checkpointer 0.1.0 → 0.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "checkpointer",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Git-isolated checkpoints that humans and AI agents share — save working states, revert anytime, ship a range as one clean commit.",
5
5
  "keywords": [
6
6
  "checkpoint",
@@ -32,19 +32,21 @@
32
32
  "scripts": {
33
33
  "build": "tsup",
34
34
  "dev": "tsup --watch",
35
+ "pretest": "tsup",
35
36
  "test": "vitest run",
36
37
  "test:watch": "vitest",
37
38
  "typecheck": "tsc --noEmit",
38
- "prepublishOnly": "npm run build"
39
+ "smoke": "node scripts/smoke.mjs",
40
+ "prepublishOnly": "npm run build && npm run smoke"
39
41
  },
40
42
  "dependencies": {
41
43
  "commander": "^12.1.0",
42
- "picocolors": "^1.1.1"
44
+ "picocolors": "^1.1.1",
45
+ "typescript": "^5.7.2"
43
46
  },
44
47
  "devDependencies": {
45
48
  "@types/node": "^22.10.0",
46
49
  "tsup": "^8.3.5",
47
- "typescript": "^5.7.2",
48
50
  "vitest": "^2.1.8"
49
51
  }
50
52
  }
@@ -28,6 +28,10 @@ If `checkpointer` is not installed, run it through `npx checkpointer <command>`.
28
28
  ```bash
29
29
  checkpointer save --intent "why you are about to make this change"
30
30
  ```
31
+ To avoid piling up identical checkpoints, gate the save on a real change:
32
+ ```bash
33
+ checkpointer changed && checkpointer save --intent "..." # exits 100 if nothing changed
34
+ ```
31
35
  2. **After reaching a known-good state** — tests pass, feature works:
32
36
  ```bash
33
37
  checkpointer save working-login --status working -m "login flow works end to end"
@@ -53,7 +57,15 @@ If `checkpointer` is not installed, run it through `npx checkpointer <command>`.
53
57
 
54
58
  ## Rules
55
59
 
60
+ - A plain `save` with no changes is a no-op — it reuses the latest checkpoint instead of
61
+ piling up duplicates (the `--json` payload has `"noop": true`). Pass `--allow-empty`, or a
62
+ name/message/status, to force a new one. So saving proactively is cheap and safe.
56
63
  - Restoring is always safe: it auto-saves the current state first, so a restore can be undone.
64
+ It never deletes later checkpoints — they stay in `list` (under a "set aside" divider) and you
65
+ can `restore` straight back to them. Restoring only rewinds the working tree.
66
+ - After a rollback, `ship` follows the live line of work: it targets the latest checkpoint a
67
+ restore hasn't set aside, and refuses (`abandoned_target`, exit 5) an explicit `--upto` on a
68
+ set-aside one. To ship set-aside content, `restore` it (or re-`save` the current state) first.
57
69
  - `ship` only adds a commit — it never overwrites the user's uncommitted or untracked work.
58
70
  - Never run `ship` without showing `status` or `--dry-run` output to the user first.
59
71
  - Don't `--force` past a `broken` checkpoint without telling the user why.
@@ -68,12 +80,33 @@ If `checkpointer` is not installed, run it through `npx checkpointer <command>`.
68
80
  | `checkpointer save [name]` | Snapshot the working tree |
69
81
  | `checkpointer list` | List checkpoints |
70
82
  | `checkpointer status` | Show how many checkpoints are unshipped |
83
+ | `checkpointer changed [id]` | Is there anything new to save? (exit 0 = yes, 100 = no) |
71
84
  | `checkpointer show <id>` | Details + files in a checkpoint |
72
85
  | `checkpointer diff <a> [b]` | Diff two checkpoints, or one vs the working tree |
73
86
  | `checkpointer restore <id>` | Reset working tree to a checkpoint (auto-saves first) |
74
87
  | `checkpointer tag <id> <status>` | Mark working / wip / broken |
75
88
  | `checkpointer ship -m "msg"` | Bundle unshipped checkpoints into one commit |
89
+ | `checkpointer graph --json` | Function call graph of the project (nodes/edges/roots) for understanding code |
76
90
  | `checkpointer info` | Show storage location and excluded paths (e.g. .env, *.key) |
77
91
 
78
- Add `--json` to any command for structured output. On failure with `--json`, the
79
- command prints `{"error": "...", "code": "..."}` to stdout and exits non-zero.
92
+ To understand an unfamiliar codebase or trace how a function is reached before
93
+ editing it, `checkpointer graph --json` returns the project's call graph: `nodes`
94
+ (functions/methods with `file`, `line`, `description`, params) and `edges`
95
+ (`{from, to}` by node id), plus `roots` (entrypoints). Resolved via the TypeScript
96
+ compiler, so method and import calls are accurate. For a human, `checkpointer graph`
97
+ opens an interactive, searchable tree in the browser.
98
+
99
+ Add `--json` to any command for a stable, versioned envelope on stdout:
100
+
101
+ - success — `{"schema":"checkpointer/v1","ok":true,"data":{...}}`
102
+ - failure — `{"schema":"checkpointer/v1","ok":false,"error":{"message":"...","code":"..."}}` (exits non-zero)
103
+
104
+ Branch on the `ok` field, not on output text. Fields inside `data` are additive.
105
+
106
+ Exit codes are stable, so you can react without parsing the message:
107
+
108
+ - `0` success · `1` generic/unexpected
109
+ - `3` environment not ready (not initialized, not a repo, lock held, corrupt metadata)
110
+ - `4` bad input (no such checkpoint, duplicate name, invalid status, missing message)
111
+ - `5` safety refusal — a human decision is needed (e.g. a `broken` checkpoint, a detached HEAD, or a set-aside checkpoint blocks ship)
112
+ - `6` benign no-op — nothing to do (nothing unshipped; repo already matches)