codiedev 0.10.0-beta.1 → 0.10.0-beta.10

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.
Files changed (155) hide show
  1. package/README.md +11 -5
  2. package/assets/opencode-plugin.mjs +6 -0
  3. package/assets/session-key.mjs +48 -0
  4. package/assets/tui-brand-plugin.tsx +73 -0
  5. package/dist/backup/cache.js +1 -5
  6. package/dist/backup/match.js +0 -6
  7. package/dist/backup/run.js +3 -35
  8. package/dist/captureExclusions.js +0 -12
  9. package/dist/captureLog.js +0 -28
  10. package/dist/captureReadiness.js +0 -58
  11. package/dist/captureSignals.js +184 -0
  12. package/dist/cli.js +135 -72
  13. package/dist/cliSession.js +456 -0
  14. package/dist/codexHookTrust.js +125 -6
  15. package/dist/codexLimitScan.js +359 -0
  16. package/dist/codie.js +77 -130
  17. package/dist/codieBrandInstall.js +80 -0
  18. package/dist/codieLauncher.js +76 -79
  19. package/dist/codieRuntime.js +19 -23
  20. package/dist/codieRuntimeInstall.js +108 -23
  21. package/dist/codieUsage.js +181 -0
  22. package/dist/commands/agentTemplates.generated.js +136 -0
  23. package/dist/commands/agents.js +1088 -0
  24. package/dist/commands/agentsSdk.generated.js +7 -0
  25. package/dist/commands/ask.js +0 -3
  26. package/dist/commands/capture.js +0 -2
  27. package/dist/commands/createTicket.js +0 -10
  28. package/dist/commands/doctor.js +53 -120
  29. package/dist/commands/evals.js +187 -0
  30. package/dist/commands/inbox.js +0 -2
  31. package/dist/commands/library.js +0 -3
  32. package/dist/commands/pack.js +573 -0
  33. package/dist/commands/ping.js +0 -2
  34. package/dist/commands/pull.js +6 -10
  35. package/dist/commands/push.js +2 -12
  36. package/dist/commands/search.js +0 -4
  37. package/dist/commands/send.js +0 -5
  38. package/dist/commands/share.js +0 -4
  39. package/dist/commands/shared.js +0 -35
  40. package/dist/commands/traces.js +344 -0
  41. package/dist/commands/tracesLabel.js +348 -0
  42. package/dist/configDir.js +18 -11
  43. package/dist/connect.js +55 -118
  44. package/dist/connectFlow.js +35 -9
  45. package/dist/copilotHooks.js +391 -0
  46. package/dist/copilotInstallation.js +64 -0
  47. package/dist/cursorHooks.js +38 -30
  48. package/dist/cursorLifecycle.js +109 -0
  49. package/dist/detection.js +0 -30
  50. package/dist/harnessDirs.js +77 -0
  51. package/dist/hook.js +256 -445
  52. package/dist/inboxFormat.js +0 -24
  53. package/dist/launchContext.js +150 -0
  54. package/dist/launcher.js +168 -0
  55. package/dist/limitEvent.js +44 -13
  56. package/dist/limitEventReporter.js +1 -1
  57. package/dist/managedPi.js +256 -0
  58. package/dist/mcp.js +5 -384
  59. package/dist/nativeSteering.js +24 -0
  60. package/dist/packs/codie.js +182 -0
  61. package/dist/packs/harnesses.js +411 -0
  62. package/dist/packs/hookGate.js +256 -0
  63. package/dist/packs/install.js +286 -0
  64. package/dist/packs/manifest.js +126 -0
  65. package/dist/packs/paths.js +81 -0
  66. package/dist/packs/shim.js +214 -0
  67. package/dist/packs/store.js +155 -0
  68. package/dist/packs/sync.js +170 -0
  69. package/dist/piHooks.js +216 -0
  70. package/dist/piRuntime.js +120 -0
  71. package/dist/repoResolver.js +0 -19
  72. package/dist/secret.js +0 -3
  73. package/dist/selfUpdate.js +376 -0
  74. package/dist/skillMarker.js +23 -0
  75. package/dist/subagents.js +135 -0
  76. package/dist/teamSkillContext.js +10 -0
  77. package/dist/transcriptModels.js +205 -0
  78. package/dist/upgradeNudge.js +0 -30
  79. package/dist/utils.js +502 -828
  80. package/dist/version.js +0 -10
  81. package/dist/versionCheck.js +0 -33
  82. package/package.json +9 -10
  83. package/dist/backup/cache.d.ts +0 -14
  84. package/dist/backup/match.d.ts +0 -2
  85. package/dist/backup/run.d.ts +0 -25
  86. package/dist/captureExclusions.d.ts +0 -30
  87. package/dist/captureLog.d.ts +0 -20
  88. package/dist/captureReadiness.d.ts +0 -65
  89. package/dist/cli.d.ts +0 -16
  90. package/dist/codexHookTrust.d.ts +0 -34
  91. package/dist/codie.d.ts +0 -2
  92. package/dist/codieLauncher.d.ts +0 -53
  93. package/dist/codieRuntime.d.ts +0 -29
  94. package/dist/codieRuntimeInstall.d.ts +0 -28
  95. package/dist/codieStartup.d.ts +0 -26
  96. package/dist/codieStartup.js +0 -30
  97. package/dist/commands/ask.d.ts +0 -1
  98. package/dist/commands/capture.d.ts +0 -14
  99. package/dist/commands/createTicket.d.ts +0 -27
  100. package/dist/commands/delete.d.ts +0 -1
  101. package/dist/commands/doctor.d.ts +0 -1
  102. package/dist/commands/inbox.d.ts +0 -3
  103. package/dist/commands/library.d.ts +0 -2
  104. package/dist/commands/note.d.ts +0 -1
  105. package/dist/commands/ping.d.ts +0 -1
  106. package/dist/commands/promote.d.ts +0 -1
  107. package/dist/commands/promote.js +0 -53
  108. package/dist/commands/pull.d.ts +0 -2
  109. package/dist/commands/push.d.ts +0 -33
  110. package/dist/commands/react.d.ts +0 -2
  111. package/dist/commands/react.js +0 -40
  112. package/dist/commands/reverseTicket.d.ts +0 -2
  113. package/dist/commands/reverseTicket.js +0 -477
  114. package/dist/commands/search.d.ts +0 -2
  115. package/dist/commands/security.d.ts +0 -1
  116. package/dist/commands/security.js +0 -156
  117. package/dist/commands/send.d.ts +0 -2
  118. package/dist/commands/share.d.ts +0 -2
  119. package/dist/commands/shared.d.ts +0 -64
  120. package/dist/configDir.d.ts +0 -1
  121. package/dist/connect.d.ts +0 -1
  122. package/dist/connectFlow.d.ts +0 -13
  123. package/dist/cursorHooks.d.ts +0 -23
  124. package/dist/detection.d.ts +0 -30
  125. package/dist/hook.d.ts +0 -6
  126. package/dist/inboxFormat.d.ts +0 -38
  127. package/dist/limitEvent.d.ts +0 -16
  128. package/dist/limitEventReporter.d.ts +0 -21
  129. package/dist/mcp.d.ts +0 -12
  130. package/dist/prUrl.d.ts +0 -9
  131. package/dist/prUrl.js +0 -33
  132. package/dist/repoResolver.d.ts +0 -17
  133. package/dist/secret.d.ts +0 -1
  134. package/dist/security.d.ts +0 -102
  135. package/dist/security.js +0 -437
  136. package/dist/securityDeepScan.d.ts +0 -41
  137. package/dist/securityDeepScan.js +0 -248
  138. package/dist/securityDoctor.d.ts +0 -32
  139. package/dist/securityDoctor.js +0 -63
  140. package/dist/securityFeature.d.ts +0 -5
  141. package/dist/securityFeature.js +0 -7
  142. package/dist/securityInstall.d.ts +0 -63
  143. package/dist/securityInstall.js +0 -239
  144. package/dist/securityInventory.d.ts +0 -54
  145. package/dist/securityInventory.js +0 -556
  146. package/dist/securityPilot.d.ts +0 -19
  147. package/dist/securityPilot.js +0 -61
  148. package/dist/securityPolicy.d.ts +0 -33
  149. package/dist/securityPolicy.js +0 -188
  150. package/dist/securitySession.d.ts +0 -6
  151. package/dist/securitySession.js +0 -72
  152. package/dist/upgradeNudge.d.ts +0 -25
  153. package/dist/utils.d.ts +0 -342
  154. package/dist/version.d.ts +0 -1
  155. package/dist/versionCheck.d.ts +0 -68
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CAPTURE_SIGNALS_VERSION = void 0;
4
+ exports.parseCaptureSignals = parseCaptureSignals;
5
+ exports.withLaunch = withLaunch;
6
+ const transcriptModels_1 = require("./transcriptModels");
7
+ exports.CAPTURE_SIGNALS_VERSION = 1;
8
+ const IDLE_MS = 5 * 60_000;
9
+ const LIMIT = 100;
10
+ const skillKey = (value) => typeof value === "string"
11
+ ? value
12
+ .replace(/^\//, "")
13
+ .replace(/\.md$/i, "")
14
+ .replace(/["'`]/g, "")
15
+ .trim()
16
+ .toLowerCase()
17
+ : "";
18
+ function parseCaptureSignals(content, source) {
19
+ const timestamps = new Set();
20
+ const invocationCounts = new Map();
21
+ const invocations = new Set(), pulls = new Set(), entrypoints = new Set();
22
+ const tools = new Map(), calls = new Set();
23
+ let parsedRecords = 0, truncated = false;
24
+ let premiumRequests, nanoAiu;
25
+ let cursorSubagents;
26
+ const artifacts = new Map();
27
+ let lastInvoked = null;
28
+ const marker = (text) => {
29
+ if (!lastInvoked || artifacts.has(lastInvoked))
30
+ return;
31
+ const m = text.match(/codiedev:artifact=([a-z0-9]{16,64})/i);
32
+ if (m && artifacts.size < LIMIT)
33
+ artifacts.set(lastInvoked, m[1]);
34
+ };
35
+ const addSkill = (set, value) => {
36
+ const key = skillKey(value);
37
+ if (!key || key.length > 200 || !/^[a-z0-9][a-z0-9_:/.-]*$/i.test(key))
38
+ return;
39
+ if (set.size >= LIMIT && !set.has(key)) {
40
+ truncated = true;
41
+ return;
42
+ }
43
+ set.add(key);
44
+ if (set === invocations) {
45
+ invocationCounts.set(key, (invocationCounts.get(key) ?? 0) + 1);
46
+ lastInvoked = key;
47
+ }
48
+ };
49
+ const command = (value) => {
50
+ if (typeof value !== "string")
51
+ return;
52
+ for (const match of value.matchAll(/\bcodiedev\s+pull\s+([^\s"'`]+)/gi))
53
+ addSkill(pulls, match[1]);
54
+ };
55
+ const tool = (name, id, input) => {
56
+ if (typeof name !== "string" || !name || name.length > 100)
57
+ return;
58
+ const key = typeof id === "string" ? id : `${parsedRecords}:${calls.size}`;
59
+ if (calls.has(key))
60
+ return;
61
+ calls.add(key);
62
+ if (tools.size < LIMIT || tools.has(name))
63
+ tools.set(name, (tools.get(name) ?? 0) + 1);
64
+ else
65
+ truncated = true;
66
+ let args = input;
67
+ if (typeof args === "string") {
68
+ try {
69
+ args = JSON.parse(args);
70
+ }
71
+ catch {
72
+ command(args);
73
+ return;
74
+ }
75
+ }
76
+ if (name.toLowerCase() === "skill")
77
+ addSkill(invocations, args?.skill ?? args?.name);
78
+ command(args?.command ?? args?.cmd);
79
+ };
80
+ for (const record of (0, transcriptModels_1.transcriptRecords)(content, source)) {
81
+ if (!record || typeof record !== "object")
82
+ continue;
83
+ const e = record;
84
+ parsedRecords++;
85
+ const entrypoint = (value) => {
86
+ if (typeof value === "string" &&
87
+ entrypoints.size < 10 &&
88
+ /^[a-z0-9][a-z0-9_.:-]{0,39}$/i.test(value))
89
+ entrypoints.add(value.toLowerCase());
90
+ };
91
+ entrypoint(e.entrypoint);
92
+ if (e.type === "session_meta" && e.payload) {
93
+ const src = e.payload.source;
94
+ entrypoint(typeof src === "string"
95
+ ? `codex:${src}`
96
+ : src && typeof src === "object"
97
+ ? `codex:${Object.keys(src)[0] ?? "other"}`
98
+ : undefined);
99
+ }
100
+ if (e.type === "cursor.subagent_summary" && Number.isSafeInteger(e.count) && e.count > 0) {
101
+ cursorSubagents = { count: e.count, truncated: e.truncated === true };
102
+ }
103
+ if (e.type === "copilot.skill_invoked")
104
+ addSkill(invocations, e.skill);
105
+ if (e.type === "pi.skill_invoked")
106
+ addSkill(invocations, e.skill);
107
+ if (e.type === "copilot.usage_summary") {
108
+ if (typeof e.premiumRequests === "number" && e.premiumRequests >= 0)
109
+ premiumRequests = e.premiumRequests;
110
+ if (typeof e.nanoAiu === "number" && e.nanoAiu >= 0)
111
+ nanoAiu = e.nanoAiu;
112
+ }
113
+ const time = typeof e.timestamp === "string"
114
+ ? Date.parse(e.timestamp)
115
+ : e.info?.time?.created;
116
+ if (typeof time === "number" && Number.isFinite(time) && time > 0)
117
+ timestamps.add(time);
118
+ const blocks = e.message?.content;
119
+ if (Array.isArray(blocks))
120
+ for (const part of blocks) {
121
+ if (part?.type === "tool_use")
122
+ tool(part.name, part.id, part.input);
123
+ if (part?.type === "tool_result")
124
+ marker(typeof part.content === "string" ? part.content : JSON.stringify(part.content ?? ""));
125
+ if (part?.type === "text" && e.type === "user") {
126
+ for (const match of String(part.text ?? "").matchAll(/<command-name>\/?([a-z0-9:_-]+)<\/command-name>/gi))
127
+ addSkill(invocations, match[1]);
128
+ marker(String(part.text ?? ""));
129
+ }
130
+ }
131
+ if (typeof blocks === "string" && e.type === "user") {
132
+ for (const match of blocks.matchAll(/<command-name>\/?([a-z0-9:_-]+)<\/command-name>/gi))
133
+ addSkill(invocations, match[1]);
134
+ marker(blocks);
135
+ }
136
+ if (e.type === "response_item" &&
137
+ ["function_call", "custom_tool_call"].includes(e.payload?.type))
138
+ tool(e.payload.name, e.payload.call_id, e.payload.arguments ?? e.payload.input);
139
+ if (e.info?.role === "assistant" && Array.isArray(e.parts))
140
+ for (const part of e.parts) {
141
+ if (part?.type === "tool")
142
+ tool(part.tool, part.callID ?? part.id, part.state?.input);
143
+ }
144
+ }
145
+ const sorted = [...timestamps].sort((a, b) => a - b);
146
+ let activeMs = 0;
147
+ for (let i = 1; i < sorted.length; i++) {
148
+ const gap = sorted[i] - sorted[i - 1];
149
+ if (gap <= IDLE_MS)
150
+ activeMs += gap;
151
+ }
152
+ return {
153
+ version: exports.CAPTURE_SIGNALS_VERSION,
154
+ parsedRecords,
155
+ timestampCount: sorted.length,
156
+ ...(sorted.length
157
+ ? { firstAt: sorted[0], lastAt: sorted[sorted.length - 1] }
158
+ : {}),
159
+ activeMs,
160
+ idleThresholdMs: IDLE_MS,
161
+ skillInvocations: [...invocations].sort(),
162
+ skillInvocationCounts: [...invocationCounts]
163
+ .map(([skill, count]) => ({ skill, count }))
164
+ .sort((a, b) => a.skill.localeCompare(b.skill)),
165
+ ...(artifacts.size
166
+ ? { skillInvocationArtifacts: [...artifacts].map(([skill, artifactId]) => ({ skill, artifactId })).sort((a, b) => a.skill.localeCompare(b.skill)) }
167
+ : {}),
168
+ skillPulls: [...pulls].sort(),
169
+ toolCalls: [...tools]
170
+ .map(([name, calls]) => ({ name, calls }))
171
+ .sort((a, b) => a.name.localeCompare(b.name)),
172
+ ...(cursorSubagents ? { subagents: cursorSubagents } : {}),
173
+ ...(entrypoints.size ? { entrypoints: [...entrypoints].sort() } : {}),
174
+ ...(premiumRequests !== undefined ? { premiumRequests } : {}),
175
+ ...(nanoAiu !== undefined ? { nanoAiu } : {}),
176
+ truncated,
177
+ };
178
+ }
179
+ function withLaunch(signals, launch) {
180
+ if (!launch || !/^[a-z0-9][a-z0-9_.:-]{0,39}$/.test(launch))
181
+ return signals;
182
+ const all = new Set([...(signals.entrypoints ?? []), launch]);
183
+ return all.size > 10 ? signals : { ...signals, entrypoints: [...all].sort() };
184
+ }
package/dist/cli.js CHANGED
@@ -1,21 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- /**
4
- * Codiedev CLI dispatcher.
5
- *
6
- * Subcommands:
7
- * codiedev connect — link agent CLIs to your org
8
- * codiedev push <file> — author/update a spec/review/decision/etc.
9
- * codiedev pull <key> — fetch an artifact by filename key
10
- * codiedev ping <user> "<msg>" — send a message (optionally --with <key>)
11
- * codiedev inbox — list pings (use --unread to filter)
12
- * codiedev read <ping-id> — mark read + show full message
13
- * codiedev note "<text>" — capture a thought
14
- * codiedev promote <artifact-id> — promote an extracted artifact to authored
15
- * codiedev help — show this help
16
- */
17
3
  Object.defineProperty(exports, "__esModule", { value: true });
18
4
  const connect_1 = require("./connect");
5
+ const cliSession_1 = require("./cliSession");
6
+ const utils_1 = require("./utils");
19
7
  const push_1 = require("./commands/push");
20
8
  const delete_1 = require("./commands/delete");
21
9
  const pull_1 = require("./commands/pull");
@@ -23,17 +11,19 @@ const ask_1 = require("./commands/ask");
23
11
  const ping_1 = require("./commands/ping");
24
12
  const inbox_1 = require("./commands/inbox");
25
13
  const note_1 = require("./commands/note");
26
- const promote_1 = require("./commands/promote");
27
- const reverseTicket_1 = require("./commands/reverseTicket");
28
14
  const createTicket_1 = require("./commands/createTicket");
29
15
  const doctor_1 = require("./commands/doctor");
30
16
  const search_1 = require("./commands/search");
31
17
  const library_1 = require("./commands/library");
32
18
  const share_1 = require("./commands/share");
33
19
  const send_1 = require("./commands/send");
34
- const react_1 = require("./commands/react");
35
20
  const capture_1 = require("./commands/capture");
36
- const security_1 = require("./commands/security");
21
+ const pack_1 = require("./commands/pack");
22
+ const traces_1 = require("./commands/traces");
23
+ const agents_1 = require("./commands/agents");
24
+ const evals_1 = require("./commands/evals");
25
+ const hookGate_1 = require("./packs/hookGate");
26
+ const sync_1 = require("./packs/sync");
37
27
  const version_1 = require("./version");
38
28
  const HELP = `
39
29
  Codiedev CLI
@@ -43,14 +33,11 @@ Codiedev CLI
43
33
  someone left off across sessions and providers.
44
34
 
45
35
  Connect:
46
- codiedev connect Link Claude Code / Codex / Cursor to your org
47
- codiedev doctor Verify setup, capture, and Agent Security
48
- codiedev security pilot Run safe synthetic policy checks
49
- codiedev security inventory Inventory MCPs, skills, hooks, plugins,
50
- instructions, and editor extensions
51
- codiedev security scan --deep Run installed open-source scanners too
52
- codiedev security sync Fetch administrator policy locally
53
- codiedev security rollback --yes Restore pre-update hook configuration
36
+ codiedev connect Sign in with your browser and link
37
+ Claude Code / Codex / Cursor /
38
+ GitHub Copilot / pi to your org
39
+ codiedev logout Sign this machine out
40
+ codiedev doctor Verify setup and capture
54
41
 
55
42
  Harness:
56
43
  codie Launch the governed Codie harness.
@@ -70,14 +57,6 @@ Artifacts:
70
57
  team's collective memory. Returns an
71
58
  LLM-synthesized answer with citations
72
59
  pointing at sessions + artifacts.
73
- codiedev promote <artifact-id> Promote an auto-extracted artifact
74
- to an authored one
75
- codiedev reverse-ticket [<pr-url>] Generate a Jira ticket draft.
76
- No URL = branch mode (uses your current
77
- local git branch, no PR needed).
78
- Draft lands in /portal/agentic-ticketing.
79
- codiedev reverse-ticket --base <ref> Override the base ref in branch mode
80
- (defaults to origin/main).
81
60
  codiedev create-ticket [<prompt>] Forward-write a scoped ticket plan.
82
61
  Claude investigates the codebase, asks
83
62
  "single repo or multiple? where?", then
@@ -96,6 +75,30 @@ Messaging:
96
75
  codiedev inbox [--unread] [--limit N] Show messages
97
76
  codiedev read <ping-id> Mark read + show full message
98
77
 
78
+ Starter packs:
79
+ codiedev pack list Packs assigned to your team
80
+ codiedev pack install [slug] [--harness claude,codex,copilot,cursor,codie,pi]
81
+ [--dry-run] [--json]
82
+ Install a pack (or all) into every
83
+ detected tool
84
+ codiedev pack status Installed packs, up to date or not
85
+
86
+ Traces (agents on the gateway):
87
+ codiedev agents init | deploy | run | runs | show | secrets | webhook
88
+ Deploy agents and run them in fresh sandboxes
89
+ (codiedev agents help)
90
+ codiedev traces agents Agents you maintain, with saved test cases
91
+ codiedev traces cases <agent> [--dataset name [--version n]] [--model id]
92
+ Pull an agent's test cases (or one dataset)
93
+ into this repo for your coding agent to
94
+ run, optionally on another model
95
+ codiedev traces report <results.json> Send the results back to Traces
96
+ codiedev traces overview | runs | run | score | scores | score-kinds | queue | judge | import | add-example | versions | save-version
97
+ Agents, runs, failures, scores, review queues,
98
+ automatic scoring and datasets (codiedev traces help)
99
+ codiedev evals report <run.json> File one variant's eval scores under an experiment
100
+ codiedev evals last <subject> Latest experiment on a subject + its champion
101
+
99
102
  Discovery:
100
103
  codiedev search "<query>" Semantic search across the team's
101
104
  captured sessions and artifacts
@@ -103,9 +106,6 @@ Discovery:
103
106
  [--type T] [--tag X] [--limit N]
104
107
  List artifacts in your workspace
105
108
 
106
- Feed:
107
- codiedev react <postId> <emoji> Toggle a reaction on a feed post
108
-
109
109
  Privacy:
110
110
  codiedev ignore <path> Never capture this folder or its children
111
111
  codiedev unignore <path> Stop ignoring a folder
@@ -159,21 +159,49 @@ locally before any capture leaves your machine, so an offline or failed portal
159
159
  status sync never weakens it.
160
160
  `.trim();
161
161
  const COMMAND_HELP = {
162
+ pack: pack_1.PACK_HELP,
163
+ traces: traces_1.TRACES_HELP,
164
+ agents: agents_1.AGENTS_HELP,
165
+ evals: evals_1.EVALS_HELP,
162
166
  connect: `
163
167
  codiedev connect — link your agent CLI to Codiedev
164
168
 
165
- Interactive setup. Prompts for an API token, then installs:
166
- - ~/.codiedev/config.json (token + org + tracked repos)
169
+ Opens your browser to sign in (approve once, no API key to copy), then
170
+ installs:
171
+ - ~/.codiedev/config.json (sign-in + org + tracked repos)
167
172
  - ~/.claude/settings.json hook (captures session transcripts)
168
173
  - ~/.claude/CLAUDE.md instructions (teaches Claude the commands)
169
174
  - ~/.codex/hooks.json hook (same, for Codex)
170
175
  - ~/.codex/AGENTS.md instructions (same, for Codex)
171
- - ~/.cursor/hooks.json hooks (session, prompt, security, capture)
176
+ - ~/.cursor/hooks.json hooks (session, backup, capture)
172
177
  - ~/.cursor/rules/codiedev.mdc (teaches Cursor the commands)
178
+ - ~/.copilot/hooks/codiedev.json (GitHub Copilot: VS Code + CLI capture)
179
+ - ~/.pi/agent/extensions/codiedev.ts (pi: session, prompt, capture)
180
+ - ~/.pi/agent/AGENTS.md (teaches pi the commands)
173
181
 
174
182
  Re-run anytime to swap accounts or refresh the instruction block.
175
183
 
176
- Get your token: https://codiedev.com/portal/integrations/claude-code
184
+ Over SSH or on a machine with no display it shows a link and a short code
185
+ instead: open the link on your laptop or phone, check the code, approve.
186
+ Detected automatically.
187
+
188
+ Options:
189
+ --token Paste an API token instead of signing in with a browser
190
+ (CI, or a machine with no browser anywhere). Create one at
191
+ https://codiedev.com/portal/integrations/claude-code
192
+ --force, -f Sign in again even if this machine is already connected.
193
+
194
+ Browser sign-in stores a 24-hour access token and a refresh token that
195
+ rotates on every use; nothing long-lived is saved. Revoke a machine from
196
+ Integrations in the portal, or run 'codiedev logout' on it.
197
+ `.trim(),
198
+ logout: `
199
+ codiedev logout — sign this machine out
200
+
201
+ Ends this machine's browser sign-in on the server and removes it from
202
+ ~/.codiedev/config.json. Device settings (ignored folders) are kept.
203
+ For a pasted API token, it's only forgotten locally: revoke it in the
204
+ portal under Integrations.
177
205
  `.trim(),
178
206
  push: `
179
207
  codiedev push — author or update an artifact
@@ -275,20 +303,6 @@ codiedev note — capture a passing thought, linked to your session
275
303
  unignore: IGNORE_HELP,
276
304
  ignored: IGNORE_HELP,
277
305
  capture: IGNORE_HELP,
278
- promote: `
279
- codiedev promote — promote an auto-extracted artifact to authored
280
-
281
- Usage:
282
- codiedev promote <artifact-id> [--key filename.md]
283
-
284
- The session-capture pipeline auto-extracts spec/bugfix/decision
285
- artifacts from each agent session. Promote turns one of those into
286
- a first-class authored artifact your team can ping, pull, and
287
- update versions of.
288
-
289
- Find artifact-ids in the portal under Knowledge → Memory, or via
290
- the portal search.
291
- `.trim(),
292
306
  "create-ticket": `
293
307
  codiedev create-ticket — forward-write a scoped ticket plan
294
308
 
@@ -406,16 +420,37 @@ Run 'codiedev help <command>' for each, or see the quick list:
406
420
 
407
421
  codiedev help
408
422
 
409
- ## Getting a token
423
+ ## Signing in
410
424
 
411
- 1. Log in to https://codiedev.com/portal/integrations/claude-code
412
- 2. Click "Create token"
413
- 3. Copy the cdv_... string and paste it into 'codiedev connect'
425
+ 'codiedev connect' opens your browser; approve, and you're done. Nothing
426
+ long-lived is stored: a 24-hour access token plus a rotating refresh token.
414
427
 
415
- Tokens are per-user. Rotate any time by revoking + creating a new one.
428
+ Over SSH it shows a link and code to approve from your laptop or phone,
429
+ automatically. For CI, create a token at
430
+ https://codiedev.com/portal/integrations/claude-code and run
431
+ 'codiedev connect --token'.
416
432
  `.trim();
433
+ const REMOVED_COMMANDS = {
434
+ promote: "Share an auto-saved spec with 'Promote to team' in the portal's My artifacts list.",
435
+ "reverse-ticket": "Use 'codiedev create-ticket' to draft Jira tickets.",
436
+ reverseTicket: "Use 'codiedev create-ticket' to draft Jira tickets.",
437
+ react: "React to feed posts in the portal.",
438
+ };
439
+ function removedCommand(command) {
440
+ console.error(`'codiedev ${command}' has been removed. ${REMOVED_COMMANDS[command] ?? ""}`.trim());
441
+ process.exit(1);
442
+ }
417
443
  async function main() {
418
444
  const [, , command, ...rest] = process.argv;
445
+ if (command === "hook-gate") {
446
+ (0, hookGate_1.runHookGateCli)(rest);
447
+ return;
448
+ }
449
+ if (command && !["pack", "packs", "help", "docs", "version", "--version", "-v", "--help", "-h"].includes(command) && !rest.includes("--json")) {
450
+ const nag = (0, sync_1.packNagLine)();
451
+ if (nag)
452
+ console.error(`\n${nag}\n`);
453
+ }
419
454
  if (!command || command === "--help" || command === "-h") {
420
455
  console.log(HELP);
421
456
  return;
@@ -438,7 +473,6 @@ async function main() {
438
473
  console.log(DOCS);
439
474
  return;
440
475
  }
441
- // Support `codiedev <command> --help` too.
442
476
  if (rest.includes("--help") || rest.includes("-h")) {
443
477
  if (COMMAND_HELP[command]) {
444
478
  console.log(COMMAND_HELP[command]);
@@ -449,18 +483,40 @@ async function main() {
449
483
  console.log(`codiedev v${version_1.CLI_VERSION}`);
450
484
  return;
451
485
  }
486
+ if (command !== "connect" && command !== "logout") {
487
+ const fresh = await (0, cliSession_1.ensureFreshToken)({ configPath: utils_1.CONFIG_PATH }).catch(() => null);
488
+ if (fresh?.status === "signed_out") {
489
+ console.error("\nYour Codiedev sign-in has ended (revoked or expired). Run `codiedev connect` to sign in again.\n");
490
+ }
491
+ }
452
492
  try {
453
493
  switch (command) {
454
494
  case "connect":
455
495
  await (0, connect_1.runConnect)(rest);
456
496
  return;
497
+ case "session-refresh": {
498
+ await (0, cliSession_1.ensureFreshToken)({ configPath: utils_1.CONFIG_PATH }, 60 * 60_000).catch(() => null);
499
+ return;
500
+ }
501
+ case "logout": {
502
+ const out = await (0, cliSession_1.logout)({ configPath: utils_1.CONFIG_PATH });
503
+ if (!out.wasConnected) {
504
+ console.log("This machine isn't signed in.");
505
+ }
506
+ else if (out.hadBrowserAuth) {
507
+ console.log(out.serverRevoked
508
+ ? "Signed out. This machine's sign-in is revoked."
509
+ : "Signed out on this machine. Couldn't reach Codiedev to revoke the sign-in; revoke it under Integrations in the portal.");
510
+ }
511
+ else {
512
+ console.log("Removed the API token from this machine. It still works elsewhere until you revoke it under Integrations in the portal.");
513
+ }
514
+ return;
515
+ }
457
516
  case "doctor":
458
517
  case "verify":
459
518
  await (0, doctor_1.runDoctor)(rest);
460
519
  return;
461
- case "security":
462
- await (0, security_1.runSecurityCommand)(rest);
463
- return;
464
520
  case "push":
465
521
  await (0, push_1.runPush)(rest);
466
522
  return;
@@ -479,7 +535,6 @@ async function main() {
479
535
  return;
480
536
  case "inbox":
481
537
  case "check":
482
- // Support `codiedev check inbox` as an alias.
483
538
  if (command === "check" && rest[0] === "inbox") {
484
539
  await (0, inbox_1.runInbox)(rest.slice(1));
485
540
  }
@@ -494,11 +549,10 @@ async function main() {
494
549
  await (0, note_1.runNote)(rest);
495
550
  return;
496
551
  case "promote":
497
- await (0, promote_1.runPromote)(rest);
498
- return;
499
552
  case "reverse-ticket":
500
553
  case "reverseTicket":
501
- await (0, reverseTicket_1.runReverseTicket)(rest);
554
+ case "react":
555
+ removedCommand(command);
502
556
  return;
503
557
  case "create-ticket":
504
558
  case "createTicket":
@@ -511,22 +565,31 @@ async function main() {
511
565
  case "ls":
512
566
  await (0, library_1.runLibrary)(rest);
513
567
  return;
568
+ case "traces":
569
+ await (0, traces_1.runTraces)(rest);
570
+ return;
571
+ case "agents":
572
+ await (0, agents_1.runAgents)(rest);
573
+ return;
574
+ case "evals":
575
+ await (0, evals_1.runEvals)(rest);
576
+ return;
514
577
  case "share":
515
578
  await (0, share_1.runShare)(rest);
516
579
  return;
517
580
  case "send":
518
581
  await (0, send_1.runSend)(rest);
519
582
  return;
520
- case "react":
521
- await (0, react_1.runReact)(rest);
522
- return;
523
583
  case "ignore":
524
584
  case "unignore":
525
585
  case "ignored":
526
586
  await (0, capture_1.runCaptureCommand)([command, ...rest]);
527
587
  return;
588
+ case "pack":
589
+ case "packs":
590
+ await (0, pack_1.runPack)(rest);
591
+ return;
528
592
  case "capture":
529
- // Back-compat alias for the earlier `codiedev capture <sub>` form.
530
593
  await (0, capture_1.runCaptureCommand)(rest);
531
594
  return;
532
595
  default: