assertion-cli 0.5.2__tar.gz → 0.5.3__tar.gz

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 (30) hide show
  1. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/PKG-INFO +1 -1
  2. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/assertion_cli.egg-info/PKG-INFO +1 -1
  3. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/git.py +2 -1
  4. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/pyproject.toml +1 -1
  5. assertion_cli-0.5.3/templates/ACTIVATION.md +50 -0
  6. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/templates/SKILL.md +11 -3
  7. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/tests/test_git.py +33 -0
  8. assertion_cli-0.5.2/templates/ACTIVATION.md +0 -20
  9. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/README.md +0 -0
  10. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/api.py +0 -0
  11. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/assertion_cli.egg-info/SOURCES.txt +0 -0
  12. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/assertion_cli.egg-info/dependency_links.txt +0 -0
  13. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/assertion_cli.egg-info/entry_points.txt +0 -0
  14. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/assertion_cli.egg-info/requires.txt +0 -0
  15. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/assertion_cli.egg-info/top_level.txt +0 -0
  16. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/bundle.py +0 -0
  17. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/link.py +0 -0
  18. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/main.py +0 -0
  19. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/models.py +0 -0
  20. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/session.py +0 -0
  21. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/setup.cfg +0 -0
  22. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/templates/__init__.py +0 -0
  23. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/tests/test_api.py +0 -0
  24. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/tests/test_bundle.py +0 -0
  25. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/tests/test_decision.py +0 -0
  26. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/tests/test_init.py +0 -0
  27. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/tests/test_link.py +0 -0
  28. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/tests/test_main.py +0 -0
  29. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/tests/test_prompt.py +0 -0
  30. {assertion_cli-0.5.2 → assertion_cli-0.5.3}/tests/test_session.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: assertion-cli
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: CLI for the Assertion API
5
5
  Requires-Python: >=3.13
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: assertion-cli
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: CLI for the Assertion API
5
5
  Requires-Python: >=3.13
6
6
  Description-Content-Type: text/markdown
@@ -120,6 +120,7 @@ def get_uncommitted_diff(repo_root: Path, base_sha: str) -> str:
120
120
  ]
121
121
 
122
122
  parts = [p for p in [tracked, "\n".join(untracked_diffs)] if p]
123
- return "\n".join(parts)
123
+ diff = "\n".join(parts)
124
+ return diff + "\n" if diff else diff
124
125
  except RuntimeError as exc:
125
126
  exit_with_error(f"Failed to collect git diff: {exc}")
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "assertion-cli"
7
- version = "0.5.2"
7
+ version = "0.5.3"
8
8
  description = "CLI for the Assertion API"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.13"
@@ -0,0 +1,50 @@
1
+ # Assertion verification
2
+
3
+ This repo uses the Assertion CLI (`asrt`) to track user intent and verify your work. The full workflow lives in the `assertion-cli` skill:
4
+
5
+ - **Claude Code** — [`.claude/skills/assertion-cli/SKILL.md`](.claude/skills/assertion-cli/SKILL.md)
6
+ - **Codex / Cursor** — [`.agents/skills/assertion-cli/SKILL.md`](.agents/skills/assertion-cli/SKILL.md)
7
+
8
+ Both files are byte-identical. Read whichever your agent loads (or either one directly). In brief, follow these three rules for every conversation:
9
+
10
+ 1. **Log every user message:** run `asrt prompt "<exact text>"` before anything else, on every turn — it's the verifier's record of intent.
11
+ 2. **Checkpoint at trajectory-feedback moments**, not every change. First checkpoint: `asrt stacks`, pick the stack that fits, then `asrt checkpoint --stack <id> "<summary>"`; later ones drop `--stack` and auto-continue. A feature build is a handful of checkpoints.
12
+ 3. **Verify at completion** with `asrt verify`. If feedback requires changes, iterate and re-verify — do **not** drop back into the checkpoint loop. Once verify is clean, open a PR — and that PR **must** carry the hidden Assertion session marker (see below).
13
+
14
+ ---
15
+
16
+ ## ⚠️ REQUIRED: every PR must embed the hidden session marker
17
+
18
+ **This is the single most-missed step, and it is not optional.** A PR opened from an Assertion session that omits the marker cannot be linked back to its verification, so the work reads as unverified.
19
+
20
+ The Assertion GitHub bot links a PR to its verification session by **branch name first**. When the branch name doesn't match the one you verified on (you renamed it, the head ref differs, etc.), the bot falls back to reading the marker. No marker → no fallback → no link.
21
+
22
+ `asrt get-link` prints the marker as an HTML comment that GitHub hides from the rendered description but still delivers to the bot in the webhook payload:
23
+
24
+ ```
25
+ <!-- assertion-session: https://app.tryassertion.com/sessions/<id> -->
26
+ ```
27
+
28
+ **Open the PR with the marker embedded** — never paste the bare URL into the visible body; use the command so the format stays exact:
29
+
30
+ ```
31
+ gh pr create --title "<title>" --body "$(printf '%s\n\n%s\n' '<one-paragraph why>' "$(asrt get-link)")"
32
+ ```
33
+
34
+ If a PR already exists for the branch, add the marker instead of opening a new one:
35
+
36
+ ```
37
+ gh pr edit --body "$(printf '%s\n\n%s\n' '<existing summary>' "$(asrt get-link)")"
38
+ ```
39
+
40
+ **Then confirm it landed.** The marker won't show in the rendered description — that's expected — so verify it's in the raw body:
41
+
42
+ ```
43
+ gh pr view --json body --jq .body | grep -q 'assertion-session:' && echo "marker present" || echo "MARKER MISSING — fix before continuing"
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Hard gates (do not bypass)
49
+ - **No PR whose body omits the session marker.** If `asrt get-link` has nothing to return, you haven't verified yet — go back to rule 3.
50
+ - **Confirm the marker after creating/editing the PR** with the `gh pr view` check above. Treat a missing marker as a blocking error, not a warning.
@@ -16,6 +16,8 @@ Before any `asrt` call:
16
16
  - You are inside a git repository.
17
17
  - `asrt init` has been run in this repo. It records the current HEAD as the diff base that every checkpoint/verify diffs against, and installs the skill files you are reading right now. If `asrt checkpoint` or `asrt verify` errors with "No diff base recorded", run `asrt init` and retry.
18
18
 
19
+ **Starting a fresh session:** when beginning a new session, delete the contents of `.assertion/` first. This clears the previous session's in-flight state (metadata, prompts log, link) so a new session starts clean and anchors to the stack you pick on the first checkpoint. Only the user should do this — it resets the session.
20
+
19
21
  Treat `.assertion/metadata.json`, `.assertion/prompts`, and `.assertion/base_sha` as internal state owned by the CLI. Do not create, edit, or delete those files manually — use `asrt prompt` to append to the prompts log.
20
22
 
21
23
  `asrt stacks` is read-only and lists every verification stack in the user's workspace, along with the repo each is configured for. Run it once per session before your first checkpoint so you can pick a stack ID; do not hardcode IDs from memory.
@@ -179,7 +181,15 @@ EOF
179
181
  )"
180
182
  ```
181
183
 
182
- After creating or editing the PR, confirm the marker is in the raw body with `gh pr view --json body` — it won't show in the rendered description, and that's expected.
184
+ **Enforce it — don't assume it landed.** Immediately after creating or editing the PR, confirm the marker is in the raw body (it won't show in the rendered description that's expected):
185
+
186
+ ```
187
+ gh pr view --json body --jq .body | grep -q 'assertion-session:' \
188
+ && echo "marker present" \
189
+ || { echo "MARKER MISSING — re-run gh pr edit with \$(asrt get-link) before continuing"; exit 1; }
190
+ ```
191
+
192
+ A missing marker is a **blocking error**, not a warning: do not consider the PR step complete, and do not move on, until this check prints `marker present`. Re-run `gh pr edit` with `$(asrt get-link)` and re-check until it passes.
183
193
 
184
194
  **Do not open a PR without a clean `asrt verify` / `asrt verify-status`, and do not open one whose body omits the session marker.** Do not end a session with a failed/dirty verify unless the verification service itself is unavailable.
185
195
 
@@ -200,8 +210,6 @@ asrt get-link # hidden PR marker — embed in th
200
210
 
201
211
  ## Environment
202
212
 
203
- - `ASSERTION_BASE_URL` — point the CLI at a non-default backend (default `http://localhost:8000`).
204
-
205
213
  ## Non-interactive / harness mode
206
214
 
207
215
  When running under a non-interactive harness (CI, benchmark runner, scripts):
@@ -222,3 +222,36 @@ def test_get_uncommitted_diff_includes_local_only_commit_against_base(
222
222
  diff = get_uncommitted_diff(tmp_path, base_sha)
223
223
  assert "local.txt" in diff
224
224
  assert "+local change" in diff
225
+
226
+
227
+ # --- trailing newline (diff must never be corrupt for git apply) ---
228
+
229
+
230
+ def test_get_uncommitted_diff_ends_with_newline_when_not_empty(tmp_path: Path) -> None:
231
+ """Diff must end with \\n so git apply on the receiving end never chokes."""
232
+ _init_repo_with_commit(tmp_path)
233
+
234
+ # Tracked change
235
+ f = tmp_path / "file.txt"
236
+ f.write_text("content\n")
237
+ subprocess.run(
238
+ ["git", "add", "file.txt"], cwd=tmp_path, capture_output=True, check=True
239
+ )
240
+ subprocess.run(
241
+ ["git", "commit", "-m", "add file"],
242
+ cwd=tmp_path,
243
+ capture_output=True,
244
+ check=True,
245
+ env={**GIT_ENV, "HOME": str(tmp_path)},
246
+ )
247
+ f.write_text("modified\n")
248
+
249
+ diff = get_uncommitted_diff(tmp_path, "HEAD")
250
+ assert diff != ""
251
+ assert diff.endswith("\n"), f"tracked diff should end with newline, got: {diff[-10:]!r}"
252
+
253
+ # Untracked only
254
+ (tmp_path / "untracked.py").write_text("x = 1\n")
255
+ diff2 = get_uncommitted_diff(tmp_path, "HEAD")
256
+ assert diff2 != ""
257
+ assert diff2.endswith("\n"), f"untracked diff should end with newline, got: {diff2[-10:]!r}"
@@ -1,20 +0,0 @@
1
- # Assertion verification
2
-
3
- This repo uses the Assertion CLI (`asrt`) to track user intent and verify your work. The full workflow lives in the `assertion-cli` skill:
4
-
5
- - **Claude Code** — [`.claude/skills/assertion-cli/SKILL.md`](.claude/skills/assertion-cli/SKILL.md)
6
- - **Codex / Cursor** — [`.agents/skills/assertion-cli/SKILL.md`](.agents/skills/assertion-cli/SKILL.md)
7
-
8
- Both files are byte-identical. Read whichever your agent loads (or either one directly). In brief, follow these three rules for every conversation:
9
-
10
- 1. **Every user message:** call `asrt prompt "<exact text of the message>"` before doing any other work for that turn. This is the verifier's source of truth for what the user asked for and how their direction evolves. Apply to every user turn, not just the first.
11
- 2. **Checkpoint at trajectory-feedback moments**, not on every small change. On the first checkpoint of a session, run `asrt stacks`, pick the stack that fits this repo and the work (use the stack's `repo`, `name`, `description`, plus folder/branch/README signals), then run `asrt checkpoint --stack <id> "<summary>"`. Subsequent checkpoints in the same session don't need `--stack` — `asrt checkpoint "<summary>"` auto-continues. A whole feature build is a handful of checkpoints, not one per file.
12
- 3. **Verify at completion** with `asrt verify`. If feedback requires changes, iterate and re-verify — do **not** drop back into the checkpoint loop. Once verify is clean, open a PR and **embed the hidden Assertion session marker in its body** — this is required, not optional. The marker (`asrt get-link`) is an HTML comment GitHub hides from the rendered description but delivers to the Assertion GitHub bot, which uses it to link the PR to the verification when the branch name doesn't match:
13
-
14
- ```
15
- gh pr create --title "<title>" --body "$(printf '%s\n\n%s\n' '<one-paragraph why>' "$(asrt get-link)")"
16
- ```
17
-
18
- If a PR already exists for the branch, add the marker with `gh pr edit --body` instead of opening a new one.
19
-
20
- Do not open a PR without a clean `asrt verify`, and do not open one whose body omits the session marker.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes