@memfork/cli 0.1.1 → 0.1.3
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/dist/cli.js +3 -2
- package/dist/commands/doctor.d.ts +1 -0
- package/dist/commands/doctor.js +25 -0
- package/dist/commands/init.js +3 -2
- package/dist/commands/install.js +3 -2
- package/dist/commands/join.js +1 -1
- package/dist/commands/ops.js +5 -4
- package/dist/commands/ui-server.d.ts +1 -1
- package/dist/commands/ui-server.js +4 -4
- package/dist/config.d.ts +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
import { Command } from "commander";
|
|
22
22
|
import chalk from "chalk";
|
|
23
23
|
import { cmdInit } from "./commands/init.js";
|
|
24
|
-
import { cmdDoctor } from "./commands/doctor.js";
|
|
24
|
+
import { cmdDoctor, cmdDoctorEnv } from "./commands/doctor.js";
|
|
25
25
|
import { cmdInstall } from "./commands/install.js";
|
|
26
26
|
import { cmdStatus, cmdLog, cmdRecall, cmdCommit, cmdMerge, cmdProposals, cmdUi, cmdShow, cmdDiff, cmdDelegates, cmdGrant, cmdGrantMemwal, cmdRevoke, cmdBranch, cmdCheckout, } from "./commands/ops.js";
|
|
27
27
|
import { cmdJoin } from "./commands/join.js";
|
|
@@ -39,7 +39,8 @@ program
|
|
|
39
39
|
program
|
|
40
40
|
.command("doctor")
|
|
41
41
|
.description("verify config, credentials, Sui connection, and MemWal")
|
|
42
|
-
.
|
|
42
|
+
.option("--env", "print MEMFORK_* env vars ready to paste into .env.local")
|
|
43
|
+
.action(wrap((opts) => opts.env ? cmdDoctorEnv() : cmdDoctor()));
|
|
43
44
|
program
|
|
44
45
|
.command("join")
|
|
45
46
|
.description("onboard to an existing tree (team member setup)")
|
package/dist/commands/doctor.js
CHANGED
|
@@ -22,6 +22,31 @@ function printCheck(c) {
|
|
|
22
22
|
console.log(` ${chalk.cyan("→")} ${c.fix}`);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
export async function cmdDoctorEnv() {
|
|
26
|
+
let cfg;
|
|
27
|
+
try {
|
|
28
|
+
cfg = resolveConfig();
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
console.error(chalk.red("✗ Could not resolve config: " + e.message));
|
|
32
|
+
console.error(chalk.dim(" Run `memfork init` first."));
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
console.log("");
|
|
36
|
+
console.log(chalk.dim("# MemForks environment variables — paste into .env.local"));
|
|
37
|
+
console.log(chalk.yellow("# Keep these private. Do not commit or share this output."));
|
|
38
|
+
console.log("");
|
|
39
|
+
console.log(`MEMFORK_TREE_ID=${cfg.treeId}`);
|
|
40
|
+
console.log(`MEMFORK_PRIVATE_KEY=${cfg.privateKey}`);
|
|
41
|
+
console.log(`MEMFORK_MEMWAL_ACCOUNT=${cfg.memwalAccountId}`);
|
|
42
|
+
console.log(`MEMFORK_MEMWAL_KEY=${cfg.memwalKey}`);
|
|
43
|
+
console.log(`MEMFORK_NETWORK=${cfg.network}`);
|
|
44
|
+
if (cfg.rpcUrl)
|
|
45
|
+
console.log(`MEMFORK_RPC_URL=${cfg.rpcUrl}`);
|
|
46
|
+
if (cfg.packageId)
|
|
47
|
+
console.log(`MEMFORK_PACKAGE_ID=${cfg.packageId}`);
|
|
48
|
+
console.log("");
|
|
49
|
+
}
|
|
25
50
|
export async function cmdDoctor() {
|
|
26
51
|
console.log("");
|
|
27
52
|
console.log(chalk.bold("memfork doctor"));
|
package/dist/commands/init.js
CHANGED
|
@@ -56,6 +56,7 @@ async function cmdInitQuick() {
|
|
|
56
56
|
console.log("");
|
|
57
57
|
const network = await select({
|
|
58
58
|
message: "Sui network",
|
|
59
|
+
default: "mainnet",
|
|
59
60
|
choices: [
|
|
60
61
|
{ value: "mainnet", name: "mainnet (recommended — gas sponsored by MemForks)" },
|
|
61
62
|
{ value: "testnet", name: "testnet (free gas via faucet)" },
|
|
@@ -223,7 +224,7 @@ async function cmdInitManual() {
|
|
|
223
224
|
// ── Write ──────────────────────────────────────────────────────────────────────
|
|
224
225
|
writeProjectConfig({
|
|
225
226
|
treeId,
|
|
226
|
-
network: network ?? "
|
|
227
|
+
network: network ?? "mainnet",
|
|
227
228
|
defaultBranch,
|
|
228
229
|
...(rpcUrl ? { rpcUrl } : {}),
|
|
229
230
|
...(packageId ? { packageId } : {}),
|
|
@@ -244,7 +245,7 @@ async function cmdInitManual() {
|
|
|
244
245
|
const client = await MemForksClient.connect({
|
|
245
246
|
treeId,
|
|
246
247
|
signer: resolvedKey,
|
|
247
|
-
network: network ?? "
|
|
248
|
+
network: network ?? "mainnet",
|
|
248
249
|
...(rpcUrl ? { rpcUrl } : {}),
|
|
249
250
|
...(packageId ? { packageId } : {}),
|
|
250
251
|
});
|
package/dist/commands/install.js
CHANGED
|
@@ -21,7 +21,8 @@ import path from "node:path";
|
|
|
21
21
|
import { fileURLToPath } from "node:url";
|
|
22
22
|
import { readCredentials, readProjectConfig, MEMWAL_CONSTANTS } from "../config.js";
|
|
23
23
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
24
|
-
|
|
24
|
+
// dist/commands/install.js → packages/cli → packages → repo root → plugins/
|
|
25
|
+
const PLUGIN_ROOT = path.resolve(__dirname, "..", "..", "..", "..", "plugins");
|
|
25
26
|
function ok(s) { return chalk.green("✓") + " " + s; }
|
|
26
27
|
function warn(s) { return chalk.yellow("⚠") + " " + s; }
|
|
27
28
|
function tip(s) { return chalk.cyan("→") + " " + s; }
|
|
@@ -36,7 +37,7 @@ function resolveMcpCreds() {
|
|
|
36
37
|
const tree = creds.trees[project.treeId];
|
|
37
38
|
if (!tree?.memwalAccountId || !tree?.memwalKey)
|
|
38
39
|
return null;
|
|
39
|
-
const rawNetwork = project.network ?? "
|
|
40
|
+
const rawNetwork = project.network ?? "mainnet";
|
|
40
41
|
const network = (rawNetwork === "mainnet" ? "mainnet" : "testnet");
|
|
41
42
|
const relayer = MEMWAL_CONSTANTS[network].relayer;
|
|
42
43
|
return {
|
package/dist/commands/join.js
CHANGED
|
@@ -40,7 +40,7 @@ export async function cmdJoin() {
|
|
|
40
40
|
process.exit(1);
|
|
41
41
|
}
|
|
42
42
|
const treeId = project.treeId;
|
|
43
|
-
const network = project.network ?? "
|
|
43
|
+
const network = project.network ?? "mainnet";
|
|
44
44
|
console.log(dim(` Found .memfork/config.json`));
|
|
45
45
|
console.log(dim(` tree: ${treeId}`));
|
|
46
46
|
console.log(dim(` network: ${network}`));
|
package/dist/commands/ops.js
CHANGED
|
@@ -165,7 +165,7 @@ export async function cmdUi(opts = {}) {
|
|
|
165
165
|
const appDir = findAppDir();
|
|
166
166
|
if (!appDir) {
|
|
167
167
|
console.log(chalk.yellow("Could not find the MemForks app directory."));
|
|
168
|
-
console.log(chalk.dim("Build the app manually: cd
|
|
168
|
+
console.log(chalk.dim("Build the app manually: cd apps/visualizer && npm run build"));
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
171
|
const distDir = path.join(appDir, "dist");
|
|
@@ -339,7 +339,7 @@ export async function cmdGrantMemwal(opts) {
|
|
|
339
339
|
const { cfg } = await getClient();
|
|
340
340
|
const { addDelegateKey } = await import("@mysten-incubation/memwal/account");
|
|
341
341
|
const { JsonRpcHTTPTransport, SuiJsonRpcClient, getJsonRpcFullnodeUrl } = await import("@mysten/sui/jsonRpc");
|
|
342
|
-
const network = cfg.network ?? "
|
|
342
|
+
const network = cfg.network ?? "mainnet";
|
|
343
343
|
const consts = MEMWAL_CONSTANTS[network === "mainnet" ? "mainnet" : "testnet"];
|
|
344
344
|
const rpcUrl = getJsonRpcFullnodeUrl(network);
|
|
345
345
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -427,9 +427,10 @@ function extractFacts(response) {
|
|
|
427
427
|
}
|
|
428
428
|
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
429
429
|
function findAppDir() {
|
|
430
|
+
// dist/commands/ops.js → packages/cli → packages → repo root → apps/visualizer
|
|
430
431
|
const candidates = [
|
|
431
|
-
new URL("
|
|
432
|
-
new URL("
|
|
432
|
+
new URL("../../../../apps/visualizer", import.meta.url).pathname,
|
|
433
|
+
new URL("../../../../../apps/visualizer", import.meta.url).pathname,
|
|
433
434
|
];
|
|
434
435
|
for (const c of candidates) {
|
|
435
436
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `memfork ui` — local HTTP server.
|
|
3
3
|
*
|
|
4
|
-
* Serves the pre-built React app from
|
|
4
|
+
* Serves the pre-built React app from apps/visualizer/dist/ as static files and
|
|
5
5
|
* exposes two API routes so the React app can discover the current tree
|
|
6
6
|
* config and recall MemWal facts without exposing credentials in the
|
|
7
7
|
* browser bundle.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `memfork ui` — local HTTP server.
|
|
3
3
|
*
|
|
4
|
-
* Serves the pre-built React app from
|
|
4
|
+
* Serves the pre-built React app from apps/visualizer/dist/ as static files and
|
|
5
5
|
* exposes two API routes so the React app can discover the current tree
|
|
6
6
|
* config and recall MemWal facts without exposing credentials in the
|
|
7
7
|
* browser bundle.
|
|
@@ -45,7 +45,7 @@ async function handleApiConfig(res) {
|
|
|
45
45
|
const project = readProjectConfig();
|
|
46
46
|
const creds = readCredentials();
|
|
47
47
|
const treeId = project?.treeId ?? creds.default ?? null;
|
|
48
|
-
const network = (project?.network ?? "
|
|
48
|
+
const network = (project?.network ?? "mainnet");
|
|
49
49
|
const stored = treeId ? creds.trees[treeId] : undefined;
|
|
50
50
|
json(res, {
|
|
51
51
|
treeId,
|
|
@@ -76,7 +76,7 @@ async function handleApiFacts(res, url) {
|
|
|
76
76
|
const project = readProjectConfig();
|
|
77
77
|
const creds = readCredentials();
|
|
78
78
|
const treeId = project?.treeId ?? creds.default;
|
|
79
|
-
const network = (project?.network ?? "
|
|
79
|
+
const network = (project?.network ?? "mainnet");
|
|
80
80
|
const stored = treeId ? creds.trees[treeId] : undefined;
|
|
81
81
|
if (!stored?.memwalKey || !stored?.memwalAccountId || !treeId) {
|
|
82
82
|
json(res, { facts: [] });
|
|
@@ -109,7 +109,7 @@ async function handleApiHistory(res, url) {
|
|
|
109
109
|
const project = readProjectConfig();
|
|
110
110
|
const creds = readCredentials();
|
|
111
111
|
const treeId = project?.treeId ?? creds.default;
|
|
112
|
-
const network = (project?.network ?? "
|
|
112
|
+
const network = (project?.network ?? "mainnet");
|
|
113
113
|
const stored = treeId ? creds.trees[treeId] : undefined;
|
|
114
114
|
if (!stored?.memwalKey || !stored?.memwalAccountId || !treeId) {
|
|
115
115
|
json(res, { commits: [] });
|
package/dist/config.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare const MEMWAL_CONSTANTS: {
|
|
|
37
37
|
export interface ProjectConfig {
|
|
38
38
|
/** Sui MemoryTree object ID. */
|
|
39
39
|
treeId?: string;
|
|
40
|
-
/** Sui network. Default: "
|
|
40
|
+
/** Sui network. Default: "mainnet". */
|
|
41
41
|
network?: "testnet" | "mainnet" | "devnet" | "localnet";
|
|
42
42
|
/** Default branch name. Default: "main". */
|
|
43
43
|
defaultBranch?: string;
|