@peac/cli 0.9.18
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 +23 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +87 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/bridge/index.d.ts +6 -0
- package/dist/commands/bridge/index.d.ts.map +1 -0
- package/dist/commands/bridge/index.js +20 -0
- package/dist/commands/bridge/index.js.map +1 -0
- package/dist/commands/bridge/install.d.ts +6 -0
- package/dist/commands/bridge/install.d.ts.map +1 -0
- package/dist/commands/bridge/install.js +27 -0
- package/dist/commands/bridge/install.js.map +1 -0
- package/dist/commands/bridge/start.d.ts +6 -0
- package/dist/commands/bridge/start.d.ts.map +1 -0
- package/dist/commands/bridge/start.js +123 -0
- package/dist/commands/bridge/start.js.map +1 -0
- package/dist/commands/bridge/status.d.ts +6 -0
- package/dist/commands/bridge/status.d.ts.map +1 -0
- package/dist/commands/bridge/status.js +192 -0
- package/dist/commands/bridge/status.js.map +1 -0
- package/dist/commands/bridge/stop.d.ts +6 -0
- package/dist/commands/bridge/stop.d.ts.map +1 -0
- package/dist/commands/bridge/stop.js +130 -0
- package/dist/commands/bridge/stop.js.map +1 -0
- package/dist/commands/discover.d.ts +9 -0
- package/dist/commands/discover.d.ts.map +1 -0
- package/dist/commands/discover.js +39 -0
- package/dist/commands/discover.js.map +1 -0
- package/dist/commands/hash.d.ts +10 -0
- package/dist/commands/hash.d.ts.map +1 -0
- package/dist/commands/hash.js +106 -0
- package/dist/commands/hash.js.map +1 -0
- package/dist/commands/policy.d.ts +13 -0
- package/dist/commands/policy.d.ts.map +1 -0
- package/dist/commands/policy.js +364 -0
- package/dist/commands/policy.js.map +1 -0
- package/dist/commands/verify.d.ts +13 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +50 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +213 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +49 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +16 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +101 -0
- package/dist/utils.js.map +1 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @peac/cli
|
|
2
|
+
|
|
3
|
+
PEAC protocol command-line tools
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @peac/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
See [peacprotocol.org](https://peacprotocol.org) for full documentation.
|
|
14
|
+
|
|
15
|
+
## License
|
|
16
|
+
|
|
17
|
+
Apache-2.0
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
PEAC Protocol is an open source project stewarded by Originary and community contributors.
|
|
22
|
+
|
|
23
|
+
[Originary](https://www.originary.xyz) | [Docs](https://peacprotocol.org) | [GitHub](https://github.com/peacprotocol/peac)
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;GAGG"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
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 utils_js_1 = require("./utils.js");
|
|
14
|
+
const program = new commander_1.Command();
|
|
15
|
+
const exit = (0, utils_js_1.createExitHandler)();
|
|
16
|
+
program
|
|
17
|
+
.name('peac')
|
|
18
|
+
.description('PEAC Protocol CLI tools for discovery, hashing, and verification')
|
|
19
|
+
.version('0.9.13.1');
|
|
20
|
+
// Global options
|
|
21
|
+
program
|
|
22
|
+
.option('-j, --json', 'output in JSON format')
|
|
23
|
+
.option('-v, --verbose', 'verbose output')
|
|
24
|
+
.option('-t, --timeout <ms>', 'request timeout in milliseconds', '5000');
|
|
25
|
+
// peac discover <url>
|
|
26
|
+
program
|
|
27
|
+
.command('discover <url>')
|
|
28
|
+
.description('List AIPREF / agent-permissions / peac.txt sources')
|
|
29
|
+
.action(async (url, options) => {
|
|
30
|
+
const globalOptions = program.opts();
|
|
31
|
+
const command = new discover_js_1.DiscoverCommand();
|
|
32
|
+
const result = await command.execute(url, {
|
|
33
|
+
...globalOptions,
|
|
34
|
+
timeout: parseInt(globalOptions.timeout),
|
|
35
|
+
});
|
|
36
|
+
console.log((0, utils_js_1.formatOutput)(result, globalOptions.json));
|
|
37
|
+
exit(result.success ? 0 : 1);
|
|
38
|
+
});
|
|
39
|
+
// peac hash <policy.json>
|
|
40
|
+
program
|
|
41
|
+
.command('hash [policy-file]')
|
|
42
|
+
.description('Compute canonical digest of policy (from file or stdin)')
|
|
43
|
+
.action(async (policyFile, options) => {
|
|
44
|
+
const globalOptions = program.opts();
|
|
45
|
+
const command = new hash_js_1.HashCommand();
|
|
46
|
+
let result;
|
|
47
|
+
if (policyFile) {
|
|
48
|
+
result = await command.execute(policyFile, globalOptions);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
result = await command.executeFromStdin(globalOptions);
|
|
52
|
+
}
|
|
53
|
+
console.log((0, utils_js_1.formatOutput)(result, globalOptions.json));
|
|
54
|
+
exit(result.success ? 0 : 1);
|
|
55
|
+
});
|
|
56
|
+
// peac verify <receipt.jws> --resource <url>
|
|
57
|
+
program
|
|
58
|
+
.command('verify <receipt-file>')
|
|
59
|
+
.description('Verify receipt JWS signature and optionally recompute policy hash')
|
|
60
|
+
.option('-r, --resource <url>', 'resource URL for policy hash verification')
|
|
61
|
+
.option('-k, --keys <jwks-file>', 'path to JWKS file for verification')
|
|
62
|
+
.action(async (receiptFile, options) => {
|
|
63
|
+
const globalOptions = program.opts();
|
|
64
|
+
const command = new verify_js_1.VerifyCommand();
|
|
65
|
+
const result = await command.execute(receiptFile, {
|
|
66
|
+
...globalOptions,
|
|
67
|
+
...options,
|
|
68
|
+
timeout: parseInt(globalOptions.timeout),
|
|
69
|
+
});
|
|
70
|
+
console.log((0, utils_js_1.formatOutput)(result, globalOptions.json));
|
|
71
|
+
exit(result.success ? 0 : 1);
|
|
72
|
+
});
|
|
73
|
+
// peac bridge {install|start|stop|status}
|
|
74
|
+
program.addCommand((0, index_js_1.bridgeCommand)());
|
|
75
|
+
// Handle unknown commands
|
|
76
|
+
program.on('command:*', () => {
|
|
77
|
+
console.error('Invalid command. See --help for available commands.');
|
|
78
|
+
exit(1);
|
|
79
|
+
});
|
|
80
|
+
// Parse command line arguments
|
|
81
|
+
program.parse(process.argv);
|
|
82
|
+
// If no command provided, show help
|
|
83
|
+
if (!process.argv.slice(2).length) {
|
|
84
|
+
program.outputHelp();
|
|
85
|
+
exit(0);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
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,yCAA6D;AAE7D,MAAM,OAAO,GAAG,IAAI,mBAA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0C;AAC1C,OAAO,CAAC,UAAU,CAAC,IAAA,wBAAa,GAAE,CAAC,CAAC;AAEpC,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/bridge/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,aAAa,YAW5B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/commands/bridge/install.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,cAAc,YAkB7B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/bridge/start.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,YAAY,YAgI3B"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* peac bridge start - Start the bridge server
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.startCommand = startCommand;
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
const os_1 = require("os");
|
|
12
|
+
function startCommand() {
|
|
13
|
+
return new commander_1.Command('start')
|
|
14
|
+
.description('Start the PEAC Bridge')
|
|
15
|
+
.option('--port <port>', 'Port to listen on', '31415')
|
|
16
|
+
.option('--mode <mode>', 'Mode (dev|test|production)', 'production')
|
|
17
|
+
.option('--foreground', 'Run in foreground mode')
|
|
18
|
+
.action(async (options) => {
|
|
19
|
+
const peacDir = (0, path_1.join)((0, os_1.homedir)(), '.peac');
|
|
20
|
+
const logsDir = (0, path_1.join)(peacDir, 'logs');
|
|
21
|
+
const pidFile = (0, path_1.join)(peacDir, 'bridge.pid');
|
|
22
|
+
// Ensure directories exist
|
|
23
|
+
(0, fs_1.mkdirSync)(peacDir, { recursive: true });
|
|
24
|
+
(0, fs_1.mkdirSync)(logsDir, { recursive: true });
|
|
25
|
+
const env = {
|
|
26
|
+
...process.env,
|
|
27
|
+
PEAC_BRIDGE_PORT: options.port,
|
|
28
|
+
PEAC_MODE: options.mode,
|
|
29
|
+
};
|
|
30
|
+
// Prefer resolved module path (works for workspace install)
|
|
31
|
+
let bridgePath = null;
|
|
32
|
+
try {
|
|
33
|
+
bridgePath = require.resolve('@peac/app-bridge/dist/server.js', { paths: [process.cwd()] });
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
try {
|
|
37
|
+
const localPath = (0, path_1.join)(process.cwd(), 'apps/bridge/dist/server.js');
|
|
38
|
+
(0, fs_1.accessSync)(localPath);
|
|
39
|
+
bridgePath = localPath;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
bridgePath = null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (!bridgePath) {
|
|
46
|
+
console.error('Bridge executable not found');
|
|
47
|
+
console.error(' Run "pnpm build" in monorepo or install @peac/app-bridge');
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
if (options.foreground) {
|
|
51
|
+
// Run in foreground
|
|
52
|
+
const args = ['node', bridgePath];
|
|
53
|
+
const bridge = (0, child_process_1.spawn)(args[0], args.slice(1), {
|
|
54
|
+
stdio: 'inherit',
|
|
55
|
+
env,
|
|
56
|
+
});
|
|
57
|
+
console.log(`Starting PEAC Bridge on port ${options.port}`);
|
|
58
|
+
console.log('Press Ctrl+C to stop');
|
|
59
|
+
bridge.on('error', (err) => {
|
|
60
|
+
console.error('Failed to start bridge:', err);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
});
|
|
63
|
+
bridge.on('exit', (code) => {
|
|
64
|
+
console.log(`Bridge exited with code ${code}`);
|
|
65
|
+
process.exit(code || 0);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
// Run in background
|
|
70
|
+
const logFile = (0, path_1.join)(logsDir, 'bridge.log');
|
|
71
|
+
const out = (0, fs_1.openSync)(logFile, 'a');
|
|
72
|
+
const err = (0, fs_1.openSync)(logFile, 'a');
|
|
73
|
+
const args = ['node', bridgePath];
|
|
74
|
+
const bridge = (0, child_process_1.spawn)(args[0], args.slice(1), {
|
|
75
|
+
detached: true,
|
|
76
|
+
stdio: ['ignore', out, err],
|
|
77
|
+
env,
|
|
78
|
+
});
|
|
79
|
+
bridge.unref();
|
|
80
|
+
// Write PID file
|
|
81
|
+
(0, fs_1.writeFileSync)(pidFile, bridge.pid?.toString() || '');
|
|
82
|
+
console.log(`Bridge started on port ${options.port} (PID: ${bridge.pid})`);
|
|
83
|
+
console.log(`Logs: ${logFile}`);
|
|
84
|
+
// Write/update config
|
|
85
|
+
const configFile = (0, path_1.join)(peacDir, 'bridge.json');
|
|
86
|
+
try {
|
|
87
|
+
const existingConfig = JSON.parse((0, fs_1.readFileSync)(configFile, 'utf-8'));
|
|
88
|
+
existingConfig.pid = bridge.pid;
|
|
89
|
+
existingConfig.started_at = new Date().toISOString();
|
|
90
|
+
existingConfig.log_file = logFile;
|
|
91
|
+
(0, fs_1.writeFileSync)(configFile, JSON.stringify(existingConfig, null, 2));
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
// Create new config if it doesn't exist
|
|
95
|
+
(0, fs_1.writeFileSync)(configFile, JSON.stringify({
|
|
96
|
+
url: `http://127.0.0.1:${options.port}`,
|
|
97
|
+
version: '0.9.13.2',
|
|
98
|
+
wire_version: '0.9.13',
|
|
99
|
+
pid: bridge.pid,
|
|
100
|
+
started_at: new Date().toISOString(),
|
|
101
|
+
log_file: logFile,
|
|
102
|
+
}, null, 2));
|
|
103
|
+
}
|
|
104
|
+
// Wait a moment and check if it started successfully
|
|
105
|
+
setTimeout(async () => {
|
|
106
|
+
try {
|
|
107
|
+
const response = await fetch(`http://127.0.0.1:${options.port}/health`);
|
|
108
|
+
if (response.ok) {
|
|
109
|
+
console.log(`Bridge is healthy and responding`);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
console.warn(`Bridge responding but not healthy (HTTP ${response.status})`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.warn(`Bridge may not be responding yet:`, error instanceof Error ? error.message : String(error));
|
|
117
|
+
console.log(` Check logs: ${logFile}`);
|
|
118
|
+
}
|
|
119
|
+
}, 2000);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/bridge/start.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAQH,oCAgIC;AAtID,yCAAoC;AACpC,iDAAsC;AACtC,2BAAkF;AAClF,+BAA4B;AAC5B,2BAA6B;AAE7B,SAAgB,YAAY;IAC1B,OAAO,IAAI,mBAAO,CAAC,OAAO,CAAC;SACxB,WAAW,CAAC,uBAAuB,CAAC;SACpC,MAAM,CAAC,eAAe,EAAE,mBAAmB,EAAE,OAAO,CAAC;SACrD,MAAM,CAAC,eAAe,EAAE,4BAA4B,EAAE,YAAY,CAAC;SACnE,MAAM,CAAC,cAAc,EAAE,wBAAwB,CAAC;SAChD,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,MAAM,OAAO,GAAG,IAAA,WAAI,EAAC,IAAA,YAAO,GAAE,EAAE,OAAO,CAAC,CAAC;QACzC,MAAM,OAAO,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACtC,MAAM,OAAO,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE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G,MAAM,KAAK,CAAC,oBAAoB,OAAO,CAAC,IAAI,SAAS,CAAC,CAAC;oBACxE,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC;wBAChB,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;oBAClD,CAAC;yBAAM,CAAC;wBACN,OAAO,CAAC,IAAI,CAAC,2CAA2C,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;oBAC9E,CAAC;gBACH,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,IAAI,CACV,mCAAmC,EACnC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;oBACF,OAAO,CAAC,GAAG,CAAC,kBAAkB,OAAO,EAAE,CAAC,CAAC;gBAC3C,CAAC;YACH,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/bridge/status.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,aAAa,YA8L5B"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* peac bridge status - Check bridge server status
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.statusCommand = statusCommand;
|
|
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 statusCommand() {
|
|
12
|
+
return new commander_1.Command('status')
|
|
13
|
+
.description('Check PEAC Bridge status')
|
|
14
|
+
.option('--json', 'Output status as JSON')
|
|
15
|
+
.action(async (options) => {
|
|
16
|
+
const peacDir = (0, path_1.join)((0, os_1.homedir)(), '.peac');
|
|
17
|
+
const pidFile = (0, path_1.join)(peacDir, 'bridge.pid');
|
|
18
|
+
const configFile = (0, path_1.join)(peacDir, 'bridge.json');
|
|
19
|
+
const status = {
|
|
20
|
+
running: false,
|
|
21
|
+
configured: (0, fs_1.existsSync)(configFile),
|
|
22
|
+
config: null,
|
|
23
|
+
process: null,
|
|
24
|
+
health: null,
|
|
25
|
+
};
|
|
26
|
+
// Check configuration
|
|
27
|
+
if (status.configured) {
|
|
28
|
+
try {
|
|
29
|
+
status.config = JSON.parse((0, fs_1.readFileSync)(configFile, 'utf-8'));
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
status.config = { error: 'Invalid config file' };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Check if process is running
|
|
36
|
+
if ((0, fs_1.existsSync)(pidFile)) {
|
|
37
|
+
try {
|
|
38
|
+
const pidStr = (0, fs_1.readFileSync)(pidFile, 'utf-8').trim();
|
|
39
|
+
const pid = parseInt(pidStr, 10);
|
|
40
|
+
if (!isNaN(pid)) {
|
|
41
|
+
try {
|
|
42
|
+
process.kill(pid, 0); // Signal 0 checks if process exists
|
|
43
|
+
status.running = true;
|
|
44
|
+
status.process = {
|
|
45
|
+
pid,
|
|
46
|
+
uptime: status.config?.started_at
|
|
47
|
+
? Math.round((Date.now() - new Date(status.config.started_at).getTime()) / 1000)
|
|
48
|
+
: null,
|
|
49
|
+
};
|
|
50
|
+
// Try to check health endpoint
|
|
51
|
+
if (status.config?.url) {
|
|
52
|
+
try {
|
|
53
|
+
const healthUrl = status.config.url.replace(/\/$/, '') + '/health';
|
|
54
|
+
const response = await fetch(healthUrl, {
|
|
55
|
+
method: 'GET',
|
|
56
|
+
headers: { Accept: 'application/json' },
|
|
57
|
+
signal: AbortSignal.timeout(5000),
|
|
58
|
+
});
|
|
59
|
+
if (response.ok) {
|
|
60
|
+
status.health = await response.json();
|
|
61
|
+
status.health.status = 'healthy';
|
|
62
|
+
// Capture peac-version header if present
|
|
63
|
+
const peacVersion = response.headers.get('peac-version');
|
|
64
|
+
if (peacVersion) {
|
|
65
|
+
status.health.peac_version = peacVersion;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
status.health = {
|
|
70
|
+
status: 'unhealthy',
|
|
71
|
+
code: response.status,
|
|
72
|
+
statusText: response.statusText,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
status.health = {
|
|
78
|
+
status: 'unreachable',
|
|
79
|
+
error: error.message,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
if (error.code === 'ESRCH') {
|
|
86
|
+
status.process = { pid, status: 'not_found' };
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
status.process = { pid, error: error.message };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
status.process = { error: 'Invalid PID file' };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (options.json) {
|
|
99
|
+
console.log(JSON.stringify(status, null, 2));
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
// Human-readable output
|
|
103
|
+
console.log('PEAC Bridge Status');
|
|
104
|
+
console.log('');
|
|
105
|
+
if (!status.configured) {
|
|
106
|
+
console.log('Configuration: Not configured');
|
|
107
|
+
console.log(' Run "peac bridge install" to initialize');
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
console.log('Configuration: Found');
|
|
111
|
+
if (status.config?.url) {
|
|
112
|
+
console.log(` URL: ${status.config.url}`);
|
|
113
|
+
}
|
|
114
|
+
if (status.config?.wire_version) {
|
|
115
|
+
console.log(` Wire version: ${status.config.wire_version}`);
|
|
116
|
+
}
|
|
117
|
+
if (status.config?.version) {
|
|
118
|
+
console.log(` Implementation version: ${status.config.version}`);
|
|
119
|
+
}
|
|
120
|
+
console.log('');
|
|
121
|
+
if (!status.running) {
|
|
122
|
+
console.log('Process: Not running');
|
|
123
|
+
if (status.process?.status === 'not_found') {
|
|
124
|
+
console.log(' (Stale PID file - process not found)');
|
|
125
|
+
}
|
|
126
|
+
console.log(' Run "peac bridge start" to start the bridge');
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
console.log('Process: Running');
|
|
130
|
+
console.log(` PID: ${status.process.pid}`);
|
|
131
|
+
if (status.process.uptime !== null) {
|
|
132
|
+
const uptime = status.process.uptime;
|
|
133
|
+
const hours = Math.floor(uptime / 3600);
|
|
134
|
+
const minutes = Math.floor((uptime % 3600) / 60);
|
|
135
|
+
const seconds = uptime % 60;
|
|
136
|
+
console.log(` Uptime: ${hours}h ${minutes}m ${seconds}s`);
|
|
137
|
+
}
|
|
138
|
+
if (status.config?.log_file) {
|
|
139
|
+
console.log(` Logs: ${status.config.log_file}`);
|
|
140
|
+
}
|
|
141
|
+
console.log('');
|
|
142
|
+
if (!status.health) {
|
|
143
|
+
console.log('Health: Unknown (no URL configured)');
|
|
144
|
+
}
|
|
145
|
+
else if (status.health.status === 'healthy') {
|
|
146
|
+
console.log('Health: Healthy');
|
|
147
|
+
if (status.health.peac_version) {
|
|
148
|
+
console.log(` Wire version: ${status.health.peac_version}`);
|
|
149
|
+
}
|
|
150
|
+
if (status.health.response_time_ms) {
|
|
151
|
+
console.log(` Response time: ${status.health.response_time_ms.toFixed(2)}ms`);
|
|
152
|
+
}
|
|
153
|
+
if (status.health.memory_mb) {
|
|
154
|
+
console.log(` Memory usage: ${status.health.memory_mb.toFixed(1)} MB`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
else if (status.health.status === 'unhealthy') {
|
|
158
|
+
console.log('Health: Unhealthy');
|
|
159
|
+
console.log(` HTTP ${status.health.code}: ${status.health.statusText}`);
|
|
160
|
+
}
|
|
161
|
+
else if (status.health.status === 'unreachable') {
|
|
162
|
+
console.log('Health: Unreachable');
|
|
163
|
+
console.log(` Error: ${status.health.error}`);
|
|
164
|
+
console.log(' Bridge may be starting up or misconfigured');
|
|
165
|
+
}
|
|
166
|
+
// Show readiness if we have health info
|
|
167
|
+
if (status.health?.status === 'healthy' && status.config?.url) {
|
|
168
|
+
try {
|
|
169
|
+
const readyUrl = status.config.url.replace(/\/$/, '') + '/ready';
|
|
170
|
+
const response = await fetch(readyUrl, {
|
|
171
|
+
method: 'GET',
|
|
172
|
+
headers: { Accept: 'application/peac+json' },
|
|
173
|
+
signal: AbortSignal.timeout(5000),
|
|
174
|
+
});
|
|
175
|
+
if (response.ok) {
|
|
176
|
+
const readiness = (await response.json());
|
|
177
|
+
console.log('');
|
|
178
|
+
console.log('Readiness:', readiness.ok ? 'Ready' : 'Not Ready');
|
|
179
|
+
if (readiness.checks) {
|
|
180
|
+
Object.entries(readiness.checks).forEach(([check, result]) => {
|
|
181
|
+
console.log(` ${check}: ${result ? 'OK' : 'FAIL'}`);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
// Readiness check failed, but don't show error - health already covers connectivity
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/bridge/status.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAOH,sCA8LC;AAnMD,yCAAoC;AACpC,2BAA8C;AAC9C,+BAA4B;AAC5B,2BAA6B;AAE7B,SAAgB,aAAa;IAC3B,OAAO,IAAI,mBAAO,CAAC,QAAQ,CAAC;SACzB,WAAW,CAAC,0BAA0B,CAAC;SACvC,MAAM,CAAC,QAAQ,EAAE,uBAAuB,CAAC;SACz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