fix: 为所有 skill 的 .workflow/ 路径添加 projectRoot 前缀

从子目录执行 skill 时,相对路径 .workflow/ 会导致产物落到错误位置。
通过 git rev-parse --show-toplevel || pwd 检测项目根目录,
所有 .workflow/ 路径引用统一加上 {projectRoot} 前缀确保路径正确。

涉及 72 个文件,覆盖 20+ 个 skill。
This commit is contained in:
catlog22
2026-02-08 13:46:48 +08:00
parent 71faaf43a8
commit 54c3234d84
72 changed files with 904 additions and 482 deletions

View File

@@ -53,8 +53,8 @@ const agentId = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/{agent-type}.md (MUST read first)
2. Read: .workflow/project-tech.json
3. Read: .workflow/project-guidelines.json
2. Read: {projectRoot}/.workflow/project-tech.json
3. Read: {projectRoot}/.workflow/project-guidelines.json
## TASK CONTEXT
${taskContext}

View File

@@ -13,7 +13,7 @@ Batch plan issue resolution using **issue-plan-agent** that combines exploration
- Issue IDs provided (comma-separated) or `--all-pending` flag
- `ccw issue` CLI available
- `.workflow/issues/` directory exists or will be created
- `{projectRoot}/.workflow/issues/` directory exists or will be created
## Auto Mode
@@ -95,7 +95,7 @@ update_plan({
### Step 1.2: Unified Explore + Plan (issue-plan-agent) - PARALLEL
```javascript
Bash(`mkdir -p .workflow/issues/solutions`);
Bash(`mkdir -p ${projectRoot}/.workflow/issues/solutions`);
const pendingSelections = []; // Collect multi-solution issues for user selection
const agentResults = []; // Collect all agent results for conflict aggregation
@@ -109,8 +109,8 @@ const agentTasks = batches.map((batch, batchIndex) => {
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/issue-plan-agent.md (MUST read first)
2. Read: .workflow/project-tech.json
3. Read: .workflow/project-guidelines.json
2. Read: {projectRoot}/.workflow/project-tech.json
3. Read: {projectRoot}/.workflow/project-guidelines.json
---
@@ -122,8 +122,8 @@ ${issueList}
**Project Root**: ${process.cwd()}
### Project Context (MANDATORY)
1. Read: .workflow/project-tech.json (technology stack, architecture)
2. Read: .workflow/project-guidelines.json (constraints and conventions)
1. Read: {projectRoot}/.workflow/project-tech.json (technology stack, architecture)
2. Read: {projectRoot}/.workflow/project-guidelines.json (constraints and conventions)
### Workflow
1. Fetch issue details: ccw issue status <id> --json
@@ -138,7 +138,7 @@ ${issueList}
- **If previous solution failed**: Reference failure analysis in solution.approach
- Add explicit verification steps to prevent same failure mode
6. **If github_url exists**: Add final task to comment on GitHub issue
7. Write solution to: .workflow/issues/solutions/{issue-id}.jsonl
7. Write solution to: ${projectRoot}/.workflow/issues/solutions/{issue-id}.jsonl
8. **CRITICAL - Binding Decision**:
- Single solution → **MUST execute**: ccw issue bind <issue-id> <solution-id>
- Multiple solutions → Return pending_selection only (no bind)

View File

@@ -5,8 +5,8 @@
Converts various planning artifact formats into issue workflow solutions with intelligent detection and automatic binding.
**Supported Sources** (auto-detected):
- **lite-plan**: `.workflow/.lite-plan/{slug}/plan.json`
- **workflow-session**: `WFS-xxx` ID or `.workflow/active/{session}/` folder
- **lite-plan**: `{projectRoot}/.workflow/.lite-plan/{slug}/plan.json`
- **workflow-session**: `WFS-xxx` ID or `{projectRoot}/.workflow/active/{session}/` folder
- **markdown**: Any `.md` file with implementation/task content
- **json**: Direct JSON files matching plan-json-schema
@@ -14,7 +14,7 @@ Converts various planning artifact formats into issue workflow solutions with in
- Source artifact path or WFS-xxx ID provided
- `ccw issue` CLI available
- `.workflow/issues/` directory exists or will be created
- `{projectRoot}/.workflow/issues/` directory exists or will be created
## Auto Mode
@@ -91,7 +91,7 @@ const source = extractSourceArg(input);
function detectSourceType(source) {
// Check for WFS-xxx pattern (workflow session ID)
if (source.match(/^WFS-[\w-]+$/)) {
return { type: 'workflow-session-id', path: `.workflow/active/${source}` };
return { type: 'workflow-session-id', path: `${projectRoot}/.workflow/active/${source}` };
}
// Check if directory
@@ -591,9 +591,9 @@ if (!flags.yes && !flags.y) {
}
// Persist solution (following issue-plan-agent pattern)
Bash(`mkdir -p .workflow/issues/solutions`);
Bash(`mkdir -p ${projectRoot}/.workflow/issues/solutions`);
const solutionFile = `.workflow/issues/solutions/${issueId}.jsonl`;
const solutionFile = `${projectRoot}/.workflow/issues/solutions/${issueId}.jsonl`;
if (flags.supplement) {
// Supplement mode: update existing solution line atomically
@@ -686,6 +686,6 @@ console.log(`
After conversion completion:
- Issue created/updated with `status: planned` and `bound_solution_id` set
- Solution persisted in `.workflow/issues/solutions/{issue-id}.jsonl`
- Solution persisted in `{projectRoot}/.workflow/issues/solutions/{issue-id}.jsonl`
- Report: issue ID, solution ID, task count, mode (new/supplement)
- Recommend next step: Form execution queue via Phase 4

View File

@@ -29,7 +29,7 @@ When `--yes` or `-y`: Auto-select highest-scored idea, skip confirmations, creat
| Argument | Required | Type | Default | Description |
|----------|----------|------|---------|-------------|
| SESSION | Yes | String | - | Session ID or path to `.workflow/.brainstorm/BS-xxx` |
| SESSION | Yes | String | - | Session ID or path to `{projectRoot}/.workflow/.brainstorm/BS-xxx` |
| --idea | No | Integer | - | Pre-select idea by index (0-based) |
| --auto | No | Flag | false | Auto-select highest-scored idea |
| -y, --yes | No | Flag | false | Skip all confirmations |
@@ -157,7 +157,7 @@ Phase 5: Generate Solution Tasks
```
Phase 6: Bind Solution
├─ Write solution to .workflow/issues/solutions/{issue-id}.jsonl
├─ Write solution to {projectRoot}/.workflow/issues/solutions/{issue-id}.jsonl
├─ Bind via: ccw issue bind {issue-id} {solution-id}
├─ Update issue status to 'planned'
└─ Returns: SOL-{issue-id}-{uid}
@@ -277,7 +277,7 @@ EOF
### Solution Binding
```bash
# Append solution to JSONL file
echo '{"id":"SOL-xxx","tasks":[...]}' >> .workflow/issues/solutions/{issue-id}.jsonl
echo '{"id":"SOL-xxx","tasks":[...]}' >> ${projectRoot}/.workflow/issues/solutions/{issue-id}.jsonl
# Bind to issue
ccw issue bind {issue-id} {solution-id}
@@ -361,7 +361,7 @@ brainstorm-with-file
### Input Files
```
.workflow/.brainstorm/BS-{slug}-{date}/
{projectRoot}/.workflow/.brainstorm/BS-{slug}-{date}/
├── synthesis.json # REQUIRED - Top ideas with scores
├── perspectives.json # OPTIONAL - Multi-CLI insights
├── brainstorm.md # Reference only
@@ -376,7 +376,7 @@ brainstorm-with-file
### Output Files
```
.workflow/issues/
{projectRoot}/.workflow/issues/
├── solutions/
│ └── ISS-YYYYMMDD-001.jsonl # Created solution (JSONL)
└── (managed by ccw issue CLI)

View File

@@ -9,7 +9,7 @@ Queue formation command using **issue-queue-agent** that analyzes all bound solu
## Prerequisites
- Issues with `status: planned` and `bound_solution_id` exist
- Solutions written in `.workflow/issues/solutions/{issue-id}.jsonl`
- Solutions written in `{projectRoot}/.workflow/issues/solutions/{issue-id}.jsonl`
- `ccw issue` CLI available
## Auto Mode
@@ -117,8 +117,8 @@ const queueIds = numQueues === 1
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/issue-queue-agent.md (MUST read first)
2. Read: .workflow/project-tech.json
3. Read: .workflow/project-guidelines.json
2. Read: ${projectRoot}/.workflow/project-tech.json
3. Read: ${projectRoot}/.workflow/project-guidelines.json
---
@@ -145,8 +145,8 @@ Step 6: Write queue JSON + update index
### Output Requirements
**Write files** (exactly 2):
- `.workflow/issues/queues/${queueId}.json` - Full queue with solutions, conflicts, groups
- `.workflow/issues/queues/index.json` - Update with new queue entry
- `${projectRoot}/.workflow/issues/queues/${queueId}.json` - Full queue with solutions, conflicts, groups
- `${projectRoot}/.workflow/issues/queues/index.json` - Update with new queue entry
**Return JSON**:
\`\`\`json
@@ -267,8 +267,8 @@ if (allClarifications.length > 0) {
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/issue-queue-agent.md (MUST read first)
2. Read: .workflow/project-tech.json
3. Read: .workflow/project-guidelines.json
2. Read: ${projectRoot}/.workflow/project-tech.json
3. Read: ${projectRoot}/.workflow/project-guidelines.json
---
@@ -278,7 +278,7 @@ if (allClarifications.length > 0) {
**Conflict**: ${clarification.conflict_id} resolved: ${answer.selected}
### Instructions
1. Read existing queue file: .workflow/issues/queues/${clarification.queue_id}.json
1. Read existing queue file: ${projectRoot}/.workflow/issues/queues/${clarification.queue_id}.json
2. Update conflict resolution with user decision
3. Re-order affected solutions if needed
4. Write updated queue file
@@ -370,7 +370,7 @@ ASK_USER([{
## Storage Structure (Queue History)
```
.workflow/issues/
{projectRoot}/.workflow/issues/
├── issues.jsonl # All issues (one per line)
├── queues/ # Queue history directory
│ ├── index.json # Queue index (active + history)