@context-forge/core 0.19.17 → 0.19.19
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/dist/adoption/adoptionCompletion.d.ts +16 -0
- package/dist/adoption/adoptionCompletion.d.ts.map +1 -0
- package/dist/adoption/adoptionCompletion.js +37 -0
- package/dist/adoption/adoptionCompletion.js.map +1 -0
- package/dist/adoption/adoptionFacts.d.ts +4 -2
- package/dist/adoption/adoptionFacts.d.ts.map +1 -1
- package/dist/adoption/adoptionFacts.js +72 -7
- package/dist/adoption/adoptionFacts.js.map +1 -1
- package/dist/adoption/adoptionOutcome.d.ts +3 -0
- package/dist/adoption/adoptionOutcome.d.ts.map +1 -1
- package/dist/adoption/adoptionOutcome.js.map +1 -1
- package/dist/adoption/adoptionResolver.d.ts +2 -1
- package/dist/adoption/adoptionResolver.d.ts.map +1 -1
- package/dist/adoption/adoptionResolver.js +50 -12
- package/dist/adoption/adoptionResolver.js.map +1 -1
- package/dist/adoption/contracts.d.ts +5 -0
- package/dist/adoption/contracts.d.ts.map +1 -1
- package/dist/adoption/contracts.js +0 -3
- package/dist/adoption/contracts.js.map +1 -1
- package/dist/adoption/index.d.ts +1 -0
- package/dist/adoption/index.d.ts.map +1 -1
- package/dist/adoption/index.js +1 -0
- package/dist/adoption/index.js.map +1 -1
- package/dist/detection/comprehensionAnalysis.d.ts +7 -0
- package/dist/detection/comprehensionAnalysis.d.ts.map +1 -0
- package/dist/detection/comprehensionAnalysis.js +59 -0
- package/dist/detection/comprehensionAnalysis.js.map +1 -0
- package/dist/detection/index.d.ts +4 -0
- package/dist/detection/index.d.ts.map +1 -1
- package/dist/detection/index.js +4 -0
- package/dist/detection/index.js.map +1 -1
- package/dist/detection/planningArtifacts.d.ts +15 -3
- package/dist/detection/planningArtifacts.d.ts.map +1 -1
- package/dist/detection/planningArtifacts.js +38 -6
- package/dist/detection/planningArtifacts.js.map +1 -1
- package/dist/detection/presentPaths.d.ts +5 -0
- package/dist/detection/presentPaths.d.ts.map +1 -1
- package/dist/detection/presentPaths.js +12 -2
- package/dist/detection/presentPaths.js.map +1 -1
- package/dist/detection/sourceVolume.d.ts.map +1 -1
- package/dist/detection/sourceVolume.js +1 -0
- package/dist/detection/sourceVolume.js.map +1 -1
- package/dist/detection/squadronProbe.d.ts +56 -0
- package/dist/detection/squadronProbe.d.ts.map +1 -0
- package/dist/detection/squadronProbe.js +103 -0
- package/dist/detection/squadronProbe.js.map +1 -0
- package/dist/docs-map/discoverDocs.d.ts +14 -0
- package/dist/docs-map/discoverDocs.d.ts.map +1 -0
- package/dist/docs-map/discoverDocs.js +122 -0
- package/dist/docs-map/discoverDocs.js.map +1 -0
- package/dist/docs-map/docsMapError.d.ts +11 -0
- package/dist/docs-map/docsMapError.d.ts.map +1 -0
- package/dist/docs-map/docsMapError.js +23 -0
- package/dist/docs-map/docsMapError.js.map +1 -0
- package/dist/docs-map/docsMapFile.d.ts +24 -0
- package/dist/docs-map/docsMapFile.d.ts.map +1 -0
- package/dist/docs-map/docsMapFile.js +142 -0
- package/dist/docs-map/docsMapFile.js.map +1 -0
- package/dist/docs-map/index.d.ts +4 -0
- package/dist/docs-map/index.d.ts.map +1 -0
- package/dist/docs-map/index.js +3 -0
- package/dist/docs-map/index.js.map +1 -0
- package/dist/docs-map/renderDocsMap.d.ts +10 -0
- package/dist/docs-map/renderDocsMap.d.ts.map +1 -0
- package/dist/docs-map/renderDocsMap.js +44 -0
- package/dist/docs-map/renderDocsMap.js.map +1 -0
- package/dist/guides/guideMinimum.d.ts +1 -1
- package/dist/guides/guideMinimum.js +1 -1
- package/dist/introspection/ConsistencyChecker.d.ts.map +1 -1
- package/dist/introspection/ConsistencyChecker.js +15 -4
- package/dist/introspection/ConsistencyChecker.js.map +1 -1
- package/dist/introspection/WorkflowNavigator.d.ts +12 -15
- package/dist/introspection/WorkflowNavigator.d.ts.map +1 -1
- package/dist/introspection/WorkflowNavigator.js +99 -53
- package/dist/introspection/WorkflowNavigator.js.map +1 -1
- package/dist/introspection/adoptionNavigation.d.ts +40 -0
- package/dist/introspection/adoptionNavigation.d.ts.map +1 -0
- package/dist/introspection/adoptionNavigation.js +190 -0
- package/dist/introspection/adoptionNavigation.js.map +1 -0
- package/dist/introspection/parsers/existingStatePlan.d.ts +7 -0
- package/dist/introspection/parsers/existingStatePlan.d.ts.map +1 -0
- package/dist/introspection/parsers/existingStatePlan.js +22 -0
- package/dist/introspection/parsers/existingStatePlan.js.map +1 -0
- package/dist/introspection/parsers/slicePlanParser.d.ts.map +1 -1
- package/dist/introspection/parsers/slicePlanParser.js +10 -1
- package/dist/introspection/parsers/slicePlanParser.js.map +1 -1
- package/dist/introspection/retroactiveRules.d.ts +17 -0
- package/dist/introspection/retroactiveRules.d.ts.map +1 -0
- package/dist/introspection/retroactiveRules.js +100 -0
- package/dist/introspection/retroactiveRules.js.map +1 -0
- package/dist/introspection/reviewGate.d.ts +24 -1
- package/dist/introspection/reviewGate.d.ts.map +1 -1
- package/dist/introspection/reviewGate.js +24 -0
- package/dist/introspection/reviewGate.js.map +1 -1
- package/dist/introspection/statusDerivation.d.ts +19 -1
- package/dist/introspection/statusDerivation.d.ts.map +1 -1
- package/dist/introspection/statusDerivation.js +24 -0
- package/dist/introspection/statusDerivation.js.map +1 -1
- package/dist/introspection/types.d.ts +8 -0
- package/dist/introspection/types.d.ts.map +1 -1
- package/dist/introspection/types.js.map +1 -1
- package/dist/node.d.ts +2 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +4 -0
- package/dist/node.js.map +1 -1
- package/dist/ruleReconciliation/index.d.ts +5 -0
- package/dist/ruleReconciliation/index.d.ts.map +1 -0
- package/dist/ruleReconciliation/index.js +5 -0
- package/dist/ruleReconciliation/index.js.map +1 -0
- package/dist/ruleReconciliation/markers.d.ts +20 -0
- package/dist/ruleReconciliation/markers.d.ts.map +1 -0
- package/dist/ruleReconciliation/markers.js +20 -0
- package/dist/ruleReconciliation/markers.js.map +1 -0
- package/dist/ruleReconciliation/projectSources.d.ts +29 -0
- package/dist/ruleReconciliation/projectSources.d.ts.map +1 -0
- package/dist/ruleReconciliation/projectSources.js +80 -0
- package/dist/ruleReconciliation/projectSources.js.map +1 -0
- package/dist/ruleReconciliation/schema.d.ts +24 -0
- package/dist/ruleReconciliation/schema.d.ts.map +1 -0
- package/dist/ruleReconciliation/schema.js +77 -0
- package/dist/ruleReconciliation/schema.js.map +1 -0
- package/dist/ruleReconciliation/store.d.ts +6 -0
- package/dist/ruleReconciliation/store.d.ts.map +1 -0
- package/dist/ruleReconciliation/store.js +56 -0
- package/dist/ruleReconciliation/store.js.map +1 -0
- package/dist/schema/frontmatterSchema.d.ts.map +1 -1
- package/dist/schema/frontmatterSchema.js +3 -0
- package/dist/schema/frontmatterSchema.js.map +1 -1
- package/dist/schema/projectSchema.d.ts +2 -0
- package/dist/schema/projectSchema.d.ts.map +1 -1
- package/dist/schema/projectSchema.js +2 -0
- package/dist/schema/projectSchema.js.map +1 -1
- package/dist/services/ContextIntegrator.d.ts.map +1 -1
- package/dist/services/ContextIntegrator.js +2 -0
- package/dist/services/ContextIntegrator.js.map +1 -1
- package/dist/services/CoreServiceFactory.d.ts +4 -0
- package/dist/services/CoreServiceFactory.d.ts.map +1 -1
- package/dist/services/CoreServiceFactory.js +7 -1
- package/dist/services/CoreServiceFactory.js.map +1 -1
- package/dist/services/SectionBuilder.d.ts.map +1 -1
- package/dist/services/SectionBuilder.js +3 -0
- package/dist/services/SectionBuilder.js.map +1 -1
- package/dist/types/context.d.ts +2 -0
- package/dist/types/context.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/detection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAwC,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAoB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/detection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAwC,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAoB,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AACvG,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,+BAA+B,GAIhC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
/** nnn-arch.*.md
|
|
2
|
-
export declare const
|
|
3
|
-
/**
|
|
1
|
+
/** nnn-arch.*.md and nnn-hld.*.md, as ProjectModelBuilder parses them. */
|
|
2
|
+
export declare const ARCHITECTURE_FILE_PATTERN: RegExp;
|
|
3
|
+
/** nnn-slices.*.md, as ProjectModelBuilder parses them. */
|
|
4
|
+
export declare const SLICE_PLAN_FILE_PATTERN: RegExp;
|
|
5
|
+
/** The 3-digit index prefix of a planning file name. */
|
|
6
|
+
export declare function fileIndexOf(path: string): string;
|
|
7
|
+
/** Orders absolute paths by the 3-digit index of the file name, then by full path. */
|
|
8
|
+
export declare function compareByFileIndex(a: string, b: string): number;
|
|
9
|
+
/**
|
|
10
|
+
* Absolute paths of the planning artifacts under `root`, sorted lexically by full path (not by
|
|
11
|
+
* file-name index; callers that need index order sort with `compareByFileIndex`). Empty means
|
|
12
|
+
* not yet planned.
|
|
13
|
+
*/
|
|
4
14
|
export declare function findPlanningArtifacts(root: string): Promise<string[]>;
|
|
15
|
+
/** Absolute paths of the architecture artifacts under `root`, ordered by file-name index (R3). */
|
|
16
|
+
export declare function findArchitectureArtifacts(root: string): Promise<string[]>;
|
|
5
17
|
//# sourceMappingURL=planningArtifacts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planningArtifacts.d.ts","sourceRoot":"","sources":["../../src/detection/planningArtifacts.ts"],"names":[],"mappings":"AAWA,
|
|
1
|
+
{"version":3,"file":"planningArtifacts.d.ts","sourceRoot":"","sources":["../../src/detection/planningArtifacts.ts"],"names":[],"mappings":"AAWA,0EAA0E;AAC1E,eAAO,MAAM,yBAAyB,QAAgC,CAAC;AAEvE,2DAA2D;AAC3D,eAAO,MAAM,uBAAuB,QAA4B,CAAC;AAEjE,wDAAwD;AACxD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAK/D;AAsBD;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAY3E;AAED,kGAAkG;AAClG,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAU/E"}
|
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
// "Already planned" check (slice 261, D6): a planning artifact file exists.
|
|
2
2
|
// A concept (000-concept.*) is not a planning artifact.
|
|
3
3
|
import { readdir } from 'fs/promises';
|
|
4
|
-
import { join } from 'path';
|
|
4
|
+
import { basename, join } from 'path';
|
|
5
5
|
import { AdoptionError } from '../adoption/contracts.js';
|
|
6
6
|
import { INITIATIVE_PLAN_FILE_PATTERN } from '../introspection/ArtifactIntrospector.js';
|
|
7
7
|
import { isEnoent } from './pathPresent.js';
|
|
8
8
|
const PROJECT_GUIDES_DIR = join('project-documents', 'user', 'project-guides');
|
|
9
9
|
const ARCHITECTURE_DIR = join('project-documents', 'user', 'architecture');
|
|
10
|
-
/** nnn-arch.*.md
|
|
11
|
-
export const
|
|
10
|
+
/** nnn-arch.*.md and nnn-hld.*.md, as ProjectModelBuilder parses them. */
|
|
11
|
+
export const ARCHITECTURE_FILE_PATTERN = /^\d{3}-(arch|hld)\..+\.md$/i;
|
|
12
|
+
/** nnn-slices.*.md, as ProjectModelBuilder parses them. */
|
|
13
|
+
export const SLICE_PLAN_FILE_PATTERN = /^\d{3}-slices\..+\.md$/i;
|
|
14
|
+
/** The 3-digit index prefix of a planning file name. */
|
|
15
|
+
export function fileIndexOf(path) {
|
|
16
|
+
return basename(path).slice(0, 3);
|
|
17
|
+
}
|
|
18
|
+
/** Orders absolute paths by the 3-digit index of the file name, then by full path. */
|
|
19
|
+
export function compareByFileIndex(a, b) {
|
|
20
|
+
const indexA = fileIndexOf(a);
|
|
21
|
+
const indexB = fileIndexOf(b);
|
|
22
|
+
if (indexA !== indexB)
|
|
23
|
+
return indexA < indexB ? -1 : 1;
|
|
24
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
25
|
+
}
|
|
26
|
+
function isPlanningArtifactName(name) {
|
|
27
|
+
return ARCHITECTURE_FILE_PATTERN.test(name) || SLICE_PLAN_FILE_PATTERN.test(name);
|
|
28
|
+
}
|
|
12
29
|
const OVERRIDE_REMEDY = 'To skip detection run `cf config set adoption.state in_progress` or `cf config set adoption.state declined`.';
|
|
13
30
|
/** File names in a directory; a missing directory (ENOENT) has none. Other errors throw. */
|
|
14
31
|
async function listFileNames(dir) {
|
|
@@ -24,17 +41,32 @@ async function listFileNames(dir) {
|
|
|
24
41
|
});
|
|
25
42
|
}
|
|
26
43
|
}
|
|
27
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Absolute paths of the planning artifacts under `root`, sorted lexically by full path (not by
|
|
46
|
+
* file-name index; callers that need index order sort with `compareByFileIndex`). Empty means
|
|
47
|
+
* not yet planned.
|
|
48
|
+
*/
|
|
28
49
|
export async function findPlanningArtifacts(root) {
|
|
29
50
|
const guidesDir = join(root, PROJECT_GUIDES_DIR);
|
|
30
51
|
const archDir = join(root, ARCHITECTURE_DIR);
|
|
31
52
|
const [guideNames, archNames] = await Promise.all([listFileNames(guidesDir), listFileNames(archDir)]);
|
|
32
53
|
const found = [
|
|
33
54
|
...guideNames
|
|
34
|
-
.filter((name) => INITIATIVE_PLAN_FILE_PATTERN.test(name) ||
|
|
55
|
+
.filter((name) => INITIATIVE_PLAN_FILE_PATTERN.test(name) || isPlanningArtifactName(name))
|
|
35
56
|
.map((name) => join(guidesDir, name)),
|
|
36
|
-
...archNames.filter(
|
|
57
|
+
...archNames.filter(isPlanningArtifactName).map((name) => join(archDir, name)),
|
|
37
58
|
];
|
|
38
59
|
return found.sort();
|
|
39
60
|
}
|
|
61
|
+
/** Absolute paths of the architecture artifacts under `root`, ordered by file-name index (R3). */
|
|
62
|
+
export async function findArchitectureArtifacts(root) {
|
|
63
|
+
const guidesDir = join(root, PROJECT_GUIDES_DIR);
|
|
64
|
+
const archDir = join(root, ARCHITECTURE_DIR);
|
|
65
|
+
const [guideNames, archNames] = await Promise.all([listFileNames(guidesDir), listFileNames(archDir)]);
|
|
66
|
+
const found = [
|
|
67
|
+
...guideNames.filter((name) => ARCHITECTURE_FILE_PATTERN.test(name)).map((name) => join(guidesDir, name)),
|
|
68
|
+
...archNames.filter((name) => ARCHITECTURE_FILE_PATTERN.test(name)).map((name) => join(archDir, name)),
|
|
69
|
+
];
|
|
70
|
+
return found.sort(compareByFileIndex);
|
|
71
|
+
}
|
|
40
72
|
//# sourceMappingURL=planningArtifacts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planningArtifacts.js","sourceRoot":"","sources":["../../src/detection/planningArtifacts.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,wDAAwD;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"planningArtifacts.js","sourceRoot":"","sources":["../../src/detection/planningArtifacts.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,wDAAwD;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAC/E,MAAM,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;AAE3E,0EAA0E;AAC1E,MAAM,CAAC,MAAM,yBAAyB,GAAG,6BAA6B,CAAC;AAEvE,2DAA2D;AAC3D,MAAM,CAAC,MAAM,uBAAuB,GAAG,yBAAyB,CAAC;AAEjE,wDAAwD;AACxD,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,kBAAkB,CAAC,CAAS,EAAE,CAAS;IACrD,MAAM,MAAM,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,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;KACvG,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export declare const DOC_PATHS: readonly string[];
|
|
2
2
|
export declare const ADR_DIRS: readonly string[];
|
|
3
3
|
export declare const RULE_FILE_PATHS: readonly string[];
|
|
4
|
+
/**
|
|
5
|
+
* The rule files `setup-ide` writes a managed block into: the project's own text
|
|
6
|
+
* sits outside the block. Every other `RULE_FILE_PATHS` entry is project-owned whole.
|
|
7
|
+
*/
|
|
8
|
+
export declare const COMPOSITE_RULE_FILES: readonly string[];
|
|
4
9
|
/** The candidates (relative to root) that exist, in candidate order. Non-ENOENT errors throw. */
|
|
5
10
|
export declare function presentPaths(root: string, candidates: readonly string[]): string[];
|
|
6
11
|
//# sourceMappingURL=presentPaths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentPaths.d.ts","sourceRoot":"","sources":["../../src/detection/presentPaths.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,SAAS,EAAE,SAAS,MAAM,EAA2C,CAAC;AAEnF,eAAO,MAAM,QAAQ,EAAE,SAAS,MAAM,EAQrC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"presentPaths.d.ts","sourceRoot":"","sources":["../../src/detection/presentPaths.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,SAAS,EAAE,SAAS,MAAM,EAA2C,CAAC;AAEnF,eAAO,MAAM,QAAQ,EAAE,SAAS,MAAM,EAQrC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAU5C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAIjD,CAAC;AAEF,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAElF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Presence-only facts for the Adoption Facts section (slice 261, D5). Core records
|
|
2
|
-
// which well-known paths exist; it never reads them for meaning.
|
|
3
|
-
//
|
|
2
|
+
// which well-known paths exist; it never reads them for meaning. Exported from
|
|
3
|
+
// detection/index.ts: rule reconciliation (slice 266) enumerates the same list.
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
import { pathPresent } from './pathPresent.js';
|
|
6
6
|
export const DOC_PATHS = ['README.md', 'README', 'docs', 'doc'];
|
|
@@ -21,8 +21,18 @@ export const RULE_FILE_PATHS = [
|
|
|
21
21
|
'.cursor/rules',
|
|
22
22
|
'.windsurfrules',
|
|
23
23
|
'.github/copilot-instructions.md',
|
|
24
|
+
'.github/instructions',
|
|
24
25
|
'.claude/rules',
|
|
25
26
|
];
|
|
27
|
+
/**
|
|
28
|
+
* The rule files `setup-ide` writes a managed block into: the project's own text
|
|
29
|
+
* sits outside the block. Every other `RULE_FILE_PATHS` entry is project-owned whole.
|
|
30
|
+
*/
|
|
31
|
+
export const COMPOSITE_RULE_FILES = [
|
|
32
|
+
'CLAUDE.md',
|
|
33
|
+
'AGENTS.md',
|
|
34
|
+
'.github/copilot-instructions.md',
|
|
35
|
+
];
|
|
26
36
|
/** The candidates (relative to root) that exist, in candidate order. Non-ENOENT errors throw. */
|
|
27
37
|
export function presentPaths(root, candidates) {
|
|
28
38
|
return candidates.filter((candidate) => pathPresent(join(root, candidate)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentPaths.js","sourceRoot":"","sources":["../../src/detection/presentPaths.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF
|
|
1
|
+
{"version":3,"file":"presentPaths.js","sourceRoot":"","sources":["../../src/detection/presentPaths.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,+EAA+E;AAC/E,gFAAgF;AAChF,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,CAAC,MAAM,SAAS,GAAsB,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAEnF,MAAM,CAAC,MAAM,QAAQ,GAAsB;IACzC,UAAU;IACV,WAAW;IACX,gBAAgB;IAChB,6BAA6B;IAC7B,SAAS;IACT,KAAK;IACL,MAAM;CACP,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAsB;IAChD,WAAW;IACX,WAAW;IACX,WAAW;IACX,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,iCAAiC;IACjC,sBAAsB;IACtB,eAAe;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAsB;IACrD,WAAW;IACX,WAAW;IACX,iCAAiC;CAClC,CAAC;AAEF,iGAAiG;AACjG,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,UAA6B;IACtE,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sourceVolume.d.ts","sourceRoot":"","sources":["../../src/detection/sourceVolume.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"sourceVolume.d.ts","sourceRoot":"","sources":["../../src/detection/sourceVolume.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAG9C,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAI1C,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,qBAAqB,QAAa,CAAC;AAEhD,qFAAqF;AACrF,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAyEvC,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAQ7E"}
|
|
@@ -6,6 +6,7 @@ import { isEnoent, isFsError } from './pathPresent.js';
|
|
|
6
6
|
/** Extensions (lowercase, no dot) counted as source. Adding a language is a one-line edit. */
|
|
7
7
|
export const SOURCE_EXTENSIONS = [
|
|
8
8
|
'ts', 'tsx', 'js', 'jsx', 'py', 'rb', 'go', 'rs', 'java', 'kt', 'swift', 'c', 'h', 'cpp', 'cs', 'php',
|
|
9
|
+
'sh', 'dart', 'vue', 'svelte', 'scala', 'lua', 'ex',
|
|
9
10
|
];
|
|
10
11
|
/** Directories never walked, besides any directory whose name starts with a dot. */
|
|
11
12
|
export const EXCLUDED_DIRS = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sourceVolume.js","sourceRoot":"","sources":["../../src/detection/sourceVolume.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OA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A2B,kBAAkB,eAAe,EAAE,CACrF,CAAC;QACJ,CAAC;QACD,wFAAwF;QACxF,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,KAAK,CAAC,WAAW,EAAE,IAAI,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACzD,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC1B,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,EAAE,IAAI,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACtD,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC;YAC3C,IAAI,KAAK,KAAK,IAAI;gBAAE,SAAS;YAC7B,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;YACjB,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAAY;IACpD,MAAM,KAAK,GAAU,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IACxD,MAAM,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACxB,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,KAAK,IAAI,2BAA2B;KACnD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const SQUADRON_PROBE_COMMAND: {
|
|
2
|
+
readonly file: "sq";
|
|
3
|
+
readonly args: readonly ["probe", "--json"];
|
|
4
|
+
};
|
|
5
|
+
export declare const SUPPORTED_PROBE_VERSION = 1;
|
|
6
|
+
export declare const SQUADRON_PROBE_TIMEOUT_MS = 10000;
|
|
7
|
+
export declare const SQUADRON_PROBE_MAX_BUFFER_BYTES: number;
|
|
8
|
+
/** What happened when the probe process ran; produced by the process wrapper, nothing else. */
|
|
9
|
+
export type ProbeRun = {
|
|
10
|
+
kind: 'not-found';
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'could-not-run';
|
|
13
|
+
detail: string;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'exited';
|
|
16
|
+
exitCode: number;
|
|
17
|
+
stdout: string;
|
|
18
|
+
stderr: string;
|
|
19
|
+
};
|
|
20
|
+
export type ProbeUnavailableReason = Exclude<ProbeRun, {
|
|
21
|
+
kind: 'exited';
|
|
22
|
+
}> | {
|
|
23
|
+
kind: 'non-zero-exit';
|
|
24
|
+
exitCode: number;
|
|
25
|
+
} | {
|
|
26
|
+
kind: 'unreadable-output';
|
|
27
|
+
} | {
|
|
28
|
+
kind: 'unsupported-version';
|
|
29
|
+
value: string;
|
|
30
|
+
};
|
|
31
|
+
export type ProbeOutcome = {
|
|
32
|
+
kind: 'available';
|
|
33
|
+
json: string;
|
|
34
|
+
warnings: string[];
|
|
35
|
+
} | {
|
|
36
|
+
kind: 'unavailable';
|
|
37
|
+
reason: ProbeUnavailableReason;
|
|
38
|
+
warnings: string[];
|
|
39
|
+
};
|
|
40
|
+
/** D2: turn a finished probe run into an outcome. Pure; never throws for bad probe output. */
|
|
41
|
+
export declare function classifyProbeRun(run: ProbeRun): ProbeOutcome;
|
|
42
|
+
export interface ProbeLimits {
|
|
43
|
+
timeoutMs: number;
|
|
44
|
+
maxBufferBytes: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* D1/R1: the only code that spawns a process. No shell, no env changes. Resolves, never
|
|
48
|
+
* rejects: every failure is a `ProbeRun`. Exported for tests (they pass a fake executable).
|
|
49
|
+
*/
|
|
50
|
+
export declare function runProbeProcess(command: {
|
|
51
|
+
readonly file: string;
|
|
52
|
+
readonly args: readonly string[];
|
|
53
|
+
}, cwd: string, limits: ProbeLimits): Promise<ProbeRun>;
|
|
54
|
+
/** Run `sq probe --json` in the checkout and classify the result. */
|
|
55
|
+
export declare function runSquadronProbe(checkoutPath: string): Promise<ProbeOutcome>;
|
|
56
|
+
//# sourceMappingURL=squadronProbe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"squadronProbe.d.ts","sourceRoot":"","sources":["../../src/detection/squadronProbe.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB;;;CAAqD,CAAC;AACzF,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAChD,eAAO,MAAM,+BAA+B,QAAc,CAAC;AAE3D,+FAA+F;AAC/F,MAAM,MAAM,QAAQ,GAChB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzE,MAAM,MAAM,sBAAsB,GAC9B,OAAO,CAAC,QAAQ,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,GACrC;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,mBAAmB,CAAA;CAAE,GAE7B;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,sBAAsB,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAoDhF,8FAA8F;AAC9F,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,QAAQ,GAAG,YAAY,CAY5D;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EACpE,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,QAAQ,CAAC,CAsBnB;AAED,qEAAqE;AACrE,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAMlF"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Squadron capability probe (slice 262 D1-D3): constants, result types, the process
|
|
2
|
+
// wrapper and the pure classifier. cf reads `probe_version` only; every other field is
|
|
3
|
+
// for the guide prompt.
|
|
4
|
+
import { execFile } from 'node:child_process';
|
|
5
|
+
export const SQUADRON_PROBE_COMMAND = { file: 'sq', args: ['probe', '--json'] };
|
|
6
|
+
export const SUPPORTED_PROBE_VERSION = 1;
|
|
7
|
+
export const SQUADRON_PROBE_TIMEOUT_MS = 10_000;
|
|
8
|
+
export const SQUADRON_PROBE_MAX_BUFFER_BYTES = 1024 * 1024;
|
|
9
|
+
const MISSING_VERSION = 'missing';
|
|
10
|
+
/** D3: stderr lines verbatim; trailing whitespace trimmed, empty lines dropped. */
|
|
11
|
+
function toWarnings(stderr) {
|
|
12
|
+
return stderr
|
|
13
|
+
.split('\n')
|
|
14
|
+
.map((line) => line.trimEnd())
|
|
15
|
+
.filter((line) => line.length > 0);
|
|
16
|
+
}
|
|
17
|
+
/** Parsed stdout as a plain object, or undefined when it is not valid JSON or not an object. */
|
|
18
|
+
function parseJsonObject(stdout) {
|
|
19
|
+
let parsed;
|
|
20
|
+
try {
|
|
21
|
+
parsed = JSON.parse(stdout.trim());
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
// Only a SyntaxError means "stdout is not JSON", which is a stated outcome (D2 step 4);
|
|
25
|
+
// anything else is a bug and propagates.
|
|
26
|
+
if (error instanceof SyntaxError)
|
|
27
|
+
return undefined;
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
|
|
31
|
+
return undefined;
|
|
32
|
+
return parsed; // narrowed above: non-null, non-array object
|
|
33
|
+
}
|
|
34
|
+
function classifyExit(run) {
|
|
35
|
+
const warnings = toWarnings(run.stderr);
|
|
36
|
+
if (run.exitCode !== 0) {
|
|
37
|
+
return {
|
|
38
|
+
kind: 'unavailable',
|
|
39
|
+
reason: { kind: 'non-zero-exit', exitCode: run.exitCode },
|
|
40
|
+
warnings,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const object = parseJsonObject(run.stdout);
|
|
44
|
+
if (object === undefined) {
|
|
45
|
+
return { kind: 'unavailable', reason: { kind: 'unreadable-output' }, warnings };
|
|
46
|
+
}
|
|
47
|
+
if (object.probe_version !== SUPPORTED_PROBE_VERSION) {
|
|
48
|
+
const value = 'probe_version' in object ? JSON.stringify(object.probe_version) : MISSING_VERSION;
|
|
49
|
+
return {
|
|
50
|
+
kind: 'unavailable',
|
|
51
|
+
reason: { kind: 'unsupported-version', value },
|
|
52
|
+
warnings,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return { kind: 'available', json: run.stdout.trim(), warnings };
|
|
56
|
+
}
|
|
57
|
+
/** D2: turn a finished probe run into an outcome. Pure; never throws for bad probe output. */
|
|
58
|
+
export function classifyProbeRun(run) {
|
|
59
|
+
switch (run.kind) {
|
|
60
|
+
case 'not-found':
|
|
61
|
+
case 'could-not-run':
|
|
62
|
+
return { kind: 'unavailable', reason: run, warnings: [] };
|
|
63
|
+
case 'exited':
|
|
64
|
+
return classifyExit(run);
|
|
65
|
+
default: {
|
|
66
|
+
const unreachable = run;
|
|
67
|
+
throw new Error(`Unhandled probe run: ${JSON.stringify(unreachable)}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* D1/R1: the only code that spawns a process. No shell, no env changes. Resolves, never
|
|
73
|
+
* rejects: every failure is a `ProbeRun`. Exported for tests (they pass a fake executable).
|
|
74
|
+
*/
|
|
75
|
+
export function runProbeProcess(command, cwd, limits) {
|
|
76
|
+
return new Promise((resolve) => {
|
|
77
|
+
execFile(command.file, [...command.args], { cwd, timeout: limits.timeoutMs, maxBuffer: limits.maxBufferBytes, encoding: 'utf8' }, (error, stdout, stderr) => {
|
|
78
|
+
if (error === null) {
|
|
79
|
+
resolve({ kind: 'exited', exitCode: 0, stdout, stderr });
|
|
80
|
+
}
|
|
81
|
+
else if (error.code === 'ENOENT') {
|
|
82
|
+
resolve({ kind: 'not-found' });
|
|
83
|
+
}
|
|
84
|
+
else if (typeof error.code === 'number') {
|
|
85
|
+
resolve({ kind: 'exited', exitCode: error.code, stdout, stderr });
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
// Timeout, output over the buffer, a signal kill, EACCES: one statement (D1).
|
|
89
|
+
const detail = typeof error.code === 'string' ? error.code : (error.signal ?? error.message);
|
|
90
|
+
resolve({ kind: 'could-not-run', detail });
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/** Run `sq probe --json` in the checkout and classify the result. */
|
|
96
|
+
export async function runSquadronProbe(checkoutPath) {
|
|
97
|
+
const run = await runProbeProcess(SQUADRON_PROBE_COMMAND, checkoutPath, {
|
|
98
|
+
timeoutMs: SQUADRON_PROBE_TIMEOUT_MS,
|
|
99
|
+
maxBufferBytes: SQUADRON_PROBE_MAX_BUFFER_BYTES,
|
|
100
|
+
});
|
|
101
|
+
return classifyProbeRun(run);
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=squadronProbe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"squadronProbe.js","sourceRoot":"","sources":["../../src/detection/squadronProbe.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,uFAAuF;AACvF,wBAAwB;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAW,CAAC;AACzF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAChD,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,GAAG,IAAI,CAAC;AAmB3D,MAAM,eAAe,GAAG,SAAS,CAAC;AAElC,mFAAmF;AACnF,SAAS,UAAU,CAAC,MAAc;IAChC,OAAO,MAAM;SACV,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;SAC7B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,gGAAgG;AAChG,SAAS,eAAe,CAAC,MAAc;IACrC,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,wFAAwF;QACxF,yCAAyC;QACzC,IAAI,KAAK,YAAY,WAAW;YAAE,OAAO,SAAS,CAAC;QACnD,MAAM,KAAK,CAAC;IACd,CAAC;IAC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QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YACpE,CAAC;iBAAM,CAAC;gBACN,8EAA8E;gBAC9E,MAAM,MAAM,GACV,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;gBAChF,OAAO,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,qEAAqE;AACrE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,YAAoB;IACzD,MAAM,GAAG,GAAG,MAAM,eAAe,CAAC,sBAAsB,EAAE,YAAY,EAAE;QACtE,SAAS,EAAE,yBAAyB;QACpC,cAAc,EAAE,+BAA+B;KAChD,CAAC,CAAC;IACH,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface MappedDoc {
|
|
2
|
+
kind: 'adr' | 'doc';
|
|
3
|
+
/** Root-relative, POSIX separators. */
|
|
4
|
+
path: string;
|
|
5
|
+
title: string;
|
|
6
|
+
}
|
|
7
|
+
export interface Discovery {
|
|
8
|
+
docs: MappedDoc[];
|
|
9
|
+
/** Root-relative POSIX paths of symlinks that were not followed. */
|
|
10
|
+
skippedSymlinks: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare const MARKDOWN_EXTENSIONS: readonly string[];
|
|
13
|
+
export declare function discoverMappedDocs(root: string): Promise<Discovery>;
|
|
14
|
+
//# sourceMappingURL=discoverDocs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverDocs.d.ts","sourceRoot":"","sources":["../../src/docs-map/discoverDocs.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,oEAAoE;IACpE,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAAY,CAAC;AA2F9D,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAsBzE"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { lstat, readdir, readFile } from 'fs/promises';
|
|
2
|
+
import { basename, extname, join, posix } from 'path';
|
|
3
|
+
import { isEnoent } from '../detection/pathPresent.js';
|
|
4
|
+
import { ADR_DIRS, DOC_PATHS, presentPaths } from '../detection/presentPaths.js';
|
|
5
|
+
import { EXCLUDED_DIRS } from '../detection/sourceVolume.js';
|
|
6
|
+
import { wrapFsError } from './docsMapError.js';
|
|
7
|
+
export const MARKDOWN_EXTENSIONS = ['.md'];
|
|
8
|
+
const FRONTMATTER_FENCE = '---';
|
|
9
|
+
/** ATX level-1 heading: `#`, at least one space, text; a closing `#` run must follow a space. */
|
|
10
|
+
const H1_PATTERN = /^\s*#[ \t]+(.+?)(?:[ \t]+#+)?[ \t]*$/;
|
|
11
|
+
function isMarkdown(name) {
|
|
12
|
+
return MARKDOWN_EXTENSIONS.includes(extname(name).toLowerCase());
|
|
13
|
+
}
|
|
14
|
+
function isSkippedDirectory(name) {
|
|
15
|
+
return name.startsWith('.') || EXCLUDED_DIRS.includes(name);
|
|
16
|
+
}
|
|
17
|
+
/** Recursively collect Markdown files under `relDir`; symlinks are recorded, never followed. */
|
|
18
|
+
async function walkMarkdown(root, relDir, into) {
|
|
19
|
+
let entries;
|
|
20
|
+
try {
|
|
21
|
+
entries = await readdir(join(root, relDir), { withFileTypes: true });
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
// The directory vanished after it was found: treat it as not present.
|
|
25
|
+
if (isEnoent(error))
|
|
26
|
+
return;
|
|
27
|
+
throw wrapFsError(relDir, 'read directory', error);
|
|
28
|
+
}
|
|
29
|
+
for (const entry of entries) {
|
|
30
|
+
const relPath = posix.join(relDir, entry.name);
|
|
31
|
+
if (entry.isSymbolicLink()) {
|
|
32
|
+
into.symlinks.push(relPath);
|
|
33
|
+
}
|
|
34
|
+
else if (entry.isDirectory()) {
|
|
35
|
+
if (!isSkippedDirectory(entry.name))
|
|
36
|
+
await walkMarkdown(root, relPath, into);
|
|
37
|
+
}
|
|
38
|
+
else if (entry.isFile() && isMarkdown(entry.name)) {
|
|
39
|
+
into.files.push(relPath);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Expand one present candidate into the Markdown files it stands for. */
|
|
44
|
+
async function expandCandidate(root, candidate, into) {
|
|
45
|
+
let stats;
|
|
46
|
+
try {
|
|
47
|
+
stats = await lstat(join(root, candidate));
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
// The candidate vanished after presentPaths found it: treat it as not present.
|
|
51
|
+
if (isEnoent(error))
|
|
52
|
+
return;
|
|
53
|
+
throw wrapFsError(candidate, 'inspect', error);
|
|
54
|
+
}
|
|
55
|
+
if (stats.isSymbolicLink()) {
|
|
56
|
+
into.symlinks.push(candidate);
|
|
57
|
+
}
|
|
58
|
+
else if (stats.isDirectory()) {
|
|
59
|
+
await walkMarkdown(root, candidate, into);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
into.files.push(candidate);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** The first H1 of a Markdown file, skipping a leading frontmatter block. */
|
|
66
|
+
function firstHeading(content) {
|
|
67
|
+
const lines = content.split(/\r?\n/);
|
|
68
|
+
let index = 0;
|
|
69
|
+
if (lines[0]?.trimEnd() === FRONTMATTER_FENCE) {
|
|
70
|
+
const close = lines.findIndex((line, i) => i > 0 && line.trimEnd() === FRONTMATTER_FENCE);
|
|
71
|
+
// An unterminated block means the whole file is frontmatter: no heading inside it.
|
|
72
|
+
if (close === -1)
|
|
73
|
+
return undefined;
|
|
74
|
+
index = close + 1;
|
|
75
|
+
}
|
|
76
|
+
for (; index < lines.length; index++) {
|
|
77
|
+
const match = H1_PATTERN.exec(lines[index]);
|
|
78
|
+
if (match)
|
|
79
|
+
return match[1];
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
/** The title for a doc: its first H1, else the filename. `undefined` when the file vanished. */
|
|
84
|
+
async function readTitle(root, relPath) {
|
|
85
|
+
let content;
|
|
86
|
+
try {
|
|
87
|
+
content = await readFile(join(root, relPath), 'utf8');
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
// The file vanished after the walk: the caller drops the entry.
|
|
91
|
+
if (isEnoent(error))
|
|
92
|
+
return undefined;
|
|
93
|
+
throw wrapFsError(relPath, 'read', error);
|
|
94
|
+
}
|
|
95
|
+
return firstHeading(content) ?? basename(relPath);
|
|
96
|
+
}
|
|
97
|
+
export async function discoverMappedDocs(root) {
|
|
98
|
+
const adrs = { files: [], symlinks: [] };
|
|
99
|
+
for (const candidate of presentPaths(root, ADR_DIRS)) {
|
|
100
|
+
await expandCandidate(root, candidate, adrs);
|
|
101
|
+
}
|
|
102
|
+
const docs = { files: [], symlinks: [] };
|
|
103
|
+
for (const candidate of presentPaths(root, DOC_PATHS)) {
|
|
104
|
+
await expandCandidate(root, candidate, docs);
|
|
105
|
+
}
|
|
106
|
+
const adrPaths = new Set(adrs.files);
|
|
107
|
+
const kinds = new Map();
|
|
108
|
+
for (const path of adrPaths)
|
|
109
|
+
kinds.set(path, 'adr');
|
|
110
|
+
for (const path of docs.files)
|
|
111
|
+
if (!adrPaths.has(path))
|
|
112
|
+
kinds.set(path, 'doc');
|
|
113
|
+
const mapped = [];
|
|
114
|
+
for (const [path, kind] of kinds) {
|
|
115
|
+
const title = await readTitle(root, path);
|
|
116
|
+
if (title !== undefined)
|
|
117
|
+
mapped.push({ kind, path, title });
|
|
118
|
+
}
|
|
119
|
+
const skippedSymlinks = [...new Set([...adrs.symlinks, ...docs.symlinks])].sort();
|
|
120
|
+
return { docs: mapped, skippedSymlinks };
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=discoverDocs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discoverDocs.js","sourceRoot":"","sources":["../../src/docs-map/discoverDocs.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAehD,MAAM,CAAC,MAAM,mBAAmB,GAAsB,CAAC,KAAK,CAAC,CAAC;AAE9D,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAEhC,iGAAiG;AACjG,MAAM,UAAU,GAAG,sCAAsC,CAAC;AAO1D,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY;IACtC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC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AAM,KAAK,GAAG,IAAI,GAAG,EAA6B,CAAC;IACnD,KAAK,MAAM,IAAI,IAAI,QAAQ;QAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACpD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK;QAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAE/E,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC1C,IAAI,KAAK,KAAK,SAAS;YAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9D,CAAC;IACD,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAClF,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class DocsMapError extends Error {
|
|
2
|
+
readonly path: string;
|
|
3
|
+
readonly reason: string;
|
|
4
|
+
constructor(path: string, reason: string);
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Wrap a filesystem failure as a DocsMapError naming the path and system code.
|
|
8
|
+
* Anything that is not a filesystem error is returned unchanged for the caller to rethrow.
|
|
9
|
+
*/
|
|
10
|
+
export declare function wrapFsError(path: string, action: string, error: unknown): unknown;
|
|
11
|
+
//# sourceMappingURL=docsMapError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docsMapError.d.ts","sourceRoot":"","sources":["../../src/docs-map/docsMapError.ts"],"names":[],"mappings":"AAIA,qBAAa,YAAa,SAAQ,KAAK;IAEnC,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM;gBADd,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM;CAK1B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAGjF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Failure of the docs map (slice 267): carries the path and the reason, and names both.
|
|
2
|
+
// Lives in its own file so discovery and the map writer can both import it without a cycle.
|
|
3
|
+
import { isFsError } from '../detection/pathPresent.js';
|
|
4
|
+
export class DocsMapError extends Error {
|
|
5
|
+
path;
|
|
6
|
+
reason;
|
|
7
|
+
constructor(path, reason) {
|
|
8
|
+
super(`Docs map: ${reason} (${path})`);
|
|
9
|
+
this.path = path;
|
|
10
|
+
this.reason = reason;
|
|
11
|
+
this.name = 'DocsMapError';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Wrap a filesystem failure as a DocsMapError naming the path and system code.
|
|
16
|
+
* Anything that is not a filesystem error is returned unchanged for the caller to rethrow.
|
|
17
|
+
*/
|
|
18
|
+
export function wrapFsError(path, action, error) {
|
|
19
|
+
if (!isFsError(error))
|
|
20
|
+
return error;
|
|
21
|
+
return new DocsMapError(path, `cannot ${action}: ${error.code}`);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=docsMapError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docsMapError.js","sourceRoot":"","sources":["../../src/docs-map/docsMapError.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,4FAA4F;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,MAAM,OAAO,YAAa,SAAQ,KAAK;IAE1B;IACA;IAFX,YACW,IAAY,EACZ,MAAc;QAEvB,KAAK,CAAC,aAAa,MAAM,KAAK,IAAI,GAAG,CAAC,CAAC;QAH9B,SAAI,GAAJ,IAAI,CAAQ;QACZ,WAAM,GAAN,MAAM,CAAQ;QAGvB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,MAAc,EAAE,KAAc;IACtE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACpC,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,UAAU,MAAM,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const DOCS_MAP_BEGIN = "<!-- BEGIN:cf-docs-map -->";
|
|
2
|
+
export declare const DOCS_MAP_END = "<!-- END:cf-docs-map -->";
|
|
3
|
+
export declare const DOCS_MAP_INDEX = "050";
|
|
4
|
+
export declare const DOCS_MAP_SEGMENT = "docs-map";
|
|
5
|
+
export declare const DOCS_MAP_DIR = "project-documents/user/architecture";
|
|
6
|
+
export declare const DOCS_MAP_DOC_TYPE = "reference";
|
|
7
|
+
export declare const DOCS_MAP_STATUS: {
|
|
8
|
+
readonly Created: "created";
|
|
9
|
+
readonly Updated: "updated";
|
|
10
|
+
readonly Unchanged: "unchanged";
|
|
11
|
+
};
|
|
12
|
+
export type DocsMapStatus = (typeof DOCS_MAP_STATUS)[keyof typeof DOCS_MAP_STATUS];
|
|
13
|
+
export interface DocsMapResult {
|
|
14
|
+
path: string;
|
|
15
|
+
status: DocsMapStatus;
|
|
16
|
+
adrs: number;
|
|
17
|
+
docs: number;
|
|
18
|
+
skippedSymlinks: string[];
|
|
19
|
+
}
|
|
20
|
+
/** The canonical map path. No pattern search: a renamed project gets a new map (D1). */
|
|
21
|
+
export declare function docsMapPath(root: string, projectName: string): string;
|
|
22
|
+
/** Write or refresh the project's docs map. Discovery runs first, so a discovery error leaves any map untouched. */
|
|
23
|
+
export declare function writeDocsMap(root: string, projectName: string): Promise<DocsMapResult>;
|
|
24
|
+
//# sourceMappingURL=docsMapFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docsMapFile.d.ts","sourceRoot":"","sources":["../../src/docs-map/docsMapFile.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,cAAc,+BAA+B,CAAC;AAC3D,eAAO,MAAM,YAAY,6BAA6B,CAAC;AACvD,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAC3C,eAAO,MAAM,YAAY,wCAAwC,CAAC;AAClE,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAE7C,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAEnF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAKrE;AAkGD,oHAAoH;AACpH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAkB5F"}
|