dev-playbooks-cn 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 (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +466 -0
  3. package/bin/devbooks.js +987 -0
  4. package/package.json +43 -0
  5. package/skills/Skills/344/275/277/347/224/250/350/257/264/346/230/216.md +446 -0
  6. package/skills/Skill/345/274/200/345/217/221/346/214/207/345/215/227.md +248 -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//351/200/232/347/224/250/345/256/210/351/227/250/345/215/217/350/256/256.md +114 -0
  10. package/skills/_template/config-discovery-template.md +126 -0
  11. package/skills/devbooks-brownfield-bootstrap/SKILL.md +167 -0
  12. package/skills/devbooks-brownfield-bootstrap/references//344/273/243/347/240/201/345/257/274/350/210/252/347/255/226/347/225/245.md +203 -0
  13. package/skills/devbooks-brownfield-bootstrap/references//345/255/230/351/207/217/351/241/271/347/233/256/345/210/235/345/247/213/345/214/226.md +96 -0
  14. package/skills/devbooks-brownfield-bootstrap/references//345/255/230/351/207/217/351/241/271/347/233/256/345/210/235/345/247/213/345/214/226/346/217/220/347/244/272/350/257/215.md +115 -0
  15. package/skills/devbooks-brownfield-bootstrap/references//346/234/257/350/257/255/350/241/250/346/250/241/346/235/277.md +42 -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/346/236/266/346/236/204/345/234/260/345/233/276/346/217/220/347/244/272/350/257/215.md +33 -0
  20. package/skills/devbooks-c4-map/references//345/210/206/345/261/202/347/272/246/346/235/237/346/243/200/346/237/245/346/270/205/345/215/225.md +185 -0
  21. package/skills/devbooks-code-review/SKILL.md +175 -0
  22. package/skills/devbooks-code-review/references/PR/346/250/241/346/235/277/344/270/216/346/214/207/345/215/227.md +321 -0
  23. package/skills/devbooks-code-review/references//344/273/243/347/240/201/350/257/204/345/256/241/346/217/220/347/244/272/350/257/215.md +100 -0
  24. package/skills/devbooks-code-review/references//345/235/217/345/221/263/351/201/223/351/200/237/346/237/245/350/241/250.md +495 -0
  25. package/skills/devbooks-code-review/references//350/265/204/346/272/220/347/256/241/347/220/206/345/256/241/346/237/245/346/270/205/345/215/225.md +311 -0
  26. package/skills/devbooks-coder/SKILL.md +219 -0
  27. package/skills/devbooks-coder/references//344/273/243/347/240/201/345/256/236/347/216/260/346/217/220/347/244/272/350/257/215.md +70 -0
  28. package/skills/devbooks-coder/references//344/275/216/351/243/216/351/231/251/346/224/271/345/212/250/346/212/200/346/234/257.md +275 -0
  29. package/skills/devbooks-coder/references//346/227/245/345/277/227/350/247/204/350/214/203.md +329 -0
  30. package/skills/devbooks-coder/references//347/274/226/347/240/201/351/243/216/346/240/274/347/273/206/345/210/231.md +351 -0
  31. package/skills/devbooks-coder/references//351/224/231/350/257/257/347/240/201/350/247/204/350/214/203.md +463 -0
  32. package/skills/devbooks-delivery-workflow/SKILL.md +217 -0
  33. package/skills/devbooks-delivery-workflow/references//344/272/244/344/273/230/351/252/214/346/224/266/345/267/245/344/275/234/346/265/201.md +256 -0
  34. package/skills/devbooks-delivery-workflow/references//345/216/237/345/236/213-/347/224/237/344/272/247/345/217/214/350/275/250/346/250/241/345/274/217.md +168 -0
  35. package/skills/devbooks-delivery-workflow/references//345/217/230/346/233/264/351/252/214/350/257/201/344/270/216/350/277/275/346/272/257/346/250/241/346/235/277.md +133 -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 +1040 -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 +442 -0
  42. package/skills/devbooks-delivery-workflow/scripts/change-spec-delta-scaffold.sh +136 -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 +387 -0
  46. package/skills/devbooks-delivery-workflow/scripts/guardrail-check.sh +519 -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//345/233/236/345/206/231/350/256/276/350/256/241/346/226/207/346/241/243/346/217/220/347/244/272/350/257/215.md +196 -0
  64. package/skills/devbooks-design-doc/SKILL.md +121 -0
  65. package/skills/devbooks-design-doc/references//345/276/256/346/234/215/345/212/241/350/256/276/350/256/241/346/270/205/345/215/225.md +149 -0
  66. package/skills/devbooks-design-doc/references//350/256/276/350/256/241/346/226/207/346/241/243/346/217/220/347/244/272/350/257/215.md +189 -0
  67. package/skills/devbooks-design-doc/references//351/232/220/347/247/201/345/220/210/350/247/204/346/243/200/346/237/245/346/270/205/345/215/225.md +240 -0
  68. package/skills/devbooks-entropy-monitor/SKILL.md +188 -0
  69. package/skills/devbooks-entropy-monitor/references//347/206/265/345/272/246/351/207/217/346/226/271/346/263/225/350/256/272.md +223 -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//345/275/261/345/223/215/345/210/206/346/236/220/346/217/220/347/244/272/350/257/215.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//347/274/226/347/240/201/350/256/241/345/210/222/346/217/220/347/244/272/350/257/215.md +99 -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//346/217/220/346/241/210/346/222/260/345/206/231/346/217/220/347/244/272/350/257/215.md +66 -0
  84. package/skills/devbooks-proposal-challenger/SKILL.md +86 -0
  85. package/skills/devbooks-proposal-challenger/references//344/274/246/347/220/206/344/270/216/345/220/210/350/247/204/346/243/200/346/237/245/346/270/205/345/215/225.md +176 -0
  86. package/skills/devbooks-proposal-challenger/references//346/217/220/346/241/210/350/264/250/347/226/221/346/217/220/347/244/272/350/257/215.md +57 -0
  87. package/skills/devbooks-proposal-debate-workflow/SKILL.md +78 -0
  88. package/skills/devbooks-proposal-debate-workflow/references//346/217/220/346/241/210/345/257/271/350/276/251/345/267/245/344/275/234/346/265/201.md +24 -0
  89. package/skills/devbooks-proposal-debate-workflow/references//346/217/220/346/241/210/345/257/271/350/276/251/346/250/241/346/235/277.md +35 -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//346/217/220/346/241/210/350/243/201/345/206/263/346/217/220/347/244/272/350/257/215.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/350/256/276/350/256/241/346/214/207/345/215/227.md +349 -0
  96. package/skills/devbooks-spec-contract/references//345/245/221/347/272/246/344/270/216/346/225/260/346/215/256/345/256/232/344/271/211/346/217/220/347/244/272/350/257/215.md +85 -0
  97. package/skills/devbooks-spec-contract/references//350/247/204/346/240/274/345/217/230/346/233/264/346/217/220/347/244/272/350/257/215.md +63 -0
  98. package/skills/devbooks-spec-contract/references//351/232/220/345/274/217/345/217/230/346/233/264/346/243/200/346/265/213/346/217/220/347/244/272/350/257/215.md +183 -0
  99. package/skills/devbooks-spec-contract/scripts/implicit-change-detect.sh +378 -0
  100. package/skills/devbooks-spec-gardener/SKILL.md +72 -0
  101. package/skills/devbooks-spec-gardener/references//350/247/204/346/240/274/345/233/255/344/270/201/346/217/220/347/244/272/350/257/215.md +41 -0
  102. package/skills/devbooks-test-owner/SKILL.md +172 -0
  103. package/skills/devbooks-test-owner/references//345/217/230/346/233/264/351/252/214/350/257/201/344/270/216/350/277/275/346/272/257/346/250/241/346/235/277.md +228 -0
  104. package/skills/devbooks-test-owner/references//345/274/202/346/255/245/347/263/273/347/273/237/346/265/213/350/257/225/347/255/226/347/225/245.md +316 -0
  105. package/skills/devbooks-test-owner/references//346/265/213/350/257/225/344/273/243/347/240/201/346/217/220/347/244/272/350/257/215.md +208 -0
  106. package/skills/devbooks-test-owner/references//346/265/213/350/257/225/345/210/206/345/261/202/347/255/226/347/225/245.md +281 -0
  107. package/skills/devbooks-test-owner/references//346/265/213/350/257/225/351/251/261/345/212/250.md +394 -0
  108. package/skills/devbooks-test-owner/references//350/247/243/344/276/235/350/265/226/346/212/200/346/234/257/351/200/237/346/237/245/350/241/250.md +432 -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 +19 -0
  115. package/templates/claude-commands/devbooks/c4.md +19 -0
  116. package/templates/claude-commands/devbooks/challenger.md +19 -0
  117. package/templates/claude-commands/devbooks/code.md +19 -0
  118. package/templates/claude-commands/devbooks/debate.md +19 -0
  119. package/templates/claude-commands/devbooks/delivery.md +19 -0
  120. package/templates/claude-commands/devbooks/design.md +19 -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 +19 -0
  128. package/templates/claude-commands/devbooks/proposal.md +19 -0
  129. package/templates/claude-commands/devbooks/quick.md +42 -0
  130. package/templates/claude-commands/devbooks/review.md +19 -0
  131. package/templates/claude-commands/devbooks/router.md +19 -0
  132. package/templates/claude-commands/devbooks/spec.md +19 -0
  133. package/templates/claude-commands/devbooks/test-review.md +19 -0
  134. package/templates/claude-commands/devbooks/test.md +19 -0
  135. package/templates/dev-playbooks/README.md +458 -0
  136. package/templates/dev-playbooks/changes/.gitkeep +1 -0
  137. package/templates/dev-playbooks/constitution.md +116 -0
  138. package/templates/dev-playbooks/project.md +96 -0
  139. package/templates/dev-playbooks/scripts/.gitkeep +1 -0
  140. package/templates/dev-playbooks/specs/_meta/anti-patterns/.gitkeep +2 -0
  141. package/templates/dev-playbooks/specs/_meta/glossary.md +47 -0
  142. package/templates/dev-playbooks/specs/_meta/project-profile.md +79 -0
  143. package/templates/dev-playbooks/specs/architecture/fitness-rules.md +95 -0
@@ -0,0 +1,203 @@
1
+ #!/bin/bash
2
+ # skills/devbooks-delivery-workflow/scripts/spec-preview.sh
3
+ # Spec Conflict Pre-check Script
4
+ #
5
+ # Reads the spec delta from a change package and checks for conflicts in the staging layer.
6
+ #
7
+ # Usage:
8
+ # ./spec-preview.sh <change-id> [options]
9
+ # ./spec-preview.sh --help
10
+ #
11
+ # Exit codes:
12
+ # 0 - No conflicts
13
+ # 1 - Conflicts detected
14
+ # 2 - Usage error
15
+
16
+ set -euo pipefail
17
+
18
+ VERSION="1.0.0"
19
+
20
+ # Defaults
21
+ project_root="."
22
+ change_root="changes"
23
+ truth_root="specs"
24
+
25
+ # Color output
26
+ RED='\033[0;31m'
27
+ GREEN='\033[0;32m'
28
+ YELLOW='\033[0;33m'
29
+ BLUE='\033[0;34m'
30
+ NC='\033[0m'
31
+
32
+ # Show help
33
+ show_help() {
34
+ cat << 'EOF'
35
+ Spec Conflict Pre-check Script (spec-preview.sh)
36
+
37
+ Usage:
38
+ ./spec-preview.sh <change-id> [options]
39
+
40
+ Options:
41
+ --project-root DIR Project root directory, default is current directory
42
+ --change-root DIR Change package directory, default is changes
43
+ --truth-root DIR Truth source directory, default is specs
44
+ --help, -h Show this help message
45
+ --version, -v Show version information
46
+
47
+ Conflict detection:
48
+ 1. File-level conflicts: Same target file modified by multiple change packages
49
+ 2. Content-level conflicts: Same REQ-xxx being modified
50
+
51
+ Exit codes:
52
+ 0 - No conflicts
53
+ 1 - Conflicts detected
54
+ 2 - Usage error
55
+
56
+ Examples:
57
+ ./spec-preview.sh my-feature
58
+ ./spec-preview.sh my-feature --change-root dev-playbooks/changes
59
+
60
+ EOF
61
+ }
62
+
63
+ show_version() {
64
+ echo "spec-preview.sh v${VERSION}"
65
+ }
66
+
67
+ log_info() {
68
+ echo -e "${BLUE}[INFO]${NC} $*"
69
+ }
70
+
71
+ log_warn() {
72
+ echo -e "${YELLOW}[WARN]${NC} $*" >&2
73
+ }
74
+
75
+ log_error() {
76
+ echo -e "${RED}[ERROR]${NC} $*" >&2
77
+ }
78
+
79
+ log_pass() {
80
+ echo -e "${GREEN}[PASS]${NC} $*"
81
+ }
82
+
83
+ # Main function
84
+ main() {
85
+ local change_id=""
86
+
87
+ # Parse arguments
88
+ while [[ $# -gt 0 ]]; do
89
+ case "$1" in
90
+ --help|-h)
91
+ show_help
92
+ exit 0
93
+ ;;
94
+ --version|-v)
95
+ show_version
96
+ exit 0
97
+ ;;
98
+ --project-root)
99
+ project_root="${2:-.}"
100
+ shift 2
101
+ ;;
102
+ --change-root)
103
+ change_root="${2:-changes}"
104
+ shift 2
105
+ ;;
106
+ --truth-root)
107
+ truth_root="${2:-specs}"
108
+ shift 2
109
+ ;;
110
+ -*)
111
+ log_error "Unknown option: $1"
112
+ exit 2
113
+ ;;
114
+ *)
115
+ change_id="$1"
116
+ shift
117
+ ;;
118
+ esac
119
+ done
120
+
121
+ if [[ -z "$change_id" ]]; then
122
+ log_error "Missing change-id"
123
+ exit 2
124
+ fi
125
+
126
+ # Build paths
127
+ local change_dir="${project_root}/${change_root}/${change_id}"
128
+ local staged_dir="${project_root}/${truth_root}/_staged"
129
+ local specs_delta_dir="${change_dir}/specs"
130
+
131
+ log_info "Pre-checking change package: ${change_id}"
132
+ log_info " Change directory: ${change_dir}"
133
+ log_info " Staging directory: ${staged_dir}"
134
+
135
+ # Check change package exists
136
+ if [[ ! -d "$change_dir" ]]; then
137
+ log_error "Change package does not exist: ${change_dir}"
138
+ exit 2
139
+ fi
140
+
141
+ # Check if there is spec delta
142
+ if [[ ! -d "$specs_delta_dir" ]]; then
143
+ log_info "No spec delta, skipping pre-check"
144
+ exit 0
145
+ fi
146
+
147
+ local conflicts=0
148
+ local file_conflicts=""
149
+ local req_conflicts=""
150
+
151
+ # File-level conflict detection
152
+ log_info "Checking file-level conflicts..."
153
+ while IFS= read -r delta_file; do
154
+ [[ -z "$delta_file" ]] && continue
155
+
156
+ local relative_path="${delta_file#$specs_delta_dir/}"
157
+ local staged_path="${staged_dir}/${relative_path}"
158
+
159
+ if [[ -f "$staged_path" ]]; then
160
+ file_conflicts="${file_conflicts} ${relative_path}\n"
161
+ conflicts=$((conflicts + 1))
162
+ fi
163
+ done < <(find "$specs_delta_dir" -type f -name "*.md" 2>/dev/null)
164
+
165
+ # Content-level conflict detection (REQ-xxx)
166
+ log_info "Checking content-level conflicts..."
167
+ local current_reqs
168
+ current_reqs=$(grep -rhoE "REQ-[A-Z0-9]+-[0-9]+" "$specs_delta_dir" 2>/dev/null | sort -u || true)
169
+
170
+ if [[ -n "$current_reqs" && -d "$staged_dir" ]]; then
171
+ while IFS= read -r req; do
172
+ [[ -z "$req" ]] && continue
173
+
174
+ if grep -rq "$req" "$staged_dir" 2>/dev/null; then
175
+ req_conflicts="${req_conflicts} ${req}\n"
176
+ conflicts=$((conflicts + 1))
177
+ fi
178
+ done <<< "$current_reqs"
179
+ fi
180
+
181
+ # Output results
182
+ echo ""
183
+ if [[ $conflicts -gt 0 ]]; then
184
+ log_error "Detected ${conflicts} conflict(s)"
185
+
186
+ if [[ -n "$file_conflicts" ]]; then
187
+ echo -e "\nFile-level conflicts:"
188
+ echo -e "$file_conflicts"
189
+ fi
190
+
191
+ if [[ -n "$req_conflicts" ]]; then
192
+ echo -e "\nContent-level conflicts (REQ-xxx):"
193
+ echo -e "$req_conflicts"
194
+ fi
195
+
196
+ exit 1
197
+ fi
198
+
199
+ log_pass "No conflicts, ready to stage"
200
+ exit 0
201
+ }
202
+
203
+ main "$@"
@@ -0,0 +1,118 @@
1
+ #!/bin/bash
2
+ # skills/devbooks-delivery-workflow/scripts/spec-promote.sh
3
+ # Spec Promotion Script
4
+ #
5
+ # Promotes the spec delta from the staging layer to the truth layer.
6
+ #
7
+ # Usage:
8
+ # ./spec-promote.sh <change-id> [options]
9
+ # ./spec-promote.sh --help
10
+ #
11
+ # Exit codes:
12
+ # 0 - Promotion successful
13
+ # 1 - Promotion failed
14
+ # 2 - Usage error
15
+
16
+ set -euo pipefail
17
+
18
+ VERSION="1.0.0"
19
+
20
+ project_root="."
21
+ truth_root="specs"
22
+ dry_run=false
23
+
24
+ RED='\033[0;31m'
25
+ GREEN='\033[0;32m'
26
+ YELLOW='\033[0;33m'
27
+ BLUE='\033[0;34m'
28
+ NC='\033[0m'
29
+
30
+ show_help() {
31
+ cat << 'EOF'
32
+ Spec Promotion Script (spec-promote.sh)
33
+
34
+ Usage:
35
+ ./spec-promote.sh <change-id> [options]
36
+
37
+ Options:
38
+ --project-root DIR Project root directory
39
+ --truth-root DIR Truth source directory
40
+ --dry-run Simulate run
41
+ --help, -h Show help
42
+
43
+ Process:
44
+ 1. Check prerequisites (already staged)
45
+ 2. Move _staged/<change-id>/ contents to specs/
46
+ 3. Clean up _staged/<change-id>/ directory
47
+
48
+ EOF
49
+ }
50
+
51
+ log_info() { echo -e "${BLUE}[INFO]${NC} $*"; }
52
+ log_warn() { echo -e "${YELLOW}[WARN]${NC} $*" >&2; }
53
+ log_error() { echo -e "${RED}[ERROR]${NC} $*" >&2; }
54
+ log_pass() { echo -e "${GREEN}[PASS]${NC} $*"; }
55
+
56
+ main() {
57
+ local change_id=""
58
+
59
+ while [[ $# -gt 0 ]]; do
60
+ case "$1" in
61
+ --help|-h) show_help; exit 0 ;;
62
+ --version|-v) echo "spec-promote.sh v${VERSION}"; exit 0 ;;
63
+ --project-root) project_root="${2:-.}"; shift 2 ;;
64
+ --truth-root) truth_root="${2:-specs}"; shift 2 ;;
65
+ --dry-run) dry_run=true; shift ;;
66
+ -*) log_error "Unknown option: $1"; exit 2 ;;
67
+ *) change_id="$1"; shift ;;
68
+ esac
69
+ done
70
+
71
+ if [[ -z "$change_id" ]]; then
72
+ log_error "Missing change-id"
73
+ exit 2
74
+ fi
75
+
76
+ local staged_dir="${project_root}/${truth_root}/_staged/${change_id}"
77
+ local specs_dir="${project_root}/${truth_root}"
78
+
79
+ log_info "Promoting change package: ${change_id}"
80
+
81
+ # Check prerequisites
82
+ if [[ ! -d "$staged_dir" ]]; then
83
+ log_error "Staged content not found: ${staged_dir}"
84
+ log_error "Please run spec-stage.sh first"
85
+ exit 1
86
+ fi
87
+
88
+ # Promote files
89
+ local promoted=0
90
+ while IFS= read -r file; do
91
+ [[ -z "$file" ]] && continue
92
+
93
+ local relative_path="${file#$staged_dir/}"
94
+ local target_path="${specs_dir}/${relative_path}"
95
+ local target_dir
96
+ target_dir=$(dirname "$target_path")
97
+
98
+ if [[ "$dry_run" == true ]]; then
99
+ log_info "[DRY-RUN] ${relative_path} -> ${target_path}"
100
+ else
101
+ mkdir -p "$target_dir"
102
+ cp "$file" "$target_path"
103
+ fi
104
+ promoted=$((promoted + 1))
105
+ done < <(find "$staged_dir" -type f 2>/dev/null)
106
+
107
+ # Clean up staging directory
108
+ if [[ "$dry_run" == true ]]; then
109
+ log_info "[DRY-RUN] Would delete: ${staged_dir}"
110
+ else
111
+ rm -rf "$staged_dir"
112
+ fi
113
+
114
+ log_pass "Promoted ${promoted} file(s) to truth layer"
115
+ exit 0
116
+ }
117
+
118
+ main "$@"
@@ -0,0 +1,124 @@
1
+ #!/bin/bash
2
+ # skills/devbooks-delivery-workflow/scripts/spec-rollback.sh
3
+ # Spec Rollback Script
4
+ #
5
+ # Rolls back spec sync operations.
6
+ #
7
+ # Usage:
8
+ # ./spec-rollback.sh <change-id> [options]
9
+ # ./spec-rollback.sh --help
10
+ #
11
+ # Exit codes:
12
+ # 0 - Rollback successful
13
+ # 1 - Rollback failed
14
+ # 2 - Usage error
15
+
16
+ set -euo pipefail
17
+
18
+ VERSION="1.0.0"
19
+
20
+ project_root="."
21
+ truth_root="specs"
22
+ change_root="changes"
23
+ target="staged"
24
+ dry_run=false
25
+
26
+ RED='\033[0;31m'
27
+ GREEN='\033[0;32m'
28
+ YELLOW='\033[0;33m'
29
+ BLUE='\033[0;34m'
30
+ NC='\033[0m'
31
+
32
+ show_help() {
33
+ cat << 'EOF'
34
+ Spec Rollback Script (spec-rollback.sh)
35
+
36
+ Usage:
37
+ ./spec-rollback.sh <change-id> [options]
38
+
39
+ Options:
40
+ --project-root DIR Project root directory
41
+ --truth-root DIR Truth source directory
42
+ --change-root DIR Change package directory
43
+ --target TARGET Rollback target: staged | draft
44
+ --dry-run Simulate run
45
+ --help, -h Show help
46
+
47
+ Rollback targets:
48
+ staged - Clean up staging layer (preserve spec delta in change package)
49
+ draft - Roll back to change package state (clean up staging layer, do not touch specs)
50
+
51
+ EOF
52
+ }
53
+
54
+ log_info() { echo -e "${BLUE}[INFO]${NC} $*"; }
55
+ log_warn() { echo -e "${YELLOW}[WARN]${NC} $*" >&2; }
56
+ log_error() { echo -e "${RED}[ERROR]${NC} $*" >&2; }
57
+ log_pass() { echo -e "${GREEN}[PASS]${NC} $*"; }
58
+
59
+ main() {
60
+ local change_id=""
61
+
62
+ while [[ $# -gt 0 ]]; do
63
+ case "$1" in
64
+ --help|-h) show_help; exit 0 ;;
65
+ --version|-v) echo "spec-rollback.sh v${VERSION}"; exit 0 ;;
66
+ --project-root) project_root="${2:-.}"; shift 2 ;;
67
+ --truth-root) truth_root="${2:-specs}"; shift 2 ;;
68
+ --change-root) change_root="${2:-changes}"; shift 2 ;;
69
+ --target) target="${2:-staged}"; shift 2 ;;
70
+ --dry-run) dry_run=true; shift ;;
71
+ -*) log_error "Unknown option: $1"; exit 2 ;;
72
+ *) change_id="$1"; shift ;;
73
+ esac
74
+ done
75
+
76
+ if [[ -z "$change_id" ]]; then
77
+ log_error "Missing change-id"
78
+ exit 2
79
+ fi
80
+
81
+ case "$target" in
82
+ staged|draft) ;;
83
+ *) log_error "Invalid rollback target: $target"; exit 2 ;;
84
+ esac
85
+
86
+ local staged_dir="${project_root}/${truth_root}/_staged/${change_id}"
87
+
88
+ log_info "Rolling back change package: ${change_id}"
89
+ log_info "Rollback target: ${target}"
90
+
91
+ case "$target" in
92
+ staged)
93
+ # Clean up staging layer
94
+ if [[ -d "$staged_dir" ]]; then
95
+ if [[ "$dry_run" == true ]]; then
96
+ log_info "[DRY-RUN] Would delete: ${staged_dir}"
97
+ else
98
+ rm -rf "$staged_dir"
99
+ log_pass "Cleaned up staging layer: ${staged_dir}"
100
+ fi
101
+ else
102
+ log_info "Staging layer is empty, no cleanup needed"
103
+ fi
104
+ ;;
105
+
106
+ draft)
107
+ # Roll back to change package state (clean up staging layer)
108
+ if [[ -d "$staged_dir" ]]; then
109
+ if [[ "$dry_run" == true ]]; then
110
+ log_info "[DRY-RUN] Would delete: ${staged_dir}"
111
+ else
112
+ rm -rf "$staged_dir"
113
+ log_pass "Rolled back to draft state"
114
+ fi
115
+ else
116
+ log_info "Already in draft state"
117
+ fi
118
+ ;;
119
+ esac
120
+
121
+ exit 0
122
+ }
123
+
124
+ main "$@"
@@ -0,0 +1,117 @@
1
+ #!/bin/bash
2
+ # skills/devbooks-delivery-workflow/scripts/spec-stage.sh
3
+ # Spec Staging Script
4
+ #
5
+ # Syncs the spec delta from a change package to the staging layer.
6
+ #
7
+ # Usage:
8
+ # ./spec-stage.sh <change-id> [options]
9
+ # ./spec-stage.sh --help
10
+ #
11
+ # Exit codes:
12
+ # 0 - Staging successful
13
+ # 1 - Staging failed (conflicts)
14
+ # 2 - Usage error
15
+
16
+ set -euo pipefail
17
+
18
+ VERSION="1.0.0"
19
+
20
+ project_root="."
21
+ change_root="changes"
22
+ truth_root="specs"
23
+ dry_run=false
24
+ force=false
25
+
26
+ RED='\033[0;31m'
27
+ GREEN='\033[0;32m'
28
+ YELLOW='\033[0;33m'
29
+ BLUE='\033[0;34m'
30
+ NC='\033[0m'
31
+
32
+ show_help() {
33
+ cat << 'EOF'
34
+ Spec Staging Script (spec-stage.sh)
35
+
36
+ Usage:
37
+ ./spec-stage.sh <change-id> [options]
38
+
39
+ Options:
40
+ --project-root DIR Project root directory
41
+ --change-root DIR Change package directory
42
+ --truth-root DIR Truth source directory
43
+ --dry-run Simulate run, do not actually modify files
44
+ --force Force staging, ignore conflicts
45
+ --help, -h Show help
46
+
47
+ Exit codes:
48
+ 0 - Staging successful
49
+ 1 - Staging failed
50
+ 2 - Usage error
51
+
52
+ EOF
53
+ }
54
+
55
+ log_info() { echo -e "${BLUE}[INFO]${NC} $*"; }
56
+ log_warn() { echo -e "${YELLOW}[WARN]${NC} $*" >&2; }
57
+ log_error() { echo -e "${RED}[ERROR]${NC} $*" >&2; }
58
+ log_pass() { echo -e "${GREEN}[PASS]${NC} $*"; }
59
+
60
+ main() {
61
+ local change_id=""
62
+
63
+ while [[ $# -gt 0 ]]; do
64
+ case "$1" in
65
+ --help|-h) show_help; exit 0 ;;
66
+ --version|-v) echo "spec-stage.sh v${VERSION}"; exit 0 ;;
67
+ --project-root) project_root="${2:-.}"; shift 2 ;;
68
+ --change-root) change_root="${2:-changes}"; shift 2 ;;
69
+ --truth-root) truth_root="${2:-specs}"; shift 2 ;;
70
+ --dry-run) dry_run=true; shift ;;
71
+ --force) force=true; shift ;;
72
+ -*) log_error "Unknown option: $1"; exit 2 ;;
73
+ *) change_id="$1"; shift ;;
74
+ esac
75
+ done
76
+
77
+ if [[ -z "$change_id" ]]; then
78
+ log_error "Missing change-id"
79
+ exit 2
80
+ fi
81
+
82
+ local change_dir="${project_root}/${change_root}/${change_id}"
83
+ local staged_dir="${project_root}/${truth_root}/_staged/${change_id}"
84
+ local specs_delta_dir="${change_dir}/specs"
85
+
86
+ log_info "Staging change package: ${change_id}"
87
+
88
+ if [[ ! -d "$specs_delta_dir" ]]; then
89
+ log_info "No spec delta, skipping staging"
90
+ exit 0
91
+ fi
92
+
93
+ # Call spec-preview to check for conflicts
94
+ local script_dir
95
+ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
96
+
97
+ if [[ "$force" != true && -x "${script_dir}/spec-preview.sh" ]]; then
98
+ if ! "${script_dir}/spec-preview.sh" "$change_id" --project-root "$project_root" --change-root "$change_root" --truth-root "$truth_root"; then
99
+ log_error "Conflicts exist, use --force to force staging"
100
+ exit 1
101
+ fi
102
+ fi
103
+
104
+ # Execute staging
105
+ if [[ "$dry_run" == true ]]; then
106
+ log_info "[DRY-RUN] Would create: ${staged_dir}"
107
+ log_info "[DRY-RUN] Would copy: ${specs_delta_dir}/* -> ${staged_dir}/"
108
+ else
109
+ mkdir -p "$staged_dir"
110
+ cp -r "$specs_delta_dir"/* "$staged_dir"/
111
+ log_pass "Staged to: ${staged_dir}"
112
+ fi
113
+
114
+ exit 0
115
+ }
116
+
117
+ main "$@"
@@ -0,0 +1,78 @@
1
+ #!/bin/bash
2
+ # verify-all.sh - Run all verification scripts
3
+ #
4
+ # Aggregate AC-001 ~ AC-022 verification results
5
+
6
+ set -uo pipefail
7
+
8
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9
+
10
+ GREEN='\033[0;32m'
11
+ RED='\033[0;31m'
12
+ YELLOW='\033[1;33m'
13
+ CYAN='\033[0;36m'
14
+ NC='\033[0m'
15
+
16
+ echo -e "${CYAN}╔════════════════════════════════════════════════╗${NC}"
17
+ echo -e "${CYAN}║ DevBooks Independence Verification Suite ║${NC}"
18
+ echo -e "${CYAN}╚════════════════════════════════════════════════╝${NC}"
19
+ echo ""
20
+
21
+ # Run each verification script
22
+ echo -e "${YELLOW}>>> OpenSpec Cleanup Verification (AC-001 ~ AC-004)${NC}"
23
+ echo ""
24
+ openspec_result=0
25
+ if "$SCRIPT_DIR/verify-openspec-free.sh"; then
26
+ openspec_result=1
27
+ fi
28
+ echo ""
29
+
30
+ echo -e "${YELLOW}>>> Slash Command Verification (AC-005 ~ AC-010)${NC}"
31
+ echo ""
32
+ slash_result=0
33
+ if "$SCRIPT_DIR/verify-slash-commands.sh"; then
34
+ slash_result=1
35
+ fi
36
+ echo ""
37
+
38
+ echo -e "${YELLOW}>>> npm Package Verification (AC-011 ~ AC-016)${NC}"
39
+ echo ""
40
+ npm_result=0
41
+ if "$SCRIPT_DIR/verify-npm-package.sh"; then
42
+ npm_result=1
43
+ fi
44
+ echo ""
45
+
46
+ echo -e "${CYAN}╔════════════════════════════════════════════════╗${NC}"
47
+ echo -e "${CYAN}║ Summary Results ║${NC}"
48
+ echo -e "${CYAN}╚════════════════════════════════════════════════╝${NC}"
49
+ echo ""
50
+
51
+ if [[ $openspec_result -eq 1 ]]; then
52
+ echo -e "${GREEN}✅ OpenSpec Cleanup Verification${NC}"
53
+ else
54
+ echo -e "${RED}❌ OpenSpec Cleanup Verification${NC}"
55
+ fi
56
+
57
+ if [[ $slash_result -eq 1 ]]; then
58
+ echo -e "${GREEN}✅ Slash Command Verification${NC}"
59
+ else
60
+ echo -e "${RED}❌ Slash Command Verification${NC}"
61
+ fi
62
+
63
+ if [[ $npm_result -eq 1 ]]; then
64
+ echo -e "${GREEN}✅ npm Package Verification${NC}"
65
+ else
66
+ echo -e "${RED}❌ npm Package Verification${NC}"
67
+ fi
68
+
69
+ echo ""
70
+
71
+ total=$((openspec_result + slash_result + npm_result))
72
+ if [[ $total -eq 3 ]]; then
73
+ echo -e "${GREEN}All verifications passed! DevBooks independence verification successful.${NC}"
74
+ exit 0
75
+ else
76
+ echo -e "${RED}Some verifications failed, please check the output above.${NC}"
77
+ exit 1
78
+ fi