@cogit/cli 0.19.1 → 0.21.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cogit",
3
3
  "displayName": "cogit",
4
- "version": "0.19.1",
4
+ "version": "0.21.0",
5
5
  "description": "Git remembers what changed. cogit remembers why.",
6
6
  "author": {
7
7
  "name": "Eren Sertkaya"
package/README.md CHANGED
@@ -6,10 +6,7 @@ Git remembers what changed. cogit remembers why.
6
6
 
7
7
  <p align="center"><img src="docs/images/cogit-descartes.jpg" width="360" alt="René Descartes with git branches running through his hair"><br><i>Cogito, ergo commit.</i></p>
8
8
 
9
- <picture>
10
- <source media="(prefers-color-scheme: dark)" srcset="docs/images/map-dark.png">
11
- <img src="docs/images/map-light.png" alt="The map: sessions, branches and the decision behind a message">
12
- </picture>
9
+ <img src="docs/images/demo.gif" alt="cogit open shows the projects, then the map; pasting a message hash opens the decision behind it, and cogit why lists the thoughts behind a file">
13
10
 
14
11
  cogit records every message you send to an AI coding agent as a *thought commit*: what you
15
12
  asked, what came of it, and the message it answered. Your code commits point back to the
@@ -56,6 +53,9 @@ Then, in Claude Code:
56
53
  /plugin install cogit --marketplace erensrtky/cogit
57
54
  ```
58
55
 
56
+ To get plugin updates on their own, turn on auto-update once: `/plugin` → Marketplaces →
57
+ cogit → Enable auto-update. Claude Code leaves it off for marketplaces outside its own.
58
+
59
59
  ## Quick start
60
60
 
61
61
  ```bash
@@ -20219,10 +20219,11 @@ var Config = external_exports.object({
20219
20219
  sessionEndCatchUp: external_exports.boolean().default(true),
20220
20220
  /**
20221
20221
  * Who writes the record (Story 12.1): the main agent (`agent`), both (`mixed`,
20222
- * the default: a side model often, the agent rarely), or only the side model
20223
- * (`side`, the agent is never interrupted).
20222
+ * "Detailed" in the panel: a side model often, the agent rarely), or only the
20223
+ * side model (`side`, "Economical", the default since 0.21: the agent is never
20224
+ * interrupted and the session-end pass writes the branches).
20224
20225
  */
20225
- recorder: external_exports.enum(["agent", "mixed", "side"]).default("mixed"),
20226
+ recorder: external_exports.enum(["agent", "mixed", "side"]).default("side"),
20226
20227
  /** Model the side runs use: the headless catch-up and the periodic records. */
20227
20228
  sideModel: external_exports.string().trim().min(1).max(64).default("haiku"),
20228
20229
  /** How often the side model records, in turns (Story 12.1). */
@@ -20242,6 +20243,12 @@ var Config = external_exports.object({
20242
20243
  * how to read the record (`log` / `show`). On by default; costs only tokens.
20243
20244
  */
20244
20245
  startupContext: external_exports.boolean().default(true),
20246
+ /**
20247
+ * Whether sessions started without a person (`claude -p`, an SDK) are recorded.
20248
+ * Off by default: other plugins start them in the background, one per prompt,
20249
+ * and they would fill the map and the inbox.
20250
+ */
20251
+ recordHeadless: external_exports.boolean().default(false),
20245
20252
  /** Port the local map server binds on `127.0.0.1`. */
20246
20253
  serverPort: external_exports.int().min(1).max(65535).default(4747),
20247
20254
  /** Default for new projects; `init` asks per repo. Story 9.3: the record travels. */
@@ -20407,6 +20414,12 @@ var Session = external_exports.object({
20407
20414
  startedAt: IsoDate,
20408
20415
  updatedAt: IsoDate,
20409
20416
  status: Status.default({ goal: "", done: [], pending: [], next: "" }),
20417
+ /**
20418
+ * One line on where the session left off (L0), so a later session can tell
20419
+ * whether it continues this one without reading the branches. Written by the
20420
+ * session-end pass; old records have none.
20421
+ */
20422
+ leftOff: external_exports.string().max(400).optional(),
20410
20423
  nodes: external_exports.array(LineageNode).default([]),
20411
20424
  /** The linked git worktree the session ran in; set by the CLI, never by the agent. */
20412
20425
  worktree: external_exports.object({ path: external_exports.string().min(1), branch: external_exports.string().min(1).nullable() }).optional(),
@@ -20435,6 +20448,7 @@ var SessionInput = external_exports.object({
20435
20448
  title: external_exports.string().max(200).optional(),
20436
20449
  epoch: Slug.nullable().optional(),
20437
20450
  status: Status.optional(),
20451
+ leftOff: external_exports.string().max(400).optional(),
20438
20452
  nodes: external_exports.array(LineageNodeInput).optional()
20439
20453
  });
20440
20454
 
@@ -20773,6 +20787,12 @@ function parseHookInput(stdin) {
20773
20787
  const parsed = ClaudeHookInput.safeParse(raw);
20774
20788
  return parsed.success ? parsed.data : void 0;
20775
20789
  }
20790
+ function isHeadless(env) {
20791
+ return env.CLAUDE_CODE_ENTRYPOINT?.startsWith("sdk") ?? false;
20792
+ }
20793
+ function userNotice(text) {
20794
+ return { systemMessage: text };
20795
+ }
20776
20796
  function additionalContext(event, text) {
20777
20797
  return { hookSpecificOutput: { hookEventName: event, additionalContext: text } };
20778
20798
  }
@@ -21053,13 +21073,23 @@ function displayTurn(turn, roots) {
21053
21073
  ...turn,
21054
21074
  text: capped(text),
21055
21075
  replies: turn.replies.map(capped),
21056
- tools: { ...turn.tools, files: turn.tools.files.map(relative3) }
21076
+ // Steps and questions feed the recorder only; the map keeps the counts.
21077
+ tools: {
21078
+ commands: turn.tools.commands,
21079
+ files: turn.tools.files.map(relative3),
21080
+ other: turn.tools.other
21081
+ }
21057
21082
  };
21058
21083
  }
21059
21084
  var EDIT_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
21060
21085
  var CLEAR = /<command-name>\s*\/clear\s*<\/command-name>/;
21061
21086
  var LINE_UUID = /"uuid":"([^"]+)"/;
21062
21087
  var LINE_PARENT = /"parentUuid":"([^"]+)"/;
21088
+ var LIST_LIMIT = 40;
21089
+ function addOnce(tools, key, text) {
21090
+ const list = tools[key] ?? [];
21091
+ if (list.length < LIST_LIMIT && !list.includes(text)) tools[key] = [...list, text.slice(0, 300)];
21092
+ }
21063
21093
  function addAssistant(turn, line) {
21064
21094
  if (line.isSidechain) return;
21065
21095
  const content = line.message?.content;
@@ -21068,11 +21098,23 @@ function addAssistant(turn, line) {
21068
21098
  if (block?.type === "text" && typeof block.text === "string" && block.text.trim() !== "") {
21069
21099
  turn.replies.push(block.text);
21070
21100
  } else if (block?.type === "tool_use") {
21071
- const path = block.input?.file_path;
21072
- if (block.name === "Bash") turn.tools.commands += 1;
21073
- else if (EDIT_TOOLS.has(block.name) && typeof path === "string") {
21101
+ const input2 = block.input ?? {};
21102
+ const path = input2.file_path;
21103
+ if (block.name === "Bash") {
21104
+ turn.tools.commands += 1;
21105
+ if (typeof input2.description === "string" && input2.description.trim() !== "")
21106
+ addOnce(turn.tools, "steps", input2.description.trim());
21107
+ } else if (EDIT_TOOLS.has(block.name) && typeof path === "string") {
21074
21108
  if (!turn.tools.files.includes(path)) turn.tools.files.push(path);
21075
- } else turn.tools.other += 1;
21109
+ } else {
21110
+ turn.tools.other += 1;
21111
+ if (block.name === "AskUserQuestion" && Array.isArray(input2.questions))
21112
+ for (const q of input2.questions) {
21113
+ if (typeof q?.question !== "string") continue;
21114
+ const options = Array.isArray(q.options) ? q.options.map((o) => o?.label).filter((label) => typeof label === "string") : [];
21115
+ addOnce(turn.tools, "asks", `${q.question} [${options.join(" | ")}]`);
21116
+ }
21117
+ }
21076
21118
  }
21077
21119
  }
21078
21120
  }
@@ -21257,7 +21299,9 @@ var claude = {
21257
21299
  displayTurn,
21258
21300
  excerpt,
21259
21301
  parseHookInput,
21302
+ isHeadless,
21260
21303
  additionalContext,
21304
+ userNotice,
21261
21305
  readRetention,
21262
21306
  readPluginInstalled,
21263
21307
  readSkillAllowed,
@@ -21837,6 +21881,8 @@ export {
21837
21881
  Config,
21838
21882
  SESSION_SCHEMA,
21839
21883
  MESSAGE_ID,
21884
+ BranchSummary,
21885
+ Status,
21840
21886
  SessionInput,
21841
21887
  STATE_SCHEMA,
21842
21888
  LockBusyError,