opencodekit 0.23.1 → 0.23.3
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/dist/index.js +354 -825
- package/dist/template/.opencode/AGENTS.md +15 -2
- package/dist/template/.opencode/command/init.md +198 -34
- package/dist/template/.opencode/context/fallow.md +137 -0
- package/dist/template/.opencode/opencode.json +12 -315
- package/dist/template/.opencode/plugin/codesearch.ts +730 -0
- package/dist/template/.opencode/plugin/memory/compile.ts +171 -186
- package/dist/template/.opencode/plugin/memory/index-generator.ts +118 -133
- package/dist/template/.opencode/plugin/memory/lint.ts +253 -275
- package/dist/template/.opencode/plugin/memory/tools.ts +224 -268
- package/dist/template/.opencode/plugin/memory/validate.ts +154 -164
- package/dist/template/.opencode/plugin/sdk/copilot/responses/tool/web-search-preview.ts +13 -30
- package/dist/template/.opencode/plugin/sdk/copilot/responses/tool/web-search-shared.ts +25 -0
- package/dist/template/.opencode/plugin/sdk/copilot/responses/tool/web-search.ts +17 -34
- package/dist/template/.opencode/plugin/session-summary.ts +0 -2
- package/dist/template/.opencode/plugin/srcwalk.ts +646 -667
- package/dist/template/.opencode/skill/code-navigation/SKILL.md +10 -10
- package/dist/template/.opencode/skill/code-review-and-quality/SKILL.md +1 -1
- package/dist/template/.opencode/skill/condition-based-waiting/example.ts +15 -2
- package/dist/template/.opencode/skill/debugging-and-error-recovery/SKILL.md +1 -1
- package/dist/template/.opencode/skill/deep-module-design/SKILL.md +1 -1
- package/dist/template/.opencode/skill/fallow/SKILL.md +409 -0
- package/dist/template/.opencode/skill/fallow/references/cli-reference.md +1905 -0
- package/dist/template/.opencode/skill/fallow/references/gotchas.md +644 -0
- package/dist/template/.opencode/skill/fallow/references/patterns.md +791 -0
- package/dist/template/.opencode/skill/planning-and-task-breakdown/SKILL.md +1 -1
- package/dist/template/.opencode/skill/srcwalk/SKILL.md +10 -13
- package/dist/template/.opencode/skill/ubiquitous-language/SKILL.md +1 -1
- package/dist/template/.opencode/tool/grepsearch.ts +92 -103
- package/package.json +1 -1
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
5. This `AGENTS.md`
|
|
14
14
|
6. **Skills** — before non-trivial work, check the available skills list injected at session start. If a skill's purpose matches the task, load and follow it.
|
|
15
15
|
7. Memory (`memory-search`, `observation`) — create observations, search/read memory
|
|
16
|
-
8.
|
|
17
|
-
9.
|
|
16
|
+
8. Csearch (`csearch`) — multi-keyword code chunk search with BM25 ranking. Provide specific keywords; returns complete function/class code chunks ranked by relevance. Use when you need to find code by what it does, not by exact symbol name.
|
|
17
|
+
9. Srcwalk (`srcwalk_read`, `srcwalk_map`, `srcwalk_callers`, `srcwalk_callees`, `srcwalk_flow`, `srcwalk_deps`, `srcwalk_impact`) — structural code navigation (file reading, call graphs, import analysis, directory maps, blast-radius triage). Use when you have a known file/symbol and need to trace connections.
|
|
18
|
+
10. Project files and codebase evidence
|
|
18
19
|
|
|
19
20
|
If sources conflict, state the conflict explicitly. Official docs > code > blog posts > AI-generated content.
|
|
20
21
|
|
|
@@ -85,6 +86,18 @@ Reject changes that worsen overall code health.
|
|
|
85
86
|
- If verification fails twice on the same approach, stop and escalate.
|
|
86
87
|
- **Auto-detect project toolchain** — look for `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`, `Makefile`, etc.
|
|
87
88
|
|
|
89
|
+
### Fallow Codebase Gate
|
|
90
|
+
Before committing or claiming completion, run the Fallow codebase gate to catch structural issues that linters and type checkers cannot see:
|
|
91
|
+
|
|
92
|
+
- Run **`npx fallow audit --format json --quiet`** and check the `verdict`. If `"fail"`, resolve all findings before proceeding.
|
|
93
|
+
- Run **`npx fallow`** for full codebase analysis (dead code, duplication, health) — this is the single-pass overview.
|
|
94
|
+
- Use **`npx fallow fix --dry-run`** to preview safe auto-fixes for dead code.
|
|
95
|
+
- Use **`npx fallow dead-code --trace FILE:EXPORT`** to investigate why a specific export is flagged before deleting it.
|
|
96
|
+
|
|
97
|
+
Fallow builds a complete module graph (Rust-native, sub-second). Its analysis is **deterministic** — no AI inside the analyzer. It finds unused code, circular dependencies, code duplication, complexity hotspots, and architecture boundary violations across the entire codebase.
|
|
98
|
+
|
|
99
|
+
See `.opencode/context/fallow.md` for the full command reference.
|
|
100
|
+
|
|
88
101
|
## Tool Discipline
|
|
89
102
|
- Use tools whenever they materially improve correctness. Keep calling until the task is complete **and** verified.
|
|
90
103
|
- If a tool returns empty, partial, or suspiciously narrow results, try 1-2 fallback strategies before reporting "no results found."
|
|
@@ -6,34 +6,47 @@ agent: build
|
|
|
6
6
|
|
|
7
7
|
# Init: $ARGUMENTS
|
|
8
8
|
|
|
9
|
-
Initialize project setup. Run once per project.
|
|
9
|
+
Initialize project setup. Run once per project.
|
|
10
10
|
|
|
11
11
|
> **Next step for fresh projects:** `/plan` to create first implementation plan.
|
|
12
|
-
> **Next step for
|
|
12
|
+
> **Next step for existing codebases:** `/review-codebase` for deep codebase analysis.
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Idempotency Rules
|
|
15
|
+
|
|
16
|
+
| File | Rule |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `AGENTS.md` | Improve in-place — never overwrite blindly |
|
|
19
|
+
| `tech-stack.md` | Overwrite with detected values (auto-regenerated) |
|
|
20
|
+
| `roadmap.md` / `state.md` | Skip if exists, ask before overwrite |
|
|
21
|
+
| `user.md` | Skip if exists, ask before overwrite |
|
|
22
|
+
| `.opencode/opencode.json` `instructions[]` | Add to array — never remove existing entries |
|
|
23
|
+
|
|
24
|
+
## Skills
|
|
15
25
|
|
|
16
26
|
```typescript
|
|
17
27
|
skill({ name: "brainstorming" });
|
|
18
|
-
skill({ name: "verification-before-completion" });
|
|
19
28
|
```
|
|
20
29
|
|
|
30
|
+
Load `verification-before-completion` inside Mode 1 only (after AGENTS.md creation).
|
|
31
|
+
|
|
21
32
|
## Parse Arguments
|
|
22
33
|
|
|
23
34
|
| Argument | Default | Description |
|
|
24
35
|
|---|---|---|
|
|
25
36
|
| `--deep` | false | Comprehensive research for AGENTS.md (~100+ tool calls) |
|
|
26
|
-
| `--context` | false | Init planning context (roadmap, state) |
|
|
27
|
-
| `--user` | false | Init user profile |
|
|
37
|
+
| `--context` | false | Init planning context (roadmap.md, state.md) |
|
|
38
|
+
| `--user` | false | Init user profile (user.md) |
|
|
28
39
|
| `--all` | false | Full init: AGENTS.md + context + user profile |
|
|
29
40
|
|
|
30
41
|
**Mode rules:**
|
|
31
|
-
- No flags (default): Core project setup — AGENTS.md + tech
|
|
42
|
+
- No flags (default): Core project setup — AGENTS.md + tech-stack.md
|
|
32
43
|
- `--context`: Planning context (roadmap.md, state.md)
|
|
33
44
|
- `--user`: User profile (user.md)
|
|
34
45
|
- `--all`: Everything
|
|
35
46
|
- `--deep` applies to AGENTS.md generation only
|
|
36
47
|
|
|
48
|
+
**Brownfield auto-detection:** Existing codebase = any `src/`, `lib/`, or `app/` directory with `.ts`, `.js`, `.tsx`, `.jsx`, `.py`, `.go`, or `.rs` files. Affects Mode 2 discovery scope.
|
|
49
|
+
|
|
37
50
|
---
|
|
38
51
|
|
|
39
52
|
## Mode 1: Core Setup (Default)
|
|
@@ -47,14 +60,38 @@ Detect and validate:
|
|
|
47
60
|
- Existing AI rules (`.cursor/rules/`, `.cursorrules`, `.github/copilot-instructions.md`)
|
|
48
61
|
- Top-level directory structure
|
|
49
62
|
|
|
50
|
-
With `--deep`:
|
|
63
|
+
With `--deep`:
|
|
64
|
+
- Analyze git history (last 50 commits for patterns)
|
|
65
|
+
- Map source directory structure and subsystem candidates
|
|
66
|
+
- Identify common patterns (error handling, logging, data flow)
|
|
67
|
+
- Detect testing patterns and coverage gaps
|
|
51
68
|
|
|
52
69
|
### Phase 2: Preview Detection
|
|
53
70
|
|
|
54
|
-
Show detected summary and ask for confirmation before writing
|
|
71
|
+
Show detected summary and ask for confirmation before writing:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
question({
|
|
75
|
+
questions: [
|
|
76
|
+
{
|
|
77
|
+
header: "Proceed?",
|
|
78
|
+
question: "Write AGENTS.md and tech-stack.md with the detected configuration?",
|
|
79
|
+
options: [
|
|
80
|
+
{ label: "Yes (Recommended)", description: "Create both files" },
|
|
81
|
+
{ label: "AGENTS.md only", description: "Skip tech-stack.md" },
|
|
82
|
+
{ label: "Cancel", description: "Don't write anything" },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
});
|
|
87
|
+
```
|
|
55
88
|
|
|
56
89
|
### Phase 3: Create AGENTS.md
|
|
57
90
|
|
|
91
|
+
```typescript
|
|
92
|
+
skill({ name: "verification-before-completion" });
|
|
93
|
+
```
|
|
94
|
+
|
|
58
95
|
Create `./AGENTS.md` — target <60 lines (max 150). Include:
|
|
59
96
|
- Tech stack with versions, file structure, validated commands
|
|
60
97
|
- Code example from actual codebase
|
|
@@ -64,7 +101,25 @@ Create `./AGENTS.md` — target <60 lines (max 150). Include:
|
|
|
64
101
|
|
|
65
102
|
### Phase 4: Create tech-stack.md
|
|
66
103
|
|
|
67
|
-
Write detected values to `.opencode/memory/project/tech-stack.md`.
|
|
104
|
+
Write detected values to `.opencode/memory/project/tech-stack.md`. Then persist:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
observation({
|
|
108
|
+
type: "feature",
|
|
109
|
+
title: "Project initialized — [tech stack summary]",
|
|
110
|
+
narrative: "Core setup completed: AGENTS.md, tech-stack.md created for [language/framework] project",
|
|
111
|
+
concepts: "project-setup, initialization",
|
|
112
|
+
confidence: "high",
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Phase 5: Setup Fallow (if available)
|
|
117
|
+
|
|
118
|
+
Check if fallow is available. If yes and no `.fallowrc.json` exists:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npx fallow init --quiet 2>/dev/null || true
|
|
122
|
+
```
|
|
68
123
|
|
|
69
124
|
---
|
|
70
125
|
|
|
@@ -72,29 +127,109 @@ Write detected values to `.opencode/memory/project/tech-stack.md`. Persist with
|
|
|
72
127
|
|
|
73
128
|
Initialize project planning context with roadmap and state files.
|
|
74
129
|
|
|
75
|
-
### Phase 1: Discovery
|
|
130
|
+
### Phase 1: Discovery (brownfield)
|
|
76
131
|
|
|
77
|
-
If
|
|
78
|
-
- `explore` for architecture patterns
|
|
79
|
-
- `explore` for data flow
|
|
80
|
-
- `explore` for domain boundaries
|
|
132
|
+
If the project has existing code (brownfield — see auto-detection above), run parallel codebase analysis:
|
|
81
133
|
|
|
82
|
-
|
|
134
|
+
```typescript
|
|
135
|
+
task({
|
|
136
|
+
subagent_type: "explore",
|
|
137
|
+
description: "Map architecture patterns",
|
|
138
|
+
prompt: `Search the codebase for: architecture patterns, data flow, domain boundaries, and module structure.
|
|
139
|
+
Return: key architectural decisions, data flow patterns, main domains/modules.`,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
task({
|
|
143
|
+
subagent_type: "explore",
|
|
144
|
+
description: "Map domain boundaries",
|
|
145
|
+
prompt: `Search the codebase for: domain boundaries, module organization, and subsystem structure.
|
|
146
|
+
Return: top-level domains, module boundaries, dependency direction.`,
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
If greenfield (no existing code), skip to requirements gathering.
|
|
83
151
|
|
|
84
152
|
### Phase 2: Requirements Gathering
|
|
85
153
|
|
|
86
|
-
Ask questions to define:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
154
|
+
Ask questions to define project direction:
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
question({
|
|
158
|
+
questions: [
|
|
159
|
+
{
|
|
160
|
+
header: "Project vision",
|
|
161
|
+
question: "What is the project vision? (1-2 sentences)",
|
|
162
|
+
options: [
|
|
163
|
+
{ label: "Let me type it", description: "Custom input" },
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
header: "Target users",
|
|
168
|
+
question: "Who are the primary users?",
|
|
169
|
+
multiple: true,
|
|
170
|
+
options: [
|
|
171
|
+
{ label: "Developers", description: "Tooling, libraries, CLI" },
|
|
172
|
+
{ label: "End users", description: "Consumer-facing application" },
|
|
173
|
+
{ label: "Internal team", description: "Internal tool or service" },
|
|
174
|
+
{ label: "Both", description: "Multiple user types" },
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
header: "Success criteria",
|
|
179
|
+
question: "What defines success for this project? (select all that apply)",
|
|
180
|
+
multiple: true,
|
|
181
|
+
options: [
|
|
182
|
+
{ label: "Stability", description: "Reliability and correctness first" },
|
|
183
|
+
{ label: "Speed", description: "Performance and low latency" },
|
|
184
|
+
{ label: "UX", description: "User experience and polish" },
|
|
185
|
+
{ label: "Maintainability", description: "Code quality and extensibility" },
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
});
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Phase 3: Preview
|
|
193
|
+
|
|
194
|
+
Show the gathered requirements as a structured outline and ask for confirmation before writing files.
|
|
195
|
+
|
|
196
|
+
### Phase 4: Create Files
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
// Create roadmap.md
|
|
200
|
+
write({
|
|
201
|
+
filePath: ".opencode/memory/project/roadmap.md",
|
|
202
|
+
content: `# Roadmap
|
|
203
|
+
|
|
204
|
+
## Vision
|
|
205
|
+
[1-2 sentences]
|
|
92
206
|
|
|
93
|
-
|
|
207
|
+
## Target Users
|
|
208
|
+
- ...
|
|
94
209
|
|
|
95
|
-
|
|
96
|
-
-
|
|
97
|
-
|
|
210
|
+
## Feature Roadmap
|
|
211
|
+
- ...
|
|
212
|
+
`,
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
// Create state.md
|
|
216
|
+
write({
|
|
217
|
+
filePath: ".opencode/memory/project/state.md",
|
|
218
|
+
content: `# State
|
|
219
|
+
|
|
220
|
+
## Current Status
|
|
221
|
+
Initial setup
|
|
222
|
+
|
|
223
|
+
## Active Decisions
|
|
224
|
+
(none)
|
|
225
|
+
|
|
226
|
+
## Next Priorities
|
|
227
|
+
- ...
|
|
228
|
+
`,
|
|
229
|
+
});
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Then update `.opencode/opencode.json` to include these files in `instructions[]` — append them to the existing array without removing `user.md`, `git-context.md`, or `fallow.md`.
|
|
98
233
|
|
|
99
234
|
---
|
|
100
235
|
|
|
@@ -104,19 +239,48 @@ Create personalized user profile at `.opencode/memory/project/user.md`.
|
|
|
104
239
|
|
|
105
240
|
### Phase 1: Gather Preferences
|
|
106
241
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
242
|
+
```typescript
|
|
243
|
+
question({
|
|
244
|
+
questions: [
|
|
245
|
+
{
|
|
246
|
+
header: "Identity",
|
|
247
|
+
question: "What is your name and role?",
|
|
248
|
+
options: [
|
|
249
|
+
{ label: "Set name", description: "Tell me your details" },
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
header: "Communication",
|
|
254
|
+
question: "How detailed should AI responses be?",
|
|
255
|
+
options: [
|
|
256
|
+
{ label: "Concise (Recommended)", description: "Short, direct answers" },
|
|
257
|
+
{ label: "Detailed", description: "Full explanations and reasoning" },
|
|
258
|
+
{ label: "Mixed", description: "Depends on context" },
|
|
259
|
+
],
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
header: "Git workflow",
|
|
263
|
+
question: "How should git commits be handled?",
|
|
264
|
+
options: [
|
|
265
|
+
{ label: "Ask first (Recommended)", description: "Always confirm before commit/push" },
|
|
266
|
+
{ label: "Auto-commit", description: "Commit directly after completion" },
|
|
267
|
+
],
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
});
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Phase 2: Preview
|
|
274
|
+
|
|
275
|
+
Show the captured preferences as a summary and ask for confirmation before writing.
|
|
112
276
|
|
|
113
|
-
### Phase
|
|
277
|
+
### Phase 3: Create user.md
|
|
114
278
|
|
|
115
279
|
Write to `.opencode/memory/project/user.md` with the captured preferences.
|
|
116
280
|
|
|
117
|
-
### Phase
|
|
281
|
+
### Phase 4: Ensure instructions[] includes user.md
|
|
118
282
|
|
|
119
|
-
|
|
283
|
+
Check that `user.md` is listed in `.opencode/opencode.json` `instructions[]`. If missing, append it alongside the existing entries (`git-context.md`, `fallow.md`).
|
|
120
284
|
|
|
121
285
|
> **Warning:** Do not add more files to `instructions[]` unless essential. Per-prompt injection of too many files causes session OOM. Use `memory-search({ file: "..." })` for on-demand access.
|
|
122
286
|
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
purpose: Fallow codebase intelligence commands for AI agents — dead code, duplication, complexity, and audit gating
|
|
3
|
+
updated: 2026-06-04
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Fallow — Codebase Intelligence Reference
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Fallow is a Rust-native, deterministic static analysis tool for TypeScript/JavaScript codebases.
|
|
11
|
+
**No AI inside the analyzer** — same input always produces the same output.
|
|
12
|
+
It builds a complete module graph to find issues no linter or type checker can see.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Commands
|
|
17
|
+
|
|
18
|
+
### Full Analysis (single pass)
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx fallow # All analyses: dead code + duplication + health
|
|
22
|
+
npx fallow --format json # Structured output for agent parsing
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Dead Code
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx fallow dead-code # Full dead code report
|
|
29
|
+
npx fallow dead-code --format json --quiet # JSON for agents
|
|
30
|
+
npx fallow dead-code --unused-exports # Only unused exports
|
|
31
|
+
npx fallow dead-code --unused-dependencies # Only unused deps
|
|
32
|
+
npx fallow dead-code --circular # Only circular deps
|
|
33
|
+
npx fallow fix --dry-run # Preview safe auto-fixes
|
|
34
|
+
npx fallow fix --yes # Apply auto-fixes
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Trace (investigate before deleting)
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx fallow dead-code --trace FILE:EXPORT_NAME # Why is this export flagged?
|
|
41
|
+
npx fallow dead-code --trace-dependency PACKAGE_NAME # Where is this dep imported?
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Duplication
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx fallow dupes # Find code clones
|
|
48
|
+
npx fallow dupes --mode strict # Exact matches only
|
|
49
|
+
npx fallow dupes --mode weak # Structural matches
|
|
50
|
+
npx fallow dupes --trace FILE:LINE # Deep-dive a specific clone group
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Health (complexity)
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npx fallow health # Complexity hotspots + refactoring targets
|
|
57
|
+
npx fallow health --format json # Structured output
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Audit Gate (for CI / pre-commit)
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npx fallow audit # Check changed files (verdict: pass/warn/fail)
|
|
64
|
+
npx fallow audit --format json # Structured verdict for agents
|
|
65
|
+
npx fallow audit --gate new-only # Only flag new issues, not pre-existing
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Workflow Patterns
|
|
71
|
+
|
|
72
|
+
### Post-Edit Verification Loop
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# 1. Make changes
|
|
76
|
+
# 2. Run audit
|
|
77
|
+
npx fallow audit --format json --quiet
|
|
78
|
+
# 3. If verdict is "fail", inspect findings
|
|
79
|
+
# 4. Fix or investigate with --trace
|
|
80
|
+
# 5. Re-run audit until pass
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Codebase Cleanup
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npx fallow # Full picture
|
|
87
|
+
npx fallow dead-code --format json # Find unused code
|
|
88
|
+
npx fallow fix --dry-run # Preview auto-removals
|
|
89
|
+
npx fallow fix --yes # Apply auto-fixes
|
|
90
|
+
npx fallow dupes # Find duplication
|
|
91
|
+
npx fallow health # Find complexity hotspots
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Monorepo / Workspace
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npx fallow --workspace # Analyze all workspaces
|
|
98
|
+
npx fallow --workspace packages/pkg # Analyze specific workspace
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Understanding Output
|
|
104
|
+
|
|
105
|
+
Every finding in `--format json` includes:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"path": "src/utils/example.ts:42",
|
|
110
|
+
"issue_type": "unused-exports",
|
|
111
|
+
"actions": [
|
|
112
|
+
{
|
|
113
|
+
"type": "delete-export",
|
|
114
|
+
"auto_fixable": true,
|
|
115
|
+
"description": "Remove unused export"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The `actions[]` array is machine-actionable. Agents can inspect `auto_fixable` flags and apply safe fixes programmatically.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Config
|
|
126
|
+
|
|
127
|
+
Fallow auto-detects your project. For custom config, run:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npx fallow init # Generates .fallow/config.yaml with auto-detected settings
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Common config patterns:
|
|
134
|
+
- `ignorePatterns` — exclude directories from analysis (e.g., `.opencode/`)
|
|
135
|
+
- `entry` — declare additional entry points
|
|
136
|
+
- `publicPackages` — packages with public API surface
|
|
137
|
+
- `rules` — custom issue severity rules
|