@harness-engineering/cli 1.2.0 → 1.2.2

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.
Files changed (52) hide show
  1. package/dist/bin/harness.js +1 -1
  2. package/dist/{chunk-IXT3KLVN.js → chunk-5RQKSZLA.js} +4 -3
  3. package/dist/index.js +1 -1
  4. package/package.json +6 -4
  5. package/dist/agents/commands/claude-code/harness/add-component.md +0 -34
  6. package/dist/agents/commands/claude-code/harness/align-documentation.md +0 -33
  7. package/dist/agents/commands/claude-code/harness/architecture-advisor.md +0 -41
  8. package/dist/agents/commands/claude-code/harness/brainstorming.md +0 -42
  9. package/dist/agents/commands/claude-code/harness/check-mechanical-constraints.md +0 -32
  10. package/dist/agents/commands/claude-code/harness/cleanup-dead-code.md +0 -33
  11. package/dist/agents/commands/claude-code/harness/code-review.md +0 -33
  12. package/dist/agents/commands/claude-code/harness/debugging.md +0 -43
  13. package/dist/agents/commands/claude-code/harness/detect-doc-drift.md +0 -32
  14. package/dist/agents/commands/claude-code/harness/diagnostics.md +0 -43
  15. package/dist/agents/commands/claude-code/harness/enforce-architecture.md +0 -32
  16. package/dist/agents/commands/claude-code/harness/execution.md +0 -43
  17. package/dist/agents/commands/claude-code/harness/git-workflow.md +0 -32
  18. package/dist/agents/commands/claude-code/harness/initialize-project.md +0 -33
  19. package/dist/agents/commands/claude-code/harness/onboarding.md +0 -32
  20. package/dist/agents/commands/claude-code/harness/parallel-agents.md +0 -35
  21. package/dist/agents/commands/claude-code/harness/planning.md +0 -41
  22. package/dist/agents/commands/claude-code/harness/pre-commit-review.md +0 -38
  23. package/dist/agents/commands/claude-code/harness/refactoring.md +0 -35
  24. package/dist/agents/commands/claude-code/harness/skill-authoring.md +0 -35
  25. package/dist/agents/commands/claude-code/harness/state-management.md +0 -35
  26. package/dist/agents/commands/claude-code/harness/tdd.md +0 -42
  27. package/dist/agents/commands/claude-code/harness/validate-context-engineering.md +0 -32
  28. package/dist/agents/commands/claude-code/harness/verification.md +0 -38
  29. package/dist/agents/commands/gemini-cli/harness/add-component.toml +0 -240
  30. package/dist/agents/commands/gemini-cli/harness/align-documentation.toml +0 -238
  31. package/dist/agents/commands/gemini-cli/harness/architecture-advisor.toml +0 -469
  32. package/dist/agents/commands/gemini-cli/harness/brainstorming.toml +0 -326
  33. package/dist/agents/commands/gemini-cli/harness/check-mechanical-constraints.toml +0 -249
  34. package/dist/agents/commands/gemini-cli/harness/cleanup-dead-code.toml +0 -258
  35. package/dist/agents/commands/gemini-cli/harness/code-review.toml +0 -461
  36. package/dist/agents/commands/gemini-cli/harness/debugging.toml +0 -436
  37. package/dist/agents/commands/gemini-cli/harness/detect-doc-drift.toml +0 -215
  38. package/dist/agents/commands/gemini-cli/harness/diagnostics.toml +0 -401
  39. package/dist/agents/commands/gemini-cli/harness/enforce-architecture.toml +0 -222
  40. package/dist/agents/commands/gemini-cli/harness/execution.toml +0 -381
  41. package/dist/agents/commands/gemini-cli/harness/git-workflow.toml +0 -325
  42. package/dist/agents/commands/gemini-cli/harness/initialize-project.toml +0 -257
  43. package/dist/agents/commands/gemini-cli/harness/onboarding.toml +0 -316
  44. package/dist/agents/commands/gemini-cli/harness/parallel-agents.toml +0 -221
  45. package/dist/agents/commands/gemini-cli/harness/planning.toml +0 -405
  46. package/dist/agents/commands/gemini-cli/harness/pre-commit-review.toml +0 -294
  47. package/dist/agents/commands/gemini-cli/harness/refactoring.toml +0 -209
  48. package/dist/agents/commands/gemini-cli/harness/skill-authoring.toml +0 -350
  49. package/dist/agents/commands/gemini-cli/harness/state-management.toml +0 -354
  50. package/dist/agents/commands/gemini-cli/harness/tdd.toml +0 -247
  51. package/dist/agents/commands/gemini-cli/harness/validate-context-engineering.toml +0 -186
  52. package/dist/agents/commands/gemini-cli/harness/verification.toml +0 -334
@@ -1,258 +0,0 @@
1
- # Generated by harness generate-slash-commands. Do not edit.
2
- description = "Detect unused exports and dead code"
3
- prompt = """
4
- <context>
5
- Cognitive mode: diagnostic-investigator
6
- Type: flexible
7
- </context>
8
-
9
- <objective>
10
- Detect unused exports and dead code
11
- </objective>
12
-
13
- <execution_context>
14
- --- SKILL.md (agents/skills/claude-code/cleanup-dead-code/SKILL.md) ---
15
- # Cleanup Dead Code
16
-
17
- > Entropy analysis and safe cleanup. Find unused exports, dead files, and pattern violations — then remove them without breaking anything.
18
-
19
- ## When to Use
20
-
21
- - After a major refactoring or feature removal
22
- - When the codebase feels "heavy" — too many files, unclear what is used
23
- - As a periodic hygiene task (monthly or per-quarter)
24
- - When `on_entropy_check` triggers fire
25
- - After deleting a feature flag and its associated code paths
26
- - When `harness cleanup` reports growing entropy in the project health dashboard
27
- - NOT during active feature development — dead code cleanup is a separate, focused task
28
- - NOT when tests are failing — fix tests first, then clean up
29
- - NOT under time pressure — dead code removal requires careful verification
30
-
31
- ## Process
32
-
33
- ### Phase 1: Analyze — Run Entropy Report
34
-
35
- 1. **Run `harness cleanup`** to generate a full entropy report. This analyzes:
36
- - **Dead exports** — functions, classes, and constants that are exported but never imported anywhere
37
- - **Unused files** — files that are not imported by any other file in the project
38
- - **Pattern violations** — code that violates established project patterns (e.g., a service file without a corresponding test file)
39
- - **Orphaned dependencies** — npm packages listed in package.json but never imported
40
-
41
- 2. **Run `harness cleanup --type dead-code --json`** for machine-readable output focused specifically on unused code.
42
-
43
- 3. **Review the report summary.** Note the total count and distribution. A few dead exports are normal; dozens suggest accumulated entropy from incomplete refactorings.
44
-
45
- ### Phase 2: Categorize — Safe vs. Needs Review
46
-
47
- **Safe to auto-fix (remove without further analysis):**
48
-
49
- - Exports that are not imported anywhere AND not referenced in any config file
50
- - Files that are not imported anywhere AND have no side effects (no top-level execution)
51
- - Commented-out code blocks (dead by definition)
52
- - Unused local variables and imports within a file (linter can catch these)
53
-
54
- **Needs human review before removal:**
55
-
56
- - Exports that APPEAR unused but might be consumed dynamically (see "What NOT to Delete" below)
57
- - Files that appear unused but are entry points (CLI scripts, test fixtures, config files)
58
- - Code that is only used in specific build configurations or environments
59
- - Exports from a public package — external consumers may depend on them
60
-
61
- ### Phase 3: Apply Safe Fixes
62
-
63
- For each item categorized as safe:
64
-
65
- 1. **Remove the dead code.** Delete the export, function, file, or import.
66
-
67
- 2. **Run `harness fix-drift`** to update any documentation references that pointed to the deleted code.
68
-
69
- 3. **Run the full test suite.** All tests must pass. If any test fails:
70
- - **STOP.** The code was not actually dead — something depends on it.
71
- - **Undo the deletion immediately.**
72
- - **Reclassify** the item as "needs human review" and investigate the hidden dependency.
73
-
74
- 4. **Run `harness validate` and `harness check-deps`.** Both must pass.
75
-
76
- 5. **Commit the cleanup.** Group related removals into logical commits (e.g., "remove unused shipping utilities" not "delete dead code").
77
-
78
- ### Phase 4: Report Remaining Items
79
-
80
- For items that need human review, report:
81
-
82
- 1. **What it is** — file path, export name, what it does
83
- 2. **Why it appears dead** — no static imports found
84
- 3. **Why it might not be dead** — dynamic import patterns, external consumers, test utilities
85
- 4. **Recommended action** — delete with confidence, delete with caution, or keep
86
-
87
- ## What NOT to Delete
88
-
89
- These patterns make code APPEAR dead when it is actually in use:
90
-
91
- ### Dynamically imported modules
92
-
93
- ```typescript
94
- // This import won't show up in static analysis
95
- const module = await import(`./plugins/${pluginName}`);
96
- ```
97
-
98
- Files in a `plugins/` directory may appear unused but are loaded dynamically at runtime. Check for `import()` calls, `require()` with variables, and glob-based loading patterns.
99
-
100
- ### Test utilities and fixtures
101
-
102
- ```typescript
103
- // test-helpers.ts — only imported by test files
104
- export function createMockUser() { ... }
105
- ```
106
-
107
- Test utility files may appear unused if the analysis excludes test files. Verify that `harness cleanup` includes test files in its import graph.
108
-
109
- ### Type-only exports
110
-
111
- ```typescript
112
- // Only used as a type, never as a value
113
- export interface UserConfig { ... }
114
- ```
115
-
116
- Some analysis tools miss type-only imports (`import type { UserConfig }`). Verify before deleting any exported interface or type alias.
117
-
118
- ### Package entry points
119
-
120
- ```typescript
121
- // index.ts — re-exports for external consumers
122
- export { createClient } from './client';
123
- ```
124
-
125
- The entry point of a package re-exports things for external consumers. These exports may have zero internal imports but are the public API.
126
-
127
- ### Side-effect files
128
-
129
- ```typescript
130
- // polyfills.ts — imported for side effects, not for exports
131
- import './polyfills';
132
- ```
133
-
134
- Some files are imported for their side effects (polyfills, global registrations, CSS). They have no exports but are not dead.
135
-
136
- ### Environment-specific code
137
-
138
- ```typescript
139
- // Only used when FEATURE_FLAG_X is enabled
140
- if (process.env.FEATURE_FLAG_X) {
141
- const handler = require('./experimental-handler');
142
- }
143
- ```
144
-
145
- Code behind feature flags or environment checks may appear dead in the default configuration.
146
-
147
- ## Harness Integration
148
-
149
- - **`harness cleanup`** — Full entropy analysis. Reports dead exports, unused files, pattern violations, and orphaned dependencies.
150
- - **`harness cleanup --type dead-code`** — Focused analysis on unused code specifically.
151
- - **`harness cleanup --type dead-code --json`** — Machine-readable output for automation.
152
- - **`harness fix-drift`** — Update documentation after removing dead code. Ensures deleted items are not still referenced in docs.
153
- - **`harness validate`** — Run after cleanup to verify project structure remains valid.
154
- - **`harness check-deps`** — Run after cleanup to verify no dependency violations were introduced.
155
-
156
- ## Success Criteria
157
-
158
- - `harness cleanup` reports zero dead exports and zero unused files (or all remaining items are documented as intentional)
159
- - All tests pass after every deletion
160
- - `harness validate` and `harness check-deps` pass after cleanup
161
- - Documentation references to deleted code are updated or removed
162
- - No dynamically-imported, type-only, or side-effect code was accidentally deleted
163
- - Each cleanup commit is atomic and has a descriptive message explaining what was removed and why
164
-
165
- ## Examples
166
-
167
- ### Example: Removing unused utility functions
168
-
169
- **Entropy report:**
170
-
171
- ```
172
- DEAD EXPORT: src/utils/string-helpers.ts
173
- - capitalizeFirst() — 0 imports found
174
- - truncateWithEllipsis() — 0 imports found
175
- - slugify() — 3 imports found (ACTIVE, not dead)
176
- ```
177
-
178
- **Action:** Remove `capitalizeFirst` and `truncateWithEllipsis` from the file. Keep `slugify`. Run tests — all pass. Commit: "remove unused capitalizeFirst and truncateWithEllipsis from string-helpers"
179
-
180
- ### Example: Detecting a false positive
181
-
182
- **Entropy report:**
183
-
184
- ```
185
- UNUSED FILE: src/plugins/markdown-renderer.ts
186
- - 0 static imports found
187
- - File contains: export default class MarkdownRenderer
188
- ```
189
-
190
- **Investigation:** Check for dynamic imports:
191
-
192
- ```typescript
193
- // src/plugins/index.ts
194
- const renderer = await import(`./${format}-renderer`);
195
- ```
196
-
197
- **Result:** False positive. The file is loaded dynamically based on the `format` variable. Mark as intentional and add a comment in the file explaining the dynamic loading pattern.
198
-
199
- ### Example: Orphaned npm dependency
200
-
201
- **Entropy report:**
202
-
203
- ```
204
- ORPHANED DEPENDENCY: moment (package.json)
205
- - 0 imports of 'moment' found in src/
206
- - Last imported in commit abc123 (removed 3 months ago)
207
- ```
208
-
209
- **Action:** Remove `moment` from package.json dependencies. Run `npm install` to update lockfile. Run tests — all pass. Commit: "remove unused moment dependency"
210
-
211
- ## Escalation
212
-
213
- - **When removing code causes unexpected test failures:** The code has a hidden dependency. Undo the deletion, investigate the dependency chain, and document the finding. The code is not dead — it is just hard to trace.
214
- - **When the entropy report is very large (>50 items):** Do not attempt to clean everything at once. Pick the highest-confidence dead code (files with zero imports, no dynamic patterns) and clean those first. Schedule the rest across multiple sessions.
215
- - **When you are unsure if an export is used externally:** Check if the code is in a published package. If so, removing an export is a breaking change. Deprecate first, then remove in a major version.
216
- - **When dead code is tangled with live code in the same file:** Extract the live code first (using harness-refactoring), then delete the remaining dead code. Do not try to surgically remove dead code from a complex file in one step.
217
-
218
-
219
- --- skill.yaml (agents/skills/claude-code/cleanup-dead-code/skill.yaml) ---
220
- name: cleanup-dead-code
221
- version: "1.0.0"
222
- description: Detect unused exports and dead code
223
- cognitive_mode: diagnostic-investigator
224
- triggers:
225
- - manual
226
- platforms:
227
- - claude-code
228
- - gemini-cli
229
- tools:
230
- - Bash
231
- - Read
232
- - Glob
233
- - Grep
234
- cli:
235
- command: harness skill run cleanup-dead-code
236
- args:
237
- - name: path
238
- description: Project root path
239
- required: false
240
- mcp:
241
- tool: run_skill
242
- input:
243
- skill: cleanup-dead-code
244
- path: string
245
- type: flexible
246
- state:
247
- persistent: false
248
- files: []
249
- depends_on: []
250
-
251
- </execution_context>
252
-
253
- <process>
254
- 1. Try: invoke mcp__harness__run_skill with skill: "cleanup-dead-code"
255
- 2. If MCP unavailable: follow the SKILL.md workflow provided above directly
256
- 3. Pass through any arguments provided by the user
257
- </process>
258
- """