@memfork/cli 0.1.0 → 0.1.2

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 ADDED
@@ -0,0 +1,109 @@
1
+ # @memfork/cli
2
+
3
+ Command-line interface for [MemForks](https://github.com/memfork/memforks) — on-chain, branch-aware agent memory.
4
+
5
+ Initialize a memory tree, commit facts, branch and merge, onboard teammates, and install IDE plugins.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g @memfork/cli
11
+ # or run without installing
12
+ npx @memfork/cli init
13
+ ```
14
+
15
+ ## Quick start
16
+
17
+ ```bash
18
+ # One-shot setup on mainnet (gas sponsored — no SUI required)
19
+ memfork init
20
+
21
+ # Verify everything works
22
+ memfork doctor
23
+
24
+ # Install Cursor plugin (MemWal MCP + MemForks rules)
25
+ memfork install cursor
26
+ ```
27
+
28
+ Restart your IDE. The agent recalls and commits memory scoped to your Git branch.
29
+
30
+ ## Commands
31
+
32
+ ### Setup
33
+
34
+ | Command | Description |
35
+ |---------|-------------|
36
+ | `memfork init` | Interactive setup — create or link a memory tree |
37
+ | `memfork init --quick` | Auto-provision key, MemWal account, and tree (testnet) |
38
+ | `memfork join` | Onboard to an existing tree (team member) |
39
+ | `memfork doctor` | Verify config, RPC, credentials, and on-chain state |
40
+ | `memfork install cursor` | Install Cursor MCP + rules |
41
+ | `memfork install codex` | Install Codex plugin scaffold |
42
+
43
+ ### Memory operations
44
+
45
+ | Command | Description |
46
+ |---------|-------------|
47
+ | `memfork status` | Tree, network, branch, signer |
48
+ | `memfork log` | Recent commits on a branch |
49
+ | `memfork recall <query>` | Semantic recall from CLI |
50
+ | `memfork commit -m "…" --facts "…"` | Anchor facts on-chain |
51
+ | `memfork branch <name>` | Create a new branch |
52
+ | `memfork checkout <name>` | Switch active branch |
53
+ | `memfork diff <a> <b>` | Fact diff between branches |
54
+ | `memfork merge <from> <into> --resolver <id>` | Propose a merge |
55
+ | `memfork proposals` | List open merge proposals |
56
+
57
+ ### Access control
58
+
59
+ | Command | Description |
60
+ |---------|-------------|
61
+ | `memfork grant --agent <addr>` | Grant on-chain delegate access |
62
+ | `memfork grant-memwal --agent <addr> --pubkey <hex>` | Register MemWal decrypt key |
63
+ | `memfork revoke --agent <addr>` | Revoke delegate |
64
+ | `memfork delegates` | List current delegates |
65
+
66
+ ## Config files
67
+
68
+ | File | Committable? | Contents |
69
+ |------|--------------|----------|
70
+ | `.memfork/config.json` | Yes | `treeId`, `network`, `defaultBranch` |
71
+ | `~/.memfork/credentials.json` | No | Private keys, MemWal delegate key |
72
+
73
+ Never commit credentials. Share `.memfork/config.json` via git so teammates can `memfork join`.
74
+
75
+ ## Team onboarding
76
+
77
+ **Teammate:**
78
+
79
+ ```bash
80
+ git clone <repo> # .memfork/config.json is already there
81
+ memfork join
82
+ ```
83
+
84
+ **Tree owner** (runs the printed commands):
85
+
86
+ ```bash
87
+ memfork grant --agent <teammate-address>
88
+ memfork grant-memwal --agent <teammate-address> --pubkey <hex>
89
+ ```
90
+
91
+ ## Environment variables
92
+
93
+ | Variable | Description |
94
+ |----------|-------------|
95
+ | `MEMFORK_TREE_ID` | MemoryTree object ID |
96
+ | `MEMFORK_PRIVATE_KEY` | Sui private key (`suiprivkey1…`) |
97
+ | `MEMFORK_NETWORK` | `mainnet` (default) or `testnet` |
98
+ | `MEMFORK_SPONSOR_URL` | Gas sponsor service URL |
99
+ | `MEMFORK_PACKAGE_ID` | Override Move package ID |
100
+
101
+ ## Links
102
+
103
+ - [@memfork/core](https://www.npmjs.com/package/@memfork/core) — TypeScript SDK
104
+ - [Developer guide](https://github.com/memfork/memforks/blob/main/docs/developer-guide.md)
105
+ - [Git comparison](https://github.com/memfork/memforks/blob/main/docs/git-comparison.md)
106
+
107
+ ## License
108
+
109
+ Apache-2.0
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
- .action(wrap(cmdDoctor));
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)")
@@ -9,4 +9,5 @@
9
9
  * ✓ / ✗ Signer address matches tree owner (or has delegate)
10
10
  * ✓ / ✗ MemWal account reachable
11
11
  */
12
+ export declare function cmdDoctorEnv(): Promise<void>;
12
13
  export declare function cmdDoctor(): Promise<void>;
@@ -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"));
@@ -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
- const PLUGIN_ROOT = path.resolve(__dirname, "..", "..", "..", "plugins");
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; }
@@ -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 app && npm run build"));
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");
@@ -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("../../../app", import.meta.url).pathname,
432
- new URL("../../../../app", import.meta.url).pathname,
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 app/dist/ as static files and
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 app/dist/ as static files and
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memfork/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "MemForks CLI — init, commit, recall, merge, install plugins",
5
5
  "type": "module",
6
6
  "bin": {
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@inquirer/prompts": "^8.5.2",
27
- "@memfork/core": "^0.1.0",
27
+ "@memfork/core": "^0.1.1",
28
28
  "chalk": "^5.6.2",
29
29
  "commander": "^15.0.0"
30
30
  },