faf 8.10.0 → 8.11.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.
@@ -5,11 +5,13 @@ import type { FafData } from '../core/types.js';
5
5
  * Deterministic projection from curated TRUTH — facts, not hallucinated prose
6
6
  * (Gloaguen: LLM freewrite hurts). Sections: orientation · setup · verify ·
7
7
  * map · conventions · three-tier guardrails · DoD · when stuck · security ·
8
- * commit. Human Context (who/why marketing) is intentionally omitted — that
9
- * belongs in README / project.faf, not agent ops.
8
+ * commit · project facts. AGENTS.md does not copy the six W's: it points to
9
+ * the facts file (project.faf), which holds them. GEMINI.md, .cursorrules,
10
+ * CLAUDE.md and Copilot carry them (labels.ts sixWsFilled).
10
11
  *
11
12
  * Design: BETTER guide + hand exemplar (faf-cli AGENTS.md) + agents-md-facts.
12
13
  */
13
- export declare function renderAgentsMd(data: FafData): string;
14
- /** Write AGENTS.md — non-destructive: injects/updates the faf block, preserves the rest. */
15
- export declare function writeAgentsMd(dir: string, data: FafData): void;
14
+ export declare function renderAgentsMd(data: FafData, factsRef?: string): string;
15
+ /** Write AGENTS.md — non-destructive: injects/updates the faf block, preserves the rest.
16
+ * factsRef: the facts file's path relative to `dir` (default `project.faf`). */
17
+ export declare function writeAgentsMd(dir: string, data: FafData, factsRef?: string): void;
@@ -34,6 +34,6 @@ export interface FafMetaOpts {
34
34
  */
35
35
  export declare function fafMetaTag(data: FafData, opts?: FafMetaOpts): string;
36
36
  /** Render CLAUDE.md content from .faf data */
37
- export declare function renderClaudeMd(data: FafData): string;
37
+ export declare function renderClaudeMd(data: FafData, factsRef?: string): string;
38
38
  /** Extract project data from CLAUDE.md content (pull direction) */
39
39
  export declare function parseClaudeMd(content: string): Partial<FafData>;
@@ -18,10 +18,10 @@ import type { FafData } from '../core/types.js';
18
18
  * already consume the richer slots Option B will add (test/lint/run, …), so this
19
19
  * emitter is built once and grows with the data.
20
20
  */
21
- export declare function renderCopilotInstructions(data: FafData): string;
21
+ export declare function renderCopilotInstructions(data: FafData, factsRef?: string): string;
22
22
  /**
23
23
  * Write `.github/copilot-instructions.md` — non-destructive (injects/updates the
24
24
  * faf block, preserves the rest). Creates the `.github/` directory if absent.
25
25
  * The project folder is the boundary: a `.github` linked outside it is refused.
26
26
  */
27
- export declare function writeCopilotInstructions(dir: string, data: FafData): void;
27
+ export declare function writeCopilotInstructions(dir: string, data: FafData, factsRef?: string): void;
@@ -1,5 +1,5 @@
1
1
  import type { FafData } from '../core/types.js';
2
2
  /** Render .cursorrules content from .faf data */
3
- export declare function renderCursorrules(data: FafData): string;
3
+ export declare function renderCursorrules(data: FafData, factsRef?: string): string;
4
4
  /** Write .cursorrules — non-destructive: injects/updates the faf block (hash-comment markers), preserves the rest. */
5
- export declare function writeCursorrules(dir: string, data: FafData): void;
5
+ export declare function writeCursorrules(dir: string, data: FafData, factsRef?: string): void;
@@ -79,6 +79,9 @@ export interface WriteFafOptions {
79
79
  * overwrite (`faf init --new` / `--force`, `faf git --force`). Default: an existing
80
80
  * file is updated in place with {@link updateFafFile}. */
81
81
  replace?: boolean;
82
+ /** Called when `replace` overwrote an existing file after keeping
83
+ * `path.bak-<timestamp>`. */
84
+ onReplacedBackup?: (backupPath: string) => void;
82
85
  /** Called for each alias of an existing file that `data` would change
83
86
  * (`stack: *base` while `data.stack` has more keys): faf leaves it as
84
87
  * written — it never replaces or expands an alias — and that path is not
@@ -139,3 +142,16 @@ export declare function findFafFile(dir?: string): string | null;
139
142
  * tracked AND untracked .faf (it's the cwd's location under the root, not file status).
140
143
  * Caller must already be inside a git repo. */
141
144
  export declare function gitRepoRel(fafPath: string, cwd?: string): string;
145
+ /**
146
+ * How the context files faf writes into `dir` name the facts file: the AGENTS.md
147
+ * pointer, the `claim=` stamp and the "Authored from" line. One rule for every
148
+ * file: the path from `dir` (the folder faf writes into, the project folder by
149
+ * default) to the real facts file, also for a file in a subfolder such as
150
+ * `.github/copilot-instructions.md`. It names the facts file; it is not a link
151
+ * relative to each file. It finds a legacy `.faf` or a project.faf one folder
152
+ * up, and uses real paths so a symlinked folder still resolves. When `dir` is
153
+ * outside the project (an `--output` elsewhere), the path would climb out and
154
+ * carry this machine's folders into a file meant to be shared, so it is the
155
+ * file name alone.
156
+ */
157
+ export declare function factsRefFor(dir: string, fafPath: string): string;
@@ -7,6 +7,6 @@ import type { FafData } from '../core/types.js';
7
7
  * required actions — not the AGENTS.md BETTER ladder, which is a different
8
8
  * spec for a different reader.
9
9
  */
10
- export declare function renderGeminiMd(data: FafData): string;
10
+ export declare function renderGeminiMd(data: FafData, factsRef?: string): string;
11
11
  /** Write GEMINI.md — non-destructive: injects/updates the faf block, preserves the rest. */
12
- export declare function writeGeminiMd(dir: string, data: FafData): void;
12
+ export declare function writeGeminiMd(dir: string, data: FafData, factsRef?: string): void;
@@ -17,6 +17,35 @@ export declare const ACRONYMS: Set<string>;
17
17
  export declare function titleLabel(key: string): string;
18
18
  /** A slot value that carries real content (not empty, not slotignored). */
19
19
  export declare function filled(v: unknown): v is string;
20
+ /**
21
+ * A six-W value as one line of text, or null when the slot does not count as
22
+ * filled. Same rule as the scorer: empty, `slotignored` and placeholder words
23
+ * (TBD, None, N/A, …; isPlaceholder) are not facts. Numbers, booleans, dates
24
+ * and lists are facts and render as text. Line breaks and runs of spaces
25
+ * become one space, so a value never opens a new line in the host file. Files
26
+ * that put a bullet or comment marker before each value (CLAUDE.md, GEMINI.md,
27
+ * .cursorrules, Copilot, MEMORY.md) are then safe; llms.txt writes values on
28
+ * their own line and escapes a leading Markdown marker itself (llms.ts).
29
+ * One slot, one fact, one line.
30
+ */
31
+ export declare function factText(v: unknown): string | null;
32
+ /**
33
+ * The fact at `path` in .faf data as one line (factText), with numbers as
34
+ * written in the file. YAML reads an unquoted `2026.10`, `0x1F` or `1e3` as a
35
+ * number and loses the text; this puts it back from the file faf read, so every
36
+ * context file shows what the person wrote. Data that was not read from a file
37
+ * (no source recorded) renders as before.
38
+ */
39
+ export declare function factAt(data: object, path: readonly string[]): string | null;
40
+ /**
41
+ * The filled six W's, in fixed order, as [label, value] pairs ("Who", "What",
42
+ * "Why", "Where", "When", "How"). One source for every context file faf writes
43
+ * (CLAUDE.md, GEMINI.md, .cursorrules, Copilot), so they agree word for word.
44
+ * Each renderer formats the pairs in its host file's own style.
45
+ */
46
+ export declare function sixWsFilled(data: {
47
+ human_context?: unknown;
48
+ }): [string, string][];
20
49
  /**
21
50
  * The canonical display label for a .faf slot path, sourced from the slot
22
51
  * registry ("know your stack") — `stack.cicd` → "CI/CD", `stack.api_type` → "API".
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "faf",
3
- "version": "8.10.0",
4
- "description": "Persistent AI context + memory — .faf and .fafm, IANA-registered. AI suggests your goal and six W's; you confirm. Anthropic-merged.",
3
+ "version": "8.11.0",
4
+ "description": "Persistent AI context + memory — .faf and .fafm, IANA-registered. AI suggests your goal and six W's, you confirm, and every agent file faf writes carries them. Anthropic-merged.",
5
5
  "type": "module",
6
6
  "icon": "https://faf.one/orange-smiley.svg",
7
7
  "logo": "https://faf.one/orange-smiley.svg",
package/project.faf CHANGED
@@ -1,7 +1,7 @@
1
1
  faf_version: "3.0"
2
2
  project:
3
3
  name: faf-cli
4
- version: "8.10.0"
4
+ version: "8.11.0"
5
5
  goal: "CLI for IANA-registered .faf + .fafm — context DNA and portable agent memory, scored by the always-33 engine"
6
6
  main_language: TypeScript
7
7
  type: cli # found: package.json bin