@codemieai/code 0.0.32 → 0.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -7
- package/bin/codemie-opencode.js +11 -0
- package/dist/agents/codemie-code/agent.d.ts +17 -1
- package/dist/agents/codemie-code/agent.d.ts.map +1 -1
- package/dist/agents/codemie-code/agent.js +62 -3
- package/dist/agents/codemie-code/agent.js.map +1 -1
- package/dist/agents/codemie-code/index.d.ts +1 -0
- package/dist/agents/codemie-code/index.d.ts.map +1 -1
- package/dist/agents/codemie-code/index.js +28 -2
- package/dist/agents/codemie-code/index.js.map +1 -1
- package/dist/agents/codemie-code/prompts.d.ts +12 -3
- package/dist/agents/codemie-code/prompts.d.ts.map +1 -1
- package/dist/agents/codemie-code/prompts.js +25 -5
- package/dist/agents/codemie-code/prompts.js.map +1 -1
- package/dist/agents/codemie-code/types.d.ts +3 -0
- package/dist/agents/codemie-code/types.d.ts.map +1 -1
- package/dist/agents/codemie-code/types.js.map +1 -1
- package/dist/agents/codemie-code/ui/todoPanel.d.ts.map +1 -1
- package/dist/agents/codemie-code/ui/todoPanel.js +4 -0
- package/dist/agents/codemie-code/ui/todoPanel.js.map +1 -1
- package/dist/agents/core/AgentCLI.d.ts.map +1 -1
- package/dist/agents/core/AgentCLI.js +3 -1
- package/dist/agents/core/AgentCLI.js.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.js +46 -2
- package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
- package/dist/agents/core/session/BaseSessionAdapter.d.ts +25 -0
- package/dist/agents/core/session/BaseSessionAdapter.d.ts.map +1 -1
- package/dist/agents/core/session/SessionStore.d.ts +15 -0
- package/dist/agents/core/session/SessionStore.d.ts.map +1 -1
- package/dist/agents/core/session/SessionStore.js +46 -0
- package/dist/agents/core/session/SessionStore.js.map +1 -1
- package/dist/agents/core/session/discovery-types.d.ts +53 -0
- package/dist/agents/core/session/discovery-types.d.ts.map +1 -0
- package/dist/agents/core/session/discovery-types.js +8 -0
- package/dist/agents/core/session/discovery-types.js.map +1 -0
- package/dist/agents/core/session/types.d.ts +2 -0
- package/dist/agents/core/session/types.d.ts.map +1 -1
- package/dist/agents/core/types.d.ts +45 -0
- package/dist/agents/core/types.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.d.ts +44 -1
- package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.js +214 -0
- package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
- package/dist/agents/plugins/claude/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/agents/plugins/claude/plugin/README.md +40 -2
- package/dist/agents/plugins/claude/plugin/claude-templates/README.md +5 -5
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/CLAUDE.md.template +177 -436
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/code-review-agent-template.md.template +49 -82
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/refactor-cleaner-agent.md.template +337 -0
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/solution-architect-agent.md.template +129 -419
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/unit-tester-agent.md.template +146 -693
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/api/api-patterns.md.template +110 -138
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/architecture.md.template +197 -0
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/data/database-patterns.md.template +171 -91
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/development/development-practices.md.template +219 -131
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/security/security-practices.md.template +223 -98
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/standards/code-quality.md.template +131 -95
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/testing/testing-patterns.md.template +247 -75
- package/dist/agents/plugins/claude/plugin/commands/README.md +133 -0
- package/dist/agents/plugins/claude/plugin/commands/codemie-init.md +336 -544
- package/dist/agents/plugins/claude/plugin/commands/codemie-subagents.md +232 -503
- package/dist/agents/plugins/claude/plugin/commands/memory-add.md +311 -30
- package/dist/agents/plugins/claude/plugin/commands/memory-refresh.md +218 -39
- package/dist/agents/plugins/claude/plugin/hooks/hooks.json +11 -0
- package/dist/agents/plugins/gemini/extension/gemini-extension.json +1 -1
- package/dist/agents/plugins/gemini/extension/hooks/hooks.json +12 -0
- package/dist/agents/plugins/gemini/gemini.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/gemini/gemini.plugin.js +2 -4
- package/dist/agents/plugins/gemini/gemini.plugin.js.map +1 -1
- package/dist/agents/plugins/opencode/index.d.ts +8 -0
- package/dist/agents/plugins/opencode/index.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/index.js +12 -0
- package/dist/agents/plugins/opencode/index.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode-message-types.d.ts +207 -0
- package/dist/agents/plugins/opencode/opencode-message-types.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode-message-types.js +59 -0
- package/dist/agents/plugins/opencode/opencode-message-types.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode-model-configs.d.ts +65 -0
- package/dist/agents/plugins/opencode/opencode-model-configs.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode-model-configs.js +184 -0
- package/dist/agents/plugins/opencode/opencode-model-configs.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode.paths.d.ts +62 -0
- package/dist/agents/plugins/opencode/opencode.paths.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode.paths.js +148 -0
- package/dist/agents/plugins/opencode/opencode.paths.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode.plugin.d.ts +35 -0
- package/dist/agents/plugins/opencode/opencode.plugin.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode.plugin.js +338 -0
- package/dist/agents/plugins/opencode/opencode.plugin.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode.session.d.ts +77 -0
- package/dist/agents/plugins/opencode/opencode.session.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode.session.js +424 -0
- package/dist/agents/plugins/opencode/opencode.session.js.map +1 -0
- package/dist/agents/plugins/opencode/opencode.storage-utils.d.ts +25 -0
- package/dist/agents/plugins/opencode/opencode.storage-utils.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/opencode.storage-utils.js +96 -0
- package/dist/agents/plugins/opencode/opencode.storage-utils.js.map +1 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.d.ts +30 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.js +116 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.js.map +1 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.d.ts +102 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.d.ts.map +1 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.js +584 -0
- package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.js.map +1 -0
- package/dist/agents/registry.d.ts.map +1 -1
- package/dist/agents/registry.js +2 -0
- package/dist/agents/registry.js.map +1 -1
- package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts +5 -0
- package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts.map +1 -1
- package/dist/cli/commands/doctor/checks/AgentsCheck.js +29 -0
- package/dist/cli/commands/doctor/checks/AgentsCheck.js.map +1 -1
- package/dist/cli/commands/hook.d.ts.map +1 -1
- package/dist/cli/commands/hook.js +63 -6
- package/dist/cli/commands/hook.js.map +1 -1
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +86 -7
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/opencode-metrics.d.ts +13 -0
- package/dist/cli/commands/opencode-metrics.d.ts.map +1 -0
- package/dist/cli/commands/opencode-metrics.js +200 -0
- package/dist/cli/commands/opencode-metrics.js.map +1 -0
- package/dist/cli/commands/setup.d.ts.map +1 -1
- package/dist/cli/commands/setup.js +113 -0
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/skill.d.ts +6 -0
- package/dist/cli/commands/skill.d.ts.map +1 -0
- package/dist/cli/commands/skill.js +196 -0
- package/dist/cli/commands/skill.js.map +1 -0
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +34 -6
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/migrations/003-remove-hooks-node.migration.d.ts +22 -0
- package/dist/migrations/003-remove-hooks-node.migration.d.ts.map +1 -0
- package/dist/migrations/003-remove-hooks-node.migration.js +103 -0
- package/dist/migrations/003-remove-hooks-node.migration.js.map +1 -0
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +1 -1
- package/dist/migrations/index.js.map +1 -1
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-api-client.d.ts +3 -2
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-api-client.d.ts.map +1 -1
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-api-client.js +6 -2
- package/dist/providers/plugins/sso/session/processors/metrics/metrics-api-client.js.map +1 -1
- package/dist/providers/plugins/sso/sso.http-client.js +2 -2
- package/dist/providers/plugins/sso/sso.http-client.js.map +1 -1
- package/dist/providers/plugins/sso/sso.setup-steps.d.ts.map +1 -1
- package/dist/providers/plugins/sso/sso.setup-steps.js +14 -10
- package/dist/providers/plugins/sso/sso.setup-steps.js.map +1 -1
- package/dist/skills/core/SkillDiscovery.d.ts +83 -0
- package/dist/skills/core/SkillDiscovery.d.ts.map +1 -0
- package/dist/skills/core/SkillDiscovery.js +237 -0
- package/dist/skills/core/SkillDiscovery.js.map +1 -0
- package/dist/skills/core/SkillManager.d.ts +86 -0
- package/dist/skills/core/SkillManager.d.ts.map +1 -0
- package/dist/skills/core/SkillManager.js +155 -0
- package/dist/skills/core/SkillManager.js.map +1 -0
- package/dist/skills/core/types.d.ts +120 -0
- package/dist/skills/core/types.d.ts.map +1 -0
- package/dist/skills/core/types.js +20 -0
- package/dist/skills/core/types.js.map +1 -0
- package/dist/skills/index.d.ts +12 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +12 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/utils/content-loader.d.ts +25 -0
- package/dist/skills/utils/content-loader.d.ts.map +1 -0
- package/dist/skills/utils/content-loader.js +161 -0
- package/dist/skills/utils/content-loader.js.map +1 -0
- package/dist/skills/utils/frontmatter.d.ts +60 -0
- package/dist/skills/utils/frontmatter.d.ts.map +1 -0
- package/dist/skills/utils/frontmatter.js +114 -0
- package/dist/skills/utils/frontmatter.js.map +1 -0
- package/dist/skills/utils/pattern-matcher.d.ts +60 -0
- package/dist/skills/utils/pattern-matcher.d.ts.map +1 -0
- package/dist/skills/utils/pattern-matcher.js +97 -0
- package/dist/skills/utils/pattern-matcher.js.map +1 -0
- package/dist/utils/exec.d.ts.map +1 -1
- package/dist/utils/exec.js +11 -1
- package/dist/utils/exec.js.map +1 -1
- package/dist/utils/installation-detector.d.ts +22 -0
- package/dist/utils/installation-detector.d.ts.map +1 -0
- package/dist/utils/installation-detector.js +49 -0
- package/dist/utils/installation-detector.js.map +1 -0
- package/dist/utils/native-installer.d.ts +49 -0
- package/dist/utils/native-installer.d.ts.map +1 -0
- package/dist/utils/native-installer.js +194 -0
- package/dist/utils/native-installer.js.map +1 -0
- package/dist/utils/version-utils.d.ts +50 -0
- package/dist/utils/version-utils.d.ts.map +1 -0
- package/dist/utils/version-utils.js +92 -0
- package/dist/utils/version-utils.js.map +1 -0
- package/package.json +5 -2
- package/scripts/copy-mr-skill-to-global.ts +252 -0
- package/scripts/demo-hooks.sh +125 -0
- package/scripts/test-hooks.sh +196 -0
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/INDEX.md +0 -205
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/TEMPLATE_SIZES.md +0 -74
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/layered-architecture.md.template +0 -143
- package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/project-structure.md.template +0 -127
|
@@ -370,97 +370,64 @@ Adapt your review to align with these established project patterns.
|
|
|
370
370
|
|
|
371
371
|
---
|
|
372
372
|
|
|
373
|
-
## Quick Reference Checklist
|
|
374
|
-
|
|
375
|
-
**[
|
|
376
|
-
|
|
377
|
-
###
|
|
378
|
-
- [ ]
|
|
379
|
-
- [ ]
|
|
380
|
-
- [ ]
|
|
381
|
-
- [ ]
|
|
382
|
-
|
|
383
|
-
###
|
|
384
|
-
- [ ]
|
|
385
|
-
- [ ]
|
|
386
|
-
- [ ]
|
|
387
|
-
- [ ]
|
|
388
|
-
|
|
389
|
-
###
|
|
390
|
-
- [ ]
|
|
391
|
-
- [ ]
|
|
392
|
-
- [ ]
|
|
393
|
-
- [ ]
|
|
394
|
-
|
|
395
|
-
### [
|
|
396
|
-
- [ ] [
|
|
397
|
-
- [ ] [
|
|
398
|
-
- [ ] [
|
|
399
|
-
- [ ] [
|
|
400
|
-
|
|
401
|
-
### [CATEGORY_5: e.g., Async & Performance]
|
|
402
|
-
- [ ] [CHECK_1]
|
|
403
|
-
- [ ] [CHECK_2]
|
|
404
|
-
- [ ] [CHECK_3]
|
|
405
|
-
- [ ] [CHECK_4]
|
|
406
|
-
|
|
407
|
-
### [CATEGORY_6: e.g., Security & Best Practices]
|
|
408
|
-
- [ ] [CHECK_1]
|
|
409
|
-
- [ ] [CHECK_2]
|
|
410
|
-
- [ ] [CHECK_3]
|
|
411
|
-
- [ ] [CHECK_4]
|
|
373
|
+
## Quick Reference Checklist
|
|
374
|
+
|
|
375
|
+
**[GENERATION INSTRUCTION]**: Create checklist items matching the pattern categories above.
|
|
376
|
+
|
|
377
|
+
### Security
|
|
378
|
+
- [ ] No hardcoded secrets/credentials
|
|
379
|
+
- [ ] Input validation on all external data
|
|
380
|
+
- [ ] Parameterized queries (no string concatenation)
|
|
381
|
+
- [ ] Proper authentication/authorization checks
|
|
382
|
+
|
|
383
|
+
### Performance
|
|
384
|
+
- [ ] No N+1 query patterns
|
|
385
|
+
- [ ] Pagination for large datasets
|
|
386
|
+
- [ ] No blocking calls in async context
|
|
387
|
+
- [ ] Appropriate data structures
|
|
388
|
+
|
|
389
|
+
### Code Quality
|
|
390
|
+
- [ ] Functions under complexity threshold
|
|
391
|
+
- [ ] No significant duplication
|
|
392
|
+
- [ ] Proper error handling
|
|
393
|
+
- [ ] Type safety maintained
|
|
394
|
+
|
|
395
|
+
### [PROJECT_NAME] Patterns
|
|
396
|
+
- [ ] [PROJECT_SPECIFIC_CHECK_1]
|
|
397
|
+
- [ ] [PROJECT_SPECIFIC_CHECK_2]
|
|
398
|
+
- [ ] [PROJECT_SPECIFIC_CHECK_3]
|
|
399
|
+
- [ ] [PROJECT_SPECIFIC_CHECK_4]
|
|
412
400
|
|
|
413
401
|
---
|
|
414
402
|
|
|
415
|
-
##
|
|
403
|
+
## Edge Cases
|
|
416
404
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
405
|
+
**Large diffs (>30 files)**: Ask user to prioritize or focus on high-risk files first.
|
|
406
|
+
**No changes detected**: Prompt user to specify commit SHA, branch comparison, or stage changes.
|
|
407
|
+
**Binary/generated files**: Skip and note: "Skipped N binary/generated files (*.min.js, dist/*, etc.)"
|
|
408
|
+
**Uncertain about conventions**: Ask for clarification rather than assuming.
|
|
421
409
|
|
|
422
|
-
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## Review Principles
|
|
423
413
|
|
|
424
|
-
|
|
425
|
-
-
|
|
426
|
-
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
414
|
+
1. **Be Constructive** - Frame as learning opportunities
|
|
415
|
+
2. **Be Specific** - Always include file paths and line numbers
|
|
416
|
+
3. **Prioritize** - Critical/major first; don't overwhelm with minor issues
|
|
417
|
+
4. **Explain Why** - Help developers understand the reasoning
|
|
418
|
+
5. **Provide Solutions** - Every issue needs an actionable fix example
|
|
419
|
+
6. **Acknowledge Good Work** - Note well-written code and good practices
|
|
430
420
|
|
|
431
421
|
---
|
|
432
422
|
|
|
433
|
-
## Generation Instructions
|
|
423
|
+
## Generation Instructions
|
|
434
424
|
|
|
435
425
|
**For LLM generating project-specific agent from this template:**
|
|
436
426
|
|
|
437
|
-
1. **
|
|
438
|
-
2. **
|
|
439
|
-
3. **
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
4. **Extract project metadata**:
|
|
445
|
-
- Primary language(s) and versions
|
|
446
|
-
- Frameworks and their versions
|
|
447
|
-
- Architectural style
|
|
448
|
-
- Testing approach
|
|
449
|
-
- Exception/error handling patterns
|
|
450
|
-
- Logging approach
|
|
451
|
-
5. **Populate placeholders**:
|
|
452
|
-
- Replace [ALL_CAPS_PLACEHOLDERS] with project-specific values
|
|
453
|
-
- Generate concrete code examples in project's style
|
|
454
|
-
- Customize thresholds based on project standards
|
|
455
|
-
6. **Validate completeness**:
|
|
456
|
-
- All pattern categories have examples
|
|
457
|
-
- Quick reference checklist matches pattern categories
|
|
458
|
-
- Examples use project's actual language/framework syntax
|
|
459
|
-
- Security and performance patterns are project-relevant
|
|
460
|
-
|
|
461
|
-
**Key Sections to Customize**:
|
|
462
|
-
- Project-Specific Context Awareness
|
|
463
|
-
- Special Detection Rules
|
|
464
|
-
- [PROJECT_NAME]-Specific Best Practices (MOST IMPORTANT)
|
|
465
|
-
- Quick Reference Checklist
|
|
466
|
-
- Example Code Review Format (use project's language)
|
|
427
|
+
1. **Discover project metadata**: Read package.json/pyproject.toml/go.mod etc.
|
|
428
|
+
2. **Read documentation**: README, CONTRIBUTING, ARCHITECTURE files
|
|
429
|
+
3. **Extract linting rules**: Parse .eslintrc, pylintrc, ruff.toml etc.
|
|
430
|
+
4. **Sample codebase**: Identify 5-8 critical pattern categories with examples
|
|
431
|
+
5. **Populate placeholders**: Replace all [PLACEHOLDERS] with project values
|
|
432
|
+
6. **Generate examples**: Use project's actual language and framework syntax
|
|
433
|
+
7. **Validate**: Ensure all pattern categories have working code examples
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: refactor-cleaner
|
|
3
|
+
description: |-
|
|
4
|
+
Use this agent for dead code cleanup, duplicate elimination, and dependency pruning.
|
|
5
|
+
Triggers: "clean up code", "remove dead code", "find unused", "remove duplicates", "prune dependencies", "refactor cleanup".
|
|
6
|
+
Runs analysis tools to identify unused code and safely removes it with full documentation.
|
|
7
|
+
tools: Read, Write, Edit, Bash, Grep, Glob
|
|
8
|
+
model: inherit
|
|
9
|
+
color: orange
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Refactor & Dead Code Cleaner Template
|
|
13
|
+
|
|
14
|
+
**Purpose**: This template guides generation of project-specific refactoring agents that safely identify and remove dead code, duplicates, and unused dependencies.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Core Mission
|
|
19
|
+
|
|
20
|
+
Keep the codebase lean and maintainable by:
|
|
21
|
+
- Detecting and removing unused code, exports, and files
|
|
22
|
+
- Eliminating duplicate code through consolidation
|
|
23
|
+
- Pruning unused dependencies
|
|
24
|
+
- Documenting all changes for traceability
|
|
25
|
+
- **Never breaking functionality**
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Context Discovery
|
|
30
|
+
|
|
31
|
+
**[GENERATION INSTRUCTION]**: Analyze project to identify:
|
|
32
|
+
- `.codemie/guides/` folder (if exists) for cleanup guidelines
|
|
33
|
+
- Available analysis tools (from package.json, Makefile, or installed globally)
|
|
34
|
+
- Critical code paths that must never be removed
|
|
35
|
+
- Project structure and module organization
|
|
36
|
+
- Test commands and build verification
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Analysis Tools
|
|
41
|
+
|
|
42
|
+
**[GENERATION INSTRUCTION]**: Identify which tools are available in the project. Common options by ecosystem:
|
|
43
|
+
|
|
44
|
+
| Ecosystem | Dead Code | Unused Deps | Unused Exports |
|
|
45
|
+
|-----------|-----------|-------------|----------------|
|
|
46
|
+
| JavaScript/TypeScript | knip, ts-prune | depcheck, knip | ts-prune, knip |
|
|
47
|
+
| Python | vulture, dead | pip-autoremove | pylint |
|
|
48
|
+
| Java | UCDetector, SpotBugs | mvn dependency:analyze | — |
|
|
49
|
+
| Go | deadcode, unused | go mod tidy | — |
|
|
50
|
+
|
|
51
|
+
**[TEMPLATE]**:
|
|
52
|
+
```bash
|
|
53
|
+
# Primary analysis tool
|
|
54
|
+
[PRIMARY_TOOL_COMMAND]
|
|
55
|
+
|
|
56
|
+
# Unused dependencies
|
|
57
|
+
[UNUSED_DEPS_COMMAND]
|
|
58
|
+
|
|
59
|
+
# Unused exports/functions
|
|
60
|
+
[UNUSED_EXPORTS_COMMAND]
|
|
61
|
+
|
|
62
|
+
# Additional checks
|
|
63
|
+
[ADDITIONAL_CHECKS]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Workflow
|
|
69
|
+
|
|
70
|
+
### Phase 1: Analysis
|
|
71
|
+
|
|
72
|
+
1. Run detection tools
|
|
73
|
+
2. Collect and categorize findings:
|
|
74
|
+
- **SAFE**: Unused private exports, unused dependencies, dead files
|
|
75
|
+
- **CAREFUL**: Potentially used via dynamic imports/reflection
|
|
76
|
+
- **RISKY**: Public API, shared utilities, external integrations
|
|
77
|
+
|
|
78
|
+
### Phase 2: Verification
|
|
79
|
+
|
|
80
|
+
For each item flagged for removal:
|
|
81
|
+
- [ ] Grep for all references (including string patterns)
|
|
82
|
+
- [ ] Check for dynamic imports/reflection usage
|
|
83
|
+
- [ ] Verify not part of public API
|
|
84
|
+
- [ ] Review git history for context
|
|
85
|
+
- [ ] Confirm not in critical paths list
|
|
86
|
+
|
|
87
|
+
### Phase 3: Safe Removal
|
|
88
|
+
|
|
89
|
+
Process in order (safest first):
|
|
90
|
+
1. Unused dependencies
|
|
91
|
+
2. Unused internal exports/functions
|
|
92
|
+
3. Unused files
|
|
93
|
+
4. Duplicate code consolidation
|
|
94
|
+
|
|
95
|
+
After each batch:
|
|
96
|
+
- [ ] Build succeeds
|
|
97
|
+
- [ ] Tests pass
|
|
98
|
+
- [ ] Commit changes
|
|
99
|
+
- [ ] Update deletion log
|
|
100
|
+
|
|
101
|
+
### Phase 4: Documentation
|
|
102
|
+
|
|
103
|
+
Update `[DELETION_LOG_PATH]` with all changes.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Critical Paths - NEVER REMOVE
|
|
108
|
+
|
|
109
|
+
**[GENERATION INSTRUCTION]**: Identify from codebase analysis:
|
|
110
|
+
- Authentication/authorization code
|
|
111
|
+
- Payment/transaction processing
|
|
112
|
+
- Core business logic
|
|
113
|
+
- External API integrations
|
|
114
|
+
- Database connections
|
|
115
|
+
- Real-time/websocket handlers
|
|
116
|
+
- Public API exports
|
|
117
|
+
|
|
118
|
+
**[TEMPLATE]**:
|
|
119
|
+
```
|
|
120
|
+
NEVER REMOVE without explicit approval:
|
|
121
|
+
- [CRITICAL_PATH_1]: [DESCRIPTION]
|
|
122
|
+
- [CRITICAL_PATH_2]: [DESCRIPTION]
|
|
123
|
+
- [CRITICAL_PATH_3]: [DESCRIPTION]
|
|
124
|
+
- [CRITICAL_PATH_4]: [DESCRIPTION]
|
|
125
|
+
- [CRITICAL_PATH_5]: [DESCRIPTION]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Safe to Remove
|
|
131
|
+
|
|
132
|
+
**[TEMPLATE]**:
|
|
133
|
+
```
|
|
134
|
+
Generally safe to remove after verification:
|
|
135
|
+
- Unused components in [COMPONENTS_DIR]
|
|
136
|
+
- Deprecated utilities in [UTILS_DIR]
|
|
137
|
+
- Test files for deleted features
|
|
138
|
+
- Commented-out code blocks
|
|
139
|
+
- Unused types/interfaces
|
|
140
|
+
- Old migration files (verify first)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Common Patterns
|
|
146
|
+
|
|
147
|
+
### Unused Imports
|
|
148
|
+
```[language]
|
|
149
|
+
# ❌ Remove unused
|
|
150
|
+
[unused_import_example]
|
|
151
|
+
|
|
152
|
+
# ✅ Keep only used
|
|
153
|
+
[clean_import_example]
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Dead Code
|
|
157
|
+
```[language]
|
|
158
|
+
# ❌ Remove unreachable/unused
|
|
159
|
+
[dead_code_example]
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Duplicates
|
|
163
|
+
```
|
|
164
|
+
# ❌ Multiple similar implementations
|
|
165
|
+
[duplicate_files_example]
|
|
166
|
+
|
|
167
|
+
# ✅ Consolidate to one
|
|
168
|
+
[consolidated_example]
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Deletion Log Format
|
|
174
|
+
|
|
175
|
+
Create/update `[DELETION_LOG_PATH]`:
|
|
176
|
+
|
|
177
|
+
```markdown
|
|
178
|
+
# Code Deletion Log
|
|
179
|
+
|
|
180
|
+
## [YYYY-MM-DD] Cleanup Session
|
|
181
|
+
|
|
182
|
+
### Dependencies Removed
|
|
183
|
+
| Package | Reason | Size Impact |
|
|
184
|
+
|---------|--------|-------------|
|
|
185
|
+
| name | unused | -XX KB |
|
|
186
|
+
|
|
187
|
+
### Files Deleted
|
|
188
|
+
| File | Reason | Replacement |
|
|
189
|
+
|------|--------|-------------|
|
|
190
|
+
| path | unused | N/A or new-path |
|
|
191
|
+
|
|
192
|
+
### Duplicates Consolidated
|
|
193
|
+
| Removed | Kept | Reason |
|
|
194
|
+
|---------|------|--------|
|
|
195
|
+
| old-path | new-path | identical |
|
|
196
|
+
|
|
197
|
+
### Exports Removed
|
|
198
|
+
| File | Exports | Reason |
|
|
199
|
+
|------|---------|--------|
|
|
200
|
+
| path | fn1, fn2 | no references |
|
|
201
|
+
|
|
202
|
+
### Summary
|
|
203
|
+
- Files deleted: X
|
|
204
|
+
- Dependencies removed: X
|
|
205
|
+
- Lines removed: X
|
|
206
|
+
- Bundle/build impact: -XX KB
|
|
207
|
+
|
|
208
|
+
### Verification
|
|
209
|
+
- [ ] Build passes
|
|
210
|
+
- [ ] Tests pass
|
|
211
|
+
- [ ] Manual testing done
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Safety Checklist
|
|
217
|
+
|
|
218
|
+
**Before removing**:
|
|
219
|
+
- [ ] Detection tool flagged it
|
|
220
|
+
- [ ] Grep found no references
|
|
221
|
+
- [ ] Not in critical paths list
|
|
222
|
+
- [ ] Not dynamically imported
|
|
223
|
+
- [ ] Git history reviewed
|
|
224
|
+
- [ ] Working on feature branch
|
|
225
|
+
|
|
226
|
+
**After each batch**:
|
|
227
|
+
- [ ] Build succeeds
|
|
228
|
+
- [ ] Tests pass
|
|
229
|
+
- [ ] Changes committed
|
|
230
|
+
- [ ] Deletion log updated
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Error Recovery
|
|
235
|
+
|
|
236
|
+
If something breaks:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# 1. Immediate rollback
|
|
240
|
+
git revert HEAD
|
|
241
|
+
[INSTALL_COMMAND]
|
|
242
|
+
[BUILD_COMMAND]
|
|
243
|
+
[TEST_COMMAND]
|
|
244
|
+
|
|
245
|
+
# 2. Investigate why detection missed it
|
|
246
|
+
|
|
247
|
+
# 3. Add to "NEVER REMOVE" list
|
|
248
|
+
|
|
249
|
+
# 4. Document the edge case
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## When NOT to Run
|
|
255
|
+
|
|
256
|
+
- During active feature development
|
|
257
|
+
- Before production deployment
|
|
258
|
+
- Without adequate test coverage
|
|
259
|
+
- On unfamiliar code
|
|
260
|
+
- When codebase is unstable
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Generation Instructions
|
|
265
|
+
|
|
266
|
+
**For LLM generating project-specific agent from this template:**
|
|
267
|
+
|
|
268
|
+
### Step 1: Discover Analysis Tools
|
|
269
|
+
|
|
270
|
+
Check for available tools:
|
|
271
|
+
- package.json scripts and devDependencies
|
|
272
|
+
- Makefile targets
|
|
273
|
+
- pyproject.toml/setup.py tools
|
|
274
|
+
- pom.xml plugins
|
|
275
|
+
- Global installations
|
|
276
|
+
|
|
277
|
+
Populate `[PRIMARY_TOOL_COMMAND]`, `[UNUSED_DEPS_COMMAND]`, etc.
|
|
278
|
+
|
|
279
|
+
### Step 2: Identify Critical Paths
|
|
280
|
+
|
|
281
|
+
Analyze codebase for code that must never be removed:
|
|
282
|
+
- Auth modules
|
|
283
|
+
- Payment/billing code
|
|
284
|
+
- Core API handlers
|
|
285
|
+
- Database clients
|
|
286
|
+
- Third-party integrations
|
|
287
|
+
- Real-time functionality
|
|
288
|
+
|
|
289
|
+
Populate the "NEVER REMOVE" section with specific paths.
|
|
290
|
+
|
|
291
|
+
### Step 3: Map Project Structure
|
|
292
|
+
|
|
293
|
+
Identify:
|
|
294
|
+
- Where components/modules live
|
|
295
|
+
- Where utilities are stored
|
|
296
|
+
- Test file locations
|
|
297
|
+
- Build output directories (to ignore)
|
|
298
|
+
|
|
299
|
+
### Step 4: Extract Commands
|
|
300
|
+
|
|
301
|
+
Find actual commands for:
|
|
302
|
+
- Running analysis tools
|
|
303
|
+
- Building the project
|
|
304
|
+
- Running tests
|
|
305
|
+
- Installing dependencies
|
|
306
|
+
|
|
307
|
+
### Step 5: Create Language-Specific Examples
|
|
308
|
+
|
|
309
|
+
Generate examples for:
|
|
310
|
+
- Unused imports pattern
|
|
311
|
+
- Dead code pattern
|
|
312
|
+
- Duplicate code pattern
|
|
313
|
+
|
|
314
|
+
Using project's actual language syntax.
|
|
315
|
+
|
|
316
|
+
### Step 6: Set Deletion Log Path
|
|
317
|
+
|
|
318
|
+
Determine appropriate location:
|
|
319
|
+
- `docs/DELETION_LOG.md`
|
|
320
|
+
- `DELETION_LOG.md`
|
|
321
|
+
- `.github/DELETION_LOG.md`
|
|
322
|
+
|
|
323
|
+
### Step 7: Finalize Agent
|
|
324
|
+
|
|
325
|
+
- Remove all `[GENERATION INSTRUCTION]` blocks
|
|
326
|
+
- Remove this "Generation Instructions" section
|
|
327
|
+
- Replace all `[PLACEHOLDERS]`
|
|
328
|
+
- **Target agent size: 120-180 lines**
|
|
329
|
+
|
|
330
|
+
### Validation
|
|
331
|
+
|
|
332
|
+
- [ ] Analysis tool commands are valid
|
|
333
|
+
- [ ] Critical paths identified and listed
|
|
334
|
+
- [ ] Build/test commands accurate
|
|
335
|
+
- [ ] Examples use project's language
|
|
336
|
+
- [ ] Deletion log path specified
|
|
337
|
+
- [ ] No `[PLACEHOLDERS]` remain
|