Skip to content

Commit 87846ef

Browse files
tylergraydevTyler Grayclaude
authored
fix(types): close 26 svelte-check errors via SubAgent type drift (#214 PR2) (#226)
Second of the cleanups proposed in #214 (Group A). Purely additive field updates — no behavior changes. Brings `npm run check` from 53 -> 27 errors (closes 26). ## What was wrong `SubAgentForm.svelte` reads and writes nine fields that the type contracts never exposed. The reads/writes are correct — the data round-trips through `settings.json`, the Rust `subagents` table (20 columns, all present in `subagents.rs` and `subagent_writer.rs`), and Tauri — but `$lib/types` and `markdownParser` had drifted, so the errors piled up silently. ## Changes - `subagent.ts` — add `disallowedTools`, `maxTurns`, `memory`, `background`, `effort`, `isolation`, `hooks`, `mcpServers`, `initialPrompt` to both `SubAgent` (read via `Partial<SubAgent>` as the form's `initialValues`) and `CreateSubAgentRequest` (the object the form's `handleSubmit` builds). Types match the Rust struct: string arrays, a numeric `maxTurns`, a boolean `background`, the rest strings. - `markdownParser.ts` — add the seven fields that `applyParsedSubAgent` assigns to `ParsedSubAgent` (`hooks`/`mcpServers` excluded — the paste/import path doesn't touch them). ## Maps to #214 groups Closes group **A** (SubAgent / ParsedSubAgent type drift, 26 errors). The remaining 27 errors fall into #214's groups B, D, E, H, K, M — targets for follow-up PRs. ## Test plan - [x] `npm run check` — 27 errors (down from 53 on `main`) - [x] `npx vitest run` — 1565/1565 tests pass - [x] Verified zero NEW errors (remaining 27 all pre-existing, map to #214's other groups) Co-authored-by: Tyler Gray <tylerg@emergentsoftware.net> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 85d9921 commit 87846ef

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

src/lib/types/subagent.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ export interface SubAgent {
88
permissionMode?: string;
99
skills?: string[];
1010
tags?: string[];
11+
disallowedTools?: string[];
12+
maxTurns?: number;
13+
memory?: string;
14+
background?: boolean;
15+
effort?: string;
16+
isolation?: string;
17+
hooks?: string;
18+
mcpServers?: string;
19+
initialPrompt?: string;
1120
source: string;
1221
sourcePath?: string;
1322
isFavorite: boolean;
@@ -24,6 +33,15 @@ export interface CreateSubAgentRequest {
2433
permissionMode?: string;
2534
skills?: string[];
2635
tags?: string[];
36+
disallowedTools?: string[];
37+
maxTurns?: number;
38+
memory?: string;
39+
background?: boolean;
40+
effort?: string;
41+
isolation?: string;
42+
hooks?: string;
43+
mcpServers?: string;
44+
initialPrompt?: string;
2745
}
2846

2947
export interface ProjectSubAgent {

src/lib/utils/markdownParser.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ export interface ParsedSubAgent {
5050
permissionMode?: string;
5151
skills?: string[];
5252
tags?: string[];
53+
disallowedTools?: string[];
54+
maxTurns?: number;
55+
memory?: string;
56+
background?: boolean;
57+
effort?: string;
58+
isolation?: string;
59+
initialPrompt?: string;
5360
}
5461

5562
export interface ParseResult<T> {

0 commit comments

Comments
 (0)