solforge 0.2.4 → 0.2.5

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 (42) hide show
  1. package/README.md +471 -79
  2. package/cli.cjs +106 -78
  3. package/package.json +1 -1
  4. package/scripts/install.sh +1 -1
  5. package/scripts/postinstall.cjs +66 -58
  6. package/server/methods/program/get-token-accounts-by-owner.ts +7 -2
  7. package/server/ws-server.ts +4 -1
  8. package/src/api-server-entry.ts +91 -91
  9. package/src/cli/commands/rpc-start.ts +4 -1
  10. package/src/cli/main.ts +7 -3
  11. package/src/cli/run-solforge.ts +20 -6
  12. package/src/commands/add-program.ts +324 -328
  13. package/src/commands/init.ts +106 -106
  14. package/src/commands/list.ts +125 -125
  15. package/src/commands/mint.ts +246 -246
  16. package/src/commands/start.ts +834 -831
  17. package/src/commands/status.ts +80 -80
  18. package/src/commands/stop.ts +381 -382
  19. package/src/config/manager.ts +149 -149
  20. package/src/gui/public/app.css +1556 -1
  21. package/src/gui/public/build/main.css +1569 -1
  22. package/src/gui/server.ts +20 -21
  23. package/src/gui/src/app.tsx +56 -37
  24. package/src/gui/src/components/airdrop-mint-form.tsx +17 -11
  25. package/src/gui/src/components/clone-program-modal.tsx +6 -6
  26. package/src/gui/src/components/clone-token-modal.tsx +7 -7
  27. package/src/gui/src/components/modal.tsx +13 -11
  28. package/src/gui/src/components/programs-panel.tsx +27 -15
  29. package/src/gui/src/components/status-panel.tsx +31 -17
  30. package/src/gui/src/components/tokens-panel.tsx +25 -19
  31. package/src/gui/src/index.css +491 -463
  32. package/src/index.ts +161 -146
  33. package/src/rpc/start.ts +1 -1
  34. package/src/services/api-server.ts +470 -473
  35. package/src/services/port-manager.ts +167 -167
  36. package/src/services/process-registry.ts +143 -143
  37. package/src/services/program-cloner.ts +312 -312
  38. package/src/services/token-cloner.ts +799 -797
  39. package/src/services/validator.ts +288 -288
  40. package/src/types/config.ts +71 -71
  41. package/src/utils/shell.ts +75 -75
  42. package/src/utils/token-loader.ts +77 -77
@@ -8,7 +8,10 @@ export async function rpcStartCommand(args: string[]) {
8
8
  const cfg = await readConfig(flags["config"] as string | undefined);
9
9
  const rpcPort = Number(flags["port"] ?? cfg.server.rpcPort ?? 8899);
10
10
  const wsPort = Number(flags["ws-port"] ?? cfg.server.wsPort ?? rpcPort + 1);
11
- const host = (flags["host"] as string) || "127.0.0.1";
11
+ const host =
12
+ flags["network"] === true
13
+ ? "0.0.0.0"
14
+ : (flags["host"] as string) || "127.0.0.1";
12
15
  const dbMode =
13
16
  (flags["db-mode"] as string) || cfg.server.db.mode || "ephemeral";
14
17
  const dbPath =
package/src/cli/main.ts CHANGED
@@ -29,7 +29,8 @@ async function main() {
29
29
 
30
30
  if (!cmd) {
31
31
  const { runSolforge } = await import("./run-solforge");
32
- await runSolforge();
32
+ // Pass through any flags provided when no explicit command was given
33
+ await runSolforge(raw);
33
34
  return;
34
35
  }
35
36
 
@@ -45,8 +46,9 @@ async function main() {
45
46
 
46
47
  // Alias: solforge start -> solforge rpc start
47
48
  if (cmd === "start") {
48
- const { rpcStartCommand } = await import("./commands/rpc-start");
49
- await rpcStartCommand(rest);
49
+ // Run the full Solforge flow (config ensure + bootstrap + servers)
50
+ const { runSolforge } = await import("./run-solforge");
51
+ await runSolforge(rest);
50
52
  return;
51
53
  }
52
54
 
@@ -134,6 +136,8 @@ Commands:
134
136
  Options:
135
137
  -h, --help Show help
136
138
  -v, --version Show version
139
+ --network Bind servers to 0.0.0.0 (LAN access)
140
+ -y, --ci Non-interactive; auto-accept prompts (use existing config)
137
141
  `);
138
142
  }
139
143
 
@@ -9,17 +9,25 @@ import { startRpcServers } from "../rpc/start";
9
9
  import { bootstrapEnvironment } from "./bootstrap";
10
10
  import { cancelSetup } from "./setup-utils";
11
11
  import { runSetupWizard } from "./setup-wizard";
12
+ import { parseFlags } from "./utils/args";
12
13
 
13
14
  const CONFIG_PATH = "sf.config.json";
14
15
 
15
- export async function runSolforge() {
16
- const config = await ensureConfig();
17
- await startWithConfig(config);
16
+ export async function runSolforge(args: string[] = []) {
17
+ const { flags } = parseFlags(args);
18
+ const ci = flags["ci"] === true || flags["y"] === true;
19
+ const config = await ensureConfig(ci);
20
+ await startWithConfig(config, args);
18
21
  }
19
22
 
20
- async function ensureConfig(): Promise<SolforgeConfig> {
23
+ async function ensureConfig(ci = false): Promise<SolforgeConfig> {
21
24
  const exists = await Bun.file(CONFIG_PATH).exists();
22
25
  if (!exists) {
26
+ if (ci) {
27
+ // Non-interactive: write defaults and continue
28
+ await saveConfig(defaultConfig);
29
+ return defaultConfig;
30
+ }
23
31
  p.intro("Solforge setup");
24
32
  const config = await runSetupWizard();
25
33
  await saveConfig(config);
@@ -28,6 +36,7 @@ async function ensureConfig(): Promise<SolforgeConfig> {
28
36
  }
29
37
 
30
38
  const current = await readConfig(CONFIG_PATH);
39
+ if (ci) return current; // Non-interactive: always reuse existing config
31
40
  const reuse = await p.confirm({
32
41
  message: `Use existing config at ${CONFIG_PATH}?`,
33
42
  initialValue: true,
@@ -41,8 +50,13 @@ async function ensureConfig(): Promise<SolforgeConfig> {
41
50
  return updated;
42
51
  }
43
52
 
44
- async function startWithConfig(config: SolforgeConfig) {
45
- const host = String(process.env.RPC_HOST || "127.0.0.1");
53
+ async function startWithConfig(config: SolforgeConfig, args: string[] = []) {
54
+ const { flags } = parseFlags(args);
55
+ const host = String(
56
+ flags["network"] === true
57
+ ? "0.0.0.0"
58
+ : ((flags["host"] as string) ?? process.env.RPC_HOST ?? "127.0.0.1"),
59
+ );
46
60
  const rpcPort = Number(config.server.rpcPort || defaultConfig.server.rpcPort);
47
61
  const wsPort = Number(config.server.wsPort || rpcPort + 1);
48
62
  const guiEnabled = config.gui?.enabled !== false;