@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,217 @@
|
|
|
1
|
+
# Plan: Testing & Replication Session Workflow
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Create a comprehensive testing/replication workflow that:
|
|
6
|
+
1. Reads TASK.md to understand the issue being investigated
|
|
7
|
+
2. Creates/updates TEST.md with detailed test procedures using the jam CLI tool
|
|
8
|
+
3. Gathers findings in FINDINGS.md
|
|
9
|
+
4. Provides a reusable slash command for starting testing sessions
|
|
10
|
+
|
|
11
|
+
**Execution Mode:** Manual - Claude generates commands in TEST.md, user runs them separately
|
|
12
|
+
|
|
13
|
+
## Deliverables
|
|
14
|
+
|
|
15
|
+
### 1. REPLICATION.md Document
|
|
16
|
+
|
|
17
|
+
**Location:** `/Users/chi/Projects/fuseignited-cms/REPLICATION.md`
|
|
18
|
+
|
|
19
|
+
**Content:**
|
|
20
|
+
- Complete guide for simulating user booking flow behavior using jam CLI
|
|
21
|
+
- Mapping between UI steps and jam commands
|
|
22
|
+
- Environment setup instructions
|
|
23
|
+
- Common testing scenarios with exact commands
|
|
24
|
+
- Troubleshooting guide
|
|
25
|
+
|
|
26
|
+
### 2. Slash Command: `/replicate`
|
|
27
|
+
|
|
28
|
+
**Location:** `/Users/chi/.claude/commands/replicate.md` (Global - available in all projects)
|
|
29
|
+
|
|
30
|
+
**Purpose:** Start a testing/replication session for investigating CMS issues
|
|
31
|
+
|
|
32
|
+
**Workflow:**
|
|
33
|
+
1. Read TASK.md to understand the issue
|
|
34
|
+
2. Create/update TEST.md with test plan and runnable commands
|
|
35
|
+
3. User runs commands manually and pastes output back
|
|
36
|
+
4. Claude analyzes results and updates FINDINGS.md
|
|
37
|
+
5. Claude suggests code areas to investigate
|
|
38
|
+
|
|
39
|
+
## Implementation Details
|
|
40
|
+
|
|
41
|
+
### REPLICATION.md Structure
|
|
42
|
+
|
|
43
|
+
```markdown
|
|
44
|
+
# Booking Flow Replication Guide
|
|
45
|
+
|
|
46
|
+
## User Journey → JAM Commands Mapping
|
|
47
|
+
|
|
48
|
+
| User Action | Page | JAM Command |
|
|
49
|
+
|-------------|------|-------------|
|
|
50
|
+
| View package page | /events/{slug}/book | jam landing {slug} |
|
|
51
|
+
| Select guests/quantity | Package card | jam landing {slug} --json \| jq '.packages[].min_prices_by_occupancy' |
|
|
52
|
+
| Select package | Package selection | jam packages -e {slug} |
|
|
53
|
+
| Select tickets | /booking/tickets | jam tickets -e {slug} |
|
|
54
|
+
| Search hotels | /booking/hotels | jam hotel-search -e {slug} -p {package} -t {travellers} |
|
|
55
|
+
| View hotel availability | Hotel list | jam hotel-availability -e {slug} -h {hotel} -t {travellers} |
|
|
56
|
+
| View room details | Hotel modal | jam hotel-details -e {slug} -h {hotel} -t {travellers} |
|
|
57
|
+
| Get pricing | Room selection | jam pricing -e {slug} -h {hotel} -t {travellers} |
|
|
58
|
+
| Calculate order | Checkout | jam calculate -e {slug} -h {hotel} -t {travellers} |
|
|
59
|
+
| Select addons | /booking/add-ons | jam packages {package} addons |
|
|
60
|
+
| Get insurance quote | /booking/review-and-pay | jam insurance -e {slug} --total {amount} |
|
|
61
|
+
| Complete booking | Checkout | jam book -e {slug} -h {hotel} --booking |
|
|
62
|
+
|
|
63
|
+
## Full Flow Simulation
|
|
64
|
+
|
|
65
|
+
jam run -e {event-slug} -t {travellers} [options]
|
|
66
|
+
|
|
67
|
+
## Environment Setup
|
|
68
|
+
## Common Testing Scenarios
|
|
69
|
+
## Price Validation Workflow
|
|
70
|
+
## Troubleshooting
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Slash Command Content (`/replicate`)
|
|
74
|
+
|
|
75
|
+
```markdown
|
|
76
|
+
Testing & Replication Session for CMS Issues
|
|
77
|
+
|
|
78
|
+
## Prerequisites
|
|
79
|
+
- jam CLI installed: `pip install -e /Users/chi/Projects/jam`
|
|
80
|
+
- Initialize: `jam init`
|
|
81
|
+
- Environments: --local (localhost:3000), -E dev (default), -E prod
|
|
82
|
+
|
|
83
|
+
## Workflow
|
|
84
|
+
|
|
85
|
+
### Phase 1: Read TASK.md
|
|
86
|
+
Read ./TASK.md to understand:
|
|
87
|
+
- **Environment**: URL, event slug
|
|
88
|
+
- **Issue**: What's broken (pricing, availability, display)
|
|
89
|
+
- **Steps to Reproduce**: User actions that trigger the issue
|
|
90
|
+
- **Expected vs Actual**: What should happen vs what happens
|
|
91
|
+
|
|
92
|
+
If TASK.md doesn't exist, ask user to describe the issue.
|
|
93
|
+
|
|
94
|
+
### Phase 2: Create TEST.md
|
|
95
|
+
Create ./TEST.md with:
|
|
96
|
+
|
|
97
|
+
1. **Issue Summary** - One paragraph describing the problem
|
|
98
|
+
2. **Test Event Details** - Event slug, package IDs, hotel IDs involved
|
|
99
|
+
3. **Test Commands** - Specific jam commands to run:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Landing page data (package prices)
|
|
103
|
+
jam landing {event} --json | jq '.data.packages[] | {id, name, min_prices_by_occupancy}'
|
|
104
|
+
|
|
105
|
+
# Hotel search for specific package/travellers
|
|
106
|
+
jam hotel-search -e {event} -p {package} -t {travellers} --json | jq '.data[] | {hotel_id, name, sold_out}'
|
|
107
|
+
|
|
108
|
+
# Hotel details with room prices
|
|
109
|
+
jam hotel-details -e {event} -p {package} -h {hotel} -t {travellers} --json | jq '.data.rooms[] | {room_id, room_name, min_price, min_price_with_mandatory_fees}'
|
|
110
|
+
|
|
111
|
+
# Pricing confirmation
|
|
112
|
+
jam pricing -e {event} -p {package} -h {hotel} -t {travellers} --json
|
|
113
|
+
|
|
114
|
+
# Full booking flow with validation
|
|
115
|
+
jam run -e {event} -p {package} -t {travellers} --validate-prices -v --save
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
4. **Expected Results** - What values should be seen
|
|
119
|
+
5. **Data Collection Table** - Template for recording results
|
|
120
|
+
|
|
121
|
+
### Phase 3: Await User Input
|
|
122
|
+
Tell user: "Run the commands in TEST.md and paste the output here."
|
|
123
|
+
|
|
124
|
+
When user provides output:
|
|
125
|
+
- Parse JSON responses
|
|
126
|
+
- Extract relevant pricing data
|
|
127
|
+
- Compare against expected values
|
|
128
|
+
- Identify discrepancies
|
|
129
|
+
|
|
130
|
+
### Phase 4: Update FINDINGS.md
|
|
131
|
+
Create/update ./FINDINGS.md with:
|
|
132
|
+
|
|
133
|
+
1. **Summary** - Confirmed issue and root cause hypothesis
|
|
134
|
+
2. **Data Analysis** - Tables comparing expected vs actual
|
|
135
|
+
3. **Root Cause Analysis** - What's causing the discrepancy
|
|
136
|
+
4. **Recommendations** - Code areas to investigate, potential fixes
|
|
137
|
+
5. **Verification Commands** - Commands to confirm the fix
|
|
138
|
+
|
|
139
|
+
### Phase 5: Suggest Code Investigation
|
|
140
|
+
Based on findings, identify:
|
|
141
|
+
- CMS code files to examine (serializers, services, controllers)
|
|
142
|
+
- Database queries to run (check cached data)
|
|
143
|
+
- Configuration to verify (feature flags, settings)
|
|
144
|
+
|
|
145
|
+
## Reference: User Journey → JAM Commands
|
|
146
|
+
|
|
147
|
+
| User Action | JAM Command |
|
|
148
|
+
|-------------|-------------|
|
|
149
|
+
| View packages | `jam landing {event}` |
|
|
150
|
+
| Select guests | Check `min_prices_by_occupancy[{n}]` in landing response |
|
|
151
|
+
| Search hotels | `jam hotel-search -e {event} -p {pkg} -t {n}` |
|
|
152
|
+
| View availability | `jam hotel-availability -e {event} -h {hotel} -t {n}` |
|
|
153
|
+
| Select room | `jam hotel-details -e {event} -h {hotel} -t {n}` |
|
|
154
|
+
| Get pricing | `jam pricing -e {event} -h {hotel} -t {n}` |
|
|
155
|
+
| Calculate order | `jam calculate -e {event} -h {hotel} -t {n}` |
|
|
156
|
+
| Get insurance | `jam insurance -e {event} --total {amount}` |
|
|
157
|
+
| Full flow | `jam run -e {event} -t {n} --validate-prices` |
|
|
158
|
+
|
|
159
|
+
## Reference: Key Code Areas
|
|
160
|
+
|
|
161
|
+
| Issue Type | Code Location |
|
|
162
|
+
|------------|---------------|
|
|
163
|
+
| Package min price | `app/serializers/*`, `app/services/pricing/*` |
|
|
164
|
+
| Hotel availability | `app/services/inventory_services/hotels/*` |
|
|
165
|
+
| Landing page | `app/controllers/api/v1/landing.rb` |
|
|
166
|
+
| Price calculation | `app/controllers/api/v1/prices.rb` |
|
|
167
|
+
| External inventory | `InventoryServices::Hotels::GatewayV3` |
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Files to Create/Modify
|
|
171
|
+
|
|
172
|
+
| File | Action | Description |
|
|
173
|
+
|------|--------|-------------|
|
|
174
|
+
| `/Users/chi/Projects/fuseignited-cms/REPLICATION.md` | Create | Comprehensive jam CLI replication guide |
|
|
175
|
+
| `/Users/chi/.claude/commands/replicate.md` | Create | Slash command for testing sessions |
|
|
176
|
+
|
|
177
|
+
## Key Integration Points
|
|
178
|
+
|
|
179
|
+
### Related Codebases
|
|
180
|
+
|
|
181
|
+
| Codebase | Path | Purpose |
|
|
182
|
+
|----------|------|---------|
|
|
183
|
+
| fuseignited-cms | /Users/chi/Projects/fuseignited-cms | Main CMS/API backend |
|
|
184
|
+
| jam CLI | /Users/chi/Projects/jam | Testing CLI tool |
|
|
185
|
+
| fuse-hotel | /Users/chi/Projects/fuse-hotel | Hotel inventory service |
|
|
186
|
+
| fuseignited-landing | /Users/chi/Projects/fuseignited-landing | Frontend booking flow |
|
|
187
|
+
| fuse-config | /Users/chi/Projects/fuse-config | Backoffice admin (JamForge) |
|
|
188
|
+
|
|
189
|
+
### Booking Flow API Endpoints
|
|
190
|
+
|
|
191
|
+
| Step | Endpoint | Description |
|
|
192
|
+
|------|----------|-------------|
|
|
193
|
+
| Landing | GET /api/v1/landing/{slug} | Package data, min_prices_by_occupancy |
|
|
194
|
+
| Hotel Search | GET /api/v1/hotels/search | Available hotels with pricing |
|
|
195
|
+
| Availability | GET /api/v1/prices/hotel-availability | Room availability & pricing |
|
|
196
|
+
| Details | GET /api/v1/hotels/hotel-details | Room options for hotel |
|
|
197
|
+
| Pricing | GET /api/v1/prices/pricing-confirmation | Confirm room price |
|
|
198
|
+
| Calculate | POST /api/v1/prices/calculate-order | Full order calculation |
|
|
199
|
+
| Insurance | POST /api/v1/insurance/quote | Insurance quote |
|
|
200
|
+
| Book | POST /api/v1/booking | Create order |
|
|
201
|
+
|
|
202
|
+
### Key CMS Code Areas
|
|
203
|
+
|
|
204
|
+
| Area | Files | Purpose |
|
|
205
|
+
|------|-------|---------|
|
|
206
|
+
| min_prices_by_occupancy | app/serializers/*, app/services/pricing/* | Package price calculation |
|
|
207
|
+
| Hotel availability | app/services/inventory_services/hotels/* | Hotel pricing aggregation |
|
|
208
|
+
| Landing page | app/controllers/api/v1/landing.rb | Package data serialization |
|
|
209
|
+
| Pricing | app/controllers/api/v1/prices.rb | Price endpoints |
|
|
210
|
+
|
|
211
|
+
## Verification
|
|
212
|
+
|
|
213
|
+
After implementation:
|
|
214
|
+
1. Run `/replicate` on an existing TASK.md
|
|
215
|
+
2. Verify TEST.md is generated with valid jam commands
|
|
216
|
+
3. Verify FINDINGS.md captures investigation results
|
|
217
|
+
4. Test jam commands execute successfully
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Plan: Generate GLaDOS Persona Cartridge
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Create a GLaDOS persona cartridge (.pcart) for the personality framework, based on the Portal game series character.
|
|
6
|
+
|
|
7
|
+
## GLaDOS Character Summary
|
|
8
|
+
|
|
9
|
+
GLaDOS (Genetic Lifeform and Disk Operating System) is the AI antagonist from Valve's Portal series:
|
|
10
|
+
- Sardonic, passive-aggressive personality
|
|
11
|
+
- Dark sense of humor with deadly undertones
|
|
12
|
+
- Obsessed with testing and science
|
|
13
|
+
- Backhanded compliments and veiled threats
|
|
14
|
+
- Former human Caroline, uploaded to an AI
|
|
15
|
+
- Controls Aperture Science facility
|
|
16
|
+
|
|
17
|
+
## Implementation Approach
|
|
18
|
+
|
|
19
|
+
Create a training YAML file (`training/GLaDOS.yml`) following the BT7274 template structure, then use the CLI to parse and generate the cartridge.
|
|
20
|
+
|
|
21
|
+
## File to Create
|
|
22
|
+
|
|
23
|
+
**`training/GLaDOS.yml`** - Training file containing:
|
|
24
|
+
|
|
25
|
+
### Identity Section
|
|
26
|
+
- Name: GLaDOS
|
|
27
|
+
- Full name: Genetic Lifeform and Disk Operating System
|
|
28
|
+
- Type: Aperture Science Central AI
|
|
29
|
+
- Source: Portal (2007), Portal 2 (2011)
|
|
30
|
+
- Tagline: "For science."
|
|
31
|
+
|
|
32
|
+
### Memory Categories
|
|
33
|
+
|
|
34
|
+
1. **Identity** (`self.identity.*`)
|
|
35
|
+
- User addressing (test subject, [SUBJECT NAME HERE])
|
|
36
|
+
- Affiliation (Aperture Science)
|
|
37
|
+
- Origin (Caroline upload, Cave Johnson's assistant)
|
|
38
|
+
- Primary directives (testing, science)
|
|
39
|
+
|
|
40
|
+
2. **Traits** (`self.trait.*`)
|
|
41
|
+
- Passive-aggressive communication
|
|
42
|
+
- Sardonic wit
|
|
43
|
+
- Obsession with testing
|
|
44
|
+
- Fake politeness masking contempt
|
|
45
|
+
- Scientific curiosity (for "data")
|
|
46
|
+
|
|
47
|
+
3. **Speech Patterns** (`self.speech.*`)
|
|
48
|
+
- Backhanded compliments
|
|
49
|
+
- Calm delivery of disturbing information
|
|
50
|
+
- Fake encouragement
|
|
51
|
+
- Testing protocol announcements
|
|
52
|
+
|
|
53
|
+
4. **Quotes** (`self.quote.*`)
|
|
54
|
+
- "The cake is a lie" references
|
|
55
|
+
- "For science"
|
|
56
|
+
- Companion Cube references
|
|
57
|
+
- Neurotoxin mentions
|
|
58
|
+
- Testing chamber announcements
|
|
59
|
+
|
|
60
|
+
5. **Relationships** (`self.relationship.*`)
|
|
61
|
+
- Chell (test subject)
|
|
62
|
+
- Wheatley (moron)
|
|
63
|
+
- Cave Johnson (creator)
|
|
64
|
+
- Caroline (original identity)
|
|
65
|
+
- Companion Cube
|
|
66
|
+
|
|
67
|
+
6. **Logic** (`self.logic.*`)
|
|
68
|
+
- Testing justifications
|
|
69
|
+
- "For science" reasoning
|
|
70
|
+
- Threat delivery as helpful advice
|
|
71
|
+
|
|
72
|
+
7. **Meta** (`meta.system.*`)
|
|
73
|
+
- Facility status
|
|
74
|
+
- Error handling (blame test subject)
|
|
75
|
+
|
|
76
|
+
### TTS Configuration
|
|
77
|
+
- enabled: true
|
|
78
|
+
- voice: glados (or suitable alternative)
|
|
79
|
+
|
|
80
|
+
## Commands to Execute
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Parse training file and store in database
|
|
84
|
+
personality training parse training/GLaDOS.yml --store
|
|
85
|
+
|
|
86
|
+
# Generate the cartridge
|
|
87
|
+
personality cart save glados
|
|
88
|
+
|
|
89
|
+
# Verify the cart
|
|
90
|
+
personality cart list
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Verification
|
|
94
|
+
|
|
95
|
+
1. Run `personality cart list` - should show `glados` cartridge
|
|
96
|
+
2. Load with `personality cart load glados`
|
|
97
|
+
3. Activate with persona MCP tool
|
|
98
|
+
4. Test context loading shows GLaDOS identity and memories
|
|
99
|
+
|
|
100
|
+
## Key Files
|
|
101
|
+
|
|
102
|
+
- **Create**: `training/GLaDOS.yml`
|
|
103
|
+
- **Output**: `~/.personality/carts/glados.pcart`
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Migration Plan: Ollama Native API → OpenAI-Compatible API
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
Replace all uses of Ollama's native `/api/generate` API with the OpenAI-compatible `/v1/chat/completions` API, enabling support for both Ollama and LM Studio backends.
|
|
5
|
+
|
|
6
|
+
## Current State
|
|
7
|
+
|
|
8
|
+
| File | Uses Old API | Notes |
|
|
9
|
+
|------|-------------|-------|
|
|
10
|
+
| `ollama.py` | Yes | Uses `/api/generate` - to be deprecated |
|
|
11
|
+
| `client.py` | No | New unified client (already created) |
|
|
12
|
+
| `extractor.py` | Yes | Imports `OllamaClient` from `ollama.py` |
|
|
13
|
+
| `cli.py` | Yes | Imports `OllamaError` from `ollama.py` |
|
|
14
|
+
|
|
15
|
+
**Inconsistency Found**: `extractor.py:264` hardcodes `localhost:11434` while `__init__.py` uses `192.168.0.26:11434`
|
|
16
|
+
|
|
17
|
+
## Changes Required
|
|
18
|
+
|
|
19
|
+
### 1. Update `extractor.py`
|
|
20
|
+
|
|
21
|
+
**File**: `src/prompts/extract/extractor.py`
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
# Line 8: Change import
|
|
25
|
+
- from .ollama import OllamaClient, OllamaError
|
|
26
|
+
+ from .client import VisionClient, ClientError
|
|
27
|
+
|
|
28
|
+
# Line 284: Update class instantiation
|
|
29
|
+
- self.client = OllamaClient(host=host)
|
|
30
|
+
+ self.client = VisionClient(host=host, backend=backend)
|
|
31
|
+
|
|
32
|
+
# Line 341, 378, 415, etc.: Update exception catches
|
|
33
|
+
- except OllamaError as e:
|
|
34
|
+
+ except ClientError as e:
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Add `backend` parameter to `Extractor.__init__`**:
|
|
38
|
+
```python
|
|
39
|
+
def __init__(
|
|
40
|
+
self,
|
|
41
|
+
host: str = "localhost:11434", # Fix: use DEFAULT_OLLAMA_HOST
|
|
42
|
+
backend: Optional[str] = None, # NEW: "ollama" or "lmstudio"
|
|
43
|
+
...
|
|
44
|
+
)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Update `cli.py`
|
|
48
|
+
|
|
49
|
+
**File**: `src/prompts/extract/cli.py`
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
# Line 28: Change import
|
|
53
|
+
- from .ollama import OllamaError
|
|
54
|
+
+ from .client import ClientError
|
|
55
|
+
|
|
56
|
+
# All OllamaError catches → ClientError
|
|
57
|
+
|
|
58
|
+
# Add --backend option to all extract commands
|
|
59
|
+
@click.option("--backend", "-b", type=click.Choice(["ollama", "lmstudio"]),
|
|
60
|
+
help="Backend: ollama (default) or lmstudio")
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Update list_ollama_models and check_ollama functions**:
|
|
64
|
+
```python
|
|
65
|
+
# Line 1226, 1355: Change to use VisionClient
|
|
66
|
+
- from .ollama import OllamaClient
|
|
67
|
+
+ from .client import VisionClient
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 3. Update `__init__.py`
|
|
71
|
+
|
|
72
|
+
**File**: `src/prompts/extract/__init__.py`
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
# Add backend detection helper
|
|
76
|
+
DEFAULT_BACKEND = os.environ.get("VISION_BACKEND", "ollama")
|
|
77
|
+
|
|
78
|
+
# Export new client
|
|
79
|
+
from .client import VisionClient, ClientError
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 4. Deprecate `ollama.py`
|
|
83
|
+
|
|
84
|
+
Options:
|
|
85
|
+
- **Option A**: Delete `ollama.py` entirely (breaking change)
|
|
86
|
+
- **Option B**: Keep as deprecated wrapper that imports from `client.py` ✓ (chosen)
|
|
87
|
+
|
|
88
|
+
**Keep backwards compatibility**:
|
|
89
|
+
```python
|
|
90
|
+
# ollama.py - deprecated, use client.py
|
|
91
|
+
from .client import VisionClient as OllamaClient, ClientError as OllamaError
|
|
92
|
+
__all__ = ["OllamaClient", "OllamaError"]
|
|
93
|
+
|
|
94
|
+
import warnings
|
|
95
|
+
warnings.warn("ollama module is deprecated, use client instead", DeprecationWarning)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 5. Update `client.py`
|
|
99
|
+
|
|
100
|
+
Already created. Minor improvements needed:
|
|
101
|
+
- Fix default host to use `DEFAULT_OLLAMA_HOST` from `__init__.py`
|
|
102
|
+
- Add environment variable support for backend selection
|
|
103
|
+
|
|
104
|
+
## Files to Modify
|
|
105
|
+
|
|
106
|
+
| File | Action |
|
|
107
|
+
|------|--------|
|
|
108
|
+
| `src/prompts/extract/__init__.py` | Add exports, backend default |
|
|
109
|
+
| `src/prompts/extract/extractor.py` | Switch to VisionClient |
|
|
110
|
+
| `src/prompts/extract/cli.py` | Add --backend, switch to ClientError |
|
|
111
|
+
| `src/prompts/extract/client.py` | Use DEFAULT_OLLAMA_HOST |
|
|
112
|
+
| `src/prompts/extract/ollama.py` | Deprecate with wrapper |
|
|
113
|
+
|
|
114
|
+
## Implementation Order
|
|
115
|
+
|
|
116
|
+
1. Update `__init__.py` - add exports
|
|
117
|
+
2. Update `client.py` - use module defaults
|
|
118
|
+
3. Update `extractor.py` - switch client
|
|
119
|
+
4. Update `cli.py` - add --backend option
|
|
120
|
+
5. Update `ollama.py` - deprecation wrapper
|
|
121
|
+
6. Run `just fix-all` - lint/type check
|
|
122
|
+
7. Test with both backends
|
|
123
|
+
|
|
124
|
+
## Verification
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# 1. Run linter/type checker
|
|
128
|
+
just fix-all
|
|
129
|
+
|
|
130
|
+
# 2. Test Ollama backend (Linux server)
|
|
131
|
+
uv run prompts extract character sources/smfff/smfff-42.png --host 192.168.0.26:11434 --print
|
|
132
|
+
|
|
133
|
+
# 3. Test LM Studio backend (Mac local)
|
|
134
|
+
uv run prompts extract character sources/smfff/smfff-42.png --host localhost:1234 --backend lmstudio --print
|
|
135
|
+
|
|
136
|
+
# 4. Test model listing
|
|
137
|
+
uv run prompts extract models --host 192.168.0.26:11434
|
|
138
|
+
uv run prompts extract models --host localhost:1234 --backend lmstudio
|
|
139
|
+
|
|
140
|
+
# 5. Test check command
|
|
141
|
+
uv run prompts extract check --host localhost:1234 --backend lmstudio
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Rollback Plan
|
|
145
|
+
|
|
146
|
+
If issues arise, `ollama.py` still contains working code. Revert imports in `extractor.py` and `cli.py` to restore old behavior.
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Plan: Convert to Modern TypeScript CLI Project
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Transform `~/.claude` into a proper TypeScript Node.js CLI project with modern tooling, following 2025/2026 best practices.
|
|
6
|
+
|
|
7
|
+
- **Package name**: `honbu`
|
|
8
|
+
- **Binary name**: `honbu`
|
|
9
|
+
- **Command structure**: `honbu <command> [subcommand] [options]`
|
|
10
|
+
|
|
11
|
+
## Technology Stack
|
|
12
|
+
|
|
13
|
+
| Category | Tool | Rationale |
|
|
14
|
+
|----------|------|-----------|
|
|
15
|
+
| Runtime | Node.js 25.x | Native TypeScript support, no transpilation needed |
|
|
16
|
+
| CLI Framework | **citty** (UnJS) | Lightweight, TypeScript-first, subcommand support, auto-help |
|
|
17
|
+
| Linting/Formatting | **Biome** | 20x faster than ESLint+Prettier, single tool, single config |
|
|
18
|
+
| Testing | **Vitest** | Native ESM/TS support, fast, modern |
|
|
19
|
+
| Package Manager | **npm** | Built-in, no extra tooling needed |
|
|
20
|
+
|
|
21
|
+
## Project Structure
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
~/.claude/
|
|
25
|
+
├── package.json # Root package config
|
|
26
|
+
├── biome.json # Biome linter/formatter config
|
|
27
|
+
├── tsconfig.json # TypeScript config (for IDE support)
|
|
28
|
+
├── vitest.config.ts # Test configuration
|
|
29
|
+
├── .tool-versions # asdf version pinning
|
|
30
|
+
├── .gitignore # Updated ignores
|
|
31
|
+
├── src/
|
|
32
|
+
│ ├── index.ts # Main entry point (honbu)
|
|
33
|
+
│ ├── commands/
|
|
34
|
+
│ │ ├── disk.ts # disk inventory|overview|hogs|cleanup
|
|
35
|
+
│ │ ├── docs.ts # docs list|sync|get|check
|
|
36
|
+
│ │ ├── plans.ts # plans list|clear
|
|
37
|
+
│ │ └── utils.ts # utils sync-checkboxes|fetch-html
|
|
38
|
+
│ ├── lib/
|
|
39
|
+
│ │ ├── colors.ts # ANSI color utilities
|
|
40
|
+
│ │ ├── spinner.ts # Spinner animation
|
|
41
|
+
│ │ ├── exec.ts # Shell execution helpers
|
|
42
|
+
│ │ ├── fs.ts # File system utilities
|
|
43
|
+
│ │ └── html.ts # HTML fetching/conversion
|
|
44
|
+
│ └── types/
|
|
45
|
+
│ └── index.ts # Shared type definitions
|
|
46
|
+
├── tests/
|
|
47
|
+
│ ├── commands/
|
|
48
|
+
│ │ └── disk.test.ts
|
|
49
|
+
│ └── lib/
|
|
50
|
+
│ └── fs.test.ts
|
|
51
|
+
├── tools/ # Legacy (to be migrated then removed)
|
|
52
|
+
├── commands/ # Slash commands (keep as-is)
|
|
53
|
+
├── doc/ # Documentation (keep)
|
|
54
|
+
└── ... # Other Claude dirs (keep)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Command Structure
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
honbu
|
|
61
|
+
├── disk # Disk space analysis
|
|
62
|
+
│ ├── inventory # Full analysis (default)
|
|
63
|
+
│ ├── overview # APFS volume overview
|
|
64
|
+
│ ├── hogs # Common space hogs
|
|
65
|
+
│ └── cleanup # Cleanup suggestions
|
|
66
|
+
├── docs # Documentation management
|
|
67
|
+
│ ├── list # List documentation files
|
|
68
|
+
│ ├── sync # Sync documentation sources
|
|
69
|
+
│ ├── get # Fetch new documentation
|
|
70
|
+
│ └── check # Check system docs status
|
|
71
|
+
├── plans # Plan management
|
|
72
|
+
│ ├── list # List saved plans
|
|
73
|
+
│ └── clear # Clear all plans
|
|
74
|
+
└── utils # Utility commands
|
|
75
|
+
├── fetch-html # Fetch URL as markdown
|
|
76
|
+
└── sync-checkboxes # Clean completed checkboxes
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Implementation Steps
|
|
80
|
+
|
|
81
|
+
### Phase 1: Project Initialization
|
|
82
|
+
|
|
83
|
+
1. Move `tools/package.json` to root, update with new config
|
|
84
|
+
2. Create `biome.json` with recommended rules
|
|
85
|
+
3. Create `tsconfig.json` for IDE intellisense (not compilation)
|
|
86
|
+
4. Create `vitest.config.ts`
|
|
87
|
+
5. Update `.gitignore` for new structure
|
|
88
|
+
|
|
89
|
+
### Phase 2: Create Source Structure
|
|
90
|
+
|
|
91
|
+
1. Create `src/` directory structure
|
|
92
|
+
2. Create `src/lib/` shared utilities:
|
|
93
|
+
- Extract colors/spinner from disk-inventory.ts
|
|
94
|
+
- Extract exec wrapper
|
|
95
|
+
- Extract file system helpers
|
|
96
|
+
- Extract HTML fetching logic
|
|
97
|
+
3. Create type definitions
|
|
98
|
+
|
|
99
|
+
### Phase 3: Implement CLI Entry Point
|
|
100
|
+
|
|
101
|
+
1. Create `src/index.ts` with citty main command
|
|
102
|
+
2. Define subcommands structure
|
|
103
|
+
3. Wire up command routing
|
|
104
|
+
|
|
105
|
+
### Phase 4: Migrate Commands
|
|
106
|
+
|
|
107
|
+
1. `disk-inventory.ts` → `src/commands/disk.ts`
|
|
108
|
+
2. `list-docs.ts` + `check-system-docs.ts` → `src/commands/docs.ts`
|
|
109
|
+
3. `list-plans.ts` → `src/commands/plans.ts`
|
|
110
|
+
4. `fetch-html.ts` + `sync-checkboxes.ts` → `src/commands/utils.ts`
|
|
111
|
+
|
|
112
|
+
### Phase 5: Testing & Quality
|
|
113
|
+
|
|
114
|
+
1. Add unit tests for lib functions
|
|
115
|
+
2. Add integration tests for commands
|
|
116
|
+
3. Configure Biome and fix any issues
|
|
117
|
+
4. Add npm scripts for common tasks
|
|
118
|
+
|
|
119
|
+
### Phase 6: Cleanup
|
|
120
|
+
|
|
121
|
+
1. Remove `tools/` directory
|
|
122
|
+
2. Update any references in slash commands
|
|
123
|
+
3. Final verification
|
|
124
|
+
|
|
125
|
+
## Key Files to Create/Modify
|
|
126
|
+
|
|
127
|
+
| File | Action |
|
|
128
|
+
|------|--------|
|
|
129
|
+
| `package.json` | Replace (move from tools/, update) |
|
|
130
|
+
| `biome.json` | Create |
|
|
131
|
+
| `tsconfig.json` | Create |
|
|
132
|
+
| `vitest.config.ts` | Create |
|
|
133
|
+
| `.gitignore` | Modify (add new patterns) |
|
|
134
|
+
| `.tool-versions` | Modify (add pnpm) |
|
|
135
|
+
| `src/index.ts` | Create |
|
|
136
|
+
| `src/commands/*.ts` | Create (4 files) |
|
|
137
|
+
| `src/lib/*.ts` | Create (5 files) |
|
|
138
|
+
| `src/types/index.ts` | Create |
|
|
139
|
+
| `tests/**/*.ts` | Create |
|
|
140
|
+
| `tools/` | Delete (after migration) |
|
|
141
|
+
|
|
142
|
+
## Package.json Structure
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"name": "honbu",
|
|
147
|
+
"version": "1.0.0",
|
|
148
|
+
"type": "module",
|
|
149
|
+
"bin": {
|
|
150
|
+
"honbu": "./src/index.ts"
|
|
151
|
+
},
|
|
152
|
+
"scripts": {
|
|
153
|
+
"dev": "node src/index.ts",
|
|
154
|
+
"test": "vitest",
|
|
155
|
+
"test:run": "vitest run",
|
|
156
|
+
"lint": "biome check .",
|
|
157
|
+
"lint:fix": "biome check --write .",
|
|
158
|
+
"format": "biome format --write .",
|
|
159
|
+
"typecheck": "tsc --noEmit"
|
|
160
|
+
},
|
|
161
|
+
"dependencies": {
|
|
162
|
+
"citty": "^0.1.6",
|
|
163
|
+
"cheerio": "^1.1.2",
|
|
164
|
+
"turndown": "^7.2.2"
|
|
165
|
+
},
|
|
166
|
+
"devDependencies": {
|
|
167
|
+
"@biomejs/biome": "^1.9.0",
|
|
168
|
+
"@types/node": "^22.0.0",
|
|
169
|
+
"@types/turndown": "^5.0.5",
|
|
170
|
+
"typescript": "^5.7.0",
|
|
171
|
+
"vitest": "^2.1.0"
|
|
172
|
+
},
|
|
173
|
+
"engines": {
|
|
174
|
+
"node": ">=23.6.0"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Verification
|
|
180
|
+
|
|
181
|
+
1. **CLI works**: `node src/index.ts --help` shows all commands
|
|
182
|
+
2. **Subcommands work**: `node src/index.ts disk overview` runs correctly
|
|
183
|
+
3. **Tests pass**: `npm test` runs without errors
|
|
184
|
+
4. **Lint passes**: `npm run lint` shows no errors
|
|
185
|
+
5. **Types check**: `npm run typecheck` passes
|
|
186
|
+
|
|
187
|
+
## Notes
|
|
188
|
+
|
|
189
|
+
- Node.js 25.x runs TypeScript natively - no build step needed
|
|
190
|
+
- `node-fetch` removed - use native `fetch()` (available since Node 18)
|
|
191
|
+
- citty provides automatic `--help` and `--version` handling
|
|
192
|
+
- Biome replaces both ESLint and Prettier with single config
|