{"modulePath":"github.com/dphaener/physa","version":"v0.0.32","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package newcodebase\n\nPackage 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.\n\nThe answers file read by ReadAnswers has one answer per line, as \\`1: \\\u003canswer\u003e\\` to \\`3: \\\u003canswer\u003e\\`, 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\\`.\n\n## Constants\n\n```go\nconst FewChanges = 5\n```\nFewChanges is the most changes a new codebase may have had. It is a first guess, to be tuned against real repos.\n\n## Functions\n\n```go\nfunc New(g store.Gather) bool\n```\nNew 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.\n\n```go\nfunc TitleCase(s string) string\n```\nTitleCase makes a product name from a directory name: words split at dashes, underscores, dots and spaces, each capitalised.\n\n## Types\n\n```go\ntype Answers struct {\n\tName, Promise string\n\tTerms         []Term\n}\n```\nAnswers is what the person said: the product's name and promise, and its first terms.\n\n```go\nfunc Ask(in io.Reader, out io.Writer, qs []Question) (Answers, error)\n```\nAsk prints each question as \\`1. \\\u003cquestion\u003e\\` and \\`   Suggested: \\\u003canswer\u003e\\`, 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.\n\n```go\nfunc Obtain(g store.Gather, repoName, file string, terminal bool, in io.Reader, out io.Writer) (Answers, error)\n```\nObtain gets a new codebase's answers: read from file when given, asked on out and read from in when terminal says a person is there, and otherwise an error saying how to answer. It starts no session.\n\n```go\nfunc ReadAnswers(path string, qs ...Question) (Answers, error)\n```\nReadAnswers reads the answers file at path, in the format above. Missing numbers take the suggestions in qs.\n\n```go\nfunc (a Answers) Describe(write bool) (string, map[string]any)\n```\nDescribe is what a new codebase's map will hold, in text and as the value --json prints; write says the map is being written, and without it the text adds that nothing is written without --write.\n\n```go\nfunc (a Answers) GlossaryTerms() string\n```\nGlossaryTerms renders the terms as glossary.md wants them (design 01 §4): \\`\\*\\*Name\\*\\*: meaning\\`, one per paragraph.\n\n```go\ntype Question struct {\n\tNumber    int\n\tText      string\n\tSuggested string\n}\n```\nQuestion is one numbered question with the answer Physa suggests.\n\n```go\nfunc Questions(g store.Gather, repoName string) []Question\n```\nQuestions returns the three questions, numbered 1 to 3, with suggestions drawn from the repo's directory name and its README.\n\n```go\ntype Term struct {\n\tName, Meaning string\n}\n```\nTerm is one term of the glossary with its meaning.\n\n","path":"github.com/dphaener/physa/internal/newcodebase","name":"newcodebase","synopsis":"Package newcodebase is how Physa starts a map when there is nothing to recover (design 02 §2.8).","isRedistributable":true}
