@memfork/cli 0.1.18 → 0.1.19

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.
@@ -49,7 +49,7 @@ async function handleApiConfig(res) {
49
49
  const stored = treeId ? creds.trees[treeId] : undefined;
50
50
  json(res, {
51
51
  treeId,
52
- packageId: project?.packageId ?? "0x7df9719d799386d34d657c49ae8cd6f5f03b39036f7c428b556095e42afd852f",
52
+ packageId: project?.packageId ?? "0xc13cc014fb8084b3468f6e5ffdc272e64ef35b7a912332eba7a0d44dd66b3121",
53
53
  network,
54
54
  rpcUrl: project?.rpcUrl ?? null,
55
55
  hasMemwal: !!(stored?.memwalKey && stored?.memwalAccountId),
package/dist/config.d.ts CHANGED
@@ -25,22 +25,22 @@
25
25
  export declare const MEMWAL_CONSTANTS: {
26
26
  readonly testnet: {
27
27
  readonly packageId: "0xcf6ad755a1cdff7217865c796778fabe5aa399cb0cf2eba986f4b582047229c6";
28
- readonly memforksPackageId: "0xc9f0a4964f810c794479bc5b66347998969d2c59d6797c313b8a96d2bdd6a914";
28
+ readonly memforksPackageId: "0x185e765a4979fb9d9089374f822485c88b9d0b2f91f9b1313a73043d5ef2357f";
29
29
  readonly registryId: "0xe80f2feec1c139616a86c9f71210152e2a7ca552b20841f2e192f99f75864437";
30
- readonly relayer: "https://relayer.staging.memwal.ai";
30
+ readonly relayer: "https://relayer-staging.memory.walrus.xyz";
31
31
  };
32
32
  readonly mainnet: {
33
33
  readonly packageId: "0xcee7a6fd8de52ce645c38332bde23d4a30fd9426bc4681409733dd50958a24c6";
34
- readonly memforksPackageId: "0x7df9719d799386d34d657c49ae8cd6f5f03b39036f7c428b556095e42afd852f";
34
+ readonly memforksPackageId: "0xc13cc014fb8084b3468f6e5ffdc272e64ef35b7a912332eba7a0d44dd66b3121";
35
35
  readonly registryId: "0x0da982cefa26864ae834a8a0504b904233d49e20fcc17c373c8bed99c75a7edd";
36
- readonly relayer: "https://relayer.memwal.ai";
36
+ readonly relayer: "https://relayer.memory.walrus.xyz";
37
37
  };
38
38
  };
39
39
  export interface ProjectConfig {
40
40
  /** Sui MemoryTree object ID. */
41
41
  treeId?: string;
42
42
  /** Sui network. Default: "mainnet". */
43
- network?: "testnet" | "mainnet" | "devnet" | "localnet";
43
+ network?: 'testnet' | 'mainnet' | 'devnet' | 'localnet';
44
44
  /** Default branch name. Default: "main". */
45
45
  defaultBranch?: string;
46
46
  /** Override Sui RPC URL. */
@@ -70,7 +70,7 @@ export interface ResolvedConfig {
70
70
  memwalAccountId: string;
71
71
  memwalKey: string;
72
72
  memwalRelayer: string;
73
- network: "testnet" | "mainnet" | "devnet" | "localnet";
73
+ network: 'testnet' | 'mainnet' | 'devnet' | 'localnet';
74
74
  defaultBranch: string;
75
75
  rpcUrl?: string;
76
76
  packageId?: string;
package/dist/config.js CHANGED
@@ -22,32 +22,32 @@
22
22
  *
23
23
  * Plugins and hooks call the CLI binary and never read credentials themselves.
24
24
  */
25
- import fs from "node:fs";
26
- import path from "node:path";
27
- import os from "node:os";
25
+ import fs from 'node:fs';
26
+ import path from 'node:path';
27
+ import os from 'node:os';
28
28
  // ─── Public network constants ─────────────────────────────────────────────────
29
29
  // Sources: https://docs.memwal.ai/contract/overview
30
30
  export const MEMWAL_CONSTANTS = {
31
31
  testnet: {
32
- packageId: "0xcf6ad755a1cdff7217865c796778fabe5aa399cb0cf2eba986f4b582047229c6",
33
- memforksPackageId: "0xc9f0a4964f810c794479bc5b66347998969d2c59d6797c313b8a96d2bdd6a914",
34
- registryId: "0xe80f2feec1c139616a86c9f71210152e2a7ca552b20841f2e192f99f75864437",
35
- relayer: "https://relayer.staging.memwal.ai",
32
+ packageId: '0xcf6ad755a1cdff7217865c796778fabe5aa399cb0cf2eba986f4b582047229c6',
33
+ memforksPackageId: '0x185e765a4979fb9d9089374f822485c88b9d0b2f91f9b1313a73043d5ef2357f',
34
+ registryId: '0xe80f2feec1c139616a86c9f71210152e2a7ca552b20841f2e192f99f75864437',
35
+ relayer: 'https://relayer-staging.memory.walrus.xyz',
36
36
  },
37
37
  mainnet: {
38
- packageId: "0xcee7a6fd8de52ce645c38332bde23d4a30fd9426bc4681409733dd50958a24c6",
39
- memforksPackageId: "0x7df9719d799386d34d657c49ae8cd6f5f03b39036f7c428b556095e42afd852f",
40
- registryId: "0x0da982cefa26864ae834a8a0504b904233d49e20fcc17c373c8bed99c75a7edd",
41
- relayer: "https://relayer.memwal.ai",
38
+ packageId: '0xcee7a6fd8de52ce645c38332bde23d4a30fd9426bc4681409733dd50958a24c6',
39
+ memforksPackageId: '0xc13cc014fb8084b3468f6e5ffdc272e64ef35b7a912332eba7a0d44dd66b3121',
40
+ registryId: '0x0da982cefa26864ae834a8a0504b904233d49e20fcc17c373c8bed99c75a7edd',
41
+ relayer: 'https://relayer.memory.walrus.xyz',
42
42
  },
43
43
  };
44
44
  // ─── Paths ────────────────────────────────────────────────────────────────────
45
45
  function defaultRelayer(network) {
46
- return MEMWAL_CONSTANTS[network]?.relayer
47
- ?? MEMWAL_CONSTANTS.mainnet.relayer;
46
+ return (MEMWAL_CONSTANTS[network]?.relayer ??
47
+ MEMWAL_CONSTANTS.mainnet.relayer);
48
48
  }
49
49
  export function projectConfigPath(cwd = process.cwd()) {
50
- return path.join(cwd, ".memfork", "config.json");
50
+ return path.join(cwd, '.memfork', 'config.json');
51
51
  }
52
52
  /**
53
53
  * Walk up the directory tree from `cwd` looking for a `.memfork/config.json`,
@@ -56,7 +56,7 @@ export function projectConfigPath(cwd = process.cwd()) {
56
56
  function findProjectConfigPath(cwd = process.cwd()) {
57
57
  let dir = cwd;
58
58
  while (true) {
59
- const candidate = path.join(dir, ".memfork", "config.json");
59
+ const candidate = path.join(dir, '.memfork', 'config.json');
60
60
  if (fs.existsSync(candidate))
61
61
  return candidate;
62
62
  const parent = path.dirname(dir);
@@ -66,7 +66,7 @@ function findProjectConfigPath(cwd = process.cwd()) {
66
66
  }
67
67
  }
68
68
  export function credentialsPath() {
69
- return path.join(os.homedir(), ".memfork", "credentials.json");
69
+ return path.join(os.homedir(), '.memfork', 'credentials.json');
70
70
  }
71
71
  // ─── Read helpers ─────────────────────────────────────────────────────────────
72
72
  export function readProjectConfig(cwd = process.cwd()) {
@@ -74,7 +74,7 @@ export function readProjectConfig(cwd = process.cwd()) {
74
74
  if (!p)
75
75
  return null;
76
76
  try {
77
- return JSON.parse(fs.readFileSync(p, "utf8"));
77
+ return JSON.parse(fs.readFileSync(p, 'utf8'));
78
78
  }
79
79
  catch {
80
80
  return null;
@@ -85,7 +85,7 @@ export function readCredentials() {
85
85
  if (!fs.existsSync(p))
86
86
  return { trees: {} };
87
87
  try {
88
- return JSON.parse(fs.readFileSync(p, "utf8"));
88
+ return JSON.parse(fs.readFileSync(p, 'utf8'));
89
89
  }
90
90
  catch {
91
91
  return { trees: {} };
@@ -94,14 +94,14 @@ export function readCredentials() {
94
94
  // ─── Write helpers ────────────────────────────────────────────────────────────
95
95
  export function writeProjectConfig(cfg, cwd = process.cwd()) {
96
96
  const root = findGitRoot(cwd) ?? cwd;
97
- const dir = path.join(root, ".memfork");
97
+ const dir = path.join(root, '.memfork');
98
98
  fs.mkdirSync(dir, { recursive: true });
99
- fs.writeFileSync(path.join(root, ".memfork", "config.json"), JSON.stringify(cfg, null, 2) + "\n", "utf8");
99
+ fs.writeFileSync(path.join(root, '.memfork', 'config.json'), JSON.stringify(cfg, null, 2) + '\n', 'utf8');
100
100
  }
101
101
  function findGitRoot(cwd) {
102
102
  let dir = cwd;
103
103
  while (true) {
104
- if (fs.existsSync(path.join(dir, ".git")))
104
+ if (fs.existsSync(path.join(dir, '.git')))
105
105
  return dir;
106
106
  const parent = path.dirname(dir);
107
107
  if (parent === dir)
@@ -110,10 +110,10 @@ function findGitRoot(cwd) {
110
110
  }
111
111
  }
112
112
  export function writeCredentials(creds) {
113
- const dir = path.join(os.homedir(), ".memfork");
113
+ const dir = path.join(os.homedir(), '.memfork');
114
114
  fs.mkdirSync(dir, { recursive: true });
115
115
  const p = credentialsPath();
116
- fs.writeFileSync(p, JSON.stringify(creds, null, 2) + "\n", "utf8");
116
+ fs.writeFileSync(p, JSON.stringify(creds, null, 2) + '\n', 'utf8');
117
117
  // 600: owner read+write only — no other users can read private keys.
118
118
  fs.chmodSync(p, 0o600);
119
119
  }
@@ -133,7 +133,7 @@ export function setDefaultTree(treeId) {
133
133
  export class ConfigError extends Error {
134
134
  constructor(message) {
135
135
  super(message);
136
- this.name = "ConfigError";
136
+ this.name = 'ConfigError';
137
137
  }
138
138
  }
139
139
  /**
@@ -145,21 +145,15 @@ export function resolveConfig(opts = {}) {
145
145
  const creds = readCredentials();
146
146
  const env = process.env;
147
147
  // ── Resolve treeId ──────────────────────────────────────────────────────────
148
- const treeId = env["MEMFORK_TREE_ID"] ??
149
- opts.treeId ??
150
- project?.treeId ??
151
- creds.default;
148
+ const treeId = env['MEMFORK_TREE_ID'] ?? opts.treeId ?? project?.treeId ?? creds.default;
152
149
  if (!treeId) {
153
- throw new ConfigError("No MemoryTree found. Run `memfork init` to create or link one.");
150
+ throw new ConfigError('No MemoryTree found. Run `memfork init` to create or link one.');
154
151
  }
155
152
  // ── Resolve credentials ────────────────────────────────────────────────────
156
153
  const stored = creds.trees[treeId];
157
- const privateKey = env["MEMFORK_PRIVATE_KEY"] ??
158
- stored?.privateKey;
159
- const memwalAccountId = env["MEMFORK_MEMWAL_ACCOUNT"] ??
160
- stored?.memwalAccountId;
161
- const memwalKey = env["MEMFORK_MEMWAL_KEY"] ??
162
- stored?.memwalKey;
154
+ const privateKey = env['MEMFORK_PRIVATE_KEY'] ?? stored?.privateKey;
155
+ const memwalAccountId = env['MEMFORK_MEMWAL_ACCOUNT'] ?? stored?.memwalAccountId;
156
+ const memwalKey = env['MEMFORK_MEMWAL_KEY'] ?? stored?.memwalKey;
163
157
  if (!privateKey) {
164
158
  throw new ConfigError(`No private key for tree ${treeId}. Run \`memfork init\` or set MEMFORK_PRIVATE_KEY.`);
165
159
  }
@@ -170,22 +164,23 @@ export function resolveConfig(opts = {}) {
170
164
  throw new ConfigError(`No MemWal delegate key for tree ${treeId}. Run \`memfork init\` or set MEMFORK_MEMWAL_KEY.`);
171
165
  }
172
166
  // ── Merge non-secret config ────────────────────────────────────────────────
173
- const network = (env["MEMFORK_NETWORK"] ??
167
+ const network = (env['MEMFORK_NETWORK'] ??
174
168
  project?.network ??
175
- "mainnet");
169
+ 'mainnet');
176
170
  return {
177
171
  treeId,
178
172
  privateKey,
179
173
  memwalAccountId,
180
174
  memwalKey,
181
- memwalRelayer: env["MEMFORK_RELAYER_URL"] ??
175
+ memwalRelayer: env['MEMFORK_RELAYER_URL'] ??
182
176
  stored?.memwalRelayer ??
183
177
  defaultRelayer(network),
184
178
  network,
185
- defaultBranch: project?.defaultBranch ?? "main",
186
- rpcUrl: env["MEMFORK_RPC_URL"] ?? project?.rpcUrl,
187
- packageId: env["MEMFORK_PACKAGE_ID"] ?? project?.packageId,
188
- sponsorUrl: env["MEMFORK_SPONSOR_URL"] ?? project?.["sponsorUrl"],
179
+ defaultBranch: project?.defaultBranch ?? 'main',
180
+ rpcUrl: env['MEMFORK_RPC_URL'] ?? project?.rpcUrl,
181
+ packageId: env['MEMFORK_PACKAGE_ID'] ?? project?.packageId,
182
+ sponsorUrl: env['MEMFORK_SPONSOR_URL'] ??
183
+ project?.['sponsorUrl'],
189
184
  };
190
185
  }
191
186
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memfork/cli",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "MemForks CLI — init, commit, recall, merge, install plugins",
5
5
  "repository": {
6
6
  "type": "git",