mirror of
https://github.com/affaan-m/ECC.git
synced 2026-08-20 22:42:22 +02:00
The `.opencode/commands/*.md` frontmatter referenced agents with the Claude Code plugin namespace (`agent: everything-claude-code:<name>`), but ECC's opencode integration registers its agents unscoped in `opencode.json`'s `agent` map (`code-reviewer`, `planner`, ...), and that file's own `command` section already references them unscoped. The `everything-claude-code:` scope resolves under no opencode config (the opencode plugin package is `ecc-universal`, and inline-config agents are bare), so subtask commands like `/code-review` hard-fail with `Agent not found: everything-claude-code:code-reviewer`. Non-subtask commands fall back to the default agent and appear to work — which is why only some commands failed. Strip the `everything-claude-code:` prefix from all 30 command frontmatter agent ids so they match the registered agents, fix the MIGRATION.md example, and replace the test that enforced the broken scoped invariant with one that asserts each command agent id is a registered opencode agent (fails on the old scoped ids, passes on the fix). Fixes #2477
2.1 KiB
2.1 KiB
description, agent, subtask
| description | agent | subtask |
|---|---|---|
| Remove dead code and consolidate duplicates | refactor-cleaner | true |
Refactor Clean Command
Analyze and clean up the codebase: $ARGUMENTS
Your Task
- Detect dead code using analysis tools
- Identify duplicates and consolidation opportunities
- Safely remove unused code with documentation
- Verify no functionality broken
Detection Phase
Run Analysis Tools
# Find unused exports
npx knip
# Find unused dependencies
npx depcheck
# Find unused TypeScript exports
npx ts-prune
Manual Checks
- Unused functions (no callers)
- Unused variables
- Unused imports
- Commented-out code
- Unreachable code
- Unused CSS classes
Removal Phase
Before Removing
- Search for usage - grep, find references
- Check exports - might be used externally
- Verify tests - no test depends on it
- Document removal - git commit message
Safe Removal Order
- Remove unused imports first
- Remove unused private functions
- Remove unused exported functions
- Remove unused types/interfaces
- Remove unused files
Consolidation Phase
Identify Duplicates
- Similar functions with minor differences
- Copy-pasted code blocks
- Repeated patterns
Consolidation Strategies
- Extract utility function - for repeated logic
- Create base class - for similar classes
- Use higher-order functions - for repeated patterns
- Create shared constants - for magic values
Verification
After cleanup:
npm run build- builds successfullynpm test- all tests passnpm run lint- no new lint errors- Manual smoke test - features work
Report Format
Dead Code Analysis
==================
Removed:
- file.ts: functionName (unused export)
- utils.ts: helperFunction (no callers)
Consolidated:
- formatDate() and formatDateTime() → dateUtils.format()
Remaining (manual review needed):
- oldComponent.tsx: potentially unused, verify with team
CAUTION: Always verify before removing. When in doubt, ask or add // TODO: verify usage comment.