prjct-cli 0.35.3 → 0.35.4

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.
Files changed (44) hide show
  1. package/core/commands/analysis.ts +58 -32
  2. package/core/commands/command-data.ts +11 -50
  3. package/core/commands/commands.ts +18 -21
  4. package/core/commands/context.ts +238 -0
  5. package/core/commands/register.ts +7 -5
  6. package/core/commands/setup.ts +1 -17
  7. package/core/index.ts +2 -4
  8. package/core/services/index.ts +2 -0
  9. package/core/services/sync-service.ts +1080 -0
  10. package/core/types/commands.ts +0 -12
  11. package/core/types/index.ts +0 -1
  12. package/dist/bin/prjct.mjs +1215 -307
  13. package/package.json +2 -8
  14. package/templates/agentic/agent-routing.md +22 -88
  15. package/templates/agentic/agents/uxui.md +42 -197
  16. package/templates/agentic/context-filtering.md +14 -56
  17. package/templates/agentic/orchestrator.md +26 -302
  18. package/templates/agentic/skill-integration.md +37 -289
  19. package/templates/agentic/subagent-generation.md +31 -104
  20. package/templates/agentic/task-fragmentation.md +39 -273
  21. package/templates/agents/AGENTS.md +32 -188
  22. package/templates/commands/bug.md +22 -520
  23. package/templates/commands/dash.md +26 -161
  24. package/templates/commands/done.md +19 -250
  25. package/templates/commands/enrich.md +21 -732
  26. package/templates/commands/idea.md +18 -160
  27. package/templates/commands/init.md +20 -209
  28. package/templates/commands/merge.md +21 -185
  29. package/templates/commands/next.md +21 -103
  30. package/templates/commands/pause.md +21 -272
  31. package/templates/commands/resume.md +18 -411
  32. package/templates/commands/setup.md +0 -1
  33. package/templates/commands/ship.md +30 -627
  34. package/templates/commands/sync.md +11 -1448
  35. package/templates/commands/task.md +17 -439
  36. package/templates/commands/test.md +30 -259
  37. package/CLAUDE.md +0 -211
  38. package/packages/shared/package.json +0 -29
  39. package/packages/shared/src/index.ts +0 -10
  40. package/packages/shared/src/schemas.ts +0 -124
  41. package/packages/shared/src/types.ts +0 -187
  42. package/packages/shared/src/unified.ts +0 -174
  43. package/packages/shared/src/utils.ts +0 -148
  44. package/packages/shared/tsconfig.json +0 -18
@@ -1,1460 +1,23 @@
1
1
  ---
2
- allowed-tools: [Read, Write, Bash, Glob, Grep]
3
- description: 'Deep sync - analyze git, update ALL project data'
4
- timestamp-rule: 'GetTimestamp() for all timestamps'
5
- architecture: 'Write-Through (JSON → MD → Events)'
6
- storage-layer: true
7
- source-of-truth: 'storage/*.json'
8
- claude-context: 'context/*.md'
9
- backend-sync: 'sync/pending.json'
2
+ allowed-tools: [Bash]
10
3
  ---
11
4
 
12
- # /p:sync - Deep Project Sync
5
+ # p. sync
13
6
 
14
- **CRITICAL**: This is a DEEP analysis. Sync EVERYTHING with the real state of the repository.
15
-
16
- ## Architecture: Write-Through Pattern
17
-
18
- ```
19
- Git Analysis → Storage (JSON) → Context (MD) → Project Metadata
20
- ```
21
-
22
- **Source of Truth**: `storage/*.json` (state, queue, ideas, shipped)
23
- **Claude Context**: `context/*.md` (now, next, ideas, shipped, CLAUDE.md)
24
- **Project Metadata**: `project.json`
25
-
26
- ## What Gets Analyzed & Updated
27
-
28
- ### Git Analysis (Deep)
29
- - `git status` - Uncommitted changes, staged files
30
- - `git log` - Recent commits to detect completed tasks
31
- - `git diff` - What's changed since last commit
32
- - `git branch` - Current branch, feature branches
33
-
34
- ### Storage Files (Source of Truth)
35
- - `storage/state.json` - Current task state
36
- - `storage/queue.json` - Task queue
37
- - `storage/ideas.json` - Ideas list
38
- - `storage/shipped.json` - Shipped features
39
-
40
- ### Context Files (Generated for Claude)
41
- - `context/now.md` - Current task (from state.json)
42
- - `context/next.md` - Task queue (from queue.json)
43
- - `context/ideas.md` - Ideas (from ideas.json)
44
- - `context/shipped.md` - Shipped (from shipped.json)
45
- - `context/CLAUDE.md` - Full project context
46
-
47
- ### Project Metadata
48
- - `project.json` - ALL fields with real data
49
-
50
- ## Context Variables
51
- - `{projectId}`: From `.prjct/prjct.config.json`
52
- - `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
53
- - `{cwd}`: Current working directory (repo path)
54
-
55
- ---
56
-
57
- ## Step 0: Migration Check (Legacy Projects)
58
-
59
- CHECK: Does `.prjct/prjct.config.json` exist?
60
-
61
- IF file exists:
62
- READ: `.prjct/prjct.config.json`
63
- CHECK: Does `projectId` exist and is it a valid UUID?
64
-
65
- IF projectId is missing OR not a UUID:
66
- MIGRATE to UUID:
67
- 1. Generate new UUID: `{newProjectId}`
68
- 2. Create global structure: `~/.prjct-cli/projects/{newProjectId}/`
69
- 3. Create subdirectories: storage/, context/, agents/, memory/, analysis/
70
- 4. IF legacy data exists in `.prjct/`:
71
- - Migrate core/now.md → storage/state.json
72
- - Migrate planning/ideas.md → storage/ideas.json
73
- - Migrate progress/shipped.md → storage/shipped.json
74
- 5. Update `.prjct/prjct.config.json` with new `projectId`
75
- OUTPUT: "🔄 Migrated to UUID format: {newProjectId}"
76
-
77
- IF file not found:
78
- CHECK: Does `.prjct/` directory exist? (legacy project without config)
79
-
80
- IF `.prjct/` exists:
81
- MIGRATE:
82
- 1. Generate new UUID: `{newProjectId}`
83
- 2. Create `.prjct/prjct.config.json` with `projectId`
84
- 3. Create global structure
85
- 4. Migrate legacy data
86
- OUTPUT: "🔄 Migrated legacy project to UUID: {newProjectId}"
87
- ELSE:
88
- OUTPUT: "No prjct project. Run /p:init first."
89
- STOP
90
-
91
- ---
92
-
93
- ## Step 1: Read Config
94
-
95
- READ: `.prjct/prjct.config.json`
96
- EXTRACT: `projectId`
97
-
98
- IF file not found:
99
- OUTPUT: "No prjct project. Run /p:init first."
100
- STOP
101
-
102
- ---
103
-
104
- ## Step 2: Deep Git Analysis
105
-
106
- ### 2.1 Git Status (Uncommitted Work)
107
7
  ```bash
108
- git status --porcelain
8
+ prjct sync
109
9
  ```
110
10
 
111
- EXTRACT:
112
- - `{stagedFiles}`: Files staged for commit
113
- - `{modifiedFiles}`: Modified but not staged
114
- - `{untrackedFiles}`: New files
115
- - `{hasUncommittedChanges}`: true/false
116
-
117
- ### 2.2 Recent Commits (Last 20)
118
- ```bash
119
- git log --oneline -20 --pretty=format:"%h|%s|%ad" --date=short
120
- ```
121
-
122
- ANALYZE each commit for completed tasks.
123
-
124
- EXTRACT: `{completedTasks}` - List of tasks found in commits
125
-
126
- ### 2.3 Current Branch Analysis
127
- ```bash
128
- git branch --show-current
129
- git log main..HEAD --oneline 2>/dev/null
130
- ```
131
-
132
- EXTRACT:
133
- - `{currentBranch}`: Current branch name
134
- - `{branchCommits}`: Commits ahead of main
135
- - `{isFeatureBranch}`: true if not main/master
136
-
137
- ---
138
-
139
- ## Step 3: Gather Project Stats
140
-
141
- ### Count Files
142
- ```bash
143
- find . -type f \( -name "*.js" -o -name "*.ts" -o -name "*.tsx" -o -name "*.py" \) -not -path "./node_modules/*" -not -path "./.git/*" | wc -l
144
- ```
145
- EXTRACT: `{fileCount}`
146
-
147
- ### Count Commits
148
- ```bash
149
- git rev-list --count HEAD
150
- ```
151
- EXTRACT: `{commitCount}`
152
-
153
- ### Get Version
154
- READ: `package.json` → version field
155
- EXTRACT: `{version}`
156
-
157
- ### Get Project Name
158
- READ: `package.json` → name field OR directory name
159
- EXTRACT: `{projectName}`
160
-
161
- ### Detect Stack
162
- GLOB for config files and analyze:
163
- - `package.json` → Node.js, detect React/Vue/Express/Next.js
164
- - `Cargo.toml` → Rust
165
- - `go.mod` → Go
166
- - `requirements.txt` / `pyproject.toml` → Python
167
-
168
- EXTRACT: `{languages}`, `{frameworks}`, `{techStack}`
169
-
170
- ### Detect Frontend/UI Stack (for UX/UI Agent)
171
-
172
- **CRITICAL**: If ANY frontend technology is detected, generate the UX/UI agent.
173
-
174
- #### Web Frontend Detection
175
- ```bash
176
- # Check package.json for web frameworks
177
- grep -E '"(react|react-dom|next|vue|nuxt|svelte|@sveltejs/kit|@angular/core)"' package.json 2>/dev/null
178
- ```
179
-
180
- SET: `{hasWebFrontend}` = true if any match
181
-
182
- #### Mobile Frontend Detection
183
- ```bash
184
- # React Native / Expo
185
- grep -E '"(react-native|expo)"' package.json 2>/dev/null
186
-
187
- # Flutter
188
- test -f pubspec.yaml && echo "flutter"
189
-
190
- # SwiftUI (iOS)
191
- find . -name "*.swift" -exec grep -l "import SwiftUI" {} \; 2>/dev/null | head -1
192
-
193
- # Jetpack Compose (Android)
194
- find . -name "*.kt" -exec grep -l "androidx.compose" {} \; 2>/dev/null | head -1
195
- ```
196
-
197
- SET: `{hasMobileFrontend}` = true if any match
198
-
199
- #### Combined Frontend Flag
200
- ```
201
- {hasFrontendUI} = {hasWebFrontend} OR {hasMobileFrontend}
202
- ```
203
-
204
- EXTRACT: `{frontendType}` = "web" | "mobile" | "both" | null
205
-
206
- ---
207
-
208
- ## Step 3.5: Deep Project Analysis (TRULY AGENTIC)
209
-
210
- **CRITICAL: Do NOT follow hardcoded rules. ANALYZE the actual project and UNDERSTAND what it is.**
211
-
212
- ### 3.5.1 Detect Project Type (AGENTIC)
213
-
214
- **Look at the project root and DETERMINE what kind of project this is:**
215
-
216
- ```bash
217
- ls -la
218
- ```
219
-
220
- ANALYZE what files exist and REASON about the project type:
221
-
222
- | If you see... | Project is... | Ecosystem |
223
- |---------------|---------------|-----------|
224
- | `Gemfile` | Ruby/Rails | Ruby |
225
- | `requirements.txt`, `pyproject.toml`, `setup.py` | Python | Python |
226
- | `go.mod` | Go | Go |
227
- | `Cargo.toml` | Rust | Rust |
228
- | `composer.json` | PHP | PHP |
229
- | `pom.xml`, `build.gradle` | Java | JVM |
230
- | `*.csproj`, `*.sln` | .NET/C# | .NET |
231
- | `mix.exs` | Elixir | Elixir |
232
- | `Package.swift` | Swift | Apple |
233
- | `package.json` | Node.js/JavaScript | JavaScript |
234
- | `pubspec.yaml` | Flutter/Dart | Dart |
235
- | `Makefile` only | C/C++ or custom | Native |
236
-
237
- SET: `{ecosystem}` = detected ecosystem
238
- SET: `{projectType}` = specific type (e.g., "Rails", "Django", "Next.js", "Go API")
239
-
240
- ### 3.5.2 Detect Commands FOR THIS PROJECT (AGENTIC)
241
-
242
- **Based on the ecosystem, LOOK for the actual commands this project uses:**
243
-
244
- #### Ruby/Rails
245
- ```bash
246
- cat Gemfile | head -20 # See dependencies
247
- test -f bin/rails && echo "rails"
248
- test -f Rakefile && echo "rake"
249
- ```
250
- → Commands: `bundle install`, `rails s`, `rails c`, `rake db:migrate`, `rspec`
251
-
252
- #### Python
253
- ```bash
254
- test -f pyproject.toml && cat pyproject.toml | head -20
255
- test -f requirements.txt && echo "pip"
256
- which poetry && echo "poetry"
257
- which uv && echo "uv"
258
- ```
259
- → Commands: `pip install -r requirements.txt` OR `poetry install` OR `uv sync`
260
-
261
- #### Go
262
- ```bash
263
- cat go.mod | head -5
264
- ```
265
- → Commands: `go build`, `go test ./...`, `go run .`
266
-
267
- #### Rust
268
- ```bash
269
- cat Cargo.toml | head -10
270
- ```
271
- → Commands: `cargo build`, `cargo test`, `cargo run`
272
-
273
- #### Node.js/JavaScript
274
- ```bash
275
- # Check lockfile to determine package manager
276
- test -f bun.lockb && echo "bun"
277
- test -f pnpm-lock.yaml && echo "pnpm"
278
- test -f yarn.lock && echo "yarn"
279
- test -f package-lock.json && echo "npm"
280
- cat package.json | grep -A 20 '"scripts"'
281
- ```
282
- → Commands: Use detected package manager + scripts from package.json
283
-
284
- **EXTRACT the actual commands:**
285
- - `{installCommand}` = what installs dependencies
286
- - `{runCommand}` = how to run scripts
287
- - `{testCommand}` = how to run tests
288
- - `{buildCommand}` = how to build
289
- - `{devCommand}` = how to run dev server
290
-
291
- ### 3.5.3 Detect Code Conventions (AGENTIC)
292
-
293
- **LOOK at actual files to understand patterns:**
294
-
295
- ```bash
296
- # List some source files
297
- find . -type f \( -name "*.rb" -o -name "*.py" -o -name "*.go" -o -name "*.rs" -o -name "*.ts" -o -name "*.js" \) -not -path "*/node_modules/*" -not -path "*/.git/*" | head -10
298
-
299
- # Check for linters/formatters
300
- ls .rubocop.yml .eslintrc* .prettierrc* pyproject.toml rustfmt.toml .golangci.yml 2>/dev/null
301
- ```
302
-
303
- ANALYZE and DETERMINE:
304
- - `{namingConvention}` = based on actual file names
305
- - `{linter}` = what linter is configured
306
- - `{formatter}` = what formatter is used
307
-
308
- ### 3.5.4 Detect Project Structure (AGENTIC)
309
-
310
- ```bash
311
- ls -d */ 2>/dev/null | head -10
312
- ```
313
-
314
- UNDERSTAND the structure:
315
- - Where is source code?
316
- - Where are tests?
317
- - Is it a monorepo?
318
- - What's the architecture?
319
-
320
- ### 3.5.5 Generate Project-Specific Rules (AGENTIC)
321
-
322
- **Based on YOUR ANALYSIS, generate rules that make sense for THIS project.**
323
-
324
- Think: "What does a developer working on this project need to know?"
325
-
326
- Examples:
327
- - Rails project: "Use `bundle exec` for Ruby commands", "Migrations: `rails db:migrate`"
328
- - Python/Poetry: "Use `poetry run` to run commands in venv"
329
- - Go project: "Use `go test ./...` to run all tests"
330
- - Rust project: "Use `cargo fmt` before commits"
331
- - Node/bun: "Use `bun` not npm - this project has bun.lockb"
332
-
333
- ### 3.5.6 Write analysis/repo-analysis.json
334
-
335
- ```bash
336
- mkdir -p {globalPath}/analysis
337
- ```
338
-
339
- WRITE: `{globalPath}/analysis/repo-analysis.json`
340
-
341
- ```json
342
- {
343
- "analyzedAt": "{timestamp}",
344
- "ecosystem": "{ecosystem}",
345
- "projectType": "{projectType}",
346
- "commands": {
347
- "install": "{installCommand}",
348
- "run": "{runCommand}",
349
- "test": "{testCommand}",
350
- "build": "{buildCommand}",
351
- "dev": "{devCommand}",
352
- "lint": "{lintCommand}",
353
- "format": "{formatCommand}"
354
- },
355
- "conventions": {
356
- "naming": "{namingConvention}",
357
- "linter": "{linter}",
358
- "formatter": "{formatter}"
359
- },
360
- "structure": {
361
- "srcDir": "{srcDir}",
362
- "testDir": "{testDir}",
363
- "isMonorepo": {isMonorepo}
364
- },
365
- "rules": [
366
- "{rule1 - generated based on analysis}",
367
- "{rule2 - generated based on analysis}",
368
- "..."
369
- ]
370
- }
371
- ```
372
-
373
- ---
374
-
375
- ## Step 3.5.7: Update Enterprise State (CRITICAL for Multi-Session)
376
-
377
- **CRITICAL**: This step updates state.json with enterprise fields for multi-session continuity.
378
-
379
- ### 3.5.7.1 Read Existing State
380
-
381
- ```
382
- READ: {globalPath}/storage/state.json
383
-
384
- IF file not found:
385
- CREATE default state:
386
- {
387
- "projectId": "{projectId}",
388
- "currentTask": null,
389
- "queue": [],
390
- "shipped": []
391
- }
392
- ```
393
-
394
- ### 3.5.7.2 Update Stack Info
395
-
396
- ```
397
- SET: state.stack = {
398
- "language": "{detected language - e.g., TypeScript, Python, Go}",
399
- "runtime": "{runtime - e.g., Node.js, Python 3.11, Go 1.21}",
400
- "framework": "{primary framework - e.g., React, Django, Gin}",
401
- "stateManagement": "{if detected - e.g., Zustand, Redux, None}",
402
- "database": "{if detected - e.g., PostgreSQL, MongoDB}",
403
- "styling": "{if detected - e.g., Tailwind, CSS Modules}",
404
- "testRunner": "{test framework - e.g., Vitest, Pytest, go test}"
405
- }
406
- ```
407
-
408
- ### 3.5.7.3 Determine Project Type
409
-
410
- ```
411
- # Count domains detected
412
- SET: domainCount = count of detected domains (frontend, backend, database, etc.)
413
-
414
- # Determine project type
415
- IF fileCount > 300 OR domainCount >= 4:
416
- SET: state.projectType = "enterprise"
417
- ELSE IF domainCount >= 2 OR fileCount > 50:
418
- SET: state.projectType = "complex"
419
- ELSE:
420
- SET: state.projectType = "simple"
421
- ```
422
-
423
- ### 3.5.7.4 Initialize Domains (Enterprise Projects)
424
-
425
- IF state.projectType == "enterprise" OR state.projectType == "complex":
426
-
427
- ```
428
- # Detect and initialize domain progress
429
- SET: state.domains = {}
430
-
431
- FOR EACH domain in {detectedDomains}:
432
- # Count files in domain area
433
- COUNT files matching domain patterns
434
-
435
- SET: state.domains[domain] = {
436
- "status": "pending",
437
- "progress": 0,
438
- "tests": "none",
439
- "keyFiles": ["{detected key files for domain}"],
440
- "dependencies": []
441
- }
442
- ```
443
-
444
- ### 3.5.7.5 Update Metrics
445
-
446
- ```
447
- SET: state.metrics = {
448
- "totalFiles": {fileCount},
449
- "totalLOC": {locCount if available},
450
- "testCoverage": null,
451
- "lastBuild": "unknown"
452
- }
453
- ```
454
-
455
- ### 3.5.7.6 Update Session Context
456
-
457
- ```
458
- SET: state.lastSync = {timestamp}
459
- SET: state.lastUpdated = {timestamp}
460
-
461
- IF state.context does not exist:
462
- SET: state.context = {}
463
-
464
- SET: state.context.lastSession = {timestamp}
465
- SET: state.context.lastAction = "Synced project"
466
- SET: state.context.nextAction = "Run `p. task \"description\"` to start working"
467
- ```
468
-
469
- ### 3.5.7.7 Write Updated State
470
-
471
- ```
472
- WRITE: {globalPath}/storage/state.json
473
- OUTPUT: "📊 Updated state.json with enterprise fields"
474
- ```
475
-
476
- ---
477
-
478
- ## Step 3.6: Generate/Update Roadmap (For Existing Projects)
479
-
480
- **CRITICAL**: This step populates the roadmap from git history for existing projects.
481
- Features detected from git are marked as `legacy: true` - they do NOT require PRDs.
482
-
483
- ### 3.6.1 Check if Roadmap Exists
484
-
485
- READ: `{globalPath}/storage/roadmap.json`
486
-
487
- ```
488
- IF roadmap.json does NOT exist:
489
- SET: {isNewRoadmap} = true
490
- SET: {existingFeatures} = []
491
- ELSE:
492
- SET: {isNewRoadmap} = false
493
- SET: {existingFeatures} = roadmap.features
494
- ```
495
-
496
- IF roadmap already has features AND was NOT generated from git:
497
- SKIP to Step 4 (don't overwrite manual roadmap)
498
-
499
- ### 3.6.2 Analyze Git History for Features
500
-
501
- ```bash
502
- # Get all commits with conventional commit format (last 200)
503
- git log --oneline --all --pretty=format:"%h|%s|%ad|%an" --date=short | head -200
504
- ```
505
-
506
- PARSE commits and GROUP by conventional commit type:
507
-
508
- | Prefix | Type | Maps To |
509
- |--------|------|---------|
510
- | `feat:` | Feature | New feature |
511
- | `fix:` | Bug Fix | Bug fix (not a feature) |
512
- | `refactor:` | Refactor | Code change (not a feature) |
513
- | `chore:` | Chore | Maintenance (not a feature) |
514
- | `docs:` | Docs | Documentation (not a feature) |
515
- | `perf:` | Performance | Enhancement |
516
- | `test:` | Test | Testing (not a feature) |
517
-
518
- **Feature Grouping Logic:**
519
-
520
- ```
521
- FOR EACH commit with "feat:" prefix:
522
- EXTRACT: feature name from commit message
523
- # e.g., "feat: add user authentication" → "user authentication"
524
- # e.g., "feat(api): implement rate limiting" → "api rate limiting"
525
-
526
- GROUP commits by similar feature names
527
- COUNT commits per feature group
528
- SUM lines changed per group: git show --stat {commit} | tail -1
529
- ```
530
-
531
- SET: `{detectedFeatures}` = grouped features with:
532
- - name
533
- - commits (array of {hash, message, date})
534
- - totalCommits
535
- - linesAdded
536
- - linesRemoved
537
- - firstCommitDate
538
- - lastCommitDate
539
-
540
- ### 3.6.3 Analyze Feature Branches
541
-
542
- ```bash
543
- git branch -a --format='%(refname:short)|%(upstream:short)|%(committerdate:short)' 2>/dev/null
544
- ```
545
-
546
- FOR EACH branch:
547
- IF branch name matches `feature/*` or `feat/*`:
548
- COUNT commits ahead of main:
549
- ```bash
550
- git rev-list --count main..{branch} 2>/dev/null || echo "0"
551
- ```
552
-
553
- ADD to `{activeBranches}`:
554
- - name: branch name
555
- - commitsAhead: count
556
- - lastCommit: date
557
-
558
- ### 3.6.4 Analyze Tags (Shipped Versions)
559
-
560
- ```bash
561
- git tag --sort=-creatordate --format='%(refname:short)|%(creatordate:short)' 2>/dev/null | head -20
562
- ```
563
-
564
- FOR EACH tag:
565
- EXTRACT version from tag name
566
- LINK to features completed before tag date
567
- ADD to `{versionTags}` array
568
-
569
- ### 3.6.5 Generate Initial Roadmap
570
-
571
- IF {isNewRoadmap} OR roadmap was generated from git:
572
-
573
- GENERATE UUIDs:
574
- ```bash
575
- # For each feature
576
- bun -e "console.log('feat_' + crypto.randomUUID().slice(0,8))" 2>/dev/null || node -e "console.log('feat_' + require('crypto').randomUUID().slice(0,8))"
577
- ```
578
-
579
- WRITE: `{globalPath}/storage/roadmap.json`
580
-
581
- ```json
582
- {
583
- "strategy": null,
584
- "features": [
585
- // COMPLETED FEATURES (from git history)
586
- {
587
- "id": "feat_{uuid8}",
588
- "name": "{detected feature name}",
589
- "description": "Inferred from git history",
590
- "date": "{firstCommitDate}",
591
- "status": "completed",
592
- "impact": "medium",
593
- "progress": 100,
594
- "tasks": [],
595
- "createdAt": "{firstCommitDate}",
596
- "completedDate": "{lastCommitDate}",
597
-
598
- // LEGACY MARKERS
599
- "legacy": true,
600
- "prdId": null,
601
- "inferredFrom": "git",
602
-
603
- // GIT DATA
604
- "commits": [
605
- {"hash": "{hash}", "message": "{message}", "date": "{date}"}
606
- ],
607
- "effort": {
608
- "estimated": null,
609
- "actual": {
610
- "commits": {totalCommits},
611
- "linesAdded": {linesAdded},
612
- "linesRemoved": {linesRemoved}
613
- }
614
- }
615
- },
616
-
617
- // ACTIVE FEATURES (from branches)
618
- {
619
- "id": "feat_{uuid8}",
620
- "name": "{branch name without prefix}",
621
- "description": "Work in progress",
622
- "date": "{today}",
623
- "status": "active",
624
- "impact": "medium",
625
- "progress": 0,
626
- "tasks": [],
627
- "createdAt": "{today}",
628
-
629
- // LEGACY MARKERS
630
- "legacy": true,
631
- "prdId": null,
632
- "inferredFrom": "git-branch",
633
-
634
- // BRANCH DATA
635
- "branch": "{branch name}",
636
- "commitsAhead": {count}
637
- }
638
- ],
639
- "backlog": [],
640
- "quarters": [],
641
- "lastUpdated": "{timestamp}",
642
- "generatedFrom": "git-history",
643
- "generatedAt": "{timestamp}"
644
- }
645
- ```
646
-
647
- ### 3.6.6 Initialize PRDs Storage
648
-
649
- IF `{globalPath}/storage/prds.json` does NOT exist:
650
- CREATE empty prds.json:
651
- ```json
652
- {
653
- "prds": [],
654
- "lastUpdated": "{timestamp}"
655
- }
656
- ```
657
-
658
- ### 3.6.7 Output
659
-
660
- ```
661
- 📊 Roadmap {isNewRoadmap ? "Generated" : "Updated"} from Git History
662
-
663
- Detected Features:
664
- ├── Completed: {completedFeatures.length} features
665
- {FOR EACH completedFeature (max 5)}
666
- │ └── {name} ({totalCommits} commits)
667
- {END FOR}
668
- ├── Active: {activeBranches.length} in progress
669
- {FOR EACH activeBranch}
670
- │ └── {name} ({commitsAhead} commits ahead)
671
- {END FOR}
672
- └── Legacy Mode: PRDs not required for existing work
673
-
674
- Going forward, use `p. prd <title>` before starting new features.
675
- ```
676
-
677
- SET: `{roadmapGenerated}` = true
678
- SET: `{completedCount}` = completed features count
679
- SET: `{activeCount}` = active branches count
680
-
681
- ---
682
-
683
- ## Step 4: Regenerate ALL Context Files
684
-
685
- ### 4.1 Read Storage (Source of Truth)
686
-
687
- READ: `{globalPath}/storage/state.json`
688
- READ: `{globalPath}/storage/queue.json`
689
- READ: `{globalPath}/storage/ideas.json`
690
- READ: `{globalPath}/storage/shipped.json`
691
-
692
- ### 4.2 Generate context/now.md
693
-
694
- WRITE: `{globalPath}/context/now.md`
695
-
696
- IF state.currentTask exists:
697
- ```markdown
698
- # NOW
699
-
700
- **{state.currentTask.description}**
701
-
702
- Started: {state.currentTask.startedAt}
703
- Session: {state.currentTask.sessionId}
704
- {IF estimate: Estimate: {state.currentTask.estimate}}
705
- ```
706
-
707
- ELSE IF state.pausedTask exists:
708
- ```markdown
709
- # NOW
710
-
711
- ⏸️ **{state.pausedTask.description}** (paused)
712
-
713
- Paused: {state.pausedTask.pausedAt}
714
- Reason: {state.pausedTask.pauseReason}
715
- ```
716
-
717
- ELSE:
718
- ```markdown
719
- # NOW
720
-
721
- _No active task_
722
-
723
- Use `/p:now <task>` to start working.
724
- ```
725
-
726
- ### 4.3 Generate context/next.md
727
-
728
- WRITE: `{globalPath}/context/next.md`
729
-
730
- ```markdown
731
- # NEXT
732
-
733
- ## Active
734
-
735
- {FOR EACH task in queue.tasks WHERE section == "active":}
736
- - [ ] {task.description} {task.priority ? `[${task.priority}]` : ''}
737
- {END FOR}
738
-
739
- ## Backlog
740
-
741
- {FOR EACH task in queue.tasks WHERE section == "backlog":}
742
- - [ ] {task.description}
743
- {END FOR}
744
- ```
745
-
746
- ### 4.4 Generate context/ideas.md
747
-
748
- WRITE: `{globalPath}/context/ideas.md`
749
-
750
- ```markdown
751
- # IDEAS
752
-
753
- ## Pending
754
-
755
- {FOR EACH idea in ideas.ideas WHERE status == "pending":}
756
- - **{idea.text}** {idea.tags.join(' ')}
757
- - Priority: {idea.priority}
758
- - Added: {idea.createdAt}
759
- {END FOR}
760
-
761
- ## Converted
762
-
763
- {FOR EACH idea in ideas.ideas WHERE status == "converted":}
764
- - ~~{idea.text}~~ → Feature
765
- {END FOR}
766
- ```
767
-
768
- ### 4.5 Generate context/shipped.md
769
-
770
- WRITE: `{globalPath}/context/shipped.md`
771
-
772
- ```markdown
773
- # SHIPPED 🚀
774
-
775
- ## {Current Month Year}
776
-
777
- {FOR EACH ship in shipped.shipped WHERE month matches:}
778
- - **{ship.name}** v{ship.version} - {formatDate(ship.shippedAt)}
779
- {END FOR}
780
-
781
- ---
782
-
783
- **Total shipped:** {shipped.shipped.length}
784
- ```
785
-
786
- ---
787
-
788
- ## Step 5: Update context/CLAUDE.md (CRITICAL - AGENTIC)
789
-
790
- **ALWAYS OVERWRITE** this file on every sync.
791
-
792
- READ: `{globalPath}/analysis/repo-analysis.json` to get the analysis you just did.
793
-
794
- WRITE: `{globalPath}/context/CLAUDE.md`
795
-
796
- **Generate this file BASED ON YOUR ANALYSIS. The content below is a TEMPLATE - adapt it to what you found.**
797
-
798
- ```markdown
799
- # {projectName} - Project Rules
800
- <!-- projectId: {projectId} -->
801
- <!-- Generated: {GetTimestamp()} -->
802
- <!-- Ecosystem: {ecosystem} | Type: {projectType} -->
803
-
804
- ## THIS PROJECT ({ecosystem})
805
-
806
- **Type:** {projectType}
807
- **Path:** {cwd}
808
-
809
- ### Commands (USE THESE, NOT OTHERS)
810
-
811
- | Action | Command |
812
- |--------|---------|
813
- | Install dependencies | \`{installCommand}\` |
814
- | Run dev server | \`{devCommand}\` |
815
- | Run tests | \`{testCommand}\` |
816
- | Build | \`{buildCommand}\` |
817
- | Lint | \`{lintCommand}\` |
818
- | Format | \`{formatCommand}\` |
819
-
820
- ### Project-Specific Rules
821
-
822
- {FOR EACH rule in analysis.rules}
823
- - {rule}
824
- {END FOR}
825
-
826
- ### Code Conventions
827
-
828
- - **Naming**: {namingConvention}
829
- - **Linter**: {linter}
830
- - **Formatter**: {formatter}
831
- {IF isMonorepo}
832
- - **Monorepo**: Check which package you're in before running commands
833
- {ENDIF}
834
-
835
- ---
836
-
837
- ## DO vs DON'T (FOR THIS PROJECT)
838
-
839
- | DO | DON'T |
840
- |----|-------|
841
- | \`{installCommand}\` | Wrong install command for this ecosystem |
842
- | \`{testCommand}\` | Wrong test command |
843
- | Read files before editing | Assume contents |
844
- | Use Task(Explore) to understand | Jump to conclusions |
845
- | Ask when uncertain | Make assumptions |
846
-
847
- ---
848
-
849
- ## PRJCT RULES
850
-
851
- ### Path Resolution
852
- **ALL prjct writes go to**: \`~/.prjct-cli/projects/{projectId}/\`
853
- - NEVER write to \`.prjct/\`
854
- - NEVER write to \`./\` for prjct data
855
-
856
- ### Workflow
857
- \`\`\`
858
- p. sync → p. task "desc" → [work] → p. done → p. ship
859
- \`\`\`
860
-
861
- | Command | Action |
862
- |---------|--------|
863
- | \`p. sync\` | Re-analyze project |
864
- | \`p. task X\` | Start task |
865
- | \`p. done\` | Complete subtask |
866
- | \`p. ship X\` | Ship feature |
867
-
868
- ---
869
-
870
- ## PROJECT STATE
871
-
872
- | Field | Value |
873
- |-------|-------|
874
- | Name | {projectName} |
875
- | Version | {version} |
876
- | Ecosystem | {ecosystem} |
877
- | Branch | {currentBranch} |
878
- | Files | {fileCount} |
879
-
880
- **Current Task:** {currentTask.description || "_None_"}
881
- **Queue:** {queue.tasks.length} tasks
882
-
883
- ---
884
-
885
- ## AGENTS
886
-
887
- Load from \`{globalPath}/agents/\`:
888
- {FOR EACH agent in generatedAgents}
889
- - \`{agent}.md\`
890
- {END FOR}
891
-
892
- ---
893
-
894
- ## STRUCTURE
895
-
896
- \`\`\`
897
- {srcDir}/ # Source code
898
- {testDir}/ # Tests
899
- {globalPath}/
900
- ├── storage/ # prjct state
901
- ├── context/ # This file
902
- ├── agents/ # Domain experts
903
- └── analysis/ # repo-analysis.json
904
- \`\`\`
905
- ```
906
-
907
- ---
908
-
909
- ## Step 6: Update project.json (CRITICAL: cliVersion)
910
-
911
- READ existing: `{globalPath}/project.json` (preserve createdAt, integrations)
912
-
913
- GET CLI version (REQUIRED - this clears the status line warning):
914
- ```bash
915
- bun -e "console.log(require('./package.json').version)" 2>/dev/null || node -e "console.log(require('./package.json').version)"
916
- ```
917
- SET: `{cliVersion}` = result (e.g., "0.25.1")
918
-
919
- CHECK: `{previousCliVersion}` = existing.cliVersion (if any)
920
- SET: `{isVersionUpgrade}` = previousCliVersion != cliVersion OR previousCliVersion is missing
921
-
922
- **CRITICAL**: The `cliVersion` field MUST be written to project.json. This field:
923
- - Clears the "⚠️ prjct v{version} available!" status line warning
924
- - Indicates which CLI version last synced this project
925
- - If missing, the warning will persist even after sync
926
-
927
- WRITE: `{globalPath}/project.json` (merge with existing, but ALWAYS update these fields):
928
-
929
- ```json
930
- {
931
- "projectId": "{projectId}",
932
- "repoPath": "{cwd}",
933
- "name": "{projectName}",
934
- "version": "{version}",
935
- "cliVersion": "{cliVersion}", // ← REQUIRED: Must match CLI version to clear warning
936
- "techStack": {techStack},
937
- "fileCount": {fileCount},
938
- "commitCount": {commitCount},
939
- "stack": "{stack}",
940
- "currentBranch": "{currentBranch}",
941
- "hasUncommittedChanges": {hasUncommittedChanges},
942
- "createdAt": "{existingCreatedAt || GetTimestamp()}",
943
- "lastSync": "{GetTimestamp()}",
944
- "integrations": "{existing.integrations || {}}" // ← Preserve integrations
945
- }
946
- ```
947
-
948
- ### Step 6.1: Update Statusline Script (If Version Upgrade)
949
-
950
- IF `{isVersionUpgrade}` == true:
951
-
952
- CHECK: Does `~/.prjct-cli/statusline/statusline.sh` exist?
953
- (Also check `~/.claude/prjct-statusline.sh` as fallback - follow symlink if applicable)
954
-
955
- IF file exists:
956
- READ the statusline script content
957
-
958
- IF content contains `CLI_VERSION=`:
959
- EXTRACT current version from script (regex: `/CLI_VERSION="([^"]*)"/`)
960
-
961
- IF extracted version != `{cliVersion}`:
962
- UPDATE the CLI_VERSION line in the script:
963
- ```javascript
964
- const content = fs.readFileSync(statusLinePath, 'utf8')
965
- const updated = content.replace(/CLI_VERSION="[^"]*"/, `CLI_VERSION="${cliVersion}"`)
966
- fs.writeFileSync(statusLinePath, updated, { mode: 0o755 })
967
- ```
968
- OUTPUT: "✓ Statusline updated to v{cliVersion}"
969
- ELSE:
970
- // Already at correct version, no action needed
971
-
972
- ELSE:
973
- // Script exists but NO CLI_VERSION - old version without version check
974
- // Replace with new script from assets (has version check logic)
975
- OUTPUT: "⚠️ Statusline missing version check. Run `prjct setup` to update."
976
-
977
- ELSE:
978
- // No statusline script exists - sync doesn't create it
979
- OUTPUT: "💡 Run `prjct setup` to install statusline"
980
-
981
- ---
982
-
983
- ## Step 7: Generate Claude Code Sub-Agents (AGENTIC)
984
-
985
- Generate sub-agents for Claude Code in the GLOBAL storage `{globalPath}/agents/` directory.
986
-
987
- ### 7.0 PURGE Legacy Agents (CRITICAL)
988
-
989
- **ALWAYS purge all existing agents to ensure no legacy remains.**
990
-
991
- ```bash
992
- rm -rf {globalPath}/agents/*
993
- ```
994
-
995
- OUTPUT: "🗑️ Purged legacy agents"
996
-
997
- This ensures:
998
- - Old agent formats are removed
999
- - New agent templates are used
1000
- - No outdated instructions remain
1001
-
1002
- ### 7.1 Create Directory
1003
-
1004
- ```bash
1005
- mkdir -p {globalPath}/agents
1006
- ```
1007
-
1008
- ### 7.2 Read Generation Instructions
1009
-
1010
- READ: `templates/agentic/subagent-generation.md`
1011
-
1012
- This template contains:
1013
- - Which workflow agents to ALWAYS generate
1014
- - Which domain agents to generate based on stack
1015
- - Format and structure requirements
1016
-
1017
- ### 7.3 Generate Workflow Agents (ALWAYS)
1018
-
1019
- These 3 agents are ALWAYS created for every prjct project:
1020
-
1021
- **prjct-workflow.md** - Handles: /p:now, /p:done, /p:next, /p:pause, /p:resume
1022
- READ template: `templates/subagents/workflow/prjct-workflow.md`
1023
- ADAPT with: projectId, projectPath
1024
- WRITE to: `{globalPath}/agents/prjct-workflow.md`
1025
-
1026
- **prjct-planner.md** - Handles: /p:feature, /p:idea, /p:spec, /p:bug
1027
- READ template: `templates/subagents/workflow/prjct-planner.md`
1028
- ADAPT with: projectId, projectPath
1029
- WRITE to: `{globalPath}/agents/prjct-planner.md`
1030
-
1031
- **prjct-shipper.md** - Handles: /p:ship
1032
- READ template: `templates/subagents/workflow/prjct-shipper.md`
1033
- ADAPT with: projectId, projectPath, detected test/lint commands
1034
- WRITE to: `{globalPath}/agents/prjct-shipper.md`
1035
-
1036
- ### 7.4 Generate Domain Agents (Based on Stack)
1037
-
1038
- Analyze `{techStack}` from Step 3 and generate ONLY relevant domain agents:
1039
-
1040
- | If Detected | Generate | Template |
1041
- |-------------|----------|----------|
1042
- | React, Vue, Angular, Svelte, CSS | `frontend.md` | `templates/subagents/domain/frontend.md` |
1043
- | Node.js, Express, Go, Python API | `backend.md` | `templates/subagents/domain/backend.md` |
1044
- | PostgreSQL, MySQL, MongoDB, Prisma | `database.md` | `templates/subagents/domain/database.md` |
1045
- | Docker, Kubernetes, GitHub Actions | `devops.md` | `templates/subagents/domain/devops.md` |
1046
- | Bun test, Jest, Pytest, testing | `testing.md` | `templates/subagents/domain/testing.md` |
1047
- | **{hasFrontendUI} = true** | `uxui.md` | `templates/agentic/agents/uxui.md` |
1048
-
1049
- For EACH detected stack:
1050
- 1. READ template from `templates/subagents/domain/{name}.md`
1051
- 2. ADAPT description with detected frameworks (e.g., "React specialist" not just "frontend")
1052
- 3. WRITE to `{globalPath}/agents/{name}.md`
1053
-
1054
- ### 7.5 Generate UX/UI Agent (CRITICAL for Frontend Projects)
1055
-
1056
- **Priority: UX > UI** - User experience is more important than visuals.
1057
-
1058
- IF `{hasFrontendUI}` == true:
1059
-
1060
- 1. READ template: `templates/agentic/agents/uxui.md`
1061
- 2. WRITE to: `{globalPath}/agents/uxui.md`
1062
- 3. ADD to `{domainAgents}`: "uxui"
1063
-
1064
- OUTPUT: "🎨 Generated UX/UI agent for {frontendType} ({frameworks detected})"
1065
-
1066
- The UX/UI agent ensures:
1067
- - **UX First**: Clarity, feedback, reduced friction, error handling, accessibility
1068
- - **Modern UI**: Distinctive typography, bold colors, purposeful animation
1069
- - **Anti-patterns avoided**: No "AI slop" (Inter font, purple gradients, generic layouts)
1070
- - **Checklists**: UX and UI quality gates before shipping
1071
-
1072
- ### 7.6 Report Generated Agents
1073
-
1074
- Track which agents were generated for output:
1075
- - `{workflowAgents}`: Always 3 (prjct-workflow, prjct-planner, prjct-shipper)
1076
- - `{domainAgents}`: List of domain agents generated
1077
-
1078
- ---
1079
-
1080
- ## Step 7.5: Install Agent Skills (agentskills.io)
1081
-
1082
- **CRITICAL: This step discovers and installs skills from the agentskills.io ecosystem.**
1083
-
1084
- Skills follow the Agent Skills standard (by Anthropic). Each skill is a directory with a `SKILL.md` file.
1085
-
1086
- ### 7.5.1 Check Existing Skills
1087
-
1088
- ```bash
1089
- ls -d ~/.claude/skills/*/ 2>/dev/null || echo "none"
1090
- ```
1091
-
1092
- SET: `{existingSkills}` = list of installed skill directories
1093
-
1094
- ### 7.5.2 Read Skill Mappings
1095
-
1096
- READ: `templates/config/skill-mappings.json`
1097
-
1098
- This file contains:
1099
- - Agent → Skill mappings
1100
- - Search terms for agentskills.io
1101
- - Anthropic official skills references
1102
-
1103
- ### 7.5.3 Search & Install Skills (AGENTIC)
1104
-
1105
- **For each generated agent, find and install matching skills from agentskills.io.**
1106
-
1107
- ```
1108
- FOR EACH agent IN {generatedAgents}:
1109
- GET: skillConfig = skill-mappings.json.agentToSkillMap[agent]
1110
-
1111
- IF skillConfig.fromAnthropic == true:
1112
- # PRIORITY 1: Check anthropics/skills repo
1113
- USE WebFetch:
1114
- url: "https://api.github.com/repos/anthropics/skills/contents/skills"
1115
- prompt: "List available skills. Find one matching: {skillConfig.searchTerms}"
1116
-
1117
- IF skill found:
1118
- # Download SKILL.md from anthropics/skills
1119
- USE WebFetch:
1120
- url: "https://raw.githubusercontent.com/anthropics/skills/main/skills/{skill}/SKILL.md"
1121
- prompt: "Get the complete SKILL.md content"
1122
-
1123
- SET: {skillContent} = result
1124
- SET: {skillSource} = "anthropics/skills"
1125
-
1126
- ELSE:
1127
- # PRIORITY 2: Search agentskills.io marketplace
1128
- USE WebFetch:
1129
- url: "https://agentskills.io/search?q={skillConfig.searchTerms[0]}"
1130
- prompt: "Find skills matching {agent}. Return: name, repo URL, description"
1131
-
1132
- IF results found:
1133
- SELECT best match based on:
1134
- - Relevance to agent domain
1135
- - Recent updates
1136
- - Good documentation
1137
-
1138
- # Download from matched repo
1139
- USE WebFetch:
1140
- url: "{result.repoUrl}/raw/main/SKILL.md"
1141
- prompt: "Get the SKILL.md content"
1142
-
1143
- SET: {skillContent} = result
1144
- SET: {skillSource} = "agentskills.io"
1145
-
1146
- IF {skillContent} exists:
1147
- # Install skill to ~/.claude/skills/{name}/
1148
- ```bash
1149
- mkdir -p ~/.claude/skills/{skill.name}
1150
- ```
1151
-
1152
- WRITE: `~/.claude/skills/{skill.name}/SKILL.md`
1153
- CONTENT: {skillContent}
1154
-
1155
- OUTPUT: "📦 Installed: {skill.name} (from {skillSource})"
1156
- ADD to {installedSkills}
1157
-
1158
- ELSE:
1159
- # FALLBACK: Create minimal custom skill
1160
- → Go to Step 7.5.4
1161
- ```
1162
-
1163
- ### 7.5.4 Create Custom Skill (Fallback)
1164
-
1165
- If no suitable skill found, CREATE a minimal skill following the agentskills.io spec:
1166
-
1167
- ```bash
1168
- mkdir -p ~/.claude/skills/{agent}-custom
1169
- ```
1170
-
1171
- WRITE: `~/.claude/skills/{agent}-custom/SKILL.md`
1172
-
1173
- ```markdown
1174
- ---
1175
- name: {agent}-custom
1176
- description: Custom skill for {agent} domain. Use when working on {domain description}.
1177
- ---
1178
-
1179
- # {Agent} Custom Skill
1180
-
1181
- This skill provides guidance for {agent} domain tasks.
1182
-
1183
- ## When to Use
1184
- - {Task type 1 this skill helps with}
1185
- - {Task type 2 this skill helps with}
1186
-
1187
- ## Guidelines
1188
- {Domain-specific guidelines based on project analysis}
1189
-
1190
- ## Patterns
1191
- {Common patterns detected in this project}
1192
- ```
1193
-
1194
- ADD to {createdSkills}
1195
-
1196
- ### 7.5.5 Install Document Skills (Optional)
1197
-
1198
- IF project creates documents (PDFs, presentations, spreadsheets):
1199
-
1200
- ```
1201
- CHECK package.json for: pdf-lib, docx, pptxgenjs, exceljs, etc.
1202
-
1203
- IF found:
1204
- INSTALL from anthropics/skills:
1205
- - pdf/ - PDF creation and editing
1206
- - docx/ - Word document creation
1207
- - pptx/ - PowerPoint presentations
1208
- - xlsx/ - Excel spreadsheets
1209
-
1210
- FOR EACH docSkill in [pdf, docx, pptx, xlsx]:
1211
- IF dependency detected:
1212
- USE WebFetch:
1213
- url: "https://raw.githubusercontent.com/anthropics/skills/main/skills/{docSkill}/SKILL.md"
1214
- prompt: "Get SKILL.md content"
1215
-
1216
- mkdir -p ~/.claude/skills/{docSkill}
1217
- WRITE: ~/.claude/skills/{docSkill}/SKILL.md
1218
- ```
1219
-
1220
- ### 7.5.6 Save Skills Configuration
1221
-
1222
- ```bash
1223
- mkdir -p {globalPath}/config
1224
- ```
1225
-
1226
- WRITE: `{globalPath}/config/skills.json`
1227
-
1228
- ```json
1229
- {
1230
- "projectId": "{projectId}",
1231
- "ecosystem": "{ecosystem}",
1232
- "syncedAt": "{GetTimestamp()}",
1233
- "skillsDirectory": "~/.claude/skills/",
1234
- "skills": [
1235
- {
1236
- "name": "{skill.name}",
1237
- "source": "{skillSource}",
1238
- "path": "~/.claude/skills/{skill.name}/SKILL.md",
1239
- "linkedAgents": ["{agent}"],
1240
- "installedAt": "{GetTimestamp()}"
1241
- }
1242
- ],
1243
- "agentSkillMap": {
1244
- "{agent}": "{skill.name}"
1245
- }
1246
- }
1247
- ```
1248
-
1249
- ### 7.5.7 Update Agent Frontmatter
1250
-
1251
- FOR EACH agent file in `{globalPath}/agents/`:
1252
- READ agent file
1253
- GET skill from agentSkillMap[agent.name]
1254
-
1255
- IF skill exists:
1256
- UPDATE frontmatter to include: `skills: [{skill}]`
1257
- WRITE updated agent file
1258
-
1259
- ### 7.5.8 Output Summary
1260
-
1261
- ```
1262
- OUTPUT:
1263
- 📦 Skills Installed (agentskills.io)
1264
- ├── From anthropics/skills: {anthropicSkills.length}
1265
- ├── From marketplace: {marketplaceSkills.length}
1266
- ├── Custom created: {createdSkills.length}
1267
- └── Location: ~/.claude/skills/
1268
-
1269
- 🔗 Agent → Skill Mapping:
1270
- {FOR EACH entry in agentSkillMap}
1271
- ├── {agent}.md → {skill}
1272
- {END FOR}
1273
- ```
1274
-
1275
- ---
1276
-
1277
- ## Step 8: Log to Memory
1278
-
1279
- APPEND to: `{globalPath}/memory/events.jsonl`
1280
-
1281
- ```json
1282
- {"ts":"{GetTimestamp()}","action":"sync","branch":"{currentBranch}","uncommitted":{hasUncommittedChanges},"fileCount":{fileCount},"commitCount":{commitCount}}
1283
- ```
1284
-
1285
- ---
1286
-
1287
- ## Step 9: Backend Sync (Cloud)
1288
-
1289
- Sync with prjct API if authenticated.
1290
-
1291
- ### 9.1 Check Authentication
1292
-
1293
- READ: `~/.prjct-cli/config/auth.json`
1294
-
1295
- IF no auth OR no apiKey:
1296
- SET: `{cloudSync}` = false
1297
- OUTPUT TIP: "💡 Run `prjct auth` to enable cloud sync"
1298
- CONTINUE to output (skip 9.2, 9.3)
1299
-
1300
- ELSE:
1301
- SET: `{cloudSync}` = true
1302
-
1303
- ### 9.2 Push Pending Events
1304
-
1305
- READ: `{globalPath}/sync/pending.json`
1306
- COUNT: `{pendingCount}` events
1307
-
1308
- IF pendingCount > 0:
1309
- CALL syncManager.push(projectId)
1310
-
1311
- IF success:
1312
- SET: `{pushedCount}` = result.count
1313
- OUTPUT: "☁️ Pushed {pushedCount} events to cloud"
1314
- ELSE:
1315
- OUTPUT: "⚠️ Cloud sync failed: {error}. Events queued for retry."
1316
- SET: `{syncError}` = error
1317
- ELSE:
1318
- SET: `{pushedCount}` = 0
1319
-
1320
- ### 9.3 Pull Updates (if push succeeded)
1321
-
1322
- IF cloudSync AND no syncError:
1323
- CALL syncManager.pull(projectId)
1324
-
1325
- IF success AND result.count > 0:
1326
- SET: `{pulledCount}` = result.count
1327
- OUTPUT: "📥 Pulled {pulledCount} updates from cloud"
1328
- ELSE:
1329
- SET: `{pulledCount}` = 0
1330
-
1331
- ---
1332
-
1333
- ## Output
1334
-
1335
- ```
1336
- 🔄 Project synced to prjct v{cliVersion}
1337
-
1338
- 📊 Project Stats
1339
- ├── Files: {fileCount}
1340
- ├── Commits: {commitCount}
1341
- ├── Version: {version}
1342
- └── Stack: {stack}
1343
-
1344
- 🌿 Git Status
1345
- ├── Branch: {currentBranch}
1346
- ├── Uncommitted: {hasUncommittedChanges ? "Yes - " + modifiedCount + " files" : "Clean"}
1347
- └── Recent: {recentCommitCount} commits this week
1348
-
1349
- 📁 Context Updated
1350
- ├── context/now.md
1351
- ├── context/next.md
1352
- ├── context/ideas.md
1353
- ├── context/shipped.md
1354
- └── context/CLAUDE.md
1355
-
1356
- 🤖 Agents Regenerated ({workflowAgents.length + domainAgents.length})
1357
- ├── Workflow: prjct-workflow, prjct-planner, prjct-shipper
1358
- ├── Domain: {domainAgents.join(', ') || 'none'}
1359
- {IF hasFrontendUI}
1360
- └── 🎨 UX/UI: uxui.md (Priority: UX > UI)
1361
- {ENDIF}
1362
-
1363
- 📦 Skills (agentskills.io)
1364
- ├── From anthropics/skills: {anthropicSkills.length}
1365
- ├── From marketplace: {marketplaceSkills.length}
1366
- ├── Custom: {createdSkills.length}
1367
- └── Location: ~/.claude/skills/
1368
-
1369
- 🔗 Agent → Skill Mapping
1370
- {FOR EACH entry in agentSkillMap}
1371
- ├── {entry.agent}.md → {entry.skill}/
1372
- {END FOR}
1373
-
1374
- {IF isVersionUpgrade}
1375
- ✨ New Features Available in v{cliVersion}:
1376
-
1377
- • /p:task - Unified task command with agentic classification
1378
- • Automatic type detection (feature, bug, improvement, refactor, chore)
1379
- • 7-phase development workflow for all task types
1380
- • Git branch management with type-based prefixes
1381
- • UX/UI design workflow for frontend tasks
1382
- • Design expert integration
1383
-
1384
- Note: /p:now and /p:feature are deprecated. Use /p:task instead.
1385
- {ENDIF}
1386
-
1387
- {IF cloudSync}
1388
- ☁️ Cloud Sync
1389
- ├── Pushed: {pushedCount} events
1390
- ├── Pulled: {pulledCount} updates
1391
- └── Status: {syncError ? "⚠️ " + syncError : "✓ Synced"}
1392
- {ELSE}
1393
- 💡 Cloud sync disabled. Run `prjct auth` to enable.
1394
- {ENDIF}
1395
-
1396
- {IF hasUncommittedChanges}
1397
- ⚠️ You have uncommitted changes
1398
-
1399
- Next: Commit your work or continue coding
1400
- {ELSE}
1401
- ✨ Repository is clean!
1402
-
1403
- Next: /p:task "your next task"
1404
- {ENDIF}
1405
- ```
1406
-
1407
- ---
1408
-
1409
- ## Error Handling
1410
-
1411
- | Error | Response | Action |
1412
- |-------|----------|--------|
1413
- | No config | "No prjct project" | STOP |
1414
- | Not a git repo | "Not a git repository" | WARN, continue without git |
1415
- | No commits | Use defaults | CONTINUE |
1416
- | File read error | Skip that file | CONTINUE |
1417
-
1418
- ---
1419
-
1420
- ## File Structure Reference
11
+ CLI handles: git analysis, context generation, agents, skills.
1421
12
 
13
+ **Output**:
1422
14
  ```
1423
- ~/.prjct-cli/projects/{projectId}/
1424
- ├── storage/ # Source of Truth (JSON)
1425
- │ ├── state.json # Current + paused task
1426
- │ ├── queue.json # Task queue
1427
- │ ├── ideas.json # Ideas list
1428
- │ └── shipped.json # Shipped features
1429
- ├── context/ # For Claude (MD)
1430
- │ ├── CLAUDE.md # Full context
1431
- │ ├── now.md # Current task
1432
- │ ├── next.md # Queue
1433
- │ ├── ideas.md # Ideas
1434
- │ └── shipped.md # Shipped
1435
- ├── config/ # Configuration (NEW)
1436
- │ └── skills.json # Agent-to-skill mappings
1437
- ├── sync/ # Backend Sync
1438
- │ └── pending.json # Events queue
1439
- ├── agents/ # Specialists
1440
- ├── memory/ # Audit Trail
1441
- │ └── events.jsonl
1442
- └── project.json # Metadata
15
+ ✅ Synced: {projectName}
1443
16
 
1444
- # Sub-Agents are in {globalPath}/agents/
1445
- ├── prjct-workflow.md # /p:task, /p:done, /p:pause, /p:resume
1446
- ├── prjct-planner.md # /p:plan, /p:prd, /p:spec
1447
- ├── prjct-shipper.md # /p:ship
1448
- ├── frontend.md # (if React/Vue/Angular detected)
1449
- ├── backend.md # (if Node/Go/Python API detected)
1450
- ├── database.md # (if DB detected)
1451
- ├── devops.md # (if Docker/K8s detected)
1452
- ├── testing.md # (if test framework detected)
1453
- └── uxui.md # (if ANY frontend UI detected)
17
+ Ecosystem: {ecosystem}
18
+ Agents: {count} generated
1454
19
 
1455
- # Skills are in ~/.claude/skills/ (agentskills.io format)
1456
- ├── {skill-name}/
1457
- │ └── SKILL.md # Required: skill definition
1458
- │ └── scripts/ # Optional: helper scripts
1459
- │ └── references/ # Optional: documentation
20
+ Next:
21
+ - Start work → `p. task "description"`
22
+ - See queue `p. next`
1460
23
  ```