@memfork/cli 0.1.43 → 0.1.45
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/branch.d.ts +4 -0
- package/dist/branch.js +23 -2
- package/dist/commands/install.js +75 -10
- package/package.json +1 -1
- package/plugins/codex/.agents/plugins/marketplace.json +12 -0
- /package/plugins/codex/{.codex-plugin → plugins/memforks/.codex-plugin}/plugin.json +0 -0
- /package/plugins/codex/{README.md → plugins/memforks/README.md} +0 -0
- /package/plugins/codex/{skills → plugins/memforks/skills}/memforks-status/SKILL.md +0 -0
- /package/plugins/codex/{skills → plugins/memforks/skills}/memory-commit/SKILL.md +0 -0
- /package/plugins/codex/{skills → plugins/memforks/skills}/memory-fork/SKILL.md +0 -0
- /package/plugins/codex/{skills → plugins/memforks/skills}/memory-recall/SKILL.md +0 -0
package/dist/branch.d.ts
CHANGED
|
@@ -48,9 +48,13 @@ export declare function pickBranch(sources: BranchSources): string;
|
|
|
48
48
|
/**
|
|
49
49
|
* Resolve the branch a command should operate on, applying the full
|
|
50
50
|
* precedence chain (reads MEMFORK_BRANCH and the current git branch).
|
|
51
|
+
*
|
|
52
|
+
* Prints a warning when no git branch is detected and no fallback is
|
|
53
|
+
* configured — the caller will operate on "main" which may be unintended.
|
|
51
54
|
*/
|
|
52
55
|
export declare function resolveBranch(opts?: {
|
|
53
56
|
explicit?: string;
|
|
54
57
|
configDefault?: string;
|
|
55
58
|
cwd?: string;
|
|
59
|
+
silent?: boolean;
|
|
56
60
|
}): string;
|
package/dist/branch.js
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* the core guarantees those integrations are unaffected by this logic.
|
|
19
19
|
*/
|
|
20
20
|
import { execSync } from "node:child_process";
|
|
21
|
+
import chalk from "chalk";
|
|
21
22
|
/**
|
|
22
23
|
* Read the current git branch, or undefined when there is no usable answer.
|
|
23
24
|
*
|
|
@@ -63,12 +64,32 @@ export function pickBranch(sources) {
|
|
|
63
64
|
/**
|
|
64
65
|
* Resolve the branch a command should operate on, applying the full
|
|
65
66
|
* precedence chain (reads MEMFORK_BRANCH and the current git branch).
|
|
67
|
+
*
|
|
68
|
+
* Prints a warning when no git branch is detected and no fallback is
|
|
69
|
+
* configured — the caller will operate on "main" which may be unintended.
|
|
66
70
|
*/
|
|
67
71
|
export function resolveBranch(opts = {}) {
|
|
68
|
-
|
|
72
|
+
const git = gitBranch(opts.cwd);
|
|
73
|
+
const branch = pickBranch({
|
|
69
74
|
explicit: opts.explicit,
|
|
70
75
|
env: process.env["MEMFORK_BRANCH"],
|
|
71
|
-
git
|
|
76
|
+
git,
|
|
72
77
|
configDefault: opts.configDefault,
|
|
73
78
|
});
|
|
79
|
+
// Warn when we fell all the way through to "main" because there is no git
|
|
80
|
+
// repo and no other source — this is almost always unintended.
|
|
81
|
+
if (!opts.silent &&
|
|
82
|
+
branch === "main" &&
|
|
83
|
+
!opts.explicit &&
|
|
84
|
+
!process.env["MEMFORK_BRANCH"] &&
|
|
85
|
+
!git &&
|
|
86
|
+
!opts.configDefault) {
|
|
87
|
+
process.stderr.write(chalk.yellow("⚠") +
|
|
88
|
+
" No git branch detected — committing to " +
|
|
89
|
+
chalk.bold("main") +
|
|
90
|
+
". Run " +
|
|
91
|
+
chalk.dim("git init && git checkout -b <branch>") +
|
|
92
|
+
" to use branch-scoped memory.\n");
|
|
93
|
+
}
|
|
94
|
+
return branch;
|
|
74
95
|
}
|
package/dist/commands/install.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* codex — ~/.codex/config.toml + installs plugin into this project
|
|
16
16
|
*/
|
|
17
17
|
import chalk from "chalk";
|
|
18
|
+
import { execSync } from "node:child_process";
|
|
18
19
|
import fs from "node:fs";
|
|
19
20
|
import os from "node:os";
|
|
20
21
|
import path from "node:path";
|
|
@@ -122,17 +123,81 @@ function installCodex(cwd) {
|
|
|
122
123
|
else {
|
|
123
124
|
console.log(warn("MemWal MCP skipped — run `memfork init` first to provision credentials."));
|
|
124
125
|
}
|
|
125
|
-
// ── 2. Codex plugin
|
|
126
|
+
// ── 2. Codex plugin — build marketplace layout + register + install ───────
|
|
127
|
+
//
|
|
128
|
+
// Codex uses a marketplace model. We copy the plugin source into
|
|
129
|
+
// ~/.memfork/codex-plugin/ (a global location so it works from any project),
|
|
130
|
+
// register it as a local marketplace, then install memforks@memforks.
|
|
131
|
+
// The user runs nothing extra.
|
|
132
|
+
const marketplaceDst = path.join(os.homedir(), ".memfork", "codex-plugin");
|
|
126
133
|
const pluginSrc = path.join(PLUGIN_ROOT, "codex");
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
copyDir(pluginSrc, marketplaceDst);
|
|
135
|
+
console.log(ok(`Plugin files: ${dim(marketplaceDst)}`));
|
|
136
|
+
// Register marketplace (idempotent — Codex no-ops if already added).
|
|
137
|
+
try {
|
|
138
|
+
execSync(`codex plugin marketplace add ${JSON.stringify(marketplaceDst)} --json`, {
|
|
139
|
+
stdio: "pipe",
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
catch (e) {
|
|
143
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
144
|
+
// Codex exits non-zero when the marketplace is already registered.
|
|
145
|
+
if (!msg.includes("already")) {
|
|
146
|
+
console.log(warn(`Marketplace registration failed: ${msg}`));
|
|
147
|
+
console.log(dim(` Run manually: codex plugin marketplace add ~/.memfork/codex-plugin`));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// Install / upgrade the plugin (idempotent).
|
|
151
|
+
try {
|
|
152
|
+
execSync(`codex plugin add memforks@memforks --json`, { stdio: "pipe" });
|
|
153
|
+
console.log(ok("Plugin: memforks@memforks (installed)"));
|
|
154
|
+
}
|
|
155
|
+
catch (e) {
|
|
156
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
157
|
+
// Already installed at the same version is not a real error.
|
|
158
|
+
if (msg.includes("already")) {
|
|
159
|
+
console.log(ok("Plugin: memforks@memforks (up to date)"));
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
console.log(warn(`Plugin install failed: ${msg}`));
|
|
163
|
+
console.log(dim(` Run manually: codex plugin add memforks@memforks`));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// ── 3. Project-scoped Codex config (.codex/config.toml) ──────────────────
|
|
167
|
+
//
|
|
168
|
+
// Codex defaults to read-only sandbox, which blocks `memfork commit` (it
|
|
169
|
+
// needs to write ~/.memfork/ and hit the network). A project-level override
|
|
170
|
+
// turns on workspace-write + network without touching the user's global
|
|
171
|
+
// Codex config or any other project.
|
|
172
|
+
const projectCodexDir = path.join(cwd, ".codex");
|
|
173
|
+
const projectCodexCfg = path.join(projectCodexDir, "config.toml");
|
|
174
|
+
fs.mkdirSync(projectCodexDir, { recursive: true });
|
|
175
|
+
const sandboxBlock = `# Written by memfork install codex
|
|
176
|
+
# workspace-write + network_access lets the agent run \`memfork commit\`
|
|
177
|
+
# without escalation prompts, scoped to this project only.
|
|
178
|
+
sandbox_mode = "workspace-write"
|
|
179
|
+
|
|
180
|
+
[sandbox_workspace_write]
|
|
181
|
+
network_access = true
|
|
182
|
+
`;
|
|
183
|
+
if (!fs.existsSync(projectCodexCfg)) {
|
|
184
|
+
fs.writeFileSync(projectCodexCfg, sandboxBlock, "utf8");
|
|
185
|
+
console.log(ok(`Sandbox: ${dim(projectCodexCfg)} (workspace-write + network)`));
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
// File already exists — only patch if the keys are missing.
|
|
189
|
+
const existing = fs.readFileSync(projectCodexCfg, "utf8");
|
|
190
|
+
let patched = existing;
|
|
191
|
+
if (!existing.includes("sandbox_mode")) {
|
|
192
|
+
patched += "\n" + sandboxBlock;
|
|
193
|
+
fs.writeFileSync(projectCodexCfg, patched, "utf8");
|
|
194
|
+
console.log(ok(`Sandbox: ${dim(projectCodexCfg)} (patched workspace-write + network)`));
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
console.log(ok(`Sandbox: ${dim(projectCodexCfg)} (already configured)`));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
// ── Summary (Codex) ────────────────────────────────────────────────────────
|
|
136
201
|
console.log("");
|
|
137
202
|
console.log(tip("The agent now has:"));
|
|
138
203
|
console.log(dim(" memwal_recall / memwal_remember — memory storage via MemWal MCP"));
|
package/package.json
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "memforks",
|
|
3
|
+
"interface": { "displayName": "MemForks" },
|
|
4
|
+
"plugins": [
|
|
5
|
+
{
|
|
6
|
+
"name": "memforks",
|
|
7
|
+
"source": { "source": "local", "path": "./plugins/memforks" },
|
|
8
|
+
"policy": { "installation": "AVAILABLE", "authentication": "ON_USE" },
|
|
9
|
+
"category": "Productivity"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|