@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,78 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
TEMPLATE_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
6
|
+
GLOBAL_SKILLS_DIR="$HOME/.claude/skills"
|
|
7
|
+
|
|
8
|
+
# Stale global skill folders from the wiki rename (adr -> decision, prd -> req)
|
|
9
|
+
ORPHAN_SKILLS=(
|
|
10
|
+
adr-create adr-finalize adr-next adr-walkthrough
|
|
11
|
+
prd-create prd-finalize prd-extract-decisions prd-update prd-trash prd-compile
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
SKIP_MCPS=false
|
|
15
|
+
for arg in "$@"; do
|
|
16
|
+
[ "$arg" = "--skip-mcps" ] && SKIP_MCPS=true
|
|
17
|
+
done
|
|
18
|
+
|
|
19
|
+
# 1. Ensure global MCP servers are installed (user scope, non-interactive)
|
|
20
|
+
# Pass --skip-mcps when MCPs were already handled interactively by the caller.
|
|
21
|
+
if [ "$SKIP_MCPS" = false ]; then
|
|
22
|
+
echo "Checking global MCP servers (user scope)..."
|
|
23
|
+
"$SCRIPT_DIR/install-mcps.sh"
|
|
24
|
+
echo ""
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# 2. Install hooks globally
|
|
28
|
+
GLOBAL_HOOKS_DIR="$HOME/.claude/hooks"
|
|
29
|
+
if [ -d "$TEMPLATE_DIR/lib/hooks" ]; then
|
|
30
|
+
echo "Installing hooks globally (~/.claude/hooks/)..."
|
|
31
|
+
mkdir -p "$GLOBAL_HOOKS_DIR"
|
|
32
|
+
rsync -av --exclude='.DS_Store' "$TEMPLATE_DIR/lib/hooks/" "$GLOBAL_HOOKS_DIR/"
|
|
33
|
+
echo ""
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# 3. Install skills globally
|
|
37
|
+
echo "Installing skills globally (~/.claude/skills/)..."
|
|
38
|
+
|
|
39
|
+
# Ensure the global skills directory exists
|
|
40
|
+
mkdir -p "$GLOBAL_SKILLS_DIR"
|
|
41
|
+
|
|
42
|
+
# Rsync skills from the template to ~/.claude/skills/
|
|
43
|
+
rsync -av --exclude='.DS_Store' "$TEMPLATE_DIR/lib/skills/" "$GLOBAL_SKILLS_DIR/"
|
|
44
|
+
|
|
45
|
+
# Detect stale skill folders from the wiki rename
|
|
46
|
+
ORPHAN_FOUND=()
|
|
47
|
+
for skill in "${ORPHAN_SKILLS[@]}"; do
|
|
48
|
+
if [ -d "$GLOBAL_SKILLS_DIR/$skill" ]; then
|
|
49
|
+
ORPHAN_FOUND+=("$GLOBAL_SKILLS_DIR/$skill")
|
|
50
|
+
fi
|
|
51
|
+
done
|
|
52
|
+
|
|
53
|
+
if [ ${#ORPHAN_FOUND[@]} -gt 0 ]; then
|
|
54
|
+
echo ""
|
|
55
|
+
echo "Stale skill folders detected from the wiki rename:"
|
|
56
|
+
for p in "${ORPHAN_FOUND[@]}"; do
|
|
57
|
+
echo " $p"
|
|
58
|
+
done
|
|
59
|
+
echo ""
|
|
60
|
+
if [ -t 0 ]; then
|
|
61
|
+
read -r -p "Delete these ${#ORPHAN_FOUND[@]} folder(s)? [y/N]: " REPLY
|
|
62
|
+
case "$REPLY" in
|
|
63
|
+
[yY])
|
|
64
|
+
for p in "${ORPHAN_FOUND[@]}"; do
|
|
65
|
+
rm -rf "$p"
|
|
66
|
+
done
|
|
67
|
+
echo "Removed."
|
|
68
|
+
;;
|
|
69
|
+
*)
|
|
70
|
+
echo "Skipped. To remove manually: rm -rf ~/.claude/skills/{adr-create,adr-finalize,adr-next,adr-walkthrough,prd-create,prd-finalize,prd-extract-decisions,prd-update,prd-trash,prd-compile}"
|
|
71
|
+
;;
|
|
72
|
+
esac
|
|
73
|
+
else
|
|
74
|
+
echo "Non-interactive mode: skipping deletion. Remove manually if needed."
|
|
75
|
+
fi
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
echo "Global setup complete (MCPs + skills)."
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# install-mcps.sh [--interactive] [--project-dir <dir>]
|
|
5
|
+
#
|
|
6
|
+
# Without --interactive: installs all missing MCPs at user scope without prompting
|
|
7
|
+
# (current install-global.sh behaviour — used by `bootstrap install`)
|
|
8
|
+
# With --interactive --project-dir <dir>: prompts for each missing MCP and asks scope
|
|
9
|
+
# (used by setup-project.sh and update-project.sh)
|
|
10
|
+
#
|
|
11
|
+
# Serena is only offered when --project-dir is provided (it requires an absolute project path).
|
|
12
|
+
|
|
13
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
14
|
+
. "$SCRIPT_DIR/lib.sh"
|
|
15
|
+
|
|
16
|
+
INTERACTIVE=false
|
|
17
|
+
PROJECT_DIR=""
|
|
18
|
+
|
|
19
|
+
while [[ $# -gt 0 ]]; do
|
|
20
|
+
case "$1" in
|
|
21
|
+
--interactive) INTERACTIVE=true; shift ;;
|
|
22
|
+
--project-dir) PROJECT_DIR="$2"; shift 2 ;;
|
|
23
|
+
*) shift ;;
|
|
24
|
+
esac
|
|
25
|
+
done
|
|
26
|
+
|
|
27
|
+
# mcp_installed, serena_installed, prompt_yn, prompt_scope live in lib.sh.
|
|
28
|
+
|
|
29
|
+
# mcp_add_scoped <scope> <claude-mcp-add-args...>
|
|
30
|
+
# Runs `claude mcp add --scope <scope> <args...>`. For project scope, cd into
|
|
31
|
+
# PROJECT_DIR first (project MCPs are written relative to cwd); if project scope
|
|
32
|
+
# is requested without a PROJECT_DIR, fall back to user scope.
|
|
33
|
+
mcp_add_scoped() {
|
|
34
|
+
local scope="$1"; shift
|
|
35
|
+
if [ "$scope" = "project" ] && [ -n "$PROJECT_DIR" ]; then
|
|
36
|
+
( cd "$PROJECT_DIR" && claude mcp add --scope project "$@" )
|
|
37
|
+
else
|
|
38
|
+
claude mcp add --scope user "$@"
|
|
39
|
+
fi
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# register_optional_mcp <name> <interactive-prompt> <adder-fn>
|
|
43
|
+
# Common wrapper for the optional MCPs (brave-search / context7 / playwright):
|
|
44
|
+
# skip if already installed; in interactive mode gate on a y/n prompt and ask
|
|
45
|
+
# for scope; otherwise install non-interactively at user scope. <adder-fn>
|
|
46
|
+
# performs the actual `claude mcp add` (including any API-key prompting) and
|
|
47
|
+
# receives the resolved scope ("user" | "project") as its only argument.
|
|
48
|
+
register_optional_mcp() {
|
|
49
|
+
local name="$1" prompt="$2" adder="$3" scope
|
|
50
|
+
if mcp_installed "$name"; then
|
|
51
|
+
echo " $name: already installed, skipping."
|
|
52
|
+
return 0
|
|
53
|
+
fi
|
|
54
|
+
if [ "$INTERACTIVE" = true ]; then
|
|
55
|
+
if prompt_yn "$prompt"; then
|
|
56
|
+
scope="$(prompt_scope "$name")"
|
|
57
|
+
"$adder" "$scope"
|
|
58
|
+
echo " $name MCP installed."
|
|
59
|
+
fi
|
|
60
|
+
else
|
|
61
|
+
echo " Installing $name MCP..."
|
|
62
|
+
"$adder" user
|
|
63
|
+
echo " $name MCP installed."
|
|
64
|
+
fi
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
# Per-MCP adders. Each takes the resolved scope as $1 and preserves the exact
|
|
68
|
+
# interactive vs non-interactive key-prompting behaviour of the original blocks.
|
|
69
|
+
_add_brave() {
|
|
70
|
+
if [ "$INTERACTIVE" = true ]; then
|
|
71
|
+
read -r -p " BRAVE_API_KEY (get one at https://brave.com/search/api/): " BRAVE_API_KEY
|
|
72
|
+
elif [ -z "${BRAVE_API_KEY:-}" ]; then
|
|
73
|
+
echo -n " Enter your Brave Search API key (get one at https://brave.com/search/api/): "
|
|
74
|
+
read -r BRAVE_API_KEY
|
|
75
|
+
fi
|
|
76
|
+
mcp_add_scoped "$1" brave-search \
|
|
77
|
+
--env "BRAVE_API_KEY=${BRAVE_API_KEY}" \
|
|
78
|
+
-- npx -y @modelcontextprotocol/server-brave-search
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_add_context7() {
|
|
82
|
+
if [ "$INTERACTIVE" = true ]; then
|
|
83
|
+
read -r -p " CONTEXT7_API_KEY (optional — press Enter to skip; get one at https://context7.com/dashboard): " CONTEXT7_API_KEY
|
|
84
|
+
elif [ -z "${CONTEXT7_API_KEY:-}" ]; then
|
|
85
|
+
echo -n " Enter your Context7 API key (optional — press Enter to skip, get one at https://context7.com/dashboard): "
|
|
86
|
+
read -r CONTEXT7_API_KEY
|
|
87
|
+
fi
|
|
88
|
+
if [ -n "${CONTEXT7_API_KEY:-}" ]; then
|
|
89
|
+
mcp_add_scoped "$1" --transport http \
|
|
90
|
+
--header "CONTEXT7_API_KEY: ${CONTEXT7_API_KEY}" \
|
|
91
|
+
context7 https://mcp.context7.com/mcp
|
|
92
|
+
else
|
|
93
|
+
mcp_add_scoped "$1" --transport http \
|
|
94
|
+
context7 https://mcp.context7.com/mcp
|
|
95
|
+
fi
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
_add_playwright() {
|
|
99
|
+
mcp_add_scoped "$1" playwright -- npx @playwright/mcp@latest
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
# ---------------------------------------------------------------------------
|
|
103
|
+
# Serena (always project scope — only when --project-dir provided)
|
|
104
|
+
# ---------------------------------------------------------------------------
|
|
105
|
+
if [ -n "$PROJECT_DIR" ]; then
|
|
106
|
+
if serena_installed "$PROJECT_DIR"; then
|
|
107
|
+
echo " serena: already registered for this project, skipping."
|
|
108
|
+
elif [ "$INTERACTIVE" = true ]; then
|
|
109
|
+
if prompt_yn "Install Serena MCP (code exploration & editing, always project scope)? [Y/n]: "; then
|
|
110
|
+
( cd "$PROJECT_DIR" && \
|
|
111
|
+
claude mcp add --scope project serena -- \
|
|
112
|
+
uvx --from git+https://github.com/oraios/serena \
|
|
113
|
+
serena start-mcp-server --context claude-code --project "$PROJECT_DIR" )
|
|
114
|
+
echo " serena MCP registered."
|
|
115
|
+
fi
|
|
116
|
+
fi
|
|
117
|
+
# Non-interactive with --project-dir: skip Serena — setup-project.sh previously
|
|
118
|
+
# handled it explicitly; callers that want silent Serena setup do so themselves.
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
# ---------------------------------------------------------------------------
|
|
122
|
+
# Optional MCPs (near-identical wrappers — see register_optional_mcp above)
|
|
123
|
+
# ---------------------------------------------------------------------------
|
|
124
|
+
register_optional_mcp brave-search \
|
|
125
|
+
"Install Brave Search MCP (web research, requires API key)? [y/N]: " _add_brave
|
|
126
|
+
|
|
127
|
+
register_optional_mcp context7 \
|
|
128
|
+
"Install Context7 MCP (library documentation lookups)? [y/N]: " _add_context7
|
|
129
|
+
|
|
130
|
+
register_optional_mcp playwright \
|
|
131
|
+
"Install Playwright MCP (browser automation & UI testing)? [y/N]: " _add_playwright
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# shellcheck shell=bash
|
|
2
|
+
# lib.sh — shared shell helpers for the bootstrap-claude setup scripts.
|
|
3
|
+
#
|
|
4
|
+
# Sourced, never executed. Source it with:
|
|
5
|
+
# SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"; . "$SCRIPT_DIR/lib.sh"
|
|
6
|
+
#
|
|
7
|
+
# HARD CONSTRAINT: must run on macOS default bash 3.2. No `local -n` namerefs,
|
|
8
|
+
# no associative arrays, no `${var,,}`. Functions return values by printing to
|
|
9
|
+
# stdout; diagnostics go to stderr.
|
|
10
|
+
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
12
|
+
# resolve_project_dir <path>
|
|
13
|
+
#
|
|
14
|
+
# Resolves <path> (e.g. "." or a relative path) to an absolute directory by
|
|
15
|
+
# cd-ing into it and printing pwd. On success prints the absolute path to
|
|
16
|
+
# stdout. On failure (unresolvable path or not a directory) prints an error to
|
|
17
|
+
# stderr and returns 1 — so callers can `PROJECT_DIR="$(resolve_project_dir "$1")" || exit 1`.
|
|
18
|
+
# ---------------------------------------------------------------------------
|
|
19
|
+
resolve_project_dir() {
|
|
20
|
+
local resolved
|
|
21
|
+
resolved="$(cd "$1" 2>/dev/null && pwd)" || {
|
|
22
|
+
echo "Error: Cannot resolve path: $1" >&2
|
|
23
|
+
return 1
|
|
24
|
+
}
|
|
25
|
+
if [ ! -d "$resolved" ]; then
|
|
26
|
+
echo "Error: Directory does not exist: $resolved" >&2
|
|
27
|
+
return 1
|
|
28
|
+
fi
|
|
29
|
+
printf '%s\n' "$resolved"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# ---------------------------------------------------------------------------
|
|
33
|
+
# mcp_installed <name>
|
|
34
|
+
#
|
|
35
|
+
# True when an MCP named <name> is registered at any scope visible to the
|
|
36
|
+
# current project.
|
|
37
|
+
# ---------------------------------------------------------------------------
|
|
38
|
+
mcp_installed() {
|
|
39
|
+
claude mcp get "$1" &>/dev/null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# ---------------------------------------------------------------------------
|
|
43
|
+
# serena_installed <project_dir>
|
|
44
|
+
#
|
|
45
|
+
# True when Serena is already registered for <project_dir> (its project-scoped
|
|
46
|
+
# .mcp.json names "serena").
|
|
47
|
+
# ---------------------------------------------------------------------------
|
|
48
|
+
serena_installed() {
|
|
49
|
+
[ -n "$1" ] && [ -f "$1/.mcp.json" ] && \
|
|
50
|
+
grep -q '"serena"' "$1/.mcp.json" 2>/dev/null
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# ---------------------------------------------------------------------------
|
|
54
|
+
# detect_installed_mcps <project_dir>
|
|
55
|
+
#
|
|
56
|
+
# Prints the space-separated names of the MCPs currently available to
|
|
57
|
+
# <project_dir>: "serena" (via its project .mcp.json) plus any of
|
|
58
|
+
# context7 / brave-search / playwright registered with `claude mcp`.
|
|
59
|
+
# Intended to be passed unquoted to build-mcp-guide.sh so it word-splits into
|
|
60
|
+
# separate arguments.
|
|
61
|
+
# ---------------------------------------------------------------------------
|
|
62
|
+
detect_installed_mcps() {
|
|
63
|
+
local project_dir result mcp
|
|
64
|
+
project_dir="$1"
|
|
65
|
+
result=""
|
|
66
|
+
if serena_installed "$project_dir"; then
|
|
67
|
+
result="serena"
|
|
68
|
+
fi
|
|
69
|
+
for mcp in context7 brave-search playwright; do
|
|
70
|
+
if mcp_installed "$mcp"; then
|
|
71
|
+
result="${result:+$result }$mcp"
|
|
72
|
+
fi
|
|
73
|
+
done
|
|
74
|
+
printf '%s\n' "$result"
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
# ---------------------------------------------------------------------------
|
|
78
|
+
# run_project_sync <project_dir> <script_dir>
|
|
79
|
+
#
|
|
80
|
+
# The shared setup/update sequence run identically by setup-project.sh and
|
|
81
|
+
# update-project.sh: install MCPs interactively, install skills+hooks globally,
|
|
82
|
+
# sync the wiki scaffold, merge the .gitignore, build the MCP-tools guide for
|
|
83
|
+
# the detected MCPs, then bootstrap Serena's project.yml. Prints the same
|
|
84
|
+
# section headers and blank-line separators the two scripts printed inline.
|
|
85
|
+
# ---------------------------------------------------------------------------
|
|
86
|
+
run_project_sync() {
|
|
87
|
+
local project_dir script_dir installed_mcps
|
|
88
|
+
project_dir="$1"
|
|
89
|
+
script_dir="$2"
|
|
90
|
+
|
|
91
|
+
echo "Checking MCP servers..."
|
|
92
|
+
"$script_dir/install-mcps.sh" --interactive --project-dir "$project_dir"
|
|
93
|
+
echo ""
|
|
94
|
+
|
|
95
|
+
echo "Installing skills and hooks globally..."
|
|
96
|
+
"$script_dir/install-global.sh" --skip-mcps
|
|
97
|
+
echo ""
|
|
98
|
+
|
|
99
|
+
echo "Syncing wiki scaffold..."
|
|
100
|
+
"$script_dir/sync-wiki-scaffold.sh" "$project_dir"
|
|
101
|
+
"$script_dir/merge-gitignore.sh" "$project_dir"
|
|
102
|
+
echo ""
|
|
103
|
+
|
|
104
|
+
echo "Building MCP tools guide..."
|
|
105
|
+
installed_mcps="$(detect_installed_mcps "$project_dir")"
|
|
106
|
+
# Unquoted on purpose: word-split the space-separated names into arguments.
|
|
107
|
+
"$script_dir/build-mcp-guide.sh" "$project_dir" $installed_mcps
|
|
108
|
+
echo ""
|
|
109
|
+
|
|
110
|
+
echo "Bootstrapping Serena project.yml..."
|
|
111
|
+
"$script_dir/bootstrap-serena.sh" "$project_dir"
|
|
112
|
+
echo ""
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
# ---------------------------------------------------------------------------
|
|
116
|
+
# prompt_yn <prompt>
|
|
117
|
+
#
|
|
118
|
+
# Reads a yes/no answer. In a non-interactive terminal answers "no" (prints a
|
|
119
|
+
# note and returns 1). Returns 0 for y/Y*, 1 otherwise.
|
|
120
|
+
# ---------------------------------------------------------------------------
|
|
121
|
+
prompt_yn() {
|
|
122
|
+
local prompt reply
|
|
123
|
+
prompt="$1"
|
|
124
|
+
if [ -t 0 ]; then
|
|
125
|
+
read -r -p "$prompt" reply
|
|
126
|
+
else
|
|
127
|
+
echo " Non-interactive terminal: skipping prompt, answering no."
|
|
128
|
+
reply="n"
|
|
129
|
+
fi
|
|
130
|
+
case "$reply" in
|
|
131
|
+
[yY]*) return 0 ;;
|
|
132
|
+
*) return 1 ;;
|
|
133
|
+
esac
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
# ---------------------------------------------------------------------------
|
|
137
|
+
# prompt_scope <name>
|
|
138
|
+
#
|
|
139
|
+
# Asks whether to register <name> at user (default) or project scope.
|
|
140
|
+
# Prints "user" or "project". Defaults to "user" in a non-interactive terminal.
|
|
141
|
+
# ---------------------------------------------------------------------------
|
|
142
|
+
prompt_scope() {
|
|
143
|
+
local name reply
|
|
144
|
+
name="$1"
|
|
145
|
+
if [ -t 0 ]; then
|
|
146
|
+
read -r -p " Scope for $name — [u]ser (default) or [p]roject? " reply
|
|
147
|
+
else
|
|
148
|
+
reply="u"
|
|
149
|
+
fi
|
|
150
|
+
case "$reply" in
|
|
151
|
+
[pP]*) echo "project" ;;
|
|
152
|
+
*) echo "user" ;;
|
|
153
|
+
esac
|
|
154
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
# Packed copy of the repo .gitignore (dotfiles are never included in npm packages)
|
|
7
|
+
TEMPLATE_GITIGNORE="$SCRIPT_DIR/templates/gitignore"
|
|
8
|
+
|
|
9
|
+
if [ $# -ne 1 ]; then
|
|
10
|
+
echo "Usage: $0 <path-to-project>" >&2
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
PROJECT_DIR="$(resolve_project_dir "$1")" || exit 1
|
|
15
|
+
|
|
16
|
+
TARGET="$PROJECT_DIR/.gitignore"
|
|
17
|
+
|
|
18
|
+
# No target → copy wholesale
|
|
19
|
+
if [ ! -f "$TARGET" ]; then
|
|
20
|
+
cp "$TEMPLATE_GITIGNORE" "$TARGET"
|
|
21
|
+
echo ".gitignore: copied to $PROJECT_DIR"
|
|
22
|
+
exit 0
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
# Snapshot existing lines for exact-match lookups during the merge loop
|
|
26
|
+
EXISTING=$(mktemp)
|
|
27
|
+
cp "$TARGET" "$EXISTING"
|
|
28
|
+
trap 'rm -f "$EXISTING"' EXIT
|
|
29
|
+
|
|
30
|
+
added=0
|
|
31
|
+
pending="" # comment/blank lines buffered until we know the next content line is new
|
|
32
|
+
|
|
33
|
+
while IFS= read -r line || [ -n "$line" ]; do
|
|
34
|
+
trimmed="${line#"${line%%[![:space:]]*}"}" # leading-whitespace stripped
|
|
35
|
+
|
|
36
|
+
if [ -z "$trimmed" ] || [[ "$trimmed" == \#* ]]; then
|
|
37
|
+
# Blank or comment line — hold in buffer; only flush if a new content line follows
|
|
38
|
+
pending+="${line}"$'\n'
|
|
39
|
+
else
|
|
40
|
+
# Content line
|
|
41
|
+
if grep -qFx -- "$line" "$EXISTING"; then
|
|
42
|
+
# Already present — discard buffered headers (their section is already represented)
|
|
43
|
+
pending=""
|
|
44
|
+
else
|
|
45
|
+
# New line — pre-flight the file on first append, then flush buffer + add line
|
|
46
|
+
if [ "$added" -eq 0 ] && [ -s "$TARGET" ]; then
|
|
47
|
+
# Ensure target ends with a newline before we start appending
|
|
48
|
+
[[ $(tail -c1 "$TARGET") ]] && printf '\n' >> "$TARGET"
|
|
49
|
+
fi
|
|
50
|
+
if [ -n "$pending" ]; then
|
|
51
|
+
printf '%s' "$pending" >> "$TARGET"
|
|
52
|
+
pending=""
|
|
53
|
+
fi
|
|
54
|
+
printf '%s\n' "$line" >> "$TARGET"
|
|
55
|
+
echo " + $line"
|
|
56
|
+
added=$((added + 1))
|
|
57
|
+
fi
|
|
58
|
+
fi
|
|
59
|
+
done < "$TEMPLATE_GITIGNORE"
|
|
60
|
+
|
|
61
|
+
if [ "$added" -eq 0 ]; then
|
|
62
|
+
echo ".gitignore: already up to date in $PROJECT_DIR"
|
|
63
|
+
else
|
|
64
|
+
echo ".gitignore: $added line(s) merged into $PROJECT_DIR"
|
|
65
|
+
fi
|