Repository navigation
feat(#537): /acp-rule remove <id> and clear operations - #538
Conversation
📦 Built Extension ArtifactBranch: Option A — Install from npm PR tag (recommended)pi install npm:billion-context-pi@pr-538Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pi-pr538.tgz
pi install ./packageThis comment is automatically updated on each push. |
[bot] 🏷 Review of PR #538 — verdict: mergeable ✅ Reviewed branch ① Original issue (#537) — direction check#537 is a well-scoped port request with explicit acceptance criteria and red lines (no wire bytes change, no pin bump, gate unchanged, TUI-only echo, description update). The PR implements exactly that scope: model-side ② Regression review — existing behaviors audited on
|
Summary
Ports the rule delete/clear wiring from bili ranxianglei/billion-context#1178 (issue #1177) onto this repo's human surface: the
/acp-rulecommand. The model-sideacp_ruletool (#490) stays out of scope per the issue.Kernel
removeRule/clearRuleshave been exported since acp-kernel 0.0.84; this repo pins 0.0.86 — no pin bump.Behavior
New argument parsing in
src/commands.ts(parseRuleCommand):/acp-rule/acp-rule <text>/acp-rule remove <id>removeRule(state, id)→ save → echoRemoved ruleN: <text>/acp-rule clearclearRules(state)→ save → echoCleared N rule(s)./No rules to clear.when emptyDiscrimination (per issue constraint — plain text that merely starts with these words must stay recordable):
clearonly fires on the exact single-token argclearremoveonly fires on exactly two tokens where the second matches^rule\d+$removing old logs nightly,record a rule about removing things, etc. all still recordremove rule1 clear), repeated clears, or repeated removes are rejected with an explicit error before any mutation, no state touchedUnchanged by design:
runtime.adapter.rules !== truegate fires first, as beforeACP_RULE_CUSTOM_TYPEpath (src/messages.ts:40excludes it from context) — TUI-only, zero wire bytes changeno rule with id "rule99" — list current rules first…) surface verbatim, same as the record pathCommand
descriptionstring updated to cover all four ops.Tests
5 new tests in
tests/rule-command.test.tscovering every acceptance item:No rules to clear.Plus extended the existing off-gate test: remove/clear now also hit the enablement warning.
Verification
npm run typecheck✅tests/rule-command.test.ts11/11 passnpm run build✅; new strings verified present indist/index.jsEnv note (sandbox artifact, not a code issue)
This agent sandbox mounts
/tmpread-only, so the committed test files' hardcoded/tmp/pai-acp-rule-*sidecar paths raise EACCES here. Baseline run of pristine master in the same environment fails 94/935 tests for exactly this reason; my branch fails those same 94 plus the 5 new ones — zero new regressions. With the sidecar paths pointed at a writable dir, all 11 rule-command tests pass. CI (writable /tmp) will run them normally.Behavior change disclosure
/acp-rulegains two new invocation syntaxes (remove <id>,clear). Existinglist(no args) andrecord(text) behavior is byte-identical — the discriminator only intercepts the exact token patterns above. No config, persistence-format, or wire changes.Closes #537