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

@@ -23,7 +23,7 @@ The review mode is determined by the input arguments:
// If session ID not provided, auto-detect
if (!providedSessionId) {
// Check for active sessions
const activeSessions = Glob('.workflow/active/WFS-*');
const activeSessions = Glob('${projectRoot}/.workflow/active/WFS-*');
if (activeSessions.length === 1) {
sessionId = activeSessions[0].match(/WFS-[^/]+/)[0];
} else if (activeSessions.length > 1) {
@@ -37,7 +37,7 @@ if (!providedSessionId) {
}
// Validate session exists
Bash(`test -d .workflow/active/${sessionId} && echo "EXISTS"`);
Bash(`test -d ${projectRoot}/.workflow/active/${sessionId} && echo "EXISTS"`);
```
### Step 1.2: Session Validation
@@ -62,11 +62,11 @@ git log --since="${sessionCreatedAt}" --name-only --pretty=format: | sort -u
```javascript
// Create workflow session for this review (type: review)
// Orchestrator handles session creation directly
Bash(`mkdir -p .workflow/active/WFS-review-${Date.now()}`);
Bash(`mkdir -p ${projectRoot}/.workflow/active/WFS-review-${Date.now()}`);
// Initialize workflow-session.json
const sessionId = `WFS-review-${Date.now()}`;
Write(`.workflow/active/${sessionId}/workflow-session.json`, JSON.stringify({
Write(`${projectRoot}/.workflow/active/${sessionId}/workflow-session.json`, JSON.stringify({
session_id: sessionId,
type: "review",
description: `Code review for ${targetPattern}`,
@@ -117,7 +117,7 @@ done
### Step 1.4: Output Directory Setup
- Output directory: `.workflow/active/${sessionId}/.review/`
- Output directory: `${projectRoot}/.workflow/active/${sessionId}/.review/`
- Create directory structure:
```bash
mkdir -p ${sessionDir}/.review/{dimensions,iterations,reports}
@@ -295,7 +295,7 @@ done
## Output File Structure
```
.workflow/active/WFS-{session-id}/.review/
{projectRoot}/.workflow/active/WFS-{session-id}/.review/
├── review-state.json # Orchestrator state machine (includes metadata)
├── review-progress.json # Real-time progress for dashboard
├── dimensions/ # Per-dimension results
@@ -319,7 +319,7 @@ done
## Session Context
```
.workflow/active/WFS-{session-id}/
{projectRoot}/.workflow/active/WFS-{session-id}/
├── workflow-session.json
├── IMPL_PLAN.md
├── TODO_LIST.md

View File

@@ -94,8 +94,8 @@ dimensions.forEach(dimension => {
3. Get target files: Read resolved_files from review-state.json
4. Validate file access: bash(ls -la ${targetFiles.join(' ')})
5. Execute: cat ~/.ccw/workflows/cli-templates/schemas/review-dimension-results-schema.json (get output schema reference)
6. Read: .workflow/project-tech.json (technology stack and architecture context)
7. Read: .workflow/project-guidelines.json (user-defined constraints and conventions to validate against)
6. Read: ${projectRoot}/.workflow/project-tech.json (technology stack and architecture context)
7. Read: ${projectRoot}/.workflow/project-guidelines.json (user-defined constraints and conventions to validate against)
---
@@ -217,8 +217,8 @@ dimensions.forEach(dimension => {
4. Get changed files: bash(cd ${workflowDir} && git log --since="${sessionCreatedAt}" --name-only --pretty=format: | sort -u)
5. Read review state: ${reviewStateJsonPath}
6. Execute: cat ~/.ccw/workflows/cli-templates/schemas/review-dimension-results-schema.json (get output schema reference)
7. Read: .workflow/project-tech.json (technology stack and architecture context)
8. Read: .workflow/project-guidelines.json (user-defined constraints and conventions to validate against)
7. Read: ${projectRoot}/.workflow/project-tech.json (technology stack and architecture context)
8. Read: ${projectRoot}/.workflow/project-guidelines.json (user-defined constraints and conventions to validate against)
---
@@ -336,8 +336,8 @@ const deepDiveAgentId = spawn_agent({
4. Identify related code: bash(grep -r "import.*${basename(file)}" ${projectDir}/src --include="*.ts")
5. Read test files: bash(find ${projectDir}/tests -name "*${basename(file, '.ts')}*" -type f)
6. Execute: cat ~/.ccw/workflows/cli-templates/schemas/review-deep-dive-results-schema.json (get output schema reference)
7. Read: .workflow/project-tech.json (technology stack and architecture context)
8. Read: .workflow/project-guidelines.json (user-defined constraints for remediation compliance)
7. Read: ${projectRoot}/.workflow/project-tech.json (technology stack and architecture context)
8. Read: ${projectRoot}/.workflow/project-guidelines.json (user-defined constraints for remediation compliance)
---

View File

@@ -89,8 +89,8 @@ selectedFindings.forEach(finding => {
4. Identify related code: bash(grep -r "import.*${basename(finding.file)}" ${projectDir}/src --include="*.ts")
5. Read test files: bash(find ${projectDir}/tests -name "*${basename(finding.file, '.ts')}*" -type f)
6. Execute: cat ~/.ccw/workflows/cli-templates/schemas/review-deep-dive-results-schema.json (get output schema reference)
7. Read: .workflow/project-tech.json (technology stack and architecture context)
8. Read: .workflow/project-guidelines.json (user-defined constraints for remediation compliance)
7. Read: ${projectRoot}/.workflow/project-tech.json (technology stack and architecture context)
8. Read: ${projectRoot}/.workflow/project-guidelines.json (user-defined constraints for remediation compliance)
---
@@ -200,8 +200,8 @@ selectedFindings.forEach(finding => {
4. Identify related code: bash(grep -r "import.*${basename(finding.file)}" ${workflowDir}/src --include="*.ts")
5. Read test files: bash(find ${workflowDir}/tests -name "*${basename(finding.file, '.ts')}*" -type f)
6. Execute: cat ~/.ccw/workflows/cli-templates/schemas/review-deep-dive-results-schema.json (get output schema reference)
7. Read: .workflow/project-tech.json (technology stack and architecture context)
8. Read: .workflow/project-guidelines.json (user-defined constraints for remediation compliance)
7. Read: ${projectRoot}/.workflow/project-tech.json (technology stack and architecture context)
8. Read: ${projectRoot}/.workflow/project-guidelines.json (user-defined constraints for remediation compliance)
---

View File

@@ -159,7 +159,7 @@ review-cycle src/auth/**
review-cycle
# Step 2: Run automated fixes using dimension findings
review-cycle --fix .workflow/active/WFS-{session-id}/.review/
review-cycle --fix ${projectRoot}/.workflow/active/WFS-{session-id}/.review/
```
## Output

View File

@@ -10,19 +10,19 @@ Validate fix input source, create fix session structure, and perform intelligent
```bash
# Fix from exported findings file (session-based path)
review-cycle --fix .workflow/active/WFS-123/.review/fix-export-1706184622000.json
review-cycle --fix ${projectRoot}/.workflow/active/WFS-123/.review/fix-export-1706184622000.json
# Fix from review directory (auto-discovers latest export)
review-cycle --fix .workflow/active/WFS-123/.review/
review-cycle --fix ${projectRoot}/.workflow/active/WFS-123/.review/
# Resume interrupted fix session
review-cycle --fix --resume
# Custom max retry attempts per finding
review-cycle --fix .workflow/active/WFS-123/.review/ --max-iterations=5
review-cycle --fix ${projectRoot}/.workflow/active/WFS-123/.review/ --max-iterations=5
# Custom batch size for parallel planning (default: 5 findings per batch)
review-cycle --fix .workflow/active/WFS-123/.review/ --batch-size=3
review-cycle --fix ${projectRoot}/.workflow/active/WFS-123/.review/ --batch-size=3
```
**Fix Source**: Exported findings from review cycle dashboard
@@ -208,7 +208,7 @@ console.log(`Created ${batches.length} batches (${batchSize} findings per batch)
## Output File Structure
```
.workflow/active/WFS-{session-id}/.review/
{projectRoot}/.workflow/active/WFS-{session-id}/.review/
├── fix-export-{timestamp}.json # Exported findings (input)
└── fixes/{fix-session-id}/
├── partial-plan-1.json # Batch 1 partial plan (planning agent 1 output)

View File

@@ -105,8 +105,8 @@ const agentId = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/cli-planning-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
---

View File

@@ -60,8 +60,8 @@ const execAgentId = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/cli-execution-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
---