codiedev 0.2.1 → 0.3.0

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/utils.js CHANGED
@@ -42,6 +42,8 @@ exports.hashToken = hashToken;
42
42
  exports.claudeCodeInstalled = claudeCodeInstalled;
43
43
  exports.codexInstalled = codexInstalled;
44
44
  exports.installHook = installHook;
45
+ exports.installClaudeCodeMcp = installClaudeCodeMcp;
46
+ exports.installCodexMcp = installCodexMcp;
45
47
  exports.installCodexHook = installCodexHook;
46
48
  exports.parseClaudeCodeStats = parseClaudeCodeStats;
47
49
  exports.parseCodexStats = parseCodexStats;
@@ -182,6 +184,65 @@ function installHook() {
182
184
  }
183
185
  fs.writeFileSync(CLAUDE_SETTINGS_PATH, JSON.stringify(settings, null, 2), "utf8");
184
186
  }
187
+ // ─────────────────────────────────────────────────────────────────────────────
188
+ // MCP server installation — writes the codiedev MCP server config into each
189
+ // agent CLI's expected location so "npx codiedev connect" wires it up once.
190
+ // ─────────────────────────────────────────────────────────────────────────────
191
+ const CLAUDE_USER_CONFIG_PATH = path.join(os.homedir(), ".claude.json");
192
+ const CODEX_CONFIG_PATH = path.join(os.homedir(), ".codex", "config.toml");
193
+ /**
194
+ * Install the CodieDev MCP server into Claude Code's user-scope config.
195
+ * Safe to call multiple times — updates the existing entry if present.
196
+ */
197
+ function installClaudeCodeMcp() {
198
+ let config = {};
199
+ try {
200
+ if (fs.existsSync(CLAUDE_USER_CONFIG_PATH)) {
201
+ const raw = fs.readFileSync(CLAUDE_USER_CONFIG_PATH, "utf8");
202
+ config = raw.trim() ? JSON.parse(raw) : {};
203
+ }
204
+ }
205
+ catch {
206
+ // Start fresh if the existing file is corrupt — safer than failing the install.
207
+ config = {};
208
+ }
209
+ const mcpServers = config.mcpServers ?? {};
210
+ mcpServers.codiedev = {
211
+ type: "stdio",
212
+ command: "npx",
213
+ args: ["codiedev-mcp"],
214
+ };
215
+ config.mcpServers = mcpServers;
216
+ fs.writeFileSync(CLAUDE_USER_CONFIG_PATH, JSON.stringify(config, null, 2), "utf8");
217
+ }
218
+ /**
219
+ * Best-effort append of the CodieDev MCP server block to ~/.codex/config.toml.
220
+ *
221
+ * Codex uses TOML and we don't want a full parser for such a small addition,
222
+ * so we append a well-marked block if one isn't already present. Idempotent.
223
+ */
224
+ function installCodexMcp() {
225
+ if (!fs.existsSync(CODEX_DIR)) {
226
+ fs.mkdirSync(CODEX_DIR, { recursive: true });
227
+ }
228
+ const marker = "# codiedev-mcp";
229
+ let existing = "";
230
+ if (fs.existsSync(CODEX_CONFIG_PATH)) {
231
+ existing = fs.readFileSync(CODEX_CONFIG_PATH, "utf8");
232
+ }
233
+ if (existing.includes(marker))
234
+ return false;
235
+ const block = [
236
+ "",
237
+ marker,
238
+ "[mcp_servers.codiedev]",
239
+ 'command = "npx"',
240
+ 'args = ["codiedev-mcp"]',
241
+ "",
242
+ ].join("\n");
243
+ fs.writeFileSync(CODEX_CONFIG_PATH, existing + block, "utf8");
244
+ return true;
245
+ }
185
246
  // Codex doesn't have a SessionEnd event yet — Stop fires after every turn.
186
247
  // The backend dedupes on (companyId, sessionId) and replaces the stored
187
248
  // transcript on re-upload, so the latest turn's snapshot wins.
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "codiedev",
3
- "version": "0.2.1",
4
- "description": "Connect Claude Code or Codex to CodieDev for org-wide session capture",
3
+ "version": "0.3.0",
4
+ "description": "Connect Claude Code or Codex to CodieDev for org-wide session capture and artifact collaboration",
5
5
  "bin": {
6
- "codiedev": "./dist/connect.js",
7
- "codiedev-hook": "./dist/hook.js"
6
+ "codiedev": "./dist/cli.js",
7
+ "codiedev-hook": "./dist/hook.js",
8
+ "codiedev-mcp": "./dist/mcp.js"
8
9
  },
9
10
  "scripts": {
10
11
  "build": "tsc",
11
12
  "dev": "tsc --watch",
12
13
  "prepublishOnly": "tsc"
13
14
  },
14
- "files": ["dist", "README.md"],
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
15
19
  "keywords": [
16
20
  "codiedev",
17
21
  "claude-code",
@@ -30,7 +34,10 @@
30
34
  "access": "public"
31
35
  },
32
36
  "devDependencies": {
33
- "typescript": "^5.4.0",
34
- "@types/node": "^20.0.0"
37
+ "@types/node": "^20.0.0",
38
+ "typescript": "^5.4.0"
39
+ },
40
+ "dependencies": {
41
+ "@modelcontextprotocol/sdk": "^1.29.0"
35
42
  }
36
43
  }