@mcpbox/mcpbox-claude 0.1.6 → 0.1.7

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.
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "mcpbox",
3
+ "interface": {
4
+ "displayName": "MCPBox"
5
+ },
6
+ "plugins": [
7
+ {
8
+ "name": "mcpbox",
9
+ "source": {
10
+ "source": "local",
11
+ "path": "."
12
+ },
13
+ "policy": {
14
+ "installation": "AVAILABLE",
15
+ "authentication": "ON_INSTALL"
16
+ },
17
+ "category": "Productivity"
18
+ }
19
+ ]
20
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mcpbox-claude",
3
3
  "description": "MCPBox × Claude Code glue. Drives the mcpbox MCP server (daruma tracker + full MeiSei pipeline torii→…→fujin→daruma). Ships /mcpbox:{tasks,plan,next,mine,status,close,sync,capture,doctor,mode} and pipeline commands, SessionStart/Stop/UserPromptSubmit hooks, and a managed CLAUDE.md policy that makes mcpbox the default tracker AND pipeline substrate.",
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "author": {
6
6
  "name": "tupical"
7
7
  },
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "mcpbox",
3
+ "version": "0.1.7",
4
+ "description": "MCPBox agent stack for Codex: the daruma tracker plus the MeiSei maturity pipeline behind one MCP server.",
5
+ "author": {
6
+ "name": "tupical"
7
+ },
8
+ "homepage": "https://mcpbox.ru",
9
+ "mcpServers": "./.mcp.json",
10
+ "interface": {
11
+ "displayName": "MCPBox",
12
+ "shortDescription": "Task tracker + maturity pipeline for agents.",
13
+ "longDescription": "One MCP endpoint (https://mcpbox.ru/v1/mcp) exposing the daruma tracker (tasks, plans, plan-only intake) and the platform pipeline torii→satori→enma→yatagarasu→fujin→daruma. Ships the routing policy as a skill and /mcpbox-* prompts.",
14
+ "developerName": "tupical",
15
+ "category": "Productivity",
16
+ "websiteURL": "https://mcpbox.ru"
17
+ }
18
+ }
package/.mcp.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "mcpServers": {
3
+ "mcpbox": {
4
+ "type": "http",
5
+ "url": "https://mcpbox.ru/v1/mcp",
6
+ "oauth_resource": "https://mcpbox.ru/v1/mcp"
7
+ }
8
+ }
9
+ }
@@ -39,8 +39,9 @@ Usage:
39
39
  mcpbox-claude init [--dir DIR] Write the managed CLAUDE.md policy block
40
40
  (daruma tracker + full pipeline). Idempotent.
41
41
  mcpbox-claude uninit [--dir DIR] Remove the managed CLAUDE.md policy block.
42
- mcpbox-claude codex-init [--dir DIR] Write AGENTS.md policy + ~/.codex/config.toml
43
- [mcp_servers.mcpbox]. Idempotent.
42
+ mcpbox-claude codex-init [--dir DIR] Write AGENTS.md policy, ~/.codex/config.toml
43
+ [mcp_servers.mcpbox], the mcpbox skill and
44
+ /mcpbox-* prompts. Idempotent.
44
45
  mcpbox-claude codex-uninit [--dir DIR]
45
46
  mcpbox-claude cursor-init [--dir DIR] Write .cursor/rules/mcpbox-policy.mdc +
46
47
  .cursor/mcp.json mcpbox entry. Idempotent.
@@ -102,16 +103,20 @@ function report(r) {
102
103
 
103
104
  async function cmdCodexInit(rest) {
104
105
  const { projectDir } = parseDirFlag(rest);
105
- const { policy, mcp } = await installCodex({ projectDir });
106
+ const { policy, mcp, skill, prompts } = await installCodex({ projectDir });
106
107
  report(policy);
107
108
  report(mcp);
109
+ report(skill);
110
+ report(prompts);
108
111
  }
109
112
 
110
113
  async function cmdCodexUninit(rest) {
111
114
  const { projectDir } = parseDirFlag(rest);
112
- const { policy, mcp } = await removeCodex({ projectDir });
115
+ const { policy, mcp, skill, prompts } = await removeCodex({ projectDir });
113
116
  report(policy);
114
117
  report(mcp);
118
+ report(skill);
119
+ report(prompts);
115
120
  }
116
121
 
117
122
  async function cmdCursorInit(rest) {
package/lib/codex.mjs CHANGED
@@ -1,19 +1,26 @@
1
1
  // Codex surface for the mcpbox harness — parity with the Claude CLAUDE.md
2
- // plugin. Two idempotent writes:
3
- // 1. AGENTS.md policy block (Codex reads it every session in the workspace).
2
+ // plugin. Four idempotent writes:
3
+ // 1. AGENTS.md policy block. Measured against Codex 0.146: AGENTS.md is
4
+ // read from the working directory, NOT from a parent — a global install
5
+ // lands it in ~/AGENTS.md where no project sees it, hence (3) and (4).
4
6
  // 2. `~/.codex/config.toml` [mcp_servers.mcpbox] pointing at the single
5
7
  // canonical HTTP endpoint. Codex's config is global-only, so the entry
6
8
  // is fenced with comment markers and replaced in place — surrounding
7
9
  // hand-written TOML is preserved.
10
+ // 3. `$CODEX_HOME/skills/mcpbox/SKILL.md` — the same policy, reachable from
11
+ // every working directory instead of just the install one.
12
+ // 4. `$CODEX_HOME/prompts/mcpbox-*.md` — Codex's slash commands. Generated
13
+ // from the plugin's commands/, which already use exactly this shape
14
+ // (frontmatter `description` + "the user invoked" body).
8
15
  //
9
16
  // The policy body is BLOCK_BODY_PLAIN from lib/policy.mjs — one source of
10
- // truth, minus the Claude-only slash commands this surface cannot run.
11
- // shared across CLAUDE.md / AGENTS.md / .cursor/rules. Slash-command and
12
- // tool-surface phrasing stays Claude-flavoured; that's a deliberate
13
- // non-issue, not per-surface forks to maintain.
17
+ // truth shared across CLAUDE.md / AGENTS.md / .cursor/rules, minus the
18
+ // Claude-only slash commands this surface cannot run.
14
19
 
20
+ import { promises as fs } from "node:fs";
15
21
  import { homedir } from "node:os";
16
- import { join, resolve } from "node:path";
22
+ import { dirname, join, resolve } from "node:path";
23
+ import { fileURLToPath } from "node:url";
17
24
  import {
18
25
  BLOCK_BODY_PLAIN,
19
26
  MCP_URL,
@@ -30,8 +37,20 @@ const TOML_BLOCK = `[mcp_servers.mcpbox]
30
37
  url = "${MCP_URL}"
31
38
  `;
32
39
 
40
+ // Codex data dir: explicit override (tests) > $CODEX_HOME > ~/.codex.
41
+ export function codexHomeDir(home) {
42
+ if (home) return resolve(home);
43
+ const env = process.env.CODEX_HOME?.trim();
44
+ if (env) return env;
45
+ return join(homedir(), ".codex");
46
+ }
47
+
33
48
  function codexConfigPath(configPath) {
34
- return configPath ? resolve(configPath) : join(homedir(), ".codex", "config.toml");
49
+ return configPath ? resolve(configPath) : join(codexHomeDir(), "config.toml");
50
+ }
51
+
52
+ function packageRoot() {
53
+ return resolve(dirname(fileURLToPath(import.meta.url)), "..");
35
54
  }
36
55
 
37
56
  // AGENTS.md policy block in the project directory.
@@ -55,17 +74,96 @@ export function removeCodexMcp({ configPath } = {}) {
55
74
  return removeManagedBlock({ target: codexConfigPath(configPath), begin: TOML_BEGIN, end: TOML_END });
56
75
  }
57
76
 
58
- // Both surfaces at once (what `mcpbox-claude codex-init` calls).
59
- export async function installCodex({ projectDir } = {}) {
77
+ // The policy as a user-level Codex skill, so it is reachable from any working
78
+ // directory — AGENTS.md alone only covers the one the installer ran in.
79
+ export async function installCodexSkill({ codexHome } = {}) {
80
+ const target = join(codexHomeDir(codexHome), "skills", "mcpbox", "SKILL.md");
81
+ const body = `---
82
+ name: mcpbox
83
+ description: MCPBox/daruma routing policy — read before creating tasks or plans, choosing between the daruma tracker and the maturity pipeline, or when the user mentions the tracker, backlog, plan, decomposition, or \`mcpbox mode\`.
84
+ ---
85
+
86
+ ${BLOCK_BODY_PLAIN}`;
87
+ let before = null;
88
+ try {
89
+ before = await fs.readFile(target, "utf8");
90
+ } catch { /* absent → install */ }
91
+ if (before === body) return { action: "unchanged", path: target };
92
+ await fs.mkdir(dirname(target), { recursive: true });
93
+ await fs.writeFile(target, body);
94
+ return { action: before === null ? "installed" : "updated", path: target };
95
+ }
96
+
97
+ export async function removeCodexSkill({ codexHome } = {}) {
98
+ const dir = join(codexHomeDir(codexHome), "skills", "mcpbox");
99
+ try {
100
+ await fs.access(dir);
101
+ } catch {
102
+ return { action: "missing", path: join(dir, "SKILL.md") };
103
+ }
104
+ await fs.rm(dir, { recursive: true, force: true });
105
+ return { action: "removed-block", path: join(dir, "SKILL.md") };
106
+ }
107
+
108
+ // Codex slash commands live in `$CODEX_HOME/prompts/<name>.md` and are invoked
109
+ // as `/<name>`; the plugin's `commands/tasks.md` becomes `/mcpbox-tasks`.
110
+ // There is no `:` namespace here, so the body's `/mcpbox:tasks` is rewritten
111
+ // to the name the user can actually type.
112
+ export function codexPromptName(commandFile) {
113
+ return `mcpbox-${commandFile.replace(/\.md$/, "")}`;
114
+ }
115
+
116
+ export async function installCodexPrompts({ codexHome } = {}) {
117
+ const source = join(packageRoot(), "commands");
118
+ const targetDir = join(codexHomeDir(codexHome), "prompts");
119
+ const files = (await fs.readdir(source)).filter((f) => f.endsWith(".md")).sort();
120
+ await fs.mkdir(targetDir, { recursive: true });
121
+ let written = 0;
122
+ for (const file of files) {
123
+ const name = codexPromptName(file);
124
+ const body = (await fs.readFile(join(source, file), "utf8"))
125
+ .replace(/\/mcpbox:([a-z-]+)/g, "/mcpbox-$1");
126
+ const target = join(targetDir, `${name}.md`);
127
+ let before = null;
128
+ try {
129
+ before = await fs.readFile(target, "utf8");
130
+ } catch { /* absent */ }
131
+ if (before === body) continue;
132
+ await fs.writeFile(target, body);
133
+ written += 1;
134
+ }
135
+ return { action: written ? "installed" : "unchanged", path: targetDir, count: files.length };
136
+ }
137
+
138
+ export async function removeCodexPrompts({ codexHome } = {}) {
139
+ const targetDir = join(codexHomeDir(codexHome), "prompts");
140
+ let files = [];
141
+ try {
142
+ files = await fs.readdir(targetDir);
143
+ } catch {
144
+ return { action: "missing", path: targetDir };
145
+ }
146
+ // Only our own `mcpbox-*.md` — a hand-written prompt next to them survives.
147
+ const ours = files.filter((f) => f.startsWith("mcpbox-") && f.endsWith(".md"));
148
+ await Promise.all(ours.map((f) => fs.rm(join(targetDir, f), { force: true })));
149
+ return { action: ours.length ? "removed-block" : "missing", path: targetDir };
150
+ }
151
+
152
+ // Every surface at once (what `mcpbox-claude codex-init` calls).
153
+ export async function installCodex({ projectDir, codexHome } = {}) {
60
154
  const policy = await installCodexPolicy({ projectDir });
61
155
  const mcp = await installCodexMcp();
62
- return { policy, mcp };
156
+ const skill = await installCodexSkill({ codexHome });
157
+ const prompts = await installCodexPrompts({ codexHome });
158
+ return { policy, mcp, skill, prompts };
63
159
  }
64
160
 
65
- export async function removeCodex({ projectDir } = {}) {
161
+ export async function removeCodex({ projectDir, codexHome } = {}) {
66
162
  const policy = await removeCodexPolicy({ projectDir });
67
163
  const mcp = await removeCodexMcp();
68
- return { policy, mcp };
164
+ const skill = await removeCodexSkill({ codexHome });
165
+ const prompts = await removeCodexPrompts({ codexHome });
166
+ return { policy, mcp, skill, prompts };
69
167
  }
70
168
 
71
169
  export { BEGIN, END, TOML_BEGIN, TOML_END, codexConfigPath };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpbox/mcpbox-claude",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "MCPBox agent harness for Claude Code: managed policy (daruma tracker + full pipeline), hooks, and slash commands over the single mcpbox MCP server.",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -15,6 +15,9 @@
15
15
  "commands/",
16
16
  "hooks/",
17
17
  ".claude-plugin/",
18
+ ".codex-plugin/",
19
+ ".agents/",
20
+ ".mcp.json",
18
21
  "README.md"
19
22
  ],
20
23
  "engines": {