@peac/cli 0.10.9 → 0.10.11

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 (60) hide show
  1. package/LICENSE +1 -1
  2. package/dist/index.cjs +2257 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.mjs +2236 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/package.json +21 -16
  7. package/dist/cli.js +0 -90
  8. package/dist/cli.js.map +0 -1
  9. package/dist/commands/bridge/index.js +0 -20
  10. package/dist/commands/bridge/index.js.map +0 -1
  11. package/dist/commands/bridge/install.js +0 -27
  12. package/dist/commands/bridge/install.js.map +0 -1
  13. package/dist/commands/bridge/start.js +0 -123
  14. package/dist/commands/bridge/start.js.map +0 -1
  15. package/dist/commands/bridge/status.js +0 -192
  16. package/dist/commands/bridge/status.js.map +0 -1
  17. package/dist/commands/bridge/stop.js +0 -130
  18. package/dist/commands/bridge/stop.js.map +0 -1
  19. package/dist/commands/bundle.js +0 -363
  20. package/dist/commands/bundle.js.map +0 -1
  21. package/dist/commands/conformance.js +0 -301
  22. package/dist/commands/conformance.js.map +0 -1
  23. package/dist/commands/discover.js +0 -39
  24. package/dist/commands/discover.js.map +0 -1
  25. package/dist/commands/hash.js +0 -106
  26. package/dist/commands/hash.js.map +0 -1
  27. package/dist/commands/policy.js +0 -712
  28. package/dist/commands/policy.js.map +0 -1
  29. package/dist/commands/samples.js +0 -360
  30. package/dist/commands/samples.js.map +0 -1
  31. package/dist/commands/verify.js +0 -50
  32. package/dist/commands/verify.js.map +0 -1
  33. package/dist/commands/workflow.d.ts +0 -11
  34. package/dist/commands/workflow.d.ts.map +0 -1
  35. package/dist/commands/workflow.js +0 -214
  36. package/dist/commands/workflow.js.map +0 -1
  37. package/dist/index.js +0 -240
  38. package/dist/index.js.map +0 -1
  39. package/dist/lib/conformance/digest.js +0 -202
  40. package/dist/lib/conformance/digest.js.map +0 -1
  41. package/dist/lib/conformance/index.js +0 -30
  42. package/dist/lib/conformance/index.js.map +0 -1
  43. package/dist/lib/conformance/manifest.js +0 -66
  44. package/dist/lib/conformance/manifest.js.map +0 -1
  45. package/dist/lib/conformance/profiles.js +0 -138
  46. package/dist/lib/conformance/profiles.js.map +0 -1
  47. package/dist/lib/conformance/types.js +0 -8
  48. package/dist/lib/conformance/types.js.map +0 -1
  49. package/dist/lib/conformance/validators.js +0 -415
  50. package/dist/lib/conformance/validators.js.map +0 -1
  51. package/dist/lib/conformance-runner.js +0 -433
  52. package/dist/lib/conformance-runner.js.map +0 -1
  53. package/dist/lib/samples-loader.js +0 -311
  54. package/dist/lib/samples-loader.js.map +0 -1
  55. package/dist/lib/version.js +0 -61
  56. package/dist/lib/version.js.map +0 -1
  57. package/dist/types.js +0 -6
  58. package/dist/types.js.map +0 -1
  59. package/dist/utils.js +0 -101
  60. package/dist/utils.js.map +0 -1
@@ -1,363 +0,0 @@
1
- "use strict";
2
- /**
3
- * PEAC Bundle CLI Commands (v0.9.30+)
4
- *
5
- * Commands for creating and verifying dispute bundles:
6
- * - create: Create a dispute bundle from receipts and keys
7
- * - verify: Verify a dispute bundle (offline by default)
8
- * - info: Show bundle manifest information
9
- *
10
- * Automation flags:
11
- * - --json: Machine-readable JSON output
12
- * - --online: Enable external key fetching (verify only, not yet implemented)
13
- */
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
- Object.defineProperty(o, "default", { enumerable: true, value: v });
27
- }) : function(o, v) {
28
- o["default"] = v;
29
- });
30
- var __importStar = (this && this.__importStar) || (function () {
31
- var ownKeys = function(o) {
32
- ownKeys = Object.getOwnPropertyNames || function (o) {
33
- var ar = [];
34
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
- return ar;
36
- };
37
- return ownKeys(o);
38
- };
39
- return function (mod) {
40
- if (mod && mod.__esModule) return mod;
41
- var result = {};
42
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
- __setModuleDefault(result, mod);
44
- return result;
45
- };
46
- })();
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.bundleCommand = void 0;
49
- const commander_1 = require("commander");
50
- const fs = __importStar(require("fs"));
51
- const path = __importStar(require("path"));
52
- const audit_1 = require("@peac/audit");
53
- /**
54
- * Get global options from parent command
55
- */
56
- function getGlobalOptions(cmd) {
57
- const parent = cmd.parent;
58
- if (!parent)
59
- return {};
60
- return parent.opts();
61
- }
62
- /**
63
- * Output result - handles JSON vs human-readable format
64
- */
65
- function output(data, opts, humanMessage) {
66
- if (opts.json) {
67
- console.log(JSON.stringify(data, null, 2));
68
- }
69
- else if (humanMessage) {
70
- console.log(humanMessage);
71
- }
72
- }
73
- /**
74
- * Output error - handles JSON vs human-readable format
75
- */
76
- function outputError(error, details, opts) {
77
- if (opts.json) {
78
- console.log(JSON.stringify({ success: false, error, ...details }, null, 2));
79
- }
80
- else {
81
- console.error(`Error: ${error}`);
82
- if (details.code) {
83
- console.error(`Code: ${details.code}`);
84
- }
85
- }
86
- }
87
- /**
88
- * Read receipts from a directory or files
89
- */
90
- function readReceipts(receiptsPath) {
91
- const receipts = [];
92
- const stat = fs.statSync(receiptsPath);
93
- if (stat.isDirectory()) {
94
- // Read all .jws files in directory
95
- const files = fs.readdirSync(receiptsPath);
96
- for (const file of files) {
97
- if (file.endsWith('.jws')) {
98
- const content = fs.readFileSync(path.join(receiptsPath, file), 'utf8').trim();
99
- receipts.push(content);
100
- }
101
- }
102
- }
103
- else {
104
- // Single file - read it
105
- const content = fs.readFileSync(receiptsPath, 'utf8').trim();
106
- receipts.push(content);
107
- }
108
- return receipts;
109
- }
110
- /**
111
- * Read JWKS from file
112
- */
113
- function readJwks(keysPath) {
114
- const content = fs.readFileSync(keysPath, 'utf8');
115
- return JSON.parse(content);
116
- }
117
- const bundle = new commander_1.Command('bundle').description('Dispute bundle operations (v0.9.30+)');
118
- exports.bundleCommand = bundle;
119
- /**
120
- * peac bundle create --dispute <ref> --receipts <path> --keys <file> [--policy <file>] -o <output>
121
- */
122
- bundle
123
- .command('create')
124
- .description('Create a dispute bundle from receipts and keys')
125
- .requiredOption('-d, --dispute <ref>', 'Dispute reference (ULID)')
126
- .requiredOption('-r, --receipts <path>', 'Path to receipts (directory or file)')
127
- .requiredOption('-k, --keys <file>', 'Path to JWKS file with public keys')
128
- .option('-p, --policy <file>', 'Path to policy YAML file')
129
- .option('-c, --created-by <uri>', 'Creator URI (default: cli)')
130
- .requiredOption('-o, --output <file>', 'Output bundle file path')
131
- .option('--bundle-id <id>', 'Custom bundle ID (generated if not provided)')
132
- .action(async (options, cmd) => {
133
- const globalOpts = getGlobalOptions(cmd);
134
- try {
135
- // Validate input paths exist
136
- if (!fs.existsSync(options.receipts)) {
137
- outputError('Receipts path not found', { path: options.receipts }, globalOpts);
138
- process.exit(1);
139
- }
140
- if (!fs.existsSync(options.keys)) {
141
- outputError('JWKS file not found', { path: options.keys }, globalOpts);
142
- process.exit(1);
143
- }
144
- // Read inputs
145
- const receipts = readReceipts(options.receipts);
146
- const keys = readJwks(options.keys);
147
- if (receipts.length === 0) {
148
- outputError('No receipts found', { path: options.receipts }, globalOpts);
149
- process.exit(1);
150
- }
151
- // Read policy if provided
152
- let policy;
153
- if (options.policy) {
154
- if (!fs.existsSync(options.policy)) {
155
- outputError('Policy file not found', { path: options.policy }, globalOpts);
156
- process.exit(1);
157
- }
158
- policy = fs.readFileSync(options.policy, 'utf8');
159
- }
160
- // Create bundle
161
- const createOptions = {
162
- dispute_ref: options.dispute,
163
- created_by: options.createdBy ?? 'peac-cli',
164
- receipts,
165
- keys,
166
- policy,
167
- bundle_id: options.bundleId,
168
- };
169
- const result = await (0, audit_1.createDisputeBundle)(createOptions);
170
- if (!result.ok) {
171
- outputError(result.error.message, { code: result.error.code }, globalOpts);
172
- process.exit(1);
173
- }
174
- // Write output
175
- fs.writeFileSync(options.output, result.value);
176
- // Read back to get manifest info
177
- const readResult = await (0, audit_1.readDisputeBundle)(result.value);
178
- if (readResult.ok) {
179
- const manifest = readResult.value.manifest;
180
- output({
181
- success: true,
182
- bundle_id: manifest.bundle_id,
183
- content_hash: manifest.content_hash,
184
- receipts_count: manifest.receipts.length,
185
- keys_count: manifest.keys.length,
186
- output_path: options.output,
187
- }, globalOpts, `Bundle created successfully:
188
- Bundle ID: ${manifest.bundle_id}
189
- Content hash: ${manifest.content_hash}
190
- Receipts: ${manifest.receipts.length}
191
- Keys: ${manifest.keys.length}
192
- Output: ${options.output}`);
193
- }
194
- else {
195
- output({ success: true, output_path: options.output }, globalOpts, `Bundle created: ${options.output}`);
196
- }
197
- process.exit(0);
198
- }
199
- catch (err) {
200
- outputError(err.message, {}, globalOpts);
201
- process.exit(1);
202
- }
203
- });
204
- /**
205
- * peac bundle verify <bundle> [--online] [--output <file>] [--format json|text]
206
- *
207
- * NOTE: Verification is OFFLINE by default - uses only keys bundled in the archive.
208
- * Use --online to enable external key fetching (not yet implemented).
209
- */
210
- bundle
211
- .command('verify')
212
- .description('Verify a dispute bundle (offline by default)')
213
- .argument('<bundle>', 'Path to bundle ZIP file')
214
- .option('--online', 'Allow external key fetching (not yet implemented)', false)
215
- .option('-o, --output <file>', 'Output report to file')
216
- .option('-f, --format <format>', 'Output format: json or text', 'text')
217
- .action(async (bundlePath, options, cmd) => {
218
- const globalOpts = getGlobalOptions(cmd);
219
- try {
220
- // Validate bundle exists
221
- if (!fs.existsSync(bundlePath)) {
222
- outputError('Bundle file not found', { path: bundlePath }, globalOpts);
223
- process.exit(1);
224
- }
225
- // Read bundle
226
- const zipBuffer = fs.readFileSync(bundlePath);
227
- // Verify bundle - offline by default, online if explicitly requested
228
- const offline = !options.online;
229
- const result = await (0, audit_1.verifyBundle)(zipBuffer, { offline });
230
- if (!result.ok) {
231
- outputError(result.error.message, { code: result.error.code }, globalOpts);
232
- process.exit(1);
233
- }
234
- const report = result.value;
235
- // Format output
236
- let outputContent;
237
- if (options.format === 'json' || globalOpts.json) {
238
- outputContent = (0, audit_1.serializeReport)(report, true);
239
- }
240
- else {
241
- outputContent = (0, audit_1.formatReportText)(report);
242
- }
243
- // Write to file or stdout
244
- if (options.output) {
245
- fs.writeFileSync(options.output, outputContent);
246
- output({
247
- success: true,
248
- report_hash: report.report_hash,
249
- summary: report.summary,
250
- recommendation: report.auditor_summary.recommendation,
251
- output_path: options.output,
252
- }, globalOpts, `Verification complete:
253
- ${report.auditor_summary.headline}
254
- Recommendation: ${report.auditor_summary.recommendation.toUpperCase()}
255
- Report hash: ${report.report_hash}
256
- Report saved to: ${options.output}`);
257
- }
258
- else if (globalOpts.json) {
259
- // JSON to stdout
260
- console.log(outputContent);
261
- }
262
- else {
263
- // Text to stdout
264
- console.log(outputContent);
265
- }
266
- // Exit code based on recommendation
267
- const exitCode = report.auditor_summary.recommendation === 'valid' ? 0 : 1;
268
- process.exit(exitCode);
269
- }
270
- catch (err) {
271
- outputError(err.message, {}, globalOpts);
272
- process.exit(1);
273
- }
274
- });
275
- /**
276
- * peac bundle info <bundle>
277
- */
278
- bundle
279
- .command('info')
280
- .description('Show bundle manifest information')
281
- .argument('<bundle>', 'Path to bundle ZIP file')
282
- .action(async (bundlePath, options, cmd) => {
283
- const globalOpts = getGlobalOptions(cmd);
284
- try {
285
- // Validate bundle exists
286
- if (!fs.existsSync(bundlePath)) {
287
- outputError('Bundle file not found', { path: bundlePath }, globalOpts);
288
- process.exit(1);
289
- }
290
- // Read bundle
291
- const zipBuffer = fs.readFileSync(bundlePath);
292
- const result = await (0, audit_1.readDisputeBundle)(zipBuffer);
293
- if (!result.ok) {
294
- outputError(result.error.message, { code: result.error.code }, globalOpts);
295
- process.exit(1);
296
- }
297
- const { manifest, receipts, keys, policy } = result.value;
298
- if (globalOpts.json) {
299
- console.log(JSON.stringify({
300
- success: true,
301
- manifest: {
302
- version: manifest.version,
303
- bundle_id: manifest.bundle_id,
304
- dispute_ref: manifest.dispute_ref,
305
- created_by: manifest.created_by,
306
- created_at: manifest.created_at,
307
- time_range: manifest.time_range,
308
- content_hash: manifest.content_hash,
309
- receipts_count: manifest.receipts.length,
310
- keys_count: manifest.keys.length,
311
- has_policy: !!policy,
312
- },
313
- }, null, 2));
314
- }
315
- else {
316
- console.log(`PEAC Dispute Bundle Info
317
- ========================
318
-
319
- Version: ${manifest.version}
320
- Bundle ID: ${manifest.bundle_id}
321
- Dispute Ref: ${manifest.dispute_ref}
322
- Created By: ${manifest.created_by}
323
- Created At: ${manifest.created_at}
324
-
325
- Time Range
326
- ----------
327
- Start: ${manifest.time_range.start}
328
- End: ${manifest.time_range.end}
329
-
330
- Contents
331
- --------
332
- Receipts: ${manifest.receipts.length}
333
- Keys: ${keys.keys.length}
334
- Policy: ${policy ? 'Yes' : 'No'}
335
-
336
- Integrity
337
- ---------
338
- Content Hash: ${manifest.content_hash}
339
- `);
340
- // List receipts
341
- if (manifest.receipts.length > 0) {
342
- console.log('Receipts:');
343
- for (const receipt of manifest.receipts) {
344
- console.log(` - ${receipt.receipt_id} (${receipt.issued_at})`);
345
- }
346
- console.log('');
347
- }
348
- // List keys
349
- if (manifest.keys.length > 0) {
350
- console.log('Keys:');
351
- for (const key of manifest.keys) {
352
- console.log(` - ${key.kid} (${key.alg})`);
353
- }
354
- }
355
- }
356
- process.exit(0);
357
- }
358
- catch (err) {
359
- outputError(err.message, {}, globalOpts);
360
- process.exit(1);
361
- }
362
- });
363
- //# sourceMappingURL=bundle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundle.js","sourceR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,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;gBAC7C,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,WAAW,CAAE,GAAa,CAAC,OAAO,EAAE,EAAE,EAAE,UAAU,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -1,301 +0,0 @@
1
- "use strict";
2
- /**
3
- * PEAC Conformance CLI Commands (v0.10.8+)
4
- *
5
- * Commands for running conformance tests:
6
- * - run: Run conformance tests against fixtures
7
- * - list: List available conformance test fixtures
8
- *
9
- * Uses real validators from @peac/schema and generates reports
10
- * conforming to peac-conformance-report/0.1.
11
- *
12
- * @packageDocumentation
13
- */
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
- Object.defineProperty(o, "default", { enumerable: true, value: v });
27
- }) : function(o, v) {
28
- o["default"] = v;
29
- });
30
- var __importStar = (this && this.__importStar) || (function () {
31
- var ownKeys = function(o) {
32
- ownKeys = Object.getOwnPropertyNames || function (o) {
33
- var ar = [];
34
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
- return ar;
36
- };
37
- return ownKeys(o);
38
- };
39
- return function (mod) {
40
- if (mod && mod.__esModule) return mod;
41
- var result = {};
42
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
- __setModuleDefault(result, mod);
44
- return result;
45
- };
46
- })();
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.conformance = void 0;
49
- const commander_1 = require("commander");
50
- const fs = __importStar(require("fs"));
51
- const path = __importStar(require("path"));
52
- const conformance_runner_js_1 = require("../lib/conformance-runner.js");
53
- const version_js_1 = require("../lib/version.js");
54
- /**
55
- * Get global options from parent command
56
- */
57
- function getGlobalOptions(cmd) {
58
- const parent = cmd.parent;
59
- if (!parent)
60
- return {};
61
- return parent.opts();
62
- }
63
- /**
64
- * Output error - handles JSON vs human-readable format
65
- */
66
- function outputError(error, details, opts) {
67
- if (opts.json) {
68
- console.log(JSON.stringify({ success: false, error, ...details }, null, 2));
69
- }
70
- else {
71
- console.error(`Error: ${error}`);
72
- if (details.code) {
73
- console.error(`Code: ${details.code}`);
74
- }
75
- if (details.hint) {
76
- console.error(`Hint: ${details.hint}`);
77
- }
78
- }
79
- }
80
- /**
81
- * Find fixtures directory (relative to CLI package or repo root)
82
- */
83
- function findFixturesDir(customPath) {
84
- // Use custom path if provided
85
- if (customPath) {
86
- if (fs.existsSync(customPath)) {
87
- return customPath;
88
- }
89
- return null;
90
- }
91
- // Try relative to CLI package (when installed)
92
- const cliPath = path.resolve(__dirname, '../../../../specs/conformance/fixtures');
93
- if (fs.existsSync(cliPath)) {
94
- return cliPath;
95
- }
96
- // Try relative to repo root (when running from source)
97
- const repoPath = path.resolve(process.cwd(), 'specs/conformance/fixtures');
98
- if (fs.existsSync(repoPath)) {
99
- return repoPath;
100
- }
101
- // Try one level up (when running from packages/cli)
102
- const upPath = path.resolve(process.cwd(), '../../specs/conformance/fixtures');
103
- if (fs.existsSync(upPath)) {
104
- return upPath;
105
- }
106
- return null;
107
- }
108
- /**
109
- * List available fixture categories
110
- */
111
- function listCategories(fixturesDir) {
112
- const entries = fs.readdirSync(fixturesDir, { withFileTypes: true });
113
- return entries.filter((e) => e.isDirectory() && !e.name.startsWith('.')).map((e) => e.name);
114
- }
115
- /**
116
- * Count fixtures in a category
117
- */
118
- function countFixtures(categoryPath) {
119
- if (!fs.existsSync(categoryPath))
120
- return 0;
121
- const files = fs.readdirSync(categoryPath);
122
- return files.filter((f) => f.endsWith('.json')).length;
123
- }
124
- const conformance = new commander_1.Command('conformance')
125
- .description('PEAC conformance testing (v0.10.8+)')
126
- .option('--json', 'Output in JSON format');
127
- exports.conformance = conformance;
128
- /**
129
- * peac conformance run [options]
130
- */
131
- conformance
132
- .command('run')
133
- .description('Run conformance tests')
134
- .option('-l, --level <level>', 'Conformance level: basic, standard, full', 'standard')
135
- .option('-c, --category <category>', 'Test specific category only')
136
- .option('-o, --output <format>', 'Output format: json, text, markdown', 'text')
137
- .option('-v, --verbose', 'Show detailed test output')
138
- .option('--fixtures <path>', 'Path to fixtures directory')
139
- .option('--implementation <name>', 'Implementation name for report', '@peac/cli')
140
- .action(async (options, cmd) => {
141
- const globalOpts = getGlobalOptions(cmd);
142
- const startTime = Date.now();
143
- try {
144
- // Find fixtures directory
145
- const fixturesDir = findFixturesDir(options.fixtures);
146
- if (!fixturesDir) {
147
- outputError('Fixtures directory not found', {
148
- hint: options.fixtures
149
- ? `Specified path does not exist: ${options.fixtures}`
150
- : 'Run from repo root, specify --fixtures <path>, or ensure specs/conformance/fixtures is available',
151
- }, globalOpts);
152
- process.exitCode = 1;
153
- return;
154
- }
155
- // Validate level
156
- const validLevels = ['basic', 'standard', 'full'];
157
- if (!validLevels.includes(options.level)) {
158
- outputError('Invalid conformance level', {
159
- level: options.level,
160
- valid: validLevels,
161
- }, globalOpts);
162
- process.exitCode = 1;
163
- return;
164
- }
165
- // Set up callbacks for verbose output
166
- const callbacks = options.verbose
167
- ? {
168
- onTestStart: (testId) => {
169
- console.log(`Running: ${testId}`);
170
- },
171
- onTestComplete: (result) => {
172
- const status = result.status === 'pass' ? 'PASS' : result.status === 'fail' ? 'FAIL' : 'SKIP';
173
- console.log(` ${status}: ${result.id}`);
174
- },
175
- }
176
- : undefined;
177
- // Run conformance tests
178
- const report = (0, conformance_runner_js_1.runConformance)({
179
- fixturesDir,
180
- level: options.level,
181
- category: options.category,
182
- implementationName: options.implementation,
183
- implementationVersion: (0, version_js_1.getVersion)(),
184
- }, callbacks);
185
- // Add runtime metadata
186
- report.implementation.runtime = (0, version_js_1.getRuntime)();
187
- const commit = (0, version_js_1.getCommit)();
188
- if (commit) {
189
- report.implementation.commit = commit;
190
- }
191
- // Add meta section
192
- report.meta = {
193
- generated_at: new Date().toISOString(),
194
- runner: {
195
- name: 'peac-cli',
196
- version: (0, version_js_1.getVersion)(),
197
- },
198
- duration_ms: Date.now() - startTime,
199
- };
200
- // Output based on format
201
- if (options.output === 'json' || globalOpts.json) {
202
- console.log(JSON.stringify(report, null, 2));
203
- }
204
- else if (options.output === 'markdown') {
205
- console.log((0, conformance_runner_js_1.formatReportMarkdown)(report));
206
- }
207
- else {
208
- console.log((0, conformance_runner_js_1.formatReportText)(report));
209
- }
210
- process.exitCode = report.summary.failed === 0 ? 0 : 1;
211
- }
212
- catch (err) {
213
- outputError(err.message, {}, globalOpts);
214
- process.exitCode = 1;
215
- }
216
- });
217
- /**
218
- * peac conformance list [--category <cat>]
219
- */
220
- conformance
221
- .command('list')
222
- .description('List available conformance test fixtures')
223
- .option('-c, --category <category>', 'List fixtures in specific category')
224
- .option('--fixtures <path>', 'Path to fixtures directory')
225
- .action((options, cmd) => {
226
- const globalOpts = getGlobalOptions(cmd);
227
- try {
228
- // Find fixtures directory
229
- const fixturesDir = findFixturesDir(options.fixtures);
230
- if (!fixturesDir) {
231
- outputError('Fixtures directory not found', {
232
- hint: options.fixtures
233
- ? `Specified path does not exist: ${options.fixtures}`
234
- : 'Run from repo root, specify --fixtures <path>, or ensure specs/conformance/fixtures is available',
235
- }, globalOpts);
236
- process.exitCode = 1;
237
- return;
238
- }
239
- // Load manifest
240
- const manifestPath = path.join(fixturesDir, 'manifest.json');
241
- const manifest = fs.existsSync(manifestPath)
242
- ? JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
243
- : {};
244
- // List categories
245
- const categories = listCategories(fixturesDir);
246
- if (options.category) {
247
- // List fixtures in specific category
248
- if (!categories.includes(options.category)) {
249
- outputError('Category not found', {
250
- category: options.category,
251
- available: categories,
252
- }, globalOpts);
253
- process.exitCode = 1;
254
- return;
255
- }
256
- const categoryPath = path.join(fixturesDir, options.category);
257
- const files = fs.readdirSync(categoryPath).filter((f) => f.endsWith('.json'));
258
- const categoryManifest = manifest[options.category];
259
- if (globalOpts.json) {
260
- const fixtures = files.map((f) => ({
261
- file: f,
262
- description: categoryManifest?.[f]?.description || 'No description',
263
- }));
264
- console.log(JSON.stringify({ category: options.category, fixtures }, null, 2));
265
- }
266
- else {
267
- console.log(`Fixtures in ${options.category}:\n`);
268
- for (const file of files) {
269
- const info = categoryManifest?.[file] || {};
270
- const desc = info.description || 'No description';
271
- console.log(` ${file}`);
272
- console.log(` ${desc}\n`);
273
- }
274
- }
275
- }
276
- else {
277
- // List all categories
278
- if (globalOpts.json) {
279
- const categorySummary = categories.map((cat) => ({
280
- name: cat,
281
- fixture_count: countFixtures(path.join(fixturesDir, cat)),
282
- }));
283
- console.log(JSON.stringify({ categories: categorySummary }, null, 2));
284
- }
285
- else {
286
- console.log(`Available conformance test categories:\n`);
287
- for (const cat of categories) {
288
- const count = countFixtures(path.join(fixturesDir, cat));
289
- console.log(` ${cat} (${count} fixtures)`);
290
- }
291
- console.log(`\nUse 'peac conformance list -c <category>' to see fixtures in a category.`);
292
- }
293
- }
294
- process.exitCode = 0;
295
- }
296
- catch (err) {
297
- outputError(err.message, {}, globalOpts);
298
- process.exitCode = 1;
299
- }
300
- });
301
- //# sourceMappingURL=conformance.js.map