feat: Optimize Codex prompt commands parameter flexibility

- Enhanced 14 commands with flexible parameter support
- Standardized argument formats across all commands
- Added English parameter descriptions for clarity
- Maintained backward compatibility

Commands optimized:
- analyze-with-file: Added --depth, --max-iterations
- brainstorm-with-file: Added --perspectives, --max-ideas, --focus
- debug-with-file: Added --scope, --focus, --depth
- issue-execute: Unified format, added --skip-tests, --skip-build, --dry-run
- lite-plan-a/b/c: Added depth and execution control flags
- execute: Added --parallel, --filter, --skip-tests
- brainstorm-to-cycle: Unified to --session format, added --launch
- lite-fix: Added --hotfix, --severity, --scope
- clean: Added --focus, --target, --confirm
- lite-execute: Unified --plan format, added execution control
- compact: Added --description, --tags, --force
- issue-new: Complete flexible parameter support

Unchanged (already optimal):
- issue-plan, issue-discover, issue-queue, issue-discover-by-prompt
This commit is contained in:
catlog22
2026-01-29 11:29:39 +08:00
parent 04a84f9893
commit 3a7bbe0e42
14 changed files with 248 additions and 73 deletions

View File

@@ -1,19 +1,38 @@
---
description: Create structured issue from GitHub URL or text description
argument-hint: "<github-url | text-description> [--priority 1-5]"
description: Create structured issue from GitHub URL or text description. Auto mode with --yes flag.
argument-hint: "[--yes|-y] <GITHUB_URL | TEXT_DESCRIPTION> [--priority PRIORITY] [--labels LABELS]"
---
# Issue New
# Issue New Command
## Goal
## Core Principles
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.
**Core Principle**: Requirement Clarity Detection → Ask only when needed
**Requirement Clarity Detection** → Ask only when needed
**Flexible Parameter Input** → Support multiple formats and flags
**Auto Mode Support**`--yes`/`-y` skips confirmation questions
```
Clear Input (GitHub URL, structured text) → Direct creation
Unclear Input (vague description) → Minimal clarifying questions
Clear Input (GitHub URL, structured text) → Direct creation (no questions)
Unclear Input (vague description) → Clarifying questions (unless --yes)
Auto Mode (--yes or -y flag) → Skip all questions, use inference
```
## Parameter Formats
```bash
# GitHub URL (auto-detected)
/prompts:issue-new https://github.com/owner/repo/issues/123
/prompts:issue-new GH-123
# Text description with priority
/prompts:issue-new "Login fails with special chars" --priority 1
# Auto mode - skip all questions
/prompts:issue-new --yes "something broken"
/prompts:issue-new -y https://github.com/owner/repo/issues/456
# With labels
/prompts:issue-new "Database migration needed" --priority 2 --labels "enhancement,database"
```
## Issue Structure
@@ -78,25 +97,46 @@ echo '{"title":"...", "context":"...", "priority":3}' | ccw issue create
## Workflow
### Step 1: Analyze Input Clarity
### Phase 0: Parse Arguments & Flags
Parse and detect input type:
Extract parameters from user input:
```bash
# Input examples (Codex placeholders)
INPUT="$1" # GitHub URL or text description
AUTO_MODE="$2" # Check for --yes or -y flag
# Parse flags (comma-separated in single argument)
PRIORITY=$(echo "$INPUT" | grep -oP '(?<=--priority\s)\d+' || echo "3")
LABELS=$(echo "$INPUT" | grep -oP '(?<=--labels\s)\K[^-]*' | xargs)
AUTO_YES=$(echo "$INPUT" | grep -qE '--yes|-y' && echo "true" || echo "false")
# Extract main input (URL or text) - remove all flags
MAIN_INPUT=$(echo "$INPUT" | sed 's/\s*--priority\s*\d*//; s/\s*--labels\s*[^-]*//; s/\s*--yes\s*//; s/\s*-y\s*//' | xargs)
```
### Phase 1: Analyze Input & Clarity Detection
```javascript
// Detection patterns
const isGitHubUrl = input.match(/github\.com\/[\w-]+\/[\w-]+\/issues\/\d+/);
const isGitHubShort = input.match(/^#(\d+)$/);
const hasStructure = input.match(/(expected|actual|affects|steps):/i);
const mainInput = userInput.trim();
// Detect input type and clarity
const isGitHubUrl = mainInput.match(/github\.com\/[\w-]+\/[\w-]+\/issues\/\d+/);
const isGitHubShort = mainInput.match(/^GH-?\d+$/);
const hasStructure = mainInput.match(/(expected|actual|affects|steps):/i);
// Clarity score: 0-3
let clarityScore = 0;
if (isGitHubUrl || isGitHubShort) clarityScore = 3; // GitHub = fully clear
else if (hasStructure) clarityScore = 2; // Structured text = clear
else if (input.length > 50) clarityScore = 1; // Long text = somewhat clear
else if (mainInput.length > 50) clarityScore = 1; // Long text = somewhat clear
else clarityScore = 0; // Vague
// Auto mode override: if --yes/-y flag, skip all questions
const skipQuestions = process.env.AUTO_YES === 'true';
```
### Step 2: Extract Issue Data
### Phase 2: Extract Issue Data & Priority
**For GitHub URL/Short:**
@@ -104,13 +144,14 @@ else clarityScore = 0; // Vague
# Fetch issue details via gh CLI
gh issue view <issue-ref> --json number,title,body,labels,url
# Parse response
# Parse response with priority override
{
"id": "GH-123",
"title": "...",
"priority": $PRIORITY || 3, # Use --priority flag if provided
"source": "github",
"source_url": "https://github.com/...",
"labels": ["bug", "priority:high"],
"labels": $LABELS || [...existing labels],
"context": "..."
}
```
@@ -126,10 +167,12 @@ const expected = text.match(/expected:?\s*([^.]+)/i);
const actual = text.match(/actual:?\s*([^.]+)/i);
const affects = text.match(/affects?:?\s*([^.]+)/i);
// Build issue data
// Build issue data with flags
{
"id": id,
"title": text.split(/[.\n]/)[0].substring(0, 60),
"priority": $PRIORITY || 3, # From --priority flag
"labels": $LABELS?.split(',') || [], # From --labels flag
"source": "text",
"context": text.substring(0, 500),
"expected_behavior": expected?.[1]?.trim(),
@@ -137,7 +180,7 @@ const affects = text.match(/affects?:?\s*([^.]+)/i);
}
```
### Step 3: Context Hint (Conditional)
### Phase 3: Context Hint (Conditional)
For medium clarity (score 1-2) without affected components:
@@ -150,11 +193,13 @@ Add discovered files to `affected_components` (max 3 files).
**Note**: Skip this for GitHub issues (already have context) and vague inputs (needs clarification first).
### Step 4: Clarification (Only if Unclear)
### Phase 4: Conditional Clarification (Skip if Auto Mode)
**Only for clarity score < 2:**
**Only ask if**: clarity < 2 AND NOT in auto mode (skipQuestions = false)
Present a prompt asking for more details:
If auto mode (`--yes`/`-y`), proceed directly to creation with inferred details.
Otherwise, present minimal clarification:
```
Input unclear. Please describe:
@@ -165,17 +210,23 @@ Input unclear. Please describe:
Wait for user response, then update issue data.
### Step 5: GitHub Publishing Decision
### Phase 5: GitHub Publishing Decision (Skip if Already GitHub)
For non-GitHub sources, determine if user wants to publish to GitHub:
```
For non-GitHub sources AND NOT auto mode, ask:
```
Would you like to publish this issue to GitHub?
1. Yes, publish to GitHub (create issue and link it)
2. No, keep local only (store without GitHub sync)
```
### Step 6: Create Issue
In auto mode: Default to NO (keep local only, unless explicitly requested with --publish flag).
### Phase 6: Create Issue
**Create via CLI:**
@@ -198,7 +249,7 @@ GH_NUMBER=$(echo $GH_URL | grep -oE '/issues/([0-9]+)$' | grep -oE '[0-9]+')
ccw issue update ${ISSUE_ID} --github-url "${GH_URL}" --github-number ${GH_NUMBER}
```
### Step 7: Output Result
### Phase 7: Output Result
```markdown
## Issue Created
@@ -244,20 +295,96 @@ Before completing, verify:
## Start Execution
Parse input and detect clarity:
### Parameter Parsing (Phase 0)
```bash
# Get input from arguments
INPUT="${1}"
# Codex passes full input as $1
INPUT="$1"
# Detect if GitHub URL
if echo "${INPUT}" | grep -qE 'github\.com/.*/issues/[0-9]+'; then
echo "GitHub URL detected - fetching issue..."
gh issue view "${INPUT}" --json number,title,body,labels,url
else
echo "Text input detected - analyzing clarity..."
# Continue with text parsing
fi
# Extract flags
AUTO_YES=false
PRIORITY=3
LABELS=""
# Parse using parameter expansion
while [[ $INPUT == -* ]]; do
case $INPUT in
-y|--yes)
AUTO_YES=true
INPUT="${INPUT#* }" # Remove flag and space
;;
--priority)
PRIORITY="${INPUT#* }"
PRIORITY="${PRIORITY%% *}" # Extract next word
INPUT="${INPUT#*--priority $PRIORITY }"
;;
--labels)
LABELS="${INPUT#* }"
LABELS="${LABELS%% --*}" # Extract until next flag
INPUT="${INPUT#*--labels $LABELS }"
;;
*)
INPUT="${INPUT#* }"
;;
esac
done
# Remaining text is the main input (GitHub URL or description)
MAIN_INPUT="$INPUT"
```
Then follow the workflow based on detected input type.
### Execution Flow (All Phases)
```
1. Parse Arguments (Phase 0)
└─ Extract: AUTO_YES, PRIORITY, LABELS, MAIN_INPUT
2. Detect Input Type & Clarity (Phase 1)
├─ GitHub URL/Short? → Score 3 (clear)
├─ Structured text? → Score 2 (somewhat clear)
├─ Long text? → Score 1 (vague)
└─ Short text? → Score 0 (very vague)
3. Extract Issue Data (Phase 2)
├─ If GitHub: gh CLI fetch + parse
└─ If text: Parse structure + apply PRIORITY/LABELS flags
4. Context Hint (Phase 3, conditional)
└─ Only for clarity 1-2 AND no components → ACE search (max 3 files)
5. Clarification (Phase 4, conditional)
└─ If clarity < 2 AND NOT auto mode → Ask for details
└─ If auto mode (AUTO_YES=true) → Skip, use inferred data
6. GitHub Publishing (Phase 5, conditional)
├─ If source = github → Skip (already from GitHub)
└─ If source != github:
├─ If auto mode → Default NO (keep local)
└─ If manual → Ask user preference
7. Create Issue (Phase 6)
├─ Create local issue via ccw CLI
└─ If publishToGitHub → gh issue create → link
8. Output Result (Phase 7)
└─ Display: ID, title, source, GitHub status, next step
```
## Quick Examples
```bash
# Auto mode - GitHub issue (no questions)
/prompts:issue-new -y https://github.com/org/repo/issues/42
# Standard mode - text with priority
/prompts:issue-new "Database connection timeout" --priority 1
# Auto mode - text with priority and labels
/prompts:issue-new --yes "Add caching layer" --priority 2 --labels "enhancement,performance"
# GitHub short format
/prompts:issue-new GH-123
# Complex text description
/prompts:issue-new "User login fails. Expected: redirect to dashboard. Actual: 500 error"
```