Skip to content

Split comline clean into clean (code) + reset (history) - #15

Merged
Kinflou merged 1 commit into
mainfrom
fix/clean-reset-split
Aug 30, 2026
Merged

Kinflou merged 1 commit into
mainfrom
fix/clean-reset-split

Conversation

@Kinflou

@Kinflou Kinflou commented Aug 30, 2026

Copy link
Copy Markdown
Member

Problem

comline clean ran remove_dir_all(".comline/") — the entire content-addressable
store, i.e. every frozen version and the commit chain — with no confirmation,
in the same command that removes regenerable generated code. There is no publish
yet, so .comline/ is the only copy of the history; a build afterwards silently
restarts at 0.0.1.

clean in every comparable tool (cargo clean, make clean) means "remove
regenerable output." This one also destroyed the irreplaceable part.

Change

command does
comline clean [--dry-run] removes only generated code — the generate output root or files. Never touches .comline/.
comline reset [--force] [--dry-run] (new) deletes .comline/ and generated code. On a TTY: prints how many versions will be lost, requires typing reset. Without a TTY: refuses with exit 2 unless --force. --dry-run lists (incl. the history that would be lost) and never prompts.
  • CliError::ConfirmationRequired → exit 2 (precondition), consistent with the existing contract.
  • clean::generated_files is now pub(crate), shared by both.
  • tests/cli/clean.rs rewritten for the code-only semantics; new tests/cli/reset.rs (force removes store + generated; no-TTY-no-force refuses and leaves .comline/; dry-run keeps everything).
  • docs/cli.md + README.md updated; the versioning-model section now says the history has no other copy and only reset discards it.

cargo fmt --check, cargo clippy --all-targets -- -D warnings, and all 36 integration tests pass locally.

Note

comline clean is kept (not removed) — it's the least-surprising home for
"remove generated files," now matching what other toolchains mean by it.

comline clean deleted .comline/ — the entire version history — with no
confirmation and no way back, in the same gesture that removes regenerable
generated code. Nothing else holds the history (no publish yet), so a build
afterwards silently restarted at 0.0.1.

- comline clean now removes only generated code; .comline/ is never touched.
- comline reset (new) deletes .comline/ + generated code. On a TTY it prints
  how many versions will be lost and requires typing `reset`; without a TTY it
  refuses (exit 2) unless --force. --dry-run on either lists without deleting.
- CliError::ConfirmationRequired -> exit 2.
- clean.rs::generated_files is now pub(crate), shared with reset.
- tests: clean.rs rewritten (code-only semantics); new reset.rs.
- docs/cli.md + README updated; versioning-model section now states the
  history has no other copy and only reset discards it.

All: cargo fmt --check, clippy -D warnings, 36 integration tests green.
@Kinflou
Kinflou merged commit e36d1f0 into main Aug 30, 2026
2 checks passed
Kinflou pushed a commit to ComlineProject/docs that referenced this pull request Aug 30, 2026
ComlineProject/cli#15 merged. Updated reference/cli (clean row + new reset row +
exit-2 note), reference/versioning (history model), guide/packages,
guide/codegen/generating-code, and design/ir-generation (the section is now a
record of what landed, retitled 'The clean / reset split').
@Kinflou
Kinflou deleted the fix/clean-reset-split branch September 2, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant