@gi4nks/ph 1.4.0 → 1.5.0
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/CHANGELOG.md +7 -0
- package/README.md +129 -6
- package/dist/cli.js +278 -1
- package/dist/cli.js.map +1 -1
- package/docs/ph-manual.md +160 -0
- package/package.json +1 -1
package/docs/ph-manual.md
CHANGED
|
@@ -356,6 +356,166 @@ ph treats your prompt history as a first-class artifact: searchable, annotated,
|
|
|
356
356
|
|
|
357
357
|
---
|
|
358
358
|
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## 7. Remote Server Setup
|
|
362
|
+
|
|
363
|
+
ph can act as a central sync hub for prompt history across multiple machines.
|
|
364
|
+
|
|
365
|
+
### Server Installation
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
# Install globally
|
|
369
|
+
sudo npm install -g @gi4nks/ph
|
|
370
|
+
|
|
371
|
+
# Verify
|
|
372
|
+
ph --help
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### Ubuntu (systemd service)
|
|
376
|
+
|
|
377
|
+
Create `/etc/systemd/system/ph.service`:
|
|
378
|
+
|
|
379
|
+
```ini
|
|
380
|
+
[Unit]
|
|
381
|
+
Description=ph remote sync server
|
|
382
|
+
After=network.target
|
|
383
|
+
|
|
384
|
+
[Service]
|
|
385
|
+
Type=simple
|
|
386
|
+
ExecStart=<path-to-ph> server --port 3001 --host 0.0.0.0
|
|
387
|
+
Restart=always
|
|
388
|
+
RestartSec=5
|
|
389
|
+
User=<your-user>
|
|
390
|
+
Environment=NODE_ENV=production
|
|
391
|
+
StandardOutput=append:/var/log/ph-server.log
|
|
392
|
+
StandardError=append:/var/log/ph-server.log
|
|
393
|
+
|
|
394
|
+
[Install]
|
|
395
|
+
WantedBy=multi-user.target
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
Replace `<path-to-ph>` with the output of `which ph` on the server, and `<your-user>` with the user running the service.
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
sudo systemctl daemon-reload
|
|
402
|
+
sudo systemctl enable --now ph.service
|
|
403
|
+
sudo systemctl status ph.service
|
|
404
|
+
sudo ufw allow 3001/tcp # if firewall is enabled
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### macOS (launchd)
|
|
408
|
+
|
|
409
|
+
Create `~/Library/LaunchAgents/com.gi4nks.ph.plist`:
|
|
410
|
+
|
|
411
|
+
```xml
|
|
412
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
413
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
414
|
+
<plist version="1.0">
|
|
415
|
+
<dict>
|
|
416
|
+
<key>Label</key>
|
|
417
|
+
<string>com.gi4nks.ph</string>
|
|
418
|
+
<key>ProgramArguments</key>
|
|
419
|
+
<array>
|
|
420
|
+
<string>/usr/local/bin/ph</string>
|
|
421
|
+
<string>server</string>
|
|
422
|
+
<string>--port</string>
|
|
423
|
+
<string>3001</string>
|
|
424
|
+
<string>--host</string>
|
|
425
|
+
<string>0.0.0.0</string>
|
|
426
|
+
</array>
|
|
427
|
+
<key>RunAtLoad</key>
|
|
428
|
+
<true/>
|
|
429
|
+
<key>KeepAlive</key>
|
|
430
|
+
<true/>
|
|
431
|
+
<key>StandardOutPath</key>
|
|
432
|
+
<string>/tmp/ph-server.log</string>
|
|
433
|
+
<key>StandardErrorPath</key>
|
|
434
|
+
<string>/tmp/ph-server.err</string>
|
|
435
|
+
</dict>
|
|
436
|
+
</plist>
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
```bash
|
|
440
|
+
launchctl load ~/Library/LaunchAgents/com.gi4nks.ph.plist
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
### Client Setup
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
# Configure remote server URL
|
|
447
|
+
ph config set remote-url http://<server-ip>:3001
|
|
448
|
+
# Or via env var (takes precedence)
|
|
449
|
+
export PH_REMOTE_URL=http://<server-ip>:3001
|
|
450
|
+
|
|
451
|
+
# Sync commands
|
|
452
|
+
ph remote push # send unsynced local prompts to server
|
|
453
|
+
ph remote pull # fetch remote prompts since last pull
|
|
454
|
+
ph remote status # show sync state
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
After `ph remote-url` is configured, every `ph log` automatically does a background push to the server (fire-and-forget, never blocks).
|
|
458
|
+
|
|
459
|
+
### Logs
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
# systemd
|
|
463
|
+
sudo journalctl -u ph.service -f
|
|
464
|
+
|
|
465
|
+
# launchd
|
|
466
|
+
cat /tmp/ph-server.log
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
## 8. Release Process
|
|
472
|
+
|
|
473
|
+
Releases are fully automated via **semantic-release** using conventional commits.
|
|
474
|
+
|
|
475
|
+
### How it works
|
|
476
|
+
|
|
477
|
+
1. All commits must follow the [Conventional Commits](https://www.conventionalcommits.org/) format:
|
|
478
|
+
|
|
479
|
+
```
|
|
480
|
+
feat: add new feature → minor release (1.x.0)
|
|
481
|
+
fix: resolve bug → patch release (1.0.x)
|
|
482
|
+
chore: bump deps → no release
|
|
483
|
+
BREAKING CHANGE: ... → major release (x.0.0)
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
2. Push to `main` triggers GitHub Actions workflow `.github/workflows/release.yml`
|
|
487
|
+
|
|
488
|
+
3. The workflow runs:
|
|
489
|
+
- `actions/checkout@v4` with full git history (`fetch-depth: 0`)
|
|
490
|
+
- `actions/setup-node@v4` with Node 22
|
|
491
|
+
- `npm ci` — clean install
|
|
492
|
+
- `npm run build` — tsup bundle
|
|
493
|
+
- `npx semantic-release` — analyzes commits, bumps version, updates CHANGELOG.md, creates git tag, publishes to npm
|
|
494
|
+
|
|
495
|
+
### npm publish details
|
|
496
|
+
|
|
497
|
+
- **OIDC Trusted Publishing**: Package is signed with provenance attestation via GitHub Actions OIDC token
|
|
498
|
+
- **Publisher identity**: `GitHub Actions <npm-oidc-no-reply@github.com>`
|
|
499
|
+
- **Registry**: `https://registry.npmjs.org/`
|
|
500
|
+
- **Access**: public
|
|
501
|
+
|
|
502
|
+
### Verify provenance
|
|
503
|
+
|
|
504
|
+
```bash
|
|
505
|
+
npm audit signatures
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
### Manual release (emergency)
|
|
509
|
+
|
|
510
|
+
Create a tag manually and push:
|
|
511
|
+
|
|
512
|
+
```bash
|
|
513
|
+
git tag v1.2.3
|
|
514
|
+
git push origin v1.2.3
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
---
|
|
518
|
+
|
|
359
519
|
## Repository
|
|
360
520
|
|
|
361
521
|
[https://github.com/gi4nks/ph](https://github.com/gi4nks/ph)
|