0.2.2: --revert hardening (#8) + command consolidation#10
Merged
Conversation
) Bucket each lastgood record by SHAPE, not just "line non-empty", so a corrupt-but-non-empty snapshot is refused instead of silently treated as "every file deleted" and reported as a benign no-op. - A well-formed record is exactly `<abspath>\t<non-empty-model>`. Records that are non-absolute, empty-model, or carry a stray 3rd column (format drift) now count as `malformed` and force exit 1 — no partial revert. - Empty model column no longer writes a blank `model: ` line into an agent. - `read ... || [ -n "$f$m$extra" ]` keeps a final record that lacks a trailing newline, closing a silent-partial-revert (last line dropped) on hand-edited or foreign snapshots. - Success line discloses partial reverts: "reverted N of M ... (K skipped)". Preserves bash 3.2 constraints (integer counters / ${#arr[@]} over ${arr[*]+x}; guarded empty-array expansions under set -u). Gate: npm test 80/0 (was 75; +5 hardening drift-locks) · shellcheck clean.
One command retunes any agent group via a type flag instead of three near-identical wrappers. BREAKING: /cc-agents:crawler-model and /cc-agents:implementer-model are removed — use /cc-agents:model --crawler | --implementer. - set-model.sh: add --scout, --brainstorm, --all groups. Every agent with a model: line is now tunable (glm-scout, glm-brainstorm were not); --all rewrites all six transactionally (verified live: --all then --revert round-trips all files, crawler back to glm-5-turbo). - commands/model.md: forwards $ARGUMENTS verbatim, documents every group flag; crawler-model.md + implementer-model.md deleted. - Tests: +scout/brainstorm/all coverage; command drift-locks rewritten for the single-command surface; the CHANGELOG version drift-lock now tracks the newest heading instead of a hardcoded string (stops going stale each release). - README command section collapsed to one flag table; notes get-model is pending cc-proxy /v1/models. Version 0.2.1 -> 0.2.2. Gate: npm test 86/0 · release-gate v0.2.2 OK · shellcheck clean.
PR review of the 0.2.2 branch surfaced two verified HIGH silent-failures in the arg/revert paths the diff already touches. Fixed with tests. - --revert now charset-validates the recorded model value with the same guard as the forward path. A lastgood record with a literal `\n` in the model column (`<abspath>\tglm-x\ntools: Bash`) was fed to fm_rewrite's `awk -v`, which interprets the escape and injected `tools: Bash` into a least-privilege agent (exit 0, silent). A bad value now buckets as malformed → whole snapshot refused (exit 1). Live-verified: injection blocked, no tools: line written. - Stray positional args rejected (exit 2) instead of silently mis-targeting: `set-model.sh scout glm-4.6` (missing --) used to be swallowed as the id and retune the REVIEWERS, not scout; a second positional last-won silently. Both now error, and a bareword group name suggests the --form. - ALL derived from the group arrays (was a hand-maintained literal that a new group could silently escape); locked by a structure test. - Tests: +injection (backslash-n + quote), +positional (typo/double/unknown- flag), +--all/--revert round-trip over DISTINCT per-file models (the only case a cross-file revert mixup surfaces). CHANGELOG: removals under Removed. Charset pattern is `*[!]A-Za-z0-9._:/[-]*` (leading `]` = literal, matching the forward path) so the bracketed default id glm-5.2[1m] stays valid. Gate: npm test 93/0 (was 86) · release-gate v0.2.2 OK · shellcheck clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a major update to the model-tuning commands for the cc-agents plugin, consolidating the command surface and improving robustness, especially for reverting model changes. The previous per-agent commands have been unified into a single flexible command, new agent groups are now tunable, and the revert logic is hardened against malformed records. Documentation and tests are updated to reflect these changes.
Command consolidation and new features:
/cc-agents:model,/cc-agents:crawler-model,/cc-agents:implementer-model) with a single switchable/cc-agents:modelcommand. Users can now select the target group with flags (--crawler,--implementer,--scout,--brainstorm,--all), making the interface simpler and more flexible. [1] [2] [3] [4] [5] [6] [7] [8] [9]glm-scoutandglm-brainstormagents, as well as an--allflag to retune every agent at once, ensuring all agents with amodel:line can be updated in a single operation. [1] [2] [3] [4] [5] [6]Robustness and revert improvements:
set-model.sh --revertagainst malformed or partial last-known-good records: now refuses to revert if records are corrupt, skips and warns for files deleted since the snapshot, and reports partial reverts clearly. Prevents silent errors and data loss. [1] [2] [3]Closes #8
Gate: npm test 86/0 · release-gate v0.2.2 OK · shellcheck clean.
Documentation updates:
README.mdand command markdown files to document the new unified command, group flags, and improved revert behavior. Removed obsolete per-agent command docs. [1] [2] [3] [4]Testing:
Version bump:
0.2.2inpackage.jsonand.claude-plugin/plugin.json. [1] [2] [3]These changes make the model-tuning workflow more intuitive, safer, and easier to maintain.