@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
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @skillit/client
|
|
2
|
+
|
|
3
|
+
> The `skillit` command-line interface: generate, audit, and refine AI-agent
|
|
4
|
+
> skills from a TypeScript codebase, plus the Anthropic model client that powers
|
|
5
|
+
> the headless refine loop.
|
|
6
|
+
|
|
7
|
+
`@skillit/client` ships the `skillit` binary. It ties together the skillit
|
|
8
|
+
source extractors (`@skillit/cli`, `@skillit/mcp`, `@skillit/core`) behind one
|
|
9
|
+
CLI, and provides the Anthropic-backed `ModelClient` used by `skillit refine`
|
|
10
|
+
when run without an agent.
|
|
11
|
+
|
|
12
|
+
## Commands
|
|
13
|
+
|
|
14
|
+
| Command | What it does |
|
|
15
|
+
| ---------------- | ---------------------------------------------------------------------------------------------------- |
|
|
16
|
+
| `skillit gen` | Deterministically (re)generate the skill from current source — no model, no install. |
|
|
17
|
+
| `skillit audit` | Audit + judge the generated skill; `--json` emits the full report with per-finding source locations. |
|
|
18
|
+
| `skillit init` | Detect the project and install the matching `@skillit/*` package (install/wire only). |
|
|
19
|
+
| `skillit refine` | Headless audit → draft → review loop that writes routing annotations back into source. |
|
|
20
|
+
| `skillit mcp` | Extract / bundle skills from a live MCP server. |
|
|
21
|
+
|
|
22
|
+
## Quick start
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Install
|
|
26
|
+
npm install --save-dev @skillit/client
|
|
27
|
+
|
|
28
|
+
# Generate a skill from a Commander CLI
|
|
29
|
+
skillit gen --source cli --program ./dist/cli.js#program
|
|
30
|
+
|
|
31
|
+
# Check its grade and findings as JSON
|
|
32
|
+
skillit audit --source cli --program ./dist/cli.js#program --json
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
For the agent-driven workflow (recommended), use the bundled
|
|
36
|
+
`/skillit-bootstrap` skill — see the repository README.
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
MIT
|
package/dist/bin.d.ts
CHANGED
package/dist/bin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAM5C,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/bin.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// packages/client/src/bin.ts
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
program
|
|
9
|
-
program
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
import { pathToFileURL } from 'node:url';
|
|
4
|
+
import { reportMcpErrorAndExit } from '@skillit/mcp';
|
|
5
|
+
import { buildProgram } from './program.js';
|
|
6
|
+
// Re-export the factory so `@skillit/cli`'s program loader can auto-discover
|
|
7
|
+
// the skillit program from this package's `bin` entry (it probes `buildProgram`
|
|
8
|
+
// / `createProgram` / `program` / `default`) when `skillit init/refine --source
|
|
9
|
+
// cli` is run without an explicit `--program`.
|
|
10
|
+
export { buildProgram };
|
|
11
|
+
// Only parse argv when this file is the executed entry — NOT when it is
|
|
12
|
+
// imported for introspection (auto-discovery does `import(bin)`). Parsing on
|
|
13
|
+
// import would consume `process.argv` and could exit the host process.
|
|
14
|
+
const argv1 = process.argv[1];
|
|
15
|
+
if (argv1 !== undefined && import.meta.url === pathToFileURL(argv1).href) {
|
|
16
|
+
buildProgram()
|
|
17
|
+
.parseAsync(process.argv)
|
|
18
|
+
.catch((err) => {
|
|
19
|
+
// Preserve the mcp exit-code contract for the `skillit mcp …` path; other
|
|
20
|
+
// errors keep the prior generic behavior (stderr message + exit 1).
|
|
21
|
+
reportMcpErrorAndExit(err);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
16
24
|
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,6BAA6B;AAC7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,6BAA6B;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,6EAA6E;AAC7E,gFAAgF;AAChF,gFAAgF;AAChF,+CAA+C;AAC/C,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,wEAAwE;AACxE,6EAA6E;AAC7E,uEAAuE;AACvE,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC9B,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IACzE,YAAY,EAAE;SACX,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC;SACxB,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;QACtB,0EAA0E;QAC1E,oEAAoE;QACpE,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { type ActionableImprovement, type AuditResult, type ExtractedSkill, type RefineSource, type SkillJudgeEstimate, type TargetLocation } from '@skillit/core';
|
|
3
|
+
import { type RefineSourceKind } from '../detect-source.js';
|
|
4
|
+
/** An improvement with each of its targets resolved to a concrete location (or null). */
|
|
5
|
+
export interface AuditReportImprovement extends ActionableImprovement {
|
|
6
|
+
/** One entry per `targets[]`, in order; `null` when the source can't resolve it. */
|
|
7
|
+
resolvedLocations: Array<TargetLocation | null>;
|
|
8
|
+
}
|
|
9
|
+
/** The full JSON report emitted by `skillit audit --json`. */
|
|
10
|
+
export interface AuditReport {
|
|
11
|
+
audit: AuditResult;
|
|
12
|
+
estimate: SkillJudgeEstimate;
|
|
13
|
+
improvements: AuditReportImprovement[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Pure report builder: audit + score the skill, then resolve every improvement
|
|
17
|
+
* target to its on-disk location via the source's optional resolveTargetLocation.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildAuditReport(source: RefineSource, skill: ExtractedSkill): Promise<AuditReport>;
|
|
20
|
+
/** Parsed options for the `audit` action. */
|
|
21
|
+
export interface AuditCommandOpts {
|
|
22
|
+
source?: string;
|
|
23
|
+
program?: string;
|
|
24
|
+
configType?: string;
|
|
25
|
+
mcp?: string;
|
|
26
|
+
server?: string;
|
|
27
|
+
mode?: string;
|
|
28
|
+
overlay?: string;
|
|
29
|
+
json?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare function runAuditCommand(opts: AuditCommandOpts): Promise<void>;
|
|
32
|
+
export declare function buildAuditCommand(): Command;
|
|
33
|
+
export type { RefineSourceKind };
|
|
34
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/commands/audit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAK7B,yFAAyF;AACzF,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;IACnE,oFAAoF;IACpF,iBAAiB,EAAE,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CACjD;AAED,8DAA8D;AAC9D,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,YAAY,EAAE,sBAAsB,EAAE,CAAC;CACxC;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,WAAW,CAAC,CAkBtB;AAED,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqG3E;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAY3C;AAGD,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// packages/client/src/commands/audit.ts
|
|
2
|
+
import { isAbsolute, join } from 'node:path';
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import { auditSkill, ConfigRefineSource, estimateSkillJudgeScore } from '@skillit/core';
|
|
5
|
+
import { CliRefineSource, loadProgram } from '@skillit/cli';
|
|
6
|
+
import { classifyRefineSources, detectInstalledSources, detectProjectNature } from '../detect-source.js';
|
|
7
|
+
import { parseConfigTypeSpec, resolveRefineSource } from './refine.js';
|
|
8
|
+
import { resolveTypeDocEntry } from '../typedoc-entry.js';
|
|
9
|
+
import { resolveMcpMode } from '../mcp-mode.js';
|
|
10
|
+
/**
|
|
11
|
+
* Pure report builder: audit + score the skill, then resolve every improvement
|
|
12
|
+
* target to its on-disk location via the source's optional resolveTargetLocation.
|
|
13
|
+
*/
|
|
14
|
+
export async function buildAuditReport(source, skill) {
|
|
15
|
+
const audit = auditSkill(skill);
|
|
16
|
+
const estimate = estimateSkillJudgeScore(audit, skill);
|
|
17
|
+
const improvements = [];
|
|
18
|
+
for (const imp of estimate.improvements) {
|
|
19
|
+
const targets = imp.targets ?? [];
|
|
20
|
+
const resolvedLocations = [];
|
|
21
|
+
for (const target of targets) {
|
|
22
|
+
const loc = source.resolveTargetLocation
|
|
23
|
+
? await source.resolveTargetLocation(target)
|
|
24
|
+
: undefined;
|
|
25
|
+
resolvedLocations.push(loc ?? null);
|
|
26
|
+
}
|
|
27
|
+
improvements.push({ ...imp, resolvedLocations });
|
|
28
|
+
}
|
|
29
|
+
return { audit, estimate, improvements };
|
|
30
|
+
}
|
|
31
|
+
export async function runAuditCommand(opts) {
|
|
32
|
+
const cwd = process.cwd();
|
|
33
|
+
// Auto-detect the project nature once when no explicit --source is given;
|
|
34
|
+
// reuse it for both the typedoc and mcp branches below.
|
|
35
|
+
const nature = opts.source === undefined ? await detectProjectNature(cwd) : undefined;
|
|
36
|
+
// mcp: explicit --source, an explicit --mcp path (which only the mcp source
|
|
37
|
+
// consumes), or auto-detected via @modelcontextprotocol/sdk.
|
|
38
|
+
const isMcp = opts.source === 'mcp' ||
|
|
39
|
+
(opts.source === undefined && (opts.mcp !== undefined || nature === 'mcp'));
|
|
40
|
+
// typedoc: explicit, or auto-detected as a plain TS library — but never when
|
|
41
|
+
// an explicit --mcp path was given (that routes to mcp above).
|
|
42
|
+
const isTypedoc = opts.source === 'typedoc' ||
|
|
43
|
+
(opts.source === undefined && opts.mcp === undefined && nature === 'typedoc');
|
|
44
|
+
let source;
|
|
45
|
+
if (isTypedoc) {
|
|
46
|
+
// Lazy import: keeps `@skillit/typedoc` (and its `typedoc` peer) off the CLI
|
|
47
|
+
// startup path so non-typedoc commands run without TypeDoc installed.
|
|
48
|
+
const { createTypeDocRefineSource } = await import('@skillit/typedoc');
|
|
49
|
+
const { entryPoints, tsconfig } = resolveTypeDocEntry(cwd);
|
|
50
|
+
source = createTypeDocRefineSource({ entryPoints, tsconfig, cwd });
|
|
51
|
+
}
|
|
52
|
+
else if (isMcp) {
|
|
53
|
+
if (opts.mcp === undefined) {
|
|
54
|
+
console.error('The mcp source requires --mcp <path> (path to mcp.json or MCP config file).');
|
|
55
|
+
process.exitCode = 1;
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const resolved = await resolveMcpMode(cwd, opts);
|
|
59
|
+
if ('error' in resolved) {
|
|
60
|
+
console.error(resolved.error);
|
|
61
|
+
process.exitCode = 1;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
// Lazy import: keeps `@skillit/mcp` (and its SDK peer) off the CLI startup
|
|
65
|
+
// path so non-mcp commands run without the MCP SDK installed.
|
|
66
|
+
const { createMcpRefineSource } = await import('@skillit/mcp');
|
|
67
|
+
source = await createMcpRefineSource({
|
|
68
|
+
mcpPath: isAbsolute(opts.mcp) ? opts.mcp : join(cwd, opts.mcp),
|
|
69
|
+
mode: resolved.mode,
|
|
70
|
+
cwd,
|
|
71
|
+
...(opts.server !== undefined ? { serverName: opts.server } : {}),
|
|
72
|
+
overlayPath: opts.overlay
|
|
73
|
+
? isAbsolute(opts.overlay)
|
|
74
|
+
? opts.overlay
|
|
75
|
+
: join(cwd, opts.overlay)
|
|
76
|
+
: join(cwd, '.skillit-overlay.json'),
|
|
77
|
+
sourceGlob: join(cwd, '**', '*.ts')
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
const candidates = await detectInstalledSources(cwd);
|
|
82
|
+
const detected = classifyRefineSources(candidates);
|
|
83
|
+
const resolution = resolveRefineSource(opts, detected, candidates);
|
|
84
|
+
if ('error' in resolution) {
|
|
85
|
+
console.error(resolution.error);
|
|
86
|
+
process.exitCode = 1;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (resolution.kind === 'cli') {
|
|
90
|
+
const program = await loadProgram({ program: opts.program, cwd });
|
|
91
|
+
source = new CliRefineSource({ program, sourceGlob: join(cwd, '**', '*.ts'), cwd });
|
|
92
|
+
}
|
|
93
|
+
else if (resolution.kind === 'config') {
|
|
94
|
+
const parsed = parseConfigTypeSpec(opts.configType, cwd);
|
|
95
|
+
if ('error' in parsed) {
|
|
96
|
+
console.error(parsed.error);
|
|
97
|
+
process.exitCode = 1;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// No explicit name: ConfigRefineSource derives it from the package nearest
|
|
101
|
+
// the config file (→ typeName), matching what `skillit gen` writes for the
|
|
102
|
+
// same source.
|
|
103
|
+
source = new ConfigRefineSource({
|
|
104
|
+
configFile: isAbsolute(parsed.configFile)
|
|
105
|
+
? parsed.configFile
|
|
106
|
+
: join(cwd, parsed.configFile),
|
|
107
|
+
typeName: parsed.typeName
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
console.error(`skillit audit does not yet support the ${resolution.kind} source; cli, config, and typedoc are supported in this release.`);
|
|
112
|
+
process.exitCode = 1;
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const skill = await source.extract();
|
|
117
|
+
const report = await buildAuditReport(source, skill);
|
|
118
|
+
if (opts.json) {
|
|
119
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
console.log(`Grade ${report.estimate.grade} (${report.estimate.total}/120)`);
|
|
123
|
+
console.log(`Fatal ${report.audit.summary.fatal}, Error ${report.audit.summary.error}, Warning ${report.audit.summary.warning}, Alert ${report.audit.summary.alert}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export function buildAuditCommand() {
|
|
127
|
+
return new Command('audit')
|
|
128
|
+
.description('Audit + judge the generated skill; emit findings (with target locations) as JSON')
|
|
129
|
+
.option('--source <kind>', 'cli | mcp | typedoc | config (auto-detected if omitted)')
|
|
130
|
+
.option('--program <file#export>', 'commander program entry (cli source)')
|
|
131
|
+
.option('--config-type <file#export>', 'config type entry (config source)')
|
|
132
|
+
.option('--mcp <path>', 'path to mcp.json or MCP config file')
|
|
133
|
+
.option('--server <name>', 'MCP server entry to select (mcp source)')
|
|
134
|
+
.option('--mode <build|runtime>', 'MCP refine mode (auto-detected if omitted)')
|
|
135
|
+
.option('--overlay <path>', 'overlay JSON path (mcp runtime mode)')
|
|
136
|
+
.option('--json', 'emit the full AuditResult + SkillJudgeEstimate as JSON')
|
|
137
|
+
.action((opts) => runAuditCommand(opts));
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/commands/audit.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,uBAAuB,EAOxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EAEpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAA0B,MAAM,aAAa,CAAC;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAehD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAoB,EACpB,KAAqB;IAErB,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,uBAAuB,CAAC,KAAK,EAAE,KA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MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,WAAW,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,aAAa,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,WAAW,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,CACzJ,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;SACxB,WAAW,CAAC,kFAAkF,CAAC;SAC/F,MAAM,CAAC,iBAAiB,EAAE,yDAAyD,CAAC;SACpF,MAAM,CAAC,yBAAyB,EAAE,sCAAsC,CAAC;SACzE,MAAM,CAAC,6BAA6B,EAAE,mCAAmC,CAAC;SAC1E,MAAM,CAAC,cAAc,EAAE,qCAAqC,CAAC;SAC7D,MAAM,CAAC,iBAAiB,EAAE,yCAAyC,CAAC;SACpE,MAAM,CAAC,wBAAwB,EAAE,4CAA4C,CAAC;SAC9E,MAAM,CAAC,kBAAkB,EAAE,sCAAsC,CAAC;SAClE,MAAM,CAAC,QAAQ,EAAE,wDAAwD,CAAC;SAC1E,MAAM,CAAC,CAAC,IAAsB,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { type GenerateConfigSkillOpts, type GenerateMcpSkillOpts, type GenerateSkillOpts, type GenerateTypeDocSkillOpts } from '../generate.js';
|
|
3
|
+
/** Injectable generators (test seam, mirrors InitDeps). */
|
|
4
|
+
export interface GenDeps {
|
|
5
|
+
generateCliSkill?(opts: GenerateSkillOpts): Promise<void>;
|
|
6
|
+
generateConfigSkill?(opts: GenerateConfigSkillOpts): Promise<void>;
|
|
7
|
+
generateTypeDocSkill?(opts: GenerateTypeDocSkillOpts): Promise<void>;
|
|
8
|
+
generateMcpSkill?(opts: GenerateMcpSkillOpts): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
/** Parsed options for the `gen` action. */
|
|
11
|
+
export interface GenCommandOpts {
|
|
12
|
+
source?: string;
|
|
13
|
+
program?: string;
|
|
14
|
+
configType?: string;
|
|
15
|
+
mcp?: string;
|
|
16
|
+
server?: string;
|
|
17
|
+
out: string;
|
|
18
|
+
invocation?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function buildGenCommand(deps?: GenDeps): Command;
|
|
21
|
+
//# sourceMappingURL=gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gen.d.ts","sourceRoot":"","sources":["../../src/commands/gen.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,OAAO,EAML,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC9B,MAAM,gBAAgB,CAAC;AAIxB,2DAA2D;AAC3D,MAAM,WAAW,OAAO;IACtB,gBAAgB,CAAC,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,mBAAmB,CAAC,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,oBAAoB,CAAC,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,gBAAgB,CAAC,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED,2CAA2C;AAC3C,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAmBD,wBAAgB,eAAe,CAAC,IAAI,GAAE,OAAY,GAAG,OAAO,CAuG3D"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// packages/client/src/commands/gen.ts
|
|
2
|
+
import { isAbsolute, join } from 'node:path';
|
|
3
|
+
import { readFile } from 'node:fs/promises';
|
|
4
|
+
import { Command } from 'commander';
|
|
5
|
+
import { classifyRefineSources, detectInstalledSources, detectProjectNature } from '../detect-source.js';
|
|
6
|
+
import { generateCliSkill as defaultGenerateCliSkill, generateConfigSkill as defaultGenerateConfigSkill, generateMcpSkill as defaultGenerateMcpSkill, generateTypeDocSkill as defaultGenerateTypeDocSkill } from '../generate.js';
|
|
7
|
+
import { parseConfigTypeSpec, resolveRefineSource } from './refine.js';
|
|
8
|
+
import { resolveTypeDocEntry } from '../typedoc-entry.js';
|
|
9
|
+
/** Strip a leading `@scope/` from a package name for a skill dir name. */
|
|
10
|
+
function skillNameFrom(packageName) {
|
|
11
|
+
const slash = packageName.indexOf('/');
|
|
12
|
+
if (packageName.startsWith('@') && slash !== -1)
|
|
13
|
+
return packageName.slice(slash + 1);
|
|
14
|
+
return packageName;
|
|
15
|
+
}
|
|
16
|
+
async function readPackageName(cwd) {
|
|
17
|
+
try {
|
|
18
|
+
const raw = await readFile(join(cwd, 'package.json'), 'utf8');
|
|
19
|
+
const pkg = JSON.parse(raw);
|
|
20
|
+
return pkg.name ?? 'skill';
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return 'skill';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function buildGenCommand(deps = {}) {
|
|
27
|
+
const generateCliSkill = deps.generateCliSkill ?? defaultGenerateCliSkill;
|
|
28
|
+
const generateConfigSkill = deps.generateConfigSkill ?? defaultGenerateConfigSkill;
|
|
29
|
+
const generateTypeDocSkill = deps.generateTypeDocSkill ?? defaultGenerateTypeDocSkill;
|
|
30
|
+
const generateMcpSkill = deps.generateMcpSkill ?? defaultGenerateMcpSkill;
|
|
31
|
+
return new Command('gen')
|
|
32
|
+
.description('Deterministically (re)generate the skill from current source — no model, no install')
|
|
33
|
+
.option('--source <kind>', 'cli | mcp | typedoc | config (auto-detected if omitted)')
|
|
34
|
+
.option('--program <file#export>', 'commander program entry (cli source)')
|
|
35
|
+
.option('--config-type <file#export>', 'config type entry (config source)')
|
|
36
|
+
.option('--mcp <path>', 'path to mcp.json or MCP config file (mcp source)')
|
|
37
|
+
.option('--server <name>', 'MCP server entry to select (mcp source)')
|
|
38
|
+
.option('--out <dir>', 'output directory for the generated skill', 'skills')
|
|
39
|
+
.option('--invocation <mode>', 'invocation mode for CLI command examples: npx (zero-install) or global (bare binary)')
|
|
40
|
+
.action(async (opts) => {
|
|
41
|
+
const cwd = process.cwd();
|
|
42
|
+
const outDir = join(cwd, opts.out);
|
|
43
|
+
// Detect the project nature at most once (it can spawn the project's CLI
|
|
44
|
+
// bin). Only needed to auto-route when --source is omitted.
|
|
45
|
+
const nature = opts.source === undefined ? await detectProjectNature(cwd) : undefined;
|
|
46
|
+
if (opts.source === 'config') {
|
|
47
|
+
if (opts.configType === undefined) {
|
|
48
|
+
throw new Error('The config source requires --config-type <file#export> (e.g. ./src/config.ts#MyConfig).');
|
|
49
|
+
}
|
|
50
|
+
const parsed = parseConfigTypeSpec(opts.configType, cwd);
|
|
51
|
+
if ('error' in parsed)
|
|
52
|
+
throw new Error(parsed.error);
|
|
53
|
+
// No explicit name: ConfigRefineSource derives it from the package
|
|
54
|
+
// nearest the config file (→ typeName), which is more correct in a
|
|
55
|
+
// monorepo than this command's cwd.
|
|
56
|
+
await generateConfigSkill({
|
|
57
|
+
configFile: parsed.configFile,
|
|
58
|
+
typeName: parsed.typeName,
|
|
59
|
+
outDir
|
|
60
|
+
});
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
// mcp: explicit --source, an explicit --mcp path (which only the mcp
|
|
64
|
+
// source consumes), or auto-detected via @modelcontextprotocol/sdk.
|
|
65
|
+
const isMcp = opts.source === 'mcp' ||
|
|
66
|
+
(opts.source === undefined && (opts.mcp !== undefined || nature === 'mcp'));
|
|
67
|
+
if (isMcp) {
|
|
68
|
+
if (opts.mcp === undefined) {
|
|
69
|
+
throw new Error('The mcp source requires --mcp <path> (path to mcp.json or MCP config file).');
|
|
70
|
+
}
|
|
71
|
+
const mcpPath = isAbsolute(opts.mcp) ? opts.mcp : join(cwd, opts.mcp);
|
|
72
|
+
await generateMcpSkill({
|
|
73
|
+
mcpPath,
|
|
74
|
+
...(opts.server !== undefined ? { server: opts.server } : {}),
|
|
75
|
+
outDir
|
|
76
|
+
});
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
// typedoc: explicit, or auto-detected as a plain TS library.
|
|
80
|
+
const isTypedoc = opts.source === 'typedoc' || nature === 'typedoc';
|
|
81
|
+
if (isTypedoc) {
|
|
82
|
+
const { entryPoints, tsconfig } = resolveTypeDocEntry(cwd);
|
|
83
|
+
await generateTypeDocSkill({ cwd, entryPoints, tsconfig, outDir });
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
// Resolve the cli source the same way refine does (handles auto-detection
|
|
87
|
+
// and the ambiguous/none guidance).
|
|
88
|
+
const candidates = await detectInstalledSources(cwd);
|
|
89
|
+
const detected = classifyRefineSources(candidates);
|
|
90
|
+
const resolution = resolveRefineSource(opts, detected, candidates);
|
|
91
|
+
if ('error' in resolution)
|
|
92
|
+
throw new Error(resolution.error);
|
|
93
|
+
if (resolution.kind === 'cli') {
|
|
94
|
+
const name = skillNameFrom(await readPackageName(cwd));
|
|
95
|
+
const nature = 'cli';
|
|
96
|
+
await generateCliSkill({
|
|
97
|
+
cwd,
|
|
98
|
+
nature,
|
|
99
|
+
name,
|
|
100
|
+
outDir,
|
|
101
|
+
...(opts.program !== undefined ? { program: opts.program } : {}),
|
|
102
|
+
...(opts.invocation !== undefined
|
|
103
|
+
? { invocationMode: opts.invocation }
|
|
104
|
+
: {})
|
|
105
|
+
});
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
// Auto-detection resolved to a source gen can't generate yet (e.g. mcp).
|
|
109
|
+
throw new Error(`skillit gen does not yet support the ${resolution.kind} source; cli and config are supported in this release.`);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gen.js","sourceRoot":"","sources":["../../src/commands/gen.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EAEpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,IAAI,uBAAuB,EAC3C,mBAAmB,IAAI,0BAA0B,EACjD,gBAAgB,IAAI,uBAAuB,EAC3C,oBAAoB,IAAI,2BAA2B,EAMpD,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAqB1D,0EAA0E;AAC1E,SAAS,aAAa,CAAC,WAAmB;IACxC,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;QAAE,OAAO,WAAW,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IACrF,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,KAAK,UAAU,eAAe,CAAC,GAAW;IACxC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,Q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AC,IAAI,CAAC,UAAU,KAAK,SAAS;oBAC/B,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,UAA+B,EAAE;oBAC1D,CAAC,CAAC,EAAE,CAAC;aACR,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,yEAAyE;QACzE,MAAM,IAAI,KAAK,CACb,wCAAwC,UAAU,CAAC,IAAI,wDAAwD,CAChH,CAAC;IACJ,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -1,32 +1,18 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import { type RefineSourceKind } from '../detect-source.js';
|
|
3
|
-
import { type RefineCommandOpts } from './refine.js';
|
|
4
2
|
type PackageManager = 'pnpm' | 'yarn' | 'npm';
|
|
5
|
-
/** Options passed to the (CLI-path) skill generator. */
|
|
6
|
-
export interface GenerateSkillOpts {
|
|
7
|
-
/** Project root being initialized. */
|
|
8
|
-
cwd: string;
|
|
9
|
-
/** Resolved project nature. */
|
|
10
|
-
nature: RefineSourceKind;
|
|
11
|
-
/** Skill name (consumer package name, scope stripped). */
|
|
12
|
-
name: string;
|
|
13
|
-
/** Absolute output directory (`<cwd>/<out>`). */
|
|
14
|
-
outDir: string;
|
|
15
|
-
/** `--program <file#export>` entry, if provided. */
|
|
16
|
-
program?: string;
|
|
17
|
-
}
|
|
18
3
|
/**
|
|
19
|
-
* Injectable side-effecting steps for {@link buildInitCommand}.
|
|
20
|
-
*
|
|
21
|
-
*
|
|
4
|
+
* Injectable side-effecting steps for {@link buildInitCommand}. Phase 0 init is
|
|
5
|
+
* install/wire ONLY — it no longer generates or refines (those are `skillit
|
|
6
|
+
* gen` and `skillit refine`), so the only injectable step is the install.
|
|
22
7
|
*/
|
|
23
8
|
export interface InitDeps {
|
|
24
9
|
/** Install `pkg` as a dev dependency in `cwd` using package manager `pm`. */
|
|
25
10
|
runInstall?(pkg: string, pm: PackageManager, cwd: string): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Write `skillit-postinstall.cjs` and wire `scripts.postinstall` in
|
|
13
|
+
* `package.json`. Skips (with a warning) if `postinstall` is already set.
|
|
14
|
+
*/
|
|
15
|
+
wirePostinstall?(cwd: string): Promise<void>;
|
|
30
16
|
}
|
|
31
17
|
export declare function buildInitCommand(deps?: InitDeps): Command;
|
|
32
18
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,KAAK,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,6EAA6E;IAC7E,UAAU,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzE;;;OAGG;IACH,eAAe,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9C;AAwDD,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,QAAa,GAAG,OAAO,CAoE7D"}
|