opensip-cli 0.1.1 → 0.1.3

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 (61) hide show
  1. package/dist/bootstrap/bind-tool-context.d.ts +16 -0
  2. package/dist/bootstrap/bind-tool-context.d.ts.map +1 -0
  3. package/dist/bootstrap/bind-tool-context.js +160 -0
  4. package/dist/bootstrap/bind-tool-context.js.map +1 -0
  5. package/dist/bootstrap/build-per-run-scope.d.ts.map +1 -1
  6. package/dist/bootstrap/build-per-run-scope.js +35 -2
  7. package/dist/bootstrap/build-per-run-scope.js.map +1 -1
  8. package/dist/bootstrap/bundled-tools.manifest.json +6 -0
  9. package/dist/bootstrap/deliver-envelope.d.ts +7 -0
  10. package/dist/bootstrap/deliver-envelope.d.ts.map +1 -1
  11. package/dist/bootstrap/deliver-envelope.js +18 -3
  12. package/dist/bootstrap/deliver-envelope.js.map +1 -1
  13. package/dist/bootstrap/execute-post-bailout-bootstrap.d.ts +45 -0
  14. package/dist/bootstrap/execute-post-bailout-bootstrap.d.ts.map +1 -0
  15. package/dist/bootstrap/execute-post-bailout-bootstrap.js +108 -0
  16. package/dist/bootstrap/execute-post-bailout-bootstrap.js.map +1 -0
  17. package/dist/bootstrap/plan-pre-action-bootstrap.d.ts +45 -0
  18. package/dist/bootstrap/plan-pre-action-bootstrap.d.ts.map +1 -0
  19. package/dist/bootstrap/plan-pre-action-bootstrap.js +86 -0
  20. package/dist/bootstrap/plan-pre-action-bootstrap.js.map +1 -0
  21. package/dist/bootstrap/pre-action-bootstrap-phases.d.ts +20 -0
  22. package/dist/bootstrap/pre-action-bootstrap-phases.d.ts.map +1 -0
  23. package/dist/bootstrap/pre-action-bootstrap-phases.js +25 -0
  24. package/dist/bootstrap/pre-action-bootstrap-phases.js.map +1 -0
  25. package/dist/bootstrap/pre-action-hook.d.ts +7 -61
  26. package/dist/bootstrap/pre-action-hook.d.ts.map +1 -1
  27. package/dist/bootstrap/pre-action-hook.js +34 -272
  28. package/dist/bootstrap/pre-action-hook.js.map +1 -1
  29. package/dist/bootstrap/pre-action-runtime.d.ts +9 -0
  30. package/dist/bootstrap/pre-action-runtime.d.ts.map +1 -0
  31. package/dist/bootstrap/pre-action-runtime.js +2 -0
  32. package/dist/bootstrap/pre-action-runtime.js.map +1 -0
  33. package/dist/bootstrap/register-tools-bundled.d.ts +28 -0
  34. package/dist/bootstrap/register-tools-bundled.d.ts.map +1 -0
  35. package/dist/bootstrap/register-tools-bundled.js +107 -0
  36. package/dist/bootstrap/register-tools-bundled.js.map +1 -0
  37. package/dist/bootstrap/register-tools-discovery.d.ts +154 -0
  38. package/dist/bootstrap/register-tools-discovery.d.ts.map +1 -0
  39. package/dist/bootstrap/register-tools-discovery.js +385 -0
  40. package/dist/bootstrap/register-tools-discovery.js.map +1 -0
  41. package/dist/bootstrap/register-tools-mount.d.ts +25 -0
  42. package/dist/bootstrap/register-tools-mount.d.ts.map +1 -0
  43. package/dist/bootstrap/register-tools-mount.js +91 -0
  44. package/dist/bootstrap/register-tools-mount.js.map +1 -0
  45. package/dist/bootstrap/register-tools-shared.d.ts +40 -0
  46. package/dist/bootstrap/register-tools-shared.d.ts.map +1 -0
  47. package/dist/bootstrap/register-tools-shared.js +98 -0
  48. package/dist/bootstrap/register-tools-shared.js.map +1 -0
  49. package/dist/bootstrap/register-tools.d.ts +4 -215
  50. package/dist/bootstrap/register-tools.d.ts.map +1 -1
  51. package/dist/bootstrap/register-tools.js +4 -683
  52. package/dist/bootstrap/register-tools.js.map +1 -1
  53. package/dist/commands/mount-command-spec.d.ts +2 -1
  54. package/dist/commands/mount-command-spec.d.ts.map +1 -1
  55. package/dist/commands/mount-command-spec.js +3 -6
  56. package/dist/commands/mount-command-spec.js.map +1 -1
  57. package/dist/env/host-env-specs.d.ts +4 -3
  58. package/dist/env/host-env-specs.d.ts.map +1 -1
  59. package/dist/env/host-env-specs.js +8 -3
  60. package/dist/env/host-env-specs.js.map +1 -1
  61. package/package.json +33 -33
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-tools-discovery.js","sourceRoot":"","sources":["../../src/bootstrap/register-tools-discovery.ts"],"names":[],"mappings":"AAAA,2LAA2L;AAC3L,2LAA2L;AAC3L,OAAO,EACL,SAAS,EACT,yBAAyB,EACzB,4BAA4B,EAC5B,+BAA+B,EAC/B,gBAAgB,EAChB,MAAM,EACN,uBAAuB,EACvB,2BAA2B,EAC3B,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,GAMjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,iBAAiB,EAAwB,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAY5D;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,yBAAyB,CACvC,GAAW,EACX,aAAqB;IAErB,MAAM,OAAO,GAA0B,EAAE,CAAC;IAC1C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,qBAAqB,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;QACnE,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAChC,OAAO,CAAC,IAAI,CAAC;gBACX,GAAG,EAAE,mBAAmB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;gBAChE,IAAI,EAAE,SAAS;aAChB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,sEAAsE;QACtE,qEAAqE;QACrE,mEAAmE;IACrE,CAAC;IACD,OAAO,CAAC,IAAI,CACV,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,EAC5B,EAAE,GAAG,EAAE,gBAAgB,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAC/D,EAAE,GAAG,E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,CAAC,MAAM,EAAE,EAAE,CACpE,CAAC;IACJ,CAAC;IAED,4EAA4E;IAC5E,gEAAgE;IAChE,yBAAyB,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/C,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7B,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtB,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { type CliProgram } from '@opensip-cli/contracts';
2
+ import { type ToolCliContext, type ToolRegistry } from '@opensip-cli/core';
3
+ /**
4
+ * Walk the registry and mount each tool's commands onto `program`. This is
5
+ * **step 8** of the tool lifecycle (launch, §5.4) — see
6
+ * {@link runToolLifecycle}.
7
+ *
8
+ * Public launch: there is ONE command surface — the tool's declared `commandSpecs`,
9
+ * mounted by `mountCommandSpec`. `register()` and the raw-Commander `program`
10
+ * handle on the tool context are gone, so the host owns `program` and passes it
11
+ * in here (the tool never touches Commander). A tool with no `commandSpecs` is a
12
+ * mis-declaration: it contributes no commands, surfaced loudly via
13
+ * `cli.tool.no_command_surface`.
14
+ *
15
+ * Failures are isolated per tool — one tool whose spec fails to mount must not
16
+ * take the whole CLI down. The failure is logged + stderr-warned, then we
17
+ * continue with the next tool.
18
+ *
19
+ * @param registry The per-invocation tool registry to walk.
20
+ * @param program The root Commander program (host-owned; the composition root
21
+ * passes it — it is no longer reachable through the tool context, §8).
22
+ * @param ctx The per-invocation handler context (render/emit/scope — no program).
23
+ */
24
+ export declare function mountAllToolCommands(registry: ToolRegistry, program: CliProgram, ctx: ToolCliContext): void;
25
+ //# sourceMappingURL=register-tools-mount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-tools-mount.d.ts","sourceRoot":"","sources":["../../src/bootstrap/register-tools-mount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAO9F;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,UAAU,EACnB,GAAG,EAAE,cAAc,GAClB,IAAI,CAqBN"}
@@ -0,0 +1,91 @@
1
+ import { logger } from '@opensip-cli/core';
2
+ import { mountCommandSpec } from '../commands/mount-command-spec.js';
3
+ import { bindToolCliContext } from './bind-tool-context.js';
4
+ import { BOOTSTRAP_MODULE } from './register-tools-shared.js';
5
+ /**
6
+ * Walk the registry and mount each tool's commands onto `program`. This is
7
+ * **step 8** of the tool lifecycle (launch, §5.4) — see
8
+ * {@link runToolLifecycle}.
9
+ *
10
+ * Public launch: there is ONE command surface — the tool's declared `commandSpecs`,
11
+ * mounted by `mountCommandSpec`. `register()` and the raw-Commander `program`
12
+ * handle on the tool context are gone, so the host owns `program` and passes it
13
+ * in here (the tool never touches Commander). A tool with no `commandSpecs` is a
14
+ * mis-declaration: it contributes no commands, surfaced loudly via
15
+ * `cli.tool.no_command_surface`.
16
+ *
17
+ * Failures are isolated per tool — one tool whose spec fails to mount must not
18
+ * take the whole CLI down. The failure is logged + stderr-warned, then we
19
+ * continue with the next tool.
20
+ *
21
+ * @param registry The per-invocation tool registry to walk.
22
+ * @param program The root Commander program (host-owned; the composition root
23
+ * passes it — it is no longer reachable through the tool context, §8).
24
+ * @param ctx The per-invocation handler context (render/emit/scope — no program).
25
+ */
26
+ export function mountAllToolCommands(registry, program, ctx) {
27
+ for (const tool of registry.list()) {
28
+ try {
29
+ mountOneTool(program, tool, ctx);
30
+ }
31
+ catch (error) {
32
+ const msg = error instanceof Error ? error.message : String(error);
33
+ const human = tool.metadata.name ?? tool.metadata.id;
34
+ process.stderr.write(`opensip: tool ${human} failed to mount: ${msg}\n`);
35
+ logger.warn({
36
+ evt: 'cli.tool.register_failed',
37
+ module: BOOTSTRAP_MODULE,
38
+ toolId: tool.metadata.id, // stable UUID
39
+ toolName: human,
40
+ error: msg,
41
+ });
42
+ }
43
+ }
44
+ // ADR-0021: one shared help shape across every mounted command — uniform
45
+ // option/subcommand ordering and a docs footer — applied here (the single
46
+ // place that has walked every tool's commands) rather than per tool.
47
+ applySharedHelpConfiguration(program);
48
+ }
49
+ /**
50
+ * Mount ONE tool's commands from its declared `commandSpecs` — the only command
51
+ * surface (public launch). Extracted so {@link mountAllToolCommands} keeps its
52
+ * per-tool failure isolation around a single call. A tool with no `commandSpecs`
53
+ * contributes nothing and is surfaced via `cli.tool.no_command_surface`.
54
+ */
55
+ function mountOneTool(program, tool, ctx) {
56
+ if (tool.commandSpecs !== undefined && tool.commandSpecs.length > 0) {
57
+ const toolCtx = bindToolCliContext(tool, ctx);
58
+ for (const spec of tool.commandSpecs) {
59
+ // `Tool.commandSpecs` is `CommandSpec<unknown, ToolCliContext>[]`, which
60
+ // is assignable to the mounter's `HostCommandSpec` (handler contravariance
61
+ // — an `unknown`-opts handler accepts a `Record`-opts call). No cast.
62
+ mountCommandSpec(program, spec, toolCtx);
63
+ }
64
+ return;
65
+ }
66
+ // No declarative command surface — a mis-declared tool contributes no commands.
67
+ // Surface it rather than silently mounting nothing.
68
+ logger.warn({
69
+ evt: 'cli.tool.no_command_surface',
70
+ module: BOOTSTRAP_MODULE,
71
+ toolId: tool.metadata.id, // stable
72
+ toolName: tool.metadata.name ?? tool.metadata.id,
73
+ detail: 'tool declares no commandSpecs; no commands mounted',
74
+ });
75
+ }
76
+ const DOCS_HELP_FOOTER = '\nDocs: https://opensip.ai/docs/opensip-cli';
77
+ /**
78
+ * Apply one help configuration to the root program and every (sub)command:
79
+ * options + subcommands sort alphabetically so the help reads the same across
80
+ * `fit`/`graph`/`sim`, and the root help ends with a docs pointer (ADR-0021).
81
+ */
82
+ function applySharedHelpConfiguration(program) {
83
+ const configure = (cmd) => {
84
+ cmd.configureHelp({ sortOptions: true, sortSubcommands: true });
85
+ for (const sub of cmd.commands)
86
+ configure(sub);
87
+ };
88
+ configure(program);
89
+ program.addHelpText('after', DOCS_HELP_FOOTER);
90
+ }
91
+ //# sourceMappingURL=register-tools-mount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-tools-mount.js","sourceRoot":"","sources":["../../src/bootstrap/register-tools-mount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAqD,MAAM,mBAAmB,CAAC;AAE9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAsB,EACtB,OAAmB,EACnB,GAAmB;IAEnB,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;QACnC,IAAI,CAAC;YACH,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnE,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,KAAK,qBAAqB,GAAG,IAAI,CAAC,CAAC;YACzE,MAAM,CAAC,IAAI,CAAC;gBACV,GAAG,EAAE,0BAA0B;gBAC/B,MAAM,EAAE,gBAAgB;gBACxB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,cAAc;gBACxC,QAAQ,EA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AG,CAAC,CAAC;IACjD,CAAC,CAAC;IACF,SAAS,CAAC,OAAO,CAAC,CAAC;IACnB,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,40 @@
1
+ /** `module` field on every structured log event emitted from this file. */
2
+ export declare const BOOTSTRAP_MODULE = "cli:bootstrap";
3
+ export declare const BUNDLED_TOOL_PACKAGES: readonly string[];
4
+ /**
5
+ * The ADR-0038 back-compat pin: the tool IDS whose `init` scaffold dirs the
6
+ * pre-registry-driven CLI ALWAYS created (fit/sim). The composition root warns
7
+ * (`cli.tool.expected_bundled_absent`) when one of these is missing from the
8
+ * populated registry, so a build whose {@link BUNDLED_TOOL_PACKAGES} drifted
9
+ * (a tool removed, a packaging variant) under-scaffolds LOUDLY instead of
10
+ * silently.
11
+ *
12
+ * Now derived from the same manifest as BUNDLED_TOOL_PACKAGES (Workstream A)
13
+ * so a single edit keeps them in sync. `graph` is correctly absent: it never
14
+ * scaffolded (`pluginLayout` undefined).
15
+ */
16
+ export declare const EXPECTED_SCAFFOLDING_TOOL_IDS: readonly string[];
17
+ /**
18
+ * Resolve a bundled tool's PACKAGE DIR — the directory whose `package.json`
19
+ * carries the `opensipTools` manifest.
20
+ *
21
+ * The `./package.json` subpath is not declared in each engine's `exports`,
22
+ * so `require.resolve('<pkg>/package.json')` throws. Instead we resolve the
23
+ * package's MAIN entry (a bare-name resolve, always permitted by `exports`)
24
+ * and walk up to the nearest ancestor directory that has a `package.json`
25
+ * whose `name` matches `packageName`. That ancestor IS the tool's own
26
+ * package dir under both the source layout and pnpm's workspace-injected
27
+ * `node_modules` layout (verified against fitness/simulation/graph here).
28
+ *
29
+ * @returns the resolved package directory, or `undefined` when the package
30
+ * cannot be resolved (should never happen for a bundled direct dep).
31
+ */
32
+ export declare function resolveBundledPackageDir(packageName: string): string | undefined;
33
+ /**
34
+ * Resolve a bundled tool package's on-disk directory, requiring success.
35
+ *
36
+ * @throws {PluginIncompatibleError} when the package directory cannot be
37
+ * resolved on disk (its manifest is unreadable).
38
+ */
39
+ export declare function resolveRequiredBundledPackageDir(packageName: string): string;
40
+ //# sourceMappingURL=register-tools-shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-tools-shared.d.ts","sourceRoot":"","sources":["../../src/bootstrap/register-tools-shared.ts"],"names":[],"mappings":"AAOA,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAmBhD,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAAoC,CAAC;AAExF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,6BAA6B,EAAE,SAAS,MAAM,EAAuC,CAAC;AAEnG;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAkChF;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAO5E"}
@@ -0,0 +1,98 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { createRequire } from 'node:module';
3
+ import { dirname, join } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { logger, PluginIncompatibleError } from '@opensip-cli/core';
6
+ /** `module` field on every structured log event emitted from this file. */
7
+ export const BOOTSTRAP_MODULE = 'cli:bootstrap';
8
+ /** Used to resolve the bundled engine package dirs from the CLI's own module graph. */
9
+ const requireFromHere = createRequire(import.meta.url);
10
+ /**
11
+ * Bundled first-party tools are now data-driven (platform-ergonomics Workstream A).
12
+ * The source of truth is the co-located JSON manifest (single edit site when
13
+ * adding a first-party tool). Loaded via fs + import.meta.url (works in both
14
+ * src dev and dist/ after tsc; the json is committed under src/ and must be
15
+ * present next to the .js in dist at runtime — ensured by package "files": ["dist"]
16
+ * + manual cp in build or future asset plugin; no resolveJsonModule dep).
17
+ */
18
+ const manifestUrl = new URL('bundled-tools.manifest.json', import.meta.url);
19
+ const bundledManifest = JSON.parse(readFileSync(fileURLToPath(manifestUrl), 'utf8'));
20
+ export const BUNDLED_TOOL_PACKAGES = bundledManifest.bundledPackages;
21
+ /**
22
+ * The ADR-0038 back-compat pin: the tool IDS whose `init` scaffold dirs the
23
+ * pre-registry-driven CLI ALWAYS created (fit/sim). The composition root warns
24
+ * (`cli.tool.expected_bundled_absent`) when one of these is missing from the
25
+ * populated registry, so a build whose {@link BUNDLED_TOOL_PACKAGES} drifted
26
+ * (a tool removed, a packaging variant) under-scaffolds LOUDLY instead of
27
+ * silently.
28
+ *
29
+ * Now derived from the same manifest as BUNDLED_TOOL_PACKAGES (Workstream A)
30
+ * so a single edit keeps them in sync. `graph` is correctly absent: it never
31
+ * scaffolded (`pluginLayout` undefined).
32
+ */
33
+ export const EXPECTED_SCAFFOLDING_TOOL_IDS = bundledManifest.scaffoldingToolIds;
34
+ /**
35
+ * Resolve a bundled tool's PACKAGE DIR — the directory whose `package.json`
36
+ * carries the `opensipTools` manifest.
37
+ *
38
+ * The `./package.json` subpath is not declared in each engine's `exports`,
39
+ * so `require.resolve('<pkg>/package.json')` throws. Instead we resolve the
40
+ * package's MAIN entry (a bare-name resolve, always permitted by `exports`)
41
+ * and walk up to the nearest ancestor directory that has a `package.json`
42
+ * whose `name` matches `packageName`. That ancestor IS the tool's own
43
+ * package dir under both the source layout and pnpm's workspace-injected
44
+ * `node_modules` layout (verified against fitness/simulation/graph here).
45
+ *
46
+ * @returns the resolved package directory, or `undefined` when the package
47
+ * cannot be resolved (should never happen for a bundled direct dep).
48
+ */
49
+ export function resolveBundledPackageDir(packageName) {
50
+ let resolvedEntry;
51
+ try {
52
+ resolvedEntry = requireFromHere.resolve(packageName);
53
+ }
54
+ catch (error) {
55
+ // A bundled direct dep failing to resolve is a packaging fault — log it
56
+ // so the subsequent fail-closed throw is diagnosable, then signal the
57
+ // unresolved state to the caller (which raises PluginIncompatibleError).
58
+ logger.debug({
59
+ evt: 'cli.tool.bundled_unresolved',
60
+ module: BOOTSTRAP_MODULE,
61
+ packageName,
62
+ error: error instanceof Error ? error.message : String(error),
63
+ });
64
+ return undefined;
65
+ }
66
+ let dir = dirname(resolvedEntry);
67
+ for (let i = 0; i < 50; i++) {
68
+ const pkgPath = join(dir, 'package.json');
69
+ if (existsSync(pkgPath)) {
70
+ try {
71
+ const json = JSON.parse(readFileSync(pkgPath, 'utf8'));
72
+ if (json.name === packageName)
73
+ return dir;
74
+ }
75
+ catch {
76
+ // @swallow-ok unreadable package.json on the walk-up — keep climbing.
77
+ }
78
+ }
79
+ const parent = dirname(dir);
80
+ if (parent === dir)
81
+ break;
82
+ dir = parent;
83
+ }
84
+ return undefined;
85
+ }
86
+ /**
87
+ * Resolve a bundled tool package's on-disk directory, requiring success.
88
+ *
89
+ * @throws {PluginIncompatibleError} when the package directory cannot be
90
+ * resolved on disk (its manifest is unreadable).
91
+ */
92
+ export function resolveRequiredBundledPackageDir(packageName) {
93
+ const dir = resolveBundledPackageDir(packageName);
94
+ if (dir !== undefined)
95
+ return dir;
96
+ throw new PluginIncompatibleError(`bundled tool '${packageName}' could not be resolved on disk; its manifest is unreadable`, { diagnostic: 'package directory not resolvable' });
97
+ }
98
+ //# sourceMappingURL=register-tools-shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-tools-shared.js","sourceRoot":"","sources":["../../src/bootstrap/register-tools-shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEpE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEhD,uFAAuF;A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AE,CAAC;YACxB,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAEpD,CAAC;gBACF,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW;oBAAE,OAAO,GAAG,CAAC;YAC5C,CAAC;YAAC,MAAM,CAAC;gBACP,sEAAsE;YACxE,CAAC;QACH,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM;QAC1B,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gCAAgC,CAAC,WAAmB;IAClE,MAAM,GAAG,GAAG,wBAAwB,CAAC,WAAW,CAAC,CAAC;IAClD,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC;IAClC,MAAM,IAAI,uBAAuB,CAC/B,iBAAiB,WAAW,6DAA6D,EACzF,EAAE,UAAU,EAAE,kCAAkC,EAAE,CACnD,CAAC;AACJ,CAAC"}
@@ -10,219 +10,8 @@
10
10
  * a noisy warning when a third-party package happens to ship under a
11
11
  * built-in id.
12
12
  */
13
- import { type CliProgram } from '@opensip-cli/contracts';
14
- import { type ToolCliContext, type ToolDiscoverySource, type ToolPluginManifest, type ToolProvenance, type ToolRegistry } from '@opensip-cli/core';
15
- /**
16
- * Bundled first-party tool PACKAGES — declared as direct deps of
17
- * opensip-cli. Order is registration order (and thus help/listing order).
18
- *
19
- * launch cutover: these are package NAMES, not imported tool runtimes. The
20
- * host no longer statically `import`s `fitnessTool`/`graphTool`/`simulationTool`
21
- * — bundled tools are resolved on disk and loaded by DYNAMIC IMPORT through the
22
- * exact same manifest → `admitTool` → import → register path an installed or
23
- * project-local tool travels (north-star §2.1, Figure 7). "Bundled" is now a
24
- * provenance/trust posture, not a privileged load path: install-source
25
- * independence is structural, not merely tested (`no-bootstrap-tool-import`
26
- * guards this file against a static tool-runtime import creeping back).
27
- */
28
- export declare const BUNDLED_TOOL_PACKAGES: readonly string[];
29
- /**
30
- * The ADR-0038 back-compat pin: the tool IDS whose `init` scaffold dirs the
31
- * pre-registry-driven CLI ALWAYS created (fit/sim). The composition root warns
32
- * (`cli.tool.expected_bundled_absent`) when one of these is missing from the
33
- * populated registry, so a build whose {@link BUNDLED_TOOL_PACKAGES} drifted
34
- * (a tool removed, a packaging variant) under-scaffolds LOUDLY instead of
35
- * silently.
36
- *
37
- * Deliberately a HISTORICAL CONSTANT, not derived from the loaded bundled
38
- * manifests: bundled tools fail CLOSED in {@link registerFirstPartyTools}
39
- * (every load failure throws before the warning could run), so "bundled
40
- * manifests absent from the registry" is structurally empty — a derived list
41
- * could never fire. The only drift this diagnostic exists to catch is an edit
42
- * to the package list itself, which is precisely what a derivation would
43
- * follow rather than flag. Co-located with the package list (one module owns
44
- * both encodings) so an editor of either sees the other. `graph` is correctly
45
- * absent: it never scaffolded (`pluginLayout` undefined).
46
- */
47
- export declare const EXPECTED_SCAFFOLDING_TOOL_IDS: readonly string[];
48
- /**
49
- * Register the bundled first-party tools into the supplied registry, each one
50
- * flowing through the SAME admit → dynamic-import → register path the external
51
- * path uses (launch cutover — replaces the static-import + gate path).
52
- *
53
- * Per package name: `resolveBundledPackageDir` → `loadToolManifest('bundled')`
54
- * → `admitTool({ source: 'bundled', explicitlyRequested: true })` →
55
- * `importToolRuntime` (dynamic import + shape validation) → drift guard →
56
- * `registry.register`. A bundled tool ships with the CLI, so it is always
57
- * explicitly present: a missing/incompatible manifest or a runtime that fails
58
- * to load is FAIL-CLOSED (never a silent skip). The recorded `ToolProvenance`
59
- * (source `'bundled'`, trusted-by-shipping) and manifest are pushed onto the
60
- * optional collectors so the composition root can surface provenance
61
- * (`plugin list`) and seed the per-run capability registry (§5.3).
62
- *
63
- * @param registry The per-invocation tool registry to populate.
64
- * @param provenance Optional sink for the admitted tools' provenance records.
65
- * @param manifests Optional sink for the admitted tools' manifests (§5.3).
66
- * @param packages The bundled package names to load (defaults to
67
- * {@link BUNDLED_TOOL_PACKAGES}; injectable so the fail-closed paths are
68
- * testable with fixture packages).
69
- * @throws {PluginIncompatibleError} when a bundled tool cannot be resolved,
70
- * has no conformant manifest, is out of range, or its runtime fails to load
71
- * — mapped to `EXIT_CODES.PLUGIN_INCOMPATIBLE` (exit 5) by the CLI boundary.
72
- */
73
- export declare function registerFirstPartyTools(registry: ToolRegistry, provenance?: ToolProvenance[], manifests?: ToolPluginManifest[], packages?: readonly string[]): Promise<void>;
74
- export interface DiscoveryOptions {
75
- /**
76
- * Ordered tool-discovery sources (precedence: first wins on duplicate
77
- * name). Built by {@link buildToolDiscoverySources} at the composition
78
- * root; passed in here so this function reads no ambient HOME/cwd state
79
- * and stays unit-testable with explicit anchors.
80
- */
81
- readonly sources: readonly ToolDiscoverySource[];
82
- }
83
- /**
84
- * Build the ordered tool-discovery sources. Order is precedence
85
- * (first-occurrence-wins on duplicate name):
86
- *
87
- * 1. project-local `.runtime/plugins/tool` — `plugin add --project`
88
- * 2. project tree (walk up from cwd) — plain `npm install @tool`
89
- * 3. user-global `~/.opensip-cli/plugins/tool` — `plugin add` (default)
90
- * 4. CLI install dir (walk up) — `npm i -g @tool`
91
- *
92
- * A project-local pin therefore shadows a user-global install of the same
93
- * tool. Project-root resolution is best-effort: an unresolvable context
94
- * (e.g. running outside any project) simply contributes no `.runtime`
95
- * source.
96
- */
97
- export declare function buildToolDiscoverySources(cwd: string, cliInstallDir: string): ToolDiscoverySource[];
98
- export declare function discoverAndRegisterToolPackages(registry: ToolRegistry, opts: DiscoveryOptions, builtInIds: ReadonlySet<string>, provenance?: ToolProvenance[], manifests?: ToolPluginManifest[]): Promise<void>;
99
- /**
100
- * The outcome of admitting a tool — the recorded `ToolProvenance` plus the
101
- * loaded `ToolPluginManifest`. Returned by the authored legs
102
- * ({@link admitUserGlobalTool} / {@link admitProjectLocalTool}) and the
103
- * installed leg ({@link admitInstalledTool}) alike. The manifest is returned
104
- * (not re-read) so the register step can run the drift guard
105
- * (`assertManifestMatchesTool`) against the imported runtime and seed the
106
- * per-run capability registry, without a second filesystem read.
107
- */
108
- export interface AuthoredAdmission {
109
- readonly provenance: ToolProvenance;
110
- readonly manifest: ToolPluginManifest;
111
- }
112
- /**
113
- * Admit (or reject) a single PROJECT-LOCAL authored tool under the
114
- * deny-by-default trust policy (launch, Phase 3 Task 3.2; wired into
115
- * production discovery in the launch contract).
116
- *
117
- * A project-local tool is authored code under
118
- * `<project>/opensip-cli/tools/<name>/` declaring its identity via a JSON
119
- * sidecar (`opensip-tool.manifest.json`). It is read + gated WITHOUT importing
120
- * its module:
121
- *
122
- * 1. `loadToolManifest('project-local', dir)` — identity only, no code run.
123
- * 2. Trust check — {@link isProjectLocalToolTrusted}. Not allowlisted ⇒
124
- * throw {@link PluginIncompatibleError} (fail-closed, exit 5) before any
125
- * import. Allowlisted ⇒ run the shared compatibility tail; an incompatible
126
- * explicitly-trusted tool is likewise fail-closed.
127
- *
128
- * Returns the admitted tool's `{ provenance, manifest }` on success. The trust
129
- * decision always precedes import (it is the FIRST statement here, ahead of the
130
- * shared {@link admitAuthoredTool} tail).
131
- *
132
- * @throws {PluginIncompatibleError} when the tool has no conformant sidecar
133
- * manifest, is not allowlisted, or is compatibility-incompatible.
134
- */
135
- export declare function admitProjectLocalTool(args: {
136
- readonly dir: string;
137
- readonly env?: NodeJS.ProcessEnv;
138
- }): AuthoredAdmission;
139
- /**
140
- * Admit a single USER-GLOBAL authored tool — the trusted-by-default sibling of
141
- * {@link admitProjectLocalTool}.
142
- *
143
- * A user-global tool is an authored sidecar under
144
- * `~/.opensip-cli/tools/<name>/`. The user deliberately placed it in their
145
- * own home dir (the `npm i -g` analogue for authored code), so there is **no
146
- * allowlist gate** — it is trusted-by-default. It still reads the static
147
- * sidecar and runs `admitTool` BEFORE the module could be imported (the shared
148
- * {@link admitAuthoredTool} tail), so trust-before-import holds for this leg
149
- * too: a global tool the user explicitly authored is fail-closed on a
150
- * missing/incompatible manifest, never a silent skip.
151
- *
152
- * @throws {PluginIncompatibleError} when the tool has no conformant sidecar
153
- * manifest or is compatibility-incompatible.
154
- */
155
- export declare function admitUserGlobalTool(args: {
156
- readonly dir: string;
157
- }): AuthoredAdmission;
158
- /**
159
- * Discover + admit + register AUTHORED Tool sidecars from the two authored
160
- * roots, then dynamic-import each admitted runtime through the shared
161
- * `importToolRuntime` seam — the same admit → import → register path the
162
- * bundled and installed legs travel (ADR-0027; this is the leg that makes the
163
- * dormant {@link admitProjectLocalTool} live).
164
- *
165
- * Two roots, two trust postures:
166
- * - **global** (`~/.opensip-cli/tools/`) → {@link admitUserGlobalTool},
167
- * trusted-by-default.
168
- * - **project** (`<project>/opensip-cli/tools/`) → {@link admitProjectLocalTool},
169
- * deny-by-default (allowlist via `OPENSIP_CLI_ALLOW_PROJECT_TOOLS`).
170
- *
171
- * Global is processed FIRST so a project-authored tool cannot shadow a same-id
172
- * global one — matching the `~/.opensip-cli/plugins` precedence note in
173
- * {@link buildToolDiscoverySources} (first-writer-wins via the registry).
174
- * `builtInIds` are skipped so an authored tool never shadows a bundled one.
175
- *
176
- * **Trust-before-import.** For each candidate, the admit step (which EMBEDS the
177
- * trust decision — deny-by-default inside `admitProjectLocalTool`) runs to
178
- * completion BEFORE `importToolRuntime`. A non-allowlisted project tool THROWS
179
- * `PluginIncompatibleError` (exit 5) here, propagated out of the walk: it must
180
- * fail the run loudly — that is the clone-protection contract.
181
- *
182
- * **Error-posture asymmetry (deliberate).** An un-allowlisted *project* tool is
183
- * fail-closed by policy (clone-risk; the user must opt in). A *global* tool that
184
- * fails to load is also fail-closed (the user explicitly authored it into
185
- * `$HOME`). This differs from the *installed* npm leg, where a stray bad plugin
186
- * skips-with-diagnostic so it can't take fit/graph/sim down — authored tools are
187
- * first-party-intent, installed tools are ambient.
188
- *
189
- * @param registry The per-invocation tool registry to populate.
190
- * @param opts.projectAuthoredDir `resolveProjectPaths(root).authoredToolsDir`,
191
- * or `undefined` when there is no resolvable project context.
192
- * @param opts.globalAuthoredDir `resolveUserPaths().authoredToolsDir`.
193
- * @param opts.env Environment carrying the project allowlist (default
194
- * `process.env`); injectable for tests.
195
- * @param builtInIds Bundled-tool ids to skip on a name collision.
196
- * @param provenance Sink for admitted authored tools' provenance records.
197
- * @param manifests Sink for admitted authored tools' manifests (§5.3).
198
- * @throws {PluginIncompatibleError} for an un-allowlisted project tool, or any
199
- * authored tool whose sidecar/runtime is missing/incompatible (fail-closed).
200
- */
201
- export declare function discoverAndRegisterAuthoredTools(registry: ToolRegistry, opts: {
202
- readonly projectAuthoredDir?: string;
203
- readonly globalAuthoredDir: string;
204
- readonly env?: NodeJS.ProcessEnv;
205
- }, builtInIds: ReadonlySet<string>, provenance?: ToolProvenance[], manifests?: ToolPluginManifest[]): Promise<void>;
206
- /**
207
- * Walk the registry and mount each tool's commands onto `program`. This is
208
- * **step 8** of the tool lifecycle (launch, §5.4) — see
209
- * {@link runToolLifecycle}.
210
- *
211
- * Public launch: there is ONE command surface — the tool's declared `commandSpecs`,
212
- * mounted by `mountCommandSpec`. `register()` and the raw-Commander `program`
213
- * handle on the tool context are gone, so the host owns `program` and passes it
214
- * in here (the tool never touches Commander). A tool with no `commandSpecs` is a
215
- * mis-declaration: it contributes no commands, surfaced loudly via
216
- * `cli.tool.no_command_surface`.
217
- *
218
- * Failures are isolated per tool — one tool whose spec fails to mount must not
219
- * take the whole CLI down. The failure is logged + stderr-warned, then we
220
- * continue with the next tool.
221
- *
222
- * @param registry The per-invocation tool registry to walk.
223
- * @param program The root Commander program (host-owned; the composition root
224
- * passes it — it is no longer reachable through the tool context, §8).
225
- * @param ctx The per-invocation handler context (render/emit/scope — no program).
226
- */
227
- export declare function mountAllToolCommands(registry: ToolRegistry, program: CliProgram, ctx: ToolCliContext): void;
13
+ export { BUNDLED_TOOL_PACKAGES, EXPECTED_SCAFFOLDING_TOOL_IDS } from './register-tools-shared.js';
14
+ export { registerFirstPartyTools } from './register-tools-bundled.js';
15
+ export { type DiscoveryOptions, buildToolDiscoverySources, discoverAndRegisterToolPackages, type AuthoredAdmission, admitProjectLocalTool, admitUserGlobalTool, discoverAndRegisterAuthoredTools, } from './register-tools-discovery.js';
16
+ export { mountAllToolCommands } from './register-tools-mount.js';
228
17
  //# sourceMappingURL=register-tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register-tools.d.ts","sourceRoot":"","sources":["../../src/bootstrap/register-tools.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAaL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,YAAY,EAElB,MAAM,mBAAmB,CAAC;AAe3B;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAIlD,CAAC;AAKF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,6BAA6B,EAAE,SAAS,MAAM,EAA8B,CAAC;AA6E1F;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,YAAY,EACtB,UAAU,GAAE,cAAc,EAAO,EACjC,SAAS,GAAE,kBAAkB,EAAO,EACpC,QAAQ,GAAE,SAAS,MAAM,EAA0B,GAClD,OAAO,CAAC,IAAI,CAAC,CAwCf;AA8DD,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAClD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,GACpB,mBAAmB,EAAE,CAqBvB;AAiHD,wBAAsB,+BAA+B,CACnD,QAAQ,EAAE,YAAY,EACtB,I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