@parseme/cli 0.1.1 → 0.1.2
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 +81 -45
- package/dist/cli/cli.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -202,6 +202,10 @@ npx husky init
|
|
|
202
202
|
cat > .husky/post-commit << 'EOF'
|
|
203
203
|
#!/bin/sh
|
|
204
204
|
|
|
205
|
+
# Load nvm if available
|
|
206
|
+
export NVM_DIR="$HOME/.nvm"
|
|
207
|
+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
208
|
+
|
|
205
209
|
# Generate PARSEME files locally after commit
|
|
206
210
|
npx @parseme/cli generate
|
|
207
211
|
EOF
|
|
@@ -247,6 +251,10 @@ npx husky init
|
|
|
247
251
|
cat > .husky/post-commit << 'EOF'
|
|
248
252
|
#!/bin/sh
|
|
249
253
|
|
|
254
|
+
# Load nvm if available
|
|
255
|
+
export NVM_DIR="$HOME/.nvm"
|
|
256
|
+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
257
|
+
|
|
250
258
|
npx @parseme/cli generate
|
|
251
259
|
EOF
|
|
252
260
|
|
|
@@ -254,6 +262,10 @@ EOF
|
|
|
254
262
|
cat > .husky/pre-push << 'EOF'
|
|
255
263
|
#!/bin/sh
|
|
256
264
|
|
|
265
|
+
# Load nvm if available
|
|
266
|
+
export NVM_DIR="$HOME/.nvm"
|
|
267
|
+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
268
|
+
|
|
257
269
|
# Regenerate without git info for clean remote state
|
|
258
270
|
npx @parseme/cli generate --no-git-info
|
|
259
271
|
|
|
@@ -268,6 +280,10 @@ EOF
|
|
|
268
280
|
cat > .husky/post-push << 'EOF'
|
|
269
281
|
#!/bin/sh
|
|
270
282
|
|
|
283
|
+
# Load nvm if available
|
|
284
|
+
export NVM_DIR="$HOME/.nvm"
|
|
285
|
+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
286
|
+
|
|
271
287
|
# Regenerate with git info for local development
|
|
272
288
|
npx @parseme/cli generate
|
|
273
289
|
EOF
|
|
@@ -326,19 +342,11 @@ The `--no-verify` flag in pre-push prevents an infinite loop by skipping hook ex
|
|
|
326
342
|
|
|
327
343
|
### Option 4: GitHub Actions for Remote Generation paired with Local Generation
|
|
328
344
|
|
|
329
|
-
Use GitHub Actions to automatically
|
|
345
|
+
Use GitHub Actions to automatically update PARSEME files on every push to main. This is the recommended approach for teams using GitHub.
|
|
330
346
|
|
|
331
347
|
**Setup:**
|
|
332
348
|
|
|
333
|
-
**1.
|
|
334
|
-
|
|
335
|
-
```gitignore
|
|
336
|
-
# Parseme documentation (generated locally and by CI)
|
|
337
|
-
parseme-context/
|
|
338
|
-
PARSEME.md
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
**2. Create `.github/workflows/parseme-update.yml`:**
|
|
349
|
+
**1. Create `.github/workflows/parseme-update.yml`:**
|
|
342
350
|
|
|
343
351
|
```yaml
|
|
344
352
|
name: Update PARSEME Documentation
|
|
@@ -346,7 +354,7 @@ name: Update PARSEME Documentation
|
|
|
346
354
|
on:
|
|
347
355
|
push:
|
|
348
356
|
branches:
|
|
349
|
-
- main
|
|
357
|
+
- 'main'
|
|
350
358
|
|
|
351
359
|
jobs:
|
|
352
360
|
update-parseme:
|
|
@@ -357,49 +365,46 @@ jobs:
|
|
|
357
365
|
GITHUB_TOKEN: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }}
|
|
358
366
|
|
|
359
367
|
steps:
|
|
360
|
-
- name:
|
|
361
|
-
id: check_pusher
|
|
368
|
+
- name: Service Account Gate
|
|
362
369
|
run: |
|
|
363
370
|
if [ "${{ github.event.pusher.name }}" = "${{ secrets.GH_SERVICE_ACCOUNT_USERNAME }}" ]; then
|
|
364
|
-
echo "
|
|
365
|
-
|
|
366
|
-
echo "is_bot=false" >> $GITHUB_OUTPUT
|
|
371
|
+
echo "::notice::Skipping workflow - push was made by service account"
|
|
372
|
+
exit 1
|
|
367
373
|
fi
|
|
368
374
|
|
|
369
375
|
- name: Checkout code
|
|
370
|
-
if: steps.check_pusher.outputs.is_bot == 'false'
|
|
371
376
|
uses: actions/checkout@v4
|
|
372
377
|
with:
|
|
373
378
|
fetch-depth: 0
|
|
374
379
|
token: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }}
|
|
375
380
|
|
|
376
381
|
- name: Setup Node.js
|
|
377
|
-
if: steps.check_pusher.outputs.is_bot == 'false'
|
|
378
382
|
uses: actions/setup-node@v4
|
|
379
383
|
with:
|
|
380
|
-
node-version: '
|
|
384
|
+
node-version: '24'
|
|
381
385
|
cache: 'npm'
|
|
382
386
|
|
|
383
387
|
- name: Configure Git
|
|
384
|
-
if: steps.check_pusher.outputs.is_bot == 'false'
|
|
385
388
|
run: |
|
|
386
389
|
git config user.name "${{ secrets.GH_SERVICE_ACCOUNT_USERNAME }}"
|
|
387
390
|
git config user.email "${{ secrets.GH_SERVICE_ACCOUNT_USERNAME }}@users.noreply.github.com"
|
|
388
391
|
|
|
392
|
+
- name: Configure npm for GitHub Packages
|
|
393
|
+
run: |
|
|
394
|
+
npm config set @netgear:registry https://npm.pkg.github.com/
|
|
395
|
+
npm config set //npm.pkg.github.com/:_authToken "${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }}"
|
|
396
|
+
|
|
389
397
|
- name: Install dependencies
|
|
390
|
-
if: steps.check_pusher.outputs.is_bot == 'false'
|
|
391
398
|
run: npm ci
|
|
392
399
|
|
|
393
|
-
- name: Generate
|
|
394
|
-
|
|
395
|
-
run: parseme generate --no-git-info
|
|
400
|
+
- name: Generate PARSEME documentation
|
|
401
|
+
run: npx parseme generate --no-git-info
|
|
396
402
|
|
|
397
|
-
- name:
|
|
398
|
-
|
|
399
|
-
|
|
403
|
+
- name: Stage changes
|
|
404
|
+
run: |
|
|
405
|
+
git add PARSEME.md parseme-context/
|
|
400
406
|
|
|
401
407
|
- name: Check for changes
|
|
402
|
-
if: steps.check_pusher.outputs.is_bot == 'false'
|
|
403
408
|
id: check_changes
|
|
404
409
|
run: |
|
|
405
410
|
if git diff --cached --quiet; then
|
|
@@ -408,56 +413,87 @@ jobs:
|
|
|
408
413
|
echo "changes=true" >> $GITHUB_OUTPUT
|
|
409
414
|
fi
|
|
410
415
|
|
|
411
|
-
- name: Commit
|
|
412
|
-
if: steps.
|
|
416
|
+
- name: Commit
|
|
417
|
+
if: steps.check_changes.outputs.changes == 'true'
|
|
413
418
|
run: |
|
|
414
|
-
git commit
|
|
415
|
-
git push
|
|
419
|
+
git commit -m "chore: Update PARSEME AI Agent Context [skip ci]" --no-verify
|
|
420
|
+
git push
|
|
416
421
|
```
|
|
417
422
|
|
|
418
|
-
**
|
|
423
|
+
**2. Configure GitHub secrets:**
|
|
419
424
|
|
|
420
425
|
- `GH_SERVICE_ACCOUNT_TOKEN`: A GitHub personal access token with repo write permissions
|
|
421
|
-
- `GH_SERVICE_ACCOUNT_USERNAME`: The username of your service account
|
|
426
|
+
- `GH_SERVICE_ACCOUNT_USERNAME`: The username of your service account
|
|
422
427
|
|
|
423
|
-
**
|
|
428
|
+
**3. Setup local git hooks with Husky:**
|
|
424
429
|
|
|
425
430
|
```bash
|
|
426
431
|
# Install Husky (if not already installed)
|
|
427
432
|
npm install --save-dev husky
|
|
428
433
|
npx husky init
|
|
429
434
|
|
|
435
|
+
# Create pre-commit hook
|
|
436
|
+
cat > .husky/pre-commit << 'EOF'
|
|
437
|
+
#!/bin/sh
|
|
438
|
+
|
|
439
|
+
# Pre-commit hook to reset PARSEME files to prevent them from being committed
|
|
440
|
+
for file in $(git ls-files parseme-context/ PARSEME.md 2>/dev/null); do
|
|
441
|
+
git restore --staged "$file" 2>/dev/null
|
|
442
|
+
done
|
|
443
|
+
EOF
|
|
444
|
+
|
|
430
445
|
# Create post-commit hook
|
|
431
446
|
cat > .husky/post-commit << 'EOF'
|
|
432
447
|
#!/bin/sh
|
|
433
448
|
|
|
434
|
-
#
|
|
435
|
-
|
|
449
|
+
# Load nvm if available
|
|
450
|
+
export NVM_DIR="$HOME/.nvm"
|
|
451
|
+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
452
|
+
|
|
453
|
+
# Generate PARSEME files locally after commit for local AI agent usage
|
|
454
|
+
npx @parseme/cli generate --no-git-info
|
|
436
455
|
EOF
|
|
437
456
|
|
|
438
457
|
# Create post-merge hook
|
|
439
458
|
cat > .husky/post-merge << 'EOF'
|
|
440
459
|
#!/bin/sh
|
|
441
460
|
|
|
442
|
-
#
|
|
443
|
-
|
|
461
|
+
# Load nvm if available
|
|
462
|
+
export NVM_DIR="$HOME/.nvm"
|
|
463
|
+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
464
|
+
|
|
465
|
+
# Generate PARSEME files locally after merge for local AI agent usage
|
|
466
|
+
npx @parseme/cli generate --no-git-info
|
|
467
|
+
EOF
|
|
468
|
+
|
|
469
|
+
# Create post-checkout hook
|
|
470
|
+
cat > .husky/post-checkout << 'EOF'
|
|
471
|
+
#!/bin/sh
|
|
472
|
+
|
|
473
|
+
# Load nvm if available
|
|
474
|
+
export NVM_DIR="$HOME/.nvm"
|
|
475
|
+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
|
476
|
+
|
|
477
|
+
# Generate PARSEME files locally after checkout for local AI agent usage
|
|
478
|
+
npx @parseme/cli generate --no-git-info
|
|
444
479
|
EOF
|
|
445
480
|
|
|
446
481
|
# Make hooks executable
|
|
447
|
-
chmod +x .husky/post-commit .husky/post-merge
|
|
482
|
+
chmod +x .husky/pre-commit .husky/post-commit .husky/post-merge .husky/post-checkout
|
|
448
483
|
```
|
|
449
484
|
|
|
450
485
|
**How it works:**
|
|
451
486
|
|
|
452
|
-
1. **
|
|
453
|
-
2. **
|
|
454
|
-
3. **
|
|
455
|
-
4. **
|
|
487
|
+
1. **On push to main**: GitHub Actions detects the push
|
|
488
|
+
2. **Service account check**: Workflow exits early if the push was made by the service account
|
|
489
|
+
3. **Generate and commit**: Generates PARSEME files with `--no-git-info` flag and creates a new commit with `[skip ci]` message
|
|
490
|
+
4. **Push changes**: The new commit is pushed back to the repository
|
|
491
|
+
5. **Local hooks**: Pre-commit hook prevents PARSEME files from being committed manually, while post-commit/merge/checkout hooks regenerate them locally for AI agent usage
|
|
456
492
|
|
|
457
493
|
**Notes:**
|
|
458
494
|
|
|
459
495
|
- The workflow only runs on the `main` branch (adjust as needed for your branching strategy)
|
|
460
|
-
- If using a custom `contextDir`, update
|
|
496
|
+
- If using a custom `contextDir`, update the paths in both the workflow and hooks accordingly
|
|
461
497
|
|
|
462
498
|
## Configuration
|
|
463
499
|
|
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.2');
|
|
12
12
|
// Generate command
|
|
13
13
|
program
|
|
14
14
|
.command('generate')
|
package/package.json
CHANGED