claude-code-workflow 6.3.37 → 6.3.38

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 (146) hide show
  1. package/.claude/commands/workflow/lite-execute.md +2 -0
  2. package/.codex/agents/action-planning-agent.md +885 -0
  3. package/.codex/agents/ccw-loop-executor.md +260 -0
  4. package/.codex/agents/cli-discuss-agent.md +391 -0
  5. package/.codex/agents/cli-execution-agent.md +333 -0
  6. package/.codex/agents/cli-explore-agent.md +186 -0
  7. package/.codex/agents/cli-lite-planning-agent.md +736 -0
  8. package/.codex/agents/cli-planning-agent.md +562 -0
  9. package/.codex/agents/code-developer.md +408 -0
  10. package/.codex/agents/conceptual-planning-agent.md +321 -0
  11. package/.codex/agents/context-search-agent.md +585 -0
  12. package/.codex/agents/debug-explore-agent.md +436 -0
  13. package/.codex/agents/doc-generator.md +334 -0
  14. package/.codex/agents/issue-plan-agent.md +417 -0
  15. package/.codex/agents/issue-queue-agent.md +311 -0
  16. package/.codex/agents/memory-bridge.md +96 -0
  17. package/.codex/agents/test-context-search-agent.md +402 -0
  18. package/.codex/agents/test-fix-agent.md +359 -0
  19. package/.codex/agents/ui-design-agent.md +595 -0
  20. package/.codex/agents/universal-executor.md +135 -0
  21. package/.codex/prompts/issue-discover-by-prompt.md +364 -0
  22. package/.codex/prompts/issue-discover.md +261 -0
  23. package/.codex/prompts/issue-execute.md +10 -0
  24. package/.codex/prompts/issue-new.md +285 -0
  25. package/.codex/prompts/issue-plan.md +161 -63
  26. package/.codex/prompts/issue-queue.md +298 -288
  27. package/.codex/prompts/lite-execute.md +627 -133
  28. package/.codex/prompts/lite-fix.md +670 -0
  29. package/.codex/prompts/lite-plan-a.md +337 -0
  30. package/.codex/prompts/lite-plan-b.md +485 -0
  31. package/.codex/prompts/{lite-plan.md → lite-plan-c.md} +601 -469
  32. package/.codex/skills/ccw-loop/README.md +171 -0
  33. package/.codex/skills/ccw-loop/SKILL.md +349 -0
  34. package/.codex/skills/ccw-loop/phases/actions/action-complete.md +269 -0
  35. package/.codex/skills/ccw-loop/phases/actions/action-debug.md +286 -0
  36. package/.codex/skills/ccw-loop/phases/actions/action-develop.md +183 -0
  37. package/.codex/skills/ccw-loop/phases/actions/action-init.md +164 -0
  38. package/.codex/skills/ccw-loop/phases/actions/action-menu.md +205 -0
  39. package/.codex/skills/ccw-loop/phases/actions/action-validate.md +250 -0
  40. package/.codex/skills/ccw-loop/phases/orchestrator.md +416 -0
  41. package/.codex/skills/ccw-loop/phases/state-schema.md +388 -0
  42. package/.codex/skills/ccw-loop/specs/action-catalog.md +182 -0
  43. package/.codex/skills/ccw-loop-b/README.md +102 -0
  44. package/.codex/skills/ccw-loop-b/SKILL.md +322 -0
  45. package/.codex/skills/ccw-loop-b/phases/orchestrator.md +257 -0
  46. package/.codex/skills/ccw-loop-b/phases/state-schema.md +181 -0
  47. package/ccw/dist/cli.d.ts.map +1 -1
  48. package/ccw/dist/cli.js +4 -0
  49. package/ccw/dist/cli.js.map +1 -1
  50. package/ccw/dist/commands/install.d.ts.map +1 -1
  51. package/ccw/dist/commands/install.js +38 -7
  52. package/ccw/dist/commands/install.js.map +1 -1
  53. package/ccw/dist/commands/issue.d.ts +3 -0
  54. package/ccw/dist/commands/issue.d.ts.map +1 -1
  55. package/ccw/dist/commands/issue.js +107 -0
  56. package/ccw/dist/commands/issue.js.map +1 -1
  57. package/ccw/dist/commands/upgrade.js +1 -1
  58. package/ccw/dist/commands/upgrade.js.map +1 -1
  59. package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -1
  60. package/ccw/dist/config/litellm-api-config-manager.js +3 -2
  61. package/ccw/dist/config/litellm-api-config-manager.js.map +1 -1
  62. package/ccw/dist/core/memory-embedder-bridge.d.ts.map +1 -1
  63. package/ccw/dist/core/memory-embedder-bridge.js +2 -5
  64. package/ccw/dist/core/memory-embedder-bridge.js.map +1 -1
  65. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  66. package/ccw/dist/core/routes/codexlens/config-handlers.d.ts.map +1 -1
  67. package/ccw/dist/core/routes/codexlens/config-handlers.js +7 -6
  68. package/ccw/dist/core/routes/codexlens/config-handlers.js.map +1 -1
  69. package/ccw/dist/core/routes/codexlens/semantic-handlers.d.ts.map +1 -1
  70. package/ccw/dist/core/routes/codexlens/semantic-handlers.js +2 -2
  71. package/ccw/dist/core/routes/codexlens/semantic-handlers.js.map +1 -1
  72. package/ccw/dist/core/routes/graph-routes.d.ts.map +1 -1
  73. package/ccw/dist/core/routes/graph-routes.js +17 -2
  74. package/ccw/dist/core/routes/graph-routes.js.map +1 -1
  75. package/ccw/dist/core/routes/issue-routes.d.ts.map +1 -1
  76. package/ccw/dist/core/routes/issue-routes.js +280 -33
  77. package/ccw/dist/core/routes/issue-routes.js.map +1 -1
  78. package/ccw/dist/core/routes/loop-v2-routes.d.ts +9 -0
  79. package/ccw/dist/core/routes/loop-v2-routes.d.ts.map +1 -1
  80. package/ccw/dist/core/routes/loop-v2-routes.js +56 -4
  81. package/ccw/dist/core/routes/loop-v2-routes.js.map +1 -1
  82. package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
  83. package/ccw/dist/core/routes/system-routes.js +3 -2
  84. package/ccw/dist/core/routes/system-routes.js.map +1 -1
  85. package/ccw/dist/core/server.d.ts.map +1 -1
  86. package/ccw/dist/core/server.js +5 -3
  87. package/ccw/dist/core/server.js.map +1 -1
  88. package/ccw/dist/tools/codex-lens-lsp.d.ts.map +1 -1
  89. package/ccw/dist/tools/codex-lens-lsp.js +2 -5
  90. package/ccw/dist/tools/codex-lens-lsp.js.map +1 -1
  91. package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
  92. package/ccw/dist/tools/codex-lens.js +22 -32
  93. package/ccw/dist/tools/codex-lens.js.map +1 -1
  94. package/ccw/dist/tools/litellm-client.d.ts +6 -0
  95. package/ccw/dist/tools/litellm-client.d.ts.map +1 -1
  96. package/ccw/dist/tools/litellm-client.js +15 -2
  97. package/ccw/dist/tools/litellm-client.js.map +1 -1
  98. package/ccw/dist/tools/loop-task-manager.d.ts +13 -2
  99. package/ccw/dist/tools/loop-task-manager.d.ts.map +1 -1
  100. package/ccw/dist/tools/loop-task-manager.js.map +1 -1
  101. package/ccw/dist/tools/native-session-discovery.d.ts.map +1 -1
  102. package/ccw/dist/tools/native-session-discovery.js +35 -7
  103. package/ccw/dist/tools/native-session-discovery.js.map +1 -1
  104. package/ccw/dist/utils/codexlens-path.d.ts +36 -0
  105. package/ccw/dist/utils/codexlens-path.d.ts.map +1 -0
  106. package/ccw/dist/utils/codexlens-path.js +56 -0
  107. package/ccw/dist/utils/codexlens-path.js.map +1 -0
  108. package/ccw/dist/utils/uv-manager.d.ts.map +1 -1
  109. package/ccw/dist/utils/uv-manager.js +3 -2
  110. package/ccw/dist/utils/uv-manager.js.map +1 -1
  111. package/ccw/src/cli.ts +4 -0
  112. package/ccw/src/commands/install.ts +50 -7
  113. package/ccw/src/commands/issue.ts +119 -0
  114. package/ccw/src/commands/upgrade.ts +1 -1
  115. package/ccw/src/config/litellm-api-config-manager.ts +3 -2
  116. package/ccw/src/core/memory-embedder-bridge.ts +2 -6
  117. package/ccw/src/core/routes/cli-routes.ts +1 -1
  118. package/ccw/src/core/routes/codexlens/config-handlers.ts +7 -6
  119. package/ccw/src/core/routes/codexlens/semantic-handlers.ts +2 -2
  120. package/ccw/src/core/routes/graph-routes.ts +18 -2
  121. package/ccw/src/core/routes/issue-routes.ts +308 -33
  122. package/ccw/src/core/routes/loop-v2-routes.ts +64 -6
  123. package/ccw/src/core/routes/system-routes.ts +3 -2
  124. package/ccw/src/core/server.ts +6 -3
  125. package/ccw/src/templates/dashboard-css/02-session.css +2 -0
  126. package/ccw/src/templates/dashboard-css/04-lite-tasks.css +103 -1
  127. package/ccw/src/templates/dashboard-css/32-issue-manager.css +32 -0
  128. package/ccw/src/templates/dashboard-js/components/cli-history.js +48 -48
  129. package/ccw/src/templates/dashboard-js/components/navigation.js +6 -0
  130. package/ccw/src/templates/dashboard-js/components/notifications.js +6 -0
  131. package/ccw/src/templates/dashboard-js/components/version-check.js +38 -0
  132. package/ccw/src/templates/dashboard-js/i18n.js +126 -0
  133. package/ccw/src/templates/dashboard-js/state.js +2 -0
  134. package/ccw/src/templates/dashboard-js/views/cli-manager.js +1 -1
  135. package/ccw/src/templates/dashboard-js/views/issue-manager.js +183 -1
  136. package/ccw/src/templates/dashboard-js/views/lite-tasks.js +55 -11
  137. package/ccw/src/templates/dashboard-js/views/loop-monitor.js +112 -11
  138. package/ccw/src/templates/dashboard.html +48 -2
  139. package/ccw/src/tools/codex-lens-lsp.ts +2 -5
  140. package/ccw/src/tools/codex-lens.ts +27 -38
  141. package/ccw/src/tools/litellm-client.ts +16 -2
  142. package/ccw/src/tools/loop-task-manager.ts +13 -2
  143. package/ccw/src/tools/native-session-discovery.ts +38 -7
  144. package/ccw/src/utils/codexlens-path.ts +60 -0
  145. package/ccw/src/utils/uv-manager.ts +3 -2
  146. package/package.json +1 -1
@@ -0,0 +1,261 @@
1
+ ---
2
+ description: Discover potential issues from multiple perspectives (bug, UX, test, quality, security, performance, maintainability, best-practices)
3
+ argument-hint: "<path-pattern> [--perspectives=bug,ux,...] [--external]"
4
+ ---
5
+
6
+ # Issue Discovery (Codex Version)
7
+
8
+ ## Goal
9
+
10
+ Multi-perspective issue discovery that explores code from different angles to identify potential bugs, UX improvements, test gaps, and other actionable items. Unlike code review (which assesses existing code quality), discovery focuses on **finding opportunities for improvement and potential problems**.
11
+
12
+ **Discovery Scope**: Specified modules/files only
13
+ **Output Directory**: `.workflow/issues/discoveries/{discovery-id}/`
14
+ **Available Perspectives**: bug, ux, test, quality, security, performance, maintainability, best-practices
15
+
16
+ ## Inputs
17
+
18
+ - **Target Pattern**: File glob pattern (e.g., `src/auth/**`)
19
+ - **Perspectives**: Comma-separated list via `--perspectives` (or interactive selection)
20
+ - **External Research**: `--external` flag enables Exa research for security and best-practices
21
+
22
+ ## Output Requirements
23
+
24
+ **Generate Files:**
25
+ 1. `.workflow/issues/discoveries/{discovery-id}/discovery-state.json` - Session state
26
+ 2. `.workflow/issues/discoveries/{discovery-id}/perspectives/{perspective}.json` - Per-perspective findings
27
+ 3. `.workflow/issues/discoveries/{discovery-id}/discovery-issues.jsonl` - Generated issue candidates
28
+ 4. `.workflow/issues/discoveries/{discovery-id}/summary.md` - Summary report
29
+
30
+ **Return Summary:**
31
+ ```json
32
+ {
33
+ "discovery_id": "DSC-YYYYMMDD-HHmmss",
34
+ "target_pattern": "src/auth/**",
35
+ "perspectives_analyzed": ["bug", "security", "test"],
36
+ "total_findings": 15,
37
+ "issues_generated": 8,
38
+ "priority_distribution": { "critical": 1, "high": 3, "medium": 4 }
39
+ }
40
+ ```
41
+
42
+ ## Workflow
43
+
44
+ ### Step 1: Initialize Discovery Session
45
+
46
+ ```bash
47
+ # Generate discovery ID
48
+ DISCOVERY_ID="DSC-$(date -u +%Y%m%d-%H%M%S)"
49
+ OUTPUT_DIR=".workflow/issues/discoveries/${DISCOVERY_ID}"
50
+
51
+ # Create directory structure
52
+ mkdir -p "${OUTPUT_DIR}/perspectives"
53
+ ```
54
+
55
+ Resolve target files:
56
+ ```bash
57
+ # List files matching pattern
58
+ find <target-pattern> -type f -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx"
59
+ ```
60
+
61
+ If no files found, abort with error message.
62
+
63
+ ### Step 2: Select Perspectives
64
+
65
+ **If `--perspectives` provided:**
66
+ - Parse comma-separated list
67
+ - Validate against available perspectives
68
+
69
+ **If not provided (interactive):**
70
+ - Present perspective groups:
71
+ - Quick scan: bug, test, quality
72
+ - Security audit: security, bug, quality
73
+ - Full analysis: all perspectives
74
+ - Use first group as default or wait for user input
75
+
76
+ ### Step 3: Analyze Each Perspective
77
+
78
+ For each selected perspective, explore target files and identify issues.
79
+
80
+ **Perspective-Specific Focus:**
81
+
82
+ | Perspective | Focus Areas | Priority Guide |
83
+ |-------------|-------------|----------------|
84
+ | **bug** | Null checks, edge cases, resource leaks, race conditions, boundary conditions, exception handling | Critical=data corruption/crash, High=malfunction, Medium=edge case |
85
+ | **ux** | Error messages, loading states, feedback, accessibility, interaction patterns | Critical=inaccessible, High=confusing, Medium=inconsistent |
86
+ | **test** | Missing unit tests, edge case coverage, integration gaps, assertion quality | Critical=no security tests, High=no core logic tests |
87
+ | **quality** | Complexity, duplication, naming, documentation, code smells | Critical=unmaintainable, High=significant issues |
88
+ | **security** | Input validation, auth/authz, injection, XSS/CSRF, data exposure | Critical=auth bypass/injection, High=missing authz |
89
+ | **performance** | N+1 queries, memory leaks, caching, algorithm efficiency | Critical=memory leaks, High=N+1 queries |
90
+ | **maintainability** | Coupling, interface design, tech debt, extensibility | Critical=forced changes, High=unclear boundaries |
91
+ | **best-practices** | Framework conventions, language patterns, anti-patterns | Critical=bug-causing anti-patterns, High=convention violations |
92
+
93
+ **For each perspective:**
94
+
95
+ 1. Read target files and analyze for perspective-specific concerns
96
+ 2. Use `rg` to search for patterns indicating issues
97
+ 3. Record findings with:
98
+ - `id`: Finding ID (e.g., `F-001`)
99
+ - `title`: Brief description
100
+ - `priority`: critical/high/medium/low
101
+ - `category`: Specific category within perspective
102
+ - `description`: Detailed explanation
103
+ - `file`: File path
104
+ - `line`: Line number
105
+ - `snippet`: Code snippet
106
+ - `suggested_issue`: Proposed issue text
107
+ - `confidence`: 0.0-1.0
108
+
109
+ 4. Write to `{OUTPUT_DIR}/perspectives/{perspective}.json`:
110
+ ```json
111
+ {
112
+ "perspective": "security",
113
+ "analyzed_at": "2025-01-22T...",
114
+ "files_analyzed": 15,
115
+ "findings": [
116
+ {
117
+ "id": "F-001",
118
+ "title": "Missing input validation",
119
+ "priority": "high",
120
+ "category": "input-validation",
121
+ "description": "User input is passed directly to database query",
122
+ "file": "src/auth/login.ts",
123
+ "line": 42,
124
+ "snippet": "db.query(`SELECT * FROM users WHERE name = '${input}'`)",
125
+ "suggested_issue": "Add input sanitization to prevent SQL injection",
126
+ "confidence": 0.95
127
+ }
128
+ ]
129
+ }
130
+ ```
131
+
132
+ ### Step 4: External Research (if --external)
133
+
134
+ For security and best-practices perspectives, use Exa to search for:
135
+ - Industry best practices for the tech stack
136
+ - Known vulnerability patterns
137
+ - Framework-specific security guidelines
138
+
139
+ Write results to `{OUTPUT_DIR}/external-research.json`.
140
+
141
+ ### Step 5: Aggregate and Prioritize
142
+
143
+ 1. Load all perspective JSON files
144
+ 2. Deduplicate findings by file+line
145
+ 3. Calculate priority scores:
146
+ - critical: 1.0
147
+ - high: 0.8
148
+ - medium: 0.5
149
+ - low: 0.2
150
+ - Adjust by confidence
151
+
152
+ 4. Sort by priority score descending
153
+
154
+ ### Step 6: Generate Issues
155
+
156
+ Convert high-priority findings to issue format:
157
+
158
+ ```bash
159
+ # Append to discovery-issues.jsonl
160
+ echo '{"id":"ISS-DSC-001","title":"...","priority":"high",...}' >> ${OUTPUT_DIR}/discovery-issues.jsonl
161
+ ```
162
+
163
+ Issue criteria:
164
+ - `priority` is critical or high
165
+ - OR `priority_score >= 0.7`
166
+ - OR `confidence >= 0.9` with medium priority
167
+
168
+ ### Step 7: Update Discovery State
169
+
170
+ Write final state to `{OUTPUT_DIR}/discovery-state.json`:
171
+ ```json
172
+ {
173
+ "discovery_id": "DSC-...",
174
+ "target_pattern": "src/auth/**",
175
+ "phase": "complete",
176
+ "created_at": "...",
177
+ "updated_at": "...",
178
+ "perspectives": ["bug", "security", "test"],
179
+ "results": {
180
+ "total_findings": 15,
181
+ "issues_generated": 8,
182
+ "priority_distribution": {
183
+ "critical": 1,
184
+ "high": 3,
185
+ "medium": 4
186
+ }
187
+ }
188
+ }
189
+ ```
190
+
191
+ ### Step 8: Generate Summary
192
+
193
+ Write summary to `{OUTPUT_DIR}/summary.md`:
194
+ ```markdown
195
+ # Discovery Summary: DSC-...
196
+
197
+ **Target**: src/auth/**
198
+ **Perspectives**: bug, security, test
199
+ **Total Findings**: 15
200
+ **Issues Generated**: 8
201
+
202
+ ## Priority Breakdown
203
+ - Critical: 1
204
+ - High: 3
205
+ - Medium: 4
206
+
207
+ ## Top Findings
208
+
209
+ 1. **[Critical] SQL Injection in login.ts:42**
210
+ Category: security/input-validation
211
+ ...
212
+
213
+ 2. **[High] Missing null check in auth.ts:128**
214
+ Category: bug/null-check
215
+ ...
216
+
217
+ ## Next Steps
218
+ - Run `/issue:plan` to plan solutions for generated issues
219
+ - Use `ccw view` to review findings in dashboard
220
+ ```
221
+
222
+ ## Quality Checklist
223
+
224
+ Before completing, verify:
225
+
226
+ - [ ] All target files analyzed for selected perspectives
227
+ - [ ] Findings include file:line references
228
+ - [ ] Priority assigned to all findings
229
+ - [ ] Issues generated from high-priority findings
230
+ - [ ] Discovery state shows `phase: complete`
231
+ - [ ] Summary includes actionable next steps
232
+
233
+ ## Error Handling
234
+
235
+ | Situation | Action |
236
+ |-----------|--------|
237
+ | No files match pattern | Abort with clear error message |
238
+ | Perspective analysis fails | Log error, continue with other perspectives |
239
+ | No findings | Report "No issues found" (not an error) |
240
+ | External research fails | Continue without external context |
241
+
242
+ ## Schema References
243
+
244
+ | Schema | Path | Purpose |
245
+ |--------|------|---------|
246
+ | Discovery State | `~/.claude/workflows/cli-templates/schemas/discovery-state-schema.json` | Session state |
247
+ | Discovery Finding | `~/.claude/workflows/cli-templates/schemas/discovery-finding-schema.json` | Finding format |
248
+
249
+ ## Start Discovery
250
+
251
+ Begin by resolving target files:
252
+
253
+ ```bash
254
+ # Parse target pattern from arguments
255
+ TARGET_PATTERN="${1:-src/**}"
256
+
257
+ # Count matching files
258
+ find ${TARGET_PATTERN} -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" \) | wc -l
259
+ ```
260
+
261
+ Then proceed with perspective selection and analysis.
@@ -9,6 +9,16 @@ argument-hint: "--queue <queue-id> [--worktree [<existing-path>]]"
9
9
 
10
10
  **Serial Execution**: Execute solutions ONE BY ONE from the issue queue via `ccw issue next`. For each solution, complete all tasks sequentially (implement → test → verify), then commit once per solution with formatted summary. Continue autonomously until queue is empty.
11
11
 
12
+ ## Project Context (MANDATORY FIRST STEPS)
13
+
14
+ Before starting execution, load project context:
15
+
16
+ 1. **Read project tech stack**: `.workflow/project-tech.json`
17
+ 2. **Read project guidelines**: `.workflow/project-guidelines.json`
18
+ 3. **Read solution schema**: `~/.claude/workflows/cli-templates/schemas/solution-schema.json`
19
+
20
+ This ensures execution follows project conventions and patterns.
21
+
12
22
  ## Queue ID Requirement (MANDATORY)
13
23
 
14
24
  **`--queue <queue-id>` parameter is REQUIRED**
@@ -0,0 +1,285 @@
1
+ ---
2
+ description: Create structured issue from GitHub URL or text description
3
+ argument-hint: "<github-url | text-description> [--priority 1-5]"
4
+ ---
5
+
6
+ # Issue New (Codex Version)
7
+
8
+ ## Goal
9
+
10
+ Create a new issue from a GitHub URL or text description. Detect input clarity and ask clarifying questions only when necessary. Register the issue for planning.
11
+
12
+ **Core Principle**: Requirement Clarity Detection → Ask only when needed
13
+
14
+ ```
15
+ Clear Input (GitHub URL, structured text) → Direct creation
16
+ Unclear Input (vague description) → Minimal clarifying questions
17
+ ```
18
+
19
+ ## Issue Structure
20
+
21
+ ```typescript
22
+ interface Issue {
23
+ id: string; // GH-123 or ISS-YYYYMMDD-HHMMSS
24
+ title: string;
25
+ status: 'registered' | 'planned' | 'queued' | 'in_progress' | 'completed' | 'failed';
26
+ priority: number; // 1 (critical) to 5 (low)
27
+ context: string; // Problem description
28
+ source: 'github' | 'text' | 'discovery';
29
+ source_url?: string;
30
+ labels?: string[];
31
+
32
+ // GitHub binding (for non-GitHub sources that publish to GitHub)
33
+ github_url?: string;
34
+ github_number?: number;
35
+
36
+ // Optional structured fields
37
+ expected_behavior?: string;
38
+ actual_behavior?: string;
39
+ affected_components?: string[];
40
+
41
+ // Solution binding
42
+ bound_solution_id: string | null;
43
+
44
+ // Timestamps
45
+ created_at: string;
46
+ updated_at: string;
47
+ }
48
+ ```
49
+
50
+ ## Inputs
51
+
52
+ - **GitHub URL**: `https://github.com/owner/repo/issues/123` or `#123`
53
+ - **Text description**: Natural language description
54
+ - **Priority flag**: `--priority 1-5` (optional, default: 3)
55
+
56
+ ## Output Requirements
57
+
58
+ **Create Issue via CLI** (preferred method):
59
+ ```bash
60
+ # Pipe input (recommended for complex JSON)
61
+ echo '{"title":"...", "context":"...", "priority":3}' | ccw issue create
62
+
63
+ # Returns created issue JSON
64
+ {"id":"ISS-20251229-001","title":"...","status":"registered",...}
65
+ ```
66
+
67
+ **Return Summary:**
68
+ ```json
69
+ {
70
+ "created": true,
71
+ "id": "ISS-20251229-001",
72
+ "title": "Login fails with special chars",
73
+ "source": "text",
74
+ "github_published": false,
75
+ "next_step": "/issue:plan ISS-20251229-001"
76
+ }
77
+ ```
78
+
79
+ ## Workflow
80
+
81
+ ### Step 1: Analyze Input Clarity
82
+
83
+ Parse and detect input type:
84
+
85
+ ```javascript
86
+ // Detection patterns
87
+ const isGitHubUrl = input.match(/github\.com\/[\w-]+\/[\w-]+\/issues\/\d+/);
88
+ const isGitHubShort = input.match(/^#(\d+)$/);
89
+ const hasStructure = input.match(/(expected|actual|affects|steps):/i);
90
+
91
+ // Clarity score: 0-3
92
+ let clarityScore = 0;
93
+ if (isGitHubUrl || isGitHubShort) clarityScore = 3; // GitHub = fully clear
94
+ else if (hasStructure) clarityScore = 2; // Structured text = clear
95
+ else if (input.length > 50) clarityScore = 1; // Long text = somewhat clear
96
+ else clarityScore = 0; // Vague
97
+ ```
98
+
99
+ ### Step 2: Extract Issue Data
100
+
101
+ **For GitHub URL/Short:**
102
+
103
+ ```bash
104
+ # Fetch issue details via gh CLI
105
+ gh issue view <issue-ref> --json number,title,body,labels,url
106
+
107
+ # Parse response
108
+ {
109
+ "id": "GH-123",
110
+ "title": "...",
111
+ "source": "github",
112
+ "source_url": "https://github.com/...",
113
+ "labels": ["bug", "priority:high"],
114
+ "context": "..."
115
+ }
116
+ ```
117
+
118
+ **For Text Description:**
119
+
120
+ ```javascript
121
+ // Generate issue ID
122
+ const id = `ISS-${new Date().toISOString().replace(/[-:T]/g, '').slice(0, 14)}`;
123
+
124
+ // Parse structured fields if present
125
+ const expected = text.match(/expected:?\s*([^.]+)/i);
126
+ const actual = text.match(/actual:?\s*([^.]+)/i);
127
+ const affects = text.match(/affects?:?\s*([^.]+)/i);
128
+
129
+ // Build issue data
130
+ {
131
+ "id": id,
132
+ "title": text.split(/[.\n]/)[0].substring(0, 60),
133
+ "source": "text",
134
+ "context": text.substring(0, 500),
135
+ "expected_behavior": expected?.[1]?.trim(),
136
+ "actual_behavior": actual?.[1]?.trim()
137
+ }
138
+ ```
139
+
140
+ ### Step 3: Context Hint (Conditional)
141
+
142
+ For medium clarity (score 1-2) without affected components:
143
+
144
+ ```bash
145
+ # Use rg to find potentially related files
146
+ rg -l "<keyword>" --type ts | head -5
147
+ ```
148
+
149
+ Add discovered files to `affected_components` (max 3 files).
150
+
151
+ **Note**: Skip this for GitHub issues (already have context) and vague inputs (needs clarification first).
152
+
153
+ ### Step 4: Clarification (Only if Unclear)
154
+
155
+ **Only for clarity score < 2:**
156
+
157
+ Present a prompt asking for more details:
158
+
159
+ ```
160
+ Input unclear. Please describe:
161
+ - What is the issue about?
162
+ - Where does it occur?
163
+ - What is the expected behavior?
164
+ ```
165
+
166
+ Wait for user response, then update issue data.
167
+
168
+ ### Step 5: GitHub Publishing Decision
169
+
170
+ For non-GitHub sources, determine if user wants to publish to GitHub:
171
+
172
+ ```
173
+ Would you like to publish this issue to GitHub?
174
+ 1. Yes, publish to GitHub (create issue and link it)
175
+ 2. No, keep local only (store without GitHub sync)
176
+ ```
177
+
178
+ ### Step 6: Create Issue
179
+
180
+ **Create via CLI:**
181
+
182
+ ```bash
183
+ # Build issue JSON
184
+ ISSUE_JSON='{"title":"...","context":"...","priority":3,"source":"text"}'
185
+
186
+ # Create issue (auto-generates ID)
187
+ echo "${ISSUE_JSON}" | ccw issue create
188
+ ```
189
+
190
+ **If publishing to GitHub:**
191
+
192
+ ```bash
193
+ # Create on GitHub first
194
+ GH_URL=$(gh issue create --title "..." --body "..." | grep -oE 'https://github.com/[^ ]+')
195
+ GH_NUMBER=$(echo $GH_URL | grep -oE '/issues/([0-9]+)$' | grep -oE '[0-9]+')
196
+
197
+ # Update local issue with binding
198
+ ccw issue update ${ISSUE_ID} --github-url "${GH_URL}" --github-number ${GH_NUMBER}
199
+ ```
200
+
201
+ ### Step 7: Output Result
202
+
203
+ ```markdown
204
+ ## Issue Created
205
+
206
+ **ID**: ISS-20251229-001
207
+ **Title**: Login fails with special chars
208
+ **Source**: text
209
+ **Priority**: 2 (High)
210
+
211
+ **Context**:
212
+ 500 error when password contains quotes
213
+
214
+ **Affected Components**:
215
+ - src/auth/login.ts
216
+ - src/utils/validation.ts
217
+
218
+ **GitHub**: Not published (local only)
219
+
220
+ **Next Step**: `/issue:plan ISS-20251229-001`
221
+ ```
222
+
223
+ ## Quality Checklist
224
+
225
+ Before completing, verify:
226
+
227
+ - [ ] Issue ID generated correctly (GH-xxx or ISS-YYYYMMDD-HHMMSS)
228
+ - [ ] Title extracted (max 60 chars)
229
+ - [ ] Context captured (problem description)
230
+ - [ ] Priority assigned (1-5)
231
+ - [ ] Status set to `registered`
232
+ - [ ] Created via `ccw issue create` CLI command
233
+
234
+ ## Error Handling
235
+
236
+ | Situation | Action |
237
+ |-----------|--------|
238
+ | GitHub URL not accessible | Report error, suggest text input |
239
+ | gh CLI not available | Fall back to text-based creation |
240
+ | Empty input | Prompt for description |
241
+ | Very vague input | Ask clarifying questions |
242
+ | Issue already exists | Report duplicate, show existing |
243
+
244
+ ## Examples
245
+
246
+ ### Clear Input (No Questions)
247
+
248
+ ```bash
249
+ # GitHub URL
250
+ codex -p "@.codex/prompts/issue-new.md https://github.com/org/repo/issues/42"
251
+ # → Fetches, parses, creates immediately
252
+
253
+ # Structured text
254
+ codex -p "@.codex/prompts/issue-new.md 'Login fails with special chars. Expected: success. Actual: 500'"
255
+ # → Parses structure, creates immediately
256
+ ```
257
+
258
+ ### Vague Input (Clarification)
259
+
260
+ ```bash
261
+ codex -p "@.codex/prompts/issue-new.md 'auth broken'"
262
+ # → Asks: "Please describe the issue in more detail"
263
+ # → User provides details
264
+ # → Creates issue
265
+ ```
266
+
267
+ ## Start Execution
268
+
269
+ Parse input and detect clarity:
270
+
271
+ ```bash
272
+ # Get input from arguments
273
+ INPUT="${1}"
274
+
275
+ # Detect if GitHub URL
276
+ if echo "${INPUT}" | grep -qE 'github\.com/.*/issues/[0-9]+'; then
277
+ echo "GitHub URL detected - fetching issue..."
278
+ gh issue view "${INPUT}" --json number,title,body,labels,url
279
+ else
280
+ echo "Text input detected - analyzing clarity..."
281
+ # Continue with text parsing
282
+ fi
283
+ ```
284
+
285
+ Then follow the workflow based on detected input type.