@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,346 @@
1
+ #!/usr/bin/env bash
2
+ # Reconcile State
3
+ # Compares workflow state file to git reality: verifies worktrees exist,
4
+ # branches exist, task statuses are consistent, and phase is valid.
5
+ #
6
+ # Usage: reconcile-state.sh --state-file <path> --repo-root <path>
7
+ #
8
+ # Exit codes:
9
+ # 0 = state is consistent with git
10
+ # 1 = discrepancies found
11
+ # 2 = usage error (missing required args)
12
+
13
+ set -euo pipefail
14
+
15
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
+
17
+ # Colors
18
+ RED='\033[0;31m'
19
+ GREEN='\033[0;32m'
20
+ YELLOW='\033[1;33m'
21
+ NC='\033[0m'
22
+
23
+ # ============================================================
24
+ # ARGUMENT PARSING
25
+ # ============================================================
26
+
27
+ STATE_FILE=""
28
+ REPO_ROOT=""
29
+
30
+ usage() {
31
+ cat << 'USAGE'
32
+ Usage: reconcile-state.sh --state-file <path> --repo-root <path>
33
+
34
+ Required:
35
+ --state-file <path> Path to the workflow state JSON file
36
+ --repo-root <path> Git repository root directory
37
+
38
+ Optional:
39
+ --help Show this help message
40
+
41
+ Exit codes:
42
+ 0 State is consistent with git
43
+ 1 Discrepancies found
44
+ 2 Usage error (missing required args)
45
+ USAGE
46
+ }
47
+
48
+ while [[ $# -gt 0 ]]; do
49
+ case "$1" in
50
+ --state-file)
51
+ if [[ -z "${2:-}" ]]; then
52
+ echo "Error: --state-file requires a path argument" >&2
53
+ exit 2
54
+ fi
55
+ STATE_FILE="$2"
56
+ shift 2
57
+ ;;
58
+ --repo-root)
59
+ if [[ -z "${2:-}" ]]; then
60
+ echo "Error: --repo-root requires a path argument" >&2
61
+ exit 2
62
+ fi
63
+ REPO_ROOT="$2"
64
+ shift 2
65
+ ;;
66
+ --help)
67
+ usage
68
+ exit 0
69
+ ;;
70
+ *)
71
+ echo "Error: Unknown argument '$1'" >&2
72
+ usage >&2
73
+ exit 2
74
+ ;;
75
+ esac
76
+ done
77
+
78
+ if [[ -z "$STATE_FILE" || -z "$REPO_ROOT" ]]; then
79
+ echo "Error: --state-file and --repo-root are required" >&2
80
+ usage >&2
81
+ exit 2
82
+ fi
83
+
84
+ # ============================================================
85
+ # DEPENDENCY CHECK
86
+ # ============================================================
87
+
88
+ if ! command -v jq &>/dev/null; then
89
+ echo "Error: jq is required but not installed" >&2
90
+ exit 2
91
+ fi
92
+
93
+ if ! command -v git &>/dev/null; then
94
+ echo "Error: git is required but not installed" >&2
95
+ exit 2
96
+ fi
97
+
98
+ # ============================================================
99
+ # CHECK FUNCTIONS
100
+ # ============================================================
101
+
102
+ CHECK_PASS=0
103
+ CHECK_FAIL=0
104
+ RESULTS=()
105
+
106
+ check_pass() {
107
+ local name="$1"
108
+ RESULTS+=("- **PASS**: $name")
109
+ CHECK_PASS=$((CHECK_PASS + 1))
110
+ }
111
+
112
+ check_fail() {
113
+ local name="$1"
114
+ local detail="${2:-}"
115
+ if [[ -n "$detail" ]]; then
116
+ RESULTS+=("- **FAIL**: $name — $detail")
117
+ else
118
+ RESULTS+=("- **FAIL**: $name")
119
+ fi
120
+ CHECK_FAIL=$((CHECK_FAIL + 1))
121
+ }
122
+
123
+ # ============================================================
124
+ # CHECK 1: State file exists and is valid JSON
125
+ # ============================================================
126
+
127
+ check_state_file() {
128
+ if [[ ! -f "$STATE_FILE" ]]; then
129
+ check_fail "State file exists" "File not found: $STATE_FILE"
130
+ return 1
131
+ fi
132
+
133
+ if ! jq empty "$STATE_FILE" 2>/dev/null; then
134
+ check_fail "State file exists" "Invalid JSON: $STATE_FILE"
135
+ return 1
136
+ fi
137
+
138
+ check_pass "State file exists"
139
+ return 0
140
+ }
141
+
142
+ # ============================================================
143
+ # CHECK 2: Phase is valid for workflow type
144
+ # ============================================================
145
+
146
+ check_phase_valid() {
147
+ local workflow_type
148
+ local phase
149
+
150
+ workflow_type="$(jq -r '.workflowType // "feature"' "$STATE_FILE")"
151
+ phase="$(jq -r '.phase // "unknown"' "$STATE_FILE")"
152
+
153
+ # Define valid phases per workflow type
154
+ local -a valid_phases
155
+ case "$workflow_type" in
156
+ feature)
157
+ valid_phases=(ideate plan plan-review delegate review synthesize complete cancelled)
158
+ ;;
159
+ debug)
160
+ valid_phases=(triage investigate fix validate complete cancelled)
161
+ ;;
162
+ refactor)
163
+ valid_phases=(explore brief implement validate complete cancelled)
164
+ ;;
165
+ *)
166
+ check_fail "Phase is valid" "Unknown workflow type: $workflow_type"
167
+ return 1
168
+ ;;
169
+ esac
170
+
171
+ local found=false
172
+ for valid_phase in "${valid_phases[@]}"; do
173
+ if [[ "$phase" == "$valid_phase" ]]; then
174
+ found=true
175
+ break
176
+ fi
177
+ done
178
+
179
+ if [[ "$found" == true ]]; then
180
+ check_pass "Phase is valid ($phase for $workflow_type)"
181
+ return 0
182
+ else
183
+ check_fail "Phase is valid" "Phase '$phase' is not valid for workflow type '$workflow_type' (valid: ${valid_phases[*]})"
184
+ return 1
185
+ fi
186
+ }
187
+
188
+ # ============================================================
189
+ # CHECK 3: Task branches exist in git
190
+ # ============================================================
191
+
192
+ check_task_branches() {
193
+ local task_count
194
+ task_count="$(jq '.tasks | length' "$STATE_FILE")"
195
+
196
+ if [[ "$task_count" -eq 0 ]]; then
197
+ check_pass "Task branches exist (no tasks to check)"
198
+ return 0
199
+ fi
200
+
201
+ local missing_branches=()
202
+ local branches_checked=0
203
+
204
+ # Get all branches from the task array
205
+ local task_branches
206
+ task_branches="$(jq -r '.tasks[] | select(.branch != null and .branch != "") | .branch' "$STATE_FILE")"
207
+
208
+ while IFS= read -r branch; do
209
+ [[ -z "$branch" ]] && continue
210
+ branches_checked=$((branches_checked + 1))
211
+
212
+ # Check if branch exists in git
213
+ if ! git -C "$REPO_ROOT" rev-parse --verify "refs/heads/$branch" &>/dev/null; then
214
+ missing_branches+=("$branch")
215
+ fi
216
+ done <<< "$task_branches"
217
+
218
+ if [[ ${#missing_branches[@]} -eq 0 ]]; then
219
+ check_pass "Task branches exist ($branches_checked branches verified)"
220
+ return 0
221
+ else
222
+ local missing_list
223
+ missing_list="$(IFS=', '; echo "${missing_branches[*]}")"
224
+ check_fail "Task branches exist" "Missing branches: $missing_list"
225
+ return 1
226
+ fi
227
+ }
228
+
229
+ # ============================================================
230
+ # CHECK 4: Worktrees listed in state exist on disk
231
+ # ============================================================
232
+
233
+ check_worktrees_exist() {
234
+ local worktree_count
235
+ worktree_count="$(jq '.worktrees | length' "$STATE_FILE")"
236
+
237
+ if [[ "$worktree_count" -eq 0 ]]; then
238
+ check_pass "Worktrees exist (no worktrees to check)"
239
+ return 0
240
+ fi
241
+
242
+ # Get actual git worktrees
243
+ local git_worktrees
244
+ git_worktrees="$(git -C "$REPO_ROOT" worktree list --porcelain 2>/dev/null | grep '^worktree ' | sed 's/^worktree //' || true)"
245
+
246
+ local missing_worktrees=()
247
+ local worktrees_checked=0
248
+
249
+ # Check each worktree in state
250
+ local worktree_paths
251
+ worktree_paths="$(jq -r '.worktrees | to_entries[] | select(.value.status == "active") | .value.path // empty' "$STATE_FILE")"
252
+
253
+ while IFS= read -r wt_path; do
254
+ [[ -z "$wt_path" ]] && continue
255
+ worktrees_checked=$((worktrees_checked + 1))
256
+
257
+ if [[ ! -d "$wt_path" ]]; then
258
+ missing_worktrees+=("$wt_path")
259
+ elif ! echo "$git_worktrees" | grep -qFx "$wt_path"; then
260
+ missing_worktrees+=("$wt_path (not a git worktree)")
261
+ fi
262
+ done <<< "$worktree_paths"
263
+
264
+ if [[ ${#missing_worktrees[@]} -eq 0 ]]; then
265
+ check_pass "Worktrees exist ($worktrees_checked worktrees verified)"
266
+ return 0
267
+ else
268
+ local missing_list
269
+ missing_list="$(IFS=', '; echo "${missing_worktrees[*]}")"
270
+ check_fail "Worktrees exist" "Missing worktree paths: $missing_list"
271
+ return 1
272
+ fi
273
+ }
274
+
275
+ # ============================================================
276
+ # CHECK 5: Task status consistency
277
+ # ============================================================
278
+
279
+ check_task_status_consistency() {
280
+ local task_count
281
+ task_count="$(jq '.tasks | length' "$STATE_FILE")"
282
+
283
+ if [[ "$task_count" -eq 0 ]]; then
284
+ check_pass "Task status consistency (no tasks to check)"
285
+ return 0
286
+ fi
287
+
288
+ local inconsistencies=()
289
+
290
+ # Check for in-progress tasks without branches
291
+ local in_progress_no_branch
292
+ in_progress_no_branch="$(jq -r '.tasks[] | select(.status == "in-progress" and (.branch == null or .branch == "")) | .id' "$STATE_FILE")"
293
+
294
+ while IFS= read -r task_id; do
295
+ [[ -z "$task_id" ]] && continue
296
+ inconsistencies+=("Task $task_id is in-progress but has no branch")
297
+ done <<< "$in_progress_no_branch"
298
+
299
+ if [[ ${#inconsistencies[@]} -eq 0 ]]; then
300
+ check_pass "Task status consistency ($task_count tasks checked)"
301
+ return 0
302
+ else
303
+ local issue_list
304
+ issue_list="$(IFS='; '; echo "${inconsistencies[*]}")"
305
+ check_fail "Task status consistency" "$issue_list"
306
+ return 1
307
+ fi
308
+ }
309
+
310
+ # ============================================================
311
+ # EXECUTE CHECKS
312
+ # ============================================================
313
+
314
+ if check_state_file; then
315
+ check_phase_valid || true
316
+ check_task_branches || true
317
+ check_worktrees_exist || true
318
+ check_task_status_consistency || true
319
+ fi
320
+
321
+ # ============================================================
322
+ # STRUCTURED OUTPUT
323
+ # ============================================================
324
+
325
+ echo "## State Reconciliation Report"
326
+ echo ""
327
+ echo "**State file:** \`$STATE_FILE\`"
328
+ echo "**Repo root:** \`$REPO_ROOT\`"
329
+ echo ""
330
+
331
+ for result in "${RESULTS[@]}"; do
332
+ echo "$result"
333
+ done
334
+
335
+ echo ""
336
+ TOTAL=$((CHECK_PASS + CHECK_FAIL))
337
+ echo "---"
338
+ echo ""
339
+
340
+ if [[ $CHECK_FAIL -eq 0 ]]; then
341
+ echo "**Result: PASS** — State is consistent with git ($CHECK_PASS/$TOTAL checks passed)"
342
+ exit 0
343
+ else
344
+ echo "**Result: FAIL** — Discrepancies found ($CHECK_FAIL/$TOTAL checks failed)"
345
+ exit 1
346
+ fi