@codewizard-dt/bootstrap 2.10.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/.github/workflows/build.yml +88 -0
- package/.github/workflows/security.yml +24 -0
- package/.gitleaks.toml +15 -0
- package/README.md +472 -0
- package/bin/cli.js +47 -0
- package/lib/README.md +27 -0
- package/lib/hooks/README.md +316 -0
- package/lib/hooks/env-file-guard.js +45 -0
- package/lib/hooks/git-protected-ops-block.js +77 -0
- package/lib/hooks/lib/serena-languages.js +158 -0
- package/lib/hooks/lib/serena.js +787 -0
- package/lib/hooks/mv-absolute-path-block.js +53 -0
- package/lib/hooks/serena-bash-grep-block.js +501 -0
- package/lib/hooks/serena-edit-guard.js +74 -0
- package/lib/hooks/serena-first-glob-guard.js +94 -0
- package/lib/hooks/serena-first-guard.js +74 -0
- package/lib/hooks/serena-first-read-guard.js +167 -0
- package/lib/hooks/serena-pre-delegation.js +117 -0
- package/lib/hooks/serena-session-reset.js +45 -0
- package/lib/hooks/serena-usage-tracker.js +186 -0
- package/lib/hooks/serena-write-guard.js +58 -0
- package/lib/prompts/README.md +16 -0
- package/lib/prompts/migrate-wiki.md +111 -0
- package/lib/prompts/setup-deployment.md +322 -0
- package/lib/prompts/setup-design-system.md +162 -0
- package/lib/prompts/setup-strict-typechecks.md +139 -0
- package/lib/scripts/README.md +49 -0
- package/lib/scripts/bootstrap-serena.sh +145 -0
- package/lib/scripts/build-mcp-guide.sh +108 -0
- package/lib/scripts/install-global.sh +78 -0
- package/lib/scripts/install-mcps.sh +131 -0
- package/lib/scripts/lib.sh +154 -0
- package/lib/scripts/merge-gitignore.sh +65 -0
- package/lib/scripts/migrate-project.sh +273 -0
- package/lib/scripts/setup-deployment.sh +104 -0
- package/lib/scripts/setup-project.sh +55 -0
- package/lib/scripts/setup-runner.sh +99 -0
- package/lib/scripts/setup-strict-typechecks.sh +29 -0
- package/lib/scripts/startup.sh +42 -0
- package/lib/scripts/sync-wiki-scaffold.sh +104 -0
- package/lib/scripts/templates/CLAUDE-env-safety.md +3 -0
- package/lib/scripts/templates/CLAUDE-wiki.md +60 -0
- package/lib/scripts/templates/gitignore +136 -0
- package/lib/scripts/templates/guides/stubs/00-header.md +15 -0
- package/lib/scripts/templates/guides/stubs/brave-search.md +20 -0
- package/lib/scripts/templates/guides/stubs/context7.md +26 -0
- package/lib/scripts/templates/guides/stubs/playwright.md +26 -0
- package/lib/scripts/templates/guides/stubs/serena.md +219 -0
- package/lib/scripts/templates/wiki/conventions.md +100 -0
- package/lib/scripts/templates/wiki/dashboard.html +1733 -0
- package/lib/scripts/templates/wiki/hot.md +21 -0
- package/lib/scripts/templates/wiki/index.md +46 -0
- package/lib/scripts/templates/wiki/knowledge/concepts/.gitkeep +0 -0
- package/lib/scripts/templates/wiki/knowledge/entities/components/.gitkeep +0 -0
- package/lib/scripts/templates/wiki/knowledge/entities/organisations/.gitkeep +0 -0
- package/lib/scripts/templates/wiki/knowledge/entities/people/.gitkeep +0 -0
- package/lib/scripts/templates/wiki/knowledge/entities/tools/.gitkeep +0 -0
- package/lib/scripts/templates/wiki/knowledge/sources/.gitkeep +0 -0
- package/lib/scripts/templates/wiki/log.md +14 -0
- package/lib/scripts/templates/wiki/work/bugs/.gitkeep +0 -0
- package/lib/scripts/templates/wiki/work/bugs/archive/index.md +6 -0
- package/lib/scripts/templates/wiki/work/bugs/index.md +12 -0
- package/lib/scripts/templates/wiki/work/bugs/lifecycle.md +39 -0
- package/lib/scripts/templates/wiki/work/decisions/.gitkeep +0 -0
- package/lib/scripts/templates/wiki/work/decisions/archive/index.md +6 -0
- package/lib/scripts/templates/wiki/work/decisions/index.md +12 -0
- package/lib/scripts/templates/wiki/work/decisions/lifecycle.md +42 -0
- package/lib/scripts/templates/wiki/work/requirements/.gitkeep +0 -0
- package/lib/scripts/templates/wiki/work/requirements/archive/index.md +6 -0
- package/lib/scripts/templates/wiki/work/requirements/index.md +12 -0
- package/lib/scripts/templates/wiki/work/requirements/lifecycle.md +34 -0
- package/lib/scripts/templates/wiki/work/roadmaps/.gitkeep +0 -0
- package/lib/scripts/templates/wiki/work/roadmaps/archive/index.md +6 -0
- package/lib/scripts/templates/wiki/work/roadmaps/index.md +12 -0
- package/lib/scripts/templates/wiki/work/roadmaps/lifecycle.md +32 -0
- package/lib/scripts/templates/wiki/work/tasks/.gitkeep +0 -0
- package/lib/scripts/templates/wiki/work/tasks/archive/index.md +6 -0
- package/lib/scripts/templates/wiki/work/tasks/index.md +12 -0
- package/lib/scripts/templates/wiki/work/tasks/lifecycle.md +39 -0
- package/lib/scripts/templates/wiki/work/uat/.gitkeep +0 -0
- package/lib/scripts/templates/wiki/work/uat/archive/index.md +6 -0
- package/lib/scripts/templates/wiki/work/uat/index.md +12 -0
- package/lib/scripts/templates/wiki/work/uat/lifecycle.md +48 -0
- package/lib/scripts/templates/wiki/work/uat/screenshots/.gitkeep +0 -0
- package/lib/scripts/update-project.sh +75 -0
- package/lib/scripts/wiki-dashboard-server.js +146 -0
- package/lib/skills/README.md +146 -0
- package/lib/skills/anti-slop/SKILL.md +183 -0
- package/lib/skills/bug-close/SKILL.md +136 -0
- package/lib/skills/bug-file/SKILL.md +114 -0
- package/lib/skills/bug-triage/SKILL.md +140 -0
- package/lib/skills/company-align/SKILL.md +203 -0
- package/lib/skills/debug-logs/SKILL.md +129 -0
- package/lib/skills/decision-create/SKILL.md +220 -0
- package/lib/skills/decision-finalize/SKILL.md +181 -0
- package/lib/skills/decision-next/SKILL.md +129 -0
- package/lib/skills/decision-walkthrough/SKILL.md +169 -0
- package/lib/skills/demo/SKILL.md +183 -0
- package/lib/skills/elevator-pitch/SKILL.md +125 -0
- package/lib/skills/eval-create/SKILL.md +344 -0
- package/lib/skills/eval-gap/SKILL.md +150 -0
- package/lib/skills/eval-run/SKILL.md +214 -0
- package/lib/skills/extract-feature/SKILL.md +344 -0
- package/lib/skills/flashcard/SKILL.md +513 -0
- package/lib/skills/frontend-taste/SKILL.md +184 -0
- package/lib/skills/gap-assess/SKILL.md +97 -0
- package/lib/skills/git-commit/SKILL.md +164 -0
- package/lib/skills/lint/SKILL.md +99 -0
- package/lib/skills/marp-slideshow/SKILL.md +212 -0
- package/lib/skills/mermaid-flowchart/SKILL.md +194 -0
- package/lib/skills/now/SKILL.md +36 -0
- package/lib/skills/port-feature/SKILL.md +315 -0
- package/lib/skills/power-mode/SKILL.md +184 -0
- package/lib/skills/primer/SKILL.md +84 -0
- package/lib/skills/project-readme/SKILL.md +166 -0
- package/lib/skills/req-compile/SKILL.md +131 -0
- package/lib/skills/req-create/SKILL.md +124 -0
- package/lib/skills/req-extract-decisions/SKILL.md +241 -0
- package/lib/skills/req-finalize/SKILL.md +251 -0
- package/lib/skills/req-retire/SKILL.md +185 -0
- package/lib/skills/req-update/SKILL.md +265 -0
- package/lib/skills/research/SKILL.md +250 -0
- package/lib/skills/research-company/SKILL.md +345 -0
- package/lib/skills/roadmap-add/SKILL.md +238 -0
- package/lib/skills/roadmap-create/SKILL.md +223 -0
- package/lib/skills/roadmap-next/SKILL.md +132 -0
- package/lib/skills/security-audit/SKILL.md +246 -0
- package/lib/skills/serena-config/SKILL.md +92 -0
- package/lib/skills/simplify/SKILL.md +227 -0
- package/lib/skills/tackle/SKILL.md +156 -0
- package/lib/skills/task-add/SKILL.md +208 -0
- package/lib/skills/task-audit/SKILL.md +294 -0
- package/lib/skills/task-trash/SKILL.md +115 -0
- package/lib/skills/task-update/SKILL.md +136 -0
- package/lib/skills/uat-auto/SKILL.md +69 -0
- package/lib/skills/uat-auto-plus/SKILL.md +115 -0
- package/lib/skills/uat-generate/SKILL.md +289 -0
- package/lib/skills/uat-skip/SKILL.md +169 -0
- package/lib/skills/uat-walk/SKILL.md +164 -0
- package/lib/skills/uat-walk/UAT-CORE.md +140 -0
- package/lib/skills/update-docs/SKILL.md +75 -0
- package/lib/skills/wiki-archive/SKILL.md +96 -0
- package/lib/skills/wiki-ingest/SKILL.md +139 -0
- package/lib/skills/wiki-lint/SKILL.md +131 -0
- package/lib/skills/wiki-query/SKILL.md +71 -0
- package/lib/skills/wiki-rotate-log/SKILL.md +90 -0
- package/lib/skills/wiki-tidy/SKILL.md +107 -0
- package/package.json +32 -0
- package/raw/.gitkeep +0 -0
- package/raw/design-principles.md +65 -0
- package/raw/guides/command-anti-patterns.md +79 -0
- package/raw/guides/deployment-strategy.md +448 -0
- package/raw/guides/evals-framework.md +452 -0
- package/raw/guides/mcp-tools.md +335 -0
- package/raw/guides/task-spec.md +79 -0
- package/raw/guides/type-checking-templates/README.md +112 -0
- package/raw/guides/type-checking-templates/eslint/eslint.config.ts +105 -0
- package/raw/guides/type-checking-templates/python/mypy.ini +69 -0
- package/raw/guides/type-checking-templates/python/pyproject.toml +164 -0
- package/raw/guides/type-checking-templates/python/pyrightconfig.json +67 -0
- package/raw/guides/type-checking-templates/tsconfig/tsconfig.app.jsonc +45 -0
- package/raw/guides/type-checking-templates/tsconfig/tsconfig.lib.jsonc +44 -0
- package/raw/guides/type-checking-templates/tsconfig/tsconfig.node-esm.jsonc +40 -0
- package/raw/guides/type-checking-templates/tsconfig/tsconfig.node.jsonc +34 -0
- package/raw/guides/type-checking-templates/tsconfig/tsconfig.vite-root.json +8 -0
- package/raw/harness-notes.md +20 -0
- package/raw/house-style/components/Badge.tsx +16 -0
- package/raw/house-style/components/Button.tsx +32 -0
- package/raw/house-style/components/Card.tsx +26 -0
- package/raw/house-style/components/Chip.tsx +57 -0
- package/raw/house-style/components/IconButton.tsx +67 -0
- package/raw/house-style/components/Modal.tsx +18 -0
- package/raw/house-style/components/Stepper.tsx +141 -0
- package/raw/house-style/components/icons.tsx +128 -0
- package/raw/house-style/preview/src/index.css +46 -0
- package/raw/house-style/tokens/tailwind.preset.ts +49 -0
- package/raw/house-style/tokens/tokens.json +62 -0
- package/raw/llm-wiki-2.md +162 -0
- package/raw/llm-wiki.md +75 -0
- package/raw/research/dark-mode-theme/index.md +85 -0
- package/raw/research/dark-mode-theme/sources.md +49 -0
- package/raw/research/serena-mcp-disconnect/index.md +81 -0
- package/raw/research/serena-mcp-disconnect/sources.md +87 -0
- package/raw/research/wiki-tooling-improvements/index.md +126 -0
- package/raw/research/wiki-tooling-improvements/sources.md +73 -0
- package/raw/software-factory-case-study.pdf +0 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Migrate a project bootstrapped with the legacy .docs/ layout to the LLM Wiki
|
|
5
|
+
# structure (wiki/knowledge/ + wiki/work/). The mechanical scaffold is done by
|
|
6
|
+
# sync-wiki-scaffold.sh; the semantic conversion (frontmatter synthesis, ID
|
|
7
|
+
# renames, link rewriting, family indexes) is performed by Claude using the
|
|
8
|
+
# prompt template at lib/prompts/migrate-wiki.md — same seam as setup-deployment.
|
|
9
|
+
#
|
|
10
|
+
# Safety: requires a clean git tree and runs on a fresh `wiki-migration` branch
|
|
11
|
+
# so the entire migration is one reviewable diff. Files are `git mv`d before
|
|
12
|
+
# editing, so history is preserved.
|
|
13
|
+
#
|
|
14
|
+
# Usage:
|
|
15
|
+
# migrate-project.sh [--dry-run] <path-to-project> [additional context...]
|
|
16
|
+
|
|
17
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
18
|
+
. "$SCRIPT_DIR/lib.sh"
|
|
19
|
+
TEMPLATE="$SCRIPT_DIR/../prompts/migrate-wiki.md"
|
|
20
|
+
|
|
21
|
+
if [ ! -f "$TEMPLATE" ]; then
|
|
22
|
+
echo "Error: prompt template not found at $TEMPLATE" >&2
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
DRY_RUN=false
|
|
27
|
+
POSITIONAL=()
|
|
28
|
+
for arg in "$@"; do
|
|
29
|
+
case "$arg" in
|
|
30
|
+
--dry-run) DRY_RUN=true ;;
|
|
31
|
+
*) POSITIONAL+=("$arg") ;;
|
|
32
|
+
esac
|
|
33
|
+
done
|
|
34
|
+
set -- "${POSITIONAL[@]}"
|
|
35
|
+
|
|
36
|
+
if [ $# -lt 1 ]; then
|
|
37
|
+
echo "Usage: $0 [--dry-run] <path-to-project> [additional context...]" >&2
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
PROJECT_DIR="$(resolve_project_dir "$1")" || exit 1
|
|
42
|
+
shift
|
|
43
|
+
EXTRA_CONTEXT="${*}"
|
|
44
|
+
|
|
45
|
+
# --- Preflight 1: legacy content must exist -------------------------------
|
|
46
|
+
LEGACY_FAMILIES=(tasks uat adr prd bugs roadmaps)
|
|
47
|
+
LEGACY_FOUND=()
|
|
48
|
+
for fam in "${LEGACY_FAMILIES[@]}"; do
|
|
49
|
+
dir="$PROJECT_DIR/.docs/$fam"
|
|
50
|
+
if [ -d "$dir" ]; then
|
|
51
|
+
count=$(find "$dir" -name '*.md' -type f | wc -l | tr -d ' ')
|
|
52
|
+
if [ "$count" -gt 0 ]; then
|
|
53
|
+
LEGACY_FOUND+=("$fam:$count")
|
|
54
|
+
fi
|
|
55
|
+
fi
|
|
56
|
+
done
|
|
57
|
+
|
|
58
|
+
if [ ${#LEGACY_FOUND[@]} -eq 0 ]; then
|
|
59
|
+
echo "Nothing to migrate: no legacy .docs/ artifact content found in $PROJECT_DIR."
|
|
60
|
+
exit 0
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
echo "Legacy .docs/ content found in $PROJECT_DIR:"
|
|
64
|
+
for entry in "${LEGACY_FOUND[@]}"; do
|
|
65
|
+
fam="${entry%%:*}"
|
|
66
|
+
count="${entry##*:}"
|
|
67
|
+
echo " .docs/$fam — $count markdown file(s)"
|
|
68
|
+
done
|
|
69
|
+
echo ""
|
|
70
|
+
|
|
71
|
+
# --- Detect git repo (used by both dry-run and live paths) -----------------
|
|
72
|
+
if git -C "$PROJECT_DIR" rev-parse --git-dir &>/dev/null; then
|
|
73
|
+
IS_GIT=true
|
|
74
|
+
else
|
|
75
|
+
IS_GIT=false
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# --- Dry run: inventory only, no changes, no branch ------------------------
|
|
79
|
+
if [ "$DRY_RUN" = true ]; then
|
|
80
|
+
echo "DRY RUN — files that would migrate:"
|
|
81
|
+
echo ""
|
|
82
|
+
for fam in "${LEGACY_FAMILIES[@]}"; do
|
|
83
|
+
dir="$PROJECT_DIR/.docs/$fam"
|
|
84
|
+
[ -d "$dir" ] || continue
|
|
85
|
+
find "$dir" -name '*.md' -type f | sort | while read -r f; do
|
|
86
|
+
echo " ${f#"$PROJECT_DIR/"}"
|
|
87
|
+
done
|
|
88
|
+
done
|
|
89
|
+
echo ""
|
|
90
|
+
echo "Target layout: wiki/work/{tasks,uat,decisions,requirements,bugs,roadmaps}/"
|
|
91
|
+
if [ "$IS_GIT" = true ]; then
|
|
92
|
+
echo "Run without --dry-run to migrate (requires clean git tree)."
|
|
93
|
+
else
|
|
94
|
+
echo "Run without --dry-run to migrate (no git repo — will use plain mv)."
|
|
95
|
+
fi
|
|
96
|
+
exit 0
|
|
97
|
+
fi
|
|
98
|
+
|
|
99
|
+
# --- Preflight 2: git-specific checks (skipped when no git repo) -----------
|
|
100
|
+
if [ "$IS_GIT" = true ]; then
|
|
101
|
+
if [ -n "$(git -C "$PROJECT_DIR" status --porcelain)" ]; then
|
|
102
|
+
echo "Error: working tree is not clean. Commit or stash your changes first —" >&2
|
|
103
|
+
echo "the migration must be the only thing in its diff." >&2
|
|
104
|
+
exit 1
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
if git -C "$PROJECT_DIR" show-ref --verify --quiet refs/heads/wiki-migration; then
|
|
108
|
+
echo "Error: a 'wiki-migration' branch already exists." >&2
|
|
109
|
+
echo "Delete or rename it first: git branch -D wiki-migration" >&2
|
|
110
|
+
exit 1
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
git -C "$PROJECT_DIR" switch -c wiki-migration
|
|
114
|
+
echo "Created and switched to branch: wiki-migration"
|
|
115
|
+
echo ""
|
|
116
|
+
else
|
|
117
|
+
echo "Note: no git repository detected — migration will use plain 'mv' instead of 'git mv'."
|
|
118
|
+
echo " File history will not be preserved. Consider 'git init && git add -A && git commit' first."
|
|
119
|
+
echo ""
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# --- Scaffold first: wiki tree + CLAUDE.md schema + guides -----------------
|
|
123
|
+
"$SCRIPT_DIR/sync-wiki-scaffold.sh" "$PROJECT_DIR"
|
|
124
|
+
echo ""
|
|
125
|
+
|
|
126
|
+
# --- Run the Claude-driven migration ---------------------------------------
|
|
127
|
+
PROMPT="$(sed "s|__PROJECT_DIR__|$PROJECT_DIR|g" "$TEMPLATE")"
|
|
128
|
+
|
|
129
|
+
# When there is no git repo, prepend an override block so Claude uses plain
|
|
130
|
+
# mv/rm instead of git mv/git rm throughout the migration.
|
|
131
|
+
if [ "$IS_GIT" = false ]; then
|
|
132
|
+
PROMPT="ENVIRONMENT NOTE (overrides every git-specific instruction below):
|
|
133
|
+
This project has NO git repository. Adapt all git commands:
|
|
134
|
+
- Use the Bash 'mv' command instead of 'git mv' for ALL file moves. The rule still applies: move first, edit second.
|
|
135
|
+
- Use the Bash 'rm -f' command instead of 'git rm' for ALL deletions.
|
|
136
|
+
- Skip 'git log' for dates — use today's date for both created: and updated: frontmatter fields.
|
|
137
|
+
- Skip 'git add -A' — there is no staging area.
|
|
138
|
+
- You are NOT on a wiki-migration branch. Work directly in the project directory.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
$PROMPT"
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
if [ -n "$EXTRA_CONTEXT" ]; then
|
|
146
|
+
PROMPT="$PROMPT
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
Additional context from the user:
|
|
151
|
+
$EXTRA_CONTEXT"
|
|
152
|
+
fi
|
|
153
|
+
|
|
154
|
+
TOTAL_FILES=0
|
|
155
|
+
for fam in "${LEGACY_FAMILIES[@]}"; do
|
|
156
|
+
dir="$PROJECT_DIR/.docs/$fam"
|
|
157
|
+
[ -d "$dir" ] || continue
|
|
158
|
+
count=$(find "$dir" -name '*.md' -type f | wc -l | tr -d ' ')
|
|
159
|
+
TOTAL_FILES=$((TOTAL_FILES + count))
|
|
160
|
+
done
|
|
161
|
+
|
|
162
|
+
echo "Migrating .docs/ content to wiki/ ($TOTAL_FILES files — Claude is running, this may take a few minutes)..."
|
|
163
|
+
echo ""
|
|
164
|
+
|
|
165
|
+
# Heartbeat to stderr — fallback for when Claude is silent between tool calls
|
|
166
|
+
(
|
|
167
|
+
START=$SECONDS
|
|
168
|
+
while true; do
|
|
169
|
+
sleep 15
|
|
170
|
+
ELAPSED=$((SECONDS - START))
|
|
171
|
+
printf " [%dm%02ds] still running...\n" $((ELAPSED / 60)) $((ELAPSED % 60)) >&2
|
|
172
|
+
done
|
|
173
|
+
) &
|
|
174
|
+
HEARTBEAT_PID=$!
|
|
175
|
+
|
|
176
|
+
# Scratch dir for the FIFO + display filter, under the project being migrated.
|
|
177
|
+
# Absolute path so it survives the `cd "$PROJECT_DIR"` below; created if absent.
|
|
178
|
+
TMP_DIR="$PROJECT_DIR/tmp"
|
|
179
|
+
mkdir -p "$TMP_DIR"
|
|
180
|
+
# Keep the scratch files out of the migration diff (Claude runs `git add -A`).
|
|
181
|
+
printf '*\n' > "$TMP_DIR/.gitignore"
|
|
182
|
+
|
|
183
|
+
# FIFO lets us pipe Claude's stream-json through a display filter while
|
|
184
|
+
# still capturing Claude's PID for the watchdog.
|
|
185
|
+
CLAUDE_FIFO=$(mktemp -u "$TMP_DIR/claude-migrate.XXXXXX")
|
|
186
|
+
mkfifo "$CLAUDE_FIFO"
|
|
187
|
+
|
|
188
|
+
# Write display filter to a temp file to avoid heredoc/redirect ambiguity.
|
|
189
|
+
# No `.py` suffix: macOS mktemp only randomizes trailing X's, so a suffix after
|
|
190
|
+
# them is treated literally and collides on the second run.
|
|
191
|
+
DISPLAY_SCRIPT=$(mktemp "$TMP_DIR/claude-display.XXXXXX")
|
|
192
|
+
cat > "$DISPLAY_SCRIPT" << 'PYEOF'
|
|
193
|
+
import sys, json
|
|
194
|
+
for line in sys.stdin:
|
|
195
|
+
line = line.strip()
|
|
196
|
+
if not line:
|
|
197
|
+
continue
|
|
198
|
+
try:
|
|
199
|
+
ev = json.loads(line)
|
|
200
|
+
if ev.get('type') == 'assistant':
|
|
201
|
+
for b in ev.get('message', {}).get('content', []):
|
|
202
|
+
if b.get('type') == 'text' and b.get('text'):
|
|
203
|
+
print(b['text'], end='', flush=True)
|
|
204
|
+
elif b.get('type') == 'tool_use':
|
|
205
|
+
name = b.get('name', '?')
|
|
206
|
+
inp = b.get('input', {})
|
|
207
|
+
detail = inp.get('command', inp.get('file_path', inp.get('path', '')))
|
|
208
|
+
label = name + (': ' + detail if detail else '')
|
|
209
|
+
print(' [' + label + ']', flush=True)
|
|
210
|
+
except Exception:
|
|
211
|
+
pass
|
|
212
|
+
PYEOF
|
|
213
|
+
|
|
214
|
+
# Start display filter — opens FIFO for reading (blocks until Claude connects)
|
|
215
|
+
python3 -u "$DISPLAY_SCRIPT" < "$CLAUDE_FIFO" &
|
|
216
|
+
DISPLAY_PID=$!
|
|
217
|
+
|
|
218
|
+
cd "$PROJECT_DIR"
|
|
219
|
+
|
|
220
|
+
CLAUDE_EXIT=0
|
|
221
|
+
CLAUDE_STDERR=$(mktemp "$TMP_DIR/claude-stderr.XXXXXX")
|
|
222
|
+
CLAUDE_MIGRATION=1 claude -p --verbose --dangerously-skip-permissions --strict-mcp-config \
|
|
223
|
+
--output-format stream-json < /dev/null "$PROMPT" > "$CLAUDE_FIFO" 2>"$CLAUDE_STDERR" &
|
|
224
|
+
CLAUDE_PID=$!
|
|
225
|
+
|
|
226
|
+
# Watchdog: kill Claude if it exceeds 30 minutes (hangs / idle loop)
|
|
227
|
+
TIMEOUT_SECS=1800
|
|
228
|
+
(sleep "$TIMEOUT_SECS"; echo "" >&2; echo " [timeout] Migration exceeded ${TIMEOUT_SECS}s — killing Claude." >&2; kill "$CLAUDE_PID" 2>/dev/null) &
|
|
229
|
+
WATCHDOG_PID=$!
|
|
230
|
+
|
|
231
|
+
trap 'kill "$HEARTBEAT_PID" "$WATCHDOG_PID" "$CLAUDE_PID" "$DISPLAY_PID" 2>/dev/null; wait "$HEARTBEAT_PID" "$WATCHDOG_PID" "$DISPLAY_PID" 2>/dev/null || true; rm -f "$CLAUDE_FIFO" "$DISPLAY_SCRIPT" "${CLAUDE_STDERR:-}"' EXIT
|
|
232
|
+
|
|
233
|
+
wait "$CLAUDE_PID" || CLAUDE_EXIT=$?
|
|
234
|
+
kill "$WATCHDOG_PID" 2>/dev/null; wait "$WATCHDOG_PID" 2>/dev/null
|
|
235
|
+
kill "$HEARTBEAT_PID" 2>/dev/null; wait "$HEARTBEAT_PID" 2>/dev/null
|
|
236
|
+
wait "$DISPLAY_PID" 2>/dev/null || true # let the filter flush remaining output
|
|
237
|
+
rm -f "$CLAUDE_FIFO" "$DISPLAY_SCRIPT"
|
|
238
|
+
|
|
239
|
+
if [ "$CLAUDE_EXIT" -ne 0 ]; then
|
|
240
|
+
# Filter known telemetry noise (Safe-chain, DataDog) — these cause non-zero
|
|
241
|
+
# exit codes but don't indicate migration failure.
|
|
242
|
+
REAL_ERRORS=""
|
|
243
|
+
if [ -f "$CLAUDE_STDERR" ]; then
|
|
244
|
+
REAL_ERRORS=$(grep -v "^Safe-chain:" "$CLAUDE_STDERR" 2>/dev/null || true)
|
|
245
|
+
fi
|
|
246
|
+
if [ -n "$REAL_ERRORS" ]; then
|
|
247
|
+
echo "Error: Claude exited with code $CLAUDE_EXIT" >&2
|
|
248
|
+
echo "--- Claude stderr ---" >&2
|
|
249
|
+
echo "$REAL_ERRORS" >&2
|
|
250
|
+
echo "--------------------" >&2
|
|
251
|
+
rm -f "$CLAUDE_STDERR"
|
|
252
|
+
exit "$CLAUDE_EXIT"
|
|
253
|
+
fi
|
|
254
|
+
# Only telemetry noise — migration succeeded despite non-zero exit code
|
|
255
|
+
fi
|
|
256
|
+
rm -f "$CLAUDE_STDERR"
|
|
257
|
+
|
|
258
|
+
echo ""
|
|
259
|
+
echo "============================="
|
|
260
|
+
echo " Migration run complete"
|
|
261
|
+
echo "============================="
|
|
262
|
+
echo ""
|
|
263
|
+
if [ "$IS_GIT" = true ]; then
|
|
264
|
+
echo "Next steps (changes are on branch 'wiki-migration', uncommitted):"
|
|
265
|
+
echo " 1. Review: git status && git diff"
|
|
266
|
+
echo " 2. Health-check: open Claude Code and run /wiki-lint"
|
|
267
|
+
echo " 3. Commit: git add -A && git commit -m 'Migrate .docs/ to wiki structure'"
|
|
268
|
+
echo " 4. Merge: switch back and merge wiki-migration when satisfied"
|
|
269
|
+
else
|
|
270
|
+
echo "Next steps:"
|
|
271
|
+
echo " 1. Review: check wiki/work/ to verify all files landed correctly"
|
|
272
|
+
echo " 2. Health-check: open Claude Code and run /wiki-lint"
|
|
273
|
+
fi
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Deployment / CI scaffolding seam — separate from the wiki/skills/MCP sync flow.
|
|
5
|
+
# Reads raw/guides/deployment-strategy.md as a prompt template and runs Claude
|
|
6
|
+
# to scaffold .github/ workflows + Makefile + .gitleaks.toml into a target project.
|
|
7
|
+
#
|
|
8
|
+
# Deliberately not called by setup-project.sh or update-project.sh: workflows get
|
|
9
|
+
# hand-customized per project (Dockerfile paths, runner labels, deploy steps) and
|
|
10
|
+
# must not be created or clobbered unless the user explicitly asks for deployment.
|
|
11
|
+
#
|
|
12
|
+
# Invokable standalone (`npx @codewizard-dt/bootstrap deploy`) so a project can
|
|
13
|
+
# opt into CI on demand. Claude applies copy-once semantics:
|
|
14
|
+
# - security.yml → always overwritten (generic, no project-specific content)
|
|
15
|
+
# - build.yml → created once, skipped if present
|
|
16
|
+
# - .gitleaks.toml → created once, skipped if present
|
|
17
|
+
# - Makefile → Docker targets added/merged if a Makefile already exists
|
|
18
|
+
|
|
19
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
20
|
+
. "$SCRIPT_DIR/lib.sh"
|
|
21
|
+
GUIDE="$SCRIPT_DIR/../../raw/guides/deployment-strategy.md"
|
|
22
|
+
TEMPLATE="$SCRIPT_DIR/../prompts/setup-deployment.md"
|
|
23
|
+
|
|
24
|
+
if [ ! -f "$GUIDE" ]; then
|
|
25
|
+
echo "Error: deployment guide not found at $GUIDE" >&2
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
if [ ! -f "$TEMPLATE" ]; then
|
|
30
|
+
echo "Error: prompt template not found at $TEMPLATE" >&2
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
DRY_RUN=false
|
|
35
|
+
POSITIONAL=()
|
|
36
|
+
for arg in "$@"; do
|
|
37
|
+
case "$arg" in
|
|
38
|
+
--dry-run) DRY_RUN=true ;;
|
|
39
|
+
*) POSITIONAL+=("$arg") ;;
|
|
40
|
+
esac
|
|
41
|
+
done
|
|
42
|
+
set -- "${POSITIONAL[@]}"
|
|
43
|
+
|
|
44
|
+
if [ $# -lt 1 ]; then
|
|
45
|
+
echo "Usage: $0 [--dry-run] <path-to-project> [additional context...]" >&2
|
|
46
|
+
exit 1
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
PROJECT_DIR="$(resolve_project_dir "$1")" || exit 1
|
|
50
|
+
shift
|
|
51
|
+
EXTRA_CONTEXT="${*}"
|
|
52
|
+
|
|
53
|
+
if [ "$DRY_RUN" = true ]; then
|
|
54
|
+
echo "Docker and Compose files in $PROJECT_DIR:"
|
|
55
|
+
echo ""
|
|
56
|
+
echo " Dockerfiles:"
|
|
57
|
+
find "$PROJECT_DIR" \( -name node_modules -o -name .git \) -prune -o \
|
|
58
|
+
-name "Dockerfile*" -print | sort | while read -r f; do
|
|
59
|
+
echo " ${f#"$PROJECT_DIR/"}"
|
|
60
|
+
done
|
|
61
|
+
echo ""
|
|
62
|
+
echo " Docker Compose files:"
|
|
63
|
+
find "$PROJECT_DIR" \( -name node_modules -o -name .git \) -prune -o \
|
|
64
|
+
\( -name "docker-compose*.yml" -o -name "docker-compose*.yaml" \
|
|
65
|
+
-o -name "compose*.yml" -o -name "compose*.yaml" \) -print | sort | while read -r f; do
|
|
66
|
+
echo " ${f#"$PROJECT_DIR/"}"
|
|
67
|
+
done
|
|
68
|
+
exit 0
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
TASK="$(sed "s|__PROJECT_DIR__|$PROJECT_DIR|g" "$TEMPLATE")"
|
|
72
|
+
|
|
73
|
+
PROMPT="$(cat "$GUIDE")
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
$TASK"
|
|
78
|
+
|
|
79
|
+
if [ -n "$EXTRA_CONTEXT" ]; then
|
|
80
|
+
PROMPT="$PROMPT
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
Additional context from the user:
|
|
85
|
+
$EXTRA_CONTEXT"
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
echo "Scaffolding CI/CD for: $PROJECT_DIR"
|
|
89
|
+
echo " Checking for existing services and Docker configuration..."
|
|
90
|
+
cd "$PROJECT_DIR"
|
|
91
|
+
|
|
92
|
+
# --strict-mcp-config: skip global MCPs (Playwright, Brave, etc.) — prevents MCP startup hangs.
|
|
93
|
+
# < /dev/null: close stdin so no interactive prompt can block.
|
|
94
|
+
# Watchdog: kill Claude if it exceeds 5 minutes (e.g. doctl --wait or runaway tool loop).
|
|
95
|
+
TIMEOUT_SECS=300
|
|
96
|
+
claude -p --dangerously-skip-permissions --strict-mcp-config < /dev/null "$PROMPT" &
|
|
97
|
+
DEPLOY_PID=$!
|
|
98
|
+
( sleep $TIMEOUT_SECS \
|
|
99
|
+
&& echo "" >&2 \
|
|
100
|
+
&& echo " [timeout] Deployment scaffolding exceeded ${TIMEOUT_SECS}s — run 'npx bootstrap deploy' to retry." >&2 \
|
|
101
|
+
&& kill "$DEPLOY_PID" 2>/dev/null ) &
|
|
102
|
+
WATCHDOG_PID=$!
|
|
103
|
+
wait "$DEPLOY_PID" || true
|
|
104
|
+
kill "$WATCHDOG_PID" 2>/dev/null; wait "$WATCHDOG_PID" 2>/dev/null || true
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
+
. "$SCRIPT_DIR/lib.sh"
|
|
6
|
+
|
|
7
|
+
# 0. Preflight checks
|
|
8
|
+
if ! command -v claude &> /dev/null; then
|
|
9
|
+
echo "Error: 'claude' (Claude Code) is not installed."
|
|
10
|
+
echo "Install it with: npm install -g @anthropic-ai/claude-code"
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
if ! command -v uv &> /dev/null; then
|
|
15
|
+
echo "Error: 'uv' is not installed."
|
|
16
|
+
echo "Install it with: curl -LsSf https://astral.sh/uv/install.sh | sh"
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
if [ $# -ne 1 ]; then
|
|
21
|
+
echo "Usage: $0 <path-to-project>"
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
PROJECT_DIR="$(resolve_project_dir "$1")" || exit 1
|
|
26
|
+
|
|
27
|
+
echo "Setting up project: $PROJECT_DIR"
|
|
28
|
+
echo ""
|
|
29
|
+
|
|
30
|
+
# Shared setup/update sequence: MCPs, skills+hooks, wiki scaffold, MCP guide, Serena.
|
|
31
|
+
run_project_sync "$PROJECT_DIR" "$SCRIPT_DIR"
|
|
32
|
+
|
|
33
|
+
# Done
|
|
34
|
+
echo "============================="
|
|
35
|
+
echo " Setup complete!"
|
|
36
|
+
echo "============================="
|
|
37
|
+
echo ""
|
|
38
|
+
echo "Next steps:"
|
|
39
|
+
echo " 1. cd $PROJECT_DIR"
|
|
40
|
+
echo " 2. Open Claude Code: claude"
|
|
41
|
+
echo " 3. Run /init to initialize the project"
|
|
42
|
+
echo " 4. Run /primer to set up Serena's memory structure"
|
|
43
|
+
echo " 5. Drop source documents into raw/ and run /wiki-ingest <file> to grow the wiki"
|
|
44
|
+
echo " 6. Optional: run 'npx @codewizard-dt/bootstrap deploy' when you explicitly want deployment scaffolding"
|
|
45
|
+
echo ""
|
|
46
|
+
echo "API keys (if you skipped any during setup):"
|
|
47
|
+
echo " brave-search BRAVE_API_KEY https://brave.com/search/api/"
|
|
48
|
+
echo " context7 CONTEXT7_API_KEY (optional) https://context7.com/dashboard"
|
|
49
|
+
echo ""
|
|
50
|
+
echo "To add a key later:"
|
|
51
|
+
echo " claude mcp remove brave-search -s user"
|
|
52
|
+
echo " claude mcp add --scope user brave-search --env BRAVE_API_KEY=<key> -- npx -y @modelcontextprotocol/server-brave-search"
|
|
53
|
+
echo ""
|
|
54
|
+
echo " claude mcp remove context7 -s user"
|
|
55
|
+
echo " claude mcp add --scope user --transport http --header \"CONTEXT7_API_KEY: <key>\" context7 https://mcp.context7.com/mcp"
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Generalized GitHub Actions self-hosted runner installer.
|
|
3
|
+
# Must be run as root on the target droplet.
|
|
4
|
+
#
|
|
5
|
+
# Usage:
|
|
6
|
+
# RUNNER_TOKEN=<token> REPO_URL=https://github.com/org/repo bash setup-runner.sh
|
|
7
|
+
#
|
|
8
|
+
# Required env vars:
|
|
9
|
+
# RUNNER_TOKEN Registration token from GitHub → repo → Settings → Actions → Runners
|
|
10
|
+
# REPO_URL Full HTTPS URL of the GitHub repo (e.g. https://github.com/acme/myapp)
|
|
11
|
+
#
|
|
12
|
+
# Optional env vars (all have defaults):
|
|
13
|
+
# RUNNER_VERSION GitHub Actions runner version (default: 2.331.0)
|
|
14
|
+
# RUNNER_DIR Install directory (default: /opt/actions-runner)
|
|
15
|
+
# RUNNER_USER System user to run the service (default: runner)
|
|
16
|
+
# RUNNER_NAME Display name registered on GitHub (default: <hostname>-droplet)
|
|
17
|
+
# RUNNER_LABEL Label attached to the runner (default: droplet)
|
|
18
|
+
# GITHUB_USER GitHub username for GHCR login (default: derived from REPO_URL)
|
|
19
|
+
#
|
|
20
|
+
# Get the registration token from:
|
|
21
|
+
# GitHub → repo → Settings → Actions → Runners → New self-hosted runner (Linux x64)
|
|
22
|
+
|
|
23
|
+
set -euo pipefail
|
|
24
|
+
|
|
25
|
+
: "${RUNNER_TOKEN:?RUNNER_TOKEN env var is required}"
|
|
26
|
+
: "${REPO_URL:?REPO_URL env var is required (e.g. https://github.com/acme/myapp)}"
|
|
27
|
+
|
|
28
|
+
RUNNER_VERSION="${RUNNER_VERSION:-2.331.0}"
|
|
29
|
+
RUNNER_DIR="${RUNNER_DIR:-/opt/actions-runner}"
|
|
30
|
+
RUNNER_USER="${RUNNER_USER:-runner}"
|
|
31
|
+
RUNNER_NAME="${RUNNER_NAME:-$(hostname)-droplet}"
|
|
32
|
+
RUNNER_LABEL="${RUNNER_LABEL:-droplet}"
|
|
33
|
+
# Derive GitHub username from the third path segment of https://github.com/owner/repo
|
|
34
|
+
GITHUB_USER="${GITHUB_USER:-$(echo "$REPO_URL" | sed 's|https://github.com/||' | cut -d/ -f1)}"
|
|
35
|
+
|
|
36
|
+
echo "==> Creating runner user '${RUNNER_USER}'"
|
|
37
|
+
id "${RUNNER_USER}" &>/dev/null || useradd -m -G docker "${RUNNER_USER}"
|
|
38
|
+
|
|
39
|
+
echo "==> Creating runner directory at ${RUNNER_DIR}"
|
|
40
|
+
mkdir -p "${RUNNER_DIR}"
|
|
41
|
+
|
|
42
|
+
# Skip download if the correct version is already extracted.
|
|
43
|
+
INSTALLED_VERSION=""
|
|
44
|
+
if [ -f "${RUNNER_DIR}/bin/Runner.Listener" ]; then
|
|
45
|
+
INSTALLED_VERSION=$("${RUNNER_DIR}/bin/Runner.Listener" --version 2>/dev/null | tr -d '[:space:]' || true)
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
if [ "${INSTALLED_VERSION}" = "${RUNNER_VERSION}" ]; then
|
|
49
|
+
echo "==> Runner v${RUNNER_VERSION} already installed — skipping download"
|
|
50
|
+
else
|
|
51
|
+
echo "==> Downloading GitHub Actions runner v${RUNNER_VERSION}"
|
|
52
|
+
curl -fsSL -o "${RUNNER_DIR}/runner.tar.gz" \
|
|
53
|
+
"https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz"
|
|
54
|
+
tar xzf "${RUNNER_DIR}/runner.tar.gz" -C "${RUNNER_DIR}"
|
|
55
|
+
rm "${RUNNER_DIR}/runner.tar.gz"
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
echo "==> Setting ownership of ${RUNNER_DIR}"
|
|
59
|
+
chown -R "${RUNNER_USER}:${RUNNER_USER}" "${RUNNER_DIR}"
|
|
60
|
+
|
|
61
|
+
echo "==> Stopping and uninstalling any existing runner service"
|
|
62
|
+
# Must happen while .runner still exists — svc.sh reads it to determine the service name.
|
|
63
|
+
if [ -f "${RUNNER_DIR}/.runner" ]; then
|
|
64
|
+
cd "${RUNNER_DIR}"
|
|
65
|
+
./svc.sh stop 2>/dev/null || true
|
|
66
|
+
./svc.sh uninstall 2>/dev/null || true
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
echo "==> Configuring runner as '${RUNNER_USER}'"
|
|
70
|
+
# Wipe local config so config.sh doesn't refuse to run on re-runs.
|
|
71
|
+
rm -f "${RUNNER_DIR}/.runner" "${RUNNER_DIR}/.credentials" "${RUNNER_DIR}/.credentials_rsaparams"
|
|
72
|
+
# sudo -u avoids the login-shell env reset of 'su -', so config.sh writes
|
|
73
|
+
# .runner/.credentials into RUNNER_DIR (where svc.sh expects to find them).
|
|
74
|
+
sudo -u "${RUNNER_USER}" bash -c "cd '${RUNNER_DIR}' && ./config.sh \
|
|
75
|
+
--url '${REPO_URL}' \
|
|
76
|
+
--token '${RUNNER_TOKEN}' \
|
|
77
|
+
--name '${RUNNER_NAME}' \
|
|
78
|
+
--labels '${RUNNER_LABEL}' \
|
|
79
|
+
--work '${RUNNER_DIR}/_work' \
|
|
80
|
+
--unattended \
|
|
81
|
+
--replace"
|
|
82
|
+
|
|
83
|
+
echo "==> Installing runner as a systemd service (runs as '${RUNNER_USER}')"
|
|
84
|
+
# svc.sh must run as root from RUNNER_DIR so it finds the .runner file config.sh wrote.
|
|
85
|
+
cd "${RUNNER_DIR}"
|
|
86
|
+
./svc.sh install "${RUNNER_USER}"
|
|
87
|
+
./svc.sh start
|
|
88
|
+
|
|
89
|
+
echo "==> Runner status"
|
|
90
|
+
systemctl status "actions.runner.*.service" --no-pager || true
|
|
91
|
+
|
|
92
|
+
echo ""
|
|
93
|
+
echo "Done. Runner '${RUNNER_NAME}' registered and running as '${RUNNER_USER}'."
|
|
94
|
+
echo "Verify at: ${REPO_URL}/settings/actions/runners"
|
|
95
|
+
echo ""
|
|
96
|
+
echo "Next: authenticate Docker with GHCR as the runner user:"
|
|
97
|
+
echo " su - ${RUNNER_USER} -c \"gh auth token | docker login ghcr.io -u ${GITHUB_USER} --password-stdin\""
|
|
98
|
+
echo " # or with a PAT:"
|
|
99
|
+
echo " su - ${RUNNER_USER} -c \"echo <PAT> | docker login ghcr.io -u ${GITHUB_USER} --password-stdin\""
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Usage:
|
|
5
|
+
# setup-strict-typechecks.sh # all languages
|
|
6
|
+
# setup-strict-typechecks.sh typescript python # space-separated
|
|
7
|
+
# setup-strict-typechecks.sh "typescript, python" # comma-separated
|
|
8
|
+
|
|
9
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
10
|
+
TEMPLATE="$SCRIPT_DIR/../prompts/setup-strict-typechecks.md"
|
|
11
|
+
|
|
12
|
+
if [ ! -f "$TEMPLATE" ]; then
|
|
13
|
+
echo "Error: prompt template not found at $TEMPLATE" >&2
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
PROMPT="$(cat "$TEMPLATE")"
|
|
18
|
+
|
|
19
|
+
if [ $# -gt 0 ]; then
|
|
20
|
+
# Normalize: join args, split on commas/spaces, rejoin as "lang1, lang2"
|
|
21
|
+
LANGS="$(printf '%s ' "$@" | tr ',' ' ' | tr -s ' ' | sed 's/^ //;s/ $//;s/ /, /g')"
|
|
22
|
+
PROMPT="${PROMPT}
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
**Language constraint**: Configure ONLY the following language(s): ${LANGS}. Skip all other languages entirely."
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
claude -p --dangerously-skip-permissions "$PROMPT"
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
export DEBIAN_FRONTEND=noninteractive
|
|
5
|
+
|
|
6
|
+
apt-get update -y
|
|
7
|
+
apt-get upgrade -y
|
|
8
|
+
|
|
9
|
+
# Zsh
|
|
10
|
+
apt-get install -y zsh curl make
|
|
11
|
+
|
|
12
|
+
# Docker
|
|
13
|
+
apt-get install -y ca-certificates gnupg lsb-release
|
|
14
|
+
install -m 0755 -d /etc/apt/keyrings
|
|
15
|
+
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
|
16
|
+
chmod a+r /etc/apt/keyrings/docker.gpg
|
|
17
|
+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
|
|
18
|
+
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
|
|
19
|
+
> /etc/apt/sources.list.d/docker.list
|
|
20
|
+
apt-get update -y
|
|
21
|
+
apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
|
22
|
+
systemctl enable --now docker
|
|
23
|
+
|
|
24
|
+
# Oh My Zsh — install for root (skip if already installed)
|
|
25
|
+
if [[ ! -d /root/.oh-my-zsh ]]; then
|
|
26
|
+
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
|
27
|
+
fi
|
|
28
|
+
chsh -s "$(which zsh)" root
|
|
29
|
+
|
|
30
|
+
# Add non-root user to docker group if one exists (skip root)
|
|
31
|
+
DEFAULT_USER=$(getent passwd 1000 | cut -d: -f1 || true)
|
|
32
|
+
if [[ -n "$DEFAULT_USER" ]]; then
|
|
33
|
+
usermod -aG docker "$DEFAULT_USER"
|
|
34
|
+
chsh -s "$(which zsh)" "$DEFAULT_USER"
|
|
35
|
+
# Oh My Zsh for the non-root user (skip if already installed)
|
|
36
|
+
USER_HOME=$(getent passwd "$DEFAULT_USER" | cut -d: -f6)
|
|
37
|
+
if [[ ! -d "$USER_HOME/.oh-my-zsh" ]]; then
|
|
38
|
+
su -c 'sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended' "$DEFAULT_USER"
|
|
39
|
+
fi
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
echo "Done — docker $(docker --version), gh $(gh --version | head -1), zsh $(zsh --version)"
|