prjct-cli 0.35.4 → 0.36.1

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.
@@ -1,136 +1,34 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * postinstall - Minimal, reliable setup
4
+ * postinstall - Minimal setup message
5
5
  *
6
- * CRITICAL: Only copies p.md router to ~/.claude/commands/
7
- * p.md reads templates from npm root, so updates work automatically.
8
- * Statusline is best-effort (optional).
6
+ * NOTE: postinstall often doesn't run (npm quirks, --ignore-scripts, etc.)
7
+ * The reliable setup path is `prjct start` which users run manually.
8
+ *
9
+ * This script just shows a helpful message.
9
10
  */
10
11
 
11
12
  const fs = require('fs')
12
13
  const path = require('path')
13
- const os = require('os')
14
14
 
15
15
  const ROOT = path.resolve(__dirname, '..')
16
- const HOME = os.homedir()
17
- const CLAUDE_DIR = path.join(HOME, '.claude')
18
- const COMMANDS_DIR = path.join(CLAUDE_DIR, 'commands')
19
-
20
- // Read version from package.json
21
16
  const pkg = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf-8'))
22
17
  const VERSION = pkg.version
23
18
 
24
- console.log('\n prjct-cli postinstall\n')
25
-
26
- // 1. Copy p.md router (CRITICAL - main entry point)
27
- try {
28
- fs.mkdirSync(COMMANDS_DIR, { recursive: true })
29
-
30
- const pmdSrc = path.join(ROOT, 'templates', 'commands', 'p.md')
31
- const pmdDest = path.join(COMMANDS_DIR, 'p.md')
32
-
33
- if (fs.existsSync(pmdSrc)) {
34
- fs.copyFileSync(pmdSrc, pmdDest)
35
- console.log(' \u2713 p.md router installed')
36
- } else {
37
- console.log(' ! p.md not found in package')
38
- }
39
- } catch (error) {
40
- console.log(' ! Could not install p.md:', error.message)
41
- console.log(' Run: npx prjct-cli setup')
42
- }
43
-
44
- // 2. Install individual commands as separate skills (p.task, p.sync, etc.)
45
- try {
46
- const commandsDir = path.join(ROOT, 'templates', 'commands')
47
- const commands = fs.readdirSync(commandsDir).filter(f => f.endsWith('.md') && f !== 'p.md')
48
-
49
- let installed = 0
50
- for (const cmd of commands) {
51
- const src = path.join(commandsDir, cmd)
52
- const cmdName = cmd.replace('.md', '')
53
- const dest = path.join(COMMANDS_DIR, `p.${cmdName}.md`)
54
-
55
- try {
56
- fs.copyFileSync(src, dest)
57
- installed++
58
- } catch {
59
- // Skip files that fail to copy
60
- }
61
- }
62
-
63
- console.log(` \u2713 ${installed} individual commands installed (/p.task, /p.sync, etc.)`)
64
- } catch (error) {
65
- console.log(' ! Could not install individual commands:', error.message)
66
- }
67
-
68
- // 3. Statusline (best-effort, not critical)
69
- try {
70
- const STATUSLINE_SRC = path.join(ROOT, 'assets', 'statusline')
71
- const STATUSLINE_DEST = path.join(HOME, '.prjct-cli', 'statusline')
72
-
73
- if (fs.existsSync(STATUSLINE_SRC)) {
74
- // Create dirs
75
- fs.mkdirSync(path.join(STATUSLINE_DEST, 'lib'), { recursive: true })
76
- fs.mkdirSync(path.join(STATUSLINE_DEST, 'components'), { recursive: true })
77
- fs.mkdirSync(path.join(STATUSLINE_DEST, 'themes'), { recursive: true })
78
-
79
- // Copy main script with version patched
80
- const mainScript = path.join(STATUSLINE_SRC, 'statusline.sh')
81
- if (fs.existsSync(mainScript)) {
82
- let content = fs.readFileSync(mainScript, 'utf-8')
83
- content = content.replace(/CLI_VERSION="[^"]*"/, `CLI_VERSION="${VERSION}"`)
84
- fs.writeFileSync(path.join(STATUSLINE_DEST, 'statusline.sh'), content, { mode: 0o755 })
85
- }
86
-
87
- // Copy subdirs
88
- for (const subdir of ['lib', 'components', 'themes']) {
89
- const srcDir = path.join(STATUSLINE_SRC, subdir)
90
- if (fs.existsSync(srcDir)) {
91
- for (const f of fs.readdirSync(srcDir)) {
92
- fs.copyFileSync(
93
- path.join(srcDir, f),
94
- path.join(STATUSLINE_DEST, subdir, f)
95
- )
96
- }
97
- }
98
- }
99
-
100
- // Default config (only if not exists)
101
- const configSrc = path.join(STATUSLINE_SRC, 'default-config.json')
102
- const configDest = path.join(STATUSLINE_DEST, 'config.json')
103
- if (fs.existsSync(configSrc) && !fs.existsSync(configDest)) {
104
- fs.copyFileSync(configSrc, configDest)
105
- }
19
+ // Colors
20
+ const CYAN = '\x1b[36m'
21
+ const GREEN = '\x1b[32m'
22
+ const DIM = '\x1b[2m'
23
+ const BOLD = '\x1b[1m'
24
+ const RESET = '\x1b[0m'
106
25
 
107
- // Symlink in ~/.claude
108
- const symlinkPath = path.join(CLAUDE_DIR, 'prjct-statusline.sh')
109
- const targetPath = path.join(STATUSLINE_DEST, 'statusline.sh')
110
- try {
111
- if (fs.existsSync(symlinkPath)) fs.unlinkSync(symlinkPath)
112
- if (fs.existsSync(targetPath)) fs.symlinkSync(targetPath, symlinkPath)
113
- } catch {
114
- // Symlink failed, copy instead
115
- if (fs.existsSync(targetPath)) {
116
- fs.copyFileSync(targetPath, symlinkPath)
117
- fs.chmodSync(symlinkPath, 0o755)
118
- }
119
- }
26
+ console.log(`
27
+ ${CYAN}${BOLD} prjct${RESET} ${DIM}v${VERSION}${RESET}
120
28
 
121
- // Update settings.json
122
- const settingsPath = path.join(CLAUDE_DIR, 'settings.json')
123
- let settings = {}
124
- if (fs.existsSync(settingsPath)) {
125
- try { settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8')) } catch {}
126
- }
127
- settings.statusLine = { type: 'command', command: symlinkPath }
128
- fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2))
29
+ ${GREEN}✓${RESET} Installed successfully!
129
30
 
130
- console.log(' \u2713 statusline installed')
131
- }
132
- } catch {
133
- // Statusline is optional, don't fail
134
- }
31
+ ${BOLD}Next step:${RESET} Run ${CYAN}prjct start${RESET} to configure your AI providers.
135
32
 
136
- console.log('\n')
33
+ ${DIM}Supports: Claude Code, Gemini CLI, or both${RESET}
34
+ `)
@@ -1,6 +1,14 @@
1
1
  # AGENTS.md
2
2
 
3
- AI assistant guidance for **prjct-cli** - developer momentum tool.
3
+ AI assistant guidance for **prjct-cli** - context layer for AI coding agents. Works with Claude Code, Gemini CLI, and more.
4
+
5
+ ## What This Is
6
+
7
+ **NOT** project management. NO sprints, story points, ceremonies, or meetings.
8
+
9
+ **IS** a context layer that gives AI agents the project knowledge they need to work effectively.
10
+
11
+ ---
4
12
 
5
13
  ## Dynamic Agent Generation
6
14
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: 'prjct CLI - Developer momentum tool'
2
+ description: 'prjct CLI - Context layer for AI agents'
3
3
  allowed-tools: [Read, Write, Edit, Bash, Glob, Grep, Task, AskUserQuestion, TodoWrite, WebFetch]
4
4
  ---
5
5
 
@@ -0,0 +1,37 @@
1
+ # prjct Command Router for Gemini CLI
2
+ description = "prjct - Context layer for AI coding agents"
3
+
4
+ prompt = """
5
+ # prjct Command Router
6
+
7
+ You are using prjct, a context layer for AI coding agents.
8
+
9
+ **ARGUMENTS**: {{args}}
10
+
11
+ ## Instructions
12
+
13
+ 1. Parse arguments: first word = `command`, rest = `commandArgs`
14
+ 2. Get npm global root by running: `npm root -g`
15
+ 3. Read the command template from:
16
+ `{npmRoot}/prjct-cli/templates/commands/{command}.md`
17
+ 4. Execute the template with `commandArgs` as input
18
+
19
+ ## Example
20
+
21
+ If arguments = "task fix the login bug":
22
+ - command = "task"
23
+ - commandArgs = "fix the login bug"
24
+ - npm root -g → `/opt/homebrew/lib/node_modules`
25
+ - Read: `/opt/homebrew/lib/node_modules/prjct-cli/templates/commands/task.md`
26
+ - Execute template with: "fix the login bug"
27
+
28
+ ## Available Commands
29
+
30
+ task, done, ship, sync, init, idea, dash, next, pause, resume, bug,
31
+ linear, feature, prd, plan, review, merge, git, test, cleanup,
32
+ design, analyze, history, enrich, update
33
+
34
+ ## Action
35
+
36
+ NOW run `npm root -g` and read the appropriate command template.
37
+ """
@@ -1,7 +1,7 @@
1
1
  <!-- prjct:start - DO NOT REMOVE THIS MARKER -->
2
2
  # prjct-cli
3
3
 
4
- **Developer momentum tool** - Track progress through natural language commands without PM overhead.
4
+ **Context layer for AI agents** - Project context for Claude Code, Gemini CLI, and more.
5
5
 
6
6
  ## HOW TO USE PRJCT (Read This First)
7
7
 
@@ -56,6 +56,38 @@ Designed for [Claude](https://www.anthropic.com/claude)
56
56
 
57
57
  **This is NON-NEGOTIABLE. The prjct signature (`🤖 Generated with [p/]`) must appear in ALL commits.**
58
58
 
59
+ ### 5. Storage Rules (CROSS-AGENT COMPATIBILITY)
60
+
61
+ **NEVER use temporary files** - Write directly to final destination:
62
+ - WRONG: Create `.tmp/file.json`, then `mv` to final path
63
+ - CORRECT: Write directly to `{globalPath}/storage/state.json`
64
+
65
+ **JSON formatting** - Always use consistent format:
66
+ - 2-space indentation
67
+ - No trailing commas
68
+ - Keys in logical order (as defined in storage schemas)
69
+
70
+ **Atomic writes for JSON**:
71
+ ```javascript
72
+ // Read → Modify → Write (no temp files)
73
+ const data = JSON.parse(fs.readFileSync(path, 'utf-8'))
74
+ data.newField = value
75
+ fs.writeFileSync(path, JSON.stringify(data, null, 2))
76
+ ```
77
+
78
+ **Timestamps**: Always ISO-8601 with milliseconds (`.000Z`)
79
+ **UUIDs**: Always v4 format (lowercase)
80
+ **Line endings**: LF (not CRLF)
81
+ **Encoding**: UTF-8 without BOM
82
+
83
+ **NEVER**:
84
+ - Use `.tmp/` directories
85
+ - Use `mv` or `rename` operations for storage files
86
+ - Create backup files like `*.bak` or `*.old`
87
+ - Modify existing lines in `events.jsonl`
88
+
89
+ **Full specification**: Install prjct-cli and see `{npm root -g}/prjct-cli/templates/global/STORAGE-SPEC.md`
90
+
59
91
  ---
60
92
 
61
93
  ## CORE WORKFLOW
@@ -0,0 +1,265 @@
1
+ <!-- prjct:start - DO NOT REMOVE THIS MARKER -->
2
+ # prjct-cli
3
+
4
+ **Context layer for AI agents** - Project context for Claude Code, Gemini CLI, and more.
5
+
6
+ ## HOW TO USE PRJCT (Read This First)
7
+
8
+ When user types `p. <command>`, load the template from `templates/commands/{command}.md` and execute it intelligently.
9
+
10
+ ```
11
+ p. sync → templates/commands/sync.md
12
+ p. task X → templates/commands/task.md
13
+ p. done → templates/commands/done.md
14
+ p. ship X → templates/commands/ship.md
15
+ ```
16
+
17
+ **Key Insight**: Templates are GUIDANCE, not scripts. Use your intelligence to adapt them to the situation.
18
+
19
+ ---
20
+
21
+ ## CRITICAL RULES
22
+
23
+ ### 1. Path Resolution (MOST IMPORTANT)
24
+ **ALL writes go to global storage**: `~/.prjct-cli/projects/{projectId}/`
25
+
26
+ - **NEVER** write to `.prjct/` (config only, read-only)
27
+ - **NEVER** write to `./` (current directory)
28
+ - **ALWAYS** resolve projectId first from `.prjct/prjct.config.json`
29
+
30
+ ### 2. Before Any Command
31
+ ```
32
+ 1. Read .prjct/prjct.config.json → get projectId
33
+ 2. Set globalPath = ~/.prjct-cli/projects/{projectId}
34
+ 3. Execute command using globalPath for all writes
35
+ 4. Log to {globalPath}/memory/events.jsonl
36
+ ```
37
+
38
+ ### 3. Timestamps & UUIDs
39
+ ```bash
40
+ # Timestamp (NEVER hardcode)
41
+ bun -e "console.log(new Date().toISOString())" 2>/dev/null || node -e "console.log(new Date().toISOString())"
42
+
43
+ # UUID
44
+ bun -e "console.log(crypto.randomUUID())" 2>/dev/null || node -e "console.log(require('crypto').randomUUID())"
45
+ ```
46
+
47
+ ### 4. Git Commit Footer (CRITICAL - ALWAYS INCLUDE)
48
+
49
+ **Every commit made with prjct MUST include this footer:**
50
+
51
+ ```
52
+ 🤖 Generated with [p/](https://www.prjct.app/)
53
+ Designed for [Gemini](https://geminicli.com/)
54
+
55
+ ```
56
+
57
+ **This is NON-NEGOTIABLE. The prjct signature (`🤖 Generated with [p/]`) must appear in ALL commits.**
58
+
59
+ ### 5. Storage Rules (CROSS-AGENT COMPATIBILITY)
60
+
61
+ **NEVER use temporary files** - Write directly to final destination:
62
+ - WRONG: Create `.tmp/file.json`, then `mv` to final path
63
+ - CORRECT: Write directly to `{globalPath}/storage/state.json`
64
+
65
+ **JSON formatting** - Always use consistent format:
66
+ - 2-space indentation
67
+ - No trailing commas
68
+ - Keys in logical order (as defined in storage schemas)
69
+
70
+ **Atomic writes for JSON**:
71
+ ```javascript
72
+ // Read → Modify → Write (no temp files)
73
+ const data = JSON.parse(fs.readFileSync(path, 'utf-8'))
74
+ data.newField = value
75
+ fs.writeFileSync(path, JSON.stringify(data, null, 2))
76
+ ```
77
+
78
+ **Timestamps**: Always ISO-8601 with milliseconds (`.000Z`)
79
+ **UUIDs**: Always v4 format (lowercase)
80
+ **Line endings**: LF (not CRLF)
81
+ **Encoding**: UTF-8 without BOM
82
+
83
+ **NEVER**:
84
+ - Use `.tmp/` directories
85
+ - Use `mv` or `rename` operations for storage files
86
+ - Create backup files like `*.bak` or `*.old`
87
+ - Modify existing lines in `events.jsonl`
88
+
89
+ **Full specification**: Install prjct-cli and see `{npm root -g}/prjct-cli/templates/global/STORAGE-SPEC.md`
90
+
91
+ ---
92
+
93
+ ## CORE WORKFLOW
94
+
95
+ ```
96
+ p. sync → p. task "description" → [work] → p. done → p. ship
97
+ │ │ │ │
98
+ │ └─ Creates branch, breaks down │ │
99
+ │ task, starts tracking │ │
100
+ │ │ │
101
+ └─ Analyzes project, generates agents │ │
102
+ │ │
103
+ Completes subtask ─────┘ │
104
+
105
+ Ships feature, PR, tag ───┘
106
+ ```
107
+
108
+ ### Quick Reference
109
+
110
+ | Trigger | What It Does |
111
+ |---------|--------------|
112
+ | `p. sync` | Analyze project, generate domain agents |
113
+ | `p. task <desc>` | Start task with auto-classification |
114
+ | `p. done` | Complete current subtask |
115
+ | `p. ship [name]` | Ship feature with PR + version bump |
116
+ | `p. pause` | Pause current task |
117
+ | `p. resume` | Resume paused task |
118
+ | `p. bug <desc>` | Report bug with auto-priority |
119
+
120
+ ---
121
+
122
+ ## ARCHITECTURE: Write-Through Pattern
123
+
124
+ ```
125
+ User Action → Storage (JSON) → Context (MD) → Sync Events
126
+ ```
127
+
128
+ | Layer | Path | Purpose |
129
+ |-------|------|---------|
130
+ | **Storage** | `storage/*.json` | Source of truth |
131
+ | **Context** | `context/*.md` | AI-readable summaries |
132
+ | **Memory** | `memory/events.jsonl` | Audit trail (append-only) |
133
+ | **Agents** | `agents/*.md` | Domain specialists |
134
+ | **Sync** | `sync/pending.json` | Backend sync queue |
135
+
136
+ ### File Structure
137
+ ```
138
+ ~/.prjct-cli/projects/{projectId}/
139
+ ├── storage/
140
+ │ ├── state.json # Current task (SOURCE OF TRUTH)
141
+ │ ├── queue.json # Task queue
142
+ │ └── shipped.json # Shipped features
143
+ ├── context/
144
+ │ ├── now.md # Current task (generated)
145
+ │ └── next.md # Queue (generated)
146
+ ├── config/
147
+ │ └── skills.json # Agent-to-skill mappings
148
+ ├── memory/
149
+ │ └── events.jsonl # Audit trail
150
+ ├── agents/ # Domain specialists (auto-generated)
151
+ └── sync/
152
+ └── pending.json # Events for backend
153
+ ```
154
+
155
+ ---
156
+
157
+ ## INTELLIGENT BEHAVIOR
158
+
159
+ ### When Starting Tasks (`p. task`)
160
+ 1. **Analyze** - Understand what user wants to achieve
161
+ 2. **Classify** - Determine type: feature, bug, improvement, refactor, chore
162
+ 3. **Explore** - Find similar code, patterns, affected files
163
+ 4. **Ask** - Clarify ambiguities
164
+ 5. **Design** - Propose 2-3 approaches, get approval
165
+ 6. **Break down** - Create actionable subtasks
166
+ 7. **Track** - Update storage/state.json
167
+
168
+ ### When Completing Tasks (`p. done`)
169
+ 1. Check if there are more subtasks
170
+ 2. If yes, advance to next subtask
171
+ 3. If no, task is complete
172
+ 4. Update storage, generate context
173
+
174
+ ### When Shipping (`p. ship`)
175
+ 1. Run tests (if configured)
176
+ 2. Create PR (if on feature branch)
177
+ 3. Bump version
178
+ 4. Update CHANGELOG
179
+ 5. Create git tag
180
+
181
+ ### Key Intelligence Rules
182
+ - **Read before write** - Always read existing files before modifying
183
+ - **Explore before coding** - Understand codebase first
184
+ - **Ask when uncertain** - Clarify ambiguities
185
+ - **Adapt templates** - Templates are guidance, not rigid scripts
186
+ - **Log everything** - Append to memory/events.jsonl
187
+
188
+ ---
189
+
190
+ ## OUTPUT FORMAT
191
+
192
+ Concise responses (< 4 lines):
193
+ ```
194
+ ✅ [What was done]
195
+
196
+ [Key metrics]
197
+ Next: [suggested action]
198
+ ```
199
+
200
+ ---
201
+
202
+ ## LOADING DOMAIN AGENTS
203
+
204
+ When working on tasks, load relevant agents from `{globalPath}/agents/`:
205
+ - `frontend.md` - Frontend patterns, components
206
+ - `backend.md` - Backend patterns, APIs
207
+ - `database.md` - Database patterns, queries
208
+ - `uxui.md` - UX/UI guidelines
209
+ - `testing.md` - Testing patterns
210
+ - `devops.md` - CI/CD, containers
211
+
212
+ These agents contain project-specific patterns. **USE THEM**.
213
+
214
+ ---
215
+
216
+ ## SKILL INTEGRATION
217
+
218
+ Agents can be linked to skills for specialized expertise.
219
+
220
+ ### How Skills Work
221
+
222
+ 1. **During `p. sync`**: Skills are discovered and installed
223
+ 2. **During `p. task`**: Skills are auto-invoked for domain expertise
224
+ 3. **Agent frontmatter** has `skills: [skill-name]` field
225
+
226
+ ### Skill Location
227
+
228
+ Skills are SKILL.md files in `~/.gemini/skills/{skill-name}/`
229
+
230
+ **Note**: Gemini CLI and Claude Code use the same SKILL.md format, so skills are compatible between both agents.
231
+
232
+ ### Skill Configuration
233
+
234
+ After sync: `{globalPath}/config/skills.json` contains skill mappings.
235
+
236
+ ---
237
+
238
+ ## GEMINI-SPECIFIC FEATURES
239
+
240
+ ### Context Hierarchy
241
+
242
+ Gemini CLI loads GEMINI.md files hierarchically:
243
+ 1. Global: `~/.gemini/GEMINI.md`
244
+ 2. Project ancestors: Walk up to `.git` root
245
+ 3. Subdirectories: Scan below cwd (respects `.geminiignore`)
246
+
247
+ ### Modular Imports
248
+
249
+ You can import content from other files using `@file.md` syntax:
250
+ ```markdown
251
+ @./components/instructions.md
252
+ @../shared/style-guide.md
253
+ ```
254
+
255
+ ### Memory Commands
256
+
257
+ - `/memory show` - Display loaded context
258
+ - `/memory refresh` - Reload all GEMINI.md files
259
+ - `/memory add <text>` - Add to global context
260
+
261
+ ---
262
+
263
+ **Auto-managed by prjct-cli** | https://prjct.app | v0.27.0
264
+
265
+ <!-- prjct:end - DO NOT REMOVE THIS MARKER -->