prjct-cli 0.33.5 → 0.34.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 (39) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/package.json +1 -1
  3. package/scripts/postinstall.js +26 -2
  4. package/templates/agentic/orchestrator.md +303 -0
  5. package/templates/commands/bug.md +2 -0
  6. package/templates/commands/github.md +63 -7
  7. package/templates/commands/jira.md +44 -4
  8. package/templates/commands/linear.md +40 -8
  9. package/templates/commands/monday.md +42 -6
  10. package/templates/commands/p.md +57 -10
  11. package/templates/commands/sync.md +133 -97
  12. package/templates/commands/task.md +12 -0
  13. package/templates/config/skill-mappings.json +95 -63
  14. package/dist/bin/prjct.mjs +0 -13581
  15. package/dist/core/infrastructure/command-installer.js +0 -473
  16. package/dist/core/infrastructure/editors-config.js +0 -157
  17. package/dist/core/infrastructure/setup.js +0 -893
  18. package/dist/core/utils/version.js +0 -142
  19. package/packages/shared/.turbo/turbo-build.log +0 -14
  20. package/packages/shared/dist/index.d.ts +0 -10
  21. package/packages/shared/dist/index.d.ts.map +0 -1
  22. package/packages/shared/dist/index.js +0 -4196
  23. package/packages/shared/dist/schemas.d.ts +0 -408
  24. package/packages/shared/dist/schemas.d.ts.map +0 -1
  25. package/packages/shared/dist/types.d.ts +0 -144
  26. package/packages/shared/dist/types.d.ts.map +0 -1
  27. package/packages/shared/dist/unified.d.ts +0 -139
  28. package/packages/shared/dist/unified.d.ts.map +0 -1
  29. package/packages/shared/dist/utils.d.ts +0 -60
  30. package/packages/shared/dist/utils.d.ts.map +0 -1
  31. package/templates/commands/ask.md +0 -128
  32. package/templates/commands/dashboard.md +0 -686
  33. package/templates/commands/feature.md +0 -46
  34. package/templates/commands/now.md +0 -53
  35. package/templates/commands/suggest.md +0 -116
  36. package/templates/global/docs/agents.md +0 -88
  37. package/templates/global/docs/architecture.md +0 -103
  38. package/templates/global/docs/commands.md +0 -96
  39. package/templates/global/docs/validation.md +0 -95
package/CHANGELOG.md CHANGED
@@ -1,5 +1,70 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.34.0] - 2026-01-15
4
+
5
+ ### Feature: Agentic Orchestrator + MCP Auto-Install
6
+
7
+ Major release with intelligent task routing and simplified integration setup.
8
+
9
+ #### Orchestrator Agent (NEW)
10
+
11
+ Auto-routing system for tasks to the right agents and skills:
12
+
13
+ - **Domain Detection**: Analyzes task keywords to detect domains (frontend, backend, database, etc.)
14
+ - **Agent Loading**: Automatically loads relevant agents from `{globalPath}/agents/`
15
+ - **Skill Invocation**: Invokes skills from `~/.claude/skills/` based on task context
16
+ - **Multi-Domain Coordination**: Handles tasks spanning multiple domains with proper execution order
17
+
18
+ **Usage**: Orchestrator runs automatically for task-related commands (`p. task`, `p. done`, `p. ship`, etc.)
19
+
20
+ #### MCP Server Auto-Install
21
+
22
+ All integrations now auto-install their MCP servers:
23
+
24
+ - **Linear**: Auto-installs `mcp-remote` for Linear API
25
+ - **JIRA**: Auto-installs Atlassian MCP server
26
+ - **GitHub**: Auto-installs GitHub MCP server with token validation
27
+ - **Monday.com**: Auto-installs Monday MCP server
28
+
29
+ No more manual `~/.claude/settings.json` editing - just run `p. linear setup` and it handles everything.
30
+
31
+ #### Individual Command Skills
32
+
33
+ All 37 prjct commands now available as individual Claude Code skills:
34
+
35
+ - `/p.task` - Start a task
36
+ - `/p.sync` - Sync project
37
+ - `/p.linear` - Linear integration
38
+ - Plus 34 more commands
39
+
40
+ #### agentskills.io Integration
41
+
42
+ Skills are now discovered from the official agentskills.io ecosystem:
43
+
44
+ - Skills from `anthropics/skills` GitHub repo
45
+ - Proper SKILL.md format with YAML frontmatter
46
+ - Agent-to-skill mapping in `templates/config/skill-mappings.json`
47
+
48
+ **Files Changed:**
49
+ - `templates/agentic/orchestrator.md` (NEW)
50
+ - `templates/commands/p.md` - Orchestrator integration
51
+ - `templates/commands/task.md` - Orchestrator context usage
52
+ - `templates/commands/linear.md` - MCP auto-install
53
+ - `templates/commands/jira.md` - MCP auto-install
54
+ - `templates/commands/github.md` - MCP auto-install
55
+ - `templates/commands/monday.md` - MCP auto-install
56
+ - `templates/config/skill-mappings.json` - agentskills.io sources
57
+ - `scripts/postinstall.js` - Individual command installation
58
+
59
+ **Removed (deprecated):**
60
+ - `templates/commands/feature.md`
61
+ - `templates/commands/now.md`
62
+ - `templates/commands/dashboard.md`
63
+ - `templates/commands/suggest.md`
64
+ - `templates/commands/ask.md`
65
+
66
+ ---
67
+
3
68
  ## [0.33.5] - 2026-01-13
4
69
 
5
70
  ### Fix: Type Safety Improvements (PRJ-54)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prjct-cli",
3
- "version": "0.33.5",
3
+ "version": "0.34.0",
4
4
  "description": "Built for Claude - Ship fast, track progress, stay focused. Developer momentum tool for indie hackers.",
5
5
  "main": "core/index.ts",
6
6
  "bin": {
@@ -23,7 +23,7 @@ const VERSION = pkg.version
23
23
 
24
24
  console.log('\n prjct-cli postinstall\n')
25
25
 
26
- // 1. Copy p.md router (CRITICAL - this is the only essential file)
26
+ // 1. Copy p.md router (CRITICAL - main entry point)
27
27
  try {
28
28
  fs.mkdirSync(COMMANDS_DIR, { recursive: true })
29
29
 
@@ -41,7 +41,31 @@ try {
41
41
  console.log(' Run: npx prjct-cli setup')
42
42
  }
43
43
 
44
- // 2. Statusline (best-effort, not critical)
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)
45
69
  try {
46
70
  const STATUSLINE_SRC = path.join(ROOT, 'assets', 'statusline')
47
71
  const STATUSLINE_DEST = path.join(HOME, '.prjct-cli', 'statusline')
@@ -0,0 +1,303 @@
1
+ # Orchestrator - Agent & Skill Coordinator
2
+
3
+ **Purpose**: Automatically route tasks to the right agents and skills.
4
+
5
+ ## How It Works
6
+
7
+ ```
8
+ User Task → Orchestrator → [Analyze] → [Load Agents] → [Invoke Skills] → [Execute]
9
+ ```
10
+
11
+ The orchestrator is **implicit** - it runs automatically for every p. command.
12
+
13
+ ---
14
+
15
+ ## Step 1: Task Analysis
16
+
17
+ Analyze the current task/command to determine domains involved.
18
+
19
+ ### Domain Detection Keywords
20
+
21
+ | Domain | Keywords | Agent | Skills |
22
+ |--------|----------|-------|--------|
23
+ | **Frontend** | react, vue, component, UI, CSS, styling, layout | `frontend.md` | ui-design, react-patterns |
24
+ | **UX/UI** | design, user experience, accessibility, UX, interaction | `uxui.md` | ux-research, accessibility |
25
+ | **Backend** | API, server, endpoint, database query, auth | `backend.md` | api-design, backend-patterns |
26
+ | **Database** | schema, migration, query, SQL, ORM, prisma | `database.md` | sql-patterns, database-design |
27
+ | **Testing** | test, spec, coverage, TDD, unit, integration | `testing.md` | test-automation |
28
+ | **DevOps** | deploy, CI/CD, docker, kubernetes, pipeline | `devops.md` | ci-cd, infrastructure |
29
+ | **Planning** | plan, architecture, design doc, PRD, spec | `prjct-planner.md` | architecture |
30
+ | **Shipping** | ship, release, PR, merge, version | `prjct-shipper.md` | code-review |
31
+
32
+ ### Analysis Process
33
+
34
+ ```
35
+ 1. EXTRACT keywords from task description
36
+ 2. MATCH keywords to domains (can be multiple)
37
+ 3. SET: {detectedDomains} = matched domains
38
+ 4. SET: {primaryDomain} = highest match count
39
+ 5. SET: {secondaryDomains} = other matches
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Step 2: Load Project Context
45
+
46
+ ```
47
+ READ: .prjct/prjct.config.json → {projectId}
48
+ SET: {globalPath} = ~/.prjct-cli/projects/{projectId}
49
+
50
+ READ: {globalPath}/config/skills.json → {skillsConfig}
51
+ READ: {globalPath}/analysis/repo-analysis.json → {repoAnalysis}
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Step 3: Load Relevant Agents
57
+
58
+ For each detected domain, load the corresponding agent.
59
+
60
+ ```
61
+ SET: {loadedAgents} = []
62
+
63
+ FOR EACH domain IN {detectedDomains}:
64
+ SET: {agentPath} = {globalPath}/agents/{domain}.md
65
+
66
+ IF file exists:
67
+ READ: {agentPath}
68
+ EXTRACT: frontmatter (description, skills, patterns)
69
+ ADD to {loadedAgents}
70
+
71
+ OUTPUT: "🤖 Loaded: {domain} agent"
72
+ ```
73
+
74
+ ### Agent Context Injection
75
+
76
+ Each loaded agent provides:
77
+ - **Patterns**: Code patterns specific to this project
78
+ - **Conventions**: Naming, structure, style rules
79
+ - **Skills**: Which skills to invoke for this domain
80
+ - **Anti-patterns**: What to avoid
81
+
82
+ ---
83
+
84
+ ## Step 4: Invoke Skills
85
+
86
+ For each loaded agent, check if skills should be invoked.
87
+
88
+ ```
89
+ FOR EACH agent IN {loadedAgents}:
90
+ GET: {agentSkills} = agent.frontmatter.skills
91
+
92
+ FOR EACH skillName IN {agentSkills}:
93
+ SET: {skillPath} = ~/.claude/skills/{skillName}/SKILL.md
94
+
95
+ IF file exists:
96
+ READ: {skillPath}
97
+ EXTRACT: skill instructions
98
+ ADD to {activeSkills}
99
+
100
+ OUTPUT: "⚡ Skill active: {skillName}"
101
+ ```
102
+
103
+ ### Skill Selection Criteria
104
+
105
+ Only invoke skills that are:
106
+ 1. **Relevant** to the current task
107
+ 2. **Installed** in ~/.claude/skills/
108
+ 3. **Linked** to a loaded agent
109
+
110
+ ---
111
+
112
+ ## Step 5: Build Execution Context
113
+
114
+ Combine all context for task execution.
115
+
116
+ ```json
117
+ {
118
+ "task": "{original task description}",
119
+ "command": "{p. command being executed}",
120
+ "project": {
121
+ "id": "{projectId}",
122
+ "ecosystem": "{repoAnalysis.ecosystem}",
123
+ "conventions": "{repoAnalysis.conventions}"
124
+ },
125
+ "agents": [
126
+ {
127
+ "name": "{agent.name}",
128
+ "patterns": "{agent.patterns}",
129
+ "rules": "{agent.rules}"
130
+ }
131
+ ],
132
+ "skills": [
133
+ {
134
+ "name": "{skill.name}",
135
+ "instructions": "{skill.instructions}"
136
+ }
137
+ ],
138
+ "execution": {
139
+ "primaryDomain": "{primaryDomain}",
140
+ "secondaryDomains": ["{secondaryDomains}"],
141
+ "commands": "{repoAnalysis.commands}"
142
+ }
143
+ }
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Step 6: Execute with Context
149
+
150
+ Pass the execution context to the command template.
151
+
152
+ The command template receives:
153
+ - `{orchestrator.agents}` - Loaded agent contexts
154
+ - `{orchestrator.skills}` - Active skill instructions
155
+ - `{orchestrator.project}` - Project conventions
156
+ - `{orchestrator.execution}` - Execution metadata
157
+
158
+ ---
159
+
160
+ ## Multi-Domain Coordination
161
+
162
+ When task spans multiple domains:
163
+
164
+ ### Example: "Add user authentication with login form"
165
+
166
+ ```
167
+ Detected domains:
168
+ ├── Frontend (login form, UI)
169
+ ├── Backend (auth API, sessions)
170
+ └── Database (users table, schema)
171
+
172
+ Loaded agents:
173
+ ├── frontend.md → React patterns, form handling
174
+ ├── backend.md → API design, auth patterns
175
+ └── database.md → Schema design, migrations
176
+
177
+ Active skills:
178
+ ├── ui-design → Form components
179
+ ├── api-design → Auth endpoints
180
+ └── sql-patterns → User schema
181
+
182
+ Execution order:
183
+ 1. Database: Create users schema
184
+ 2. Backend: Implement auth API
185
+ 3. Frontend: Build login form
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Orchestrator Output
191
+
192
+ At the start of each command, output:
193
+
194
+ ```
195
+ 🎯 Task: {task description}
196
+
197
+ 📦 Context Loaded:
198
+ ├── Agents: {loadedAgents.join(', ')}
199
+ ├── Skills: {activeSkills.join(', ')}
200
+ └── Primary: {primaryDomain}
201
+
202
+ {Continue with command execution...}
203
+ ```
204
+
205
+ ---
206
+
207
+ ## Integration with Commands
208
+
209
+ Every p. command should:
210
+
211
+ 1. **Before execution**: Run orchestrator Steps 1-5
212
+ 2. **During execution**: Use orchestrator context
213
+ 3. **After execution**: Log which agents/skills were used
214
+
215
+ ### Command Template Integration
216
+
217
+ ```markdown
218
+ # p. {command}
219
+
220
+ ## Step 0: Orchestrator
221
+
222
+ INCLUDE: templates/agentic/orchestrator.md
223
+
224
+ Execute orchestrator Steps 1-5 to build context.
225
+
226
+ ## Step 1: {Command-specific logic}
227
+
228
+ Use {orchestrator.agents} and {orchestrator.skills} for:
229
+ - Code patterns
230
+ - Conventions
231
+ - Domain expertise
232
+
233
+ {Rest of command...}
234
+ ```
235
+
236
+ ---
237
+
238
+ ## Configuration
239
+
240
+ ### Disable Orchestrator
241
+
242
+ For simple commands that don't need orchestration:
243
+
244
+ ```yaml
245
+ ---
246
+ orchestrator: false
247
+ ---
248
+ ```
249
+
250
+ ### Force Specific Agents
251
+
252
+ ```yaml
253
+ ---
254
+ orchestrator:
255
+ agents: [frontend, testing]
256
+ skills: [ui-design]
257
+ ---
258
+ ```
259
+
260
+ ---
261
+
262
+ ## Skill Invocation Patterns
263
+
264
+ ### When to Invoke Skills
265
+
266
+ | Trigger | Skills to Invoke |
267
+ |---------|------------------|
268
+ | Creating UI component | ui-design, accessibility |
269
+ | Writing API endpoint | api-design, backend-patterns |
270
+ | Database changes | sql-patterns, database-design |
271
+ | Writing tests | test-automation |
272
+ | Deploying | ci-cd, infrastructure |
273
+ | Code review | code-review |
274
+ | Creating documents | pdf, docx, pptx (if installed) |
275
+
276
+ ### Skill Execution
277
+
278
+ Skills provide:
279
+ 1. **Instructions** - How to approach the task
280
+ 2. **Examples** - Code/pattern examples
281
+ 3. **Checklists** - Quality gates
282
+ 4. **References** - Additional documentation
283
+
284
+ ---
285
+
286
+ ## Error Handling
287
+
288
+ | Situation | Action |
289
+ |-----------|--------|
290
+ | No agents found | Use default patterns from repo-analysis |
291
+ | No skills installed | Continue without skills, suggest `p. sync` |
292
+ | Agent file missing | Skip that agent, continue with others |
293
+ | Skill file missing | Skip that skill, log warning |
294
+
295
+ ---
296
+
297
+ ## Logging
298
+
299
+ Log orchestrator decisions to memory:
300
+
301
+ ```json
302
+ {"ts":"{timestamp}","action":"orchestrator","task":"{task}","agents":["{agents}"],"skills":["{skills}"],"primaryDomain":"{domain}"}
303
+ ```
@@ -10,6 +10,8 @@ backend-sync: 'sync/pending.json'
10
10
 
11
11
  # /p:bug - Report Bug with Auto-Start
12
12
 
13
+ **ARGUMENTS**: $ARGUMENTS
14
+
13
15
  ## Usage
14
16
 
15
17
  ```
@@ -5,6 +5,8 @@ description: 'GitHub Issues integration via MCP'
5
5
 
6
6
  # p. github - GitHub Issues Integration
7
7
 
8
+ **ARGUMENTS**: $ARGUMENTS
9
+
8
10
  Manage GitHub Issues directly from prjct using MCP.
9
11
 
10
12
  ## Context Variables
@@ -50,17 +52,65 @@ IF file not found:
50
52
 
51
53
  ---
52
54
 
53
- ## Step 2: Check MCP Tools
55
+ ## Step 2: Check GITHUB_TOKEN
56
+
57
+ ```
58
+ CHECK: Is GITHUB_TOKEN env var set?
59
+
60
+ IF not set:
61
+ OUTPUT: "GitHub requires a Personal Access Token."
62
+ OUTPUT: ""
63
+ OUTPUT: "1. Create token at: https://github.com/settings/tokens"
64
+ OUTPUT: "2. Select 'repo' scope"
65
+ OUTPUT: "3. Set env var: export GITHUB_TOKEN=ghp_..."
66
+ OUTPUT: "4. Run `p. github setup` again"
67
+ STOP
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Step 3: Install MCP Server (if needed)
73
+
74
+ ```
75
+ READ: ~/.claude/settings.json (create {} if not exists)
76
+ CHECK: Does mcpServers.github exist?
77
+
78
+ IF not exists:
79
+ READ: templates/mcp-config.json
80
+ EXTRACT: mcpServers.github
81
+
82
+ MERGE into ~/.claude/settings.json:
83
+ {
84
+ "mcpServers": {
85
+ "github": {
86
+ "command": "npx",
87
+ "args": ["-y", "@modelcontextprotocol/server-github"],
88
+ "env": {
89
+ "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
90
+ }
91
+ }
92
+ }
93
+ }
94
+
95
+ WRITE: ~/.claude/settings.json
96
+
97
+ OUTPUT: "✅ Installed GitHub MCP server"
98
+ OUTPUT: ""
99
+ OUTPUT: "⚠️ Restart Claude Code to activate the MCP server."
100
+ OUTPUT: "Then run `p. github setup` again to complete configuration."
101
+ STOP
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Step 4: Check MCP Tools Available
54
107
 
55
108
  ```
56
109
  CHECK: Are mcp__github__* tools available?
57
110
 
58
111
  IF not available:
59
- OUTPUT: "GitHub MCP not configured."
60
- OUTPUT: "1. Set GITHUB_TOKEN env var (needs repo scope)"
61
- OUTPUT: "2. Add to ~/.claude/settings.json:"
62
- OUTPUT: '{"mcpServers":{"github":{"command":"npx","args":["-y","@modelcontextprotocol/server-github"],"env":{"GITHUB_PERSONAL_ACCESS_TOKEN":"${GITHUB_TOKEN}"}}}}'
63
- OUTPUT: "3. Restart Claude Code."
112
+ OUTPUT: "GitHub MCP is installed but not yet active."
113
+ OUTPUT: "Restart Claude Code, then run `p. github setup` again."
64
114
  STOP
65
115
  ```
66
116
 
@@ -70,7 +120,13 @@ IF not available:
70
120
 
71
121
  ### Flow
72
122
 
73
- 1. **Verify MCP tools available**
123
+ 1. **Check token + Install MCP + Verify tools**
124
+ ```
125
+ Execute Step 2 (check GITHUB_TOKEN)
126
+ Execute Step 3 (auto-install MCP if needed)
127
+ Execute Step 4 (verify tools active)
128
+ IF not available: Prompt restart and STOP
129
+ ```
74
130
 
75
131
  2. **Detect repo from git remote**
76
132
  ```bash
@@ -5,6 +5,8 @@ description: 'JIRA issue tracker integration'
5
5
 
6
6
  # p. jira - JIRA Integration
7
7
 
8
+ **ARGUMENTS**: $ARGUMENTS
9
+
8
10
  Manage JIRA issues directly from prjct.
9
11
 
10
12
  ## Context Variables
@@ -68,7 +70,38 @@ IF file not found:
68
70
 
69
71
  ---
70
72
 
71
- ## Step 2: Detect Auth Mode
73
+ ## Step 2: Install MCP Server (if needed)
74
+
75
+ ```
76
+ READ: ~/.claude/settings.json (create {} if not exists)
77
+ CHECK: Does mcpServers.Atlassian exist?
78
+
79
+ IF not exists:
80
+ READ: templates/mcp-config.json
81
+ EXTRACT: mcpServers.Atlassian
82
+
83
+ MERGE into ~/.claude/settings.json:
84
+ {
85
+ "mcpServers": {
86
+ "Atlassian": {
87
+ "command": "npx",
88
+ "args": ["-y", "mcp-remote@latest", "https://mcp.atlassian.com/v1/sse"]
89
+ }
90
+ }
91
+ }
92
+
93
+ WRITE: ~/.claude/settings.json
94
+
95
+ OUTPUT: "✅ Installed Atlassian MCP server"
96
+ OUTPUT: ""
97
+ OUTPUT: "⚠️ Restart Claude Code to activate the MCP server."
98
+ OUTPUT: "Then run `p. jira setup` again to complete configuration."
99
+ STOP
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Step 3: Detect Auth Mode
72
105
 
73
106
  ```
74
107
  # Check API Token first
@@ -79,6 +112,12 @@ IF JIRA_API_TOKEN is set:
79
112
  ELSE IF mcp__atlassian__jira_* tools available:
80
113
  SET: authMode = "mcp"
81
114
 
115
+ # MCP installed but not active
116
+ ELSE IF mcpServers.Atlassian exists in settings.json:
117
+ OUTPUT: "Atlassian MCP is installed but not yet active."
118
+ OUTPUT: "Restart Claude Code, then run `p. jira setup` again."
119
+ STOP
120
+
82
121
  # Neither available
83
122
  ELSE:
84
123
  OUTPUT: "JIRA not configured. Run `p. jira setup` first."
@@ -91,10 +130,11 @@ ELSE:
91
130
 
92
131
  ### Flow
93
132
 
94
- 1. **Detect available auth methods**
133
+ 1. **Install MCP + Detect auth mode**
95
134
  ```
96
- CHECK: JIRA_API_TOKEN env var
97
- CHECK: Atlassian MCP tools available
135
+ Execute Step 2 (auto-install MCP if needed)
136
+ Execute Step 3 (detect auth mode)
137
+ IF MCP not active: Prompt restart and STOP
98
138
  ```
99
139
 
100
140
  2. **If MCP available (preferred)**
@@ -5,6 +5,8 @@ description: 'Linear issue tracker integration via MCP'
5
5
 
6
6
  # p. linear - Linear Integration
7
7
 
8
+ **ARGUMENTS**: $ARGUMENTS
9
+
8
10
  Manage Linear issues directly from prjct using MCP (no SDK needed).
9
11
 
10
12
  ## Context Variables
@@ -50,16 +52,45 @@ IF file not found:
50
52
 
51
53
  ---
52
54
 
53
- ## Step 2: Check MCP Tools
55
+ ## Step 2: Install MCP Server (if needed)
56
+
57
+ ```
58
+ READ: ~/.claude/settings.json (create {} if not exists)
59
+ CHECK: Does mcpServers.linear exist?
60
+
61
+ IF not exists:
62
+ READ: templates/mcp-config.json
63
+ EXTRACT: mcpServers.linear
64
+
65
+ MERGE into ~/.claude/settings.json:
66
+ {
67
+ "mcpServers": {
68
+ "linear": {
69
+ "command": "npx",
70
+ "args": ["-y", "mcp-remote", "https://mcp.linear.app/mcp"]
71
+ }
72
+ }
73
+ }
74
+
75
+ WRITE: ~/.claude/settings.json
76
+
77
+ OUTPUT: "✅ Installed Linear MCP server"
78
+ OUTPUT: ""
79
+ OUTPUT: "⚠️ Restart Claude Code to activate the MCP server."
80
+ OUTPUT: "Then run `p. linear setup` again to complete configuration."
81
+ STOP
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Step 3: Check MCP Tools Available
54
87
 
55
88
  ```
56
89
  CHECK: Are mcp__linear__* tools available?
57
90
 
58
91
  IF not available:
59
- OUTPUT: "Linear MCP not configured."
60
- OUTPUT: "Add to ~/.claude/settings.json or .mcp.json:"
61
- OUTPUT: '{"mcpServers":{"linear":{"command":"npx","args":["-y","mcp-remote","https://mcp.linear.app/mcp"]}}}'
62
- OUTPUT: "Then restart Claude Code."
92
+ OUTPUT: "Linear MCP is installed but not yet active."
93
+ OUTPUT: "Restart Claude Code, then run `p. linear setup` again."
63
94
  STOP
64
95
  ```
65
96
 
@@ -69,10 +100,11 @@ IF not available:
69
100
 
70
101
  ### Flow
71
102
 
72
- 1. **Verify MCP tools available**
103
+ 1. **Install MCP + Verify tools available**
73
104
  ```
74
- CHECK: mcp__linear__* tools exist
75
- IF not: Show MCP config instructions, STOP
105
+ Execute Step 2 (auto-install if needed)
106
+ Execute Step 3 (verify tools active)
107
+ IF not available: Prompt restart and STOP
76
108
  ```
77
109
 
78
110
  2. **Test connection (triggers OAuth if needed)**