@context-forge/core 0.19.16 → 0.19.18

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.
Files changed (203) hide show
  1. package/dist/adoption/adoptionCompletion.d.ts +16 -0
  2. package/dist/adoption/adoptionCompletion.d.ts.map +1 -0
  3. package/dist/adoption/adoptionCompletion.js +37 -0
  4. package/dist/adoption/adoptionCompletion.js.map +1 -0
  5. package/dist/adoption/adoptionFacts.d.ts +25 -0
  6. package/dist/adoption/adoptionFacts.d.ts.map +1 -0
  7. package/dist/adoption/adoptionFacts.js +149 -0
  8. package/dist/adoption/adoptionFacts.js.map +1 -0
  9. package/dist/adoption/adoptionOutcome.d.ts +40 -0
  10. package/dist/adoption/adoptionOutcome.d.ts.map +1 -0
  11. package/dist/adoption/adoptionOutcome.js +30 -0
  12. package/dist/adoption/adoptionOutcome.js.map +1 -0
  13. package/dist/adoption/adoptionResolver.d.ts +8 -0
  14. package/dist/adoption/adoptionResolver.d.ts.map +1 -0
  15. package/dist/adoption/adoptionResolver.js +152 -0
  16. package/dist/adoption/adoptionResolver.js.map +1 -0
  17. package/dist/adoption/adoptionState.d.ts +7 -0
  18. package/dist/adoption/adoptionState.d.ts.map +1 -0
  19. package/dist/adoption/adoptionState.js +24 -0
  20. package/dist/adoption/adoptionState.js.map +1 -0
  21. package/dist/adoption/contracts.d.ts +24 -0
  22. package/dist/adoption/contracts.d.ts.map +1 -0
  23. package/dist/adoption/contracts.js +14 -0
  24. package/dist/adoption/contracts.js.map +1 -0
  25. package/dist/adoption/index.d.ts +7 -0
  26. package/dist/adoption/index.d.ts.map +1 -0
  27. package/dist/adoption/index.js +7 -0
  28. package/dist/adoption/index.js.map +1 -0
  29. package/dist/config/ConfigKeys.d.ts +2 -0
  30. package/dist/config/ConfigKeys.d.ts.map +1 -1
  31. package/dist/config/ConfigKeys.js +18 -0
  32. package/dist/config/ConfigKeys.js.map +1 -1
  33. package/dist/config/index.d.ts +1 -1
  34. package/dist/config/index.d.ts.map +1 -1
  35. package/dist/config/index.js +1 -1
  36. package/dist/config/index.js.map +1 -1
  37. package/dist/detection/buildManifest.d.ts +4 -0
  38. package/dist/detection/buildManifest.d.ts.map +1 -0
  39. package/dist/detection/buildManifest.js +21 -0
  40. package/dist/detection/buildManifest.js.map +1 -0
  41. package/dist/detection/ciDetection.d.ts +15 -0
  42. package/dist/detection/ciDetection.d.ts.map +1 -0
  43. package/dist/detection/ciDetection.js +71 -0
  44. package/dist/detection/ciDetection.js.map +1 -0
  45. package/dist/detection/comprehensionAnalysis.d.ts +7 -0
  46. package/dist/detection/comprehensionAnalysis.d.ts.map +1 -0
  47. package/dist/detection/comprehensionAnalysis.js +59 -0
  48. package/dist/detection/comprehensionAnalysis.js.map +1 -0
  49. package/dist/detection/history.d.ts +12 -0
  50. package/dist/detection/history.d.ts.map +1 -0
  51. package/dist/detection/history.js +22 -0
  52. package/dist/detection/history.js.map +1 -0
  53. package/dist/detection/index.d.ts +10 -0
  54. package/dist/detection/index.d.ts.map +1 -0
  55. package/dist/detection/index.js +10 -0
  56. package/dist/detection/index.js.map +1 -0
  57. package/dist/detection/pathPresent.d.ts +9 -0
  58. package/dist/detection/pathPresent.d.ts.map +1 -0
  59. package/dist/detection/pathPresent.js +29 -0
  60. package/dist/detection/pathPresent.js.map +1 -0
  61. package/dist/detection/planningArtifacts.d.ts +17 -0
  62. package/dist/detection/planningArtifacts.d.ts.map +1 -0
  63. package/dist/detection/planningArtifacts.js +72 -0
  64. package/dist/detection/planningArtifacts.js.map +1 -0
  65. package/dist/detection/presentPaths.d.ts +11 -0
  66. package/dist/detection/presentPaths.d.ts.map +1 -0
  67. package/dist/detection/presentPaths.js +40 -0
  68. package/dist/detection/presentPaths.js.map +1 -0
  69. package/dist/detection/sourceVolume.d.ts +16 -0
  70. package/dist/detection/sourceVolume.d.ts.map +1 -0
  71. package/dist/detection/sourceVolume.js +93 -0
  72. package/dist/detection/sourceVolume.js.map +1 -0
  73. package/dist/detection/squadronProbe.d.ts +56 -0
  74. package/dist/detection/squadronProbe.d.ts.map +1 -0
  75. package/dist/detection/squadronProbe.js +103 -0
  76. package/dist/detection/squadronProbe.js.map +1 -0
  77. package/dist/docs-map/discoverDocs.d.ts +14 -0
  78. package/dist/docs-map/discoverDocs.d.ts.map +1 -0
  79. package/dist/docs-map/discoverDocs.js +122 -0
  80. package/dist/docs-map/discoverDocs.js.map +1 -0
  81. package/dist/docs-map/docsMapError.d.ts +11 -0
  82. package/dist/docs-map/docsMapError.d.ts.map +1 -0
  83. package/dist/docs-map/docsMapError.js +23 -0
  84. package/dist/docs-map/docsMapError.js.map +1 -0
  85. package/dist/docs-map/docsMapFile.d.ts +24 -0
  86. package/dist/docs-map/docsMapFile.d.ts.map +1 -0
  87. package/dist/docs-map/docsMapFile.js +142 -0
  88. package/dist/docs-map/docsMapFile.js.map +1 -0
  89. package/dist/docs-map/index.d.ts +4 -0
  90. package/dist/docs-map/index.d.ts.map +1 -0
  91. package/dist/docs-map/index.js +3 -0
  92. package/dist/docs-map/index.js.map +1 -0
  93. package/dist/docs-map/renderDocsMap.d.ts +10 -0
  94. package/dist/docs-map/renderDocsMap.d.ts.map +1 -0
  95. package/dist/docs-map/renderDocsMap.js +44 -0
  96. package/dist/docs-map/renderDocsMap.js.map +1 -0
  97. package/dist/guides/guideMinimum.d.ts +8 -0
  98. package/dist/guides/guideMinimum.d.ts.map +1 -0
  99. package/dist/guides/guideMinimum.js +28 -0
  100. package/dist/guides/guideMinimum.js.map +1 -0
  101. package/dist/guides/index.d.ts +1 -0
  102. package/dist/guides/index.d.ts.map +1 -1
  103. package/dist/guides/index.js +1 -0
  104. package/dist/guides/index.js.map +1 -1
  105. package/dist/index.d.ts +1 -0
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +2 -0
  108. package/dist/index.js.map +1 -1
  109. package/dist/introspection/ArtifactIntrospector.d.ts +2 -0
  110. package/dist/introspection/ArtifactIntrospector.d.ts.map +1 -1
  111. package/dist/introspection/ArtifactIntrospector.js +3 -1
  112. package/dist/introspection/ArtifactIntrospector.js.map +1 -1
  113. package/dist/introspection/ConsistencyChecker.d.ts.map +1 -1
  114. package/dist/introspection/ConsistencyChecker.js +15 -4
  115. package/dist/introspection/ConsistencyChecker.js.map +1 -1
  116. package/dist/introspection/WorkflowNavigator.d.ts +19 -15
  117. package/dist/introspection/WorkflowNavigator.d.ts.map +1 -1
  118. package/dist/introspection/WorkflowNavigator.js +159 -57
  119. package/dist/introspection/WorkflowNavigator.js.map +1 -1
  120. package/dist/introspection/adoptionNavigation.d.ts +40 -0
  121. package/dist/introspection/adoptionNavigation.d.ts.map +1 -0
  122. package/dist/introspection/adoptionNavigation.js +190 -0
  123. package/dist/introspection/adoptionNavigation.js.map +1 -0
  124. package/dist/introspection/parsers/existingStatePlan.d.ts +7 -0
  125. package/dist/introspection/parsers/existingStatePlan.d.ts.map +1 -0
  126. package/dist/introspection/parsers/existingStatePlan.js +22 -0
  127. package/dist/introspection/parsers/existingStatePlan.js.map +1 -0
  128. package/dist/introspection/parsers/slicePlanParser.d.ts.map +1 -1
  129. package/dist/introspection/parsers/slicePlanParser.js +10 -1
  130. package/dist/introspection/parsers/slicePlanParser.js.map +1 -1
  131. package/dist/introspection/retroactiveRules.d.ts +17 -0
  132. package/dist/introspection/retroactiveRules.d.ts.map +1 -0
  133. package/dist/introspection/retroactiveRules.js +100 -0
  134. package/dist/introspection/retroactiveRules.js.map +1 -0
  135. package/dist/introspection/reviewGate.d.ts +24 -1
  136. package/dist/introspection/reviewGate.d.ts.map +1 -1
  137. package/dist/introspection/reviewGate.js +24 -0
  138. package/dist/introspection/reviewGate.js.map +1 -1
  139. package/dist/introspection/setupCiOffer.d.ts +9 -0
  140. package/dist/introspection/setupCiOffer.d.ts.map +1 -0
  141. package/dist/introspection/setupCiOffer.js +48 -0
  142. package/dist/introspection/setupCiOffer.js.map +1 -0
  143. package/dist/introspection/statusDerivation.d.ts +19 -1
  144. package/dist/introspection/statusDerivation.d.ts.map +1 -1
  145. package/dist/introspection/statusDerivation.js +24 -0
  146. package/dist/introspection/statusDerivation.js.map +1 -1
  147. package/dist/introspection/types.d.ts +18 -0
  148. package/dist/introspection/types.d.ts.map +1 -1
  149. package/dist/introspection/types.js +2 -0
  150. package/dist/introspection/types.js.map +1 -1
  151. package/dist/node.d.ts +5 -0
  152. package/dist/node.d.ts.map +1 -1
  153. package/dist/node.js +9 -0
  154. package/dist/node.js.map +1 -1
  155. package/dist/onboarding/onboardRecipe.d.ts +28 -0
  156. package/dist/onboarding/onboardRecipe.d.ts.map +1 -0
  157. package/dist/onboarding/onboardRecipe.js +79 -0
  158. package/dist/onboarding/onboardRecipe.js.map +1 -0
  159. package/dist/ruleReconciliation/index.d.ts +5 -0
  160. package/dist/ruleReconciliation/index.d.ts.map +1 -0
  161. package/dist/ruleReconciliation/index.js +5 -0
  162. package/dist/ruleReconciliation/index.js.map +1 -0
  163. package/dist/ruleReconciliation/markers.d.ts +20 -0
  164. package/dist/ruleReconciliation/markers.d.ts.map +1 -0
  165. package/dist/ruleReconciliation/markers.js +20 -0
  166. package/dist/ruleReconciliation/markers.js.map +1 -0
  167. package/dist/ruleReconciliation/projectSources.d.ts +29 -0
  168. package/dist/ruleReconciliation/projectSources.d.ts.map +1 -0
  169. package/dist/ruleReconciliation/projectSources.js +80 -0
  170. package/dist/ruleReconciliation/projectSources.js.map +1 -0
  171. package/dist/ruleReconciliation/schema.d.ts +24 -0
  172. package/dist/ruleReconciliation/schema.d.ts.map +1 -0
  173. package/dist/ruleReconciliation/schema.js +77 -0
  174. package/dist/ruleReconciliation/schema.js.map +1 -0
  175. package/dist/ruleReconciliation/store.d.ts +6 -0
  176. package/dist/ruleReconciliation/store.d.ts.map +1 -0
  177. package/dist/ruleReconciliation/store.js +56 -0
  178. package/dist/ruleReconciliation/store.js.map +1 -0
  179. package/dist/schema/frontmatterSchema.d.ts +1 -1
  180. package/dist/schema/frontmatterSchema.d.ts.map +1 -1
  181. package/dist/schema/frontmatterSchema.js +3 -0
  182. package/dist/schema/frontmatterSchema.js.map +1 -1
  183. package/dist/schema/projectSchema.d.ts +4 -0
  184. package/dist/schema/projectSchema.d.ts.map +1 -1
  185. package/dist/schema/projectSchema.js +4 -0
  186. package/dist/schema/projectSchema.js.map +1 -1
  187. package/dist/services/ContextIntegrator.d.ts +4 -1
  188. package/dist/services/ContextIntegrator.d.ts.map +1 -1
  189. package/dist/services/ContextIntegrator.js +22 -4
  190. package/dist/services/ContextIntegrator.js.map +1 -1
  191. package/dist/services/ContextTemplateEngine.d.ts.map +1 -1
  192. package/dist/services/ContextTemplateEngine.js +10 -0
  193. package/dist/services/ContextTemplateEngine.js.map +1 -1
  194. package/dist/services/CoreServiceFactory.d.ts +10 -1
  195. package/dist/services/CoreServiceFactory.d.ts.map +1 -1
  196. package/dist/services/CoreServiceFactory.js +11 -2
  197. package/dist/services/CoreServiceFactory.js.map +1 -1
  198. package/dist/services/SectionBuilder.d.ts.map +1 -1
  199. package/dist/services/SectionBuilder.js +3 -0
  200. package/dist/services/SectionBuilder.js.map +1 -1
  201. package/dist/types/context.d.ts +4 -0
  202. package/dist/types/context.d.ts.map +1 -1
  203. package/package.json +1 -1
@@ -0,0 +1,40 @@
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. Exported from
3
+ // detection/index.ts: rule reconciliation (slice 266) enumerates the same list.
4
+ import { join } from 'path';
5
+ import { pathPresent } from './pathPresent.js';
6
+ export const DOC_PATHS = ['README.md', 'README', 'docs', 'doc'];
7
+ export const ADR_DIRS = [
8
+ 'docs/adr',
9
+ 'docs/adrs',
10
+ 'docs/decisions',
11
+ 'docs/architecture/decisions',
12
+ 'doc/adr',
13
+ 'adr',
14
+ 'adrs',
15
+ ];
16
+ export const RULE_FILE_PATHS = [
17
+ 'CLAUDE.md',
18
+ 'AGENTS.md',
19
+ 'GEMINI.md',
20
+ '.cursorrules',
21
+ '.cursor/rules',
22
+ '.windsurfrules',
23
+ '.github/copilot-instructions.md',
24
+ '.github/instructions',
25
+ '.claude/rules',
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
+ ];
36
+ /** The candidates (relative to root) that exist, in candidate order. Non-ENOENT errors throw. */
37
+ export function presentPaths(root, candidates) {
38
+ return candidates.filter((candidate) => pathPresent(join(root, candidate)));
39
+ }
40
+ //# sourceMappingURL=presentPaths.js.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,16 @@
1
+ export interface SourceVolume {
2
+ files: number;
3
+ lines: number;
4
+ /** True when the walk stopped at the threshold, so `lines` is a lower bound. */
5
+ capped: boolean;
6
+ }
7
+ /** Extensions (lowercase, no dot) counted as source. Adding a language is a one-line edit. */
8
+ export declare const SOURCE_EXTENSIONS: readonly string[];
9
+ /** Directories never walked, besides any directory whose name starts with a dot. */
10
+ export declare const EXCLUDED_DIRS: readonly string[];
11
+ /** Larger files are treated as generated or minified and skipped. */
12
+ export declare const MAX_SOURCE_FILE_BYTES: number;
13
+ /** Directory entries visited before the walk gives up on a large non-source tree. */
14
+ export declare const MAX_WALK_ENTRIES = 20000;
15
+ export declare function measureSourceVolume(root: string): Promise<SourceVolume>;
16
+ //# sourceMappingURL=sourceVolume.d.ts.map
@@ -0,0 +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,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"}
@@ -0,0 +1,93 @@
1
+ import { lstat, readdir, readFile } from 'fs/promises';
2
+ import { extname, join } from 'path';
3
+ import { BROWNFIELD_MIN_SOURCE_LINES } from '../adoption/adoptionOutcome.js';
4
+ import { AdoptionError } from '../adoption/contracts.js';
5
+ import { isEnoent, isFsError } from './pathPresent.js';
6
+ /** Extensions (lowercase, no dot) counted as source. Adding a language is a one-line edit. */
7
+ export const SOURCE_EXTENSIONS = [
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',
10
+ ];
11
+ /** Directories never walked, besides any directory whose name starts with a dot. */
12
+ export const EXCLUDED_DIRS = [
13
+ 'node_modules', 'vendor', 'dist', 'build', 'out', 'target', 'coverage', '__pycache__', 'venv',
14
+ // cf's own footprint (guide, planning docs) must never tip a repo into brownfield.
15
+ 'project-documents',
16
+ ];
17
+ /** Larger files are treated as generated or minified and skipped. */
18
+ export const MAX_SOURCE_FILE_BYTES = 512 * 1024;
19
+ /** Directory entries visited before the walk gives up on a large non-source tree. */
20
+ export const MAX_WALK_ENTRIES = 20_000;
21
+ const OVERRIDE_REMEDY = 'To skip detection run `cf config set adoption.state in_progress` (treat as an existing codebase) ' +
22
+ 'or `cf config set adoption.state declined` (treat as new).';
23
+ function walkFailure(path, error) {
24
+ const code = isFsError(error) ? error.code : error instanceof Error ? error.name : 'unknown error';
25
+ return new AdoptionError(`Cannot measure source volume: ${code} at ${path}. ${OVERRIDE_REMEDY}`, {
26
+ cause: error,
27
+ });
28
+ }
29
+ /** Sorted entries of a directory; a directory deleted mid-walk (ENOENT) is empty. */
30
+ async function listDirectory(dir) {
31
+ try {
32
+ const entries = await readdir(dir, { withFileTypes: true });
33
+ return entries.sort((a, b) => a.name.localeCompare(b.name));
34
+ }
35
+ catch (error) {
36
+ if (isEnoent(error))
37
+ return [];
38
+ throw walkFailure(dir, error);
39
+ }
40
+ }
41
+ /** Non-blank line count of a source file, or null when skipped (oversized or deleted mid-walk). */
42
+ async function countSourceLines(path) {
43
+ try {
44
+ if ((await lstat(path)).size > MAX_SOURCE_FILE_BYTES)
45
+ return null;
46
+ const text = await readFile(path, 'utf-8');
47
+ return text.split('\n').filter((line) => line.trim().length > 0).length;
48
+ }
49
+ catch (error) {
50
+ if (isEnoent(error))
51
+ return null;
52
+ throw walkFailure(path, error);
53
+ }
54
+ }
55
+ function isSourceFile(name) {
56
+ return SOURCE_EXTENSIONS.includes(extname(name).slice(1).toLowerCase());
57
+ }
58
+ function isWalkedDirectory(name) {
59
+ return !name.startsWith('.') && !EXCLUDED_DIRS.includes(name);
60
+ }
61
+ async function walk(dir, tally) {
62
+ for (const entry of await listDirectory(dir)) {
63
+ if (tally.lines >= BROWNFIELD_MIN_SOURCE_LINES)
64
+ return;
65
+ tally.entries += 1;
66
+ if (tally.entries >= MAX_WALK_ENTRIES) {
67
+ throw new AdoptionError(`Cannot measure source volume: ${tally.entries} directory entries visited in ${dir} ` +
68
+ `without reaching ${BROWNFIELD_MIN_SOURCE_LINES} source lines. ${OVERRIDE_REMEDY}`);
69
+ }
70
+ // Dirent reports the entry itself, so a symlink is neither a directory nor a file here.
71
+ const path = join(dir, entry.name);
72
+ if (entry.isDirectory() && isWalkedDirectory(entry.name)) {
73
+ await walk(path, tally);
74
+ }
75
+ else if (entry.isFile() && isSourceFile(entry.name)) {
76
+ const lines = await countSourceLines(path);
77
+ if (lines === null)
78
+ continue;
79
+ tally.files += 1;
80
+ tally.lines += lines;
81
+ }
82
+ }
83
+ }
84
+ export async function measureSourceVolume(root) {
85
+ const tally = { files: 0, lines: 0, entries: 0 };
86
+ await walk(root, tally);
87
+ return {
88
+ files: tally.files,
89
+ lines: tally.lines,
90
+ capped: tally.lines >= BROWNFIELD_MIN_SOURCE_LINES,
91
+ };
92
+ }
93
+ //# sourceMappingURL=sourceVolume.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceVolume.js","sourceRoot":"","sources":["../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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,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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,CAAC;AAC9D,CAAC;AAED,gGAAgG;AAChG,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,MAAc,EAAE,IAAgB;IACxE,IAAI,OAAiB,CAAC;IACtB,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,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AC,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"}