Skip to content

Commit 7827940

Browse files
committed
feat: complete the core astro extractor logic
created main entry point for the astro extractor tested the end to end workflow added tests for astro extractor Written-by: Chris Lyons
1 parent 6df22c0 commit 7827940

7 files changed

Lines changed: 689 additions & 118 deletions

File tree

ASTRO_EXTRACTOR_PLAN.md

Lines changed: 50 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
### 1.1 Project Structure
1212

1313
- [x] Create directory structure:
14-
- `src/extractors/builtin/basic-astro/`
15-
- `src/extractors/builtin/basic-astro/index.ts`
14+
- `src/extractors/builtin/basic-astro.ts` (entry point)
15+
- `src/extractors/builtin/basic-astro/` (helper modules)
1616
- `src/extractors/builtin/basic-astro/types.ts`
1717
- `src/extractors/builtin/basic-astro/file-finder.ts`
1818
- `src/extractors/builtin/basic-astro/file-parser.ts`
@@ -142,26 +142,26 @@
142142

143143
### 4.1 JSDoc Tag Extraction
144144

145-
- [ ] Implement `extractFileComponent()` in `component-detector.ts`:
145+
- [x] Implement `extractFileComponent()` in `component-detector.ts`:
146146
- Parse frontmatter for JSDoc comments
147147
- Support `@component`, `@module`, `@namespace` tags
148148
- Extract component name and description
149149
- Use `sanitizeId()` for IDs
150150

151-
- [ ] Implement `extractFileActors()`:
151+
- [x] Implement `extractFileActors()`:
152152
- Parse `@actor` tags from frontmatter JSDoc
153153
- Format: `@actor Name {Person|System} {in|out|both}? description`
154154
- Use `sanitizeId()` for actor IDs
155155

156-
- [ ] Implement `extractFileRelationships()`:
156+
- [x] Implement `extractFileRelationships()`:
157157
- Parse `@uses` tags from frontmatter JSDoc
158158
- Create component dependencies
159159

160160
**Commit:** `feat: implement JSDoc tag extraction for Astro components`
161161

162162
### 4.2 Folder-Based Inference
163163

164-
- [ ] Implement `inferComponentFromPath()`:
164+
- [x] Implement `inferComponentFromPath()`:
165165
- Use immediate parent folder name as component
166166
- Use `ROOT_COMPONENT_MARKER` for root directory files
167167
- Match basic-node behavior exactly
@@ -170,10 +170,10 @@
170170

171171
### 4.3 Testing Component Detection
172172

173-
- [ ] Test explicit `@component` tags
174-
- [ ] Test folder-based inference
175-
- [ ] Test root directory handling
176-
- [ ] Test `@actor` and `@uses` tags
173+
- [x] Test explicit `@component` tags
174+
- [x] Test folder-based inference
175+
- [x] Test root directory handling
176+
- [x] Test `@actor` and `@uses` tags
177177

178178
**Commit:** `test: add tests for Astro component detection`
179179

@@ -183,41 +183,38 @@
183183

184184
### 5.1 TypeScript Code Extraction
185185

186-
- [ ] Extract classes from frontmatter
187-
- [ ] Extract functions from frontmatter
188-
- [ ] Extract interfaces/types (component props)
189-
190-
- [ ] Extract constants/variables
191-
- [ ] Follow basic-node code extraction patterns
186+
- [x] Extract classes from frontmatter
187+
- [x] Extract functions from frontmatter
188+
- [x] Extract interfaces/types (component props)
189+
- [x] Extract constants/variables
190+
- [x] Follow basic-node code extraction patterns
192191

193192
**Commit:** `feat: extract TypeScript code items from Astro frontmatter`
194193

195194
### 5.2 Documentation Extraction
196195

197-
- [ ] Extract JSDoc from classes/functions
198-
199-
- [ ] Support `@example`, `@remarks`, `@deprecated`
200-
- [ ] Extract parameter descriptions
201-
- [ ] Extract return types/descriptions
196+
- [x] Extract JSDoc from classes/functions
197+
- [x] Support `@example`, `@remarks`, `@deprecated`
198+
- [x] Extract parameter descriptions
199+
- [x] Extract return types/descriptions
202200

203201
**Commit:** `feat: extract documentation from Astro component code`
204202

205203
### 5.3 Component Metadata
206204

207-
- [ ] Extract component props (TypeScript interface)
208-
- [ ] Extract slots (named and default)
209-
- [ ] Extract client directives (affects architecture)
210-
- [ ] Store as code item metadata
205+
- [x] Extract component props (TypeScript interface)
206+
- [x] Extract slots (named and default)
207+
- [x] Extract client directives (affects architecture)
208+
- [x] Store as code item metadata
211209

212210
**Commit:** `feat: extract Astro-specific component metadata (props, slots, directives)`
213211

214212
### 5.4 Testing Code Extraction
215213

216-
- [ ] Test class extraction
217-
- [ ] Test function extraction
218-
- [ ] Test prop interface extraction
219-
220-
- [ ] Test documentation extraction
214+
- [x] Test class extraction
215+
- [x] Test function extraction
216+
- [x] Test prop interface extraction
217+
- [x] Test documentation extraction
221218

222219
**Commit:** `test: add tests for code extraction from Astro files`
223220

@@ -227,7 +224,7 @@
227224

228225
### 6.1 Basic IR Structure
229226

230-
- [ ] Implement `mapToIR()` in `to-ir-mapper.ts`:
227+
- [x] Implement `mapToIR()` in `to-ir-mapper.ts`:
231228
- Aggregate components, actors, relationships
232229
- Create code items array
233230
- Follow basic-node mapping pattern exactly
@@ -236,40 +233,39 @@
236233

237234
### 6.2 Container Detection
238235

239-
- [ ] Map files to nearest package.json
240-
- [ ] Create containers from packages
241-
- [ ] Handle files without packages (default container)
242-
- [ ] Match basic-node container logic
236+
- [x] Map files to nearest package.json
237+
- [x] Create containers from packages
238+
- [x] Handle files without packages (default container)
239+
- [x] Match basic-node container logic
243240

244241
**Commit:** `feat: implement container detection and assignment`
245242

246243
### 6.3 Hierarchical IDs
247244

248-
- [ ] Build `componentIdMap` (old ID → new ID)
249-
- [ ] Apply container-level IDs: `${containerId}__${componentId}`
250-
- [ ] Handle `ROOT_COMPONENT_MARKER` replacement
251-
- [ ] Apply code-level IDs: `${componentId}__${codeName}`
252-
- [ ] Update all relationship references
245+
- [x] Build `componentIdMap` (old ID → new ID)
246+
- [x] Apply container-level IDs: `${containerId}__${componentId}`
247+
- [x] Handle `ROOT_COMPONENT_MARKER` replacement
248+
- [x] Apply code-level IDs: `${componentId}__${codeName}`
249+
- [x] Update all relationship references
253250

254251
**Commit:** `feat: implement hierarchical ID system for Astro IR`
255252

256253
### 6.4 Relationship Mapping
257254

258-
- [ ] Map component → component relationships
259-
- [ ] Map component → actor relationships
260-
- [ ] Handle actor direction (in/out/both)
261-
- [ ] Deduplicate relationships
255+
- [x] Map component → component relationships
256+
- [x] Map component → actor relationships
257+
- [x] Handle actor direction (in/out/both)
258+
- [x] Deduplicate relationships
262259

263260
**Commit:** `feat: map Astro component relationships to IR`
264261

265262
### 6.5 Testing IR Mapping
266263

267-
- [ ] Test component mapping
268-
- [ ] Test hierarchical ID generation
269-
270-
- [ ] Test ROOT_COMPONENT_MARKER replacement
271-
- [ ] Test relationship mapping
272-
- [ ] Test container assignment
264+
- [x] Test component mapping
265+
- [x] Test hierarchical ID generation
266+
- [x] Test ROOT_COMPONENT_MARKER replacement
267+
- [x] Test relationship mapping
268+
- [x] Test container assignment
273269

274270
**Commit:** `test: add comprehensive IR mapping tests`
275271

@@ -279,7 +275,7 @@
279275

280276
### 7.1 Orchestration
281277

282-
- [ ] Implement main extractor in `index.ts`:
278+
- [x] Implement main extractor in `index.ts`:
283279
- Parse inputs (include, exclude patterns)
284280
- Call file finder
285281
- Call parser
@@ -291,9 +287,9 @@
291287

292288
### 7.2 Export Configuration
293289

294-
- [ ] Export as default for dynamic loading
295-
- [ ] Implement `ArchletteExtractor` interface
296-
- [ ] Match basic-node/basic-python patterns
290+
- [x] Export as default for dynamic loading
291+
- [x] Implement `ArchletteExtractor` interface
292+
- [x] Match basic-node/basic-python patterns
297293

298294
**Commit:** `feat: configure Astro extractor for dynamic loading`
299295

0 commit comments

Comments
 (0)