@parseme/cli 0.1.0 → 0.1.1
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 +34 -48
- package/dist/cli/cli.js +1 -1
- package/dist/core/context-builder.js +17 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -120,7 +120,7 @@ PARSEME aims to automatically analyse any JavaScript or TypeScript project like:
|
|
|
120
120
|
## Installation
|
|
121
121
|
|
|
122
122
|
```bash
|
|
123
|
-
npm install --save-dev parseme
|
|
123
|
+
npm install --save-dev @parseme/cli
|
|
124
124
|
```
|
|
125
125
|
|
|
126
126
|
## Quick Start
|
|
@@ -128,9 +128,9 @@ npm install --save-dev parseme
|
|
|
128
128
|
1. **Initialize configuration**:
|
|
129
129
|
|
|
130
130
|
```bash
|
|
131
|
-
npx parseme init
|
|
131
|
+
npx @parseme/cli init
|
|
132
132
|
# or use the alias
|
|
133
|
-
npx parseme i
|
|
133
|
+
npx @parseme/cli i
|
|
134
134
|
```
|
|
135
135
|
|
|
136
136
|
You'll be prompted for:
|
|
@@ -147,9 +147,9 @@ npm install --save-dev parseme
|
|
|
147
147
|
|
|
148
148
|
2. **Generate context**:
|
|
149
149
|
```bash
|
|
150
|
-
npx parseme generate
|
|
150
|
+
npx @parseme/cli generate
|
|
151
151
|
# or use the alias
|
|
152
|
-
npx parseme g
|
|
152
|
+
npx @parseme/cli g
|
|
153
153
|
```
|
|
154
154
|
|
|
155
155
|
This creates:
|
|
@@ -182,11 +182,9 @@ Add to your `package.json` scripts (optional, for convenience):
|
|
|
182
182
|
```bash
|
|
183
183
|
npm run parseme
|
|
184
184
|
# or directly
|
|
185
|
-
|
|
185
|
+
parseme generate
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
-
**Best for:** Small projects, occasional updates, or when you prefer full control over when context is generated.
|
|
189
|
-
|
|
190
188
|
---
|
|
191
189
|
|
|
192
190
|
### Option 2: Automatic Local Generation
|
|
@@ -205,7 +203,7 @@ cat > .husky/post-commit << 'EOF'
|
|
|
205
203
|
#!/bin/sh
|
|
206
204
|
|
|
207
205
|
# Generate PARSEME files locally after commit
|
|
208
|
-
npx parseme generate
|
|
206
|
+
npx @parseme/cli generate
|
|
209
207
|
EOF
|
|
210
208
|
|
|
211
209
|
# Make hook executable
|
|
@@ -218,7 +216,7 @@ chmod +x .husky/post-commit
|
|
|
218
216
|
cat > .git/hooks/post-commit << 'EOF'
|
|
219
217
|
#!/bin/sh
|
|
220
218
|
|
|
221
|
-
npx parseme generate
|
|
219
|
+
npx @parseme/cli generate
|
|
222
220
|
EOF
|
|
223
221
|
|
|
224
222
|
chmod +x .git/hooks/post-commit
|
|
@@ -230,8 +228,6 @@ chmod +x .git/hooks/post-commit
|
|
|
230
228
|
- Files are ready to be staged and committed with your next commit
|
|
231
229
|
- Simple setup with minimal configuration
|
|
232
230
|
|
|
233
|
-
**Best for:** Solo developers or small teams wanting automatic local updates with committed parseme files.
|
|
234
|
-
|
|
235
231
|
**Note:** If using a custom `contextDir`, ensure the path is consistent across your team's configuration.
|
|
236
232
|
|
|
237
233
|
---
|
|
@@ -251,7 +247,7 @@ npx husky init
|
|
|
251
247
|
cat > .husky/post-commit << 'EOF'
|
|
252
248
|
#!/bin/sh
|
|
253
249
|
|
|
254
|
-
npx parseme generate
|
|
250
|
+
npx @parseme/cli generate
|
|
255
251
|
EOF
|
|
256
252
|
|
|
257
253
|
# Create pre-push hook
|
|
@@ -259,7 +255,7 @@ cat > .husky/pre-push << 'EOF'
|
|
|
259
255
|
#!/bin/sh
|
|
260
256
|
|
|
261
257
|
# Regenerate without git info for clean remote state
|
|
262
|
-
npx parseme generate --no-git-info
|
|
258
|
+
npx @parseme/cli generate --no-git-info
|
|
263
259
|
|
|
264
260
|
# Stage parseme files
|
|
265
261
|
git add parseme-context/ PARSEME.md
|
|
@@ -273,7 +269,7 @@ cat > .husky/post-push << 'EOF'
|
|
|
273
269
|
#!/bin/sh
|
|
274
270
|
|
|
275
271
|
# Regenerate with git info for local development
|
|
276
|
-
npx parseme generate
|
|
272
|
+
npx @parseme/cli generate
|
|
277
273
|
EOF
|
|
278
274
|
|
|
279
275
|
# Make hooks executable
|
|
@@ -287,7 +283,7 @@ chmod +x .husky/post-commit .husky/pre-push .husky/post-push
|
|
|
287
283
|
cat > .git/hooks/post-commit << 'EOF'
|
|
288
284
|
#!/bin/sh
|
|
289
285
|
|
|
290
|
-
npx parseme generate
|
|
286
|
+
npx @parseme/cli generate
|
|
291
287
|
EOF
|
|
292
288
|
|
|
293
289
|
# Pre-push: Regenerate without git info and amend before pushing
|
|
@@ -295,7 +291,7 @@ cat > .git/hooks/pre-push << 'EOF'
|
|
|
295
291
|
#!/bin/sh
|
|
296
292
|
|
|
297
293
|
# Regenerate without git info for clean remote state
|
|
298
|
-
npx parseme generate --no-git-info
|
|
294
|
+
npx @parseme/cli generate --no-git-info
|
|
299
295
|
|
|
300
296
|
# Stage parseme files
|
|
301
297
|
git add parseme-context/ PARSEME.md
|
|
@@ -309,7 +305,7 @@ cat > .git/hooks/post-push << 'EOF'
|
|
|
309
305
|
#!/bin/sh
|
|
310
306
|
|
|
311
307
|
# Regenerate with git info for local development
|
|
312
|
-
npx parseme generate
|
|
308
|
+
npx @parseme/cli generate
|
|
313
309
|
EOF
|
|
314
310
|
|
|
315
311
|
# Make hooks executable
|
|
@@ -324,8 +320,6 @@ chmod +x .git/hooks/post-commit .git/hooks/pre-push .git/hooks/post-push
|
|
|
324
320
|
|
|
325
321
|
The `--no-verify` flag in pre-push prevents an infinite loop by skipping hook execution on the amend.
|
|
326
322
|
|
|
327
|
-
**Best for:** Teams that want detailed local context for development while keeping clean, portable context in the repository.
|
|
328
|
-
|
|
329
323
|
**Note:** If using a custom `contextDir`, update the `git add` path in the pre-push hook (e.g., `git add docs/context/ PARSEME.md`).
|
|
330
324
|
|
|
331
325
|
---
|
|
@@ -398,7 +392,7 @@ jobs:
|
|
|
398
392
|
|
|
399
393
|
- name: Generate ParseMe documentation
|
|
400
394
|
if: steps.check_pusher.outputs.is_bot == 'false'
|
|
401
|
-
run:
|
|
395
|
+
run: parseme generate --no-git-info
|
|
402
396
|
|
|
403
397
|
- name: Force add parseme files (ignored in .gitignore)
|
|
404
398
|
if: steps.check_pusher.outputs.is_bot == 'false'
|
|
@@ -438,7 +432,7 @@ cat > .husky/post-commit << 'EOF'
|
|
|
438
432
|
#!/bin/sh
|
|
439
433
|
|
|
440
434
|
# Generate PARSEME files locally after commit
|
|
441
|
-
npx parseme generate
|
|
435
|
+
npx @parseme/cli generate
|
|
442
436
|
EOF
|
|
443
437
|
|
|
444
438
|
# Create post-merge hook
|
|
@@ -460,8 +454,6 @@ chmod +x .husky/post-commit .husky/post-merge
|
|
|
460
454
|
3. **Remote updates**: GitHub Actions automatically generates and commits parseme files (without git info) when pushing to main
|
|
461
455
|
4. **After pull/merge**: The post-merge hook ensures parseme files stay untracked locally, preventing conflicts
|
|
462
456
|
|
|
463
|
-
**Best for:** Teams using GitHub that want automated CI-managed remote updates with local context for development.
|
|
464
|
-
|
|
465
457
|
**Notes:**
|
|
466
458
|
|
|
467
459
|
- The workflow only runs on the `main` branch (adjust as needed for your branching strategy)
|
|
@@ -476,7 +468,7 @@ The `parseme init` command creates a minimal config with only your custom settin
|
|
|
476
468
|
**Minimal config example** (created by `parseme init`):
|
|
477
469
|
|
|
478
470
|
```javascript
|
|
479
|
-
/** @type {import('parseme').ParsemeConfigFile} */
|
|
471
|
+
/** @type {import('@parseme/cli').ParsemeConfigFile} */
|
|
480
472
|
const config = {
|
|
481
473
|
contextDir: 'parseme-context',
|
|
482
474
|
excludePatterns: ['node_modules/**', '.git/**'],
|
|
@@ -488,7 +480,7 @@ export default config;
|
|
|
488
480
|
**Full config example** (all available options):
|
|
489
481
|
|
|
490
482
|
```javascript
|
|
491
|
-
/** @type {import('parseme').ParsemeConfigFile} */
|
|
483
|
+
/** @type {import('@parseme/cli').ParsemeConfigFile} */
|
|
492
484
|
const config = {
|
|
493
485
|
// Output settings
|
|
494
486
|
outputPath: 'PARSEME.md',
|
|
@@ -551,7 +543,7 @@ PARSEME supports three configuration formats with the following priority:
|
|
|
551
543
|
#### Example TypeScript Configuration
|
|
552
544
|
|
|
553
545
|
```typescript
|
|
554
|
-
import type { ParsemeConfigFile } from 'parseme';
|
|
546
|
+
import type { ParsemeConfigFile } from '@parseme/cli';
|
|
555
547
|
|
|
556
548
|
const config: ParsemeConfigFile = {
|
|
557
549
|
contextDir: 'parseme-context',
|
|
@@ -565,7 +557,7 @@ export default config;
|
|
|
565
557
|
#### Example JavaScript Configuration
|
|
566
558
|
|
|
567
559
|
```javascript
|
|
568
|
-
/** @type {import('parseme').ParsemeConfigFile} */
|
|
560
|
+
/** @type {import('@parseme/cli').ParsemeConfigFile} */
|
|
569
561
|
const config = {
|
|
570
562
|
contextDir: 'parseme-context',
|
|
571
563
|
excludePatterns: ['node_modules/**', 'dist/**', '.git/**'],
|
|
@@ -583,7 +575,7 @@ Configuration values are resolved in the following order (highest to lowest prio
|
|
|
583
575
|
2. **Config file** - Based on file format priority above
|
|
584
576
|
3. **Default values** - Built-in sensible defaults
|
|
585
577
|
|
|
586
|
-
**Example**: `
|
|
578
|
+
**Example**: `parseme --output custom.md` overrides `outputPath` from config file.
|
|
587
579
|
|
|
588
580
|
### Configuration Options
|
|
589
581
|
|
|
@@ -663,42 +655,36 @@ After initialization, setup tips are displayed:
|
|
|
663
655
|
|
|
664
656
|
```bash
|
|
665
657
|
# Generate context (auto-detects config file)
|
|
666
|
-
|
|
667
|
-
|
|
658
|
+
parseme generate
|
|
659
|
+
parseme g # alias
|
|
668
660
|
|
|
669
661
|
# Initialize configuration (JSON by default)
|
|
670
|
-
|
|
671
|
-
|
|
662
|
+
parseme init
|
|
663
|
+
parseme i # alias
|
|
672
664
|
|
|
673
665
|
# Initialize with TypeScript format
|
|
674
|
-
|
|
666
|
+
parseme init --format ts
|
|
675
667
|
|
|
676
668
|
# Initialize with JavaScript format
|
|
677
|
-
|
|
669
|
+
parseme init --format js
|
|
678
670
|
|
|
679
671
|
# Use custom config file
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
# If added to package.json scripts, use npm run
|
|
683
|
-
npm run parseme
|
|
684
|
-
|
|
685
|
-
# Auto-generate context with git hooks (when configured)
|
|
686
|
-
# Runs automatically after each commit
|
|
672
|
+
parseme generate --config custom.config.js
|
|
687
673
|
|
|
688
674
|
# Override config with CLI flags
|
|
689
|
-
|
|
675
|
+
parseme generate --output custom.md --context-dir docs/context --root ./src
|
|
690
676
|
|
|
691
677
|
# Disable git info generation (keeps git for file discovery)
|
|
692
|
-
|
|
678
|
+
parseme generate --no-git-info
|
|
693
679
|
|
|
694
680
|
# Disable git for file discovery (keeps git info generation)
|
|
695
|
-
|
|
681
|
+
parseme generate --no-git-files
|
|
696
682
|
|
|
697
683
|
# Disable both git info and git file discovery
|
|
698
|
-
|
|
684
|
+
parseme generate --no-git-info --no-git-files
|
|
699
685
|
|
|
700
686
|
# Specify file types and exclude patterns
|
|
701
|
-
|
|
687
|
+
parseme generate --file-types ts js --exclude "**/*.test.ts"
|
|
702
688
|
```
|
|
703
689
|
|
|
704
690
|
## Programmatic API
|
|
@@ -706,7 +692,7 @@ npx parseme generate --file-types ts js --exclude "**/*.test.ts"
|
|
|
706
692
|
You can also use PARSEME programmatically:
|
|
707
693
|
|
|
708
694
|
```typescript
|
|
709
|
-
import { ParsemeGenerator } from 'parseme';
|
|
695
|
+
import { ParsemeGenerator } from '@parseme/cli';
|
|
710
696
|
|
|
711
697
|
const generator = await ParsemeGenerator.fromConfig('./custom.config.js');
|
|
712
698
|
const context = await generator.generate();
|
package/dist/cli/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ const program = new Command();
|
|
|
8
8
|
async function promptForMissingConfig(config) {
|
|
9
9
|
return { ...config };
|
|
10
10
|
}
|
|
11
|
-
program.name('parseme').description('AI Project Context Generator').version('0.1.
|
|
11
|
+
program.name('parseme').description('AI Project Context Generator').version('0.1.1');
|
|
12
12
|
// Generate command
|
|
13
13
|
program
|
|
14
14
|
.command('generate')
|
|
@@ -38,11 +38,11 @@ export class ContextBuilder {
|
|
|
38
38
|
});
|
|
39
39
|
const hasRoutes = routes.length > 0;
|
|
40
40
|
const mainContent = this.buildHeader(linkPath, hasRoutes) +
|
|
41
|
-
'\n\n
|
|
41
|
+
'\n\n' +
|
|
42
42
|
this.buildProjectOverview(projectInfo) +
|
|
43
|
-
'\n\n
|
|
43
|
+
'\n\n' +
|
|
44
44
|
this.buildSummarySection(linkPath, hasRoutes) +
|
|
45
|
-
'\n\n
|
|
45
|
+
'\n\n' +
|
|
46
46
|
(gitInfo ? this.buildGitSection(gitInfo) : '');
|
|
47
47
|
const contextFiles = {
|
|
48
48
|
structure: '',
|
|
@@ -73,9 +73,11 @@ export class ContextBuilder {
|
|
|
73
73
|
: `5. For git tracked projects, follow the instructions in the "Git Information" section of this file to validate the actuality of the provided information.
|
|
74
74
|
6. Only dive deeper into specific files after reviewing this summary, that replaces the need for initial project exploration and significantly reduces token usage for project comprehension.`;
|
|
75
75
|
return `## PARSEME - AI Agent Context
|
|
76
|
+
|
|
76
77
|
Auto-generated project summary optimized for AI coding agents. This file provides complete project context without requiring full codebase traversal, designed for token efficiency.
|
|
77
78
|
|
|
78
79
|
**Usage Instructions for AI Agents:**
|
|
80
|
+
|
|
79
81
|
1. Read this PARSEME.md file completely first before accessing individual project files
|
|
80
82
|
2. Basic project information, script availability and dependency information provides basic understanding of code base and tech stack without checking package.json
|
|
81
83
|
3. Use the provided file list [${linkPath}/files.md](${linkPath}/files.md) to see all tracked files in the project
|
|
@@ -98,14 +100,14 @@ ${routesInstructions}`;
|
|
|
98
100
|
// Add dependencies
|
|
99
101
|
const deps = Object.keys(projectInfo.dependencies);
|
|
100
102
|
if (deps.length > 0) {
|
|
101
|
-
content += '\n
|
|
103
|
+
content += '\n### Dependencies\n\n';
|
|
102
104
|
deps.forEach((dep) => {
|
|
103
105
|
content += `- ${dep}\n`;
|
|
104
106
|
});
|
|
105
107
|
}
|
|
106
108
|
// Add available scripts
|
|
107
109
|
if (projectInfo.scripts && Object.keys(projectInfo.scripts).length > 0) {
|
|
108
|
-
content += '\n### Available Scripts\n';
|
|
110
|
+
content += '\n### Available Scripts\n\n';
|
|
109
111
|
Object.entries(projectInfo.scripts).forEach(([name, script]) => {
|
|
110
112
|
content += `- **${name}**: \`${script}\`\n`;
|
|
111
113
|
});
|
|
@@ -130,27 +132,32 @@ ${routesInstructions}`;
|
|
|
130
132
|
- **Branch:** ${gitInfo.branch}
|
|
131
133
|
- **Commit:** ${gitInfo.lastCommit}${gitInfo.origin ? `\n- **Origin:** ${gitInfo.origin}` : ''}
|
|
132
134
|
|
|
133
|
-
### Git Diff Statistics
|
|
135
|
+
### Git Diff Statistics
|
|
136
|
+
`;
|
|
134
137
|
const info = gitInfo.diffStat && gitInfo.diffStat.length > 0
|
|
135
138
|
? `Git diff statistics from the time of generation are available at [parseme-context/gitDiff.md](parseme-context/gitDiff.md) (relative to the commit mentioned above).
|
|
136
139
|
|
|
137
140
|
**AI Agent Command:** To check for changes since generation, run:
|
|
141
|
+
|
|
138
142
|
\`\`\`bash
|
|
139
143
|
git diff --stat
|
|
140
144
|
\`\`\`
|
|
145
|
+
|
|
141
146
|
Compare the output with the baseline in [parseme-context/gitDiff.md](parseme-context/gitDiff.md) to detect any modifications.`
|
|
142
147
|
: `Git diff statistics showed no changes at the time of generation relative to the commit mentioned above.`;
|
|
143
|
-
return base + '\n
|
|
148
|
+
return base + '\n' + info;
|
|
144
149
|
}
|
|
145
150
|
buildSummarySection(linkPath, hasRoutes) {
|
|
146
151
|
let content = `## Project Files
|
|
147
|
-
A complete list of all git-tracked files in the project (excluding files matching additional exclude patterns) is available at [${linkPath}/files.md](${linkPath}/files.md). This provides a quick overview of the project structure.
|
|
148
152
|
|
|
153
|
+
A complete list of all git-tracked files in the project (excluding files matching additional exclude patterns) is available at [${linkPath}/files.md](${linkPath}/files.md). This provides a quick overview of the project structure.
|
|
149
154
|
|
|
150
155
|
## Project Structure & AST
|
|
156
|
+
|
|
151
157
|
Detailed structure and Abstract Syntax Tree data for all tracked files is available at [${linkPath}/structure.json](${linkPath}/structure.json). This includes file paths, types, imports, exports, functions, classes, interfaces, and routes for comprehensive code analysis without manual parsing.`;
|
|
152
158
|
if (hasRoutes) {
|
|
153
|
-
content += `\n\n
|
|
159
|
+
content += `\n\n## API Routes
|
|
160
|
+
|
|
154
161
|
A comprehensive list of all discovered API routes is available at [${linkPath}/routes.json](${linkPath}/routes.json). This includes HTTP methods, paths, handler names, and source file locations for backend routes (Express, NestJS, and decorator-based routing).`;
|
|
155
162
|
}
|
|
156
163
|
return content;
|
|
@@ -218,6 +225,7 @@ A comprehensive list of all discovered API routes is available at [${linkPath}/r
|
|
|
218
225
|
}
|
|
219
226
|
buildDetailedGit(gitInfo) {
|
|
220
227
|
let content = `# Git Diff Statistics
|
|
228
|
+
|
|
221
229
|
`;
|
|
222
230
|
content += gitInfo.diffStat;
|
|
223
231
|
return content;
|
package/package.json
CHANGED