@agentbrain/cli 1.4.20 → 1.4.33
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 +318 -395
- package/dist/commands/doom.d.ts.map +1 -1
- package/dist/commands/doom.js +23 -9
- package/dist/commands/doom.js.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,53 +1,99 @@
|
|
|
1
1
|
# @agentbrain/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Smart context generation for coding agents - Keep AI assistants in sync with your codebase
|
|
4
|
+
|
|
5
|
+
Command-line interface for AgentBrain. Automatically generates and maintains context documentation that helps coding agents (Claude, Cursor, Windsurf) understand your codebase instantly.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@agentbrain/cli)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
|
|
10
|
+
---
|
|
4
11
|
|
|
5
12
|
## Installation
|
|
6
13
|
|
|
14
|
+
### Global Installation (Recommended)
|
|
15
|
+
|
|
7
16
|
```bash
|
|
8
17
|
npm install -g @agentbrain/cli
|
|
9
18
|
```
|
|
10
19
|
|
|
20
|
+
### Local Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install --save-dev @agentbrain/cli
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Verify Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
agentbrain --version
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
11
34
|
## Quick Start
|
|
12
35
|
|
|
36
|
+
### One-Command Setup
|
|
37
|
+
|
|
13
38
|
```bash
|
|
14
|
-
# ONE-TIME SETUP: Complete automated setup
|
|
15
39
|
cd /path/to/your/project
|
|
16
40
|
agentbrain setup
|
|
17
|
-
|
|
18
|
-
# That's it! AgentBrain now:
|
|
19
|
-
# ✓ Generates context automatically on commits
|
|
20
|
-
# ✓ Injects loading instructions into agent files
|
|
21
|
-
# ✓ Keeps everything in sync with your codebase
|
|
22
41
|
```
|
|
23
42
|
|
|
24
|
-
|
|
43
|
+
**That's it!** AgentBrain now:
|
|
44
|
+
- ✓ Generates context automatically on every commit
|
|
45
|
+
- ✓ Injects loading instructions into your agent files
|
|
46
|
+
- ✓ Detects and warns about doom loops
|
|
47
|
+
- ✓ Keeps everything in sync with your codebase
|
|
25
48
|
|
|
26
|
-
|
|
27
|
-
# Configure your API key
|
|
28
|
-
agentbrain config
|
|
49
|
+
### What Gets Created
|
|
29
50
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
agentbrain
|
|
51
|
+
- `.agentbrain/context.md` - Full repository intelligence
|
|
52
|
+
- `.agentbrain/dependency-map.md` - Service relationships
|
|
53
|
+
- `.agentbrain/patterns.md` - Coding patterns and conventions
|
|
54
|
+
- `CLAUDE.md` / `.cursorrules` / `.windsurfrules` - Agent loading instructions
|
|
55
|
+
- `.git/hooks/post-commit` - Smart auto-regeneration hook
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Core Concepts
|
|
60
|
+
|
|
61
|
+
### Smart Context Generation
|
|
62
|
+
|
|
63
|
+
AgentBrain analyzes your codebase and generates three intelligence documents:
|
|
64
|
+
|
|
65
|
+
1. **Context** - Architecture, key files, and technical overview
|
|
66
|
+
2. **Dependency Map** - How services/modules relate to each other
|
|
67
|
+
3. **Patterns** - Coding patterns, conventions, and best practices
|
|
68
|
+
|
|
69
|
+
### Automatic Regeneration
|
|
33
70
|
|
|
34
|
-
|
|
35
|
-
agentbrain spec "add user authentication"
|
|
71
|
+
After setup, context updates automatically in the background when you commit **source file changes**. Commits complete instantly (~0.05s) while regeneration happens in the background.
|
|
36
72
|
|
|
37
|
-
|
|
38
|
-
agentbrain standards
|
|
73
|
+
**Smart Filtering:** Only regenerates when source code changes (skips docs/config updates to save time and API costs).
|
|
39
74
|
|
|
40
|
-
|
|
41
|
-
|
|
75
|
+
### Doom Loop Detection
|
|
76
|
+
|
|
77
|
+
AgentBrain automatically detects when you're modifying the same files repeatedly in commits - a sign you may be stuck in a loop. When detected:
|
|
78
|
+
|
|
79
|
+
- ⚠ Warning displayed on next CLI command
|
|
80
|
+
- 🔔 Alert included in MCP tool responses
|
|
81
|
+
- 📝 Appended to handoff documents
|
|
82
|
+
- 💡 Suggests running `agentbrain spec` to plan a fix
|
|
83
|
+
|
|
84
|
+
**Check manually:**
|
|
85
|
+
```bash
|
|
86
|
+
agentbrain doom
|
|
42
87
|
```
|
|
43
88
|
|
|
89
|
+
---
|
|
90
|
+
|
|
44
91
|
## Commands
|
|
45
92
|
|
|
46
|
-
### `
|
|
93
|
+
### `setup` - Complete Automated Setup
|
|
47
94
|
|
|
48
|
-
|
|
95
|
+
One-command setup for AgentBrain in your repository.
|
|
49
96
|
|
|
50
|
-
**Usage:**
|
|
51
97
|
```bash
|
|
52
98
|
agentbrain setup [options]
|
|
53
99
|
```
|
|
@@ -56,541 +102,418 @@ agentbrain setup [options]
|
|
|
56
102
|
- `--path <path>` - Repository path (default: current directory)
|
|
57
103
|
- `--skip-hooks` - Skip git hooks installation
|
|
58
104
|
- `--skip-agent-files` - Skip agent file injection
|
|
105
|
+
- `--no-confirm` - Skip all confirmation prompts
|
|
59
106
|
|
|
60
107
|
**What it does:**
|
|
61
108
|
1. Detects which agents you use (Claude Code, Cursor, Windsurf)
|
|
62
109
|
2. Generates initial context documentation
|
|
63
|
-
3. Injects context loading instructions
|
|
64
|
-
4. Installs smart git hooks
|
|
65
|
-
5. Sets up
|
|
110
|
+
3. Injects context loading instructions
|
|
111
|
+
4. Installs smart git hooks
|
|
112
|
+
5. Sets up doom loop detection
|
|
66
113
|
|
|
67
|
-
**
|
|
68
|
-
- Creates `agentbrain/` directory with context docs
|
|
69
|
-
- Updates `CLAUDE.md`, `.cursorrules`, and/or `.windsurfrules`
|
|
70
|
-
- Installs `.git/hooks/post-commit` for smart auto-regeneration
|
|
114
|
+
**Cost:** ~$0.02-0.05 for initial generation (cached repeats are free)
|
|
71
115
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
agentbrain setup
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
### `init` - Regenerate Context
|
|
76
119
|
|
|
77
|
-
|
|
78
|
-
|
|
120
|
+
Manually regenerate all context documentation.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
agentbrain init [options]
|
|
79
124
|
```
|
|
80
125
|
|
|
81
|
-
**
|
|
126
|
+
**Options:**
|
|
127
|
+
- `--path <path>` - Repository path
|
|
128
|
+
- `--no-confirm` - Skip confirmation prompt
|
|
129
|
+
- `--silent` - Suppress output (for scripts)
|
|
82
130
|
|
|
83
|
-
**
|
|
84
|
-
|
|
131
|
+
**Use when:**
|
|
132
|
+
- You want to force a fresh regeneration
|
|
133
|
+
- Context feels stale or inaccurate
|
|
134
|
+
- After major codebase changes
|
|
85
135
|
|
|
86
|
-
|
|
136
|
+
**Cost:** ~$0.02-0.05 per regeneration (same git hash = free from cache)
|
|
87
137
|
|
|
88
138
|
---
|
|
89
139
|
|
|
90
|
-
### `
|
|
140
|
+
### `spec` - Create Task Specifications
|
|
91
141
|
|
|
92
|
-
Generate
|
|
142
|
+
Generate AI-guided task specifications with problem analysis and architecture planning.
|
|
93
143
|
|
|
94
|
-
**Usage:**
|
|
95
144
|
```bash
|
|
96
|
-
agentbrain
|
|
145
|
+
agentbrain spec "<task description>" [options]
|
|
97
146
|
```
|
|
98
147
|
|
|
99
148
|
**Options:**
|
|
100
|
-
- `--path <path>` - Repository path
|
|
101
|
-
- `--
|
|
102
|
-
- `--no-cache` - Skip cache and regenerate
|
|
103
|
-
- `--dry-run` - Preview without generating (free!)
|
|
104
|
-
|
|
105
|
-
**Output:**
|
|
106
|
-
Creates three files in `agentbrain/` directory:
|
|
107
|
-
- `context.md` - Navigation guide with exact file paths and function names
|
|
108
|
-
- `dependency-map.md` - Actual code dependencies showing imports and data flow
|
|
109
|
-
- `patterns.md` - Coding patterns and conventions found in the codebase
|
|
149
|
+
- `--path <path>` - Repository path
|
|
150
|
+
- `--load <slug>` - Load existing spec by slug
|
|
110
151
|
|
|
111
|
-
**
|
|
152
|
+
**Examples:**
|
|
112
153
|
```bash
|
|
113
|
-
#
|
|
114
|
-
agentbrain
|
|
154
|
+
# Create new spec
|
|
155
|
+
agentbrain spec "add user authentication with OAuth"
|
|
115
156
|
|
|
116
|
-
#
|
|
117
|
-
agentbrain
|
|
118
|
-
|
|
119
|
-
# Generate for specific path with custom limit
|
|
120
|
-
agentbrain init --path ~/my-project --max-files 50
|
|
157
|
+
# Load existing spec
|
|
158
|
+
agentbrain spec --load add-user-authentication
|
|
121
159
|
```
|
|
122
160
|
|
|
123
|
-
**
|
|
161
|
+
**What it creates:**
|
|
162
|
+
- Problem analysis and context
|
|
163
|
+
- Technical approach and architecture
|
|
164
|
+
- Implementation steps
|
|
165
|
+
- Testing strategy
|
|
166
|
+
- Done criteria
|
|
167
|
+
|
|
168
|
+
**Specs are saved to:** `.agentbrain/specs/<task-slug>.md`
|
|
169
|
+
|
|
170
|
+
**Cost:** ~$0.01-0.03 per spec generation
|
|
124
171
|
|
|
125
172
|
---
|
|
126
173
|
|
|
127
|
-
### `
|
|
174
|
+
### `doom` - Detect Doom Loops
|
|
128
175
|
|
|
129
|
-
|
|
176
|
+
Analyze git history to detect if you're modifying the same files repeatedly.
|
|
130
177
|
|
|
131
|
-
**Usage:**
|
|
132
178
|
```bash
|
|
133
|
-
agentbrain
|
|
179
|
+
agentbrain doom [options]
|
|
134
180
|
```
|
|
135
181
|
|
|
136
|
-
**Arguments:**
|
|
137
|
-
- `task-description` - Brief task description (e.g., "add user authentication")
|
|
138
|
-
|
|
139
182
|
**Options:**
|
|
140
|
-
- `--path <path>` - Repository path
|
|
183
|
+
- `--path <path>` - Repository path
|
|
184
|
+
- `--commits <n>` - Number of recent commits to analyze (default: 10)
|
|
185
|
+
- `--threshold <n>` - Minimum occurrences to flag (default: 4)
|
|
186
|
+
- `--json` - Output as JSON for programmatic use
|
|
141
187
|
|
|
142
|
-
**
|
|
143
|
-
The command guides you through 5 questions to create a comprehensive spec:
|
|
144
|
-
1. **Problem** - What problem does this solve? (1-2 sentences)
|
|
145
|
-
2. **Approach** - What's your approach or implementation idea? (or "not sure yet")
|
|
146
|
-
3. **Out of Scope** - What should the agent NOT touch or change?
|
|
147
|
-
4. **Done Criteria** - What does "done" look like? (acceptance criteria)
|
|
148
|
-
5. **Risks** - Any edge cases or risks to consider?
|
|
149
|
-
|
|
150
|
-
**Output:**
|
|
151
|
-
Creates `agentbrain/specs/{task-slug}.md` with:
|
|
152
|
-
- Problem statement
|
|
153
|
-
- Scope boundaries
|
|
154
|
-
- Acceptance criteria checklist
|
|
155
|
-
- Risks & edge cases
|
|
156
|
-
- Implementation notes (AI-generated using repository context)
|
|
157
|
-
- Task checklist (ordered by dependency)
|
|
158
|
-
|
|
159
|
-
**Automatic Injection:**
|
|
160
|
-
Injects spec reference into your agent files (CLAUDE.md, .cursorrules, .windsurfrules) so the agent reads the spec before implementing.
|
|
161
|
-
|
|
162
|
-
**Example:**
|
|
163
|
-
```bash
|
|
164
|
-
# Generate spec with interactive prompts
|
|
165
|
-
agentbrain spec "add OAuth authentication"
|
|
166
|
-
|
|
167
|
-
# The command will:
|
|
168
|
-
# 1. Ask 5 questions to gather requirements
|
|
169
|
-
# 2. Use repository context to generate implementation notes
|
|
170
|
-
# 3. Create agentbrain/specs/add-oauth-authentication.md
|
|
171
|
-
# 4. Inject "Active Spec" reference into agent files
|
|
172
|
-
# 5. Agent automatically reads spec at session start
|
|
188
|
+
**Example Output:**
|
|
173
189
|
```
|
|
190
|
+
Analyzing last 10 commits...
|
|
174
191
|
|
|
175
|
-
|
|
176
|
-
```markdown
|
|
177
|
-
# Spec: add OAuth authentication
|
|
192
|
+
⚠ Doom loop detected!
|
|
178
193
|
|
|
179
|
-
|
|
194
|
+
These files appear repeatedly:
|
|
195
|
+
apps/api/src/main.ts (9 times · 90%)
|
|
196
|
+
apps/api/src/auth.ts (6 times · 60%)
|
|
180
197
|
|
|
181
|
-
|
|
182
|
-
|
|
198
|
+
Suggestions:
|
|
199
|
+
→ Stop coding. Investigate root cause first.
|
|
200
|
+
→ Run: agentbrain spec "fix [problem description]"
|
|
201
|
+
```
|
|
183
202
|
|
|
184
|
-
|
|
185
|
-
|
|
203
|
+
**Automatic Detection:**
|
|
204
|
+
After commits, doom detection runs in the background. Warning shown on next command if detected.
|
|
186
205
|
|
|
187
|
-
|
|
188
|
-
- [ ] OAuth flow works with Google
|
|
189
|
-
- [ ] Tokens are stored securely
|
|
190
|
-
- [ ] Existing users can link OAuth accounts
|
|
206
|
+
---
|
|
191
207
|
|
|
192
|
-
|
|
193
|
-
- Token expiry handling
|
|
194
|
-
- Race conditions during OAuth callback
|
|
208
|
+
### `doctor` - Health Diagnostics
|
|
195
209
|
|
|
196
|
-
|
|
197
|
-
- Use existing auth middleware pattern from src/auth/
|
|
198
|
-
- Store OAuth tokens in encrypted user_credentials table
|
|
199
|
-
- Add OAuth callback route to existing auth router
|
|
200
|
-
- Follow repository's error handling pattern
|
|
210
|
+
Run health checks on your AgentBrain setup.
|
|
201
211
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
- [ ] Implement OAuth callback handler
|
|
205
|
-
- [ ] Create token storage schema
|
|
206
|
-
- [ ] Add OAuth middleware
|
|
207
|
-
- [ ] Update auth routes
|
|
208
|
-
- [ ] Write integration tests
|
|
212
|
+
```bash
|
|
213
|
+
agentbrain doctor [options]
|
|
209
214
|
```
|
|
210
215
|
|
|
211
|
-
**
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
// Agent automatically loads via injected reference
|
|
215
|
-
// Or manually via MCP:
|
|
216
|
-
load_spec({ repoPath: "/path/to/repo", task: "add-oauth-authentication" })
|
|
217
|
-
```
|
|
216
|
+
**Options:**
|
|
217
|
+
- `--path <path>` - Repository path
|
|
218
|
+
- `--json` - Output as JSON
|
|
218
219
|
|
|
219
|
-
**
|
|
220
|
+
**Checks:**
|
|
221
|
+
- ✓ Git repository status
|
|
222
|
+
- ✓ Context files exist and are valid
|
|
223
|
+
- ✓ Agent files are configured
|
|
224
|
+
- ✓ Git hooks installed correctly
|
|
225
|
+
- ✓ API configuration
|
|
220
226
|
|
|
221
|
-
**
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
227
|
+
**Use when:**
|
|
228
|
+
- Setup isn't working as expected
|
|
229
|
+
- Context generation fails
|
|
230
|
+
- Git hooks not firing
|
|
231
|
+
|
|
232
|
+
---
|
|
225
233
|
|
|
226
|
-
|
|
227
|
-
# (Injected into CLAUDE.md, .cursorrules, .windsurfrules)
|
|
234
|
+
### `status` - Auto-Update Status
|
|
228
235
|
|
|
229
|
-
|
|
230
|
-
# ... coding session ...
|
|
236
|
+
View status of background context updates.
|
|
231
237
|
|
|
232
|
-
|
|
233
|
-
|
|
238
|
+
```bash
|
|
239
|
+
agentbrain status [options]
|
|
234
240
|
```
|
|
235
241
|
|
|
242
|
+
**Options:**
|
|
243
|
+
- `--path <path>` - Repository path
|
|
244
|
+
|
|
245
|
+
**Shows:**
|
|
246
|
+
- Recent update history from `.agentbrain/update.log`
|
|
247
|
+
- Success/failure status
|
|
248
|
+
- Update duration
|
|
249
|
+
- Git hash for each update
|
|
250
|
+
|
|
236
251
|
---
|
|
237
252
|
|
|
238
|
-
### `
|
|
253
|
+
### `standards` - Generate Coding Standards
|
|
239
254
|
|
|
240
|
-
Generate coding standards
|
|
255
|
+
Generate coding standards documentation based on your codebase patterns.
|
|
241
256
|
|
|
242
|
-
**Usage:**
|
|
243
257
|
```bash
|
|
244
258
|
agentbrain standards [options]
|
|
245
259
|
```
|
|
246
260
|
|
|
247
261
|
**Options:**
|
|
248
|
-
- `--path <path>` - Repository path
|
|
262
|
+
- `--path <path>` - Repository path
|
|
249
263
|
|
|
250
|
-
**
|
|
251
|
-
- Primary language (e.g., TypeScript, Python)
|
|
252
|
-
- Framework (e.g., React, Django)
|
|
253
|
-
- Testing library (e.g., Jest, pytest)
|
|
254
|
-
- Style guide (e.g., Prettier + ESLint)
|
|
255
|
-
- Anti-patterns to avoid
|
|
256
|
-
- Architecture notes
|
|
257
|
-
- Target agents (Claude Code, Cursor, Windsurf)
|
|
258
|
-
|
|
259
|
-
**Output:**
|
|
260
|
-
Creates agent-specific files:
|
|
261
|
-
- `CLAUDE.md` - For Claude Code CLI
|
|
262
|
-
- `.cursorrules` - For Cursor (also supports legacy `.cursor/rules`)
|
|
263
|
-
- `.windsurfrules` - For Windsurf
|
|
264
|
-
|
|
265
|
-
**Example:**
|
|
266
|
-
```bash
|
|
267
|
-
agentbrain standards
|
|
268
|
-
# Follow the interactive prompts
|
|
269
|
-
```
|
|
264
|
+
**Creates:** `.agentbrain/standards.md`
|
|
270
265
|
|
|
271
|
-
**Cost:** ~$0.01-0.02
|
|
266
|
+
**Cost:** ~$0.01-0.02 per generation
|
|
272
267
|
|
|
273
268
|
---
|
|
274
269
|
|
|
275
|
-
### `
|
|
270
|
+
### `handoff` - Generate Session Handoff
|
|
276
271
|
|
|
277
|
-
Generate session handoff document
|
|
272
|
+
Generate session handoff document with recent changes and context.
|
|
278
273
|
|
|
279
|
-
**Usage:**
|
|
280
274
|
```bash
|
|
281
275
|
agentbrain handoff [options]
|
|
282
276
|
```
|
|
283
277
|
|
|
284
278
|
**Options:**
|
|
285
|
-
- `--path <path>` - Repository path
|
|
286
|
-
- `--goal <goal>` - Session goal
|
|
287
|
-
- `--commits <
|
|
288
|
-
|
|
289
|
-
**Output:**
|
|
290
|
-
Creates `agentbrain/handoff.md` with:
|
|
291
|
-
- Summary of changes
|
|
292
|
-
- Current state
|
|
293
|
-
- Context & decisions
|
|
294
|
-
- Next steps
|
|
295
|
-
- Blockers & questions
|
|
296
|
-
|
|
297
|
-
**Example:**
|
|
298
|
-
```bash
|
|
299
|
-
# After making changes
|
|
300
|
-
agentbrain handoff --goal "Implement user authentication"
|
|
279
|
+
- `--path <path>` - Repository path
|
|
280
|
+
- `--goal <goal>` - Session goal (optional)
|
|
281
|
+
- `--commits <n>` - Number of recent commits (default: 5)
|
|
301
282
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
283
|
+
**Creates:** `.agentbrain/handoff.md`
|
|
284
|
+
|
|
285
|
+
**Includes:**
|
|
286
|
+
- Recent changes summary
|
|
287
|
+
- Session context
|
|
288
|
+
- Next steps recommendations
|
|
289
|
+
- ⚠ Doom loop warning (if detected)
|
|
305
290
|
|
|
306
|
-
**Cost:** ~$0.01
|
|
291
|
+
**Cost:** ~$0.01-0.02 per generation
|
|
307
292
|
|
|
308
293
|
---
|
|
309
294
|
|
|
310
|
-
### `
|
|
295
|
+
### `config` - Configure API Settings
|
|
311
296
|
|
|
312
|
-
Configure
|
|
297
|
+
Configure AI provider API keys and settings.
|
|
313
298
|
|
|
314
|
-
**Usage:**
|
|
315
299
|
```bash
|
|
316
|
-
agentbrain config [options]
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
**Options:**
|
|
320
|
-
- `--show` - Display current configuration
|
|
321
|
-
|
|
322
|
-
**Example:**
|
|
323
|
-
```bash
|
|
324
|
-
# Set API key interactively
|
|
325
300
|
agentbrain config
|
|
326
|
-
|
|
327
|
-
# View current config
|
|
328
|
-
agentbrain config --show
|
|
329
301
|
```
|
|
330
302
|
|
|
331
|
-
**
|
|
332
|
-
-
|
|
333
|
-
-
|
|
303
|
+
**Interactive setup for:**
|
|
304
|
+
- Provider selection (OpenAI, Anthropic, or both)
|
|
305
|
+
- API key configuration
|
|
306
|
+
- Model selection
|
|
334
307
|
|
|
335
|
-
|
|
308
|
+
**Supports:**
|
|
309
|
+
- OpenAI (GPT-4, GPT-4 Turbo)
|
|
310
|
+
- Anthropic (Claude 3.5 Sonnet, Claude 3 Opus)
|
|
336
311
|
|
|
337
312
|
---
|
|
338
313
|
|
|
339
|
-
### `
|
|
314
|
+
### `disable` - Disable AgentBrain
|
|
340
315
|
|
|
341
|
-
Disable
|
|
316
|
+
Disable AgentBrain features in your repository.
|
|
342
317
|
|
|
343
|
-
**Usage:**
|
|
344
318
|
```bash
|
|
345
319
|
agentbrain disable [options]
|
|
346
320
|
```
|
|
347
321
|
|
|
348
322
|
**Options:**
|
|
349
|
-
- `--
|
|
350
|
-
- `--remove-
|
|
351
|
-
- `--remove-agent-files` - Remove agent
|
|
352
|
-
- `--full` - Complete uninstall (removes everything)
|
|
353
|
-
- `--yes` - Skip confirmation prompts
|
|
323
|
+
- `--path <path>` - Repository path
|
|
324
|
+
- `--remove-hooks` - Remove git hooks
|
|
325
|
+
- `--remove-agent-files` - Remove agent file modifications
|
|
354
326
|
|
|
355
|
-
**
|
|
356
|
-
|
|
327
|
+
**Use when:**
|
|
328
|
+
- Temporarily disabling automation
|
|
329
|
+
- Troubleshooting issues
|
|
330
|
+
- Removing AgentBrain from project
|
|
357
331
|
|
|
358
|
-
**
|
|
359
|
-
```bash
|
|
360
|
-
# Interactive mode - choose what to remove
|
|
361
|
-
agentbrain disable
|
|
332
|
+
**Note:** Does not delete `.agentbrain/` directory or context files.
|
|
362
333
|
|
|
363
|
-
|
|
364
|
-
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## MCP Integration
|
|
365
337
|
|
|
366
|
-
|
|
367
|
-
agentbrain disable --remove-files
|
|
338
|
+
AgentBrain provides a Model Context Protocol (MCP) server that enables AI agents to access repository intelligence directly.
|
|
368
339
|
|
|
369
|
-
|
|
370
|
-
|
|
340
|
+
**Install MCP Server:**
|
|
341
|
+
```bash
|
|
342
|
+
npm install -g @agentbrain/mcp-server
|
|
371
343
|
```
|
|
372
344
|
|
|
373
|
-
**
|
|
374
|
-
To re-enable AgentBrain after disabling, simply run `agentbrain setup` again.
|
|
345
|
+
**See:** [@agentbrain/mcp-server](https://www.npmjs.com/package/@agentbrain/mcp-server) for setup instructions.
|
|
375
346
|
|
|
376
|
-
|
|
347
|
+
**MCP Tools Include Doom Warnings:**
|
|
348
|
+
- `load_context` - Returns `doom_warning` field if loop detected
|
|
349
|
+
- `load_spec` - Returns `doom_warning` field if loop detected
|
|
350
|
+
- `save_handoff` - Appends doom section to handoff document
|
|
377
351
|
|
|
378
|
-
|
|
352
|
+
---
|
|
379
353
|
|
|
380
|
-
|
|
354
|
+
## Troubleshooting
|
|
381
355
|
|
|
382
|
-
###
|
|
356
|
+
### Context Not Regenerating on Commits
|
|
383
357
|
|
|
358
|
+
**Check git hooks:**
|
|
384
359
|
```bash
|
|
385
|
-
|
|
386
|
-
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
387
|
-
|
|
388
|
-
# OpenAI
|
|
389
|
-
export OPENAI_API_KEY="sk-..."
|
|
360
|
+
agentbrain doctor
|
|
390
361
|
```
|
|
391
362
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
Create a `.env` or `.env.local` file in your project:
|
|
395
|
-
|
|
363
|
+
**Verify hook is installed:**
|
|
396
364
|
```bash
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
EOF
|
|
365
|
+
cat .git/hooks/post-commit
|
|
366
|
+
# or for Husky:
|
|
367
|
+
cat .husky/post-commit
|
|
401
368
|
```
|
|
402
369
|
|
|
403
|
-
|
|
404
|
-
- `.env.local` in current directory
|
|
405
|
-
- `.env` in current directory
|
|
406
|
-
- `.env.local` in git repository root
|
|
407
|
-
- `.env` in git repository root
|
|
408
|
-
|
|
409
|
-
**Note:** `.env` files are loaded automatically - no need to export or source them!
|
|
410
|
-
|
|
411
|
-
### 3. Stored Configuration (Lowest Priority)
|
|
412
|
-
|
|
413
|
-
Use the `agentbrain config` command to store your key persistently:
|
|
414
|
-
|
|
370
|
+
**Reinstall hooks:**
|
|
415
371
|
```bash
|
|
416
|
-
agentbrain
|
|
372
|
+
agentbrain disable --remove-hooks
|
|
373
|
+
agentbrain setup
|
|
417
374
|
```
|
|
418
375
|
|
|
419
|
-
This stores the key securely at `~/.agentbrain/config.json` with 0600 permissions.
|
|
420
|
-
|
|
421
376
|
---
|
|
422
377
|
|
|
423
|
-
|
|
378
|
+
### Hook Errors After Commits
|
|
424
379
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
5. ✅ `.env` in git root
|
|
430
|
-
6. ✅ `~/.agentbrain/config.json`
|
|
431
|
-
|
|
432
|
-
## Usage with AI Agents
|
|
433
|
-
|
|
434
|
-
After running `agentbrain setup`, your agents automatically load context at every session start.
|
|
435
|
-
|
|
436
|
-
### Claude Code CLI
|
|
437
|
-
|
|
438
|
-
AgentBrain injects loading instructions into `CLAUDE.md`, which Claude Code CLI reads automatically from your project root. No manual action needed.
|
|
439
|
-
|
|
440
|
-
### Cursor
|
|
441
|
-
|
|
442
|
-
AgentBrain injects loading instructions into `.cursorrules` (or `.cursor/rules` for legacy setups), which Cursor reads automatically. No manual action needed.
|
|
380
|
+
**Check update log:**
|
|
381
|
+
```bash
|
|
382
|
+
cat .agentbrain/update.log
|
|
383
|
+
```
|
|
443
384
|
|
|
444
|
-
|
|
385
|
+
**Common issues:**
|
|
386
|
+
- API key not configured: Run `agentbrain config`
|
|
387
|
+
- Permission errors: Check file permissions on `.agentbrain/`
|
|
388
|
+
- Path issues: Hook uses fallback paths to find `agentbrain` binary
|
|
445
389
|
|
|
446
|
-
|
|
390
|
+
---
|
|
447
391
|
|
|
448
|
-
###
|
|
392
|
+
### Context Feels Stale
|
|
449
393
|
|
|
450
|
-
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
@agentbrain/context.md
|
|
454
|
-
@agentbrain/dependency-map.md
|
|
455
|
-
@agentbrain/patterns.md
|
|
394
|
+
**Force regeneration:**
|
|
395
|
+
```bash
|
|
396
|
+
agentbrain init --no-confirm
|
|
456
397
|
```
|
|
457
398
|
|
|
458
|
-
|
|
399
|
+
**Check cache:**
|
|
400
|
+
Cache is tied to git hash. If you haven't committed changes, old cache is used.
|
|
459
401
|
|
|
460
|
-
|
|
402
|
+
---
|
|
461
403
|
|
|
462
|
-
|
|
463
|
-
|-----------|--------|-----------|--------|
|
|
464
|
-
| Init (small) | 10-20K | $0.02-0.05 | $0.02-0.04 |
|
|
465
|
-
| Init (medium) | 30-50K | $0.08-0.15 | $0.07-0.12 |
|
|
466
|
-
| Spec | 3-5K | $0.01-0.02 | $0.01-0.02 |
|
|
467
|
-
| Standards | 5-8K | $0.01-0.02 | $0.01-0.02 |
|
|
468
|
-
| Handoff | 3-5K | $0.01 | $0.01 |
|
|
469
|
-
| **Cached repeat** | 0 | **$0.00** | **$0.00** |
|
|
404
|
+
### Doom Loop False Positives
|
|
470
405
|
|
|
471
|
-
**
|
|
406
|
+
**Adjust sensitivity:**
|
|
407
|
+
```bash
|
|
408
|
+
# Check last 15 commits, flag if file appears 6+ times
|
|
409
|
+
agentbrain doom --commits 15 --threshold 6
|
|
410
|
+
```
|
|
472
411
|
|
|
473
|
-
|
|
412
|
+
**Excluded patterns:**
|
|
413
|
+
- Lock files (package-lock.json, etc.)
|
|
414
|
+
- AgentBrain files (CLAUDE.md, .cursorrules, etc.)
|
|
415
|
+
- Markdown files
|
|
474
416
|
|
|
475
|
-
|
|
417
|
+
---
|
|
476
418
|
|
|
477
|
-
|
|
478
|
-
# 1. One-time setup (do once per repo)
|
|
479
|
-
cd /path/to/project
|
|
480
|
-
agentbrain setup
|
|
419
|
+
### API Costs Too High
|
|
481
420
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
421
|
+
**Smart regeneration already optimized:**
|
|
422
|
+
- Only regenerates on source file changes
|
|
423
|
+
- Skips docs/config updates
|
|
424
|
+
- Caches by git hash
|
|
486
425
|
|
|
487
|
-
|
|
488
|
-
|
|
426
|
+
**Further reduce costs:**
|
|
427
|
+
- Use `--skip-hooks` during development sprints
|
|
428
|
+
- Manually regenerate only when needed: `agentbrain init`
|
|
429
|
+
- Disable temporarily: `agentbrain disable`
|
|
489
430
|
|
|
490
|
-
|
|
491
|
-
```
|
|
431
|
+
---
|
|
492
432
|
|
|
493
|
-
###
|
|
433
|
+
### Husky Compatibility
|
|
494
434
|
|
|
495
|
-
|
|
496
|
-
# 1. Initial setup
|
|
497
|
-
cd /path/to/project
|
|
498
|
-
agentbrain config
|
|
435
|
+
AgentBrain detects and supports Husky automatically.
|
|
499
436
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
agentbrain init # Actually generate
|
|
437
|
+
**Husky v9+ (recommended):**
|
|
438
|
+
Hook installs directly to `.husky/post-commit`
|
|
503
439
|
|
|
504
|
-
|
|
505
|
-
|
|
440
|
+
**Custom hook paths:**
|
|
441
|
+
Detects `git config core.hooksPath` and installs there
|
|
506
442
|
|
|
507
|
-
|
|
508
|
-
# ... make changes ...
|
|
509
|
-
agentbrain handoff --goal "Add authentication feature"
|
|
443
|
+
**No conflicts:** AgentBrain hook runs alongside existing hooks
|
|
510
444
|
|
|
511
|
-
|
|
512
|
-
agentbrain init # Only costs money if git hash changed
|
|
513
|
-
```
|
|
445
|
+
---
|
|
514
446
|
|
|
515
|
-
##
|
|
447
|
+
## Files & Directories
|
|
516
448
|
|
|
517
|
-
###
|
|
449
|
+
### Generated Files
|
|
518
450
|
|
|
519
|
-
Set your API key:
|
|
520
|
-
```bash
|
|
521
|
-
agentbrain config
|
|
522
|
-
# or
|
|
523
|
-
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
524
451
|
```
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
452
|
+
.agentbrain/
|
|
453
|
+
├── context.md # Full repository intelligence
|
|
454
|
+
├── dependency-map.md # Service relationships
|
|
455
|
+
├── patterns.md # Coding patterns
|
|
456
|
+
├── standards.md # Coding standards (optional)
|
|
457
|
+
├── handoff.md # Session handoff (optional)
|
|
458
|
+
├── update.log # Auto-update history
|
|
459
|
+
└── specs/ # Task specifications
|
|
460
|
+
└── <task-slug>.md
|
|
531
461
|
```
|
|
532
462
|
|
|
533
|
-
###
|
|
463
|
+
### Agent Files (Modified)
|
|
534
464
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
npm config set prefix '~/.npm-global'
|
|
539
|
-
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
|
|
540
|
-
source ~/.bashrc
|
|
541
|
-
```
|
|
465
|
+
- `CLAUDE.md` - Claude Code loading instructions
|
|
466
|
+
- `.cursorrules` - Cursor loading instructions
|
|
467
|
+
- `.windsurfrules` - Windsurf loading instructions
|
|
542
468
|
|
|
543
|
-
|
|
469
|
+
### Git Hooks
|
|
544
470
|
|
|
545
|
-
|
|
471
|
+
- `.git/hooks/post-commit` - Standard installation
|
|
472
|
+
- `.husky/post-commit` - Husky installation
|
|
546
473
|
|
|
547
|
-
|
|
548
|
-
for project in ~/projects/*; do
|
|
549
|
-
echo "Processing $project..."
|
|
550
|
-
agentbrain init --path "$project"
|
|
551
|
-
done
|
|
552
|
-
```
|
|
474
|
+
---
|
|
553
475
|
|
|
554
|
-
|
|
476
|
+
## Best Practices
|
|
555
477
|
|
|
556
|
-
|
|
557
|
-
# In CI pipeline
|
|
558
|
-
export ANTHROPIC_API_KEY="${ANTHROPIC_KEY}"
|
|
559
|
-
agentbrain init --path . --no-cache
|
|
560
|
-
# Commit generated docs to repo
|
|
561
|
-
git add agentbrain/
|
|
562
|
-
git commit -m "Update context docs"
|
|
563
|
-
```
|
|
478
|
+
### When to Use AgentBrain
|
|
564
479
|
|
|
565
|
-
|
|
480
|
+
✅ **Good for:**
|
|
481
|
+
- Active development with AI assistants
|
|
482
|
+
- Onboarding new developers
|
|
483
|
+
- Complex codebases with multiple services
|
|
484
|
+
- Keeping AI agents in sync with changes
|
|
566
485
|
|
|
567
|
-
|
|
486
|
+
❌ **Skip if:**
|
|
487
|
+
- Early prototyping (context not stable yet)
|
|
488
|
+
- API costs are a major concern
|
|
489
|
+
- Repository is < 10 files
|
|
568
490
|
|
|
569
|
-
|
|
570
|
-
# For large repos, limit files
|
|
571
|
-
agentbrain init --max-files 50
|
|
491
|
+
### Workflow Tips
|
|
572
492
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
493
|
+
1. **Initial setup:** Run `agentbrain setup` once
|
|
494
|
+
2. **Let automation work:** Commits regenerate context automatically
|
|
495
|
+
3. **Check doom warnings:** If shown, investigate before continuing
|
|
496
|
+
4. **Use specs:** Plan complex tasks with `agentbrain spec`
|
|
497
|
+
5. **Handoff cleanly:** Generate handoff at session end
|
|
576
498
|
|
|
577
|
-
###
|
|
499
|
+
### Cost Management
|
|
578
500
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
501
|
+
- Initial setup: ~$0.02-0.05
|
|
502
|
+
- Auto-regeneration: ~$0.02-0.05 per commit (only on source changes)
|
|
503
|
+
- Specs: ~$0.01-0.03 each
|
|
504
|
+
- **Expected monthly cost:** $1-5 for typical projects
|
|
583
505
|
|
|
584
|
-
|
|
506
|
+
---
|
|
585
507
|
|
|
586
|
-
|
|
587
|
-
- [@agentbrain/mcp-server](../mcp-server) - MCP server for agents
|
|
508
|
+
## Links
|
|
588
509
|
|
|
589
|
-
|
|
510
|
+
- **npm:** https://www.npmjs.com/package/@agentbrain/cli
|
|
511
|
+
- **GitHub:** https://github.com/benmalcom/agentbrain
|
|
512
|
+
- **MCP Server:** https://www.npmjs.com/package/@agentbrain/mcp-server
|
|
513
|
+
- **Core Library:** https://www.npmjs.com/package/@agentbrain/core
|
|
590
514
|
|
|
591
|
-
|
|
592
|
-
- Documentation: [Full docs](https://github.com/benmalcom/agentbrain)
|
|
515
|
+
---
|
|
593
516
|
|
|
594
517
|
## License
|
|
595
518
|
|
|
596
|
-
MIT
|
|
519
|
+
MIT © AgentBrain
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doom.d.ts","sourceRoot":"","sources":["../../src/commands/doom.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC,wBAAgB,iBAAiB,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"doom.d.ts","sourceRoot":"","sources":["../../src/commands/doom.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAInC,wBAAgB,iBAAiB,IAAI,OAAO,CAoE3C"}
|
package/dist/commands/doom.js
CHANGED
|
@@ -8,11 +8,20 @@ export function createDoomCommand() {
|
|
|
8
8
|
.option('--path <path>', 'Repository path', process.cwd())
|
|
9
9
|
.option('--commits <number>', 'Number of commits to analyze', '10')
|
|
10
10
|
.option('--threshold <number>', 'Threshold for doom loop detection', '4')
|
|
11
|
+
.option('--json', 'Output results as JSON')
|
|
11
12
|
.action(async (options) => {
|
|
12
|
-
const { path, commits, threshold } = options;
|
|
13
|
-
|
|
13
|
+
const { path, commits, threshold, json } = options;
|
|
14
|
+
if (!json) {
|
|
15
|
+
console.log(chalk.blue.bold('\n🧠 AgentBrain\n'));
|
|
16
|
+
}
|
|
14
17
|
try {
|
|
15
18
|
const result = await analyzeDoomLoop(path, parseInt(commits), parseInt(threshold));
|
|
19
|
+
// JSON output mode
|
|
20
|
+
if (json) {
|
|
21
|
+
console.log(JSON.stringify(result, null, 2));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
// Human-readable output mode
|
|
16
25
|
if (result.detected) {
|
|
17
26
|
console.log(chalk.yellow.bold('⚠ Possible doom loop detected\n'));
|
|
18
27
|
console.log(`These files were modified ${threshold}+ times in the last ${result.commitsAnalyzed} commits:\n`);
|
|
@@ -32,13 +41,18 @@ export function createDoomCommand() {
|
|
|
32
41
|
}
|
|
33
42
|
}
|
|
34
43
|
catch (error) {
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
if (json) {
|
|
45
|
+
console.error(JSON.stringify({ error: error instanceof Error ? error.message : 'Unknown error' }));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
if (error instanceof Error) {
|
|
49
|
+
if (error.message.includes('Not a git repository')) {
|
|
50
|
+
console.error(chalk.red('✗ Error: Not a git repository'));
|
|
51
|
+
console.error(chalk.gray('Run this command from a git repository\n'));
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
console.error(chalk.red('✗ Error:'), error.message, '\n');
|
|
55
|
+
}
|
|
42
56
|
}
|
|
43
57
|
}
|
|
44
58
|
process.exit(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doom.js","sourceRoot":"","sources":["../../src/commands/doom.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,UAAU,iBAAiB;IAC/B,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;SAC7B,WAAW,CAAC,iEAAiE,CAAC;SAC9E,MAAM,CAAC,eAAe,EAAE,iBAAiB,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;SACzD,MAAM,CAAC,oBAAoB,EAAE,8BAA8B,EAAE,IAAI,CAAC;SAClE,MAAM,CAAC,sBAAsB,EAAE,mCAAmC,EAAE,GAAG,CAAC;SACxE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"doom.js","sourceRoot":"","sources":["../../src/commands/doom.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,UAAU,iBAAiB;IAC/B,M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CAAC,CAAC,CAAA;wBACzD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC,CAAA;oBACvE,CAAC;yBAAM,CAAC;wBACN,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;oBAC3D,CAAC;gBACH,CAAC;YACH,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;IACH,CAAC,CAAC,CAAA;IAEJ,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// AgentBrain CLI entry point
|
|
3
3
|
import { Command } from 'commander';
|
|
4
|
+
import { checkPendingDoomWarning } from '@agentbrain/core';
|
|
4
5
|
import { createConfigCommand } from './commands/config.js';
|
|
5
6
|
import { createInitCommand } from './commands/init.js';
|
|
6
7
|
import { createStandardsCommand } from './commands/standards.js';
|
|
@@ -15,7 +16,20 @@ const program = new Command();
|
|
|
15
16
|
program
|
|
16
17
|
.name('agentbrain')
|
|
17
18
|
.description('Generate smart context docs for coding agents')
|
|
18
|
-
.version('1.4.
|
|
19
|
+
.version('1.4.33')
|
|
20
|
+
.hook('preAction', async () => {
|
|
21
|
+
// Check for pending doom warnings before every command
|
|
22
|
+
try {
|
|
23
|
+
const warning = await checkPendingDoomWarning(process.cwd());
|
|
24
|
+
if (warning) {
|
|
25
|
+
// Write to stderr so it doesn't interfere with command output
|
|
26
|
+
console.error('\n' + warning);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// Silently ignore errors (e.g., not in a git repo)
|
|
31
|
+
}
|
|
32
|
+
});
|
|
19
33
|
// Add commands
|
|
20
34
|
program.addCommand(createSetupCommand());
|
|
21
35
|
program.addCommand(createInitCommand());
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,6BAA6B;AAE7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEtD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;AAE7B,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CAAC,+CAA+C,CAAC;KAC5D,OAAO,CAAC,QAAQ,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,6BAA6B;AAE7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,oB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