@powerhousedao/ph-cli 6.0.0-dev.25 → 6.0.0-dev.27

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 (133) hide show
  1. package/dist/scripts/generate-commands-docs.js +1 -7
  2. package/dist/scripts/generate-commands-docs.js.map +1 -1
  3. package/dist/scripts/generate-commands-docs.ts +1 -7
  4. package/dist/src/cli.js +1 -4
  5. package/dist/src/cli.js.map +1 -1
  6. package/dist/src/cli.old.js +2 -11
  7. package/dist/src/cli.old.js.map +1 -1
  8. package/dist/src/commands/access-token.d.ts.map +1 -1
  9. package/dist/src/commands/access-token.js +11 -22
  10. package/dist/src/commands/access-token.js.map +1 -1
  11. package/dist/src/commands/connect.d.ts.map +1 -1
  12. package/dist/src/commands/connect.js +3 -1
  13. package/dist/src/commands/connect.js.map +1 -1
  14. package/dist/src/commands/generate.d.ts.map +1 -1
  15. package/dist/src/commands/generate.js +1 -1
  16. package/dist/src/commands/generate.js.map +1 -1
  17. package/dist/src/commands/inspect.d.ts +2 -2
  18. package/dist/src/commands/inspect.d.ts.map +1 -1
  19. package/dist/src/commands/inspect.js +2 -2
  20. package/dist/src/commands/inspect.js.map +1 -1
  21. package/dist/src/commands/install.d.ts +2 -2
  22. package/dist/src/commands/install.d.ts.map +1 -1
  23. package/dist/src/commands/install.js +2 -2
  24. package/dist/src/commands/install.js.map +1 -1
  25. package/dist/src/commands/legacy/access-token.old.d.ts.map +1 -1
  26. package/dist/src/commands/legacy/access-token.old.js +9 -25
  27. package/dist/src/commands/legacy/access-token.old.js.map +1 -1
  28. package/dist/src/commands/legacy/install.old.d.ts +2 -1
  29. package/dist/src/commands/legacy/install.old.d.ts.map +1 -1
  30. package/dist/src/commands/legacy/install.old.js.map +1 -1
  31. package/dist/src/commands/{list.old.d.ts → legacy/list.old.d.ts} +1 -1
  32. package/dist/src/commands/legacy/list.old.d.ts.map +1 -0
  33. package/dist/src/commands/{list.old.js → legacy/list.old.js} +2 -2
  34. package/dist/src/commands/legacy/list.old.js.map +1 -0
  35. package/dist/src/commands/legacy/login.old.d.ts.map +1 -1
  36. package/dist/src/commands/legacy/login.old.js +38 -53
  37. package/dist/src/commands/legacy/login.old.js.map +1 -1
  38. package/dist/src/commands/legacy/switchboard.old.d.ts.map +1 -1
  39. package/dist/src/commands/legacy/switchboard.old.js +3 -4
  40. package/dist/src/commands/legacy/switchboard.old.js.map +1 -1
  41. package/dist/src/commands/list.d.ts.map +1 -1
  42. package/dist/src/commands/list.js +1 -2
  43. package/dist/src/commands/list.js.map +1 -1
  44. package/dist/src/commands/login.d.ts +6 -2
  45. package/dist/src/commands/login.d.ts.map +1 -1
  46. package/dist/src/commands/login.js +42 -56
  47. package/dist/src/commands/login.js.map +1 -1
  48. package/dist/src/commands/logout.d.ts +6 -0
  49. package/dist/src/commands/logout.d.ts.map +1 -0
  50. package/dist/src/commands/logout.js +13 -0
  51. package/dist/src/commands/logout.js.map +1 -0
  52. package/dist/src/commands/migrate.d.ts.map +1 -1
  53. package/dist/src/commands/migrate.js +1 -1
  54. package/dist/src/commands/migrate.js.map +1 -1
  55. package/dist/src/commands/ph-cli-commands.d.ts +13 -8
  56. package/dist/src/commands/ph-cli-commands.d.ts.map +1 -1
  57. package/dist/src/commands/ph-cli-commands.js +2 -0
  58. package/dist/src/commands/ph-cli-commands.js.map +1 -1
  59. package/dist/src/commands/ph-cli.d.ts +20 -8
  60. package/dist/src/commands/ph-cli.d.ts.map +1 -1
  61. package/dist/src/commands/register-commands.js +1 -1
  62. package/dist/src/commands/register-commands.js.map +1 -1
  63. package/dist/src/commands/switchboard.d.ts.map +1 -1
  64. package/dist/src/commands/switchboard.js +5 -6
  65. package/dist/src/commands/switchboard.js.map +1 -1
  66. package/dist/src/commands/uninstall.d.ts +2 -2
  67. package/dist/src/commands/uninstall.d.ts.map +1 -1
  68. package/dist/src/commands/uninstall.js +2 -2
  69. package/dist/src/commands/uninstall.js.map +1 -1
  70. package/dist/src/commands/vetra.d.ts.map +1 -1
  71. package/dist/src/commands/vetra.js +1 -1
  72. package/dist/src/commands/vetra.js.map +1 -1
  73. package/dist/src/help.d.ts +3 -3
  74. package/dist/src/help.d.ts.map +1 -1
  75. package/dist/src/help.js +7 -7
  76. package/dist/src/services/auth.d.ts +5 -53
  77. package/dist/src/services/auth.d.ts.map +1 -1
  78. package/dist/src/services/auth.js +11 -159
  79. package/dist/src/services/auth.js.map +1 -1
  80. package/dist/src/services/connect-build.d.ts +3 -0
  81. package/dist/src/services/connect-build.d.ts.map +1 -0
  82. package/dist/src/services/connect-build.js +24 -0
  83. package/dist/src/services/connect-build.js.map +1 -0
  84. package/dist/src/services/connect-preview.d.ts +3 -0
  85. package/dist/src/services/connect-preview.d.ts.map +1 -0
  86. package/dist/src/services/connect-preview.js +35 -0
  87. package/dist/src/services/connect-preview.js.map +1 -0
  88. package/dist/src/services/connect-studio.d.ts +3 -0
  89. package/dist/src/services/connect-studio.d.ts.map +1 -0
  90. package/dist/src/services/connect-studio.js +29 -0
  91. package/dist/src/services/connect-studio.js.map +1 -0
  92. package/dist/src/services/inspect.d.ts +1 -1
  93. package/dist/src/services/inspect.d.ts.map +1 -1
  94. package/dist/src/services/inspect.js +1 -1
  95. package/dist/src/services/inspect.js.map +1 -1
  96. package/dist/src/services/vetra.js +1 -1
  97. package/dist/src/services/vetra.js.map +1 -1
  98. package/dist/src/types.d.ts +1 -4
  99. package/dist/src/types.d.ts.map +1 -1
  100. package/dist/src/utils/assign-env-vars.d.ts +3 -0
  101. package/dist/src/utils/assign-env-vars.d.ts.map +1 -0
  102. package/dist/src/utils/assign-env-vars.js +11 -0
  103. package/dist/src/utils/assign-env-vars.js.map +1 -0
  104. package/dist/src/version.d.ts +1 -1
  105. package/dist/src/version.js +1 -1
  106. package/dist/tsconfig.tsbuildinfo +1 -1
  107. package/package.json +13 -10
  108. package/dist/src/commands/get-package-manager.d.ts +0 -30
  109. package/dist/src/commands/get-package-manager.d.ts.map +0 -1
  110. package/dist/src/commands/get-package-manager.js +0 -8
  111. package/dist/src/commands/get-package-manager.js.map +0 -1
  112. package/dist/src/commands/list.old.d.ts.map +0 -1
  113. package/dist/src/commands/list.old.js.map +0 -1
  114. package/dist/src/index.d.ts +0 -4
  115. package/dist/src/index.d.ts.map +0 -1
  116. package/dist/src/index.js +0 -4
  117. package/dist/src/index.js.map +0 -1
  118. package/dist/src/services/connect.d.ts +0 -5
  119. package/dist/src/services/connect.d.ts.map +0 -1
  120. package/dist/src/services/connect.js +0 -90
  121. package/dist/src/services/connect.js.map +0 -1
  122. package/dist/src/utils/file-system.d.ts +0 -2
  123. package/dist/src/utils/file-system.d.ts.map +0 -1
  124. package/dist/src/utils/file-system.js +0 -15
  125. package/dist/src/utils/file-system.js.map +0 -1
  126. package/dist/src/utils/index.d.ts +0 -3
  127. package/dist/src/utils/index.d.ts.map +0 -1
  128. package/dist/src/utils/index.js +0 -3
  129. package/dist/src/utils/index.js.map +0 -1
  130. package/dist/src/utils/projects.d.ts +0 -19
  131. package/dist/src/utils/projects.d.ts.map +0 -1
  132. package/dist/src/utils/projects.js +0 -93
  133. package/dist/src/utils/projects.js.map +0 -1
@@ -5,6 +5,7 @@ import { inspect } from "./inspect.js";
5
5
  import { install } from "./install.js";
6
6
  import { list } from "./list.js";
7
7
  import { login } from "./login.js";
8
+ import { logout } from "./logout.js";
8
9
  import { migrate } from "./migrate.js";
9
10
  import { switchboard } from "./switchboard.js";
10
11
  import { uninstall } from "./uninstall.js";
@@ -19,6 +20,7 @@ export const phCliCommands = {
19
20
  migrate,
20
21
  switchboard,
21
22
  login,
23
+ logout,
22
24
  install,
23
25
  uninstall,
24
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ph-cli-commands.js","sourceRoot":"","sources":["../../../src/commands/ph-cli-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,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gB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,QAAQ;IACR,KAAK;IACL,OAAO;IACP,cAAc,EAAE,WAAW;IAC3B,OAAO;IACP,IAAI;IACJ,OAAO;IACP,WAAW;IACX,KAAK;IACL,MAAM;IACN,OAAO;IACP,SAAS;CACD,CAAC"}
@@ -177,6 +177,9 @@ export declare const phCli: Partial<import("cmd-ts/dist/cjs/argparser.js").Regis
177
177
  status: boolean | undefined;
178
178
  showDid: boolean | undefined;
179
179
  };
180
+ } | {
181
+ command: "logout";
182
+ args: {};
180
183
  } | {
181
184
  command: "install";
182
185
  args: {
@@ -378,6 +381,9 @@ export declare const phCli: Partial<import("cmd-ts/dist/cjs/argparser.js").Regis
378
381
  status: boolean | undefined;
379
382
  showDid: boolean | undefined;
380
383
  };
384
+ } | {
385
+ command: "logout";
386
+ args: {};
381
387
  } | {
382
388
  command: "install";
383
389
  args: {
@@ -423,7 +429,7 @@ export declare const phCli: Partial<import("cmd-ts/dist/cjs/argparser.js").Regis
423
429
  value: Promise<never>;
424
430
  } | {
425
431
  command: "inspect";
426
- value: never;
432
+ value: Promise<never>;
427
433
  } | {
428
434
  command: "list";
429
435
  value: Promise<void>;
@@ -435,13 +441,16 @@ export declare const phCli: Partial<import("cmd-ts/dist/cjs/argparser.js").Regis
435
441
  value: Promise<void>;
436
442
  } | {
437
443
  command: "login";
438
- value: Promise<void>;
444
+ value: Promise<never>;
445
+ } | {
446
+ command: "logout";
447
+ value: Promise<never>;
439
448
  } | {
440
449
  command: "install";
441
- value: Promise<void>;
450
+ value: Promise<never>;
442
451
  } | {
443
452
  command: "uninstall";
444
- value: Promise<void>;
453
+ value: Promise<never>;
445
454
  }> & {
446
455
  run(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
447
456
  command: "generate";
@@ -466,7 +475,7 @@ export declare const phCli: Partial<import("cmd-ts/dist/cjs/argparser.js").Regis
466
475
  value: Promise<never>;
467
476
  } | {
468
477
  command: "inspect";
469
- value: never;
478
+ value: Promise<never>;
470
479
  } | {
471
480
  command: "list";
472
481
  value: Promise<void>;
@@ -478,13 +487,16 @@ export declare const phCli: Partial<import("cmd-ts/dist/cjs/argparser.js").Regis
478
487
  value: Promise<void>;
479
488
  } | {
480
489
  command: "login";
481
- value: Promise<void>;
490
+ value: Promise<never>;
491
+ } | {
492
+ command: "logout";
493
+ value: Promise<never>;
482
494
  } | {
483
495
  command: "install";
484
- value: Promise<void>;
496
+ value: Promise<never>;
485
497
  } | {
486
498
  command: "uninstall";
487
- value: Promise<void>;
499
+ value: Promise<never>;
488
500
  }>>;
489
501
  };
490
502
  //# sourceMappingURL=ph-cli.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ph-cli.d.ts","sourceRoot":"","sources":["../../../src/commands/ph-cli.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKhB,CAAC"}
1
+ {"version":3,"file":"ph-cli.d.ts","sourceRoot":"","sources":["../../../src/commands/ph-cli.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKhB,CAAC"}
@@ -10,7 +10,7 @@ import { serviceCommand } from "./legacy/service.old.js";
10
10
  import { switchboardCommand } from "./legacy/switchboard.old.js";
11
11
  import { uninstallCommand } from "./legacy/uninstall.old.js";
12
12
  import { vetraCommand } from "./legacy/vetra.old.js";
13
- import { listCommand } from "./list.old.js";
13
+ import { listCommand } from "./legacy/list.old.js";
14
14
  export const commands = [
15
15
  accessTokenCommand,
16
16
  connectCommand,
@@ -1 +1 @@
1
- {"version":3,"file":"register-commands.js","sourceRoot":"","sources":["../../../src/commands/register-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,kBAAkB;IAClB,cAAc;IACd,eAAe;IACf,WAAW;IACX,cAAc;IACd,gBAAgB;IAChB,cAAc;IACd,WAAW;IACX,cAAc;IACd,YAAY;IACZ,kBAAkB;IAClB,YAAY;IACZ,cAAc;CACf,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AAClD,CAAC"}
1
+ {"version":3,"file":"register-commands.js","sourceRoot":"","sources":["../../../src/commands/register-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,kBAAkB;IAClB,cAAc;IACd,eAAe;IACf,WAAW;IACX,cAAc;IACd,gBAAgB;IAChB,cAAc;IACd,WAAW;IACX,cAAc;IACd,YAAY;IACZ,kBAAkB;IAClB,YAAY;IACZ,cAAc;CACf,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AAClD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"switchboard.d.ts","sourceRoot":"","sources":["../../../src/commands/switchboard.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6JAuCtB,CAAC"}
1
+ {"version":3,"file":"switchboard.d.ts","sourceRoot":"","sources":["../../../src/commands/switchboard.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6JA0CtB,CAAC"}
@@ -1,7 +1,5 @@
1
1
  import { switchboardArgs } from "@powerhousedao/common/clis";
2
2
  import { command } from "cmd-ts";
3
- import { runSwitchboardMigrations } from "../services/switchboard-migrate.js";
4
- import { startSwitchboard } from "../services/switchboard.js";
5
3
  export const switchboard = command({
6
4
  name: "switchboard",
7
5
  aliases: ["reactor"],
@@ -26,17 +24,18 @@ This command:
26
24
  process.env.BASE_PATH = basePath;
27
25
  }
28
26
  if (migrate || migrateStatus) {
27
+ const { runSwitchboardMigrations } = await import("../services/switchboard-migrate.js");
29
28
  await runSwitchboardMigrations({
30
29
  dbPath,
31
30
  statusOnly: migrateStatus,
32
31
  });
33
32
  process.exit(0);
34
33
  }
35
- const { defaultDriveUrl, connectCrypto } = await startSwitchboard(args);
34
+ const { startSwitchboard } = await import("../services/switchboard.js");
35
+ const { defaultDriveUrl, renown } = await startSwitchboard(args);
36
36
  console.log(" ➜ Switchboard:", defaultDriveUrl);
37
- if (connectCrypto) {
38
- const did = await connectCrypto.did();
39
- console.log(" ➜ Identity:", did);
37
+ if (renown) {
38
+ console.log(" ➜ Identity:", renown.did);
40
39
  }
41
40
  },
42
41
  });
@@ -1 +1 @@
1
- {"version":3,"file":"switchboard.js","sourceRoot":"","sources":["../../../src/commands/switchboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC;IACjC,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,WAAW,EAAE;;;;;;;;;;6EAU8D;IAC3E,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACtB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;QACD,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,E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AC1D,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,QAAQ,CAAC;QACnC,CAAC;QAED,IAAI,OAAO,IAAI,aAAa,EAAE,CAAC;YAC7B,MAAM,EAAE,wBAAwB,EAAE,GAAG,MAAM,MAAM,CAC/C,oCAAoC,CACrC,CAAC;YACF,MAAM,wBAAwB,CAAC;gBAC7B,MAAM;gBACN,UAAU,EAAE,aAAa;aAC1B,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC;QACxE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACjE,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAC;QACnD,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -16,7 +16,7 @@ export declare const uninstall: Partial<import("cmd-ts/dist/cjs/argparser.js").R
16
16
  yarn: boolean | undefined;
17
17
  bun: boolean | undefined;
18
18
  dependencies: string[];
19
- }, Promise<void>> & {
20
- run(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<Promise<void>>>;
19
+ }, Promise<never>> & {
20
+ run(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<Promise<never>>>;
21
21
  } & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned & import("cmd-ts/dist/cjs/helpdoc.js").Descriptive & import("cmd-ts/dist/cjs/helpdoc.js").Aliased>;
22
22
  //# sourceMappingURL=uninstall.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;6JA4EpB,CAAC"}
1
+ {"version":3,"file":"uninstall.d.ts","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;6JA8EpB,CAAC"}
@@ -1,9 +1,8 @@
1
- import { uninstallArgs } from "@powerhousedao/common/clis";
1
+ import { getPowerhouseProjectInfo, getPowerhouseProjectUninstallCommand, makeDependenciesWithVersions, uninstallArgs, } from "@powerhousedao/common/clis";
2
2
  import { execSync } from "child_process";
3
3
  import { command } from "cmd-ts";
4
4
  import { AGENTS } from "package-manager-detector";
5
5
  import { removeStylesImports, updateConfigFile } from "../utils.js";
6
- import { getPowerhouseProjectInfo, getPowerhouseProjectUninstallCommand, makeDependenciesWithVersions, } from "../utils/projects.js";
7
6
  export const uninstall = command({
8
7
  name: "uninstall",
9
8
  aliases: ["remove"],
@@ -66,6 +65,7 @@ This command:
66
65
  console.error("❌ Failed to update styles file");
67
66
  throw error;
68
67
  }
68
+ process.exit(0);
69
69
  },
70
70
  });
71
71
  //# sourceMappingURL=uninstall.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/commands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EACL,wBAAwB,EACxB,oCAAoC,EACpC,4BAA4B,G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;YACrE,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;QACrD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;YAChD,MAAM,KAAK,CAAC;QACd,CAAC;QAED,IAAI,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;YAC9C,mBAAmB,CAAC,wBAAwB,EAAE,WAAW,CAAC,CAAC;YAC3D,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;QACrD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;YAChD,MAAM,KAAK,CAAC;QACd,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;CACF,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"vetra.d.ts","sourceRoot":"","sources":["../../../src/commands/vetra.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6JAmBhB,CAAC"}
1
+ {"version":3,"file":"vetra.d.ts","sourceRoot":"","sources":["../../../src/commands/vetra.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6JAoBhB,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { vetraArgs } from "@powerhousedao/common/clis";
2
2
  import { command } from "cmd-ts";
3
- import { startVetra } from "../services/vetra.js";
4
3
  export const vetra = command({
5
4
  name: "vetra",
6
5
  description: `
@@ -18,6 +17,7 @@ This command:
18
17
  if (args.debug) {
19
18
  console.log(args);
20
19
  }
20
+ const { startVetra } = await import("../services/vetra.js");
21
21
  await startVetra(args);
22
22
  },
23
23
  });
@@ -1 +1 @@
1
- {"version":3,"file":"vetra.js","sourceRoot":"","sources":["../../../src/commands/vetra.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC;IAC3B,IAAI,EAAE,OAAO;IACb,WAAW,EAAE;;;;;;;;;iEASkD;IAC/D,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACtB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;QACD,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"vetra.js","sourceRoot":"","sources":["../../../src/commands/vetra.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC;IAC3B,IAAI,EAAE,OAAO;IACb,WAAW,EAAE;;;;;;;;;iEASkD;IAC/D,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACtB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;QACD,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;QAC5D,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CACF,CAAC,CAAC"}
@@ -45,7 +45,7 @@ export declare const serviceHelp = "\nCommand Overview:\n The service command m
45
45
  /**
46
46
  * Help text for the switchboard command
47
47
  */
48
- export declare const switchboardHelp = "\nCommand Overview:\n The switchboard command starts a local Switchboard instance, which acts as the document\n processing engine for Powerhouse projects. It provides the infrastructure for document\n models, processors, and real-time updates.\n\n This command:\n 1. Starts a local switchboard server\n 2. Loads document models and processors\n 3. Provides an API for document operations\n 4. Enables real-time document processing\n 5. Can authenticate with remote services using your identity from 'ph login'\n\nOptions:\n --port <PORT> Port to host the API. Default is 4001.\n\n --config-file <path> Path to the powerhouse.config.js file. Default is\n './powerhouse.config.json'. This configures the switchboard behavior.\n\n --dev Enable development mode to load local packages from the current directory.\n This allows the switchboard to discover and load document models, processors,\n and subgraphs from your local development environment.\n\n --db-path <DB_PATH> Path to the database for storing document data.\n\n --https-key-file <path> Path to the SSL key file if using HTTPS for secure connections.\n\n --https-cert-file <path> Path to the SSL certificate file if using HTTPS.\n\n --packages <pkg...> List of packages to be loaded. If defined, packages specified\n in the config file are ignored.\n\n --base-path <path> Base path for the API endpoints. Sets the BASE_PATH environment\n variable used by the server to prefix all routes.\n\nIdentity Options:\n --use-identity Enable identity using the keypair from 'ph login'. This allows the\n switchboard to authenticate with remote drives and services using\n your authorized Ethereum identity.\n\n --keypair-path <path> Path to a custom keypair file. Overrides the default .keypair.json\n in the current directory.\n\n --require-identity Require an existing keypair; fail if not found. Use this when you\n want to ensure the switchboard runs with a valid identity. If no\n keypair exists, run 'ph login' first to create one.\n\nMigration Options:\n --migrate Run database migrations and exit without starting the server.\n Useful for CI/CD pipelines or manual migration control.\n Only works with PostgreSQL databases.\n\n --migrate-status Show current migration status and exit. Lists all migrations\n and indicates which have been applied.\n\nExamples:\n $ ph switchboard # Start switchboard with default settings\n $ ph switchboard --port 5000 # Use custom port 5000\n $ ph switchboard --dev # Enable dev mode to load local packages\n $ ph switchboard --config-file custom.json # Use custom configuration file\n $ ph switchboard --packages pkg1 pkg2 # Load specific packages\n $ ph switchboard --base-path /switchboard # Set API base path to /switchboard\n $ ph switchboard --use-identity # Start with identity from ph login\n $ ph switchboard --require-identity # Require identity, fail if not logged in\n $ ph switchboard --migrate # Run migrations and exit\n $ ph switchboard --migrate-status # Check migration status\n $ ph switchboard --db-path postgresql://... --migrate # Migrate specific database\n";
48
+ export declare const switchboardHelp = "\nCommand Overview:\n The switchboard command starts a local Switchboard instance, which acts as the document\n processing engine for Powerhouse projects. It provides the infrastructure for document\n models, processors, and real-time updates.\n\n This command:\n 1. Starts a local switchboard server\n 2. Loads document models and processors\n 3. Provides an API for document operations\n 4. Enables real-time document processing\n 5. Can authenticate with remote services using your identity from 'ph login'\n\nOptions:\n --port <PORT> Port to host the API. Default is 4001.\n\n --config-file <path> Path to the powerhouse.config.js file. Default is\n './powerhouse.config.json'. This configures the switchboard behavior.\n\n --dev Enable development mode to load local packages from the current directory.\n This allows the switchboard to discover and load document models, processors,\n and subgraphs from your local development environment.\n\n --db-path <DB_PATH> Path to the database for storing document data.\n\n --https-key-file <path> Path to the SSL key file if using HTTPS for secure connections.\n\n --https-cert-file <path> Path to the SSL certificate file if using HTTPS.\n\n --packages <pkg...> List of packages to be loaded. If defined, packages specified\n in the config file are ignored.\n\n --base-path <path> Base path for the API endpoints. Sets the BASE_PATH environment\n variable used by the server to prefix all routes.\n\nIdentity Options:\n --use-identity Enable identity using the keypair from 'ph login'. This allows the\n switchboard to authenticate with remote drives and services using\n your authorized Ethereum identity.\n\n --keypair-path <path> Path to a custom keypair file. Overrides the default .ph/.keypair.json\n in the current directory.\n\n --require-identity Require an existing keypair; fail if not found. Use this when you\n want to ensure the switchboard runs with a valid identity. If no\n keypair exists, run 'ph login' first to create one.\n\nMigration Options:\n --migrate Run database migrations and exit without starting the server.\n Useful for CI/CD pipelines or manual migration control.\n Only works with PostgreSQL databases.\n\n --migrate-status Show current migration status and exit. Lists all migrations\n and indicates which have been applied.\n\nExamples:\n $ ph switchboard # Start switchboard with default settings\n $ ph switchboard --port 5000 # Use custom port 5000\n $ ph switchboard --dev # Enable dev mode to load local packages\n $ ph switchboard --config-file custom.json # Use custom configuration file\n $ ph switchboard --packages pkg1 pkg2 # Load specific packages\n $ ph switchboard --base-path /switchboard # Set API base path to /switchboard\n $ ph switchboard --use-identity # Start with identity from ph login\n $ ph switchboard --require-identity # Require identity, fail if not logged in\n $ ph switchboard --migrate # Run migrations and exit\n $ ph switchboard --migrate-status # Check migration status\n $ ph switchboard --db-path postgresql://... --migrate # Migrate specific database\n";
49
49
  /**
50
50
  * Help text for the reactor command
51
51
  */
@@ -57,9 +57,9 @@ export declare const versionHelp = "\nCommand Overview:\n The version command d
57
57
  /**
58
58
  * Help text for the login command
59
59
  */
60
- export declare const loginHelp = "\nCommand Overview:\n The login command authenticates you with Renown using your Ethereum wallet. This enables\n the CLI to act on behalf of your Ethereum identity for authenticated operations.\n\n This command:\n 1. Generates or loads a cryptographic identity (DID) for the CLI\n 2. Opens your browser to the Renown authentication page\n 3. You authorize the CLI's DID to act on behalf of your Ethereum address\n 4. Stores the credentials locally in ~/.ph/auth.json\n\nOptions:\n --renown-url <url> Specify a custom Renown server URL. Defaults to\n https://www.renown.id\n\n --timeout <seconds> Set the authentication timeout in seconds. The command will\n wait this long for you to complete authentication in the browser.\n Defaults to 300 seconds (5 minutes).\n\n --logout Sign out and clear your stored credentials. Use this when you\n want to switch accounts or revoke local authentication.\n\n --status Show your current authentication status without logging in.\n Displays your CLI DID, ETH address, and when you authenticated.\n\n --show-did Show only the CLI's DID and exit. Useful for scripts.\n\nAuthentication Flow:\n 1. Run 'ph login' - the CLI generates/loads its cryptographic identity (DID)\n 2. A browser window opens to Renown with the CLI's DID\n 3. Connect your Ethereum wallet (MetaMask, etc.)\n 4. Authorize the CLI's DID to act on behalf of your ETH address\n 5. Return to your terminal - authentication is complete!\n\nCredentials Storage:\n All identity files are stored per-project in the current working directory:\n\n .keypair.json The CLI's cryptographic keypair (ECDSA P-256)\n .auth.json Your authentication credentials including:\n - Your Ethereum address (the account you authorized)\n - Your User DID (did:pkh:eip155:chainId:address)\n - CLI DID (did:key:... - the CLI's cryptographic identity)\n - Credential ID for session validation\n\n This allows each project to have its own identity and credentials.\n For CI/CD, provide the keypair via PH_RENOWN_PRIVATE_KEY env variable.\n\nEnvironment Variables:\n PH_RENOWN_PRIVATE_KEY JSON-encoded JWK keypair for the CLI's identity.\n If set, the CLI will use this instead of generating\n or loading from file. Useful for CI/CD environments.\n\nExamples:\n $ ph login # Authenticate with default settings\n $ ph login --status # Check authentication status and CLI DID\n $ ph login --show-did # Print only the CLI's DID\n $ ph login --logout # Sign out and clear credentials\n $ ph login --timeout 600 # Wait up to 10 minutes for authentication\n $ ph login --renown-url http://localhost:3000 # Use local Renown server\n\nNotes:\n - You only need to authenticate once; credentials persist until you log out\n - The CLI's DID remains stable unless you delete .keypair.json from your project\n - If already authenticated, the command will show your current status\n - The browser must remain open until authentication completes\n - Your wallet signature authorizes the CLI's DID to act on your behalf\n";
60
+ export declare const loginHelp = "\nCommand Overview:\n The login command authenticates you with Renown using your Ethereum wallet. This enables\n the CLI to act on behalf of your Ethereum identity for authenticated operations.\n\n This command:\n 1. Generates or loads a cryptographic identity (DID) for the CLI\n 2. Opens your browser to the Renown authentication page\n 3. You authorize the CLI's DID to act on behalf of your Ethereum address\n 4. Stores the credentials locally in .ph/.renown.json\n\nOptions:\n --renown-url <url> Specify a custom Renown server URL. Defaults to\n https://www.renown.id\n\n --timeout <seconds> Set the authentication timeout in seconds. The command will\n wait this long for you to complete authentication in the browser.\n Defaults to 300 seconds (5 minutes).\n\n --logout Sign out and clear your stored credentials. Use this when you\n want to switch accounts or revoke local authentication.\n\n --status Show your current authentication status without logging in.\n Displays your CLI DID, ETH address, and when you authenticated.\n\n --show-did Show only the CLI's DID and exit. Useful for scripts.\n\nAuthentication Flow:\n 1. Run 'ph login' - the CLI generates/loads its cryptographic identity (DID)\n 2. A browser window opens to Renown with the CLI's DID\n 3. Connect your Ethereum wallet (MetaMask, etc.)\n 4. Authorize the CLI's DID to act on behalf of your ETH address\n 5. Return to your terminal - authentication is complete!\n\nCredentials Storage:\n All identity files are stored per-project in the current working directory:\n\n .ph/.keypair.json The CLI's cryptographic keypair (ECDSA P-256)\n .ph/.renown.json Your Renown authentication credentials including:\n - Your Ethereum address (the account you authorized)\n - Your User DID (did:pkh:eip155:chainId:address)\n - CLI DID (did:key:... - the CLI's cryptographic identity)\n - Credential ID for session validation\n\n This allows each project to have its own identity and credentials.\n For CI/CD, provide the keypair via PH_RENOWN_PRIVATE_KEY env variable.\n\nEnvironment Variables:\n PH_RENOWN_PRIVATE_KEY JSON-encoded JWK keypair for the CLI's identity.\n If set, the CLI will use this instead of generating\n or loading from file. Useful for CI/CD environments.\n\nExamples:\n $ ph login # Authenticate with default settings\n $ ph login --status # Check authentication status and CLI DID\n $ ph login --show-did # Print only the CLI's DID\n $ ph login --logout # Sign out and clear credentials\n $ ph login --timeout 600 # Wait up to 10 minutes for authentication\n $ ph login --renown-url http://localhost:3000 # Use local Renown server\n\nNotes:\n - You only need to authenticate once; credentials persist until you log out\n - The CLI's DID remains stable unless you delete .ph/.keypair.json from your project\n - If already authenticated, the command will show your current status\n - The browser must remain open until authentication completes\n - Your wallet signature authorizes the CLI's DID to act on your behalf\n";
61
61
  /**
62
62
  * Help text for the access-token command
63
63
  */
64
- export declare const accessTokenHelp = "\nCommand Overview:\n The access-token command generates a bearer token for API authentication. This token\n can be used to authenticate requests to Powerhouse APIs like reactor-api (Switchboard).\n\n This command:\n 1. Uses your CLI's cryptographic identity (DID) to sign a verifiable credential\n 2. Creates a JWT bearer token with configurable expiration\n 3. Outputs the token to stdout (info to stderr) for easy piping\n\nPrerequisites:\n You must have a cryptographic identity. Run 'ph login' first to:\n - Generate a keypair (stored in .keypair.json)\n - Optionally link your Ethereum address (stored in .auth.json)\n\nOptions:\n --expiry <duration> Set the token expiration time. Supports multiple formats:\n - Days: \"7d\" (default), \"30d\", \"1d\"\n - Hours: \"24h\", \"12h\", \"1h\"\n - Seconds: \"3600\", \"3600s\", \"86400s\"\n Default is 7 days.\n\n --audience <url> Optional. Set the intended audience (aud claim) for the token.\n This can be used to restrict the token to specific services.\n\nToken Details:\n The generated token is a JWT (JSON Web Token) containing:\n - Issuer (iss): Your CLI's DID (did:key:...)\n - Subject (sub): Your CLI's DID\n - Credential Subject: Chain ID, network ID, and address (if authenticated)\n - Expiration (exp): Based on --expiry option\n - Audience (aud): If --audience is specified\n\nOutput:\n - Token information (DID, address, expiry) is printed to stderr\n - The token itself is printed to stdout for easy piping/copying\n\n This allows you to use the command in scripts:\n TOKEN=$(ph access-token)\n curl -H \"Authorization: Bearer $TOKEN\" http://localhost:4001/graphql\n\nExamples:\n $ ph access-token # Generate token valid for 7 days\n $ ph access-token --expiry 30d # Generate token valid for 30 days\n $ ph access-token --expiry 24h # Generate token valid for 24 hours\n $ ph access-token --expiry 3600 # Generate token valid for 1 hour (3600 seconds)\n $ ph access-token --audience http://localhost:4001 # Set audience claim\n $ ph access-token | pbcopy # Copy token to clipboard (macOS)\n $ ph access-token | xclip -selection c # Copy token to clipboard (Linux)\n\nUsage with APIs:\n # Generate token and use with curl\n TOKEN=$(ph access-token --expiry 1d)\n curl -X POST http://localhost:4001/graphql \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -d '{\"query\": \"{ drives { id name } }\"}'\n\n # Export as environment variable\n export PH_ACCESS_TOKEN=$(ph access-token)\n\nNotes:\n - Tokens are self-signed using your CLI's private key\n - No network request is made; tokens are generated locally\n - The recipient API must trust your CLI's DID to accept the token\n - For reactor-api, ensure AUTH_ENABLED=true to require authentication\n";
64
+ export declare const accessTokenHelp = "\nCommand Overview:\n The access-token command generates a bearer token for API authentication. This token\n can be used to authenticate requests to Powerhouse APIs like reactor-api (Switchboard).\n\n This command:\n 1. Uses your CLI's cryptographic identity (DID) to sign a verifiable credential\n 2. Creates a JWT bearer token with configurable expiration\n 3. Outputs the token to stdout (info to stderr) for easy piping\n\nPrerequisites:\n You must have a cryptographic identity. Run 'ph login' first to:\n - Generate a keypair (stored in .ph/.keypair.json)\n - Optionally link your Ethereum address (stored in .ph/.renown.json)\n\nOptions:\n --expiry <duration> Set the token expiration time. Supports multiple formats:\n - Days: \"7d\" (default), \"30d\", \"1d\"\n - Hours: \"24h\", \"12h\", \"1h\"\n - Seconds: \"3600\", \"3600s\", \"86400s\"\n Default is 7 days.\n\n --audience <url> Optional. Set the intended audience (aud claim) for the token.\n This can be used to restrict the token to specific services.\n\nToken Details:\n The generated token is a JWT (JSON Web Token) containing:\n - Issuer (iss): Your CLI's DID (did:key:...)\n - Subject (sub): Your CLI's DID\n - Credential Subject: Chain ID, network ID, and address (if authenticated)\n - Expiration (exp): Based on --expiry option\n - Audience (aud): If --audience is specified\n\nOutput:\n - Token information (DID, address, expiry) is printed to stderr\n - The token itself is printed to stdout for easy piping/copying\n\n This allows you to use the command in scripts:\n TOKEN=$(ph access-token)\n curl -H \"Authorization: Bearer $TOKEN\" http://localhost:4001/graphql\n\nExamples:\n $ ph access-token # Generate token valid for 7 days\n $ ph access-token --expiry 30d # Generate token valid for 30 days\n $ ph access-token --expiry 24h # Generate token valid for 24 hours\n $ ph access-token --expiry 3600 # Generate token valid for 1 hour (3600 seconds)\n $ ph access-token --audience http://localhost:4001 # Set audience claim\n $ ph access-token | pbcopy # Copy token to clipboard (macOS)\n $ ph access-token | xclip -selection c # Copy token to clipboard (Linux)\n\nUsage with APIs:\n # Generate token and use with curl\n TOKEN=$(ph access-token --expiry 1d)\n curl -X POST http://localhost:4001/graphql \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer $TOKEN\" \\\n -d '{\"query\": \"{ drives { id name } }\"}'\n\n # Export as environment variable\n export PH_ACCESS_TOKEN=$(ph access-token)\n\nNotes:\n - Tokens are self-signed using your CLI's private key\n - No network request is made; tokens are generated locally\n - The recipient API must trust your CLI's DID to accept the token\n - For reactor-api, ensure AUTH_ENABLED=true to require authentication\n";
65
65
  //# sourceMappingURL=help.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/help.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,iBAAiB,wzEAgD7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,4oCA0B5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,stDAsC9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,k/GA+DxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,+jEAsCvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,4pEAwCzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,ypCA2BpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,m7DAoCnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,4iHAsDrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,miDAkCvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,+zDAqCvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,ghHAmE3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,s6DAuCvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,2kCA0BvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,+0GAkErB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,o9FAkE3B,CAAC"}
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/help.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,iBAAiB,wzEAgD7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,4oCA0B5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,stDAsC9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,k/GA+DxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,+jEAsCvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,4pEAwCzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,ypCA2BpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,m7DAoCnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,4iHAsDrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,miDAkCvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,+zDAqCvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,ohHAmE3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,s6DAuCvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,2kCA0BvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,q2GAkErB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,89FAkE3B,CAAC"}
package/dist/src/help.js CHANGED
@@ -526,7 +526,7 @@ Identity Options:
526
526
  switchboard to authenticate with remote drives and services using
527
527
  your authorized Ethereum identity.
528
528
 
529
- --keypair-path <path> Path to a custom keypair file. Overrides the default .keypair.json
529
+ --keypair-path <path> Path to a custom keypair file. Overrides the default .ph/.keypair.json
530
530
  in the current directory.
531
531
 
532
532
  --require-identity Require an existing keypair; fail if not found. Use this when you
@@ -639,7 +639,7 @@ Command Overview:
639
639
  1. Generates or loads a cryptographic identity (DID) for the CLI
640
640
  2. Opens your browser to the Renown authentication page
641
641
  3. You authorize the CLI's DID to act on behalf of your Ethereum address
642
- 4. Stores the credentials locally in ~/.ph/auth.json
642
+ 4. Stores the credentials locally in .ph/.renown.json
643
643
 
644
644
  Options:
645
645
  --renown-url <url> Specify a custom Renown server URL. Defaults to
@@ -667,8 +667,8 @@ Authentication Flow:
667
667
  Credentials Storage:
668
668
  All identity files are stored per-project in the current working directory:
669
669
 
670
- .keypair.json The CLI's cryptographic keypair (ECDSA P-256)
671
- .auth.json Your authentication credentials including:
670
+ .ph/.keypair.json The CLI's cryptographic keypair (ECDSA P-256)
671
+ .ph/.renown.json Your Renown authentication credentials including:
672
672
  - Your Ethereum address (the account you authorized)
673
673
  - Your User DID (did:pkh:eip155:chainId:address)
674
674
  - CLI DID (did:key:... - the CLI's cryptographic identity)
@@ -692,7 +692,7 @@ Examples:
692
692
 
693
693
  Notes:
694
694
  - You only need to authenticate once; credentials persist until you log out
695
- - The CLI's DID remains stable unless you delete .keypair.json from your project
695
+ - The CLI's DID remains stable unless you delete .ph/.keypair.json from your project
696
696
  - If already authenticated, the command will show your current status
697
697
  - The browser must remain open until authentication completes
698
698
  - Your wallet signature authorizes the CLI's DID to act on your behalf
@@ -712,8 +712,8 @@ Command Overview:
712
712
 
713
713
  Prerequisites:
714
714
  You must have a cryptographic identity. Run 'ph login' first to:
715
- - Generate a keypair (stored in .keypair.json)
716
- - Optionally link your Ethereum address (stored in .auth.json)
715
+ - Generate a keypair (stored in .ph/.keypair.json)
716
+ - Optionally link your Ethereum address (stored in .ph/.renown.json)
717
717
 
718
718
  Options:
719
719
  --expiry <duration> Set the token expiration time. Supports multiple formats:
@@ -1,69 +1,21 @@
1
- import { type IConnectCrypto, type JsonWebKeyPairStorage, type JwkKeyPair } from "@renown/sdk";
1
+ import { type IRenown } from "@renown/sdk/node";
2
2
  export interface StoredCredentials {
3
3
  address: string;
4
4
  chainId: number;
5
- did: string;
6
- connectDid: string;
5
+ userDid: string;
6
+ appDid: string;
7
7
  credentialId: string;
8
8
  userDocumentId?: string;
9
9
  authenticatedAt: string;
10
10
  renownUrl: string;
11
11
  }
12
- /**
13
- * Key storage that supports:
14
- * 1. PH_RENOWN_PRIVATE_KEY environment variable (JSON-encoded JwkKeyPair)
15
- * 2. Falls back to file storage at .keypair.json in current working directory
16
- */
17
- export declare class KeyStorage implements JsonWebKeyPairStorage {
18
- #private;
19
- constructor(filePath?: string);
20
- loadKeyPair(): Promise<JwkKeyPair | undefined>;
21
- saveKeyPair(keyPair: JwkKeyPair): Promise<void>;
22
- }
23
- /**
24
- * Load stored credentials from disk
25
- */
26
- export declare function loadCredentials(): StoredCredentials | null;
27
- /**
28
- * Save credentials to disk (in current working directory)
29
- */
30
- export declare function saveCredentials(credentials: StoredCredentials): void;
31
- /**
32
- * Clear stored credentials
33
- */
34
- export declare function clearCredentials(): boolean;
35
- /**
36
- * Check if user is currently authenticated
37
- */
38
- export declare function isAuthenticated(): boolean;
39
12
  /**
40
13
  * Generate a UUID v4 for session IDs
41
14
  */
42
15
  export declare function generateSessionId(): string;
43
16
  /**
44
- * Default Renown URL
45
- */
46
- export declare const DEFAULT_RENOWN_URL: "https://www.renown.id";
47
- /**
48
- * Get or create the ConnectCrypto instance
17
+ * Get or create the Renown instance
49
18
  * Uses PH_RENOWN_PRIVATE_KEY env var if set, otherwise generates/loads from file
50
19
  */
51
- export declare function getConnectCrypto(): Promise<IConnectCrypto>;
52
- /**
53
- * Get the DID from ConnectCrypto
54
- * This is the did:key:... format DID that identifies this CLI instance
55
- */
56
- export declare function getConnectDid(): Promise<string>;
57
- /**
58
- * Get the issuer for signing credentials
59
- */
60
- export declare function getIssuer(): Promise<import("did-jwt-vc").Issuer>;
61
- /**
62
- * Get a bearer token for API authentication
63
- */
64
- export declare function getBearerToken(driveUrl: string, address?: string, refresh?: boolean): Promise<string>;
65
- /**
66
- * Export the keypair to a JSON string suitable for PH_RENOWN_PRIVATE_KEY
67
- */
68
- export declare function exportKeyPairToEnv(keyPair: JwkKeyPair): string;
20
+ export declare function getRenown(): Promise<IRenown>;
69
21
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/services/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EAChB,MAAM,aAAa,CAAC;AAarB,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IACh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sources":["../../../src/services/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAS/D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;GAGG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,CAKlD"}
@@ -1,171 +1,23 @@
1
- import { ConnectCrypto, } from "@renown/sdk";
2
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
- import { dirname, join } from "node:path";
4
- const ENV_KEY_NAME = "PH_RENOWN_PRIVATE_KEY";
5
- const AUTH_FILE = ".auth.json";
6
- const KEYPAIR_FILE = ".keypair.json";
1
+ import { RenownBuilder } from "@renown/sdk/node";
2
+ import { join } from "node:path";
3
+ const AUTH_FILE = ".ph/.renown.json";
7
4
  const AUTH_PATH = join(process.cwd(), AUTH_FILE);
8
- const KEYPAIR_PATH = join(process.cwd(), KEYPAIR_FILE);
9
- // Singleton instance of ConnectCrypto
10
- let connectCryptoInstance = null;
11
- /**
12
- * Key storage that supports:
13
- * 1. PH_RENOWN_PRIVATE_KEY environment variable (JSON-encoded JwkKeyPair)
14
- * 2. Falls back to file storage at .keypair.json in current working directory
15
- */
16
- export class KeyStorage {
17
- #filePath;
18
- constructor(filePath) {
19
- this.#filePath = filePath || KEYPAIR_PATH;
20
- // Ensure directory exists
21
- const dir = dirname(this.#filePath);
22
- if (!existsSync(dir)) {
23
- mkdirSync(dir, { recursive: true });
24
- }
25
- }
26
- async loadKeyPair() {
27
- // First check environment variable
28
- const envKey = process.env[ENV_KEY_NAME];
29
- if (envKey) {
30
- try {
31
- const keyPair = JSON.parse(envKey);
32
- // Validate it has the required structure
33
- if (keyPair.publicKey && keyPair.privateKey) {
34
- return keyPair;
35
- }
36
- console.warn(`${ENV_KEY_NAME} is set but doesn't contain valid publicKey and privateKey`);
37
- }
38
- catch (e) {
39
- console.warn(`Failed to parse ${ENV_KEY_NAME} as JSON:`, e);
40
- }
41
- }
42
- // Fall back to file storage
43
- return this.#loadFromFile();
44
- }
45
- async saveKeyPair(keyPair) {
46
- // Don't save if using env var
47
- if (process.env[ENV_KEY_NAME]) {
48
- return;
49
- }
50
- // Save to file
51
- this.#saveToFile(keyPair);
52
- }
53
- #loadFromFile() {
54
- try {
55
- if (!existsSync(this.#filePath)) {
56
- return undefined;
57
- }
58
- const data = readFileSync(this.#filePath, "utf-8");
59
- const parsed = JSON.parse(data);
60
- return parsed.keyPair;
61
- }
62
- catch {
63
- return undefined;
64
- }
65
- }
66
- #saveToFile(keyPair) {
67
- const data = { keyPair };
68
- writeFileSync(this.#filePath, JSON.stringify(data, null, 2), "utf-8");
69
- }
70
- }
71
- /**
72
- * Load stored credentials from disk
73
- */
74
- export function loadCredentials() {
75
- try {
76
- if (!existsSync(AUTH_PATH)) {
77
- return null;
78
- }
79
- const content = readFileSync(AUTH_PATH, "utf-8");
80
- return JSON.parse(content);
81
- }
82
- catch {
83
- return null;
84
- }
85
- }
86
- /**
87
- * Save credentials to disk (in current working directory)
88
- */
89
- export function saveCredentials(credentials) {
90
- writeFileSync(AUTH_PATH, JSON.stringify(credentials, null, 2), "utf-8");
91
- }
92
- /**
93
- * Clear stored credentials
94
- */
95
- export function clearCredentials() {
96
- try {
97
- if (existsSync(AUTH_PATH)) {
98
- writeFileSync(AUTH_PATH, "{}", "utf-8");
99
- }
100
- return true;
101
- }
102
- catch {
103
- return false;
104
- }
105
- }
106
- /**
107
- * Check if user is currently authenticated
108
- */
109
- export function isAuthenticated() {
110
- const creds = loadCredentials();
111
- return creds !== null && !!creds.credentialId;
112
- }
5
+ // Singleton instance of Renown
6
+ let renownInstance = null;
113
7
  /**
114
8
  * Generate a UUID v4 for session IDs
115
9
  */
116
10
  export function generateSessionId() {
117
- // Simple UUID v4 implementation using crypto
118
- const bytes = new Uint8Array(16);
119
- crypto.getRandomValues(bytes);
120
- // Set version (4) and variant bits
121
- bytes[6] = (bytes[6] & 0x0f) | 0x40;
122
- bytes[8] = (bytes[8] & 0x3f) | 0x80;
123
- const hex = Array.from(bytes)
124
- .map((b) => b.toString(16).padStart(2, "0"))
125
- .join("");
126
- return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
11
+ return crypto.randomUUID();
127
12
  }
128
13
  /**
129
- * Default Renown URL
130
- */
131
- export const DEFAULT_RENOWN_URL = "https://www.renown.id";
132
- /**
133
- * Get or create the ConnectCrypto instance
14
+ * Get or create the Renown instance
134
15
  * Uses PH_RENOWN_PRIVATE_KEY env var if set, otherwise generates/loads from file
135
16
  */
136
- export async function getConnectCrypto() {
137
- if (!connectCryptoInstance) {
138
- const keyStorage = new KeyStorage();
139
- connectCryptoInstance = new ConnectCrypto(keyStorage);
17
+ export async function getRenown() {
18
+ if (!renownInstance) {
19
+ renownInstance = await new RenownBuilder("ph-cli").build();
140
20
  }
141
- return connectCryptoInstance;
142
- }
143
- /**
144
- * Get the DID from ConnectCrypto
145
- * This is the did:key:... format DID that identifies this CLI instance
146
- */
147
- export async function getConnectDid() {
148
- const crypto = await getConnectCrypto();
149
- return crypto.did();
150
- }
151
- /**
152
- * Get the issuer for signing credentials
153
- */
154
- export async function getIssuer() {
155
- const crypto = await getConnectCrypto();
156
- return crypto.getIssuer();
157
- }
158
- /**
159
- * Get a bearer token for API authentication
160
- */
161
- export async function getBearerToken(driveUrl, address, refresh = false) {
162
- const crypto = await getConnectCrypto();
163
- return crypto.getBearerToken(driveUrl, address, refresh);
164
- }
165
- /**
166
- * Export the keypair to a JSON string suitable for PH_RENOWN_PRIVATE_KEY
167
- */
168
- export function exportKeyPairToEnv(keyPair) {
169
- return JSON.stringify(keyPair);
21
+ return renownInstance;
170
22
  }
171
23
  //# sourceMappingURL=auth.js.map