newcodebase

package
v0.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package newcodebase is how Physa starts a map when there is nothing to recover (design 02 §2.8). It detects a new codebase from the gather, then asks a person a short round of numbered questions, each with a suggested answer, to write the product's promise and first terms, or reads the answers from a file. It never guesses for the person: a suggestion is used only when the person accepts it. It calls no agent and writes no file.

The answers file read by ReadAnswers has one answer per line, as `1: <answer>` to `3: <answer>`, numbered as Questions numbers them. Blank lines and lines starting with `#` are ignored. A number left out takes the suggestion of the questions passed in; with none to take, the name and the promise are errors and the terms are none. The first colon ends the number, so a term's own colon stays in the answer, as in `3: Cut list: The parts`.

Index

Constants

View Source
const FewChanges = 5

FewChanges is the most changes a new codebase may have had. It is a first guess, to be tuned against real repos.

Variables

This section is empty.

Functions

func New

func New(g store.Gather) bool

New reports whether the gather is of a new codebase: no agent doc, contributing guide, overview doc or decision record (a README alone does not count, since generators write one), no PRs, and at most FewChanges changes.

func TitleCase

func TitleCase(s string) string

TitleCase makes a product name from a directory name: words split at dashes, underscores, dots and spaces, each capitalised.

Types

type Answers

type Answers struct {
	Name, Promise string
	Terms         []Term
}

Answers is what the person said: the product's name and promise, and its first terms.

func Ask

func Ask(in io.Reader, out io.Writer, qs []Question) (Answers, error)

Ask prints each question as `1. <question>` and ` Suggested: <answer>`, and reads one line. An empty line or `yes` accepts the suggestion. An answer that fails its check (a promise still holding …, a term without a meaning) is asked again, at most twice, then it is an error. Input that ends before an answer is an error: Ask never answers for the person.

func ReadAnswers

func ReadAnswers(path string, qs ...Question) (Answers, error)

ReadAnswers reads the answers file at path, in the format above. Missing numbers take the suggestions in qs.

func (Answers) GlossaryTerms

func (a Answers) GlossaryTerms() string

GlossaryTerms renders the terms as glossary.md wants them (design 01 §4): `**Name**: meaning`, one per paragraph.

type Question

type Question struct {
	Number    int
	Text      string
	Suggested string
}

Question is one numbered question with the answer Physa suggests.

func Questions

func Questions(g store.Gather, repoName string) []Question

Questions returns the three questions, numbered 1 to 3, with suggestions drawn from the repo's directory name and its README.

type Term

type Term struct {
	Name, Meaning string
}

Term is one term of the glossary with its meaning.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL