@shardworks/nexus 0.1.99 → 0.1.101

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 (150) hide show
  1. package/README.md +208 -0
  2. package/dist/cli.d.ts +4 -8
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +4 -8
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/index.d.ts +14 -0
  7. package/dist/commands/index.d.ts.map +1 -0
  8. package/dist/commands/index.js +27 -0
  9. package/dist/commands/index.js.map +1 -0
  10. package/dist/commands/init.d.ts +19 -0
  11. package/dist/commands/init.d.ts.map +1 -0
  12. package/dist/commands/init.js +90 -0
  13. package/dist/commands/init.js.map +1 -0
  14. package/dist/commands/plugin.d.ts +28 -0
  15. package/dist/commands/plugin.d.ts.map +1 -0
  16. package/dist/commands/plugin.js +174 -0
  17. package/dist/commands/plugin.js.map +1 -0
  18. package/dist/commands/status.d.ts +16 -0
  19. package/dist/commands/status.d.ts.map +1 -0
  20. package/dist/commands/status.js +54 -0
  21. package/dist/commands/status.js.map +1 -0
  22. package/dist/commands/test-helpers.d.ts +18 -0
  23. package/dist/commands/test-helpers.d.ts.map +1 -0
  24. package/dist/commands/test-helpers.js +56 -0
  25. package/dist/commands/test-helpers.js.map +1 -0
  26. package/dist/commands/upgrade.d.ts +13 -0
  27. package/dist/commands/upgrade.d.ts.map +1 -0
  28. package/dist/commands/upgrade.js +21 -0
  29. package/dist/commands/upgrade.js.map +1 -0
  30. package/dist/commands/version.d.ts +15 -0
  31. package/dist/commands/version.d.ts.map +1 -0
  32. package/dist/commands/version.js +52 -0
  33. package/dist/commands/version.js.map +1 -0
  34. package/dist/helpers.d.ts +27 -0
  35. package/dist/helpers.d.ts.map +1 -0
  36. package/dist/helpers.js +48 -0
  37. package/dist/helpers.js.map +1 -0
  38. package/dist/index.d.ts +2 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +2 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/program.d.ts +11 -26
  43. package/dist/program.d.ts.map +1 -1
  44. package/dist/program.js +45 -92
  45. package/dist/program.js.map +1 -1
  46. package/package.json +9 -20
  47. package/dist/v1/cli.d.ts +0 -3
  48. package/dist/v1/cli.d.ts.map +0 -1
  49. package/dist/v1/cli.js +0 -4
  50. package/dist/v1/cli.js.map +0 -1
  51. package/dist/v1/commands/anima.d.ts +0 -2
  52. package/dist/v1/commands/anima.d.ts.map +0 -1
  53. package/dist/v1/commands/anima.js +0 -176
  54. package/dist/v1/commands/anima.js.map +0 -1
  55. package/dist/v1/commands/audit.d.ts +0 -2
  56. package/dist/v1/commands/audit.d.ts.map +0 -1
  57. package/dist/v1/commands/audit.js +0 -42
  58. package/dist/v1/commands/audit.js.map +0 -1
  59. package/dist/v1/commands/clock.d.ts +0 -2
  60. package/dist/v1/commands/clock.d.ts.map +0 -1
  61. package/dist/v1/commands/clock.js +0 -185
  62. package/dist/v1/commands/clock.js.map +0 -1
  63. package/dist/v1/commands/consult.d.ts +0 -9
  64. package/dist/v1/commands/consult.d.ts.map +0 -1
  65. package/dist/v1/commands/consult.js +0 -105
  66. package/dist/v1/commands/consult.js.map +0 -1
  67. package/dist/v1/commands/convene.d.ts +0 -2
  68. package/dist/v1/commands/convene.d.ts.map +0 -1
  69. package/dist/v1/commands/convene.js +0 -78
  70. package/dist/v1/commands/convene.js.map +0 -1
  71. package/dist/v1/commands/conversation.d.ts +0 -2
  72. package/dist/v1/commands/conversation.d.ts.map +0 -1
  73. package/dist/v1/commands/conversation.js +0 -140
  74. package/dist/v1/commands/conversation.js.map +0 -1
  75. package/dist/v1/commands/dashboard.d.ts +0 -2
  76. package/dist/v1/commands/dashboard.d.ts.map +0 -1
  77. package/dist/v1/commands/dashboard.js +0 -36
  78. package/dist/v1/commands/dashboard.js.map +0 -1
  79. package/dist/v1/commands/dispatch.d.ts +0 -2
  80. package/dist/v1/commands/dispatch.d.ts.map +0 -1
  81. package/dist/v1/commands/dispatch.js +0 -41
  82. package/dist/v1/commands/dispatch.js.map +0 -1
  83. package/dist/v1/commands/event.d.ts +0 -2
  84. package/dist/v1/commands/event.d.ts.map +0 -1
  85. package/dist/v1/commands/event.js +0 -65
  86. package/dist/v1/commands/event.js.map +0 -1
  87. package/dist/v1/commands/init.d.ts +0 -2
  88. package/dist/v1/commands/init.d.ts.map +0 -1
  89. package/dist/v1/commands/init.js +0 -98
  90. package/dist/v1/commands/init.js.map +0 -1
  91. package/dist/v1/commands/install-tool.d.ts +0 -2
  92. package/dist/v1/commands/install-tool.d.ts.map +0 -1
  93. package/dist/v1/commands/install-tool.js +0 -74
  94. package/dist/v1/commands/install-tool.js.map +0 -1
  95. package/dist/v1/commands/rehydrate.d.ts +0 -2
  96. package/dist/v1/commands/rehydrate.d.ts.map +0 -1
  97. package/dist/v1/commands/rehydrate.js +0 -43
  98. package/dist/v1/commands/rehydrate.js.map +0 -1
  99. package/dist/v1/commands/remove-tool.d.ts +0 -2
  100. package/dist/v1/commands/remove-tool.d.ts.map +0 -1
  101. package/dist/v1/commands/remove-tool.js +0 -25
  102. package/dist/v1/commands/remove-tool.js.map +0 -1
  103. package/dist/v1/commands/session.d.ts +0 -2
  104. package/dist/v1/commands/session.d.ts.map +0 -1
  105. package/dist/v1/commands/session.js +0 -93
  106. package/dist/v1/commands/session.js.map +0 -1
  107. package/dist/v1/commands/signal.d.ts +0 -2
  108. package/dist/v1/commands/signal.d.ts.map +0 -1
  109. package/dist/v1/commands/signal.js +0 -36
  110. package/dist/v1/commands/signal.js.map +0 -1
  111. package/dist/v1/commands/status.d.ts +0 -2
  112. package/dist/v1/commands/status.d.ts.map +0 -1
  113. package/dist/v1/commands/status.js +0 -111
  114. package/dist/v1/commands/status.js.map +0 -1
  115. package/dist/v1/commands/tool.d.ts +0 -2
  116. package/dist/v1/commands/tool.d.ts.map +0 -1
  117. package/dist/v1/commands/tool.js +0 -47
  118. package/dist/v1/commands/tool.js.map +0 -1
  119. package/dist/v1/commands/upgrade-books.d.ts +0 -2
  120. package/dist/v1/commands/upgrade-books.d.ts.map +0 -1
  121. package/dist/v1/commands/upgrade-books.js +0 -33
  122. package/dist/v1/commands/upgrade-books.js.map +0 -1
  123. package/dist/v1/commands/upgrade.d.ts +0 -2
  124. package/dist/v1/commands/upgrade.d.ts.map +0 -1
  125. package/dist/v1/commands/upgrade.js +0 -222
  126. package/dist/v1/commands/upgrade.js.map +0 -1
  127. package/dist/v1/commands/version.d.ts +0 -2
  128. package/dist/v1/commands/version.d.ts.map +0 -1
  129. package/dist/v1/commands/version.js +0 -80
  130. package/dist/v1/commands/version.js.map +0 -1
  131. package/dist/v1/commands/workshop.d.ts +0 -2
  132. package/dist/v1/commands/workshop.d.ts.map +0 -1
  133. package/dist/v1/commands/workshop.js +0 -128
  134. package/dist/v1/commands/workshop.js.map +0 -1
  135. package/dist/v1/commands/writ.d.ts +0 -2
  136. package/dist/v1/commands/writ.d.ts.map +0 -1
  137. package/dist/v1/commands/writ.js +0 -202
  138. package/dist/v1/commands/writ.js.map +0 -1
  139. package/dist/v1/index.d.ts +0 -2
  140. package/dist/v1/index.d.ts.map +0 -1
  141. package/dist/v1/index.js +0 -2
  142. package/dist/v1/index.js.map +0 -1
  143. package/dist/v1/program.d.ts +0 -2
  144. package/dist/v1/program.d.ts.map +0 -1
  145. package/dist/v1/program.js +0 -70
  146. package/dist/v1/program.js.map +0 -1
  147. package/dist/v1/resolve-home.d.ts +0 -16
  148. package/dist/v1/resolve-home.d.ts.map +0 -1
  149. package/dist/v1/resolve-home.js +0 -18
  150. package/dist/v1/resolve-home.js.map +0 -1
@@ -0,0 +1,16 @@
1
+ /**
2
+ * nsg status — guild status.
3
+ *
4
+ * A framework command. Shows guild identity, framework version, and installed plugins
5
+ * separated into apparatuses (running infrastructure) and kits (passive capabilities).
6
+ * Domain-specific status (writ counts, session history, clock state) belongs
7
+ * to plugins, not here.
8
+ *
9
+ * Requires a booted guild — prints a friendly error if run outside one.
10
+ */
11
+ import { z } from 'zod';
12
+ declare const _default: import("@shardworks/tools-apparatus").ToolDefinition<{
13
+ json: z.ZodOptional<z.ZodBoolean>;
14
+ }>;
15
+ export default _default;
16
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;AAExB,wBA0CG"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * nsg status — guild status.
3
+ *
4
+ * A framework command. Shows guild identity, framework version, and installed plugins
5
+ * separated into apparatuses (running infrastructure) and kits (passive capabilities).
6
+ * Domain-specific status (writ counts, session history, clock state) belongs
7
+ * to plugins, not here.
8
+ *
9
+ * Requires a booted guild — prints a friendly error if run outside one.
10
+ */
11
+ import { tool } from '@shardworks/tools-apparatus';
12
+ import { VERSION, readGuildConfig, guild } from '@shardworks/nexus-core';
13
+ import { z } from 'zod';
14
+ export default tool({
15
+ name: 'status',
16
+ description: 'Show guild identity and installed plugin summary',
17
+ callableBy: ['cli'],
18
+ params: {
19
+ json: z.boolean().optional().describe('Output as JSON'),
20
+ },
21
+ handler: async (params) => {
22
+ let g;
23
+ try {
24
+ g = guild();
25
+ }
26
+ catch {
27
+ throw new Error('Not inside a guild. Run `nsg init` to create one, or use --guild-root to specify the path.');
28
+ }
29
+ const { home } = g;
30
+ const config = readGuildConfig(home);
31
+ // Note: at status time we don't load/start plugins — we just report what's
32
+ // declared in guild.json. Type discrimination (kit vs apparatus) requires
33
+ // loading the modules, which is deferred to avoid startup cost for status.
34
+ const result = {
35
+ guild: config.name,
36
+ nexus: VERSION,
37
+ home,
38
+ model: config.settings?.model ?? '(not set)',
39
+ plugins: [...config.plugins].sort(),
40
+ };
41
+ if (params.json) {
42
+ return result;
43
+ }
44
+ const lines = [
45
+ `Guild: ${result.guild}`,
46
+ `Nexus: ${result.nexus}`,
47
+ `Home: ${result.home}`,
48
+ `Model: ${result.model}`,
49
+ `Plugins: ${result.plugins.length > 0 ? result.plugins.join(', ') : '(none)'}`,
50
+ ];
51
+ return lines.join('\n');
52
+ },
53
+ });
54
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAe,IAAI,CAAC;IAClB,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,kDAAkD;IAC/D,UAAU,EAAE,CAAC,KAAK,CAAC;IACnB,MAAM,EAAE;QACN,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;KACxD;IACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxB,IAAI,CAAC,CAAC;QACN,IAAI,CAAC;YACH,CAAC,GAAG,KAAK,EAAE,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,4FAA4F,CAAC,CAAC;QAChH,CAAC;QAED,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACnB,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QAErC,2EAA2E;QAC3E,0EAA0E;QAC1E,2EAA2E;QAC3E,MAAM,MAAM,GAAG;YACb,KAAK,EAAI,MAAM,CAAC,IAAI;YACpB,KAAK,EAAI,OAAO;YAChB,IAAI;YACJ,KAAK,EAAI,MAAM,CAAC,QAAQ,EAAE,KAAK,IAAI,WAAW;YAC9C,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE;SACpC,CAAC;QAEF,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,MAAM,KAAK,GAAG;YACZ,aAAa,MAAM,CAAC,KAAK,EAAE;YAC3B,aAAa,MAAM,CAAC,KAAK,EAAE;YAC3B,aAAa,MAAM,CAAC,IAAI,EAAE;YAC1B,aAAa,MAAM,CAAC,KAAK,EAAE;YAC3B,aAAa,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;SAChF,CAAC;QACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Shared test helpers for CLI command tests.
3
+ *
4
+ * Provides guild accessor setup, temp directory management, and minimal
5
+ * guild.json scaffolding. Extracted from status.test.ts, version.test.ts,
6
+ * and plugin.test.ts where these were copy-pasted identically.
7
+ */
8
+ /** Set up a minimal guild accessor pointing at the given directory. */
9
+ export declare function setupGuildAccessor(home: string): void;
10
+ /** Create a temp directory and register it for cleanup. */
11
+ export declare function makeTmpDir(prefix: string): string;
12
+ /** Write a minimal guild.json to dir, with optional overrides. */
13
+ export declare function makeGuild(dir: string, overrides?: Record<string, unknown>): void;
14
+ /** Write a guild-root package.json declaring the given npm dependencies. */
15
+ export declare function makeGuildPackageJson(dir: string, deps: Record<string, string>): void;
16
+ /** Clean up guild state and temp directories. Call from afterEach(). */
17
+ export declare function cleanupTestState(): void;
18
+ //# sourceMappingURL=test-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../../src/commands/test-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,uEAAuE;AACvE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAUrD;AAED,2DAA2D;AAC3D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI,CASpF;AAED,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAGpF;AAED,wEAAwE;AACxE,wBAAgB,gBAAgB,IAAI,IAAI,CAMvC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Shared test helpers for CLI command tests.
3
+ *
4
+ * Provides guild accessor setup, temp directory management, and minimal
5
+ * guild.json scaffolding. Extracted from status.test.ts, version.test.ts,
6
+ * and plugin.test.ts where these were copy-pasted identically.
7
+ */
8
+ import fs from 'node:fs';
9
+ import os from 'node:os';
10
+ import path from 'node:path';
11
+ import { setGuild, clearGuild } from '@shardworks/nexus-core';
12
+ /** Accumulates temp dirs for cleanup in afterEach. */
13
+ let tmpDirs = [];
14
+ /** Set up a minimal guild accessor pointing at the given directory. */
15
+ export function setupGuildAccessor(home) {
16
+ setGuild({
17
+ home,
18
+ apparatus: () => { throw new Error('not available in test'); },
19
+ config: () => ({}),
20
+ writeConfig: () => { throw new Error('not available in test'); },
21
+ guildConfig: () => ({}),
22
+ kits: () => [],
23
+ apparatuses: () => [],
24
+ });
25
+ }
26
+ /** Create a temp directory and register it for cleanup. */
27
+ export function makeTmpDir(prefix) {
28
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), `nsg-${prefix}-test-`));
29
+ tmpDirs.push(dir);
30
+ return dir;
31
+ }
32
+ /** Write a minimal guild.json to dir, with optional overrides. */
33
+ export function makeGuild(dir, overrides = {}) {
34
+ const config = {
35
+ name: 'test-guild',
36
+ nexus: '0.0.0',
37
+ plugins: [],
38
+ settings: { model: 'sonnet' },
39
+ ...overrides,
40
+ };
41
+ fs.writeFileSync(path.join(dir, 'guild.json'), JSON.stringify(config, null, 2) + '\n');
42
+ }
43
+ /** Write a guild-root package.json declaring the given npm dependencies. */
44
+ export function makeGuildPackageJson(dir, deps) {
45
+ const pkg = { name: 'test-guild', version: '1.0.0', dependencies: deps };
46
+ fs.writeFileSync(path.join(dir, 'package.json'), JSON.stringify(pkg, null, 2) + '\n');
47
+ }
48
+ /** Clean up guild state and temp directories. Call from afterEach(). */
49
+ export function cleanupTestState() {
50
+ clearGuild();
51
+ for (const dir of tmpDirs) {
52
+ fs.rmSync(dir, { recursive: true, force: true });
53
+ }
54
+ tmpDirs = [];
55
+ }
56
+ //# sourceMappingURL=test-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-helpers.js","sourceRoot":"","sources":["../../src/commands/test-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE9D,sDAAsD;AACtD,IAAI,OAAO,GAAa,EAAE,CAAC;AAE3B,uEAAuE;AACvE,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,QAAQ,CAAC;QACP,IAAI;QACJ,SAAS,EAAE,GAAG,EAAE,GAAG,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;QAC9D,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAU;QAC3B,WAAW,EAAE,GAAG,EAAE,GAAG,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;QAChE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAU;QAChC,IAAI,EA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GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,GAAG,EAAE,CAAC;AACf,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * nsg upgrade — upgrade the guild framework.
3
+ *
4
+ * Stub — upgrade lifecycle not yet designed. Will handle framework version
5
+ * bumps, guild.json schema reconciliation, and plugin-specific upgrade
6
+ * hooks when implemented.
7
+ */
8
+ import { z } from 'zod';
9
+ declare const _default: import("@shardworks/tools-apparatus").ToolDefinition<{
10
+ dryRun: z.ZodOptional<z.ZodBoolean>;
11
+ }>;
12
+ export default _default;
13
+ //# sourceMappingURL=upgrade.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;AAExB,wBAUG"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * nsg upgrade — upgrade the guild framework.
3
+ *
4
+ * Stub — upgrade lifecycle not yet designed. Will handle framework version
5
+ * bumps, guild.json schema reconciliation, and plugin-specific upgrade
6
+ * hooks when implemented.
7
+ */
8
+ import { tool } from '@shardworks/tools-apparatus';
9
+ import { z } from 'zod';
10
+ export default tool({
11
+ name: 'upgrade',
12
+ description: 'Upgrade the guild framework and run pending plugin migrations',
13
+ callableBy: ['cli'],
14
+ params: {
15
+ dryRun: z.boolean().optional().describe('Show what would be done without applying changes'),
16
+ },
17
+ handler: async () => {
18
+ return 'Not yet implemented.';
19
+ },
20
+ });
21
+ //# sourceMappingURL=upgrade.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAe,IAAI,CAAC;IAClB,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,+DAA+D;IAC5E,UAAU,EAAE,CAAC,KAAK,CAAC;IACnB,MAAM,EAAE;QACN,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;KAC5F;IACD,OAAO,EAAE,KAAK,IAAI,EAAE;QAClB,OAAO,sBAAsB,CAAC;IAChC,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * nsg version — show framework and plugin version info.
3
+ *
4
+ * A framework command — hardcoded in the CLI, not discovered via plugins.
5
+ *
6
+ * Always shows framework and Node versions. When run inside a guild,
7
+ * additionally shows installed plugin versions. Gracefully degrades
8
+ * when run outside a guild (no error, just less info).
9
+ */
10
+ import { z } from 'zod';
11
+ declare const _default: import("@shardworks/tools-apparatus").ToolDefinition<{
12
+ json: z.ZodOptional<z.ZodBoolean>;
13
+ }>;
14
+ export default _default;
15
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/commands/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;;;;AAExB,wBAwCG"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * nsg version — show framework and plugin version info.
3
+ *
4
+ * A framework command — hardcoded in the CLI, not discovered via plugins.
5
+ *
6
+ * Always shows framework and Node versions. When run inside a guild,
7
+ * additionally shows installed plugin versions. Gracefully degrades
8
+ * when run outside a guild (no error, just less info).
9
+ */
10
+ import { tool } from '@shardworks/tools-apparatus';
11
+ import { VERSION, readGuildConfig, guild, readGuildPackageJson, resolvePackageNameForPluginId } from '@shardworks/nexus-core';
12
+ import { z } from 'zod';
13
+ export default tool({
14
+ name: 'version',
15
+ description: 'Show Nexus framework and installed plugin version information',
16
+ callableBy: ['cli'],
17
+ params: {
18
+ json: z.boolean().optional().describe('Output as JSON'),
19
+ },
20
+ handler: async (params) => {
21
+ const result = {
22
+ nexus: VERSION,
23
+ node: process.version,
24
+ };
25
+ // Add plugin versions when running inside a guild.
26
+ // guild() throws if not initialized — that's fine, we just skip plugin info.
27
+ try {
28
+ const { home } = guild();
29
+ const config = readGuildConfig(home);
30
+ for (const pluginId of config.plugins) {
31
+ const packageName = resolvePackageNameForPluginId(home, pluginId);
32
+ if (!packageName) {
33
+ result[pluginId] = 'not installed';
34
+ continue;
35
+ }
36
+ const { pkgJson } = readGuildPackageJson(home, packageName);
37
+ result[packageName] = pkgJson
38
+ ? (pkgJson.version ?? 'unknown')
39
+ : 'not installed';
40
+ }
41
+ }
42
+ catch {
43
+ // Not in a guild or guild.json unreadable — just show framework version
44
+ }
45
+ if (params.json) {
46
+ return result;
47
+ }
48
+ const lines = Object.entries(result).map(([k, v]) => `${k}: ${v}`);
49
+ return lines.join('\n');
50
+ },
51
+ });
52
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/commands/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,oBAAoB,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAC9H,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAe,IAAI,CAAC;IAClB,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,+DAA+D;IAC5E,UAAU,EAAE,CAAC,KAAK,CAAC;IACnB,MAAM,EAAE;QACN,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,Q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1,27 @@
1
+ /**
2
+ * Pure helper functions for CLI command generation.
3
+ *
4
+ * Extracted from program.ts so they can be tested independently
5
+ * without pulling in heavy runtime dependencies (Arbor, Instrumentarium).
6
+ */
7
+ import { z } from 'zod';
8
+ import type { ToolDefinition } from '@shardworks/tools-apparatus';
9
+ /**
10
+ * Convert camelCase key to kebab-case CLI flag.
11
+ * e.g. 'writId' → '--writ-id'
12
+ */
13
+ export declare function toFlag(key: string): string;
14
+ /**
15
+ * Detect whether a Zod schema accepts booleans (and only booleans).
16
+ * Used to register Commander flags without <value> for boolean params.
17
+ */
18
+ export declare function isBooleanSchema(schema: z.ZodTypeAny): boolean;
19
+ /**
20
+ * Determine which hyphen prefixes have enough tools to warrant a group.
21
+ *
22
+ * Returns a Set of prefixes that have 2+ tools sharing them.
23
+ * 'plugin-list' + 'plugin-install' → 'plugin' is a group.
24
+ * 'show-writ' alone → 'show' is NOT a group.
25
+ */
26
+ export declare function findGroupPrefixes(tools: ToolDefinition[]): Set<string>;
27
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE;;;GAGG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,GAAG,OAAO,CAO7D;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAetE"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Pure helper functions for CLI command generation.
3
+ *
4
+ * Extracted from program.ts so they can be tested independently
5
+ * without pulling in heavy runtime dependencies (Arbor, Instrumentarium).
6
+ */
7
+ import { z } from 'zod';
8
+ /**
9
+ * Convert camelCase key to kebab-case CLI flag.
10
+ * e.g. 'writId' → '--writ-id'
11
+ */
12
+ export function toFlag(key) {
13
+ return `--${key.replace(/([A-Z])/g, (c) => `-${c.toLowerCase()}`)}`;
14
+ }
15
+ /**
16
+ * Detect whether a Zod schema accepts booleans (and only booleans).
17
+ * Used to register Commander flags without <value> for boolean params.
18
+ */
19
+ export function isBooleanSchema(schema) {
20
+ return (schema.safeParse(true).success &&
21
+ schema.safeParse(false).success &&
22
+ !schema.safeParse(42).success &&
23
+ !schema.safeParse('test').success);
24
+ }
25
+ /**
26
+ * Determine which hyphen prefixes have enough tools to warrant a group.
27
+ *
28
+ * Returns a Set of prefixes that have 2+ tools sharing them.
29
+ * 'plugin-list' + 'plugin-install' → 'plugin' is a group.
30
+ * 'show-writ' alone → 'show' is NOT a group.
31
+ */
32
+ export function findGroupPrefixes(tools) {
33
+ const prefixCounts = new Map();
34
+ for (const t of tools) {
35
+ const idx = t.name.indexOf('-');
36
+ if (idx === -1)
37
+ continue;
38
+ const prefix = t.name.slice(0, idx);
39
+ prefixCounts.set(prefix, (prefixCounts.get(prefix) ?? 0) + 1);
40
+ }
41
+ const groups = new Set();
42
+ for (const [prefix, count] of prefixCounts) {
43
+ if (count >= 2)
44
+ groups.add(prefix);
45
+ }
46
+ return groups;
47
+ }
48
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,GAAW;IAChC,OAAO,KAAK,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC;AACtE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,MAAoB;IAClD,OAAO,CACL,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO;QAC9B,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO;QAC/B,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,OAAO;QAC7B,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,OAAO,CAClC,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAuB;IACvD,MAAM,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE/C,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,MAAM,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,GAAG,KAAK,CAAC,CAAC;YAAE,SAAS;QACzB,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACpC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,YAAY,EAAE,CAAC;QAC3C,IAAI,KAAK,IAAI,CAAC;YAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export { VERSION } from '@shardworks/nexus-core';
2
+ export { main } from './program.ts';
3
+ export { frameworkCommands } from './commands/index.ts';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,4 @@
1
1
  export { VERSION } from '@shardworks/nexus-core';
2
+ export { main } from "./program.js";
3
+ export { frameworkCommands } from "./commands/index.js";
2
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/program.d.ts CHANGED
@@ -1,35 +1,20 @@
1
1
  /**
2
- * nsg program — dynamic Commander setup via mainspring tool resolution.
2
+ * nsg program — dynamic Commander setup.
3
3
  *
4
- * Discovers installed tools at startup via the Mainspring, then registers each
5
- * as a Commander command with auto-generated options from its Zod param schema.
4
+ * Two command sources:
5
+ *
6
+ * 1. **Framework commands** — hardcoded in the CLI package (init, status,
7
+ * version, upgrade, plugin management). Always available, even without
8
+ * a guild.
9
+ *
10
+ * 2. **Plugin tools** — discovered at runtime via The Instrumentarium
11
+ * (tools apparatus). Only available when a guild is present and the
12
+ * tools apparatus is installed.
6
13
  *
7
14
  * Tool names are auto-grouped when multiple tools share a hyphen prefix:
8
- * 'rig-list' + 'rig-install' → 'nsg rig list' / 'nsg rig install'.
15
+ * 'plugin-list' + 'plugin-install' → 'nsg plugin list' / 'nsg plugin install'.
9
16
  * A tool like 'show-writ' stays flat ('nsg show-writ') since no other tool
10
17
  * starts with 'show-'.
11
- *
12
- * Commander lives here; rig handles all manifest and import logic.
13
- */
14
- import { z } from 'zod';
15
- import type { Tool } from '@shardworks/nexus-mainspring';
16
- /**
17
- * Convert camelCase key to kebab-case CLI flag.
18
- * e.g. 'writId' → '--writ-id'
19
- */
20
- export declare function toFlag(key: string): string;
21
- /**
22
- * Detect whether a Zod schema accepts booleans (and only booleans).
23
- * Used to register Commander flags without <value> for boolean params.
24
- */
25
- export declare function isBooleanSchema(schema: z.ZodTypeAny): boolean;
26
- /**
27
- * Determine which hyphen prefixes have enough tools to warrant a group.
28
- *
29
- * Returns a Set of prefixes that have 2+ tools sharing them.
30
- * 'rig-list' + 'rig-install' → 'rig' is a group.
31
- * 'show-writ' alone → 'show' is NOT a group.
32
18
  */
33
- export declare function findGroupPrefixes(tools: Tool[]): Set<string>;
34
19
  export declare function main(): Promise<void>;
35
20
  //# sourceMappingURL=program.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,8BAA8B,CAAC;AAOrE;;;GAGG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1C;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,GAAG,OAAO,CAO7D;AAqED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAe5D;AA+CD,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAuD1C"}
1
+ {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAwGH,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAwD1C"}