@rewrlution/papyrus-cli 0.0.1 → 0.0.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 +1 -454
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,8 +21,6 @@ Papyrus is a command-line journaling tool designed for developers who want to ca
|
|
|
21
21
|
|
|
22
22
|
## Installation
|
|
23
23
|
|
|
24
|
-
### From npm (Recommended)
|
|
25
|
-
|
|
26
24
|
```bash
|
|
27
25
|
# Install globally
|
|
28
26
|
npm install -g @rewrlution/papyrus-cli
|
|
@@ -34,27 +32,6 @@ pnpm add -g @rewrlution/papyrus-cli
|
|
|
34
32
|
yarn global add @rewrlution/papyrus-cli
|
|
35
33
|
```
|
|
36
34
|
|
|
37
|
-
### From Source (Development)
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
# Clone the monorepo
|
|
41
|
-
git clone https://github.com/your-username/papyrus.git
|
|
42
|
-
cd papyrus
|
|
43
|
-
|
|
44
|
-
# Install dependencies
|
|
45
|
-
pnpm install
|
|
46
|
-
|
|
47
|
-
# Build packages
|
|
48
|
-
pnpm build
|
|
49
|
-
|
|
50
|
-
# Link CLI globally
|
|
51
|
-
cd packages/cli
|
|
52
|
-
pnpm link --global
|
|
53
|
-
|
|
54
|
-
# Now you can use papyrus anywhere
|
|
55
|
-
papyrus --version
|
|
56
|
-
```
|
|
57
|
-
|
|
58
35
|
## Quick Start
|
|
59
36
|
|
|
60
37
|
### 1. Register an Account
|
|
@@ -254,443 +231,13 @@ Log out and clear stored token.
|
|
|
254
231
|
papyrus logout
|
|
255
232
|
```
|
|
256
233
|
|
|
257
|
-
## Configuration
|
|
258
|
-
|
|
259
|
-
### Storage Locations
|
|
260
|
-
|
|
261
|
-
Papyrus follows the XDG Base Directory specification:
|
|
262
|
-
|
|
263
|
-
**On Linux/macOS:**
|
|
264
|
-
|
|
265
|
-
- Journals: `~/.local/share/papyrus/journals/`
|
|
266
|
-
- Config: `~/.config/papyrus/`
|
|
267
|
-
- Token: `~/.config/papyrus/token`
|
|
268
|
-
- Sync metadata: `~/.local/share/papyrus/sync-meta.json`
|
|
269
|
-
|
|
270
|
-
**On Windows:**
|
|
271
|
-
|
|
272
|
-
- Journals: `%LOCALAPPDATA%\papyrus\journals\`
|
|
273
|
-
- Config: `%APPDATA%\papyrus\`
|
|
274
|
-
- Token: `%APPDATA%\papyrus\token`
|
|
275
|
-
- Sync metadata: `%LOCALAPPDATA%\papyrus\sync-meta.json`
|
|
276
|
-
|
|
277
|
-
### Editor Configuration
|
|
278
|
-
|
|
279
|
-
Papyrus uses your system's default editor. Priority order:
|
|
280
|
-
|
|
281
|
-
1. `$EDITOR` environment variable
|
|
282
|
-
2. `$VISUAL` environment variable
|
|
283
|
-
3. Detected editors: `vim`, `vi`, `nano`, `code` (VS Code), `notepad` (Windows)
|
|
284
|
-
|
|
285
|
-
**Set your preferred editor:**
|
|
286
|
-
|
|
287
|
-
```bash
|
|
288
|
-
# Bash/Zsh
|
|
289
|
-
export EDITOR=vim
|
|
290
|
-
|
|
291
|
-
# Or add to ~/.bashrc or ~/.zshrc
|
|
292
|
-
echo 'export EDITOR=vim' >> ~/.bashrc
|
|
293
|
-
|
|
294
|
-
# Windows (PowerShell)
|
|
295
|
-
$env:EDITOR = "code --wait"
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
**VS Code users:** Add `--wait` flag so Papyrus waits for you to close the file:
|
|
299
|
-
|
|
300
|
-
```bash
|
|
301
|
-
export EDITOR="code --wait"
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
### Date Formats
|
|
305
|
-
|
|
306
|
-
Papyrus accepts flexible date input:
|
|
307
|
-
|
|
308
|
-
- `today` - Current date
|
|
309
|
-
- `yesterday` - One day ago
|
|
310
|
-
- `tomorrow` - One day ahead
|
|
311
|
-
- `YYYYMMDD` - Specific date (e.g., `20260104`)
|
|
312
|
-
- `YYYY-MM-DD` - ISO format (e.g., `2026-01-04`)
|
|
313
|
-
- `+N` or `-N` - Days from today (e.g., `+7`, `-3`)
|
|
314
|
-
|
|
315
|
-
## Development
|
|
316
|
-
|
|
317
|
-
### Prerequisites
|
|
318
|
-
|
|
319
|
-
- Node.js 18 or higher
|
|
320
|
-
- pnpm 10 or higher
|
|
321
|
-
- Git
|
|
322
|
-
|
|
323
|
-
### Setup Development Environment
|
|
324
|
-
|
|
325
|
-
```bash
|
|
326
|
-
# Clone monorepo
|
|
327
|
-
git clone https://github.com/your-username/papyrus.git
|
|
328
|
-
cd papyrus
|
|
329
|
-
|
|
330
|
-
# Install dependencies
|
|
331
|
-
pnpm install
|
|
332
|
-
|
|
333
|
-
# Build shared package (required dependency)
|
|
334
|
-
cd packages/shared
|
|
335
|
-
pnpm build
|
|
336
|
-
|
|
337
|
-
# Return to CLI package
|
|
338
|
-
cd ../cli
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
### Development Workflow
|
|
342
|
-
|
|
343
|
-
```bash
|
|
344
|
-
# Watch mode (auto-reloads on changes)
|
|
345
|
-
pnpm dev
|
|
346
|
-
|
|
347
|
-
# Build
|
|
348
|
-
pnpm build
|
|
349
|
-
|
|
350
|
-
# Run tests
|
|
351
|
-
pnpm test
|
|
352
|
-
|
|
353
|
-
# Run built CLI
|
|
354
|
-
pnpm start
|
|
355
|
-
|
|
356
|
-
# Or run directly with tsx
|
|
357
|
-
tsx src/cli.tsx add --date today
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
### Project Structure
|
|
361
|
-
|
|
362
|
-
```
|
|
363
|
-
packages/cli/
|
|
364
|
-
├── src/
|
|
365
|
-
│ ├── cli.tsx # Entry point
|
|
366
|
-
│ ├── commands/ # Command handlers
|
|
367
|
-
│ │ ├── auth/ # Auth commands (login, register, logout)
|
|
368
|
-
│ │ └── journal/ # Journal commands (add, show, list, sync)
|
|
369
|
-
│ ├── components/ # React/Ink UI components
|
|
370
|
-
│ ├── lib/ # Business logic
|
|
371
|
-
│ │ ├── api/ # API client
|
|
372
|
-
│ │ ├── auth/ # Auth middleware
|
|
373
|
-
│ │ ├── storage/ # Local storage
|
|
374
|
-
│ │ └── sync/ # Sync engine
|
|
375
|
-
│ └── utils/ # Utilities (date, editor, token)
|
|
376
|
-
├── docs/ # Documentation
|
|
377
|
-
├── tests/ # Tests
|
|
378
|
-
├── dist/ # Build output
|
|
379
|
-
└── package.json
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
### Running Tests
|
|
383
|
-
|
|
384
|
-
```bash
|
|
385
|
-
# Run tests once
|
|
386
|
-
pnpm test
|
|
387
|
-
|
|
388
|
-
# Watch mode
|
|
389
|
-
pnpm test --watch
|
|
390
|
-
|
|
391
|
-
# With UI
|
|
392
|
-
pnpm test --ui
|
|
393
|
-
|
|
394
|
-
# From monorepo root
|
|
395
|
-
pnpm test --filter=@rewrlution/papyrus-cli
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
### Local Testing
|
|
399
|
-
|
|
400
|
-
Test the CLI as if installed globally:
|
|
401
|
-
|
|
402
|
-
```bash
|
|
403
|
-
# Build and link
|
|
404
|
-
pnpm build
|
|
405
|
-
pnpm link --global
|
|
406
|
-
|
|
407
|
-
# Test commands
|
|
408
|
-
papyrus --version
|
|
409
|
-
papyrus add
|
|
410
|
-
|
|
411
|
-
# Unlink when done
|
|
412
|
-
pnpm unlink --global
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
### Building for Production
|
|
416
|
-
|
|
417
|
-
```bash
|
|
418
|
-
# Clean build
|
|
419
|
-
rm -rf dist
|
|
420
|
-
pnpm build
|
|
421
|
-
|
|
422
|
-
# Test tarball (simulates npm publish)
|
|
423
|
-
npm pack
|
|
424
|
-
|
|
425
|
-
# Install from tarball
|
|
426
|
-
npm install -g ./rewrlution-papyrus-cli-*.tgz
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
## Deployment
|
|
430
|
-
|
|
431
|
-
### Versioning
|
|
432
|
-
|
|
433
|
-
Papyrus follows [Semantic Versioning](https://semver.org/):
|
|
434
|
-
|
|
435
|
-
- **MAJOR**: Breaking changes (e.g., command renamed)
|
|
436
|
-
- **MINOR**: New features (e.g., new command added)
|
|
437
|
-
- **PATCH**: Bug fixes (e.g., error handling fixed)
|
|
438
|
-
|
|
439
|
-
### Release Process
|
|
440
|
-
|
|
441
|
-
```bash
|
|
442
|
-
# 1. Update version in package.json
|
|
443
|
-
vim packages/cli/package.json
|
|
444
|
-
# Change "version": "0.0.1" to "0.0.2"
|
|
445
|
-
|
|
446
|
-
# 2. Update CHANGELOG.md
|
|
447
|
-
vim packages/cli/CHANGELOG.md
|
|
448
|
-
# Document changes
|
|
449
|
-
|
|
450
|
-
# 3. Commit changes
|
|
451
|
-
git add packages/cli/package.json packages/cli/CHANGELOG.md
|
|
452
|
-
git commit -m "chore(cli): bump version to 0.0.2"
|
|
453
|
-
|
|
454
|
-
# 4. Create tag
|
|
455
|
-
# For bug fixes (1.0.0 → 1.0.1)
|
|
456
|
-
npm version patch
|
|
457
|
-
git push --follow-tags
|
|
458
|
-
|
|
459
|
-
# For new features (1.0.0 → 1.1.0)
|
|
460
|
-
npm version minor
|
|
461
|
-
git push --follow-tags
|
|
462
|
-
|
|
463
|
-
# For breaking changes (1.0.0 → 2.0.0)
|
|
464
|
-
npm version major
|
|
465
|
-
git push --follow-tags
|
|
466
|
-
```
|
|
467
|
-
|
|
468
|
-
The `npm version` command:
|
|
469
|
-
|
|
470
|
-
- ✅ Updates `package.json`
|
|
471
|
-
- ✅ Creates a git commit
|
|
472
|
-
- ✅ Creates a git tag
|
|
473
|
-
- ✅ All in one command!
|
|
474
|
-
|
|
475
|
-
## Quick Reference Card:
|
|
476
|
-
|
|
477
|
-
```bash
|
|
478
|
-
# Normal development (no publish)
|
|
479
|
-
git add .
|
|
480
|
-
git commit -m "Add feature"
|
|
481
|
-
git push origin main
|
|
482
|
-
|
|
483
|
-
# When ready to release (publishes to npm)
|
|
484
|
-
npm version patch # or minor/major
|
|
485
|
-
git push --follow-tags
|
|
486
|
-
|
|
487
|
-
# Delete tags (only use it if you create a tag by mistake)
|
|
488
|
-
git tag -d v1.0.0
|
|
489
|
-
```
|
|
490
|
-
|
|
491
|
-
**For detailed deployment instructions, see [Deployment Guide](./docs/10-DEPLOYMENT-GUIDE.md).**
|
|
492
|
-
|
|
493
|
-
## Architecture
|
|
494
|
-
|
|
495
|
-
### Technology Stack
|
|
496
|
-
|
|
497
|
-
- **TypeScript** - Type-safe development
|
|
498
|
-
- **Commander.js** - CLI framework (git-like commands)
|
|
499
|
-
- **Ink** - React for terminal UIs
|
|
500
|
-
- **React** - UI component library
|
|
501
|
-
- **Axios** - HTTP client for API calls
|
|
502
|
-
- **date-fns** - Date manipulation
|
|
503
|
-
- **env-paths** - XDG-compliant path resolution
|
|
504
|
-
- **Zod** - Runtime type validation (from shared package)
|
|
505
|
-
|
|
506
|
-
### Key Design Decisions
|
|
507
|
-
|
|
508
|
-
**Why Ink (React)?**
|
|
509
|
-
|
|
510
|
-
- Declarative UI (easier than imperative terminal APIs)
|
|
511
|
-
- Component reusability
|
|
512
|
-
- State management with hooks
|
|
513
|
-
- Familiar for React developers
|
|
514
|
-
|
|
515
|
-
**Why Local-First?**
|
|
516
|
-
|
|
517
|
-
- Fast (no network latency)
|
|
518
|
-
- Works offline
|
|
519
|
-
- User owns their data (markdown files)
|
|
520
|
-
- Sync is optional enhancement
|
|
521
|
-
|
|
522
|
-
**Why XDG Base Directory?**
|
|
523
|
-
|
|
524
|
-
- Standard on Linux/Unix
|
|
525
|
-
- Predictable locations
|
|
526
|
-
- Respects user preferences
|
|
527
|
-
- Clean home directory
|
|
528
|
-
|
|
529
|
-
**Why Hash-Based Sync?**
|
|
530
|
-
|
|
531
|
-
- Efficient (compare hashes, not full content)
|
|
532
|
-
- Detects changes reliably
|
|
533
|
-
- Enables three-way merge
|
|
534
|
-
- No server-side state required
|
|
535
|
-
|
|
536
|
-
## Troubleshooting
|
|
537
|
-
|
|
538
|
-
### "Command not found: papyrus"
|
|
539
|
-
|
|
540
|
-
**Cause:** CLI not installed or not in PATH.
|
|
541
|
-
|
|
542
|
-
**Solution:**
|
|
543
|
-
|
|
544
|
-
```bash
|
|
545
|
-
# Check if installed
|
|
546
|
-
npm list -g @rewrlution/papyrus-cli
|
|
547
|
-
|
|
548
|
-
# Reinstall
|
|
549
|
-
npm install -g @rewrlution/papyrus-cli
|
|
550
|
-
|
|
551
|
-
# Check PATH
|
|
552
|
-
echo $PATH # Should include npm global bin directory
|
|
553
|
-
```
|
|
554
|
-
|
|
555
|
-
### "No text editor found"
|
|
556
|
-
|
|
557
|
-
**Cause:** No supported editor detected.
|
|
558
|
-
|
|
559
|
-
**Solution:**
|
|
560
|
-
|
|
561
|
-
```bash
|
|
562
|
-
# Set EDITOR environment variable
|
|
563
|
-
export EDITOR=vim
|
|
564
|
-
|
|
565
|
-
# Or install a supported editor
|
|
566
|
-
sudo apt-get install vim # Linux
|
|
567
|
-
brew install vim # macOS
|
|
568
|
-
```
|
|
569
|
-
|
|
570
|
-
### "Not authenticated"
|
|
571
|
-
|
|
572
|
-
**Cause:** Not logged in or token expired.
|
|
573
|
-
|
|
574
|
-
**Solution:**
|
|
575
|
-
|
|
576
|
-
```bash
|
|
577
|
-
# Log in again
|
|
578
|
-
papyrus login
|
|
579
|
-
|
|
580
|
-
# Check token status
|
|
581
|
-
ls ~/.config/papyrus/token # Should exist
|
|
582
|
-
```
|
|
583
|
-
|
|
584
|
-
### "Sync failed"
|
|
585
|
-
|
|
586
|
-
**Cause:** Network issues or server down.
|
|
587
|
-
|
|
588
|
-
**Solution:**
|
|
589
|
-
|
|
590
|
-
```bash
|
|
591
|
-
# Check internet connection
|
|
592
|
-
ping api.papyrus.com
|
|
593
|
-
|
|
594
|
-
# Try again later
|
|
595
|
-
papyrus sync
|
|
596
|
-
|
|
597
|
-
# Check server status
|
|
598
|
-
# https://status.papyrus.com (if available)
|
|
599
|
-
```
|
|
600
|
-
|
|
601
|
-
### "Cannot find module '@rewrlution/papyrus-shared'"
|
|
602
|
-
|
|
603
|
-
**Cause:** Development environment not set up correctly.
|
|
604
|
-
|
|
605
|
-
**Solution:**
|
|
606
|
-
|
|
607
|
-
```bash
|
|
608
|
-
# Build shared package first
|
|
609
|
-
cd packages/shared
|
|
610
|
-
pnpm build
|
|
611
|
-
|
|
612
|
-
# Then build CLI
|
|
613
|
-
cd ../cli
|
|
614
|
-
pnpm build
|
|
615
|
-
```
|
|
616
|
-
|
|
617
|
-
## Contributing
|
|
618
|
-
|
|
619
|
-
We welcome contributions! Here's how you can help:
|
|
620
|
-
|
|
621
|
-
### Reporting Bugs
|
|
622
|
-
|
|
623
|
-
1. Check existing issues: https://github.com/your-username/papyrus/issues
|
|
624
|
-
2. Create new issue with:
|
|
625
|
-
- Clear description
|
|
626
|
-
- Steps to reproduce
|
|
627
|
-
- Expected vs actual behavior
|
|
628
|
-
- Environment (OS, Node version)
|
|
629
|
-
- Error messages/screenshots
|
|
630
|
-
|
|
631
|
-
### Suggesting Features
|
|
632
|
-
|
|
633
|
-
1. Open a discussion: https://github.com/your-username/papyrus/discussions
|
|
634
|
-
2. Describe the feature and use case
|
|
635
|
-
3. Consider implementation approach
|
|
636
|
-
4. Be open to feedback
|
|
637
|
-
|
|
638
|
-
### Contributing Code
|
|
639
|
-
|
|
640
|
-
1. Fork the repository
|
|
641
|
-
2. Create a feature branch: `git checkout -b feature/my-feature`
|
|
642
|
-
3. Make changes following code style
|
|
643
|
-
4. Add tests
|
|
644
|
-
5. Update documentation
|
|
645
|
-
6. Run tests: `pnpm test`
|
|
646
|
-
7. Run linter: `pnpm lint`
|
|
647
|
-
8. Commit: `git commit -m "feat(cli): add search command"`
|
|
648
|
-
9. Push: `git push origin feature/my-feature`
|
|
649
|
-
10. Open Pull Request
|
|
650
|
-
|
|
651
|
-
**Code Style:**
|
|
652
|
-
|
|
653
|
-
- Use TypeScript
|
|
654
|
-
- Follow existing patterns
|
|
655
|
-
- Add JSDoc comments for public APIs
|
|
656
|
-
- Keep functions small and focused
|
|
657
|
-
- Write tests for new features
|
|
658
|
-
|
|
659
|
-
**Commit Messages:**
|
|
660
|
-
|
|
661
|
-
- Follow [Conventional Commits](https://www.conventionalcommits.org/)
|
|
662
|
-
- Format: `type(scope): description`
|
|
663
|
-
- Types: `feat`, `fix`, `docs`, `chore`, `test`, `refactor`
|
|
664
|
-
- Examples:
|
|
665
|
-
- `feat(cli): add search command`
|
|
666
|
-
- `fix(sync): handle conflict resolution`
|
|
667
|
-
- `docs: update README with examples`
|
|
668
|
-
|
|
669
|
-
## Documentation
|
|
670
|
-
|
|
671
|
-
- **[CLAUDE.md](./CLAUDE.md)** - Complete development guide
|
|
672
|
-
- **[Deployment Guide](./docs/10-DEPLOYMENT-GUIDE.md)** - CI/CD and npm publishing
|
|
673
|
-
- **[Tutorials](./docs/)** - Step-by-step implementation guides
|
|
674
|
-
- **[Architecture Decisions](./docs/)** - Design rationale
|
|
675
|
-
|
|
676
234
|
## License
|
|
677
235
|
|
|
678
236
|
MIT License - see [LICENSE](../../LICENSE) file for details.
|
|
679
237
|
|
|
680
238
|
## Support
|
|
681
239
|
|
|
682
|
-
- **
|
|
683
|
-
- **Discussions**: https://github.com/your-username/papyrus/discussions
|
|
684
|
-
- **Email**: support@papyrus.com (if available)
|
|
685
|
-
|
|
686
|
-
## Acknowledgments
|
|
687
|
-
|
|
688
|
-
Built with:
|
|
689
|
-
|
|
690
|
-
- [Commander.js](https://github.com/tj/commander.js) - CLI framework
|
|
691
|
-
- [Ink](https://github.com/vadimdemedes/ink) - Terminal UI
|
|
692
|
-
- [React](https://react.dev) - UI library
|
|
693
|
-
- [Zod](https://zod.dev) - Validation
|
|
240
|
+
- **Email**: rewrlution@gmail.com
|
|
694
241
|
|
|
695
242
|
---
|
|
696
243
|
|