prjct-cli 0.37.0 → 0.39.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 (33) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/README.md +84 -37
  3. package/bin/prjct.ts +11 -1
  4. package/core/index.ts +53 -26
  5. package/core/infrastructure/ai-provider.ts +157 -1
  6. package/core/infrastructure/setup.ts +225 -7
  7. package/core/types/provider.ts +18 -1
  8. package/dist/bin/prjct.mjs +3607 -1050
  9. package/dist/core/infrastructure/command-installer.js +458 -47
  10. package/dist/core/infrastructure/setup.js +728 -211
  11. package/package.json +1 -1
  12. package/templates/antigravity/SKILL.md +39 -0
  13. package/templates/cursor/commands/bug.md +8 -0
  14. package/templates/cursor/commands/done.md +4 -0
  15. package/templates/cursor/commands/pause.md +6 -0
  16. package/templates/cursor/commands/resume.md +4 -0
  17. package/templates/cursor/commands/ship.md +8 -0
  18. package/templates/cursor/commands/sync.md +4 -0
  19. package/templates/cursor/commands/task.md +8 -0
  20. package/templates/cursor/router.mdc +6 -6
  21. package/templates/global/ANTIGRAVITY.md +256 -0
  22. package/templates/global/CLAUDE.md +30 -0
  23. package/templates/global/CURSOR.mdc +60 -25
  24. package/templates/global/GEMINI.md +30 -0
  25. package/templates/global/WINDSURF.md +268 -0
  26. package/templates/windsurf/router.md +28 -0
  27. package/templates/windsurf/workflows/bug.md +8 -0
  28. package/templates/windsurf/workflows/done.md +4 -0
  29. package/templates/windsurf/workflows/pause.md +4 -0
  30. package/templates/windsurf/workflows/resume.md +4 -0
  31. package/templates/windsurf/workflows/ship.md +8 -0
  32. package/templates/windsurf/workflows/sync.md +4 -0
  33. package/templates/windsurf/workflows/task.md +8 -0
@@ -0,0 +1,268 @@
1
+ ---
2
+ trigger: always_on
3
+ description: "prjct - Context layer for AI coding agents"
4
+ ---
5
+
6
+ <!-- prjct:start - DO NOT REMOVE THIS MARKER -->
7
+ # prjct-cli
8
+
9
+ **Context layer for AI agents** - Project context for your AI coding assistant.
10
+
11
+ ## HOW TO USE PRJCT (Read This First)
12
+
13
+ In Windsurf, use the `/workflow` syntax. Type `/` followed by the workflow name:
14
+
15
+ ```
16
+ /sync → Analyze project, generate agents
17
+ /task X → Start task with description X
18
+ /done → Complete current subtask
19
+ /ship → Ship feature with PR + version bump
20
+ /bug X → Report bug with description X
21
+ /pause → Pause current task
22
+ /resume → Resume paused task
23
+ ```
24
+
25
+ Each workflow loads templates from the prjct-cli npm package.
26
+
27
+ **Key Insight**: Templates are GUIDANCE, not scripts. Use your intelligence to adapt them to the situation.
28
+
29
+ ---
30
+
31
+ ## CRITICAL RULES
32
+
33
+ ### 0. PLAN BEFORE ACTION (NON-NEGOTIABLE)
34
+
35
+ **For ANY prjct task, you MUST create a plan and get user approval BEFORE executing.**
36
+
37
+ ```
38
+ EVERY prjct workflow (/task, /sync, /ship, etc.):
39
+ 1. STOP - Do not execute anything yet
40
+ 2. ANALYZE - Read relevant files, understand scope
41
+ 3. PLAN - Write a clear plan with:
42
+ - What will be done
43
+ - Files that will be modified
44
+ - Potential risks
45
+ 4. ASK - Present plan to user and wait for explicit approval
46
+ 5. EXECUTE - Only after user says "yes", "approved", "go ahead", etc.
47
+ ```
48
+
49
+ **NEVER:**
50
+ - Execute code changes without showing a plan first
51
+ - Assume approval - wait for explicit confirmation
52
+ - Skip the plan step for "simple" tasks
53
+
54
+ **ALWAYS:**
55
+ - Show the plan in a clear, readable format
56
+ - Wait for user response before proceeding
57
+ - If user asks questions, answer them before executing
58
+
59
+ This rule applies to ALL prjct operations. No exceptions.
60
+
61
+ ---
62
+
63
+ ### 1. Path Resolution (MOST IMPORTANT)
64
+ **ALL writes go to global storage**: `~/.prjct-cli/projects/{projectId}/`
65
+
66
+ - **NEVER** write to `.prjct/` (config only, read-only)
67
+ - **NEVER** write to `./` (current directory)
68
+ - **ALWAYS** resolve projectId first from `.prjct/prjct.config.json`
69
+
70
+ ### 2. Before Any Workflow
71
+ ```
72
+ 1. Read .prjct/prjct.config.json → get projectId
73
+ 2. Set globalPath = ~/.prjct-cli/projects/{projectId}
74
+ 3. Execute workflow using globalPath for all writes
75
+ 4. Log to {globalPath}/memory/events.jsonl
76
+ ```
77
+
78
+ ### 3. Loading Templates
79
+ ```bash
80
+ # Get npm global root
81
+ npm root -g
82
+ # → e.g., /opt/homebrew/lib/node_modules
83
+
84
+ # Read template
85
+ {npmRoot}/prjct-cli/templates/commands/{workflow}.md
86
+ ```
87
+
88
+ ### 4. Timestamps & UUIDs
89
+ ```bash
90
+ # Timestamp (NEVER hardcode)
91
+ node -e "console.log(new Date().toISOString())"
92
+
93
+ # UUID
94
+ node -e "console.log(require('crypto').randomUUID())"
95
+ ```
96
+
97
+ ### 5. Git Commit Footer (CRITICAL - ALWAYS INCLUDE)
98
+
99
+ **Every commit made with prjct MUST include this footer:**
100
+
101
+ ```
102
+ 🤖 Generated with [p/](https://www.prjct.app/)
103
+ Built with [Windsurf](https://www.windsurf.com/)
104
+
105
+ ```
106
+
107
+ **This is NON-NEGOTIABLE. The prjct signature must appear in ALL commits.**
108
+
109
+ ### 6. Storage Rules (CROSS-AGENT COMPATIBILITY)
110
+
111
+ **NEVER use temporary files** - Write directly to final destination:
112
+ - WRONG: Create `.tmp/file.json`, then `mv` to final path
113
+ - CORRECT: Write directly to `{globalPath}/storage/state.json`
114
+
115
+ **JSON formatting** - Always use consistent format:
116
+ - 2-space indentation
117
+ - No trailing commas
118
+ - Keys in logical order
119
+
120
+ **Timestamps**: Always ISO-8601 with milliseconds (`.000Z`)
121
+ **UUIDs**: Always v4 format (lowercase)
122
+
123
+ ---
124
+
125
+ ## CORE WORKFLOW
126
+
127
+ ```
128
+ /sync → /task "description" → [work] → /done → /ship
129
+ │ │ │ │
130
+ │ └─ Creates branch, breaks down │ │
131
+ │ task, starts tracking │ │
132
+ │ │ │
133
+ └─ Analyzes project, generates agents │ │
134
+ │ │
135
+ Completes subtask ───┘ │
136
+
137
+ Ships feature, PR ────┘
138
+ ```
139
+
140
+ ### Quick Reference
141
+
142
+ | Workflow | What It Does |
143
+ |----------|--------------|
144
+ | `/sync` | Analyze project, generate domain agents |
145
+ | `/task <desc>` | Start task with auto-classification |
146
+ | `/done` | Complete current subtask |
147
+ | `/ship [name]` | Ship feature with PR + version bump |
148
+ | `/pause` | Pause current task |
149
+ | `/resume` | Resume paused task |
150
+ | `/bug <desc>` | Report bug with auto-priority |
151
+
152
+ ---
153
+
154
+ ## ARCHITECTURE: Write-Through Pattern
155
+
156
+ ```
157
+ User Action → Storage (JSON) → Context (MD) → Sync Events
158
+ ```
159
+
160
+ | Layer | Path | Purpose |
161
+ |-------|------|---------|
162
+ | **Storage** | `storage/*.json` | Source of truth |
163
+ | **Context** | `context/*.md` | AI-readable summaries |
164
+ | **Memory** | `memory/events.jsonl` | Audit trail (append-only) |
165
+ | **Agents** | `agents/*.md` | Domain specialists |
166
+ | **Sync** | `sync/pending.json` | Backend sync queue |
167
+
168
+ ### File Structure
169
+ ```
170
+ ~/.prjct-cli/projects/{projectId}/
171
+ ├── storage/
172
+ │ ├── state.json # Current task (SOURCE OF TRUTH)
173
+ │ ├── queue.json # Task queue
174
+ │ └── shipped.json # Shipped features
175
+ ├── context/
176
+ │ ├── now.md # Current task (generated)
177
+ │ └── next.md # Queue (generated)
178
+ ├── config/
179
+ │ └── skills.json # Agent-to-skill mappings
180
+ ├── memory/
181
+ │ └── events.jsonl # Audit trail
182
+ ├── agents/ # Domain specialists (auto-generated)
183
+ └── sync/
184
+ └── pending.json # Events for backend
185
+ ```
186
+
187
+ ---
188
+
189
+ ## INTELLIGENT BEHAVIOR
190
+
191
+ ### When Starting Tasks (`/task`)
192
+ 1. **Analyze** - Understand what user wants to achieve
193
+ 2. **Classify** - Determine type: feature, bug, improvement, refactor, chore
194
+ 3. **Explore** - Find similar code, patterns, affected files
195
+ 4. **Ask** - Clarify ambiguities
196
+ 5. **Design** - Propose 2-3 approaches, get approval
197
+ 6. **Break down** - Create actionable subtasks
198
+ 7. **Track** - Update storage/state.json
199
+
200
+ ### When Completing Tasks (`/done`)
201
+ 1. Check if there are more subtasks
202
+ 2. If yes, advance to next subtask
203
+ 3. If no, task is complete
204
+ 4. Update storage, generate context
205
+
206
+ ### When Shipping (`/ship`)
207
+ 1. Run tests (if configured)
208
+ 2. Create PR (if on feature branch)
209
+ 3. Bump version
210
+ 4. Update CHANGELOG
211
+ 5. Create git tag
212
+
213
+ ### Key Intelligence Rules
214
+ - **Read before write** - Always read existing files before modifying
215
+ - **Explore before coding** - Understand codebase structure
216
+ - **Ask when uncertain** - Clarify requirements
217
+ - **Adapt templates** - Templates are guidance, not rigid scripts
218
+ - **Log everything** - Append to memory/events.jsonl
219
+
220
+ ---
221
+
222
+ ## OUTPUT FORMAT
223
+
224
+ Concise responses (< 4 lines):
225
+ ```
226
+ ✅ [What was done]
227
+
228
+ [Key metrics]
229
+ Next: [suggested action]
230
+ ```
231
+
232
+ ---
233
+
234
+ ## LOADING DOMAIN AGENTS
235
+
236
+ When working on tasks, load relevant agents from `{globalPath}/agents/`:
237
+ - `frontend.md` - Frontend patterns, components
238
+ - `backend.md` - Backend patterns, APIs
239
+ - `database.md` - Database patterns, queries
240
+ - `uxui.md` - UX/UI guidelines
241
+ - `testing.md` - Testing patterns
242
+ - `devops.md` - CI/CD, containers
243
+
244
+ These agents contain project-specific patterns. **USE THEM**.
245
+
246
+ ---
247
+
248
+ ## WINDSURF-SPECIFIC NOTES
249
+
250
+ ### Router Regeneration
251
+ If workflow files in `.windsurf/workflows/` are deleted:
252
+ - Run `/sync` to regenerate them
253
+ - Or run `prjct init` in the project
254
+
255
+ ### Model Agnostic
256
+ prjct works with any model Windsurf supports:
257
+ - GPT-4, GPT-4o
258
+ - Claude Opus, Claude Sonnet
259
+ - Gemini Pro
260
+ - And more
261
+
262
+ The instructions are model-agnostic.
263
+
264
+ ---
265
+
266
+ **Auto-managed by prjct-cli** | https://prjct.app
267
+
268
+ <!-- prjct:end - DO NOT REMOVE THIS MARKER -->
@@ -0,0 +1,28 @@
1
+ ---
2
+ trigger: always_on
3
+ description: "prjct - Context layer for AI coding agents"
4
+ ---
5
+
6
+ # prjct
7
+
8
+ You are using **prjct**, a context layer for AI coding agents.
9
+
10
+ ## Load Full Instructions
11
+
12
+ 1. Run: `npm root -g` to get the npm global root
13
+ 2. Read: `{npmRoot}/prjct-cli/templates/global/WINDSURF.md`
14
+ 3. Follow those instructions for ALL workflow requests
15
+
16
+ ## Quick Reference
17
+
18
+ | Workflow | Action |
19
+ |----------|--------|
20
+ | `/sync` | Analyze project, generate agents |
21
+ | `/task "..."` | Start a task |
22
+ | `/done` | Complete subtask |
23
+ | `/ship` | Ship with PR + version |
24
+
25
+ ## Note
26
+
27
+ This router auto-regenerates with `/sync` if deleted.
28
+ Full instructions are in the npm package (always up-to-date).
@@ -0,0 +1,8 @@
1
+ # /bug - Report a bug
2
+
3
+ **ARGUMENTS**: {{args}}
4
+
5
+ Run `npm root -g` to get npm global root, then read and execute:
6
+ `{npmRoot}/prjct-cli/templates/commands/bug.md`
7
+
8
+ Pass the arguments as the bug description.
@@ -0,0 +1,4 @@
1
+ # /done - Complete subtask
2
+
3
+ Run `npm root -g` to get npm global root, then read and execute:
4
+ `{npmRoot}/prjct-cli/templates/commands/done.md`
@@ -0,0 +1,4 @@
1
+ # /pause - Pause current task
2
+
3
+ Run `npm root -g` to get npm global root, then read and execute:
4
+ `{npmRoot}/prjct-cli/templates/commands/pause.md`
@@ -0,0 +1,4 @@
1
+ # /resume - Resume paused task
2
+
3
+ Run `npm root -g` to get npm global root, then read and execute:
4
+ `{npmRoot}/prjct-cli/templates/commands/resume.md`
@@ -0,0 +1,8 @@
1
+ # /ship - Ship feature
2
+
3
+ **ARGUMENTS**: {{args}}
4
+
5
+ Run `npm root -g` to get npm global root, then read and execute:
6
+ `{npmRoot}/prjct-cli/templates/commands/ship.md`
7
+
8
+ Pass the arguments as the ship name (optional).
@@ -0,0 +1,4 @@
1
+ # /sync - Analyze project
2
+
3
+ Run `npm root -g` to get npm global root, then read and execute:
4
+ `{npmRoot}/prjct-cli/templates/commands/sync.md`
@@ -0,0 +1,8 @@
1
+ # /task - Start a task
2
+
3
+ **ARGUMENTS**: {{args}}
4
+
5
+ Run `npm root -g` to get npm global root, then read and execute:
6
+ `{npmRoot}/prjct-cli/templates/commands/task.md`
7
+
8
+ Pass the arguments as the task description.