@aperant/framework 0.6.7 → 0.7.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/cli/commands/ci-watch.d.mts.map +1 -1
  3. package/dist/cli/commands/ci-watch.mjs +39 -1
  4. package/dist/cli/commands/ci-watch.mjs.map +1 -1
  5. package/dist/cli/commands/health-check.mjs +1 -1
  6. package/dist/cli/commands/health-check.mjs.map +1 -1
  7. package/dist/cli/commands/init.d.mts +10 -1
  8. package/dist/cli/commands/init.d.mts.map +1 -1
  9. package/dist/cli/commands/init.mjs +94 -4
  10. package/dist/cli/commands/init.mjs.map +1 -1
  11. package/dist/cli/commands/route.d.mts.map +1 -1
  12. package/dist/cli/commands/route.mjs +37 -2
  13. package/dist/cli/commands/route.mjs.map +1 -1
  14. package/dist/cli/commands/task.d.mts.map +1 -1
  15. package/dist/cli/commands/task.mjs +48 -0
  16. package/dist/cli/commands/task.mjs.map +1 -1
  17. package/dist/cli/help.d.mts.map +1 -1
  18. package/dist/cli/help.mjs +1 -0
  19. package/dist/cli/help.mjs.map +1 -1
  20. package/dist/cli/host/detect.d.mts +122 -9
  21. package/dist/cli/host/detect.d.mts.map +1 -1
  22. package/dist/cli/host/detect.mjs +132 -0
  23. package/dist/cli/host/detect.mjs.map +1 -1
  24. package/dist/cli/install/legacy-paths.d.mts +38 -0
  25. package/dist/cli/install/legacy-paths.d.mts.map +1 -0
  26. package/dist/cli/install/legacy-paths.mjs +69 -0
  27. package/dist/cli/install/legacy-paths.mjs.map +1 -0
  28. package/dist/cli/install/runtime-migrate.d.mts +84 -0
  29. package/dist/cli/install/runtime-migrate.d.mts.map +1 -0
  30. package/dist/cli/install/runtime-migrate.mjs +244 -0
  31. package/dist/cli/install/runtime-migrate.mjs.map +1 -0
  32. package/dist/cli/route/drift-detect.d.mts +20 -0
  33. package/dist/cli/route/drift-detect.d.mts.map +1 -0
  34. package/dist/cli/route/drift-detect.mjs +107 -0
  35. package/dist/cli/route/drift-detect.mjs.map +1 -0
  36. package/dist/cli/util/aperant-section.d.mts +34 -0
  37. package/dist/cli/util/aperant-section.d.mts.map +1 -0
  38. package/dist/cli/util/aperant-section.mjs +127 -0
  39. package/dist/cli/util/aperant-section.mjs.map +1 -0
  40. package/dist/cli/util/copy.d.mts +28 -1
  41. package/dist/cli/util/copy.d.mts.map +1 -1
  42. package/dist/cli/util/copy.mjs +43 -55
  43. package/dist/cli/util/copy.mjs.map +1 -1
  44. package/dist/cli/util/semver.d.mts +17 -0
  45. package/dist/cli/util/semver.d.mts.map +1 -0
  46. package/dist/cli/util/semver.mjs +29 -0
  47. package/dist/cli/util/semver.mjs.map +1 -0
  48. package/dist/cli/util/skill-installs.d.mts +65 -9
  49. package/dist/cli/util/skill-installs.d.mts.map +1 -1
  50. package/dist/cli/util/skill-installs.mjs +130 -21
  51. package/dist/cli/util/skill-installs.mjs.map +1 -1
  52. package/dist/cli/util/version-preflight.d.mts +44 -0
  53. package/dist/cli/util/version-preflight.d.mts.map +1 -0
  54. package/dist/cli/util/version-preflight.mjs +66 -0
  55. package/dist/cli/util/version-preflight.mjs.map +1 -0
  56. package/package.json +1 -1
  57. package/skills/apt-close-task/SKILL.md +5 -0
  58. package/skills/apt-ship/SKILL.md +16 -4
  59. package/skills/apt-spar/SKILL.md +36 -11
  60. package/skills/apt-update/SKILL.md +26 -1
  61. package/skills/apt-watch-ci/SKILL.md +4 -1
  62. package/src/cli/commands/ci-watch.mjs +39 -1
  63. package/src/cli/commands/health-check.mjs +1 -1
  64. package/src/cli/commands/init.mjs +102 -2
  65. package/src/cli/commands/route.mjs +38 -2
  66. package/src/cli/commands/task.mjs +49 -0
  67. package/src/cli/help.mjs +1 -0
  68. package/src/cli/host/detect.mjs +135 -0
  69. package/src/cli/install/legacy-paths.mjs +69 -0
  70. package/src/cli/install/runtime-migrate.mjs +252 -0
  71. package/src/cli/route/drift-detect.mjs +107 -0
  72. package/src/cli/util/aperant-section.mjs +136 -0
  73. package/src/cli/util/copy.mjs +43 -56
  74. package/src/cli/util/semver.mjs +28 -0
  75. package/src/cli/util/skill-installs.mjs +134 -21
  76. package/src/cli/util/version-preflight.mjs +65 -0
  77. package/templates/aperant-claude-md-appendix.md +37 -0
@@ -0,0 +1,69 @@
1
+ /**
2
+ * install/legacy-paths.mjs — shared registry of legacy install topologies
3
+ * the framework once wrote to but no longer owns. Single source of truth
4
+ * for both:
5
+ *
6
+ * - BUG-021: `runLegacyCleanup` in `install/runtime-migrate.mjs` knows
7
+ * which files under a legacy root are framework-owned (safe to
8
+ * remove) vs user-added (preserve).
9
+ * - BUG-022: `readSkillInstallState` in `util/skill-installs.mjs` falls
10
+ * back to `version_file` here when no manifest is present, so a
11
+ * pre-manifest install still surfaces as "installed" rather than
12
+ * "missing-skills".
13
+ *
14
+ * Derivation: the codex `framework_files` list was extracted from
15
+ * `git show 1a8dd8a8 --stat` (the original "make Codex a first-class
16
+ * skill install surface" commit) — every `.agents/skills/…` path the
17
+ * installer once wrote, including the `.apt-version` stamp and the
18
+ * apt-pr-review / apt-discuss / apt-verify-proof sub-files. When the
19
+ * codex installer was retargeted to `.codex/`, that entire tree became
20
+ * orphaned on upgrading projects.
21
+ *
22
+ * Schema:
23
+ * { [runtimeId]: {
24
+ * install_root: relative path the runtime once wrote into,
25
+ * version_file: relative path of the legacy `.apt-version` stamp,
26
+ * framework_files: array of relative paths the installer once owned
27
+ * (under install_root).
28
+ * } }
29
+ *
30
+ * Frozen via Object.freeze so callers cannot mutate the shared registry.
31
+ */
32
+ /** @type {Record<string, { install_root: string, version_file: string, framework_files: ReadonlyArray<string> }>} */
33
+ export const LEGACY_INSTALL_PATHS = Object.freeze({
34
+ codex: Object.freeze({
35
+ install_root: '.agents/skills',
36
+ version_file: '.agents/skills/.apt-version',
37
+ framework_files: Object.freeze([
38
+ '.apt-version',
39
+ 'apt/SKILL.md',
40
+ 'apt-debug/SKILL.md',
41
+ 'apt-discuss/SKILL.md',
42
+ 'apt-discuss/examples/rationalization-example.md',
43
+ 'apt-docs/SKILL.md',
44
+ 'apt-execute/SKILL.md',
45
+ 'apt-pause/SKILL.md',
46
+ 'apt-plan/SKILL.md',
47
+ 'apt-pr-review/SCHEMA.md',
48
+ 'apt-pr-review/SKILL.md',
49
+ 'apt-pr-review/prompts/fp-gate-codex.md',
50
+ 'apt-pr-review/templates/external-comment.md',
51
+ 'apt-quick/SKILL.md',
52
+ 'apt-resume/SKILL.md',
53
+ 'apt-review/SKILL.md',
54
+ 'apt-roadmap/SKILL.md',
55
+ 'apt-roundtable/SKILL.md',
56
+ 'apt-run/SKILL.md',
57
+ 'apt-scan/SKILL.md',
58
+ 'apt-setup/SKILL.md',
59
+ 'apt-ship/SKILL.md',
60
+ 'apt-stress-test/SKILL.md',
61
+ 'apt-verify/SKILL.md',
62
+ 'apt-verify-proof/SKILL.md',
63
+ 'apt-verify-proof/references/multi-model-setup.md',
64
+ 'apt-verify-proof/references/multi-model-verification.md',
65
+ 'apt-verify-proof/references/proof-capture.md',
66
+ ]),
67
+ }),
68
+ });
69
+ //# sourceMappingURL=legacy-paths.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy-paths.mjs","sourceRoot":"","sources":["../../../src/cli/install/legacy-paths.mjs"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,qHAAqH;AACrH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;QACpB,YAAY,EAAE,gBAAgB;QAC9B,YAAY,EAAE,6BAA6B;QAC3C,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC;YAC9B,cAAc;YACd,cAAc;YACd,oBAAoB;YACpB,sBAAsB;YACtB,iDAAiD;YACjD,mBAAmB;YACnB,sBAAsB;YACtB,oBAAoB;YACpB,mBAAmB;YACnB,yBAAyB;YACzB,wBAAwB;YACxB,wCAAwC;YACxC,6CAA6C;YAC7C,oBAAoB;YACpB,qBAAqB;YACrB,qBAAqB;YACrB,sBAAsB;YACtB,yBAAyB;YACzB,kBAAkB;YAClB,mBAAmB;YACnB,oBAAoB;YACpB,mBAAmB;YACnB,0BAA0B;YAC1B,qBAAqB;YACrB,2BAA2B;YAC3B,kDAAkD;YAClD,yDAAyD;YACzD,8CAA8C;SAC9C,CAAC;KACF,CAAC;CACF,CAAC,CAAA"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Probe the codex legacy install tree at `<targetDir>/.agents/skills/`.
3
+ *
4
+ * @param {string} targetDir
5
+ * @returns {LegacyCodexDetection}
6
+ */
7
+ export function detectLegacyCodexTree(targetDir: string): LegacyCodexDetection;
8
+ /**
9
+ * Clean up the legacy `.agents/skills/` tree if it looks orphaned.
10
+ *
11
+ * Branches:
12
+ * 1. `present: false` OR `frameworkFiles.length === 0` → no-op,
13
+ * `{ ran: false, reason: 'no-legacy' }`.
14
+ * 2. `hasManifest: true` → managed install, no-op,
15
+ * `{ ran: false, reason: 'managed' }`.
16
+ * 3. Otherwise: per-file `unlinkSync` each framework-owned file;
17
+ * `rmdirSync` any now-empty `apt-*` subdirectory; sweep
18
+ * `.agents/skills/` only if it is empty; sweep `.agents/` only if
19
+ * its `skills/` got removed and `.agents/` is empty.
20
+ *
21
+ * Returns `{ ran: true, removed, retained, rmdirs }` on the cleanup
22
+ * branch:
23
+ * - `removed` — relative paths under `install_root` that were unlinked.
24
+ * - `retained` — relative paths under `install_root` that were NOT
25
+ * removed (user-added skills / files not in the legacy set).
26
+ * - `rmdirs` — absolute paths of directories that were removed
27
+ * (apt-* subdirs, the install_root itself, .agents/), in removal order.
28
+ *
29
+ * Atomicity: per-file unlink is non-atomic. A partial-failure scenario
30
+ * (process killed mid-loop) is tolerable — the next `init` run will
31
+ * re-detect the remaining framework files and finish the sweep.
32
+ *
33
+ * @param {{ targetDir: string, dryRun?: boolean }} args
34
+ * @returns {
35
+ * | { ran: false, reason: 'no-legacy' | 'managed' }
36
+ * | { ran: true, removed: string[], retained: string[], rmdirs: string[] }
37
+ * }
38
+ */
39
+ export function runLegacyCleanup({ targetDir, dryRun }: {
40
+ targetDir: string;
41
+ dryRun?: boolean;
42
+ }): any | {
43
+ ran: false;
44
+ reason: "no-legacy" | "managed";
45
+ } | {
46
+ ran: true;
47
+ removed: string[];
48
+ retained: string[];
49
+ rmdirs: string[];
50
+ };
51
+ export type LegacyCodexDetection = {
52
+ /**
53
+ * True when `.agents/skills/` exists.
54
+ */
55
+ present: boolean;
56
+ /**
57
+ * Subset of `framework_files` that
58
+ * actually exist on disk (relative
59
+ * to install_root).
60
+ */
61
+ frameworkFiles: string[];
62
+ /**
63
+ * Everything else under
64
+ * install_root (relative to
65
+ * install_root). May include both
66
+ * files and directories. Drives the
67
+ * `retained[]` warning.
68
+ */
69
+ userFiles: string[];
70
+ /**
71
+ * Whether the legacy `.apt-version`
72
+ * stamp is present.
73
+ */
74
+ hasAptVersion: boolean;
75
+ /**
76
+ * Whether an
77
+ * `apt-file-manifest.json` is
78
+ * present at install_root (signals
79
+ * a managed install — cleanup
80
+ * should no-op).
81
+ */
82
+ hasManifest: boolean;
83
+ };
84
+ //# sourceMappingURL=runtime-migrate.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-migrate.d.mts","sourceRoot":"","sources":["../../../src/cli/install/runtime-migrate.mjs"],"names":[],"mappings":"AA8FA;;;;;GAKG;AACH,iDAHW,MAAM,GACJ,oBAAoB,CA0BhC;AAmBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wDANW;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAEjD,GAAC,GAAK;IAAE,GAAG,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAA;CAAE,GAC/C;IAAE,GAAG,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAgF5E;;;;;aAxNa,OAAO;;;;;;oBACP,MAAM,EAAE;;;;;;;;eAGR,MAAM,EAAE;;;;;mBAKR,OAAO;;;;;;;;iBAEP,OAAO"}
@@ -0,0 +1,244 @@
1
+ /**
2
+ * install/runtime-migrate.mjs — at-install cleanup of legacy install
3
+ * trees the framework no longer owns (FRAMEWORK-BUG-021).
4
+ *
5
+ * Codex was originally installed into `.agents/skills/` (commit 1a8dd8a8)
6
+ * and later moved to `.codex/`. Projects that upgraded across that move
7
+ * end up with a stale `.agents/skills/` tree that:
8
+ *
9
+ * - keeps `.apt-version` on disk → the legacy fallback in
10
+ * `readSkillInstallState` reports a stale codex install.
11
+ * - shows up in `health-check` as `stale-skills`.
12
+ * - leaves dozens of orphaned SKILL.md files the runtime no longer
13
+ * reads.
14
+ *
15
+ * `runLegacyCleanup` runs once per `apt-tools init` when codex is in the
16
+ * requested runtime set. It is conservative by default:
17
+ *
18
+ * - Only files listed in `LEGACY_INSTALL_PATHS.codex.framework_files`
19
+ * are removed. User-added skill directories (`my-skill/`, …) are
20
+ * preserved. If anything beyond the known framework set remains,
21
+ * `retained[]` lists those paths.
22
+ * - A present-and-current `apt-file-manifest.json` is treated as the
23
+ * authoritative "this is a managed install, leave it alone" signal:
24
+ * the function no-ops with `reason: 'managed'`.
25
+ * - The caller can suppress cleanup entirely via `--keep-legacy` at the
26
+ * init.mjs site; the function itself is dumb about flags.
27
+ */
28
+ import { existsSync, readdirSync, rmdirSync, unlinkSync } from 'node:fs';
29
+ import { dirname, join } from 'node:path';
30
+ import { LEGACY_INSTALL_PATHS } from './legacy-paths.mjs';
31
+ import { MANIFEST_FILENAME } from './manifest.mjs';
32
+ /**
33
+ * @typedef {Object} LegacyCodexDetection
34
+ * @property {boolean} present True when `.agents/skills/` exists.
35
+ * @property {string[]} frameworkFiles Subset of `framework_files` that
36
+ * actually exist on disk (relative
37
+ * to install_root).
38
+ * @property {string[]} userFiles Everything else under
39
+ * install_root (relative to
40
+ * install_root). May include both
41
+ * files and directories. Drives the
42
+ * `retained[]` warning.
43
+ * @property {boolean} hasAptVersion Whether the legacy `.apt-version`
44
+ * stamp is present.
45
+ * @property {boolean} hasManifest Whether an
46
+ * `apt-file-manifest.json` is
47
+ * present at install_root (signals
48
+ * a managed install — cleanup
49
+ * should no-op).
50
+ */
51
+ const LEGACY = LEGACY_INSTALL_PATHS.codex;
52
+ /**
53
+ * Recursively enumerate every file path under `dir`, returning paths
54
+ * relative to `dir`. Used to compute the "user files" set (anything not
55
+ * in the framework_files list).
56
+ *
57
+ * Returns [] when the dir doesn't exist. Swallows per-entry errors so a
58
+ * single unreadable symlink doesn't abort detection.
59
+ *
60
+ * @param {string} dir
61
+ * @returns {string[]}
62
+ */
63
+ function walkRelative(dir) {
64
+ /** @type {string[]} */
65
+ const out = [];
66
+ if (!existsSync(dir))
67
+ return out;
68
+ /** @param {string} current @param {string} rel */
69
+ const visit = (current, rel) => {
70
+ let entries;
71
+ try {
72
+ entries = readdirSync(current, { withFileTypes: true });
73
+ }
74
+ catch {
75
+ return;
76
+ }
77
+ for (const entry of entries) {
78
+ const childPath = join(current, entry.name);
79
+ const childRel = rel ? `${rel}/${entry.name}` : entry.name;
80
+ if (entry.isDirectory()) {
81
+ visit(childPath, childRel);
82
+ }
83
+ else if (entry.isFile()) {
84
+ out.push(childRel);
85
+ }
86
+ // Symlinks / other entry types are intentionally ignored — the
87
+ // framework only ever writes regular files.
88
+ }
89
+ };
90
+ visit(dir, '');
91
+ return out;
92
+ }
93
+ /**
94
+ * Probe the codex legacy install tree at `<targetDir>/.agents/skills/`.
95
+ *
96
+ * @param {string} targetDir
97
+ * @returns {LegacyCodexDetection}
98
+ */
99
+ export function detectLegacyCodexTree(targetDir) {
100
+ const installRoot = join(targetDir, LEGACY.install_root);
101
+ if (!existsSync(installRoot)) {
102
+ return {
103
+ present: false,
104
+ frameworkFiles: [],
105
+ userFiles: [],
106
+ hasAptVersion: false,
107
+ hasManifest: false,
108
+ };
109
+ }
110
+ const onDisk = walkRelative(installRoot);
111
+ const frameworkSet = new Set(LEGACY.framework_files);
112
+ const frameworkFiles = onDisk.filter((p) => frameworkSet.has(p));
113
+ const userFiles = onDisk.filter((p) => !frameworkSet.has(p) && p !== MANIFEST_FILENAME);
114
+ return {
115
+ present: true,
116
+ frameworkFiles,
117
+ userFiles,
118
+ hasAptVersion: onDisk.includes('.apt-version'),
119
+ hasManifest: onDisk.includes(MANIFEST_FILENAME),
120
+ };
121
+ }
122
+ /**
123
+ * Try to remove a directory if it is empty. Swallows ENOTEMPTY / ENOENT
124
+ * so the caller can blindly sweep candidate dirs in any order.
125
+ *
126
+ * @param {string} dir
127
+ * @returns {boolean} true iff the dir was actually removed.
128
+ */
129
+ function rmEmptyDir(dir) {
130
+ if (!existsSync(dir))
131
+ return false;
132
+ try {
133
+ rmdirSync(dir);
134
+ return true;
135
+ }
136
+ catch {
137
+ return false;
138
+ }
139
+ }
140
+ /**
141
+ * Clean up the legacy `.agents/skills/` tree if it looks orphaned.
142
+ *
143
+ * Branches:
144
+ * 1. `present: false` OR `frameworkFiles.length === 0` → no-op,
145
+ * `{ ran: false, reason: 'no-legacy' }`.
146
+ * 2. `hasManifest: true` → managed install, no-op,
147
+ * `{ ran: false, reason: 'managed' }`.
148
+ * 3. Otherwise: per-file `unlinkSync` each framework-owned file;
149
+ * `rmdirSync` any now-empty `apt-*` subdirectory; sweep
150
+ * `.agents/skills/` only if it is empty; sweep `.agents/` only if
151
+ * its `skills/` got removed and `.agents/` is empty.
152
+ *
153
+ * Returns `{ ran: true, removed, retained, rmdirs }` on the cleanup
154
+ * branch:
155
+ * - `removed` — relative paths under `install_root` that were unlinked.
156
+ * - `retained` — relative paths under `install_root` that were NOT
157
+ * removed (user-added skills / files not in the legacy set).
158
+ * - `rmdirs` — absolute paths of directories that were removed
159
+ * (apt-* subdirs, the install_root itself, .agents/), in removal order.
160
+ *
161
+ * Atomicity: per-file unlink is non-atomic. A partial-failure scenario
162
+ * (process killed mid-loop) is tolerable — the next `init` run will
163
+ * re-detect the remaining framework files and finish the sweep.
164
+ *
165
+ * @param {{ targetDir: string, dryRun?: boolean }} args
166
+ * @returns {
167
+ * | { ran: false, reason: 'no-legacy' | 'managed' }
168
+ * | { ran: true, removed: string[], retained: string[], rmdirs: string[] }
169
+ * }
170
+ */
171
+ export function runLegacyCleanup({ targetDir, dryRun = false }) {
172
+ const detection = detectLegacyCodexTree(targetDir);
173
+ if (!detection.present || detection.frameworkFiles.length === 0) {
174
+ return { ran: false, reason: 'no-legacy' };
175
+ }
176
+ if (detection.hasManifest) {
177
+ return { ran: false, reason: 'managed' };
178
+ }
179
+ const installRoot = join(targetDir, LEGACY.install_root);
180
+ const removed = [];
181
+ const rmdirs = [];
182
+ if (dryRun) {
183
+ // Dry-run: report what WOULD be removed without touching the filesystem.
184
+ // `retained` is the user-file set from the pre-walk (no sweep occurred).
185
+ // `rmdirs` is the set of apt-* subdirs that would become empty after removal.
186
+ const wouldRemove = detection.frameworkFiles;
187
+ const retained = detection.userFiles;
188
+ const candidateDirs = new Set();
189
+ for (const rel of wouldRemove) {
190
+ let parent = dirname(rel);
191
+ while (parent !== '.' && parent !== '') {
192
+ candidateDirs.add(parent);
193
+ parent = dirname(parent);
194
+ }
195
+ }
196
+ const wouldRmdirs = [...candidateDirs]
197
+ .sort((a, b) => b.length - a.length)
198
+ .map((rel) => join(installRoot, rel));
199
+ return { ran: true, dryRun: true, removed: wouldRemove, retained, rmdirs: wouldRmdirs };
200
+ }
201
+ for (const rel of detection.frameworkFiles) {
202
+ const abs = join(installRoot, rel);
203
+ try {
204
+ unlinkSync(abs);
205
+ removed.push(rel);
206
+ }
207
+ catch {
208
+ /* best-effort: leave a partial sweep; next run finishes it */
209
+ }
210
+ }
211
+ // Sweep any now-empty `apt-*/` subdirs the unlinks left behind.
212
+ // Walk parent dirs of every removed file in reverse-depth order so
213
+ // nested `apt-pr-review/prompts/` empties before `apt-pr-review/`.
214
+ const candidateDirs = new Set();
215
+ for (const rel of removed) {
216
+ let parent = dirname(rel);
217
+ while (parent !== '.' && parent !== '') {
218
+ candidateDirs.add(parent);
219
+ parent = dirname(parent);
220
+ }
221
+ }
222
+ const sortedDirs = [...candidateDirs].sort((a, b) => b.length - a.length);
223
+ for (const rel of sortedDirs) {
224
+ const abs = join(installRoot, rel);
225
+ if (rmEmptyDir(abs))
226
+ rmdirs.push(abs);
227
+ }
228
+ // Sweep `.agents/skills/` only if fully empty after the per-file
229
+ // pass — preserves any user-added skill dirs.
230
+ if (rmEmptyDir(installRoot)) {
231
+ rmdirs.push(installRoot);
232
+ // Sweep `.agents/` only if it became empty too (i.e. no other
233
+ // `.agents/<sibling>` content the user keeps there).
234
+ const agentsRoot = dirname(installRoot);
235
+ if (rmEmptyDir(agentsRoot))
236
+ rmdirs.push(agentsRoot);
237
+ }
238
+ // Use the pre-walk's userFiles as `retained` — the post-walk only existed
239
+ // to defensively re-scan, but pre-walk already captured user files accurately.
240
+ // (PRF-002: avoid redundant detectLegacyCodexTree call.)
241
+ const retained = detection.userFiles;
242
+ return { ran: true, removed, retained, rmdirs };
243
+ }
244
+ //# sourceMappingURL=runtime-migrate.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-migrate.mjs","sourceRoot":"","sources":["../../../src/cli/install/runtime-migrate.mjs"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;;;;;;;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AiE;IACjE,8CAA8C;IAC9C,IAAI,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACxB,8DAA8D;QAC9D,qDAAqD;QACrD,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;QACvC,IAAI,UAAU,CAAC,UAAU,CAAC;YAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IACpD,CAAC;IAED,0EAA0E;IAC1E,+EAA+E;IAC/E,yDAAyD;IACzD,MAAM,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAA;IAEpC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;AAChD,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Detect whether the workspace source for `@aperant/framework` is ahead
3
+ * of the installed kernel.
4
+ *
5
+ * @param {string} targetDir Absolute path the route was invoked against.
6
+ * @param {string|null} installedVersion The installed kernel's version (semver string), or null when unknown.
7
+ * @returns {null | {
8
+ * source_path: string,
9
+ * source_version: string,
10
+ * installed_version: string,
11
+ * drift: true,
12
+ * }}
13
+ */
14
+ export function detectSourceWorkspaceDrift(targetDir: string, installedVersion: string | null): null | {
15
+ source_path: string;
16
+ source_version: string;
17
+ installed_version: string;
18
+ drift: true;
19
+ };
20
+ //# sourceMappingURL=drift-detect.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drift-detect.d.mts","sourceRoot":"","sources":["../../../src/cli/route/drift-detect.mjs"],"names":[],"mappings":"AAwDA;;;;;;;;;;;;GAYG;AACH,sDATW,MAAM,oBACN,MAAM,GAAC,IAAI,GACT,IAAI,GAAG;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,IAAI,CAAC;CACb,CAuCH"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * route/drift-detect.mjs — FRAMEWORK-BUG-017 (rung 1 of 3).
3
+ *
4
+ * In-band detection of the "installed kernel drifts behind source
5
+ * workspace" failure mode. When an Aperant contributor self-hosts the
6
+ * framework out of a monorepo checkout, the kernel at
7
+ * `.aperant/deps/node_modules/@aperant/framework/` lags behind the
8
+ * source at `packages/framework/` after every same-PR framework fix.
9
+ * The SessionStart worker only knows about npm — it cannot tell that
10
+ * the workspace is ahead of the install.
11
+ *
12
+ * This module walks up from `targetDir`, looking for a sibling
13
+ * `packages/framework/package.json`. When found AND its `version`
14
+ * differs from the installed kernel's `version`, it returns a synthetic
15
+ * `update_check`-shaped object so `route.mjs` can surface the chip
16
+ * immediately — without waiting for the SessionStart hook to fire.
17
+ *
18
+ * Safe for the route hot path: synchronous, file-existence checks
19
+ * only, bounded walk (6 segments max), no network, no spawn.
20
+ *
21
+ * Security (Codex review edit 2): the workspace `package.json:version`
22
+ * is validated against the same semver-shape regex `update-chips.mjs`
23
+ * uses on the cache. A poisoned workspace `package.json` cannot
24
+ * propagate a non-semver `latest_version` into the synthesized
25
+ * `update_check` block.
26
+ */
27
+ import { existsSync, readFileSync } from 'node:fs';
28
+ import { dirname, join } from 'node:path';
29
+ import { compareVersions, SEMVER_RE } from '../util/semver.mjs';
30
+ /** Max directory frames to walk before giving up. */
31
+ const MAX_WALK_DEPTH = 6;
32
+ /**
33
+ * Walk up from `start`, returning every directory frame including
34
+ * `start` itself. Stops at the filesystem root or at a depth of
35
+ * `MAX_WALK_DEPTH` (whichever comes first). The hard cap keeps this
36
+ * cheap on the route hot path and contains accidental scans on deeply
37
+ * nested input paths.
38
+ *
39
+ * @param {string} start
40
+ * @returns {string[]}
41
+ */
42
+ function walkUp(start) {
43
+ const frames = [];
44
+ let cur = start;
45
+ for (let i = 0; i < MAX_WALK_DEPTH; i++) {
46
+ frames.push(cur);
47
+ const parent = dirname(cur);
48
+ if (parent === cur)
49
+ break;
50
+ cur = parent;
51
+ }
52
+ return frames;
53
+ }
54
+ /**
55
+ * Detect whether the workspace source for `@aperant/framework` is ahead
56
+ * of the installed kernel.
57
+ *
58
+ * @param {string} targetDir Absolute path the route was invoked against.
59
+ * @param {string|null} installedVersion The installed kernel's version (semver string), or null when unknown.
60
+ * @returns {null | {
61
+ * source_path: string,
62
+ * source_version: string,
63
+ * installed_version: string,
64
+ * drift: true,
65
+ * }}
66
+ */
67
+ export function detectSourceWorkspaceDrift(targetDir, installedVersion) {
68
+ if (!targetDir || typeof targetDir !== 'string')
69
+ return null;
70
+ if (!installedVersion || typeof installedVersion !== 'string')
71
+ return null;
72
+ if (!SEMVER_RE.test(installedVersion))
73
+ return null;
74
+ for (const dir of walkUp(targetDir)) {
75
+ const candidate = join(dir, 'packages', 'framework', 'package.json');
76
+ if (!existsSync(candidate))
77
+ continue;
78
+ let pkg;
79
+ try {
80
+ pkg = JSON.parse(readFileSync(candidate, 'utf-8'));
81
+ }
82
+ catch {
83
+ return null;
84
+ }
85
+ // Validate the workspace package is actually @aperant/framework —
86
+ // guard against false matches on unrelated monorepos that happen
87
+ // to have a `packages/framework/` directory.
88
+ if (pkg?.name !== '@aperant/framework')
89
+ continue;
90
+ const sourceVersion = pkg?.version;
91
+ if (typeof sourceVersion !== 'string' || !SEMVER_RE.test(sourceVersion))
92
+ return null;
93
+ // Only report drift when workspace source is strictly ahead of the installed
94
+ // kernel. Equal (already up-to-date) and behind (installed is newer) both
95
+ // return null — only source-ahead is a drift worth surfacing.
96
+ if (compareVersions(sourceVersion, installedVersion) <= 0)
97
+ return null;
98
+ return {
99
+ source_path: candidate,
100
+ source_version: sourceVersion,
101
+ installed_version: installedVersion,
102
+ drift: true,
103
+ };
104
+ }
105
+ return null;
106
+ }
107
+ //# sourceMappingURL=drift-detect.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drift-detect.mjs","sourceRoot":"","sources":["../../../src/cli/route/drift-detect.mjs"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;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AA;QACP,IAAI,CAAC;YACJ,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAA;QACnD,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,IAAI,CAAA;QACZ,CAAC;QAED,kEAAkE;QAClE,iEAAiE;QACjE,6CAA6C;QAC7C,IAAI,GAAG,EAAE,IAAI,KAAK,oBAAoB;YAAE,SAAQ;QAEhD,MAAM,aAAa,GAAG,GAAG,EAAE,OAAO,CAAA;QAClC,IAAI,OAAO,aAAa,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC;YAAE,OAAO,IAAI,CAAA;QACpF,6EAA6E;QAC7E,0EAA0E;QAC1E,8DAA8D;QAC9D,IAAI,eAAe,CAAC,aAAa,EAAE,gBAAgB,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAA;QAEtE,OAAO;YACN,WAAW,EAAE,SAAS;YACtB,cAAc,EAAE,aAAa;YAC7B,iBAAiB,EAAE,gBAAgB;YACnC,KAAK,EAAE,IAAI;SACX,CAAA;IACF,CAAC;IAED,OAAO,IAAI,CAAA;AACZ,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Build the full "## Aperant Framework" section, wrapped in the
3
+ * `<!-- APT:framework-* -->` markers.
4
+ *
5
+ * @param {Object} opts
6
+ * @param {string} opts.canonicalRoot Absolute path to the framework root
7
+ * (the directory that contains
8
+ * `templates/aperant-claude-md-appendix.md`).
9
+ * @param {string} opts.targetDir Project root (passed to discoverSkills).
10
+ * @param {string} [opts.cli] Host CLI label (forwarded to
11
+ * getTrustedSkillSources so the install
12
+ * root for the runtime is included).
13
+ * @returns {string} The full section, including markers
14
+ * and trailing newline before the
15
+ * end-marker. No leading newline.
16
+ */
17
+ export function buildAptSection({ canonicalRoot, targetDir, cli }: {
18
+ canonicalRoot: string;
19
+ targetDir: string;
20
+ cli?: string | undefined;
21
+ }): string;
22
+ /**
23
+ * Extract the `/apt:<slug>` (or bare `/apt`) row IDs from the
24
+ * `<!-- APT:framework-* -->` section of an existing instruction file.
25
+ * Returns `[]` when the file has no APT section.
26
+ *
27
+ * Used by `injectInstructionFile` to detect foreign rows that would be
28
+ * silently clobbered by a regeneration — see `--force-overwrite-catalog`.
29
+ *
30
+ * @param {string} text Full instruction-file contents.
31
+ * @returns {string[]} Row IDs in file order, e.g. `['/apt', '/apt:quick', …]`.
32
+ */
33
+ export function extractAptSectionRowIds(text: string): string[];
34
+ //# sourceMappingURL=aperant-section.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aperant-section.d.mts","sourceRoot":"","sources":["../../../src/cli/util/aperant-section.mjs"],"names":[],"mappings":"AAuDA;;;;;;;;;;;;;;;GAeG;AACH,mEAXG;IAAqB,aAAa,EAA1B,MAAM;IAGO,SAAS,EAAtB,MAAM;IACQ,GAAG;CAGzB,GAAU,MAAM,CAqClB;AAED;;;;;;;;;;GAUG;AACH,8CAHW,MAAM,GACJ,MAAM,EAAE,CAoBpB"}