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.
- package/LICENSE +21 -0
- package/README.md +463 -0
- package/bin/devbooks.js +986 -0
- package/package.json +41 -0
- package/skills/Skill-Development-Guide.md +249 -0
- package/skills/Skills-Usage-Guide.md +447 -0
- package/skills/_shared/context-detection-template.md +315 -0
- package/skills/_shared/mcp-enhancement-template.md +144 -0
- package/skills/_shared/references/universal-gating-protocol.md +114 -0
- package/skills/_template/config-discovery-template.md +126 -0
- package/skills/devbooks-brownfield-bootstrap/SKILL.md +168 -0
- package/skills/devbooks-brownfield-bootstrap/references/10-glossary-template.md +42 -0
- package/skills/devbooks-brownfield-bootstrap/references/brownfield-bootstrap-prompt.md +115 -0
- package/skills/devbooks-brownfield-bootstrap/references/brownfield-bootstrap.md +96 -0
- package/skills/devbooks-brownfield-bootstrap/references/code-navigation-strategy.md +203 -0
- package/skills/devbooks-brownfield-bootstrap/scripts/cod-update.sh +357 -0
- package/skills/devbooks-brownfield-bootstrap/templates/project-profile-template.md +172 -0
- package/skills/devbooks-c4-map/SKILL.md +151 -0
- package/skills/devbooks-c4-map/references/c4-architecture-map-prompt.md +33 -0
- package/skills/devbooks-c4-map/references/layered-constraint-checklist.md +185 -0
- package/skills/devbooks-code-review/SKILL.md +175 -0
- package/skills/devbooks-code-review/references/code-review-prompt.md +100 -0
- package/skills/devbooks-code-review/references/code-smell-cheatsheet.md +498 -0
- package/skills/devbooks-code-review/references/pr-template-and-guidelines.md +321 -0
- package/skills/devbooks-code-review/references/resource-management-review-checklist.md +311 -0
- package/skills/devbooks-coder/SKILL.md +219 -0
- package/skills/devbooks-coder/references/code-implementation-prompt.md +74 -0
- package/skills/devbooks-coder/references/coding-style-guidelines.md +351 -0
- package/skills/devbooks-coder/references/error-code-standard.md +463 -0
- package/skills/devbooks-coder/references/logging-standard.md +329 -0
- package/skills/devbooks-coder/references/low-risk-modification-techniques.md +275 -0
- package/skills/devbooks-delivery-workflow/SKILL.md +217 -0
- package/skills/devbooks-delivery-workflow/references/9-change-verification-traceability-template.md +133 -0
- package/skills/devbooks-delivery-workflow/references/delivery-acceptance-workflow.md +177 -0
- package/skills/devbooks-delivery-workflow/references/prototype-production-dual-track.md +169 -0
- package/skills/devbooks-delivery-workflow/scripts/ac-trace-check.sh +330 -0
- package/skills/devbooks-delivery-workflow/scripts/audit-scope.sh +262 -0
- package/skills/devbooks-delivery-workflow/scripts/change-check.sh +1039 -0
- package/skills/devbooks-delivery-workflow/scripts/change-codemod-scaffold.sh +135 -0
- package/skills/devbooks-delivery-workflow/scripts/change-evidence.sh +152 -0
- package/skills/devbooks-delivery-workflow/scripts/change-scaffold.sh +467 -0
- package/skills/devbooks-delivery-workflow/scripts/change-spec-delta-scaffold.sh +135 -0
- package/skills/devbooks-delivery-workflow/scripts/constitution-check.sh +237 -0
- package/skills/devbooks-delivery-workflow/scripts/env-match-check.sh +128 -0
- package/skills/devbooks-delivery-workflow/scripts/fitness-check.sh +365 -0
- package/skills/devbooks-delivery-workflow/scripts/guardrail-check.sh +516 -0
- package/skills/devbooks-delivery-workflow/scripts/handoff-check.sh +141 -0
- package/skills/devbooks-delivery-workflow/scripts/hygiene-check.sh +340 -0
- package/skills/devbooks-delivery-workflow/scripts/migrate-from-openspec.sh +385 -0
- package/skills/devbooks-delivery-workflow/scripts/migrate-to-v2-gates.sh +202 -0
- package/skills/devbooks-delivery-workflow/scripts/progress-dashboard.sh +319 -0
- package/skills/devbooks-delivery-workflow/scripts/prototype-promote.sh +341 -0
- package/skills/devbooks-delivery-workflow/scripts/spec-preview.sh +203 -0
- package/skills/devbooks-delivery-workflow/scripts/spec-promote.sh +118 -0
- package/skills/devbooks-delivery-workflow/scripts/spec-rollback.sh +124 -0
- package/skills/devbooks-delivery-workflow/scripts/spec-stage.sh +117 -0
- package/skills/devbooks-delivery-workflow/scripts/verify-all.sh +78 -0
- package/skills/devbooks-delivery-workflow/scripts/verify-npm-package.sh +123 -0
- package/skills/devbooks-delivery-workflow/scripts/verify-openspec-free.sh +81 -0
- package/skills/devbooks-delivery-workflow/scripts/verify-slash-commands.sh +146 -0
- package/skills/devbooks-delivery-workflow/templates/handoff.md +50 -0
- package/skills/devbooks-design-backport/SKILL.md +73 -0
- package/skills/devbooks-design-backport/references/design-backport-prompt.md +132 -0
- package/skills/devbooks-design-doc/SKILL.md +121 -0
- package/skills/devbooks-design-doc/references/design-doc-prompt.md +188 -0
- package/skills/devbooks-design-doc/references/microservice-design-checklist.md +149 -0
- package/skills/devbooks-design-doc/references/privacy-compliance-checklist.md +240 -0
- package/skills/devbooks-entropy-monitor/SKILL.md +188 -0
- package/skills/devbooks-entropy-monitor/references/entropy-metrics-methodology.md +218 -0
- package/skills/devbooks-entropy-monitor/scripts/entropy-measure.sh +449 -0
- package/skills/devbooks-entropy-monitor/scripts/entropy-report.sh +303 -0
- package/skills/devbooks-entropy-monitor/templates/thresholds.json +99 -0
- package/skills/devbooks-federation/SKILL.md +264 -0
- package/skills/devbooks-federation/scripts/federation-check.sh +144 -0
- package/skills/devbooks-federation/templates/federation.yaml +89 -0
- package/skills/devbooks-impact-analysis/SKILL.md +135 -0
- package/skills/devbooks-impact-analysis/references/impact-analysis-prompt.md +82 -0
- package/skills/devbooks-impact-analysis/scripts/graph-cache.sh +214 -0
- package/skills/devbooks-implementation-plan/SKILL.md +83 -0
- package/skills/devbooks-implementation-plan/references/implementation-plan-prompt.md +95 -0
- package/skills/devbooks-index-bootstrap/SKILL.md +240 -0
- package/skills/devbooks-proposal-author/SKILL.md +83 -0
- package/skills/devbooks-proposal-author/references/proposal-authoring-prompt.md +66 -0
- package/skills/devbooks-proposal-challenger/SKILL.md +86 -0
- package/skills/devbooks-proposal-challenger/references/ethics-and-compliance-checklist.md +176 -0
- package/skills/devbooks-proposal-challenger/references/proposal-challenge-prompt.md +57 -0
- package/skills/devbooks-proposal-debate-workflow/SKILL.md +78 -0
- package/skills/devbooks-proposal-debate-workflow/references/11-proposal-debate-template.md +35 -0
- package/skills/devbooks-proposal-debate-workflow/references/proposal-debate-workflow.md +24 -0
- package/skills/devbooks-proposal-debate-workflow/scripts/proposal-debate-check.sh +102 -0
- package/skills/devbooks-proposal-judge/SKILL.md +78 -0
- package/skills/devbooks-proposal-judge/references/proposal-judge-prompt.md +37 -0
- package/skills/devbooks-router/SKILL.md +346 -0
- package/skills/devbooks-spec-contract/SKILL.md +191 -0
- package/skills/devbooks-spec-contract/references/api-design-guide.md +349 -0
- package/skills/devbooks-spec-contract/references/contract-and-data-definition-prompt.md +85 -0
- package/skills/devbooks-spec-contract/references/implicit-change-detection-prompt.md +183 -0
- package/skills/devbooks-spec-contract/references/spec-change-prompt.md +63 -0
- package/skills/devbooks-spec-contract/scripts/implicit-change-detect.sh +378 -0
- package/skills/devbooks-spec-gardener/SKILL.md +73 -0
- package/skills/devbooks-spec-gardener/references/spec-gardener-prompt.md +41 -0
- package/skills/devbooks-test-owner/SKILL.md +173 -0
- package/skills/devbooks-test-owner/references/9-change-verification-traceability-template.md +133 -0
- package/skills/devbooks-test-owner/references/async-system-test-strategy.md +316 -0
- package/skills/devbooks-test-owner/references/decoupling-techniques-cheatsheet.md +269 -0
- package/skills/devbooks-test-owner/references/test-code-prompt.md +171 -0
- package/skills/devbooks-test-owner/references/test-driven-development.md +351 -0
- package/skills/devbooks-test-owner/references/test-layering-strategy.md +281 -0
- package/skills/devbooks-test-reviewer/SKILL.md +189 -0
- package/templates/.devbooks/config.yaml +88 -0
- package/templates/claude-commands/devbooks/apply.md +38 -0
- package/templates/claude-commands/devbooks/archive.md +33 -0
- package/templates/claude-commands/devbooks/backport.md +19 -0
- package/templates/claude-commands/devbooks/bootstrap.md +20 -0
- package/templates/claude-commands/devbooks/c4.md +20 -0
- package/templates/claude-commands/devbooks/challenger.md +19 -0
- package/templates/claude-commands/devbooks/code.md +20 -0
- package/templates/claude-commands/devbooks/debate.md +20 -0
- package/templates/claude-commands/devbooks/delivery.md +20 -0
- package/templates/claude-commands/devbooks/design.md +20 -0
- package/templates/claude-commands/devbooks/entropy.md +19 -0
- package/templates/claude-commands/devbooks/federation.md +19 -0
- package/templates/claude-commands/devbooks/gardener.md +19 -0
- package/templates/claude-commands/devbooks/impact.md +19 -0
- package/templates/claude-commands/devbooks/index.md +19 -0
- package/templates/claude-commands/devbooks/judge.md +19 -0
- package/templates/claude-commands/devbooks/plan.md +20 -0
- package/templates/claude-commands/devbooks/proposal.md +20 -0
- package/templates/claude-commands/devbooks/quick.md +43 -0
- package/templates/claude-commands/devbooks/review.md +20 -0
- package/templates/claude-commands/devbooks/router.md +19 -0
- package/templates/claude-commands/devbooks/spec.md +20 -0
- package/templates/claude-commands/devbooks/test-review.md +19 -0
- package/templates/claude-commands/devbooks/test.md +20 -0
- package/templates/dev-playbooks/changes/.gitkeep +1 -0
- package/templates/dev-playbooks/constitution.md +116 -0
- package/templates/dev-playbooks/project.md +96 -0
- package/templates/dev-playbooks/scripts/.gitkeep +1 -0
- package/templates/dev-playbooks/specs/_meta/anti-patterns/.gitkeep +2 -0
- package/templates/dev-playbooks/specs/_meta/glossary.md +48 -0
- package/templates/dev-playbooks/specs/_meta/project-profile.md +79 -0
- 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 spec deltas from a change package and checks for staging conflicts.
|
|
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 found
|
|
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
|
+
# 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 (default: current directory)
|
|
42
|
+
--change-root DIR Change root (default: changes)
|
|
43
|
+
--truth-root DIR Truth root (default: specs)
|
|
44
|
+
--help, -h Show help
|
|
45
|
+
--version, -v Show version
|
|
46
|
+
|
|
47
|
+
conflict detection:
|
|
48
|
+
1. File-level conflict: the same target file is modified by multiple changes
|
|
49
|
+
2. Content-level conflict: the same REQ-xxx is modified
|
|
50
|
+
|
|
51
|
+
exit codes:
|
|
52
|
+
0 - no conflicts
|
|
53
|
+
1 - conflicts found
|
|
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
|
|
84
|
+
main() {
|
|
85
|
+
local change_id=""
|
|
86
|
+
|
|
87
|
+
# Parse args
|
|
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: ${change_id}"
|
|
132
|
+
log_info " change dir: ${change_dir}"
|
|
133
|
+
log_info " staged dir: ${staged_dir}"
|
|
134
|
+
|
|
135
|
+
# Ensure change exists
|
|
136
|
+
if [[ ! -d "$change_dir" ]]; then
|
|
137
|
+
log_error "change directory not found: ${change_dir}"
|
|
138
|
+
exit 2
|
|
139
|
+
fi
|
|
140
|
+
|
|
141
|
+
# Check whether spec deltas exist
|
|
142
|
+
if [[ ! -d "$specs_delta_dir" ]]; then
|
|
143
|
+
log_info "no spec deltas; skipping"
|
|
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
|
|
182
|
+
echo ""
|
|
183
|
+
if [[ $conflicts -gt 0 ]]; then
|
|
184
|
+
log_error "found ${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; safe 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 staged spec deltas into the truth root.
|
|
6
|
+
#
|
|
7
|
+
# Usage:
|
|
8
|
+
# ./spec-promote.sh <change-id> [options]
|
|
9
|
+
# ./spec-promote.sh --help
|
|
10
|
+
#
|
|
11
|
+
# Exit codes:
|
|
12
|
+
# 0 - success
|
|
13
|
+
# 1 - failure
|
|
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
|
|
39
|
+
--truth-root DIR Truth root
|
|
40
|
+
--dry-run Dry run
|
|
41
|
+
--help, -h Show help
|
|
42
|
+
|
|
43
|
+
flow:
|
|
44
|
+
1. Verify preconditions (already staged)
|
|
45
|
+
2. Copy _staged/<change-id>/ into specs/
|
|
46
|
+
3. Remove _staged/<change-id>/
|
|
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: ${change_id}"
|
|
80
|
+
|
|
81
|
+
# Preconditions
|
|
82
|
+
if [[ ! -d "$staged_dir" ]]; then
|
|
83
|
+
log_error "staged content not found: ${staged_dir}"
|
|
84
|
+
log_error "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
|
+
# Cleanup staged directory
|
|
108
|
+
if [[ "$dry_run" == true ]]; then
|
|
109
|
+
log_info "[DRY-RUN] would remove: ${staged_dir}"
|
|
110
|
+
else
|
|
111
|
+
rm -rf "$staged_dir"
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
log_pass "promoted ${promoted} file(s) into truth root"
|
|
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 staging operations.
|
|
6
|
+
#
|
|
7
|
+
# Usage:
|
|
8
|
+
# ./spec-rollback.sh <change-id> [options]
|
|
9
|
+
# ./spec-rollback.sh --help
|
|
10
|
+
#
|
|
11
|
+
# Exit codes:
|
|
12
|
+
# 0 - success
|
|
13
|
+
# 1 - failure
|
|
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
|
|
41
|
+
--truth-root DIR Truth root
|
|
42
|
+
--change-root DIR Change root
|
|
43
|
+
--target TARGET Target: staged | draft
|
|
44
|
+
--dry-run Dry run
|
|
45
|
+
--help, -h Show help
|
|
46
|
+
|
|
47
|
+
targets:
|
|
48
|
+
staged - clear the staging layer (keep spec deltas in the change package)
|
|
49
|
+
draft - roll back to change-package state (clear staging; 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 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: ${change_id}"
|
|
89
|
+
log_info "target: ${target}"
|
|
90
|
+
|
|
91
|
+
case "$target" in
|
|
92
|
+
staged)
|
|
93
|
+
# Clear staging layer
|
|
94
|
+
if [[ -d "$staged_dir" ]]; then
|
|
95
|
+
if [[ "$dry_run" == true ]]; then
|
|
96
|
+
log_info "[DRY-RUN] would remove: ${staged_dir}"
|
|
97
|
+
else
|
|
98
|
+
rm -rf "$staged_dir"
|
|
99
|
+
log_pass "cleared staging: ${staged_dir}"
|
|
100
|
+
fi
|
|
101
|
+
else
|
|
102
|
+
log_info "staging is empty; nothing to do"
|
|
103
|
+
fi
|
|
104
|
+
;;
|
|
105
|
+
|
|
106
|
+
draft)
|
|
107
|
+
# Roll back to change-package state (clear staging)
|
|
108
|
+
if [[ -d "$staged_dir" ]]; then
|
|
109
|
+
if [[ "$dry_run" == true ]]; then
|
|
110
|
+
log_info "[DRY-RUN] would remove: ${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 a change package's spec deltas into the staging layer.
|
|
6
|
+
#
|
|
7
|
+
# Usage:
|
|
8
|
+
# ./spec-stage.sh <change-id> [options]
|
|
9
|
+
# ./spec-stage.sh --help
|
|
10
|
+
#
|
|
11
|
+
# Exit codes:
|
|
12
|
+
# 0 - success
|
|
13
|
+
# 1 - failure (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
|
|
41
|
+
--change-root DIR Change root
|
|
42
|
+
--truth-root DIR Truth root
|
|
43
|
+
--dry-run Dry run (no filesystem changes)
|
|
44
|
+
--force Force stage (ignore conflicts)
|
|
45
|
+
--help, -h Show help
|
|
46
|
+
|
|
47
|
+
exit codes:
|
|
48
|
+
0 - success
|
|
49
|
+
1 - failure
|
|
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: ${change_id}"
|
|
87
|
+
|
|
88
|
+
if [[ ! -d "$specs_delta_dir" ]]; then
|
|
89
|
+
log_info "no spec deltas; skipping"
|
|
90
|
+
exit 0
|
|
91
|
+
fi
|
|
92
|
+
|
|
93
|
+
# Use 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 detected; use --force to stage anyway"
|
|
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
|
+
# Aggregates verification results for AC-001 ~ AC-022
|
|
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 verification scripts
|
|
22
|
+
echo -e "${YELLOW}>>> OpenSpec removal 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 ║${NC}"
|
|
48
|
+
echo -e "${CYAN}╚════════════════════════════════════════════════╝${NC}"
|
|
49
|
+
echo ""
|
|
50
|
+
|
|
51
|
+
if [[ $openspec_result -eq 1 ]]; then
|
|
52
|
+
echo -e "${GREEN}✅ OpenSpec removal verification${NC}"
|
|
53
|
+
else
|
|
54
|
+
echo -e "${RED}❌ OpenSpec removal 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 checks passed! DevBooks independence verified.${NC}"
|
|
74
|
+
exit 0
|
|
75
|
+
else
|
|
76
|
+
echo -e "${RED}⚠️ Some checks failed. Review the output above.${NC}"
|
|
77
|
+
exit 1
|
|
78
|
+
fi
|