@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/dist/src/contracts.d.ts
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import type { ConfigSlot, DeploymentEffect,
|
|
2
|
-
export type DeploymentIntent = "install" | "configure" | "upgrade" | "uninstall" | "repair";
|
|
3
|
-
export interface ModuleTarget {
|
|
4
|
-
moduleRef: string;
|
|
5
|
-
targetVersion?: string;
|
|
6
|
-
config?: Record<string, string>;
|
|
7
|
-
}
|
|
1
|
+
import type { ConfigSlot, DeploymentEffect, ModuleDescriptor, ModuleRequirement } from "@tomflow/proflow-module-contract";
|
|
8
2
|
export interface ResolvedModule {
|
|
9
3
|
moduleRef: string;
|
|
10
4
|
packageName: string;
|
|
11
5
|
moduleVersion: string;
|
|
12
|
-
kind: ModuleDescriptor["kind"]
|
|
13
|
-
|
|
14
|
-
identity?: ModuleDescriptor["identity"];
|
|
6
|
+
kind: ModuleDescriptor["kind"];
|
|
7
|
+
identity: ModuleDescriptor["identity"];
|
|
15
8
|
documentation: ModuleDescriptor["documentation"];
|
|
16
9
|
provides: ModuleDescriptor["provides"];
|
|
17
10
|
requires: ModuleDescriptor["requires"];
|
|
@@ -21,93 +14,7 @@ export interface ResolvedModule {
|
|
|
21
14
|
verification: ModuleDescriptor["verification"];
|
|
22
15
|
effects: DeploymentEffect[];
|
|
23
16
|
source: {
|
|
24
|
-
type: "workspace" | "installed"
|
|
17
|
+
type: "workspace" | "installed";
|
|
25
18
|
path?: string;
|
|
26
19
|
};
|
|
27
20
|
}
|
|
28
|
-
export interface DeploymentStep {
|
|
29
|
-
stepRef: string;
|
|
30
|
-
moduleRef: string;
|
|
31
|
-
kind: "config" | "package" | "lifecycle" | "external-resource" | "human";
|
|
32
|
-
preconditions: string[];
|
|
33
|
-
expectedEffect: string;
|
|
34
|
-
checkStrategy: string;
|
|
35
|
-
executeStrategy?: string;
|
|
36
|
-
postcondition: string;
|
|
37
|
-
}
|
|
38
|
-
export interface VerificationStep {
|
|
39
|
-
moduleRef: string;
|
|
40
|
-
checks: string[];
|
|
41
|
-
}
|
|
42
|
-
export interface DeploymentPlan {
|
|
43
|
-
planRef: string;
|
|
44
|
-
intent: DeploymentIntent;
|
|
45
|
-
moduleTargets: ModuleTarget[];
|
|
46
|
-
resolvedModules: ResolvedModule[];
|
|
47
|
-
targetDescriptors?: ModuleDescriptor[];
|
|
48
|
-
steps: DeploymentStep[];
|
|
49
|
-
effects: DeploymentEffect[];
|
|
50
|
-
humanActions: HumanAction[];
|
|
51
|
-
verification: VerificationStep[];
|
|
52
|
-
fingerprint: string;
|
|
53
|
-
createdAt: string;
|
|
54
|
-
}
|
|
55
|
-
export interface VerificationRecord {
|
|
56
|
-
verificationRef: string;
|
|
57
|
-
moduleRef: string;
|
|
58
|
-
moduleVersion: string;
|
|
59
|
-
resourceIdentity?: string;
|
|
60
|
-
resourceVersion?: string;
|
|
61
|
-
result: "PASS" | "FAIL";
|
|
62
|
-
summary: string;
|
|
63
|
-
evidenceRefs: string[];
|
|
64
|
-
verifiedAt: string;
|
|
65
|
-
}
|
|
66
|
-
export type PlatformState = "READY" | "DEGRADED" | "ACTION_REQUIRED" | "NOT_READY";
|
|
67
|
-
export interface SelectedModuleFact {
|
|
68
|
-
moduleRef: string;
|
|
69
|
-
moduleVersion: string;
|
|
70
|
-
}
|
|
71
|
-
export interface DeploymentState {
|
|
72
|
-
contract: "proflow.deployment-state.v1";
|
|
73
|
-
selectedModules: SelectedModuleFact[];
|
|
74
|
-
lastAppliedPlans: {
|
|
75
|
-
planRef: string;
|
|
76
|
-
intent: DeploymentIntent;
|
|
77
|
-
appliedAt: string;
|
|
78
|
-
}[];
|
|
79
|
-
verificationIndex: {
|
|
80
|
-
moduleRef: string;
|
|
81
|
-
latestRef: string;
|
|
82
|
-
}[];
|
|
83
|
-
pendingActions: PendingActionRecord[];
|
|
84
|
-
updatedAt: string;
|
|
85
|
-
}
|
|
86
|
-
export interface PendingActionRecord {
|
|
87
|
-
planRef: string;
|
|
88
|
-
stepRef: string;
|
|
89
|
-
moduleRef: string;
|
|
90
|
-
action: string;
|
|
91
|
-
description?: string;
|
|
92
|
-
createdAt: string;
|
|
93
|
-
}
|
|
94
|
-
export interface LockRecord {
|
|
95
|
-
pid: number;
|
|
96
|
-
createdAt: string;
|
|
97
|
-
planRef: string;
|
|
98
|
-
workspaceFingerprint: string;
|
|
99
|
-
}
|
|
100
|
-
export type ApplyStepStatus = "SKIP" | "EXECUTED" | "ACTION_REQUIRED" | "FAILED";
|
|
101
|
-
export interface ApplyStepResult {
|
|
102
|
-
stepRef: string;
|
|
103
|
-
moduleRef: string;
|
|
104
|
-
status: ApplyStepStatus;
|
|
105
|
-
message: string;
|
|
106
|
-
}
|
|
107
|
-
export type ApplyOutcome = "COMPLETE" | "ACTION_REQUIRED" | "FAILED" | "BLOCKED";
|
|
108
|
-
export interface ApplyResult {
|
|
109
|
-
planRef: string;
|
|
110
|
-
outcome: ApplyOutcome;
|
|
111
|
-
stepResults: ApplyStepResult[];
|
|
112
|
-
completedAt: string;
|
|
113
|
-
}
|
|
@@ -90,7 +90,6 @@ function toResolvedModule(descriptor, source) {
|
|
|
90
90
|
packageName: descriptor.packageName,
|
|
91
91
|
moduleVersion: descriptor.moduleVersion,
|
|
92
92
|
kind: descriptor.kind,
|
|
93
|
-
installClass: descriptor.installClass,
|
|
94
93
|
identity: descriptor.identity,
|
|
95
94
|
documentation: descriptor.documentation,
|
|
96
95
|
provides: descriptor.provides,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ConfigSlot, type ModuleProvide, type ModuleRequire } from "@tomflow/proflow-module-contract";
|
|
2
|
+
import type { ResolvedModule } from "../contracts.ts";
|
|
3
|
+
import type { ModuleCatalog } from "../modules.ts";
|
|
4
|
+
export interface AggregatedDocument {
|
|
5
|
+
id: string;
|
|
6
|
+
path: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
content: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AggregatedModuleDocs {
|
|
11
|
+
moduleRef: string;
|
|
12
|
+
version: string;
|
|
13
|
+
provides: ModuleProvide[];
|
|
14
|
+
requires: ModuleRequire[];
|
|
15
|
+
configSlots: ConfigSlot[];
|
|
16
|
+
documents: AggregatedDocument[];
|
|
17
|
+
}
|
|
18
|
+
export declare function aggregateModuleDocs(workspaceRoot: string, catalog: ModuleCatalog, modules: readonly ResolvedModule[]): Promise<AggregatedModuleDocs[]>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { parseModuleDescriptor, } from "@tomflow/proflow-module-contract";
|
|
2
|
+
import { readModuleDocument } from "./docs.js";
|
|
3
|
+
function sourceOf(module) {
|
|
4
|
+
return module.source.path === undefined
|
|
5
|
+
? { type: module.source.type, packageName: module.packageName }
|
|
6
|
+
: {
|
|
7
|
+
type: module.source.type,
|
|
8
|
+
packageName: module.packageName,
|
|
9
|
+
path: module.source.path,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export async function aggregateModuleDocs(workspaceRoot, catalog, modules) {
|
|
13
|
+
const output = [];
|
|
14
|
+
for (const module of [...modules].sort((a, b) => a.moduleRef.localeCompare(b.moduleRef))) {
|
|
15
|
+
const source = sourceOf(module);
|
|
16
|
+
const descriptor = parseModuleDescriptor(await catalog.loadDescriptor(source));
|
|
17
|
+
const documents = [];
|
|
18
|
+
for (const entry of descriptor.documentation) {
|
|
19
|
+
const document = await readModuleDocument({
|
|
20
|
+
workspaceRoot,
|
|
21
|
+
source,
|
|
22
|
+
descriptor,
|
|
23
|
+
documentId: entry.id,
|
|
24
|
+
});
|
|
25
|
+
documents.push({
|
|
26
|
+
id: document.documentId,
|
|
27
|
+
path: document.path,
|
|
28
|
+
...(document.description === undefined
|
|
29
|
+
? {}
|
|
30
|
+
: { description: document.description }),
|
|
31
|
+
content: document.content,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
output.push({
|
|
35
|
+
moduleRef: module.moduleRef,
|
|
36
|
+
version: module.moduleVersion,
|
|
37
|
+
provides: [...descriptor.provides],
|
|
38
|
+
requires: [...descriptor.requires],
|
|
39
|
+
configSlots: [...descriptor.configSlots],
|
|
40
|
+
documents,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return output;
|
|
44
|
+
}
|
package/dist/src/docs/docs.d.ts
CHANGED
|
@@ -1,31 +1,5 @@
|
|
|
1
1
|
import type { ModuleDescriptor } from "@tomflow/proflow-module-contract";
|
|
2
2
|
import type { ModuleSource } from "../modules.ts";
|
|
3
|
-
export interface PublishedCommand {
|
|
4
|
-
name: string;
|
|
5
|
-
target: string;
|
|
6
|
-
}
|
|
7
|
-
export interface PublicApiEntry {
|
|
8
|
-
subpath: string;
|
|
9
|
-
target?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface ModuleDocsView {
|
|
12
|
-
moduleRef: string;
|
|
13
|
-
packageName: string;
|
|
14
|
-
moduleVersion: string;
|
|
15
|
-
kind: ModuleDescriptor["kind"];
|
|
16
|
-
installClass: ModuleDescriptor["installClass"];
|
|
17
|
-
identity: ModuleDescriptor["identity"];
|
|
18
|
-
commands: PublishedCommand[];
|
|
19
|
-
publicApiEntries: PublicApiEntry[];
|
|
20
|
-
provides: ModuleDescriptor["provides"];
|
|
21
|
-
requires: ModuleDescriptor["requires"];
|
|
22
|
-
requirements: ModuleDescriptor["requirements"];
|
|
23
|
-
configSlots: ModuleDescriptor["configSlots"];
|
|
24
|
-
lifecycle: ModuleDescriptor["lifecycle"]["supported"];
|
|
25
|
-
verification: ModuleDescriptor["verification"];
|
|
26
|
-
effects: ModuleDescriptor["effects"];
|
|
27
|
-
documentation: ModuleDescriptor["documentation"];
|
|
28
|
-
}
|
|
29
3
|
export interface ModuleDocumentContent {
|
|
30
4
|
moduleRef: string;
|
|
31
5
|
packageName: string;
|
|
@@ -34,11 +8,6 @@ export interface ModuleDocumentContent {
|
|
|
34
8
|
description?: string;
|
|
35
9
|
content: string;
|
|
36
10
|
}
|
|
37
|
-
export declare function describeModule(input: {
|
|
38
|
-
workspaceRoot: string;
|
|
39
|
-
source: ModuleSource;
|
|
40
|
-
descriptor: ModuleDescriptor;
|
|
41
|
-
}): Promise<ModuleDocsView>;
|
|
42
11
|
export declare function readModuleDocument(input: {
|
|
43
12
|
workspaceRoot: string;
|
|
44
13
|
source: ModuleSource;
|
package/dist/src/docs/docs.js
CHANGED
|
@@ -3,33 +3,6 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
import { dirname, join, resolve, sep } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { PlatformError } from "../errors.js";
|
|
6
|
-
function executableName(packageName) {
|
|
7
|
-
return packageName.split("/").pop() ?? packageName;
|
|
8
|
-
}
|
|
9
|
-
function commandsFrom(manifest, packageName) {
|
|
10
|
-
if (typeof manifest.bin === "string") {
|
|
11
|
-
return [{ name: executableName(packageName), target: manifest.bin }];
|
|
12
|
-
}
|
|
13
|
-
if (typeof manifest.bin !== "object" || manifest.bin === null)
|
|
14
|
-
return [];
|
|
15
|
-
return Object.entries(manifest.bin)
|
|
16
|
-
.flatMap(([name, target]) => typeof target === "string" ? [{ name, target }] : [])
|
|
17
|
-
.sort((left, right) => left.name.localeCompare(right.name));
|
|
18
|
-
}
|
|
19
|
-
function publicApiEntriesFrom(manifest) {
|
|
20
|
-
if (typeof manifest.exports === "string") {
|
|
21
|
-
return [{ subpath: ".", target: manifest.exports }];
|
|
22
|
-
}
|
|
23
|
-
if (typeof manifest.exports !== "object" || manifest.exports === null)
|
|
24
|
-
return [];
|
|
25
|
-
return Object.entries(manifest.exports)
|
|
26
|
-
.filter(([subpath]) => subpath.startsWith("."))
|
|
27
|
-
.map(([subpath, target]) => ({
|
|
28
|
-
subpath,
|
|
29
|
-
...(typeof target === "string" ? { target } : {}),
|
|
30
|
-
}))
|
|
31
|
-
.sort((left, right) => left.subpath.localeCompare(right.subpath));
|
|
32
|
-
}
|
|
33
6
|
async function packageRootFor(workspaceRoot, source) {
|
|
34
7
|
if (source.type === "workspace") {
|
|
35
8
|
if (source.path === undefined) {
|
|
@@ -62,40 +35,6 @@ async function packageRootFor(workspaceRoot, source) {
|
|
|
62
35
|
}
|
|
63
36
|
throw new PlatformError("DESCRIPTOR_INVALID", `package root not found for ${source.packageName}`);
|
|
64
37
|
}
|
|
65
|
-
async function readManifest(packageRoot, packageName) {
|
|
66
|
-
try {
|
|
67
|
-
const manifest = JSON.parse(await readFile(join(packageRoot, "package.json"), "utf8"));
|
|
68
|
-
if (manifest.name !== packageName) {
|
|
69
|
-
throw new Error(`expected package ${packageName}`);
|
|
70
|
-
}
|
|
71
|
-
return manifest;
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
throw new PlatformError("DESCRIPTOR_INVALID", `invalid package metadata for ${packageName}: ${error instanceof Error ? error.message : String(error)}`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
export async function describeModule(input) {
|
|
78
|
-
const packageRoot = await packageRootFor(input.workspaceRoot, input.source);
|
|
79
|
-
const manifest = await readManifest(packageRoot, input.descriptor.packageName);
|
|
80
|
-
return {
|
|
81
|
-
moduleRef: input.descriptor.moduleRef,
|
|
82
|
-
packageName: input.descriptor.packageName,
|
|
83
|
-
moduleVersion: input.descriptor.moduleVersion,
|
|
84
|
-
kind: input.descriptor.kind,
|
|
85
|
-
installClass: input.descriptor.installClass,
|
|
86
|
-
identity: input.descriptor.identity,
|
|
87
|
-
commands: commandsFrom(manifest, input.descriptor.packageName),
|
|
88
|
-
publicApiEntries: publicApiEntriesFrom(manifest),
|
|
89
|
-
provides: input.descriptor.provides,
|
|
90
|
-
requires: input.descriptor.requires,
|
|
91
|
-
requirements: input.descriptor.requirements,
|
|
92
|
-
configSlots: input.descriptor.configSlots,
|
|
93
|
-
lifecycle: input.descriptor.lifecycle.supported,
|
|
94
|
-
verification: input.descriptor.verification,
|
|
95
|
-
effects: input.descriptor.effects,
|
|
96
|
-
documentation: input.descriptor.documentation,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
38
|
export async function readModuleDocument(input) {
|
|
100
39
|
const entry = input.descriptor.documentation.find((candidate) => candidate.id === input.documentId);
|
|
101
40
|
if (entry === undefined) {
|
package/dist/src/docs/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type { AggregatedDocument, AggregatedModuleDocs, } from "./aggregate.ts";
|
|
2
|
+
export { aggregateModuleDocs } from "./aggregate.ts";
|
package/dist/src/docs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { aggregateModuleDocs } from "./aggregate.js";
|
package/dist/src/errors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const platformErrorCodes: readonly ["INVALID_REQUEST", "DESCRIPTOR_INVALID", "DUPLICATE_IDENTITY", "DEPENDENCY_UNRESOLVED", "DEPENDENCY_INCOMPATIBLE", "DEPENDENCY_CYCLE", "
|
|
1
|
+
export declare const platformErrorCodes: readonly ["INVALID_REQUEST", "DESCRIPTOR_INVALID", "DUPLICATE_IDENTITY", "DEPENDENCY_UNRESOLVED", "DEPENDENCY_INCOMPATIBLE", "DEPENDENCY_CYCLE", "CONFIG_INVALID", "WORKSPACE_NOT_FOUND", "WORKSPACE_INSTANCE_INVALID", "PACKAGE_MANAGER_UNSUPPORTED", "PACKAGE_MANAGER_CONFLICT", "PACKAGE_MANAGER_UNAVAILABLE", "LIFECYCLE_UNSUPPORTED", "UNINSTALL_FAILED", "REGISTRY_UNAVAILABLE", "REGISTRY_AUTH_REQUIRED", "REGISTRY_RESPONSE_INVALID", "PACKAGE_NOT_FOUND", "PACKAGE_NOT_PROFLOW", "COMMAND_FAILED"];
|
|
2
2
|
export type PlatformErrorCode = (typeof platformErrorCodes)[number];
|
|
3
3
|
export declare class PlatformError extends Error {
|
|
4
4
|
readonly code: PlatformErrorCode;
|
package/dist/src/errors.js
CHANGED
|
@@ -5,32 +5,14 @@ export const platformErrorCodes = [
|
|
|
5
5
|
"DEPENDENCY_UNRESOLVED",
|
|
6
6
|
"DEPENDENCY_INCOMPATIBLE",
|
|
7
7
|
"DEPENDENCY_CYCLE",
|
|
8
|
-
"CONFIG_MISSING",
|
|
9
8
|
"CONFIG_INVALID",
|
|
10
|
-
"SECRET_REF_INVALID",
|
|
11
|
-
"PLAN_STALE",
|
|
12
|
-
"PLAN_NOT_FOUND",
|
|
13
|
-
"PLAN_INVALID",
|
|
14
|
-
"WORKSPACE_LOCKED",
|
|
15
9
|
"WORKSPACE_NOT_FOUND",
|
|
16
|
-
"WORKSPACE_NOT_WRITABLE",
|
|
17
|
-
"WORKSPACE_NOT_BOUND",
|
|
18
|
-
"WORKSPACE_ALREADY_BOUND",
|
|
19
|
-
"BOUND_WORKSPACE_MISSING",
|
|
20
10
|
"WORKSPACE_INSTANCE_INVALID",
|
|
21
|
-
"GLOBAL_BINDING_INVALID",
|
|
22
|
-
"GLOBAL_BINDING_LOCKED",
|
|
23
|
-
"GLOBAL_OPERATION_LOCKED",
|
|
24
11
|
"PACKAGE_MANAGER_UNSUPPORTED",
|
|
25
12
|
"PACKAGE_MANAGER_CONFLICT",
|
|
26
13
|
"PACKAGE_MANAGER_UNAVAILABLE",
|
|
27
14
|
"LIFECYCLE_UNSUPPORTED",
|
|
28
|
-
"SECRET_LEAK",
|
|
29
|
-
"APPLY_FAILED",
|
|
30
|
-
"UPGRADE_FAILED",
|
|
31
|
-
"CORE_PACKAGE_REQUIRED",
|
|
32
15
|
"UNINSTALL_FAILED",
|
|
33
|
-
"VERIFY_FAILED",
|
|
34
16
|
"REGISTRY_UNAVAILABLE",
|
|
35
17
|
"REGISTRY_AUTH_REQUIRED",
|
|
36
18
|
"REGISTRY_RESPONSE_INVALID",
|
|
@@ -11,13 +11,10 @@ export interface DependencyGraph {
|
|
|
11
11
|
edges: DependencyEdge[];
|
|
12
12
|
order: string[];
|
|
13
13
|
}
|
|
14
|
-
export interface GraphOptions {
|
|
15
|
-
config?: Record<string, Record<string, string>>;
|
|
16
|
-
}
|
|
17
14
|
export declare class ModuleRefUnresolvedError extends Error {
|
|
18
15
|
readonly code: "MODULE_REF_UNRESOLVED";
|
|
19
16
|
readonly from: string;
|
|
20
17
|
readonly target: string;
|
|
21
18
|
constructor(from: string, target: string, message: string);
|
|
22
19
|
}
|
|
23
|
-
export declare function buildDependencyGraph(modules: readonly ResolvedModule[]
|
|
20
|
+
export declare function buildDependencyGraph(modules: readonly ResolvedModule[]): DependencyGraph;
|
package/dist/src/graph/graph.js
CHANGED
|
@@ -14,9 +14,8 @@ export class ModuleRefUnresolvedError extends Error {
|
|
|
14
14
|
function compareRef(a, b) {
|
|
15
15
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
16
16
|
}
|
|
17
|
-
export function buildDependencyGraph(modules
|
|
17
|
+
export function buildDependencyGraph(modules) {
|
|
18
18
|
const nodes = [...new Set(modules.map((module) => module.moduleRef))].sort(compareRef);
|
|
19
|
-
const nodeSet = new Set(nodes);
|
|
20
19
|
const providersByContract = new Map();
|
|
21
20
|
for (const module of modules) {
|
|
22
21
|
for (const provide of module.provides) {
|
|
@@ -39,17 +38,6 @@ export function buildDependencyGraph(modules, options = {}) {
|
|
|
39
38
|
};
|
|
40
39
|
const sorted = [...modules].sort((a, b) => compareRef(a.moduleRef, b.moduleRef));
|
|
41
40
|
for (const module of sorted) {
|
|
42
|
-
for (const slot of module.configSlots) {
|
|
43
|
-
if (slot.type !== "moduleRef")
|
|
44
|
-
continue;
|
|
45
|
-
const effective = options.config?.[module.moduleRef]?.[slot.key] ?? slot.default;
|
|
46
|
-
if (typeof effective !== "string")
|
|
47
|
-
continue;
|
|
48
|
-
if (!nodeSet.has(effective)) {
|
|
49
|
-
throw new ModuleRefUnresolvedError(module.moduleRef, effective, `moduleRef binding ${slot.key}=${effective} for ${module.moduleRef} does not resolve to a selected module`);
|
|
50
|
-
}
|
|
51
|
-
addEdge(module.moduleRef, effective, "moduleRef");
|
|
52
|
-
}
|
|
53
41
|
for (const requirement of module.requires) {
|
|
54
42
|
const candidates = providersByContract.get(requirement.contractRef) ?? [];
|
|
55
43
|
const matching = candidates
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { DependencyEdge, DependencyEdgeKind, DependencyGraph,
|
|
2
|
-
export { buildDependencyGraph
|
|
1
|
+
export type { DependencyEdge, DependencyEdgeKind, DependencyGraph, } from "./graph.ts";
|
|
2
|
+
export { buildDependencyGraph } from "./graph.ts";
|
package/dist/src/graph/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { buildDependencyGraph
|
|
1
|
+
export { buildDependencyGraph } from "./graph.js";
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,28 +1,8 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
export {
|
|
3
|
-
export type { CliOutcome, CliStatus } from "./cli.ts";
|
|
4
|
-
export { runCli } from "./cli.ts";
|
|
5
|
-
export type { DeploymentIntent, DeploymentPlan, DeploymentState, DeploymentStep, ModuleTarget, PlatformState, ResolvedModule, VerificationRecord, VerificationStep, } from "./contracts.ts";
|
|
1
|
+
export type { CliOutcome, CliRuntimeOptions, CliStatus, } from "./cli.ts";
|
|
2
|
+
export { renderHumanResult, runCli } from "./cli.ts";
|
|
6
3
|
export { AutoModuleCatalog, discoverModules } from "./discovery/discover.ts";
|
|
7
|
-
export type {
|
|
8
|
-
export {
|
|
9
|
-
export { doctorModule, doctorModules } from "./doctor/index.ts";
|
|
4
|
+
export type { AggregatedDocument, AggregatedModuleDocs, } from "./docs/aggregate.ts";
|
|
5
|
+
export { aggregateModuleDocs } from "./docs/aggregate.ts";
|
|
10
6
|
export type { PlatformErrorCode } from "./errors.ts";
|
|
11
7
|
export { PlatformError } from "./errors.ts";
|
|
12
|
-
export { generateInstallDoc, preflightInstallerEnvironment, renderInstallDoc, } from "./install/index.ts";
|
|
13
|
-
export { dispatchLifecycle, restartModules, startModules, statusModules, stopModules, } from "./lifecycle/index.ts";
|
|
14
|
-
export { buildManifest, MANIFEST_CONTRACT } from "./manifest/index.ts";
|
|
15
8
|
export type { ModuleCatalog, ModuleSource } from "./modules.ts";
|
|
16
|
-
export { versionSatisfies } from "./modules.ts";
|
|
17
|
-
export type { WorkspacePaths } from "./paths.ts";
|
|
18
|
-
export { atomicWrite, workspacePaths } from "./paths.ts";
|
|
19
|
-
export { appendVerification, emptyDeploymentState, listPlans, loadConfig, loadDeploymentState, loadLatestVerification, loadPlan, loadVerificationHistory, materializeConfig, saveDeploymentState, savePlan, writeInstallDoc, } from "./persistence/index.ts";
|
|
20
|
-
export { assessUpgrade, CheckStrategy, checkPlanStale, computeFingerprint, ExecuteStrategy, evaluateStepCheck, planDeployment, planRepair, planUpgrade, repairFactCodes, } from "./planner/index.ts";
|
|
21
|
-
export type { PlanInput } from "./planner/plan.ts";
|
|
22
|
-
export type { PreflightResult } from "./preflight/findings.ts";
|
|
23
|
-
export { runPreflight } from "./preflight/preflight.ts";
|
|
24
|
-
export { assessPlatformReady } from "./ready/index.ts";
|
|
25
|
-
export type { RegistryDiscoveryResult, RegistryModuleCandidate, RegistryRejectedPackage, } from "./registry/index.ts";
|
|
26
|
-
export { discoverRegistryModules } from "./registry/index.ts";
|
|
27
|
-
export { acquireWorkspaceLock, readWorkspaceLock, redactDeep, redactPlanSecrets, redactSecretValues, SECRET_REDACTED, workspaceLockPath, } from "./security/index.ts";
|
|
28
|
-
export { verifyModule, verifyModules } from "./verification/index.ts";
|
package/dist/src/index.js
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { runCli } from "./cli.js";
|
|
1
|
+
export { renderHumanResult, runCli } from "./cli.js";
|
|
3
2
|
export { AutoModuleCatalog, discoverModules } from "./discovery/discover.js";
|
|
4
|
-
export {
|
|
5
|
-
export { doctorModule, doctorModules } from "./doctor/index.js";
|
|
3
|
+
export { aggregateModuleDocs } from "./docs/aggregate.js";
|
|
6
4
|
export { PlatformError } from "./errors.js";
|
|
7
|
-
export { generateInstallDoc, preflightInstallerEnvironment, renderInstallDoc, } from "./install/index.js";
|
|
8
|
-
export { dispatchLifecycle, restartModules, startModules, statusModules, stopModules, } from "./lifecycle/index.js";
|
|
9
|
-
export { buildManifest, MANIFEST_CONTRACT } from "./manifest/index.js";
|
|
10
|
-
export { versionSatisfies } from "./modules.js";
|
|
11
|
-
export { atomicWrite, workspacePaths } from "./paths.js";
|
|
12
|
-
export { appendVerification, emptyDeploymentState, listPlans, loadConfig, loadDeploymentState, loadLatestVerification, loadPlan, loadVerificationHistory, materializeConfig, saveDeploymentState, savePlan, writeInstallDoc, } from "./persistence/index.js";
|
|
13
|
-
export { assessUpgrade, CheckStrategy, checkPlanStale, computeFingerprint, ExecuteStrategy, evaluateStepCheck, planDeployment, planRepair, planUpgrade, repairFactCodes, } from "./planner/index.js";
|
|
14
|
-
export { runPreflight } from "./preflight/preflight.js";
|
|
15
|
-
export { assessPlatformReady } from "./ready/index.js";
|
|
16
|
-
export { discoverRegistryModules } from "./registry/index.js";
|
|
17
|
-
export { acquireWorkspaceLock, readWorkspaceLock, redactDeep, redactPlanSecrets, redactSecretValues, SECRET_REDACTED, workspaceLockPath, } from "./security/index.js";
|
|
18
|
-
export { verifyModule, verifyModules } from "./verification/index.js";
|
|
@@ -11,3 +11,24 @@ export interface PackageCommandRunner {
|
|
|
11
11
|
export declare function systemPackageCommandRunner(): PackageCommandRunner;
|
|
12
12
|
export declare function readWorkspacePackageManagerSelection(workspaceRoot: string): Promise<WorkspacePackageManagerSelection>;
|
|
13
13
|
export declare function findExecutable(command: string): boolean;
|
|
14
|
+
export interface WorkspacePackageTarget {
|
|
15
|
+
packageName: string;
|
|
16
|
+
version: string;
|
|
17
|
+
}
|
|
18
|
+
export interface WorkspacePackageMutationResult {
|
|
19
|
+
packageManager: SupportedWorkspacePackageManager;
|
|
20
|
+
packages: string[];
|
|
21
|
+
}
|
|
22
|
+
export declare function syncWorkspacePackages(options: {
|
|
23
|
+
workspaceRoot: string;
|
|
24
|
+
packages: readonly WorkspacePackageTarget[];
|
|
25
|
+
runner?: PackageCommandRunner;
|
|
26
|
+
executableAvailable?: (command: string) => boolean;
|
|
27
|
+
}): Promise<WorkspacePackageMutationResult>;
|
|
28
|
+
export declare function removeWorkspacePackages(options: {
|
|
29
|
+
workspaceRoot: string;
|
|
30
|
+
packageNames: readonly string[];
|
|
31
|
+
runner?: PackageCommandRunner;
|
|
32
|
+
executableAvailable?: (command: string) => boolean;
|
|
33
|
+
}): Promise<WorkspacePackageMutationResult>;
|
|
34
|
+
export declare function observeWorkspaceInstalledVersion(workspaceRoot: string, packageName: string): Promise<string | undefined>;
|
|
@@ -4,6 +4,7 @@ import { access, readFile } from "node:fs/promises";
|
|
|
4
4
|
import { delimiter, join } from "node:path";
|
|
5
5
|
import { promisify } from "node:util";
|
|
6
6
|
import { PlatformError } from "../errors.js";
|
|
7
|
+
import { atomicWrite } from "../paths.js";
|
|
7
8
|
const execFileAsync = promisify(execFile);
|
|
8
9
|
export function systemPackageCommandRunner() {
|
|
9
10
|
return {
|
|
@@ -112,3 +113,155 @@ function isMissingFile(error) {
|
|
|
112
113
|
function errorMessage(error) {
|
|
113
114
|
return error instanceof Error ? error.message : String(error);
|
|
114
115
|
}
|
|
116
|
+
export async function syncWorkspacePackages(options) {
|
|
117
|
+
if (options.packages.length === 0) {
|
|
118
|
+
return { packageManager: "npm", packages: [] };
|
|
119
|
+
}
|
|
120
|
+
await ensureWorkspaceManifest(options.workspaceRoot);
|
|
121
|
+
const runner = options.runner ?? systemPackageCommandRunner();
|
|
122
|
+
const manager = await requireWorkspacePackageManager(options.workspaceRoot, options.executableAvailable ?? findExecutable);
|
|
123
|
+
const targets = [...options.packages].sort((a, b) => a.packageName.localeCompare(b.packageName));
|
|
124
|
+
const specs = targets.map((item) => `${item.packageName}@${item.version}`);
|
|
125
|
+
await writeManagedPackageSet(options.workspaceRoot, targets);
|
|
126
|
+
const args = await packageManagerInstallArgs(runner, manager, options.workspaceRoot);
|
|
127
|
+
try {
|
|
128
|
+
await runner.run(manager.name, args, options.workspaceRoot);
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
throw new PlatformError("COMMAND_FAILED", `${manager.name} install failed: ${packageMutationError(error)}`);
|
|
132
|
+
}
|
|
133
|
+
return { packageManager: manager.name, packages: specs };
|
|
134
|
+
}
|
|
135
|
+
async function writeManagedPackageSet(workspaceRoot, targets) {
|
|
136
|
+
const path = join(workspaceRoot, "package.json");
|
|
137
|
+
const parsed = JSON.parse(await readFile(path, "utf8"));
|
|
138
|
+
if (!isRecord(parsed)) {
|
|
139
|
+
throw new PlatformError("INVALID_REQUEST", "workspace package.json root must be an object");
|
|
140
|
+
}
|
|
141
|
+
const dependencies = isRecord(parsed.dependencies)
|
|
142
|
+
? { ...parsed.dependencies }
|
|
143
|
+
: {};
|
|
144
|
+
const devDependencies = isRecord(parsed.devDependencies)
|
|
145
|
+
? { ...parsed.devDependencies }
|
|
146
|
+
: {};
|
|
147
|
+
for (const record of [dependencies, devDependencies]) {
|
|
148
|
+
for (const name of Object.keys(record)) {
|
|
149
|
+
if (name.startsWith("@tomflow/proflow-"))
|
|
150
|
+
delete record[name];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
for (const target of targets)
|
|
154
|
+
dependencies[target.packageName] = target.version;
|
|
155
|
+
const next = { ...parsed, dependencies };
|
|
156
|
+
if ("devDependencies" in parsed || Object.keys(devDependencies).length > 0) {
|
|
157
|
+
next.devDependencies = devDependencies;
|
|
158
|
+
}
|
|
159
|
+
await atomicWrite(path, `${JSON.stringify(next, null, 2)}\n`);
|
|
160
|
+
}
|
|
161
|
+
async function packageManagerInstallArgs(runner, manager, workspaceRoot) {
|
|
162
|
+
if (manager.name === "pnpm")
|
|
163
|
+
return ["install", "--ignore-scripts"];
|
|
164
|
+
if (manager.name === "npm")
|
|
165
|
+
return ["install", "--ignore-scripts"];
|
|
166
|
+
const major = await batchYarnMajorVersion(runner, manager, workspaceRoot);
|
|
167
|
+
return major <= 1
|
|
168
|
+
? ["install", "--ignore-scripts"]
|
|
169
|
+
: ["install", "--mode=skip-build"];
|
|
170
|
+
}
|
|
171
|
+
export async function removeWorkspacePackages(options) {
|
|
172
|
+
const packageNames = [...new Set(options.packageNames)].sort();
|
|
173
|
+
if (packageNames.length === 0) {
|
|
174
|
+
return { packageManager: "npm", packages: [] };
|
|
175
|
+
}
|
|
176
|
+
const runner = options.runner ?? systemPackageCommandRunner();
|
|
177
|
+
const manager = await requireWorkspacePackageManager(options.workspaceRoot, options.executableAvailable ?? findExecutable);
|
|
178
|
+
const args = await batchPackageManagerArgs(runner, manager, options.workspaceRoot, "remove", packageNames);
|
|
179
|
+
try {
|
|
180
|
+
await runner.run(manager.name, args, options.workspaceRoot);
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
throw new PlatformError("UNINSTALL_FAILED", `${manager.name} remove failed: ${packageMutationError(error)}`);
|
|
184
|
+
}
|
|
185
|
+
return { packageManager: manager.name, packages: packageNames };
|
|
186
|
+
}
|
|
187
|
+
export async function observeWorkspaceInstalledVersion(workspaceRoot, packageName) {
|
|
188
|
+
try {
|
|
189
|
+
const raw = await readFile(join(workspaceRoot, "node_modules", ...packageName.split("/"), "package.json"), "utf8");
|
|
190
|
+
const parsed = JSON.parse(raw);
|
|
191
|
+
if (!isRecord(parsed) ||
|
|
192
|
+
parsed.name !== packageName ||
|
|
193
|
+
typeof parsed.version !== "string") {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
return parsed.version;
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
return undefined;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
async function ensureWorkspaceManifest(workspaceRoot) {
|
|
203
|
+
const path = join(workspaceRoot, "package.json");
|
|
204
|
+
try {
|
|
205
|
+
const raw = await readFile(path, "utf8");
|
|
206
|
+
const parsed = JSON.parse(raw);
|
|
207
|
+
if (!isRecord(parsed))
|
|
208
|
+
throw new Error("package.json root must be an object");
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
if (!isMissingFile(error)) {
|
|
213
|
+
throw new PlatformError("INVALID_REQUEST", `workspace package.json is invalid: ${errorMessage(error)}`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
await atomicWrite(path, `${JSON.stringify({ private: true }, null, 2)}\n`);
|
|
217
|
+
}
|
|
218
|
+
async function requireWorkspacePackageManager(workspaceRoot, executableAvailable) {
|
|
219
|
+
const manager = await readWorkspacePackageManagerSelection(workspaceRoot);
|
|
220
|
+
if (!executableAvailable(manager.name)) {
|
|
221
|
+
throw new PlatformError("PACKAGE_MANAGER_UNAVAILABLE", `workspace package manager ${manager.name} is not available on PATH`);
|
|
222
|
+
}
|
|
223
|
+
return manager;
|
|
224
|
+
}
|
|
225
|
+
async function batchPackageManagerArgs(runner, manager, workspaceRoot, operation, packages) {
|
|
226
|
+
if (manager.name === "pnpm") {
|
|
227
|
+
return operation === "remove"
|
|
228
|
+
? ["--config.ignore-scripts=true", "remove", ...packages]
|
|
229
|
+
: ["add", "--save-exact", "--ignore-scripts", ...packages];
|
|
230
|
+
}
|
|
231
|
+
if (manager.name === "npm") {
|
|
232
|
+
return operation === "remove"
|
|
233
|
+
? ["uninstall", "--ignore-scripts", ...packages]
|
|
234
|
+
: ["install", "--save-exact", "--ignore-scripts", ...packages];
|
|
235
|
+
}
|
|
236
|
+
const major = await batchYarnMajorVersion(runner, manager, workspaceRoot);
|
|
237
|
+
if (major <= 1) {
|
|
238
|
+
return operation === "remove"
|
|
239
|
+
? ["remove", "--ignore-scripts", ...packages]
|
|
240
|
+
: ["add", "--exact", "--ignore-scripts", ...packages];
|
|
241
|
+
}
|
|
242
|
+
return operation === "remove"
|
|
243
|
+
? ["remove", "--mode=skip-build", ...packages]
|
|
244
|
+
: ["add", "--exact", "--mode=skip-build", ...packages];
|
|
245
|
+
}
|
|
246
|
+
async function batchYarnMajorVersion(runner, manager, workspaceRoot) {
|
|
247
|
+
const declared = manager.declared;
|
|
248
|
+
const separator = declared?.lastIndexOf("@") ?? -1;
|
|
249
|
+
const declaredVersion = declared !== undefined && separator > 0
|
|
250
|
+
? declared.slice(separator + 1)
|
|
251
|
+
: undefined;
|
|
252
|
+
const value = declaredVersion ??
|
|
253
|
+
(await runner.run("yarn", ["--version"], workspaceRoot)).trim();
|
|
254
|
+
const major = Number.parseInt(value.split(".")[0] ?? "", 10);
|
|
255
|
+
if (!Number.isInteger(major) || major < 1) {
|
|
256
|
+
throw new PlatformError("PACKAGE_MANAGER_UNAVAILABLE", `cannot determine a supported Yarn major version from ${value || "<empty>"}`);
|
|
257
|
+
}
|
|
258
|
+
return major;
|
|
259
|
+
}
|
|
260
|
+
function packageMutationError(error) {
|
|
261
|
+
if (isRecord(error) &&
|
|
262
|
+
typeof error.stderr === "string" &&
|
|
263
|
+
error.stderr.trim() !== "") {
|
|
264
|
+
return error.stderr.trim();
|
|
265
|
+
}
|
|
266
|
+
return errorMessage(error);
|
|
267
|
+
}
|