cc-devflow 1.0.1
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 +83 -0
- package/.claude/agents/architecture-designer.md +443 -0
- package/.claude/agents/bug-analyzer.md +382 -0
- package/.claude/agents/checklist-agent.md +175 -0
- package/.claude/agents/clarify-analyst.md +50 -0
- package/.claude/agents/code-reviewer.md +71 -0
- package/.claude/agents/codex-analyzer.md +39 -0
- package/.claude/agents/compatibility-checker.md +580 -0
- package/.claude/agents/consistency-checker.md +532 -0
- package/.claude/agents/impact-analyzer.md +441 -0
- package/.claude/agents/planner.md +230 -0
- package/.claude/agents/prd-writer.md +320 -0
- package/.claude/agents/project-guidelines-generator.md +1329 -0
- package/.claude/agents/qa-tester.md +313 -0
- package/.claude/agents/release-manager.md +295 -0
- package/.claude/agents/security-reviewer.md +314 -0
- package/.claude/agents/style-guide-generator.md +458 -0
- package/.claude/agents/tech-architect.md +516 -0
- package/.claude/agents/ui-designer.md +485 -0
- package/.claude/commands/code-review-high.md +58 -0
- package/.claude/commands/core-architecture.md +429 -0
- package/.claude/commands/core-guidelines.md +486 -0
- package/.claude/commands/core-roadmap.md +439 -0
- package/.claude/commands/core-style.md +293 -0
- package/.claude/commands/flow-archive.md +245 -0
- package/.claude/commands/flow-checklist.md +260 -0
- package/.claude/commands/flow-clarify.md +136 -0
- package/.claude/commands/flow-constitution.md +82 -0
- package/.claude/commands/flow-dev.md +134 -0
- package/.claude/commands/flow-epic.md +150 -0
- package/.claude/commands/flow-fix.md +104 -0
- package/.claude/commands/flow-ideate.md +214 -0
- package/.claude/commands/flow-init.md +313 -0
- package/.claude/commands/flow-new.md +394 -0
- package/.claude/commands/flow-prd.md +131 -0
- package/.claude/commands/flow-qa.md +93 -0
- package/.claude/commands/flow-release.md +92 -0
- package/.claude/commands/flow-restart.md +98 -0
- package/.claude/commands/flow-status.md +64 -0
- package/.claude/commands/flow-tech.md +142 -0
- package/.claude/commands/flow-ui.md +189 -0
- package/.claude/commands/flow-update.md +111 -0
- package/.claude/commands/flow-upgrade.md +115 -0
- package/.claude/commands/flow-verify.md +96 -0
- package/.claude/commands/problem-analyzer.md +60 -0
- package/.claude/config/quality-rules.yml +161 -0
- package/.claude/docs/SPEC_KIT_CONSTITUTION_ANALYSIS.md +426 -0
- package/.claude/docs/design/consistency-conflict-detection-algorithms.md +658 -0
- package/.claude/docs/design/intent-driven-input-design.md +380 -0
- package/.claude/docs/design/prd-version-management-design.md +437 -0
- package/.claude/docs/guides/INIT_TROUBLESHOOTING.md +117 -0
- package/.claude/docs/guides/NEW_TROUBLESHOOTING.md +151 -0
- package/.claude/docs/guides/ROADMAP_TROUBLESHOOTING.md +188 -0
- package/.claude/docs/guides/TASK_COMPLETION_MARKING.md +338 -0
- package/.claude/docs/templates/ARCHITECTURE_TEMPLATE.md +633 -0
- package/.claude/docs/templates/BACKLOG_TEMPLATE.md +261 -0
- package/.claude/docs/templates/CHECKLIST_TEMPLATE.md +52 -0
- package/.claude/docs/templates/CLARIFICATION_REPORT_TEMPLATE.md +206 -0
- package/.claude/docs/templates/CODE_REVIEW_TEMPLATE.md +71 -0
- package/.claude/docs/templates/EPIC_TEMPLATE.md +805 -0
- package/.claude/docs/templates/INIT_FLOW_TEMPLATE.md +213 -0
- package/.claude/docs/templates/INTENT_CLARIFICATION_TEMPLATE.md +57 -0
- package/.claude/docs/templates/NEW_ORCHESTRATION_TEMPLATE.md +148 -0
- package/.claude/docs/templates/PRD_TEMPLATE.md +562 -0
- package/.claude/docs/templates/RESEARCH_TEMPLATE.md +276 -0
- package/.claude/docs/templates/REVIEW-HIGH.md +57 -0
- package/.claude/docs/templates/ROADMAP_DIALOGUE_TEMPLATE.md +198 -0
- package/.claude/docs/templates/ROADMAP_TEMPLATE.md +310 -0
- package/.claude/docs/templates/STYLE_TEMPLATE.md +1266 -0
- package/.claude/docs/templates/TASKS_TEMPLATE.md +523 -0
- package/.claude/docs/templates/TECH_DESIGN_TEMPLATE.md +1019 -0
- package/.claude/docs/templates/UI_PROTOTYPE_TEMPLATE.md +1436 -0
- package/.claude/guides/agent-guides/agent-coordination-guide.md +459 -0
- package/.claude/guides/project-guidelines-system.md +463 -0
- package/.claude/guides/technical-guides/datetime-handling-guide.md +563 -0
- package/.claude/guides/technical-guides/git-github-guide.md +642 -0
- package/.claude/guides/technical-guides/test-execution-guide.md +618 -0
- package/.claude/guides/workflow-guides/bug-fix-orchestrator.md +217 -0
- package/.claude/guides/workflow-guides/flow-orchestrator.md +282 -0
- package/.claude/hooks/checklist-gate.js +397 -0
- package/.claude/hooks/error-handling-reminder.sh +12 -0
- package/.claude/hooks/error-handling-reminder.ts +459 -0
- package/.claude/hooks/post-tool-use-tracker.sh +280 -0
- package/.claude/hooks/pre-tool-use-guardrail.sh +36 -0
- package/.claude/hooks/pre-tool-use-guardrail.ts +342 -0
- package/.claude/hooks/skill-activation-prompt.sh +36 -0
- package/.claude/hooks/skill-activation-prompt.ts +214 -0
- package/.claude/hooks/state/skills-used-test-guard.json +3 -0
- package/.claude/rules/devflow-conventions.md +305 -0
- package/.claude/rules/project-constitution.md +748 -0
- package/.claude/schemas/constitution.schema.json +43 -0
- package/.claude/scripts/analyze-upgrade-impact.sh +200 -0
- package/.claude/scripts/archive-requirement.sh +351 -0
- package/.claude/scripts/calculate-checklist-completion.sh +243 -0
- package/.claude/scripts/calculate-quarter.sh +206 -0
- package/.claude/scripts/check-dependencies.sh +409 -0
- package/.claude/scripts/check-prerequisites.sh +232 -0
- package/.claude/scripts/check-task-status.sh +264 -0
- package/.claude/scripts/checklist-errors.sh +131 -0
- package/.claude/scripts/common.sh +570 -0
- package/.claude/scripts/consolidate-research.sh +182 -0
- package/.claude/scripts/create-requirement.sh +426 -0
- package/.claude/scripts/export-contracts.sh +117 -0
- package/.claude/scripts/extract-data-model.sh +78 -0
- package/.claude/scripts/generate-clarification-questions.sh +377 -0
- package/.claude/scripts/generate-clarification-report.sh +463 -0
- package/.claude/scripts/generate-quickstart.sh +146 -0
- package/.claude/scripts/generate-research-tasks.sh +157 -0
- package/.claude/scripts/generate-status-report.sh +523 -0
- package/.claude/scripts/generate-tech-analysis.sh +46 -0
- package/.claude/scripts/locate-requirement-in-roadmap.sh +233 -0
- package/.claude/scripts/manage-constitution.sh +602 -0
- package/.claude/scripts/mark-task-complete.sh +198 -0
- package/.claude/scripts/populate-research-tasks.sh +259 -0
- package/.claude/scripts/recover-workflow.sh +460 -0
- package/.claude/scripts/run-clarify-scan.sh +601 -0
- package/.claude/scripts/run-high-review.sh +62 -0
- package/.claude/scripts/run-problem-analysis.sh +68 -0
- package/.claude/scripts/setup-epic.sh +173 -0
- package/.claude/scripts/sync-roadmap-progress.sh +300 -0
- package/.claude/scripts/sync-task-marks.sh +199 -0
- package/.claude/scripts/test-clarify-scan.sh +515 -0
- package/.claude/scripts/update-agent-context.sh +806 -0
- package/.claude/scripts/validate-constitution.sh +567 -0
- package/.claude/scripts/validate-hooks.sh +487 -0
- package/.claude/scripts/validate-research.sh +332 -0
- package/.claude/scripts/validate-scope-boundary.sh +493 -0
- package/.claude/scripts/verify-setup.sh +37 -0
- package/.claude/settings.json +76 -0
- package/.claude/skills/_reference-implementations/README.md +96 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/SKILL.md +302 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/architecture-overview.md +451 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/async-and-errors.md +307 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/complete-examples.md +638 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/configuration.md +275 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/database-patterns.md +224 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/middleware-guide.md +213 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/routing-and-controllers.md +756 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/sentry-and-monitoring.md +336 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/services-and-repositories.md +789 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/testing-guide.md +235 -0
- package/.claude/skills/_reference-implementations/backend-express-prisma/resources/validation-patterns.md +754 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/SKILL.md +399 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/common-patterns.md +331 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/complete-examples.md +872 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/component-patterns.md +502 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/data-fetching.md +767 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/file-organization.md +502 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/loading-and-error-states.md +501 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/performance.md +406 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/routing-guide.md +364 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/styling-guide.md +428 -0
- package/.claude/skills/_reference-implementations/frontend-react-mui/resources/typescript-standards.md +418 -0
- package/.claude/skills/cc-devflow-orchestrator/SKILL.md +229 -0
- package/.claude/skills/constitution-guardian/SKILL.md +306 -0
- package/.claude/skills/devflow-constitution-quick-ref/SKILL.md +374 -0
- package/.claude/skills/devflow-file-standards/SKILL.md +353 -0
- package/.claude/skills/devflow-tdd-enforcer/SKILL.md +192 -0
- package/.claude/skills/skill-developer/ADVANCED.md +197 -0
- package/.claude/skills/skill-developer/HOOK_MECHANISMS.md +306 -0
- package/.claude/skills/skill-developer/PATTERNS_LIBRARY.md +152 -0
- package/.claude/skills/skill-developer/SKILL.md +426 -0
- package/.claude/skills/skill-developer/SKILL_RULES_REFERENCE.md +315 -0
- package/.claude/skills/skill-developer/TRIGGER_TYPES.md +305 -0
- package/.claude/skills/skill-developer/TROUBLESHOOTING.md +514 -0
- package/.claude/skills/skill-rules.json +213 -0
- package/.claude/tests/README.md +300 -0
- package/.claude/tests/TODO.md +69 -0
- package/.claude/tests/__pycache__/test_analyze_upgrade_impact.cpython-311-pytest-7.2.2.pyc +0 -0
- package/.claude/tests/__pycache__/test_consolidate_research.cpython-311-pytest-7.2.2.pyc +0 -0
- package/.claude/tests/__pycache__/test_export_contracts.cpython-311-pytest-7.2.2.pyc +0 -0
- package/.claude/tests/__pycache__/test_extract_data_model.cpython-311-pytest-7.2.2.pyc +0 -0
- package/.claude/tests/__pycache__/test_generate_quickstart.cpython-311-pytest-7.2.2.pyc +0 -0
- package/.claude/tests/__pycache__/test_generate_research_tasks.cpython-311-pytest-7.2.2.pyc +0 -0
- package/.claude/tests/constitution/run_all_constitution_tests.sh +111 -0
- package/.claude/tests/constitution/test_agent_assignment.sh +207 -0
- package/.claude/tests/constitution/test_article_coverage.sh +201 -0
- package/.claude/tests/constitution/test_template_completeness.sh +150 -0
- package/.claude/tests/constitution/test_version_consistency.sh +120 -0
- package/.claude/tests/fixtures/spec_delta_full.md +16 -0
- package/.claude/tests/fixtures/tasks_progress_sample.md +5 -0
- package/.claude/tests/run-all-tests.sh +229 -0
- package/.claude/tests/scripts/run.sh +30 -0
- package/.claude/tests/scripts/test-framework.sh +128 -0
- package/.claude/tests/scripts/test_check_prerequisites.sh +511 -0
- package/.claude/tests/scripts/test_check_prerequisites.sh.bak +504 -0
- package/.claude/tests/scripts/test_check_prerequisites.sh.bak2 +505 -0
- package/.claude/tests/scripts/test_check_prerequisites.sh.bak3 +506 -0
- package/.claude/tests/scripts/test_check_prerequisites.sh.bak4 +507 -0
- package/.claude/tests/scripts/test_check_prerequisites.sh.bak5 +508 -0
- package/.claude/tests/scripts/test_check_task_status.sh +499 -0
- package/.claude/tests/scripts/test_common.sh +244 -0
- package/.claude/tests/scripts/test_generate_status_report.sh +71 -0
- package/.claude/tests/scripts/test_mark_task_complete.sh +441 -0
- package/.claude/tests/scripts/test_mark_task_complete.sh.backup +410 -0
- package/.claude/tests/scripts/test_recover_workflow.sh +304 -0
- package/.claude/tests/scripts/test_setup_epic.sh +437 -0
- package/.claude/tests/scripts/test_sync_task_marks.sh +196 -0
- package/.claude/tests/scripts/test_validate_constitution.sh +74 -0
- package/.claude/tests/scripts/test_validate_research.sh +462 -0
- package/.claude/tests/slugify.bats +82 -0
- package/.claude/tests/test-framework.sh +732 -0
- package/.claude/tests/test_analyze_upgrade_impact.py +34 -0
- package/.claude/tests/test_consolidate_research.py +48 -0
- package/.claude/tests/test_export_contracts.py +43 -0
- package/.claude/tests/test_extract_data_model.py +33 -0
- package/.claude/tests/test_generate_quickstart.py +50 -0
- package/.claude/tests/test_generate_research_tasks.py +52 -0
- package/.claude/tsc-cache/6e64f818-6398-49ca-8623-581a9af85c44/edited-files.log +1 -0
- package/.claude/tsc-cache/795ba6e3-b98a-423b-bab2-51aa62812569/affected-repos.txt +1 -0
- package/.claude/tsc-cache/795ba6e3-b98a-423b-bab2-51aa62812569/edited-files.log +1 -0
- package/.claude/tsc-cache/ae335694-be5a-4ba4-a1a0-b676c09a7906/affected-repos.txt +1 -0
- package/.claude/tsc-cache/ae335694-be5a-4ba4-a1a0-b676c09a7906/edited-files.log +1 -0
- package/CHANGELOG.md +507 -0
- package/LICENSE +21 -0
- package/README.md +534 -0
- package/README.zh-CN.md +530 -0
- package/bin/adapt.js +240 -0
- package/bin/cc-devflow-cli.js +185 -0
- package/bin/cc-devflow.js +78 -0
- package/config/adapters.yml +5 -0
- package/config/schema/adapters.schema.json +44 -0
- package/docs/CLAUDE.md +26 -0
- package/docs/commands/README.md +61 -0
- package/docs/commands/README.zh-CN.md +55 -0
- package/docs/commands/core-roadmap.md +106 -0
- package/docs/commands/core-roadmap.zh-CN.md +102 -0
- package/docs/commands/core-style.md +405 -0
- package/docs/commands/core-style.zh-CN.md +405 -0
- package/docs/commands/flow-init.md +134 -0
- package/docs/commands/flow-init.zh-CN.md +163 -0
- package/docs/commands/flow-new.md +274 -0
- package/docs/commands/flow-new.zh-CN.md +270 -0
- package/docs/guides/getting-started.md +204 -0
- package/docs/guides/getting-started.zh-CN.md +152 -0
- package/lib/adapters/adapter-interface.js +57 -0
- package/lib/adapters/claude-adapter.js +74 -0
- package/lib/adapters/codex-adapter.js +40 -0
- package/lib/adapters/config-validator.js +68 -0
- package/lib/adapters/logger.js +42 -0
- package/lib/adapters/registry.js +153 -0
- package/lib/compiler/CLAUDE.md +92 -0
- package/lib/compiler/__tests__/drift.test.js +215 -0
- package/lib/compiler/__tests__/errors.test.js +184 -0
- package/lib/compiler/__tests__/incremental.test.js +174 -0
- package/lib/compiler/__tests__/integration.test.js +174 -0
- package/lib/compiler/__tests__/manifest.test.js +233 -0
- package/lib/compiler/__tests__/parser.test.js +456 -0
- package/lib/compiler/__tests__/schemas.test.js +301 -0
- package/lib/compiler/__tests__/skills-registry.test.js +125 -0
- package/lib/compiler/__tests__/transformer.test.js +286 -0
- package/lib/compiler/emitters/antigravity-emitter.js +171 -0
- package/lib/compiler/emitters/base-emitter.js +73 -0
- package/lib/compiler/emitters/codex-emitter.js +52 -0
- package/lib/compiler/emitters/cursor-emitter.js +31 -0
- package/lib/compiler/emitters/index.js +50 -0
- package/lib/compiler/emitters/qwen-emitter.js +39 -0
- package/lib/compiler/errors.js +119 -0
- package/lib/compiler/index.js +256 -0
- package/lib/compiler/manifest.js +242 -0
- package/lib/compiler/parser.js +258 -0
- package/lib/compiler/platforms.js +113 -0
- package/lib/compiler/resource-copier.js +320 -0
- package/lib/compiler/rules-emitters/__tests__/antigravity-rules-emitter.test.js +191 -0
- package/lib/compiler/rules-emitters/__tests__/codex-rules-emitter.test.js +109 -0
- package/lib/compiler/rules-emitters/__tests__/cursor-rules-emitter.test.js +123 -0
- package/lib/compiler/rules-emitters/__tests__/qwen-rules-emitter.test.js +123 -0
- package/lib/compiler/rules-emitters/antigravity-rules-emitter.js +253 -0
- package/lib/compiler/rules-emitters/base-rules-emitter.js +83 -0
- package/lib/compiler/rules-emitters/codex-rules-emitter.js +116 -0
- package/lib/compiler/rules-emitters/cursor-rules-emitter.js +98 -0
- package/lib/compiler/rules-emitters/index.js +71 -0
- package/lib/compiler/rules-emitters/qwen-rules-emitter.js +70 -0
- package/lib/compiler/schemas.js +144 -0
- package/lib/compiler/skills-registry.js +225 -0
- package/lib/compiler/transformer.js +236 -0
- package/package.json +50 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# ═══════════════════════════════════════════════════════════════════════════════
|
|
4
|
+
# CC-DevFlow Hooks 依赖检查脚本
|
|
5
|
+
# ═══════════════════════════════════════════════════════════════════════════════
|
|
6
|
+
#
|
|
7
|
+
# 【核心功能】
|
|
8
|
+
# 1. 检查 Hooks 系统所需的所有依赖
|
|
9
|
+
# 2. 提供安装缺失依赖的指导
|
|
10
|
+
# 3. 可选:自动安装缺失的依赖(需要 --install 参数)
|
|
11
|
+
#
|
|
12
|
+
# 【使用方式】
|
|
13
|
+
# ./check-dependencies.sh # 仅检查
|
|
14
|
+
# ./check-dependencies.sh --install # 检查并自动安装
|
|
15
|
+
# ./check-dependencies.sh --verbose # 显示详细信息
|
|
16
|
+
#
|
|
17
|
+
# 【设计哲学】
|
|
18
|
+
# "环境应该是可复现的,依赖应该是明确的"
|
|
19
|
+
# 新团队成员或 CI 环境应该能快速搭建 hooks 运行环境
|
|
20
|
+
#
|
|
21
|
+
# ═══════════════════════════════════════════════════════════════════════════════
|
|
22
|
+
|
|
23
|
+
set -e
|
|
24
|
+
|
|
25
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
26
|
+
# 颜色定义
|
|
27
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
28
|
+
RED='\033[0;31m'
|
|
29
|
+
GREEN='\033[0;32m'
|
|
30
|
+
YELLOW='\033[1;33m'
|
|
31
|
+
BLUE='\033[0;34m'
|
|
32
|
+
NC='\033[0m' # No Color
|
|
33
|
+
|
|
34
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
35
|
+
# 工具函数
|
|
36
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
37
|
+
|
|
38
|
+
log_success() {
|
|
39
|
+
echo -e "${GREEN}✅ $1${NC}"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
log_warning() {
|
|
43
|
+
echo -e "${YELLOW}⚠️ $1${NC}"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
log_error() {
|
|
47
|
+
echo -e "${RED}❌ $1${NC}"
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
log_info() {
|
|
51
|
+
echo -e "${BLUE}ℹ️ $1${NC}"
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
log_section() {
|
|
55
|
+
echo ""
|
|
56
|
+
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
57
|
+
echo -e "${BLUE}$1${NC}"
|
|
58
|
+
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
62
|
+
# 全局变量
|
|
63
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
64
|
+
MISSING_DEPS=()
|
|
65
|
+
INSTALL_MODE=false
|
|
66
|
+
VERBOSE=false
|
|
67
|
+
|
|
68
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
69
|
+
# 检查函数
|
|
70
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
71
|
+
|
|
72
|
+
# ┌───────────────────────────────────────────────────────────────┐
|
|
73
|
+
# │ 检查 Node.js │
|
|
74
|
+
# └───────────────────────────────────────────────────────────────┘
|
|
75
|
+
check_node() {
|
|
76
|
+
log_section "📦 检查 Node.js"
|
|
77
|
+
|
|
78
|
+
if command -v node &> /dev/null; then
|
|
79
|
+
local node_version=$(node --version)
|
|
80
|
+
local major_version=$(echo "$node_version" | cut -d'.' -f1 | sed 's/v//')
|
|
81
|
+
|
|
82
|
+
# 要求 Node.js >= 18 (ESM 支持,稳定的 TS 支持)
|
|
83
|
+
if [[ $major_version -ge 18 ]]; then
|
|
84
|
+
log_success "Node.js $node_version 已安装"
|
|
85
|
+
[[ "$VERBOSE" == "true" ]] && log_info "路径: $(which node)"
|
|
86
|
+
return 0
|
|
87
|
+
else
|
|
88
|
+
log_warning "Node.js 版本过低: $node_version (需要 >= 18.x)"
|
|
89
|
+
log_info "当前版本可用,但建议升级"
|
|
90
|
+
return 0
|
|
91
|
+
fi
|
|
92
|
+
else
|
|
93
|
+
log_error "Node.js 未安装"
|
|
94
|
+
MISSING_DEPS+=("node")
|
|
95
|
+
return 1
|
|
96
|
+
fi
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
# ┌───────────────────────────────────────────────────────────────┐
|
|
100
|
+
# │ 检查 jq (JSON 处理工具) │
|
|
101
|
+
# └───────────────────────────────────────────────────────────────┘
|
|
102
|
+
check_jq() {
|
|
103
|
+
log_section "🔧 检查 jq"
|
|
104
|
+
|
|
105
|
+
if command -v jq &> /dev/null; then
|
|
106
|
+
local jq_version=$(jq --version)
|
|
107
|
+
log_success "jq $jq_version 已安装"
|
|
108
|
+
[[ "$VERBOSE" == "true" ]] && log_info "路径: $(which jq)"
|
|
109
|
+
return 0
|
|
110
|
+
else
|
|
111
|
+
log_error "jq 未安装"
|
|
112
|
+
log_info "jq 用于 post-tool-use-tracker.sh 和 validate-hooks.sh"
|
|
113
|
+
MISSING_DEPS+=("jq")
|
|
114
|
+
return 1
|
|
115
|
+
fi
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
# ┌───────────────────────────────────────────────────────────────┐
|
|
119
|
+
# │ 检查 Bash │
|
|
120
|
+
# └───────────────────────────────────────────────────────────────┘
|
|
121
|
+
check_bash() {
|
|
122
|
+
log_section "🐚 检查 Bash"
|
|
123
|
+
|
|
124
|
+
if command -v bash &> /dev/null; then
|
|
125
|
+
local bash_version=$(bash --version | head -1)
|
|
126
|
+
log_success "Bash 已安装: $bash_version"
|
|
127
|
+
[[ "$VERBOSE" == "true" ]] && log_info "路径: $(which bash)"
|
|
128
|
+
|
|
129
|
+
# 检查版本是否 >= 3.2(macOS 默认版本)
|
|
130
|
+
local version=$(echo "$bash_version" | grep -oE '[0-9]+\.[0-9]+' | head -1)
|
|
131
|
+
local major=$(echo "$version" | cut -d'.' -f1)
|
|
132
|
+
|
|
133
|
+
if [[ $major -ge 3 ]]; then
|
|
134
|
+
log_success "Bash 版本满足要求 (>= 3.2)"
|
|
135
|
+
else
|
|
136
|
+
log_warning "Bash 版本较低: $version"
|
|
137
|
+
fi
|
|
138
|
+
return 0
|
|
139
|
+
else
|
|
140
|
+
log_error "Bash 未安装(几乎不可能出现此情况)"
|
|
141
|
+
MISSING_DEPS+=("bash")
|
|
142
|
+
return 1
|
|
143
|
+
fi
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
# ┌───────────────────────────────────────────────────────────────┐
|
|
147
|
+
# │ 检查 TypeScript (可选,但推荐) │
|
|
148
|
+
# └───────────────────────────────────────────────────────────────┘
|
|
149
|
+
check_typescript() {
|
|
150
|
+
log_section "📘 检查 TypeScript (可选)"
|
|
151
|
+
|
|
152
|
+
if command -v tsc &> /dev/null; then
|
|
153
|
+
local ts_version=$(tsc --version)
|
|
154
|
+
log_success "TypeScript $ts_version 已安装"
|
|
155
|
+
[[ "$VERBOSE" == "true" ]] && log_info "路径: $(which tsc)"
|
|
156
|
+
return 0
|
|
157
|
+
else
|
|
158
|
+
log_info "TypeScript 未安装(hooks 可以直接运行 .ts 文件,无需编译)"
|
|
159
|
+
log_info "安装 TypeScript 可以获得更好的类型检查体验"
|
|
160
|
+
return 0
|
|
161
|
+
fi
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
165
|
+
# 安装函数
|
|
166
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
167
|
+
|
|
168
|
+
install_dependencies() {
|
|
169
|
+
if [[ ${#MISSING_DEPS[@]} -eq 0 ]]; then
|
|
170
|
+
log_success "无需安装任何依赖"
|
|
171
|
+
return 0
|
|
172
|
+
fi
|
|
173
|
+
|
|
174
|
+
log_section "📥 安装缺失的依赖"
|
|
175
|
+
|
|
176
|
+
# 检测操作系统
|
|
177
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
178
|
+
# macOS
|
|
179
|
+
install_macos
|
|
180
|
+
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
181
|
+
# Linux
|
|
182
|
+
install_linux
|
|
183
|
+
else
|
|
184
|
+
log_error "不支持的操作系统: $OSTYPE"
|
|
185
|
+
log_info "请手动安装以下依赖: ${MISSING_DEPS[*]}"
|
|
186
|
+
return 1
|
|
187
|
+
fi
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
install_macos() {
|
|
191
|
+
log_info "检测到 macOS 系统"
|
|
192
|
+
|
|
193
|
+
# 检查 Homebrew
|
|
194
|
+
if ! command -v brew &> /dev/null; then
|
|
195
|
+
log_error "Homebrew 未安装"
|
|
196
|
+
log_info "请访问 https://brew.sh/ 安装 Homebrew"
|
|
197
|
+
log_info "或运行: /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
|
|
198
|
+
return 1
|
|
199
|
+
fi
|
|
200
|
+
|
|
201
|
+
for dep in "${MISSING_DEPS[@]}"; do
|
|
202
|
+
case $dep in
|
|
203
|
+
node)
|
|
204
|
+
log_info "安装 Node.js..."
|
|
205
|
+
brew install node
|
|
206
|
+
;;
|
|
207
|
+
jq)
|
|
208
|
+
log_info "安装 jq..."
|
|
209
|
+
brew install jq
|
|
210
|
+
;;
|
|
211
|
+
bash)
|
|
212
|
+
log_info "安装 Bash (更新版本)..."
|
|
213
|
+
brew install bash
|
|
214
|
+
;;
|
|
215
|
+
*)
|
|
216
|
+
log_warning "未知依赖: $dep"
|
|
217
|
+
;;
|
|
218
|
+
esac
|
|
219
|
+
done
|
|
220
|
+
|
|
221
|
+
log_success "依赖安装完成"
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
install_linux() {
|
|
225
|
+
log_info "检测到 Linux 系统"
|
|
226
|
+
|
|
227
|
+
# 检测包管理器
|
|
228
|
+
if command -v apt-get &> /dev/null; then
|
|
229
|
+
PKG_MANAGER="apt-get"
|
|
230
|
+
UPDATE_CMD="sudo apt-get update"
|
|
231
|
+
elif command -v yum &> /dev/null; then
|
|
232
|
+
PKG_MANAGER="yum"
|
|
233
|
+
UPDATE_CMD="sudo yum update"
|
|
234
|
+
elif command -v dnf &> /dev/null; then
|
|
235
|
+
PKG_MANAGER="dnf"
|
|
236
|
+
UPDATE_CMD="sudo dnf update"
|
|
237
|
+
else
|
|
238
|
+
log_error "未检测到支持的包管理器 (apt-get/yum/dnf)"
|
|
239
|
+
log_info "请手动安装以下依赖: ${MISSING_DEPS[*]}"
|
|
240
|
+
return 1
|
|
241
|
+
fi
|
|
242
|
+
|
|
243
|
+
log_info "使用包管理器: $PKG_MANAGER"
|
|
244
|
+
|
|
245
|
+
for dep in "${MISSING_DEPS[@]}"; do
|
|
246
|
+
case $dep in
|
|
247
|
+
node)
|
|
248
|
+
log_info "安装 Node.js..."
|
|
249
|
+
if [[ "$PKG_MANAGER" == "apt-get" ]]; then
|
|
250
|
+
# 使用 NodeSource 仓库获取最新版本
|
|
251
|
+
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
|
|
252
|
+
sudo apt-get install -y nodejs
|
|
253
|
+
else
|
|
254
|
+
sudo $PKG_MANAGER install -y nodejs
|
|
255
|
+
fi
|
|
256
|
+
;;
|
|
257
|
+
jq)
|
|
258
|
+
log_info "安装 jq..."
|
|
259
|
+
sudo $PKG_MANAGER install -y jq
|
|
260
|
+
;;
|
|
261
|
+
bash)
|
|
262
|
+
log_info "安装 Bash..."
|
|
263
|
+
sudo $PKG_MANAGER install -y bash
|
|
264
|
+
;;
|
|
265
|
+
*)
|
|
266
|
+
log_warning "未知依赖: $dep"
|
|
267
|
+
;;
|
|
268
|
+
esac
|
|
269
|
+
done
|
|
270
|
+
|
|
271
|
+
log_success "依赖安装完成"
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
275
|
+
# 显示安装指导
|
|
276
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
277
|
+
|
|
278
|
+
show_install_guide() {
|
|
279
|
+
if [[ ${#MISSING_DEPS[@]} -eq 0 ]]; then
|
|
280
|
+
return 0
|
|
281
|
+
fi
|
|
282
|
+
|
|
283
|
+
log_section "📚 安装指导"
|
|
284
|
+
|
|
285
|
+
echo "缺失的依赖: ${MISSING_DEPS[*]}"
|
|
286
|
+
echo ""
|
|
287
|
+
|
|
288
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
289
|
+
echo "macOS 安装命令:"
|
|
290
|
+
for dep in "${MISSING_DEPS[@]}"; do
|
|
291
|
+
case $dep in
|
|
292
|
+
node)
|
|
293
|
+
echo " brew install node"
|
|
294
|
+
;;
|
|
295
|
+
jq)
|
|
296
|
+
echo " brew install jq"
|
|
297
|
+
;;
|
|
298
|
+
bash)
|
|
299
|
+
echo " brew install bash"
|
|
300
|
+
;;
|
|
301
|
+
esac
|
|
302
|
+
done
|
|
303
|
+
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
304
|
+
echo "Linux 安装命令:"
|
|
305
|
+
for dep in "${MISSING_DEPS[@]}"; do
|
|
306
|
+
case $dep in
|
|
307
|
+
node)
|
|
308
|
+
echo " # Ubuntu/Debian:"
|
|
309
|
+
echo " curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -"
|
|
310
|
+
echo " sudo apt-get install -y nodejs"
|
|
311
|
+
echo ""
|
|
312
|
+
echo " # RHEL/CentOS:"
|
|
313
|
+
echo " sudo yum install -y nodejs"
|
|
314
|
+
;;
|
|
315
|
+
jq)
|
|
316
|
+
echo " sudo apt-get install -y jq # Ubuntu/Debian"
|
|
317
|
+
echo " sudo yum install -y jq # RHEL/CentOS"
|
|
318
|
+
;;
|
|
319
|
+
bash)
|
|
320
|
+
echo " sudo apt-get install -y bash # Ubuntu/Debian"
|
|
321
|
+
echo " sudo yum install -y bash # RHEL/CentOS"
|
|
322
|
+
;;
|
|
323
|
+
esac
|
|
324
|
+
done
|
|
325
|
+
fi
|
|
326
|
+
|
|
327
|
+
echo ""
|
|
328
|
+
log_info "或者运行: $0 --install (自动安装)"
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
332
|
+
# 主函数
|
|
333
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
334
|
+
|
|
335
|
+
main() {
|
|
336
|
+
echo ""
|
|
337
|
+
echo "╔════════════════════════════════════════════════════════════╗"
|
|
338
|
+
echo "║ CC-DevFlow Hooks 依赖检查工具 ║"
|
|
339
|
+
echo "╚════════════════════════════════════════════════════════════╝"
|
|
340
|
+
echo ""
|
|
341
|
+
|
|
342
|
+
# 解析参数
|
|
343
|
+
while [[ $# -gt 0 ]]; do
|
|
344
|
+
case $1 in
|
|
345
|
+
--install)
|
|
346
|
+
INSTALL_MODE=true
|
|
347
|
+
shift
|
|
348
|
+
;;
|
|
349
|
+
--verbose|-v)
|
|
350
|
+
VERBOSE=true
|
|
351
|
+
shift
|
|
352
|
+
;;
|
|
353
|
+
--help|-h)
|
|
354
|
+
echo "使用方式:"
|
|
355
|
+
echo " $0 检查依赖"
|
|
356
|
+
echo " $0 --install 检查并自动安装缺失的依赖"
|
|
357
|
+
echo " $0 --verbose 显示详细信息"
|
|
358
|
+
echo ""
|
|
359
|
+
echo "必需依赖:"
|
|
360
|
+
echo " - Node.js >= 18 (运行 TypeScript hooks)"
|
|
361
|
+
echo " - jq (JSON 处理)"
|
|
362
|
+
echo " - bash >= 3.2 (运行 shell hooks)"
|
|
363
|
+
echo ""
|
|
364
|
+
echo "可选依赖:"
|
|
365
|
+
echo " - TypeScript (类型检查,非必需)"
|
|
366
|
+
exit 0
|
|
367
|
+
;;
|
|
368
|
+
*)
|
|
369
|
+
log_error "未知参数: $1"
|
|
370
|
+
exit 1
|
|
371
|
+
;;
|
|
372
|
+
esac
|
|
373
|
+
done
|
|
374
|
+
|
|
375
|
+
# 执行检查
|
|
376
|
+
check_node
|
|
377
|
+
check_jq
|
|
378
|
+
check_bash
|
|
379
|
+
check_typescript
|
|
380
|
+
|
|
381
|
+
# 总结
|
|
382
|
+
echo ""
|
|
383
|
+
log_section "📊 检查总结"
|
|
384
|
+
|
|
385
|
+
if [[ ${#MISSING_DEPS[@]} -eq 0 ]]; then
|
|
386
|
+
log_success "所有必需依赖已安装!Hooks 系统可以正常运行。"
|
|
387
|
+
echo ""
|
|
388
|
+
log_info "下一步: 运行 ./.claude/scripts/validate-hooks.sh 验证 hooks 配置"
|
|
389
|
+
exit 0
|
|
390
|
+
else
|
|
391
|
+
log_error "发现 ${#MISSING_DEPS[@]} 个缺失的依赖: ${MISSING_DEPS[*]}"
|
|
392
|
+
echo ""
|
|
393
|
+
|
|
394
|
+
if [[ "$INSTALL_MODE" == "true" ]]; then
|
|
395
|
+
install_dependencies
|
|
396
|
+
echo ""
|
|
397
|
+
log_info "重新检查依赖..."
|
|
398
|
+
exec "$0" --verbose
|
|
399
|
+
else
|
|
400
|
+
show_install_guide
|
|
401
|
+
exit 1
|
|
402
|
+
fi
|
|
403
|
+
fi
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
407
|
+
# 入口
|
|
408
|
+
# ───────────────────────────────────────────────────────────────────────────────
|
|
409
|
+
main "$@"
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Consolidated prerequisite checking script for cc-devflow
|
|
4
|
+
#
|
|
5
|
+
# This script provides unified prerequisite checking for development workflow.
|
|
6
|
+
# Based on spec-kit design principles with cc-devflow enhancements.
|
|
7
|
+
#
|
|
8
|
+
# Usage: ./check-prerequisites.sh [OPTIONS]
|
|
9
|
+
#
|
|
10
|
+
# OPTIONS:
|
|
11
|
+
# --json Output in JSON format
|
|
12
|
+
# --require-epic Require EPIC.md to exist (for task generation phase)
|
|
13
|
+
# --require-tasks Require tasks/ to exist (for implementation phase)
|
|
14
|
+
# --include-tasks Include tasks/ in AVAILABLE_DOCS list
|
|
15
|
+
# --paths-only Only output path variables (no validation)
|
|
16
|
+
# --help, -h Show help message
|
|
17
|
+
#
|
|
18
|
+
# OUTPUTS:
|
|
19
|
+
# JSON mode: {"REQ_ID":"...", "REQ_DIR":"...", "AVAILABLE_DOCS":["..."]}
|
|
20
|
+
# Text mode: REQ_ID:... \n REQ_DIR:... \n AVAILABLE_DOCS: \n ✓/✗ file.md
|
|
21
|
+
# Paths only: REPO_ROOT: ... \n REQ_ID: ... \n REQ_DIR: ... etc.
|
|
22
|
+
|
|
23
|
+
set -e
|
|
24
|
+
|
|
25
|
+
# Parse command line arguments
|
|
26
|
+
JSON_MODE=false
|
|
27
|
+
REQUIRE_EPIC=false
|
|
28
|
+
REQUIRE_TASKS=false
|
|
29
|
+
INCLUDE_TASKS=false
|
|
30
|
+
PATHS_ONLY=false
|
|
31
|
+
|
|
32
|
+
for arg in "$@"; do
|
|
33
|
+
case "$arg" in
|
|
34
|
+
--json)
|
|
35
|
+
JSON_MODE=true
|
|
36
|
+
;;
|
|
37
|
+
--require-epic)
|
|
38
|
+
REQUIRE_EPIC=true
|
|
39
|
+
;;
|
|
40
|
+
--require-tasks)
|
|
41
|
+
REQUIRE_TASKS=true
|
|
42
|
+
;;
|
|
43
|
+
--include-tasks)
|
|
44
|
+
INCLUDE_TASKS=true
|
|
45
|
+
;;
|
|
46
|
+
--paths-only)
|
|
47
|
+
PATHS_ONLY=true
|
|
48
|
+
;;
|
|
49
|
+
--help|-h)
|
|
50
|
+
cat << 'EOF'
|
|
51
|
+
Usage: check-prerequisites.sh [OPTIONS]
|
|
52
|
+
|
|
53
|
+
Consolidated prerequisite checking for cc-devflow workflow.
|
|
54
|
+
|
|
55
|
+
OPTIONS:
|
|
56
|
+
--json Output in JSON format
|
|
57
|
+
--require-epic Require EPIC.md to exist (for task generation phase)
|
|
58
|
+
--require-tasks Require tasks/ to exist (for implementation phase)
|
|
59
|
+
--include-tasks Include tasks/ in AVAILABLE_DOCS list
|
|
60
|
+
--paths-only Only output path variables (no prerequisite validation)
|
|
61
|
+
--help, -h Show this help message
|
|
62
|
+
|
|
63
|
+
EXAMPLES:
|
|
64
|
+
# Check planning prerequisites (PRD.md required)
|
|
65
|
+
./check-prerequisites.sh --json
|
|
66
|
+
|
|
67
|
+
# Check task generation prerequisites (PRD.md + EPIC.md required)
|
|
68
|
+
./check-prerequisites.sh --json --require-epic
|
|
69
|
+
|
|
70
|
+
# Check implementation prerequisites (PRD.md + EPIC.md + tasks/ required)
|
|
71
|
+
./check-prerequisites.sh --json --require-epic --require-tasks --include-tasks
|
|
72
|
+
|
|
73
|
+
# Get requirement paths only (no validation)
|
|
74
|
+
./check-prerequisites.sh --paths-only
|
|
75
|
+
|
|
76
|
+
EOF
|
|
77
|
+
exit 0
|
|
78
|
+
;;
|
|
79
|
+
*)
|
|
80
|
+
echo "ERROR: Unknown option '$arg'. Use --help for usage information." >&2
|
|
81
|
+
exit 1
|
|
82
|
+
;;
|
|
83
|
+
esac
|
|
84
|
+
done
|
|
85
|
+
|
|
86
|
+
# Source common functions
|
|
87
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
88
|
+
source "$SCRIPT_DIR/common.sh"
|
|
89
|
+
|
|
90
|
+
# Get requirement paths
|
|
91
|
+
eval $(get_requirement_paths)
|
|
92
|
+
|
|
93
|
+
# Validate requirement ID exists
|
|
94
|
+
if [[ -z "$REQ_ID" ]]; then
|
|
95
|
+
echo "ERROR: No requirement ID found" >&2
|
|
96
|
+
echo "Please ensure you are on a feature branch (feature/REQ-XXX-title)" >&2
|
|
97
|
+
echo "Or set DEVFLOW_REQ_ID environment variable" >&2
|
|
98
|
+
exit 1
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# Validate requirement ID format
|
|
102
|
+
validate_req_id "$REQ_ID" || exit 1
|
|
103
|
+
|
|
104
|
+
# If paths-only mode, output paths and exit (support JSON + paths-only combined)
|
|
105
|
+
if $PATHS_ONLY; then
|
|
106
|
+
if $JSON_MODE; then
|
|
107
|
+
# Minimal JSON paths payload (no validation performed)
|
|
108
|
+
printf '{"%s":"%s","%s":"%s","%s":"%s","%s":"%s","%s":"%s","%s":"%s"}\n' \
|
|
109
|
+
"REPO_ROOT" "$REPO_ROOT" \
|
|
110
|
+
"REQ_ID" "$REQ_ID" \
|
|
111
|
+
"REQ_TYPE" "$REQ_TYPE" \
|
|
112
|
+
"REQ_DIR" "$REQ_DIR" \
|
|
113
|
+
"PRD_FILE" "$PRD_FILE" \
|
|
114
|
+
"EPIC_FILE" "$EPIC_FILE"
|
|
115
|
+
else
|
|
116
|
+
echo "REPO_ROOT: $REPO_ROOT"
|
|
117
|
+
echo "REQ_ID: $REQ_ID"
|
|
118
|
+
echo "REQ_TYPE: $REQ_TYPE"
|
|
119
|
+
echo "REQ_DIR: $REQ_DIR"
|
|
120
|
+
echo "PRD_FILE: $PRD_FILE"
|
|
121
|
+
echo "EPIC_FILE: $EPIC_FILE"
|
|
122
|
+
fi
|
|
123
|
+
exit 0
|
|
124
|
+
fi
|
|
125
|
+
|
|
126
|
+
# Validate required directories and files
|
|
127
|
+
if [[ ! -d "$REQ_DIR" ]]; then
|
|
128
|
+
echo "ERROR: Requirement directory not found: $REQ_DIR" >&2
|
|
129
|
+
echo "Run /flow-new first to create the requirement structure." >&2
|
|
130
|
+
exit 1
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
if [[ ! -f "$PRD_FILE" ]]; then
|
|
134
|
+
echo "ERROR: PRD.md not found in $REQ_DIR" >&2
|
|
135
|
+
echo "Run prd-writer agent first to create the PRD." >&2
|
|
136
|
+
exit 1
|
|
137
|
+
fi
|
|
138
|
+
|
|
139
|
+
# Check for EPIC.md if required
|
|
140
|
+
if $REQUIRE_EPIC && [[ ! -f "$EPIC_FILE" ]]; then
|
|
141
|
+
echo "ERROR: EPIC.md not found in $REQ_DIR" >&2
|
|
142
|
+
echo "Run planner agent first to create the Epic." >&2
|
|
143
|
+
exit 1
|
|
144
|
+
fi
|
|
145
|
+
|
|
146
|
+
# Check for tasks/ or TASKS.md if required
|
|
147
|
+
# Support both tasks/ directory (old format) and TASKS.md file (new format)
|
|
148
|
+
if $REQUIRE_TASKS; then
|
|
149
|
+
TASKS_FILE="$REQ_DIR/TASKS.md"
|
|
150
|
+
if [[ ! -d "$TASKS_DIR" || -z "$(ls -A "$TASKS_DIR" 2>/dev/null)" ]] && [[ ! -f "$TASKS_FILE" ]]; then
|
|
151
|
+
echo "ERROR: Neither tasks/ directory nor TASKS.md file found in $REQ_DIR" >&2
|
|
152
|
+
echo "Run planner agent first to create the task breakdown." >&2
|
|
153
|
+
exit 1
|
|
154
|
+
fi
|
|
155
|
+
fi
|
|
156
|
+
|
|
157
|
+
# Build list of available documents
|
|
158
|
+
docs=()
|
|
159
|
+
|
|
160
|
+
# Check optional docs
|
|
161
|
+
[[ -d "$RESEARCH_DIR" && -n "$(ls -A "$RESEARCH_DIR" 2>/dev/null)" ]] && docs+=("research/")
|
|
162
|
+
[[ -f "$TEST_PLAN_FILE" ]] && docs+=("TEST_PLAN.md")
|
|
163
|
+
[[ -f "$SECURITY_PLAN_FILE" ]] && docs+=("SECURITY_PLAN.md")
|
|
164
|
+
[[ -f "$TEST_REPORT_FILE" ]] && docs+=("TEST_REPORT.md")
|
|
165
|
+
[[ -f "$SECURITY_REPORT_FILE" ]] && docs+=("SECURITY_REPORT.md")
|
|
166
|
+
[[ -f "$RELEASE_PLAN_FILE" ]] && docs+=("RELEASE_PLAN.md")
|
|
167
|
+
[[ -f "$LOG_FILE" ]] && docs+=("EXECUTION_LOG.md")
|
|
168
|
+
|
|
169
|
+
# Include tasks/ or TASKS.md if requested and it exists
|
|
170
|
+
# Support both tasks/ directory (old format) and TASKS.md file (new format)
|
|
171
|
+
if $INCLUDE_TASKS; then
|
|
172
|
+
TASKS_FILE="$REQ_DIR/TASKS.md"
|
|
173
|
+
if [[ -d "$TASKS_DIR" && -n "$(ls -A "$TASKS_DIR" 2>/dev/null)" ]]; then
|
|
174
|
+
docs+=("tasks/")
|
|
175
|
+
elif [[ -f "$TASKS_FILE" ]]; then
|
|
176
|
+
docs+=("TASKS.md")
|
|
177
|
+
fi
|
|
178
|
+
fi
|
|
179
|
+
|
|
180
|
+
# For BUG type, check BUG-specific files
|
|
181
|
+
if [[ "$REQ_TYPE" == "bug" ]]; then
|
|
182
|
+
[[ -f "$ANALYSIS_FILE" ]] && docs+=("ANALYSIS.md")
|
|
183
|
+
[[ -f "$PLAN_FILE" ]] && docs+=("PLAN.md")
|
|
184
|
+
fi
|
|
185
|
+
|
|
186
|
+
# Output results
|
|
187
|
+
if $JSON_MODE; then
|
|
188
|
+
# Build JSON array of documents
|
|
189
|
+
if [[ ${#docs[@]} -eq 0 ]]; then
|
|
190
|
+
json_docs="[]"
|
|
191
|
+
else
|
|
192
|
+
json_docs=$(printf '"%s",' "${docs[@]}")
|
|
193
|
+
json_docs="[${json_docs%,}]"
|
|
194
|
+
fi
|
|
195
|
+
|
|
196
|
+
printf '{"%s":"%s","%s":"%s","%s":"%s","%s":%s}\n' \
|
|
197
|
+
"REQ_ID" "$REQ_ID" \
|
|
198
|
+
"REQ_TYPE" "$REQ_TYPE" \
|
|
199
|
+
"REQ_DIR" "$REQ_DIR" \
|
|
200
|
+
"AVAILABLE_DOCS" "$json_docs"
|
|
201
|
+
else
|
|
202
|
+
# Text output
|
|
203
|
+
echo "REQ_ID: $REQ_ID"
|
|
204
|
+
echo "REQ_TYPE: $REQ_TYPE"
|
|
205
|
+
echo "REQ_DIR: $REQ_DIR"
|
|
206
|
+
echo "AVAILABLE_DOCS:"
|
|
207
|
+
|
|
208
|
+
# Show status of each potential document
|
|
209
|
+
check_dir "$RESEARCH_DIR" "research/"
|
|
210
|
+
check_file "$TEST_PLAN_FILE" "TEST_PLAN.md"
|
|
211
|
+
check_file "$SECURITY_PLAN_FILE" "SECURITY_PLAN.md"
|
|
212
|
+
check_file "$TEST_REPORT_FILE" "TEST_REPORT.md"
|
|
213
|
+
check_file "$SECURITY_REPORT_FILE" "SECURITY_REPORT.md"
|
|
214
|
+
check_file "$RELEASE_PLAN_FILE" "RELEASE_PLAN.md"
|
|
215
|
+
check_file "$LOG_FILE" "EXECUTION_LOG.md"
|
|
216
|
+
|
|
217
|
+
if $INCLUDE_TASKS; then
|
|
218
|
+
TASKS_FILE="$REQ_DIR/TASKS.md"
|
|
219
|
+
# Check for tasks/ directory first, fallback to TASKS.md
|
|
220
|
+
if [[ -d "$TASKS_DIR" && -n "$(ls -A "$TASKS_DIR" 2>/dev/null)" ]]; then
|
|
221
|
+
check_dir "$TASKS_DIR" "tasks/"
|
|
222
|
+
else
|
|
223
|
+
check_file "$TASKS_FILE" "TASKS.md"
|
|
224
|
+
fi
|
|
225
|
+
fi
|
|
226
|
+
|
|
227
|
+
# BUG-specific files
|
|
228
|
+
if [[ "$REQ_TYPE" == "bug" ]]; then
|
|
229
|
+
check_file "$ANALYSIS_FILE" "ANALYSIS.md"
|
|
230
|
+
check_file "$PLAN_FILE" "PLAN.md"
|
|
231
|
+
fi
|
|
232
|
+
fi
|