codiedev 0.3.2 → 0.3.4

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/cli.js CHANGED
@@ -25,6 +25,10 @@ const promote_1 = require("./commands/promote");
25
25
  const HELP = `
26
26
  CodieDev CLI
27
27
 
28
+ The team artifact layer for agent-coded work. Share specs and reviews
29
+ with teammates, get pinged when they need your input, pick up where
30
+ someone left off across sessions and providers.
31
+
28
32
  Connect:
29
33
  codiedev connect Link Claude Code / Codex to your org
30
34
 
@@ -45,19 +49,260 @@ Capture:
45
49
  codiedev note "<text>" Capture a passing thought
46
50
 
47
51
  Other:
48
- codiedev help Show this help
52
+ codiedev help [command] Show this help, or details for one command
53
+ codiedev docs Print the full usage guide
49
54
  codiedev version Show version
50
55
 
56
+ Filename conventions:
57
+ spec-*.md → spec review-*.md → review
58
+ decision-*.md → decision proposal-*.md → proposal
59
+ bugfix-*.md → bugfix anything else → note
60
+
61
+ Examples:
62
+ codiedev push docs/specs/spec-cart-clear.md
63
+ codiedev pull spec-cart-clear.md
64
+ codiedev ping maya "thoughts on batch vs parallel?" --with spec-cart-clear.md
65
+ codiedev inbox --unread
66
+ codiedev note "idempotency key is worth a follow-up"
67
+
51
68
  Backend: ${process.env.CODIEDEV_URL ?? "https://codiedev.com"}
69
+ Token: https://codiedev.com/portal/integrations/claude-code
70
+ Docs: codiedev docs
71
+ `.trim();
72
+ const COMMAND_HELP = {
73
+ connect: `
74
+ codiedev connect — link your agent CLI to CodieDev
75
+
76
+ Interactive setup. Prompts for an API token, then installs:
77
+ - ~/.codiedev/config.json (token + org + tracked repos)
78
+ - ~/.claude/settings.json hook (captures session transcripts)
79
+ - ~/.claude/CLAUDE.md instructions (teaches Claude the commands)
80
+ - ~/.codex/hooks.json hook (same, for Codex)
81
+ - ~/.codex/AGENTS.md instructions (same, for Codex)
82
+
83
+ Re-run anytime to swap accounts or refresh the instruction block.
84
+
85
+ Get your token: https://codiedev.com/portal/integrations/claude-code
86
+ `.trim(),
87
+ push: `
88
+ codiedev push — author or update an artifact
89
+
90
+ Usage:
91
+ codiedev push <file.md> [--type spec|review|decision|proposal|bugfix|note]
92
+
93
+ The file's basename becomes its key (unique per company). Pushing the
94
+ same key again creates a new version — full history is preserved.
95
+
96
+ Type is inferred from the filename prefix unless you override with --type.
97
+
98
+ Examples:
99
+ codiedev push spec-cart-clear.md
100
+ codiedev push docs/review-auth.md --type review
101
+ codiedev push notes/random.md --type note
102
+ `.trim(),
103
+ pull: `
104
+ codiedev pull — fetch an artifact
105
+
106
+ Usage:
107
+ codiedev pull <key> [--version N] [--out path.md]
108
+
109
+ By default prints to stdout (pipe-friendly). --out writes to a file.
110
+ --version gets a specific historical version; omit for the latest.
111
+
112
+ Examples:
113
+ codiedev pull spec-cart-clear.md
114
+ codiedev pull spec-cart-clear.md --version 2
115
+ codiedev pull spec-cart-clear.md --out ./local-copy.md
116
+ codiedev pull spec-cart-clear.md | less
117
+ `.trim(),
118
+ ping: `
119
+ codiedev ping — send a teammate a message, optionally attached to an artifact
120
+
121
+ Usage:
122
+ codiedev ping <user> "<message>" [--with <artifact-key>]
123
+
124
+ <user> resolves to a teammate in your org by first name, full name,
125
+ or email. Ambiguous matches return a list — retry with the full email.
126
+
127
+ Teammates are notified by email and can reply from their own agent.
128
+
129
+ Examples:
130
+ codiedev ping maya "thoughts on batch vs parallel?" --with spec-cart-clear.md
131
+ codiedev ping nic@signalandcode.co "can you take this one?"
132
+ `.trim(),
133
+ inbox: `
134
+ codiedev inbox — show messages from teammates
135
+
136
+ Usage:
137
+ codiedev inbox [--unread] [--limit N]
138
+
139
+ Lists pings with sender, subject artifact, and preview. Each row
140
+ shows a ping-id you can pass to 'codiedev read'.
141
+
142
+ Unread rows show as ● ; read rows as · .
143
+
144
+ Examples:
145
+ codiedev inbox
146
+ codiedev inbox --unread
147
+ codiedev inbox --limit 10
148
+ `.trim(),
149
+ read: `
150
+ codiedev read — mark a ping as read and show its full content
151
+
152
+ Usage:
153
+ codiedev read <ping-id>
154
+
155
+ Grab the ping-id from 'codiedev inbox'. After reading, the ping will
156
+ drop out of 'codiedev inbox --unread' and the portal inbox badge
157
+ decrements for you.
158
+ `.trim(),
159
+ note: `
160
+ codiedev note — capture a passing thought, linked to your session
161
+
162
+ Usage:
163
+ codiedev note "<text>"
164
+
165
+ Stores the note in your org memory so you can search it later or
166
+ reference it in a ticket. Notes appear in the portal under the
167
+ Agent Inbox → My authored artifacts.
168
+
169
+ Examples:
170
+ codiedev note "idempotency key is worth a follow-up"
171
+ codiedev note "timeout threshold feels arbitrary — validate on slow networks"
172
+ `.trim(),
173
+ promote: `
174
+ codiedev promote — promote an auto-extracted artifact to authored
175
+
176
+ Usage:
177
+ codiedev promote <artifact-id> [--key filename.md]
178
+
179
+ The session-capture pipeline auto-extracts spec/bugfix/decision
180
+ artifacts from each agent session. Promote turns one of those into
181
+ a first-class authored artifact your team can ping, pull, and
182
+ update versions of.
183
+
184
+ Find artifact-ids in the portal under Knowledge → Memory, or via
185
+ the portal search.
186
+ `.trim(),
187
+ };
188
+ const DOCS = `
189
+ CodieDev — usage guide
190
+
191
+ ## What this is
192
+
193
+ CodieDev is a team artifact layer on top of your coding agent (Claude
194
+ Code, Codex, etc.). It persists the *durable* outputs of agent work —
195
+ specs, reviews, decisions, proposals, and captured thoughts — so:
196
+
197
+ - Your teammates can pick up where you left off without a handoff call.
198
+ - Your manager can see what's shipping and why, grounded in real
199
+ session evidence.
200
+ - Your future self can search "what did we decide about X?" and get
201
+ a real answer with citations.
202
+
203
+ ## Core loop
204
+
205
+ 1. You push an artifact:
206
+ codiedev push spec-cart-clear.md
207
+
208
+ 2. Your teammate gets pinged (either directly by you, or because
209
+ they asked to be kept in the loop on that key):
210
+ codiedev ping maya "thoughts?" --with spec-cart-clear.md
211
+
212
+ 3. They check their inbox:
213
+ codiedev inbox
214
+
215
+ 4. They pull your artifact, edit it, and push back:
216
+ codiedev pull spec-cart-clear.md > my-copy.md
217
+ # ...edit...
218
+ codiedev push my-copy.md (saves as v2 of the same key)
219
+
220
+ 5. You pull the updated version and keep building.
221
+
222
+ ## Versions
223
+
224
+ Every push of the same filename creates a new version. Latest is the
225
+ default on pull; use --version N to get a historical one. All versions
226
+ are preserved — you can always roll back.
227
+
228
+ ## Lifecycle
229
+
230
+ Artifacts have a status that auto-advances as PRs reference them:
231
+
232
+ draft → accepted → implementing → shipped
233
+ → archived
234
+
235
+ Artifacts stay editable at every stage, including after merge —
236
+ lessons-learned and follow-up notes append as new versions.
237
+
238
+ ## Portal
239
+
240
+ Everything you do in the CLI is visible at:
241
+
242
+ https://codiedev.com/portal/inbox
243
+
244
+ Your CTO (or any non-technical teammate) can follow along without ever
245
+ touching a terminal — they read the artifacts in the portal and get
246
+ email notifications when pinged.
247
+
248
+ ## Agent-native
249
+
250
+ If you use Claude Code or Codex, the agent already knows the commands —
251
+ 'codiedev connect' installs instructions into your user-level config.
252
+ Just say things like:
253
+
254
+ "push this spec and ping Nic"
255
+ "any messages?"
256
+ "pull Maya's latest spec"
257
+
258
+ The agent will run the right command via Bash.
259
+
260
+ ## Command reference
261
+
262
+ Run 'codiedev help <command>' for each, or see the quick list:
263
+
264
+ codiedev help
265
+
266
+ ## Getting a token
267
+
268
+ 1. Log in to https://codiedev.com/portal/integrations/claude-code
269
+ 2. Click "Create token"
270
+ 3. Copy the cdv_... string and paste it into 'codiedev connect'
271
+
272
+ Tokens are per-user. Rotate any time by revoking + creating a new one.
52
273
  `.trim();
53
274
  async function main() {
54
275
  const [, , command, ...rest] = process.argv;
55
- if (!command || command === "help" || command === "--help" || command === "-h") {
276
+ if (!command || command === "--help" || command === "-h") {
56
277
  console.log(HELP);
57
278
  return;
58
279
  }
280
+ if (command === "help") {
281
+ const sub = rest[0];
282
+ if (sub && COMMAND_HELP[sub]) {
283
+ console.log(COMMAND_HELP[sub]);
284
+ return;
285
+ }
286
+ if (sub) {
287
+ console.log(`No help for "${sub}". Valid commands:`);
288
+ console.log(Object.keys(COMMAND_HELP).join(", "));
289
+ return;
290
+ }
291
+ console.log(HELP);
292
+ return;
293
+ }
294
+ if (command === "docs") {
295
+ console.log(DOCS);
296
+ return;
297
+ }
298
+ // Support `codiedev <command> --help` too.
299
+ if (rest.includes("--help") || rest.includes("-h")) {
300
+ if (COMMAND_HELP[command]) {
301
+ console.log(COMMAND_HELP[command]);
302
+ return;
303
+ }
304
+ }
59
305
  if (command === "version" || command === "--version" || command === "-v") {
60
- // Package version is replaced at publish via tsc — for now, print the source-of-truth.
61
306
  console.log("codiedev cli");
62
307
  return;
63
308
  }
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codiedev",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Connect Claude Code or Codex to CodieDev for org-wide session capture and artifact collaboration",
5
5
  "bin": {
6
6
  "codiedev": "./dist/cli.js",