Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
All notable changes to this project are documented here, following
[Keep a Changelog](https://keepachangelog.com/) and semantic versioning.

## [0.1.9] - 2026-09-12

### Fixed

- Reject unknown CLI flags (for example `--wriet`) with exit code 2 instead of
silently ignoring them and running report-only.

## [0.1.8] - 2026-09-12

### Added
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ctxtrim",
"version": "0.1.8",
"version": "0.1.9",
"description": "Trim what bloats your AI coding context. Scan a repo, find the high-cost/low-value files ballooning your Claude Code / Cursor / Codex context, and write ignore files to cut token cost. Zero dependencies.",
"type": "module",
"bin": {
Expand Down
1 change: 1 addition & 0 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function parse(argv) {
else if (has("--top")) o.top = Number(val());
else if (has("--format")) o.format = val();
else if (has("--fail-on-waste")) o.failOnWaste = Number(val());
else if (a.startsWith("-")) return { ...o, error: `ctxtrim: unknown option: ${a}\n` };
else if (!a.startsWith("-")) {
if (o.path !== null) return { ...o, error: "ctxtrim: only one path may be supplied\n" };
o.path = a;
Expand Down
6 changes: 6 additions & 0 deletions test/ctxtrim.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ test("CLI fails only when waste reaches the threshold", () => {
assert.equal(pass.status, 0, `clean repo should pass a 50%% threshold\n${pass.stderr}`);
});

test("CLI rejects unknown flags", () => {
const result = spawnSync(process.execPath, [cli, repo, "--wriet"], { encoding: "utf8" });
assert.equal(result.status, 2, `--wriet should fail with exit 2\n${result.stderr}`);
assert.match(result.stderr, /ctxtrim: unknown (option|flag).*--wriet/i);
});

test("CLI rejects non-finite and negative numeric options", () => {
const invalid = [
["--max-tokens", "abc"],
Expand Down
Loading