Skip to content

Commit d0481b4

Browse files
committed
chore: add changeset for v0.5.0 and update documentation
Changeset: - Add changeset for minor version bump (→ 0.5.0) - Bumps @lytics/dev-agent-core and @lytics/dev-agent Scanner docs: - Update README with new DocumentType 'variable' and metadata fields - Document isArrowFunction, isHook, isAsync, isConstant, constantKind Website docs: - Add 'New in v0.5.0' section to tools index - Update dev_search with v0.5 markers for new extraction types - Update quickstart with expanded extraction list
1 parent 88a7962 commit d0481b4

File tree

5 files changed

+69
-7
lines changed

5 files changed

+69
-7
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
"@lytics/dev-agent-core": minor
3+
"@lytics/dev-agent": minor
4+
---
5+
6+
feat(scanner): Extract arrow functions, function expressions, and exported constants
7+
8+
### New Features
9+
10+
**Arrow Function Extraction**
11+
- Extract arrow functions assigned to `const`/`let` variables
12+
- Extract function expressions assigned to variables
13+
- Detect React hooks automatically (`use*` naming pattern)
14+
- Detect async arrow functions
15+
16+
**Exported Constant Extraction**
17+
- Extract exported `const` with object literal initializers (config objects)
18+
- Extract exported `const` with array literal initializers (static lists)
19+
- Extract exported `const` with call expression initializers (factories like `createContext()`)
20+
21+
### API Changes
22+
23+
**New DocumentType value:**
24+
- Added `'variable'` to `DocumentType` union
25+
26+
**New metadata fields:**
27+
- `isArrowFunction?: boolean` - true for arrow functions (vs function expressions)
28+
- `isHook?: boolean` - true if name matches `/^use[A-Z]/` (React convention)
29+
- `isAsync?: boolean` - true for async functions
30+
- `isConstant?: boolean` - true for exported constants
31+
- `constantKind?: 'object' | 'array' | 'value'` - kind of constant initializer
32+
33+
### Examples
34+
35+
Now extracts:
36+
```typescript
37+
export const useAuth = () => { ... } // Hook (isHook: true)
38+
export const fetchData = async (url) => { ... } // Async (isAsync: true)
39+
const validateEmail = (email: string) => ... // Utility function
40+
export const API_CONFIG = { baseUrl: '...' } // Object constant
41+
export const LANGUAGES = ['ts', 'js'] // Array constant
42+
export const AppContext = createContext({}) // Factory constant
43+
```
44+
45+
### Migration
46+
47+
No breaking changes. The new `'variable'` DocumentType is additive. Existing queries for `'function'`, `'class'`, etc. continue to work unchanged.
48+

packages/core/src/scanner/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Represents a single extracted code element or documentation section:
5656
interface Document {
5757
id: string; // Unique identifier: "file:name:line"
5858
text: string; // Text to embed (for vector search)
59-
type: DocumentType; // 'function' | 'class' | 'interface' | 'type' | 'method' | 'documentation'
59+
type: DocumentType; // 'function' | 'class' | 'interface' | 'type' | 'method' | 'documentation' | 'variable'
6060
language: string; // 'typescript' | 'javascript' | 'markdown'
6161

6262
metadata: {
@@ -67,6 +67,13 @@ interface Document {
6767
signature?: string; // Full signature
6868
exported: boolean; // Is it a public API?
6969
docstring?: string; // Documentation comment
70+
71+
// Variable/function metadata (for type: 'variable')
72+
isArrowFunction?: boolean; // True for arrow functions
73+
isHook?: boolean; // True for React hooks (use* pattern)
74+
isAsync?: boolean; // True for async functions
75+
isConstant?: boolean; // True for exported constants
76+
constantKind?: 'object' | 'array' | 'value'; // Kind of constant
7077
};
7178
}
7279
```
@@ -364,8 +371,8 @@ const utilDocs = result.documents.filter(
364371

365372
| Language | Scanner | Extracts | Status |
366373
|----------|---------|----------|--------|
367-
| TypeScript | `TypeScriptScanner` | Functions, classes, methods, interfaces, types, JSDoc | ✅ Implemented |
368-
| JavaScript | `TypeScriptScanner` | Functions, classes, methods, JSDoc | ✅ Implemented (via .ts scanner) |
374+
| TypeScript | `TypeScriptScanner` | Functions, classes, methods, interfaces, types, arrow functions, exported constants, JSDoc | ✅ Implemented |
375+
| JavaScript | `TypeScriptScanner` | Functions, classes, methods, arrow functions, exported constants, JSDoc | ✅ Implemented (via .ts scanner) |
369376
| Markdown | `MarkdownScanner` | Documentation sections, code blocks | ✅ Implemented |
370377
| Go | - | Functions, structs, interfaces | 🔄 Planned (tree-sitter) |
371378
| Python | - | Functions, classes, docstrings | 🔄 Planned (tree-sitter) |

website/content/docs/quickstart.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Try these prompts:
7171
When you run `dev index .`:
7272

7373
1. **Scanner** parses your code using the TypeScript Compiler API
74-
2. **Extractor** identifies functions, classes, interfaces, types
74+
2. **Extractor** identifies functions, classes, interfaces, types, arrow functions, hooks, and exported constants
7575
3. **Embedder** generates vector embeddings locally (MiniLM-L6-v2)
7676
4. **Storage** saves everything to LanceDB (`~/.dev-agent/indexes/`)
7777

website/content/docs/tools/dev-search.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,13 @@ This surfaces test files without affecting semantic search rankings — tests ar
8686

8787
dev_search indexes these code components:
8888

89-
- **Functions** — Named functions and arrow functions
89+
- **Functions** — Named function declarations
90+
- **Arrow functions** — Arrow functions assigned to variables (e.g., `const handler = () => {}`) ✨ v0.5
91+
- **React hooks** — Automatically detected by `use*` naming pattern ✨ v0.5
9092
- **Classes** — Class declarations and their methods
9193
- **Interfaces** — TypeScript interfaces
9294
- **Types** — Type aliases
93-
- **Variables**Exported constants and variables
95+
- **Exported constants**Objects, arrays, and factory calls (e.g., `export const CONFIG = {}`) ✨ v0.5
9496
- **Markdown sections** — Headers and content blocks
9597

9698
## Tips

website/content/docs/tools/index.mdx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ dev-agent provides nine tools through the Model Context Protocol (MCP). These to
1616
| [`dev_status`](/docs/tools/dev-status) | Check repository indexing status |
1717
| [`dev_health`](/docs/tools/dev-health) | Monitor MCP server health |
1818

19-
## New in v0.4.0
19+
## New in v0.5.0
20+
21+
- **Enhanced indexing** — Arrow functions, React hooks, and exported constants now extracted
22+
- **`dev_search`** — Better coverage of modern JavaScript patterns (hooks, utilities, configs)
23+
24+
## v0.4.0
2025

2126
- **`dev_history`** — Semantic search over git commit history
2227
- **`dev_map`** — Change frequency indicators (🔥 hot, ✏️ active, 📝 recent)

0 commit comments

Comments
 (0)