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.
- package/README.md +471 -79
- package/cli.cjs +106 -78
- package/package.json +1 -1
- package/scripts/install.sh +1 -1
- package/scripts/postinstall.cjs +66 -58
- package/server/methods/program/get-token-accounts-by-owner.ts +7 -2
- package/server/ws-server.ts +4 -1
- package/src/api-server-entry.ts +91 -91
- package/src/cli/commands/rpc-start.ts +4 -1
- package/src/cli/main.ts +7 -3
- package/src/cli/run-solforge.ts +20 -6
- package/src/commands/add-program.ts +324 -328
- package/src/commands/init.ts +106 -106
- package/src/commands/list.ts +125 -125
- package/src/commands/mint.ts +246 -246
- package/src/commands/start.ts +834 -831
- package/src/commands/status.ts +80 -80
- package/src/commands/stop.ts +381 -382
- package/src/config/manager.ts +149 -149
- package/src/gui/public/app.css +1556 -1
- package/src/gui/public/build/main.css +1569 -1
- package/src/gui/server.ts +20 -21
- package/src/gui/src/app.tsx +56 -37
- package/src/gui/src/components/airdrop-mint-form.tsx +17 -11
- package/src/gui/src/components/clone-program-modal.tsx +6 -6
- package/src/gui/src/components/clone-token-modal.tsx +7 -7
- package/src/gui/src/components/modal.tsx +13 -11
- package/src/gui/src/components/programs-panel.tsx +27 -15
- package/src/gui/src/components/status-panel.tsx +31 -17
- package/src/gui/src/components/tokens-panel.tsx +25 -19
- package/src/gui/src/index.css +491 -463
- package/src/index.ts +161 -146
- package/src/rpc/start.ts +1 -1
- package/src/services/api-server.ts +470 -473
- package/src/services/port-manager.ts +167 -167
- package/src/services/process-registry.ts +143 -143
- package/src/services/program-cloner.ts +312 -312
- package/src/services/token-cloner.ts +799 -797
- package/src/services/validator.ts +288 -288
- package/src/types/config.ts +71 -71
- package/src/utils/shell.ts +75 -75
- 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 =
|
|
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
|
-
|
|
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
|
-
|
|
49
|
-
await
|
|
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
|
|
package/src/cli/run-solforge.ts
CHANGED
|
@@ -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
|
|
17
|
-
|
|
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
|
|
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;
|