Commit fd8c813
authored
feat(init): auto-update .gitignore + tighter tagline (#31)
* docs(readme): tighten tagline to name the actual problem
"Your side project died at 80%. Bring it back in one prompt." was
cryptic — readers had to guess what 80% referred to (project
abandonment? completion?), and nothing in the line connected to
the actual problem the tool solves (agent context rot in long
sessions).
Replace with the literal failure mode users hit in practice:
"Your agent forgot the ADR you wrote 30 prompts ago." Names the
pain directly, no metaphor decoding required. The next paragraph
already explains the mechanism, so the tagline can stay terse.
* feat(init): auto-update .gitignore so static.md is trackable
A common onboarding stumble: user follows the README, runs
`revive init`, then `git add .revive/static.md` — git silently
skips the file because their .gitignore has `.revive/*` (or
similar) and no exception. The "checked in" workflow the README
documents quietly fails.
`cmd_init` now calls `maybe_update_gitignore` after writing
static.md. Logic:
- Skip silently if not in a git repo, no .gitignore exists, or
`git check-ignore` says the file is already trackable.
- Otherwise append a small canonical block:
.revive/*
!.revive/static.md
with a header comment explaining what gets tracked vs not.
- Re-run `git check-ignore`. If a directory-level `.revive/`
rule still suppresses the un-ignore (git semantics: `!`
cannot rescue a file inside a fully-ignored directory), print
a warning telling the user how to fix it.
4 new tests cover: no .gitignore (no-op), `.revive/*` (append +
verify trackable), already-correct (idempotent — line count
unchanged), `.revive/` directory rule (warning emitted, exit 0
preserved).
* fix(init/gitignore): handle broad dot-dir + read-only cases (codex)
Two issues codex flagged on the original gitignore-auto patch:
[P2] Broad dot-dir rules left static.md untrackable
- A repo with `.revive/`, `.revive`, or even `.*` / `.*/` already
ignores the parent directory. Git semantics: `!` cannot rescue
a file inside a fully-ignored directory.
- The canonical block now leads with `!.revive/` to un-ignore the
parent first, then re-ignores contents with `.revive/*`, then
re-includes static.md with `!.revive/static.md`.
- The "warns when a directory-level .revive/ rule blocks" test
flipped to "un-ignores even with a directory-level rule" — the
former failure mode no longer happens. Added a parallel test
for `.*` to cover the broad-rule case.
[P3] Read-only .gitignore aborted `revive init`
- Under `set -e`, `cat >> .gitignore` on a read-only file killed
cmd_init even though the gitignore update is best-effort.
- Pre-check writability with `[[ -w .gitignore ]]`. If not
writable, print the exact lines the user needs to add and
return 0 — static.md is already created at this point.
- New test exercises the read-only path: chmod -w .gitignore,
trap restores write perm so teardown doesn't break.1 parent 23535be commit fd8c813
3 files changed
Lines changed: 118 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
697 | 697 | | |
698 | 698 | | |
699 | 699 | | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
700 | 751 | | |
701 | 752 | | |
702 | 753 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1430 | 1430 | | |
1431 | 1431 | | |
1432 | 1432 | | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
0 commit comments