@lvlup-sw/exarchos 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/.claude-plugin/marketplace.json +22 -0
  2. package/.claude-plugin/plugin.json +17 -0
  3. package/.mcp.json +17 -0
  4. package/AGENTS.md +59 -0
  5. package/CLAUDE.md.template +62 -0
  6. package/LICENSE +202 -0
  7. package/README.md +258 -0
  8. package/commands/autocompact.md +37 -0
  9. package/commands/checkpoint.md +85 -0
  10. package/commands/cleanup.md +99 -0
  11. package/commands/debug.md +145 -0
  12. package/commands/delegate.md +56 -0
  13. package/commands/ideate.md +82 -0
  14. package/commands/plan.md +150 -0
  15. package/commands/refactor.md +139 -0
  16. package/commands/reload.md +37 -0
  17. package/commands/resume.md +130 -0
  18. package/commands/review.md +51 -0
  19. package/commands/sync-schemas.md +74 -0
  20. package/commands/synthesize.md +122 -0
  21. package/commands/tdd.md +58 -0
  22. package/dist/exarchos-cli.js +8828 -0
  23. package/dist/exarchos-mcp.js +50 -0
  24. package/hooks/hooks.json +53 -0
  25. package/package.json +59 -0
  26. package/rules/coding-standards.md +46 -0
  27. package/rules/mcp-tool-guidance.md +26 -0
  28. package/rules/pr-descriptions.md +12 -0
  29. package/rules/rm-safety.md +9 -0
  30. package/rules/skill-path-resolution.md +10 -0
  31. package/rules/tdd.md +41 -0
  32. package/rules/telemetry-awareness.md +9 -0
  33. package/scripts/assess-refactor-scope.sh +239 -0
  34. package/scripts/check-benchmark-regression.sh +229 -0
  35. package/scripts/check-coderabbit.sh +288 -0
  36. package/scripts/check-coverage-thresholds.sh +194 -0
  37. package/scripts/check-polish-scope.sh +245 -0
  38. package/scripts/check-property-tests.sh +167 -0
  39. package/scripts/check-tdd-compliance.sh +265 -0
  40. package/scripts/coderabbit-review-gate.sh +518 -0
  41. package/scripts/debug-review-gate.sh +201 -0
  42. package/scripts/extract-fix-tasks.sh +179 -0
  43. package/scripts/extract-task.sh +67 -0
  44. package/scripts/generate-traceability.sh +209 -0
  45. package/scripts/investigation-timer.sh +171 -0
  46. package/scripts/needs-schema-sync.sh +174 -0
  47. package/scripts/new-project.sh +103 -0
  48. package/scripts/post-delegation-check.sh +317 -0
  49. package/scripts/pre-synthesis-check.sh +440 -0
  50. package/scripts/reconcile-state.sh +346 -0
  51. package/scripts/reconstruct-stack.sh +432 -0
  52. package/scripts/review-diff.sh +63 -0
  53. package/scripts/review-verdict.sh +169 -0
  54. package/scripts/security-scan.sh +248 -0
  55. package/scripts/select-debug-track.sh +186 -0
  56. package/scripts/setup-worktree.sh +323 -0
  57. package/scripts/spec-coverage-check.sh +230 -0
  58. package/scripts/static-analysis-gate.sh +236 -0
  59. package/scripts/sync-labels.sh +122 -0
  60. package/scripts/validate-companion.sh +161 -0
  61. package/scripts/validate-dotnet-standards.sh +267 -0
  62. package/scripts/validate-installation.sh +101 -0
  63. package/scripts/validate-plugin.sh +223 -0
  64. package/scripts/validate-refactor.sh +234 -0
  65. package/scripts/validate-rm.sh +93 -0
  66. package/scripts/verify-delegation-saga.sh +240 -0
  67. package/scripts/verify-doc-links.sh +211 -0
  68. package/scripts/verify-ideate-artifacts.sh +296 -0
  69. package/scripts/verify-plan-coverage.sh +228 -0
  70. package/scripts/verify-review-triage.sh +219 -0
  71. package/scripts/verify-worktree-baseline.sh +159 -0
  72. package/scripts/verify-worktree.sh +84 -0
  73. package/settings.json +47 -0
  74. package/skills/brainstorming/SKILL.md +127 -0
  75. package/skills/brainstorming/references/design-template.md +65 -0
  76. package/skills/cleanup/SKILL.md +147 -0
  77. package/skills/cleanup/references/merge-verification.md +40 -0
  78. package/skills/debug/SKILL.md +204 -0
  79. package/skills/debug/references/hotfix-track.md +134 -0
  80. package/skills/debug/references/investigation-checklist.md +217 -0
  81. package/skills/debug/references/rca-template.md +150 -0
  82. package/skills/debug/references/state-schema.md +294 -0
  83. package/skills/debug/references/thorough-track.md +194 -0
  84. package/skills/debug/references/triage-questions.md +155 -0
  85. package/skills/debug/references/troubleshooting.md +47 -0
  86. package/skills/delegation/SKILL.md +150 -0
  87. package/skills/delegation/references/adaptive-orchestration.md +31 -0
  88. package/skills/delegation/references/agent-teams-saga.md +248 -0
  89. package/skills/delegation/references/fix-mode.md +74 -0
  90. package/skills/delegation/references/fixer-prompt.md +162 -0
  91. package/skills/delegation/references/implementer-prompt.md +322 -0
  92. package/skills/delegation/references/parallel-strategy.md +124 -0
  93. package/skills/delegation/references/pbt-patterns.md +172 -0
  94. package/skills/delegation/references/pr-fixes-mode.md +154 -0
  95. package/skills/delegation/references/state-management.md +51 -0
  96. package/skills/delegation/references/testing-patterns.md +129 -0
  97. package/skills/delegation/references/troubleshooting.md +33 -0
  98. package/skills/delegation/references/workflow-steps.md +127 -0
  99. package/skills/delegation/references/worktree-enforcement.md +64 -0
  100. package/skills/dotnet-standards/SKILL.md +269 -0
  101. package/skills/dotnet-standards/references/csharp-standards.md +120 -0
  102. package/skills/dotnet-standards/templates/.editorconfig +366 -0
  103. package/skills/dotnet-standards/templates/Directory.Build.props +56 -0
  104. package/skills/dotnet-standards/templates/Directory.Packages.props +69 -0
  105. package/skills/dotnet-standards/templates/global.json +6 -0
  106. package/skills/dotnet-standards/templates/nuget.config +9 -0
  107. package/skills/dotnet-standards/templates/stylecop.json +37 -0
  108. package/skills/git-worktrees/SKILL.md +255 -0
  109. package/skills/implementation-planning/SKILL.md +233 -0
  110. package/skills/implementation-planning/references/plan-document-template.md +42 -0
  111. package/skills/implementation-planning/references/spec-tracing-guide.md +51 -0
  112. package/skills/implementation-planning/references/task-template.md +43 -0
  113. package/skills/implementation-planning/references/testing-strategy-guide.md +88 -0
  114. package/skills/quality-review/SKILL.md +278 -0
  115. package/skills/quality-review/references/code-quality-checklist.md +159 -0
  116. package/skills/quality-review/references/review-report-template.md +65 -0
  117. package/skills/quality-review/references/security-checklist.md +79 -0
  118. package/skills/quality-review/references/typescript-standards.md +24 -0
  119. package/skills/refactor/COMMAND.md +67 -0
  120. package/skills/refactor/SKILL.md +198 -0
  121. package/skills/refactor/phases/auto-chain.md +262 -0
  122. package/skills/refactor/phases/brief.md +176 -0
  123. package/skills/refactor/phases/explore.md +132 -0
  124. package/skills/refactor/phases/overhaul-delegate.md +136 -0
  125. package/skills/refactor/phases/overhaul-plan.md +312 -0
  126. package/skills/refactor/phases/overhaul-review.md +304 -0
  127. package/skills/refactor/phases/polish-implement.md +349 -0
  128. package/skills/refactor/phases/polish-validate.md +218 -0
  129. package/skills/refactor/phases/update-docs.md +234 -0
  130. package/skills/refactor/references/brief-template.md +81 -0
  131. package/skills/refactor/references/doc-update-checklist.md +110 -0
  132. package/skills/refactor/references/explore-checklist.md +73 -0
  133. package/skills/refactor/references/overhaul-track.md +215 -0
  134. package/skills/refactor/references/polish-track.md +170 -0
  135. package/skills/shared/prompts/context-reading.md +58 -0
  136. package/skills/shared/prompts/report-format.md +54 -0
  137. package/skills/shared/prompts/tdd-requirements.md +39 -0
  138. package/skills/shepherd/SKILL.md +264 -0
  139. package/skills/shepherd/references/assess-checklist.md +124 -0
  140. package/skills/shepherd/references/fix-strategies.md +191 -0
  141. package/skills/spec-review/SKILL.md +229 -0
  142. package/skills/spec-review/references/review-checklist.md +60 -0
  143. package/skills/sync-schemas/SKILL.md +114 -0
  144. package/skills/sync-schemas/references/configuration.md +73 -0
  145. package/skills/synthesis/SKILL.md +129 -0
  146. package/skills/synthesis/references/pr-descriptions.md +87 -0
  147. package/skills/synthesis/references/synthesis-steps.md +109 -0
  148. package/skills/synthesis/references/troubleshooting.md +115 -0
  149. package/skills/validate-all-skills.sh +57 -0
  150. package/skills/validate-frontmatter.sh +237 -0
  151. package/skills/workflow-state/SKILL.md +210 -0
  152. package/skills/workflow-state/references/mcp-tool-reference.md +111 -0
  153. package/skills/workflow-state/references/phase-transitions.md +141 -0
@@ -0,0 +1,171 @@
1
+ #!/usr/bin/env bash
2
+ # Investigation Timer
3
+ # Enforces the 15-minute investigation time-box for hotfix track.
4
+ # Replaces prose "15-Minute Investigation Checkpoint" with deterministic validation.
5
+ #
6
+ # Usage: investigation-timer.sh --started-at <ISO8601> [--budget-minutes 15]
7
+ # investigation-timer.sh --state-file <path> [--budget-minutes 15]
8
+ #
9
+ # Exit codes:
10
+ # 0 = within budget
11
+ # 1 = budget exceeded
12
+ # 2 = usage error (missing required args, invalid input)
13
+
14
+ set -euo pipefail
15
+
16
+ # ============================================================
17
+ # ARGUMENT PARSING
18
+ # ============================================================
19
+
20
+ STARTED_AT=""
21
+ STATE_FILE=""
22
+ BUDGET_MINUTES=15
23
+
24
+ usage() {
25
+ cat << 'USAGE'
26
+ Usage: investigation-timer.sh --started-at <ISO8601> [--budget-minutes 15]
27
+ investigation-timer.sh --state-file <path> [--budget-minutes 15]
28
+
29
+ Required (one of):
30
+ --started-at <ISO8601> Investigation start timestamp
31
+ --state-file <path> Path to workflow state JSON (reads investigation.startedAt)
32
+
33
+ Optional:
34
+ --budget-minutes <N> Investigation budget in minutes (default: 15)
35
+ --help Show this help message
36
+
37
+ Exit codes:
38
+ 0 Within budget
39
+ 1 Budget exceeded — recommend escalating to thorough track
40
+ 2 Usage error (missing args, invalid timestamp)
41
+ USAGE
42
+ }
43
+
44
+ while [[ $# -gt 0 ]]; do
45
+ case "$1" in
46
+ --started-at)
47
+ if [[ -z "${2:-}" ]]; then
48
+ echo "Error: --started-at requires an ISO8601 timestamp argument" >&2
49
+ exit 2
50
+ fi
51
+ STARTED_AT="$2"
52
+ shift 2
53
+ ;;
54
+ --state-file)
55
+ if [[ -z "${2:-}" ]]; then
56
+ echo "Error: --state-file requires a path argument" >&2
57
+ exit 2
58
+ fi
59
+ STATE_FILE="$2"
60
+ shift 2
61
+ ;;
62
+ --budget-minutes)
63
+ if [[ -z "${2:-}" ]]; then
64
+ echo "Error: --budget-minutes requires a number argument" >&2
65
+ exit 2
66
+ fi
67
+ BUDGET_MINUTES="$2"
68
+ shift 2
69
+ ;;
70
+ --help)
71
+ usage
72
+ exit 0
73
+ ;;
74
+ *)
75
+ echo "Error: Unknown argument '$1'" >&2
76
+ usage >&2
77
+ exit 2
78
+ ;;
79
+ esac
80
+ done
81
+
82
+ # ============================================================
83
+ # RESOLVE STARTED_AT
84
+ # ============================================================
85
+
86
+ if [[ -z "$STARTED_AT" && -z "$STATE_FILE" ]]; then
87
+ echo "Error: Either --started-at or --state-file is required" >&2
88
+ usage >&2
89
+ exit 2
90
+ fi
91
+
92
+ if [[ -n "$STATE_FILE" && -z "$STARTED_AT" ]]; then
93
+ if [[ ! -f "$STATE_FILE" ]]; then
94
+ echo "Error: State file not found: $STATE_FILE" >&2
95
+ exit 2
96
+ fi
97
+
98
+ if ! command -v jq &>/dev/null; then
99
+ echo "Error: jq is required but not installed" >&2
100
+ exit 2
101
+ fi
102
+
103
+ STARTED_AT="$(jq -r '.investigation.startedAt // empty' "$STATE_FILE")"
104
+ if [[ -z "$STARTED_AT" ]]; then
105
+ echo "Error: No investigation.startedAt found in state file" >&2
106
+ exit 2
107
+ fi
108
+ fi
109
+
110
+ # ============================================================
111
+ # VALIDATE TIMESTAMP
112
+ # ============================================================
113
+
114
+ # Try to parse the timestamp to epoch seconds
115
+ # macOS date: date -j -f format
116
+ # GNU date: date -d string
117
+ START_EPOCH=""
118
+
119
+ # Try GNU date first (Linux), then macOS date (with TZ=UTC to handle Z suffix correctly)
120
+ if START_EPOCH="$(date -d "$STARTED_AT" +%s 2>/dev/null)"; then
121
+ : # success
122
+ elif START_EPOCH="$(TZ=UTC date -j -f "%Y-%m-%dT%H:%M:%SZ" "$STARTED_AT" +%s 2>/dev/null)"; then
123
+ : # success
124
+ elif START_EPOCH="$(TZ=UTC date -j -f "%Y-%m-%dT%H:%M:%S%z" "$STARTED_AT" +%s 2>/dev/null)"; then
125
+ : # success
126
+ else
127
+ echo "Error: Invalid timestamp: $STARTED_AT (expected ISO8601 format)" >&2
128
+ exit 2
129
+ fi
130
+
131
+ # ============================================================
132
+ # CALCULATE ELAPSED TIME
133
+ # ============================================================
134
+
135
+ NOW_EPOCH="$(date +%s)"
136
+ ELAPSED_SECONDS=$(( NOW_EPOCH - START_EPOCH ))
137
+ BUDGET_SECONDS=$(( BUDGET_MINUTES * 60 ))
138
+
139
+ # Format elapsed time as Xm Ys
140
+ ELAPSED_MINUTES=$(( ELAPSED_SECONDS / 60 ))
141
+ ELAPSED_REMAINDER=$(( ELAPSED_SECONDS % 60 ))
142
+
143
+ # ============================================================
144
+ # DETERMINE STATUS
145
+ # ============================================================
146
+
147
+ if [[ $ELAPSED_SECONDS -le $BUDGET_SECONDS ]]; then
148
+ REMAINING_SECONDS=$(( BUDGET_SECONDS - ELAPSED_SECONDS ))
149
+ REMAINING_MINUTES=$(( REMAINING_SECONDS / 60 ))
150
+ REMAINING_REMAINDER=$(( REMAINING_SECONDS % 60 ))
151
+ STATUS="WITHIN BUDGET (${REMAINING_MINUTES}m ${REMAINING_REMAINDER}s remaining)"
152
+ EXIT_CODE=0
153
+ else
154
+ OVER_SECONDS=$(( ELAPSED_SECONDS - BUDGET_SECONDS ))
155
+ OVER_MINUTES=$(( OVER_SECONDS / 60 ))
156
+ OVER_REMAINDER=$(( OVER_SECONDS % 60 ))
157
+ STATUS="BUDGET EXCEEDED by ${OVER_MINUTES}m ${OVER_REMAINDER}s — Recommend escalating to thorough track"
158
+ EXIT_CODE=1
159
+ fi
160
+
161
+ # ============================================================
162
+ # STRUCTURED OUTPUT
163
+ # ============================================================
164
+
165
+ echo "## Investigation Timer"
166
+ echo "- **Started:** $STARTED_AT"
167
+ echo "- **Elapsed:** ${ELAPSED_MINUTES}m ${ELAPSED_REMAINDER}s"
168
+ echo "- **Budget:** ${BUDGET_MINUTES}m"
169
+ echo "- **Status:** $STATUS"
170
+
171
+ exit $EXIT_CODE
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env bash
2
+ # needs-schema-sync.sh — Detect API file modifications requiring schema sync
3
+ # Replaces "Schema Sync Auto-Detection" prose in delegation SKILL.md.
4
+ #
5
+ # Usage: needs-schema-sync.sh --repo-root <path> [--base-branch main] [--diff-file <path>]
6
+ #
7
+ # Exit codes:
8
+ # 0 = no sync needed
9
+ # 1 = sync needed (API files modified)
10
+ # 2 = usage error (missing required args)
11
+
12
+ set -euo pipefail
13
+
14
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15
+
16
+ # Colors
17
+ RED='\033[0;31m'
18
+ GREEN='\033[0;32m'
19
+ YELLOW='\033[1;33m'
20
+ NC='\033[0m'
21
+
22
+ # ============================================================
23
+ # ARGUMENT PARSING
24
+ # ============================================================
25
+
26
+ REPO_ROOT=""
27
+ BASE_BRANCH="main"
28
+ DIFF_FILE=""
29
+
30
+ usage() {
31
+ cat << 'USAGE'
32
+ Usage: needs-schema-sync.sh --repo-root <path> [--base-branch main] [--diff-file <path>]
33
+
34
+ Required:
35
+ --repo-root <path> Repository root directory
36
+
37
+ Optional:
38
+ --base-branch <name> Base branch/commit to diff against (default: main)
39
+ --diff-file <path> Use pre-computed diff file instead of git diff
40
+ --help Show this help message
41
+
42
+ Detects modifications to API files matching these patterns:
43
+ *Endpoints.cs, Models/*.cs, Requests/*.cs, Responses/*.cs, Dtos/*.cs
44
+
45
+ Exit codes:
46
+ 0 No sync needed (no API files modified)
47
+ 1 Sync needed (API files modified — lists them)
48
+ 2 Usage error (missing required args)
49
+ USAGE
50
+ }
51
+
52
+ while [[ $# -gt 0 ]]; do
53
+ case "$1" in
54
+ --repo-root)
55
+ if [[ -z "${2:-}" ]]; then
56
+ echo "Error: --repo-root requires a path argument" >&2
57
+ exit 2
58
+ fi
59
+ REPO_ROOT="$2"
60
+ shift 2
61
+ ;;
62
+ --base-branch)
63
+ if [[ -z "${2:-}" ]]; then
64
+ echo "Error: --base-branch requires an argument" >&2
65
+ exit 2
66
+ fi
67
+ BASE_BRANCH="$2"
68
+ shift 2
69
+ ;;
70
+ --diff-file)
71
+ if [[ -z "${2:-}" ]]; then
72
+ echo "Error: --diff-file requires a path argument" >&2
73
+ exit 2
74
+ fi
75
+ DIFF_FILE="$2"
76
+ shift 2
77
+ ;;
78
+ --help)
79
+ usage
80
+ exit 0
81
+ ;;
82
+ *)
83
+ echo "Error: Unknown argument '$1'" >&2
84
+ usage >&2
85
+ exit 2
86
+ ;;
87
+ esac
88
+ done
89
+
90
+ if [[ -z "$REPO_ROOT" ]]; then
91
+ echo "Error: --repo-root is required" >&2
92
+ usage >&2
93
+ exit 2
94
+ fi
95
+
96
+ # ============================================================
97
+ # API FILE PATTERNS
98
+ # ============================================================
99
+
100
+ # Patterns that trigger schema sync
101
+ # These match: *Endpoints.cs, Models/*.cs, Requests/*.cs, Responses/*.cs, Dtos/*.cs
102
+ API_PATTERNS=(
103
+ 'Endpoints\.cs$'
104
+ 'Models/[^/]*\.cs$'
105
+ 'Requests/[^/]*\.cs$'
106
+ 'Responses/[^/]*\.cs$'
107
+ 'Dtos/[^/]*\.cs$'
108
+ )
109
+
110
+ # ============================================================
111
+ # GET CHANGED FILES
112
+ # ============================================================
113
+
114
+ CHANGED_FILES=""
115
+
116
+ if [[ -n "$DIFF_FILE" ]]; then
117
+ # Extract file paths from diff file
118
+ if [[ ! -f "$DIFF_FILE" ]]; then
119
+ echo "Error: Diff file not found: $DIFF_FILE" >&2
120
+ exit 2
121
+ fi
122
+ # Parse diff headers to get file names (lines starting with +++ b/)
123
+ CHANGED_FILES="$(
124
+ grep -E '^\+\+\+ b/|^--- a/' "$DIFF_FILE" \
125
+ | sed -E 's|^\+\+\+ b/||; s|^--- a/||' \
126
+ | grep -v '^/dev/null$' \
127
+ | sort -u || true
128
+ )"
129
+ else
130
+ # Use git diff to get changed files
131
+ if ! CHANGED_FILES="$(git -C "$REPO_ROOT" diff --name-only "$BASE_BRANCH"...HEAD 2>/dev/null || \
132
+ git -C "$REPO_ROOT" diff --name-only "$BASE_BRANCH" HEAD 2>/dev/null || \
133
+ git -C "$REPO_ROOT" diff --name-only "$BASE_BRANCH" 2>/dev/null)"; then
134
+ echo "Error: git diff failed for base '$BASE_BRANCH'" >&2
135
+ exit 1
136
+ fi
137
+ fi
138
+
139
+ # ============================================================
140
+ # MATCH API FILES
141
+ # ============================================================
142
+
143
+ API_FILES=()
144
+
145
+ while IFS= read -r file; do
146
+ [[ -z "$file" ]] && continue
147
+
148
+ for pattern in "${API_PATTERNS[@]}"; do
149
+ if echo "$file" | grep -qE "$pattern"; then
150
+ API_FILES+=("$file")
151
+ break
152
+ fi
153
+ done
154
+ done <<< "$CHANGED_FILES"
155
+
156
+ # ============================================================
157
+ # OUTPUT
158
+ # ============================================================
159
+
160
+ if [[ ${#API_FILES[@]} -eq 0 ]]; then
161
+ echo "## Schema Sync Check"
162
+ echo ""
163
+ echo "**Result: No sync needed** — No API files modified"
164
+ exit 0
165
+ else
166
+ echo "## Schema Sync Check"
167
+ echo ""
168
+ echo "**Result: Sync needed** — ${#API_FILES[@]} API file(s) modified:"
169
+ echo ""
170
+ for f in "${API_FILES[@]}"; do
171
+ echo "- \`$f\`"
172
+ done
173
+ exit 1
174
+ fi
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # new-project.sh - Initialize a new project with Claude Code configuration
4
+ #
5
+ # Usage: new-project.sh [project-path] [options]
6
+ #
7
+ # Options:
8
+ # --typescript Set up for TypeScript project
9
+ # --csharp Set up for C# project
10
+ # --minimal Only create CLAUDE.md, no local overrides
11
+ #
12
+
13
+ set -euo pipefail
14
+
15
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
+ REPO_ROOT="$(dirname "$SCRIPT_DIR")"
17
+
18
+ # Defaults
19
+ PROJECT_PATH="${1:-.}"
20
+ LANG=""
21
+ MINIMAL=false
22
+
23
+ # Parse arguments
24
+ shift || true
25
+ while [[ $# -gt 0 ]]; do
26
+ case $1 in
27
+ --typescript) LANG="typescript"; shift ;;
28
+ --csharp) LANG="csharp"; shift ;;
29
+ --minimal) MINIMAL=true; shift ;;
30
+ *) echo "Unknown option: $1"; exit 1 ;;
31
+ esac
32
+ done
33
+
34
+ # Resolve project path
35
+ PROJECT_PATH="$(cd "$PROJECT_PATH" 2>/dev/null && pwd || echo "$PROJECT_PATH")"
36
+
37
+ if [ ! -d "$PROJECT_PATH" ]; then
38
+ echo "Creating project directory: $PROJECT_PATH"
39
+ mkdir -p "$PROJECT_PATH"
40
+ fi
41
+
42
+ echo "Setting up Claude Code for: $PROJECT_PATH"
43
+ echo ""
44
+
45
+ # Create CLAUDE.md from template
46
+ if [ -f "$PROJECT_PATH/CLAUDE.md" ]; then
47
+ echo "[skip] CLAUDE.md already exists"
48
+ else
49
+ cp "$REPO_ROOT/CLAUDE.md.template" "$PROJECT_PATH/CLAUDE.md"
50
+ echo "[created] CLAUDE.md"
51
+
52
+ # Customize based on language
53
+ if [ "$LANG" = "typescript" ]; then
54
+ sed -i 's/npm run test:run/npm run test/g' "$PROJECT_PATH/CLAUDE.md"
55
+ sed -i 's/npm run test:coverage/npm run test -- --coverage/g' "$PROJECT_PATH/CLAUDE.md"
56
+ elif [ "$LANG" = "csharp" ]; then
57
+ sed -i 's/npm run test:run/dotnet test/g' "$PROJECT_PATH/CLAUDE.md"
58
+ sed -i 's/npm run test:coverage/dotnet test --collect:"XPlat Code Coverage"/g' "$PROJECT_PATH/CLAUDE.md"
59
+ sed -i 's/npm run typecheck/dotnet build/g' "$PROJECT_PATH/CLAUDE.md"
60
+ fi
61
+ fi
62
+
63
+ # Create .claude directory for local overrides (unless minimal)
64
+ if [ "$MINIMAL" = false ]; then
65
+ mkdir -p "$PROJECT_PATH/.claude"
66
+
67
+ # Create local settings.json if it doesn't exist
68
+ if [ ! -f "$PROJECT_PATH/.claude/settings.json" ]; then
69
+ cat > "$PROJECT_PATH/.claude/settings.json" << 'EOF'
70
+ {
71
+ "permissions": {
72
+ "allow": []
73
+ }
74
+ }
75
+ EOF
76
+ echo "[created] .claude/settings.json (local overrides)"
77
+ else
78
+ echo "[skip] .claude/settings.json already exists"
79
+ fi
80
+
81
+ # Add .claude/settings.local.json to .gitignore if git repo
82
+ if [ -d "$PROJECT_PATH/.git" ]; then
83
+ if ! grep -q "settings.local.json" "$PROJECT_PATH/.gitignore" 2>/dev/null; then
84
+ echo ".claude/settings.local.json" >> "$PROJECT_PATH/.gitignore"
85
+ echo "[updated] .gitignore (added settings.local.json)"
86
+ fi
87
+ fi
88
+ fi
89
+
90
+ echo ""
91
+ echo "Setup complete!"
92
+ echo ""
93
+ echo "Available commands (via global config):"
94
+ echo " /ideate - Collaborative design exploration"
95
+ echo " /plan - TDD implementation planning"
96
+ echo " /delegate - Dispatch to Jules or subagents"
97
+ echo " /review - Two-stage code review"
98
+ echo " /synthesize - Merge and create PR"
99
+ echo ""
100
+ echo "Next steps:"
101
+ echo " 1. Edit $PROJECT_PATH/CLAUDE.md with project-specific details"
102
+ echo " 2. Add project-specific rules to $PROJECT_PATH/.claude/rules/ if needed"
103
+ echo ""