@cogit/cli 0.0.0-stage → 0.18.1

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.
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __cl_createRequire } from "node:module";
3
+ const require = __cl_createRequire(import.meta.url);
4
+ import {
5
+ BLOCK_END,
6
+ BLOCK_START,
7
+ GIT_HOOK_EVENTS,
8
+ currentCliPath,
9
+ hookBlock,
10
+ installGitHook,
11
+ installGitHooks,
12
+ isGitHookEvent,
13
+ refreshGitHooks,
14
+ runGitHook,
15
+ uninstallGitHooks,
16
+ withHookBlock,
17
+ withoutHookBlock
18
+ } from "./chunk-3FDYKXX3.js";
19
+ export {
20
+ BLOCK_END,
21
+ BLOCK_START,
22
+ GIT_HOOK_EVENTS,
23
+ currentCliPath,
24
+ hookBlock,
25
+ installGitHook,
26
+ installGitHooks,
27
+ isGitHookEvent,
28
+ refreshGitHooks,
29
+ runGitHook,
30
+ uninstallGitHooks,
31
+ withHookBlock,
32
+ withoutHookBlock
33
+ };
@@ -0,0 +1,65 @@
1
+ {
2
+ "hooks": {
3
+ "Stop": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "node",
9
+ "args": ["${CLAUDE_PLUGIN_ROOT}/dist/cli.js", "hook", "stop"],
10
+ "timeout": 10
11
+ }
12
+ ]
13
+ }
14
+ ],
15
+ "SessionStart": [
16
+ {
17
+ "hooks": [
18
+ {
19
+ "type": "command",
20
+ "command": "node",
21
+ "args": ["${CLAUDE_PLUGIN_ROOT}/dist/cli.js", "hook", "sessionstart"],
22
+ "timeout": 10
23
+ }
24
+ ]
25
+ }
26
+ ],
27
+ "SessionEnd": [
28
+ {
29
+ "hooks": [
30
+ {
31
+ "type": "command",
32
+ "command": "node",
33
+ "args": ["${CLAUDE_PLUGIN_ROOT}/dist/cli.js", "hook", "sessionend"],
34
+ "timeout": 5
35
+ }
36
+ ]
37
+ }
38
+ ],
39
+ "UserPromptSubmit": [
40
+ {
41
+ "hooks": [
42
+ {
43
+ "type": "command",
44
+ "command": "node",
45
+ "args": ["${CLAUDE_PLUGIN_ROOT}/dist/cli.js", "hook", "promptsubmit"],
46
+ "timeout": 5
47
+ }
48
+ ]
49
+ }
50
+ ],
51
+ "PreToolUse": [
52
+ {
53
+ "matcher": "Edit|Write|MultiEdit",
54
+ "hooks": [
55
+ {
56
+ "type": "command",
57
+ "command": "node",
58
+ "args": ["${CLAUDE_PLUGIN_ROOT}/dist/cli.js", "hook", "pretooluse"],
59
+ "timeout": 10
60
+ }
61
+ ]
62
+ }
63
+ ]
64
+ }
65
+ }
package/package.json CHANGED
@@ -1,6 +1,51 @@
1
1
  {
2
2
  "name": "@cogit/cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.18.1",
4
+ "description": "Git remembers what changed. cogit remembers why.",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "git",
8
+ "ai",
9
+ "coding-agent",
10
+ "claude-code",
11
+ "history",
12
+ "lineage",
13
+ "commit",
14
+ "context"
15
+ ],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/erensrtky/cogit.git"
19
+ },
20
+ "homepage": "https://github.com/erensrtky/cogit#readme",
21
+ "bugs": {
22
+ "url": "https://github.com/erensrtky/cogit/issues"
23
+ },
24
+ "type": "module",
25
+ "bin": {
26
+ "cogit": "dist/cli.js"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ ".claude-plugin",
31
+ "skills",
32
+ "hooks"
33
+ ],
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "engines": {
38
+ "node": ">=22.13.0"
39
+ },
40
+ "scripts": {
41
+ "prebuild": "node ../../scripts/sync-version.mjs",
42
+ "build": "tsup",
43
+ "prepack": "node ../../scripts/sync-version.mjs && node ../../scripts/copy-docs.mjs"
44
+ },
45
+ "devDependencies": {
46
+ "@inquirer/prompts": "^8.7.4",
47
+ "commander": "^15.0.0",
48
+ "tsup": "^9.0.0",
49
+ "zod": "^4.6.7"
50
+ }
51
+ }
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: record
3
+ description: Record or update this session's cogit lineage: one node per user message with what came of it and its parent, branch summaries, and the goal, open items and next step. Use when the user asks to record the session or its lineage, or when a cogit hook asks for an update.
4
+ allowed-tools: Bash(node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js" *) Edit(/${CLAUDE_PROJECT_DIR}/.cogit/inbox/**)
5
+ ---
6
+
7
+ # Record this session's lineage
8
+
9
+ The current record (`cogit session show`):
10
+
11
+ !`node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js" session show "${CLAUDE_SESSION_ID}" -C "${CLAUDE_PROJECT_DIR}"`
12
+
13
+ ## Check first
14
+
15
+ - `initialized: false`: reply exactly "cogit is not set up in this project yet; run
16
+ `npx @cogit/cli init` here first." and stop.
17
+ - `sessionError`: quote it and stop; never write over the record.
18
+ - Nothing new or changed (`newMessages` empty): reply "Lineage is up to date." and stop.
19
+
20
+ ## Look something up
21
+
22
+ A word rather than a hash: `node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js" search "<text>" -C "<dir>"`
23
+ scans titles, branch summaries, decisions and stored conversations, newest first (`--json`,
24
+ `-n`, `--session`); hashes go to `show`.
25
+
26
+ ## A pull request description
27
+
28
+ When the user asks for a PR description, run
29
+ `node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js" pr -C "${CLAUDE_PROJECT_DIR}"` and hand its output
30
+ over as it is; do not write one yourself. Only when the user uses `gh`, follow it with
31
+ `gh pr create --body "$(node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js" pr -C "${CLAUDE_PROJECT_DIR}")"`.
32
+
33
+ ## Send only what is new or changed
34
+
35
+ One JSON object:
36
+
37
+ - `sessionId`: always `"${CLAUDE_SESSION_ID}"`.
38
+ - `title`: a few words; on the first write or when the focus changed.
39
+ - `epoch`: an `epochs` id that fits; a distinct new feature first gets
40
+ `node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js" epoch add <id> "<title>" -C "<dir>"`. Omit when unsure.
41
+ - `status`: replaces all four fields, so send each: `goal` (one sentence), `done`, `pending`
42
+ (`{ "text", "needsUser": true }` when it waits on the user), `next` (concrete step).
43
+ - `nodes`: only new nodes or changed fields; the rest is kept.
44
+
45
+ ## One node per user message
46
+
47
+ `newMessages` lists unrecorded messages in order with stable `id`, display `label`, time and
48
+ text start. Send one `message` node for every one, even "ok"; skip none. If it is `null`, the
49
+ transcript is unreadable: send only `status`.
50
+
51
+ - `id`: the message's `id`; the `label` works too, and a parent or link accepts either.
52
+ `kind`: `"message"`.
53
+ - `title`: a few words in the user's wording; never copy a long paste.
54
+ - `summary`: what came of it, ONLY when `messageSummaries` is true; otherwise leave it out,
55
+ like a commit with a subject and no body.
56
+ - A decision: `decidedBy` (`"user"` or `"agreed"`), `why`, `alternatives`
57
+ (`{ "option", "why" }`).
58
+ - Your work belongs to the message that caused it: `work`, `agentDecisions`
59
+ (`{ "title", "why", "alternatives" }`), `commits` (short hashes), `files` (a few paths).
60
+ Work spanning messages goes on the one it ended in; update an earlier node only to correct it.
61
+
62
+ ## Parents
63
+
64
+ Every message grows from an earlier one; a thread that starts something new is a root.
65
+
66
+ - Default: the previous message. `parent: null` only if it would work as a new chat's first
67
+ message. Back to an older thread: that message is the parent, the previous one goes in `links`.
68
+ - A first message continuing earlier work: `parent` is `<sessionId>:<stable id>`;
69
+ `candidates` lists the last messages of the most recent other sessions. The target must be
70
+ a message of an earlier session of this project.
71
+ - Unsure: use the previous message. A wrong "continue" hides a branch; a wrong branch breaks
72
+ the chain.
73
+ - `links`: up to 5 earlier messages it builds on besides the parent.
74
+ - Correcting is safe: resend the node with the new parent or links; its id and notes stay,
75
+ and an unchanged resend writes nothing.
76
+ - Hints, not rules: `gapMinutes`, `resumed`, `commitBetween` (a real commit landed in this
77
+ repo between them), `lastMessages`, and for a first message `candidates`/`continuesHint`.
78
+
79
+ ## Branch summary
80
+
81
+ A branch starts at a root or where a message gets a second child. Its first message carries a
82
+ short `branch`: `{ "title", "asked", "outcome", "open" }`. Write it when the branch ends or
83
+ with the status at session end, not every turn. New records send no `phase`, `step`,
84
+ `decision` or `question` nodes; old ones keep rendering, leave them alone.
85
+
86
+ Write titles and text in the conversation's language (`language: "auto"` means it); JSON keys
87
+ stay English. Record decisions and reasons, never secrets, tokens, passwords, credentials,
88
+ personal data, file contents or command output.
89
+
90
+ ## Write it in two steps
91
+
92
+ 1. Write the JSON to the `inbox` path with the Write tool (no heredoc or `echo`).
93
+ 2. `node "${CLAUDE_PLUGIN_ROOT}/dist/cli.js" session write -C "<dir from the record>" --file "<inbox path>" --consume`
94
+
95
+ If it fails, fix the JSON according to the error and run it again. Then reply with one short
96
+ line, e.g. "Lineage updated (3 nodes)"; never repeat the JSON.