dev-playbooks 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +463 -0
  3. package/bin/devbooks.js +986 -0
  4. package/package.json +41 -0
  5. package/skills/Skill-Development-Guide.md +249 -0
  6. package/skills/Skills-Usage-Guide.md +447 -0
  7. package/skills/_shared/context-detection-template.md +315 -0
  8. package/skills/_shared/mcp-enhancement-template.md +144 -0
  9. package/skills/_shared/references/universal-gating-protocol.md +114 -0
  10. package/skills/_template/config-discovery-template.md +126 -0
  11. package/skills/devbooks-brownfield-bootstrap/SKILL.md +168 -0
  12. package/skills/devbooks-brownfield-bootstrap/references/10-glossary-template.md +42 -0
  13. package/skills/devbooks-brownfield-bootstrap/references/brownfield-bootstrap-prompt.md +115 -0
  14. package/skills/devbooks-brownfield-bootstrap/references/brownfield-bootstrap.md +96 -0
  15. package/skills/devbooks-brownfield-bootstrap/references/code-navigation-strategy.md +203 -0
  16. package/skills/devbooks-brownfield-bootstrap/scripts/cod-update.sh +357 -0
  17. package/skills/devbooks-brownfield-bootstrap/templates/project-profile-template.md +172 -0
  18. package/skills/devbooks-c4-map/SKILL.md +151 -0
  19. package/skills/devbooks-c4-map/references/c4-architecture-map-prompt.md +33 -0
  20. package/skills/devbooks-c4-map/references/layered-constraint-checklist.md +185 -0
  21. package/skills/devbooks-code-review/SKILL.md +175 -0
  22. package/skills/devbooks-code-review/references/code-review-prompt.md +100 -0
  23. package/skills/devbooks-code-review/references/code-smell-cheatsheet.md +498 -0
  24. package/skills/devbooks-code-review/references/pr-template-and-guidelines.md +321 -0
  25. package/skills/devbooks-code-review/references/resource-management-review-checklist.md +311 -0
  26. package/skills/devbooks-coder/SKILL.md +219 -0
  27. package/skills/devbooks-coder/references/code-implementation-prompt.md +74 -0
  28. package/skills/devbooks-coder/references/coding-style-guidelines.md +351 -0
  29. package/skills/devbooks-coder/references/error-code-standard.md +463 -0
  30. package/skills/devbooks-coder/references/logging-standard.md +329 -0
  31. package/skills/devbooks-coder/references/low-risk-modification-techniques.md +275 -0
  32. package/skills/devbooks-delivery-workflow/SKILL.md +217 -0
  33. package/skills/devbooks-delivery-workflow/references/9-change-verification-traceability-template.md +133 -0
  34. package/skills/devbooks-delivery-workflow/references/delivery-acceptance-workflow.md +177 -0
  35. package/skills/devbooks-delivery-workflow/references/prototype-production-dual-track.md +169 -0
  36. package/skills/devbooks-delivery-workflow/scripts/ac-trace-check.sh +330 -0
  37. package/skills/devbooks-delivery-workflow/scripts/audit-scope.sh +262 -0
  38. package/skills/devbooks-delivery-workflow/scripts/change-check.sh +1039 -0
  39. package/skills/devbooks-delivery-workflow/scripts/change-codemod-scaffold.sh +135 -0
  40. package/skills/devbooks-delivery-workflow/scripts/change-evidence.sh +152 -0
  41. package/skills/devbooks-delivery-workflow/scripts/change-scaffold.sh +467 -0
  42. package/skills/devbooks-delivery-workflow/scripts/change-spec-delta-scaffold.sh +135 -0
  43. package/skills/devbooks-delivery-workflow/scripts/constitution-check.sh +237 -0
  44. package/skills/devbooks-delivery-workflow/scripts/env-match-check.sh +128 -0
  45. package/skills/devbooks-delivery-workflow/scripts/fitness-check.sh +365 -0
  46. package/skills/devbooks-delivery-workflow/scripts/guardrail-check.sh +516 -0
  47. package/skills/devbooks-delivery-workflow/scripts/handoff-check.sh +141 -0
  48. package/skills/devbooks-delivery-workflow/scripts/hygiene-check.sh +340 -0
  49. package/skills/devbooks-delivery-workflow/scripts/migrate-from-openspec.sh +385 -0
  50. package/skills/devbooks-delivery-workflow/scripts/migrate-to-v2-gates.sh +202 -0
  51. package/skills/devbooks-delivery-workflow/scripts/progress-dashboard.sh +319 -0
  52. package/skills/devbooks-delivery-workflow/scripts/prototype-promote.sh +341 -0
  53. package/skills/devbooks-delivery-workflow/scripts/spec-preview.sh +203 -0
  54. package/skills/devbooks-delivery-workflow/scripts/spec-promote.sh +118 -0
  55. package/skills/devbooks-delivery-workflow/scripts/spec-rollback.sh +124 -0
  56. package/skills/devbooks-delivery-workflow/scripts/spec-stage.sh +117 -0
  57. package/skills/devbooks-delivery-workflow/scripts/verify-all.sh +78 -0
  58. package/skills/devbooks-delivery-workflow/scripts/verify-npm-package.sh +123 -0
  59. package/skills/devbooks-delivery-workflow/scripts/verify-openspec-free.sh +81 -0
  60. package/skills/devbooks-delivery-workflow/scripts/verify-slash-commands.sh +146 -0
  61. package/skills/devbooks-delivery-workflow/templates/handoff.md +50 -0
  62. package/skills/devbooks-design-backport/SKILL.md +73 -0
  63. package/skills/devbooks-design-backport/references/design-backport-prompt.md +132 -0
  64. package/skills/devbooks-design-doc/SKILL.md +121 -0
  65. package/skills/devbooks-design-doc/references/design-doc-prompt.md +188 -0
  66. package/skills/devbooks-design-doc/references/microservice-design-checklist.md +149 -0
  67. package/skills/devbooks-design-doc/references/privacy-compliance-checklist.md +240 -0
  68. package/skills/devbooks-entropy-monitor/SKILL.md +188 -0
  69. package/skills/devbooks-entropy-monitor/references/entropy-metrics-methodology.md +218 -0
  70. package/skills/devbooks-entropy-monitor/scripts/entropy-measure.sh +449 -0
  71. package/skills/devbooks-entropy-monitor/scripts/entropy-report.sh +303 -0
  72. package/skills/devbooks-entropy-monitor/templates/thresholds.json +99 -0
  73. package/skills/devbooks-federation/SKILL.md +264 -0
  74. package/skills/devbooks-federation/scripts/federation-check.sh +144 -0
  75. package/skills/devbooks-federation/templates/federation.yaml +89 -0
  76. package/skills/devbooks-impact-analysis/SKILL.md +135 -0
  77. package/skills/devbooks-impact-analysis/references/impact-analysis-prompt.md +82 -0
  78. package/skills/devbooks-impact-analysis/scripts/graph-cache.sh +214 -0
  79. package/skills/devbooks-implementation-plan/SKILL.md +83 -0
  80. package/skills/devbooks-implementation-plan/references/implementation-plan-prompt.md +95 -0
  81. package/skills/devbooks-index-bootstrap/SKILL.md +240 -0
  82. package/skills/devbooks-proposal-author/SKILL.md +83 -0
  83. package/skills/devbooks-proposal-author/references/proposal-authoring-prompt.md +66 -0
  84. package/skills/devbooks-proposal-challenger/SKILL.md +86 -0
  85. package/skills/devbooks-proposal-challenger/references/ethics-and-compliance-checklist.md +176 -0
  86. package/skills/devbooks-proposal-challenger/references/proposal-challenge-prompt.md +57 -0
  87. package/skills/devbooks-proposal-debate-workflow/SKILL.md +78 -0
  88. package/skills/devbooks-proposal-debate-workflow/references/11-proposal-debate-template.md +35 -0
  89. package/skills/devbooks-proposal-debate-workflow/references/proposal-debate-workflow.md +24 -0
  90. package/skills/devbooks-proposal-debate-workflow/scripts/proposal-debate-check.sh +102 -0
  91. package/skills/devbooks-proposal-judge/SKILL.md +78 -0
  92. package/skills/devbooks-proposal-judge/references/proposal-judge-prompt.md +37 -0
  93. package/skills/devbooks-router/SKILL.md +346 -0
  94. package/skills/devbooks-spec-contract/SKILL.md +191 -0
  95. package/skills/devbooks-spec-contract/references/api-design-guide.md +349 -0
  96. package/skills/devbooks-spec-contract/references/contract-and-data-definition-prompt.md +85 -0
  97. package/skills/devbooks-spec-contract/references/implicit-change-detection-prompt.md +183 -0
  98. package/skills/devbooks-spec-contract/references/spec-change-prompt.md +63 -0
  99. package/skills/devbooks-spec-contract/scripts/implicit-change-detect.sh +378 -0
  100. package/skills/devbooks-spec-gardener/SKILL.md +73 -0
  101. package/skills/devbooks-spec-gardener/references/spec-gardener-prompt.md +41 -0
  102. package/skills/devbooks-test-owner/SKILL.md +173 -0
  103. package/skills/devbooks-test-owner/references/9-change-verification-traceability-template.md +133 -0
  104. package/skills/devbooks-test-owner/references/async-system-test-strategy.md +316 -0
  105. package/skills/devbooks-test-owner/references/decoupling-techniques-cheatsheet.md +269 -0
  106. package/skills/devbooks-test-owner/references/test-code-prompt.md +171 -0
  107. package/skills/devbooks-test-owner/references/test-driven-development.md +351 -0
  108. package/skills/devbooks-test-owner/references/test-layering-strategy.md +281 -0
  109. package/skills/devbooks-test-reviewer/SKILL.md +189 -0
  110. package/templates/.devbooks/config.yaml +88 -0
  111. package/templates/claude-commands/devbooks/apply.md +38 -0
  112. package/templates/claude-commands/devbooks/archive.md +33 -0
  113. package/templates/claude-commands/devbooks/backport.md +19 -0
  114. package/templates/claude-commands/devbooks/bootstrap.md +20 -0
  115. package/templates/claude-commands/devbooks/c4.md +20 -0
  116. package/templates/claude-commands/devbooks/challenger.md +19 -0
  117. package/templates/claude-commands/devbooks/code.md +20 -0
  118. package/templates/claude-commands/devbooks/debate.md +20 -0
  119. package/templates/claude-commands/devbooks/delivery.md +20 -0
  120. package/templates/claude-commands/devbooks/design.md +20 -0
  121. package/templates/claude-commands/devbooks/entropy.md +19 -0
  122. package/templates/claude-commands/devbooks/federation.md +19 -0
  123. package/templates/claude-commands/devbooks/gardener.md +19 -0
  124. package/templates/claude-commands/devbooks/impact.md +19 -0
  125. package/templates/claude-commands/devbooks/index.md +19 -0
  126. package/templates/claude-commands/devbooks/judge.md +19 -0
  127. package/templates/claude-commands/devbooks/plan.md +20 -0
  128. package/templates/claude-commands/devbooks/proposal.md +20 -0
  129. package/templates/claude-commands/devbooks/quick.md +43 -0
  130. package/templates/claude-commands/devbooks/review.md +20 -0
  131. package/templates/claude-commands/devbooks/router.md +19 -0
  132. package/templates/claude-commands/devbooks/spec.md +20 -0
  133. package/templates/claude-commands/devbooks/test-review.md +19 -0
  134. package/templates/claude-commands/devbooks/test.md +20 -0
  135. package/templates/dev-playbooks/changes/.gitkeep +1 -0
  136. package/templates/dev-playbooks/constitution.md +116 -0
  137. package/templates/dev-playbooks/project.md +96 -0
  138. package/templates/dev-playbooks/scripts/.gitkeep +1 -0
  139. package/templates/dev-playbooks/specs/_meta/anti-patterns/.gitkeep +2 -0
  140. package/templates/dev-playbooks/specs/_meta/glossary.md +48 -0
  141. package/templates/dev-playbooks/specs/_meta/project-profile.md +79 -0
  142. package/templates/dev-playbooks/specs/architecture/fitness-rules.md +95 -0
@@ -0,0 +1,237 @@
1
+ #!/bin/bash
2
+ # skills/devbooks-delivery-workflow/scripts/constitution-check.sh
3
+ # Constitution compliance check script
4
+ #
5
+ # Checks whether constitution.md exists and has the required structure.
6
+ #
7
+ # Usage:
8
+ # ./constitution-check.sh [project-root]
9
+ # ./constitution-check.sh --help
10
+ #
11
+ # Exit codes:
12
+ # 0 - constitution exists and is valid
13
+ # 1 - constitution missing or invalid
14
+ # 2 - usage error
15
+
16
+ set -euo pipefail
17
+
18
+ # Color output
19
+ RED='\033[0;31m'
20
+ GREEN='\033[0;32m'
21
+ YELLOW='\033[0;33m'
22
+ NC='\033[0m' # No Color
23
+
24
+ # Version
25
+ VERSION="1.0.0"
26
+
27
+ # Help
28
+ show_help() {
29
+ cat << 'EOF'
30
+ Constitution compliance check (constitution-check.sh)
31
+
32
+ usage:
33
+ ./constitution-check.sh [options] [project-root]
34
+
35
+ options:
36
+ --help, -h Show this help
37
+ --version, -v Show version
38
+ --quiet, -q Quiet mode (errors only)
39
+
40
+ args:
41
+ project-root Project root (default: current directory)
42
+
43
+ checks:
44
+ 1. constitution.md exists
45
+ 2. Contains a "Part Zero" section
46
+ 3. Contains at least one "GIP-" rule heading
47
+ 4. Contains an "Escape Hatch(es)" section
48
+
49
+ exit codes:
50
+ 0 - constitution exists and is valid
51
+ 1 - constitution missing or invalid
52
+ 2 - usage error
53
+
54
+ examples:
55
+ ./constitution-check.sh # check current directory
56
+ ./constitution-check.sh /path/to/project # check a specific directory
57
+ ./constitution-check.sh --quiet # quiet mode
58
+
59
+ EOF
60
+ }
61
+
62
+ # Version output
63
+ show_version() {
64
+ echo "constitution-check.sh v${VERSION}"
65
+ }
66
+
67
+ # Logging helpers
68
+ log_info() {
69
+ [[ "$QUIET" == "false" ]] && echo -e "${GREEN}[INFO]${NC} $*"
70
+ }
71
+
72
+ log_warn() {
73
+ [[ "$QUIET" == "false" ]] && echo -e "${YELLOW}[WARN]${NC} $*" >&2
74
+ }
75
+
76
+ log_error() {
77
+ echo -e "${RED}[FAIL]${NC} $*" >&2
78
+ }
79
+
80
+ log_pass() {
81
+ [[ "$QUIET" == "false" ]] && echo -e "${GREEN}[PASS]${NC} $*"
82
+ }
83
+
84
+ # Resolve truth root
85
+ # Prefer dev-playbooks/, fallback to devbooks/
86
+ resolve_truth_root() {
87
+ local root="$1"
88
+
89
+ # Check root mapping from .devbooks/config.yaml
90
+ if [[ -f "${root}/.devbooks/config.yaml" ]]; then
91
+ local config_root
92
+ config_root=$(grep "^root:" "${root}/.devbooks/config.yaml" 2>/dev/null | sed 's/root: *//' | tr -d "'" | tr -d '"' | tr -d '/' || true)
93
+ if [[ -n "$config_root" && -d "${root}/${config_root}" ]]; then
94
+ echo "${root}/${config_root}"
95
+ return 0
96
+ fi
97
+ fi
98
+
99
+ # Prefer dev-playbooks/
100
+ if [[ -d "${root}/dev-playbooks" ]]; then
101
+ echo "${root}/dev-playbooks"
102
+ return 0
103
+ fi
104
+
105
+ # Fallback to devbooks/
106
+ if [[ -d "${root}/devbooks" ]]; then
107
+ echo "${root}/devbooks"
108
+ return 0
109
+ fi
110
+
111
+ # Not found
112
+ echo ""
113
+ return 1
114
+ }
115
+
116
+ # Check constitution
117
+ check_constitution() {
118
+ local root="${1:-.}"
119
+ local errors=0
120
+ local checks_passed=0
121
+ local total_checks=4
122
+
123
+ # Resolve truth root
124
+ local config_root
125
+ config_root=$(resolve_truth_root "$root") || {
126
+ log_error "cannot locate truth root (dev-playbooks/ or devbooks/)"
127
+ return 1
128
+ }
129
+
130
+ local constitution="${config_root}/constitution.md"
131
+
132
+ log_info "checking constitution file: $constitution"
133
+
134
+ # Check 1: file exists
135
+ if [[ -f "$constitution" ]]; then
136
+ log_pass "constitution.md exists"
137
+ ((checks_passed++))
138
+ else
139
+ log_error "constitution.md not found: $constitution"
140
+ ((errors++))
141
+ fi
142
+
143
+ # If file is missing, return early
144
+ if [[ ! -f "$constitution" ]]; then
145
+ echo ""
146
+ log_error "constitution check failed: $errors error(s)"
147
+ return 1
148
+ fi
149
+
150
+ # Check 2: Part Zero section
151
+ if grep -qE "^#+ *Part Zero" "$constitution" 2>/dev/null; then
152
+ log_pass "contains 'Part Zero' section"
153
+ ((checks_passed++))
154
+ else
155
+ log_error "missing 'Part Zero' section"
156
+ ((errors++))
157
+ fi
158
+
159
+ # Check 3: GIP rules
160
+ local gip_count
161
+ gip_count=$(grep -cE "^#+ *GIP-[0-9]+" "$constitution" 2>/dev/null || echo "0")
162
+ if [[ "$gip_count" -gt 0 ]]; then
163
+ log_pass "contains GIP rules (${gip_count})"
164
+ ((checks_passed++))
165
+ else
166
+ log_error "missing GIP rules (need at least 1 GIP-xxx heading)"
167
+ ((errors++))
168
+ fi
169
+
170
+ # Check 4: Escape Hatch(es) section
171
+ if grep -qE "^#+ *Escape Hatches?" "$constitution" 2>/dev/null; then
172
+ log_pass "contains 'Escape Hatch(es)' section"
173
+ ((checks_passed++))
174
+ else
175
+ log_error "missing 'Escape Hatch(es)' section"
176
+ ((errors++))
177
+ fi
178
+
179
+ # Summary
180
+ echo ""
181
+ if [[ "$errors" -eq 0 ]]; then
182
+ log_info "constitution checks passed: ${checks_passed}/${total_checks}"
183
+ return 0
184
+ else
185
+ log_error "constitution checks failed: ${checks_passed}/${total_checks} passed, ${errors} error(s)"
186
+ return 1
187
+ fi
188
+ }
189
+
190
+ # Main
191
+ main() {
192
+ QUIET="false"
193
+ local project_root="."
194
+
195
+ # Parse args
196
+ while [[ $# -gt 0 ]]; do
197
+ case "$1" in
198
+ --help|-h)
199
+ show_help
200
+ exit 0
201
+ ;;
202
+ --version|-v)
203
+ show_version
204
+ exit 0
205
+ ;;
206
+ --quiet|-q)
207
+ QUIET="true"
208
+ shift
209
+ ;;
210
+ -*)
211
+ log_error "unknown option: $1"
212
+ echo "hint: use --help" >&2
213
+ exit 2
214
+ ;;
215
+ *)
216
+ project_root="$1"
217
+ shift
218
+ ;;
219
+ esac
220
+ done
221
+
222
+ # Validate project root
223
+ if [[ ! -d "$project_root" ]]; then
224
+ log_error "project root not found: $project_root"
225
+ exit 2
226
+ fi
227
+
228
+ # Run checks
229
+ if check_constitution "$project_root"; then
230
+ exit 0
231
+ else
232
+ exit 1
233
+ fi
234
+ }
235
+
236
+ # Run
237
+ main "$@"
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env bash
2
+ # env-match-check.sh - Verify test environment declaration exists in verification.md
3
+ #
4
+ # This script checks that verification.md contains a test environment declaration
5
+ # section, which is required for archive mode to ensure reproducibility.
6
+ #
7
+ # Reference: harden-devbooks-quality-gates design.md AC-006
8
+
9
+ set -euo pipefail
10
+
11
+ usage() {
12
+ cat <<'EOF' >&2
13
+ usage: env-match-check.sh <change-id> [options]
14
+
15
+ Verify test environment declaration exists in verification.md:
16
+ 1. Checks verification.md exists
17
+ 2. Verifies a "Test Environment" (or equivalent) section exists
18
+ 3. Returns exit code based on verification status
19
+
20
+ Options:
21
+ --project-root <dir> Project root directory (default: pwd)
22
+ --change-root <dir> Change packages root (default: changes)
23
+ -h, --help Show this help message
24
+
25
+ Exit Codes:
26
+ 0 - Environment declaration found
27
+ 1 - Check failed (missing section)
28
+ 2 - Usage error
29
+
30
+ Examples:
31
+ env-match-check.sh my-change-001
32
+ env-match-check.sh my-change-001 --change-root dev-playbooks/changes
33
+ EOF
34
+ }
35
+
36
+ if [[ $# -eq 0 ]]; then
37
+ usage
38
+ exit 2
39
+ fi
40
+
41
+ if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
42
+ usage
43
+ exit 0
44
+ fi
45
+
46
+ change_id="$1"
47
+ shift
48
+
49
+ project_root="${DEVBOOKS_PROJECT_ROOT:-$(pwd)}"
50
+ change_root="${DEVBOOKS_CHANGE_ROOT:-changes}"
51
+
52
+ while [[ $# -gt 0 ]]; do
53
+ case "$1" in
54
+ -h|--help)
55
+ usage
56
+ exit 0
57
+ ;;
58
+ --project-root)
59
+ project_root="${2:-}"
60
+ shift 2
61
+ ;;
62
+ --change-root)
63
+ change_root="${2:-}"
64
+ shift 2
65
+ ;;
66
+ *)
67
+ echo "error: unknown option: $1" >&2
68
+ usage
69
+ exit 2
70
+ ;;
71
+ esac
72
+ done
73
+
74
+ # Validate change-id
75
+ if [[ -z "$change_id" || "$change_id" == "-"* || "$change_id" =~ [[:space:]] ]]; then
76
+ echo "error: invalid change-id: '$change_id'" >&2
77
+ exit 2
78
+ fi
79
+
80
+ # Build paths
81
+ project_root="${project_root%/}"
82
+ change_root="${change_root%/}"
83
+
84
+ if [[ "$change_root" = /* ]]; then
85
+ change_dir="${change_root}/${change_id}"
86
+ else
87
+ change_dir="${project_root}/${change_root}/${change_id}"
88
+ fi
89
+
90
+ verification_file="${change_dir}/verification.md"
91
+
92
+ echo "env-match-check: checking '${change_id}'"
93
+ echo " change-dir: ${change_dir}"
94
+
95
+ # Check change directory exists
96
+ if [[ ! -d "$change_dir" ]]; then
97
+ echo "error: missing change directory: ${change_dir}" >&2
98
+ exit 1
99
+ fi
100
+
101
+ # Check verification.md exists
102
+ if [[ ! -f "$verification_file" ]]; then
103
+ echo "error: missing verification.md: ${verification_file}" >&2
104
+ exit 1
105
+ fi
106
+
107
+ # Check for environment declaration section
108
+ # Accept both Chinese and English section names
109
+ env_section_pattern="Test Environment|Environment Declaration|Runtime Environment"
110
+
111
+ if grep -qE "^#+ *(${env_section_pattern})" "$verification_file" 2>/dev/null; then
112
+ echo "ok: environment declaration section found"
113
+ exit 0
114
+ fi
115
+
116
+ # Also check for environment content without explicit heading
117
+ # Pattern: lines starting with "- Runtime:" or "- Database:" etc.
118
+ env_content_pattern="^- *(Runtime|Environment|Database|External):"
119
+
120
+ if grep -qE "${env_content_pattern}" "$verification_file" 2>/dev/null; then
121
+ echo "ok: environment declaration content found"
122
+ exit 0
123
+ fi
124
+
125
+ # No environment declaration found
126
+ echo "error: verification.md missing test environment declaration section" >&2
127
+ echo "hint: add a '## Test Environment' section with runtime, database, and external dependency info" >&2
128
+ exit 1