@aladac/hu 0.1.0-a1
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/.tool-versions +1 -0
- package/CLAUDE.md +122 -0
- package/HOOKS-DATA-INTEGRATION.md +457 -0
- package/SAMPLE.md +378 -0
- package/TODO.md +25 -0
- package/biome.json +51 -0
- package/commands/bootstrap.md +13 -0
- package/commands/c.md +1 -0
- package/commands/check-name.md +62 -0
- package/commands/disk.md +141 -0
- package/commands/docs/archive.md +27 -0
- package/commands/docs/check-internal.md +53 -0
- package/commands/docs/cleanup.md +65 -0
- package/commands/docs/consolidate.md +72 -0
- package/commands/docs/get.md +101 -0
- package/commands/docs/list.md +61 -0
- package/commands/docs/sync.md +64 -0
- package/commands/docs/update.md +49 -0
- package/commands/plans/clear.md +23 -0
- package/commands/plans/create.md +71 -0
- package/commands/plans/list.md +21 -0
- package/commands/plans/sync.md +38 -0
- package/commands/reinstall.md +20 -0
- package/commands/replicate.md +303 -0
- package/commands/warp.md +0 -0
- package/doc/README.md +35 -0
- package/doc/claude-code/capabilities.md +202 -0
- package/doc/claude-code/directory-structure.md +246 -0
- package/doc/claude-code/hooks.md +348 -0
- package/doc/claude-code/overview.md +109 -0
- package/doc/claude-code/plugins.md +273 -0
- package/doc/claude-code/sdk-protocols.md +202 -0
- package/document-manifest.toml +29 -0
- package/justfile +39 -0
- package/package.json +33 -0
- package/plans/compiled-watching-feather.md +217 -0
- package/plans/crispy-crafting-pnueli.md +103 -0
- package/plans/greedy-booping-coral.md +146 -0
- package/plans/imperative-sleeping-flamingo.md +192 -0
- package/plans/jaunty-sprouting-marble.md +171 -0
- package/plans/jiggly-discovering-lake.md +68 -0
- package/plans/magical-nibbling-spark.md +144 -0
- package/plans/mellow-kindling-acorn.md +110 -0
- package/plans/recursive-questing-engelbart.md +65 -0
- package/plans/serialized-roaming-kernighan.md +227 -0
- package/plans/structured-wondering-wirth.md +230 -0
- package/plans/vectorized-dreaming-iverson.md +191 -0
- package/plans/velvety-enchanting-ocean.md +92 -0
- package/plans/wiggly-sparking-pixel.md +48 -0
- package/plans/zippy-shimmying-fox.md +188 -0
- package/plugins/installed_plugins.json +4 -0
- package/sample-hooks.json +298 -0
- package/settings.json +24 -0
- package/settings.local.json +7 -0
- package/src/commands/bump.ts +130 -0
- package/src/commands/disk.ts +419 -0
- package/src/commands/docs.ts +729 -0
- package/src/commands/plans.ts +259 -0
- package/src/commands/utils.ts +299 -0
- package/src/index.ts +26 -0
- package/src/lib/colors.ts +87 -0
- package/src/lib/exec.ts +25 -0
- package/src/lib/fs.ts +119 -0
- package/src/lib/html.ts +205 -0
- package/src/lib/spinner.ts +42 -0
- package/src/types/index.ts +61 -0
- package/tests/lib/colors.test.ts +69 -0
- package/tests/lib/fs.test.ts +65 -0
- package/tsconfig.json +20 -0
- package/vitest.config.ts +15 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
Diagnose a reported issue and identify code areas to investigate.
|
|
2
|
+
|
|
3
|
+
Arguments: $ARGUMENTS
|
|
4
|
+
|
|
5
|
+
## Phase 1: Parse the Issue
|
|
6
|
+
|
|
7
|
+
Extract from the user's description:
|
|
8
|
+
- **Environment**: URL, event slug, environment (dev/staging/prod)
|
|
9
|
+
- **Issue**: What's broken (pricing mismatch, availability wrong, display error)
|
|
10
|
+
- **Steps to Reproduce**: User actions that trigger the issue
|
|
11
|
+
- **Expected vs Actual**: What should happen vs what happens
|
|
12
|
+
- **Specific values**: Package IDs, hotel IDs, guest counts, prices mentioned
|
|
13
|
+
|
|
14
|
+
If details are missing, ask for clarification.
|
|
15
|
+
|
|
16
|
+
## Phase 2: Generate TEST.md
|
|
17
|
+
|
|
18
|
+
Create `./TEST.md` with diagnostic commands using the jam CLI tool.
|
|
19
|
+
|
|
20
|
+
**Template:**
|
|
21
|
+
```markdown
|
|
22
|
+
# Test Plan: [Issue Title]
|
|
23
|
+
|
|
24
|
+
## Issue Summary
|
|
25
|
+
[One paragraph from user's description]
|
|
26
|
+
|
|
27
|
+
## Test Parameters
|
|
28
|
+
- Event: {slug}
|
|
29
|
+
- Package ID: {id}
|
|
30
|
+
- Hotel IDs: {ids}
|
|
31
|
+
- Guest counts to test: {n1, n2, ...}
|
|
32
|
+
|
|
33
|
+
## Diagnostic Commands
|
|
34
|
+
|
|
35
|
+
### 1. Landing Page Data
|
|
36
|
+
jam landing {event} --json | jq '.data.packages[] | select(.id == {pkg}) | {name, min_prices_by_occupancy}'
|
|
37
|
+
|
|
38
|
+
### 2. Hotel Search (for each guest count)
|
|
39
|
+
jam hotel-search -e {event} -p {pkg} -t {n} --json | jq '.data[] | {hotel_id, name, booking_source, min_price_per_person}' | head -20
|
|
40
|
+
|
|
41
|
+
### 3. Specific Hotel Details
|
|
42
|
+
jam hotel-details -e {event} -p {pkg} -h {hotel} -t {n} --json | jq '.data.rooms[] | {room_id, room_name, min_price, min_price_with_mandatory_fees}'
|
|
43
|
+
|
|
44
|
+
### 4. Pricing Confirmation
|
|
45
|
+
jam pricing -e {event} -p {pkg} -h {hotel} -t {n} --json | jq '.data.room | {price, mandatory_fees_total}'
|
|
46
|
+
|
|
47
|
+
### 5. Full Flow with Validation
|
|
48
|
+
jam run -e {event} -p {pkg} -t {n} --validate-prices -v
|
|
49
|
+
|
|
50
|
+
## Expected vs Actual
|
|
51
|
+
| Metric | Expected | Actual | Source |
|
|
52
|
+
|--------|----------|--------|--------|
|
|
53
|
+
| Package card price (N guests) | $X | $Y | landing.min_prices_by_occupancy |
|
|
54
|
+
| Hotel page min price | $X | $Y | hotel-search min |
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Tell the user: **"Run the commands in TEST.md and paste the results here, or I can run them if you prefer."**
|
|
58
|
+
|
|
59
|
+
## Phase 3: Analyze Results
|
|
60
|
+
|
|
61
|
+
When user provides output:
|
|
62
|
+
|
|
63
|
+
1. **Compare values** - Find discrepancies between expected and actual
|
|
64
|
+
2. **Identify pattern** - Match to known issue types (see Reference below)
|
|
65
|
+
3. **Update FINDINGS.md** with:
|
|
66
|
+
- Data tables showing expected vs actual
|
|
67
|
+
- Root cause hypothesis
|
|
68
|
+
- Verification commands
|
|
69
|
+
|
|
70
|
+
## Phase 4: Output Code to Investigate
|
|
71
|
+
|
|
72
|
+
Based on findings, output specific file paths:
|
|
73
|
+
|
|
74
|
+
```markdown
|
|
75
|
+
## Investigation Summary
|
|
76
|
+
|
|
77
|
+
**Issue:** [One line description]
|
|
78
|
+
**Root Cause Hypothesis:** [What's likely causing this]
|
|
79
|
+
|
|
80
|
+
**Files to Check (in priority order):**
|
|
81
|
+
1. `app/path/to/file.rb:method_name` - [Why]
|
|
82
|
+
2. `app/path/to/file.rb` - [Why]
|
|
83
|
+
|
|
84
|
+
**Cache/DB to Verify:**
|
|
85
|
+
- Redis key: `{key_pattern}`
|
|
86
|
+
- SQL: `SELECT ... FROM packages WHERE id = {id}`
|
|
87
|
+
|
|
88
|
+
**Next Steps:**
|
|
89
|
+
1. [Specific action]
|
|
90
|
+
2. [Specific action]
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
# Reference: System Architecture
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
User Browser (fuseignited-landing)
|
|
99
|
+
↓ API calls
|
|
100
|
+
fuseignited-cms (Rails + Grape API)
|
|
101
|
+
↓ inventory requests
|
|
102
|
+
fuse-hotel (Python FastAPI)
|
|
103
|
+
↓ provider calls
|
|
104
|
+
External Providers (Hotelbeds, Priceline, etc.)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Booking Flow Stages
|
|
108
|
+
|
|
109
|
+
| Stage | Frontend Route | CMS Endpoint | JAM Command |
|
|
110
|
+
|-------|----------------|--------------|-------------|
|
|
111
|
+
| 1. Landing | `/events/{slug}` | GET /api/v1/landing/{slug} | `jam landing {slug} --json` |
|
|
112
|
+
| 2. Tickets | `/booking/tickets` | (landing data) | `jam tickets -e {slug}` |
|
|
113
|
+
| 3. Hotel Search | `/booking/hotels` | GET /api/v1/hotels/search | `jam hotel-search -e {slug} -p {pkg} -t {n}` |
|
|
114
|
+
| 4. Availability | Hotel list | GET /api/v1/prices/hotel-availability | `jam hotel-availability -e {slug} -h {hotel} -t {n}` |
|
|
115
|
+
| 5. Room Select | Room modal | GET /api/v1/hotels/hotel-details | `jam hotel-details -e {slug} -h {hotel} -t {n}` |
|
|
116
|
+
| 6. Pricing | Room select | GET /api/v1/prices/pricing-confirmation | `jam pricing -e {slug} -h {hotel} -t {n}` |
|
|
117
|
+
| 7. Addons | `/booking/add-ons` | GET /events/{slug}/{pkg}/addons | `jam packages {pkg} addons` |
|
|
118
|
+
| 8. Calculate | `/booking/order-details` | POST /api/v1/prices/calculate-order | `jam calculate -e {slug} -h {hotel} -t {n}` |
|
|
119
|
+
| 9. Insurance | `/booking/review-and-pay` | POST /api/v1/insurance/quote | `jam insurance -e {slug} --total {amount}` |
|
|
120
|
+
| 10. Booking | Checkout | POST /api/v1/booking | `jam book -e {slug} -h {hotel} --booking` |
|
|
121
|
+
|
|
122
|
+
## Key Data Structures
|
|
123
|
+
|
|
124
|
+
### min_prices_by_occupancy (Package Card Pricing)
|
|
125
|
+
Location: `.data.packages[].min_prices_by_occupancy` (array indexed by occupancy-1)
|
|
126
|
+
```json
|
|
127
|
+
{"occupancy": 3, "price_on_offer": 211.13, "mandatory_fees_total": 0, "booking_source": "external"}
|
|
128
|
+
```
|
|
129
|
+
**Code:** `app/serializers/api/package_serializer.rb`, `app/services/pricing/*`
|
|
130
|
+
**Cache:** Redis key `package_array_hash_min_prices_{package_id}`
|
|
131
|
+
|
|
132
|
+
### Hotel Search Response
|
|
133
|
+
```json
|
|
134
|
+
{"hotel_id": 3777, "name": "Dev test hotel", "booking_source": "internal", "min_price_per_person": 99.54, "sold_out": false}
|
|
135
|
+
```
|
|
136
|
+
**Code:** `app/controllers/api/v1/hotels.rb`, `app/services/inventory_services/hotels/*`
|
|
137
|
+
|
|
138
|
+
### Room Pricing Response
|
|
139
|
+
```json
|
|
140
|
+
{"room_id": 123, "min_price": 260.00, "min_price_with_mandatory_fees": 290.00, "mandatory_fees_total": 30.00}
|
|
141
|
+
```
|
|
142
|
+
**Code:** `app/controllers/api/v1/prices.rb`, `app/services/inventory_services/hotels/availability_service.rb`
|
|
143
|
+
|
|
144
|
+
## Issue Type → Code Location
|
|
145
|
+
|
|
146
|
+
| Issue Type | Primary Files to Check |
|
|
147
|
+
|------------|------------------------|
|
|
148
|
+
| Package min price wrong | `app/serializers/api/package_serializer.rb`, `app/services/pricing/*` |
|
|
149
|
+
| Landing page data | `app/controllers/api/v1/landing.rb`, `app/serializers/api/landing_serializer.rb` |
|
|
150
|
+
| Hotel search/filter | `app/controllers/api/v1/hotels.rb` |
|
|
151
|
+
| Hotel availability | `app/services/inventory_services/hotels/availability_service.rb` |
|
|
152
|
+
| Price calculation | `app/controllers/api/v1/prices.rb` |
|
|
153
|
+
| External inventory | `app/services/inventory_services/hotels/gateway_v3.rb` |
|
|
154
|
+
| Caching/stale data | Redis keys, `Rails.cache` calls in services |
|
|
155
|
+
| Fees/resort fees | `app/services/inventory_services/hotels/*` fee handling |
|
|
156
|
+
|
|
157
|
+
## Common Issue Patterns
|
|
158
|
+
|
|
159
|
+
### Package Card ≠ Hotel Page Price
|
|
160
|
+
**Symptom:** Package card shows $211, hotel page shows $31
|
|
161
|
+
**Root Cause:** `min_prices_by_occupancy` cached/stale data
|
|
162
|
+
```bash
|
|
163
|
+
jam landing {event} --json | jq '.data.packages[] | select(.id == {pkg}) | .min_prices_by_occupancy'
|
|
164
|
+
jam hotel-search -e {event} -p {pkg} -t {n} --json | jq '.data | sort_by(.min_price_per_person) | .[0]'
|
|
165
|
+
```
|
|
166
|
+
**Check:** `app/serializers/api/package_serializer.rb`, Redis cache staleness, cache invalidation triggers
|
|
167
|
+
|
|
168
|
+
### Internal Hotels Not Considered
|
|
169
|
+
**Symptom:** Cheapest internal hotel not reflected in min price
|
|
170
|
+
```bash
|
|
171
|
+
jam hotel-search -e {event} -p {pkg} -t {n} --json | jq '.data[] | {hotel_id, name, booking_source, min_price_per_person}'
|
|
172
|
+
```
|
|
173
|
+
**Check:** `app/services/inventory_services/hotels/*` filtering logic
|
|
174
|
+
|
|
175
|
+
### External Hotel Stale/No Rooms
|
|
176
|
+
**Symptom:** External hotel in cached price has no availability
|
|
177
|
+
```bash
|
|
178
|
+
jam hotel-details -e {event} -h {hotel} -t {n} --json
|
|
179
|
+
jam inventory availability -h {hotel_id}
|
|
180
|
+
```
|
|
181
|
+
**Check:** `InventoryServices::Hotels::GatewayV3`, fuse-hotel caching
|
|
182
|
+
|
|
183
|
+
### Mandatory Fees Missing
|
|
184
|
+
**Symptom:** Price doesn't include resort fees
|
|
185
|
+
```bash
|
|
186
|
+
jam pricing -e {event} -h {hotel} -t {n} --json | jq '.data.room | {price, mandatory_fees_total}'
|
|
187
|
+
```
|
|
188
|
+
**Check:** `app/services/inventory_services/hotels/availability_service.rb`
|
|
189
|
+
|
|
190
|
+
## Investigation Methodology
|
|
191
|
+
|
|
192
|
+
1. **Compare cached vs live data** - Is `min_prices_by_occupancy` stale?
|
|
193
|
+
2. **Check by occupancy** - Does behavior change at different guest counts?
|
|
194
|
+
3. **Internal vs external** - Are both hotel types being considered?
|
|
195
|
+
4. **Mandatory fees** - Are fees included consistently?
|
|
196
|
+
5. **Cache invalidation** - What triggers a refresh?
|
|
197
|
+
|
|
198
|
+
### Key Questions to Answer
|
|
199
|
+
- Where is `min_prices_by_occupancy` calculated?
|
|
200
|
+
- When is it refreshed? On-demand or cached?
|
|
201
|
+
- Does it query all hotels or a subset?
|
|
202
|
+
- Are hotels with no availability excluded?
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
# JAM CLI Reference
|
|
207
|
+
|
|
208
|
+
## Installation
|
|
209
|
+
```bash
|
|
210
|
+
pip install -e /Users/chi/Projects/jam
|
|
211
|
+
jam init # Creates ~/.config/jam/settings.json
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Environments
|
|
215
|
+
| Flag | URL |
|
|
216
|
+
|------|-----|
|
|
217
|
+
| `--local` | http://localhost:3000 |
|
|
218
|
+
| `-E dev` (default) | https://cms.dev.jampack.com |
|
|
219
|
+
| `-E prod` | https://api.jampack.com |
|
|
220
|
+
|
|
221
|
+
## Core Commands
|
|
222
|
+
|
|
223
|
+
### Full Booking Flow
|
|
224
|
+
```bash
|
|
225
|
+
jam run -e <event-slug> # Stop at order summary
|
|
226
|
+
jam run -e <event-slug> --booking # Create actual booking
|
|
227
|
+
jam run -e <event-slug> --validate-prices # Check price consistency
|
|
228
|
+
jam run -e <event-slug> --compare-inventory # Compare CMS vs inventory API
|
|
229
|
+
jam run -e <event-slug> --save # Save request/response JSON
|
|
230
|
+
jam run -e <event-slug> -p 1024 -h 2200 # Specific package/hotel
|
|
231
|
+
jam test-all -e <event-slug> # Test all combinations
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Events & Landing
|
|
235
|
+
```bash
|
|
236
|
+
jam events # List all test events
|
|
237
|
+
jam landing <slug> # Landing page data
|
|
238
|
+
jam landing <slug> --json # Raw JSON output
|
|
239
|
+
jam packages -e <event> # List packages
|
|
240
|
+
jam packages <id> tickets # Package ticket details
|
|
241
|
+
jam packages <id> addons # Package addons
|
|
242
|
+
jam tickets -e <event> # List ticket types
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Hotels
|
|
246
|
+
```bash
|
|
247
|
+
jam hotels -e <event> -p <package> # List available hotels
|
|
248
|
+
jam hotel-search -e <event> -p <pkg> -t <n> # Search with params
|
|
249
|
+
jam hotel-availability -e <event> -h <id> # Check availability
|
|
250
|
+
jam hotel-details -e <event> -h <id> -t <n> # Room details
|
|
251
|
+
jam validate-hotels -e <event> # Test all hotels
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Pricing & Calculation
|
|
255
|
+
```bash
|
|
256
|
+
jam pricing -e <event> -h <hotel-id> -t <n>
|
|
257
|
+
jam calculate -e <event> -h <hotel-id> -t <n>
|
|
258
|
+
jam calculate -e <event> --no-hotel # Ticket-only
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Inventory (Direct API to fuse-hotel)
|
|
262
|
+
```bash
|
|
263
|
+
jam inventory availability -h <hotel-id>
|
|
264
|
+
jam inventory availability --hotel-ids 2200,2306
|
|
265
|
+
jam inventory check-rate -h <hotel-id> -r <room-type-id> -k <rate-key>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Authentication
|
|
269
|
+
```bash
|
|
270
|
+
jam auth # Get JWT token
|
|
271
|
+
jam auth -e <event> -p <password> # Password-protected event
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## Common Options
|
|
275
|
+
| Option | Description |
|
|
276
|
+
|--------|-------------|
|
|
277
|
+
| `-e, --event` | Event slug |
|
|
278
|
+
| `-E, --env` | Environment (local, dev, prod) |
|
|
279
|
+
| `-p, --package-id` | Package ID |
|
|
280
|
+
| `-h, --hotel-id` | Hotel ID |
|
|
281
|
+
| `-t, --travellers` | Number of travellers |
|
|
282
|
+
| `--json` | Raw JSON output |
|
|
283
|
+
| `-v, --verbose` | Debug output |
|
|
284
|
+
|
|
285
|
+
## Test Events
|
|
286
|
+
| Slug | Type | Notes |
|
|
287
|
+
|------|------|-------|
|
|
288
|
+
| `single-page-checkout-test-event` | flexible | General testing |
|
|
289
|
+
| `flexible-tickets-and-hotel-testing` | flexible | Internal hotel testing |
|
|
290
|
+
| `sep-flexible-event` | flexible | Default event |
|
|
291
|
+
| `e2e-jampack-mandatory-fees-dev` | regular | Fee testing |
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
# Related Codebases
|
|
296
|
+
|
|
297
|
+
| Path | Purpose |
|
|
298
|
+
|------|---------|
|
|
299
|
+
| `/Users/chi/Projects/fuseignited-cms` | Main CMS/API |
|
|
300
|
+
| `/Users/chi/Projects/jam` | Testing CLI |
|
|
301
|
+
| `/Users/chi/Projects/fuse-hotel` | Hotel inventory service |
|
|
302
|
+
| `/Users/chi/Projects/fuseignited-landing` | Frontend |
|
|
303
|
+
| `/Users/chi/Projects/fuse-config` | Backoffice (JamForge) |
|
package/commands/warp.md
ADDED
|
File without changes
|
package/doc/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Documentation
|
|
2
|
+
|
|
3
|
+
Reference documentation fetched from the web.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
doc/
|
|
7
|
+
├── README.md
|
|
8
|
+
└── claude-code/
|
|
9
|
+
├── overview.md # Overview, installation, quick start
|
|
10
|
+
├── capabilities.md # CLI commands, flags, agents
|
|
11
|
+
├── plugins.md # Plugin creation, structure, marketplace
|
|
12
|
+
├── hooks.md # Hook events, configuration, examples
|
|
13
|
+
├── directory-structure.md # ~/.claude directory layout, formats
|
|
14
|
+
└── sdk-protocols.md # Agent SDK, MCP, ACP protocols
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Claude Code
|
|
18
|
+
|
|
19
|
+
| Document | Description |
|
|
20
|
+
|----------|-------------|
|
|
21
|
+
| [Overview](claude-code/overview.md) | What Claude Code does, installation, platform support |
|
|
22
|
+
| [Capabilities](claude-code/capabilities.md) | CLI reference, flags, custom subagents |
|
|
23
|
+
| [Plugins](claude-code/plugins.md) | Creating, installing, and publishing plugins |
|
|
24
|
+
| [Hooks](claude-code/hooks.md) | Hook events, settings configuration, examples |
|
|
25
|
+
| [Directory Structure](claude-code/directory-structure.md) | ~/.claude layout, session formats, backup strategies |
|
|
26
|
+
| [SDK & Protocols](claude-code/sdk-protocols.md) | Agent SDK, MCP, ACP - the underlying protocols |
|
|
27
|
+
|
|
28
|
+
## Adding Documentation
|
|
29
|
+
|
|
30
|
+
Use the `/docs:get` command:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
/docs:get "topic name" # Saves to ./doc/topic-name.md
|
|
34
|
+
/docs:get "topic name" category # Saves to ./doc/category/topic-name.md
|
|
35
|
+
```
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: https://code.claude.com/docs/en/cli-reference
|
|
3
|
+
fetched: 2026-01-13
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Claude Code Capabilities
|
|
7
|
+
|
|
8
|
+
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows—all through natural language commands.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# MacOS/Linux
|
|
14
|
+
curl -fsSL https://claude.ai/install.sh | bash
|
|
15
|
+
|
|
16
|
+
# Homebrew (MacOS)
|
|
17
|
+
brew install --cask claude-code
|
|
18
|
+
|
|
19
|
+
# Windows
|
|
20
|
+
irm https://claude.ai/install.ps1 | iex
|
|
21
|
+
|
|
22
|
+
# NPM (requires Node.js 18+)
|
|
23
|
+
npm install -g @anthropic-ai/claude-code
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## CLI Commands
|
|
27
|
+
|
|
28
|
+
| Command | Description | Example |
|
|
29
|
+
|---------|-------------|---------|
|
|
30
|
+
| `claude` | Start interactive REPL | `claude` |
|
|
31
|
+
| `claude "query"` | Start REPL with initial prompt | `claude "explain this project"` |
|
|
32
|
+
| `claude -p "query"` | Query via SDK, then exit | `claude -p "explain this function"` |
|
|
33
|
+
| `cat file \| claude -p "query"` | Process piped content | `cat logs.txt \| claude -p "explain"` |
|
|
34
|
+
| `claude -c` | Continue most recent conversation | `claude -c` |
|
|
35
|
+
| `claude -c -p "query"` | Continue via SDK | `claude -c -p "Check for type errors"` |
|
|
36
|
+
| `claude -r "<session>" "query"` | Resume session by ID or name | `claude -r "auth-refactor" "Finish this PR"` |
|
|
37
|
+
| `claude update` | Update to latest version | `claude update` |
|
|
38
|
+
| `claude mcp` | Configure MCP servers | See MCP documentation |
|
|
39
|
+
|
|
40
|
+
## Core Capabilities
|
|
41
|
+
|
|
42
|
+
### Terminal & IDE Integration
|
|
43
|
+
- Works in terminal, VS Code, Cursor, and other IDEs
|
|
44
|
+
- Run multiple instances in parallel on different parts of your codebase
|
|
45
|
+
- Tag @claude on GitHub for PR reviews and issue assistance
|
|
46
|
+
|
|
47
|
+
### Codebase Understanding
|
|
48
|
+
- Contextual awareness of your project structure
|
|
49
|
+
- Explain complex code and architecture
|
|
50
|
+
- Search and navigate large codebases
|
|
51
|
+
|
|
52
|
+
### Task Execution
|
|
53
|
+
- Execute routine coding tasks
|
|
54
|
+
- Handle git workflows through natural language
|
|
55
|
+
- Automate common development workflows
|
|
56
|
+
|
|
57
|
+
## CLI Flags <!-- updated: 2026-01-13 -->
|
|
58
|
+
|
|
59
|
+
### Core Execution
|
|
60
|
+
|
|
61
|
+
| Flag | Description | Example |
|
|
62
|
+
|------|-------------|---------|
|
|
63
|
+
| `--print`, `-p` | Print response without interactive mode | `claude -p "query"` |
|
|
64
|
+
| `--continue`, `-c` | Load most recent conversation | `claude --continue` |
|
|
65
|
+
| `--resume`, `-r` | Resume specific session by ID or name | `claude --resume auth-refactor` |
|
|
66
|
+
| `--session-id` | Use specific session ID (valid UUID) | `claude --session-id "550e8400-..."` |
|
|
67
|
+
| `--fork-session` | Create new session instead of reusing original | `claude --resume abc123 --fork-session` |
|
|
68
|
+
|
|
69
|
+
### Model & Agent Configuration
|
|
70
|
+
|
|
71
|
+
| Flag | Description | Example |
|
|
72
|
+
|------|-------------|---------|
|
|
73
|
+
| `--model` | Set model (`sonnet`, `opus`, or full name) | `claude --model opus` |
|
|
74
|
+
| `--agent` | Specify agent for current session (overrides `agent` setting) | `claude --agent my-custom-agent` |
|
|
75
|
+
| `--agents` | Define custom subagents via JSON | See agents section below |
|
|
76
|
+
| `--fallback-model` | Fallback model when overloaded (print mode) | `claude -p --fallback-model sonnet "query"` |
|
|
77
|
+
| `--betas` | Beta headers for API requests (API key users only) | `claude --betas interleaved-thinking` |
|
|
78
|
+
|
|
79
|
+
### System Prompt Customization
|
|
80
|
+
|
|
81
|
+
| Flag | Description | Mode |
|
|
82
|
+
|------|-------------|------|
|
|
83
|
+
| `--system-prompt` | Replace entire default prompt | Interactive + Print |
|
|
84
|
+
| `--system-prompt-file` | Replace with file contents | Print only |
|
|
85
|
+
| `--append-system-prompt` | Append to default prompt (recommended) | Interactive + Print |
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Replace entire system prompt
|
|
89
|
+
claude --system-prompt "You are a Python expert"
|
|
90
|
+
|
|
91
|
+
# Load from file
|
|
92
|
+
claude -p --system-prompt-file ./prompts/review.txt "Review this PR"
|
|
93
|
+
|
|
94
|
+
# Append to default (recommended)
|
|
95
|
+
claude --append-system-prompt "Always use TypeScript"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Note:** `--system-prompt` and `--system-prompt-file` are mutually exclusive. For most use cases, `--append-system-prompt` is recommended as it preserves Claude Code's built-in capabilities.
|
|
99
|
+
|
|
100
|
+
### Tool & Permission Management
|
|
101
|
+
|
|
102
|
+
| Flag | Description |
|
|
103
|
+
|------|-------------|
|
|
104
|
+
| `--tools` | Restrict which built-in tools Claude can use (`""` for none, `"default"` for all, or specific tools like `"Bash,Edit,Read"`) |
|
|
105
|
+
| `--allowedTools` | Tools that execute without prompting |
|
|
106
|
+
| `--disallowedTools` | Tools removed from context |
|
|
107
|
+
| `--dangerously-skip-permissions` | Skip permission prompts (use with caution) |
|
|
108
|
+
| `--permission-mode` | Begin in specified permission mode |
|
|
109
|
+
| `--permission-prompt-tool` | MCP tool to handle permission prompts in non-interactive mode |
|
|
110
|
+
|
|
111
|
+
### Directory & File Configuration
|
|
112
|
+
|
|
113
|
+
| Flag | Description |
|
|
114
|
+
|------|-------------|
|
|
115
|
+
| `--add-dir` | Add additional working directories (validates each path) |
|
|
116
|
+
| `--settings` | Path to settings JSON file or JSON string |
|
|
117
|
+
| `--setting-sources` | Comma-separated list: `user`, `project`, `local` |
|
|
118
|
+
| `--plugin-dir` | Load plugins from directories (repeatable) |
|
|
119
|
+
|
|
120
|
+
### MCP Configuration
|
|
121
|
+
|
|
122
|
+
| Flag | Description |
|
|
123
|
+
|------|-------------|
|
|
124
|
+
| `--mcp-config` | Load MCP servers from JSON files or strings (space-separated) |
|
|
125
|
+
| `--strict-mcp-config` | Only use MCP servers from `--mcp-config`, ignore all others |
|
|
126
|
+
|
|
127
|
+
### Input/Output Formatting
|
|
128
|
+
|
|
129
|
+
| Flag | Description | Options |
|
|
130
|
+
|------|-------------|---------|
|
|
131
|
+
| `--output-format` | Output format for print mode | `text`, `json`, `stream-json` |
|
|
132
|
+
| `--input-format` | Input format for print mode | `text`, `stream-json` |
|
|
133
|
+
| `--json-schema` | Get validated JSON output matching schema | Print mode only |
|
|
134
|
+
| `--include-partial-messages` | Include partial streaming events | Requires `--print` and `--output-format=stream-json` |
|
|
135
|
+
|
|
136
|
+
### Advanced Options
|
|
137
|
+
|
|
138
|
+
| Flag | Description |
|
|
139
|
+
|------|-------------|
|
|
140
|
+
| `--max-turns` | Limit agentic turns (print mode). Exits with error when reached |
|
|
141
|
+
| `--chrome` | Enable Chrome browser integration for web automation |
|
|
142
|
+
| `--no-chrome` | Disable Chrome browser integration |
|
|
143
|
+
| `--ide` | Auto-connect to IDE on startup if exactly one valid IDE available |
|
|
144
|
+
| `--debug` | Enable debug mode with optional category filtering (e.g., `"api,hooks"`) |
|
|
145
|
+
| `--verbose` | Enable verbose logging, shows full turn-by-turn output |
|
|
146
|
+
| `--version`, `-v` | Output version number |
|
|
147
|
+
|
|
148
|
+
## Custom Subagents
|
|
149
|
+
|
|
150
|
+
Define custom agents with the `--agents` flag:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
claude --agents '{
|
|
154
|
+
"code-reviewer": {
|
|
155
|
+
"description": "Expert code reviewer. Use proactively after code changes.",
|
|
156
|
+
"prompt": "You are a senior code reviewer. Focus on code quality, security, and best practices.",
|
|
157
|
+
"tools": ["Read", "Grep", "Glob", "Bash"],
|
|
158
|
+
"model": "sonnet"
|
|
159
|
+
},
|
|
160
|
+
"debugger": {
|
|
161
|
+
"description": "Debugging specialist for errors and test failures.",
|
|
162
|
+
"prompt": "You are an expert debugger. Analyze errors, identify root causes, and provide fixes."
|
|
163
|
+
}
|
|
164
|
+
}'
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Agent Fields
|
|
168
|
+
|
|
169
|
+
| Field | Required | Description |
|
|
170
|
+
|-------|----------|-------------|
|
|
171
|
+
| `description` | Yes | When the subagent should be invoked |
|
|
172
|
+
| `prompt` | Yes | System prompt for the subagent |
|
|
173
|
+
| `tools` | No | Specific tools (inherits all if omitted) |
|
|
174
|
+
| `model` | No | Model: `sonnet`, `opus`, or `haiku` |
|
|
175
|
+
|
|
176
|
+
## Extensibility
|
|
177
|
+
|
|
178
|
+
### Hooks
|
|
179
|
+
Shell commands that execute at lifecycle points:
|
|
180
|
+
- **PreToolUse**: Before tool execution
|
|
181
|
+
- **PostToolUse**: After tool completion
|
|
182
|
+
- **Notification**: When Claude sends notifications
|
|
183
|
+
- **Stop**: When Claude finishes responding
|
|
184
|
+
|
|
185
|
+
### MCP (Model Context Protocol)
|
|
186
|
+
Claude Code functions as both MCP server and client. Connect to MCP servers via `.mcp.json` for team-wide tool access.
|
|
187
|
+
|
|
188
|
+
### Custom Commands
|
|
189
|
+
Store prompt templates in `.claude/commands/` as Markdown files. Access via `/` slash commands.
|
|
190
|
+
|
|
191
|
+
### Plugins
|
|
192
|
+
Install plugins from the marketplace for extended functionality.
|
|
193
|
+
|
|
194
|
+
## Resources
|
|
195
|
+
|
|
196
|
+
- [Official Documentation](https://code.claude.com/docs/en/overview)
|
|
197
|
+
- [Chrome Extension](https://code.claude.com/docs/en/chrome)
|
|
198
|
+
- [Interactive Mode](https://code.claude.com/docs/en/interactive-mode)
|
|
199
|
+
- [Slash Commands](https://code.claude.com/docs/en/slash-commands)
|
|
200
|
+
- [Settings](https://code.claude.com/docs/en/settings)
|
|
201
|
+
- [SDK Documentation](https://docs.claude.com/en/docs/agent-sdk)
|
|
202
|
+
- [GitHub Repository](https://github.com/anthropics/claude-code)
|