cc-devflow 2.4.6 → 4.1.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.
- package/.claude/CLAUDE.md +1065 -48
- package/.claude/agents/dev-implementer.md +195 -0
- package/.claude/commands/{flow-archive.md → flow/archive.md} +46 -11
- package/.claude/commands/flow/context.md +150 -0
- package/.claude/commands/flow/delta.md +245 -0
- package/.claude/commands/{flow-dev.md → flow/dev.md} +112 -11
- package/.claude/commands/flow/init.md +45 -0
- package/.claude/commands/flow/quality.md +159 -0
- package/.claude/commands/flow/spec.md +186 -0
- package/.claude/commands/flow/workspace.md +146 -0
- package/.claude/commands/{cancel-ralph.md → util/cancel-ralph.md} +1 -0
- package/.claude/config/quality-gates.yml +305 -0
- package/.claude/docs/guides/TEAM_MODE_GUIDE.md +313 -0
- package/.claude/docs/templates/DELTA_SPEC_TEMPLATE.md +91 -0
- package/.claude/docs/templates/DESIGN_DECISIONS_TEMPLATE.md +151 -0
- package/.claude/docs/templates/JOURNAL_TEMPLATE.md +75 -0
- package/.claude/docs/templates/_shared/CLAUDE.md +36 -0
- package/.claude/docs/templates/_shared/CONSTITUTION_CHECK.md +125 -0
- package/.claude/docs/templates/_shared/VALIDATION_CHECKLIST.md +187 -0
- package/.claude/docs/templates/_shared/YAML_FRONTMATTER.md +164 -0
- package/.claude/docs/templates/context/dev.jsonl.template +6 -0
- package/.claude/docs/templates/context/epic.jsonl.template +5 -0
- package/.claude/docs/templates/context/prd.jsonl.template +4 -0
- package/.claude/docs/templates/context/research.jsonl.template +4 -0
- package/.claude/docs/templates/context/review.jsonl.template +5 -0
- package/.claude/docs/templates/context/tech.jsonl.template +5 -0
- package/.claude/hooks/CLAUDE.md +342 -0
- package/.claude/hooks/inject-agent-context.ts +480 -0
- package/.claude/hooks/inject-skill-context.ts +359 -0
- package/.claude/hooks/ralph-loop.ts +931 -0
- package/.claude/hooks/task-completed-hook.ts +593 -0
- package/.claude/hooks/teammate-idle-hook.ts +690 -0
- package/.claude/hooks/types/team-types.d.ts +238 -0
- package/.claude/rules/devflow-conventions.md +82 -9
- package/.claude/scripts/archive-requirement.sh +44 -1
- package/.claude/scripts/common.sh +670 -3
- package/.claude/scripts/delta-parser.ts +527 -0
- package/.claude/scripts/detect-file-conflicts.sh +151 -0
- package/.claude/scripts/flow-context-add.sh +134 -0
- package/.claude/scripts/flow-context-init.sh +133 -0
- package/.claude/scripts/flow-context-validate.sh +144 -0
- package/.claude/scripts/flow-delta-apply.sh +297 -0
- package/.claude/scripts/flow-delta-archive.sh +71 -0
- package/.claude/scripts/flow-delta-create.sh +202 -0
- package/.claude/scripts/flow-delta-list.sh +142 -0
- package/.claude/scripts/flow-delta-status.sh +235 -0
- package/.claude/scripts/flow-quality-full.sh +184 -0
- package/.claude/scripts/flow-quality-quick.sh +64 -0
- package/.claude/scripts/flow-workspace-init.sh +117 -0
- package/.claude/scripts/flow-workspace-record.sh +164 -0
- package/.claude/scripts/flow-workspace-start.sh +88 -0
- package/.claude/scripts/get-workflow-status.sh +415 -0
- package/.claude/scripts/parse-task-dependencies.js +334 -0
- package/.claude/scripts/record-quality-error.sh +165 -0
- package/.claude/scripts/run-quality-gates.sh +242 -0
- package/.claude/scripts/team-dev-init.sh +319 -0
- package/.claude/scripts/team-state-recovery.sh +229 -0
- package/.claude/scripts/workflow-status.ts +433 -0
- package/.claude/settings.json +19 -0
- package/.claude/skills/cc-devflow-orchestrator/SKILL.md +85 -200
- package/.claude/skills/domain/using-git-worktrees/SKILL.md +252 -0
- package/.claude/skills/domain/using-git-worktrees/assets/SHELL_ALIASES.md +133 -0
- package/.claude/skills/domain/using-git-worktrees/context.jsonl +4 -0
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-cleanup.sh +218 -0
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-create.sh +232 -0
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-list.sh +130 -0
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-status.sh +140 -0
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-switch.sh +70 -0
- package/.claude/skills/skill-rules.json +72 -1
- package/.claude/skills/utility/journey-checker/SKILL.md +199 -0
- package/.claude/skills/utility/journey-checker/pressure-scenarios.md +164 -0
- package/.claude/skills/utility/skill-creator/LICENSE.txt +202 -0
- package/.claude/skills/utility/skill-creator/SKILL.md +356 -0
- package/.claude/skills/utility/skill-creator/references/output-patterns.md +82 -0
- package/.claude/skills/utility/skill-creator/references/workflows.md +28 -0
- package/.claude/skills/utility/skill-creator/scripts/init_skill.py +303 -0
- package/.claude/skills/utility/skill-creator/scripts/package_skill.py +110 -0
- package/.claude/skills/utility/skill-creator/scripts/quick_validate.py +95 -0
- package/.claude/skills/workflow/flow-dev/CLAUDE.md +78 -0
- package/.claude/skills/workflow/flow-dev/SKILL.md +96 -0
- package/.claude/skills/workflow/flow-dev/assets/IMPLEMENTATION_PLAN_TEMPLATE.md +71 -0
- package/.claude/skills/workflow/flow-dev/context.jsonl +8 -0
- package/.claude/skills/workflow/flow-dev/dev-implementer.jsonl +8 -0
- package/.claude/skills/workflow/flow-dev/scripts/entry-gate.sh +116 -0
- package/.claude/skills/workflow/flow-dev/scripts/exit-gate.sh +101 -0
- package/.claude/skills/workflow/flow-dev/scripts/task-orchestrator.sh +106 -0
- package/.claude/skills/workflow/flow-fix/SKILL.md +105 -0
- package/.claude/skills/workflow/flow-fix/context.jsonl +6 -0
- package/.claude/skills/workflow/flow-fix/references/bug-analyzer.md +381 -0
- package/.claude/skills/workflow/flow-init/SKILL.md +211 -0
- package/.claude/skills/workflow/flow-init/assets/BRAINSTORM_TEMPLATE.md +148 -0
- package/.claude/skills/workflow/flow-init/assets/INIT_FLOW_TEMPLATE.md +198 -0
- package/.claude/skills/workflow/flow-init/assets/RESEARCH_TEMPLATE.md +276 -0
- package/.claude/skills/workflow/flow-init/context.jsonl +5 -0
- package/.claude/skills/workflow/flow-init/references/flow-researcher.md +132 -0
- package/.claude/skills/workflow/flow-init/scripts/check-prerequisites.sh +232 -0
- package/.claude/skills/workflow/flow-init/scripts/consolidate-research.sh +182 -0
- package/.claude/skills/workflow/flow-init/scripts/create-requirement.sh +515 -0
- package/.claude/skills/workflow/flow-init/scripts/generate-research-tasks.sh +157 -0
- package/.claude/skills/workflow/flow-init/scripts/populate-research-tasks.sh +284 -0
- package/.claude/skills/workflow/flow-init/scripts/validate-research.sh +332 -0
- package/.claude/skills/workflow/flow-quality/SKILL.md +94 -0
- package/.claude/skills/workflow/flow-quality/context.jsonl +6 -0
- package/.claude/skills/workflow/flow-quality/references/code-quality-reviewer.md +205 -0
- package/.claude/skills/workflow/flow-quality/references/qa-tester.md +313 -0
- package/.claude/skills/workflow/flow-quality/references/security-reviewer.md +314 -0
- package/.claude/skills/workflow/flow-quality/references/spec-reviewer.md +221 -0
- package/.claude/skills/workflow/flow-release/SKILL.md +126 -0
- package/.claude/skills/workflow/flow-release/context.jsonl +7 -0
- package/.claude/skills/workflow/flow-release/references/release-manager.md +295 -0
- package/.claude/skills/workflow/flow-spec/CLAUDE.md +103 -0
- package/.claude/skills/workflow/flow-spec/SKILL.md +545 -0
- package/.claude/skills/workflow/flow-spec/context.jsonl +7 -0
- package/.claude/skills/workflow/flow-spec/scripts/entry-gate.sh +194 -0
- package/.claude/skills/workflow/flow-spec/scripts/exit-gate.sh +244 -0
- package/.claude/skills/workflow/flow-spec/scripts/parallel-orchestrator.sh +205 -0
- package/.claude/skills/workflow/flow-spec/scripts/team-communication.sh +353 -0
- package/.claude/skills/workflow/flow-spec/scripts/team-init.sh +195 -0
- package/.claude/skills/workflow/flow-spec/scripts/test-team-mode.sh +496 -0
- package/.claude/skills/workflow/flow-spec/team-config.json +165 -0
- package/.claude/skills/workflow.yaml +417 -0
- package/CHANGELOG.md +254 -0
- package/README.md +193 -33
- package/README.zh-CN.md +206 -46
- package/lib/compiler/CLAUDE.md +77 -46
- package/lib/compiler/__tests__/multi-module-emitters.test.js +508 -0
- package/lib/compiler/context-expander.js +179 -0
- package/lib/compiler/emitters/antigravity-emitter.js +195 -5
- package/lib/compiler/emitters/base-emitter.js +217 -2
- package/lib/compiler/emitters/codex-emitter.js +200 -4
- package/lib/compiler/emitters/cursor-emitter.js +307 -3
- package/lib/compiler/emitters/qwen-emitter.js +196 -4
- package/lib/compiler/index.js +197 -2
- package/lib/compiler/platforms.js +270 -21
- package/package.json +1 -1
- package/.claude/commands/flow-epic.md +0 -183
- package/.claude/commands/flow-init.md +0 -370
- package/.claude/commands/flow-prd.md +0 -144
- package/.claude/commands/flow-qa.md +0 -93
- package/.claude/commands/flow-review.md +0 -257
- package/.claude/commands/flow-tech.md +0 -142
- package/.claude/commands/flow-ui.md +0 -189
- package/.claude/skills/file-header-guardian/SKILL.md +0 -56
- package/.claude/skills/skill-developer/ADVANCED.md +0 -197
- package/.claude/skills/skill-developer/HOOK_MECHANISMS.md +0 -306
- package/.claude/skills/skill-developer/PATTERNS_LIBRARY.md +0 -152
- package/.claude/skills/skill-developer/SKILL.md +0 -426
- package/.claude/skills/skill-developer/SKILL_RULES_REFERENCE.md +0 -315
- package/.claude/skills/skill-developer/TRIGGER_TYPES.md +0 -305
- package/.claude/skills/skill-developer/TROUBLESHOOTING.md +0 -514
- package/.claude/skills/writing-skills/SKILL.md +0 -655
- package/.claude/skills/writing-skills/anthropic-best-practices.md +0 -1150
- package/.claude/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
- package/.claude/skills/writing-skills/graphviz-conventions.dot +0 -172
- package/.claude/skills/writing-skills/persuasion-principles.md +0 -187
- package/.claude/skills/writing-skills/render-graphs.js +0 -168
- package/.claude/skills/writing-skills/testing-skills-with-subagents.md +0 -384
- package/.claude/tsc-cache/795ba6e3-b98a-423b-bab2-51aa62812569/affected-repos.txt +0 -1
- package/.claude/tsc-cache/ae335694-be5a-4ba4-a1a0-b676c09a7906/affected-repos.txt +0 -1
- /package/.claude/commands/{core-architecture.md → core/architecture.md} +0 -0
- /package/.claude/commands/{core-guidelines.md → core/guidelines.md} +0 -0
- /package/.claude/commands/{core-roadmap.md → core/roadmap.md} +0 -0
- /package/.claude/commands/{core-style.md → core/style.md} +0 -0
- /package/.claude/commands/{flow-checklist.md → flow/checklist.md} +0 -0
- /package/.claude/commands/{flow-clarify.md → flow/clarify.md} +0 -0
- /package/.claude/commands/{flow-constitution.md → flow/constitution.md} +0 -0
- /package/.claude/commands/{flow-fix.md → flow/fix.md} +0 -0
- /package/.claude/commands/{flow-ideate.md → flow/ideate.md} +0 -0
- /package/.claude/commands/{flow-new.md → flow/new.md} +0 -0
- /package/.claude/commands/{flow-release.md → flow/release.md} +0 -0
- /package/.claude/commands/{flow-restart.md → flow/restart.md} +0 -0
- /package/.claude/commands/{flow-status.md → flow/status.md} +0 -0
- /package/.claude/commands/{flow-update.md → flow/update.md} +0 -0
- /package/.claude/commands/{flow-upgrade.md → flow/upgrade.md} +0 -0
- /package/.claude/commands/{flow-verify.md → flow/verify.md} +0 -0
- /package/.claude/commands/{code-review-high.md → util/code-review.md} +0 -0
- /package/.claude/commands/{git-commit.md → util/git-commit.md} +0 -0
- /package/.claude/commands/{problem-analyzer.md → util/problem-analyzer.md} +0 -0
- /package/.claude/skills/{flow-attention-refresh → domain/attention-refresh}/SKILL.md +0 -0
- /package/.claude/skills/{flow-brainstorming → domain/brainstorming}/SKILL.md +0 -0
- /package/.claude/skills/{flow-debugging → domain/debugging}/SKILL.md +0 -0
- /package/.claude/skills/{flow-finishing-branch → domain/finishing-branch}/SKILL.md +0 -0
- /package/.claude/skills/{flow-receiving-review → domain/receiving-review}/SKILL.md +0 -0
- /package/.claude/skills/{flow-tdd → domain/tdd}/SKILL.md +0 -0
- /package/.claude/skills/{verification-before-completion → domain/verification}/SKILL.md +0 -0
- /package/.claude/skills/{constitution-guardian → guardrail/constitution-guardian}/SKILL.md +0 -0
- /package/.claude/skills/{devflow-tdd-enforcer → guardrail/tdd-enforcer}/SKILL.md +0 -0
- /package/.claude/skills/{devflow-constitution-quick-ref → utility/constitution-quick-ref}/SKILL.md +0 -0
- /package/.claude/skills/{devflow-file-standards → utility/file-standards}/SKILL.md +0 -0
- /package/.claude/skills/{fractal-docs-generator → utility/fractal-docs}/SKILL.md +0 -0
- /package/.claude/skills/{npm-release → utility/npm-release}/SKILL.md +0 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Implementation Plan Template
|
|
2
|
+
|
|
3
|
+
> [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
req_id: "${REQ_ID}"
|
|
7
|
+
task_id: "${TASK_ID}"
|
|
8
|
+
created_at: "${TIMESTAMP}"
|
|
9
|
+
status: "pending"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Task Overview
|
|
13
|
+
|
|
14
|
+
**Task**: ${TASK_DESCRIPTION}
|
|
15
|
+
|
|
16
|
+
**DoD (Definition of Done)**:
|
|
17
|
+
${DOD_ITEMS}
|
|
18
|
+
|
|
19
|
+
## Implementation Strategy
|
|
20
|
+
|
|
21
|
+
### Approach
|
|
22
|
+
|
|
23
|
+
${APPROACH_DESCRIPTION}
|
|
24
|
+
|
|
25
|
+
### Files to Modify
|
|
26
|
+
|
|
27
|
+
| File | Action | Description |
|
|
28
|
+
|------|--------|-------------|
|
|
29
|
+
| ${FILE_PATH} | ${ACTION} | ${DESCRIPTION} |
|
|
30
|
+
|
|
31
|
+
### Dependencies
|
|
32
|
+
|
|
33
|
+
- ${DEPENDENCY_1}
|
|
34
|
+
- ${DEPENDENCY_2}
|
|
35
|
+
|
|
36
|
+
## TDD Sequence
|
|
37
|
+
|
|
38
|
+
### Phase 2: Write Tests First
|
|
39
|
+
|
|
40
|
+
```${LANGUAGE}
|
|
41
|
+
// Test file: ${TEST_FILE_PATH}
|
|
42
|
+
${TEST_CODE}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Expected Result**: Test should FAIL initially
|
|
46
|
+
|
|
47
|
+
### Phase 3: Implementation
|
|
48
|
+
|
|
49
|
+
```${LANGUAGE}
|
|
50
|
+
// Implementation file: ${IMPL_FILE_PATH}
|
|
51
|
+
${IMPL_CODE}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Expected Result**: Test should PASS after implementation
|
|
55
|
+
|
|
56
|
+
## Verification Steps
|
|
57
|
+
|
|
58
|
+
1. Run tests: `${TEST_COMMAND}`
|
|
59
|
+
2. Verify output: ${EXPECTED_OUTPUT}
|
|
60
|
+
3. Check coverage: `${COVERAGE_COMMAND}`
|
|
61
|
+
|
|
62
|
+
## Constitution Compliance
|
|
63
|
+
|
|
64
|
+
- [ ] Article I: Complete implementation, no placeholders
|
|
65
|
+
- [ ] Article II: Reused existing code where possible
|
|
66
|
+
- [ ] Article III: No hardcoded secrets
|
|
67
|
+
- [ ] Article VI: TDD sequence followed
|
|
68
|
+
|
|
69
|
+
## Notes
|
|
70
|
+
|
|
71
|
+
${ADDITIONAL_NOTES}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{"file": "devflow/requirements/{REQ}/TASKS.md", "reason": "Task list"}
|
|
2
|
+
{"file": "devflow/requirements/{REQ}/EPIC.md", "reason": "Epic overview"}
|
|
3
|
+
{"file": "devflow/requirements/{REQ}/BRAINSTORM.md", "reason": "Original intent"}
|
|
4
|
+
{"file": "devflow/requirements/{REQ}/ERROR_LOG.md", "reason": "Previous errors", "optional": true}
|
|
5
|
+
{"file": "devflow/requirements/{REQ}/TECH_DESIGN.md", "reason": "Technical design", "optional": true}
|
|
6
|
+
{"file": "devflow/spec/frontend/index.md", "reason": "Frontend conventions", "optional": true}
|
|
7
|
+
{"file": "devflow/spec/backend/index.md", "reason": "Backend conventions", "optional": true}
|
|
8
|
+
{"file": ".claude/rules/project-constitution.md", "reason": "Quality rules"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{"file": "devflow/requirements/{REQ}/TASKS.md", "reason": "Task list with DoD"}
|
|
2
|
+
{"file": "devflow/requirements/{REQ}/EPIC.md", "reason": "Epic overview and architecture"}
|
|
3
|
+
{"file": "devflow/requirements/{REQ}/BRAINSTORM.md", "reason": "Original intent and context"}
|
|
4
|
+
{"file": "devflow/requirements/{REQ}/ERROR_LOG.md", "reason": "Previous errors to avoid", "optional": true}
|
|
5
|
+
{"file": "devflow/requirements/{REQ}/TECH_DESIGN.md", "reason": "Technical design decisions", "optional": true}
|
|
6
|
+
{"file": "devflow/spec/frontend/index.md", "reason": "Frontend conventions", "optional": true}
|
|
7
|
+
{"file": "devflow/spec/backend/index.md", "reason": "Backend conventions", "optional": true}
|
|
8
|
+
{"file": ".claude/rules/project-constitution.md", "reason": "Quality rules and TDD mandate"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# flow-dev Entry Gate
|
|
4
|
+
# ============================================================================
|
|
5
|
+
# [INPUT]: REQ_ID, devflow/requirements/${REQ_ID}/
|
|
6
|
+
# [OUTPUT]: JSON validation result
|
|
7
|
+
# [POS]: flow-dev 的入口检查脚本,验证开发阶段前置条件
|
|
8
|
+
# [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
|
|
9
|
+
# ============================================================================
|
|
10
|
+
|
|
11
|
+
set -euo pipefail
|
|
12
|
+
|
|
13
|
+
# ============================================================================
|
|
14
|
+
# Configuration
|
|
15
|
+
# ============================================================================
|
|
16
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
17
|
+
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../../../../.." && pwd)"
|
|
18
|
+
|
|
19
|
+
# ============================================================================
|
|
20
|
+
# Functions
|
|
21
|
+
# ============================================================================
|
|
22
|
+
log_error() {
|
|
23
|
+
echo "[ERROR] $1" >&2
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
log_info() {
|
|
27
|
+
echo "[INFO] $1" >&2
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
output_json() {
|
|
31
|
+
local status="$1"
|
|
32
|
+
local message="$2"
|
|
33
|
+
local details="${3:-}"
|
|
34
|
+
|
|
35
|
+
if [[ -n "$details" ]]; then
|
|
36
|
+
echo "{\"status\":\"${status}\",\"message\":\"${message}\",\"details\":${details}}"
|
|
37
|
+
else
|
|
38
|
+
echo "{\"status\":\"${status}\",\"message\":\"${message}\"}"
|
|
39
|
+
fi
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# ============================================================================
|
|
43
|
+
# Main
|
|
44
|
+
# ============================================================================
|
|
45
|
+
main() {
|
|
46
|
+
local req_id="${1:-}"
|
|
47
|
+
|
|
48
|
+
# 1. REQ_ID 验证
|
|
49
|
+
if [[ -z "$req_id" ]]; then
|
|
50
|
+
output_json "error" "REQ_ID is required"
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
local req_dir="${PROJECT_ROOT}/devflow/requirements/${req_id}"
|
|
55
|
+
|
|
56
|
+
# 2. 目录存在性检查
|
|
57
|
+
if [[ ! -d "$req_dir" ]]; then
|
|
58
|
+
output_json "error" "Requirement directory not found: ${req_dir}"
|
|
59
|
+
exit 1
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
# 3. 必需文件检查
|
|
63
|
+
local missing_files=()
|
|
64
|
+
|
|
65
|
+
[[ ! -f "${req_dir}/TASKS.md" ]] && missing_files+=("TASKS.md")
|
|
66
|
+
[[ ! -f "${req_dir}/EPIC.md" ]] && missing_files+=("EPIC.md")
|
|
67
|
+
[[ ! -f "${req_dir}/PRD.md" ]] && missing_files+=("PRD.md")
|
|
68
|
+
[[ ! -f "${req_dir}/orchestration_status.json" ]] && missing_files+=("orchestration_status.json")
|
|
69
|
+
|
|
70
|
+
if [[ ${#missing_files[@]} -gt 0 ]]; then
|
|
71
|
+
local files_json=$(printf '"%s",' "${missing_files[@]}" | sed 's/,$//')
|
|
72
|
+
output_json "error" "Missing required files" "[${files_json}]"
|
|
73
|
+
exit 1
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
# 4. 状态检查
|
|
77
|
+
local status_file="${req_dir}/orchestration_status.json"
|
|
78
|
+
local current_status
|
|
79
|
+
|
|
80
|
+
if command -v jq &> /dev/null; then
|
|
81
|
+
current_status=$(jq -r '.status // "unknown"' "$status_file" 2>/dev/null || echo "unknown")
|
|
82
|
+
else
|
|
83
|
+
current_status=$(grep -o '"status"[[:space:]]*:[[:space:]]*"[^"]*"' "$status_file" | head -1 | sed 's/.*"\([^"]*\)"$/\1/')
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
local valid_statuses=("spec_complete" "epic_complete" "development_in_progress" "development_failed")
|
|
87
|
+
local status_valid=false
|
|
88
|
+
|
|
89
|
+
for valid in "${valid_statuses[@]}"; do
|
|
90
|
+
if [[ "$current_status" == "$valid" ]]; then
|
|
91
|
+
status_valid=true
|
|
92
|
+
break
|
|
93
|
+
fi
|
|
94
|
+
done
|
|
95
|
+
|
|
96
|
+
if [[ "$status_valid" != "true" ]]; then
|
|
97
|
+
output_json "error" "Invalid status for flow-dev: ${current_status}. Expected: spec_complete, epic_complete, development_in_progress, or development_failed"
|
|
98
|
+
exit 1
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# 5. TASKS.md 格式检查
|
|
102
|
+
if ! grep -q "^- \[ \]" "${req_dir}/TASKS.md" 2>/dev/null; then
|
|
103
|
+
# 检查是否所有任务都已完成
|
|
104
|
+
if grep -q "^- \[x\]" "${req_dir}/TASKS.md" 2>/dev/null; then
|
|
105
|
+
log_info "All tasks appear to be completed"
|
|
106
|
+
else
|
|
107
|
+
output_json "error" "TASKS.md has no valid task format (- [ ] or - [x])"
|
|
108
|
+
exit 1
|
|
109
|
+
fi
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
# 6. 成功
|
|
113
|
+
output_json "success" "Entry gate passed" "{\"req_id\":\"${req_id}\",\"status\":\"${current_status}\"}"
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
main "$@"
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# flow-dev Exit Gate
|
|
4
|
+
# ============================================================================
|
|
5
|
+
# [INPUT]: REQ_ID, devflow/requirements/${REQ_ID}/
|
|
6
|
+
# [OUTPUT]: JSON validation result
|
|
7
|
+
# [POS]: flow-dev 的出口检查脚本,验证开发阶段完成条件
|
|
8
|
+
# [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
|
|
9
|
+
# ============================================================================
|
|
10
|
+
|
|
11
|
+
set -euo pipefail
|
|
12
|
+
|
|
13
|
+
# ============================================================================
|
|
14
|
+
# Configuration
|
|
15
|
+
# ============================================================================
|
|
16
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
17
|
+
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../../../../.." && pwd)"
|
|
18
|
+
|
|
19
|
+
# ============================================================================
|
|
20
|
+
# Functions
|
|
21
|
+
# ============================================================================
|
|
22
|
+
log_error() {
|
|
23
|
+
echo "[ERROR] $1" >&2
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
log_info() {
|
|
27
|
+
echo "[INFO] $1" >&2
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
output_json() {
|
|
31
|
+
local status="$1"
|
|
32
|
+
local message="$2"
|
|
33
|
+
local details="${3:-}"
|
|
34
|
+
|
|
35
|
+
if [[ -n "$details" ]]; then
|
|
36
|
+
echo "{\"status\":\"${status}\",\"message\":\"${message}\",\"details\":${details}}"
|
|
37
|
+
else
|
|
38
|
+
echo "{\"status\":\"${status}\",\"message\":\"${message}\"}"
|
|
39
|
+
fi
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# ============================================================================
|
|
43
|
+
# Main
|
|
44
|
+
# ============================================================================
|
|
45
|
+
main() {
|
|
46
|
+
local req_id="${1:-}"
|
|
47
|
+
|
|
48
|
+
# 1. REQ_ID 验证
|
|
49
|
+
if [[ -z "$req_id" ]]; then
|
|
50
|
+
output_json "error" "REQ_ID is required"
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
local req_dir="${PROJECT_ROOT}/devflow/requirements/${req_id}"
|
|
55
|
+
local tasks_file="${req_dir}/TASKS.md"
|
|
56
|
+
|
|
57
|
+
# 2. 任务完成度检查
|
|
58
|
+
local total_tasks=0
|
|
59
|
+
local completed_tasks=0
|
|
60
|
+
|
|
61
|
+
if [[ -f "$tasks_file" ]]; then
|
|
62
|
+
total_tasks=$(grep -c "^- \[" "$tasks_file" 2>/dev/null || echo "0")
|
|
63
|
+
completed_tasks=$(grep -c "^- \[x\]" "$tasks_file" 2>/dev/null || echo "0")
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
if [[ "$total_tasks" -eq 0 ]]; then
|
|
67
|
+
output_json "error" "No tasks found in TASKS.md"
|
|
68
|
+
exit 1
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
local incomplete_tasks=$((total_tasks - completed_tasks))
|
|
72
|
+
|
|
73
|
+
if [[ "$incomplete_tasks" -gt 0 ]]; then
|
|
74
|
+
output_json "warning" "Not all tasks completed" "{\"total\":${total_tasks},\"completed\":${completed_tasks},\"incomplete\":${incomplete_tasks}}"
|
|
75
|
+
exit 1
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# 3. 测试验证 (检查是否有测试相关文件)
|
|
79
|
+
local has_tests=false
|
|
80
|
+
|
|
81
|
+
# 检查常见测试目录/文件
|
|
82
|
+
if [[ -d "${PROJECT_ROOT}/tests" ]] || \
|
|
83
|
+
[[ -d "${PROJECT_ROOT}/test" ]] || \
|
|
84
|
+
[[ -d "${PROJECT_ROOT}/__tests__" ]] || \
|
|
85
|
+
[[ -d "${PROJECT_ROOT}/spec" ]]; then
|
|
86
|
+
has_tests=true
|
|
87
|
+
fi
|
|
88
|
+
|
|
89
|
+
# 4. 实现文件检查 (检查 tasks/ 目录)
|
|
90
|
+
local impl_dir="${req_dir}/tasks"
|
|
91
|
+
local has_implementation=false
|
|
92
|
+
|
|
93
|
+
if [[ -d "$impl_dir" ]] && [[ -n "$(ls -A "$impl_dir" 2>/dev/null)" ]]; then
|
|
94
|
+
has_implementation=true
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
# 5. 成功
|
|
98
|
+
output_json "success" "Exit gate passed" "{\"req_id\":\"${req_id}\",\"total_tasks\":${total_tasks},\"completed_tasks\":${completed_tasks},\"has_tests\":${has_tests},\"has_implementation\":${has_implementation}}"
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
main "$@"
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# flow-dev Task Orchestrator
|
|
4
|
+
# ============================================================================
|
|
5
|
+
# [INPUT]: REQ_ID, TASKS.md
|
|
6
|
+
# [OUTPUT]: JSON with next task info
|
|
7
|
+
# [POS]: flow-dev 的任务调度脚本,解析 TASKS.md 并返回下一个待执行任务
|
|
8
|
+
# [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
|
|
9
|
+
# ============================================================================
|
|
10
|
+
|
|
11
|
+
set -euo pipefail
|
|
12
|
+
|
|
13
|
+
# ============================================================================
|
|
14
|
+
# Configuration
|
|
15
|
+
# ============================================================================
|
|
16
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
17
|
+
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../../../../.." && pwd)"
|
|
18
|
+
|
|
19
|
+
# ============================================================================
|
|
20
|
+
# Functions
|
|
21
|
+
# ============================================================================
|
|
22
|
+
output_json() {
|
|
23
|
+
local status="$1"
|
|
24
|
+
local message="$2"
|
|
25
|
+
local details="${3:-}"
|
|
26
|
+
|
|
27
|
+
if [[ -n "$details" ]]; then
|
|
28
|
+
echo "{\"status\":\"${status}\",\"message\":\"${message}\",\"details\":${details}}"
|
|
29
|
+
else
|
|
30
|
+
echo "{\"status\":\"${status}\",\"message\":\"${message}\"}"
|
|
31
|
+
fi
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# ============================================================================
|
|
35
|
+
# Main
|
|
36
|
+
# ============================================================================
|
|
37
|
+
main() {
|
|
38
|
+
local req_id="${1:-}"
|
|
39
|
+
local action="${2:-next}" # next, status, mark-complete
|
|
40
|
+
local task_id="${3:-}"
|
|
41
|
+
|
|
42
|
+
if [[ -z "$req_id" ]]; then
|
|
43
|
+
output_json "error" "REQ_ID is required"
|
|
44
|
+
exit 1
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
local req_dir="${PROJECT_ROOT}/devflow/requirements/${req_id}"
|
|
48
|
+
local tasks_file="${req_dir}/TASKS.md"
|
|
49
|
+
|
|
50
|
+
if [[ ! -f "$tasks_file" ]]; then
|
|
51
|
+
output_json "error" "TASKS.md not found"
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
case "$action" in
|
|
56
|
+
next)
|
|
57
|
+
# 找到第一个未完成的任务
|
|
58
|
+
local next_task
|
|
59
|
+
next_task=$(grep -n "^- \[ \]" "$tasks_file" | head -1 || echo "")
|
|
60
|
+
|
|
61
|
+
if [[ -z "$next_task" ]]; then
|
|
62
|
+
output_json "complete" "All tasks completed"
|
|
63
|
+
else
|
|
64
|
+
local line_num=$(echo "$next_task" | cut -d: -f1)
|
|
65
|
+
local task_content=$(echo "$next_task" | cut -d: -f2-)
|
|
66
|
+
|
|
67
|
+
# 提取任务 ID (T###)
|
|
68
|
+
local extracted_id=$(echo "$task_content" | grep -o 'T[0-9]\{3\}' | head -1 || echo "")
|
|
69
|
+
|
|
70
|
+
output_json "success" "Next task found" "{\"line\":${line_num},\"task_id\":\"${extracted_id}\",\"content\":\"${task_content}\"}"
|
|
71
|
+
fi
|
|
72
|
+
;;
|
|
73
|
+
|
|
74
|
+
status)
|
|
75
|
+
local total=$(grep -c "^- \[" "$tasks_file" 2>/dev/null || echo "0")
|
|
76
|
+
local completed=$(grep -c "^- \[x\]" "$tasks_file" 2>/dev/null || echo "0")
|
|
77
|
+
local pending=$((total - completed))
|
|
78
|
+
|
|
79
|
+
output_json "success" "Task status" "{\"total\":${total},\"completed\":${completed},\"pending\":${pending}}"
|
|
80
|
+
;;
|
|
81
|
+
|
|
82
|
+
mark-complete)
|
|
83
|
+
if [[ -z "$task_id" ]]; then
|
|
84
|
+
output_json "error" "task_id required for mark-complete"
|
|
85
|
+
exit 1
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
# 标记任务完成 (将 [ ] 改为 [x])
|
|
89
|
+
if grep -q "^- \[ \].*${task_id}" "$tasks_file"; then
|
|
90
|
+
sed -i.bak "s/^- \[ \]\(.*${task_id}.*\)/- [x]\1/" "$tasks_file"
|
|
91
|
+
rm -f "${tasks_file}.bak"
|
|
92
|
+
output_json "success" "Task marked complete" "{\"task_id\":\"${task_id}\"}"
|
|
93
|
+
else
|
|
94
|
+
output_json "error" "Task not found or already completed: ${task_id}"
|
|
95
|
+
exit 1
|
|
96
|
+
fi
|
|
97
|
+
;;
|
|
98
|
+
|
|
99
|
+
*)
|
|
100
|
+
output_json "error" "Unknown action: ${action}. Use: next, status, mark-complete"
|
|
101
|
+
exit 1
|
|
102
|
+
;;
|
|
103
|
+
esac
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
main "$@"
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: flow-fix
|
|
3
|
+
description: 'One-shot BUG fix flow with systematic debugging. Usage: /flow-fix "BUG-123|登录时报 500"'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Flow-Fix Skill
|
|
7
|
+
|
|
8
|
+
> [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
系统化 BUG 修复流程,遵循 4 阶段调试法。
|
|
13
|
+
|
|
14
|
+
## The Iron Law
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Input Format
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
/flow-fix "BUG_ID|TITLE"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
示例: `/flow-fix "BUG-123|登录时报500"`
|
|
27
|
+
|
|
28
|
+
## Rationalization Prevention
|
|
29
|
+
|
|
30
|
+
| Excuse | Reality |
|
|
31
|
+
|--------|---------|
|
|
32
|
+
| "我知道问题在哪" | 证明它。先调查。 |
|
|
33
|
+
| "快速修复一下" | 快速修复 = 快速回归。系统化调试。 |
|
|
34
|
+
| "没时间写测试" | 没测试 = 不知道是否真的修好了。 |
|
|
35
|
+
| "这个改动很小" | 小改动也能引入大 bug。测试它。 |
|
|
36
|
+
|
|
37
|
+
## Execution Flow
|
|
38
|
+
|
|
39
|
+
### Stage 0: Entry Gate
|
|
40
|
+
|
|
41
|
+
1. 解析 BUG_ID、TITLE
|
|
42
|
+
2. 创建 `devflow/bugs/${BUG_ID}/` 目录
|
|
43
|
+
3. 创建分支: `bugfix/${BUG_ID}-${slug}`
|
|
44
|
+
|
|
45
|
+
### Stage 1: Root Cause Investigation
|
|
46
|
+
|
|
47
|
+
**Iron Law**: 禁止写任何修复代码
|
|
48
|
+
|
|
49
|
+
1. 完整阅读错误信息
|
|
50
|
+
2. 稳定复现
|
|
51
|
+
3. 检查最近变更
|
|
52
|
+
4. 逆向追踪数据流
|
|
53
|
+
|
|
54
|
+
输出: ANALYSIS.md
|
|
55
|
+
|
|
56
|
+
### Stage 2: Pattern Analysis & Planning
|
|
57
|
+
|
|
58
|
+
1. 找到正常工作的例子
|
|
59
|
+
2. 与参考实现对比
|
|
60
|
+
3. 调用 planner 生成 PLAN.md
|
|
61
|
+
|
|
62
|
+
输出: PLAN.md, tasks/, TEST_PLAN.md
|
|
63
|
+
|
|
64
|
+
### Stage 3: Fix Execution (TDD)
|
|
65
|
+
|
|
66
|
+
1. 先写失败测试用例
|
|
67
|
+
2. 按 tasks/ 顺序执行
|
|
68
|
+
3. 每任务完成后 Git 提交
|
|
69
|
+
4. 3+ 次失败 → STOP,质疑架构
|
|
70
|
+
|
|
71
|
+
### Stage 4: Verification
|
|
72
|
+
|
|
73
|
+
1. TEST_REPORT.md (必须全部通过)
|
|
74
|
+
2. SECURITY_REPORT.md
|
|
75
|
+
3. RELEASE_PLAN.md
|
|
76
|
+
4. Status: `fix_complete`
|
|
77
|
+
|
|
78
|
+
## Output
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
devflow/bugs/${BUG_ID}/
|
|
82
|
+
├── ANALYSIS.md
|
|
83
|
+
├── PLAN.md
|
|
84
|
+
├── tasks/
|
|
85
|
+
├── TEST_PLAN.md
|
|
86
|
+
├── TEST_REPORT.md
|
|
87
|
+
├── SECURITY_REPORT.md
|
|
88
|
+
├── RELEASE_PLAN.md
|
|
89
|
+
└── orchestration_status.json
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Red Flags - STOP
|
|
93
|
+
|
|
94
|
+
如果你发现自己:
|
|
95
|
+
- 没有复现就开始修复
|
|
96
|
+
- 在"试试这个,试试那个"
|
|
97
|
+
- 3+ 次修复尝试失败
|
|
98
|
+
- 没写测试就说"修好了"
|
|
99
|
+
|
|
100
|
+
**STOP. 回到阶段 1. 调查根因。**
|
|
101
|
+
|
|
102
|
+
## Next Step
|
|
103
|
+
|
|
104
|
+
1. 提交 PR: `fix(${BUG_ID}): <summary>`
|
|
105
|
+
2. 通知相关需求负责人回归验证
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{"file": "devflow/bugs/{BUG}/ANALYSIS.md", "reason": "Root cause analysis", "optional": true}
|
|
2
|
+
{"file": "devflow/bugs/{BUG}/PLAN.md", "reason": "Fix plan", "optional": true}
|
|
3
|
+
{"file": "devflow/bugs/{BUG}/ERROR_LOG.md", "reason": "Previous errors", "optional": true}
|
|
4
|
+
{"file": ".claude/skills/flow-debugging/SKILL.md", "reason": "Debugging methodology"}
|
|
5
|
+
{"file": ".claude/skills/flow-tdd/SKILL.md", "reason": "TDD principles"}
|
|
6
|
+
{"file": ".claude/rules/project-constitution.md", "reason": "Quality rules"}
|