@peac/cli 0.10.0 → 0.10.10

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 (57) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +78 -5
  3. package/dist/commands/conformance.d.ts +16 -0
  4. package/dist/commands/conformance.d.ts.map +1 -0
  5. package/dist/commands/samples.d.ts +17 -0
  6. package/dist/commands/samples.d.ts.map +1 -0
  7. package/dist/index.cjs +2257 -0
  8. package/dist/index.cjs.map +1 -0
  9. package/dist/index.mjs +2236 -0
  10. package/dist/index.mjs.map +1 -0
  11. package/dist/lib/conformance/digest.d.ts +64 -0
  12. package/dist/lib/conformance/digest.d.ts.map +1 -0
  13. package/dist/lib/conformance/index.d.ts +11 -0
  14. package/dist/lib/conformance/index.d.ts.map +1 -0
  15. package/dist/lib/conformance/manifest.d.ts +15 -0
  16. package/dist/lib/conformance/manifest.d.ts.map +1 -0
  17. package/dist/lib/conformance/profiles.d.ts +33 -0
  18. package/dist/lib/conformance/profiles.d.ts.map +1 -0
  19. package/dist/lib/conformance/types.d.ts +186 -0
  20. package/dist/lib/conformance/types.d.ts.map +1 -0
  21. package/dist/lib/conformance/validators.d.ts +27 -0
  22. package/dist/lib/conformance/validators.d.ts.map +1 -0
  23. package/dist/lib/conformance-runner.d.ts +29 -0
  24. package/dist/lib/conformance-runner.d.ts.map +1 -0
  25. package/dist/lib/samples-loader.d.ts +44 -0
  26. package/dist/lib/samples-loader.d.ts.map +1 -0
  27. package/dist/lib/version.d.ts +22 -0
  28. package/dist/lib/version.d.ts.map +1 -0
  29. package/package.json +27 -13
  30. package/dist/cli.js +0 -90
  31. package/dist/cli.js.map +0 -1
  32. package/dist/commands/bridge/index.js +0 -20
  33. package/dist/commands/bridge/index.js.map +0 -1
  34. package/dist/commands/bridge/install.js +0 -27
  35. package/dist/commands/bridge/install.js.map +0 -1
  36. package/dist/commands/bridge/start.js +0 -123
  37. package/dist/commands/bridge/start.js.map +0 -1
  38. package/dist/commands/bridge/status.js +0 -192
  39. package/dist/commands/bridge/status.js.map +0 -1
  40. package/dist/commands/bridge/stop.js +0 -130
  41. package/dist/commands/bridge/stop.js.map +0 -1
  42. package/dist/commands/bundle.js +0 -363
  43. package/dist/commands/bundle.js.map +0 -1
  44. package/dist/commands/discover.js +0 -39
  45. package/dist/commands/discover.js.map +0 -1
  46. package/dist/commands/hash.js +0 -106
  47. package/dist/commands/hash.js.map +0 -1
  48. package/dist/commands/policy.js +0 -712
  49. package/dist/commands/policy.js.map +0 -1
  50. package/dist/commands/verify.js +0 -50
  51. package/dist/commands/verify.js.map +0 -1
  52. package/dist/index.js +0 -217
  53. package/dist/index.js.map +0 -1
  54. package/dist/types.js +0 -6
  55. package/dist/types.js.map +0 -1
  56. package/dist/utils.js +0 -101
  57. package/dist/utils.js.map +0 -1
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Conformance Runner Types
3
+ *
4
+ * Shared type definitions for the conformance testing system.
5
+ */
6
+ /**
7
+ * Conformance level determines which fixtures are run
8
+ */
9
+ export type ConformanceLevel = 'basic' | 'standard' | 'full';
10
+ /**
11
+ * Test result status
12
+ */
13
+ export type TestStatus = 'pass' | 'fail' | 'skip';
14
+ /**
15
+ * Diagnostic information for a test result
16
+ */
17
+ export interface TestDiagnostics {
18
+ error_code?: string;
19
+ error_message?: string;
20
+ skip_reason?: string;
21
+ input_digest?: {
22
+ alg: string;
23
+ value: string;
24
+ };
25
+ warnings?: string[];
26
+ }
27
+ /**
28
+ * Per-test result conforming to peac-conformance-report/0.1
29
+ */
30
+ export interface TestResult {
31
+ id: string;
32
+ category: string;
33
+ status: TestStatus;
34
+ expected?: {
35
+ valid: boolean;
36
+ error_code?: string;
37
+ error_path?: string;
38
+ error_keyword?: string;
39
+ };
40
+ observed?: {
41
+ valid: boolean;
42
+ error_code?: string;
43
+ error_path?: string;
44
+ error_keyword?: string;
45
+ error_message?: string;
46
+ };
47
+ diagnostics?: TestDiagnostics;
48
+ }
49
+ /**
50
+ * Profile capability level
51
+ */
52
+ export type ProfileLevel = 'shape' | 'semantic';
53
+ /**
54
+ * Profile detail for capabilities reporting
55
+ */
56
+ export interface ProfileDetail {
57
+ profile: string;
58
+ level: ProfileLevel;
59
+ validator: string;
60
+ notes?: string;
61
+ }
62
+ /**
63
+ * Conformance report conforming to peac-conformance-report/0.1
64
+ */
65
+ export interface ConformanceReport {
66
+ report_version: 'peac-conformance-report/0.1';
67
+ suite: {
68
+ name: string;
69
+ version: string;
70
+ vectors_digest: {
71
+ alg: string;
72
+ value: string;
73
+ };
74
+ profiles: string[];
75
+ /** Detailed capability information for each profile */
76
+ capabilities?: ProfileDetail[];
77
+ };
78
+ implementation: {
79
+ name: string;
80
+ version: string;
81
+ runtime?: string;
82
+ commit?: string;
83
+ };
84
+ summary: {
85
+ passed: number;
86
+ failed: number;
87
+ skipped: number;
88
+ total: number;
89
+ status: 'pass' | 'fail';
90
+ };
91
+ results: TestResult[];
92
+ meta?: {
93
+ generated_at?: string;
94
+ runner?: {
95
+ name: string;
96
+ version: string;
97
+ git_sha?: string;
98
+ };
99
+ duration_ms?: number;
100
+ };
101
+ }
102
+ /**
103
+ * Runner options
104
+ */
105
+ export interface RunnerOptions {
106
+ fixturesDir: string;
107
+ level: ConformanceLevel;
108
+ category?: string;
109
+ implementationName?: string;
110
+ implementationVersion?: string;
111
+ }
112
+ /**
113
+ * Runner callback for progress reporting (pure runner, no console.log)
114
+ */
115
+ export interface RunnerCallbacks {
116
+ onTestStart?: (testId: string) => void;
117
+ onTestComplete?: (result: TestResult) => void;
118
+ }
119
+ /**
120
+ * Validation result from a category validator
121
+ */
122
+ export interface ValidationResult {
123
+ valid: boolean;
124
+ error_code?: string;
125
+ error_message?: string;
126
+ warnings?: string[];
127
+ }
128
+ /**
129
+ * Extended validation result with path information
130
+ */
131
+ export interface ValidationResultWithPath extends ValidationResult {
132
+ error_path?: string;
133
+ error_keyword?: string;
134
+ }
135
+ /**
136
+ * Fixture file structure (fixture pack format)
137
+ */
138
+ export interface FixturePack {
139
+ $schema?: string;
140
+ $comment?: string;
141
+ version: string;
142
+ fixtures: Array<{
143
+ name?: string;
144
+ description?: string;
145
+ type?: string;
146
+ input: unknown;
147
+ expected: {
148
+ valid: boolean;
149
+ error_code?: string;
150
+ error?: string;
151
+ };
152
+ }>;
153
+ }
154
+ /**
155
+ * Single fixture structure (valid/invalid/edge directories)
156
+ */
157
+ export interface SingleFixture {
158
+ $comment?: string;
159
+ header?: unknown;
160
+ payload?: unknown;
161
+ expected_valid?: boolean;
162
+ expected_error?: string;
163
+ }
164
+ /**
165
+ * Manifest entry for fixture metadata (from manifest.json)
166
+ */
167
+ export interface ManifestEntry {
168
+ description?: string;
169
+ expected_keyword?: string;
170
+ expected_path?: string;
171
+ expected_valid?: boolean;
172
+ expected_error_code?: string;
173
+ version?: string;
174
+ fixture_count?: number;
175
+ note?: string;
176
+ }
177
+ /**
178
+ * Manifest structure
179
+ */
180
+ export type Manifest = Record<string, Record<string, ManifestEntry>>;
181
+ /**
182
+ * Category validator function type
183
+ * Returns ValidationResultWithPath to include error_path and error_keyword
184
+ */
185
+ export type CategoryValidator = (input: unknown) => ValidationResultWithPath;
186
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/conformance/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE;QACb,GAAG,EAAE,MAAM,CAAC;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;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,wBAAwB,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Conformance Category Validators
3
+ *
4
+ * Category-aware validation using the same validators as tests/conformance/*.spec.ts.
5
+ */
6
+ import type { ValidationResultWithPath, CategoryValidator } from './types.js';
7
+ /**
8
+ * Validate receipt claims using Zod schema
9
+ */
10
+ export declare function validateReceiptPayload(payload: unknown): ValidationResultWithPath;
11
+ /**
12
+ * Validate receipt claims using unified parser (parse-level error codes).
13
+ *
14
+ * Separate from validateReceiptPayload which returns path-level codes.
15
+ * Use this for the `parse` conformance category where fixtures assert
16
+ * parse-level codes (E_PARSE_COMMERCE_INVALID, E_PARSE_ATTESTATION_INVALID).
17
+ */
18
+ export declare function validateParseReceiptClaims(payload: unknown): ValidationResultWithPath;
19
+ /**
20
+ * Category validator registry
21
+ */
22
+ export declare const CATEGORY_VALIDATORS: Record<string, CategoryValidator>;
23
+ /**
24
+ * Get validator for a category
25
+ */
26
+ export declare function getValidator(category: string): CategoryValidator;
27
+ //# sourceMappingURL=validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/lib/conformance/validators.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAiBH,OAAO,KAAK,EAAoB,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAqBhG;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,wBAAwB,CAgCjF;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,wBAAwB,CAUrF;AAySD;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAuCjE,CAAC;AAEF;;GAEG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAoBhE"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * PEAC Conformance Runner Library
3
+ *
4
+ * Category-aware validation using the same validators as tests/conformance/*.spec.ts:
5
+ * - Receipt validation via @peac/schema (ReceiptClaimsSchema)
6
+ * - Discovery validation via @peac/disc (parse, validate)
7
+ * - Bundle verification via @peac/audit (verifyBundleIntegrity)
8
+ * - Attestation validation via @peac/schema validators
9
+ * - Interaction/Workflow validation via ordered validators
10
+ *
11
+ * This is the CLI's thin wrapper around the conformance suite.
12
+ */
13
+ export type { ConformanceLevel, TestStatus, TestDiagnostics, TestResult, ProfileLevel, ProfileDetail, ConformanceReport, RunnerOptions, RunnerCallbacks, FixturePack, SingleFixture, } from './conformance/types.js';
14
+ export { zodPathToJsonPointer } from './conformance/digest.js';
15
+ import type { ConformanceReport, RunnerOptions, RunnerCallbacks } from './conformance/types.js';
16
+ /**
17
+ * Run conformance tests and generate report
18
+ * Pure function - no console output, uses callbacks for progress
19
+ */
20
+ export declare function runConformance(options: RunnerOptions, callbacks?: RunnerCallbacks): ConformanceReport;
21
+ /**
22
+ * Format report as text
23
+ */
24
+ export declare function formatReportText(report: ConformanceReport): string;
25
+ /**
26
+ * Format report as markdown
27
+ */
28
+ export declare function formatReportMarkdown(report: ConformanceReport): string;
29
+ //# sourceMappingURL=conformance-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conformance-runner.d.ts","sourceRoot":"","sources":["../../src/lib/conformance-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,YAAY,EACV,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,UAAU,EACV,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,WAAW,EACX,aAAa,GACd,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/D,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EACb,eAAe,EAMhB,MAAM,wBAAwB,CAAC;AAmBhC;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,aAAa,EACtB,SAAS,CAAC,EAAE,eAAe,GAC1B,iBAAiB,CA8TnB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAmClE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAwCtE"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * PEAC Samples Loader
3
+ *
4
+ * Loads sample definitions from specs/conformance/samples/ when available,
5
+ * falling back to embedded defaults when running outside the repo.
6
+ *
7
+ * This ensures a single source of truth (specs folder is canonical).
8
+ */
9
+ /**
10
+ * Sample category
11
+ */
12
+ export type SampleCategory = 'valid' | 'invalid' | 'edge';
13
+ /**
14
+ * Sample definition
15
+ */
16
+ export interface SampleDefinition {
17
+ id: string;
18
+ name: string;
19
+ description: string;
20
+ category: SampleCategory;
21
+ claims: Record<string, unknown>;
22
+ header?: Record<string, unknown>;
23
+ expectedError?: string;
24
+ }
25
+ /**
26
+ * Find samples directory
27
+ */
28
+ export declare function findSamplesDir(customPath?: string): string | null;
29
+ /**
30
+ * Get sample definitions
31
+ *
32
+ * Loads from specs/conformance/samples/ when available (canonical source),
33
+ * falls back to embedded samples when running outside the repo.
34
+ */
35
+ export declare function getSamples(customSamplesPath?: string): SampleDefinition[];
36
+ /**
37
+ * Get a specific sample by ID
38
+ */
39
+ export declare function getSampleById(id: string, customSamplesPath?: string): SampleDefinition | null;
40
+ /**
41
+ * List available sample IDs by category
42
+ */
43
+ export declare function listSampleIds(category?: SampleCategory, customSamplesPath?: string): string[];
44
+ //# sourceMappingURL=samples-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"samples-loader.d.ts","sourceRoot":"","sources":["../../src/lib/samples-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,cAAc,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AA0ID;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA4BjE;AA4ED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAYzE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAG7F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAI7F"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * CLI Version Utility
3
+ *
4
+ * Reads version from package.json at runtime to avoid hardcoding.
5
+ */
6
+ /**
7
+ * Get CLI version from package.json
8
+ *
9
+ * Uses multiple strategies to find package.json:
10
+ * 1. __dirname relative path (for CJS)
11
+ * 2. Process.cwd() fallback
12
+ */
13
+ export declare function getVersion(): string;
14
+ /**
15
+ * Get runtime string (e.g., "node-22.0.0")
16
+ */
17
+ export declare function getRuntime(): string;
18
+ /**
19
+ * Get git commit hash if available
20
+ */
21
+ export declare function getCommit(): string | undefined;
22
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/lib/version.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;;;GAMG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAyBnC;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAG9C"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@peac/cli",
3
- "version": "0.10.0",
3
+ "version": "0.10.10",
4
4
  "description": "PEAC protocol command-line tools",
5
- "main": "dist/index.js",
5
+ "main": "dist/index.cjs",
6
6
  "types": "dist/index.d.ts",
7
7
  "bin": {
8
- "peac": "./dist/index.js"
8
+ "peac": "./dist/index.cjs"
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",
@@ -22,28 +22,42 @@
22
22
  "dist",
23
23
  "README.md"
24
24
  ],
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.mjs",
29
+ "require": "./dist/index.cjs",
30
+ "default": "./dist/index.mjs"
31
+ },
32
+ "./package.json": "./package.json"
33
+ },
25
34
  "publishConfig": {
26
- "access": "public"
35
+ "access": "public",
36
+ "provenance": true
27
37
  },
28
38
  "dependencies": {
29
39
  "chalk": "^4.1.2",
30
40
  "commander": "^11.0.0",
31
- "@peac/crypto": "0.10.0",
32
- "@peac/protocol": "0.10.0",
33
- "@peac/schema": "0.10.0",
34
- "@peac/policy-kit": "0.10.0",
35
- "@peac/audit": "0.10.0",
36
- "@peac/disc": "0.10.0"
41
+ "@peac/audit": "0.10.10",
42
+ "@peac/crypto": "0.10.10",
43
+ "@peac/disc": "0.10.10",
44
+ "@peac/policy-kit": "0.10.10",
45
+ "@peac/protocol": "0.10.10",
46
+ "@peac/schema": "0.10.10"
37
47
  },
38
48
  "devDependencies": {
39
49
  "@types/node": "^20.10.0",
40
50
  "typescript": "^5.3.3",
41
- "vitest": "^1.1.0"
51
+ "vitest": "^4.0.0",
52
+ "tsup": "^8.0.0"
42
53
  },
43
54
  "scripts": {
44
- "build": "tsc",
55
+ "prebuild": "rm -rf dist",
56
+ "build": "pnpm run build:js && pnpm run build:types",
45
57
  "test": "vitest run",
46
58
  "test:watch": "vitest",
47
- "clean": "rm -rf dist"
59
+ "clean": "rm -rf dist",
60
+ "build:js": "tsup",
61
+ "build:types": "rm -f dist/.tsbuildinfo && tsc && rm -f dist/.tsbuildinfo"
48
62
  }
49
63
  }
package/dist/cli.js DELETED
@@ -1,90 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- /**
4
- * PEAC Protocol CLI
5
- * Commands: discover, hash, verify
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- const commander_1 = require("commander");
9
- const discover_js_1 = require("./commands/discover.js");
10
- const hash_js_1 = require("./commands/hash.js");
11
- const verify_js_1 = require("./commands/verify.js");
12
- const index_js_1 = require("./commands/bridge/index.js");
13
- const bundle_js_1 = require("./commands/bundle.js");
14
- const utils_js_1 = require("./utils.js");
15
- const program = new commander_1.Command();
16
- const exit = (0, utils_js_1.createExitHandler)();
17
- program
18
- .name('peac')
19
- .description('PEAC Protocol CLI tools for discovery, hashing, and verification')
20
- .version('0.9.13.1');
21
- // Global options
22
- program
23
- .option('-j, --json', 'output in JSON format')
24
- .option('-v, --verbose', 'verbose output')
25
- .option('-t, --timeout <ms>', 'request timeout in milliseconds', '5000');
26
- // peac discover <url>
27
- program
28
- .command('discover <url>')
29
- .description('List AIPREF / agent-permissions / peac.txt sources')
30
- .action(async (url, options) => {
31
- const globalOptions = program.opts();
32
- const command = new discover_js_1.DiscoverCommand();
33
- const result = await command.execute(url, {
34
- ...globalOptions,
35
- timeout: parseInt(globalOptions.timeout),
36
- });
37
- console.log((0, utils_js_1.formatOutput)(result, globalOptions.json));
38
- exit(result.success ? 0 : 1);
39
- });
40
- // peac hash <policy.json>
41
- program
42
- .command('hash [policy-file]')
43
- .description('Compute canonical digest of policy (from file or stdin)')
44
- .action(async (policyFile, options) => {
45
- const globalOptions = program.opts();
46
- const command = new hash_js_1.HashCommand();
47
- let result;
48
- if (policyFile) {
49
- result = await command.execute(policyFile, globalOptions);
50
- }
51
- else {
52
- result = await command.executeFromStdin(globalOptions);
53
- }
54
- console.log((0, utils_js_1.formatOutput)(result, globalOptions.json));
55
- exit(result.success ? 0 : 1);
56
- });
57
- // peac verify <receipt.jws> --resource <url>
58
- program
59
- .command('verify <receipt-file>')
60
- .description('Verify receipt JWS signature and optionally recompute policy hash')
61
- .option('-r, --resource <url>', 'resource URL for policy hash verification')
62
- .option('-k, --keys <jwks-file>', 'path to JWKS file for verification')
63
- .action(async (receiptFile, options) => {
64
- const globalOptions = program.opts();
65
- const command = new verify_js_1.VerifyCommand();
66
- const result = await command.execute(receiptFile, {
67
- ...globalOptions,
68
- ...options,
69
- timeout: parseInt(globalOptions.timeout),
70
- });
71
- console.log((0, utils_js_1.formatOutput)(result, globalOptions.json));
72
- exit(result.success ? 0 : 1);
73
- });
74
- // peac bridge {install|start|stop|status}
75
- program.addCommand((0, index_js_1.bridgeCommand)());
76
- // peac bundle {create|verify|info}
77
- program.addCommand(bundle_js_1.bundleCommand);
78
- // Handle unknown commands
79
- program.on('command:*', () => {
80
- console.error('Invalid command. See --help for available commands.');
81
- exit(1);
82
- });
83
- // Parse command line arguments
84
- program.parse(process.argv);
85
- // If no command provided, show help
86
- if (!process.argv.slice(2).length) {
87
- program.outputHelp();
88
- exit(0);
89
- }
90
- //# sourceMappingURL=cli.js.map
package/dist/cli.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AACA;;;GAGG;;AAEH,yCAAoC;AACpC,wDAAyD;AACzD,gDAAiD;AACjD,oDAAqD;AACrD,yDAA2D;AAC3D,oDAAqD;AACrD,yCAA6D;AAE7D,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAC9B,M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UAAU,CAAC,IAAA,wBAAa,GAAE,CAAC,CAAC;AAEpC,mCAAmC;AACnC,OAAO,CAAC,UAAU,CAAC,yBAAa,CAAC,CAAC;AAElC,0BAA0B;AAC1B,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;IAC3B,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACrE,IAAI,CAAC,CAAC,CAAC,CAAC;AACV,CAAC,CAAC,CAAC;AAEH,+BAA+B;AAC/B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,oCAAoC;AACpC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,OAAO,CAAC,UAAU,EAAE,CAAC;IACrB,IAAI,CAAC,CAAC,CAAC,CAAC;AACV,CAAC"}
@@ -1,20 +0,0 @@
1
- "use strict";
2
- /**
3
- * Bridge management commands: install|start|stop|status
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.bridgeCommand = bridgeCommand;
7
- const commander_1 = require("commander");
8
- const install_js_1 = require("./install.js");
9
- const start_js_1 = require("./start.js");
10
- const stop_js_1 = require("./stop.js");
11
- const status_js_1 = require("./status.js");
12
- function bridgeCommand() {
13
- const bridge = new commander_1.Command('bridge').description('Manage PEAC Protocol Bridge (local development sidecar)');
14
- bridge.addCommand((0, install_js_1.installCommand)());
15
- bridge.addCommand((0, start_js_1.startCommand)());
16
- bridge.addCommand((0, stop_js_1.stopCommand)());
17
- bridge.addCommand((0, status_js_1.statusCommand)());
18
- return bridge;
19
- }
20
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/bridge/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAQH,sCAWC;AAjBD,yCAAoC;AACpC,6CAA8C;AAC9C,yCAA0C;AAC1C,uCAAwC;AACxC,2CAA4C;AAE5C,SAAgB,aAAa;IAC3B,MAAM,MAAM,GAAG,IAAI,mBAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,CAC9C,yDAAyD,CAC1D,CAAC;IAEF,MAAM,CAAC,UAAU,CAAC,IAAA,2BAAc,GAAE,CAAC,CAAC;IACpC,MAAM,CAAC,UAAU,CAAC,IAAA,uBAAY,GAAE,CAAC,CAAC;IAClC,MAAM,CAAC,UAAU,CAAC,IAAA,qBAAW,GAAE,CAAC,CAAC;IACjC,MAAM,CAAC,UAAU,CAAC,IAAA,yBAAa,GAAE,CAAC,CAAC;IAEnC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- /**
3
- * peac bridge install - Initialize bridge configuration
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.installCommand = installCommand;
7
- const commander_1 = require("commander");
8
- const fs_1 = require("fs");
9
- const path_1 = require("path");
10
- const os_1 = require("os");
11
- function installCommand() {
12
- return new commander_1.Command('install').description('Initialize bridge configuration').action(() => {
13
- const peacDir = (0, path_1.join)((0, os_1.homedir)(), '.peac');
14
- (0, fs_1.mkdirSync)(peacDir, { recursive: true });
15
- const config = {
16
- url: 'http://127.0.0.1:31415',
17
- version: '0.9.13.2', // Implementation version
18
- wire_version: '0.9.13', // Wire protocol version
19
- created_at: new Date().toISOString(),
20
- };
21
- (0, fs_1.writeFileSync)((0, path_1.join)(peacDir, 'bridge.json'), JSON.stringify(config, null, 2));
22
- console.log('Initialized ~/.peac/bridge.json');
23
- console.log(` Wire version: ${config.wire_version}`);
24
- console.log(` Bridge URL: ${config.url}`);
25
- });
26
- }
27
- //# sourceMappingURL=install.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/commands/bridge/install.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAOH,wCAkBC;AAvBD,yCAAoC;AACpC,2BAA8C;AAC9C,+BAA4B;AAC5B,2BAA6B;AAE7B,SAAgB,cAAc;IAC5B,OAAO,IAAI,mBAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,iCAAiC,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE;QACvF,MAAM,OAAO,GAAG,IAAA,WAAI,EAAC,IAAA,YAAO,GAAE,EAAE,OAAO,CAAC,CAAC;QACzC,IAAA,cAAS,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAExC,MAAM,MAAM,GAAG;YACb,GAAG,EAAE,wBAAwB;YAC7B,OAAO,EAAE,UAAU,EAAE,yBAAyB;YAC9C,YAAY,EAAE,QAAQ,EAAE,wBAAwB;YAChD,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC,CAAC;QAEF,IAAA,kBAAa,EAAC,IAAA,WAAI,EAAC,OAAO,EAAE,aAAa,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAE7E,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,oBAAoB,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,kBAAkB,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC"}