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,243 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# calculate-checklist-completion.sh
|
|
4
|
+
# ============================================================================
|
|
5
|
+
# Calculate completion percentage for checklist files
|
|
6
|
+
#
|
|
7
|
+
# Usage: ./calculate-checklist-completion.sh [CHECKLISTS_DIR] [OPTIONS]
|
|
8
|
+
#
|
|
9
|
+
# ARGUMENTS:
|
|
10
|
+
# CHECKLISTS_DIR Path to checklists directory (optional)
|
|
11
|
+
# Default: devflow/requirements/{REQ-ID}/checklists/
|
|
12
|
+
#
|
|
13
|
+
# OPTIONS:
|
|
14
|
+
# --req-id ID Specify requirement ID (e.g., REQ-002)
|
|
15
|
+
# --json Output in JSON format
|
|
16
|
+
# --verbose Show detailed file information
|
|
17
|
+
# --help, -h Show help message
|
|
18
|
+
#
|
|
19
|
+
# OUTPUT (JSON):
|
|
20
|
+
# {
|
|
21
|
+
# "total": 57,
|
|
22
|
+
# "checked": 46,
|
|
23
|
+
# "percentage": 80.7,
|
|
24
|
+
# "files": [
|
|
25
|
+
# {"name": "ux.md", "checked": 16, "total": 20, "percentage": 80.0},
|
|
26
|
+
# ...
|
|
27
|
+
# ]
|
|
28
|
+
# }
|
|
29
|
+
#
|
|
30
|
+
# Reference: TECH_DESIGN.md Section 6.2.2
|
|
31
|
+
# ============================================================================
|
|
32
|
+
|
|
33
|
+
set -e
|
|
34
|
+
|
|
35
|
+
# ============================================================================
|
|
36
|
+
# Load common functions
|
|
37
|
+
# ============================================================================
|
|
38
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
39
|
+
source "$SCRIPT_DIR/common.sh"
|
|
40
|
+
|
|
41
|
+
# ============================================================================
|
|
42
|
+
# Constants
|
|
43
|
+
# ============================================================================
|
|
44
|
+
REPO_ROOT=$(get_repo_root)
|
|
45
|
+
|
|
46
|
+
# ============================================================================
|
|
47
|
+
# Parse arguments
|
|
48
|
+
# ============================================================================
|
|
49
|
+
CHECKLISTS_DIR=""
|
|
50
|
+
REQ_ID=""
|
|
51
|
+
JSON_MODE=false
|
|
52
|
+
VERBOSE=false
|
|
53
|
+
|
|
54
|
+
while [[ $# -gt 0 ]]; do
|
|
55
|
+
case "$1" in
|
|
56
|
+
--req-id)
|
|
57
|
+
REQ_ID="$2"
|
|
58
|
+
shift 2
|
|
59
|
+
;;
|
|
60
|
+
--json)
|
|
61
|
+
JSON_MODE=true
|
|
62
|
+
shift
|
|
63
|
+
;;
|
|
64
|
+
--verbose|-v)
|
|
65
|
+
VERBOSE=true
|
|
66
|
+
shift
|
|
67
|
+
;;
|
|
68
|
+
--help|-h)
|
|
69
|
+
cat << 'EOF'
|
|
70
|
+
Usage: calculate-checklist-completion.sh [CHECKLISTS_DIR] [OPTIONS]
|
|
71
|
+
|
|
72
|
+
Calculate completion percentage for checklist files.
|
|
73
|
+
|
|
74
|
+
ARGUMENTS:
|
|
75
|
+
CHECKLISTS_DIR Path to checklists directory (optional)
|
|
76
|
+
|
|
77
|
+
OPTIONS:
|
|
78
|
+
--req-id ID Specify requirement ID (e.g., REQ-002)
|
|
79
|
+
--json Output results in JSON format
|
|
80
|
+
--verbose, -v Show detailed file information
|
|
81
|
+
--help, -h Show this help message
|
|
82
|
+
|
|
83
|
+
OUTPUT (JSON):
|
|
84
|
+
{
|
|
85
|
+
"total": 57,
|
|
86
|
+
"checked": 46,
|
|
87
|
+
"percentage": 80.7,
|
|
88
|
+
"files": [...]
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
EXAMPLES:
|
|
92
|
+
# Calculate for current requirement
|
|
93
|
+
./calculate-checklist-completion.sh
|
|
94
|
+
|
|
95
|
+
# Calculate for specific requirement
|
|
96
|
+
./calculate-checklist-completion.sh --req-id REQ-002
|
|
97
|
+
|
|
98
|
+
# JSON output for automation
|
|
99
|
+
./calculate-checklist-completion.sh --json
|
|
100
|
+
|
|
101
|
+
# Specify directory directly
|
|
102
|
+
./calculate-checklist-completion.sh ./checklists/
|
|
103
|
+
|
|
104
|
+
EOF
|
|
105
|
+
exit 0
|
|
106
|
+
;;
|
|
107
|
+
-*)
|
|
108
|
+
echo "ERROR: Unknown option '$1'. Use --help for usage information." >&2
|
|
109
|
+
exit 1
|
|
110
|
+
;;
|
|
111
|
+
*)
|
|
112
|
+
if [[ -z "$CHECKLISTS_DIR" ]]; then
|
|
113
|
+
CHECKLISTS_DIR="$1"
|
|
114
|
+
else
|
|
115
|
+
echo "ERROR: Too many arguments. Use --help for usage information." >&2
|
|
116
|
+
exit 1
|
|
117
|
+
fi
|
|
118
|
+
shift
|
|
119
|
+
;;
|
|
120
|
+
esac
|
|
121
|
+
done
|
|
122
|
+
|
|
123
|
+
# ============================================================================
|
|
124
|
+
# Determine checklists directory
|
|
125
|
+
# ============================================================================
|
|
126
|
+
if [[ -z "$CHECKLISTS_DIR" ]]; then
|
|
127
|
+
# Get requirement ID if not specified
|
|
128
|
+
if [[ -z "$REQ_ID" ]]; then
|
|
129
|
+
REQ_ID=$(get_current_req_id)
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
if [[ -z "$REQ_ID" ]]; then
|
|
133
|
+
if $JSON_MODE; then
|
|
134
|
+
echo '{"error": "NO_REQ_ID", "message": "Could not determine requirement ID"}'
|
|
135
|
+
else
|
|
136
|
+
echo "ERROR: Could not determine requirement ID" >&2
|
|
137
|
+
echo "Use --req-id REQ-XXX or run from feature branch" >&2
|
|
138
|
+
fi
|
|
139
|
+
exit 1
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
CHECKLISTS_DIR="$REPO_ROOT/devflow/requirements/$REQ_ID/checklists"
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
# ============================================================================
|
|
146
|
+
# Validate directory exists
|
|
147
|
+
# ============================================================================
|
|
148
|
+
if [[ ! -d "$CHECKLISTS_DIR" ]]; then
|
|
149
|
+
if $JSON_MODE; then
|
|
150
|
+
echo "{\"error\": \"NO_CHECKLISTS\", \"message\": \"Checklists directory not found: $CHECKLISTS_DIR\"}"
|
|
151
|
+
else
|
|
152
|
+
echo "ERROR: NO_CHECKLISTS" >&2
|
|
153
|
+
echo "Checklists directory not found: $CHECKLISTS_DIR" >&2
|
|
154
|
+
echo "" >&2
|
|
155
|
+
echo "Run /flow-checklist --type <type> first." >&2
|
|
156
|
+
fi
|
|
157
|
+
exit 1
|
|
158
|
+
fi
|
|
159
|
+
|
|
160
|
+
# ============================================================================
|
|
161
|
+
# Count checklist files
|
|
162
|
+
# ============================================================================
|
|
163
|
+
shopt -s nullglob
|
|
164
|
+
CHECKLIST_FILES=("$CHECKLISTS_DIR"/*.md)
|
|
165
|
+
shopt -u nullglob
|
|
166
|
+
|
|
167
|
+
if [[ ${#CHECKLIST_FILES[@]} -eq 0 ]]; then
|
|
168
|
+
if $JSON_MODE; then
|
|
169
|
+
echo '{"error": "NO_CHECKLISTS", "message": "No checklist files found", "total": 0, "checked": 0, "percentage": 0, "files": []}'
|
|
170
|
+
else
|
|
171
|
+
echo "ERROR: NO_CHECKLISTS" >&2
|
|
172
|
+
echo "No checklist files found in $CHECKLISTS_DIR" >&2
|
|
173
|
+
echo "" >&2
|
|
174
|
+
echo "Run /flow-checklist --type <type> first." >&2
|
|
175
|
+
fi
|
|
176
|
+
exit 1
|
|
177
|
+
fi
|
|
178
|
+
|
|
179
|
+
# ============================================================================
|
|
180
|
+
# Calculate completion for each file
|
|
181
|
+
# ============================================================================
|
|
182
|
+
TOTAL_ALL=0
|
|
183
|
+
CHECKED_ALL=0
|
|
184
|
+
FILES_JSON=""
|
|
185
|
+
|
|
186
|
+
for file in "${CHECKLIST_FILES[@]}"; do
|
|
187
|
+
filename=$(basename "$file")
|
|
188
|
+
|
|
189
|
+
# Count total checklist items (matches - [ ] and - [x] and - [X])
|
|
190
|
+
# Pattern: "- [" followed by space or x/X, then "]"
|
|
191
|
+
total=$(grep -cE '^\s*- \[[ xX]\]' "$file" 2>/dev/null || echo "0")
|
|
192
|
+
|
|
193
|
+
# Count checked items (matches - [x] and - [X])
|
|
194
|
+
checked=$(grep -cE '^\s*- \[[xX]\]' "$file" 2>/dev/null || echo "0")
|
|
195
|
+
|
|
196
|
+
# Calculate percentage (avoid division by zero)
|
|
197
|
+
if [[ "$total" -gt 0 ]]; then
|
|
198
|
+
percentage=$(awk "BEGIN {printf \"%.1f\", ($checked / $total) * 100}")
|
|
199
|
+
else
|
|
200
|
+
percentage="0.0"
|
|
201
|
+
fi
|
|
202
|
+
|
|
203
|
+
# Accumulate totals
|
|
204
|
+
TOTAL_ALL=$((TOTAL_ALL + total))
|
|
205
|
+
CHECKED_ALL=$((CHECKED_ALL + checked))
|
|
206
|
+
|
|
207
|
+
# Build JSON for this file
|
|
208
|
+
if [[ -n "$FILES_JSON" ]]; then
|
|
209
|
+
FILES_JSON="$FILES_JSON,"
|
|
210
|
+
fi
|
|
211
|
+
FILES_JSON="$FILES_JSON{\"name\": \"$filename\", \"checked\": $checked, \"total\": $total, \"percentage\": $percentage}"
|
|
212
|
+
|
|
213
|
+
# Verbose output
|
|
214
|
+
if $VERBOSE && ! $JSON_MODE; then
|
|
215
|
+
echo " $filename: $checked/$total ($percentage%)"
|
|
216
|
+
fi
|
|
217
|
+
done
|
|
218
|
+
|
|
219
|
+
# ============================================================================
|
|
220
|
+
# Calculate overall percentage
|
|
221
|
+
# ============================================================================
|
|
222
|
+
if [[ "$TOTAL_ALL" -gt 0 ]]; then
|
|
223
|
+
PERCENTAGE_ALL=$(awk "BEGIN {printf \"%.1f\", ($CHECKED_ALL / $TOTAL_ALL) * 100}")
|
|
224
|
+
else
|
|
225
|
+
PERCENTAGE_ALL="0.0"
|
|
226
|
+
fi
|
|
227
|
+
|
|
228
|
+
# ============================================================================
|
|
229
|
+
# Output results
|
|
230
|
+
# ============================================================================
|
|
231
|
+
if $JSON_MODE; then
|
|
232
|
+
cat << EOF
|
|
233
|
+
{
|
|
234
|
+
"total": $TOTAL_ALL,
|
|
235
|
+
"checked": $CHECKED_ALL,
|
|
236
|
+
"percentage": $PERCENTAGE_ALL,
|
|
237
|
+
"files": [$FILES_JSON]
|
|
238
|
+
}
|
|
239
|
+
EOF
|
|
240
|
+
else
|
|
241
|
+
echo "Checklist Completion: $CHECKED_ALL/$TOTAL_ALL ($PERCENTAGE_ALL%)"
|
|
242
|
+
echo "Files scanned: ${#CHECKLIST_FILES[@]}"
|
|
243
|
+
fi
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Calculate current quarter and planning horizon for roadmap planning
|
|
3
|
+
# Returns quarter info in KEY=VALUE format for use in core-roadmap command
|
|
4
|
+
# Usage: ./calculate-quarter.sh
|
|
5
|
+
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
# =============================================================================
|
|
9
|
+
# 获取当前脚本所在目录
|
|
10
|
+
# =============================================================================
|
|
11
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
12
|
+
|
|
13
|
+
# Source common functions
|
|
14
|
+
if [[ -f "$SCRIPT_DIR/common.sh" ]]; then
|
|
15
|
+
source "$SCRIPT_DIR/common.sh"
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# =============================================================================
|
|
19
|
+
# Quarter Calculation Functions (季度计算函数)
|
|
20
|
+
# =============================================================================
|
|
21
|
+
|
|
22
|
+
# Get current year
|
|
23
|
+
# Returns: 2025
|
|
24
|
+
get_current_year() {
|
|
25
|
+
TZ='Asia/Shanghai' date '+%Y'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# Get current month (1-12)
|
|
29
|
+
# Returns: 1, 2, ..., 12
|
|
30
|
+
get_current_month() {
|
|
31
|
+
TZ='Asia/Shanghai' date '+%-m'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
# Get current day of month (1-31)
|
|
35
|
+
# Returns: 7, 15, 28, etc.
|
|
36
|
+
get_current_day() {
|
|
37
|
+
TZ='Asia/Shanghai' date '+%-d'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# Calculate current quarter based on month
|
|
41
|
+
# Returns: Q1, Q2, Q3, Q4
|
|
42
|
+
get_current_quarter() {
|
|
43
|
+
local month=$(get_current_month)
|
|
44
|
+
|
|
45
|
+
if [[ $month -le 3 ]]; then
|
|
46
|
+
echo "Q1"
|
|
47
|
+
elif [[ $month -le 6 ]]; then
|
|
48
|
+
echo "Q2"
|
|
49
|
+
elif [[ $month -le 9 ]]; then
|
|
50
|
+
echo "Q3"
|
|
51
|
+
else
|
|
52
|
+
echo "Q4"
|
|
53
|
+
fi
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# Calculate remaining days in current quarter
|
|
57
|
+
# Returns: integer (days)
|
|
58
|
+
calculate_remaining_days() {
|
|
59
|
+
local year=$(get_current_year)
|
|
60
|
+
local month=$(get_current_month)
|
|
61
|
+
local day=$(get_current_day)
|
|
62
|
+
|
|
63
|
+
# Get quarter end date
|
|
64
|
+
local quarter=$(get_current_quarter)
|
|
65
|
+
local end_month
|
|
66
|
+
local end_day
|
|
67
|
+
|
|
68
|
+
case $quarter in
|
|
69
|
+
Q1) end_month=3; end_day=31 ;;
|
|
70
|
+
Q2) end_month=6; end_day=30 ;;
|
|
71
|
+
Q3) end_month=9; end_day=30 ;;
|
|
72
|
+
Q4) end_month=12; end_day=31 ;;
|
|
73
|
+
esac
|
|
74
|
+
|
|
75
|
+
# Calculate days remaining using date arithmetic
|
|
76
|
+
local current_date=$(TZ='Asia/Shanghai' date '+%Y-%m-%d')
|
|
77
|
+
local end_date="$year-$(printf '%02d' $end_month)-$end_day"
|
|
78
|
+
|
|
79
|
+
# Calculate difference in seconds and convert to days
|
|
80
|
+
local current_seconds=$(TZ='Asia/Shanghai' date -j -f '%Y-%m-%d' "$current_date" '+%s' 2>/dev/null || date -d "$current_date" '+%s')
|
|
81
|
+
local end_seconds=$(TZ='Asia/Shanghai' date -j -f '%Y-%m-%d' "$end_date" '+%s' 2>/dev/null || date -d "$end_date" '+%s')
|
|
82
|
+
|
|
83
|
+
local remaining_seconds=$((end_seconds - current_seconds))
|
|
84
|
+
local remaining_days=$((remaining_seconds / 86400))
|
|
85
|
+
|
|
86
|
+
echo $remaining_days
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
# Get next N quarters
|
|
90
|
+
# Args: $1 = number of quarters (default: 3)
|
|
91
|
+
# Returns: comma-separated list (Q2,Q3,Q4 or Q2-2025,Q3-2025,Q4-2025,Q1-2026)
|
|
92
|
+
get_next_quarters() {
|
|
93
|
+
local count=${1:-3}
|
|
94
|
+
local current_quarter=$(get_current_quarter)
|
|
95
|
+
local current_year=$(get_current_year)
|
|
96
|
+
|
|
97
|
+
local quarters=("Q1" "Q2" "Q3" "Q4")
|
|
98
|
+
local current_index=0
|
|
99
|
+
|
|
100
|
+
# Find current quarter index
|
|
101
|
+
for i in "${!quarters[@]}"; do
|
|
102
|
+
if [[ "${quarters[$i]}" == "$current_quarter" ]]; then
|
|
103
|
+
current_index=$i
|
|
104
|
+
break
|
|
105
|
+
fi
|
|
106
|
+
done
|
|
107
|
+
|
|
108
|
+
local next_quarters=()
|
|
109
|
+
local year=$current_year
|
|
110
|
+
|
|
111
|
+
for ((i=1; i<=$count; i++)); do
|
|
112
|
+
local next_index=$(( (current_index + i) % 4 ))
|
|
113
|
+
local next_quarter="${quarters[$next_index]}"
|
|
114
|
+
|
|
115
|
+
# If next_index < current_index, we wrapped around (crossed year boundary)
|
|
116
|
+
# OR if we've gone through a full year cycle (i > 4)
|
|
117
|
+
if [[ $next_index -le $current_index ]] || [[ $i -gt 4 ]]; then
|
|
118
|
+
# Calculate how many years we've crossed
|
|
119
|
+
local years_crossed=$(( (current_index + i) / 4 ))
|
|
120
|
+
year=$((current_year + years_crossed))
|
|
121
|
+
else
|
|
122
|
+
year=$current_year
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
next_quarters+=("$next_quarter-$year")
|
|
126
|
+
done
|
|
127
|
+
|
|
128
|
+
# Join with commas
|
|
129
|
+
local result=$(IFS=,; echo "${next_quarters[*]}")
|
|
130
|
+
echo "$result"
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
# Get quarter start and end dates
|
|
134
|
+
# Args: $1 = quarter (Q1, Q2, Q3, Q4), $2 = year
|
|
135
|
+
# Returns: START_DATE=YYYY-MM-DD END_DATE=YYYY-MM-DD
|
|
136
|
+
get_quarter_dates() {
|
|
137
|
+
local quarter=$1
|
|
138
|
+
local year=$2
|
|
139
|
+
|
|
140
|
+
local start_month end_month start_day end_day
|
|
141
|
+
|
|
142
|
+
case $quarter in
|
|
143
|
+
Q1) start_month=1; start_day=1; end_month=3; end_day=31 ;;
|
|
144
|
+
Q2) start_month=4; start_day=1; end_month=6; end_day=30 ;;
|
|
145
|
+
Q3) start_month=7; start_day=1; end_month=9; end_day=30 ;;
|
|
146
|
+
Q4) start_month=10; start_day=1; end_month=12; end_day=31 ;;
|
|
147
|
+
esac
|
|
148
|
+
|
|
149
|
+
local start_date="$year-$(printf '%02d' $start_month)-$(printf '%02d' $start_day)"
|
|
150
|
+
local end_date="$year-$(printf '%02d' $end_month)-$(printf '%02d' $end_day)"
|
|
151
|
+
|
|
152
|
+
echo "START_DATE=$start_date"
|
|
153
|
+
echo "END_DATE=$end_date"
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
# Calculate planning horizon description
|
|
157
|
+
# Returns: human-readable string (e.g., "Q1 2025 (remaining) + Q2, Q3, Q4 2025")
|
|
158
|
+
get_planning_horizon() {
|
|
159
|
+
local current_quarter=$(get_current_quarter)
|
|
160
|
+
local current_year=$(get_current_year)
|
|
161
|
+
local next_quarters=$(get_next_quarters 3)
|
|
162
|
+
|
|
163
|
+
# Remove year suffixes for cleaner display
|
|
164
|
+
local next_display=$(echo "$next_quarters" | sed 's/-[0-9]\{4\}//g')
|
|
165
|
+
|
|
166
|
+
echo "$current_quarter $current_year (remaining) + $next_display"
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
# =============================================================================
|
|
170
|
+
# Main Output (主输出函数)
|
|
171
|
+
# =============================================================================
|
|
172
|
+
|
|
173
|
+
main() {
|
|
174
|
+
local current_year=$(get_current_year)
|
|
175
|
+
local current_month=$(get_current_month)
|
|
176
|
+
local current_day=$(get_current_day)
|
|
177
|
+
local current_quarter=$(get_current_quarter)
|
|
178
|
+
local remaining_days=$(calculate_remaining_days)
|
|
179
|
+
local next_quarters=$(get_next_quarters 3)
|
|
180
|
+
local planning_horizon=$(get_planning_horizon)
|
|
181
|
+
|
|
182
|
+
# Get current quarter dates
|
|
183
|
+
local quarter_dates=$(get_quarter_dates "$current_quarter" "$current_year")
|
|
184
|
+
local start_date=$(echo "$quarter_dates" | grep START_DATE | cut -d= -f2)
|
|
185
|
+
local end_date=$(echo "$quarter_dates" | grep END_DATE | cut -d= -f2)
|
|
186
|
+
|
|
187
|
+
# Output in KEY=VALUE format for easy parsing
|
|
188
|
+
cat <<EOF
|
|
189
|
+
CURRENT_YEAR=$current_year
|
|
190
|
+
CURRENT_MONTH=$current_month
|
|
191
|
+
CURRENT_DAY=$current_day
|
|
192
|
+
CURRENT_QUARTER=$current_quarter
|
|
193
|
+
QUARTER_START_DATE=$start_date
|
|
194
|
+
QUARTER_END_DATE=$end_date
|
|
195
|
+
REMAINING_DAYS=$remaining_days
|
|
196
|
+
NEXT_QUARTERS=$next_quarters
|
|
197
|
+
PLANNING_HORIZON=$planning_horizon
|
|
198
|
+
EOF
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
# =============================================================================
|
|
202
|
+
# Script Entry Point (脚本入口)
|
|
203
|
+
# =============================================================================
|
|
204
|
+
|
|
205
|
+
# Run main function
|
|
206
|
+
main
|