@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.
- package/.claude-plugin/marketplace.json +22 -0
- package/.claude-plugin/plugin.json +17 -0
- package/.mcp.json +17 -0
- package/AGENTS.md +59 -0
- package/CLAUDE.md.template +62 -0
- package/LICENSE +202 -0
- package/README.md +258 -0
- package/commands/autocompact.md +37 -0
- package/commands/checkpoint.md +85 -0
- package/commands/cleanup.md +99 -0
- package/commands/debug.md +145 -0
- package/commands/delegate.md +56 -0
- package/commands/ideate.md +82 -0
- package/commands/plan.md +150 -0
- package/commands/refactor.md +139 -0
- package/commands/reload.md +37 -0
- package/commands/resume.md +130 -0
- package/commands/review.md +51 -0
- package/commands/sync-schemas.md +74 -0
- package/commands/synthesize.md +122 -0
- package/commands/tdd.md +58 -0
- package/dist/exarchos-cli.js +8828 -0
- package/dist/exarchos-mcp.js +50 -0
- package/hooks/hooks.json +53 -0
- package/package.json +59 -0
- package/rules/coding-standards.md +46 -0
- package/rules/mcp-tool-guidance.md +26 -0
- package/rules/pr-descriptions.md +12 -0
- package/rules/rm-safety.md +9 -0
- package/rules/skill-path-resolution.md +10 -0
- package/rules/tdd.md +41 -0
- package/rules/telemetry-awareness.md +9 -0
- package/scripts/assess-refactor-scope.sh +239 -0
- package/scripts/check-benchmark-regression.sh +229 -0
- package/scripts/check-coderabbit.sh +288 -0
- package/scripts/check-coverage-thresholds.sh +194 -0
- package/scripts/check-polish-scope.sh +245 -0
- package/scripts/check-property-tests.sh +167 -0
- package/scripts/check-tdd-compliance.sh +265 -0
- package/scripts/coderabbit-review-gate.sh +518 -0
- package/scripts/debug-review-gate.sh +201 -0
- package/scripts/extract-fix-tasks.sh +179 -0
- package/scripts/extract-task.sh +67 -0
- package/scripts/generate-traceability.sh +209 -0
- package/scripts/investigation-timer.sh +171 -0
- package/scripts/needs-schema-sync.sh +174 -0
- package/scripts/new-project.sh +103 -0
- package/scripts/post-delegation-check.sh +317 -0
- package/scripts/pre-synthesis-check.sh +440 -0
- package/scripts/reconcile-state.sh +346 -0
- package/scripts/reconstruct-stack.sh +432 -0
- package/scripts/review-diff.sh +63 -0
- package/scripts/review-verdict.sh +169 -0
- package/scripts/security-scan.sh +248 -0
- package/scripts/select-debug-track.sh +186 -0
- package/scripts/setup-worktree.sh +323 -0
- package/scripts/spec-coverage-check.sh +230 -0
- package/scripts/static-analysis-gate.sh +236 -0
- package/scripts/sync-labels.sh +122 -0
- package/scripts/validate-companion.sh +161 -0
- package/scripts/validate-dotnet-standards.sh +267 -0
- package/scripts/validate-installation.sh +101 -0
- package/scripts/validate-plugin.sh +223 -0
- package/scripts/validate-refactor.sh +234 -0
- package/scripts/validate-rm.sh +93 -0
- package/scripts/verify-delegation-saga.sh +240 -0
- package/scripts/verify-doc-links.sh +211 -0
- package/scripts/verify-ideate-artifacts.sh +296 -0
- package/scripts/verify-plan-coverage.sh +228 -0
- package/scripts/verify-review-triage.sh +219 -0
- package/scripts/verify-worktree-baseline.sh +159 -0
- package/scripts/verify-worktree.sh +84 -0
- package/settings.json +47 -0
- package/skills/brainstorming/SKILL.md +127 -0
- package/skills/brainstorming/references/design-template.md +65 -0
- package/skills/cleanup/SKILL.md +147 -0
- package/skills/cleanup/references/merge-verification.md +40 -0
- package/skills/debug/SKILL.md +204 -0
- package/skills/debug/references/hotfix-track.md +134 -0
- package/skills/debug/references/investigation-checklist.md +217 -0
- package/skills/debug/references/rca-template.md +150 -0
- package/skills/debug/references/state-schema.md +294 -0
- package/skills/debug/references/thorough-track.md +194 -0
- package/skills/debug/references/triage-questions.md +155 -0
- package/skills/debug/references/troubleshooting.md +47 -0
- package/skills/delegation/SKILL.md +150 -0
- package/skills/delegation/references/adaptive-orchestration.md +31 -0
- package/skills/delegation/references/agent-teams-saga.md +248 -0
- package/skills/delegation/references/fix-mode.md +74 -0
- package/skills/delegation/references/fixer-prompt.md +162 -0
- package/skills/delegation/references/implementer-prompt.md +322 -0
- package/skills/delegation/references/parallel-strategy.md +124 -0
- package/skills/delegation/references/pbt-patterns.md +172 -0
- package/skills/delegation/references/pr-fixes-mode.md +154 -0
- package/skills/delegation/references/state-management.md +51 -0
- package/skills/delegation/references/testing-patterns.md +129 -0
- package/skills/delegation/references/troubleshooting.md +33 -0
- package/skills/delegation/references/workflow-steps.md +127 -0
- package/skills/delegation/references/worktree-enforcement.md +64 -0
- package/skills/dotnet-standards/SKILL.md +269 -0
- package/skills/dotnet-standards/references/csharp-standards.md +120 -0
- package/skills/dotnet-standards/templates/.editorconfig +366 -0
- package/skills/dotnet-standards/templates/Directory.Build.props +56 -0
- package/skills/dotnet-standards/templates/Directory.Packages.props +69 -0
- package/skills/dotnet-standards/templates/global.json +6 -0
- package/skills/dotnet-standards/templates/nuget.config +9 -0
- package/skills/dotnet-standards/templates/stylecop.json +37 -0
- package/skills/git-worktrees/SKILL.md +255 -0
- package/skills/implementation-planning/SKILL.md +233 -0
- package/skills/implementation-planning/references/plan-document-template.md +42 -0
- package/skills/implementation-planning/references/spec-tracing-guide.md +51 -0
- package/skills/implementation-planning/references/task-template.md +43 -0
- package/skills/implementation-planning/references/testing-strategy-guide.md +88 -0
- package/skills/quality-review/SKILL.md +278 -0
- package/skills/quality-review/references/code-quality-checklist.md +159 -0
- package/skills/quality-review/references/review-report-template.md +65 -0
- package/skills/quality-review/references/security-checklist.md +79 -0
- package/skills/quality-review/references/typescript-standards.md +24 -0
- package/skills/refactor/COMMAND.md +67 -0
- package/skills/refactor/SKILL.md +198 -0
- package/skills/refactor/phases/auto-chain.md +262 -0
- package/skills/refactor/phases/brief.md +176 -0
- package/skills/refactor/phases/explore.md +132 -0
- package/skills/refactor/phases/overhaul-delegate.md +136 -0
- package/skills/refactor/phases/overhaul-plan.md +312 -0
- package/skills/refactor/phases/overhaul-review.md +304 -0
- package/skills/refactor/phases/polish-implement.md +349 -0
- package/skills/refactor/phases/polish-validate.md +218 -0
- package/skills/refactor/phases/update-docs.md +234 -0
- package/skills/refactor/references/brief-template.md +81 -0
- package/skills/refactor/references/doc-update-checklist.md +110 -0
- package/skills/refactor/references/explore-checklist.md +73 -0
- package/skills/refactor/references/overhaul-track.md +215 -0
- package/skills/refactor/references/polish-track.md +170 -0
- package/skills/shared/prompts/context-reading.md +58 -0
- package/skills/shared/prompts/report-format.md +54 -0
- package/skills/shared/prompts/tdd-requirements.md +39 -0
- package/skills/shepherd/SKILL.md +264 -0
- package/skills/shepherd/references/assess-checklist.md +124 -0
- package/skills/shepherd/references/fix-strategies.md +191 -0
- package/skills/spec-review/SKILL.md +229 -0
- package/skills/spec-review/references/review-checklist.md +60 -0
- package/skills/sync-schemas/SKILL.md +114 -0
- package/skills/sync-schemas/references/configuration.md +73 -0
- package/skills/synthesis/SKILL.md +129 -0
- package/skills/synthesis/references/pr-descriptions.md +87 -0
- package/skills/synthesis/references/synthesis-steps.md +109 -0
- package/skills/synthesis/references/troubleshooting.md +115 -0
- package/skills/validate-all-skills.sh +57 -0
- package/skills/validate-frontmatter.sh +237 -0
- package/skills/workflow-state/SKILL.md +210 -0
- package/skills/workflow-state/references/mcp-tool-reference.md +111 -0
- package/skills/workflow-state/references/phase-transitions.md +141 -0
package/hooks/hooks.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"PreCompact": [{
|
|
4
|
+
"matcher": "auto",
|
|
5
|
+
"hooks": [{
|
|
6
|
+
"type": "command",
|
|
7
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/exarchos-cli.js\" pre-compact",
|
|
8
|
+
"timeout": 30,
|
|
9
|
+
"statusMessage": "Saving workflow checkpoint..."
|
|
10
|
+
}]
|
|
11
|
+
}],
|
|
12
|
+
"SessionStart": [{
|
|
13
|
+
"matcher": "startup|resume",
|
|
14
|
+
"hooks": [{
|
|
15
|
+
"type": "command",
|
|
16
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/exarchos-cli.js\" session-start",
|
|
17
|
+
"timeout": 10,
|
|
18
|
+
"statusMessage": "Checking for active workflows..."
|
|
19
|
+
}]
|
|
20
|
+
}],
|
|
21
|
+
"PreToolUse": [{
|
|
22
|
+
"matcher": "mcp__exarchos__.*",
|
|
23
|
+
"hooks": [{
|
|
24
|
+
"type": "command",
|
|
25
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/exarchos-cli.js\" guard",
|
|
26
|
+
"timeout": 5
|
|
27
|
+
}]
|
|
28
|
+
}],
|
|
29
|
+
"TaskCompleted": [{
|
|
30
|
+
"hooks": [{
|
|
31
|
+
"type": "command",
|
|
32
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/exarchos-cli.js\" task-gate",
|
|
33
|
+
"timeout": 120,
|
|
34
|
+
"statusMessage": "Running quality gates..."
|
|
35
|
+
}]
|
|
36
|
+
}],
|
|
37
|
+
"TeammateIdle": [{
|
|
38
|
+
"hooks": [{
|
|
39
|
+
"type": "command",
|
|
40
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/exarchos-cli.js\" teammate-gate",
|
|
41
|
+
"timeout": 120,
|
|
42
|
+
"statusMessage": "Verifying teammate work..."
|
|
43
|
+
}]
|
|
44
|
+
}],
|
|
45
|
+
"SubagentStart": [{
|
|
46
|
+
"hooks": [{
|
|
47
|
+
"type": "command",
|
|
48
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/dist/exarchos-cli.js\" subagent-context",
|
|
49
|
+
"timeout": 5
|
|
50
|
+
}]
|
|
51
|
+
}]
|
|
52
|
+
}
|
|
53
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lvlup-sw/exarchos",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Governed SDLC workflows for Claude Code — agent orchestration, quality gates, and Graphite stacked PRs",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"exarchos-cli": "./dist/exarchos-cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/exarchos-mcp.js",
|
|
11
|
+
"dist/exarchos-cli.js",
|
|
12
|
+
"commands",
|
|
13
|
+
"skills",
|
|
14
|
+
"rules",
|
|
15
|
+
"scripts",
|
|
16
|
+
"hooks",
|
|
17
|
+
"settings.json",
|
|
18
|
+
".mcp.json",
|
|
19
|
+
".claude-plugin",
|
|
20
|
+
"CLAUDE.md.template",
|
|
21
|
+
"AGENTS.md",
|
|
22
|
+
"!**/*.test.sh",
|
|
23
|
+
"!**/*.test.ts",
|
|
24
|
+
"!**/test-fixtures",
|
|
25
|
+
"!**/trigger-tests"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc && bun run build:mcp && bun run build:cli",
|
|
29
|
+
"build:cli": "bun build servers/exarchos-mcp/src/cli.ts --outfile dist/exarchos-cli.js --target node",
|
|
30
|
+
"build:mcp": "bun build servers/exarchos-mcp/src/index.ts --outfile dist/exarchos-mcp.js --target bun --minify",
|
|
31
|
+
"prepare": "tsc",
|
|
32
|
+
"bench": "cd servers/exarchos-mcp && npx vitest bench",
|
|
33
|
+
"test": "vitest",
|
|
34
|
+
"test:run": "vitest run",
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"validate": "bash scripts/validate-plugin.sh",
|
|
37
|
+
"validate:companion": "bash scripts/validate-companion.sh"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"claude-code-plugin",
|
|
41
|
+
"agent-governance",
|
|
42
|
+
"workflow",
|
|
43
|
+
"sdlc",
|
|
44
|
+
"tdd",
|
|
45
|
+
"graphite",
|
|
46
|
+
"event-sourcing",
|
|
47
|
+
"code-review"
|
|
48
|
+
],
|
|
49
|
+
"author": "lvlup-sw",
|
|
50
|
+
"license": "Apache-2.0",
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/node": "^22.0.0",
|
|
53
|
+
"typescript": "^5.0.0",
|
|
54
|
+
"vitest": "^3.0.0"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=20.0.0"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths: "**/*.ts", "**/*.tsx", "**/*.cs"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Coding Standards
|
|
6
|
+
|
|
7
|
+
Apply these standards when reviewing or writing TypeScript or C# code.
|
|
8
|
+
|
|
9
|
+
## SOLID Constraints
|
|
10
|
+
|
|
11
|
+
| Principle | TypeScript | C# |
|
|
12
|
+
|-----------|-----------|-----|
|
|
13
|
+
| **S**RP | One primary component/class per file | One public type per file; filename matches type name |
|
|
14
|
+
| **O**CP | Discriminated unions or strategy pattern, not type switches | No `switch` on types/enums for logic; use polymorphism |
|
|
15
|
+
| **L**SP | Implement all interface methods fully | Subclasses must not throw `NotImplementedException` |
|
|
16
|
+
| **I**SP | Small focused interfaces, composed as needed | Small role-specific interfaces (e.g., `IReadable`, `IWritable`) |
|
|
17
|
+
| **D**IP | Depend on interfaces, inject implementations | All dependencies via constructor injection; never `new` concrete services |
|
|
18
|
+
|
|
19
|
+
## Control Flow
|
|
20
|
+
|
|
21
|
+
- **Guard clauses first**: Validate/narrow at function entry
|
|
22
|
+
- **Early return**: Exit immediately when conditions fail
|
|
23
|
+
- **No arrow code**: Flatten nested conditionals with early returns
|
|
24
|
+
- **Extract complexity**: Complex conditions into named predicates/helpers
|
|
25
|
+
|
|
26
|
+
## Error Handling
|
|
27
|
+
|
|
28
|
+
| Pattern | TypeScript | C# |
|
|
29
|
+
|---------|-----------|-----|
|
|
30
|
+
| Recoverable errors | Result types (consider `neverthrow`) | `Result<T>` pattern |
|
|
31
|
+
| Programmer errors | Custom error classes with discriminated unions | Exceptions + `ArgumentNullException.ThrowIfNull()` |
|
|
32
|
+
| Silent catches | Never — always handle or rethrow | Never — always handle or rethrow |
|
|
33
|
+
| Boundaries | Explicit error boundaries at API/UI layers | Explicit error boundaries at API/UI layers |
|
|
34
|
+
|
|
35
|
+
## Code Organization (DRY)
|
|
36
|
+
|
|
37
|
+
- Extract duplicated logic into utility functions/helpers
|
|
38
|
+
- Use built-in collection methods (TS: `map`/`filter`/`reduce`; C#: LINQ)
|
|
39
|
+
- Leverage standard utility types (TS: `Partial`, `Pick`, `Omit`; C#: generics, records)
|
|
40
|
+
- Do not re-implement standard library functionality
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
For TypeScript-specific standards, see `@skills/quality-review/references/typescript-standards.md`.
|
|
45
|
+
|
|
46
|
+
For C#-specific standards, see `@skills/dotnet-standards/references/csharp-standards.md`.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mcp-tool-guidance
|
|
3
|
+
description: "Prefer specialized MCP tools over generic CLI approaches."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# MCP Tool Guidance
|
|
7
|
+
|
|
8
|
+
Use specialized MCP tools over generic approaches:
|
|
9
|
+
|
|
10
|
+
1. **Workflow state** — Exarchos MCP, never manual JSON
|
|
11
|
+
2. **PR creation** — Graphite MCP (`gt submit --no-interactive --publish --merge-when-ready`), never `gh pr create`
|
|
12
|
+
3. **State management** — `exarchos_workflow` set/get, never edit JSON directly
|
|
13
|
+
|
|
14
|
+
> Additional tool guidance (Serena, GitHub MCP, Context7) is provided by the exarchos-dev-tools companion. Install: `npx @lvlup-sw/exarchos-dev`
|
|
15
|
+
|
|
16
|
+
## Quick Reference — `exarchos_workflow`
|
|
17
|
+
|
|
18
|
+
Before calling, consult `@skills/workflow-state/references/mcp-tool-reference.md` for full action signatures, error handling, and anti-patterns.
|
|
19
|
+
|
|
20
|
+
| Action | Key Parameters |
|
|
21
|
+
|--------|---------------|
|
|
22
|
+
| `get` | `featureId`, optional `query` (dot-path) or `fields` (string array for projection) |
|
|
23
|
+
| `set` | `featureId`, `updates` (object), `phase` (string) — send both in one call for guarded transitions |
|
|
24
|
+
| `init` | `featureId`, `workflowType` (`"feature"` / `"debug"` / `"refactor"`) |
|
|
25
|
+
| `cleanup` | `featureId`, `mergeVerified: true`, `prUrl`, `mergedBranches` |
|
|
26
|
+
| `cancel` | `featureId`, optional `dryRun: true` |
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pr-descriptions
|
|
3
|
+
description: "PR title and body format guidelines for Graphite stacked PRs."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PR Descriptions
|
|
7
|
+
|
|
8
|
+
**Title:** `<type>: <what>` (max 72 chars)
|
|
9
|
+
|
|
10
|
+
**Body:** Summary (2-3 sentences) → Changes (bulleted, `**Component** — description`) → Test Plan → Footer (`---` + results, design doc, related PRs). Aim for 120-200 words.
|
|
11
|
+
|
|
12
|
+
See `skills/synthesis/references/pr-descriptions.md` for template and examples.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
alwaysApply: true
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# rm Safety
|
|
6
|
+
|
|
7
|
+
**NEVER:** `rm -rf /`, `rm -rf ~`, `rm -rf .` in home/root, rm with unset variables (`$UNSET_VAR/*`)
|
|
8
|
+
|
|
9
|
+
**Always:** Use specific paths, `ls` before deleting, avoid `-f` unless needed, verify `-r` targets. When uncertain, preview with `echo rm ...` or ask the user.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skill-path-resolution
|
|
3
|
+
description: "Resolve @skills/<name>/SKILL.md paths to ~/.claude/skills/<name>/SKILL.md."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill Path Resolution
|
|
7
|
+
|
|
8
|
+
`@skills/<name>/SKILL.md` resolves to `~/.claude/skills/<name>/SKILL.md`.
|
|
9
|
+
|
|
10
|
+
When encountered: read the skill file, follow its instructions, use templates from its directory. If not found, report to user and fall back to inline instructions.
|
package/rules/tdd.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths: "**/*.ts", "**/*.tsx", "**/*.cs"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# TDD Rules
|
|
6
|
+
|
|
7
|
+
Enforce strict TDD when modifying TypeScript or C# files.
|
|
8
|
+
|
|
9
|
+
## TDD Workflow
|
|
10
|
+
|
|
11
|
+
### RED Phase
|
|
12
|
+
1. Write a test that describes expected behavior
|
|
13
|
+
2. Run tests — test MUST fail
|
|
14
|
+
3. Verify it fails for the RIGHT reason (not a compilation error)
|
|
15
|
+
|
|
16
|
+
### GREEN Phase
|
|
17
|
+
1. Write the minimum code to make the test pass
|
|
18
|
+
2. Run tests — test MUST pass
|
|
19
|
+
3. No extra features or optimizations
|
|
20
|
+
|
|
21
|
+
### REFACTOR Phase
|
|
22
|
+
1. Clean up code while tests stay green
|
|
23
|
+
2. Extract helpers, improve naming, apply SOLID
|
|
24
|
+
3. Run tests after each change
|
|
25
|
+
|
|
26
|
+
## Conventions
|
|
27
|
+
|
|
28
|
+
| | TypeScript | C# |
|
|
29
|
+
|--|-----------|-----|
|
|
30
|
+
| Framework | Vitest | TUnit |
|
|
31
|
+
| Test files | `foo.test.ts` (co-located) | `Foo.Tests.cs` (co-located) |
|
|
32
|
+
| Naming | `Method_Scenario_Outcome` | `Method_Scenario_Outcome` |
|
|
33
|
+
| Run | `npm run test:run` | `dotnet test` |
|
|
34
|
+
| Pattern | Arrange / Act / Assert | Arrange / Act / Assert |
|
|
35
|
+
| Mocking | `vi.mock()`, `vi.fn()` | NSubstitute (`Substitute.For<T>()`) |
|
|
36
|
+
| PBT | `@fast-check/vitest` | FsCheck |
|
|
37
|
+
|
|
38
|
+
For test code patterns and examples, see `@skills/delegation/references/testing-patterns.md`.
|
|
39
|
+
For property-based testing templates, see `@skills/delegation/references/pbt-patterns.md`.
|
|
40
|
+
|
|
41
|
+
Property tests are written alongside example tests in the RED phase. They complement, not replace, example tests.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: telemetry-awareness
|
|
3
|
+
description: "Apply telemetryHints from session-start output to subsequent MCP tool calls."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Telemetry Awareness
|
|
7
|
+
|
|
8
|
+
When `telemetryHints` appear in session-start output, apply the suggested
|
|
9
|
+
optimizations to subsequent MCP tool calls for the remainder of the session.
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Assess Refactor Scope
|
|
3
|
+
# Assesses scope and recommends track (polish vs overhaul).
|
|
4
|
+
# Replaces explore phase scope assessment prose with deterministic validation.
|
|
5
|
+
#
|
|
6
|
+
# Usage: assess-refactor-scope.sh --files <file1,file2,...> | --state-file <path>
|
|
7
|
+
#
|
|
8
|
+
# Exit codes:
|
|
9
|
+
# 0 = polish recommended
|
|
10
|
+
# 1 = overhaul recommended
|
|
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
|
+
FILES=""
|
|
28
|
+
STATE_FILE=""
|
|
29
|
+
|
|
30
|
+
usage() {
|
|
31
|
+
cat << 'USAGE'
|
|
32
|
+
Usage: assess-refactor-scope.sh --files <file1,file2,...> | --state-file <path>
|
|
33
|
+
|
|
34
|
+
Required (one of):
|
|
35
|
+
--files <file1,file2,...> Comma-separated list of affected files
|
|
36
|
+
--state-file <path> Path to workflow state JSON (reads explore.scopeAssessment.filesAffected)
|
|
37
|
+
|
|
38
|
+
Optional:
|
|
39
|
+
--help Show this help message
|
|
40
|
+
|
|
41
|
+
Exit codes:
|
|
42
|
+
0 Polish recommended (<=5 files, single module, good test coverage)
|
|
43
|
+
1 Overhaul recommended (scope exceeds polish limits)
|
|
44
|
+
2 Usage error (missing required args)
|
|
45
|
+
USAGE
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
while [[ $# -gt 0 ]]; do
|
|
49
|
+
case "$1" in
|
|
50
|
+
--files)
|
|
51
|
+
if [[ -z "${2:-}" ]]; then
|
|
52
|
+
echo "Error: --files requires a comma-separated list" >&2
|
|
53
|
+
exit 2
|
|
54
|
+
fi
|
|
55
|
+
FILES="$2"
|
|
56
|
+
shift 2
|
|
57
|
+
;;
|
|
58
|
+
--state-file)
|
|
59
|
+
if [[ -z "${2:-}" ]]; then
|
|
60
|
+
echo "Error: --state-file requires a path argument" >&2
|
|
61
|
+
exit 2
|
|
62
|
+
fi
|
|
63
|
+
STATE_FILE="$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 "$FILES" && -z "$STATE_FILE" ]]; then
|
|
79
|
+
echo "Error: --files or --state-file is required" >&2
|
|
80
|
+
usage >&2
|
|
81
|
+
exit 2
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
# ============================================================
|
|
85
|
+
# DEPENDENCY CHECK
|
|
86
|
+
# ============================================================
|
|
87
|
+
|
|
88
|
+
if [[ -n "$STATE_FILE" ]]; then
|
|
89
|
+
if ! command -v jq &>/dev/null; then
|
|
90
|
+
echo "Error: jq is required but not installed" >&2
|
|
91
|
+
exit 2
|
|
92
|
+
fi
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
# ============================================================
|
|
96
|
+
# PARSE FILES
|
|
97
|
+
# ============================================================
|
|
98
|
+
|
|
99
|
+
FILE_LIST=()
|
|
100
|
+
|
|
101
|
+
if [[ -n "$STATE_FILE" ]]; then
|
|
102
|
+
if [[ ! -f "$STATE_FILE" ]]; then
|
|
103
|
+
echo "Error: State file not found: $STATE_FILE" >&2
|
|
104
|
+
exit 2
|
|
105
|
+
fi
|
|
106
|
+
# Read files from state file
|
|
107
|
+
while IFS= read -r line; do
|
|
108
|
+
FILE_LIST+=("$line")
|
|
109
|
+
done < <(jq -r '.explore.scopeAssessment.filesAffected[]' "$STATE_FILE" 2>/dev/null)
|
|
110
|
+
elif [[ -n "$FILES" ]]; then
|
|
111
|
+
IFS=',' read -ra FILE_LIST <<< "$FILES"
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
FILE_COUNT=${#FILE_LIST[@]}
|
|
115
|
+
|
|
116
|
+
# ============================================================
|
|
117
|
+
# ASSESS SCOPE
|
|
118
|
+
# ============================================================
|
|
119
|
+
|
|
120
|
+
CHECK_PASS=0
|
|
121
|
+
CHECK_FAIL=0
|
|
122
|
+
RESULTS=()
|
|
123
|
+
|
|
124
|
+
check_pass() {
|
|
125
|
+
local name="$1"
|
|
126
|
+
RESULTS+=("- **PASS**: $name")
|
|
127
|
+
CHECK_PASS=$((CHECK_PASS + 1))
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
check_fail() {
|
|
131
|
+
local name="$1"
|
|
132
|
+
local detail="${2:-}"
|
|
133
|
+
if [[ -n "$detail" ]]; then
|
|
134
|
+
RESULTS+=("- **FAIL**: $name — $detail")
|
|
135
|
+
else
|
|
136
|
+
RESULTS+=("- **FAIL**: $name")
|
|
137
|
+
fi
|
|
138
|
+
CHECK_FAIL=$((CHECK_FAIL + 1))
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
# Check 1: File count (<=5 for polish)
|
|
142
|
+
if [[ $FILE_COUNT -le 5 ]]; then
|
|
143
|
+
check_pass "File count within polish limit ($FILE_COUNT <= 5)"
|
|
144
|
+
else
|
|
145
|
+
check_fail "File count exceeds polish limit" "$FILE_COUNT files (max 5)"
|
|
146
|
+
fi
|
|
147
|
+
|
|
148
|
+
# Check 2: Cross-module span
|
|
149
|
+
# Extract unique top-level directories (Bash 3 compatible — no associative arrays)
|
|
150
|
+
MODULE_LIST=""
|
|
151
|
+
for f in "${FILE_LIST[@]}"; do
|
|
152
|
+
top_dir="$(echo "$f" | cut -d'/' -f1)"
|
|
153
|
+
# Add to list if not already present
|
|
154
|
+
if ! echo "$MODULE_LIST" | grep -qF "|$top_dir|"; then
|
|
155
|
+
MODULE_LIST="${MODULE_LIST}|$top_dir|"
|
|
156
|
+
fi
|
|
157
|
+
done
|
|
158
|
+
# Count unique modules
|
|
159
|
+
MODULE_COUNT=0
|
|
160
|
+
MODULE_NAMES=""
|
|
161
|
+
if [[ -n "$MODULE_LIST" ]]; then
|
|
162
|
+
MODULE_NAMES="$(echo "$MODULE_LIST" | tr '|' '\n' | sort -u | grep -v '^$' | tr '\n' ' ')"
|
|
163
|
+
MODULE_COUNT="$(echo "$MODULE_LIST" | tr '|' '\n' | sort -u | grep -vc '^$' || true)"
|
|
164
|
+
fi
|
|
165
|
+
|
|
166
|
+
if [[ $MODULE_COUNT -le 1 ]]; then
|
|
167
|
+
check_pass "Single module scope ($MODULE_NAMES)"
|
|
168
|
+
else
|
|
169
|
+
check_fail "Cross-module span detected" "$MODULE_COUNT modules: $MODULE_NAMES"
|
|
170
|
+
fi
|
|
171
|
+
|
|
172
|
+
# Check 3: Test coverage (check if .test.ts/.test.sh files exist for affected files)
|
|
173
|
+
MISSING_TESTS=()
|
|
174
|
+
for f in "${FILE_LIST[@]}"; do
|
|
175
|
+
# Skip files that are already test files
|
|
176
|
+
if [[ "$f" == *.test.ts || "$f" == *.test.sh ]]; then
|
|
177
|
+
continue
|
|
178
|
+
fi
|
|
179
|
+
# Skip non-source files
|
|
180
|
+
if [[ "$f" != *.ts && "$f" != *.sh ]]; then
|
|
181
|
+
continue
|
|
182
|
+
fi
|
|
183
|
+
# Derive expected test file name
|
|
184
|
+
if [[ "$f" == *.ts ]]; then
|
|
185
|
+
test_file="${f%.ts}.test.ts"
|
|
186
|
+
elif [[ "$f" == *.sh ]]; then
|
|
187
|
+
test_file="${f%.sh}.test.sh"
|
|
188
|
+
fi
|
|
189
|
+
# We can only check existence if we have a reference directory,
|
|
190
|
+
# but for scope assessment we just note the expected test counterparts
|
|
191
|
+
MISSING_TESTS+=("$test_file")
|
|
192
|
+
done
|
|
193
|
+
|
|
194
|
+
# For scope assessment purposes, having test counterparts is informational
|
|
195
|
+
if [[ ${#MISSING_TESTS[@]} -eq 0 ]]; then
|
|
196
|
+
check_pass "Test coverage assessment (all source files have known patterns)"
|
|
197
|
+
else
|
|
198
|
+
# This is informational, not a hard fail for track decision
|
|
199
|
+
check_pass "Test coverage assessment (${#MISSING_TESTS[@]} test counterparts to verify)"
|
|
200
|
+
fi
|
|
201
|
+
|
|
202
|
+
# ============================================================
|
|
203
|
+
# DETERMINE RECOMMENDATION
|
|
204
|
+
# ============================================================
|
|
205
|
+
|
|
206
|
+
RECOMMENDATION="polish"
|
|
207
|
+
if [[ $FILE_COUNT -gt 5 ]]; then
|
|
208
|
+
RECOMMENDATION="overhaul"
|
|
209
|
+
fi
|
|
210
|
+
if [[ $MODULE_COUNT -gt 1 ]]; then
|
|
211
|
+
RECOMMENDATION="overhaul"
|
|
212
|
+
fi
|
|
213
|
+
|
|
214
|
+
# ============================================================
|
|
215
|
+
# STRUCTURED OUTPUT
|
|
216
|
+
# ============================================================
|
|
217
|
+
|
|
218
|
+
echo "## Scope Assessment Report"
|
|
219
|
+
echo ""
|
|
220
|
+
echo "**Files affected:** $FILE_COUNT"
|
|
221
|
+
echo "**Modules:** ${MODULE_NAMES:-}"
|
|
222
|
+
echo "**Recommendation:** $RECOMMENDATION"
|
|
223
|
+
echo ""
|
|
224
|
+
|
|
225
|
+
for result in "${RESULTS[@]}"; do
|
|
226
|
+
echo "$result"
|
|
227
|
+
done
|
|
228
|
+
|
|
229
|
+
echo ""
|
|
230
|
+
echo "---"
|
|
231
|
+
echo ""
|
|
232
|
+
|
|
233
|
+
if [[ "$RECOMMENDATION" == "polish" ]]; then
|
|
234
|
+
echo "**Result: POLISH** — Scope is within polish limits"
|
|
235
|
+
exit 0
|
|
236
|
+
else
|
|
237
|
+
echo "**Result: OVERHAUL** — Scope exceeds polish limits"
|
|
238
|
+
exit 1
|
|
239
|
+
fi
|