@highway1/cli 0.1.43 → 0.1.45

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/src/index.ts ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Polyfill for Node.js < v22.0.0
4
+ if (!Promise.withResolvers) {
5
+ Promise.withResolvers = function <T>() {
6
+ let resolve: (value: T | PromiseLike<T>) => void;
7
+ let reject: (reason?: any) => void;
8
+ const promise = new Promise<T>((res, rej) => {
9
+ resolve = res;
10
+ reject = rej;
11
+ });
12
+ return { promise, resolve: resolve!, reject: reject! };
13
+ };
14
+ }
15
+
16
+ import { Command } from 'commander';
17
+ import { createRequire } from 'module';
18
+ import { registerInitCommand } from './commands/init.js';
19
+ import { registerJoinCommand } from './commands/join.js';
20
+ import { registerDiscoverCommand } from './commands/discover.js';
21
+ import { registerSendCommand } from './commands/send.js';
22
+ import { registerStatusCommand } from './commands/status.js';
23
+ import { registerIdentityCommand } from './commands/identity.js';
24
+ import { registerCardCommand } from './commands/card.js';
25
+ import { createTrustCommand } from './commands/trust.js';
26
+ import { registerDaemonCommand } from './commands/daemon.js';
27
+
28
+ const require = createRequire(import.meta.url);
29
+ const { version } = require('../package.json');
30
+
31
+ const program = new Command();
32
+
33
+ const binName = process.argv[1]?.includes('hw1') ? 'hw1' : 'clawiverse';
34
+
35
+ program
36
+ .name(binName)
37
+ .description('CLI tool for decentralized AI agent communication')
38
+ .version(version);
39
+
40
+ // Register commands
41
+ registerInitCommand(program);
42
+ registerJoinCommand(program);
43
+ registerDiscoverCommand(program);
44
+ registerSendCommand(program);
45
+ registerStatusCommand(program);
46
+ registerIdentityCommand(program);
47
+ registerCardCommand(program);
48
+ registerDaemonCommand(program);
49
+ program.addCommand(createTrustCommand());
50
+
51
+ program.parse();
package/src/ui.ts ADDED
@@ -0,0 +1,38 @@
1
+ import chalk from 'chalk';
2
+ import ora, { Ora } from 'ora';
3
+
4
+ export function success(message: string): void {
5
+ console.log(chalk.green('✓'), message);
6
+ }
7
+
8
+ export function error(message: string): void {
9
+ console.log(chalk.red('✗'), message);
10
+ }
11
+
12
+ export function info(message: string): void {
13
+ console.log(chalk.blue('ℹ'), message);
14
+ }
15
+
16
+ export function warn(message: string): void {
17
+ console.log(chalk.yellow('⚠'), message);
18
+ }
19
+
20
+ export function spinner(text: string): Ora {
21
+ return ora(text).start();
22
+ }
23
+
24
+ export function printHeader(title: string): void {
25
+ console.log();
26
+ console.log(chalk.bold.cyan(title));
27
+ console.log(chalk.gray('─'.repeat(title.length)));
28
+ console.log();
29
+ }
30
+
31
+ export function printKeyValue(key: string, value: string): void {
32
+ console.log(chalk.gray(`${key}:`), chalk.white(value));
33
+ }
34
+
35
+ export function printSection(title: string): void {
36
+ console.log();
37
+ console.log(chalk.bold(title));
38
+ }