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,441 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_mark_task_complete.sh - 测试 mark-task-complete.sh
|
|
3
|
+
|
|
4
|
+
# 加载测试框架
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
+
source "$SCRIPT_DIR/../test-framework.sh"
|
|
7
|
+
|
|
8
|
+
# 脚本路径
|
|
9
|
+
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
10
|
+
MARK_TASK_SCRIPT="$REPO_ROOT/scripts/mark-task-complete.sh"
|
|
11
|
+
|
|
12
|
+
# ============================================================================
|
|
13
|
+
# 辅助函数
|
|
14
|
+
# ============================================================================
|
|
15
|
+
|
|
16
|
+
# 创建测试专用的 common.sh
|
|
17
|
+
create_test_common() {
|
|
18
|
+
local test_common="$TEST_TMP_DIR/scripts/common.sh"
|
|
19
|
+
mkdir -p "$(dirname "$test_common")"
|
|
20
|
+
|
|
21
|
+
# Use awk instead of sed for proper variable substitution
|
|
22
|
+
awk -v tmpdir="$TEST_TMP_DIR" '
|
|
23
|
+
/^get_repo_root\(\)/ {
|
|
24
|
+
print "get_repo_root() {"
|
|
25
|
+
print " echo \"" tmpdir "\""
|
|
26
|
+
print "}"
|
|
27
|
+
in_function = 1
|
|
28
|
+
next
|
|
29
|
+
}
|
|
30
|
+
in_function && /^}/ {
|
|
31
|
+
in_function = 0
|
|
32
|
+
next
|
|
33
|
+
}
|
|
34
|
+
!in_function {
|
|
35
|
+
print
|
|
36
|
+
}
|
|
37
|
+
' "$REPO_ROOT/scripts/common.sh" > "$test_common.tmp"
|
|
38
|
+
|
|
39
|
+
mv "$test_common.tmp" "$test_common"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# 创建带有任务的需求环境
|
|
43
|
+
setup_requirement_with_tasks() {
|
|
44
|
+
local req_id="$1"
|
|
45
|
+
local req_dir="$TEST_TMP_DIR/devflow/requirements/$req_id"
|
|
46
|
+
|
|
47
|
+
mkdir -p "$req_dir"
|
|
48
|
+
|
|
49
|
+
# 创建 TASKS.md
|
|
50
|
+
cat > "$req_dir/TASKS.md" << 'EOF'
|
|
51
|
+
# Tasks for REQ-001
|
|
52
|
+
|
|
53
|
+
## Task List
|
|
54
|
+
|
|
55
|
+
- [ ] **T001**: Implement user authentication
|
|
56
|
+
- [ ] **T002**: Add password validation
|
|
57
|
+
- [x] **T003**: Setup database schema
|
|
58
|
+
- [ ] **T004**: Create API endpoints
|
|
59
|
+
EOF
|
|
60
|
+
|
|
61
|
+
# 创建 EXECUTION_LOG.md
|
|
62
|
+
echo "# Execution Log" > "$req_dir/EXECUTION_LOG.md"
|
|
63
|
+
|
|
64
|
+
echo "$req_dir"
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
# 运行 mark-task-complete.sh
|
|
68
|
+
run_mark_task() {
|
|
69
|
+
local task_id="$1"
|
|
70
|
+
shift
|
|
71
|
+
local args=("$@")
|
|
72
|
+
|
|
73
|
+
# 设置环境
|
|
74
|
+
export DEVFLOW_REQ_ID="REQ-001"
|
|
75
|
+
|
|
76
|
+
# 创建测试专用的脚本副本
|
|
77
|
+
local test_scripts_dir="$TEST_TMP_DIR/scripts"
|
|
78
|
+
mkdir -p "$test_scripts_dir"
|
|
79
|
+
|
|
80
|
+
# 创建测试专用的 common.sh
|
|
81
|
+
create_test_common
|
|
82
|
+
|
|
83
|
+
# 复制 mark-task-complete.sh 到测试目录
|
|
84
|
+
cp "$MARK_TASK_SCRIPT" "$test_scripts_dir/"
|
|
85
|
+
|
|
86
|
+
# 在测试目录中运行脚本
|
|
87
|
+
(
|
|
88
|
+
cd "$TEST_TMP_DIR"
|
|
89
|
+
bash "$test_scripts_dir/mark-task-complete.sh" "$task_id" "${args[@]}" 2>&1
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
# ============================================================================
|
|
94
|
+
# 测试帮助信息
|
|
95
|
+
# ============================================================================
|
|
96
|
+
|
|
97
|
+
test_help_flag() {
|
|
98
|
+
describe "Should show help with --help"
|
|
99
|
+
|
|
100
|
+
# Arrange
|
|
101
|
+
local test_scripts_dir="$TEST_TMP_DIR/scripts"
|
|
102
|
+
mkdir -p "$test_scripts_dir"
|
|
103
|
+
create_test_common
|
|
104
|
+
cp "$MARK_TASK_SCRIPT" "$test_scripts_dir/"
|
|
105
|
+
|
|
106
|
+
# Act
|
|
107
|
+
local output=$(
|
|
108
|
+
cd "$TEST_TMP_DIR"
|
|
109
|
+
bash "$test_scripts_dir/mark-task-complete.sh" --help 2>&1
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
# Assert
|
|
113
|
+
assert_contains "$output" "Usage:" "Should show usage"
|
|
114
|
+
assert_contains "$output" "mark-task-complete.sh" "Should mention script name"
|
|
115
|
+
assert_contains "$output" "TASK_ID" "Should document TASK_ID argument"
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
# ============================================================================
|
|
119
|
+
# 测试参数验证
|
|
120
|
+
# ============================================================================
|
|
121
|
+
|
|
122
|
+
test_no_task_id() {
|
|
123
|
+
describe "Should fail when TASK_ID not provided"
|
|
124
|
+
|
|
125
|
+
# Arrange
|
|
126
|
+
local test_scripts_dir="$TEST_TMP_DIR/scripts"
|
|
127
|
+
mkdir -p "$test_scripts_dir"
|
|
128
|
+
create_test_common
|
|
129
|
+
cp "$MARK_TASK_SCRIPT" "$test_scripts_dir/"
|
|
130
|
+
|
|
131
|
+
# Act - Use temp file pattern to capture exit code
|
|
132
|
+
local output_file="$TEST_TMP_DIR/output.txt"
|
|
133
|
+
local exit_code_file="$TEST_TMP_DIR/exitcode.txt"
|
|
134
|
+
|
|
135
|
+
(
|
|
136
|
+
cd "$TEST_TMP_DIR"
|
|
137
|
+
export DEVFLOW_REQ_ID="REQ-001"
|
|
138
|
+
bash "$test_scripts_dir/mark-task-complete.sh" > "$output_file" 2>&1
|
|
139
|
+
echo $? > "$exit_code_file"
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
local output=$(cat "$output_file")
|
|
143
|
+
local exit_code=$(cat "$exit_code_file")
|
|
144
|
+
|
|
145
|
+
# Assert
|
|
146
|
+
assert_not_equals "$exit_code" "0" "Should fail without TASK_ID"
|
|
147
|
+
assert_contains "$output" "Task ID is required" "Should mention missing TASK_ID"
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
test_invalid_task_id_format() {
|
|
151
|
+
describe "Should fail on invalid TASK_ID format"
|
|
152
|
+
|
|
153
|
+
# Arrange
|
|
154
|
+
setup_requirement_with_tasks "REQ-001"
|
|
155
|
+
|
|
156
|
+
# Act - Use temp file pattern to capture exit code
|
|
157
|
+
local output_file="$TEST_TMP_DIR/output.txt"
|
|
158
|
+
local exit_code_file="$TEST_TMP_DIR/exitcode.txt"
|
|
159
|
+
|
|
160
|
+
(
|
|
161
|
+
run_mark_task "INVALID" > "$output_file" 2>&1
|
|
162
|
+
echo $? > "$exit_code_file"
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
local output=$(cat "$output_file")
|
|
166
|
+
local exit_code=$(cat "$exit_code_file")
|
|
167
|
+
|
|
168
|
+
# Assert
|
|
169
|
+
assert_not_equals "$exit_code" "0" "Should fail on invalid format"
|
|
170
|
+
assert_contains "$output" "Invalid task ID format" "Should mention format error"
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
test_normalize_task_id_case() {
|
|
174
|
+
describe "Should normalize task ID to uppercase"
|
|
175
|
+
|
|
176
|
+
# Arrange
|
|
177
|
+
local req_dir=$(setup_requirement_with_tasks "REQ-001")
|
|
178
|
+
|
|
179
|
+
# Act - use lowercase task id
|
|
180
|
+
local output=$(run_mark_task "t001" --json 2>&1)
|
|
181
|
+
local exit_code=$?
|
|
182
|
+
|
|
183
|
+
# Assert
|
|
184
|
+
assert_equals "$exit_code" "0" "Should succeed with lowercase"
|
|
185
|
+
assert_contains "$output" "T001" "Should normalize to T001"
|
|
186
|
+
|
|
187
|
+
# Verify checkbox was marked
|
|
188
|
+
local tasks_content=$(cat "$req_dir/TASKS.md")
|
|
189
|
+
assert_contains "$tasks_content" "[x] **T001**" "Should mark T001 as complete"
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
# ============================================================================
|
|
193
|
+
# 测试任务标记
|
|
194
|
+
# ============================================================================
|
|
195
|
+
|
|
196
|
+
test_mark_task_complete() {
|
|
197
|
+
describe "Should mark task as complete"
|
|
198
|
+
|
|
199
|
+
# Arrange
|
|
200
|
+
local req_dir=$(setup_requirement_with_tasks "REQ-001")
|
|
201
|
+
|
|
202
|
+
# Act
|
|
203
|
+
local output=$(run_mark_task "T001" 2>&1)
|
|
204
|
+
local exit_code=$?
|
|
205
|
+
|
|
206
|
+
# Assert
|
|
207
|
+
assert_equals "$exit_code" "0" "Should succeed"
|
|
208
|
+
assert_contains "$output" "✅" "Should show success message"
|
|
209
|
+
|
|
210
|
+
# Verify TASKS.md was updated
|
|
211
|
+
local tasks_content=$(cat "$req_dir/TASKS.md")
|
|
212
|
+
assert_contains "$tasks_content" "[x] **T001**" "Task should be marked complete"
|
|
213
|
+
assert_not_contains "$tasks_content" "[ ] **T001**" "Incomplete checkbox should be removed"
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
test_already_complete_task() {
|
|
217
|
+
describe "Should handle already complete task gracefully"
|
|
218
|
+
|
|
219
|
+
# Arrange
|
|
220
|
+
setup_requirement_with_tasks "REQ-001"
|
|
221
|
+
|
|
222
|
+
# Act - T003 is already marked as complete
|
|
223
|
+
local output=$(run_mark_task "T003" 2>&1)
|
|
224
|
+
local exit_code=$?
|
|
225
|
+
|
|
226
|
+
# Assert
|
|
227
|
+
assert_equals "$exit_code" "0" "Should succeed"
|
|
228
|
+
assert_contains "$output" "already" "Should mention already complete"
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
test_task_not_found() {
|
|
232
|
+
describe "Should fail when task doesn't exist"
|
|
233
|
+
|
|
234
|
+
# Arrange
|
|
235
|
+
setup_requirement_with_tasks "REQ-001"
|
|
236
|
+
|
|
237
|
+
# Act - Use temp file pattern to capture exit code
|
|
238
|
+
local output_file="$TEST_TMP_DIR/output.txt"
|
|
239
|
+
local exit_code_file="$TEST_TMP_DIR/exitcode.txt"
|
|
240
|
+
|
|
241
|
+
(
|
|
242
|
+
run_mark_task "T999" > "$output_file" 2>&1
|
|
243
|
+
echo $? > "$exit_code_file"
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
local output=$(cat "$output_file")
|
|
247
|
+
local exit_code=$(cat "$exit_code_file")
|
|
248
|
+
|
|
249
|
+
# Assert
|
|
250
|
+
assert_not_equals "$exit_code" "0" "Should fail"
|
|
251
|
+
assert_contains "$output" "not found" "Should mention task not found"
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
# ============================================================================
|
|
255
|
+
# 测试日志功能
|
|
256
|
+
# ============================================================================
|
|
257
|
+
|
|
258
|
+
test_log_to_execution_log() {
|
|
259
|
+
describe "Should log to EXECUTION_LOG.md by default"
|
|
260
|
+
|
|
261
|
+
# Arrange
|
|
262
|
+
local req_dir=$(setup_requirement_with_tasks "REQ-001")
|
|
263
|
+
|
|
264
|
+
# Act
|
|
265
|
+
run_mark_task "T002" 2>&1
|
|
266
|
+
|
|
267
|
+
# Assert
|
|
268
|
+
local log_content=$(cat "$req_dir/EXECUTION_LOG.md")
|
|
269
|
+
assert_contains "$log_content" "T002" "Should log task ID"
|
|
270
|
+
assert_contains "$log_content" "complete" "Should log completion"
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
test_no_log_option() {
|
|
274
|
+
describe "Should skip logging with --no-log"
|
|
275
|
+
|
|
276
|
+
# Arrange
|
|
277
|
+
local req_dir=$(setup_requirement_with_tasks "REQ-001")
|
|
278
|
+
local initial_log=$(cat "$req_dir/EXECUTION_LOG.md")
|
|
279
|
+
|
|
280
|
+
# Act
|
|
281
|
+
run_mark_task "T004" --no-log 2>&1
|
|
282
|
+
|
|
283
|
+
# Assert
|
|
284
|
+
local final_log=$(cat "$req_dir/EXECUTION_LOG.md")
|
|
285
|
+
assert_equals "$initial_log" "$final_log" "Log should not change"
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
# ============================================================================
|
|
289
|
+
# 测试 JSON 输出
|
|
290
|
+
# ============================================================================
|
|
291
|
+
|
|
292
|
+
test_json_output() {
|
|
293
|
+
describe "Should output valid JSON with --json"
|
|
294
|
+
|
|
295
|
+
# Arrange
|
|
296
|
+
setup_requirement_with_tasks "REQ-001"
|
|
297
|
+
|
|
298
|
+
# Act
|
|
299
|
+
local output=$(run_mark_task "T001" --json 2>&1)
|
|
300
|
+
|
|
301
|
+
# Assert
|
|
302
|
+
assert_json_valid "$output" "Should be valid JSON"
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
test_json_output_fields() {
|
|
306
|
+
describe "JSON should include required fields"
|
|
307
|
+
|
|
308
|
+
# Arrange
|
|
309
|
+
setup_requirement_with_tasks "REQ-001"
|
|
310
|
+
|
|
311
|
+
# Act
|
|
312
|
+
local output=$(run_mark_task "T002" --json 2>&1)
|
|
313
|
+
|
|
314
|
+
# Assert
|
|
315
|
+
assert_contains "$output" "\"status\"" "Should have status field"
|
|
316
|
+
assert_contains "$output" "\"task_id\"" "Should have task_id field"
|
|
317
|
+
assert_contains "$output" "\"T002\"" "Should have correct task ID"
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
test_json_already_complete() {
|
|
321
|
+
describe "JSON should indicate already complete status"
|
|
322
|
+
|
|
323
|
+
# Arrange
|
|
324
|
+
setup_requirement_with_tasks "REQ-001"
|
|
325
|
+
|
|
326
|
+
# Act
|
|
327
|
+
local output=$(run_mark_task "T003" --json 2>&1)
|
|
328
|
+
|
|
329
|
+
# Assert
|
|
330
|
+
assert_json_valid "$output" "Should be valid JSON"
|
|
331
|
+
assert_contains "$output" "already_complete" "Should have already_complete status"
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
# ============================================================================
|
|
335
|
+
# 测试进度统计
|
|
336
|
+
# ============================================================================
|
|
337
|
+
|
|
338
|
+
test_show_progress() {
|
|
339
|
+
describe "Should show task progress in text mode"
|
|
340
|
+
|
|
341
|
+
# Arrange
|
|
342
|
+
setup_requirement_with_tasks "REQ-001"
|
|
343
|
+
|
|
344
|
+
# Act
|
|
345
|
+
local output=$(run_mark_task "T001" 2>&1)
|
|
346
|
+
|
|
347
|
+
# Assert
|
|
348
|
+
assert_contains "$output" "Progress:" "Should show progress"
|
|
349
|
+
assert_contains "$output" "completed" "Should show completed count"
|
|
350
|
+
assert_contains "$output" "remaining" "Should show remaining count"
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
# ============================================================================
|
|
354
|
+
# 测试缺失文件错误
|
|
355
|
+
# ============================================================================
|
|
356
|
+
|
|
357
|
+
test_missing_tasks_file() {
|
|
358
|
+
describe "Should fail when TASKS.md doesn't exist"
|
|
359
|
+
|
|
360
|
+
# Arrange - 使用独特的REQ_ID以避免与之前测试冲突
|
|
361
|
+
local req_id="REQ-999"
|
|
362
|
+
local req_dir="$TEST_TMP_DIR/devflow/requirements/$req_id"
|
|
363
|
+
mkdir -p "$req_dir"
|
|
364
|
+
# 不创建 TASKS.md
|
|
365
|
+
|
|
366
|
+
# 创建测试脚本环境
|
|
367
|
+
local test_scripts_dir="$TEST_TMP_DIR/scripts"
|
|
368
|
+
mkdir -p "$test_scripts_dir"
|
|
369
|
+
create_test_common
|
|
370
|
+
cp "$MARK_TASK_SCRIPT" "$test_scripts_dir/"
|
|
371
|
+
|
|
372
|
+
# Act - Use temp file pattern to capture exit code
|
|
373
|
+
local output_file="$TEST_TMP_DIR/output.txt"
|
|
374
|
+
local exit_code_file="$TEST_TMP_DIR/exitcode.txt"
|
|
375
|
+
|
|
376
|
+
(
|
|
377
|
+
cd "$TEST_TMP_DIR"
|
|
378
|
+
export DEVFLOW_REQ_ID="$req_id"
|
|
379
|
+
bash "$test_scripts_dir/mark-task-complete.sh" "T001" > "$output_file" 2>&1
|
|
380
|
+
echo $? > "$exit_code_file"
|
|
381
|
+
)
|
|
382
|
+
|
|
383
|
+
local output=$(cat "$output_file")
|
|
384
|
+
local exit_code=$(cat "$exit_code_file")
|
|
385
|
+
|
|
386
|
+
# Assert
|
|
387
|
+
assert_not_equals "$exit_code" "0" "Should fail when TASKS.md missing"
|
|
388
|
+
assert_contains "$output" "TASKS.md not found" "Should mention missing TASKS.md"
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
# ============================================================================
|
|
392
|
+
# 测试错误处理
|
|
393
|
+
# ============================================================================
|
|
394
|
+
|
|
395
|
+
test_invalid_option() {
|
|
396
|
+
describe "Should reject invalid options"
|
|
397
|
+
|
|
398
|
+
# Arrange
|
|
399
|
+
local test_scripts_dir="$TEST_TMP_DIR/scripts"
|
|
400
|
+
mkdir -p "$test_scripts_dir"
|
|
401
|
+
create_test_common
|
|
402
|
+
cp "$MARK_TASK_SCRIPT" "$test_scripts_dir/"
|
|
403
|
+
|
|
404
|
+
# Act - Use temp file pattern to capture exit code
|
|
405
|
+
local output_file="$TEST_TMP_DIR/output.txt"
|
|
406
|
+
local exit_code_file="$TEST_TMP_DIR/exitcode.txt"
|
|
407
|
+
|
|
408
|
+
(
|
|
409
|
+
cd "$TEST_TMP_DIR"
|
|
410
|
+
bash "$test_scripts_dir/mark-task-complete.sh" T001 --invalid-option > "$output_file" 2>&1
|
|
411
|
+
echo $? > "$exit_code_file"
|
|
412
|
+
)
|
|
413
|
+
|
|
414
|
+
local output=$(cat "$output_file")
|
|
415
|
+
local exit_code=$(cat "$exit_code_file")
|
|
416
|
+
|
|
417
|
+
# Assert
|
|
418
|
+
assert_not_equals "$exit_code" "0" "Should fail on invalid option"
|
|
419
|
+
assert_contains "$output" "Unknown option" "Should mention unknown option"
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
# ============================================================================
|
|
423
|
+
# 运行所有测试
|
|
424
|
+
# ============================================================================
|
|
425
|
+
|
|
426
|
+
run_tests \
|
|
427
|
+
test_help_flag \
|
|
428
|
+
test_no_task_id \
|
|
429
|
+
test_invalid_task_id_format \
|
|
430
|
+
test_normalize_task_id_case \
|
|
431
|
+
test_mark_task_complete \
|
|
432
|
+
test_already_complete_task \
|
|
433
|
+
test_task_not_found \
|
|
434
|
+
test_log_to_execution_log \
|
|
435
|
+
test_no_log_option \
|
|
436
|
+
test_json_output \
|
|
437
|
+
test_json_output_fields \
|
|
438
|
+
test_json_already_complete \
|
|
439
|
+
test_show_progress \
|
|
440
|
+
test_missing_tasks_file \
|
|
441
|
+
test_invalid_option
|