@tomflow/proflow-platform-cli 0.1.14 → 0.1.16

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 (142) hide show
  1. package/README.md +48 -43
  2. package/dist/deployment/adapter.d.ts +5 -5
  3. package/dist/deployment/adapter.js +2 -1
  4. package/dist/deployment/descriptor.d.ts +2 -3
  5. package/dist/deployment/descriptor.js +2 -3
  6. package/dist/src/binding/production-bindings.d.ts +17 -15
  7. package/dist/src/binding/production-bindings.js +18 -59
  8. package/dist/src/cli.d.ts +7 -9
  9. package/dist/src/cli.js +327 -1316
  10. package/dist/src/contracts.d.ts +4 -97
  11. package/dist/src/discovery/discover.js +0 -1
  12. package/dist/src/docs/aggregate.d.ts +18 -0
  13. package/dist/src/docs/aggregate.js +44 -0
  14. package/dist/src/docs/docs.d.ts +0 -31
  15. package/dist/src/docs/docs.js +0 -61
  16. package/dist/src/docs/index.d.ts +2 -1
  17. package/dist/src/docs/index.js +1 -1
  18. package/dist/src/errors.d.ts +1 -1
  19. package/dist/src/errors.js +0 -18
  20. package/dist/src/graph/graph.d.ts +1 -4
  21. package/dist/src/graph/graph.js +1 -13
  22. package/dist/src/graph/index.d.ts +2 -2
  23. package/dist/src/graph/index.js +1 -1
  24. package/dist/src/index.d.ts +4 -24
  25. package/dist/src/index.js +2 -16
  26. package/dist/src/install/package-manager.d.ts +21 -0
  27. package/dist/src/install/package-manager.js +153 -0
  28. package/dist/src/lifecycle/dispatch.d.ts +0 -31
  29. package/dist/src/lifecycle/dispatch.js +0 -125
  30. package/dist/src/lifecycle/index.d.ts +4 -3
  31. package/dist/src/lifecycle/index.js +2 -2
  32. package/dist/src/lifecycle/thin.d.ts +11 -0
  33. package/dist/src/lifecycle/thin.js +68 -0
  34. package/dist/src/paths.d.ts +0 -14
  35. package/dist/src/paths.js +0 -39
  36. package/dist/src/persistence/config.d.ts +0 -6
  37. package/dist/src/persistence/config.js +0 -14
  38. package/dist/src/persistence/guards.d.ts +0 -6
  39. package/dist/src/persistence/guards.js +0 -114
  40. package/dist/src/persistence/index.d.ts +4 -6
  41. package/dist/src/persistence/index.js +2 -5
  42. package/dist/src/persistence/workspace-metadata.d.ts +7 -0
  43. package/dist/src/persistence/workspace-metadata.js +39 -0
  44. package/dist/src/registry/index.d.ts +1 -1
  45. package/dist/src/registry/index.js +1 -1
  46. package/dist/src/registry/npm-registry.d.ts +0 -14
  47. package/dist/src/registry/npm-registry.js +1 -132
  48. package/package.json +5 -9
  49. package/proflow.module.json +2 -3
  50. package/CHANGELOG.md +0 -85
  51. package/dist/src/apply/apply.d.ts +0 -26
  52. package/dist/src/apply/apply.js +0 -314
  53. package/dist/src/apply/cleanup.d.ts +0 -12
  54. package/dist/src/apply/cleanup.js +0 -37
  55. package/dist/src/apply/current.d.ts +0 -5
  56. package/dist/src/apply/current.js +0 -95
  57. package/dist/src/apply/driver.d.ts +0 -28
  58. package/dist/src/apply/driver.js +0 -239
  59. package/dist/src/apply/execute.d.ts +0 -36
  60. package/dist/src/apply/execute.js +0 -152
  61. package/dist/src/apply/index.d.ts +0 -8
  62. package/dist/src/apply/index.js +0 -4
  63. package/dist/src/apply/reality.d.ts +0 -20
  64. package/dist/src/apply/reality.js +0 -105
  65. package/dist/src/binding/global-binding.d.ts +0 -69
  66. package/dist/src/binding/global-binding.js +0 -349
  67. package/dist/src/doctor/doctor.d.ts +0 -41
  68. package/dist/src/doctor/doctor.js +0 -80
  69. package/dist/src/doctor/index.d.ts +0 -2
  70. package/dist/src/doctor/index.js +0 -1
  71. package/dist/src/install/bootstrap.d.ts +0 -10
  72. package/dist/src/install/bootstrap.js +0 -79
  73. package/dist/src/install/environment.d.ts +0 -30
  74. package/dist/src/install/environment.js +0 -230
  75. package/dist/src/install/index.d.ts +0 -6
  76. package/dist/src/install/index.js +0 -3
  77. package/dist/src/install/install.d.ts +0 -19
  78. package/dist/src/install/install.js +0 -172
  79. package/dist/src/lifecycle/service-process.d.ts +0 -11
  80. package/dist/src/lifecycle/service-process.js +0 -356
  81. package/dist/src/manifest/index.d.ts +0 -2
  82. package/dist/src/manifest/index.js +0 -1
  83. package/dist/src/manifest/manifest.d.ts +0 -61
  84. package/dist/src/manifest/manifest.js +0 -167
  85. package/dist/src/observer/deployment-summary.d.ts +0 -31
  86. package/dist/src/observer/deployment-summary.js +0 -34
  87. package/dist/src/persistence/atomic.d.ts +0 -2
  88. package/dist/src/persistence/atomic.js +0 -16
  89. package/dist/src/persistence/effective-config.d.ts +0 -3
  90. package/dist/src/persistence/effective-config.js +0 -20
  91. package/dist/src/persistence/generated.d.ts +0 -2
  92. package/dist/src/persistence/generated.js +0 -4
  93. package/dist/src/persistence/plans.d.ts +0 -5
  94. package/dist/src/persistence/plans.js +0 -34
  95. package/dist/src/persistence/state.d.ts +0 -7
  96. package/dist/src/persistence/state.js +0 -34
  97. package/dist/src/persistence/verification.d.ts +0 -5
  98. package/dist/src/persistence/verification.js +0 -47
  99. package/dist/src/planner/assemble.d.ts +0 -16
  100. package/dist/src/planner/assemble.js +0 -107
  101. package/dist/src/planner/check.d.ts +0 -20
  102. package/dist/src/planner/check.js +0 -107
  103. package/dist/src/planner/fingerprint.d.ts +0 -12
  104. package/dist/src/planner/fingerprint.js +0 -164
  105. package/dist/src/planner/index.d.ts +0 -13
  106. package/dist/src/planner/index.js +0 -7
  107. package/dist/src/planner/plan.d.ts +0 -15
  108. package/dist/src/planner/plan.js +0 -144
  109. package/dist/src/planner/repair.d.ts +0 -28
  110. package/dist/src/planner/repair.js +0 -131
  111. package/dist/src/planner/stale.d.ts +0 -7
  112. package/dist/src/planner/stale.js +0 -23
  113. package/dist/src/planner/steps.d.ts +0 -37
  114. package/dist/src/planner/steps.js +0 -165
  115. package/dist/src/planner/target-catalog.d.ts +0 -13
  116. package/dist/src/planner/target-catalog.js +0 -48
  117. package/dist/src/planner/upgrade.d.ts +0 -18
  118. package/dist/src/planner/upgrade.js +0 -114
  119. package/dist/src/preflight/config.d.ts +0 -11
  120. package/dist/src/preflight/config.js +0 -88
  121. package/dist/src/preflight/findings.d.ts +0 -26
  122. package/dist/src/preflight/findings.js +0 -1
  123. package/dist/src/preflight/index.d.ts +0 -7
  124. package/dist/src/preflight/index.js +0 -3
  125. package/dist/src/preflight/preflight.d.ts +0 -10
  126. package/dist/src/preflight/preflight.js +0 -190
  127. package/dist/src/preflight/requirements.d.ts +0 -11
  128. package/dist/src/preflight/requirements.js +0 -231
  129. package/dist/src/ready/index.d.ts +0 -2
  130. package/dist/src/ready/index.js +0 -1
  131. package/dist/src/ready/ready.d.ts +0 -40
  132. package/dist/src/ready/ready.js +0 -201
  133. package/dist/src/security/index.d.ts +0 -3
  134. package/dist/src/security/index.js +0 -2
  135. package/dist/src/security/lock.d.ts +0 -9
  136. package/dist/src/security/lock.js +0 -127
  137. package/dist/src/security/redact.d.ts +0 -6
  138. package/dist/src/security/redact.js +0 -48
  139. package/dist/src/verification/index.d.ts +0 -2
  140. package/dist/src/verification/index.js +0 -1
  141. package/dist/src/verification/verify.d.ts +0 -33
  142. package/dist/src/verification/verify.js +0 -114
package/README.md CHANGED
@@ -1,59 +1,64 @@
1
- # platform-cli
1
+ # @tomflow/proflow-platform-cli
2
2
 
3
- Domain Owner: deployment-governance
4
- Module Kind: cli
5
- Service: none
6
- Process: none
7
- Business Fact Owner: none
3
+ Deterministic Workspace-level CLI for ProFlow Platform installation, discovery, knowledge aggregation and lifecycle dispatch.
8
4
 
9
- ## Purpose
5
+ ## Frozen CLI
10
6
 
11
- The single platform-level deterministic Deployment planner/executor and v1 global `platform` control plane. It understands only the Module Contract and public lifecycle/verification contracts; it does not import other domains' business internals. The global CLI binary is distinct from the single bound Platform Instance.
12
-
13
- For the v1 Custom GPT carrier it may plan/verify Web-only setup, role-scoped Action auth/schema, File Bridge/Code Interpreter/Web Search requirements, `x-openai-isConsequential:false` + Always Allow target configuration, Chrome/runtime prerequisites and current verification freshness. It never creates/guesses Task `workerRef/c-id`, never uses exact ChatGPT model id as READY truth, and never accepts System Observer assessment as Deployment READY truth.
7
+ ```bash
8
+ platform modules
9
+ platform docs
10
+ platform install
11
+ platform uninstall
12
+ platform start
13
+ platform stop
14
+ ```
14
15
 
15
- ## Global CLI bootstrap
16
+ Removed top-level commands: `search`, `plan`, `apply`, `upgrade`, `preflight`, `restart`, `status`, `verify`, `doctor`, `manifest`.
16
17
 
17
- The v1 `platform` command is a Shell-global control plane. A straightforward bootstrap is:
18
+ ## Ownership
18
19
 
19
20
  ```text
20
- npm install --global @tomflow/proflow-platform-cli
21
+ Module / package owns logic and truth.
22
+ Platform CLI owns discovery, dispatch, aggregation and ordering.
23
+ Package manager owns npm dependency operations.
21
24
  ```
22
25
 
23
- This choice installs the global CLI only. It does **not** force the managed Workspace to use npm: a bound Workspace may independently use `npm`, `yarn`, or `pnpm`, selected from its own package-manager facts.
26
+ ## Workspace
24
27
 
25
- ## Commands
28
+ `platform install [--workspace <path>]` resolves the explicit workspace or `process.cwd()`. The other five commands operate on `process.cwd()` and do not depend on a global current-workspace binding.
26
29
 
30
+ `.proflow` is Workspace/user data and may survive uninstall/reinstall. `platform uninstall` removes ProFlow package dependencies only and never deletes `.proflow`.
31
+
32
+ ## Install
33
+
34
+ Install dynamically discovers the complete managed ProFlow package/version set from the private npm scope, synchronizes it in one package-manager transaction where possible, re-observes installed packages, validates descriptors, then initializes/reuses minimal Workspace-local metadata.
35
+
36
+ There is no Core package class, `installRequires`, install closure, Plan/Apply or independent Upgrade flow.
37
+
38
+ ## Modules
39
+
40
+ `platform modules` aggregates Module-owned status observations only:
41
+
42
+ ```text
43
+ moduleRef
44
+ version
45
+ configStatus: READY | INCOMPLETE | INVALID
46
+ missingConfig? # only when INCOMPLETE
47
+ runtimeStatus: RUNNING | STOPPED | FAILED | UNKNOWN
27
48
  ```
28
- platform search [package]
29
- platform modules [module|package]
30
- platform docs [module|package] [documentId]
31
- platform preflight [module]
32
- platform preflight --intent install
33
- platform install [package] [--workspace <path>]
34
- platform uninstall [module|package]
35
- platform upgrade [module|package]
36
- platform plan --intent install|configure|upgrade|uninstall|repair [options]
37
- platform apply <planRef>
38
- platform start [module]
39
- platform stop [module]
40
- platform restart [module]
41
- platform status [module]
42
- platform verify [module]
43
- platform doctor [module]
44
- platform manifest [module]
45
- ```
46
49
 
47
- `install` / `upgrade` / `uninstall` are AI-friendly high-level commands that reuse the same frozen Plan -> Apply engine. `search` reads the npm Registry installable world; `modules` reads the current Workspace managed world; `docs` mechanically aggregates package-owned Descriptor, npm `bin/exports`, and declared documentation without maintaining a second package-knowledge catalog. Package mutation is real Workspace package-manager mutation and is never satisfied by the historical no-op driver seam.
50
+ Platform does not infer private health/config/runtime facts.
51
+
52
+ ## Docs
53
+
54
+ `platform docs` aggregates each installed Module's `provides`, `requires`, `configSlots` and static documentation. It accepts no module/document positional argument.
55
+
56
+ ## Start / Stop
57
+
58
+ Start builds Runtime dependency order from `provides/requires`, dispatches all applicable Module validate/preflight first (fail-fast), then starts in dependency order (fail-fast). It does not rollback already-started Modules.
48
59
 
60
+ Stop dispatches Module stop in reverse dependency order and fails fast.
49
61
 
50
- ## v1 global workspace semantics
62
+ ## Boundary
51
63
 
52
- - The `platform` binary is installed globally and can be invoked from any shell directory.
53
- - At most one ProFlow Workspace may be bound globally at a time.
54
- - `platform install` targets the current working directory by default; `platform install --workspace <path>` explicitly selects the requested Workspace for Agent/automation use.
55
- - Requested Workspace paths are canonicalized before binding comparison. A second distinct Workspace is rejected with `WORKSPACE_ALREADY_BOUND` until the current Platform Instance is uninstalled.
56
- - `status/start/stop/restart/modules/docs/verify/doctor/upgrade/uninstall` resolve the durable global binding rather than the caller's cwd. `platform status` exposes the bound Workspace path.
57
- - `platform uninstall` without a module/package removes the current Platform Instance and clears its binding; it does not uninstall the global CLI package.
58
- - Whole-instance uninstall removes managed ProFlow modules plus Deployment-owned `.proflow/deployment` state (plans, deployment state, verification, and instance identity). Business/domain data outside `.proflow/deployment` is intentionally preserved. v1 has no purge mode, so ordinary uninstall never claims to delete preserved domain data.
59
- - Workspace package mutation is package-manager agnostic for v1: `npm`, `yarn`, and `pnpm` are supported. The CLI installation manager and the bound Workspace manager are independent facts.
64
+ The CLI must remain thin: new compliant Modules should become discoverable/observable/startable without adding module-specific business logic here.
@@ -5,7 +5,7 @@ export declare const behaviorAdapter: {
5
5
  ok: boolean;
6
6
  status: "SUCCEEDED";
7
7
  moduleRef: "platform-cli";
8
- moduleVersion: "0.1.14";
8
+ moduleVersion: "0.1.16";
9
9
  data?: {} | null;
10
10
  };
11
11
  observedEffects: never[];
@@ -16,7 +16,7 @@ export declare const behaviorAdapter: {
16
16
  ok: boolean;
17
17
  status: "SUCCEEDED";
18
18
  moduleRef: "platform-cli";
19
- moduleVersion: "0.1.14";
19
+ moduleVersion: "0.1.16";
20
20
  data?: {} | null;
21
21
  };
22
22
  observedEffects: never[];
@@ -27,7 +27,7 @@ export declare const behaviorAdapter: {
27
27
  ok: boolean;
28
28
  status: "SUCCEEDED";
29
29
  moduleRef: "platform-cli";
30
- moduleVersion: "0.1.14";
30
+ moduleVersion: "0.1.16";
31
31
  data?: {} | null;
32
32
  };
33
33
  observedEffects: never[];
@@ -38,7 +38,7 @@ export declare const behaviorAdapter: {
38
38
  ok: boolean;
39
39
  status: "SUCCEEDED";
40
40
  moduleRef: "platform-cli";
41
- moduleVersion: "0.1.14";
41
+ moduleVersion: "0.1.16";
42
42
  data?: {} | null;
43
43
  };
44
44
  observedEffects: never[];
@@ -49,7 +49,7 @@ export declare const behaviorAdapter: {
49
49
  ok: boolean;
50
50
  status: "SUCCEEDED";
51
51
  moduleRef: "platform-cli";
52
- moduleVersion: "0.1.14";
52
+ moduleVersion: "0.1.16";
53
53
  data?: {} | null;
54
54
  };
55
55
  observedEffects: never[];
@@ -1,3 +1,4 @@
1
+ import { observeDeclaredModuleStatus } from "@tomflow/proflow-module-contract";
1
2
  import { descriptor } from "./descriptor.js";
2
3
  const success = (data) => ({
3
4
  contract: "deployment.result.v1",
@@ -14,7 +15,7 @@ export const behaviorAdapter = {
14
15
  }),
15
16
  preflight: () => ({ result: success(), observedEffects: [] }),
16
17
  status: () => ({
17
- result: success({ runnable: true }),
18
+ result: success(observeDeclaredModuleStatus(descriptor, undefined, "UNKNOWN")),
18
19
  observedEffects: [],
19
20
  }),
20
21
  verify: () => ({
@@ -3,14 +3,13 @@ export declare const descriptor: {
3
3
  readonly contractVersion: "1.0.0";
4
4
  readonly moduleRef: "platform-cli";
5
5
  readonly packageName: "@tomflow/proflow-platform-cli";
6
- readonly moduleVersion: "0.1.14";
6
+ readonly moduleVersion: "0.1.16";
7
7
  readonly kind: "cli";
8
8
  readonly templateVersion: "1.0.0";
9
9
  readonly platformCompatibility: ">=1.0.0 <2.0.0";
10
- readonly installClass: "core";
11
10
  readonly identity: {
12
11
  readonly domain: "deployment-governance";
13
- readonly summary: "Deterministic platform-level deployment discovery, planning, lifecycle and verification CLI.";
12
+ readonly summary: "Thin Platform CLI for Module discovery, documentation, package synchronization and lifecycle orchestration.";
14
13
  };
15
14
  readonly provides: readonly [];
16
15
  readonly requires: readonly [];
@@ -3,14 +3,13 @@ export const descriptor = {
3
3
  contractVersion: "1.0.0",
4
4
  moduleRef: "platform-cli",
5
5
  packageName: "@tomflow/proflow-platform-cli",
6
- moduleVersion: "0.1.14",
6
+ moduleVersion: "0.1.16",
7
7
  kind: "cli",
8
8
  templateVersion: "1.0.0",
9
9
  platformCompatibility: ">=1.0.0 <2.0.0",
10
- installClass: "core",
11
10
  identity: {
12
11
  domain: "deployment-governance",
13
- summary: "Deterministic platform-level deployment discovery, planning, lifecycle and verification CLI.",
12
+ summary: "Thin Platform CLI for Module discovery, documentation, package synchronization and lifecycle orchestration.",
14
13
  },
15
14
  provides: [],
16
15
  requires: [],
@@ -2,7 +2,6 @@ import type { ResolvedModule } from "../contracts.ts";
2
2
  type ResolvedSource = ResolvedModule["source"];
3
3
  export interface DeploymentAdapterBinding {
4
4
  behaviorAdapter: Record<string, unknown>;
5
- materializeProductionConfig?: (...args: unknown[]) => unknown;
6
5
  }
7
6
  export type ProductionBindingFactory = (input: {
8
7
  moduleRef: string;
@@ -11,25 +10,28 @@ export type ProductionBindingFactory = (input: {
11
10
  modules: readonly ResolvedModule[];
12
11
  configByModuleRef: ReadonlyMap<string, Record<string, string>>;
13
12
  }) => Promise<DeploymentAdapterBinding | undefined> | DeploymentAdapterBinding | undefined;
14
- export type ServiceProcessBindingFactory = (input: {
15
- moduleRef: string;
16
- config: Record<string, string>;
17
- workspaceRoot: string;
18
- modules: readonly ResolvedModule[];
19
- configByModuleRef: ReadonlyMap<string, Record<string, string>>;
20
- }) => Promise<{
21
- serviceProcess: unknown;
22
- behaviorAdapter?: Record<string, unknown>;
23
- } | undefined> | {
24
- serviceProcess: unknown;
25
- behaviorAdapter?: Record<string, unknown>;
26
- } | undefined;
27
13
  export interface ProductionBindingOptions {
28
14
  workspaceRoot: string;
29
15
  modules: readonly ResolvedModule[];
30
- configByModuleRef: ReadonlyMap<string, Record<string, string>>;
16
+ configByModuleRef: ReadonlyMap<string, {
17
+ publicValues: Record<string, string>;
18
+ secretValues: Record<string, string>;
19
+ }>;
31
20
  importAdapter: (packageName: string, source: ResolvedSource) => Promise<Record<string, unknown>>;
32
21
  }
33
22
  export declare function importRawAdapter(packageName: string, source: ResolvedSource, workspaceRoot: string): Promise<Record<string, unknown>>;
23
+ /**
24
+ * The shipped Platform CLI production binding factory. For every discovered
25
+ * module it imports the module's own `deployment/adapter.ts` and, when that
26
+ * adapter exposes a `createProductionBinding` factory, invokes it with the
27
+ * module's materialized config to obtain a real bound adapter. A module without
28
+ * a production factory, or whose materialized config the adapter does not accept,
29
+ * is left out of the map. Import/factory exceptions are surfaced with module
30
+ * identity instead of being mistaken for ordinary unconfigured state. The
31
+ * catalog falls back to the module's unbound default only for explicit undefined
32
+ * bindings, which must fail-closed
33
+ * (ACTION_REQUIRED / NOT_READY). Platform CLI never invents a service or
34
+ * resource reality: it only relays the adapter's own current reality.
35
+ */
34
36
  export declare function buildProductionBindings(options: ProductionBindingOptions): Promise<ReadonlyMap<string, DeploymentAdapterBinding>>;
35
37
  export {};
@@ -9,19 +9,7 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
9
9
  import { createRequire } from "node:module";
10
10
  import { join } from "node:path";
11
11
  import { pathToFileURL } from "node:url";
12
- import { managedServiceStatus, restartManagedService, startManagedService, stopManagedService, } from "../lifecycle/service-process.js";
13
- import { workspacePaths } from "../paths.js";
14
- function managedServiceAdapter(workspaceRoot, module, serviceProcess, probeAdapter) {
15
- const paths = workspacePaths(workspaceRoot);
16
- return {
17
- ...probeAdapter,
18
- status: () => managedServiceStatus(paths, module),
19
- start: () => startManagedService(paths, module, serviceProcess),
20
- stop: () => stopManagedService(paths, module),
21
- restart: () => restartManagedService(paths, module, serviceProcess),
22
- uninstall: () => stopManagedService(paths, module),
23
- };
24
- }
12
+ import { PlatformError } from "../errors.js";
25
13
  export async function importRawAdapter(packageName, source, workspaceRoot) {
26
14
  if (source.type === "workspace") {
27
15
  if (source.path === undefined)
@@ -39,52 +27,27 @@ export async function importRawAdapter(packageName, source, workspaceRoot) {
39
27
  * module it imports the module's own `deployment/adapter.ts` and, when that
40
28
  * adapter exposes a `createProductionBinding` factory, invokes it with the
41
29
  * module's materialized config to obtain a real bound adapter. A module without
42
- * a production factory or whose import/factory fails, or which has no
43
- * materialized config the adapter accepts — is left out of the map, so the
44
- * catalog falls back to the module's unbound default, which must fail-closed
30
+ * a production factory, or whose materialized config the adapter does not accept,
31
+ * is left out of the map. Import/factory exceptions are surfaced with module
32
+ * identity instead of being mistaken for ordinary unconfigured state. The
33
+ * catalog falls back to the module's unbound default only for explicit undefined
34
+ * bindings, which must fail-closed
45
35
  * (ACTION_REQUIRED / NOT_READY). Platform CLI never invents a service or
46
36
  * resource reality: it only relays the adapter's own current reality.
47
37
  */
48
- function materializerBinding(namespace) {
49
- const materializer = namespace.materializeProductionConfig;
50
- return typeof materializer === "function"
51
- ? {
52
- materializeProductionConfig: materializer,
53
- }
54
- : {};
55
- }
56
38
  export async function buildProductionBindings(options) {
57
39
  const bindings = new Map();
40
+ const publicConfigByModuleRef = new Map([...options.configByModuleRef].map(([moduleRef, config]) => [
41
+ moduleRef,
42
+ { ...config.publicValues },
43
+ ]));
58
44
  for (const module of options.modules) {
59
45
  try {
60
46
  const namespace = await options.importAdapter(module.packageName, module.source);
61
- const config = options.configByModuleRef.get(module.moduleRef) ?? {};
62
- const serviceFactory = namespace.createServiceProcessBinding;
63
- if (module.kind === "service" && typeof serviceFactory === "function") {
64
- const processBinding = await serviceFactory({
65
- moduleRef: module.moduleRef,
66
- config,
67
- workspaceRoot: options.workspaceRoot,
68
- modules: options.modules,
69
- configByModuleRef: options.configByModuleRef,
70
- });
71
- if (processBinding !== undefined) {
72
- const defaultProbe = namespace
73
- .behaviorAdapter;
74
- const probeAdapter = processBinding.behaviorAdapter ??
75
- (typeof defaultProbe === "object" && defaultProbe !== null
76
- ? defaultProbe
77
- : {});
78
- bindings.set(module.packageName, {
79
- behaviorAdapter: managedServiceAdapter(options.workspaceRoot, module, processBinding.serviceProcess, probeAdapter),
80
- ...materializerBinding(namespace),
81
- });
82
- }
83
- // A formal service package that exposes the process seam must never fall
84
- // back to legacy in-memory production binding. Missing config remains
85
- // unbound and therefore fails closed.
86
- continue;
87
- }
47
+ const materialized = options.configByModuleRef.get(module.moduleRef);
48
+ const config = materialized === undefined
49
+ ? {}
50
+ : { ...materialized.publicValues, ...materialized.secretValues };
88
51
  const factory = namespace
89
52
  .createProductionBinding;
90
53
  if (typeof factory !== "function")
@@ -94,22 +57,18 @@ export async function buildProductionBindings(options) {
94
57
  config,
95
58
  workspaceRoot: options.workspaceRoot,
96
59
  modules: options.modules,
97
- configByModuleRef: options.configByModuleRef,
60
+ configByModuleRef: publicConfigByModuleRef,
98
61
  });
99
62
  if (binding !== undefined &&
100
63
  typeof binding === "object" &&
101
64
  binding !== null &&
102
65
  typeof binding.behaviorAdapter === "object" &&
103
66
  binding.behaviorAdapter !== null) {
104
- bindings.set(module.packageName, {
105
- ...binding,
106
- ...materializerBinding(namespace),
107
- });
67
+ bindings.set(module.packageName, binding);
108
68
  }
109
69
  }
110
- catch {
111
- // Import/factory failure for one module must not break the rest of the
112
- // CLI; that module simply remains unbound and fails closed when used.
70
+ catch (error) {
71
+ throw new PlatformError("COMMAND_FAILED", `production binding failed for ${module.moduleRef}: ${error instanceof Error ? error.message : String(error)}`);
113
72
  }
114
73
  }
115
74
  return bindings;
package/dist/src/cli.d.ts CHANGED
@@ -1,16 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { type GlobalWorkspaceBinding } from "./binding/global-binding.ts";
2
+ import { type PackageCommandRunner } from "./install/package-manager.ts";
3
+ import { type NpmCommandRunner } from "./registry/index.ts";
3
4
  export type CliStatus = "SUCCEEDED" | "ACTION_REQUIRED" | "BLOCKED" | "FAILED";
4
- export interface CliWorkspaceSummary {
5
- boundWorkspace: string;
6
- workspaceInstanceId: string;
7
- bindingState: GlobalWorkspaceBinding["state"];
8
- }
9
5
  export interface CliOutcome {
10
6
  command: string;
11
7
  status: CliStatus;
8
+ workspaceRoot?: string;
12
9
  data?: unknown;
13
- workspace?: CliWorkspaceSummary;
14
10
  error?: {
15
11
  code: string;
16
12
  message: string;
@@ -18,7 +14,9 @@ export interface CliOutcome {
18
14
  }
19
15
  export interface CliRuntimeOptions {
20
16
  cwd?: string;
21
- globalRoot?: string;
17
+ registryRunner?: NpmCommandRunner;
18
+ packageRunner?: PackageCommandRunner;
19
+ executableAvailable?: (command: string) => boolean;
22
20
  }
23
- export declare function renderHumanResult(machineOutput: string): string;
24
21
  export declare function runCli(argv: readonly string[], runtime?: CliRuntimeOptions): Promise<string>;
22
+ export declare function renderHumanResult(result: CliOutcome): string;