faf 8.9.0 → 8.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -20
- package/dist/cli.js +338 -331
- package/dist/cli.js.map +1 -1
- package/dist/core/dot-path.d.ts +23 -0
- package/dist/core/interview.d.ts +18 -6
- package/dist/core/suggest.d.ts +55 -0
- package/dist/detect/assemble.d.ts +4 -2
- package/dist/detect/relentless.d.ts +3 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +177 -176
- package/dist/index.js.map +1 -1
- package/dist/interrogate/readme.d.ts +9 -0
- package/dist/interrogate/types.d.ts +34 -0
- package/package.json +2 -2
- package/project.faf +5 -5
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Get a nested value from an object by dot-path (undefined when a step is missing or not a mapping). */
|
|
2
|
+
export declare function getNestedValue(obj: Record<string, unknown>, path: string): unknown;
|
|
3
|
+
/**
|
|
4
|
+
* The first intermediate step of `path` that holds something other than a
|
|
5
|
+
* mapping — a scalar or a list — as `{ at, value }`, or null when every step is
|
|
6
|
+
* a mapping or absent. Setting `path` would have to replace that value.
|
|
7
|
+
*/
|
|
8
|
+
export declare function blockingStep(obj: Record<string, unknown>, path: string): {
|
|
9
|
+
at: string;
|
|
10
|
+
value: unknown;
|
|
11
|
+
} | null;
|
|
12
|
+
/** The refusal message for a blocked `path` — names the path, the step and what is there. */
|
|
13
|
+
export declare function blockedMessage(path: string, block: {
|
|
14
|
+
at: string;
|
|
15
|
+
value: unknown;
|
|
16
|
+
}): string;
|
|
17
|
+
/**
|
|
18
|
+
* Set a nested value by dot-path. A missing (or null) intermediate step becomes
|
|
19
|
+
* a new mapping. A step that already holds anything else — a scalar or a list —
|
|
20
|
+
* is refused with an Error naming the path: the existing value is never
|
|
21
|
+
* replaced with `{}`, and `obj` is left unchanged.
|
|
22
|
+
*/
|
|
23
|
+
export declare function setNestedValue(obj: Record<string, unknown>, path: string, value: unknown): void;
|
package/dist/core/interview.d.ts
CHANGED
|
@@ -6,16 +6,21 @@
|
|
|
6
6
|
* siblings, UIs) IMPORT it — never reimplement, never copy. Decided
|
|
7
7
|
* 2026-06-10: the CLI exports, CFM consumes, zero drift. (CFM's previous
|
|
8
8
|
* hand-maintained registry had already drifted — e.g. its `how` asked "How
|
|
9
|
-
* should AI assist?" while the canonical slot semantic is "How
|
|
10
|
-
*
|
|
9
|
+
* should AI assist?" while the canonical slot semantic is "How does it work?"
|
|
10
|
+
* (the faf schema). This file is the arbiter; slots.ts is its spine.)
|
|
11
11
|
*
|
|
12
12
|
* Shape carries what interactive consumers need: question text, a short
|
|
13
13
|
* header chip, input type, required flag, select options where a closed-ish
|
|
14
14
|
* vocabulary exists. Question SEMANTICS align to core/slots.ts descriptions —
|
|
15
15
|
* the slot is the meaning, the question is just its interview voice.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* faf-facts: succinct, factual definitions for AI agents — every word earns
|
|
18
|
+
* its place. They are the human slots (the goal and six W's), not repo or
|
|
19
|
+
* stack slots: AI may only suggest them; a human reads, confirms and approves
|
|
20
|
+
* each one. Count facts, not words: one line, at most one sentence, no
|
|
21
|
+
* waffle. Short when the fact is short (where: "npm, Homebrew, GitHub"); a
|
|
22
|
+
* full line when it needs one (how: the mechanism and the choice that shapes
|
|
23
|
+
* the code).
|
|
19
24
|
*/
|
|
20
25
|
import type { SeededContextDetailed } from '../detect/relentless.js';
|
|
21
26
|
/** Bump when questions/options change — consumers can pin or report it. */
|
|
@@ -34,6 +39,10 @@ export interface InterviewQuestion<P extends string = string> {
|
|
|
34
39
|
type: 'text' | 'select';
|
|
35
40
|
required: boolean;
|
|
36
41
|
options?: InterviewOption[];
|
|
42
|
+
/** What a good answer looks like — shown in gray when there's no
|
|
43
|
+
* suggestion. The shape of an answer, never a sample answer (sample words
|
|
44
|
+
* get copied). Never written to the .faf. */
|
|
45
|
+
help?: string;
|
|
37
46
|
}
|
|
38
47
|
/**
|
|
39
48
|
* The human/sourced boundary, as TYPES — the load-bearing line in FAF.
|
|
@@ -79,6 +88,9 @@ export declare const INTERVIEW_PATHS: Record<string, InterviewQuestion>;
|
|
|
79
88
|
* otherwise derived from the slot's canonical description — so slot-driven
|
|
80
89
|
* flows (faf go) and registry-driven flows (faf_go) speak the same language.
|
|
81
90
|
*/
|
|
91
|
+
/** The help text for a slot (what a good answer looks like), or '' when the
|
|
92
|
+
* registry has none. Shown in gray by `faf go`; never written. */
|
|
93
|
+
export declare function helpForSlot(path: string): string;
|
|
82
94
|
export declare function questionForSlot(path: string): string;
|
|
83
95
|
/**
|
|
84
96
|
* The questions still worth asking for a given .faf: registry order, empty
|
|
@@ -93,8 +105,8 @@ export interface GoalSeed {
|
|
|
93
105
|
}
|
|
94
106
|
/**
|
|
95
107
|
* Seed the human-context slots from the Goal sentence — verbatim facts only.
|
|
96
|
-
* Returns a partial { what?, where
|
|
97
|
-
* human". Never returns why/when/how (not verbatim-extractable from a goal).
|
|
108
|
+
* Returns a partial { what?, where? }; absent keys = "no fact, ask the
|
|
109
|
+
* human". Never returns who/why/when/how (not verbatim-extractable from a goal).
|
|
98
110
|
*/
|
|
99
111
|
export declare function seedSixWsFromGoal(goal: string): GoalSeed;
|
|
100
112
|
export type BoxStatus = 'filled' | 'seeded' | 'empty';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intent suggestions — the goal and the six W's, as the repo suggests them.
|
|
3
|
+
*
|
|
4
|
+
* "AI cannot fill human slots. It can only suggest." `faf init` and `faf auto`
|
|
5
|
+
* never write these slots; `faf go` shows each suggestion in gray and the
|
|
6
|
+
* human confirms, edits, replaces or skips it. Nothing here is stored: the
|
|
7
|
+
* suggestions are read from the repo (README, package.json, Cargo.toml) each
|
|
8
|
+
* time they're asked for, so the .faf format stays clean and a suggestion is
|
|
9
|
+
* never staler than the file it came from.
|
|
10
|
+
*
|
|
11
|
+
* Sourced or nothing: every suggestion names where it came from
|
|
12
|
+
* (`README.md § Status`, `package.json description`).
|
|
13
|
+
*
|
|
14
|
+
* Target only. Every slot has three outcomes — Target (the validated fact for
|
|
15
|
+
* that slot), Slop (waffle, nonsense, markup) and Misplaced (good info, wrong
|
|
16
|
+
* slot) — and only a Target is suggested: every candidate passes the one gate
|
|
17
|
+
* (isValidExtraction), headings match whole, and no text is offered for two
|
|
18
|
+
* slots.
|
|
19
|
+
*
|
|
20
|
+
* Exported so other surfaces can show the same suggestions (the `/faf-go`
|
|
21
|
+
* skill and CFM's `faf_go`, via buildTableOf8 as `detailed` + `goal`); today
|
|
22
|
+
* only the CLI's `faf go` reads it.
|
|
23
|
+
*/
|
|
24
|
+
/** The human-authored slots: the goal and the six W's. */
|
|
25
|
+
export declare const INTENT_PATHS: readonly ["project.goal", "human_context.who", "human_context.what", "human_context.why", "human_context.where", "human_context.when", "human_context.how"];
|
|
26
|
+
export type IntentPath = (typeof INTENT_PATHS)[number];
|
|
27
|
+
export interface Suggestion {
|
|
28
|
+
value: string;
|
|
29
|
+
/** Where it came from: `README.md § Status`, `package.json description`. */
|
|
30
|
+
source: string;
|
|
31
|
+
}
|
|
32
|
+
export type IntentSuggestions = Partial<Record<IntentPath, Suggestion>>;
|
|
33
|
+
/** True for the goal and the six W's — slots only a human fills. */
|
|
34
|
+
export declare function isIntentPath(path: string): path is IntentPath;
|
|
35
|
+
/**
|
|
36
|
+
* Suggestions for the goal and the six W's in `dir`. When `faf` (the current
|
|
37
|
+
* .faf data) is given, a slot it already fills gets no suggestion — the
|
|
38
|
+
* human's words are never second-guessed. Precedence: README (sections, then
|
|
39
|
+
* the tagline) → package.json description → Cargo.toml description →
|
|
40
|
+
* Relentless (README + manifest, sourced).
|
|
41
|
+
*/
|
|
42
|
+
export declare function suggestIntent(dir: string, faf?: Record<string, unknown>): IntentSuggestions;
|
|
43
|
+
/** Text as a person reads it: markdown links as their words, no emphasis
|
|
44
|
+
* markers or inline HTML tags, entities as characters, one line. Real
|
|
45
|
+
* brackets and underscores stay: `arr[i]`, `Foo[T]`, `[WIP]`, `__init__.py`. */
|
|
46
|
+
export declare function asProse(text: string, refs?: ReadonlySet<string>): string;
|
|
47
|
+
/** One way to name a source, whichever reader found it: Relentless says
|
|
48
|
+
* `README:## Why` / `README:first-paragraph` / `package.json:description`;
|
|
49
|
+
* people read `README.md § Why` / `README.md § first paragraph` /
|
|
50
|
+
* `package.json description`. */
|
|
51
|
+
export declare function sourceName(source: string): string;
|
|
52
|
+
/** The one line init and auto print when suggestions are waiting, or null:
|
|
53
|
+
* `3 suggestions for the goal and the six W's (README.md, package.json) —
|
|
54
|
+
* confirm them in 'faf go'`. */
|
|
55
|
+
export declare function suggestionNote(dir: string, faf?: Record<string, unknown>): string | null;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared .faf assembly pipeline. The full slot-filling flow used to build a
|
|
3
3
|
* FRESH .faf for a directory:
|
|
4
|
-
* detect → interrogate → slotignore inactive categories → Turbo-Cat
|
|
4
|
+
* detect → interrogate → slotignore inactive categories → Turbo-Cat
|
|
5
|
+
* (the goal and six W's stay empty — suggestions, confirmed in `faf go`)
|
|
5
6
|
*
|
|
6
7
|
* Used by BOTH `faf auto` (new-file path) and `faf git` (cloned repo) so they
|
|
7
8
|
* can't drift — `faf git` previously ran detectStack alone (~33% vs ~75%).
|
|
@@ -10,7 +11,8 @@
|
|
|
10
11
|
export declare function assembleFreshFaf(dir: string): Record<string, unknown>;
|
|
11
12
|
/**
|
|
12
13
|
* Update an EXISTING .faf for `dir`. Existing values win; interrogated → detected
|
|
13
|
-
* → Turbo-Cat (formats)
|
|
14
|
+
* → Turbo-Cat (formats) fill only the remaining empties. The goal and the six
|
|
15
|
+
* W's are never filled: they're suggested (core/suggest.ts) and `faf go` asks.
|
|
14
16
|
* This is exactly the chain `faf auto` runs on an existing file — exported so
|
|
15
17
|
* consumers (faf-mcp's faf_auto) compose it instead of re-deriving it and
|
|
16
18
|
* drifting (they used to merge assembleFreshFaf's slotignore'd output over the
|
|
@@ -26,7 +26,8 @@ export interface SeededContext {
|
|
|
26
26
|
* 'package.json:description' or 'README:## Why'. If we can't name a source,
|
|
27
27
|
* we don't emit a value — sourced-or-empty, never invented.
|
|
28
28
|
* - `confidence`: 0..1 by source quality (structured field > named section >
|
|
29
|
-
*
|
|
29
|
+
* first paragraph). A signal for the seeded/confirm UI, not a score.
|
|
30
|
+
* No sentence-pattern guesses: a guess is slop, and no suggestion beats one.
|
|
30
31
|
*/
|
|
31
32
|
export interface SourcedValue {
|
|
32
33
|
value: string;
|
|
@@ -47,7 +48,7 @@ export interface SeededContextDetailed {
|
|
|
47
48
|
* human WHERE a value was relocated from before they accept it.
|
|
48
49
|
*/
|
|
49
50
|
/** `toolingRoot`: the repo root's package.json is a tooling shell (polyglot repo
|
|
50
|
-
* — real code is in sibling dirs), so its description
|
|
51
|
+
* — real code is in sibling dirs), so its description describes the
|
|
51
52
|
* tooling, not the product. Skip package.json-sourced context; README only. */
|
|
52
53
|
export interface RelentlessOpts {
|
|
53
54
|
toolingRoot?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export type { TurboCatResult, DiscoveredFormat } from './detect/turbo-cat.js';
|
|
|
33
33
|
export { relentlessContext, relentlessContextDetailed } from './detect/relentless.js';
|
|
34
34
|
export type { SeededContext, SeededContextDetailed, SourcedValue } from './detect/relentless.js';
|
|
35
35
|
export { assembleFreshFaf, updateExistingFaf, fillEmpties } from './detect/assemble.js';
|
|
36
|
+
export { suggestIntent, suggestionNote, isIntentPath, INTENT_PATHS } from './core/suggest.js';
|
|
37
|
+
export type { Suggestion, IntentSuggestions, IntentPath } from './core/suggest.js';
|
|
36
38
|
export { normalizeGitUrl, repoNameFromUrl, authorFafFromRepo } from './detect/git-repo.js';
|
|
37
39
|
export type { AuthorFafFromRepoOptions } from './detect/git-repo.js';
|
|
38
40
|
export { FafDNAManager } from './core/faf-dna.js';
|