codiedev 0.3.2 → 0.3.3
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/connect.js +14 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +89 -0
- package/package.json +1 -1
package/dist/connect.js
CHANGED
|
@@ -150,6 +150,13 @@ async function runConnect() {
|
|
|
150
150
|
catch (err) {
|
|
151
151
|
console.error(`\nWarning: Failed to install Claude Code hook — ${err.message}`);
|
|
152
152
|
}
|
|
153
|
+
try {
|
|
154
|
+
(0, utils_1.installClaudeCodeInstructions)();
|
|
155
|
+
installed.push("Claude Code agent instructions (~/.claude/CLAUDE.md)");
|
|
156
|
+
}
|
|
157
|
+
catch (err) {
|
|
158
|
+
console.error(`\nWarning: Failed to install Claude Code instructions — ${err.message}`);
|
|
159
|
+
}
|
|
153
160
|
}
|
|
154
161
|
if (hasCodex) {
|
|
155
162
|
try {
|
|
@@ -159,6 +166,13 @@ async function runConnect() {
|
|
|
159
166
|
catch (err) {
|
|
160
167
|
console.error(`\nWarning: Failed to install Codex hook — ${err.message}`);
|
|
161
168
|
}
|
|
169
|
+
try {
|
|
170
|
+
(0, utils_1.installCodexInstructions)();
|
|
171
|
+
installed.push("Codex agent instructions (~/.codex/AGENTS.md)");
|
|
172
|
+
}
|
|
173
|
+
catch (err) {
|
|
174
|
+
console.error(`\nWarning: Failed to install Codex instructions — ${err.message}`);
|
|
175
|
+
}
|
|
162
176
|
}
|
|
163
177
|
if (!hasClaude && !hasCodex) {
|
|
164
178
|
console.warn("\nNo Claude Code (~/.claude) or Codex (~/.codex) install detected.");
|
package/dist/utils.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export declare function hashToken(token: string): string;
|
|
|
27
27
|
export declare function claudeCodeInstalled(): boolean;
|
|
28
28
|
export declare function codexInstalled(): boolean;
|
|
29
29
|
export declare function installHook(): void;
|
|
30
|
+
export declare function installClaudeCodeInstructions(): void;
|
|
31
|
+
export declare function installCodexInstructions(): void;
|
|
30
32
|
/**
|
|
31
33
|
* Install the CodieDev MCP server into Claude Code's user-scope config.
|
|
32
34
|
* Safe to call multiple times — updates the existing entry if present.
|
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.installClaudeCodeInstructions = installClaudeCodeInstructions;
|
|
46
|
+
exports.installCodexInstructions = installCodexInstructions;
|
|
45
47
|
exports.installClaudeCodeMcp = installClaudeCodeMcp;
|
|
46
48
|
exports.installCodexMcp = installCodexMcp;
|
|
47
49
|
exports.installCodexHook = installCodexHook;
|
|
@@ -189,7 +191,94 @@ function installHook() {
|
|
|
189
191
|
// agent CLI's expected location so "npx codiedev connect" wires it up once.
|
|
190
192
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
191
193
|
const CLAUDE_USER_CONFIG_PATH = path.join(os.homedir(), ".claude.json");
|
|
194
|
+
const CLAUDE_USER_INSTRUCTIONS_PATH = path.join(os.homedir(), ".claude", "CLAUDE.md");
|
|
195
|
+
const CODEX_USER_INSTRUCTIONS_PATH = path.join(os.homedir(), ".codex", "AGENTS.md");
|
|
192
196
|
const CODEX_CONFIG_PATH = path.join(os.homedir(), ".codex", "config.toml");
|
|
197
|
+
const CODIEDEV_INSTRUCTIONS_BEGIN = "<!-- codiedev-cli:begin -->";
|
|
198
|
+
const CODIEDEV_INSTRUCTIONS_END = "<!-- codiedev-cli:end -->";
|
|
199
|
+
const CODIEDEV_INSTRUCTIONS_BODY = `## CodieDev — team artifact layer
|
|
200
|
+
|
|
201
|
+
This machine is connected to CodieDev. Teammates share specs, reviews,
|
|
202
|
+
decisions, and messages via a CLI on every dev's machine.
|
|
203
|
+
|
|
204
|
+
**When the user asks to share, push, ping, check messages, or capture a
|
|
205
|
+
thought, use the \`codiedev\` CLI via Bash:**
|
|
206
|
+
|
|
207
|
+
| Intent | Command |
|
|
208
|
+
|---|---|
|
|
209
|
+
| "push this spec" / "share this with the team" | \`codiedev push <file.md>\` |
|
|
210
|
+
| "pull X" / "grab the latest spec-X" / "what did Maya push?" | \`codiedev pull <key>\` |
|
|
211
|
+
| "ping Nic about this" / "ask Maya for her take" | \`codiedev ping <name> "<msg>" [--with <key>]\` |
|
|
212
|
+
| "any messages?" / "check my inbox" / "what did Nic say?" | \`codiedev inbox\` |
|
|
213
|
+
| "read Nic's reply" / "mark that ping read" | \`codiedev read <ping-id>\` |
|
|
214
|
+
| "note that X is a follow-up" / "remember X" | \`codiedev note "<text>"\` |
|
|
215
|
+
| "promote the extracted spec" | \`codiedev promote <artifact-id>\` |
|
|
216
|
+
|
|
217
|
+
**Filename conventions (set artifact type automatically):**
|
|
218
|
+
- \`spec-*.md\` → spec
|
|
219
|
+
- \`review-*.md\` → review
|
|
220
|
+
- \`decision-*.md\` → decision
|
|
221
|
+
- \`proposal-*.md\` → proposal
|
|
222
|
+
- \`bugfix-*.md\` → bugfix
|
|
223
|
+
- anything else → note
|
|
224
|
+
|
|
225
|
+
**Resolving "the spec we just worked on":**
|
|
226
|
+
- If a file was recently edited in this session matching the conventions
|
|
227
|
+
above, push that file.
|
|
228
|
+
- If content was drafted inline in the conversation, write it to a file
|
|
229
|
+
first (e.g., \`/tmp/spec-xxx.md\`) then push.
|
|
230
|
+
|
|
231
|
+
**Teammate names:** first name usually works (\`codiedev ping nic ...\`).
|
|
232
|
+
If ambiguous, the CLI returns candidates — retry with the full email.
|
|
233
|
+
|
|
234
|
+
**Errors:**
|
|
235
|
+
- "not connected" → user needs to run \`npx codiedev connect\` with their
|
|
236
|
+
API token from https://codiedev.com/portal/integrations/claude-code
|
|
237
|
+
- "ambiguous recipient" → surface candidates to the user
|
|
238
|
+
`;
|
|
239
|
+
/**
|
|
240
|
+
* Write the codiedev agent-facing docs block to the user-level Claude
|
|
241
|
+
* instructions file so Claude Code picks up the commands in every session
|
|
242
|
+
* (no per-repo CLAUDE.md needed). Idempotent — replaces the existing block
|
|
243
|
+
* between its begin/end markers on re-run.
|
|
244
|
+
*/
|
|
245
|
+
function writeInstructionsBlock(targetPath) {
|
|
246
|
+
const dir = path.dirname(targetPath);
|
|
247
|
+
if (!fs.existsSync(dir)) {
|
|
248
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
249
|
+
}
|
|
250
|
+
const block = `${CODIEDEV_INSTRUCTIONS_BEGIN}\n` +
|
|
251
|
+
CODIEDEV_INSTRUCTIONS_BODY +
|
|
252
|
+
`\n${CODIEDEV_INSTRUCTIONS_END}\n`;
|
|
253
|
+
let existing = "";
|
|
254
|
+
if (fs.existsSync(targetPath)) {
|
|
255
|
+
existing = fs.readFileSync(targetPath, "utf8");
|
|
256
|
+
}
|
|
257
|
+
const beginIdx = existing.indexOf(CODIEDEV_INSTRUCTIONS_BEGIN);
|
|
258
|
+
const endIdx = existing.indexOf(CODIEDEV_INSTRUCTIONS_END);
|
|
259
|
+
let next;
|
|
260
|
+
if (beginIdx !== -1 && endIdx !== -1 && endIdx > beginIdx) {
|
|
261
|
+
// Replace the existing block in place.
|
|
262
|
+
next =
|
|
263
|
+
existing.slice(0, beginIdx) +
|
|
264
|
+
block +
|
|
265
|
+
existing.slice(endIdx + CODIEDEV_INSTRUCTIONS_END.length);
|
|
266
|
+
}
|
|
267
|
+
else if (existing.trim()) {
|
|
268
|
+
// Append with a blank-line separator.
|
|
269
|
+
next = existing.replace(/\n*$/, "\n\n") + block;
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
next = block;
|
|
273
|
+
}
|
|
274
|
+
fs.writeFileSync(targetPath, next, "utf8");
|
|
275
|
+
}
|
|
276
|
+
function installClaudeCodeInstructions() {
|
|
277
|
+
writeInstructionsBlock(CLAUDE_USER_INSTRUCTIONS_PATH);
|
|
278
|
+
}
|
|
279
|
+
function installCodexInstructions() {
|
|
280
|
+
writeInstructionsBlock(CODEX_USER_INSTRUCTIONS_PATH);
|
|
281
|
+
}
|
|
193
282
|
/**
|
|
194
283
|
* Install the CodieDev MCP server into Claude Code's user-scope config.
|
|
195
284
|
* Safe to call multiple times — updates the existing entry if present.
|