prjct-cli 0.25.2 → 0.28.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +233 -0
  2. package/CLAUDE.md +117 -110
  3. package/core/infrastructure/command-installer.ts +27 -0
  4. package/core/infrastructure/setup.ts +99 -0
  5. package/dist/bin/prjct.mjs +525 -267
  6. package/package.json +1 -1
  7. package/templates/agentic/agents/uxui.md +8 -0
  8. package/templates/agentic/skill-integration.md +311 -0
  9. package/templates/agentic/subagent-generation.md +28 -12
  10. package/templates/commands/bug.md +72 -17
  11. package/templates/commands/cleanup.md +74 -10
  12. package/templates/commands/done.md +158 -8
  13. package/templates/commands/git.md +21 -5
  14. package/templates/commands/merge.md +202 -0
  15. package/templates/commands/p.md +32 -0
  16. package/templates/commands/pause.md +40 -7
  17. package/templates/commands/resume.md +113 -33
  18. package/templates/commands/review.md +276 -0
  19. package/templates/commands/ship.md +193 -17
  20. package/templates/commands/sync.md +442 -47
  21. package/templates/commands/task.md +168 -542
  22. package/templates/commands/test.md +75 -3
  23. package/templates/commands/verify.md +204 -0
  24. package/templates/config/skill-mappings.json +87 -0
  25. package/templates/global/CLAUDE.md +38 -52
  26. package/templates/global/docs/commands.md +29 -31
  27. package/templates/hooks/prjct-session-start.sh +50 -0
  28. package/templates/skills/prjct-done/SKILL.md +97 -0
  29. package/templates/skills/prjct-ship/SKILL.md +150 -0
  30. package/templates/skills/prjct-sync/SKILL.md +108 -0
  31. package/templates/skills/prjct-task/SKILL.md +101 -0
  32. package/templates/subagents/domain/backend.md +1 -0
  33. package/templates/subagents/domain/devops.md +1 -0
  34. package/templates/subagents/domain/frontend.md +1 -0
  35. package/templates/subagents/domain/testing.md +1 -0
  36. package/templates/subagents/workflow/prjct-planner.md +1 -0
  37. package/templates/subagents/workflow/prjct-shipper.md +1 -0
@@ -205,6 +205,173 @@ EXTRACT: `{frontendType}` = "web" | "mobile" | "both" | null
205
205
 
206
206
  ---
207
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
+
208
375
  ## Step 4: Regenerate ALL Context Files
209
376
 
210
377
  ### 4.1 Read Storage (Source of Truth)
@@ -310,74 +477,122 @@ WRITE: `{globalPath}/context/shipped.md`
310
477
 
311
478
  ---
312
479
 
313
- ## Step 5: Update context/CLAUDE.md
480
+ ## Step 5: Update context/CLAUDE.md (CRITICAL - AGENTIC)
481
+
482
+ **ALWAYS OVERWRITE** this file on every sync.
483
+
484
+ READ: `{globalPath}/analysis/repo-analysis.json` to get the analysis you just did.
314
485
 
315
486
  WRITE: `{globalPath}/context/CLAUDE.md`
316
487
 
488
+ **Generate this file BASED ON YOUR ANALYSIS. The content below is a TEMPLATE - adapt it to what you found.**
489
+
317
490
  ```markdown
318
- # {projectName} - Project Context
491
+ # {projectName} - Project Rules
319
492
  <!-- projectId: {projectId} -->
320
493
  <!-- Generated: {GetTimestamp()} -->
494
+ <!-- Ecosystem: {ecosystem} | Type: {projectType} -->
321
495
 
322
- ## Quick Reference
496
+ ## THIS PROJECT ({ecosystem})
323
497
 
324
- | Field | Value |
325
- |-------|-------|
326
- | **Name** | {projectName} |
327
- | **Version** | {version} |
328
- | **Stack** | {stack} |
329
- | **Files** | {fileCount} |
330
- | **Commits** | {commitCount} |
331
- | **Branch** | {currentBranch} |
332
- | **Path** | {cwd} |
333
- | **Last Sync** | {GetTimestamp()} |
498
+ **Type:** {projectType}
499
+ **Path:** {cwd}
334
500
 
335
- ## Current Git Status
501
+ ### Commands (USE THESE, NOT OTHERS)
336
502
 
337
- **Branch**: `{currentBranch}`
338
- **Uncommitted Changes**: {hasUncommittedChanges ? "Yes" : "Clean"}
503
+ | Action | Command |
504
+ |--------|---------|
505
+ | Install dependencies | \`{installCommand}\` |
506
+ | Run dev server | \`{devCommand}\` |
507
+ | Run tests | \`{testCommand}\` |
508
+ | Build | \`{buildCommand}\` |
509
+ | Lint | \`{lintCommand}\` |
510
+ | Format | \`{formatCommand}\` |
339
511
 
340
- {IF hasUncommittedChanges}
341
- ### Modified Files
342
- {list of modified files}
512
+ ### Project-Specific Rules
513
+
514
+ {FOR EACH rule in analysis.rules}
515
+ - {rule}
516
+ {END FOR}
517
+
518
+ ### Code Conventions
519
+
520
+ - **Naming**: {namingConvention}
521
+ - **Linter**: {linter}
522
+ - **Formatter**: {formatter}
523
+ {IF isMonorepo}
524
+ - **Monorepo**: Check which package you're in before running commands
343
525
  {ENDIF}
344
526
 
345
- ## PROJECT DATA
527
+ ---
346
528
 
347
- ### Dependencies
348
- {list dependencies from package.json}
529
+ ## DO vs DON'T (FOR THIS PROJECT)
349
530
 
350
- ### Scripts
351
- {list scripts from package.json}
531
+ | DO | DON'T |
532
+ |----|-------|
533
+ | \`{installCommand}\` | Wrong install command for this ecosystem |
534
+ | \`{testCommand}\` | Wrong test command |
535
+ | Read files before editing | Assume contents |
536
+ | Use Task(Explore) to understand | Jump to conclusions |
537
+ | Ask when uncertain | Make assumptions |
352
538
 
353
- ## CURRENT STATE
539
+ ---
354
540
 
355
- **Now:** {currentTask or "_No active task_"}
541
+ ## PRJCT RULES
356
542
 
357
- **Queue ({queue.tasks.length}):**
358
- {list first 5 tasks}
543
+ ### Path Resolution
544
+ **ALL prjct writes go to**: \`~/.prjct-cli/projects/{projectId}/\`
545
+ - NEVER write to \`.prjct/\`
546
+ - NEVER write to \`./\` for prjct data
359
547
 
360
- **Ideas ({ideas.ideas.length}):**
361
- {list first 3 ideas}
548
+ ### Workflow
549
+ \`\`\`
550
+ p. sync → p. task "desc" → [work] → p. done → p. ship
551
+ \`\`\`
362
552
 
363
- ## DATA LOCATION
553
+ | Command | Action |
554
+ |---------|--------|
555
+ | \`p. sync\` | Re-analyze project |
556
+ | \`p. task X\` | Start task |
557
+ | \`p. done\` | Complete subtask |
558
+ | \`p. ship X\` | Ship feature |
559
+
560
+ ---
561
+
562
+ ## PROJECT STATE
563
+
564
+ | Field | Value |
565
+ |-------|-------|
566
+ | Name | {projectName} |
567
+ | Version | {version} |
568
+ | Ecosystem | {ecosystem} |
569
+ | Branch | {currentBranch} |
570
+ | Files | {fileCount} |
571
+
572
+ **Current Task:** {currentTask.description || "_None_"}
573
+ **Queue:** {queue.tasks.length} tasks
574
+
575
+ ---
576
+
577
+ ## AGENTS
578
+
579
+ Load from \`{globalPath}/agents/\`:
580
+ {FOR EACH agent in generatedAgents}
581
+ - \`{agent}.md\`
582
+ {END FOR}
583
+
584
+ ---
585
+
586
+ ## STRUCTURE
364
587
 
365
588
  \`\`\`
366
- ~/.prjct-cli/projects/{projectId}/
367
- ├── storage/ # JSON (source of truth)
368
- │ ├── state.json
369
- ├── queue.json
370
- ├── ideas.json
371
- │ └── shipped.json
372
- ├── context/ # MD (for Claude)
373
- │ ├── CLAUDE.md
374
- │ ├── now.md
375
- │ ├── next.md
376
- │ ├── ideas.md
377
- │ └── shipped.md
378
- ├── sync/ # Backend sync
379
- │ └── pending.json
380
- └── agents/ # Specialists
589
+ {srcDir}/ # Source code
590
+ {testDir}/ # Tests
591
+ {globalPath}/
592
+ ├── storage/ # prjct state
593
+ ├── context/ # This file
594
+ ├── agents/ # Domain experts
595
+ └── analysis/ # repo-analysis.json
381
596
  \`\`\`
382
597
  ```
383
598
 
@@ -521,6 +736,174 @@ Track which agents were generated for output:
521
736
 
522
737
  ---
523
738
 
739
+ ## Step 7.5: Install Claude Code Skills (AGENTIC)
740
+
741
+ **CRITICAL: This step is AGENTIC. Search claude-plugins.dev dynamically to find the best skills.**
742
+
743
+ Skills in Claude Code are markdown files in `~/.claude/skills/`. We search the marketplace and download the best matching skills for each agent.
744
+
745
+ ### 7.5.1 Check Existing Skills
746
+
747
+ ```bash
748
+ ls ~/.claude/skills/*.md 2>/dev/null || echo "none"
749
+ ```
750
+
751
+ SET: `{existingSkills}` = list of installed skill files
752
+
753
+ ### 7.5.2 Search & Install Skills (AGENTIC)
754
+
755
+ **For each generated agent, search claude-plugins.dev and install the best skill.**
756
+
757
+ ```
758
+ {skillsToFind} = [
759
+ { agent: "frontend", searchTerms: ["frontend-design", "react", "ui components"] },
760
+ { agent: "uxui", searchTerms: ["ux-designer", "frontend-design", "ui ux"] },
761
+ { agent: "backend", searchTerms: ["{ecosystem} backend", "api design", "backend patterns"] },
762
+ { agent: "testing", searchTerms: ["testing", "test automation", "{ecosystem} testing"] },
763
+ { agent: "devops", searchTerms: ["devops", "ci cd", "docker kubernetes"] },
764
+ { agent: "prjct-planner", searchTerms: ["feature development", "architecture", "planning"] },
765
+ { agent: "prjct-shipper", searchTerms: ["code review", "pr review", "shipping"] }
766
+ ]
767
+
768
+ FOR EACH entry in {skillsToFind}:
769
+ IF {entry.agent} IN {generatedAgents}:
770
+
771
+ # Step A: Search claude-plugins.dev
772
+ USE WebFetch:
773
+ url: "https://claude-plugins.dev/skills?q={entry.searchTerms[0]}"
774
+ prompt: "Find the best skill for {entry.agent}. Return: skill name, author, install URL"
775
+
776
+ SET: {searchResult} = result
777
+
778
+ # Step B: Analyze results and pick best match
779
+ ANALYZE {searchResult}:
780
+ - Prefer @anthropics skills (official)
781
+ - Prefer skills with high download count
782
+ - Match the agent's domain
783
+
784
+ SET: {bestSkill} = selected skill
785
+
786
+ # Step C: Check if already installed
787
+ IF {bestSkill.name}.md NOT IN {existingSkills}:
788
+
789
+ # Step D: Get skill content from GitHub
790
+ USE WebFetch:
791
+ url: "{bestSkill.githubUrl}/raw/main/skills/{bestSkill.name}.md"
792
+ prompt: "Get the complete skill markdown content"
793
+
794
+ SET: {skillContent} = result
795
+
796
+ # Step E: Install to ~/.claude/skills/
797
+ ```bash
798
+ mkdir -p ~/.claude/skills
799
+ ```
800
+
801
+ WRITE: `~/.claude/skills/{bestSkill.name}.md`
802
+ CONTENT: {skillContent}
803
+
804
+ OUTPUT: "📦 Installed skill: {bestSkill.name} (from {bestSkill.author})"
805
+ ADD {bestSkill} to {installedSkills}
806
+
807
+ ELSE:
808
+ OUTPUT: "✓ Skill exists: {bestSkill.name}"
809
+ ADD {bestSkill.name} to {verifiedSkills}
810
+ ```
811
+
812
+ ### 7.5.3 Skill Search Fallbacks
813
+
814
+ If WebFetch fails or no results found:
815
+
816
+ ```
817
+ FALLBACK SKILLS (use these if search fails):
818
+ - frontend/uxui → "frontend-design" from @anthropics/claude-code
819
+ - backend (JS/TS) → Search "typescript backend patterns"
820
+ - backend (Python) → Search "python backend patterns"
821
+ - testing → Search "testing automation"
822
+ - devops → Search "devops ci cd"
823
+ - planner → Search "architecture planning"
824
+ - shipper → Search "code review"
825
+ ```
826
+
827
+ ### 7.5.4 Create Custom Skill if Not Found
828
+
829
+ If no suitable skill found on marketplace, CREATE a minimal skill:
830
+
831
+ ```markdown
832
+ ---
833
+ name: {agent}-skill
834
+ description: Custom skill for {agent} agent
835
+ ---
836
+
837
+ # {Agent} Skill
838
+
839
+ This is a custom skill for the {agent} domain.
840
+
841
+ ## Expertise
842
+ {Based on agent's domain - frontend, backend, etc.}
843
+
844
+ ## Patterns
845
+ {Common patterns for this domain}
846
+ ```
847
+
848
+ WRITE to: `~/.claude/skills/{agent}-custom.md`
849
+
850
+ ### 7.5.5 Save Skills Configuration
851
+
852
+ ```bash
853
+ mkdir -p {globalPath}/config
854
+ ```
855
+
856
+ WRITE: `{globalPath}/config/skills.json`
857
+
858
+ ```json
859
+ {
860
+ "projectId": "{projectId}",
861
+ "ecosystem": "{ecosystem}",
862
+ "installedAt": "{GetTimestamp()}",
863
+ "searchedAt": "{GetTimestamp()}",
864
+ "skills": [
865
+ {
866
+ "name": "{skill.name}",
867
+ "source": "{skill.source}",
868
+ "author": "{skill.author}",
869
+ "path": "~/.claude/skills/{skill.name}.md",
870
+ "linkedAgents": ["{agents that use this skill}"]
871
+ }
872
+ ],
873
+ "agentSkillMap": {
874
+ "{agent}": "{skill.name}"
875
+ }
876
+ }
877
+ ```
878
+
879
+ ### 7.5.6 Update Agent Frontmatter
880
+
881
+ FOR EACH agent file in `{globalPath}/agents/`:
882
+ READ agent file
883
+ GET skill from agentSkillMap[agent.name]
884
+
885
+ IF skill exists AND frontmatter.skills is missing:
886
+ UPDATE frontmatter to include: `skills: [{skill}]`
887
+ WRITE updated agent file
888
+
889
+ ### 7.5.7 Output Summary
890
+
891
+ ```
892
+ SET: {skillsInstalled} = list of newly installed
893
+ SET: {skillsVerified} = list of already existing
894
+ SET: {skillsCreated} = list of custom-created
895
+ SET: {totalSkills} = count of all
896
+
897
+ OUTPUT:
898
+ 📦 Skills Synchronized
899
+ ├── Installed: {skillsInstalled.length} new from marketplace
900
+ ├── Verified: {skillsVerified.length} already exist
901
+ ├── Created: {skillsCreated.length} custom skills
902
+ └── Location: ~/.claude/skills/
903
+ ```
904
+
905
+ ---
906
+
524
907
  ## Step 8: Log to Memory
525
908
 
526
909
  APPEND to: `{globalPath}/memory/events.jsonl`
@@ -607,6 +990,16 @@ IF cloudSync AND no syncError:
607
990
  └── 🎨 UX/UI: uxui.md (Priority: UX > UI)
608
991
  {ENDIF}
609
992
 
993
+ 📦 Skills ({totalSkills})
994
+ ├── Installed: {skillsInstalled.length ? skillsInstalled.join(', ') : 'none'}
995
+ ├── Verified: {skillsVerified.length ? skillsVerified.join(', ') : 'none'}
996
+ └── Config: {globalPath}/config/skills.json
997
+
998
+ 🔗 Agent → Skill Mapping
999
+ {FOR EACH entry in agentSkillMap WHERE entry.skill != null}
1000
+ ├── {entry.agent}.md → /{entry.skill}
1001
+ {END FOR}
1002
+
610
1003
  {IF isVersionUpgrade}
611
1004
  ✨ New Features Available in v{cliVersion}:
612
1005
 
@@ -668,9 +1061,11 @@ Next: /p:task "your next task"
668
1061
  │ ├── next.md # Queue
669
1062
  │ ├── ideas.md # Ideas
670
1063
  │ └── shipped.md # Shipped
1064
+ ├── config/ # Configuration (NEW)
1065
+ │ └── skills.json # Agent-to-skill mappings
671
1066
  ├── sync/ # Backend Sync
672
1067
  │ └── pending.json # Events queue
673
- ├── agents/ # Specialists (legacy)
1068
+ ├── agents/ # Specialists
674
1069
  ├── memory/ # Audit Trail
675
1070
  │ └── events.jsonl
676
1071
  └── project.json # Metadata