@parseme/cli 0.0.3 → 0.0.5
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 +182 -187
- package/dist/cli/cli.js +144 -0
- package/dist/{analyzers → core/analyzers}/ast-analyzer.d.ts +1 -1
- package/dist/{analyzers → core/analyzers}/ast-analyzer.js +14 -27
- package/dist/core/analyzers/framework-detector.d.ts +7 -0
- package/dist/core/analyzers/framework-detector.js +165 -0
- package/dist/{analyzers → core/analyzers}/pattern-detector.d.ts +2 -5
- package/dist/{analyzers → core/analyzers}/pattern-detector.js +134 -49
- package/dist/{analyzers → core/analyzers}/project-analyzer.d.ts +2 -0
- package/dist/{analyzers → core/analyzers}/project-analyzer.js +12 -9
- package/dist/core/config.d.ts +19 -0
- package/dist/{config.js → core/config.js} +79 -91
- package/dist/{builders → core}/context-builder.d.ts +4 -11
- package/dist/core/context-builder.js +225 -0
- package/dist/{generator.d.ts → core/generator.d.ts} +0 -3
- package/dist/{generator.js → core/generator.js} +12 -17
- package/dist/core/types/analyzer-types.d.ts +38 -0
- package/dist/core/types/analyzer-types.js +2 -0
- package/dist/core/types/config-types.d.ts +36 -0
- package/dist/core/types/config-types.js +2 -0
- package/dist/core/types/generator-types.d.ts +6 -0
- package/dist/core/types/generator-types.js +2 -0
- package/dist/core/types/index.d.ts +4 -0
- package/dist/core/types/index.js +5 -0
- package/dist/core/types/project-types.d.ts +30 -0
- package/dist/core/types/project-types.js +2 -0
- package/dist/core/types.d.ts +1 -0
- package/dist/core/types.js +2 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.js +2 -2
- package/dist/utils/file-collector.d.ts +23 -0
- package/dist/utils/file-collector.js +61 -0
- package/dist/utils/file-filter.d.ts +30 -0
- package/dist/utils/file-filter.js +99 -0
- package/dist/{analyzers/git-analyzer.d.ts → utils/git.d.ts} +1 -4
- package/dist/{analyzers/git-analyzer.js → utils/git.js} +0 -4
- package/dist/{prompt.d.ts → utils/prompt.d.ts} +0 -1
- package/dist/{prompt.js → utils/prompt.js} +0 -9
- package/package.json +12 -8
- package/dist/analyzers/framework-detector.d.ts +0 -12
- package/dist/analyzers/framework-detector.js +0 -180
- package/dist/builders/context-builder.js +0 -386
- package/dist/cli.js +0 -145
- package/dist/config.d.ts +0 -44
- package/dist/types.d.ts +0 -84
- package/dist/types.js +0 -2
- /package/dist/{cli.d.ts → cli/cli.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ PARSEME analyzes your TypeScript/JavaScript projects and generates a PARSEME.md
|
|
|
6
6
|
|
|
7
7
|
## Development Status
|
|
8
8
|
|
|
9
|
-
**This project is currently in active development and
|
|
9
|
+
**This project is currently in active development and pre-alpha phase.**
|
|
10
10
|
|
|
11
11
|
The core functionality is working, but expect:
|
|
12
12
|
|
|
@@ -25,97 +25,68 @@ Your feedback is **highly appreciated** and helps shape the future of this tool!
|
|
|
25
25
|
|
|
26
26
|
## Features
|
|
27
27
|
|
|
28
|
-
- **Universal Pattern Detection** - Dynamic code analysis that works across any JavaScript/TypeScript framework
|
|
29
28
|
- **Project Analysis** - AST-based code analysis with automatic endpoint, component, and service discovery
|
|
30
|
-
- **
|
|
31
|
-
- **Configurable Output** - Multi-file context generation optimized for AI assistants
|
|
29
|
+
- **Universal Pattern Detection** - Dynamic code analysis that works across many JavaScript/TypeScript frameworks
|
|
32
30
|
- **Git Integration** - Includes repository status and change tracking
|
|
33
|
-
- **
|
|
34
|
-
- **Dev Tool Integration** - Works seamlessly as
|
|
31
|
+
- **Configurable** - Comprehensive configuration options via JavaScript, TypeScript, or JSON
|
|
32
|
+
- **Dev Tool Integration** - Works seamlessly as a npm script
|
|
35
33
|
|
|
36
|
-
###
|
|
34
|
+
### **What PARSEME Detects**
|
|
37
35
|
|
|
38
36
|
PARSEME uses AST analysis to identify:
|
|
39
37
|
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
38
|
+
- **API Endpoints** - HTTP routes, GraphQL resolvers, RPC methods
|
|
39
|
+
- **Components** - UI components across all major frameworks
|
|
40
|
+
- **Services** - Business logic classes and service functions
|
|
41
|
+
- **Data Models** - Interfaces, types, schemas, DTOs
|
|
42
|
+
- **Middleware** - Request/response handlers and interceptors
|
|
43
|
+
- **Utilities** - Helper functions, hooks, composables
|
|
44
|
+
- **Project Structure** - Organized by detected patterns and purpose
|
|
47
45
|
|
|
48
46
|
## **Language Support**
|
|
49
47
|
|
|
50
48
|
- **TypeScript** - Full support including advanced types, decorators, interfaces
|
|
51
|
-
- **JavaScript (ES6+)** - Modern JavaScript with
|
|
49
|
+
- **JavaScript (ES6+)** - Modern JavaScript with ES features
|
|
52
50
|
- **JSX/TSX** - React and other JSX-based frameworks
|
|
53
51
|
- **Mixed codebases** - Projects with both JS and TS files
|
|
54
52
|
|
|
55
53
|
## Supported Projects
|
|
56
54
|
|
|
57
|
-
PARSEME aims to automatically analyse any JavaScript or TypeScript project:
|
|
55
|
+
PARSEME aims to automatically analyse any JavaScript or TypeScript project like:
|
|
58
56
|
|
|
59
|
-
###
|
|
57
|
+
### **Backend APIs**
|
|
60
58
|
|
|
61
59
|
- **NestJS** - Controllers, services, decorators, dependency injection
|
|
62
60
|
- **Express.js** - Routes, middleware, error handlers
|
|
63
61
|
- **Fastify** - Route registration, plugins, hooks
|
|
64
|
-
- **Koa.js** - Context-based middleware, routing
|
|
65
|
-
- **Hapi.js** - Route configuration, server plugins
|
|
66
|
-
- **Custom frameworks** - Any HTTP endpoint patterns
|
|
67
62
|
|
|
68
|
-
###
|
|
63
|
+
### **Frontend Applications**
|
|
69
64
|
|
|
70
65
|
- **React** - Components (functional & class), hooks, JSX patterns
|
|
71
66
|
- **Vue.js** - Components (Composition & Options API), composables
|
|
72
67
|
- **Angular** - Components, services, decorators, modules
|
|
73
68
|
- **Svelte** - Components, stores, reactive patterns
|
|
74
69
|
- **Lit** - Web components, custom elements
|
|
75
|
-
- **Vanilla JS/TS** -
|
|
70
|
+
- **Vanilla JS/TS** - Functions, classes, modules, event handlers
|
|
76
71
|
|
|
77
|
-
###
|
|
78
|
-
|
|
79
|
-
- **TypeScript libraries** - Interfaces, types, utility functions
|
|
80
|
-
- **JavaScript utilities** - Helper functions, class libraries
|
|
81
|
-
- **Node.js modules** - CommonJS and ES modules
|
|
82
|
-
- **Monorepo packages** - Lerna, Nx, Rush, Turborepo
|
|
83
|
-
|
|
84
|
-
### 🛠️ **Development Tools**
|
|
85
|
-
|
|
86
|
-
- **CLI applications** - Command-line tools and scripts
|
|
87
|
-
- **Build tools** - Webpack plugins, Vite configurations
|
|
88
|
-
- **Desktop applications** - Electron, Tauri apps
|
|
89
|
-
- **Testing utilities** - Jest plugins, test helpers
|
|
90
|
-
|
|
91
|
-
### 🏗️ **Fullstack Frameworks**
|
|
72
|
+
### **Fullstack Frameworks**
|
|
92
73
|
|
|
93
74
|
- **Next.js** - Pages, API routes, middleware, components
|
|
94
|
-
- **Nuxt.js** -
|
|
95
|
-
- **SvelteKit** - Svelte-based fullstack applications
|
|
96
|
-
- **Remix** - React-based fullstack applications
|
|
97
|
-
-
|
|
98
|
-
|
|
99
|
-
## Development Status
|
|
75
|
+
- **Nuxt.js** - Pages, server routes, composables, components
|
|
100
76
|
|
|
101
|
-
**
|
|
102
|
-
|
|
103
|
-
The core functionality is working, but expect:
|
|
104
|
-
|
|
105
|
-
- Breaking changes in configuration format
|
|
106
|
-
- API modifications as the interface gets refined
|
|
107
|
-
- Additional features being added regularly
|
|
108
|
-
- Possible bugs and edge cases
|
|
77
|
+
### **Packages & Libraries**
|
|
109
78
|
|
|
110
|
-
|
|
79
|
+
- **TypeScript utilities** - Types, interfaces, enums, generic helpers
|
|
80
|
+
- **JavaScript helpers** - Functions, classes, utilities, data manipulation
|
|
81
|
+
- **Node.js modules** - Exports, imports, CommonJS/ESM patterns
|
|
82
|
+
- **Monorepo packages** - Shared utilities, cross-package dependencies
|
|
111
83
|
|
|
112
|
-
|
|
84
|
+
### **Development Tools**
|
|
113
85
|
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
- Star the repo if you find it useful
|
|
86
|
+
- **CLI tools** - Commands, options, argument parsing
|
|
87
|
+
- **Build plugins** - Plugin functions, configuration handlers
|
|
88
|
+
- **Desktop apps** - Main processes, renderers, IPC handlers
|
|
89
|
+
- **Testing utilities** - Test functions, mocks, utilities, custom matchers
|
|
119
90
|
|
|
120
91
|
## Installation
|
|
121
92
|
|
|
@@ -129,14 +100,27 @@ npm install --save-dev parseme
|
|
|
129
100
|
|
|
130
101
|
```bash
|
|
131
102
|
npx parseme init
|
|
103
|
+
# or use the alias
|
|
104
|
+
npx parseme i
|
|
132
105
|
```
|
|
133
106
|
|
|
134
|
-
|
|
107
|
+
You'll be prompted for:
|
|
108
|
+
- Context directory path (default: `parseme-context`)
|
|
109
|
+
- Exclude patterns (default: `node_modules/**`, `dist/**`, `.git/**` - in git repositories, additional patterns on top of git-tracked files)
|
|
110
|
+
|
|
111
|
+
A minimal config file will be created with only your custom settings.
|
|
112
|
+
|
|
113
|
+
Setup tips will be displayed:
|
|
114
|
+
- How to add parseme script to package.json
|
|
115
|
+
- How to integrate with git hooks
|
|
116
|
+
- README section to help AI agents find context
|
|
117
|
+
|
|
118
|
+
2. **Add to your package.json scripts** (optional, for easier execution):
|
|
135
119
|
|
|
136
120
|
```json
|
|
137
121
|
{
|
|
138
122
|
"scripts": {
|
|
139
|
-
"parseme": "parseme"
|
|
123
|
+
"parseme": "parseme generate"
|
|
140
124
|
}
|
|
141
125
|
}
|
|
142
126
|
```
|
|
@@ -144,34 +128,59 @@ npm install --save-dev parseme
|
|
|
144
128
|
3. **Generate context**:
|
|
145
129
|
```bash
|
|
146
130
|
npm run parseme
|
|
131
|
+
# or
|
|
132
|
+
npx parseme generate
|
|
133
|
+
# or use the alias
|
|
134
|
+
npx parseme g
|
|
147
135
|
```
|
|
148
136
|
|
|
149
|
-
This
|
|
137
|
+
This creates:
|
|
138
|
+
|
|
139
|
+
- `PARSEME.md` - Main overview with links to context files
|
|
140
|
+
- `parseme-context/` - Structured data files (AST, dependencies, routes, git info)
|
|
150
141
|
|
|
151
142
|
## Configuration
|
|
152
143
|
|
|
153
144
|
PARSEME supports multiple configuration formats with automatic discovery and priority handling.
|
|
154
145
|
|
|
146
|
+
The `parseme init` command creates a minimal config with only your custom settings. Defaults are applied automatically at runtime.
|
|
147
|
+
|
|
148
|
+
**Minimal config example** (created by `parseme init`):
|
|
149
|
+
|
|
155
150
|
```javascript
|
|
156
151
|
/** @type {import('parseme').ParsemeConfigFile} */
|
|
157
|
-
|
|
152
|
+
const config = {
|
|
153
|
+
contextDir: 'parseme-context',
|
|
154
|
+
excludePatterns: ['node_modules/**', '.git/**'],
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export default config;
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Full config example** (all available options):
|
|
161
|
+
|
|
162
|
+
```javascript
|
|
163
|
+
/** @type {import('parseme').ParsemeConfigFile} */
|
|
164
|
+
const config = {
|
|
158
165
|
// Output settings
|
|
159
166
|
outputPath: 'PARSEME.md',
|
|
160
|
-
contextDir: 'parseme-context',
|
|
167
|
+
contextDir: 'parseme-context',
|
|
161
168
|
|
|
162
169
|
// Analysis settings
|
|
163
|
-
|
|
164
|
-
|
|
170
|
+
rootDir: './',
|
|
171
|
+
analyzeFileTypes: ['ts', 'tsx', 'js', 'jsx'],
|
|
172
|
+
excludePatterns: ['**/*.test.ts', 'dist/**'],
|
|
173
|
+
maxDepth: 10,
|
|
174
|
+
|
|
175
|
+
// Git integration
|
|
176
|
+
includeGitInfo: true,
|
|
165
177
|
|
|
166
|
-
//
|
|
178
|
+
// Size limits
|
|
167
179
|
limits: {
|
|
168
|
-
|
|
169
|
-
maxCharsPerFile: 50000,
|
|
170
|
-
maxFilesPerContext: 20,
|
|
171
|
-
truncateStrategy: 'split', // or 'truncate'
|
|
180
|
+
maxFilesPerContext: 5000,
|
|
172
181
|
},
|
|
173
182
|
|
|
174
|
-
// Content sections
|
|
183
|
+
// Content sections (all default to true)
|
|
175
184
|
sections: {
|
|
176
185
|
overview: true,
|
|
177
186
|
architecture: true,
|
|
@@ -180,46 +189,68 @@ export default {
|
|
|
180
189
|
git: true,
|
|
181
190
|
fileStructure: true,
|
|
182
191
|
},
|
|
192
|
+
|
|
193
|
+
// Style options
|
|
194
|
+
style: {
|
|
195
|
+
includeLineNumbers: false,
|
|
196
|
+
includeFileStats: true,
|
|
197
|
+
groupByType: true,
|
|
198
|
+
sortOrder: 'type', // 'alphabetical' | 'type' | 'size'
|
|
199
|
+
},
|
|
183
200
|
};
|
|
201
|
+
|
|
202
|
+
export default config;
|
|
184
203
|
```
|
|
185
204
|
|
|
186
205
|
### Configuration File Formats & Priority
|
|
187
206
|
|
|
188
207
|
PARSEME supports three configuration formats with the following priority:
|
|
189
208
|
|
|
190
|
-
1. **
|
|
191
|
-
2. **
|
|
192
|
-
3. **
|
|
209
|
+
1. **JSON** (`.json`) - `parseme.config.json`, `.parsemerc.json`, `.parsemerc`
|
|
210
|
+
2. **TypeScript** (`.ts`) - `parseme.config.ts`, `.parsemerc.ts`
|
|
211
|
+
3. **JavaScript** (`.js`) - `parseme.config.js`, `.parsemerc.js`
|
|
212
|
+
|
|
213
|
+
#### Example JSON Configuration
|
|
214
|
+
|
|
215
|
+
```json
|
|
216
|
+
{
|
|
217
|
+
"contextDir": "parseme-context",
|
|
218
|
+
"excludePatterns": ["node_modules/**", "dist/**", ".git/**"]
|
|
219
|
+
}
|
|
220
|
+
```
|
|
193
221
|
|
|
194
|
-
#### TypeScript Configuration
|
|
222
|
+
#### Example TypeScript Configuration
|
|
195
223
|
|
|
196
224
|
```typescript
|
|
197
225
|
import type { ParsemeConfigFile } from 'parseme';
|
|
198
226
|
|
|
199
227
|
const config: ParsemeConfigFile = {
|
|
200
|
-
|
|
201
|
-
|
|
228
|
+
contextDir: 'parseme-context',
|
|
229
|
+
excludePatterns: ['node_modules/**', 'dist/**', '.git/**'],
|
|
202
230
|
// ... other options
|
|
203
231
|
};
|
|
204
232
|
|
|
205
233
|
export default config;
|
|
206
234
|
```
|
|
207
235
|
|
|
208
|
-
####
|
|
236
|
+
#### Example JavaScript Configuration
|
|
209
237
|
|
|
210
|
-
```
|
|
211
|
-
{
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
238
|
+
```javascript
|
|
239
|
+
/** @type {import('parseme').ParsemeConfigFile} */
|
|
240
|
+
const config = {
|
|
241
|
+
contextDir: 'parseme-context',
|
|
242
|
+
excludePatterns: ['node_modules/**', 'dist/**', '.git/**'],
|
|
243
|
+
// ... other options
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
export default config;
|
|
216
247
|
```
|
|
217
248
|
|
|
218
249
|
### Configuration Priority
|
|
219
250
|
|
|
220
251
|
Configuration values are resolved in the following order (highest to lowest priority):
|
|
221
252
|
|
|
222
|
-
1. **CLI flags** - `--output`, `--root`, `--
|
|
253
|
+
1. **CLI flags** - `--output`, `--root`, `--config`, etc.
|
|
223
254
|
2. **Config file** - Based on file format priority above
|
|
224
255
|
3. **Default values** - Built-in sensible defaults
|
|
225
256
|
|
|
@@ -229,52 +260,54 @@ Configuration values are resolved in the following order (highest to lowest prio
|
|
|
229
260
|
|
|
230
261
|
#### Output Settings
|
|
231
262
|
|
|
232
|
-
- `outputPath` - Where to save the main PARSEME.md file (default: "PARSEME.md")
|
|
233
|
-
- `contextDir` - Directory for detailed context files (default: "parseme-context")
|
|
263
|
+
- `outputPath` - Where to save the main PARSEME.md file (default: `"PARSEME.md"`)
|
|
264
|
+
- `contextDir` - Directory for detailed context files (default: `"parseme-context"`)
|
|
234
265
|
|
|
235
266
|
#### Analysis Settings
|
|
236
267
|
|
|
237
|
-
- `rootDir` - Project root directory (default:
|
|
238
|
-
- `
|
|
239
|
-
- `excludePatterns` -
|
|
240
|
-
- `maxDepth` - Maximum directory depth to traverse
|
|
268
|
+
- `rootDir` - Project root directory (default: `process.cwd()`)
|
|
269
|
+
- `analyzeFileTypes` - File extensions to analyze (default and supported: `['ts', 'tsx', 'js', 'jsx']`)
|
|
270
|
+
- `excludePatterns` - Additional glob patterns to exclude files. In git repositories, only git-tracked files are analyzed (respecting all `.gitignore` files automatically). Use `excludePatterns` to exclude additional files beyond what git ignores.
|
|
271
|
+
- `maxDepth` - Maximum directory depth to traverse (default: `10`)
|
|
241
272
|
|
|
242
|
-
####
|
|
273
|
+
#### Git Integration
|
|
243
274
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
- **Express**: `detectMiddleware`, `documentRoutes`
|
|
247
|
-
- **NestJS**: `includeDecorators`, `documentModules`
|
|
248
|
-
- **Fastify**: `includePlugins`
|
|
275
|
+
- `includeGitInfo` - Include git repository information (default: `true`)
|
|
249
276
|
|
|
250
277
|
#### Content Sections
|
|
251
278
|
|
|
252
|
-
Toggle which sections to include:
|
|
279
|
+
Toggle which sections to include in the output (all default to `true`):
|
|
253
280
|
|
|
254
|
-
- `overview` - Project overview and metadata
|
|
255
|
-
- `architecture` - File type breakdown
|
|
256
|
-
- `routes` - API endpoints and routing
|
|
257
|
-
- `dependencies` - Package dependencies
|
|
258
|
-
- `git` - Repository information
|
|
259
|
-
- `fileStructure` - Detailed file listing
|
|
281
|
+
- `sections.overview` - Project overview and metadata
|
|
282
|
+
- `sections.architecture` - File type breakdown
|
|
283
|
+
- `sections.routes` - API endpoints and routing
|
|
284
|
+
- `sections.dependencies` - Package dependencies
|
|
285
|
+
- `sections.git` - Repository information
|
|
286
|
+
- `sections.fileStructure` - Detailed file listing
|
|
260
287
|
|
|
261
288
|
#### Style Options
|
|
262
289
|
|
|
263
|
-
- `includeLineNumbers` - Add line numbers to code references
|
|
264
|
-
- `includeFileStats` - Include file statistics
|
|
265
|
-
- `groupByType` - Group files by detected type
|
|
266
|
-
- `sortOrder` - "alphabetical"
|
|
290
|
+
- `style.includeLineNumbers` - Add line numbers to code references (default: `false`)
|
|
291
|
+
- `style.includeFileStats` - Include file statistics (default: `true`)
|
|
292
|
+
- `style.groupByType` - Group files by detected type (default: `true`)
|
|
293
|
+
- `style.sortOrder` - Sort order: `"alphabetical"`, `"type"`, or `"size"` (default: `"type"`)
|
|
294
|
+
|
|
295
|
+
#### Size Limits
|
|
296
|
+
|
|
297
|
+
- `limits.maxFilesPerContext` - Maximum number of files to analyze (default: `5000`)
|
|
267
298
|
|
|
268
299
|
## Output Format
|
|
269
300
|
|
|
270
|
-
PARSEME always generates
|
|
301
|
+
PARSEME always generates the following output files:
|
|
271
302
|
|
|
272
|
-
- `PARSEME.md` - Main overview
|
|
273
|
-
- Context directory (default: `parseme-context/`) with
|
|
274
|
-
- `
|
|
275
|
-
- `
|
|
276
|
-
- `
|
|
277
|
-
- `
|
|
303
|
+
- `PARSEME.md` - Main overview with links to context files (Markdown)
|
|
304
|
+
- Context directory (default: `parseme-context/`) with structured data files:
|
|
305
|
+
- `files.md` - Complete list of analyzed files (Markdown)
|
|
306
|
+
- `structure.json` - AST analysis with exports, imports, functions, and classes (JSON)
|
|
307
|
+
- `api-endpoints.json` - API routes with methods, paths, and handlers (JSON, only if routes detected)
|
|
308
|
+
- `dependencies.json` - Production dependencies with versions (JSON)
|
|
309
|
+
- `framework.json` - Framework details if detected (JSON, optional)
|
|
310
|
+
- `gitDiff.md` - Git diff statistics from generation time (Markdown, if git enabled)
|
|
278
311
|
|
|
279
312
|
The context directory location can be customized via the `contextDir` configuration option.
|
|
280
313
|
|
|
@@ -282,60 +315,65 @@ The context directory location can be customized via the `contextDir` configurat
|
|
|
282
315
|
|
|
283
316
|
```bash
|
|
284
317
|
# Generate context (auto-detects config file)
|
|
285
|
-
npx parseme
|
|
318
|
+
npx parseme generate
|
|
319
|
+
npx parseme g # alias
|
|
286
320
|
|
|
287
|
-
# Initialize configuration (
|
|
321
|
+
# Initialize configuration (JSON by default)
|
|
288
322
|
npx parseme init
|
|
323
|
+
npx parseme i # alias
|
|
289
324
|
|
|
290
325
|
# Initialize with TypeScript format
|
|
291
326
|
npx parseme init --format ts
|
|
292
327
|
|
|
293
|
-
# Initialize with
|
|
294
|
-
npx parseme init --format
|
|
328
|
+
# Initialize with JavaScript format
|
|
329
|
+
npx parseme init --format js
|
|
295
330
|
|
|
296
331
|
# Use custom config file
|
|
297
|
-
npx parseme --config custom.config.js
|
|
332
|
+
npx parseme generate --config custom.config.js
|
|
333
|
+
|
|
334
|
+
# If added to package.json scripts, use npm run
|
|
335
|
+
npm run parseme
|
|
336
|
+
|
|
337
|
+
# Auto-generate context with git hooks (when configured)
|
|
338
|
+
# Runs automatically after each commit
|
|
298
339
|
|
|
299
340
|
# Override config with CLI flags
|
|
300
|
-
npx parseme --output custom.md --context-dir docs/context --root ./src --no-git
|
|
341
|
+
npx parseme generate --output custom.md --context-dir docs/context --root ./src --no-git
|
|
301
342
|
|
|
302
|
-
#
|
|
303
|
-
npx parseme --
|
|
343
|
+
# Specify file types and exclude patterns
|
|
344
|
+
npx parseme generate --file-types ts js --exclude "**/*.test.ts"
|
|
304
345
|
```
|
|
305
346
|
|
|
306
347
|
### CLI Options
|
|
307
348
|
|
|
349
|
+
#### Generate Command (`parseme generate` or `parseme g`)
|
|
350
|
+
|
|
308
351
|
- `-c, --config <path>` - Config file path
|
|
309
352
|
- `-o, --output <path>` - Output file path
|
|
310
353
|
- `-r, --root <path>` - Root directory to analyze
|
|
311
354
|
- `--context-dir <path>` - Context directory path (default: parseme-context)
|
|
312
|
-
- `--
|
|
313
|
-
- `--exclude <patterns...>` -
|
|
355
|
+
- `--file-types <types...>` - File types to analyze (e.g., ts tsx js jsx)
|
|
356
|
+
- `--exclude <patterns...>` - Additional exclude patterns (glob, in git repositories on top of git-tracked files)
|
|
314
357
|
- `--no-git` - Disable git information
|
|
315
358
|
- `--max-depth <number>` - Maximum directory depth
|
|
316
|
-
- `--no-readme-suggestion` - Disable README.md section suggestion
|
|
317
359
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
When the README suggestion setting is not configured and you're running parseme interactively, you'll be prompted to configure:
|
|
321
|
-
|
|
322
|
-
- **README suggestion** - Whether to show the README.md section suggestion for AI agents
|
|
360
|
+
#### Init Command (`parseme init` or `parseme i`)
|
|
323
361
|
|
|
324
|
-
|
|
362
|
+
- `-f, --force` - Overwrite existing config
|
|
363
|
+
- `--format <format>` - Config format: json, ts, or js (default: json)
|
|
325
364
|
|
|
326
|
-
|
|
327
|
-
- Non-interactive terminals (no TTY)
|
|
328
|
-
- When the value is explicitly provided via CLI flags or config files
|
|
365
|
+
### Interactive Configuration
|
|
329
366
|
|
|
330
|
-
|
|
367
|
+
When running `parseme init` interactively (TTY, not CI), you'll be prompted to configure:
|
|
331
368
|
|
|
332
|
-
|
|
333
|
-
|
|
369
|
+
- **Context directory** - Where to store context files (default: `parseme-context`)
|
|
370
|
+
- **Exclude patterns** - Comma-separated glob patterns (default: `node_modules/**`, `dist/**`, `.git/**` - in git repositories, additional patterns on top of git-tracked files)
|
|
334
371
|
|
|
335
|
-
|
|
372
|
+
After initialization, setup tips are displayed:
|
|
336
373
|
|
|
337
|
-
|
|
338
|
-
|
|
374
|
+
- Package.json script suggestion
|
|
375
|
+
- Git hook integration suggestion
|
|
376
|
+
- README.md section suggestion for AI agents
|
|
339
377
|
|
|
340
378
|
## Framework Support
|
|
341
379
|
|
|
@@ -350,7 +388,7 @@ PARSEME automatically detects and provides specialized analysis for:
|
|
|
350
388
|
### NestJS
|
|
351
389
|
|
|
352
390
|
- Controller and decorator analysis
|
|
353
|
-
- Module structure detection
|
|
391
|
+
- Module structure detection w
|
|
354
392
|
- Dependency injection mapping
|
|
355
393
|
|
|
356
394
|
### Fastify
|
|
@@ -359,49 +397,6 @@ PARSEME automatically detects and provides specialized analysis for:
|
|
|
359
397
|
- Plugin identification
|
|
360
398
|
- Hook analysis
|
|
361
399
|
|
|
362
|
-
### Koa & Hapi
|
|
363
|
-
|
|
364
|
-
- Route and middleware detection
|
|
365
|
-
- Framework-specific patterns
|
|
366
|
-
|
|
367
|
-
## Integration Examples
|
|
368
|
-
|
|
369
|
-
### Basic Express Project
|
|
370
|
-
|
|
371
|
-
```javascript
|
|
372
|
-
// parseme.config.js
|
|
373
|
-
export default {
|
|
374
|
-
includePatterns: ['src/**/*.js', 'routes/**/*.js', 'middleware/**/*.js'],
|
|
375
|
-
frameworks: {
|
|
376
|
-
express: {
|
|
377
|
-
detectMiddleware: true,
|
|
378
|
-
documentRoutes: true,
|
|
379
|
-
},
|
|
380
|
-
},
|
|
381
|
-
};
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
### TypeScript NestJS Project
|
|
385
|
-
|
|
386
|
-
```javascript
|
|
387
|
-
// parseme.config.js
|
|
388
|
-
export default {
|
|
389
|
-
includePatterns: ['src/**/*.ts', '!src/**/*.spec.ts'],
|
|
390
|
-
frameworks: {
|
|
391
|
-
nestjs: {
|
|
392
|
-
includeDecorators: true,
|
|
393
|
-
documentModules: true,
|
|
394
|
-
},
|
|
395
|
-
},
|
|
396
|
-
sections: {
|
|
397
|
-
overview: true,
|
|
398
|
-
architecture: true,
|
|
399
|
-
routes: true,
|
|
400
|
-
dependencies: true,
|
|
401
|
-
},
|
|
402
|
-
};
|
|
403
|
-
```
|
|
404
|
-
|
|
405
400
|
## Programmatic API
|
|
406
401
|
|
|
407
402
|
You can also use PARSEME programmatically:
|
|
@@ -424,7 +419,7 @@ Keep your AI context automatically updated by adding parseme as a post-commit ho
|
|
|
424
419
|
|
|
425
420
|
```bash
|
|
426
421
|
# Create and make executable
|
|
427
|
-
echo '#!/bin/sh\
|
|
422
|
+
echo '#!/bin/sh\npx parseme generate' > .git/hooks/post-commit
|
|
428
423
|
chmod +x .git/hooks/post-commit
|
|
429
424
|
```
|
|
430
425
|
|
|
@@ -435,7 +430,7 @@ chmod +x .git/hooks/post-commit
|
|
|
435
430
|
{
|
|
436
431
|
"husky": {
|
|
437
432
|
"hooks": {
|
|
438
|
-
"post-commit": "npx parseme"
|
|
433
|
+
"post-commit": "npx parseme generate"
|
|
439
434
|
}
|
|
440
435
|
}
|
|
441
436
|
}
|