routstrd 0.4.5 → 0.4.7

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/package.json CHANGED
@@ -1,14 +1,21 @@
1
1
  {
2
2
  "name": "routstrd",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "bin": {
8
8
  "routstrd": "./dist/index.js"
9
9
  },
10
+ "files": [
11
+ "dist",
12
+ "src",
13
+ "README.md",
14
+ "SECURITY.md"
15
+ ],
10
16
  "scripts": {
11
17
  "start": "bun src/index.ts start",
18
+ "stop": "bun src/index.ts stop",
12
19
  "monitor": "bun src/index.ts monitor",
13
20
  "lint": "tsc --noEmit",
14
21
  "test": "bun test",
@@ -26,7 +33,7 @@
26
33
  "@cashu/cashu-ts": "^4.3.0",
27
34
  "@cashu/coco-core": "^1.0.1",
28
35
  "@cashu/coco-sqlite-bun": "^1.0.1",
29
- "@routstr/sdk": "^0.4.1",
36
+ "@routstr/sdk": "^0.4.2",
30
37
  "@scure/bip39": "^2.2.0",
31
38
  "applesauce-core": "^5.1.0",
32
39
  "applesauce-relay": "^5.1.0",
package/src/cli.ts CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  type RoutstrdConfig,
29
29
  } from "./utils/config";
30
30
  import { COCO_LOGS_DIR, logger } from "./utils/logger";
31
- import { setupIntegration, runIntegrationsForClients } from "./integrations";
31
+ import { setupIntegration, runIntegrationsForClients, type IntegrationKey } from "./integrations";
32
32
  import {
33
33
  assertLegacyCocodNotRunning,
34
34
  claimLegacyCocodPidFile,
@@ -215,7 +215,7 @@ async function requireLocalDaemon(): Promise<void> {
215
215
  }
216
216
  }
217
217
 
218
- async function initDaemon(): Promise<void> {
218
+ async function initDaemon(integrationKey?: IntegrationKey): Promise<void> {
219
219
  console.log("Initializing routstrd...");
220
220
 
221
221
  // Create config directory (0700, correcting existing installs too)
@@ -273,7 +273,7 @@ async function initDaemon(): Promise<void> {
273
273
 
274
274
  await startDaemon({ port: String(config.port || 8008), host: config.host || undefined });
275
275
 
276
- await setupIntegration(config);
276
+ await setupIntegration(config, integrationKey);
277
277
 
278
278
  console.log("\nInitialization complete!");
279
279
  console.log(
@@ -574,20 +574,68 @@ program
574
574
  .description(
575
575
  "Initialize routstrd (creates config directory and initializes wallet)",
576
576
  )
577
- .action(async () => {
578
- await requireLocalDaemon();
579
- try {
580
- await initDaemon();
581
- } catch (error) {
582
- // An expected, user-actionable refusal — print the structured message
583
- // without Bun's unhandled-rejection source snippet and stack trace.
584
- if (error instanceof WalletMigrationConflictError) {
585
- console.error(error.message);
577
+ .option("--opencode", "Set up OpenCode integration (non-interactive)")
578
+ .option("--openclaw", "Set up OpenClaw integration (non-interactive)")
579
+ .option("--pi-agent", "Set up Pi Agent integration (non-interactive)")
580
+ .option("--claude-code", "Set up Claude Code integration (non-interactive)")
581
+ .option("--hermes", "Set up Hermes integration (non-interactive)")
582
+ .option("--skip-integration", "Skip integration setup")
583
+ .action(
584
+ async (options: {
585
+ opencode?: boolean;
586
+ openclaw?: boolean;
587
+ piAgent?: boolean;
588
+ claudeCode?: boolean;
589
+ hermes?: boolean;
590
+ skipIntegration?: boolean;
591
+ }) => {
592
+ await requireLocalDaemon();
593
+
594
+ const integrationFlags: Record<string, boolean | undefined> = {
595
+ opencode: options.opencode,
596
+ openclaw: options.openclaw,
597
+ "pi-agent": options.piAgent,
598
+ "claude-code": options.claudeCode,
599
+ hermes: options.hermes,
600
+ };
601
+ const selectedIntegrations = Object.keys(integrationFlags).filter(
602
+ (key) => integrationFlags[key],
603
+ );
604
+
605
+ if (selectedIntegrations.length > 1) {
606
+ console.error(
607
+ "Error: use only one integration flag, or use 'routstrd clients add' for multiple clients.",
608
+ );
586
609
  process.exit(1);
587
610
  }
588
- throw error;
589
- }
590
- });
611
+
612
+ if (options.skipIntegration && selectedIntegrations.length > 0) {
613
+ console.error(
614
+ "Error: --skip-integration cannot be combined with an integration flag.",
615
+ );
616
+ process.exit(1);
617
+ }
618
+
619
+ let integrationKey: IntegrationKey | undefined;
620
+ if (options.skipIntegration) {
621
+ integrationKey = "skip";
622
+ } else if (selectedIntegrations.length === 1) {
623
+ integrationKey = selectedIntegrations[0];
624
+ }
625
+
626
+ try {
627
+ await initDaemon(integrationKey);
628
+ } catch (error) {
629
+ // An expected, user-actionable refusal — print the structured message
630
+ // without Bun's unhandled-rejection source snippet and stack trace.
631
+ if (error instanceof WalletMigrationConflictError) {
632
+ console.error(error.message);
633
+ process.exit(1);
634
+ }
635
+ throw error;
636
+ }
637
+ },
638
+ );
591
639
 
592
640
  // Start - start the background daemon
593
641
  program