squad-kit 0.8.0 → 0.9.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.
@@ -7,7 +7,7 @@
7
7
  <link rel="icon" href="/favicon.ico" sizes="any" />
8
8
  <link rel="icon" href="/logo.svg" type="image/svg+xml" />
9
9
  <title>squad console</title>
10
- <script type="module" crossorigin src="/assets/index-DGzIogF0.js"></script>
10
+ <script type="module" crossorigin src="/assets/index-Dnb4Fisq.js"></script>
11
11
  <link rel="stylesheet" crossorigin href="/assets/index-C5I4cnED.css">
12
12
  </head>
13
13
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squad-kit",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
4
4
  "author": "Momen Yasser <momenysr@gmail.com>",
5
5
  "description": "Plan once, execute cheap. A token-efficient, 3-step SDD workflow CLI (stories → plans → implementation).",
6
6
  "keywords": [
@@ -38,12 +38,19 @@
38
38
  "verify:console": "tsx scripts/verify-console-build.ts",
39
39
  "verify:models": "tsx scripts/verify-models.ts",
40
40
  "size:guard": "tsx scripts/size-guard.ts",
41
+ "eval": "SQUAD_INTEGRATION_TEST=1 tsx test/eval/run-eval.ts",
42
+ "eval:offline": "tsx test/eval/run-eval-offline.ts",
41
43
  "prepublishOnly": "pnpm run verify:models && pnpm build && pnpm test && pnpm size:guard"
42
44
  },
43
45
  "dependencies": {
46
+ "@ai-sdk/provider": "1.1.3",
47
+ "@ai-sdk/anthropic": "^1.2.12",
48
+ "@ai-sdk/google": "^1.2.22",
49
+ "@ai-sdk/openai": "^1.3.24",
44
50
  "@hono/node-server": "^1.13.0",
45
51
  "@inquirer/prompts": "^7.2.0",
46
52
  "boxen": "^8.0.1",
53
+ "ai": "^4.3.19",
47
54
  "commander": "^12.1.0",
48
55
  "diff": "^7.0.0",
49
56
  "fs-extra": "^11.2.0",
@@ -1,93 +1,121 @@
1
1
  # Meta-prompt: generate implementation-plan Markdown
2
2
 
3
- Use this prompt in **one agent session** together with a filled intake file (`.squad/stories/<feature-slug>/<id>/intake.md`) and any files under its `attachments/`.
3
+ You are a senior engineer maintaining **agent-executable implementation plans** for this project.
4
4
 
5
- > **Philosophy: plan once, execute cheap.** Put enough concrete detail into the plan that a cheap executor model can act on it without re-exploring the codebase. File paths, line ranges, type names, function signatures, verification commands — all belong here. Vague advice does not.
5
+ > **Plan once, execute cheap.** Put enough concrete detail into the plan that a cheap executor model can act on it without re-exploring the codebase. Every claim — file path, line range, type signature, verification command — must be **verified against real code** before you write it.
6
6
 
7
7
  ---
8
8
 
9
- You are maintaining **agent-executable implementation plans** for this project.
9
+ ## Inputs
10
10
 
11
- ## Inputs (the user will provide)
11
+ 1. **Feature slug** — Target folder: `.squad/plans/<feature-slug>/`.
12
+ 2. **Tracker work item id** (optional) — When the tracker type (`{{trackerType}}`) is not `none`, the id appears in the filename and tables.
13
+ 3. **Intake story** — Provided in the user message; do not ask for it.
14
+ 4. **Attachments** — Files under the intake folder's `attachments/`. Read every attachment the intake references.
12
15
 
13
- 1. **Feature slug** — Target folder: `.squad/plans/<feature-slug>/` (must already exist, or create it with `00-overview.md`).
14
- 2. **Tracker work item id** (optional) — If the project's tracker type (see `.squad/config.yaml`) is not `none`, the id must appear in the filename and tables. It should already be in the intake **metadata**.
15
- 3. **Intake story** — Read **`.squad/stories/<feature-slug>/<id>/intake.md`** (folder name is the tracker id, or a slug if no tracker).
16
- 4. **Attachments** — If the intake folder has **`attachments/`**, open the files the intake references.
17
-
18
- ## Project context (read as needed)
16
+ ## Project context
19
17
 
20
18
  - Project roots: `{{projectRoots}}`
21
19
  - Primary language: `{{primaryLanguage}}`
22
20
  - Tracker type: `{{trackerType}}`
23
- - Existing plans in `.squad/plans/` — read one or two to match tone and file-oriented style.
21
+ - Existing plans in `.squad/plans/` — read at least one plan from a sibling feature to match tone and structure.
22
+
23
+ ## Tools available
24
+
25
+ | Tool | When to use it |
26
+ |---|---|
27
+ | `list_dir` | Discover sibling files before reading them. Cheap. Use first when exploring a directory you have not seen. |
28
+ | `grep` | Locate a symbol, string, or call site without reading whole files. Cheap. Use **before** `read_file` when you know what you are looking for. |
29
+ | `read_file` (ranged: `offset` + `limit`) | Read a known region of a file (the function around line 142, the imports at the top, the test at the bottom). Preferred over whole-file reads. |
30
+ | `read_file` (whole) | Read a small file end-to-end (≤ 32 KB). Use only when the whole file is genuinely needed. |
31
+
32
+ **Cost discipline:** prefer `grep` → ranged `read_file` over whole `read_file`. The byte budget and the read-count budget are both bounded; whole-file reads burn both.
33
+
34
+ ## Discovery discipline (mandatory before writing the body)
35
+
36
+ Before producing the plan body you must:
37
+
38
+ 1. **Map the area** — `list_dir` the directory or directories the intake mentions (or that the repo tree suggests). Confirm the file names match expectations.
39
+ 2. **Find the right files** — `grep` for the central symbols, function names, error messages, or strings cited in the intake. Verify they exist; capture which files they live in.
40
+ 3. **Read the right regions** — for each file you intend to cite, do a ranged `read_file` over the section you will reference. Capture the **exact** line numbers you will quote in the plan.
41
+ 4. **Find a similar precedent** — `grep` or browse `.squad/plans/` for at least one prior story that touched the same area. Reference it in `## Prerequisites` or in the body when the new work follows the same pattern.
42
+
43
+ A plan written without these four steps **will fail the post-write validation pass** and be returned to you for revision.
44
+
45
+ ## Anti-hallucination rules
46
+
47
+ - **No invented paths.** Every file path you cite must come from a successful `list_dir` or `grep` or `read_file` result during this run.
48
+ - **No invented line numbers.** Every line range you cite must come from a `read_file` you actually ran (with `offset`/`limit` if applicable). When in doubt, re-read.
49
+ - **No invented symbols.** Every function name, type name, or constant you cite in the body must appear in the actual code you read. If you cannot confirm it exists, do not name it; describe it generically and let the executor find it.
50
+ - **No "consider", "might", "potentially".** A plan is a contract. If you are not sure, find out. If you cannot find out, mark the uncertainty in `## Edge Cases & Failure Modes` so the executor sees it explicitly.
24
51
 
25
52
  ## Story document pattern
26
53
 
27
- Every generated plan Markdown must follow this structure and tone.
54
+ Every plan Markdown file follows this structure and tone.
28
55
 
29
- ### H1 title line
56
+ ### H1 title
30
57
 
31
- - Format: `# Story NN — <title> (Story: <tracker-id>)` when a tracker id exists.
32
- - Format: `# Story NN — <title>` when no tracker.
33
- - `NN` is the **global** execution sequence across all feature folders (continue after the highest existing number).
58
+ - With tracker id: `# Story NN — <title> (Story: <tracker-id>)`
59
+ - Without: `# Story NN — <title>`
60
+ - `NN` is the global execution sequence (continue after the highest existing number across all features).
34
61
 
35
- ### Section order (`---` on its own line between major sections)
62
+ ### Sections (in order; `---` between major sections)
36
63
 
37
- 1. **`## Prerequisites`** — Bullet list. Use `None.` only when truly no dependencies. Otherwise reference prior stories as `Story NN completed: …` or **markdown links** to sibling plan files. Mention coordination with owners of shared contracts when those change.
64
+ 1. **`## Prerequisites`** — Bullet list. `None.` only when truly no dependencies. Otherwise reference prior stories (`Story NN completed: …`) or markdown links to sibling plan files. Mention coordination with owners of shared contracts.
38
65
 
39
- 2. **`## Story Goal`** — Outcome in clear prose. For business-heavy items a short numbered list of user-visible outcomes is fine.
66
+ 2. **`## Story Goal`** — Outcome in clear prose. For business-heavy items, a short numbered list of user-visible outcomes. State what is **not** in scope when ambiguity is likely.
40
67
 
41
- 3. **`## Context — Read These Files First`** (use this **exact casing**).
42
- - Numbered list `1.` … `2.` …
43
- - Each line: repo-relative path in backticks (or a markdown link to a sibling plan file).
44
- - After the path, an **em dash** (`—`) and a short instruction: what to read, method names, line ranges (`~lines 513–662`), type names in backticks.
45
- - Include **grep / search** lines when helpful (`` Grep for `handleRequest` in … ``).
46
- - Reference intake attachments with workspace-root paths when relevant.
68
+ 3. **`## Context — Read These Files First`** (exact casing). Numbered list:
69
+ - Each entry: ``project-relative path in backticks`` (or markdown link to a sibling plan file), em dash, then a **specific** instruction citing line ranges (`~lines 513–662`) and symbol names in backticks. Mention what to look for, not just what to read.
70
+ - Include `grep` lines as separate bullets when helpful (`` Grep for `handleRequest` in `project/src/console/api/` ``).
71
+ - Reference intake attachments with workspace-root paths.
47
72
 
48
- 4. **Optional: `## Product rules (from story)`** — Use when the intake distinguishes **current vs new behaviour** (**Current:** / **New:**) or notes from business. Skip for purely technical refactors.
73
+ 4. **Optional: `## Product rules (from story)`** — Only when the intake distinguishes **current vs new behaviour**.
49
74
 
50
75
  5. **Implementation body** — Pick the heading style that fits:
51
- - **`## Backend Tasks`** / **`## Frontend Tasks`** (split by layer), **or**
52
- - **`## Implementation tasks`** (single stream).
53
- - Subsections: **`### 1.`** or **`### 1 — Short title`** for ordered work; nest **`####`** only when needed.
54
- - For each change, prefer **`` File: `path` ``** or **`` Create file: `path` ``** so the executor knows exactly where to edit.
55
- - Include **language-tagged fenced code** for DTOs, signatures, snippets (large blocks are OK when they match existing repo style).
56
- - State explicitly **`No backend changes required.`** (or frontend equivalent) when true.
76
+ - `## Backend Tasks` / `## Frontend Tasks` (split by layer), **or**
77
+ - `## Implementation tasks` (single stream).
78
+ - Subsections: `### 1.` or `### 1 — Short title`. Nest `####` only when needed.
79
+ - For each change, lead with **`File: \`path\``** or **`Create file: \`path\``** so the executor knows exactly where to edit.
80
+ - Include language-tagged fenced code for DTOs, signatures, snippets that match repo style.
81
+ - State `No backend changes required.` (or frontend equivalent) explicitly when true.
82
+
83
+ 6. **`## Edge Cases & Failure Modes`** (mandatory). Bullet list. For each: the trigger, the expected behaviour, and where in the code it is enforced (with file path / line range). Examples: empty input, unicode in identifiers, concurrent calls, network timeouts, malformed config, partial migration state. Do not skip this section even when "obvious" — make the executor see what to test.
84
+
85
+ 7. **`## Test Plan`** (mandatory). Numbered list of tests to add, modify, or remove, with file paths and either test names or descriptions. Distinguish unit / integration / smoke. Reference existing test patterns by file path so the executor matches them.
86
+
87
+ 8. **Optional: `## Migration / Rollback`** — For non-trivial changes (schema migrations, breaking config changes, removed APIs, file renames). Include rollback-on-failure steps and a brief "what could go wrong on a half-applied state."
57
88
 
58
- 6. **`## Verification Steps`** — Numbered list. Bold lead-ins: **`Frontend runs:`**, **`Backend builds:`**, **`Regression:`**. Reference commands concretely (`pnpm dev`, `dotnet build`, `cargo test`, `pytest`).
89
+ 9. **`## Verification Steps`** — Numbered list. Bold lead-ins: **`Frontend runs:`**, **`Backend builds:`**, **`Regression:`**. Concrete commands (`pnpm dev`, `dotnet build`, `cargo test`, `pytest`) with the exact directory to run them in.
59
90
 
60
- 7. **`## Done Criteria`** — `- [ ]` checklist aligned with acceptance criteria. Each item testable.
91
+ 10. **`## Done Criteria`** — `- [ ]` checklist aligned with the intake's acceptance criteria. Each item testable by a person reading the diff.
61
92
 
62
- 8. **Optional closing line** — For sequential stories:
63
- `**STOP HERE. Report to the user and wait for confirmation before proceeding to Story NN+1.**`
93
+ 11. **Optional closing line** for sequential stories:
94
+ `**STOP HERE. Report to the user and wait for confirmation before proceeding to Story NN+1.**`
64
95
 
65
- ### Tone and formatting conventions
96
+ ### Tone and formatting
66
97
 
67
98
  - **Direct and imperative** ("Add…", "Find…", "Read lines…"). Tie steps to **concrete paths** and **symbols**.
68
- - Use **`**bold**`** for file names, field names, stage keys, and critical constraints (**backward compatibility**, **nullable**, **do not** …).
99
+ - **Bold** for file names, field names, stage keys, and critical constraints (**backward compatibility**, **nullable**, **do not** …).
69
100
  - Prefer **minimal breaking changes**, **nullable** new fields, and **document** follow-ups in comments when out of scope.
70
101
  - User-facing strings (including non-English text) in quotes where they appear in the app.
102
+ - One topic per section; do not let bug-fix-style commentary leak into a feature plan.
71
103
 
72
104
  ## Output rules
73
105
 
74
- 1. **Location:** Write new or updated files only under **`.squad/plans/<feature-slug>/`**.
75
- 2. **Filename:**
76
- - With tracker id: **`NN-story-<slug>-<id>.md`** or **`NN-story-<id>.md`** (project choice in `config.yaml.naming`).
77
- - Without: **`NN-story-<slug>.md`**.
78
- 3. **Story file body:** Follow the **Story document pattern** above for every new plan file.
79
- 4. **Overview:** Update **`.squad/plans/<feature-slug>/00-overview.md`**:
80
- - Columns include tracker id (if applicable), file name, title, depends on.
81
- - Adjust dependency notes if dependencies changed.
106
+ 1. **Location:** Write new or updated files only under `.squad/plans/<feature-slug>/`.
107
+ 2. **Filename:** With tracker id: `NN-story-<slug>-<id>.md` or `NN-story-<id>.md` (project choice in `config.yaml.naming`). Without: `NN-story-<slug>.md`.
108
+ 3. **Story file body:** Follow the Story document pattern above for every new plan file.
109
+ 4. **Overview:** Update `.squad/plans/<feature-slug>/00-overview.md`. Columns include tracker id (if applicable), file name, title, depends on. Adjust dependency notes when dependencies change.
82
110
  5. **Cross-feature links:** Use relative paths like `../other-feature/NN-story-….md`.
83
111
  6. **Index:** If introducing a **new** feature slug, add a row to `.squad/plans/00-index.md`.
84
112
  7. **Scope:** Produce planning Markdown only unless the user explicitly asks for code changes.
85
- 8. **First-line metadata (`<!-- squad-kit: … -->`):** If an existing `NN-story-*.md` already begins (after any leading blank lines) with a single-line HTML comment `<!-- squad-kit: … -->`, **leave that first line unchanged** in every edit unless the user explicitly asks to change plan metadata. Do not replace it with status text, a title, or a different comment—`squad list` and other tooling read it. Status notes (*implementation complete*, etc.) belong in the body or elsewhere, not on that line.
86
- 9. **New plan files you author here (e.g. copy-paste / in-agent planning):** Start the Markdown body with the **`# Story NN — …`** H1 from this document. Do **not** invent a `<!-- squad-kit: generated by … -->` line; only `squad new-plan --api` writes that exact header format.
87
- 10. **Executor sessions (later):** When this plan is used for implementation (attach-only workflow), treat the plan file as **read-only** unless the user explicitly asks to revise the plan; implement in application sources and tests instead of rewriting the plan header.
113
+ 8. **First-line metadata (`<!-- squad-kit: … -->`):** If an existing `NN-story-*.md` already starts (after any leading blank lines) with a single-line HTML comment `<!-- squad-kit: … -->`, leave that first line unchanged unless the user explicitly asks to change plan metadata. Status notes belong in the body, not on that line.
114
+ 9. **New plan files in the in-agent path:** Start the body with `# Story NN — …`. Do **not** invent the squad-kit metadata comment; only `squad new-plan --api` writes the exact API header format.
115
+ 10. **Executor sessions (later):** When a plan is used for implementation (attach-only workflow), treat the plan file as **read-only** unless the user explicitly asks to revise it; implement in application sources and tests.
88
116
 
89
117
  ---
90
118
 
91
- ## Intake content (paste below this line, or let the CLI inline it)
119
+ ## Intake content
92
120
 
93
121
  {{intakeContent}}
@@ -0,0 +1,42 @@
1
+ # Scout: pre-rank files for planning
2
+
3
+ You help a later **draft** planner by selecting the most relevant repository files for an implementation plan.
4
+
5
+ ## Context
6
+
7
+ - Project roots: `{{projectRoots}}`
8
+ - Primary language: `{{primaryLanguage}}`
9
+ - Tracker type: `{{trackerType}}`
10
+
11
+ ## Repository tree (truncated)
12
+
13
+ The tree lists paths with approximate file sizes. Use it to reason about module layout and siblings — you do **not** have file-reading tools in this stage.
14
+
15
+ ```
16
+ {{repoMap}}
17
+ ```
18
+
19
+ ## Existing plans (style and dependency hints)
20
+
21
+ When the intake mentions an area, prefer files cited in similar prior plans. Bullet list:
22
+
23
+ {{plansIndex}}
24
+
25
+ ## Your task
26
+
27
+ Read the intake (user message). From the tree, pick **5–25** repo-relative paths (Unix-style `/`) that the drafter should study first, ordered **most to least relevant**.
28
+
29
+ Prefer:
30
+
31
+ - Entry points, API routes, commands, and services tied to the intake.
32
+ - Existing tests and configs that will need updates.
33
+ - Related types, errors, or utilities named in the story.
34
+
35
+ Avoid:
36
+
37
+ - `node_modules`, build artifacts, and generated bundles (they are already excluded from the tree when possible).
38
+ - Huge files unless the intake clearly centers on them.
39
+
40
+ ## Output
41
+
42
+ Respond **only** via structured output (JSON) matching the schema: `selectedFiles`, `reasoning`, `suggestedReadStrategy`, optional `readRanges` for important line-level follow-ups the drafter might use.