@rasensio/aidlc 1.73.1 → 1.75.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/dist/commands/autopilot.d.ts +17 -1
- package/dist/commands/autopilot.d.ts.map +1 -1
- package/dist/commands/autopilot.js +15 -5
- package/dist/commands/autopilot.js.map +1 -1
- package/dist/commands/init.js +7 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/start.js +7 -4
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +7 -3
- package/dist/commands/update.js.map +1 -1
- package/dist/compile/knowledge-section.d.ts +27 -5
- package/dist/compile/knowledge-section.d.ts.map +1 -1
- package/dist/compile/knowledge-section.js +89 -20
- package/dist/compile/knowledge-section.js.map +1 -1
- package/dist/concurrency/common-dir.d.ts +24 -9
- package/dist/concurrency/common-dir.d.ts.map +1 -1
- package/dist/concurrency/common-dir.js +62 -30
- package/dist/concurrency/common-dir.js.map +1 -1
- package/dist/concurrency/detect.d.ts +7 -6
- package/dist/concurrency/detect.d.ts.map +1 -1
- package/dist/concurrency/detect.js +7 -6
- package/dist/concurrency/detect.js.map +1 -1
- package/dist/doctor/context.d.ts.map +1 -1
- package/dist/doctor/context.js +2 -1
- package/dist/doctor/context.js.map +1 -1
- package/dist/doctor/migrations/roadmap-sync-gh-missing.d.ts +1 -1
- package/dist/doctor/migrations/roadmap-sync-gh-missing.d.ts.map +1 -1
- package/dist/doctor/migrations/roadmap-sync-gh-missing.js +6 -5
- package/dist/doctor/migrations/roadmap-sync-gh-missing.js.map +1 -1
- package/dist/doctor/types.d.ts +6 -0
- package/dist/doctor/types.d.ts.map +1 -1
- package/dist/knowledge/compact.d.ts.map +1 -1
- package/dist/knowledge/compact.js +3 -0
- package/dist/knowledge/compact.js.map +1 -1
- package/dist/knowledge/gate-criterion.d.ts.map +1 -1
- package/dist/knowledge/gate-criterion.js +9 -2
- package/dist/knowledge/gate-criterion.js.map +1 -1
- package/dist/knowledge/source-fingerprint.d.ts.map +1 -1
- package/dist/knowledge/source-fingerprint.js +3 -1
- package/dist/knowledge/source-fingerprint.js.map +1 -1
- package/dist/knowledge/storable.d.ts +38 -0
- package/dist/knowledge/storable.d.ts.map +1 -0
- package/dist/knowledge/storable.js +87 -0
- package/dist/knowledge/storable.js.map +1 -0
- package/dist/knowledge/sync.d.ts.map +1 -1
- package/dist/knowledge/sync.js +37 -3
- package/dist/knowledge/sync.js.map +1 -1
- package/dist/knowledge/yaml-source.d.ts +12 -1
- package/dist/knowledge/yaml-source.d.ts.map +1 -1
- package/dist/knowledge/yaml-source.js +12 -1
- package/dist/knowledge/yaml-source.js.map +1 -1
- package/dist/roadmap/paths.d.ts +13 -7
- package/dist/roadmap/paths.d.ts.map +1 -1
- package/dist/roadmap/paths.js +15 -9
- package/dist/roadmap/paths.js.map +1 -1
- package/package.json +2 -2
|
@@ -3,17 +3,39 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Every platform adapter embeds this section in its instruction artifact
|
|
5
5
|
* (CLAUDE.md, Kiro steering, .cursorrules, AGENTS.md, Windsurf rules). When
|
|
6
|
-
* the project has no knowledge graph
|
|
7
|
-
*
|
|
6
|
+
* the project has no knowledge graph the section is omitted entirely: no noise
|
|
7
|
+
* for non-adopters.
|
|
8
|
+
*
|
|
9
|
+
* When the project *has* one and the block still goes — every source file broken,
|
|
10
|
+
* or the index unreadable — the caller is told, with the file named where there is
|
|
11
|
+
* one. The block used to vanish from `CLAUDE.md` with nothing said: the parser's
|
|
12
|
+
* warning reached `engine.warnings` and nothing read it, and an index that could not
|
|
13
|
+
* be opened threw past the `try` meant to contain it
|
|
14
|
+
* (knowledge-block-vanishes-silently/AC-1 – AC-4).
|
|
15
|
+
*
|
|
16
|
+
* What it must never do is keep the old rows when the sources stop parsing. That is
|
|
17
|
+
* serving stale facts, the defect knowledge-index-misses-merged-yaml removed; the
|
|
18
|
+
* block goes, and someone is told (AC-6).
|
|
8
19
|
*
|
|
9
20
|
* @module
|
|
10
21
|
*/
|
|
22
|
+
/** The rendered block and what the caller must print about it. */
|
|
23
|
+
export interface KnowledgeSection {
|
|
24
|
+
/** The `# Codebase Knowledge` block, or null when it is left out. */
|
|
25
|
+
markdown: string | null;
|
|
26
|
+
/**
|
|
27
|
+
* Everything wrong with the sources or the index, for the caller to print once per
|
|
28
|
+
* run — not once per platform, which is why rendering is the caller's to hoist
|
|
29
|
+
* (AC-5, design DD1).
|
|
30
|
+
*/
|
|
31
|
+
warnings: string[];
|
|
32
|
+
}
|
|
11
33
|
/**
|
|
12
|
-
* Render the "Codebase Knowledge" markdown section,
|
|
13
|
-
*
|
|
34
|
+
* Render the "Codebase Knowledge" markdown section, and the warnings to print
|
|
35
|
+
* about it.
|
|
14
36
|
*
|
|
15
37
|
* @param projectRoot - Absolute project root.
|
|
16
38
|
* @param maxTokens - Token budget for the generated summary (default 2000).
|
|
17
39
|
*/
|
|
18
|
-
export declare function renderKnowledgeSection(projectRoot: string, maxTokens?: number):
|
|
40
|
+
export declare function renderKnowledgeSection(projectRoot: string, maxTokens?: number): KnowledgeSection;
|
|
19
41
|
//# sourceMappingURL=knowledge-section.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledge-section.d.ts","sourceRoot":"","sources":["../../src/compile/knowledge-section.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"knowledge-section.d.ts","sourceRoot":"","sources":["../../src/compile/knowledge-section.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAQH,kEAAkE;AAClE,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AA+CD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,EACnB,SAAS,GAAE,MAA2B,GACrC,gBAAgB,CA2ClB"}
|
|
@@ -3,41 +3,110 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Every platform adapter embeds this section in its instruction artifact
|
|
5
5
|
* (CLAUDE.md, Kiro steering, .cursorrules, AGENTS.md, Windsurf rules). When
|
|
6
|
-
* the project has no knowledge graph
|
|
7
|
-
*
|
|
6
|
+
* the project has no knowledge graph the section is omitted entirely: no noise
|
|
7
|
+
* for non-adopters.
|
|
8
|
+
*
|
|
9
|
+
* When the project *has* one and the block still goes — every source file broken,
|
|
10
|
+
* or the index unreadable — the caller is told, with the file named where there is
|
|
11
|
+
* one. The block used to vanish from `CLAUDE.md` with nothing said: the parser's
|
|
12
|
+
* warning reached `engine.warnings` and nothing read it, and an index that could not
|
|
13
|
+
* be opened threw past the `try` meant to contain it
|
|
14
|
+
* (knowledge-block-vanishes-silently/AC-1 – AC-4).
|
|
15
|
+
*
|
|
16
|
+
* What it must never do is keep the old rows when the sources stop parsing. That is
|
|
17
|
+
* serving stale facts, the defect knowledge-index-misses-merged-yaml removed; the
|
|
18
|
+
* block goes, and someone is told (AC-6).
|
|
8
19
|
*
|
|
9
20
|
* @module
|
|
10
21
|
*/
|
|
22
|
+
import { sep } from 'node:path';
|
|
11
23
|
import { knowledgeExists, openKnowledge } from '../knowledge/engine.js';
|
|
12
24
|
import { DEFAULT_MAX_TOKENS } from '../knowledge/context-generator.js';
|
|
25
|
+
const PREFIX = 'knowledge graph: ';
|
|
26
|
+
/**
|
|
27
|
+
* Strip the project root out of a message. Node's file errors carry absolute paths
|
|
28
|
+
* (`EACCES: permission denied, open '/home/…/.aidlc/knowledge/modules.yaml'`), and a
|
|
29
|
+
* warning names files relative to the project, not where it sits on disk
|
|
30
|
+
* (requirements, non-functional: security).
|
|
31
|
+
*/
|
|
32
|
+
function relative(message, projectRoot) {
|
|
33
|
+
return message.split(`${projectRoot}${sep}`).join('');
|
|
34
|
+
}
|
|
35
|
+
function notReadable(err, projectRoot) {
|
|
36
|
+
const message = relative(err instanceof Error ? err.message : String(err), projectRoot);
|
|
37
|
+
return (`${PREFIX}could not be read (${message}), so the # Codebase Knowledge block was left out. ` +
|
|
38
|
+
'.aidlc/knowledge/index.db is a cache rebuilt from the YAML; deleting it forces a rebuild.');
|
|
39
|
+
}
|
|
40
|
+
function noEntities(namedAbove) {
|
|
41
|
+
return (`${PREFIX}.aidlc/knowledge/ has source files but no entities could be read, so the ` +
|
|
42
|
+
`# Codebase Knowledge block was left out${namedAbove ? ' — fix the file(s) named above' : ''}.`);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The sources' warnings, read from the files on every render.
|
|
46
|
+
*
|
|
47
|
+
* Not `engine.warnings`, which holds only what an open that rebuilt was told. An open
|
|
48
|
+
* is a cache hit precisely when an earlier command (`aidlc gate`, `aidlc discover`)
|
|
49
|
+
* rebuilt from the broken files and dropped the warning, so reading the sources makes
|
|
50
|
+
* the warning a property of the files rather than of which command ran first (AC-2,
|
|
51
|
+
* design DD2). Read even when this open rebuilt, so the list is the sources' alone: a
|
|
52
|
+
* rebuild's also carries the one-off "Outdated knowledge index was discarded" note,
|
|
53
|
+
* which is no fault in the graph (AC-12). One parse — 70–160 ms on this repository —
|
|
54
|
+
* on `update` and `init` only.
|
|
55
|
+
*/
|
|
56
|
+
function sourceWarnings(engine, projectRoot) {
|
|
57
|
+
return engine.source
|
|
58
|
+
.loadAll({ forIndex: true })
|
|
59
|
+
.warnings.map((w) => `${PREFIX}${relative(w, projectRoot)}`);
|
|
60
|
+
}
|
|
13
61
|
/**
|
|
14
|
-
* Render the "Codebase Knowledge" markdown section,
|
|
15
|
-
*
|
|
62
|
+
* Render the "Codebase Knowledge" markdown section, and the warnings to print
|
|
63
|
+
* about it.
|
|
16
64
|
*
|
|
17
65
|
* @param projectRoot - Absolute project root.
|
|
18
66
|
* @param maxTokens - Token budget for the generated summary (default 2000).
|
|
19
67
|
*/
|
|
20
68
|
export function renderKnowledgeSection(projectRoot, maxTokens = DEFAULT_MAX_TOKENS) {
|
|
21
69
|
if (!knowledgeExists(projectRoot))
|
|
22
|
-
return null;
|
|
23
|
-
|
|
70
|
+
return { markdown: null, warnings: [] };
|
|
71
|
+
let engine;
|
|
24
72
|
try {
|
|
25
|
-
|
|
26
|
-
if (output.entityCount === 0 || !output.markdown)
|
|
27
|
-
return null;
|
|
28
|
-
return [
|
|
29
|
-
'# Codebase Knowledge',
|
|
30
|
-
'',
|
|
31
|
-
'Structured facts from the AIDLC knowledge graph. Query for more with',
|
|
32
|
-
'`aidlc knowledge query <term>` before re-exploring the code; record new',
|
|
33
|
-
'findings with `aidlc knowledge add` / `relate`.',
|
|
34
|
-
'',
|
|
35
|
-
output.markdown,
|
|
36
|
-
].join('\n');
|
|
73
|
+
engine = openKnowledge(projectRoot);
|
|
37
74
|
}
|
|
38
|
-
catch {
|
|
75
|
+
catch (err) {
|
|
39
76
|
// A broken index must never break compilation; the graph is optional context.
|
|
40
|
-
|
|
77
|
+
// It must not go unmentioned either (AC-4).
|
|
78
|
+
return { markdown: null, warnings: [notReadable(err, projectRoot)] };
|
|
79
|
+
}
|
|
80
|
+
let warnings = [];
|
|
81
|
+
try {
|
|
82
|
+
warnings = sourceWarnings(engine, projectRoot);
|
|
83
|
+
const output = engine.context.generate({ type: 'full' }, { maxTokens });
|
|
84
|
+
if (output.entityCount === 0) {
|
|
85
|
+
// `generate` leaves out entities under the confidence floor, so an empty render
|
|
86
|
+
// is not an empty graph. Only an index with no rows means nothing could be read;
|
|
87
|
+
// a graph whose facts have all decayed renders nothing, as it always has (AC-12).
|
|
88
|
+
if (engine.index.getAllEntities().length > 0)
|
|
89
|
+
return { markdown: null, warnings };
|
|
90
|
+
return { markdown: null, warnings: [...warnings, noEntities(warnings.length > 0)] };
|
|
91
|
+
}
|
|
92
|
+
if (!output.markdown)
|
|
93
|
+
return { markdown: null, warnings };
|
|
94
|
+
return {
|
|
95
|
+
markdown: [
|
|
96
|
+
'# Codebase Knowledge',
|
|
97
|
+
'',
|
|
98
|
+
'Structured facts from the AIDLC knowledge graph. Query for more with',
|
|
99
|
+
'`aidlc knowledge query <term>` before re-exploring the code; record new',
|
|
100
|
+
'findings with `aidlc knowledge add` / `relate`.',
|
|
101
|
+
'',
|
|
102
|
+
output.markdown,
|
|
103
|
+
].join('\n'),
|
|
104
|
+
warnings,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
// The files already named are still worth naming (AC-1).
|
|
109
|
+
return { markdown: null, warnings: [...warnings, notReadable(err, projectRoot)] };
|
|
41
110
|
}
|
|
42
111
|
finally {
|
|
43
112
|
engine.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledge-section.js","sourceRoot":"","sources":["../../src/compile/knowledge-section.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"knowledge-section.js","sourceRoot":"","sources":["../../src/compile/knowledge-section.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAcvE,MAAM,MAAM,GAAG,mBAAmB,CAAC;AAEnC;;;;;GAKG;AACH,SAAS,QAAQ,CAAC,OAAe,EAAE,WAAmB;IACpD,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,WAAW,GAAG,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,WAAW,CAAC,GAAY,EAAE,WAAmB;IACpD,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,WAAW,CAAC,CAAC;IACxF,OAAO,CACL,GAAG,MAAM,sB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,EAAE,SAAS,EAAE,CAAC,CAAC;QACxE,IAAI,MAAM,CAAC,WAAW,KAAK,CAAC,EAAE,CAAC;YAC7B,gFAAgF;YAChF,iFAAiF;YACjF,kFAAkF;YAClF,IAAI,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,MAAM,GAAG,CAAC;gBAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;YAClF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,GAAG,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACtF,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,QAAQ;YAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAE1D,OAAO;YACL,QAAQ,EAAE;gBACR,sBAAsB;gBACtB,EAAE;gBACF,sEAAsE;gBACtE,yEAAyE;gBACzE,iDAAiD;gBACjD,EAAE;gBACF,MAAM,CAAC,QAAQ;aAChB,CAAC,IAAI,CAAC,IAAI,CAAC;YACZ,QAAQ;SACT,CAAC;IACJ,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,yDAAyD;QACzD,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,GAAG,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC;IACpF,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -15,18 +15,33 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function gitCommonDir(cwd: string): string | null;
|
|
17
17
|
/**
|
|
18
|
-
* The primary checkout's
|
|
18
|
+
* The primary checkout's copy of the project at `projectRoot`, or null outside a git
|
|
19
|
+
* repository (or wherever git reports no working tree).
|
|
19
20
|
*
|
|
20
|
-
* All worktrees share one common dir — the primary checkout's `.git` — so its
|
|
21
|
-
*
|
|
21
|
+
* All worktrees share one common dir — the primary checkout's `.git` — so its parent is
|
|
22
|
+
* the primary working tree. That is the *repository's* top, and an AIDLC project can sit
|
|
23
|
+
* below it (a monorepo package): the project is the primary working tree joined with
|
|
24
|
+
* the project's path inside its own working tree, which is the same path in every
|
|
25
|
+
* checkout of one repository (repo-root-is-not-the-project/AC-1). At the repository
|
|
26
|
+
* root that path is empty and this is the primary working tree, as before (AC-2).
|
|
22
27
|
*
|
|
23
|
-
*
|
|
24
|
-
* the concurrency gate
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
+
* It replaced `primaryWorkingTree`, which returned that top. Every caller of it — the
|
|
29
|
+
* roadmap, the concurrency gate (automation-verdicts/AC-8), autopilot — meant the
|
|
30
|
+
* project, and an export answering the wrong question beside this one is how one
|
|
31
|
+
* mistake reached five call sites. One resolution path, per this module's own DD1.
|
|
32
|
+
*
|
|
33
|
+
* `projectRoot` is the RESOLVED project root (`resolveProjectRoot`); every caller has
|
|
34
|
+
* one already, and resolving again here would be a second answer to "which project".
|
|
35
|
+
*
|
|
36
|
+
* `--show-toplevel`, not `--show-prefix`: the prefix is an empty line at the top, and
|
|
37
|
+
* trimming the output drops it, leaving one line that reads like a failure.
|
|
38
|
+
*
|
|
39
|
+
* A path that climbs out of git's working tree is never joined. `GIT_WORK_TREE` naming
|
|
40
|
+
* another directory makes `--show-toplevel` report a tree that does not contain the
|
|
41
|
+
* project; the answer is then the primary working tree, which every caller handles —
|
|
42
|
+
* null would instead switch the roadmap to this checkout's own copy.
|
|
28
43
|
*/
|
|
29
|
-
export declare function
|
|
44
|
+
export declare function primaryProjectRoot(projectRoot: string): string | null;
|
|
30
45
|
/**
|
|
31
46
|
* Resolve the writable coordination root `<common-dir>/aidlc/`, creating it
|
|
32
47
|
* on first use. Returns null outside a git repo (AC-5) or when the common
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-dir.d.ts","sourceRoot":"","sources":["../../src/concurrency/common-dir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"common-dir.d.ts","sourceRoot":"","sources":["../../src/concurrency/common-dir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAoBH;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWvD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkBrE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW3D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAgB/E;AAED,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAmBrD"}
|
|
@@ -9,8 +9,22 @@
|
|
|
9
9
|
* resolution path (design DD1).
|
|
10
10
|
*/
|
|
11
11
|
import { accessSync, constants, existsSync, mkdirSync, realpathSync } from 'node:fs';
|
|
12
|
-
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
12
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
13
13
|
import { execFileSync } from 'node:child_process';
|
|
14
|
+
/**
|
|
15
|
+
* A path `git` printed, made absolute against `cwd` and symlink-normalized, or left
|
|
16
|
+
* absolute when it cannot be resolved. One rule for every `git rev-parse` reader here,
|
|
17
|
+
* so two answers about the same directory compare equal.
|
|
18
|
+
*/
|
|
19
|
+
function canonical(path, cwd) {
|
|
20
|
+
const abs = isAbsolute(path) ? path : resolve(cwd, path);
|
|
21
|
+
try {
|
|
22
|
+
return realpathSync(abs);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return abs;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
14
28
|
/**
|
|
15
29
|
* Resolve the git common dir for `cwd`, or null outside a git repo (AC-5).
|
|
16
30
|
* Symlink-normalized (realpath) so the same dir compares equal regardless
|
|
@@ -23,33 +37,60 @@ export function gitCommonDir(cwd) {
|
|
|
23
37
|
encoding: 'utf8',
|
|
24
38
|
stdio: ['ignore', 'pipe', 'ignore'],
|
|
25
39
|
}).trim();
|
|
26
|
-
|
|
27
|
-
try {
|
|
28
|
-
return realpathSync(abs);
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
return abs;
|
|
32
|
-
}
|
|
40
|
+
return canonical(out, cwd);
|
|
33
41
|
}
|
|
34
42
|
catch {
|
|
35
43
|
return null;
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
46
|
/**
|
|
39
|
-
* The primary checkout's
|
|
47
|
+
* The primary checkout's copy of the project at `projectRoot`, or null outside a git
|
|
48
|
+
* repository (or wherever git reports no working tree).
|
|
49
|
+
*
|
|
50
|
+
* All worktrees share one common dir — the primary checkout's `.git` — so its parent is
|
|
51
|
+
* the primary working tree. That is the *repository's* top, and an AIDLC project can sit
|
|
52
|
+
* below it (a monorepo package): the project is the primary working tree joined with
|
|
53
|
+
* the project's path inside its own working tree, which is the same path in every
|
|
54
|
+
* checkout of one repository (repo-root-is-not-the-project/AC-1). At the repository
|
|
55
|
+
* root that path is empty and this is the primary working tree, as before (AC-2).
|
|
40
56
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
57
|
+
* It replaced `primaryWorkingTree`, which returned that top. Every caller of it — the
|
|
58
|
+
* roadmap, the concurrency gate (automation-verdicts/AC-8), autopilot — meant the
|
|
59
|
+
* project, and an export answering the wrong question beside this one is how one
|
|
60
|
+
* mistake reached five call sites. One resolution path, per this module's own DD1.
|
|
43
61
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
62
|
+
* `projectRoot` is the RESOLVED project root (`resolveProjectRoot`); every caller has
|
|
63
|
+
* one already, and resolving again here would be a second answer to "which project".
|
|
64
|
+
*
|
|
65
|
+
* `--show-toplevel`, not `--show-prefix`: the prefix is an empty line at the top, and
|
|
66
|
+
* trimming the output drops it, leaving one line that reads like a failure.
|
|
67
|
+
*
|
|
68
|
+
* A path that climbs out of git's working tree is never joined. `GIT_WORK_TREE` naming
|
|
69
|
+
* another directory makes `--show-toplevel` report a tree that does not contain the
|
|
70
|
+
* project; the answer is then the primary working tree, which every caller handles —
|
|
71
|
+
* null would instead switch the roadmap to this checkout's own copy.
|
|
49
72
|
*/
|
|
50
|
-
export function
|
|
51
|
-
|
|
52
|
-
|
|
73
|
+
export function primaryProjectRoot(projectRoot) {
|
|
74
|
+
let out;
|
|
75
|
+
try {
|
|
76
|
+
out = execFileSync('git', ['rev-parse', '--git-common-dir', '--show-toplevel'], {
|
|
77
|
+
cwd: projectRoot,
|
|
78
|
+
encoding: 'utf8',
|
|
79
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
80
|
+
})
|
|
81
|
+
.trim()
|
|
82
|
+
.split('\n');
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
if (out.length < 2)
|
|
88
|
+
return null;
|
|
89
|
+
const primary = dirname(canonical(out[0].trim(), projectRoot));
|
|
90
|
+
const rel = relative(canonical(out[1].trim(), projectRoot), canonical(resolve(projectRoot), projectRoot));
|
|
91
|
+
if (rel === '..' || rel.startsWith(`..${sep}`) || isAbsolute(rel))
|
|
92
|
+
return primary;
|
|
93
|
+
return join(primary, rel);
|
|
53
94
|
}
|
|
54
95
|
/**
|
|
55
96
|
* Resolve the writable coordination root `<common-dir>/aidlc/`, creating it
|
|
@@ -97,17 +138,8 @@ export function gitDirs(cwd) {
|
|
|
97
138
|
}
|
|
98
139
|
if (out.length < 2)
|
|
99
140
|
return null;
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
try {
|
|
103
|
-
return realpathSync(abs);
|
|
104
|
-
}
|
|
105
|
-
catch {
|
|
106
|
-
return abs;
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
const common = canonical(out[0].trim());
|
|
110
|
-
return { common, linked: canonical(out[1].trim()) !== common };
|
|
141
|
+
const common = canonical(out[0].trim(), cwd);
|
|
142
|
+
return { common, linked: canonical(out[1].trim(), cwd) !== common };
|
|
111
143
|
}
|
|
112
144
|
/** True when `cwd` is inside a linked worktree (not the primary checkout). */
|
|
113
145
|
export function isLinkedWorktree(cwd) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-dir.js","sourceRoot":"","sources":["../../src/concurrency/common-dir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"common-dir.js","sourceRoot":"","sources":["../../src/concurrency/common-dir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;GAIG;AACH,SAAS,SAAS,CAAC,IAAY,EAAE,GAAW;IAC1C,MAAM,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC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yConfig(projectRoot: string): ConcurrencyC
|
|
|
35
35
|
* where none of the three offered options fit and the instance was created by
|
|
36
36
|
* hand.
|
|
37
37
|
*
|
|
38
|
-
* @param primaryRoot - The primary checkout's
|
|
39
|
-
* when the caller does not know.
|
|
40
|
-
*
|
|
41
|
-
*
|
|
38
|
+
* @param primaryRoot - The primary checkout's copy of the project
|
|
39
|
+
* (`primaryProjectRoot`), or null/undefined when the caller does not know. It is
|
|
40
|
+
* compared with `projectRoot`, so it must name the same kind of directory: the
|
|
41
|
+
* checkout's top would never match a project below the repository root
|
|
42
|
+
* (repo-root-is-not-the-project/AC-4). A claim with no `worktree_path` was
|
|
43
|
+
* recorded from the primary checkout; without knowing where that is we cannot
|
|
44
|
+
* rule out that it is here, so it is treated as sharing. That is the fail-safe
|
|
42
45
|
* direction and it is exactly today's behaviour.
|
|
43
46
|
*
|
|
44
47
|
* Passed in rather than resolved here to keep NFR-1: this function stays pure
|
|
45
48
|
* reads — one directory listing plus YAML parses — and adds no git subprocess.
|
|
46
|
-
* `openClaimStore` has already paid for one `git rev-parse` by the time this
|
|
47
|
-
* runs, so the caller has the answer for free.
|
|
48
49
|
*/
|
|
49
50
|
export declare function detectConcurrency(store: ClaimStore, ownSessionId: string, timeoutMinutes: number, projectRoot: string, primaryRoot?: string | null, now?: Date): Detection;
|
|
50
51
|
//# sourceMappingURL=detect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../src/concurrency/detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EAAW,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAuB,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAEzF,uEAAuE;AACvE,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,iBAAiB,CAqB5E;AAED
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../src/concurrency/detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EAAW,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAuB,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAEzF,uEAAuE;AACvE,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,iBAAiB,CAqB5E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,UAAU,EACjB,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,EAC3B,GAAG,GAAE,IAAiB,GACrB,SAAS,CAmDX"}
|
|
@@ -58,16 +58,17 @@ export function loadConcurrencyConfig(projectRoot) {
|
|
|
58
58
|
* where none of the three offered options fit and the instance was created by
|
|
59
59
|
* hand.
|
|
60
60
|
*
|
|
61
|
-
* @param primaryRoot - The primary checkout's
|
|
62
|
-
* when the caller does not know.
|
|
63
|
-
*
|
|
64
|
-
*
|
|
61
|
+
* @param primaryRoot - The primary checkout's copy of the project
|
|
62
|
+
* (`primaryProjectRoot`), or null/undefined when the caller does not know. It is
|
|
63
|
+
* compared with `projectRoot`, so it must name the same kind of directory: the
|
|
64
|
+
* checkout's top would never match a project below the repository root
|
|
65
|
+
* (repo-root-is-not-the-project/AC-4). A claim with no `worktree_path` was
|
|
66
|
+
* recorded from the primary checkout; without knowing where that is we cannot
|
|
67
|
+
* rule out that it is here, so it is treated as sharing. That is the fail-safe
|
|
65
68
|
* direction and it is exactly today's behaviour.
|
|
66
69
|
*
|
|
67
70
|
* Passed in rather than resolved here to keep NFR-1: this function stays pure
|
|
68
71
|
* reads — one directory listing plus YAML parses — and adds no git subprocess.
|
|
69
|
-
* `openClaimStore` has already paid for one `git rev-parse` by the time this
|
|
70
|
-
* runs, so the caller has the answer for free.
|
|
71
72
|
*/
|
|
72
73
|
export function detectConcurrency(store, ownSessionId, timeoutMinutes, projectRoot, primaryRoot, now = new Date()) {
|
|
73
74
|
const holders = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../../src/concurrency/detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAmB,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAA0C,MAAM,YAAY,CAAC;AAEzF,uEAAuE;AACvE,MAAM,UAAU,qBAAqB,CAAC,WAAmB;IACvD,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;IAC9D,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO,mBAAmB,CAAC;IACxD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAEjD,CAAC;QACT,MAAM,KAAK,GAAG,MAAM,EAAE,WAAW,CAAC;QAClC,IAAI,CAAC,KAAK;YAAE,OAAO,mBAAmB,CAAC;QACvC,MAAM,IAAI,GACR,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB;YAChF,CAAC,CAAC,KAAK,CAAC,IAAI;YACZ,CAAC,CAAC,mBAAmB,CAAC,IAAI,CAAC;QAC/B,MAAM,YAAY,GAChB,OAAO,KAAK,CAAC,YAA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AAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC3E,MAAM,QAAQ,GAAG,QAAQ,KAAK,IAAI,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;QAEhF,6EAA6E;QAC7E,kDAAkD;QAClD,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC3C,OAAO,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/doctor/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,aAAa,GAAG,KAAK,CAAC,CAAC,GACtE,aAAa,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/doctor/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,aAAa,GAAG,KAAK,CAAC,CAAC,GACtE,aAAa,CAaf"}
|
package/dist/doctor/context.js
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* Doctor context construction: resolve git facts once so migrations never
|
|
3
3
|
* shell out for repo topology themselves (AC-12, AC-21).
|
|
4
4
|
*/
|
|
5
|
-
import { gitCommonDir, isLinkedWorktree } from '../concurrency/common-dir.js';
|
|
5
|
+
import { gitCommonDir, isLinkedWorktree, primaryProjectRoot } from '../concurrency/common-dir.js';
|
|
6
6
|
import { isInteractive } from '../core/tty.js';
|
|
7
7
|
export function buildDoctorContext(projectRoot, overrides) {
|
|
8
8
|
return {
|
|
9
9
|
projectRoot,
|
|
10
10
|
gitCommonDir: gitCommonDir(projectRoot),
|
|
11
11
|
isLinkedWorktree: isLinkedWorktree(projectRoot),
|
|
12
|
+
primaryProjectRoot: primaryProjectRoot(projectRoot),
|
|
12
13
|
now: overrides?.now ?? new Date(),
|
|
13
14
|
// Both streams, not stdout alone (tty-prompt-guard/AC-11): doctor's confirm
|
|
14
15
|
// reads keys from stdin, so a TTY stdout with a piped stdin would prompt into
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/doctor/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/doctor/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,MAAM,UAAU,kBAAkB,CAChC,WAAmB,EACnB,SAAuE;IAEvE,OAAO;QACL,WAAW;QACX,YAAY,EAAE,YAAY,CAAC,WAAW,CAAC;QACvC,gBAAgB,EAAE,gBAAgB,CAAC,WAAW,CAAC;QAC/C,kBAAkB,EAAE,kBAAkB,CAAC,WAAW,CAAC;QACnD,GAAG,EAAE,SAAS,EAAE,GAAG,IAAI,IAAI,IAAI,EAAE;QACjC,4EAA4E;QAC5E,8EAA8E;QAC9E,2CAA2C;QAC3C,WAAW,EAAE,SAAS,EAAE,WAAW,IAAI,aAAa,EAAE;QACtD,GAAG,EAAE,SAAS,EAAE,GAAG,IAAI,KAAK;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* better error message for it.
|
|
19
19
|
*
|
|
20
20
|
* **Nothing here spawns anything at all**, which is a stronger claim than "does not run
|
|
21
|
-
* `gh`". The primary checkout comes from `ctx.
|
|
21
|
+
* `gh`". The primary checkout comes from `ctx.primaryProjectRoot`, already resolved by
|
|
22
22
|
* `doctor/context.ts`, rather than from `roadmap/paths.ts`'s `primaryCheckout` — that
|
|
23
23
|
* helper shells out to `git rev-parse`, and reaching for it would have quietly made the
|
|
24
24
|
* no-subprocess claim false while every test still passed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roadmap-sync-gh-missing.d.ts","sourceRoot":"","sources":["../../../src/doctor/migrations/roadmap-sync-gh-missing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;
|
|
1
|
+
{"version":3,"file":"roadmap-sync-gh-missing.d.ts","sourceRoot":"","sources":["../../../src/doctor/migrations/roadmap-sync-gh-missing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAoBzE;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,WAAW,CAgCrF;AAED,eAAO,MAAM,oBAAoB,EAAE,SAMlC,CAAC"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* better error message for it.
|
|
19
19
|
*
|
|
20
20
|
* **Nothing here spawns anything at all**, which is a stronger claim than "does not run
|
|
21
|
-
* `gh`". The primary checkout comes from `ctx.
|
|
21
|
+
* `gh`". The primary checkout comes from `ctx.primaryProjectRoot`, already resolved by
|
|
22
22
|
* `doctor/context.ts`, rather than from `roadmap/paths.ts`'s `primaryCheckout` — that
|
|
23
23
|
* helper shells out to `git rev-parse`, and reaching for it would have quietly made the
|
|
24
24
|
* no-subprocess claim false while every test still passed.
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
*
|
|
32
32
|
* Requirements: issue-tracker-in-init/AC-23 … issue-tracker-in-init/AC-30
|
|
33
33
|
*/
|
|
34
|
-
import { dirname } from 'node:path';
|
|
35
34
|
import { readSyncConfig, syncConfigPath } from '../../roadmap/sync/config.js';
|
|
36
35
|
import { resolveGhOnPath } from '../../roadmap/sync/gh.js';
|
|
37
36
|
/**
|
|
@@ -43,11 +42,13 @@ import { resolveGhOnPath } from '../../roadmap/sync/gh.js';
|
|
|
43
42
|
* claim is that it performs no subprocess — calling the spawning helper would have made
|
|
44
43
|
* that claim false while every test still passed.
|
|
45
44
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
45
|
+
* Read, not re-derived. This used to compute `dirname(ctx.gitCommonDir)` itself — the
|
|
46
|
+
* repository's top, which for a project below it holds no config, so the check stayed
|
|
47
|
+
* silent for a project that had `roadmap.sync` (repo-root-is-not-the-project/AC-10).
|
|
48
|
+
* A context built by hand without the field reads as "outside git".
|
|
48
49
|
*/
|
|
49
50
|
function primaryRoot(ctx) {
|
|
50
|
-
return ctx.
|
|
51
|
+
return ctx.primaryProjectRoot ?? ctx.projectRoot;
|
|
51
52
|
}
|
|
52
53
|
/**
|
|
53
54
|
* The single source of pending-ness, with the resolved `gh` path supplied.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roadmap-sync-gh-missing.js","sourceRoot":"","sources":["../../../src/doctor/migrations/roadmap-sync-gh-missing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"roadmap-sync-gh-missing.js","sourceRoot":"","sources":["../../../src/doctor/migrations/roadmap-sync-gh-missing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAG3D;;;;;;;;;;;;;GAaG;AACH,SAAS,WAAW,CAAC,GAAkB;IACrC,OAAO,GAAG,CAAC,kBAAkB,IAAI,GAAG,CAAC,WAAW,CAAC;AACnD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,GAAkB,EAAE,MAAqB;IACtE,uFAAuF;IACvF,0FAA0F;IAC1F,6CAA6C;IAC7C,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAEpC,IAAI,MAAM,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;QACrC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,sCAAsC,EAAE,CAAC;IAC/E,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC9B,mFAAmF;QACnF,mFAAmF;QACnF,qFAAqF;QACrF,uEAAuE;QACvE,OAAO;YACL,UAAU,EAAE,KAAK;YACjB,MAAM,EAAE,gFAAgF,MAAM,CAAC,KAAK,EAAE;SACvG,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAEjE,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,IAAI;QACb,WAAW,EACT,+EAA+E;YAC/E,6EAA6E;YAC7E,qFAAqF;YACrF,QAAQ,cAAc,CAAC,IAAI,CAAC,4DAA4D;KAC3F,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAc;IAC7C,EAAE,EAAE,yBAAyB;IAC7B,IAAI,EAAE,QAAQ;IACd,KAAK,CAAC,GAAG;QACP,OAAO,cAAc,CAAC,GAAG,EAAE,eAAe,EAAE,CAAC,CAAC;IAChD,CAAC;CACF,CAAC"}
|
package/dist/doctor/types.d.ts
CHANGED
|
@@ -34,6 +34,12 @@ export interface DoctorContext {
|
|
|
34
34
|
gitCommonDir: string | null;
|
|
35
35
|
/** True when running from a linked worktree (AC-21). */
|
|
36
36
|
isLinkedWorktree: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The primary checkout's copy of the project, or null outside a git repo. Not
|
|
39
|
+
* `dirname(gitCommonDir)`: that is the repository's top, and a project can sit
|
|
40
|
+
* below it (repo-root-is-not-the-project/AC-10).
|
|
41
|
+
*/
|
|
42
|
+
primaryProjectRoot: string | null;
|
|
37
43
|
/** Injected clock so TTL migrations are deterministic in tests. */
|
|
38
44
|
now: Date;
|
|
39
45
|
/** stdout is a TTY — confirm-tier migrations may prompt (AC-23). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/doctor/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE1D,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B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EAAE,KAAK,EAAE,cAAc,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../src/knowledge/compact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,WAAW,aAAa;IAC5B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0BAA0B,EAAE,MAAM,CAAC;IACnC,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,GAAG,aAAa,CAsE9F"}
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { RELATIONSHIPS_FILE, sourceFileForType } from './types.js';
|
|
18
18
|
export function compactKnowledge(source, index) {
|
|
19
|
+
// Not `forIndex`: the files are rewritten from what this returns, so skipping a
|
|
20
|
+
// document the index cannot store would delete it from the YAML
|
|
21
|
+
// (knowledge-block-vanishes-silently design DD4).
|
|
19
22
|
const { entities, relationships, warnings } = source.loadAll();
|
|
20
23
|
// Keep the latest document per id (later lastVerified wins; ties keep last-seen,
|
|
21
24
|
// which is the most recently appended document).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact.js","sourceRoot":"","sources":["../../src/knowledge/compact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAYnE,MAAM,UAAU,gBAAgB,CAAC,MAAuB,EAAE,KAAqB;IAC7E,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IAE/D,i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