@lionden/plugin-deploy 0.1.0

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 (59) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +23 -0
  3. package/dist/deploy-task.d.ts +83 -0
  4. package/dist/deploy-task.d.ts.map +1 -0
  5. package/dist/deploy-task.js +599 -0
  6. package/dist/deploy-task.js.map +1 -0
  7. package/dist/deployment-manager.d.ts +80 -0
  8. package/dist/deployment-manager.d.ts.map +1 -0
  9. package/dist/deployment-manager.js +521 -0
  10. package/dist/deployment-manager.js.map +1 -0
  11. package/dist/deployment-state.d.ts +40 -0
  12. package/dist/deployment-state.d.ts.map +1 -0
  13. package/dist/deployment-state.js +204 -0
  14. package/dist/deployment-state.js.map +1 -0
  15. package/dist/deployment-types.d.ts +112 -0
  16. package/dist/deployment-types.d.ts.map +1 -0
  17. package/dist/deployment-types.js +9 -0
  18. package/dist/deployment-types.js.map +1 -0
  19. package/dist/errors.d.ts +7 -0
  20. package/dist/errors.d.ts.map +1 -0
  21. package/dist/errors.js +10 -0
  22. package/dist/errors.js.map +1 -0
  23. package/dist/index.d.ts +13 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +184 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/leo-sources.d.ts +11 -0
  28. package/dist/leo-sources.d.ts.map +1 -0
  29. package/dist/leo-sources.js +31 -0
  30. package/dist/leo-sources.js.map +1 -0
  31. package/dist/leo-version.d.ts +2 -0
  32. package/dist/leo-version.d.ts.map +1 -0
  33. package/dist/leo-version.js +10 -0
  34. package/dist/leo-version.js.map +1 -0
  35. package/dist/on-chain-check.d.ts +34 -0
  36. package/dist/on-chain-check.d.ts.map +1 -0
  37. package/dist/on-chain-check.js +84 -0
  38. package/dist/on-chain-check.js.map +1 -0
  39. package/dist/preflight.d.ts +94 -0
  40. package/dist/preflight.d.ts.map +1 -0
  41. package/dist/preflight.js +288 -0
  42. package/dist/preflight.js.map +1 -0
  43. package/dist/prove.d.ts +11 -0
  44. package/dist/prove.d.ts.map +1 -0
  45. package/dist/prove.js +19 -0
  46. package/dist/prove.js.map +1 -0
  47. package/dist/recipe-task.d.ts +18 -0
  48. package/dist/recipe-task.d.ts.map +1 -0
  49. package/dist/recipe-task.js +201 -0
  50. package/dist/recipe-task.js.map +1 -0
  51. package/dist/recipe-types.d.ts +95 -0
  52. package/dist/recipe-types.d.ts.map +1 -0
  53. package/dist/recipe-types.js +10 -0
  54. package/dist/recipe-types.js.map +1 -0
  55. package/dist/upgrade-task.d.ts +30 -0
  56. package/dist/upgrade-task.d.ts.map +1 -0
  57. package/dist/upgrade-task.js +315 -0
  58. package/dist/upgrade-task.js.map +1 -0
  59. package/package.json +39 -0
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Deployment state file I/O.
3
+ *
4
+ * Directory layout under `deploymentsDir`:
5
+ *
6
+ * ```
7
+ * deployments/<networkName>/
8
+ * .network.json # NetworkMetadata
9
+ * <programId>.json # DeploymentRecord (latest)
10
+ * <programId>.abi.json # ABI snapshot (for export)
11
+ * .history/<programId>/<historyCount>-<timestamp>.json # historical entries
12
+ * .pending/<programId>.json # crash recovery markers
13
+ * deployments/_exports/<networkName>.json # export bundles
14
+ * ```
15
+ *
16
+ * All writes use write-to-tmp + rename for atomicity.
17
+ */
18
+ import type { ProgramABI } from "@lionden/leo-compiler";
19
+ import type { DeploymentHistoryEntry, DeploymentRecord, ExportBundle, NetworkMetadata, PendingDeployment } from "./deployment-types.js";
20
+ export declare function writeDeploymentRecord(deploymentsDir: string, network: string, record: DeploymentRecord): void;
21
+ export declare function readDeploymentRecord(deploymentsDir: string, network: string, programId: string): DeploymentRecord | null;
22
+ /**
23
+ * Read all deployment records for a network.
24
+ * Excludes dotfiles (`.network.json`, `.history/`, `.pending/`) and
25
+ * ABI snapshots (`*.abi.json`).
26
+ */
27
+ export declare function readAllDeploymentRecords(deploymentsDir: string, network: string): DeploymentRecord[];
28
+ export declare function writeAbiSnapshot(deploymentsDir: string, network: string, programId: string, abi: ProgramABI): void;
29
+ export declare function readAbiSnapshot(deploymentsDir: string, network: string, programId: string): ProgramABI | null;
30
+ export declare function deleteAbiSnapshot(deploymentsDir: string, network: string, programId: string): void;
31
+ export declare function appendHistory(deploymentsDir: string, network: string, programId: string, entry: DeploymentHistoryEntry): void;
32
+ export declare function readHistory(deploymentsDir: string, network: string, programId: string): DeploymentHistoryEntry[];
33
+ export declare function writeNetworkMetadata(deploymentsDir: string, network: string, meta: NetworkMetadata): void;
34
+ export declare function readNetworkMetadata(deploymentsDir: string, network: string): NetworkMetadata | null;
35
+ export declare function writePendingMarker(deploymentsDir: string, network: string, pending: PendingDeployment): void;
36
+ export declare function readPendingMarker(deploymentsDir: string, network: string, programId: string): PendingDeployment | null;
37
+ export declare function deletePendingMarker(deploymentsDir: string, network: string, programId: string): void;
38
+ export declare function listPendingMarkers(deploymentsDir: string, network: string): string[];
39
+ export declare function writeExportBundle(deploymentsDir: string, network: string, bundle: ExportBundle): void;
40
+ //# sourceMappingURL=deployment-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment-state.d.ts","sourceRoot":"","sources":["../src/deployment-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EACV,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAqD/B,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,gBAAgB,GACvB,IAAI,CAKN;AAED,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,gBAAgB,GAAG,IAAI,CAIzB;AAED;;;;GAIG;AACH,wBAAg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MAAM,EACf,SAAS,EAAE,MAAM,GAChB,IAAI,CAKN;AAED,wBAAgB,kBAAkB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAOpF;AAMD,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,GACnB,IAAI,CAEN"}
@@ -0,0 +1,204 @@
1
+ /**
2
+ * Deployment state file I/O.
3
+ *
4
+ * Directory layout under `deploymentsDir`:
5
+ *
6
+ * ```
7
+ * deployments/<networkName>/
8
+ * .network.json # NetworkMetadata
9
+ * <programId>.json # DeploymentRecord (latest)
10
+ * <programId>.abi.json # ABI snapshot (for export)
11
+ * .history/<programId>/<historyCount>-<timestamp>.json # historical entries
12
+ * .pending/<programId>.json # crash recovery markers
13
+ * deployments/_exports/<networkName>.json # export bundles
14
+ * ```
15
+ *
16
+ * All writes use write-to-tmp + rename for atomicity.
17
+ */
18
+ import * as fs from "node:fs";
19
+ import * as path from "node:path";
20
+ import { parseAbi } from "@lionden/leo-compiler";
21
+ // ---------------------------------------------------------------------------
22
+ // Path helpers
23
+ // ---------------------------------------------------------------------------
24
+ function networkDir(deploymentsDir, network) {
25
+ return path.join(deploymentsDir, network);
26
+ }
27
+ function recordPath(deploymentsDir, network, programId) {
28
+ return path.join(networkDir(deploymentsDir, network), `${programId}.json`);
29
+ }
30
+ function abiSnapshotPath(deploymentsDir, network, programId) {
31
+ return path.join(networkDir(deploymentsDir, network), `${programId}.abi.json`);
32
+ }
33
+ function networkMetaPath(deploymentsDir, network) {
34
+ return path.join(networkDir(deploymentsDir, network), ".network.json");
35
+ }
36
+ function pendingDir(deploymentsDir, network) {
37
+ return path.join(networkDir(deploymentsDir, network), ".pending");
38
+ }
39
+ function pendingPath(deploymentsDir, network, programId) {
40
+ return path.join(pendingDir(deploymentsDir, network), `${programId}.json`);
41
+ }
42
+ function historyDir(deploymentsDir, network, programId) {
43
+ return path.join(networkDir(deploymentsDir, network), ".history", programId);
44
+ }
45
+ function exportPath(deploymentsDir, network) {
46
+ return path.join(deploymentsDir, "_exports", `${network}.json`);
47
+ }
48
+ /**
49
+ * Atomic write: write to a temp file, then rename into place.
50
+ */
51
+ function atomicWrite(filePath, content) {
52
+ const dir = path.dirname(filePath);
53
+ fs.mkdirSync(dir, { recursive: true });
54
+ const tmp = `${filePath}.tmp`;
55
+ fs.writeFileSync(tmp, content, "utf-8");
56
+ fs.renameSync(tmp, filePath);
57
+ }
58
+ // ---------------------------------------------------------------------------
59
+ // Deployment records
60
+ // ---------------------------------------------------------------------------
61
+ export function writeDeploymentRecord(deploymentsDir, network, record) {
62
+ atomicWrite(recordPath(deploymentsDir, network, record.programId), JSON.stringify(record, null, 2) + "\n");
63
+ }
64
+ export function readDeploymentRecord(deploymentsDir, network, programId) {
65
+ const p = recordPath(deploymentsDir, network, programId);
66
+ if (!fs.existsSync(p))
67
+ return null;
68
+ return JSON.parse(fs.readFileSync(p, "utf-8"));
69
+ }
70
+ /**
71
+ * Read all deployment records for a network.
72
+ * Excludes dotfiles (`.network.json`, `.history/`, `.pending/`) and
73
+ * ABI snapshots (`*.abi.json`).
74
+ */
75
+ export function readAllDeploymentRecords(deploymentsDir, network) {
76
+ const dir = networkDir(deploymentsDir, network);
77
+ if (!fs.existsSync(dir))
78
+ return [];
79
+ const records = [];
80
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
81
+ if (!entry.isFile())
82
+ continue;
83
+ if (entry.name.startsWith("."))
84
+ continue;
85
+ if (!entry.name.endsWith(".json"))
86
+ continue;
87
+ if (entry.name.endsWith(".abi.json"))
88
+ continue;
89
+ try {
90
+ const raw = fs.readFileSync(path.join(dir, entry.name), "utf-8");
91
+ records.push(JSON.parse(raw));
92
+ }
93
+ catch {
94
+ // Skip corrupt files
95
+ }
96
+ }
97
+ return records;
98
+ }
99
+ // ---------------------------------------------------------------------------
100
+ // ABI snapshots
101
+ // ---------------------------------------------------------------------------
102
+ export function writeAbiSnapshot(deploymentsDir, network, programId, abi) {
103
+ atomicWrite(abiSnapshotPath(deploymentsDir, network, programId), JSON.stringify(abi, null, 2) + "\n");
104
+ }
105
+ export function readAbiSnapshot(deploymentsDir, network, programId) {
106
+ const p = abiSnapshotPath(deploymentsDir, network, programId);
107
+ if (!fs.existsSync(p))
108
+ return null;
109
+ try {
110
+ // Use parseAbi for normalization (ensures all arrays are present, same as readAbiFromArtifacts)
111
+ return parseAbi(fs.readFileSync(p, "utf-8"));
112
+ }
113
+ catch {
114
+ return null;
115
+ }
116
+ }
117
+ export function deleteAbiSnapshot(deploymentsDir, network, programId) {
118
+ fs.rmSync(abiSnapshotPath(deploymentsDir, network, programId), { force: true });
119
+ }
120
+ // ---------------------------------------------------------------------------
121
+ // History
122
+ // ---------------------------------------------------------------------------
123
+ export function appendHistory(deploymentsDir, network, programId, entry) {
124
+ const dir = historyDir(deploymentsDir, network, programId);
125
+ const ts = new Date().toISOString().replace(/[:.]/g, "-");
126
+ const filename = `${String(entry.record.historyCount).padStart(6, "0")}-${ts}.json`;
127
+ atomicWrite(path.join(dir, filename), JSON.stringify(entry, null, 2) + "\n");
128
+ }
129
+ export function readHistory(deploymentsDir, network, programId) {
130
+ const dir = historyDir(deploymentsDir, network, programId);
131
+ if (!fs.existsSync(dir))
132
+ return [];
133
+ const entries = [];
134
+ const files = fs
135
+ .readdirSync(dir)
136
+ .filter((f) => f.endsWith(".json"))
137
+ .sort();
138
+ for (const file of files) {
139
+ try {
140
+ const raw = fs.readFileSync(path.join(dir, file), "utf-8");
141
+ entries.push(JSON.parse(raw));
142
+ }
143
+ catch {
144
+ // Skip corrupt files
145
+ }
146
+ }
147
+ return entries;
148
+ }
149
+ // ---------------------------------------------------------------------------
150
+ // Network metadata
151
+ // ---------------------------------------------------------------------------
152
+ export function writeNetworkMetadata(deploymentsDir, network, meta) {
153
+ atomicWrite(networkMetaPath(deploymentsDir, network), JSON.stringify(meta, null, 2) + "\n");
154
+ }
155
+ export function readNetworkMetadata(deploymentsDir, network) {
156
+ const p = networkMetaPath(deploymentsDir, network);
157
+ if (!fs.existsSync(p))
158
+ return null;
159
+ try {
160
+ return JSON.parse(fs.readFileSync(p, "utf-8"));
161
+ }
162
+ catch {
163
+ return null;
164
+ }
165
+ }
166
+ // ---------------------------------------------------------------------------
167
+ // Pending markers
168
+ // ---------------------------------------------------------------------------
169
+ export function writePendingMarker(deploymentsDir, network, pending) {
170
+ atomicWrite(pendingPath(deploymentsDir, network, pending.programId), JSON.stringify(pending, null, 2) + "\n");
171
+ }
172
+ export function readPendingMarker(deploymentsDir, network, programId) {
173
+ const p = pendingPath(deploymentsDir, network, programId);
174
+ if (!fs.existsSync(p))
175
+ return null;
176
+ try {
177
+ return JSON.parse(fs.readFileSync(p, "utf-8"));
178
+ }
179
+ catch {
180
+ return null;
181
+ }
182
+ }
183
+ export function deletePendingMarker(deploymentsDir, network, programId) {
184
+ const p = pendingPath(deploymentsDir, network, programId);
185
+ if (fs.existsSync(p)) {
186
+ fs.unlinkSync(p);
187
+ }
188
+ }
189
+ export function listPendingMarkers(deploymentsDir, network) {
190
+ const dir = pendingDir(deploymentsDir, network);
191
+ if (!fs.existsSync(dir))
192
+ return [];
193
+ return fs
194
+ .readdirSync(dir)
195
+ .filter((f) => f.endsWith(".json"))
196
+ .map((f) => f.slice(0, -".json".length));
197
+ }
198
+ // ---------------------------------------------------------------------------
199
+ // Export bundles
200
+ // ---------------------------------------------------------------------------
201
+ export function writeExportBundle(deploymentsDir, network, bundle) {
202
+ atomicWrite(exportPath(deploymentsDir, network), JSON.stringify(bundle, null, 2) + "\n");
203
+ }
204
+ //# sourceMappingURL=deployment-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment-state.js","sourceRoot":"","sources":["../src/deployment-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI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ACxE,MAAM,GAAG,GAAG,UAAU,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAChD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,OAAO,EAAE;SACN,WAAW,CAAC,GAAG,CAAC;SAChB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SAClC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,MAAM,UAAU,iBAAiB,CAC/B,cAAsB,EACtB,OAAe,EACf,MAAoB;IAEpB,WAAW,CAAC,UAAU,CAAC,cAAc,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAC3F,CAAC"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Deployment state types.
3
+ *
4
+ * Defines the record union (CompleteDeploymentRecord | DegradedDeploymentRecord |
5
+ * RecoveredDeploymentRecord), history entries, network metadata, pending markers,
6
+ * and export bundle shapes.
7
+ */
8
+ import type { AleoNetwork } from "@lionden/config";
9
+ import type { ProgramABI } from "@lionden/leo-compiler";
10
+ interface DeploymentRecordBase {
11
+ readonly programId: string;
12
+ /** Canonical local source identity when deployment used a runtime rename. */
13
+ readonly sourceProgramId?: string;
14
+ /** Name of the network in config (e.g. "devnode", "testnet") */
15
+ readonly network: string;
16
+ /** REST API endpoint of the node */
17
+ readonly endpoint: string;
18
+ /** ISO 8601 timestamp of last update */
19
+ readonly updatedAt: string;
20
+ /** On-chain program edition. */
21
+ readonly edition: number;
22
+ /** Number of historical entries for this program */
23
+ readonly historyCount: number;
24
+ }
25
+ /**
26
+ * Full provenance — written after a successful deploy or upgrade.
27
+ */
28
+ export interface CompleteDeploymentRecord extends DeploymentRecordBase {
29
+ readonly status: "complete";
30
+ readonly txId: string;
31
+ readonly blockHeight: number;
32
+ readonly deployerAddress: string;
33
+ readonly deployedAt: string;
34
+ readonly feePaid?: number;
35
+ }
36
+ /**
37
+ * Discovered on-chain with no local provenance (imported from another
38
+ * deploy process, or present before LionDen was used).
39
+ */
40
+ export interface DegradedDeploymentRecord extends DeploymentRecordBase {
41
+ readonly status: "degraded";
42
+ readonly txId: null;
43
+ readonly blockHeight: null;
44
+ readonly deployerAddress: null;
45
+ readonly deployedAt: null;
46
+ readonly feePaid: null;
47
+ }
48
+ /**
49
+ * Recovered from a pending marker after a crash — we know the intent and
50
+ * deployer, and may know confirmed transaction provenance.
51
+ */
52
+ export interface RecoveredDeploymentRecord extends DeploymentRecordBase {
53
+ readonly status: "recovered";
54
+ readonly txId: string | null;
55
+ readonly blockHeight: number | null;
56
+ readonly deployerAddress: string;
57
+ readonly deployedAt: string;
58
+ readonly feePaid: null;
59
+ }
60
+ export type DeploymentRecord = CompleteDeploymentRecord | DegradedDeploymentRecord | RecoveredDeploymentRecord;
61
+ export interface DeploymentHistoryEntry {
62
+ readonly record: DeploymentRecord;
63
+ readonly action: "deploy" | "upgrade";
64
+ }
65
+ /**
66
+ * Written to `deployments/<network>/.network.json`.
67
+ * Used to detect config drift (e.g. "testnet" endpoint changed).
68
+ */
69
+ export interface NetworkMetadata {
70
+ readonly type: "devnode" | "http";
71
+ readonly networkId: AleoNetwork;
72
+ readonly endpoint: string;
73
+ /** Reserved for future genesis-hash verification */
74
+ readonly chainIdentifier?: string;
75
+ }
76
+ /**
77
+ * Written to `deployments/<network>/.pending/<programId>.json` before
78
+ * broadcast, deleted by `record()` after confirmation.
79
+ * Used for crash recovery.
80
+ */
81
+ export interface PendingDeployment {
82
+ readonly programId: string;
83
+ readonly sourceProgramId?: string;
84
+ readonly action: "deploy" | "upgrade";
85
+ readonly txId?: string;
86
+ readonly blockHeight?: number;
87
+ readonly previousEdition?: number;
88
+ readonly startedAt: string;
89
+ readonly deployerAddress: string;
90
+ readonly priorityFee: number;
91
+ readonly privateFee: boolean;
92
+ readonly network: string;
93
+ readonly endpoint: string;
94
+ }
95
+ export interface ExportedProgram {
96
+ readonly programId: string;
97
+ readonly abi: ProgramABI | null;
98
+ readonly txId: string | null;
99
+ readonly status: "complete" | "degraded" | "recovered";
100
+ }
101
+ export interface ExportBundle {
102
+ readonly network: string;
103
+ readonly networkInfo: {
104
+ readonly type: "devnode" | "http";
105
+ readonly networkId: AleoNetwork;
106
+ readonly endpoint: string;
107
+ };
108
+ readonly exportedAt: string;
109
+ readonly programs: Record<string, ExportedProgram>;
110
+ }
111
+ export {};
112
+ //# sourceMappingURL=deployment-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment-types.d.ts","sourceRoot":"","sources":["../src/deployment-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMxD,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,6EAA6E;IAC7E,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,gEAAgE;IAChE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,oCAAoC;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,wCAAwC;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,gCAAgC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAMD;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,oBAAoB;IACpE,QAAQ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C;QAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CACpD"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Deployment state types.
3
+ *
4
+ * Defines the record union (CompleteDeploymentRecord | DegradedDeploymentRecord |
5
+ * RecoveredDeploymentRecord), history entries, network metadata, pending markers,
6
+ * and export bundle shapes.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=deployment-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment-types.js","sourceRoot":"","sources":["../src/deployment-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Shared error classes for the deploy plugin.
3
+ */
4
+ export declare class DeployError extends Error {
5
+ constructor(message: string);
6
+ }
7
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAa,WAAY,SAAQ,KAAK;gBACxB,OAAO,EAAE,MAAM;CAI5B"}
package/dist/errors.js ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Shared error classes for the deploy plugin.
3
+ */
4
+ export class DeployError extends Error {
5
+ constructor(message) {
6
+ super(message);
7
+ this.name = "DeployError";
8
+ }
9
+ }
10
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ import { type LionDenPlugin } from "@lionden/core";
2
+ declare const pluginDeploy: LionDenPlugin;
3
+ export default pluginDeploy;
4
+ export type { DeployOptions, DeployResult, DeployTaskResult, DryRunResult, } from "./deploy-task.js";
5
+ export { DeployError, readLeoSourcesFromDir, resolveDeployTargets, } from "./deploy-task.js";
6
+ export type { DeploymentManager, PreflightOptions, RecordOptions } from "./deployment-manager.js";
7
+ export { DeploymentManagerImpl } from "./deployment-manager.js";
8
+ export type { CompleteDeploymentRecord, DegradedDeploymentRecord, DeploymentHistoryEntry, DeploymentRecord, ExportBundle, ExportedProgram, NetworkMetadata, PendingDeployment, RecoveredDeploymentRecord, } from "./deployment-types.js";
9
+ export { checkProgramOnChain } from "./on-chain-check.js";
10
+ export type { DeployPreflightResult, PreflightError, PreflightWarning, ProgramPreflightOutcome, } from "./preflight.js";
11
+ export type { DeploymentContext, DeploymentRecipe, ProgramDeploymentTarget, RecipeDeployOptions, RecipeDeployResult, RecipeExecuteOptions, RecipeExecuteResult, } from "./recipe-types.js";
12
+ export type { UpgradeOptions, UpgradeResult } from "./upgrade-task.js";
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,aAAa,EAKnB,MAAM,eAAe,CAAC;AA6LvB,QAAA,MAAM,YAAY,EAAE,aAmBnB,CAAC;AAEF,eAAe,YAAY,CAAC;AAM5B,YAAY,EACV,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,YAAY,EACV,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,YAAY,EACV,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,184 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import { logSuccess, pluralize, task, } from "@lionden/core";
4
+ import { deployAction } from "./deploy-task.js";
5
+ import { DeploymentManagerImpl } from "./deployment-manager.js";
6
+ import { DeployError } from "./errors.js";
7
+ import { recipeAction } from "./recipe-task.js";
8
+ import { upgradeAction } from "./upgrade-task.js";
9
+ // ---------------------------------------------------------------------------
10
+ // Config hooks
11
+ // ---------------------------------------------------------------------------
12
+ const configHooks = {
13
+ validateResolvedConfig(config) {
14
+ const errors = [];
15
+ if (config.deploy.defaultPriorityFee < 0) {
16
+ errors.push({
17
+ path: "deploy.defaultPriorityFee",
18
+ message: "Priority fee cannot be negative",
19
+ });
20
+ }
21
+ if (config.deploy.confirmationTimeout <= 0) {
22
+ errors.push({
23
+ path: "deploy.confirmationTimeout",
24
+ message: "Confirmation timeout must be positive",
25
+ });
26
+ }
27
+ if (config.deploy.interDeploymentDelay !== undefined &&
28
+ config.deploy.interDeploymentDelay < 0) {
29
+ errors.push({
30
+ path: "deploy.interDeploymentDelay",
31
+ message: "Inter-deployment delay cannot be negative",
32
+ });
33
+ }
34
+ if ("deploymentsDir" in config.deploy &&
35
+ typeof config.deploy.deploymentsDir === "string" &&
36
+ config.deploy.deploymentsDir.trim() === "") {
37
+ errors.push({
38
+ path: "deploy.deploymentsDir",
39
+ message: "Deployments directory cannot be empty",
40
+ });
41
+ }
42
+ return errors;
43
+ },
44
+ };
45
+ // ---------------------------------------------------------------------------
46
+ // Tasks
47
+ // ---------------------------------------------------------------------------
48
+ const deployTask = task("deploy", "Deploy Aleo programs to a network")
49
+ .addOption({
50
+ name: "program",
51
+ type: "string",
52
+ description: "Deploy only the specified program",
53
+ })
54
+ .addOption({
55
+ name: "priorityFee",
56
+ type: "number",
57
+ description: "Priority fee in microcredits",
58
+ })
59
+ .addOption({
60
+ name: "rename",
61
+ type: "string",
62
+ description: "Deploy the selected source program under a different on-chain program id",
63
+ })
64
+ .addFlag({
65
+ name: "skipConfirm",
66
+ description: "Skip waiting for transaction confirmation",
67
+ })
68
+ .addFlag({
69
+ name: "noCompile",
70
+ description: "Skip compilation before deploying (artifacts must already exist)",
71
+ })
72
+ .addFlag({
73
+ name: "preflight",
74
+ description: "Run pre-flight checks only — do not deploy",
75
+ })
76
+ .addFlag({
77
+ name: "dryRun",
78
+ description: "Build transaction but do not broadcast (devnode only)",
79
+ })
80
+ .addFlag({
81
+ name: "noSkipDeployed",
82
+ description: "Fail if any program is already deployed on-chain",
83
+ })
84
+ .addFlag({
85
+ name: "export",
86
+ description: "Export deployment bundle after deploying",
87
+ })
88
+ .setAction(deployAction)
89
+ .build();
90
+ const upgradeTask = task("upgrade", "Upgrade a deployed Aleo program")
91
+ .addOption({
92
+ name: "program",
93
+ type: "string",
94
+ description: "Program to upgrade (required)",
95
+ required: true,
96
+ })
97
+ .addOption({
98
+ name: "priorityFee",
99
+ type: "number",
100
+ description: "Priority fee in microcredits",
101
+ })
102
+ .addFlag({
103
+ name: "skipConfirm",
104
+ description: "Skip waiting for transaction confirmation",
105
+ })
106
+ .setAction(upgradeAction)
107
+ .build();
108
+ const exportTask = task("export", "Export deployment addresses and ABIs for frontend consumption")
109
+ .addOption({
110
+ name: "out",
111
+ type: "string",
112
+ description: "Output file path (default: deployments/_exports/<network>.json)",
113
+ })
114
+ .setAction(exportAction)
115
+ .build();
116
+ const recipeTask = task("recipe", "Run a deployment recipe")
117
+ .addOption({
118
+ name: "file",
119
+ type: "string",
120
+ description: "Path to recipe file (relative to project root)",
121
+ required: true,
122
+ })
123
+ .addOption({
124
+ name: "export",
125
+ type: "string",
126
+ description: "Named export to run (default: 'default')",
127
+ })
128
+ .addFlag({
129
+ name: "noCompile",
130
+ description: "Skip compilation before running recipe",
131
+ })
132
+ .setAction(recipeAction)
133
+ .build();
134
+ async function exportAction(args, lre) {
135
+ const networkName = args["network"] ?? lre.config.defaultNetwork;
136
+ const outPath = args["out"];
137
+ const manager = lre.deployments;
138
+ if (!manager) {
139
+ throw new DeployError("DeploymentManager not available. Ensure @lionden/plugin-deploy is registered as a plugin.");
140
+ }
141
+ const networkConfig = lre.config.networks[networkName];
142
+ if (networkConfig?.type === "devnode") {
143
+ const networkManager = lre.network;
144
+ await networkManager.connect(networkName);
145
+ }
146
+ const bundle = await manager.export(networkName);
147
+ const programCount = Object.keys(bundle.programs).length;
148
+ const programCountText = `${programCount} ${pluralize("program", programCount)}`;
149
+ if (outPath) {
150
+ fs.mkdirSync(path.dirname(path.resolve(outPath)), { recursive: true });
151
+ fs.writeFileSync(path.resolve(outPath), JSON.stringify(bundle, null, 2));
152
+ console.log(`${logSuccess("Exported")} ${programCountText} to ${outPath}`);
153
+ }
154
+ else {
155
+ console.log(`${logSuccess("Exported")} ${programCountText} for network "${networkName}"`);
156
+ }
157
+ return bundle;
158
+ }
159
+ // ---------------------------------------------------------------------------
160
+ // Plugin definition
161
+ // ---------------------------------------------------------------------------
162
+ const pluginDeploy = {
163
+ id: "@lionden/plugin-deploy",
164
+ name: "Deploy Plugin",
165
+ hookHandlers: {
166
+ config: configHooks,
167
+ },
168
+ // --prove is a framework built-in global (see arg-names.ts), so it is not
169
+ // declared here. deployAction/upgradeAction still read it via
170
+ // resolveProveOption(), which consults lre.globalOptions["prove"] (seeded by
171
+ // the CLI from the built-in --prove) and LIONDEN_PROVE.
172
+ tasks: [deployTask, upgradeTask, exportTask, recipeTask],
173
+ extendLre(lre) {
174
+ const networkAccessor = () => lre.network;
175
+ lre["deployments"] = new DeploymentManagerImpl(lre.config, networkAccessor, lre.artifacts);
176
+ },
177
+ };
178
+ export default pluginDeploy;
179
+ // Deploy task
180
+ export { DeployError, readLeoSourcesFromDir, resolveDeployTargets, } from "./deploy-task.js";
181
+ export { DeploymentManagerImpl } from "./deployment-manager.js";
182
+ // On-chain check
183
+ export { checkProgramOnChain } from "./on-chain-check.js";
184
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAKL,UAAU,EACV,SAAS,EACT,IAAI,GACL,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E,MAAM,WAAW,GAAuB;IACtC,sBAAsB,CAAC,MAA6B;QAClD,MAAM,MAAM,GAA4B,EAAE,CAAC;QAE3C,IAAI,MAAM,CAAC,MAAM,CAAC,kBAAkB,GAAG,CAAC,EAAE,CAAC;YACzC,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,2BAA2B;gBACjC,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O,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAahE,iBAAiB;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Utility for reading Leo source files from a directory.
3
+ * Extracted to avoid circular dependencies between deploy-task and upgrade-task.
4
+ */
5
+ /**
6
+ * Read all .leo source files from an absolute source directory.
7
+ * Uses the discovered sourceDir (from discoverUnits) rather than
8
+ * deriving the path from the program ID.
9
+ */
10
+ export declare function readLeoSourcesFromDir(sourceDir: string): string;
11
+ //# sourceMappingURL=leo-sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leo-sources.d.ts","sourceRoot":"","sources":["../src/leo-sources.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAM/D"}