@skillit/client 0.2.0 → 0.4.0
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/README.md +40 -0
- package/dist/bin.d.ts +2 -1
- package/dist/bin.d.ts.map +1 -1
- package/dist/bin.js +21 -13
- package/dist/bin.js.map +1 -1
- package/dist/commands/audit.d.ts +34 -0
- package/dist/commands/audit.d.ts.map +1 -0
- package/dist/commands/audit.js +139 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/gen.d.ts +21 -0
- package/dist/commands/gen.d.ts.map +1 -0
- package/dist/commands/gen.js +112 -0
- package/dist/commands/gen.js.map +1 -0
- package/dist/commands/init.d.ts +8 -22
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +39 -81
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/refine.d.ts +34 -2
- package/dist/commands/refine.d.ts.map +1 -1
- package/dist/commands/refine.js +61 -29
- package/dist/commands/refine.js.map +1 -1
- package/dist/detect-source.d.ts.map +1 -1
- package/dist/detect-source.js +12 -5
- package/dist/detect-source.js.map +1 -1
- package/dist/generate.d.ts +74 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +68 -0
- package/dist/generate.js.map +1 -0
- package/dist/mcp-mode.d.ts +22 -0
- package/dist/mcp-mode.d.ts.map +1 -0
- package/dist/mcp-mode.js +27 -0
- package/dist/mcp-mode.js.map +1 -0
- package/dist/model/anthropic.d.ts +11 -0
- package/dist/model/anthropic.d.ts.map +1 -1
- package/dist/model/anthropic.js +16 -2
- package/dist/model/anthropic.js.map +1 -1
- package/dist/model/cli/adapters.d.ts.map +1 -1
- package/dist/model/cli/adapters.js +35 -2
- package/dist/model/cli/adapters.js.map +1 -1
- package/dist/model/cli/cli-client.d.ts.map +1 -1
- package/dist/model/cli/cli-client.js +4 -2
- package/dist/model/cli/cli-client.js.map +1 -1
- package/dist/postinstall-template.d.ts +2 -0
- package/dist/postinstall-template.d.ts.map +1 -0
- package/dist/postinstall-template.js +61 -0
- package/dist/postinstall-template.js.map +1 -0
- package/dist/program.d.ts +12 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +42 -0
- package/dist/program.js.map +1 -0
- package/dist/typedoc-entry.d.ts +6 -0
- package/dist/typedoc-entry.d.ts.map +1 -0
- package/dist/typedoc-entry.js +14 -0
- package/dist/typedoc-entry.js.map +1 -0
- package/package.json +18 -7
- package/skills/skillit-bootstrap/SKILL.md +115 -0
- package/skills/skillit-bootstrap/references/surface-routing.md +108 -0
- package/CHANGELOG.md +0 -32
- package/scripts/gen-refine-cli-skill.mjs +0 -48
- package/src/__tests__/anthropic-model.test.ts +0 -45
- package/src/__tests__/anthropic-prompt.test.ts +0 -102
- package/src/__tests__/cli-adapters.test.ts +0 -119
- package/src/__tests__/cli-client.test.ts +0 -58
- package/src/__tests__/cli-run.test.ts +0 -52
- package/src/__tests__/detect-mode.test.ts +0 -114
- package/src/__tests__/detect-source.test.ts +0 -158
- package/src/__tests__/fixtures/bin-with-program.mjs +0 -6
- package/src/__tests__/init.test.ts +0 -218
- package/src/__tests__/model-client-factory.test.ts +0 -28
- package/src/__tests__/refine-resolve.test.ts +0 -72
- package/src/bin.ts +0 -18
- package/src/commands/init.ts +0 -207
- package/src/commands/refine.ts +0 -261
- package/src/detect-mode.ts +0 -94
- package/src/detect-source.ts +0 -123
- package/src/index.ts +0 -3
- package/src/model/anthropic.ts +0 -116
- package/src/model/cli/adapters.ts +0 -178
- package/src/model/cli/cli-client.ts +0 -52
- package/src/model/cli/run.ts +0 -83
- package/src/model/model-client-factory.ts +0 -62
- package/src/model/models.ts +0 -7
- package/tsconfig.build.json +0 -9
- package/tsconfig.json +0 -4
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skillit-bootstrap
|
|
3
|
+
description: 'Bootstrap an AI-agent skill from a TypeScript codebase by running the deterministic skillit generate/audit loop and enriching repo source (JSDoc, README, config-type properties, MCP tool annotations, examples, package.json) until the skill reaches its grade target. Use for cli, typedoc, config, or mcp (build-mode) projects; never edit SKILL.md/references directly.'
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
toSkills:
|
|
6
|
+
managed: bundled-orchestrator
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# skillit-bootstrap
|
|
10
|
+
|
|
11
|
+
Bootstrap a high-quality AI-agent skill from a TypeScript codebase. You run the
|
|
12
|
+
deterministic skillit pipeline, read its machine-readable findings, and enrich
|
|
13
|
+
the **repo source** (JSDoc, README, examples, package.json) until the generated
|
|
14
|
+
skill reaches its grade target. skillit owns the skill output; you own the
|
|
15
|
+
inputs.
|
|
16
|
+
|
|
17
|
+
## The one hard rule
|
|
18
|
+
|
|
19
|
+
**Never create or edit any `SKILL.md` or `references/*.md` for the target
|
|
20
|
+
project.** Those are pure outputs of `skillit gen` — regenerated every pass. You
|
|
21
|
+
edit only repo _source surfaces_. If you find yourself about to write a
|
|
22
|
+
`SKILL.md`, stop: the fix belongs in the source the skill is generated from.
|
|
23
|
+
|
|
24
|
+
## When to use
|
|
25
|
+
|
|
26
|
+
- A `cli` (Commander), `typedoc` (TypeScript library), `config` (a TypeScript
|
|
27
|
+
config type), or `mcp` (an MCP server whose TS source you own — "build mode")
|
|
28
|
+
project that needs a generated agent skill, or whose skill scores below its
|
|
29
|
+
grade target.
|
|
30
|
+
- Run after the project is set up with the right `@skillit/*` package (see
|
|
31
|
+
step 1).
|
|
32
|
+
- **Third-party MCP servers you cannot edit** are out of scope here: with no
|
|
33
|
+
editable source, the skill is produced from an overlay ("runtime mode") via
|
|
34
|
+
`skillit refine`. This loop targets the build-mode (own-source) path. See
|
|
35
|
+
`references/surface-routing.md`.
|
|
36
|
+
|
|
37
|
+
## Inputs
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
/skillit-bootstrap [--source cli|typedoc|config|mcp] [--program <file#export>]
|
|
41
|
+
[--config-type <file#export>] [--mcp <path>] [--server <name>]
|
|
42
|
+
[--out <dir>] [--grade A|B|C] [--max-iterations <n>]
|
|
43
|
+
[--ground <glob>...]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- `--source` — override detection (`cli`, `typedoc`, `config`, or `mcp`).
|
|
47
|
+
- `--program` — Commander program entry for the cli source (`./dist/cli.js#program`).
|
|
48
|
+
- `--config-type` — config type entry for the config source (`./src/config.ts#MyConfig`).
|
|
49
|
+
- `--mcp` — path to `mcp.json` / MCP config file (mcp source).
|
|
50
|
+
- `--server` — MCP server entry to select when the config lists several (mcp source).
|
|
51
|
+
- `--out` — skill output dir (default `skills`).
|
|
52
|
+
- `--grade` — override the kind-aware target (below).
|
|
53
|
+
- `--max-iterations` — hard cap on enrich/regenerate passes (default 5).
|
|
54
|
+
- `--ground <glob>` — consumer/implementation code you MUST read before writing
|
|
55
|
+
any runtime-behavior pitfall, so your claims reflect real behavior, not guesses.
|
|
56
|
+
|
|
57
|
+
## The loop
|
|
58
|
+
|
|
59
|
+
1. **Set up once.** Determine the source kind (honor `--source`, else infer:
|
|
60
|
+
`commander`/`yargs` dep → cli; `@modelcontextprotocol/sdk` dep → mcp;
|
|
61
|
+
otherwise a TS library → typedoc). `config` is never auto-detected — select it
|
|
62
|
+
explicitly with `--config-type <file#export>`. Each kind has its own selector:
|
|
63
|
+
cli → `--program`, config → `--config-type`, mcp → `--mcp` (+ optional
|
|
64
|
+
`--server`); typedoc needs none. If the project has no `@skillit/*` package
|
|
65
|
+
installed yet, run `skillit init --source <kind>` once (it installs + wires
|
|
66
|
+
only; it does not generate).
|
|
67
|
+
2. **Generate.** Run `skillit gen --source <kind> <selector> [--out …]` (the
|
|
68
|
+
selector is the kind's from step 1). This deterministically produces the skill
|
|
69
|
+
from current source. Never hand-edit its output. (For mcp, `gen` spins up the
|
|
70
|
+
server to introspect it, so the source skill is a function of a deterministic
|
|
71
|
+
server.)
|
|
72
|
+
3. **Audit.** Run `skillit audit --source <kind> <selector> --json` and read
|
|
73
|
+
the JSON: `estimate.grade`, `estimate.dimensions` (D1–D8), and
|
|
74
|
+
`improvements[]`. Each improvement carries `suggestion`, `dimension`,
|
|
75
|
+
`targets: [{file, name, kind}]`, and (when resolvable) `resolvedLocations[]`
|
|
76
|
+
pointing at the exact file + declaration to edit. **These targets are your
|
|
77
|
+
work queue.**
|
|
78
|
+
4. **Enrich the source.** For each addressable finding, open the cited source
|
|
79
|
+
file and write the missing content on the named symbol/section/key, choosing
|
|
80
|
+
the surface the suggestion names. The surface → audit-code map and the
|
|
81
|
+
edit-vs-create guidance are in `references/surface-routing.md`. Before writing
|
|
82
|
+
any _runtime-behavior_ pitfall, read the relevant implementation (`--ground`
|
|
83
|
+
globs) — do not invent semantics from a type signature.
|
|
84
|
+
- Prefer the `upsertJsDocTag` / `upsertPropertyJsDocTag` helpers (exported
|
|
85
|
+
from `@skillit/core`) for JSDoc-tag writeback rather than free-hand
|
|
86
|
+
splicing — they handle `*/` escaping and multi-line prefixing.
|
|
87
|
+
- You may also **create** a new parseable artifact when that is the better
|
|
88
|
+
home (a `docs/<guide>.md`, an `examples/<name>.ts`, a missing README
|
|
89
|
+
section) — but only of a type an existing parser already consumes, and
|
|
90
|
+
never a `SKILL.md`.
|
|
91
|
+
5. **Regenerate + re-audit.** Re-run step 2 then step 3. Compare the new
|
|
92
|
+
`estimate` to the previous pass.
|
|
93
|
+
6. **Decide convergence** (your judgment, using these signals):
|
|
94
|
+
- **Pass** — `estimate.grade` ≥ the target. Default target is _kind-aware_:
|
|
95
|
+
typedoc/library → **A** (every export is introspectable); cli adapter-model
|
|
96
|
+
→ **B**, config → **B**, mcp → **B** — these surfaces structurally cap below
|
|
97
|
+
A (a cli command tree isn't enumerated per-symbol; a config type has no
|
|
98
|
+
functions/params, so per-option routing + one example file is its ceiling;
|
|
99
|
+
mcp reaches **A** only if every tool handler carries full JSDoc). `--grade`
|
|
100
|
+
overrides.
|
|
101
|
+
- **Plateau** — the score did not rise AND every remaining finding targets a
|
|
102
|
+
symbol that genuinely has nothing more to truthfully say. You can _see_ the
|
|
103
|
+
source, so distinguish "legitimately complete" from "stuck re-drafting" —
|
|
104
|
+
stop on the former.
|
|
105
|
+
- **Cap** — never exceed `--max-iterations` (default 5).
|
|
106
|
+
7. **Report.** Print the final grade, the D1–D8 breakdown, the list of source
|
|
107
|
+
files you enriched, and any remaining findings you judged un-addressable with
|
|
108
|
+
a one-line rationale each. This is the human review surface; the user commits
|
|
109
|
+
the result.
|
|
110
|
+
|
|
111
|
+
## After convergence
|
|
112
|
+
|
|
113
|
+
Tell the user to review the enriched source diffs and the regenerated skill,
|
|
114
|
+
then commit. Remind them the skill is reproducible: `skillit gen` on the same
|
|
115
|
+
source yields byte-identical output, so the source diff is the real change.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Enrichment surface routing
|
|
2
|
+
|
|
3
|
+
For each audit finding, edit the **source surface** named here — never the
|
|
4
|
+
generated `SKILL.md`. The audit `suggestion` text already names the surface;
|
|
5
|
+
this table is the quick reference. (Source: skillit architecture spec §2.3/§4.)
|
|
6
|
+
|
|
7
|
+
| Audit codes | Enrichment surface (what you edit) | How |
|
|
8
|
+
| ------------------ | ---------------------------------- | -------------------------------------------------------------------------- |
|
|
9
|
+
| F4 | Symbol JSDoc summary | `/** … */` on the function/class/type/enum/variable |
|
|
10
|
+
| E1, E2 | `@param` / `@returns` prose | on parameters and non-void returns |
|
|
11
|
+
| E3 | Interface/type property JSDoc | `/** … */` on each property |
|
|
12
|
+
| W7, W8, W9 | Routing tags | `@useWhen` / `@avoidWhen` / `@never` (render as pitfalls) |
|
|
13
|
+
| W10, W11, W3 | Depth tags | `@remarks` (complex fns), `@category`, `@since`/`@throws`/`@see` |
|
|
14
|
+
| W1, W5 | Module docs | `@packageDocumentation` summary + `@remarks` |
|
|
15
|
+
| E4, W2 | Examples | sibling `*.example.ts` / `examples/*`, or `@example` blocks on key exports |
|
|
16
|
+
| F3, W5, W6, A4 | README sections | Features / Troubleshooting / Quick Start, intro blockquote |
|
|
17
|
+
| F1, F2, E5, W4, A1 | package.json metadata | `description`, `keywords` (≥5, ≥3 domain), `repository` |
|
|
18
|
+
|
|
19
|
+
Use the `upsertJsDocTag` / `upsertPropertyJsDocTag` helpers (exported from
|
|
20
|
+
`@skillit/core`) for tag writeback — they escape `*/` and prefix multi-line
|
|
21
|
+
content correctly. Free-hand JSDoc splicing is error-prone.
|
|
22
|
+
|
|
23
|
+
## Edit vs. create
|
|
24
|
+
|
|
25
|
+
Editing an existing surface is the common move, but you may **create** a new
|
|
26
|
+
artifact when it is the better home for missing content — e.g.:
|
|
27
|
+
|
|
28
|
+
- a `docs/<guide>.md` page (consumed by skillit's docs scanner → `skill.documents`);
|
|
29
|
+
- an `examples/<name>.ts` or sibling `*.example.ts` (consumed by the examples scanner);
|
|
30
|
+
- a `## Troubleshooting` / `## Features` section a README lacks.
|
|
31
|
+
|
|
32
|
+
Hard constraint: the new artifact must be a type an existing skillit parser
|
|
33
|
+
already consumes — **no new parser**, and never a `SKILL.md`.
|
|
34
|
+
|
|
35
|
+
## Finite vs. coverage-gated findings (size the work before you start)
|
|
36
|
+
|
|
37
|
+
Audit improvements come in two shapes — tell them apart before deciding how far
|
|
38
|
+
a finding can move the grade:
|
|
39
|
+
|
|
40
|
+
- **Finite / complexity-gated** (e.g. `@remarks` on functions with 3+ params,
|
|
41
|
+
`@category` grouping): the target set is small and enumerable. The
|
|
42
|
+
`targets[]` list **is** the whole job — close it and the dimension moves.
|
|
43
|
+
- **Coverage-gated / all-or-nothing** (the D8 `@param` / `@returns` / property
|
|
44
|
+
JSDoc checks E1/E2/E3): the check fails on the **first** undocumented member
|
|
45
|
+
across the _entire_ public surface, so the points only land at ~100%
|
|
46
|
+
coverage. Here `targets[]` is only a **sample** — closing the listed symbols
|
|
47
|
+
does **not** flip the gate. Before committing, get the true remaining count
|
|
48
|
+
(`audit … --json` issue list, grouped by code) and decide: either do the full
|
|
49
|
+
sweep, or stop and report the gap. Do **not** write filler prose on internal
|
|
50
|
+
helpers just to chase the gate — that is the anti-pattern this skill exists to
|
|
51
|
+
prevent.
|
|
52
|
+
|
|
53
|
+
## Grounding runtime claims
|
|
54
|
+
|
|
55
|
+
Before writing any pitfall or `@never`/`@avoidWhen` rule that asserts _runtime
|
|
56
|
+
behavior_, read the implementation (the `--ground` globs, or the function body).
|
|
57
|
+
A fluent, well-structured claim that is factually wrong is invisible to the
|
|
58
|
+
deterministic audit — the safeguard is that you actually read the code.
|
|
59
|
+
|
|
60
|
+
## Per-kind headline surface
|
|
61
|
+
|
|
62
|
+
The table above is kind-independent (any project has README + package.json). The
|
|
63
|
+
_headline judgment_ of the skill lives in a kind-specific surface:
|
|
64
|
+
|
|
65
|
+
- **typedoc** — per-symbol JSDoc on exported functions/classes/types (the richest
|
|
66
|
+
surface; every export is introspectable). Writeback: `upsertJsDocTag`.
|
|
67
|
+
- **cli** — JSDoc on the command's `<Command>Options` interface; `CliRefineSource`
|
|
68
|
+
correlates the option-interface tags onto the command surface.
|
|
69
|
+
- Targets have `kind: "command"` and map to `<PascalName>Options`
|
|
70
|
+
(e.g. `callHierarchy` → `CallHierarchyOptions`).
|
|
71
|
+
- **`resolvedLocations` null** → the interface doesn't exist yet. Create it in
|
|
72
|
+
any `.ts` file inside the source glob (e.g. `src/command-options.ts`). No
|
|
73
|
+
properties needed — only the JSDoc block:
|
|
74
|
+
```ts
|
|
75
|
+
/** @useWhen - <scenario> @avoidWhen - <alt> @never - NEVER … Fix: … */
|
|
76
|
+
interface CallHierarchyOptions {}
|
|
77
|
+
```
|
|
78
|
+
After `skillit gen` + re-audit, `resolveTargetLocation` will find the interface
|
|
79
|
+
and subsequent `skillit refine` passes can write tags into it directly.
|
|
80
|
+
- For an adapter-model CLI (no static command tree), enrich the stable exported
|
|
81
|
+
symbols together with `@packageDocumentation` instead.
|
|
82
|
+
- **config** — **per-property** JSDoc on the config type's properties:
|
|
83
|
+
`@useWhen`/`@avoidWhen`/`@pitfalls`/`@remarks` on each option, plus a sibling
|
|
84
|
+
`<config>.example.ts` (written only if absent — never clobbered) for the
|
|
85
|
+
example finding. Findings carry a dot-path `configKey`; `resolveTargetLocation`
|
|
86
|
+
returns `{ file, declName, propertyPath }`. Writeback: `upsertPropertyJsDocTag`.
|
|
87
|
+
- **Tag note:** the config surface authors pitfalls as **`@pitfalls`** (what
|
|
88
|
+
`config-extract` reads), NOT `@never` (the typedoc/JSDoc surface's tag — see
|
|
89
|
+
spec §4.2 naming note). On a config option, `@never` is silently ignored.
|
|
90
|
+
`@category` is likewise not scored on config options — don't chase it there.
|
|
91
|
+
- **mcp (build mode)** — JSDoc on the tool-handler symbols **plus**
|
|
92
|
+
`_meta.toSkills.{useWhen,avoidWhen,pitfalls}` annotations in your TS server
|
|
93
|
+
source. `resolveTargetLocation` resolves a tool to its `{ file, declName }`.
|
|
94
|
+
Writeback: `upsertJsDocTag`. (`gen`/`audit --source mcp --mode build`.)
|
|
95
|
+
- **mcp (runtime mode)** — the server source is **not** editable, so the only
|
|
96
|
+
writable surface is the overlay JSON. This is handled by `skillit refine`'s
|
|
97
|
+
overlay path, **not** this loop — there is nothing to enrich in source.
|
|
98
|
+
|
|
99
|
+
## Scope
|
|
100
|
+
|
|
101
|
+
- **Supported:** `cli` (Commander), `typedoc` (TS library), `config` (a config
|
|
102
|
+
type via `--config-type`), and `mcp` **build mode** (an MCP server whose TS
|
|
103
|
+
source you own, via `--mcp` + optional `--server`).
|
|
104
|
+
- **Runtime mode** (third-party MCP servers, no editable source) is served by
|
|
105
|
+
`skillit refine`'s overlay path, not this loop.
|
|
106
|
+
- Kind-aware grade targets: typedoc → A; cli → B; config → B; mcp → B (A only if
|
|
107
|
+
every tool handler carries full JSDoc). A non-enumerated command tree, a
|
|
108
|
+
function-less config type, and a thinly-annotated tool set each cap below A.
|
package/CHANGELOG.md
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# @skillit/client
|
|
2
|
-
|
|
3
|
-
## 0.2.0
|
|
4
|
-
|
|
5
|
-
### Minor Changes
|
|
6
|
-
|
|
7
|
-
- [#41](https://github.com/pradeepmouli/skillit/pull/41) [`989f899`](https://github.com/pradeepmouli/skillit/commit/989f899fd506f422d67c808bce8b5302f11986c6) Thanks [@pradeepmouli](https://github.com/pradeepmouli)! - - fix(client): guard msg.content[0] access — throw on empty or non-text response
|
|
8
|
-
- fix(typedoc/refine): fix JSDoc closer indentation + use async fs I/O in TypeDocRefineSource
|
|
9
|
-
- feat(client): add skillit bin with refine command
|
|
10
|
-
- feat(client): add AnthropicModelClient (Sonnet drafter, Opus reviewer)
|
|
11
|
-
- feat(client): scaffold @skillit/client package
|
|
12
|
-
|
|
13
|
-
- [#53](https://github.com/pradeepmouli/skillit/pull/53) [`95caa9e`](https://github.com/pradeepmouli/skillit/commit/95caa9e1d0ed3e6562470940b857a83bc8e4a37a) Thanks [@pradeepmouli](https://github.com/pradeepmouli)! - `refine` and `init` gain `--model-client api|claude|codex|copilot`: drive the
|
|
14
|
-
audit→draft→review loop through an already-authenticated agent CLI instead of
|
|
15
|
-
the Anthropic API. Per-CLI adapters (claude maps the drafter/reviewer split to
|
|
16
|
-
Sonnet/Opus; codex/copilot use their default model) reuse the existing prompt
|
|
17
|
-
builders and verdict parser; `--model-cli-timeout` bounds each call. Default
|
|
18
|
-
remains `api`.
|
|
19
|
-
|
|
20
|
-
- [#52](https://github.com/pradeepmouli/skillit/pull/52) [`30e9f03`](https://github.com/pradeepmouli/skillit/commit/30e9f03756bb3596e0cf90bb91beb37dd6bb9c18) Thanks [@pradeepmouli](https://github.com/pradeepmouli)! - Multi-source `refine` (CLI), `skillit init`, ast-grep-based JSDoc editing, and guidance injection.
|
|
21
|
-
- **core**: new `refine/ast-edit.ts` wrapping `@ast-grep/napi` — `upsertJsDocTag`/`readJsDocTags` replace the regex/offset JSDoc surgery; `insertJsDocTag` reimplemented on top of it. `RefineSource.guidance?()` and `guidance` on draft/review requests; `refineSkill` threads the source's bundled guidance skill into every draft/review. `audit-score` surfaces CLI command annotation gaps as work items.
|
|
22
|
-
- **cli**: `CliRefineSource` (extract → bundled `skillit-cli-docs` guidance → JSDoc write-back onto the correlated `*Options` interface); commander program loader (`--program file#export` + `bin` auto-find); `*Options` interface JSDoc reader for loop closure.
|
|
23
|
-
- **client**: `refine` is source-aware — `--source cli|mcp|typedoc` with detection from installed `@skillit/*` packages, plus `--program`; `--mcp` no longer globally required. New `skillit init` command: detect project nature → install the matching package → generate the initial skill into top-level `skills/` → refine (CLI path automated; mcp/typedoc print next-step guidance).
|
|
24
|
-
|
|
25
|
-
### Patch Changes
|
|
26
|
-
|
|
27
|
-
- [#54](https://github.com/pradeepmouli/skillit/pull/54) [`314f9b0`](https://github.com/pradeepmouli/skillit/commit/314f9b0218304e40d6fa6da628fcb112d2940912) Thanks [@pradeepmouli](https://github.com/pradeepmouli)! - Rebrand `@to-skills` → `@skillit`: package scope, a single `skillit` CLI (MCP commands now mounted as `skillit mcp …`), bundled skill names (`skillit-cli-docs`/`skillit-docs`/`skillit-mcp-docs`), and the `package.json` config key (`skillit.mcp`). No API or behavior changes.
|
|
28
|
-
|
|
29
|
-
- Updated dependencies [[`989f899`](https://github.com/pradeepmouli/skillit/commit/989f899fd506f422d67c808bce8b5302f11986c6), [`9699e6f`](https://github.com/pradeepmouli/skillit/commit/9699e6f9896f4153ecdad6b1bbc87ead20e773ef), [`30e9f03`](https://github.com/pradeepmouli/skillit/commit/30e9f03756bb3596e0cf90bb91beb37dd6bb9c18), [`314f9b0`](https://github.com/pradeepmouli/skillit/commit/314f9b0218304e40d6fa6da628fcb112d2940912)]:
|
|
30
|
-
- @skillit/cli@0.4.0
|
|
31
|
-
- @skillit/core@1.5.0
|
|
32
|
-
- @skillit/mcp@0.3.0
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// Dogfood: generate a skill for the `skillit` CLI binary (the `refine` command)
|
|
2
|
-
// using @skillit/cli's own commander introspection.
|
|
3
|
-
//
|
|
4
|
-
// Run via the package script (builds first): pnpm --filter @skillit/client gen-cli-skill
|
|
5
|
-
// Or directly, after building @skillit/client: node packages/client/scripts/gen-refine-cli-skill.mjs
|
|
6
|
-
import { existsSync } from 'node:fs';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
|
-
import { dirname, resolve } from 'node:path';
|
|
9
|
-
import { Command } from 'commander';
|
|
10
|
-
import { extractCliSkill, writeCliSkill } from '@skillit/cli';
|
|
11
|
-
|
|
12
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
13
|
-
const repoRoot = resolve(here, '../../..');
|
|
14
|
-
|
|
15
|
-
// This script reads the refine command from build output. `dist/` is not in the
|
|
16
|
-
// repo by default, so fail with an actionable message rather than a raw
|
|
17
|
-
// ERR_MODULE_NOT_FOUND when it is missing or stale.
|
|
18
|
-
const refineDist = resolve(here, '../dist/commands/refine.js');
|
|
19
|
-
if (!existsSync(refineDist)) {
|
|
20
|
-
console.error(
|
|
21
|
-
`Cannot find ${refineDist}.\nBuild @skillit/client first: pnpm --filter @skillit/client build`
|
|
22
|
-
);
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
const { buildRefineCommand } = await import(refineDist);
|
|
26
|
-
|
|
27
|
-
// Reconstruct the same program shape that packages/client/src/bin.ts ships.
|
|
28
|
-
const program = new Command('skillit').description('skillit CLI').version('0.1.0');
|
|
29
|
-
program.addCommand(buildRefineCommand());
|
|
30
|
-
|
|
31
|
-
const skill = await extractCliSkill({
|
|
32
|
-
program,
|
|
33
|
-
metadata: {
|
|
34
|
-
name: 'skillit-refine',
|
|
35
|
-
description:
|
|
36
|
-
'Autonomously improve an MCP skill via the skillit audit→draft→review loop (build or runtime mode)',
|
|
37
|
-
keywords: ['skillit', 'refine', 'mcp', 'skill-generation', 'cli', 'audit', 'overlay'],
|
|
38
|
-
repository: 'https://github.com/pradeepmouli/skillit'
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
writeCliSkill(skill, { outDir: resolve(repoRoot, 'skills') });
|
|
43
|
-
|
|
44
|
-
const issues = skill.audit?.issues ?? [];
|
|
45
|
-
console.log(`Generated skills/skillit-refine/ — ${issues.length} audit finding(s).`);
|
|
46
|
-
for (const i of issues) {
|
|
47
|
-
console.log(` [${i.severity ?? '?'}] ${i.code ?? ''} ${i.message ?? ''}`.trimEnd());
|
|
48
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// packages/client/src/__tests__/anthropic-model.test.ts
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import { parseReviewVerdict } from '../model/anthropic.js';
|
|
4
|
-
|
|
5
|
-
describe('parseReviewVerdict', () => {
|
|
6
|
-
it('parses accepted verdict', () => {
|
|
7
|
-
const text = 'Looks good. {"verdict":"accepted","feedback":""}';
|
|
8
|
-
expect(parseReviewVerdict(text)).toEqual({ verdict: 'accepted', feedback: '' });
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('parses revise verdict', () => {
|
|
12
|
-
const text = '{"verdict":"revise","feedback":"Be more specific about edge cases"}';
|
|
13
|
-
expect(parseReviewVerdict(text)).toEqual({
|
|
14
|
-
verdict: 'revise',
|
|
15
|
-
feedback: 'Be more specific about edge cases'
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('fails open on malformed JSON — returns accepted', () => {
|
|
20
|
-
expect(parseReviewVerdict('not json at all')).toEqual({ verdict: 'accepted', feedback: '' });
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('fails open on missing verdict field', () => {
|
|
24
|
-
expect(parseReviewVerdict('{"feedback":"ok"}')).toEqual({
|
|
25
|
-
verdict: 'accepted',
|
|
26
|
-
feedback: 'ok'
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('parses revise verdict when feedback contains balanced braces', () => {
|
|
31
|
-
const text = '{"verdict":"revise","feedback":"handle {edge-case} and {null} inputs"}';
|
|
32
|
-
expect(parseReviewVerdict(text)).toEqual({
|
|
33
|
-
verdict: 'revise',
|
|
34
|
-
feedback: 'handle {edge-case} and {null} inputs'
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('parses revise verdict when feedback contains an unbalanced open brace', () => {
|
|
39
|
-
const text = '{"verdict":"revise","feedback":"use {var in templates"}';
|
|
40
|
-
expect(parseReviewVerdict(text)).toEqual({
|
|
41
|
-
verdict: 'revise',
|
|
42
|
-
feedback: 'use {var in templates'
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
});
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
// packages/client/src/__tests__/anthropic-prompt.test.ts
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import { buildDraftPrompt, buildReviewPrompt } from '../model/anthropic.js';
|
|
4
|
-
import type { DraftRequest, ReviewRequest, ExtractedSkill } from '@skillit/core';
|
|
5
|
-
|
|
6
|
-
const baseSkill = (): ExtractedSkill =>
|
|
7
|
-
({ name: 'my-tool', functions: [] }) as unknown as ExtractedSkill;
|
|
8
|
-
|
|
9
|
-
const baseDraftReq = (overrides: Partial<DraftRequest> = {}): DraftRequest => ({
|
|
10
|
-
toolName: 'tool_a',
|
|
11
|
-
tag: 'useWhen',
|
|
12
|
-
suggestion: 'Add @useWhen annotation',
|
|
13
|
-
currentValue: undefined,
|
|
14
|
-
skill: baseSkill(),
|
|
15
|
-
...overrides
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const baseReviewReq = (overrides: Partial<ReviewRequest> = {}): ReviewRequest => ({
|
|
19
|
-
toolName: 'tool_a',
|
|
20
|
-
tag: 'useWhen',
|
|
21
|
-
draft: 'Use this tool when listing files',
|
|
22
|
-
suggestion: 'Add @useWhen annotation',
|
|
23
|
-
skill: baseSkill(),
|
|
24
|
-
...overrides
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
describe('buildDraftPrompt', () => {
|
|
28
|
-
it('includes a Conventions section with guidance text when guidance is provided', () => {
|
|
29
|
-
const req = baseDraftReq({ guidance: 'Always use active voice.' });
|
|
30
|
-
const prompt = buildDraftPrompt(req);
|
|
31
|
-
expect(prompt).toContain('Conventions');
|
|
32
|
-
expect(prompt).toContain('Always use active voice.');
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('does NOT include a Conventions section when guidance is undefined', () => {
|
|
36
|
-
const req = baseDraftReq({ guidance: undefined });
|
|
37
|
-
const prompt = buildDraftPrompt(req);
|
|
38
|
-
expect(prompt).not.toContain('Conventions');
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('does NOT include a Conventions section when guidance is absent', () => {
|
|
42
|
-
const req = baseDraftReq();
|
|
43
|
-
const prompt = buildDraftPrompt(req);
|
|
44
|
-
expect(prompt).not.toContain('Conventions');
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('still includes core prompt content regardless of guidance', () => {
|
|
48
|
-
const req = baseDraftReq({ guidance: 'Some guidance.' });
|
|
49
|
-
const prompt = buildDraftPrompt(req);
|
|
50
|
-
expect(prompt).toContain('tool_a');
|
|
51
|
-
expect(prompt).toContain('@useWhen');
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('uses source-neutral framing (no hardcoded MCP) and keeps guidance', () => {
|
|
55
|
-
const req = baseDraftReq({ guidance: 'CLI conventions: use --flag syntax.' });
|
|
56
|
-
const prompt = buildDraftPrompt(req);
|
|
57
|
-
expect(prompt).not.toContain('MCP');
|
|
58
|
-
expect(prompt).toContain('skill annotations for "my-tool"');
|
|
59
|
-
expect(prompt).toContain('Conventions');
|
|
60
|
-
expect(prompt).toContain('CLI conventions: use --flag syntax.');
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
describe('buildReviewPrompt', () => {
|
|
65
|
-
it('includes a Conventions section with guidance text when guidance is provided', () => {
|
|
66
|
-
const req = baseReviewReq({ guidance: 'Always use active voice.' });
|
|
67
|
-
const prompt = buildReviewPrompt(req);
|
|
68
|
-
expect(prompt).toContain('Conventions');
|
|
69
|
-
expect(prompt).toContain('Always use active voice.');
|
|
70
|
-
expect(prompt.indexOf('Conventions')).toBeLessThan(prompt.indexOf('Respond with JSON only'));
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('does NOT include a Conventions section when guidance is undefined', () => {
|
|
74
|
-
const req = baseReviewReq({ guidance: undefined });
|
|
75
|
-
const prompt = buildReviewPrompt(req);
|
|
76
|
-
expect(prompt).not.toContain('Conventions');
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('does NOT include a Conventions section when guidance is absent', () => {
|
|
80
|
-
const req = baseReviewReq();
|
|
81
|
-
const prompt = buildReviewPrompt(req);
|
|
82
|
-
expect(prompt).not.toContain('Conventions');
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('still includes core prompt content regardless of guidance', () => {
|
|
86
|
-
const req = baseReviewReq({ guidance: 'Some guidance.' });
|
|
87
|
-
const prompt = buildReviewPrompt(req);
|
|
88
|
-
expect(prompt).toContain('tool_a');
|
|
89
|
-
expect(prompt).toContain('@useWhen');
|
|
90
|
-
expect(prompt).toContain('Use this tool when listing files');
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('uses source-neutral framing (no hardcoded MCP) and keeps guidance + JSON instruction', () => {
|
|
94
|
-
const req = baseReviewReq({ guidance: 'CLI conventions: use --flag syntax.' });
|
|
95
|
-
const prompt = buildReviewPrompt(req);
|
|
96
|
-
expect(prompt).not.toContain('MCP');
|
|
97
|
-
expect(prompt).toContain('skill annotation draft for "my-tool"');
|
|
98
|
-
expect(prompt).toContain('Conventions');
|
|
99
|
-
expect(prompt).toContain('CLI conventions: use --flag syntax.');
|
|
100
|
-
expect(prompt).toContain('Respond with JSON only');
|
|
101
|
-
});
|
|
102
|
-
});
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
// packages/client/src/__tests__/cli-adapters.test.ts
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import { claudeAdapter, codexAdapter, copilotAdapter, adapterFor } from '../model/cli/adapters.js';
|
|
4
|
-
import { DRAFTER, REVIEWER } from '../model/models.js';
|
|
5
|
-
|
|
6
|
-
describe('claudeAdapter', () => {
|
|
7
|
-
it('maps draft role to the drafter model and review role to the reviewer model', () => {
|
|
8
|
-
const draft = claudeAdapter.invocation('draft', 'PROMPT');
|
|
9
|
-
expect(draft.cmd).toBe('claude');
|
|
10
|
-
expect(draft.args).toEqual(['-p', '--output-format', 'json', '--model', DRAFTER]);
|
|
11
|
-
expect(draft.input).toBe('PROMPT');
|
|
12
|
-
const review = claudeAdapter.invocation('review', 'PROMPT');
|
|
13
|
-
expect(review.args).toContain(REVIEWER);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('extracts result from the claude json envelope', () => {
|
|
17
|
-
const stdout = JSON.stringify({ type: 'result', is_error: false, result: 'the answer' });
|
|
18
|
-
expect(claudeAdapter.extractResult(stdout)).toBe('the answer');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('throws when claude reports is_error', () => {
|
|
22
|
-
const stdout = JSON.stringify({ type: 'result', is_error: true, result: 'nope' });
|
|
23
|
-
expect(() => claudeAdapter.extractResult(stdout)).toThrow(/claude/i);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('returns an empty result string (does not editorialize)', () => {
|
|
27
|
-
const stdout = JSON.stringify({ type: 'result', is_error: false, result: '' });
|
|
28
|
-
expect(claudeAdapter.extractResult(stdout)).toBe('');
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe('codexAdapter', () => {
|
|
33
|
-
it('invokes codex exec --json with the prompt on stdin and no per-role model', () => {
|
|
34
|
-
const inv = codexAdapter.invocation('draft', 'PROMPT');
|
|
35
|
-
expect(inv.cmd).toBe('codex');
|
|
36
|
-
expect(inv.args).toEqual(['exec', '--json']);
|
|
37
|
-
expect(inv.input).toBe('PROMPT');
|
|
38
|
-
// role-agnostic: review uses the same invocation
|
|
39
|
-
expect(codexAdapter.invocation('review', 'PROMPT').args).toEqual(['exec', '--json']);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('extracts the last agent_message from the jsonl stream, skipping log/noise lines', () => {
|
|
43
|
-
const stdout = [
|
|
44
|
-
'some non-json log line',
|
|
45
|
-
JSON.stringify({ type: 'thread.started', thread_id: 'x' }),
|
|
46
|
-
JSON.stringify({ type: 'item.completed', item: { type: 'agent_message', text: 'first' } }),
|
|
47
|
-
JSON.stringify({ type: 'item.completed', item: { type: 'agent_message', text: 'final' } }),
|
|
48
|
-
JSON.stringify({ type: 'turn.completed' })
|
|
49
|
-
].join('\n');
|
|
50
|
-
expect(codexAdapter.extractResult(stdout)).toBe('final');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('returns an empty final agent_message, overriding an earlier non-empty one (last-wins on empty)', () => {
|
|
54
|
-
const stdout = [
|
|
55
|
-
JSON.stringify({ type: 'item.completed', item: { type: 'agent_message', text: 'first' } }),
|
|
56
|
-
JSON.stringify({ type: 'item.completed', item: { type: 'agent_message', text: '' } })
|
|
57
|
-
].join('\n');
|
|
58
|
-
expect(codexAdapter.extractResult(stdout)).toBe('');
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('throws when no agent_message is present', () => {
|
|
62
|
-
expect(() => codexAdapter.extractResult('{"type":"turn.completed"}')).toThrow(/codex/i);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('surfaces a turn.failed signal in the no-message error', () => {
|
|
66
|
-
const stdout = JSON.stringify({ type: 'turn.failed' });
|
|
67
|
-
expect(() => codexAdapter.extractResult(stdout)).toThrow(/turn\.failed/);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe('copilotAdapter', () => {
|
|
72
|
-
it('pipes the prompt via stdin (not argv) so untrusted content stays out of argv', () => {
|
|
73
|
-
const inv = copilotAdapter.invocation('draft', 'PROMPT');
|
|
74
|
-
expect(inv.cmd).toBe('copilot');
|
|
75
|
-
expect(inv.args).toEqual(['--output-format', 'json', '--no-color']);
|
|
76
|
-
expect(inv.args).not.toContain('PROMPT');
|
|
77
|
-
expect(inv.input).toBe('PROMPT');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('extracts the last assistant.message content from the jsonl stream, skipping deltas/result', () => {
|
|
81
|
-
const stdout = [
|
|
82
|
-
JSON.stringify({ type: 'assistant.message_delta', data: { deltaContent: 'the ' } }),
|
|
83
|
-
JSON.stringify({ type: 'assistant.message_delta', data: { deltaContent: 'answer' } }),
|
|
84
|
-
JSON.stringify({
|
|
85
|
-
type: 'assistant.message',
|
|
86
|
-
data: { content: 'the answer', toolRequests: [] }
|
|
87
|
-
}),
|
|
88
|
-
JSON.stringify({ type: 'result', exitCode: 0 })
|
|
89
|
-
].join('\n');
|
|
90
|
-
expect(copilotAdapter.extractResult(stdout)).toBe('the answer');
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('returns an empty assistant.message content (does not editorialize)', () => {
|
|
94
|
-
const stdout = [
|
|
95
|
-
JSON.stringify({ type: 'assistant.message', data: { content: 'first', toolRequests: [] } }),
|
|
96
|
-
JSON.stringify({ type: 'assistant.message', data: { content: '', toolRequests: [] } })
|
|
97
|
-
].join('\n');
|
|
98
|
-
expect(copilotAdapter.extractResult(stdout)).toBe('');
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('throws when no assistant.message is present', () => {
|
|
102
|
-
expect(() => copilotAdapter.extractResult('{"type":"result","exitCode":0}')).toThrow(
|
|
103
|
-
/copilot/i
|
|
104
|
-
);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('surfaces a nonzero result exitCode in the no-message error', () => {
|
|
108
|
-
const stdout = JSON.stringify({ type: 'result', exitCode: 1 });
|
|
109
|
-
expect(() => copilotAdapter.extractResult(stdout)).toThrow(/exitCode 1/);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
describe('adapterFor', () => {
|
|
114
|
-
it('returns the matching adapter', () => {
|
|
115
|
-
expect(adapterFor('claude')).toBe(claudeAdapter);
|
|
116
|
-
expect(adapterFor('codex')).toBe(codexAdapter);
|
|
117
|
-
expect(adapterFor('copilot')).toBe(copilotAdapter);
|
|
118
|
-
});
|
|
119
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// packages/client/src/__tests__/cli-client.test.ts
|
|
2
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
3
|
-
import { CliModelClient } from '../model/cli/cli-client.js';
|
|
4
|
-
import { claudeAdapter } from '../model/cli/adapters.js';
|
|
5
|
-
import type { DraftRequest, ReviewRequest, ExtractedSkill } from '@skillit/core';
|
|
6
|
-
|
|
7
|
-
const skill = { name: 'demo' } as unknown as ExtractedSkill;
|
|
8
|
-
const draftReq: DraftRequest = {
|
|
9
|
-
toolName: 'gen',
|
|
10
|
-
tag: 'useWhen',
|
|
11
|
-
suggestion: 'say when',
|
|
12
|
-
currentValue: undefined,
|
|
13
|
-
skill
|
|
14
|
-
};
|
|
15
|
-
const reviewReq: ReviewRequest = {
|
|
16
|
-
toolName: 'gen',
|
|
17
|
-
tag: 'useWhen',
|
|
18
|
-
draft: 'When generating',
|
|
19
|
-
suggestion: 'say when',
|
|
20
|
-
skill
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
describe('CliModelClient', () => {
|
|
24
|
-
it('draft() returns the trimmed result extracted from the adapter envelope', async () => {
|
|
25
|
-
const runner = vi.fn(async () =>
|
|
26
|
-
JSON.stringify({ type: 'result', is_error: false, result: ' When generating output ' })
|
|
27
|
-
);
|
|
28
|
-
const client = new CliModelClient(claudeAdapter, { runner });
|
|
29
|
-
const out = await client.draft(draftReq);
|
|
30
|
-
expect(out).toBe('When generating output');
|
|
31
|
-
// the adapter's invocation was forwarded to the runner
|
|
32
|
-
expect(runner).toHaveBeenCalledWith(
|
|
33
|
-
expect.objectContaining({ cmd: 'claude', args: expect.arrayContaining(['-p']) })
|
|
34
|
-
);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('review() parses the verdict JSON out of the adapter result', async () => {
|
|
38
|
-
const runner = vi.fn(async () =>
|
|
39
|
-
JSON.stringify({
|
|
40
|
-
type: 'result',
|
|
41
|
-
is_error: false,
|
|
42
|
-
result: 'Sure: {"verdict":"revise","feedback":"too vague"}'
|
|
43
|
-
})
|
|
44
|
-
);
|
|
45
|
-
const client = new CliModelClient(claudeAdapter, { runner });
|
|
46
|
-
const res = await client.review(reviewReq);
|
|
47
|
-
expect(res).toEqual({ verdict: 'revise', feedback: 'too vague' });
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('passes the configured timeout through to the runner', async () => {
|
|
51
|
-
const runner = vi.fn(async () =>
|
|
52
|
-
JSON.stringify({ type: 'result', is_error: false, result: 'x' })
|
|
53
|
-
);
|
|
54
|
-
const client = new CliModelClient(claudeAdapter, { runner, timeoutMs: 5000 });
|
|
55
|
-
await client.draft(draftReq);
|
|
56
|
-
expect(runner).toHaveBeenCalledWith(expect.objectContaining({ timeoutMs: 5000 }));
|
|
57
|
-
});
|
|
58
|
-
});
|