@rasensio/aidlc 2.26.0 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -5
- package/dist/autopilot/driver.d.ts +69 -7
- package/dist/autopilot/driver.d.ts.map +1 -1
- package/dist/autopilot/driver.js +371 -118
- package/dist/autopilot/driver.js.map +1 -1
- package/dist/autopilot/gitlab.d.ts +9 -0
- package/dist/autopilot/gitlab.d.ts.map +1 -1
- package/dist/autopilot/gitlab.js +21 -0
- package/dist/autopilot/gitlab.js.map +1 -1
- package/dist/autopilot/outcome.d.ts +72 -0
- package/dist/autopilot/outcome.d.ts.map +1 -0
- package/dist/autopilot/outcome.js +107 -0
- package/dist/autopilot/outcome.js.map +1 -0
- package/dist/autopilot/result.d.ts.map +1 -1
- package/dist/autopilot/result.js +8 -1
- package/dist/autopilot/result.js.map +1 -1
- package/dist/autopilot/retro.d.ts +7 -3
- package/dist/autopilot/retro.d.ts.map +1 -1
- package/dist/autopilot/retro.js +6 -2
- package/dist/autopilot/retro.js.map +1 -1
- package/dist/autopilot/state.d.ts +16 -1
- package/dist/autopilot/state.d.ts.map +1 -1
- package/dist/autopilot/state.js.map +1 -1
- package/dist/autopilot/team.d.ts +21 -1
- package/dist/autopilot/team.d.ts.map +1 -1
- package/dist/autopilot/team.js +27 -2
- package/dist/autopilot/team.js.map +1 -1
- package/dist/autopilot/typed.d.ts +10 -0
- package/dist/autopilot/typed.d.ts.map +1 -1
- package/dist/autopilot/typed.js +21 -0
- package/dist/autopilot/typed.js.map +1 -1
- package/dist/change/parser.d.ts.map +1 -1
- package/dist/change/parser.js +24 -2
- package/dist/change/parser.js.map +1 -1
- package/dist/change/types.d.ts +12 -1
- package/dist/change/types.d.ts.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +9 -0
- package/dist/cli.js.map +1 -1
- package/dist/closeout/gate-criterion.d.ts +33 -0
- package/dist/closeout/gate-criterion.d.ts.map +1 -0
- package/dist/closeout/gate-criterion.js +61 -0
- package/dist/closeout/gate-criterion.js.map +1 -0
- package/dist/closeout/hand-closeout.d.ts +43 -0
- package/dist/closeout/hand-closeout.d.ts.map +1 -0
- package/dist/closeout/hand-closeout.js +139 -0
- package/dist/closeout/hand-closeout.js.map +1 -0
- package/dist/closeout/outcome.d.ts +38 -0
- package/dist/closeout/outcome.d.ts.map +1 -0
- package/dist/closeout/outcome.js +141 -0
- package/dist/closeout/outcome.js.map +1 -0
- package/dist/commands/amend.js +11 -0
- package/dist/commands/amend.js.map +1 -1
- package/dist/commands/autopilot.d.ts +11 -1
- package/dist/commands/autopilot.d.ts.map +1 -1
- package/dist/commands/autopilot.js +97 -4
- package/dist/commands/autopilot.js.map +1 -1
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +51 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +5 -0
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/transition.d.ts.map +1 -1
- package/dist/commands/transition.js +70 -1
- package/dist/commands/transition.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +23 -4
- package/dist/commands/update.js.map +1 -1
- package/dist/compile/register-template.d.ts +12 -9
- package/dist/compile/register-template.d.ts.map +1 -1
- package/dist/compile/register-template.js +14 -31
- package/dist/compile/register-template.js.map +1 -1
- package/dist/compile/resource-template.d.ts +45 -0
- package/dist/compile/resource-template.d.ts.map +1 -0
- package/dist/compile/resource-template.js +53 -0
- package/dist/compile/resource-template.js.map +1 -0
- package/dist/compile/skill-metadata.d.ts +22 -1
- package/dist/compile/skill-metadata.d.ts.map +1 -1
- package/dist/compile/skill-metadata.js +55 -8
- package/dist/compile/skill-metadata.js.map +1 -1
- package/dist/compile/system-template.d.ts +38 -0
- package/dist/compile/system-template.d.ts.map +1 -0
- package/dist/compile/system-template.js +40 -0
- package/dist/compile/system-template.js.map +1 -0
- package/dist/compliance/report.d.ts +23 -0
- package/dist/compliance/report.d.ts.map +1 -1
- package/dist/compliance/report.js +72 -25
- package/dist/compliance/report.js.map +1 -1
- package/dist/concurrency/common-dir.d.ts +13 -0
- package/dist/concurrency/common-dir.d.ts.map +1 -1
- package/dist/concurrency/common-dir.js +9 -8
- package/dist/concurrency/common-dir.js.map +1 -1
- package/dist/concurrency/gitattributes.d.ts +2 -2
- package/dist/concurrency/gitattributes.d.ts.map +1 -1
- package/dist/concurrency/gitattributes.js +5 -14
- package/dist/concurrency/gitattributes.js.map +1 -1
- package/dist/console/operator/read.d.ts.map +1 -1
- package/dist/console/operator/read.js +2 -1
- package/dist/console/operator/read.js.map +1 -1
- package/dist/core/next-steps.d.ts.map +1 -1
- package/dist/core/next-steps.js +8 -0
- package/dist/core/next-steps.js.map +1 -1
- package/dist/core/project-version.d.ts +52 -0
- package/dist/core/project-version.d.ts.map +1 -0
- package/dist/core/project-version.js +188 -0
- package/dist/core/project-version.js.map +1 -0
- package/dist/core/template-resolver.d.ts.map +1 -1
- package/dist/core/template-resolver.js +90 -8
- package/dist/core/template-resolver.js.map +1 -1
- package/dist/core/types.d.ts +4 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/cost/dedupe-history.d.ts.map +1 -1
- package/dist/cost/dedupe-history.js +3 -2
- package/dist/cost/dedupe-history.js.map +1 -1
- package/dist/cost/gitignore.d.ts +9 -4
- package/dist/cost/gitignore.d.ts.map +1 -1
- package/dist/cost/gitignore.js +16 -5
- package/dist/cost/gitignore.js.map +1 -1
- package/dist/cost/ledger.d.ts +1 -4
- package/dist/cost/ledger.d.ts.map +1 -1
- package/dist/cost/ledger.js +25 -21
- package/dist/cost/ledger.js.map +1 -1
- package/dist/cost/purge.d.ts.map +1 -1
- package/dist/cost/purge.js +3 -2
- package/dist/cost/purge.js.map +1 -1
- package/dist/cost/record-paths.d.ts +42 -0
- package/dist/cost/record-paths.d.ts.map +1 -0
- package/dist/cost/record-paths.js +119 -0
- package/dist/cost/record-paths.js.map +1 -0
- package/dist/cost/rederive.d.ts.map +1 -1
- package/dist/cost/rederive.js +4 -3
- package/dist/cost/rederive.js.map +1 -1
- package/dist/cost/sessions.d.ts +1 -1
- package/dist/cost/sessions.d.ts.map +1 -1
- package/dist/cost/sessions.js +22 -12
- package/dist/cost/sessions.js.map +1 -1
- package/dist/discover/scanner.d.ts +11 -1
- package/dist/discover/scanner.d.ts.map +1 -1
- package/dist/discover/scanner.js +23 -2
- package/dist/discover/scanner.js.map +1 -1
- package/dist/doctor/migrations/cost-gitignore.d.ts.map +1 -1
- package/dist/doctor/migrations/cost-gitignore.js +18 -8
- package/dist/doctor/migrations/cost-gitignore.js.map +1 -1
- package/dist/doctor/migrations/cost-records-out-of-git.d.ts +39 -0
- package/dist/doctor/migrations/cost-records-out-of-git.d.ts.map +1 -0
- package/dist/doctor/migrations/cost-records-out-of-git.js +158 -0
- package/dist/doctor/migrations/cost-records-out-of-git.js.map +1 -0
- package/dist/doctor/migrations/decision-register-location.d.ts +59 -0
- package/dist/doctor/migrations/decision-register-location.d.ts.map +1 -0
- package/dist/doctor/migrations/decision-register-location.js +226 -0
- package/dist/doctor/migrations/decision-register-location.js.map +1 -0
- package/dist/doctor/migrations/deployment-outcome.d.ts +29 -0
- package/dist/doctor/migrations/deployment-outcome.d.ts.map +1 -0
- package/dist/doctor/migrations/deployment-outcome.js +89 -0
- package/dist/doctor/migrations/deployment-outcome.js.map +1 -0
- package/dist/doctor/migrations/index.d.ts.map +1 -1
- package/dist/doctor/migrations/index.js +16 -0
- package/dist/doctor/migrations/index.js.map +1 -1
- package/dist/doctor/migrations/nested-gitignore.d.ts +2 -2
- package/dist/doctor/migrations/nested-gitignore.js +2 -2
- package/dist/doctor/migrations/tracked-nested-ignored.d.ts.map +1 -1
- package/dist/doctor/migrations/tracked-nested-ignored.js +4 -1
- package/dist/doctor/migrations/tracked-nested-ignored.js.map +1 -1
- package/dist/doctor/migrations/untrack-cost-ephemera.d.ts +3 -1
- package/dist/doctor/migrations/untrack-cost-ephemera.d.ts.map +1 -1
- package/dist/doctor/migrations/untrack-cost-ephemera.js +3 -1
- package/dist/doctor/migrations/untrack-cost-ephemera.js.map +1 -1
- package/dist/knowledge/index/sqlite-index.d.ts.map +1 -1
- package/dist/knowledge/index/sqlite-index.js +13 -0
- package/dist/knowledge/index/sqlite-index.js.map +1 -1
- package/dist/knowledge/storable.d.ts +6 -3
- package/dist/knowledge/storable.d.ts.map +1 -1
- package/dist/knowledge/storable.js +10 -6
- package/dist/knowledge/storable.js.map +1 -1
- package/dist/metrics/report.d.ts.map +1 -1
- package/dist/metrics/report.js +2 -1
- package/dist/metrics/report.js.map +1 -1
- package/dist/roadmap/view-assets.d.ts +6 -0
- package/dist/roadmap/view-assets.d.ts.map +1 -1
- package/dist/roadmap/view-assets.js +11 -0
- package/dist/roadmap/view-assets.js.map +1 -1
- package/dist/roadmap/view-html.d.ts +4 -2
- package/dist/roadmap/view-html.d.ts.map +1 -1
- package/dist/roadmap/view-html.js +32 -6
- package/dist/roadmap/view-html.js.map +1 -1
- package/dist/roadmap/view-model.d.ts +39 -0
- package/dist/roadmap/view-model.d.ts.map +1 -1
- package/dist/roadmap/view-model.js +66 -0
- package/dist/roadmap/view-model.js.map +1 -1
- package/dist/setup/setup-compute.d.ts +5 -0
- package/dist/setup/setup-compute.d.ts.map +1 -1
- package/dist/setup/setup-compute.js +1 -0
- package/dist/setup/setup-compute.js.map +1 -1
- package/dist/setup/tier-models.d.ts +51 -0
- package/dist/setup/tier-models.d.ts.map +1 -0
- package/dist/setup/tier-models.js +175 -0
- package/dist/setup/tier-models.js.map +1 -0
- package/dist/traceability/parser.d.ts.map +1 -1
- package/dist/traceability/parser.js +10 -0
- package/dist/traceability/parser.js.map +1 -1
- package/package.json +2 -2
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
* The ignore lines and their rationale live in cost/gitignore.ts, because the
|
|
7
7
|
* shim writer applies them too.
|
|
8
8
|
*/
|
|
9
|
-
import { describeIgnoreWork, missingIgnoreLines, removeSelfIgnoreLines, selfIgnoreLineCount, summarizeIgnoreWork, } from './nested-gitignore.js';
|
|
10
|
-
import { COST_IGNORE_LINES, costIgnorePath,
|
|
9
|
+
import { describeIgnoreWork, missingIgnoreLines, removeSelfIgnoreLines, selfIgnoreLineCount, summarizeIgnoreWork, ensureIgnoreLines, } from './nested-gitignore.js';
|
|
10
|
+
import { COST_IGNORE_LINES, STATE_IGNORE_LINES, costIgnorePath, stateIgnorePath } from '../../cost/gitignore.js';
|
|
11
11
|
export { COST_IGNORE_LINES };
|
|
12
12
|
const REL_PATH = '.aidlc/cost/.gitignore';
|
|
13
|
+
const STATE_REL_PATH = '.aidlc/state/.gitignore';
|
|
13
14
|
export const costGitignore = {
|
|
14
15
|
id: 'cost-gitignore',
|
|
15
16
|
tier: 'safe',
|
|
@@ -18,19 +19,28 @@ export const costGitignore = {
|
|
|
18
19
|
return { applicable: false, reason: 'requires a git repository' };
|
|
19
20
|
}
|
|
20
21
|
const ignore = costIgnorePath(ctx.projectRoot);
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
// Both files, one migration: the state file holds the old record paths' lines,
|
|
23
|
+
// which this keeps current the way it keeps the cost file (finished-work-tidies-itself/AC-2).
|
|
24
|
+
const parts = [
|
|
25
|
+
describeIgnoreWork(REL_PATH, selfIgnoreLineCount(ignore), missingIgnoreLines(ignore, COST_IGNORE_LINES)),
|
|
26
|
+
describeIgnoreWork(STATE_REL_PATH, 0, missingIgnoreLines(stateIgnorePath(ctx.projectRoot), STATE_IGNORE_LINES)),
|
|
27
|
+
].filter((d) => d !== null);
|
|
28
|
+
if (parts.length === 0)
|
|
23
29
|
return { applicable: true, pending: false };
|
|
24
|
-
return { applicable: true, pending: true, description };
|
|
30
|
+
return { applicable: true, pending: true, description: parts.join('; ') };
|
|
25
31
|
},
|
|
26
32
|
apply(ctx) {
|
|
27
33
|
// Remove first: a file that held only the self-ignore line is then empty, and the
|
|
28
34
|
// lines are written into it without a leading blank line.
|
|
29
35
|
const removed = removeSelfIgnoreLines(costIgnorePath(ctx.projectRoot));
|
|
30
|
-
const added =
|
|
36
|
+
const added = ensureIgnoreLines(costIgnorePath(ctx.projectRoot), COST_IGNORE_LINES);
|
|
37
|
+
const stateAdded = ensureIgnoreLines(stateIgnorePath(ctx.projectRoot), STATE_IGNORE_LINES);
|
|
38
|
+
const summary = [summarizeIgnoreWork(REL_PATH, removed, added)];
|
|
39
|
+
if (stateAdded.length > 0)
|
|
40
|
+
summary.push(summarizeIgnoreWork(STATE_REL_PATH, 0, stateAdded));
|
|
31
41
|
return {
|
|
32
|
-
changed: removed > 0 || added.length > 0,
|
|
33
|
-
summary:
|
|
42
|
+
changed: removed > 0 || added.length > 0 || stateAdded.length > 0,
|
|
43
|
+
summary: summary.join('; '),
|
|
34
44
|
};
|
|
35
45
|
},
|
|
36
46
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost-gitignore.js","sourceRoot":"","sources":["../../../src/doctor/migrations/cost-gitignore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"cost-gitignore.js","sourceRoot":"","sources":["../../../src/doctor/migrations/cost-gitignore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEjH,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAE7B,MAAM,QAAQ,GAAG,wBAAwB,CAAC;AAC1C,MAAM,cAAc,GAAG,yBAAyB,CAAC;AAEjD,M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G,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC,CAAC;QAC3F,MAAM,OAAO,GAAG,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;QAChE,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,cAAc,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;QAC5F,OAAO;YACL,OAAO,EAAE,OAAO,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;YACjE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;SAC5B,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cost-records-out-of-git migration (confirm tier): moves the cost ledgers and session
|
|
3
|
+
* logs a checkout still holds at their old paths under `.aidlc/` into the records
|
|
4
|
+
* directory in the git common directory, then untracks and deletes the old files
|
|
5
|
+
* (finished-work-tidies-itself/AC-2).
|
|
6
|
+
*
|
|
7
|
+
* Order per run, so an interrupted run loses nothing (NFR "safe to interrupt"): append
|
|
8
|
+
* every missing record to the new file, then `git rm --cached` the tracked ones, then
|
|
9
|
+
* delete the old files, then write the ignore lines. Interrupted anywhere, records sit in
|
|
10
|
+
* both places, which the readers count once (AC-9), and the next run finds what is left.
|
|
11
|
+
*
|
|
12
|
+
* Blocked on a staged index exactly as untrack-cost-ephemera is: its `git rm --cached`
|
|
13
|
+
* must not tangle with a commit the person is preparing.
|
|
14
|
+
*/
|
|
15
|
+
import type { Migration } from '../types.js';
|
|
16
|
+
/** Every old-path record file on disk in this checkout, relative to projectRoot, `/`-separated. */
|
|
17
|
+
export declare function legacyRecordFiles(projectRoot: string): string[];
|
|
18
|
+
/** The records-directory file an old-path file's records belong in. `rel` is one `legacyRecordFiles` named. */
|
|
19
|
+
export declare function recordDestination(projectRoot: string, rel: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Append each line of `from` not already in `to` (trimmed, byte for byte). Returns the
|
|
22
|
+
* number of lines appended. Never touches `from`, so the worktree tidy can call it on a
|
|
23
|
+
* worktree without dirtying it.
|
|
24
|
+
*/
|
|
25
|
+
export declare function appendMissingLines(from: string, to: string): number;
|
|
26
|
+
/**
|
|
27
|
+
* Append every old-path record file's missing lines to its records-directory file, byte
|
|
28
|
+
* for byte (AC-2), and return how many were appended. Shared by the migration and the
|
|
29
|
+
* worktree tidy.
|
|
30
|
+
*
|
|
31
|
+
* No line is skipped for any other reason. A pre-move branch's unattributed copy can hold a
|
|
32
|
+
* record `cost sync` has since moved into an instance; `cost sync` drops that copy by its own
|
|
33
|
+
* time rule on its next run. Skipping by cursor here would be wrong: capture puts one cursor
|
|
34
|
+
* on every entry of a pass, so an unattributed record and a different instance record share
|
|
35
|
+
* one (pull request check 2).
|
|
36
|
+
*/
|
|
37
|
+
export declare function appendRecordFiles(projectRoot: string, files: string[]): number;
|
|
38
|
+
export declare const costRecordsOutOfGit: Migration;
|
|
39
|
+
//# sourceMappingURL=cost-records-out-of-git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cost-records-out-of-git.d.ts","sourceRoot":"","sources":["../../../src/doctor/migrations/cost-records-out-of-git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAQ7C,mGAAmG;AACnG,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAmB/D;AAED,+GAA+G;AAC/G,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAI1E;AAUD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAcnE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAM9E;AAOD,eAAO,MAAM,mBAAmB,EAAE,SAmDjC,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cost-records-out-of-git migration (confirm tier): moves the cost ledgers and session
|
|
3
|
+
* logs a checkout still holds at their old paths under `.aidlc/` into the records
|
|
4
|
+
* directory in the git common directory, then untracks and deletes the old files
|
|
5
|
+
* (finished-work-tidies-itself/AC-2).
|
|
6
|
+
*
|
|
7
|
+
* Order per run, so an interrupted run loses nothing (NFR "safe to interrupt"): append
|
|
8
|
+
* every missing record to the new file, then `git rm --cached` the tracked ones, then
|
|
9
|
+
* delete the old files, then write the ignore lines. Interrupted anywhere, records sit in
|
|
10
|
+
* both places, which the readers count once (AC-9), and the next run finds what is left.
|
|
11
|
+
*
|
|
12
|
+
* Blocked on a staged index exactly as untrack-cost-ephemera is: its `git rm --cached`
|
|
13
|
+
* must not tangle with a commit the person is preparing.
|
|
14
|
+
*/
|
|
15
|
+
import { execFileSync } from 'node:child_process';
|
|
16
|
+
import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, unlinkSync } from 'node:fs';
|
|
17
|
+
import { dirname, join } from 'node:path';
|
|
18
|
+
import { trackedFiles, hasStagedChanges, shellQuote } from '../git.js';
|
|
19
|
+
import { ledgerPath, recordsDir, sessionsPath, unattributedPath } from '../../cost/record-paths.js';
|
|
20
|
+
import { ensureCostGitignore } from '../../cost/gitignore.js';
|
|
21
|
+
const UNATTRIBUTED = '.aidlc/cost/unattributed.ndjson';
|
|
22
|
+
const STATE_FILES = ['costs.ndjson', 'sessions.ndjson'];
|
|
23
|
+
/** Every old-path record file on disk in this checkout, relative to projectRoot, `/`-separated. */
|
|
24
|
+
export function legacyRecordFiles(projectRoot) {
|
|
25
|
+
const out = [];
|
|
26
|
+
if (existsSync(join(projectRoot, UNATTRIBUTED)))
|
|
27
|
+
out.push(UNATTRIBUTED);
|
|
28
|
+
const stateDir = join(projectRoot, '.aidlc', 'state');
|
|
29
|
+
let dirs = [];
|
|
30
|
+
try {
|
|
31
|
+
dirs = readdirSync(stateDir, { withFileTypes: true })
|
|
32
|
+
.filter((d) => d.isDirectory())
|
|
33
|
+
.map((d) => d.name)
|
|
34
|
+
.sort();
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
for (const name of dirs) {
|
|
40
|
+
for (const file of STATE_FILES) {
|
|
41
|
+
if (existsSync(join(stateDir, name, file)))
|
|
42
|
+
out.push(`.aidlc/state/${name}/${file}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
/** The records-directory file an old-path file's records belong in. `rel` is one `legacyRecordFiles` named. */
|
|
48
|
+
export function recordDestination(projectRoot, rel) {
|
|
49
|
+
if (rel === UNATTRIBUTED)
|
|
50
|
+
return unattributedPath(projectRoot);
|
|
51
|
+
const [, , instance, file] = rel.split('/');
|
|
52
|
+
return file === 'costs.ndjson' ? ledgerPath(projectRoot, instance) : sessionsPath(projectRoot, instance);
|
|
53
|
+
}
|
|
54
|
+
function nonEmptyLines(path) {
|
|
55
|
+
if (!existsSync(path))
|
|
56
|
+
return [];
|
|
57
|
+
return readFileSync(path, 'utf8')
|
|
58
|
+
.split('\n')
|
|
59
|
+
.map((l) => l.trim())
|
|
60
|
+
.filter((l) => l !== '');
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Append each line of `from` not already in `to` (trimmed, byte for byte). Returns the
|
|
64
|
+
* number of lines appended. Never touches `from`, so the worktree tidy can call it on a
|
|
65
|
+
* worktree without dirtying it.
|
|
66
|
+
*/
|
|
67
|
+
export function appendMissingLines(from, to) {
|
|
68
|
+
const have = new Set(nonEmptyLines(to));
|
|
69
|
+
const add = [];
|
|
70
|
+
for (const line of nonEmptyLines(from)) {
|
|
71
|
+
if (have.has(line))
|
|
72
|
+
continue;
|
|
73
|
+
have.add(line);
|
|
74
|
+
add.push(line);
|
|
75
|
+
}
|
|
76
|
+
if (add.length === 0)
|
|
77
|
+
return 0;
|
|
78
|
+
mkdirSync(dirname(to), { recursive: true });
|
|
79
|
+
const body = existsSync(to) ? readFileSync(to, 'utf8') : '';
|
|
80
|
+
const prefix = body === '' || body.endsWith('\n') ? '' : '\n';
|
|
81
|
+
appendFileSync(to, prefix + add.join('\n') + '\n');
|
|
82
|
+
return add.length;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Append every old-path record file's missing lines to its records-directory file, byte
|
|
86
|
+
* for byte (AC-2), and return how many were appended. Shared by the migration and the
|
|
87
|
+
* worktree tidy.
|
|
88
|
+
*
|
|
89
|
+
* No line is skipped for any other reason. A pre-move branch's unattributed copy can hold a
|
|
90
|
+
* record `cost sync` has since moved into an instance; `cost sync` drops that copy by its own
|
|
91
|
+
* time rule on its next run. Skipping by cursor here would be wrong: capture puts one cursor
|
|
92
|
+
* on every entry of a pass, so an unattributed record and a different instance record share
|
|
93
|
+
* one (pull request check 2).
|
|
94
|
+
*/
|
|
95
|
+
export function appendRecordFiles(projectRoot, files) {
|
|
96
|
+
let appended = 0;
|
|
97
|
+
for (const rel of files) {
|
|
98
|
+
appended += appendMissingLines(join(projectRoot, rel), recordDestination(projectRoot, rel));
|
|
99
|
+
}
|
|
100
|
+
return appended;
|
|
101
|
+
}
|
|
102
|
+
/** Records in the old files: what the description promises to move. */
|
|
103
|
+
function recordCount(projectRoot, files) {
|
|
104
|
+
return files.reduce((n, f) => n + new Set(nonEmptyLines(join(projectRoot, f))).size, 0);
|
|
105
|
+
}
|
|
106
|
+
export const costRecordsOutOfGit = {
|
|
107
|
+
id: 'cost-records-out-of-git',
|
|
108
|
+
tier: 'confirm',
|
|
109
|
+
check(ctx) {
|
|
110
|
+
if (ctx.gitCommonDir === null) {
|
|
111
|
+
return { applicable: false, reason: 'requires a git repository' };
|
|
112
|
+
}
|
|
113
|
+
const dir = recordsDir(ctx.projectRoot);
|
|
114
|
+
if (dir === null) {
|
|
115
|
+
return { applicable: false, reason: 'the git common directory cannot be written' };
|
|
116
|
+
}
|
|
117
|
+
const files = legacyRecordFiles(ctx.projectRoot);
|
|
118
|
+
if (files.length === 0)
|
|
119
|
+
return { applicable: true, pending: false };
|
|
120
|
+
const tracked = trackedFiles(ctx.projectRoot, files);
|
|
121
|
+
const commands = tracked.length > 0 ? [`git rm --cached --quiet -- ${tracked.map(shellQuote).join(' ')}`] : [];
|
|
122
|
+
const untrack = tracked.length > 0 ? `, untrack ${tracked.length},` : '';
|
|
123
|
+
const description = `would move ${files.length} cost and session record file(s) ` +
|
|
124
|
+
`(${recordCount(ctx.projectRoot, files)} records) to ${dir}${untrack} and delete the old files`;
|
|
125
|
+
if (tracked.length > 0 && hasStagedChanges(ctx.projectRoot)) {
|
|
126
|
+
return {
|
|
127
|
+
applicable: true,
|
|
128
|
+
pending: true,
|
|
129
|
+
description,
|
|
130
|
+
commands,
|
|
131
|
+
blocked: 'git index has staged changes — commit or unstage them first, then re-run aidlc doctor',
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return { applicable: true, pending: true, description, commands };
|
|
135
|
+
},
|
|
136
|
+
apply(ctx) {
|
|
137
|
+
const files = legacyRecordFiles(ctx.projectRoot);
|
|
138
|
+
if (files.length === 0)
|
|
139
|
+
return { changed: false, summary: 'no record files at the old paths' };
|
|
140
|
+
const appended = appendRecordFiles(ctx.projectRoot, files);
|
|
141
|
+
const tracked = trackedFiles(ctx.projectRoot, files);
|
|
142
|
+
if (tracked.length > 0) {
|
|
143
|
+
execFileSync('git', ['rm', '--cached', '--quiet', '--', ...tracked], {
|
|
144
|
+
cwd: ctx.projectRoot,
|
|
145
|
+
stdio: ['ignore', 'ignore', 'pipe'],
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
for (const rel of files)
|
|
149
|
+
unlinkSync(join(ctx.projectRoot, rel));
|
|
150
|
+
ensureCostGitignore(ctx.projectRoot);
|
|
151
|
+
const staged = tracked.length > 0 ? `; ${tracked.length} staged as deletions, commit when ready` : '';
|
|
152
|
+
return {
|
|
153
|
+
changed: true,
|
|
154
|
+
summary: `moved ${files.length} record file(s) to ${recordsDir(ctx.projectRoot)} (${appended} new records)${staged}`,
|
|
155
|
+
};
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
//# sourceMappingURL=cost-records-out-of-git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cost-records-out-of-git.js","sourceRoot":"","sources":["../../../src/doctor/migrations/cost-records-out-of-git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACvG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,YAAY,GAAG,iCAAiC,CAAC;AACvD,MAAM,WAAW,GAAG,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;AAExD,mGAAmG;AACnG,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACnD,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,IAAI,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,YAAY,CA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AAW,EAAE,KAAK,CAAC,CAAC;QAC3D,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QACrD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,YAAY,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,EAAE;gBACnE,GAAG,EAAE,GAAG,CAAC,WAAW;gBACpB,KAAK,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC;aACpC,CAAC,CAAC;QACL,CAAC;QACD,KAAK,MAAM,GAAG,IAAI,KAAK;YAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC;QAChE,mBAAmB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACrC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,MAAM,yCAAyC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtG,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,SAAS,KAAK,CAAC,MAAM,sBAAsB,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,QAAQ,gBAAgB,MAAM,EAAE;SACrH,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Move a decision register from the folder it first shipped in to `.aidlc/decisions/`
|
|
3
|
+
* (move-decision-register-into-aidlc/AC-3 … AC-9).
|
|
4
|
+
*
|
|
5
|
+
* The register is the project's own record, so the move is a rename and never a
|
|
6
|
+
* read-then-write: its bytes are not opened. An existing target is never overwritten —
|
|
7
|
+
* with both files present the `report`-tier sibling says so and nothing moves (AC-6).
|
|
8
|
+
* Nothing is staged or committed (AC-8): `git status` shows the whole change, and
|
|
9
|
+
* `git checkout`/`git clean` undoes it.
|
|
10
|
+
*
|
|
11
|
+
* **The old folder is written as segments**, never as one string. AC-1 asks that nothing
|
|
12
|
+
* in `packages/` name it; this module is the one place that must still know it, to move
|
|
13
|
+
* it (design D4).
|
|
14
|
+
*
|
|
15
|
+
* **Two ids.** `both` must be stated on every run and must never apply, which is exactly
|
|
16
|
+
* the `report` tier; folding it into the `safe` move would need a pending result the
|
|
17
|
+
* runner then applies (design D5).
|
|
18
|
+
*
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
import type { Migration } from '../types.js';
|
|
22
|
+
/** The folder the register shipped in, as segments (design D4). */
|
|
23
|
+
export declare const LEGACY_DIR_SEGMENTS: readonly ["docs", "adr"];
|
|
24
|
+
/** For messages and the `git grep` pattern. */
|
|
25
|
+
export declare const LEGACY_DIR: string;
|
|
26
|
+
export declare const LEGACY_REGISTER_PATH: string;
|
|
27
|
+
export type RegisterLocation = 'none' | 'legacy' | 'current' | 'both';
|
|
28
|
+
export declare function registerLocation(projectRoot: string): RegisterLocation;
|
|
29
|
+
/**
|
|
30
|
+
* Rewrite matching `source:` lines; every other byte is returned unchanged (AC-4).
|
|
31
|
+
*
|
|
32
|
+
* Line edits, not a YAML round-trip: re-dumping would reflow long descriptions (design D3).
|
|
33
|
+
* A `description:` naming the path is not a `source:` line, so it is left alone and turns
|
|
34
|
+
* up in the remaining-mentions list instead.
|
|
35
|
+
*/
|
|
36
|
+
export declare function rewriteSourceLines(text: string): {
|
|
37
|
+
text: string;
|
|
38
|
+
count: number;
|
|
39
|
+
};
|
|
40
|
+
/** Knowledge files holding at least one legacy `source:` line, with their counts. */
|
|
41
|
+
export declare function legacyPointers(projectRoot: string): {
|
|
42
|
+
file: string;
|
|
43
|
+
count: number;
|
|
44
|
+
}[];
|
|
45
|
+
export interface RemainingMentions {
|
|
46
|
+
live: string[];
|
|
47
|
+
history: string[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Tracked files still naming the old folder; null outside git (AC-5).
|
|
51
|
+
*
|
|
52
|
+
* Only tracked files are searched. The two moved files are excluded by name, since the
|
|
53
|
+
* index still holds them at the old path until the owner commits. Every listed file is
|
|
54
|
+
* read by git, never written here.
|
|
55
|
+
*/
|
|
56
|
+
export declare function remainingMentions(projectRoot: string, gitCommonDir: string | null): RemainingMentions | null;
|
|
57
|
+
export declare const decisionRegisterLocation: Migration;
|
|
58
|
+
export declare const decisionRegisterTwoCopies: Migration;
|
|
59
|
+
//# sourceMappingURL=decision-register-location.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision-register-location.d.ts","sourceRoot":"","sources":["../../../src/doctor/migrations/decision-register-location.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AASH,OAAO,KAAK,EAA2C,SAAS,EAAE,MAAM,aAAa,CAAC;AAEtF,mEAAmE;AACnE,eAAO,MAAM,mBAAmB,0BAA2B,CAAC;AAC5D,+CAA+C;AAC/C,eAAO,MAAM,UAAU,QAAgC,CAAC;AACxD,eAAO,MAAM,oBAAoB,QAAuC,CAAC;AASzE,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAEtE,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB,CAMtE;AAYD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAShF;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAcrF;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,iBAAiB,GAAG,IAAI,CAqB5G;AAiCD,eAAO,MAAM,wBAAwB,EAAE,SAgEtC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,SAavC,CAAC"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Move a decision register from the folder it first shipped in to `.aidlc/decisions/`
|
|
3
|
+
* (move-decision-register-into-aidlc/AC-3 … AC-9).
|
|
4
|
+
*
|
|
5
|
+
* The register is the project's own record, so the move is a rename and never a
|
|
6
|
+
* read-then-write: its bytes are not opened. An existing target is never overwritten —
|
|
7
|
+
* with both files present the `report`-tier sibling says so and nothing moves (AC-6).
|
|
8
|
+
* Nothing is staged or committed (AC-8): `git status` shows the whole change, and
|
|
9
|
+
* `git checkout`/`git clean` undoes it.
|
|
10
|
+
*
|
|
11
|
+
* **The old folder is written as segments**, never as one string. AC-1 asks that nothing
|
|
12
|
+
* in `packages/` name it; this module is the one place that must still know it, to move
|
|
13
|
+
* it (design D4).
|
|
14
|
+
*
|
|
15
|
+
* **Two ids.** `both` must be stated on every run and must never apply, which is exactly
|
|
16
|
+
* the `report` tier; folding it into the `safe` move would need a pending result the
|
|
17
|
+
* runner then applies (design D5).
|
|
18
|
+
*
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
import { execFileSync } from 'node:child_process';
|
|
22
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmdirSync, writeFileSync } from 'node:fs';
|
|
23
|
+
import { join } from 'node:path';
|
|
24
|
+
import { REGISTER_PATH, REGISTER_SEGMENTS } from '../../compile/register-template.js';
|
|
25
|
+
import { KNOWLEDGE_DIR } from '../../knowledge/types.js';
|
|
26
|
+
import { YamlSourceStore } from '../../knowledge/yaml-source.js';
|
|
27
|
+
/** The folder the register shipped in, as segments (design D4). */
|
|
28
|
+
export const LEGACY_DIR_SEGMENTS = ['docs', 'adr'];
|
|
29
|
+
/** For messages and the `git grep` pattern. */
|
|
30
|
+
export const LEGACY_DIR = LEGACY_DIR_SEGMENTS.join('/');
|
|
31
|
+
export const LEGACY_REGISTER_PATH = `${LEGACY_DIR}/decision-register.md`;
|
|
32
|
+
const README = 'README.md';
|
|
33
|
+
const NEW_DIR_SEGMENTS = REGISTER_SEGMENTS.slice(0, -1);
|
|
34
|
+
const NEW_DIR = NEW_DIR_SEGMENTS.join('/');
|
|
35
|
+
/** Paths under these hold history: listed, never asked to change (AC-5). */
|
|
36
|
+
const HISTORY_PREFIXES = ['.aidlc/state/', '.aidlc/roadmap/done/'];
|
|
37
|
+
export function registerLocation(projectRoot) {
|
|
38
|
+
const legacy = existsSync(join(projectRoot, ...LEGACY_DIR_SEGMENTS, 'decision-register.md'));
|
|
39
|
+
const current = existsSync(join(projectRoot, ...REGISTER_SEGMENTS));
|
|
40
|
+
if (legacy && current)
|
|
41
|
+
return 'both';
|
|
42
|
+
if (legacy)
|
|
43
|
+
return 'legacy';
|
|
44
|
+
return current ? 'current' : 'none';
|
|
45
|
+
}
|
|
46
|
+
const escapeRe = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
47
|
+
/**
|
|
48
|
+
* A whole `source:` line naming the old path: indent, the key, the path bare or in one
|
|
49
|
+
* matching pair of quotes, trailing spaces, and a `\r` kept with the line.
|
|
50
|
+
*/
|
|
51
|
+
const SOURCE_LINE = new RegExp(`^(\\s*source:\\s+)(['"]?)${escapeRe(LEGACY_REGISTER_PATH)}\\2(\\s*\\r?)$`);
|
|
52
|
+
/**
|
|
53
|
+
* Rewrite matching `source:` lines; every other byte is returned unchanged (AC-4).
|
|
54
|
+
*
|
|
55
|
+
* Line edits, not a YAML round-trip: re-dumping would reflow long descriptions (design D3).
|
|
56
|
+
* A `description:` naming the path is not a `source:` line, so it is left alone and turns
|
|
57
|
+
* up in the remaining-mentions list instead.
|
|
58
|
+
*/
|
|
59
|
+
export function rewriteSourceLines(text) {
|
|
60
|
+
let count = 0;
|
|
61
|
+
const lines = text.split('\n').map((line) => {
|
|
62
|
+
const m = SOURCE_LINE.exec(line);
|
|
63
|
+
if (!m)
|
|
64
|
+
return line;
|
|
65
|
+
count++;
|
|
66
|
+
return `${m[1]}${m[2]}${REGISTER_PATH}${m[2]}${m[3]}`;
|
|
67
|
+
});
|
|
68
|
+
return { text: lines.join('\n'), count };
|
|
69
|
+
}
|
|
70
|
+
/** Knowledge files holding at least one legacy `source:` line, with their counts. */
|
|
71
|
+
export function legacyPointers(projectRoot) {
|
|
72
|
+
const dir = join(projectRoot, KNOWLEDGE_DIR);
|
|
73
|
+
const found = [];
|
|
74
|
+
for (const file of new YamlSourceStore(dir).listSourceFiles()) {
|
|
75
|
+
let text;
|
|
76
|
+
try {
|
|
77
|
+
text = readFileSync(join(dir, file), 'utf8');
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const { count } = rewriteSourceLines(text);
|
|
83
|
+
if (count > 0)
|
|
84
|
+
found.push({ file: `${KNOWLEDGE_DIR}/${file}`, count });
|
|
85
|
+
}
|
|
86
|
+
return found;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Tracked files still naming the old folder; null outside git (AC-5).
|
|
90
|
+
*
|
|
91
|
+
* Only tracked files are searched. The two moved files are excluded by name, since the
|
|
92
|
+
* index still holds them at the old path until the owner commits. Every listed file is
|
|
93
|
+
* read by git, never written here.
|
|
94
|
+
*/
|
|
95
|
+
export function remainingMentions(projectRoot, gitCommonDir) {
|
|
96
|
+
if (gitCommonDir === null)
|
|
97
|
+
return null;
|
|
98
|
+
let out;
|
|
99
|
+
try {
|
|
100
|
+
out = execFileSync('git', [
|
|
101
|
+
'grep', '-l', '-z', '-F', `${LEGACY_DIR}/`, '--', '.',
|
|
102
|
+
`:(exclude)${LEGACY_REGISTER_PATH}`,
|
|
103
|
+
`:(exclude)${LEGACY_DIR}/${README}`,
|
|
104
|
+
], { cwd: projectRoot, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
// Exit 1 is git grep's "no match"; anything else means the list cannot be trusted.
|
|
108
|
+
if (err.status === 1)
|
|
109
|
+
return { live: [], history: [] };
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
const files = out.split('\0').filter((f) => f.length > 0).sort();
|
|
113
|
+
const isHistory = (f) => HISTORY_PREFIXES.some((p) => f.startsWith(p));
|
|
114
|
+
return { live: files.filter((f) => !isHistory(f)), history: files.filter(isHistory) };
|
|
115
|
+
}
|
|
116
|
+
function pointerPhrase(pointers) {
|
|
117
|
+
const fields = pointers.reduce((n, p) => n + p.count, 0);
|
|
118
|
+
return `point ${fields} knowledge source field(s) in ${pointers.length} file(s) at ${REGISTER_PATH}`;
|
|
119
|
+
}
|
|
120
|
+
function legacyDirWouldEmpty(projectRoot, readmeMoves) {
|
|
121
|
+
const moving = new Set(['decision-register.md', ...(readmeMoves ? [README] : [])]);
|
|
122
|
+
try {
|
|
123
|
+
return readdirSync(join(projectRoot, ...LEGACY_DIR_SEGMENTS)).every((f) => moving.has(f));
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function readmeMoves(projectRoot) {
|
|
130
|
+
return (existsSync(join(projectRoot, ...LEGACY_DIR_SEGMENTS, README)) &&
|
|
131
|
+
!existsSync(join(projectRoot, ...NEW_DIR_SEGMENTS, README)));
|
|
132
|
+
}
|
|
133
|
+
function mentionsBlock(m) {
|
|
134
|
+
if (m === null)
|
|
135
|
+
return `Files still naming ${LEGACY_DIR}/ are not listed: that needs git.`;
|
|
136
|
+
const total = m.live.length + m.history.length;
|
|
137
|
+
if (total === 0)
|
|
138
|
+
return `No other tracked file names ${LEGACY_DIR}/.`;
|
|
139
|
+
const lines = [`${total} tracked file(s) still name ${LEGACY_DIR}/.`];
|
|
140
|
+
if (m.live.length > 0)
|
|
141
|
+
lines.push('Update these:', ...m.live.map((f) => ` ${f}`));
|
|
142
|
+
if (m.history.length > 0)
|
|
143
|
+
lines.push('Left as written (history):', ...m.history.map((f) => ` ${f}`));
|
|
144
|
+
return lines.join('\n');
|
|
145
|
+
}
|
|
146
|
+
export const decisionRegisterLocation = {
|
|
147
|
+
id: 'decision-register-location',
|
|
148
|
+
tier: 'safe',
|
|
149
|
+
check(ctx) {
|
|
150
|
+
const where = registerLocation(ctx.projectRoot);
|
|
151
|
+
// Never `applicable: false`: the runner prints a not-applicable result on every run,
|
|
152
|
+
// and a second run must say nothing about the register (AC-7).
|
|
153
|
+
const clean = { applicable: true, pending: false };
|
|
154
|
+
if (where !== 'legacy' && where !== 'current')
|
|
155
|
+
return clean;
|
|
156
|
+
const pointers = legacyPointers(ctx.projectRoot);
|
|
157
|
+
if (where === 'current') {
|
|
158
|
+
// A hand move, or a run that stopped after the rename: finish the rewrite (design D6).
|
|
159
|
+
if (pointers.length === 0)
|
|
160
|
+
return clean;
|
|
161
|
+
return { applicable: true, pending: true, description: `would ${pointerPhrase(pointers)}` };
|
|
162
|
+
}
|
|
163
|
+
const readme = readmeMoves(ctx.projectRoot);
|
|
164
|
+
let description = `would move ${LEGACY_REGISTER_PATH} to ${REGISTER_PATH}`;
|
|
165
|
+
if (readme)
|
|
166
|
+
description += ` and ${LEGACY_DIR}/${README} to ${NEW_DIR}/${README}`;
|
|
167
|
+
if (legacyDirWouldEmpty(ctx.projectRoot, readme))
|
|
168
|
+
description += `, and remove the empty ${LEGACY_DIR}/`;
|
|
169
|
+
if (pointers.length > 0)
|
|
170
|
+
description += `, then ${pointerPhrase(pointers)}`;
|
|
171
|
+
return { applicable: true, pending: true, description };
|
|
172
|
+
},
|
|
173
|
+
apply(ctx) {
|
|
174
|
+
const root = ctx.projectRoot;
|
|
175
|
+
const where = registerLocation(root);
|
|
176
|
+
if (where !== 'legacy' && where !== 'current') {
|
|
177
|
+
return { changed: false, summary: 'nothing to do' };
|
|
178
|
+
}
|
|
179
|
+
const done = [];
|
|
180
|
+
if (where === 'legacy') {
|
|
181
|
+
const target = join(root, ...REGISTER_SEGMENTS);
|
|
182
|
+
// renameSync replaces an existing target on POSIX; this check is what keeps AC-6 true.
|
|
183
|
+
if (existsSync(target))
|
|
184
|
+
return { changed: false, summary: 'nothing to do' };
|
|
185
|
+
mkdirSync(join(root, ...NEW_DIR_SEGMENTS), { recursive: true });
|
|
186
|
+
renameSync(join(root, ...LEGACY_DIR_SEGMENTS, 'decision-register.md'), target);
|
|
187
|
+
done.push(`moved ${LEGACY_REGISTER_PATH} to ${REGISTER_PATH}`);
|
|
188
|
+
if (readmeMoves(root)) {
|
|
189
|
+
renameSync(join(root, ...LEGACY_DIR_SEGMENTS, README), join(root, ...NEW_DIR_SEGMENTS, README));
|
|
190
|
+
done.push(`moved ${LEGACY_DIR}/${README} to ${NEW_DIR}/${README}`);
|
|
191
|
+
}
|
|
192
|
+
try {
|
|
193
|
+
// rmdirSync refuses a folder that is not empty: the AC-3 guard twice over.
|
|
194
|
+
rmdirSync(join(root, ...LEGACY_DIR_SEGMENTS));
|
|
195
|
+
done.push(`removed the empty ${LEGACY_DIR}/`);
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
// other files live there; the folder stays
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const pointers = legacyPointers(root);
|
|
202
|
+
for (const { file } of pointers) {
|
|
203
|
+
const path = join(root, ...file.split('/'));
|
|
204
|
+
writeFileSync(path, rewriteSourceLines(readFileSync(path, 'utf8')).text, 'utf8');
|
|
205
|
+
}
|
|
206
|
+
if (pointers.length > 0)
|
|
207
|
+
done.push(pointerPhrase(pointers).replace(/^point/, 'pointed'));
|
|
208
|
+
const summary = [done.join('; '), mentionsBlock(remainingMentions(root, ctx.gitCommonDir))].join('\n');
|
|
209
|
+
return { changed: true, summary };
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
export const decisionRegisterTwoCopies = {
|
|
213
|
+
id: 'decision-register-two-copies',
|
|
214
|
+
tier: 'report',
|
|
215
|
+
check(ctx) {
|
|
216
|
+
if (registerLocation(ctx.projectRoot) !== 'both')
|
|
217
|
+
return { applicable: true, pending: false };
|
|
218
|
+
return {
|
|
219
|
+
applicable: true,
|
|
220
|
+
pending: true,
|
|
221
|
+
description: `two decision registers: ${LEGACY_REGISTER_PATH} and ${REGISTER_PATH}. ` +
|
|
222
|
+
'Nothing was moved. Keep the one you want and delete the other.',
|
|
223
|
+
};
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
//# sourceMappingURL=decision-register-location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decision-register-location.js","sourceRoot":"","sources":["../../../src/doctor/migrations/decision-register-location.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGjE,mEAAmE;AACnE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,KAAK,CAAU,CAAC;AAC5D,+CAA+C;AAC/C,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACxD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,UAAU,uBA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O,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACpC,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAc;IAClD,EAAE,EAAE,8BAA8B;IAClC,IAAI,EAAE,QAAQ;IACd,KAAK,CAAC,GAAG;QACP,IAAI,gBAAgB,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,MAAM;YAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC9F,OAAO;YACL,UAAU,EAAE,IAAI;YAChB,OAAO,EAAE,IAAI;YACb,WAAW,EACT,2BAA2B,oBAAoB,QAAQ,aAAa,IAAI;gBACxE,gEAAgE;SACnE,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `deployment-outcome` (report tier): completed instances whose deployment record says nothing
|
|
3
|
+
* about what happened after the merge (closeout-requires-outcome-half/AC-15, AC-16, AC-17).
|
|
4
|
+
*
|
|
5
|
+
* Leaving deployment now needs a written `## Outcome`, but every instance closed before that
|
|
6
|
+
* was "complete" by its artifact status alone. This names them so they can be backfilled. It
|
|
7
|
+
* reads with `readOutcome`, the transition's own reader, so doctor and the transition cannot
|
|
8
|
+
* disagree about what counts as written (design D1).
|
|
9
|
+
*
|
|
10
|
+
* **Why `report`.** The remedy is writing what happened, which doctor cannot know; a confirm
|
|
11
|
+
* tier would turn doctor's exit code red for history (AC-15).
|
|
12
|
+
*
|
|
13
|
+
* **Capped at 20 lines**, as `bare-ac-in-tests` is: this repo has ~180 such records, and a
|
|
14
|
+
* block that scrolls is one nobody reads. The header counts all of them (AC-16).
|
|
15
|
+
*
|
|
16
|
+
* Reads `ctx.projectRoot`: state is committed, so a branch is judged on its own tree.
|
|
17
|
+
*/
|
|
18
|
+
import type { Migration } from '../types.js';
|
|
19
|
+
export declare const MAX_LISTED = 20;
|
|
20
|
+
export interface UnwrittenOutcome {
|
|
21
|
+
instance: string;
|
|
22
|
+
/** Project-relative. */
|
|
23
|
+
record: string;
|
|
24
|
+
why: string;
|
|
25
|
+
}
|
|
26
|
+
/** Every completed instance whose record is missing or unwritten, in sorted instance order. */
|
|
27
|
+
export declare function unwrittenOutcomes(projectRoot: string): UnwrittenOutcome[];
|
|
28
|
+
export declare const deploymentOutcome: Migration;
|
|
29
|
+
//# sourceMappingURL=deployment-outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment-outcome.d.ts","sourceRoot":"","sources":["../../../src/doctor/migrations/deployment-outcome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAE1D,eAAO,MAAM,UAAU,KAAK,CAAC;AAE7B,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAID,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAsCzE;AAED,eAAO,MAAM,iBAAiB,EAAE,SAoB/B,CAAC"}
|