@tomflow/proflow-platform-cli 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -43
- package/dist/deployment/adapter.d.ts +5 -5
- package/dist/deployment/adapter.js +2 -1
- package/dist/deployment/descriptor.d.ts +2 -3
- package/dist/deployment/descriptor.js +2 -3
- package/dist/src/binding/production-bindings.d.ts +17 -15
- package/dist/src/binding/production-bindings.js +18 -59
- package/dist/src/cli.d.ts +7 -9
- package/dist/src/cli.js +327 -1316
- package/dist/src/contracts.d.ts +4 -97
- package/dist/src/discovery/discover.js +0 -1
- package/dist/src/docs/aggregate.d.ts +18 -0
- package/dist/src/docs/aggregate.js +44 -0
- package/dist/src/docs/docs.d.ts +0 -31
- package/dist/src/docs/docs.js +0 -61
- package/dist/src/docs/index.d.ts +2 -1
- package/dist/src/docs/index.js +1 -1
- package/dist/src/errors.d.ts +1 -1
- package/dist/src/errors.js +0 -18
- package/dist/src/graph/graph.d.ts +1 -4
- package/dist/src/graph/graph.js +1 -13
- package/dist/src/graph/index.d.ts +2 -2
- package/dist/src/graph/index.js +1 -1
- package/dist/src/index.d.ts +4 -24
- package/dist/src/index.js +2 -16
- package/dist/src/install/package-manager.d.ts +21 -0
- package/dist/src/install/package-manager.js +153 -0
- package/dist/src/lifecycle/dispatch.d.ts +0 -31
- package/dist/src/lifecycle/dispatch.js +0 -125
- package/dist/src/lifecycle/index.d.ts +4 -3
- package/dist/src/lifecycle/index.js +2 -2
- package/dist/src/lifecycle/thin.d.ts +11 -0
- package/dist/src/lifecycle/thin.js +68 -0
- package/dist/src/paths.d.ts +0 -14
- package/dist/src/paths.js +0 -39
- package/dist/src/persistence/config.d.ts +0 -6
- package/dist/src/persistence/config.js +0 -14
- package/dist/src/persistence/guards.d.ts +0 -6
- package/dist/src/persistence/guards.js +0 -114
- package/dist/src/persistence/index.d.ts +4 -6
- package/dist/src/persistence/index.js +2 -5
- package/dist/src/persistence/workspace-metadata.d.ts +7 -0
- package/dist/src/persistence/workspace-metadata.js +39 -0
- package/dist/src/registry/index.d.ts +1 -1
- package/dist/src/registry/index.js +1 -1
- package/dist/src/registry/npm-registry.d.ts +0 -14
- package/dist/src/registry/npm-registry.js +1 -132
- package/package.json +2 -6
- package/proflow.module.json +2 -3
- package/CHANGELOG.md +0 -85
- package/dist/src/apply/apply.d.ts +0 -26
- package/dist/src/apply/apply.js +0 -314
- package/dist/src/apply/cleanup.d.ts +0 -12
- package/dist/src/apply/cleanup.js +0 -37
- package/dist/src/apply/current.d.ts +0 -5
- package/dist/src/apply/current.js +0 -95
- package/dist/src/apply/driver.d.ts +0 -28
- package/dist/src/apply/driver.js +0 -239
- package/dist/src/apply/execute.d.ts +0 -36
- package/dist/src/apply/execute.js +0 -152
- package/dist/src/apply/index.d.ts +0 -8
- package/dist/src/apply/index.js +0 -4
- package/dist/src/apply/reality.d.ts +0 -20
- package/dist/src/apply/reality.js +0 -105
- package/dist/src/binding/global-binding.d.ts +0 -69
- package/dist/src/binding/global-binding.js +0 -349
- package/dist/src/doctor/doctor.d.ts +0 -41
- package/dist/src/doctor/doctor.js +0 -80
- package/dist/src/doctor/index.d.ts +0 -2
- package/dist/src/doctor/index.js +0 -1
- package/dist/src/install/bootstrap.d.ts +0 -10
- package/dist/src/install/bootstrap.js +0 -79
- package/dist/src/install/environment.d.ts +0 -30
- package/dist/src/install/environment.js +0 -230
- package/dist/src/install/index.d.ts +0 -6
- package/dist/src/install/index.js +0 -3
- package/dist/src/install/install.d.ts +0 -19
- package/dist/src/install/install.js +0 -172
- package/dist/src/lifecycle/service-process.d.ts +0 -11
- package/dist/src/lifecycle/service-process.js +0 -356
- package/dist/src/manifest/index.d.ts +0 -2
- package/dist/src/manifest/index.js +0 -1
- package/dist/src/manifest/manifest.d.ts +0 -61
- package/dist/src/manifest/manifest.js +0 -167
- package/dist/src/observer/deployment-summary.d.ts +0 -31
- package/dist/src/observer/deployment-summary.js +0 -34
- package/dist/src/persistence/atomic.d.ts +0 -2
- package/dist/src/persistence/atomic.js +0 -16
- package/dist/src/persistence/effective-config.d.ts +0 -3
- package/dist/src/persistence/effective-config.js +0 -20
- package/dist/src/persistence/generated.d.ts +0 -2
- package/dist/src/persistence/generated.js +0 -4
- package/dist/src/persistence/plans.d.ts +0 -5
- package/dist/src/persistence/plans.js +0 -34
- package/dist/src/persistence/state.d.ts +0 -7
- package/dist/src/persistence/state.js +0 -34
- package/dist/src/persistence/verification.d.ts +0 -5
- package/dist/src/persistence/verification.js +0 -47
- package/dist/src/planner/assemble.d.ts +0 -16
- package/dist/src/planner/assemble.js +0 -107
- package/dist/src/planner/check.d.ts +0 -20
- package/dist/src/planner/check.js +0 -107
- package/dist/src/planner/fingerprint.d.ts +0 -12
- package/dist/src/planner/fingerprint.js +0 -164
- package/dist/src/planner/index.d.ts +0 -13
- package/dist/src/planner/index.js +0 -7
- package/dist/src/planner/plan.d.ts +0 -15
- package/dist/src/planner/plan.js +0 -144
- package/dist/src/planner/repair.d.ts +0 -28
- package/dist/src/planner/repair.js +0 -131
- package/dist/src/planner/stale.d.ts +0 -7
- package/dist/src/planner/stale.js +0 -23
- package/dist/src/planner/steps.d.ts +0 -37
- package/dist/src/planner/steps.js +0 -165
- package/dist/src/planner/target-catalog.d.ts +0 -13
- package/dist/src/planner/target-catalog.js +0 -48
- package/dist/src/planner/upgrade.d.ts +0 -18
- package/dist/src/planner/upgrade.js +0 -114
- package/dist/src/preflight/config.d.ts +0 -11
- package/dist/src/preflight/config.js +0 -88
- package/dist/src/preflight/findings.d.ts +0 -26
- package/dist/src/preflight/findings.js +0 -1
- package/dist/src/preflight/index.d.ts +0 -7
- package/dist/src/preflight/index.js +0 -3
- package/dist/src/preflight/preflight.d.ts +0 -10
- package/dist/src/preflight/preflight.js +0 -190
- package/dist/src/preflight/requirements.d.ts +0 -11
- package/dist/src/preflight/requirements.js +0 -231
- package/dist/src/ready/index.d.ts +0 -2
- package/dist/src/ready/index.js +0 -1
- package/dist/src/ready/ready.d.ts +0 -40
- package/dist/src/ready/ready.js +0 -201
- package/dist/src/security/index.d.ts +0 -3
- package/dist/src/security/index.js +0 -2
- package/dist/src/security/lock.d.ts +0 -9
- package/dist/src/security/lock.js +0 -127
- package/dist/src/security/redact.d.ts +0 -6
- package/dist/src/security/redact.js +0 -48
- package/dist/src/verification/index.d.ts +0 -2
- package/dist/src/verification/index.js +0 -1
- package/dist/src/verification/verify.d.ts +0 -33
- 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
|
-
|
|
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
|
-
##
|
|
5
|
+
## Frozen CLI
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
```bash
|
|
8
|
+
platform modules
|
|
9
|
+
platform docs
|
|
10
|
+
platform install
|
|
11
|
+
platform uninstall
|
|
12
|
+
platform start
|
|
13
|
+
platform stop
|
|
14
|
+
```
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
Removed top-level commands: `search`, `plan`, `apply`, `upgrade`, `preflight`, `restart`, `status`, `verify`, `doctor`, `manifest`.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
## Ownership
|
|
18
19
|
|
|
19
20
|
```text
|
|
20
|
-
|
|
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
|
-
|
|
26
|
+
## Workspace
|
|
24
27
|
|
|
25
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
62
|
+
## Boundary
|
|
51
63
|
|
|
52
|
-
|
|
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.
|
|
8
|
+
moduleVersion: "0.1.15";
|
|
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.
|
|
19
|
+
moduleVersion: "0.1.15";
|
|
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.
|
|
30
|
+
moduleVersion: "0.1.15";
|
|
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.
|
|
41
|
+
moduleVersion: "0.1.15";
|
|
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.
|
|
52
|
+
moduleVersion: "0.1.15";
|
|
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(
|
|
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.
|
|
6
|
+
readonly moduleVersion: "0.1.15";
|
|
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: "
|
|
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.
|
|
6
|
+
moduleVersion: "0.1.15",
|
|
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: "
|
|
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,
|
|
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 {
|
|
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
|
|
43
|
-
*
|
|
44
|
-
*
|
|
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
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
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:
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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;
|