movehat 0.0.1-alpha.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 (170) hide show
  1. package/README.md +236 -0
  2. package/bin/movehat.js +21 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +93 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/compile.d.ts +2 -0
  8. package/dist/commands/compile.d.ts.map +1 -0
  9. package/dist/commands/compile.js +71 -0
  10. package/dist/commands/compile.js.map +1 -0
  11. package/dist/commands/fork/create.d.ts +11 -0
  12. package/dist/commands/fork/create.d.ts.map +1 -0
  13. package/dist/commands/fork/create.js +56 -0
  14. package/dist/commands/fork/create.js.map +1 -0
  15. package/dist/commands/fork/fund.d.ts +12 -0
  16. package/dist/commands/fork/fund.d.ts.map +1 -0
  17. package/dist/commands/fork/fund.js +42 -0
  18. package/dist/commands/fork/fund.js.map +1 -0
  19. package/dist/commands/fork/list.d.ts +5 -0
  20. package/dist/commands/fork/list.d.ts.map +1 -0
  21. package/dist/commands/fork/list.js +61 -0
  22. package/dist/commands/fork/list.js.map +1 -0
  23. package/dist/commands/fork/serve.d.ts +10 -0
  24. package/dist/commands/fork/serve.d.ts.map +1 -0
  25. package/dist/commands/fork/serve.js +64 -0
  26. package/dist/commands/fork/serve.js.map +1 -0
  27. package/dist/commands/fork/view-resource.d.ts +11 -0
  28. package/dist/commands/fork/view-resource.d.ts.map +1 -0
  29. package/dist/commands/fork/view-resource.js +34 -0
  30. package/dist/commands/fork/view-resource.js.map +1 -0
  31. package/dist/commands/init.d.ts +2 -0
  32. package/dist/commands/init.d.ts.map +1 -0
  33. package/dist/commands/init.js +90 -0
  34. package/dist/commands/init.js.map +1 -0
  35. package/dist/commands/run.d.ts +2 -0
  36. package/dist/commands/run.d.ts.map +1 -0
  37. package/dist/commands/run.js +51 -0
  38. package/dist/commands/run.js.map +1 -0
  39. package/dist/commands/test.d.ts +2 -0
  40. package/dist/commands/test.d.ts.map +1 -0
  41. package/dist/commands/test.js +35 -0
  42. package/dist/commands/test.js.map +1 -0
  43. package/dist/core/config.d.ts +15 -0
  44. package/dist/core/config.d.ts.map +1 -0
  45. package/dist/core/config.js +121 -0
  46. package/dist/core/config.js.map +1 -0
  47. package/dist/core/contract.d.ts +20 -0
  48. package/dist/core/contract.d.ts.map +1 -0
  49. package/dist/core/contract.js +59 -0
  50. package/dist/core/contract.js.map +1 -0
  51. package/dist/core/deployments.d.ts +32 -0
  52. package/dist/core/deployments.d.ts.map +1 -0
  53. package/dist/core/deployments.js +122 -0
  54. package/dist/core/deployments.js.map +1 -0
  55. package/dist/core/shell.d.ts +25 -0
  56. package/dist/core/shell.d.ts.map +1 -0
  57. package/dist/core/shell.js +56 -0
  58. package/dist/core/shell.js.map +1 -0
  59. package/dist/errors.d.ts +12 -0
  60. package/dist/errors.d.ts.map +1 -0
  61. package/dist/errors.js +24 -0
  62. package/dist/errors.js.map +1 -0
  63. package/dist/fork/api.d.ts +33 -0
  64. package/dist/fork/api.d.ts.map +1 -0
  65. package/dist/fork/api.js +98 -0
  66. package/dist/fork/api.js.map +1 -0
  67. package/dist/fork/manager.d.ts +52 -0
  68. package/dist/fork/manager.d.ts.map +1 -0
  69. package/dist/fork/manager.js +221 -0
  70. package/dist/fork/manager.js.map +1 -0
  71. package/dist/fork/server.d.ts +55 -0
  72. package/dist/fork/server.d.ts.map +1 -0
  73. package/dist/fork/server.js +274 -0
  74. package/dist/fork/server.js.map +1 -0
  75. package/dist/fork/storage.d.ts +63 -0
  76. package/dist/fork/storage.d.ts.map +1 -0
  77. package/dist/fork/storage.js +183 -0
  78. package/dist/fork/storage.js.map +1 -0
  79. package/dist/fork/test.d.ts +75 -0
  80. package/dist/fork/test.d.ts.map +1 -0
  81. package/dist/fork/test.js +157 -0
  82. package/dist/fork/test.js.map +1 -0
  83. package/dist/helpers/assertions.d.ts +7 -0
  84. package/dist/helpers/assertions.d.ts.map +1 -0
  85. package/dist/helpers/assertions.js +17 -0
  86. package/dist/helpers/assertions.js.map +1 -0
  87. package/dist/helpers/banner.d.ts +3 -0
  88. package/dist/helpers/banner.d.ts.map +1 -0
  89. package/dist/helpers/banner.js +38 -0
  90. package/dist/helpers/banner.js.map +1 -0
  91. package/dist/helpers/index.d.ts +11 -0
  92. package/dist/helpers/index.d.ts.map +1 -0
  93. package/dist/helpers/index.js +7 -0
  94. package/dist/helpers/index.js.map +1 -0
  95. package/dist/helpers/setup.d.ts +10 -0
  96. package/dist/helpers/setup.d.ts.map +1 -0
  97. package/dist/helpers/setup.js +28 -0
  98. package/dist/helpers/setup.js.map +1 -0
  99. package/dist/index.d.ts +11 -0
  100. package/dist/index.d.ts.map +1 -0
  101. package/dist/index.js +12 -0
  102. package/dist/index.js.map +1 -0
  103. package/dist/runtime.d.ts +26 -0
  104. package/dist/runtime.d.ts.map +1 -0
  105. package/dist/runtime.js +247 -0
  106. package/dist/runtime.js.map +1 -0
  107. package/dist/templates/.env.example +9 -0
  108. package/dist/templates/.mocharc.json +8 -0
  109. package/dist/templates/README.md +92 -0
  110. package/dist/templates/move/Counter.move +64 -0
  111. package/dist/templates/move/Move.toml +16 -0
  112. package/dist/templates/movehat.config.ts +37 -0
  113. package/dist/templates/package.json +24 -0
  114. package/dist/templates/scripts/deploy-counter.ts +48 -0
  115. package/dist/templates/tests/Counter.test.ts +75 -0
  116. package/dist/templates/tsconfig.json +15 -0
  117. package/dist/templates/types/movehat.d.ts +104 -0
  118. package/dist/types/config.d.ts +35 -0
  119. package/dist/types/config.d.ts.map +1 -0
  120. package/dist/types/config.js +2 -0
  121. package/dist/types/config.js.map +1 -0
  122. package/dist/types/fork.d.ts +37 -0
  123. package/dist/types/fork.d.ts.map +1 -0
  124. package/dist/types/fork.js +5 -0
  125. package/dist/types/fork.js.map +1 -0
  126. package/dist/types/runtime.d.ts +28 -0
  127. package/dist/types/runtime.d.ts.map +1 -0
  128. package/dist/types/runtime.js +2 -0
  129. package/dist/types/runtime.js.map +1 -0
  130. package/package.json +66 -0
  131. package/src/cli.ts +106 -0
  132. package/src/commands/compile.ts +84 -0
  133. package/src/commands/fork/create.ts +70 -0
  134. package/src/commands/fork/fund.ts +57 -0
  135. package/src/commands/fork/list.ts +67 -0
  136. package/src/commands/fork/serve.ts +77 -0
  137. package/src/commands/fork/view-resource.ts +46 -0
  138. package/src/commands/init.ts +150 -0
  139. package/src/commands/run.ts +59 -0
  140. package/src/commands/test.ts +42 -0
  141. package/src/core/config.ts +151 -0
  142. package/src/core/contract.ts +97 -0
  143. package/src/core/deployments.ts +164 -0
  144. package/src/core/shell.ts +66 -0
  145. package/src/errors.ts +21 -0
  146. package/src/fork/api.ts +117 -0
  147. package/src/fork/manager.ts +264 -0
  148. package/src/fork/server.ts +311 -0
  149. package/src/fork/storage.ts +224 -0
  150. package/src/fork/test.ts +195 -0
  151. package/src/helpers/assertions.ts +29 -0
  152. package/src/helpers/banner.ts +47 -0
  153. package/src/helpers/index.ts +26 -0
  154. package/src/helpers/setup.ts +49 -0
  155. package/src/index.ts +17 -0
  156. package/src/runtime.ts +322 -0
  157. package/src/templates/.env.example +9 -0
  158. package/src/templates/.mocharc.json +8 -0
  159. package/src/templates/README.md +92 -0
  160. package/src/templates/move/Counter.move +64 -0
  161. package/src/templates/move/Move.toml +16 -0
  162. package/src/templates/movehat.config.ts +37 -0
  163. package/src/templates/package.json +24 -0
  164. package/src/templates/scripts/deploy-counter.ts +48 -0
  165. package/src/templates/tests/Counter.test.ts +75 -0
  166. package/src/templates/tsconfig.json +15 -0
  167. package/src/templates/types/movehat.d.ts +104 -0
  168. package/src/types/config.ts +36 -0
  169. package/src/types/fork.ts +41 -0
  170. package/src/types/runtime.ts +49 -0
@@ -0,0 +1,32 @@
1
+ export interface DeploymentInfo {
2
+ address: string;
3
+ moduleName: string;
4
+ network: string;
5
+ deployer: string;
6
+ timestamp: number;
7
+ txHash?: string;
8
+ blockNumber?: string;
9
+ }
10
+ /**
11
+ * Validates that a name is safe for use in file paths
12
+ * Only allows alphanumeric characters, hyphens, and underscores
13
+ * Prevents path traversal attacks
14
+ */
15
+ export declare function validateSafeName(name: string, type: "network" | "module"): void;
16
+ /**
17
+ * Save a deployment
18
+ */
19
+ export declare function saveDeployment(deployment: DeploymentInfo): void;
20
+ /**
21
+ * Load a deployment
22
+ */
23
+ export declare function loadDeployment(network: string, moduleName: string): DeploymentInfo | null;
24
+ /**
25
+ * Get all deployments for a network
26
+ */
27
+ export declare function getAllDeployments(network: string): Record<string, DeploymentInfo>;
28
+ /**
29
+ * Get deployed address for a module
30
+ */
31
+ export declare function getDeployedAddress(network: string, moduleName: string): string | null;
32
+ //# sourceMappingURL=deployments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployments.d.ts","sourceRoot":"","sources":["../../src/core/deployments.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,IAAI,CA8B/E;AA8BD;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI,CAoB/D;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAmBzF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAwBjF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIrF"}
@@ -0,0 +1,122 @@
1
+ import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "fs";
2
+ import { join } from "path";
3
+ /**
4
+ * Validates that a name is safe for use in file paths
5
+ * Only allows alphanumeric characters, hyphens, and underscores
6
+ * Prevents path traversal attacks
7
+ */
8
+ export function validateSafeName(name, type) {
9
+ if (!name || typeof name !== "string") {
10
+ throw new Error(`Invalid ${type} name: must be a non-empty string`);
11
+ }
12
+ // Check for path traversal sequences
13
+ if (name.includes("..") || name.includes("/") || name.includes("\\")) {
14
+ throw new Error(`Invalid ${type} name: "${name}"\n` +
15
+ `Path traversal sequences are not allowed.\n` +
16
+ `Use only alphanumeric characters, hyphens, and underscores.`);
17
+ }
18
+ // Only allow alphanumeric, hyphens, underscores
19
+ const safePattern = /^[a-zA-Z0-9_-]+$/;
20
+ if (!safePattern.test(name)) {
21
+ throw new Error(`Invalid ${type} name: "${name}"\n` +
22
+ `Only alphanumeric characters, hyphens (-), and underscores (_) are allowed.`);
23
+ }
24
+ // Additional check: prevent starting with dot (hidden files)
25
+ if (name.startsWith(".")) {
26
+ throw new Error(`Invalid ${type} name: "${name}"\n` +
27
+ `Names cannot start with a dot (.) to prevent hidden file creation.`);
28
+ }
29
+ }
30
+ /**
31
+ * Get the deployments directory path
32
+ */
33
+ function getDeploymentsDir() {
34
+ return join(process.cwd(), "deployments");
35
+ }
36
+ /**
37
+ * Get the network-specific deployments directory
38
+ */
39
+ function getNetworkDeploymentsDir(network) {
40
+ // Validate network name to prevent path traversal
41
+ validateSafeName(network, "network");
42
+ const deploymentsDir = getDeploymentsDir();
43
+ const networkDir = join(deploymentsDir, network);
44
+ // Create directories if they don't exist
45
+ if (!existsSync(deploymentsDir)) {
46
+ mkdirSync(deploymentsDir, { recursive: true });
47
+ }
48
+ if (!existsSync(networkDir)) {
49
+ mkdirSync(networkDir, { recursive: true });
50
+ }
51
+ return networkDir;
52
+ }
53
+ /**
54
+ * Save a deployment
55
+ */
56
+ export function saveDeployment(deployment) {
57
+ // Validate both network and module name
58
+ validateSafeName(deployment.network, "network");
59
+ validateSafeName(deployment.moduleName, "module");
60
+ const networkDir = getNetworkDeploymentsDir(deployment.network);
61
+ const filePath = join(networkDir, `${deployment.moduleName}.json`);
62
+ try {
63
+ writeFileSync(filePath, JSON.stringify(deployment, null, 2), "utf-8");
64
+ console.log(`💾 Deployment saved: deployments/${deployment.network}/${deployment.moduleName}.json`);
65
+ }
66
+ catch (error) {
67
+ console.error(`Failed to save deployment for ${deployment.moduleName} on ${deployment.network} at ${filePath}:`, error);
68
+ throw error;
69
+ }
70
+ }
71
+ /**
72
+ * Load a deployment
73
+ */
74
+ export function loadDeployment(network, moduleName) {
75
+ // Validate both network and module name
76
+ validateSafeName(network, "network");
77
+ validateSafeName(moduleName, "module");
78
+ const networkDir = getNetworkDeploymentsDir(network);
79
+ const filePath = join(networkDir, `${moduleName}.json`);
80
+ if (!existsSync(filePath)) {
81
+ return null;
82
+ }
83
+ try {
84
+ const content = readFileSync(filePath, "utf-8");
85
+ return JSON.parse(content);
86
+ }
87
+ catch (error) {
88
+ console.error(`Failed to load deployment for ${moduleName} on ${network}:`, error);
89
+ return null;
90
+ }
91
+ }
92
+ /**
93
+ * Get all deployments for a network
94
+ */
95
+ export function getAllDeployments(network) {
96
+ // Validate network name
97
+ validateSafeName(network, "network");
98
+ const networkDir = getNetworkDeploymentsDir(network);
99
+ if (!existsSync(networkDir)) {
100
+ return {};
101
+ }
102
+ const files = readdirSync(networkDir).filter((f) => f.endsWith(".json"));
103
+ const deployments = {};
104
+ for (const file of files) {
105
+ const moduleName = file.replace(".json", "");
106
+ // loadDeployment will validate moduleName internally
107
+ const deployment = loadDeployment(network, moduleName);
108
+ if (deployment) {
109
+ deployments[moduleName] = deployment;
110
+ }
111
+ }
112
+ return deployments;
113
+ }
114
+ /**
115
+ * Get deployed address for a module
116
+ */
117
+ export function getDeployedAddress(network, moduleName) {
118
+ // Validation happens in loadDeployment
119
+ const deployment = loadDeployment(network, moduleName);
120
+ return deployment ? deployment.address : null;
121
+ }
122
+ //# sourceMappingURL=deployments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployments.js","sourceRoot":"","sources":["../../src/core/deployments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACrF,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAY5B;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,IAA0B;IACvE,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,mCAAmC,CAAC,CAAC;IACtE,CAAC;IAED,qCAAqC;IACrC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,KAAK,CACb,WAAW,IAAI,WAAW,IAAI,KAAK;YACnC,6CAA6C;YAC7C,6DAA6D,CAC9D,CAAC;IACJ,CAAC;IAED,gDAAgD;IAChD,MAAM,WAAW,GAAG,kBAAkB,CAAC;IACvC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,WAAW,IAAI,WAAW,IAAI,KAAK;YACnC,6EAA6E,CAC9E,CAAC;IACJ,CAAC;IAED,6DAA6D;IAC7D,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,WAAW,IAAI,WAAW,IAAI,KAAK;YACnC,oEA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ACZ,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IAEjF,MAAM,WAAW,GAAmC,EAAE,CAAC;IAEvD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC7C,qDAAqD;QACrD,MAAM,UAAU,GAAG,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACvD,IAAI,UAAU,EAAE,CAAC;YACf,WAAW,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;QACvC,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAE,UAAkB;IACpE,uCAAuC;IACvC,MAAM,UAAU,GAAG,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACvD,OAAO,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AAChD,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Escapes a shell argument to prevent command injection
3
+ * Wraps the argument in single quotes and escapes any single quotes within
4
+ *
5
+ * @param arg - The argument to escape
6
+ * @returns The escaped argument safe for shell execution
7
+ */
8
+ export declare function escapeShellArg(arg: string): string;
9
+ /**
10
+ * Validates that a path is safe (no command injection characters)
11
+ * and returns the escaped version
12
+ *
13
+ * @param path - The path to validate and escape
14
+ * @param name - Name for error messages (e.g., "package directory")
15
+ * @returns The escaped path safe for shell execution
16
+ */
17
+ export declare function validateAndEscapePath(path: string, name?: string): string;
18
+ /**
19
+ * Validates that a profile name is safe
20
+ *
21
+ * @param profile - The profile name to validate
22
+ * @returns The escaped profile name
23
+ */
24
+ export declare function validateAndEscapeProfile(profile: string): string;
25
+ //# sourceMappingURL=shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/core/shell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQlD;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAe,GAAG,MAAM,CAiBjF;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAehE"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Escapes a shell argument to prevent command injection
3
+ * Wraps the argument in single quotes and escapes any single quotes within
4
+ *
5
+ * @param arg - The argument to escape
6
+ * @returns The escaped argument safe for shell execution
7
+ */
8
+ export function escapeShellArg(arg) {
9
+ if (typeof arg !== "string") {
10
+ throw new Error("Shell argument must be a string");
11
+ }
12
+ // Wrap in single quotes and escape any single quotes by replacing them with '\''
13
+ // This technique works on both Unix and Windows (Git Bash, WSL)
14
+ return `'${arg.replace(/'/g, "'\\''")}'`;
15
+ }
16
+ /**
17
+ * Validates that a path is safe (no command injection characters)
18
+ * and returns the escaped version
19
+ *
20
+ * @param path - The path to validate and escape
21
+ * @param name - Name for error messages (e.g., "package directory")
22
+ * @returns The escaped path safe for shell execution
23
+ */
24
+ export function validateAndEscapePath(path, name = "path") {
25
+ if (!path || typeof path !== "string") {
26
+ throw new Error(`Invalid ${name}: must be a non-empty string`);
27
+ }
28
+ // Check for obvious command injection attempts
29
+ const dangerousChars = /[;&|`$(){}[\]<>]/;
30
+ if (dangerousChars.test(path)) {
31
+ throw new Error(`Invalid ${name}: "${path}"\n` +
32
+ `Path contains potentially dangerous characters.\n` +
33
+ `Allowed characters: letters, numbers, ., -, _, /, \\, spaces`);
34
+ }
35
+ // Escape for shell safety
36
+ return escapeShellArg(path);
37
+ }
38
+ /**
39
+ * Validates that a profile name is safe
40
+ *
41
+ * @param profile - The profile name to validate
42
+ * @returns The escaped profile name
43
+ */
44
+ export function validateAndEscapeProfile(profile) {
45
+ if (!profile || typeof profile !== "string") {
46
+ throw new Error("Invalid profile name: must be a non-empty string");
47
+ }
48
+ // Profile names should only contain alphanumeric, hyphens, underscores
49
+ const safePattern = /^[a-zA-Z0-9_-]+$/;
50
+ if (!safePattern.test(profile)) {
51
+ throw new Error(`Invalid profile name: "${profile}"\n` +
52
+ `Only alphanumeric characters, hyphens (-), and underscores (_) are allowed.`);
53
+ }
54
+ return escapeShellArg(profile);
55
+ }
56
+ //# sourceMappingURL=shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/core/shell.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,iFAAiF;IACjF,gEAAgE;IAChE,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;AAC3C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY,EAAE,OAAe,MAAM;IACvE,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,8BAA8B,CAAC,CAAC;IACjE,CAAC;IAED,+CAA+C;IAC/C,MAAM,cAAc,GAAG,kBAAkB,CAAC;IAC1C,IAAI,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CACb,WAAW,IAAI,MAAM,IAAI,KAAK;YAC9B,mDAAmD;YACnD,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IAED,0BAA0B;IAC1B,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACtD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,uEAAuE;IACvE,MAAM,WAAW,GAAG,kBAAkB,CAAC;IACvC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,0BAA0B,OAAO,KAAK;YACtC,6EAA6E,CAC9E,CAAC;IACJ,CAAC;IAED,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Custom error thrown when attempting to deploy a module that is already deployed
3
+ */
4
+ export declare class ModuleAlreadyDeployedError extends Error {
5
+ readonly moduleName: string;
6
+ readonly network: string;
7
+ readonly address: string;
8
+ readonly timestamp: number;
9
+ readonly txHash?: string | undefined;
10
+ constructor(message: string, moduleName: string, network: string, address: string, timestamp: number, txHash?: string | undefined);
11
+ }
12
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;aAGjC,UAAU,EAAE,MAAM;aAClB,OAAO,EAAE,MAAM;aACf,OAAO,EAAE,MAAM;aACf,SAAS,EAAE,MAAM;aACjB,MAAM,CAAC,EAAE,MAAM;gBAL/B,OAAO,EAAE,MAAM,EACC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,YAAA;CAUlC"}
package/dist/errors.js ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Custom error thrown when attempting to deploy a module that is already deployed
3
+ */
4
+ export class ModuleAlreadyDeployedError extends Error {
5
+ moduleName;
6
+ network;
7
+ address;
8
+ timestamp;
9
+ txHash;
10
+ constructor(message, moduleName, network, address, timestamp, txHash) {
11
+ super(message);
12
+ this.moduleName = moduleName;
13
+ this.network = network;
14
+ this.address = address;
15
+ this.timestamp = timestamp;
16
+ this.txHash = txHash;
17
+ this.name = 'ModuleAlreadyDeployedError';
18
+ // Maintains proper stack trace for where our error was thrown (only available on V8)
19
+ if (Error.captureStackTrace) {
20
+ Error.captureStackTrace(this, ModuleAlreadyDeployedError);
21
+ }
22
+ }
23
+ }
24
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAGjC;IACA;IACA;IACA;IACA;IANlB,YACE,OAAe,EACC,UAAkB,EAClB,OAAe,EACf,OAAe,EACf,SAAiB,EACjB,MAAe;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QANC,eAAU,GAAV,UAAU,CAAQ;QAClB,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAAS;QAG/B,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;QAEzC,qFAAqF;QACrF,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,0BAA0B,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,33 @@
1
+ import type { LedgerInfo, AccountData, AccountResource } from '../types/fork.js';
2
+ /**
3
+ * Client for interacting with Movement/Aptos-compatible JSON API
4
+ */
5
+ export declare class MovementApiClient {
6
+ private nodeUrl;
7
+ constructor(nodeUrl: string);
8
+ /**
9
+ * Make a GET request to the API
10
+ */
11
+ private get;
12
+ /**
13
+ * Build API path with proper prefix
14
+ */
15
+ private apiPath;
16
+ /**
17
+ * Get ledger information
18
+ */
19
+ getLedgerInfo(): Promise<LedgerInfo>;
20
+ /**
21
+ * Get account information
22
+ */
23
+ getAccount(address: string): Promise<AccountData>;
24
+ /**
25
+ * Get a specific account resource
26
+ */
27
+ getAccountResource(address: string, resourceType: string): Promise<any>;
28
+ /**
29
+ * Get all resources for an account
30
+ */
31
+ getAccountResources(address: string): Promise<AccountResource[]>;
32
+ }
33
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/fork/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEjF;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,EAAE,MAAM;IAa3B;;OAEG;YACW,GAAG;IAqCjB;;OAEG;IACH,OAAO,CAAC,OAAO;IAMf;;OAEG;IACG,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IAI1C;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IASvD;;OAEG;IACG,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAW7E;;OAEG;IACG,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAOvE"}
@@ -0,0 +1,98 @@
1
+ import https from 'https';
2
+ import http from 'http';
3
+ import { URL } from 'url';
4
+ /**
5
+ * Client for interacting with Movement/Aptos-compatible JSON API
6
+ */
7
+ export class MovementApiClient {
8
+ nodeUrl;
9
+ constructor(nodeUrl) {
10
+ // Remove trailing slash
11
+ let normalized = nodeUrl.replace(/\/$/, '');
12
+ // If URL already ends with /v1, use as is
13
+ // Otherwise, assume it's the base URL
14
+ if (!normalized.endsWith('/v1')) {
15
+ // Base URL without /v1, we'll add it in requests
16
+ }
17
+ this.nodeUrl = normalized;
18
+ }
19
+ /**
20
+ * Make a GET request to the API
21
+ */
22
+ async get(path) {
23
+ const fullUrl = `${this.nodeUrl}${path}`;
24
+ const parsedUrl = new URL(fullUrl);
25
+ const isHttps = parsedUrl.protocol === 'https:';
26
+ const client = isHttps ? https : http;
27
+ return new Promise((resolve, reject) => {
28
+ const req = client.get(fullUrl, (res) => {
29
+ let data = '';
30
+ res.on('data', (chunk) => {
31
+ data += chunk;
32
+ });
33
+ res.on('end', () => {
34
+ if (res.statusCode !== 200) {
35
+ reject(new Error(`API request failed with status ${res.statusCode}: ${data}`));
36
+ return;
37
+ }
38
+ try {
39
+ const parsed = JSON.parse(data);
40
+ resolve(parsed);
41
+ }
42
+ catch (err) {
43
+ reject(new Error(`Failed to parse JSON response: ${err}`));
44
+ }
45
+ });
46
+ });
47
+ req.on('error', (err) => {
48
+ reject(new Error(`API request failed: ${err.message}`));
49
+ });
50
+ req.end();
51
+ });
52
+ }
53
+ /**
54
+ * Build API path with proper prefix
55
+ */
56
+ apiPath(suffix) {
57
+ // If nodeUrl already ends with /v1, just add the suffix
58
+ // Otherwise add /v1 prefix
59
+ return this.nodeUrl.endsWith('/v1') ? suffix : `/v1${suffix}`;
60
+ }
61
+ /**
62
+ * Get ledger information
63
+ */
64
+ async getLedgerInfo() {
65
+ return this.get(this.apiPath('/'));
66
+ }
67
+ /**
68
+ * Get account information
69
+ */
70
+ async getAccount(address) {
71
+ // Normalize address (ensure 0x prefix and lowercase)
72
+ const normalizedAddress = address.toLowerCase().startsWith('0x')
73
+ ? address.toLowerCase()
74
+ : `0x${address.toLowerCase()}`;
75
+ return this.get(this.apiPath(`/accounts/${normalizedAddress}`));
76
+ }
77
+ /**
78
+ * Get a specific account resource
79
+ */
80
+ async getAccountResource(address, resourceType) {
81
+ const normalizedAddress = address.toLowerCase().startsWith('0x')
82
+ ? address.toLowerCase()
83
+ : `0x${address.toLowerCase()}`;
84
+ // URL encode the resource type
85
+ const encodedType = encodeURIComponent(resourceType);
86
+ return this.get(this.apiPath(`/accounts/${normalizedAddress}/resource/${encodedType}`));
87
+ }
88
+ /**
89
+ * Get all resources for an account
90
+ */
91
+ async getAccountResources(address) {
92
+ const normalizedAddress = address.toLowerCase().startsWith('0x')
93
+ ? address.toLowerCase()
94
+ : `0x${address.toLowerCase()}`;
95
+ return this.get(this.apiPath(`/accounts/${normalizedAddress}/resources`));
96
+ }
97
+ }
98
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/fork/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAG1B;;GAEG;AACH,MAAM,OAAO,iBAAiB;IACpB,OAAO,CAAS;IAExB,YAAY,OAAe;QACzB,wBAAwB;QACxB,IAAI,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAE5C,0CAA0C;QAC1C,sCAAsC;QACtC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,iDAAiD;QACnD,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;IAC5B,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,GAAG,CAAI,IAAY;QAC/B,MAAM,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,CAAC;QACzC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QACnC,MAAM,OA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,WAAW,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;YAC9D,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE;YACvB,CAAC,CAAC,KAAK,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;QAEjC,OAAO,IAAI,CAAC,GAAG,CAAoB,IAAI,CAAC,OAAO,CAAC,aAAa,iBAAiB,YAAY,CAAC,CAAC,CAAC;IAC/F,CAAC;CACF"}
@@ -0,0 +1,52 @@
1
+ import type { ForkMetadata, AccountState } from '../types/fork.js';
2
+ /**
3
+ * Manager for fork operations
4
+ * Orchestrates API client and storage
5
+ */
6
+ export declare class ForkManager {
7
+ private storage;
8
+ private apiClient;
9
+ private metadata;
10
+ constructor(forkPath: string);
11
+ /**
12
+ * Initialize a new fork from a network
13
+ */
14
+ initialize(nodeUrl: string, networkName?: string): Promise<void>;
15
+ /**
16
+ * Load an existing fork
17
+ */
18
+ load(): void;
19
+ /**
20
+ * Get fork metadata
21
+ */
22
+ getMetadata(): ForkMetadata;
23
+ /**
24
+ * Get account state (with lazy loading)
25
+ */
26
+ getAccount(address: string): Promise<AccountState>;
27
+ /**
28
+ * Get a specific resource (with lazy loading)
29
+ */
30
+ getResource(address: string, resourceType: string): Promise<any>;
31
+ /**
32
+ * Get all resources for an account (with lazy loading)
33
+ */
34
+ getAllResources(address: string): Promise<Record<string, any>>;
35
+ /**
36
+ * Set a resource value (for testing/mocking)
37
+ */
38
+ setResource(address: string, resourceType: string, data: any): Promise<void>;
39
+ /**
40
+ * Fund an account with coins (adds to existing balance)
41
+ */
42
+ fundAccount(address: string, amount: number, coinType?: string): Promise<void>;
43
+ /**
44
+ * Normalize address format
45
+ */
46
+ private normalizeAddress;
47
+ /**
48
+ * List all accounts in the fork
49
+ */
50
+ listAccounts(): string[];
51
+ }
52
+ //# sourceMappingURL=manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/fork/manager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEnE;;;GAGG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,SAAS,CAAkC;IACnD,OAAO,CAAC,QAAQ,CAA6B;gBAEjC,QAAQ,EAAE,MAAM;IAI5B;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,GAAE,MAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BhF;;OAEG;IACH,IAAI,IAAI,IAAI;IASZ;;OAEG;IACH,WAAW,IAAI,YAAY;IAO3B;;OAEG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IA6BxD;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAgCtE;;OAEG;IACG,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IA4BpE;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAMlF;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAqC,GAAG,OAAO,CAAC,IAAI,CAAC;IA4DlH;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAexB;;OAEG;IACH,YAAY,IAAI,MAAM,EAAE;CAGzB"}