@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
@@ -1,33 +0,0 @@
1
- import type { ModuleOperationResult } from "@tomflow/proflow-module-contract";
2
- import type { ResolvedModule, VerificationRecord } from "../contracts.ts";
3
- import type { ModuleCatalog } from "../modules.ts";
4
- import type { WorkspacePaths } from "../paths.ts";
5
- export interface VerifyResult {
6
- moduleRef: string;
7
- record: VerificationRecord;
8
- result: ModuleOperationResult;
9
- observedEffects: string[];
10
- }
11
- /**
12
- * Derives a stable verificationRef from the record's own identity fields. It is
13
- * deterministic (no randomness) yet unique per verification event, because the
14
- * recorded `verifiedAt` timestamp is part of the canonical input.
15
- */
16
- export declare function verificationRefOf(record: Omit<VerificationRecord, "verificationRef">): string;
17
- /**
18
- * Fingerprints the identity-defining config of an external resource. Key order
19
- * is normalized so the fingerprint is stable regardless of insertion order.
20
- */
21
- export declare function configFingerprint(values: Record<string, string>, secretRefs?: readonly string[]): string;
22
- /**
23
- * Verifies a single module by dispatching its public `verify` primitive through
24
- * the lifecycle boundary, then appending a Version Verification Record. The
25
- * verdict always comes from the live adapter result, never from persisted
26
- * history. Records are appended, never overwritten.
27
- */
28
- export declare function verifyModule(catalog: ModuleCatalog, module: ResolvedModule, paths: WorkspacePaths): Promise<VerifyResult>;
29
- /**
30
- * Verifies every module that declares the `verify` primitive; modules without
31
- * it are skipped (the descriptor is the truth for what is verifiable).
32
- */
33
- export declare function verifyModules(catalog: ModuleCatalog, modules: readonly ResolvedModule[], paths: WorkspacePaths): Promise<VerifyResult[]>;
@@ -1,114 +0,0 @@
1
- import { createHash } from "node:crypto";
2
- import { dispatchLifecycle } from "../lifecycle/index.js";
3
- import { appendVerification, loadConfig } from "../persistence/index.js";
4
- /**
5
- * Derives a stable verificationRef from the record's own identity fields. It is
6
- * deterministic (no randomness) yet unique per verification event, because the
7
- * recorded `verifiedAt` timestamp is part of the canonical input.
8
- */
9
- export function verificationRefOf(record) {
10
- const canonical = JSON.stringify([
11
- record.moduleRef,
12
- record.moduleVersion,
13
- record.resourceIdentity ?? null,
14
- record.resourceVersion ?? null,
15
- record.result,
16
- record.verifiedAt,
17
- ]);
18
- const digest = createHash("sha256").update(canonical).digest("hex");
19
- return `verify-${record.moduleRef}-${digest.slice(0, 16)}`;
20
- }
21
- /**
22
- * Fingerprints the identity-defining config of an external resource. Key order
23
- * is normalized so the fingerprint is stable regardless of insertion order.
24
- */
25
- export function configFingerprint(values, secretRefs = []) {
26
- const entries = [
27
- ...Object.entries(values)
28
- .sort(([left], [right]) => left.localeCompare(right))
29
- .map(([key, value]) => `${key}=${value}`),
30
- ...[...secretRefs].sort().map((key) => `secretRef=${key}`),
31
- ];
32
- const digest = createHash("sha256").update(entries.join("\n")).digest("hex");
33
- return `fp-${digest.slice(0, 16)}`;
34
- }
35
- // A verification record is a binary verdict: only an explicit SUCCEEDED maps to
36
- // PASS. BLOCKED / ACTION_REQUIRED / FAILED are all recorded as FAIL so a pending
37
- // human action or blocked dependency can never masquerade as a passing verify.
38
- function verdictOf(status) {
39
- return status === "SUCCEEDED" ? "PASS" : "FAIL";
40
- }
41
- function summaryOf(result) {
42
- if (result.status === "SUCCEEDED") {
43
- const checks = result.checks ?? [];
44
- if (checks.length === 0)
45
- return "verify succeeded";
46
- const passed = checks.filter((check) => check.status === "PASS").length;
47
- return `verify succeeded (${passed}/${checks.length} checks passed)`;
48
- }
49
- if (result.status === "ACTION_REQUIRED" &&
50
- result.actionRequired !== undefined) {
51
- return `action required: ${result.actionRequired.action} — ${result.actionRequired.description}`;
52
- }
53
- if (result.error !== undefined) {
54
- return `${result.error.code}: ${result.error.message}`;
55
- }
56
- return `verify ${result.status.toLowerCase()}`;
57
- }
58
- function evidenceRefsOf(result) {
59
- return (result.checks ?? []).map((check) => `check:${check.id}:${check.status}`);
60
- }
61
- /**
62
- * Verifies a single module by dispatching its public `verify` primitive through
63
- * the lifecycle boundary, then appending a Version Verification Record. The
64
- * verdict always comes from the live adapter result, never from persisted
65
- * history. Records are appended, never overwritten.
66
- */
67
- export async function verifyModule(catalog, module, paths) {
68
- const dispatched = await dispatchLifecycle(catalog, module, "verify");
69
- const result = dispatched.result;
70
- let resourceIdentity;
71
- let resourceVersion;
72
- if (module.kind === "external-resource") {
73
- const config = await loadConfig(paths, module.moduleRef);
74
- const secretRefs = module.configSlots
75
- .filter((slot) => slot.type === "secretRef")
76
- .map((slot) => slot.key);
77
- resourceIdentity = configFingerprint(config?.publicValues ?? {}, secretRefs);
78
- resourceVersion = result.resourceVersion;
79
- }
80
- const base = {
81
- moduleRef: module.moduleRef,
82
- moduleVersion: module.moduleVersion,
83
- result: verdictOf(result.status),
84
- summary: summaryOf(result),
85
- evidenceRefs: evidenceRefsOf(result),
86
- verifiedAt: new Date().toISOString(),
87
- ...(resourceIdentity !== undefined ? { resourceIdentity } : {}),
88
- ...(resourceVersion !== undefined ? { resourceVersion } : {}),
89
- };
90
- const record = {
91
- ...base,
92
- verificationRef: verificationRefOf(base),
93
- };
94
- await appendVerification(paths, record);
95
- return {
96
- moduleRef: module.moduleRef,
97
- record,
98
- result,
99
- observedEffects: dispatched.observedEffects,
100
- };
101
- }
102
- /**
103
- * Verifies every module that declares the `verify` primitive; modules without
104
- * it are skipped (the descriptor is the truth for what is verifiable).
105
- */
106
- export async function verifyModules(catalog, modules, paths) {
107
- const results = [];
108
- for (const module of modules) {
109
- if (!module.lifecycle.includes("verify"))
110
- continue;
111
- results.push(await verifyModule(catalog, module, paths));
112
- }
113
- return results;
114
- }