@stackbilt/cli 0.3.3 → 0.4.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 +18 -5
- package/dist/commands/adf-bundle.d.ts +8 -0
- package/dist/commands/adf-bundle.d.ts.map +1 -0
- package/dist/commands/adf-bundle.js +169 -0
- package/dist/commands/adf-bundle.js.map +1 -0
- package/dist/commands/adf-evidence.d.ts +8 -0
- package/dist/commands/adf-evidence.d.ts.map +1 -0
- package/dist/commands/adf-evidence.js +273 -0
- package/dist/commands/adf-evidence.js.map +1 -0
- package/dist/commands/adf-migrate.d.ts +10 -0
- package/dist/commands/adf-migrate.d.ts.map +1 -0
- package/dist/commands/adf-migrate.js +383 -0
- package/dist/commands/adf-migrate.js.map +1 -0
- package/dist/commands/adf-sync.d.ts +10 -0
- package/dist/commands/adf-sync.d.ts.map +1 -0
- package/dist/commands/adf-sync.js +213 -0
- package/dist/commands/adf-sync.js.map +1 -0
- package/dist/commands/adf.d.ts +2 -2
- package/dist/commands/adf.d.ts.map +1 -1
- package/dist/commands/adf.js +31 -525
- package/dist/commands/adf.js.map +1 -1
- package/dist/commands/bootstrap.js +61 -2
- package/dist/commands/bootstrap.js.map +1 -1
- package/dist/commands/hook.d.ts.map +1 -1
- package/dist/commands/hook.js +69 -10
- package/dist/commands/hook.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -65,6 +65,7 @@ charter hook install --commit-msg
|
|
|
65
65
|
charter adf init # scaffold .ai/ context directory
|
|
66
66
|
charter adf fmt .ai/core.adf # reformat ADF to canonical form
|
|
67
67
|
charter adf bundle --task "fix React component"
|
|
68
|
+
charter adf migrate --dry-run # preview agent config → ADF migration
|
|
68
69
|
charter adf sync --check # verify .adf files match locked hashes
|
|
69
70
|
charter adf evidence --auto-measure --format json # validate metric ceilings
|
|
70
71
|
```
|
|
@@ -134,6 +135,7 @@ npx charter drift --ci --format json
|
|
|
134
135
|
npx charter audit --format json
|
|
135
136
|
|
|
136
137
|
# ADF context management
|
|
138
|
+
npx charter adf migrate --dry-run --format json
|
|
137
139
|
npx charter adf evidence --auto-measure --format json --ci
|
|
138
140
|
npx charter adf sync --check --format json
|
|
139
141
|
|
|
@@ -251,13 +253,17 @@ charter classify "update button color"
|
|
|
251
253
|
|
|
252
254
|
### `charter hook`
|
|
253
255
|
|
|
254
|
-
Install git hooks for commit-time
|
|
256
|
+
Install git hooks for commit-time governance ergonomics.
|
|
255
257
|
|
|
256
258
|
```bash
|
|
257
259
|
charter hook install --commit-msg
|
|
260
|
+
charter hook install --pre-commit
|
|
258
261
|
```
|
|
259
262
|
|
|
260
|
-
`--
|
|
263
|
+
- `--commit-msg`: Install a commit-msg hook that normalizes `Governed-By` and `Resolves-Request` trailers using `git interpret-trailers`.
|
|
264
|
+
- `--pre-commit`: Install a pre-commit hook that runs `charter adf evidence --auto-measure --ci` before each commit. Only gates when `.ai/manifest.adf` exists — no-op otherwise. Uses `npx charter` so consuming repos need Charter as a devDependency.
|
|
265
|
+
- `--force` (or global `--yes`) allows overwrite when a non-Charter hook already exists.
|
|
266
|
+
- Both flags can be passed together to install both hooks in one command.
|
|
261
267
|
|
|
262
268
|
### `charter adf`
|
|
263
269
|
|
|
@@ -272,6 +278,8 @@ charter adf sync --check [--ai-dir <dir>]
|
|
|
272
278
|
charter adf sync --write [--ai-dir <dir>]
|
|
273
279
|
charter adf evidence [--task "<prompt>"] [--ai-dir <dir>] [--auto-measure]
|
|
274
280
|
[--context '{"key": value}'] [--context-file <path>]
|
|
281
|
+
charter adf migrate [--dry-run] [--source <file>] [--no-backup]
|
|
282
|
+
[--merge-strategy append|dedupe|replace] [--ai-dir <dir>]
|
|
275
283
|
```
|
|
276
284
|
|
|
277
285
|
- `init`: Scaffold `.ai/` with `manifest.adf`, `core.adf`, and `state.adf`. Core module includes a 500-line LOC guardrail metric by default.
|
|
@@ -281,6 +289,7 @@ charter adf evidence [--task "<prompt>"] [--ai-dir <dir>] [--auto-measure]
|
|
|
281
289
|
- `sync --check`: Verify source `.adf` files match their locked hashes. Exits 1 if any source has drifted since last sync.
|
|
282
290
|
- `sync --write`: Update `.adf.lock` with current source hashes.
|
|
283
291
|
- `evidence`: Validate all metric ceilings in the merged document and produce a structured pass/fail evidence report. `--auto-measure` counts lines in files referenced by the manifest METRICS section. `--context` or `--context-file` inject external metric overrides that take precedence over auto-measured and document values. In `--ci` mode, exits 1 on constraint failures (warnings don't fail). The governance workflow template runs this automatically on PRs when `.ai/manifest.adf` is present.
|
|
292
|
+
- `migrate`: Scan existing agent config files (CLAUDE.md, .cursorrules, agents.md, GEMINI.md, copilot-instructions.md), classify content using the ADX-002 decision tree, and migrate into ADF modules. `--dry-run` previews the migration plan without writing files. `--source <file>` targets a single file. `--no-backup` skips `.pre-adf-migrate.bak` creation. `--merge-strategy` controls deduplication: `dedupe` (default, skip items already in ADF), `append` (always add), or `replace`. Environment-specific rules (WSL, PATH, credential helpers) are retained in the thin pointer.
|
|
284
293
|
|
|
285
294
|
#### Evidence Example (from Charter's own repo)
|
|
286
295
|
|
|
@@ -295,10 +304,14 @@ Produces constraint checks against live source file line counts:
|
|
|
295
304
|
```json
|
|
296
305
|
{
|
|
297
306
|
"constraints": [
|
|
298
|
-
{ "metric": "adf_commands_loc", "value":
|
|
299
|
-
{ "metric": "
|
|
307
|
+
{ "metric": "adf_commands_loc", "value": 413, "ceiling": 500, "status": "pass", "source": "context" },
|
|
308
|
+
{ "metric": "adf_bundle_loc", "value": 154, "ceiling": 200, "status": "pass", "source": "context" },
|
|
309
|
+
{ "metric": "adf_sync_loc", "value": 204, "ceiling": 250, "status": "pass", "source": "context" },
|
|
310
|
+
{ "metric": "adf_evidence_loc", "value": 263, "ceiling": 300, "status": "pass", "source": "context" },
|
|
311
|
+
{ "metric": "adf_migrate_loc", "value": 453, "ceiling": 500, "status": "pass", "source": "context" },
|
|
312
|
+
{ "metric": "bundler_loc", "value": 415, "ceiling": 500, "status": "pass", "source": "context" },
|
|
300
313
|
{ "metric": "parser_loc", "value": 214, "ceiling": 300, "status": "pass", "source": "context" },
|
|
301
|
-
{ "metric": "cli_entry_loc", "value":
|
|
314
|
+
{ "metric": "cli_entry_loc", "value": 149, "ceiling": 200, "status": "pass", "source": "context" }
|
|
302
315
|
],
|
|
303
316
|
"allPassing": true,
|
|
304
317
|
"failCount": 0,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* charter adf bundle
|
|
3
|
+
*
|
|
4
|
+
* Resolves manifest modules for a task and outputs merged context.
|
|
5
|
+
*/
|
|
6
|
+
import type { CLIOptions } from '../index';
|
|
7
|
+
export declare function adfBundle(options: CLIOptions, args: string[]): number;
|
|
8
|
+
//# sourceMappingURL=adf-bundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adf-bundle.d.ts","sourceRoot":"","sources":["../../src/commands/adf-bundle.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CA8HrE"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* charter adf bundle
|
|
4
|
+
*
|
|
5
|
+
* Resolves manifest modules for a task and outputs merged context.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.adfBundle = adfBundle;
|
|
42
|
+
const fs = __importStar(require("node:fs"));
|
|
43
|
+
const path = __importStar(require("node:path"));
|
|
44
|
+
const adf_1 = require("@stackbilt/adf");
|
|
45
|
+
const index_1 = require("../index");
|
|
46
|
+
function adfBundle(options, args) {
|
|
47
|
+
const task = getFlag(args, '--task');
|
|
48
|
+
if (!task) {
|
|
49
|
+
throw new index_1.CLIError('adf bundle requires --task "<prompt>". Usage: charter adf bundle --task "Fix React component"');
|
|
50
|
+
}
|
|
51
|
+
const aiDir = getFlag(args, '--ai-dir') || '.ai';
|
|
52
|
+
const manifestPath = path.join(aiDir, 'manifest.adf');
|
|
53
|
+
if (!fs.existsSync(manifestPath)) {
|
|
54
|
+
throw new index_1.CLIError(`manifest.adf not found at ${manifestPath}. Run: charter adf init`);
|
|
55
|
+
}
|
|
56
|
+
const manifestContent = fs.readFileSync(manifestPath, 'utf-8');
|
|
57
|
+
const manifestDoc = (0, adf_1.parseAdf)(manifestContent);
|
|
58
|
+
const manifest = (0, adf_1.parseManifest)(manifestDoc);
|
|
59
|
+
// Tokenize task into keywords (simple word split)
|
|
60
|
+
const keywords = task
|
|
61
|
+
.split(/[\s,;:()[\]{}]+/)
|
|
62
|
+
.filter(w => w.length > 1)
|
|
63
|
+
.map(w => w.replace(/[^a-zA-Z0-9]/g, ''));
|
|
64
|
+
const modulePaths = (0, adf_1.resolveModules)(manifest, keywords);
|
|
65
|
+
const readFile = (p) => fs.readFileSync(p, 'utf-8');
|
|
66
|
+
try {
|
|
67
|
+
const result = (0, adf_1.bundleModules)(aiDir, modulePaths, readFile, keywords);
|
|
68
|
+
if (options.format === 'json') {
|
|
69
|
+
const jsonOut = {
|
|
70
|
+
task,
|
|
71
|
+
keywords,
|
|
72
|
+
resolvedModules: result.resolvedModules,
|
|
73
|
+
tokenEstimate: result.tokenEstimate,
|
|
74
|
+
tokenBudget: result.tokenBudget,
|
|
75
|
+
tokenUtilization: result.tokenUtilization,
|
|
76
|
+
perModuleTokens: result.perModuleTokens,
|
|
77
|
+
triggerMatches: result.triggerMatches,
|
|
78
|
+
};
|
|
79
|
+
if (result.unmatchedModules.length > 0) {
|
|
80
|
+
jsonOut.unmatchedModules = result.unmatchedModules;
|
|
81
|
+
}
|
|
82
|
+
if (result.moduleBudgetOverruns.length > 0) {
|
|
83
|
+
jsonOut.moduleBudgetOverruns = result.moduleBudgetOverruns;
|
|
84
|
+
}
|
|
85
|
+
if (result.advisoryOnlyModules.length > 0) {
|
|
86
|
+
jsonOut.advisoryOnlyModules = result.advisoryOnlyModules;
|
|
87
|
+
}
|
|
88
|
+
if (result.manifest.cadence.length > 0) {
|
|
89
|
+
jsonOut.cadence = result.manifest.cadence;
|
|
90
|
+
}
|
|
91
|
+
console.log(JSON.stringify(jsonOut, null, 2));
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
console.log(` Task: "${task}"`);
|
|
95
|
+
console.log(` Keywords: ${keywords.join(', ')}`);
|
|
96
|
+
console.log(` Resolved modules: ${result.resolvedModules.join(', ')}`);
|
|
97
|
+
console.log(` Token estimate: ~${result.tokenEstimate}`);
|
|
98
|
+
if (result.tokenBudget !== null) {
|
|
99
|
+
const pct = result.tokenUtilization !== null
|
|
100
|
+
? ` (${(result.tokenUtilization * 100).toFixed(0)}%)`
|
|
101
|
+
: '';
|
|
102
|
+
console.log(` Token budget: ${result.tokenBudget}${pct}`);
|
|
103
|
+
}
|
|
104
|
+
console.log('');
|
|
105
|
+
if (result.moduleBudgetOverruns.length > 0) {
|
|
106
|
+
console.log(' Module budget overruns:');
|
|
107
|
+
for (const o of result.moduleBudgetOverruns) {
|
|
108
|
+
console.log(` [!] ${o.module}: ~${o.tokens} tokens (budget: ${o.budget})`);
|
|
109
|
+
}
|
|
110
|
+
console.log('');
|
|
111
|
+
}
|
|
112
|
+
if (result.triggerMatches.length > 0) {
|
|
113
|
+
console.log(' Trigger report:');
|
|
114
|
+
for (const tm of result.triggerMatches) {
|
|
115
|
+
const icon = tm.matched ? '+' : '-';
|
|
116
|
+
const kw = tm.matchedKeywords.length > 0 ? ` [${tm.matchedKeywords.join(', ')}]` : '';
|
|
117
|
+
console.log(` [${icon}] ${tm.module} (${tm.trigger})${kw}`);
|
|
118
|
+
}
|
|
119
|
+
console.log('');
|
|
120
|
+
}
|
|
121
|
+
if (result.unmatchedModules.length > 0) {
|
|
122
|
+
console.log(' Unmatched modules (not loaded):');
|
|
123
|
+
for (const m of result.unmatchedModules) {
|
|
124
|
+
console.log(` [-] ${m}`);
|
|
125
|
+
}
|
|
126
|
+
console.log('');
|
|
127
|
+
}
|
|
128
|
+
if (result.advisoryOnlyModules.length > 0) {
|
|
129
|
+
console.log(' Advisory-only modules:');
|
|
130
|
+
for (const m of result.advisoryOnlyModules) {
|
|
131
|
+
console.log(` [!] ${m}: no load-bearing sections`);
|
|
132
|
+
}
|
|
133
|
+
console.log('');
|
|
134
|
+
}
|
|
135
|
+
if (result.manifest.cadence.length > 0) {
|
|
136
|
+
console.log(' Cadence schedule:');
|
|
137
|
+
for (const c of result.manifest.cadence) {
|
|
138
|
+
console.log(` ${c.check}: ${c.frequency}`);
|
|
139
|
+
}
|
|
140
|
+
console.log('');
|
|
141
|
+
}
|
|
142
|
+
// Output merged document
|
|
143
|
+
const output = (0, adf_1.formatAdf)(result.mergedDocument);
|
|
144
|
+
console.log(' --- Merged Context ---');
|
|
145
|
+
console.log(output);
|
|
146
|
+
}
|
|
147
|
+
return index_1.EXIT_CODE.SUCCESS;
|
|
148
|
+
}
|
|
149
|
+
catch (e) {
|
|
150
|
+
if (e instanceof Error && e.name === 'AdfBundleError') {
|
|
151
|
+
if (options.format === 'json') {
|
|
152
|
+
console.log(JSON.stringify({ error: e.message }, null, 2));
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
console.error(` [error] ${e.message}`);
|
|
156
|
+
}
|
|
157
|
+
return index_1.EXIT_CODE.RUNTIME_ERROR;
|
|
158
|
+
}
|
|
159
|
+
throw e;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function getFlag(args, flag) {
|
|
163
|
+
const idx = args.indexOf(flag);
|
|
164
|
+
if (idx !== -1 && idx + 1 < args.length) {
|
|
165
|
+
return args[idx + 1];
|
|
166
|
+
}
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=adf-bundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adf-bundle.js","sourceRoot":"","sources":["../../src/commands/adf-bundle.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;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,CAAC;QACxC,OAAO,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* charter adf evidence
|
|
3
|
+
*
|
|
4
|
+
* Validates metric constraints and produces structured evidence reports.
|
|
5
|
+
*/
|
|
6
|
+
import type { CLIOptions } from '../index';
|
|
7
|
+
export declare function adfEvidence(options: CLIOptions, args: string[]): number;
|
|
8
|
+
//# sourceMappingURL=adf-evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adf-evidence.d.ts","sourceRoot":"","sources":["../../src/commands/adf-evidence.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAW3C,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CA2NvE"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* charter adf evidence
|
|
4
|
+
*
|
|
5
|
+
* Validates metric constraints and produces structured evidence reports.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.adfEvidence = adfEvidence;
|
|
42
|
+
const fs = __importStar(require("node:fs"));
|
|
43
|
+
const path = __importStar(require("node:path"));
|
|
44
|
+
const adf_1 = require("@stackbilt/adf");
|
|
45
|
+
const index_1 = require("../index");
|
|
46
|
+
const adf_sync_1 = require("./adf-sync");
|
|
47
|
+
function adfEvidence(options, args) {
|
|
48
|
+
const task = getFlag(args, '--task');
|
|
49
|
+
const aiDir = getFlag(args, '--ai-dir') || '.ai';
|
|
50
|
+
const contextJson = getFlag(args, '--context');
|
|
51
|
+
const contextFile = getFlag(args, '--context-file');
|
|
52
|
+
const autoMeasure = args.includes('--auto-measure');
|
|
53
|
+
const manifestPath = path.join(aiDir, 'manifest.adf');
|
|
54
|
+
if (!fs.existsSync(manifestPath)) {
|
|
55
|
+
throw new index_1.CLIError(`manifest.adf not found at ${manifestPath}. Run: charter adf init`);
|
|
56
|
+
}
|
|
57
|
+
const manifestContent = fs.readFileSync(manifestPath, 'utf-8');
|
|
58
|
+
const manifestDoc = (0, adf_1.parseAdf)(manifestContent);
|
|
59
|
+
const manifest = (0, adf_1.parseManifest)(manifestDoc);
|
|
60
|
+
// Resolve modules
|
|
61
|
+
let modulePaths;
|
|
62
|
+
let keywords = [];
|
|
63
|
+
if (task) {
|
|
64
|
+
keywords = task
|
|
65
|
+
.split(/[\s,;:()[\]{}]+/)
|
|
66
|
+
.filter(w => w.length > 1)
|
|
67
|
+
.map(w => w.replace(/[^a-zA-Z0-9]/g, ''));
|
|
68
|
+
modulePaths = (0, adf_1.resolveModules)(manifest, keywords);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
modulePaths = [...manifest.defaultLoad];
|
|
72
|
+
}
|
|
73
|
+
const readFile = (p) => fs.readFileSync(p, 'utf-8');
|
|
74
|
+
let context;
|
|
75
|
+
const rawContext = contextFile ? readJsonFlag(contextFile, '--context-file') : contextJson;
|
|
76
|
+
if (rawContext) {
|
|
77
|
+
try {
|
|
78
|
+
const parsed = JSON.parse(rawContext);
|
|
79
|
+
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
|
|
80
|
+
throw new Error('must be a JSON object');
|
|
81
|
+
}
|
|
82
|
+
context = parsed;
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
86
|
+
throw new index_1.CLIError(`Invalid --context JSON: ${msg}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Auto-measure: count lines in files referenced by manifest METRICS
|
|
90
|
+
// Manifest keys are UPPERCASE (parser map disambiguation), metric keys are lowercase.
|
|
91
|
+
const autoMeasured = [];
|
|
92
|
+
if (autoMeasure && manifest.metrics.length > 0) {
|
|
93
|
+
const measured = {};
|
|
94
|
+
for (const ms of manifest.metrics) {
|
|
95
|
+
const metricKey = ms.key.toLowerCase();
|
|
96
|
+
const filePath = path.resolve(ms.path);
|
|
97
|
+
if (fs.existsSync(filePath)) {
|
|
98
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
99
|
+
const lines = content.split('\n').length;
|
|
100
|
+
measured[metricKey] = lines;
|
|
101
|
+
autoMeasured.push({ metric: metricKey, path: ms.path, lines });
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
autoMeasured.push({ metric: metricKey, path: ms.path, lines: null, error: 'file not found' });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Merge: explicit --context wins over auto-measured
|
|
108
|
+
context = { ...measured, ...context };
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
const bundle = (0, adf_1.bundleModules)(aiDir, modulePaths, readFile, keywords);
|
|
112
|
+
const evidence = (0, adf_1.validateConstraints)(bundle.mergedDocument, context);
|
|
113
|
+
// Check sync status
|
|
114
|
+
const lockFile = path.join(aiDir, '.adf.lock');
|
|
115
|
+
const locked = (0, adf_sync_1.loadLockFile)(lockFile);
|
|
116
|
+
const syncEntries = [];
|
|
117
|
+
for (const entry of manifest.sync) {
|
|
118
|
+
const sourcePath = path.join(aiDir, entry.source);
|
|
119
|
+
if (fs.existsSync(sourcePath)) {
|
|
120
|
+
const sourceContent = fs.readFileSync(sourcePath, 'utf-8');
|
|
121
|
+
const sourceHash = (0, adf_sync_1.hashContent)(sourceContent);
|
|
122
|
+
const lockedHash = locked[entry.source] ?? null;
|
|
123
|
+
syncEntries.push({ source: entry.source, inSync: lockedHash === sourceHash });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const allInSync = syncEntries.length === 0 || syncEntries.every(e => e.inSync);
|
|
127
|
+
const staleCount = syncEntries.filter(e => !e.inSync).length;
|
|
128
|
+
if (options.format === 'json') {
|
|
129
|
+
const jsonOut = {
|
|
130
|
+
aiDir,
|
|
131
|
+
resolvedModules: bundle.resolvedModules,
|
|
132
|
+
tokenEstimate: bundle.tokenEstimate,
|
|
133
|
+
tokenBudget: bundle.tokenBudget,
|
|
134
|
+
tokenUtilization: bundle.tokenUtilization,
|
|
135
|
+
constraints: evidence.constraints,
|
|
136
|
+
weightSummary: evidence.weightSummary,
|
|
137
|
+
allPassing: evidence.allPassing,
|
|
138
|
+
failCount: evidence.failCount,
|
|
139
|
+
warnCount: evidence.warnCount,
|
|
140
|
+
syncStatus: { allInSync, staleCount },
|
|
141
|
+
};
|
|
142
|
+
if (task) {
|
|
143
|
+
jsonOut.task = task;
|
|
144
|
+
jsonOut.keywords = keywords;
|
|
145
|
+
}
|
|
146
|
+
if (bundle.advisoryOnlyModules.length > 0) {
|
|
147
|
+
jsonOut.advisoryOnlyModules = bundle.advisoryOnlyModules;
|
|
148
|
+
}
|
|
149
|
+
if (autoMeasured.length > 0) {
|
|
150
|
+
jsonOut.autoMeasured = autoMeasured;
|
|
151
|
+
}
|
|
152
|
+
// Suggest logical next steps based on results
|
|
153
|
+
const nextActions = [];
|
|
154
|
+
if (!evidence.allPassing) {
|
|
155
|
+
nextActions.push('Fix failing constraints before merging');
|
|
156
|
+
}
|
|
157
|
+
if (!allInSync) {
|
|
158
|
+
nextActions.push('charter adf sync --write');
|
|
159
|
+
}
|
|
160
|
+
if (evidence.warnCount > 0) {
|
|
161
|
+
nextActions.push('Review metrics at ceiling boundary');
|
|
162
|
+
}
|
|
163
|
+
if (nextActions.length > 0) {
|
|
164
|
+
jsonOut.nextActions = nextActions;
|
|
165
|
+
}
|
|
166
|
+
console.log(JSON.stringify(jsonOut, null, 2));
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
console.log('');
|
|
170
|
+
console.log(' ADF Evidence Report');
|
|
171
|
+
console.log(' ===================');
|
|
172
|
+
console.log(` Modules loaded: ${bundle.resolvedModules.join(', ')}`);
|
|
173
|
+
console.log(` Token estimate: ~${bundle.tokenEstimate}`);
|
|
174
|
+
if (bundle.tokenBudget !== null) {
|
|
175
|
+
const pct = bundle.tokenUtilization !== null
|
|
176
|
+
? ` (${(bundle.tokenUtilization * 100).toFixed(0)}%)`
|
|
177
|
+
: '';
|
|
178
|
+
console.log(` Token budget: ${bundle.tokenBudget}${pct}`);
|
|
179
|
+
}
|
|
180
|
+
console.log('');
|
|
181
|
+
// Auto-measured metrics
|
|
182
|
+
if (autoMeasured.length > 0) {
|
|
183
|
+
console.log(' Auto-measured:');
|
|
184
|
+
for (const m of autoMeasured) {
|
|
185
|
+
if (m.lines !== null) {
|
|
186
|
+
console.log(` ${m.metric}: ${m.lines} lines (${m.path})`);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
console.log(` ${m.metric}: [file not found] (${m.path})`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
console.log('');
|
|
193
|
+
}
|
|
194
|
+
// Weight summary
|
|
195
|
+
console.log(' Section weights:');
|
|
196
|
+
console.log(` Load-bearing: ${evidence.weightSummary.loadBearing}`);
|
|
197
|
+
console.log(` Advisory: ${evidence.weightSummary.advisory}`);
|
|
198
|
+
console.log(` Unweighted: ${evidence.weightSummary.unweighted}`);
|
|
199
|
+
console.log('');
|
|
200
|
+
// Advisory-only module warnings
|
|
201
|
+
if (bundle.advisoryOnlyModules.length > 0) {
|
|
202
|
+
console.log(' Advisory-only modules:');
|
|
203
|
+
for (const m of bundle.advisoryOnlyModules) {
|
|
204
|
+
console.log(` [!] ${m}: no load-bearing sections`);
|
|
205
|
+
}
|
|
206
|
+
console.log('');
|
|
207
|
+
}
|
|
208
|
+
// Constraints
|
|
209
|
+
if (evidence.constraints.length > 0) {
|
|
210
|
+
console.log(' Constraints:');
|
|
211
|
+
for (const c of evidence.constraints) {
|
|
212
|
+
const icon = c.status === 'pass' ? 'ok' : c.status === 'warn' ? 'WARN' : 'FAIL';
|
|
213
|
+
console.log(` [${icon}] ${c.message}`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
console.log(' Constraints: (none)');
|
|
218
|
+
}
|
|
219
|
+
console.log('');
|
|
220
|
+
// Sync status
|
|
221
|
+
if (syncEntries.length > 0) {
|
|
222
|
+
if (allInSync) {
|
|
223
|
+
console.log(' Sync: all sources in sync');
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
console.log(` Sync: ${staleCount} source${staleCount === 1 ? '' : 's'} out of sync`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
console.log(' Sync: no sync entries configured');
|
|
231
|
+
}
|
|
232
|
+
console.log('');
|
|
233
|
+
// Verdict
|
|
234
|
+
const verdict = evidence.allPassing ? 'PASS' : 'FAIL';
|
|
235
|
+
console.log(` Verdict: ${verdict}`);
|
|
236
|
+
if (evidence.warnCount > 0) {
|
|
237
|
+
console.log(` (${evidence.warnCount} warning${evidence.warnCount === 1 ? '' : 's'} — at ceiling boundary)`);
|
|
238
|
+
}
|
|
239
|
+
console.log('');
|
|
240
|
+
}
|
|
241
|
+
// CI mode: exit 1 on constraint failures
|
|
242
|
+
if (options.ciMode && !evidence.allPassing) {
|
|
243
|
+
return index_1.EXIT_CODE.POLICY_VIOLATION;
|
|
244
|
+
}
|
|
245
|
+
return index_1.EXIT_CODE.SUCCESS;
|
|
246
|
+
}
|
|
247
|
+
catch (e) {
|
|
248
|
+
if (e instanceof Error && e.name === 'AdfBundleError') {
|
|
249
|
+
if (options.format === 'json') {
|
|
250
|
+
console.log(JSON.stringify({ error: e.message }, null, 2));
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
console.error(` [error] ${e.message}`);
|
|
254
|
+
}
|
|
255
|
+
return index_1.EXIT_CODE.RUNTIME_ERROR;
|
|
256
|
+
}
|
|
257
|
+
throw e;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function getFlag(args, flag) {
|
|
261
|
+
const idx = args.indexOf(flag);
|
|
262
|
+
if (idx !== -1 && idx + 1 < args.length) {
|
|
263
|
+
return args[idx + 1];
|
|
264
|
+
}
|
|
265
|
+
return undefined;
|
|
266
|
+
}
|
|
267
|
+
function readJsonFlag(filePath, flagName) {
|
|
268
|
+
if (!fs.existsSync(filePath)) {
|
|
269
|
+
throw new index_1.CLIError(`File not found for ${flagName}: ${filePath}`);
|
|
270
|
+
}
|
|
271
|
+
return fs.readFileSync(filePath, 'utf-8');
|
|
272
|
+
}
|
|
273
|
+
//# sourceMappingURL=adf-evidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adf-evidence.js","sourceRoot":"","sources":["../../src/commands/adf-evidence.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBH,kCA2NC;AAhPD,4CAA8B;AAC9B,gDAAkC;AAClC,wCAMwB;AAGxB,oCAA+C;AAC/C,yCAAuD;AASvD,SAAgB,WAAW,CAAC,OAAmB,EAAE,IAAc;IAC7D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,KAAK,CAAC;IACjD,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACpD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAEpD,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IACtD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,gBAAQ,CAAC,6BAA6B,YAAY,yBAAyB,CAAC,CAAC;IACzF,CAAC;IAED,MAAM,eAAe,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC/D,MAAM,WAAW,GAAG,IAAA,cAAQ,EAAC,eAAe,CAAC,CAAC;IAC9C,MAAM,Q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AQ,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,gBAAQ,CAAC,sBAAsB,QAAQ,KAAK,QAAQ,EAAE,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* charter adf migrate
|
|
3
|
+
*
|
|
4
|
+
* Scans existing agent config files (CLAUDE.md, .cursorrules, agents.md, GEMINI.md,
|
|
5
|
+
* copilot-instructions.md), classifies their content using the ADX-002 decision tree,
|
|
6
|
+
* and migrates structured blocks into ADF modules. Replaces originals with thin pointers.
|
|
7
|
+
*/
|
|
8
|
+
import type { CLIOptions } from '../index';
|
|
9
|
+
export declare function adfMigrateCommand(options: CLIOptions, args: string[]): Promise<number>;
|
|
10
|
+
//# sourceMappingURL=adf-migrate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adf-migrate.d.ts","sourceRoot":"","sources":["../../src/commands/adf-migrate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAcH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AA4B3C,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAoD5F"}
|