panopticon-cli 0.1.6 → 0.2.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/README.md +244 -20
- package/dist/{chunk-RM3WGTFO.js → chunk-J7JUNJGH.js} +2 -2
- package/dist/chunk-J7JUNJGH.js.map +1 -0
- package/dist/cli/index.js +11 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +10 -2
- package/templates/context/CLAUDE.md.template +81 -0
- package/templates/context/STATE.md.template +106 -0
- package/templates/context/WORKSPACE.md.template +90 -0
- package/templates/docker/dotnet/Dockerfile.dev +22 -0
- package/templates/docker/dotnet/README.md +111 -0
- package/templates/docker/dotnet/docker-compose.yml +55 -0
- package/templates/docker/monorepo/Dockerfile.backend +15 -0
- package/templates/docker/monorepo/Dockerfile.frontend +17 -0
- package/templates/docker/monorepo/README.md +208 -0
- package/templates/docker/monorepo/docker-compose.yml +88 -0
- package/templates/docker/nextjs/Dockerfile.dev +20 -0
- package/templates/docker/nextjs/README.md +103 -0
- package/templates/docker/nextjs/docker-compose.yml +30 -0
- package/templates/docker/python-fastapi/Dockerfile.dev +22 -0
- package/templates/docker/python-fastapi/README.md +148 -0
- package/templates/docker/python-fastapi/docker-compose.yml +65 -0
- package/templates/docker/react-vite/Dockerfile.dev +20 -0
- package/templates/docker/react-vite/README.md +94 -0
- package/templates/docker/react-vite/docker-compose.yml +29 -0
- package/templates/docker/spring-boot/Dockerfile.dev +24 -0
- package/templates/docker/spring-boot/README.md +111 -0
- package/templates/docker/spring-boot/docker-compose.yml +71 -0
- package/dist/chunk-RM3WGTFO.js.map +0 -1
package/README.md
CHANGED
|
@@ -25,6 +25,134 @@ Panopticon is a unified orchestration layer for AI coding assistants. It works w
|
|
|
25
25
|
- **Context Engineering** - Structured state management (STATE.md, WORKSPACE.md)
|
|
26
26
|
- **Agent CVs** - Work history tracking for capability-based routing
|
|
27
27
|
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Legacy Codebase Support
|
|
31
|
+
|
|
32
|
+
> **"AI works great on greenfield projects, but it's hopeless on our legacy code."**
|
|
33
|
+
>
|
|
34
|
+
> Sound familiar? Your developers aren't wrong. But they're not stuck, either.
|
|
35
|
+
|
|
36
|
+
### The Problem Every Enterprise Faces
|
|
37
|
+
|
|
38
|
+
AI coding assistants are trained on modern, well-documented open-source code. When they encounter your 15-year-old monolith with:
|
|
39
|
+
|
|
40
|
+
- Mixed naming conventions (some `snake_case`, some `camelCase`, some `SCREAMING_CASE`)
|
|
41
|
+
- Undocumented tribal knowledge ("we never touch the `processUser()` function directly")
|
|
42
|
+
- Schemas that don't match the ORM ("the `accounts` table is actually users")
|
|
43
|
+
- Three different async patterns in the same codebase
|
|
44
|
+
- Build systems that require arcane incantations
|
|
45
|
+
|
|
46
|
+
...they stumble. Repeatedly. Every session starts from zero.
|
|
47
|
+
|
|
48
|
+
### Panopticon's Unique Solution: Adaptive Learning
|
|
49
|
+
|
|
50
|
+
Panopticon includes two AI self-monitoring skills that **no other orchestration framework provides**:
|
|
51
|
+
|
|
52
|
+
| Skill | What It Does | Business Impact |
|
|
53
|
+
|-------|--------------|-----------------|
|
|
54
|
+
| **Knowledge Capture** | Detects when AI makes mistakes or gets corrected, prompts to document the learning | AI gets smarter about YOUR codebase over time |
|
|
55
|
+
| **Refactor Radar** | Identifies systemic code issues causing repeated AI confusion, creates actionable proposals | Surfaces technical debt that's costing you AI productivity |
|
|
56
|
+
|
|
57
|
+
#### How It Works
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
Session 1: AI queries users.created_at → Error (column is "createdAt")
|
|
61
|
+
→ Knowledge Capture prompts: "Document this convention?"
|
|
62
|
+
→ User: "Yes, create skill"
|
|
63
|
+
→ Creates project-specific skill documenting naming conventions
|
|
64
|
+
|
|
65
|
+
Session 2: AI knows to use camelCase for this project
|
|
66
|
+
No more mistakes on column names
|
|
67
|
+
|
|
68
|
+
Session 5: Refactor Radar detects: "Same entity called 'user', 'account', 'member'
|
|
69
|
+
across layers - this is causing repeated confusion"
|
|
70
|
+
→ Offers to create issue with refactoring proposal
|
|
71
|
+
→ Tech lead reviews and schedules cleanup sprint
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### The Compound Effect
|
|
75
|
+
|
|
76
|
+
| Week | Without Panopticon | With Panopticon |
|
|
77
|
+
|------|-------------------|-----------------|
|
|
78
|
+
| 1 | AI makes 20 mistakes/day on conventions | AI makes 20 mistakes, captures 8 learnings |
|
|
79
|
+
| 2 | AI makes 20 mistakes/day (no memory) | AI makes 12 mistakes, captures 5 more |
|
|
80
|
+
| 4 | AI makes 20 mistakes/day (still no memory) | AI makes 3 mistakes, codebase improving |
|
|
81
|
+
| 8 | Developers give up on AI for legacy code | AI is productive, tech debt proposals in backlog |
|
|
82
|
+
|
|
83
|
+
#### Shared Team Knowledge
|
|
84
|
+
|
|
85
|
+
**When one developer learns, everyone benefits.**
|
|
86
|
+
|
|
87
|
+
Captured skills live in your project's `.claude/skills/` directory - they're version-controlled alongside your code. When Sarah documents that "we use camelCase columns" after hitting that error, every developer on the team - and every AI session from that point forward - inherits that knowledge automatically.
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
myproject/
|
|
91
|
+
├── .claude/skills/
|
|
92
|
+
│ └── project-knowledge/ # ← Git-tracked, shared by entire team
|
|
93
|
+
│ └── SKILL.md # "Database uses camelCase, not snake_case"
|
|
94
|
+
├── src/
|
|
95
|
+
└── ...
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
No more repeating the same corrections to AI across 10 different developers. No more tribal knowledge locked in one person's head. The team's collective understanding of your codebase becomes permanent, searchable, and automatically applied.
|
|
99
|
+
|
|
100
|
+
**New hire onboarding?** The AI already knows your conventions from day one.
|
|
101
|
+
|
|
102
|
+
#### For Technical Leaders
|
|
103
|
+
|
|
104
|
+
**What gets measured gets managed.** Panopticon's Refactor Radar surfaces the specific patterns that are costing you AI productivity:
|
|
105
|
+
|
|
106
|
+
- "Here are the 5 naming inconsistencies causing 40% of AI errors"
|
|
107
|
+
- "These 3 missing FK constraints led to 12 incorrect deletions last month"
|
|
108
|
+
- "Mixed async patterns in payments module caused 8 rollbacks"
|
|
109
|
+
|
|
110
|
+
Each proposal includes:
|
|
111
|
+
- **Evidence**: Specific file paths and examples
|
|
112
|
+
- **Impact**: How this affects AI (and new developers)
|
|
113
|
+
- **Migration path**: Incremental fix that won't break production
|
|
114
|
+
|
|
115
|
+
#### For Executives
|
|
116
|
+
|
|
117
|
+
**ROI is simple:**
|
|
118
|
+
|
|
119
|
+
- $200K/year senior developer spends 2 hours/day correcting AI on legacy code
|
|
120
|
+
- That's $50K/year in wasted productivity per developer
|
|
121
|
+
- Team of 10 = **$500K/year** in AI friction
|
|
122
|
+
|
|
123
|
+
Panopticon's learning system:
|
|
124
|
+
- Captures corrections once, applies them forever
|
|
125
|
+
- Identifies root causes (not just symptoms)
|
|
126
|
+
- Creates actionable improvement proposals
|
|
127
|
+
- Works across your entire AI toolchain (Claude, Codex, Cursor, Gemini)
|
|
128
|
+
|
|
129
|
+
**This isn't "AI for greenfield only." This is AI that learns your business.**
|
|
130
|
+
|
|
131
|
+
#### Configurable Per Team and Per Developer
|
|
132
|
+
|
|
133
|
+
Different teams have different ownership boundaries. Individual developers have different preferences. Panopticon respects both:
|
|
134
|
+
|
|
135
|
+
```markdown
|
|
136
|
+
# In ~/.claude/CLAUDE.md (developer's personal config)
|
|
137
|
+
|
|
138
|
+
## AI Suggestion Preferences
|
|
139
|
+
|
|
140
|
+
### refactor-radar
|
|
141
|
+
skip: database-migrations, infrastructure # DBA/Platform team handles these
|
|
142
|
+
welcome: naming, code-organization # Always happy for these
|
|
143
|
+
|
|
144
|
+
### knowledge-capture
|
|
145
|
+
skip: authentication # Security team owns this
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
- **"Skip database migrations"** - Your DBA has a change management process
|
|
149
|
+
- **"Skip infrastructure"** - Platform team owns that
|
|
150
|
+
- **"Welcome naming fixes"** - Low risk, high value, always appreciated
|
|
151
|
+
|
|
152
|
+
The AI adapts to your org structure, not the other way around.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
28
156
|
## Quick Start
|
|
29
157
|
|
|
30
158
|
```bash
|
|
@@ -210,6 +338,11 @@ This allows multiple agents to work on different features simultaneously without
|
|
|
210
338
|
|
|
211
339
|
#### Git-Backed Collaborative Planning
|
|
212
340
|
|
|
341
|
+
| Start Planning | Codebase Exploration | Discovery Questions |
|
|
342
|
+
|----------------|---------------------|---------------------|
|
|
343
|
+
|  |  |  |
|
|
344
|
+
| Click to create workspace and start AI planning | Claude explores the codebase, reads docs, understands patterns | Interactive questions to clarify requirements and approach |
|
|
345
|
+
|
|
213
346
|
Planning artifacts are stored **inside the workspace**, making them part of the feature branch:
|
|
214
347
|
|
|
215
348
|
```
|
|
@@ -222,6 +355,13 @@ workspaces/feature-min-123/
|
|
|
222
355
|
└── ... (code)
|
|
223
356
|
```
|
|
224
357
|
|
|
358
|
+

|
|
359
|
+
|
|
360
|
+
When the planning session completes, the AI generates:
|
|
361
|
+
- **STATE.md** - Current understanding, decisions made, and implementation plan
|
|
362
|
+
- **Beads tasks** - Trackable sub-tasks with dependencies for the implementation
|
|
363
|
+
- **Feature PRD** - Copied to `docs/prds/active/{issue}-plan.md` for documentation
|
|
364
|
+
|
|
225
365
|
**This enables:**
|
|
226
366
|
|
|
227
367
|
1. **Collaborative async planning** - Push your branch, someone else pulls and continues the planning session with full context
|
|
@@ -321,6 +461,8 @@ pan work recover --all
|
|
|
321
461
|
|
|
322
462
|
## Dashboard
|
|
323
463
|
|
|
464
|
+

|
|
465
|
+
|
|
324
466
|
Start the monitoring dashboard:
|
|
325
467
|
|
|
326
468
|
```bash
|
|
@@ -337,36 +479,114 @@ This runs everything in Docker containers, avoiding port conflicts with your oth
|
|
|
337
479
|
```bash
|
|
338
480
|
pan up --minimal
|
|
339
481
|
```
|
|
340
|
-
- Dashboard: http://localhost:
|
|
482
|
+
- Dashboard: http://localhost:3010
|
|
341
483
|
|
|
342
484
|
Stop with `pan down`.
|
|
343
485
|
|
|
486
|
+
### Dashboard Tabs
|
|
487
|
+
|
|
488
|
+
| Tab | Purpose |
|
|
489
|
+
|-----|---------|
|
|
490
|
+
| **Board** | Kanban view of Linear issues with drag-and-drop status changes |
|
|
491
|
+
| **Agents** | Running agent sessions with terminal output |
|
|
492
|
+
| **Activity** | Real-time `pan` command output log |
|
|
493
|
+
| **Metrics** | Runtime comparison and cost tracking |
|
|
494
|
+
| **Skills** | Available skills and their descriptions |
|
|
495
|
+
| **Health** | System health checks and diagnostics |
|
|
496
|
+
|
|
497
|
+
### Metrics & Cost Tracking
|
|
498
|
+
|
|
499
|
+
The **Metrics** tab provides insights into AI agent performance and costs:
|
|
500
|
+
|
|
501
|
+
- **Per-issue cost badges** - See costs directly on Kanban cards (color-coded by amount)
|
|
502
|
+
- **Issue cost breakdown** - Click an issue to see detailed costs by model and session
|
|
503
|
+
- **Runtime comparison** - Compare success rates, duration, and costs across runtimes (Claude, Codex, etc.)
|
|
504
|
+
- **Capability analysis** - See how different task types (feature, bugfix, refactor) perform
|
|
505
|
+
|
|
506
|
+
Cost data is stored in `~/.panopticon/`:
|
|
507
|
+
- `session-map.json` - Links Claude Code sessions to issues
|
|
508
|
+
- `runtime-metrics.json` - Aggregated runtime performance data
|
|
509
|
+
- `costs/` - Raw cost logs
|
|
510
|
+
|
|
511
|
+
**API Endpoints:**
|
|
512
|
+
|
|
513
|
+
| Endpoint | Description |
|
|
514
|
+
|----------|-------------|
|
|
515
|
+
| `GET /api/costs/summary` | Overall cost summary (today/week/month) |
|
|
516
|
+
| `GET /api/costs/by-issue` | Costs grouped by issue |
|
|
517
|
+
| `GET /api/issues/:id/costs` | Cost details for a specific issue |
|
|
518
|
+
| `GET /api/metrics/runtimes` | Runtime comparison metrics |
|
|
519
|
+
| `GET /api/metrics/tasks` | Recent task history |
|
|
520
|
+
|
|
344
521
|
## Skills
|
|
345
522
|
|
|
346
|
-
Panopticon ships with
|
|
523
|
+
Panopticon ships with 25+ skills organized into categories:
|
|
524
|
+
|
|
525
|
+
### Development Workflows
|
|
347
526
|
|
|
348
527
|
| Skill | Description |
|
|
349
528
|
|-------|-------------|
|
|
350
529
|
| `feature-work` | Standard feature development workflow |
|
|
351
530
|
| `bug-fix` | Systematic bug investigation and fix |
|
|
531
|
+
| `refactor` | Safe refactoring with test coverage |
|
|
352
532
|
| `code-review` | Comprehensive code review checklist |
|
|
353
533
|
| `code-review-security` | OWASP Top 10 security analysis |
|
|
354
534
|
| `code-review-performance` | Algorithm and resource optimization |
|
|
355
|
-
| `refactor` | Safe refactoring with test coverage |
|
|
356
535
|
| `release` | Step-by-step release process |
|
|
357
|
-
| `incident-response` | Production incident handling |
|
|
358
536
|
| `dependency-update` | Safe dependency updates |
|
|
537
|
+
| `incident-response` | Production incident handling |
|
|
359
538
|
| `onboard-codebase` | Understanding new codebases |
|
|
539
|
+
| `work-complete` | Checklist for completing agent work |
|
|
360
540
|
|
|
361
|
-
###
|
|
541
|
+
### AI Self-Monitoring
|
|
542
|
+
|
|
543
|
+
| Skill | Description |
|
|
544
|
+
|-------|-------------|
|
|
545
|
+
| `knowledge-capture` | Captures learnings when AI gets confused or corrected |
|
|
546
|
+
| `refactor-radar` | Detects systemic issues causing AI confusion |
|
|
547
|
+
| `session-health` | Detect and clean up stuck sessions |
|
|
548
|
+
|
|
549
|
+
### Panopticon Operations (pan-*)
|
|
362
550
|
|
|
363
|
-
|
|
551
|
+
| Skill | Description |
|
|
552
|
+
|-------|-------------|
|
|
553
|
+
| `pan-help` | Show all Panopticon commands |
|
|
554
|
+
| `pan-up` | Start dashboard and services |
|
|
555
|
+
| `pan-down` | Stop dashboard and services |
|
|
556
|
+
| `pan-status` | Show running agents |
|
|
557
|
+
| `pan-issue` | Spawn agent for an issue |
|
|
558
|
+
| `pan-plan` | Create execution plan for issue |
|
|
559
|
+
| `pan-tell` | Send message to running agent |
|
|
560
|
+
| `pan-kill` | Kill a running agent |
|
|
561
|
+
| `pan-approve` | Approve agent work and merge |
|
|
562
|
+
| `pan-health` | Check system health |
|
|
563
|
+
| `pan-sync` | Sync skills to AI tools |
|
|
564
|
+
| `pan-install` | Install prerequisites |
|
|
565
|
+
| `pan-setup` | Initial setup wizard |
|
|
566
|
+
| `pan-quickstart` | Quick start guide |
|
|
567
|
+
| `pan-projects` | Manage registered projects |
|
|
568
|
+
| `pan-tracker` | Issue tracker operations |
|
|
569
|
+
| `pan-logs` | View agent logs |
|
|
570
|
+
| `pan-rescue` | Recover crashed agents |
|
|
571
|
+
| `pan-diagnose` | Diagnose agent issues |
|
|
572
|
+
| `pan-docker` | Docker operations |
|
|
573
|
+
| `pan-network` | Network diagnostics |
|
|
574
|
+
| `pan-config` | Configuration management |
|
|
575
|
+
| `pan-convoy-synthesis` | Synthesize convoy coordination |
|
|
576
|
+
| `pan-subagent-creator` | Create specialized subagents |
|
|
577
|
+
| `pan-skill-creator` | Create new skills (guided) |
|
|
578
|
+
|
|
579
|
+
### Utilities
|
|
364
580
|
|
|
365
|
-
|
|
366
|
-
|
|
581
|
+
| Skill | Description |
|
|
582
|
+
|-------|-------------|
|
|
583
|
+
| `beads` | Git-backed issue tracking with dependencies |
|
|
584
|
+
| `skill-creator` | Guide for creating new skills |
|
|
585
|
+
| `web-design-guidelines` | UI/UX review checklist |
|
|
586
|
+
|
|
587
|
+
### Reserved Skill Names
|
|
367
588
|
|
|
368
|
-
**
|
|
369
|
-
`beads`, `bug-fix`, `code-review`, `code-review-performance`, `code-review-security`, `dependency-update`, `feature-work`, `incident-response`, `onboard-codebase`, `refactor`, `release`, `session-health`, `skill-creator`, `web-design-guidelines`, `work-complete`
|
|
589
|
+
Panopticon reserves all skill names listed above. **Do not use these names for project-specific skills** to avoid conflicts.
|
|
370
590
|
|
|
371
591
|
**Recommendation:** Use a project-specific prefix for your skills (e.g., `myn-standards`, `acme-deployment`) to avoid namespace collisions.
|
|
372
592
|
|
|
@@ -458,17 +678,21 @@ This ensures every Panopticon-managed project has a well-defined canonical PRD t
|
|
|
458
678
|
|
|
459
679
|
```
|
|
460
680
|
~/.panopticon/
|
|
461
|
-
skills/
|
|
462
|
-
commands/
|
|
463
|
-
agents/
|
|
681
|
+
skills/ # Shared skills (SKILL.md format)
|
|
682
|
+
commands/ # Slash commands
|
|
683
|
+
agents/ # Per-agent state
|
|
464
684
|
agent-min-123/
|
|
465
|
-
state.json
|
|
466
|
-
health.json
|
|
467
|
-
hook.json
|
|
468
|
-
cv.json
|
|
469
|
-
mail/
|
|
470
|
-
projects.json
|
|
471
|
-
|
|
685
|
+
state.json # Agent state
|
|
686
|
+
health.json # Health status
|
|
687
|
+
hook.json # GUPP work queue
|
|
688
|
+
cv.json # Work history
|
|
689
|
+
mail/ # Incoming messages
|
|
690
|
+
projects.json # Managed projects
|
|
691
|
+
project-mappings.json # Linear project → local path mappings
|
|
692
|
+
session-map.json # Claude sessions → issue linking
|
|
693
|
+
runtime-metrics.json # Runtime performance metrics
|
|
694
|
+
costs/ # Raw cost logs (JSONL)
|
|
695
|
+
backups/ # Sync backups
|
|
472
696
|
```
|
|
473
697
|
|
|
474
698
|
## Health Monitoring (Deacon Pattern)
|
|
@@ -113,7 +113,7 @@ function saveConfig(config) {
|
|
|
113
113
|
writeFileSync(CONFIG_FILE, content, "utf8");
|
|
114
114
|
}
|
|
115
115
|
function getDefaultConfig() {
|
|
116
|
-
return
|
|
116
|
+
return JSON.parse(JSON.stringify(DEFAULT_CONFIG));
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
// src/lib/shell.ts
|
|
@@ -1055,4 +1055,4 @@ export {
|
|
|
1055
1055
|
LinkManager,
|
|
1056
1056
|
getLinkManager
|
|
1057
1057
|
};
|
|
1058
|
-
//# sourceMappingURL=chunk-
|
|
1058
|
+
//# sourceMappingURL=chunk-J7JUNJGH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/paths.ts","../src/lib/config.ts","../src/lib/shell.ts","../src/lib/backup.ts","../src/lib/sync.ts","../src/lib/tracker/interface.ts","../src/lib/tracker/linear.ts","../src/lib/tracker/github.ts","../src/lib/tracker/gitlab.ts","../src/lib/tracker/factory.ts","../src/lib/tracker/linking.ts"],"sourcesContent":["import { homedir } from 'os';\nimport { join } from 'path';\n\n// Panopticon home directory\nexport const PANOPTICON_HOME = join(homedir(), '.panopticon');\n\n// Subdirectories\nexport const CONFIG_DIR = PANOPTICON_HOME;\nexport const SKILLS_DIR = join(PANOPTICON_HOME, 'skills');\nexport const COMMANDS_DIR = join(PANOPTICON_HOME, 'commands');\nexport const AGENTS_DIR = join(PANOPTICON_HOME, 'agents');\nexport const BACKUPS_DIR = join(PANOPTICON_HOME, 'backups');\nexport const COSTS_DIR = join(PANOPTICON_HOME, 'costs');\n\n// Traefik directories\nexport const TRAEFIK_DIR = join(PANOPTICON_HOME, 'traefik');\nexport const TRAEFIK_DYNAMIC_DIR = join(TRAEFIK_DIR, 'dynamic');\nexport const TRAEFIK_CERTS_DIR = join(TRAEFIK_DIR, 'certs');\n\n// Legacy certs directory (for backwards compatibility)\nexport const CERTS_DIR = join(PANOPTICON_HOME, 'certs');\n\n// Config files\nexport const CONFIG_FILE = join(CONFIG_DIR, 'config.toml');\n\n// AI tool directories\nexport const CLAUDE_DIR = join(homedir(), '.claude');\nexport const CODEX_DIR = join(homedir(), '.codex');\nexport const CURSOR_DIR = join(homedir(), '.cursor');\nexport const GEMINI_DIR = join(homedir(), '.gemini');\n\n// Target sync locations\nexport const SYNC_TARGETS = {\n claude: {\n skills: join(CLAUDE_DIR, 'skills'),\n commands: join(CLAUDE_DIR, 'commands'),\n },\n codex: {\n skills: join(CODEX_DIR, 'skills'),\n commands: join(CODEX_DIR, 'commands'),\n },\n cursor: {\n skills: join(CURSOR_DIR, 'skills'),\n commands: join(CURSOR_DIR, 'commands'),\n },\n gemini: {\n skills: join(GEMINI_DIR, 'skills'),\n commands: join(GEMINI_DIR, 'commands'),\n },\n} as const;\n\nexport type Runtime = keyof typeof SYNC_TARGETS;\n\n// Templates directory (in user's ~/.panopticon)\nexport const TEMPLATES_DIR = join(PANOPTICON_HOME, 'templates');\nexport const CLAUDE_MD_TEMPLATES = join(TEMPLATES_DIR, 'claude-md', 'sections');\n\n// Source templates directory (bundled with the package)\n// This is resolved at runtime from the package root\nimport { fileURLToPath } from 'url';\nimport { dirname } from 'path';\n\nconst currentFile = fileURLToPath(import.meta.url);\nconst distDir = dirname(currentFile); // dist/ or dist/lib/ depending on bundler\nconst packageRoot = dirname(distDir); // package root\n\nexport const SOURCE_TEMPLATES_DIR = join(packageRoot, 'templates');\nexport const SOURCE_TRAEFIK_TEMPLATES = join(SOURCE_TEMPLATES_DIR, 'traefik');\n\n// All directories to create on init\nexport const INIT_DIRS = [\n PANOPTICON_HOME,\n SKILLS_DIR,\n COMMANDS_DIR,\n AGENTS_DIR,\n BACKUPS_DIR,\n COSTS_DIR,\n TEMPLATES_DIR,\n CLAUDE_MD_TEMPLATES,\n CERTS_DIR,\n TRAEFIK_DIR,\n TRAEFIK_DYNAMIC_DIR,\n TRAEFIK_CERTS_DIR,\n];\n","import { readFileSync, writeFileSync, existsSync } from 'fs';\nimport { parse, stringify } from '@iarna/toml';\nimport { CONFIG_FILE } from './paths.js';\nimport type { TrackerType } from './tracker/interface.js';\n\n// Individual tracker configuration\nexport interface LinearConfig {\n type: 'linear';\n api_key_env?: string; // Env var name for API key (default: LINEAR_API_KEY)\n team?: string; // Default team prefix (e.g., 'MIN')\n}\n\nexport interface GitHubConfig {\n type: 'github';\n token_env?: string; // Env var name for token (default: GITHUB_TOKEN)\n owner: string; // Repository owner\n repo: string; // Repository name\n}\n\nexport interface GitLabConfig {\n type: 'gitlab';\n token_env?: string; // Env var name for token (default: GITLAB_TOKEN)\n project_id: string; // GitLab project ID\n}\n\nexport type TrackerConfigItem = LinearConfig | GitHubConfig | GitLabConfig;\n\nexport interface TrackersConfig {\n primary: TrackerType;\n secondary?: TrackerType;\n linear?: LinearConfig;\n github?: GitHubConfig;\n gitlab?: GitLabConfig;\n}\n\nexport interface PanopticonConfig {\n panopticon: {\n version: string;\n };\n sync: {\n targets: string[]; // 'claude', 'codex', 'cursor', 'gemini'\n backup_before_sync: boolean;\n auto_sync?: boolean;\n strategy?: 'symlink' | 'copy';\n };\n trackers: TrackersConfig;\n dashboard: {\n port: number;\n api_port: number;\n };\n traefik?: {\n enabled: boolean;\n dashboard_port?: number;\n domain?: string;\n };\n}\n\nconst DEFAULT_CONFIG: PanopticonConfig = {\n panopticon: {\n version: '1.0.0',\n },\n sync: {\n targets: ['claude'],\n backup_before_sync: true,\n auto_sync: false,\n strategy: 'symlink',\n },\n trackers: {\n primary: 'linear',\n linear: {\n type: 'linear',\n api_key_env: 'LINEAR_API_KEY',\n },\n },\n dashboard: {\n port: 3001,\n api_port: 3002,\n },\n};\n\nexport function loadConfig(): PanopticonConfig {\n if (!existsSync(CONFIG_FILE)) {\n return DEFAULT_CONFIG;\n }\n\n try {\n const content = readFileSync(CONFIG_FILE, 'utf8');\n const parsed = parse(content) as unknown as PanopticonConfig;\n return { ...DEFAULT_CONFIG, ...parsed };\n } catch (error) {\n console.error('Warning: Failed to parse config, using defaults');\n return DEFAULT_CONFIG;\n }\n}\n\nexport function saveConfig(config: PanopticonConfig): void {\n const content = stringify(config as any);\n writeFileSync(CONFIG_FILE, content, 'utf8');\n}\n\nexport function getDefaultConfig(): PanopticonConfig {\n return JSON.parse(JSON.stringify(DEFAULT_CONFIG));\n}\n","import { existsSync, readFileSync, appendFileSync } from 'fs';\nimport { homedir } from 'os';\nimport { join } from 'path';\n\nexport type Shell = 'bash' | 'zsh' | 'fish' | 'unknown';\n\nexport function detectShell(): Shell {\n const shell = process.env.SHELL || '';\n\n if (shell.includes('zsh')) return 'zsh';\n if (shell.includes('bash')) return 'bash';\n if (shell.includes('fish')) return 'fish';\n\n return 'unknown';\n}\n\nexport function getShellRcFile(shell: Shell): string | null {\n const home = homedir();\n\n switch (shell) {\n case 'zsh':\n return join(home, '.zshrc');\n case 'bash':\n // Prefer .bashrc, fall back to .bash_profile\n const bashrc = join(home, '.bashrc');\n if (existsSync(bashrc)) return bashrc;\n return join(home, '.bash_profile');\n case 'fish':\n return join(home, '.config', 'fish', 'config.fish');\n default:\n return null;\n }\n}\n\nconst ALIAS_LINE = 'alias pan=\"panopticon\"';\nconst ALIAS_MARKER = '# Panopticon CLI alias';\n\nexport function hasAlias(rcFile: string): boolean {\n if (!existsSync(rcFile)) return false;\n\n const content = readFileSync(rcFile, 'utf8');\n return content.includes(ALIAS_MARKER) || content.includes(ALIAS_LINE);\n}\n\nexport function addAlias(rcFile: string): void {\n if (hasAlias(rcFile)) return;\n\n const aliasBlock = `\n${ALIAS_MARKER}\n${ALIAS_LINE}\n`;\n\n appendFileSync(rcFile, aliasBlock, 'utf8');\n}\n\nexport function getAliasInstructions(shell: Shell): string {\n const rcFile = getShellRcFile(shell);\n\n if (!rcFile) {\n return `Add this to your shell config:\\n ${ALIAS_LINE}`;\n }\n\n return `Alias added to ${rcFile}. Run:\\n source ${rcFile}`;\n}\n","import { existsSync, mkdirSync, readdirSync, cpSync, rmSync } from 'fs';\nimport { join, basename } from 'path';\nimport { BACKUPS_DIR } from './paths.js';\n\nexport interface BackupInfo {\n timestamp: string;\n path: string;\n targets: string[];\n}\n\nexport function createBackupTimestamp(): string {\n return new Date().toISOString().replace(/[:.]/g, '-');\n}\n\nexport function createBackup(sourceDirs: string[]): BackupInfo {\n const timestamp = createBackupTimestamp();\n const backupPath = join(BACKUPS_DIR, timestamp);\n\n mkdirSync(backupPath, { recursive: true });\n\n const targets: string[] = [];\n\n for (const sourceDir of sourceDirs) {\n if (!existsSync(sourceDir)) continue;\n\n const targetName = basename(sourceDir);\n const targetPath = join(backupPath, targetName);\n\n cpSync(sourceDir, targetPath, { recursive: true });\n targets.push(targetName);\n }\n\n return {\n timestamp,\n path: backupPath,\n targets,\n };\n}\n\nexport function listBackups(): BackupInfo[] {\n if (!existsSync(BACKUPS_DIR)) return [];\n\n const entries = readdirSync(BACKUPS_DIR, { withFileTypes: true });\n\n return entries\n .filter((e) => e.isDirectory())\n .map((e) => {\n const backupPath = join(BACKUPS_DIR, e.name);\n const contents = readdirSync(backupPath);\n\n return {\n timestamp: e.name,\n path: backupPath,\n targets: contents,\n };\n })\n .sort((a, b) => b.timestamp.localeCompare(a.timestamp));\n}\n\nexport function restoreBackup(timestamp: string, targetDirs: Record<string, string>): void {\n const backupPath = join(BACKUPS_DIR, timestamp);\n\n if (!existsSync(backupPath)) {\n throw new Error(`Backup not found: ${timestamp}`);\n }\n\n const contents = readdirSync(backupPath, { withFileTypes: true });\n\n for (const entry of contents) {\n if (!entry.isDirectory()) continue;\n\n const sourcePath = join(backupPath, entry.name);\n const targetPath = targetDirs[entry.name];\n\n if (!targetPath) continue;\n\n // Remove existing and restore from backup\n if (existsSync(targetPath)) {\n rmSync(targetPath, { recursive: true });\n }\n\n cpSync(sourcePath, targetPath, { recursive: true });\n }\n}\n\nexport function cleanOldBackups(keepCount: number = 10): number {\n const backups = listBackups();\n\n if (backups.length <= keepCount) return 0;\n\n const toRemove = backups.slice(keepCount);\n let removed = 0;\n\n for (const backup of toRemove) {\n rmSync(backup.path, { recursive: true });\n removed++;\n }\n\n return removed;\n}\n","import { existsSync, mkdirSync, readdirSync, symlinkSync, unlinkSync, lstatSync, readlinkSync, rmSync } from 'fs';\nimport { join, basename } from 'path';\nimport { SKILLS_DIR, COMMANDS_DIR, SYNC_TARGETS, type Runtime } from './paths.js';\n\nexport interface SyncItem {\n name: string;\n sourcePath: string;\n targetPath: string;\n status: 'new' | 'exists' | 'conflict' | 'symlink';\n}\n\nexport interface SyncPlan {\n runtime: Runtime;\n skills: SyncItem[];\n commands: SyncItem[];\n}\n\n/**\n * Remove a file, symlink, or directory safely\n */\nfunction removeTarget(targetPath: string): void {\n const stats = lstatSync(targetPath);\n if (stats.isDirectory() && !stats.isSymbolicLink()) {\n // It's a real directory, remove recursively\n rmSync(targetPath, { recursive: true, force: true });\n } else {\n // It's a file or symlink\n unlinkSync(targetPath);\n }\n}\n\n/**\n * Check if a path is a Panopticon-managed symlink\n */\nexport function isPanopticonSymlink(targetPath: string): boolean {\n if (!existsSync(targetPath)) return false;\n\n try {\n const stats = lstatSync(targetPath);\n if (!stats.isSymbolicLink()) return false;\n\n const linkTarget = readlinkSync(targetPath);\n // It's ours if it points to our skills/commands dir\n return linkTarget.includes('.panopticon');\n } catch {\n return false;\n }\n}\n\n/**\n * Plan what would be synced (dry run)\n */\nexport function planSync(runtime: Runtime): SyncPlan {\n const targets = SYNC_TARGETS[runtime];\n const plan: SyncPlan = {\n runtime,\n skills: [],\n commands: [],\n };\n\n // Plan skills sync\n if (existsSync(SKILLS_DIR)) {\n const skills = readdirSync(SKILLS_DIR, { withFileTypes: true })\n .filter((d) => d.isDirectory());\n\n for (const skill of skills) {\n const sourcePath = join(SKILLS_DIR, skill.name);\n const targetPath = join(targets.skills, skill.name);\n\n let status: SyncItem['status'] = 'new';\n\n if (existsSync(targetPath)) {\n if (isPanopticonSymlink(targetPath)) {\n status = 'symlink'; // Already managed by us\n } else {\n status = 'conflict'; // User content exists\n }\n }\n\n plan.skills.push({ name: skill.name, sourcePath, targetPath, status });\n }\n }\n\n // Plan commands sync\n if (existsSync(COMMANDS_DIR)) {\n const commands = readdirSync(COMMANDS_DIR, { withFileTypes: true })\n .filter((d) => d.isDirectory());\n\n for (const cmd of commands) {\n const sourcePath = join(COMMANDS_DIR, cmd.name);\n const targetPath = join(targets.commands, cmd.name);\n\n let status: SyncItem['status'] = 'new';\n\n if (existsSync(targetPath)) {\n if (isPanopticonSymlink(targetPath)) {\n status = 'symlink';\n } else {\n status = 'conflict';\n }\n }\n\n plan.commands.push({ name: cmd.name, sourcePath, targetPath, status });\n }\n }\n\n return plan;\n}\n\nexport interface SyncOptions {\n force?: boolean;\n dryRun?: boolean;\n}\n\nexport interface SyncResult {\n created: string[];\n skipped: string[];\n conflicts: string[];\n}\n\n/**\n * Execute sync for a runtime\n */\nexport function executeSync(runtime: Runtime, options: SyncOptions = {}): SyncResult {\n const plan = planSync(runtime);\n const result: SyncResult = {\n created: [],\n skipped: [],\n conflicts: [],\n };\n\n const targets = SYNC_TARGETS[runtime];\n\n // Ensure target directories exist\n mkdirSync(targets.skills, { recursive: true });\n mkdirSync(targets.commands, { recursive: true });\n\n // Process skills\n for (const item of plan.skills) {\n if (options.dryRun) {\n if (item.status === 'new' || item.status === 'symlink') {\n result.created.push(item.name);\n } else {\n result.conflicts.push(item.name);\n }\n continue;\n }\n\n if (item.status === 'conflict' && !options.force) {\n result.conflicts.push(item.name);\n continue;\n }\n\n // Remove existing if force or if it's our symlink\n if (existsSync(item.targetPath)) {\n removeTarget(item.targetPath);\n }\n\n // Create symlink\n symlinkSync(item.sourcePath, item.targetPath);\n result.created.push(item.name);\n }\n\n // Process commands\n for (const item of plan.commands) {\n if (options.dryRun) {\n if (item.status === 'new' || item.status === 'symlink') {\n result.created.push(item.name);\n } else {\n result.conflicts.push(item.name);\n }\n continue;\n }\n\n if (item.status === 'conflict' && !options.force) {\n result.conflicts.push(item.name);\n continue;\n }\n\n if (existsSync(item.targetPath)) {\n removeTarget(item.targetPath);\n }\n\n symlinkSync(item.sourcePath, item.targetPath);\n result.created.push(item.name);\n }\n\n return result;\n}\n","/**\n * Issue Tracker Abstraction Layer\n *\n * Provides a unified interface for different issue tracking systems\n * (Linear, GitHub Issues, GitLab Issues, etc.)\n */\n\n// Supported tracker types\nexport type TrackerType = 'linear' | 'github' | 'gitlab';\n\n// Normalized issue state (lowest common denominator)\nexport type IssueState = 'open' | 'in_progress' | 'closed';\n\n// Normalized issue format\nexport interface Issue {\n /** Tracker-specific unique ID */\n id: string;\n\n /** Human-readable reference (e.g., MIN-630, #42) */\n ref: string;\n\n /** Issue title */\n title: string;\n\n /** Issue description/body (markdown) */\n description: string;\n\n /** Normalized state */\n state: IssueState;\n\n /** Labels/tags */\n labels: string[];\n\n /** Assignee username/name */\n assignee?: string;\n\n /** Web URL to the issue */\n url: string;\n\n /** Which tracker this issue came from */\n tracker: TrackerType;\n\n /** Cross-tracker linked issue references */\n linkedIssues?: string[];\n\n /** Priority (1=urgent, 2=high, 3=normal, 4=low) */\n priority?: number;\n\n /** Due date (ISO string) */\n dueDate?: string;\n\n /** Creation timestamp (ISO string) */\n createdAt: string;\n\n /** Last update timestamp (ISO string) */\n updatedAt: string;\n}\n\n// Comment on an issue\nexport interface Comment {\n id: string;\n issueId: string;\n body: string;\n author: string;\n createdAt: string;\n updatedAt: string;\n}\n\n// Filters for listing issues\nexport interface IssueFilters {\n /** Filter by state */\n state?: IssueState;\n\n /** Filter by labels (AND logic) */\n labels?: string[];\n\n /** Filter by assignee */\n assignee?: string;\n\n /** Filter by team/project (tracker-specific) */\n team?: string;\n\n /** Search query for title/description */\n query?: string;\n\n /** Maximum number of results */\n limit?: number;\n\n /** Include closed issues (default: false) */\n includeClosed?: boolean;\n}\n\n// Data for creating a new issue\nexport interface NewIssue {\n title: string;\n description?: string;\n labels?: string[];\n assignee?: string;\n team?: string;\n priority?: number;\n dueDate?: string;\n}\n\n// Data for updating an issue\nexport interface IssueUpdate {\n title?: string;\n description?: string;\n state?: IssueState;\n labels?: string[];\n assignee?: string;\n priority?: number;\n dueDate?: string;\n}\n\n/**\n * Abstract interface for issue trackers.\n * Implementations must handle normalization to/from tracker-specific formats.\n */\nexport interface IssueTracker {\n /** Tracker type identifier */\n readonly name: TrackerType;\n\n /**\n * List issues matching filters\n */\n listIssues(filters?: IssueFilters): Promise<Issue[]>;\n\n /**\n * Get a single issue by ID or ref\n * @param id - Issue ID or human-readable ref (e.g., \"MIN-630\", \"#42\")\n */\n getIssue(id: string): Promise<Issue>;\n\n /**\n * Update an existing issue\n */\n updateIssue(id: string, update: IssueUpdate): Promise<Issue>;\n\n /**\n * Create a new issue\n */\n createIssue(issue: NewIssue): Promise<Issue>;\n\n /**\n * Get comments on an issue\n */\n getComments(issueId: string): Promise<Comment[]>;\n\n /**\n * Add a comment to an issue\n */\n addComment(issueId: string, body: string): Promise<Comment>;\n\n /**\n * Transition issue to a new state\n */\n transitionIssue(id: string, state: IssueState): Promise<void>;\n\n /**\n * Link a PR/MR to an issue\n */\n linkPR(issueId: string, prUrl: string): Promise<void>;\n}\n\n/**\n * Error thrown when a tracker feature is not implemented\n */\nexport class NotImplementedError extends Error {\n constructor(feature: string) {\n super(`Not implemented: ${feature}`);\n this.name = 'NotImplementedError';\n }\n}\n\n/**\n * Error thrown when an issue is not found\n */\nexport class IssueNotFoundError extends Error {\n constructor(id: string, tracker: TrackerType) {\n super(`Issue not found: ${id} (tracker: ${tracker})`);\n this.name = 'IssueNotFoundError';\n }\n}\n\n/**\n * Error thrown when tracker authentication fails\n */\nexport class TrackerAuthError extends Error {\n constructor(tracker: TrackerType, message: string) {\n super(`Authentication failed for ${tracker}: ${message}`);\n this.name = 'TrackerAuthError';\n }\n}\n","/**\n * Linear Issue Tracker Adapter\n *\n * Implements IssueTracker interface for Linear.\n */\n\nimport { LinearClient } from '@linear/sdk';\nimport type {\n Issue,\n IssueFilters,\n IssueState,\n IssueTracker,\n IssueUpdate,\n NewIssue,\n Comment,\n TrackerType,\n} from './interface.js';\nimport { IssueNotFoundError, TrackerAuthError } from './interface.js';\n\n// Map Linear state types to our normalized states\nconst STATE_MAP: Record<string, IssueState> = {\n backlog: 'open',\n unstarted: 'open',\n started: 'in_progress',\n completed: 'closed',\n canceled: 'closed',\n};\n\nexport class LinearTracker implements IssueTracker {\n readonly name: TrackerType = 'linear';\n private client: LinearClient;\n private defaultTeam?: string;\n\n constructor(apiKey: string, options?: { team?: string }) {\n if (!apiKey) {\n throw new TrackerAuthError('linear', 'API key is required');\n }\n this.client = new LinearClient({ apiKey });\n this.defaultTeam = options?.team;\n }\n\n async listIssues(filters?: IssueFilters): Promise<Issue[]> {\n const team = filters?.team ?? this.defaultTeam;\n\n const result = await this.client.issues({\n first: filters?.limit ?? 50,\n filter: {\n team: team ? { key: { eq: team } } : undefined,\n state: filters?.state\n ? { type: { eq: this.reverseMapState(filters.state) } }\n : filters?.includeClosed\n ? undefined\n : { type: { neq: 'completed' } },\n labels: filters?.labels?.length\n ? { name: { in: filters.labels } }\n : undefined,\n assignee: filters?.assignee\n ? { name: { containsIgnoreCase: filters.assignee } }\n : undefined,\n },\n });\n\n const issues: Issue[] = [];\n for (const node of result.nodes) {\n issues.push(await this.normalizeIssue(node));\n }\n return issues;\n }\n\n async getIssue(id: string): Promise<Issue> {\n try {\n // Check if it's a UUID (36 chars with hyphens)\n const isUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id);\n\n if (isUuid) {\n // Fetch directly by UUID\n const issue = await this.client.issue(id);\n if (issue) {\n return this.normalizeIssue(issue);\n }\n } else {\n // Parse identifier (e.g., MIN-630) and search\n const match = id.match(/^([A-Z]+)-(\\d+)$/i);\n if (match) {\n const [, teamKey, number] = match;\n // Use searchIssues which supports identifier matching\n const results = await this.client.searchIssues(id, { first: 1 });\n if (results.nodes.length > 0) {\n return this.normalizeIssue(results.nodes[0]);\n }\n }\n }\n\n throw new IssueNotFoundError(id, 'linear');\n } catch (error) {\n if (error instanceof IssueNotFoundError) throw error;\n throw new IssueNotFoundError(id, 'linear');\n }\n }\n\n async updateIssue(id: string, update: IssueUpdate): Promise<Issue> {\n const issue = await this.getIssue(id);\n\n const updatePayload: Record<string, unknown> = {};\n\n if (update.title !== undefined) {\n updatePayload.title = update.title;\n }\n if (update.description !== undefined) {\n updatePayload.description = update.description;\n }\n if (update.priority !== undefined) {\n updatePayload.priority = update.priority;\n }\n if (update.dueDate !== undefined) {\n updatePayload.dueDate = update.dueDate;\n }\n if (update.state !== undefined) {\n // Need to find the state ID - this is complex in Linear\n // For now, we'll use the transition method\n await this.transitionIssue(id, update.state);\n }\n if (update.labels !== undefined) {\n // Need to look up label IDs - complex operation\n // TODO: Implement label updates\n }\n\n if (Object.keys(updatePayload).length > 0) {\n await this.client.updateIssue(issue.id, updatePayload);\n }\n\n return this.getIssue(id);\n }\n\n async createIssue(newIssue: NewIssue): Promise<Issue> {\n const team = newIssue.team ?? this.defaultTeam;\n\n if (!team) {\n throw new Error('Team is required to create an issue');\n }\n\n // Get team ID from key\n const teams = await this.client.teams({\n filter: { key: { eq: team } },\n });\n\n if (teams.nodes.length === 0) {\n throw new Error(`Team not found: ${team}`);\n }\n\n const teamId = teams.nodes[0].id;\n\n const result = await this.client.createIssue({\n teamId,\n title: newIssue.title,\n description: newIssue.description,\n priority: newIssue.priority,\n dueDate: newIssue.dueDate,\n });\n\n const created = await result.issue;\n if (!created) {\n throw new Error('Failed to create issue');\n }\n\n return this.normalizeIssue(created);\n }\n\n async getComments(issueId: string): Promise<Comment[]> {\n const issue = await this.client.issue(issueId);\n const comments = await issue.comments();\n\n return comments.nodes.map((c) => ({\n id: c.id,\n issueId,\n body: c.body,\n author: c.user?.then((u) => u?.name ?? 'Unknown') as unknown as string, // Simplified\n createdAt: c.createdAt.toISOString(),\n updatedAt: c.updatedAt.toISOString(),\n }));\n }\n\n async addComment(issueId: string, body: string): Promise<Comment> {\n const result = await this.client.createComment({\n issueId,\n body,\n });\n\n const comment = await result.comment;\n if (!comment) {\n throw new Error('Failed to create comment');\n }\n\n return {\n id: comment.id,\n issueId,\n body: comment.body,\n author: 'Panopticon', // Simplified\n createdAt: comment.createdAt.toISOString(),\n updatedAt: comment.updatedAt.toISOString(),\n };\n }\n\n async transitionIssue(id: string, state: IssueState): Promise<void> {\n const issue = await this.getIssue(id);\n\n // Get workflow states for the issue's team\n const linearIssue = await this.client.issue(issue.id);\n const team = await linearIssue.team;\n if (!team) {\n throw new Error('Could not determine issue team');\n }\n\n const states = await team.states();\n const targetStateType = this.reverseMapState(state);\n\n // Find a state matching the target type\n const targetState = states.nodes.find((s) => s.type === targetStateType);\n if (!targetState) {\n throw new Error(`No state found matching type: ${targetStateType}`);\n }\n\n await this.client.updateIssue(issue.id, {\n stateId: targetState.id,\n });\n }\n\n async linkPR(issueId: string, prUrl: string): Promise<void> {\n const issue = await this.getIssue(issueId);\n\n await this.client.createAttachment({\n issueId: issue.id,\n title: 'Pull Request',\n url: prUrl,\n });\n }\n\n private async normalizeIssue(linearIssue: any): Promise<Issue> {\n const state = await linearIssue.state;\n const assignee = await linearIssue.assignee;\n const labels = await linearIssue.labels();\n\n // Handle dueDate - can be Date, string, or undefined\n let dueDate: string | undefined;\n if (linearIssue.dueDate) {\n dueDate = linearIssue.dueDate instanceof Date\n ? linearIssue.dueDate.toISOString()\n : String(linearIssue.dueDate);\n }\n\n return {\n id: linearIssue.id,\n ref: linearIssue.identifier,\n title: linearIssue.title,\n description: linearIssue.description ?? '',\n state: this.mapState(state?.type ?? 'backlog'),\n labels: labels?.nodes?.map((l: any) => l.name) ?? [],\n assignee: assignee?.name,\n url: linearIssue.url,\n tracker: 'linear',\n priority: linearIssue.priority,\n dueDate,\n createdAt: linearIssue.createdAt instanceof Date\n ? linearIssue.createdAt.toISOString()\n : String(linearIssue.createdAt),\n updatedAt: linearIssue.updatedAt instanceof Date\n ? linearIssue.updatedAt.toISOString()\n : String(linearIssue.updatedAt),\n };\n }\n\n private mapState(linearState: string): IssueState {\n return STATE_MAP[linearState] ?? 'open';\n }\n\n private reverseMapState(state: IssueState): string {\n switch (state) {\n case 'open':\n return 'unstarted';\n case 'in_progress':\n return 'started';\n case 'closed':\n return 'completed';\n default:\n return 'unstarted';\n }\n }\n}\n","/**\n * GitHub Issues Tracker Adapter\n *\n * Implements IssueTracker interface for GitHub Issues.\n */\n\nimport { Octokit } from '@octokit/rest';\nimport type {\n Issue,\n IssueFilters,\n IssueState,\n IssueTracker,\n IssueUpdate,\n NewIssue,\n Comment,\n TrackerType,\n} from './interface.js';\nimport { IssueNotFoundError, TrackerAuthError } from './interface.js';\n\nexport class GitHubTracker implements IssueTracker {\n readonly name: TrackerType = 'github';\n private octokit: Octokit;\n private owner: string;\n private repo: string;\n\n constructor(token: string, owner: string, repo: string) {\n if (!token) {\n throw new TrackerAuthError('github', 'Token is required');\n }\n if (!owner || !repo) {\n throw new Error('GitHub owner and repo are required');\n }\n\n this.octokit = new Octokit({ auth: token });\n this.owner = owner;\n this.repo = repo;\n }\n\n async listIssues(filters?: IssueFilters): Promise<Issue[]> {\n const state = this.mapStateToGitHub(filters?.state);\n\n const response = await this.octokit.issues.listForRepo({\n owner: this.owner,\n repo: this.repo,\n state: filters?.includeClosed ? 'all' : state,\n labels: filters?.labels?.join(',') || undefined,\n assignee: filters?.assignee || undefined,\n per_page: filters?.limit ?? 50,\n });\n\n // Filter out pull requests (GitHub API returns both)\n const issues = response.data.filter((item) => !item.pull_request);\n\n return issues.map((issue) => this.normalizeIssue(issue));\n }\n\n async getIssue(id: string): Promise<Issue> {\n try {\n // Parse the issue number from refs like \"#42\" or just \"42\"\n const issueNumber = parseInt(id.replace(/^#/, ''), 10);\n\n if (isNaN(issueNumber)) {\n throw new IssueNotFoundError(id, 'github');\n }\n\n const { data: issue } = await this.octokit.issues.get({\n owner: this.owner,\n repo: this.repo,\n issue_number: issueNumber,\n });\n\n return this.normalizeIssue(issue);\n } catch (error: any) {\n if (error?.status === 404) {\n throw new IssueNotFoundError(id, 'github');\n }\n throw error;\n }\n }\n\n async updateIssue(id: string, update: IssueUpdate): Promise<Issue> {\n const issueNumber = parseInt(id.replace(/^#/, ''), 10);\n\n const updatePayload: Record<string, unknown> = {};\n\n if (update.title !== undefined) {\n updatePayload.title = update.title;\n }\n if (update.description !== undefined) {\n updatePayload.body = update.description;\n }\n if (update.state !== undefined) {\n updatePayload.state = update.state === 'closed' ? 'closed' : 'open';\n }\n if (update.labels !== undefined) {\n updatePayload.labels = update.labels;\n }\n if (update.assignee !== undefined) {\n updatePayload.assignees = update.assignee ? [update.assignee] : [];\n }\n\n await this.octokit.issues.update({\n owner: this.owner,\n repo: this.repo,\n issue_number: issueNumber,\n ...updatePayload,\n });\n\n return this.getIssue(id);\n }\n\n async createIssue(newIssue: NewIssue): Promise<Issue> {\n const { data: issue } = await this.octokit.issues.create({\n owner: this.owner,\n repo: this.repo,\n title: newIssue.title,\n body: newIssue.description,\n labels: newIssue.labels,\n assignees: newIssue.assignee ? [newIssue.assignee] : undefined,\n });\n\n return this.normalizeIssue(issue);\n }\n\n async getComments(issueId: string): Promise<Comment[]> {\n const issueNumber = parseInt(issueId.replace(/^#/, ''), 10);\n\n const { data: comments } = await this.octokit.issues.listComments({\n owner: this.owner,\n repo: this.repo,\n issue_number: issueNumber,\n });\n\n return comments.map((c) => ({\n id: String(c.id),\n issueId,\n body: c.body ?? '',\n author: c.user?.login ?? 'Unknown',\n createdAt: c.created_at,\n updatedAt: c.updated_at,\n }));\n }\n\n async addComment(issueId: string, body: string): Promise<Comment> {\n const issueNumber = parseInt(issueId.replace(/^#/, ''), 10);\n\n const { data: comment } = await this.octokit.issues.createComment({\n owner: this.owner,\n repo: this.repo,\n issue_number: issueNumber,\n body,\n });\n\n return {\n id: String(comment.id),\n issueId,\n body: comment.body ?? '',\n author: comment.user?.login ?? 'Unknown',\n createdAt: comment.created_at,\n updatedAt: comment.updated_at,\n };\n }\n\n async transitionIssue(id: string, state: IssueState): Promise<void> {\n await this.updateIssue(id, { state });\n }\n\n async linkPR(issueId: string, prUrl: string): Promise<void> {\n // GitHub auto-links PRs that mention issues\n // Add a comment with the PR link\n await this.addComment(\n issueId,\n `Linked Pull Request: ${prUrl}`\n );\n }\n\n private normalizeIssue(ghIssue: any): Issue {\n return {\n id: String(ghIssue.id),\n ref: `#${ghIssue.number}`,\n title: ghIssue.title,\n description: ghIssue.body ?? '',\n state: this.mapStateFromGitHub(ghIssue.state),\n labels: ghIssue.labels.map((l: any) =>\n typeof l === 'string' ? l : l.name\n ),\n assignee: ghIssue.assignee?.login,\n url: ghIssue.html_url,\n tracker: 'github',\n priority: undefined, // GitHub doesn't have priority\n dueDate: undefined, // GitHub doesn't have due dates on issues\n createdAt: ghIssue.created_at,\n updatedAt: ghIssue.updated_at,\n };\n }\n\n private mapStateFromGitHub(ghState: string): IssueState {\n // GitHub only has open and closed states\n // No way to distinguish \"in_progress\" without custom labels\n return ghState === 'closed' ? 'closed' : 'open';\n }\n\n private mapStateToGitHub(\n state?: IssueState\n ): 'open' | 'closed' | 'all' {\n if (!state) return 'open';\n if (state === 'closed') return 'closed';\n return 'open'; // Both 'open' and 'in_progress' map to 'open'\n }\n}\n","/**\n * GitLab Issues Tracker Adapter (Stub)\n *\n * Placeholder implementation for GitLab Issues support.\n * Full implementation will use @gitbeaker/rest.\n */\n\nimport type {\n Issue,\n IssueFilters,\n IssueState,\n IssueTracker,\n IssueUpdate,\n NewIssue,\n Comment,\n TrackerType,\n} from './interface.js';\nimport { NotImplementedError } from './interface.js';\n\nexport class GitLabTracker implements IssueTracker {\n readonly name: TrackerType = 'gitlab';\n\n constructor(\n private token: string,\n private projectId: string\n ) {\n // Stub - will initialize @gitbeaker client when implemented\n }\n\n async listIssues(_filters?: IssueFilters): Promise<Issue[]> {\n throw new NotImplementedError(\n 'GitLab tracker is not yet implemented. Coming soon!'\n );\n }\n\n async getIssue(_id: string): Promise<Issue> {\n throw new NotImplementedError(\n 'GitLab tracker is not yet implemented. Coming soon!'\n );\n }\n\n async updateIssue(_id: string, _update: IssueUpdate): Promise<Issue> {\n throw new NotImplementedError(\n 'GitLab tracker is not yet implemented. Coming soon!'\n );\n }\n\n async createIssue(_issue: NewIssue): Promise<Issue> {\n throw new NotImplementedError(\n 'GitLab tracker is not yet implemented. Coming soon!'\n );\n }\n\n async getComments(_issueId: string): Promise<Comment[]> {\n throw new NotImplementedError(\n 'GitLab tracker is not yet implemented. Coming soon!'\n );\n }\n\n async addComment(_issueId: string, _body: string): Promise<Comment> {\n throw new NotImplementedError(\n 'GitLab tracker is not yet implemented. Coming soon!'\n );\n }\n\n async transitionIssue(_id: string, _state: IssueState): Promise<void> {\n throw new NotImplementedError(\n 'GitLab tracker is not yet implemented. Coming soon!'\n );\n }\n\n async linkPR(_issueId: string, _prUrl: string): Promise<void> {\n throw new NotImplementedError(\n 'GitLab tracker is not yet implemented. Coming soon!'\n );\n }\n}\n","/**\n * Tracker Factory\n *\n * Creates appropriate tracker instances based on configuration.\n */\n\nimport type { IssueTracker, TrackerType } from './interface.js';\nimport { TrackerAuthError } from './interface.js';\nimport { LinearTracker } from './linear.js';\nimport { GitHubTracker } from './github.js';\nimport { GitLabTracker } from './gitlab.js';\nimport type { TrackersConfig } from '../config.js';\n\n// Configuration for a single tracker\nexport interface TrackerConfig {\n type: TrackerType;\n\n // Linear-specific\n apiKeyEnv?: string;\n team?: string;\n\n // GitHub-specific\n tokenEnv?: string;\n owner?: string;\n repo?: string;\n\n // GitLab-specific\n projectId?: string;\n}\n\n// Multi-tracker configuration (re-exported from config.ts)\n// Note: Use TrackersConfig from config.ts for full type with nested configs\n\n/**\n * Create a tracker instance from configuration\n */\nexport function createTracker(config: TrackerConfig): IssueTracker {\n switch (config.type) {\n case 'linear': {\n const apiKey = config.apiKeyEnv\n ? process.env[config.apiKeyEnv]\n : process.env.LINEAR_API_KEY;\n\n if (!apiKey) {\n throw new TrackerAuthError(\n 'linear',\n `API key not found. Set ${config.apiKeyEnv ?? 'LINEAR_API_KEY'} environment variable.`\n );\n }\n\n return new LinearTracker(apiKey, { team: config.team });\n }\n\n case 'github': {\n const token = config.tokenEnv\n ? process.env[config.tokenEnv]\n : process.env.GITHUB_TOKEN;\n\n if (!token) {\n throw new TrackerAuthError(\n 'github',\n `Token not found. Set ${config.tokenEnv ?? 'GITHUB_TOKEN'} environment variable.`\n );\n }\n\n if (!config.owner || !config.repo) {\n throw new Error(\n 'GitHub tracker requires owner and repo configuration'\n );\n }\n\n return new GitHubTracker(token, config.owner, config.repo);\n }\n\n case 'gitlab': {\n const token = config.tokenEnv\n ? process.env[config.tokenEnv]\n : process.env.GITLAB_TOKEN;\n\n if (!token) {\n throw new TrackerAuthError(\n 'gitlab',\n `Token not found. Set ${config.tokenEnv ?? 'GITLAB_TOKEN'} environment variable.`\n );\n }\n\n if (!config.projectId) {\n throw new Error('GitLab tracker requires projectId configuration');\n }\n\n return new GitLabTracker(token, config.projectId);\n }\n\n default:\n throw new Error(`Unknown tracker type: ${config.type}`);\n }\n}\n\n/**\n * Create tracker from trackers configuration section\n */\nexport function createTrackerFromConfig(\n trackersConfig: TrackersConfig,\n trackerType: TrackerType\n): IssueTracker {\n const config = trackersConfig[trackerType];\n\n if (!config) {\n throw new Error(\n `No configuration found for tracker: ${trackerType}. Add [trackers.${trackerType}] to config.`\n );\n }\n\n return createTracker({ ...config, type: trackerType });\n}\n\n/**\n * Get the primary tracker from configuration\n */\nexport function getPrimaryTracker(trackersConfig: TrackersConfig): IssueTracker {\n return createTrackerFromConfig(trackersConfig, trackersConfig.primary);\n}\n\n/**\n * Get the secondary tracker from configuration (if configured)\n */\nexport function getSecondaryTracker(\n trackersConfig: TrackersConfig\n): IssueTracker | null {\n if (!trackersConfig.secondary) {\n return null;\n }\n return createTrackerFromConfig(trackersConfig, trackersConfig.secondary);\n}\n\n/**\n * Get all configured trackers\n */\nexport function getAllTrackers(trackersConfig: TrackersConfig): IssueTracker[] {\n const trackers: IssueTracker[] = [getPrimaryTracker(trackersConfig)];\n\n const secondary = getSecondaryTracker(trackersConfig);\n if (secondary) {\n trackers.push(secondary);\n }\n\n return trackers;\n}\n","/**\n * Cross-Tracker Linking\n *\n * Manages links between issues in different trackers.\n * Links are stored in a local JSON file for persistence.\n */\n\nimport { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';\nimport { join } from 'path';\nimport { homedir } from 'os';\nimport type { TrackerType } from './interface.js';\n\n// Link direction types\nexport type LinkDirection = 'blocks' | 'blocked_by' | 'related' | 'duplicate_of';\n\n// A single link between two issues\nexport interface TrackerLink {\n sourceIssueRef: string; // e.g., \"MIN-630\"\n sourceTracker: TrackerType;\n targetIssueRef: string; // e.g., \"#42\"\n targetTracker: TrackerType;\n direction: LinkDirection;\n createdAt: string; // ISO timestamp\n}\n\n// Storage format\ninterface LinkStore {\n version: 1;\n links: TrackerLink[];\n}\n\n/**\n * Parse an issue reference to extract tracker and ID\n * Examples:\n * \"#42\" -> { tracker: \"github\", ref: \"#42\" }\n * \"github#42\" -> { tracker: \"github\", ref: \"#42\" }\n * \"MIN-630\" -> { tracker: \"linear\", ref: \"MIN-630\" }\n * \"gitlab#15\" -> { tracker: \"gitlab\", ref: \"#15\" }\n */\nexport function parseIssueRef(ref: string): { tracker: TrackerType; ref: string } | null {\n // Explicit tracker prefix\n if (ref.startsWith('github#')) {\n return { tracker: 'github', ref: `#${ref.slice(7)}` };\n }\n if (ref.startsWith('gitlab#')) {\n return { tracker: 'gitlab', ref: `#${ref.slice(7)}` };\n }\n if (ref.startsWith('linear:')) {\n return { tracker: 'linear', ref: ref.slice(7) };\n }\n\n // GitHub-style refs (#number)\n if (/^#\\d+$/.test(ref)) {\n return { tracker: 'github', ref };\n }\n\n // Linear-style refs (XXX-123)\n if (/^[A-Z]+-\\d+$/i.test(ref)) {\n return { tracker: 'linear', ref: ref.toUpperCase() };\n }\n\n return null;\n}\n\n/**\n * Format an issue ref with tracker prefix for display\n */\nexport function formatIssueRef(ref: string, tracker: TrackerType): string {\n if (tracker === 'github') {\n return ref.startsWith('#') ? `github${ref}` : `github#${ref}`;\n }\n if (tracker === 'gitlab') {\n return ref.startsWith('#') ? `gitlab${ref}` : `gitlab#${ref}`;\n }\n return ref; // Linear refs are already unique\n}\n\n/**\n * Link Manager for cross-tracker issue linking\n */\nexport class LinkManager {\n private storePath: string;\n private store: LinkStore;\n\n constructor(storePath?: string) {\n this.storePath = storePath ?? join(homedir(), '.panopticon', 'links.json');\n this.store = this.load();\n }\n\n private load(): LinkStore {\n if (existsSync(this.storePath)) {\n try {\n const data = JSON.parse(readFileSync(this.storePath, 'utf-8'));\n if (data.version === 1) {\n return data;\n }\n } catch {\n // Fall through to default\n }\n }\n return { version: 1, links: [] };\n }\n\n private save(): void {\n const dir = join(this.storePath, '..');\n if (!existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n writeFileSync(this.storePath, JSON.stringify(this.store, null, 2));\n }\n\n /**\n * Add a link between two issues\n */\n addLink(\n source: { ref: string; tracker: TrackerType },\n target: { ref: string; tracker: TrackerType },\n direction: LinkDirection = 'related'\n ): TrackerLink {\n // Check if link already exists\n const existing = this.store.links.find(\n (l) =>\n l.sourceIssueRef === source.ref &&\n l.sourceTracker === source.tracker &&\n l.targetIssueRef === target.ref &&\n l.targetTracker === target.tracker\n );\n\n if (existing) {\n // Update direction if different\n if (existing.direction !== direction) {\n existing.direction = direction;\n this.save();\n }\n return existing;\n }\n\n const link: TrackerLink = {\n sourceIssueRef: source.ref,\n sourceTracker: source.tracker,\n targetIssueRef: target.ref,\n targetTracker: target.tracker,\n direction,\n createdAt: new Date().toISOString(),\n };\n\n this.store.links.push(link);\n this.save();\n return link;\n }\n\n /**\n * Remove a link between two issues\n */\n removeLink(\n source: { ref: string; tracker: TrackerType },\n target: { ref: string; tracker: TrackerType }\n ): boolean {\n const index = this.store.links.findIndex(\n (l) =>\n l.sourceIssueRef === source.ref &&\n l.sourceTracker === source.tracker &&\n l.targetIssueRef === target.ref &&\n l.targetTracker === target.tracker\n );\n\n if (index >= 0) {\n this.store.links.splice(index, 1);\n this.save();\n return true;\n }\n return false;\n }\n\n /**\n * Get all issues linked to a given issue\n */\n getLinkedIssues(ref: string, tracker: TrackerType): TrackerLink[] {\n return this.store.links.filter(\n (l) =>\n (l.sourceIssueRef === ref && l.sourceTracker === tracker) ||\n (l.targetIssueRef === ref && l.targetTracker === tracker)\n );\n }\n\n /**\n * Get all links (for debugging/admin)\n */\n getAllLinks(): TrackerLink[] {\n return [...this.store.links];\n }\n\n /**\n * Find linked issue in another tracker\n */\n findLinkedIssue(\n ref: string,\n sourceTracker: TrackerType,\n targetTracker: TrackerType\n ): string | null {\n // Check as source\n const asSource = this.store.links.find(\n (l) =>\n l.sourceIssueRef === ref &&\n l.sourceTracker === sourceTracker &&\n l.targetTracker === targetTracker\n );\n if (asSource) return asSource.targetIssueRef;\n\n // Check as target\n const asTarget = this.store.links.find(\n (l) =>\n l.targetIssueRef === ref &&\n l.targetTracker === sourceTracker &&\n l.sourceTracker === targetTracker\n );\n if (asTarget) return asTarget.sourceIssueRef;\n\n return null;\n }\n\n /**\n * Clear all links (for testing)\n */\n clear(): void {\n this.store.links = [];\n this.save();\n }\n}\n\n// Singleton instance\nlet _linkManager: LinkManager | null = null;\n\nexport function getLinkManager(): LinkManager {\n if (!_linkManager) {\n _linkManager = new LinkManager();\n }\n return _linkManager;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,eAAe;AACxB,SAAS,YAAY;AA0DrB,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AAxDjB,IAAM,kBAAkB,KAAK,QAAQ,GAAG,aAAa;AAGrD,IAAM,aAAa;AACnB,IAAM,aAAa,KAAK,iBAAiB,QAAQ;AACjD,IAAM,eAAe,KAAK,iBAAiB,UAAU;AACrD,IAAM,aAAa,KAAK,iBAAiB,QAAQ;AACjD,IAAM,cAAc,KAAK,iBAAiB,SAAS;AACnD,IAAM,YAAY,KAAK,iBAAiB,OAAO;AAG/C,IAAM,cAAc,KAAK,iBAAiB,SAAS;AACnD,IAAM,sBAAsB,KAAK,aAAa,SAAS;AACvD,IAAM,oBAAoB,KAAK,aAAa,OAAO;AAGnD,IAAM,YAAY,KAAK,iBAAiB,OAAO;AAG/C,IAAM,cAAc,KAAK,YAAY,aAAa;AAGlD,IAAM,aAAa,KAAK,QAAQ,GAAG,SAAS;AAC5C,IAAM,YAAY,KAAK,QAAQ,GAAG,QAAQ;AAC1C,IAAM,aAAa,KAAK,QAAQ,GAAG,SAAS;AAC5C,IAAM,aAAa,KAAK,QAAQ,GAAG,SAAS;AAG5C,IAAM,eAAe;AAAA,EAC1B,QAAQ;AAAA,IACN,QAAQ,KAAK,YAAY,QAAQ;AAAA,IACjC,UAAU,KAAK,YAAY,UAAU;AAAA,EACvC;AAAA,EACA,OAAO;AAAA,IACL,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AA,EAKA,gBAAgB,KAAa,SAAqC;AAChE,WAAO,KAAK,MAAM,MAAM;AAAA,MACtB,CAAC,MACE,EAAE,mBAAmB,OAAO,EAAE,kBAAkB,WAChD,EAAE,mBAAmB,OAAO,EAAE,kBAAkB;AAAA,IACrD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,cAA6B;AAC3B,WAAO,CAAC,GAAG,KAAK,MAAM,KAAK;AAAA,EAC7B;AAAA;AAAA;AAAA;AAAA,EAKA,gBACE,KACA,eACA,eACe;AAEf,UAAM,WAAW,KAAK,MAAM,MAAM;AAAA,MAChC,CAAC,MACC,EAAE,mBAAmB,OACrB,EAAE,kBAAkB,iBACpB,EAAE,kBAAkB;AAAA,IACxB;AACA,QAAI,SAAU,QAAO,SAAS;AAG9B,UAAM,WAAW,KAAK,MAAM,MAAM;AAAA,MAChC,CAAC,MACC,EAAE,mBAAmB,OACrB,EAAE,kBAAkB,iBACpB,EAAE,kBAAkB;AAAA,IACxB;AACA,QAAI,SAAU,QAAO,SAAS;AAE9B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,QAAc;AACZ,SAAK,MAAM,QAAQ,CAAC;AACpB,SAAK,KAAK;AAAA,EACZ;AACF;AAGA,IAAI,eAAmC;AAEhC,SAAS,iBAA8B;AAC5C,MAAI,CAAC,cAAc;AACjB,mBAAe,IAAI,YAAY;AAAA,EACjC;AACA,SAAO;AACT;","names":["existsSync","readFileSync","homedir","join","existsSync","join","join","existsSync","existsSync","mkdirSync","readdirSync","rmSync","join","rmSync","existsSync","readdirSync","join","mkdirSync","readFileSync","writeFileSync","existsSync","mkdirSync","join","homedir"]}
|
package/dist/cli/index.js
CHANGED
|
@@ -29,14 +29,14 @@ import {
|
|
|
29
29
|
planSync,
|
|
30
30
|
restoreBackup,
|
|
31
31
|
saveConfig
|
|
32
|
-
} from "../chunk-
|
|
32
|
+
} from "../chunk-J7JUNJGH.js";
|
|
33
33
|
|
|
34
34
|
// package.json
|
|
35
35
|
var require_package = __commonJS({
|
|
36
36
|
"package.json"(exports, module) {
|
|
37
37
|
module.exports = {
|
|
38
38
|
name: "panopticon-cli",
|
|
39
|
-
version: "0.
|
|
39
|
+
version: "0.2.0",
|
|
40
40
|
description: "Multi-agent orchestration for AI coding assistants (Claude Code, Codex, Cursor, Gemini CLI)",
|
|
41
41
|
keywords: [
|
|
42
42
|
"ai-agents",
|
|
@@ -80,7 +80,13 @@ var require_package = __commonJS({
|
|
|
80
80
|
build: "tsup",
|
|
81
81
|
typecheck: "tsc --noEmit",
|
|
82
82
|
lint: "eslint src/",
|
|
83
|
-
test: "vitest",
|
|
83
|
+
test: "vitest --no-file-parallelism",
|
|
84
|
+
"test:unit": "vitest run tests/unit",
|
|
85
|
+
"test:integration": "vitest run tests/integration",
|
|
86
|
+
"test:e2e": "vitest run tests/e2e",
|
|
87
|
+
"test:coverage": "vitest run --coverage",
|
|
88
|
+
docs: "typedoc",
|
|
89
|
+
"docs:watch": "typedoc --watch",
|
|
84
90
|
prepublishOnly: "npm run build"
|
|
85
91
|
},
|
|
86
92
|
dependencies: {
|
|
@@ -97,9 +103,11 @@ var require_package = __commonJS({
|
|
|
97
103
|
devDependencies: {
|
|
98
104
|
"@types/inquirer": "^9.0.9",
|
|
99
105
|
"@types/node": "^20.10.0",
|
|
106
|
+
"@vitest/coverage-v8": "^1.0.4",
|
|
100
107
|
eslint: "^8.55.0",
|
|
101
108
|
tsup: "^8.0.1",
|
|
102
109
|
tsx: "^4.6.2",
|
|
110
|
+
typedoc: "^0.25.0",
|
|
103
111
|
typescript: "^5.3.2",
|
|
104
112
|
vitest: "^1.0.4"
|
|
105
113
|
}
|