faf-cli 7.10.1 → 7.12.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 +13 -15
- package/dist/cli.js +216 -214
- package/dist/cli.js.map +23 -21
- package/dist/core/drift.d.ts +55 -0
- package/dist/detect/assemble.d.ts +9 -0
- package/dist/detect/enrich.d.ts +11 -0
- package/dist/index.d.ts +15 -4
- package/dist/index.js +130 -118
- package/dist/index.js.map +16 -7
- package/dist/interop/agents.d.ts +15 -0
- package/dist/interop/cards.d.ts +4 -1
- package/dist/interop/claude.d.ts +35 -0
- package/dist/interop/copilot-instructions.d.ts +26 -0
- package/dist/interop/cursorrules.d.ts +5 -0
- package/dist/interop/gemini.d.ts +12 -0
- package/dist/interop/inject.d.ts +45 -0
- package/dist/interop/labels.d.ts +26 -0
- package/dist/interop/projecthtml.d.ts +3 -1
- package/dist/interop/servercard.d.ts +4 -2
- package/package.json +1 -1
- package/project.faf +3 -3
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context-drift engine — SINGLE SOURCE.
|
|
3
|
+
*
|
|
4
|
+
* A pure, snapshot comparison: given a `project.faf` and its directory, report
|
|
5
|
+
* the mtime relationship between the .faf and each AI-context file it feeds
|
|
6
|
+
* (CLAUDE.md, AGENTS.md, .cursorrules, GEMINI.md). A target NEWER than the .faf
|
|
7
|
+
* has drifted — the human edited the context file and the DNA hasn't caught up.
|
|
8
|
+
*
|
|
9
|
+
* No console, no ANSI, no process.exit. The CLI `faf drift` renders the human
|
|
10
|
+
* table on top of this; `faf drift --json` emits this shape with a metadata
|
|
11
|
+
* header; the VS Code extension imports `computeDrift` directly (faf-cli as a
|
|
12
|
+
* library, never a shell-out). One comparison, every consumer.
|
|
13
|
+
*/
|
|
14
|
+
/** AI-context files the .faf feeds — the drift targets, in report order. */
|
|
15
|
+
export declare const CONTEXT_FILES: string[];
|
|
16
|
+
/** mtime window (ms) inside which a target counts as in sync with the .faf. */
|
|
17
|
+
export declare const DRIFT_TOLERANCE_MS = 1000;
|
|
18
|
+
/** 'newer' = target newer than the .faf → needs sync. */
|
|
19
|
+
export type DriftStatus = 'newer' | 'older' | 'in-sync' | 'missing';
|
|
20
|
+
export interface DriftTarget {
|
|
21
|
+
/** Context-file name, e.g. 'CLAUDE.md'. */
|
|
22
|
+
file: string;
|
|
23
|
+
/** Whether the file exists alongside the .faf. */
|
|
24
|
+
exists: boolean;
|
|
25
|
+
/** File mtime in epoch ms, or null when missing. */
|
|
26
|
+
mtime_ms: number | null;
|
|
27
|
+
/** 'newer' = target newer than the .faf → needs sync. */
|
|
28
|
+
status: DriftStatus;
|
|
29
|
+
/** mtime_ms - source_mtime_ms, or null when missing. */
|
|
30
|
+
delta_ms: number | null;
|
|
31
|
+
}
|
|
32
|
+
export interface DriftReport {
|
|
33
|
+
/** The `project.faf` path compared against. */
|
|
34
|
+
source: string;
|
|
35
|
+
/** .faf mtime in epoch ms. */
|
|
36
|
+
source_mtime_ms: number;
|
|
37
|
+
targets: DriftTarget[];
|
|
38
|
+
/** Count of targets with status 'newer' or 'older'. */
|
|
39
|
+
drifted: number;
|
|
40
|
+
/** Count of targets with status 'in-sync'. */
|
|
41
|
+
in_sync: number;
|
|
42
|
+
/** Count of targets with status 'missing'. */
|
|
43
|
+
missing: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Compare a `project.faf` against its AI-context files by mtime.
|
|
47
|
+
*
|
|
48
|
+
* @param fafPath path to `project.faf`
|
|
49
|
+
* @param dir directory holding the context files; defaults to the .faf's
|
|
50
|
+
* own directory. Never `process.cwd()` — the CLI passes it
|
|
51
|
+
* explicitly, and a library caller (the VS Code extension)
|
|
52
|
+
* passes the .faf's directory, which for a monorepo sub-package
|
|
53
|
+
* is the package dir, not the workspace root.
|
|
54
|
+
*/
|
|
55
|
+
export declare function computeDrift(fafPath: string, dir?: string): DriftReport;
|
|
@@ -8,6 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
/** Build a fresh .faf for `dir` using the full slot-filling pipeline. */
|
|
10
10
|
export declare function assembleFreshFaf(dir: string): Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* Update an EXISTING .faf for `dir`. Existing values win; interrogated → detected
|
|
13
|
+
* → Turbo-Cat (formats) → Relentless (6 W's) fill only the remaining empties.
|
|
14
|
+
* This is exactly the chain `faf auto` runs on an existing file — exported so
|
|
15
|
+
* consumers (faf-mcp's faf_auto) compose it instead of re-deriving it and
|
|
16
|
+
* drifting (they used to merge assembleFreshFaf's slotignore'd output over the
|
|
17
|
+
* existing file, losing interrogated facts such as a docker-compose Redis).
|
|
18
|
+
*/
|
|
19
|
+
export declare function updateExistingFaf(dir: string, existing: Record<string, unknown>): Record<string, unknown>;
|
|
11
20
|
/** Fill empty/placeholder slots in `target` with values from `source`.
|
|
12
21
|
* `target` wins when its slot is non-empty. Empty here is per `isPlaceholder`
|
|
13
22
|
* (covers '', null, undefined, and known placeholder strings) — this is what
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FafData } from '../core/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Enrich .faf data with facts DETECTED from the repo at export time, so a lean
|
|
4
|
+
* or stale .faf still yields a complete AGENTS.md — the "frictionless, any repo"
|
|
5
|
+
* goal. Fill-if-absent: hand-authored .faf values always WIN; detection only
|
|
6
|
+
* fills the gaps. Pure (returns a shallow copy; never mutates the input).
|
|
7
|
+
*
|
|
8
|
+
* Detects: build/test/lint commands, key files/entry points, and secrets
|
|
9
|
+
* (.env presence — location only, never the values).
|
|
10
|
+
*/
|
|
11
|
+
export declare function enrichFromRepo(dir: string, data: FafData): FafData;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,10 +5,12 @@ export { FAF_HEX } from './ui/colors.js';
|
|
|
5
5
|
export { enrichScore, scoreFafYaml } from './core/scorer.js';
|
|
6
6
|
export { validateFaf } from './core/schema.js';
|
|
7
7
|
export { findFafFile, readFaf, readFafRaw } from './interop/faf.js';
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
8
|
+
export { computeDrift } from './core/drift.js';
|
|
9
|
+
export type { DriftReport, DriftTarget, DriftStatus } from './core/drift.js';
|
|
10
|
+
export { renderProjectHtml, generateProjectHtml, writeProjectHtml } from './interop/projecthtml.js';
|
|
11
|
+
export { buildServerCard, generateServerCard, writeServerCard, fafContextBlock, registryMeta, registryName, REGISTRY_PUBLISHER_KEY, } from './interop/servercard.js';
|
|
10
12
|
export type { ServerCardOptions } from './interop/servercard.js';
|
|
11
|
-
export { projectCards, readFafa, findFafaFile, generateA2ACard, upsertCatalog, A2A_CONTEXT_URI, } from './interop/cards.js';
|
|
13
|
+
export { projectCards, readFafa, findFafaFile, buildA2ACard, generateA2ACard, upsertCatalog, A2A_CONTEXT_URI, } from './interop/cards.js';
|
|
12
14
|
export type { FafaDoc, CardTarget, ProjectedCards } from './interop/cards.js';
|
|
13
15
|
export { Soul as FafmSoul, fromClaudeDir, canonicalPriority, utcNow, PRIORITY_ORDER, PRIORITY_RANK, KNOWLEDGE_TYPES, } from './fafm/index.js';
|
|
14
16
|
export type { Fact as FafmFact, SoulDoc, Profile as FafmProfile } from './fafm/index.js';
|
|
@@ -22,5 +24,14 @@ export { turboCatScan, turboCatSlots } from './detect/turbo-cat.js';
|
|
|
22
24
|
export type { TurboCatResult, DiscoveredFormat } from './detect/turbo-cat.js';
|
|
23
25
|
export { relentlessContext, relentlessContextDetailed } from './detect/relentless.js';
|
|
24
26
|
export type { SeededContext, SeededContextDetailed, SourcedValue } from './detect/relentless.js';
|
|
25
|
-
export { assembleFreshFaf } from './detect/assemble.js';
|
|
27
|
+
export { assembleFreshFaf, updateExistingFaf, fillEmpties } from './detect/assemble.js';
|
|
28
|
+
export { renderAgentsMd, writeAgentsMd } from './interop/agents.js';
|
|
29
|
+
export { renderGeminiMd, writeGeminiMd } from './interop/gemini.js';
|
|
30
|
+
export { renderCursorrules, writeCursorrules } from './interop/cursorrules.js';
|
|
31
|
+
export { renderCopilotInstructions, writeCopilotInstructions } from './interop/copilot-instructions.js';
|
|
32
|
+
export { renderClaudeMd, writeClaudeMd, readClaudeMd, parseClaudeMd, fafMetaTag } from './interop/claude.js';
|
|
33
|
+
export type { FafMetaOpts } from './interop/claude.js';
|
|
34
|
+
export { injectFafBlock, findFafBlock, FAF_START, FAF_END } from './interop/inject.js';
|
|
35
|
+
export { enrichFromRepo } from './detect/enrich.js';
|
|
36
|
+
export { serializeFaf, writeFaf } from './interop/faf.js';
|
|
26
37
|
export * as kernel from './wasm/kernel.js';
|