@skillit/cli 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/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/audit.d.ts +14 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +101 -0
- package/dist/audit.js.map +1 -0
- package/dist/correlator.d.ts +21 -0
- package/dist/correlator.d.ts.map +1 -0
- package/dist/correlator.js +69 -0
- package/dist/correlator.js.map +1 -0
- package/dist/extract.d.ts +37 -0
- package/dist/extract.d.ts.map +1 -0
- package/dist/extract.js +133 -0
- package/dist/extract.js.map +1 -0
- package/dist/help-parser.d.ts +17 -0
- package/dist/help-parser.d.ts.map +1 -0
- package/dist/help-parser.js +314 -0
- package/dist/help-parser.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/introspect-commander.d.ts +18 -0
- package/dist/introspect-commander.d.ts.map +1 -0
- package/dist/introspect-commander.js +96 -0
- package/dist/introspect-commander.js.map +1 -0
- package/dist/options-jsdoc.d.ts +10 -0
- package/dist/options-jsdoc.d.ts.map +1 -0
- package/dist/options-jsdoc.js +12 -0
- package/dist/options-jsdoc.js.map +1 -0
- package/dist/program-loader.d.ts +20 -0
- package/dist/program-loader.d.ts.map +1 -0
- package/dist/program-loader.js +90 -0
- package/dist/program-loader.js.map +1 -0
- package/dist/refine-source.d.ts +32 -0
- package/dist/refine-source.d.ts.map +1 -0
- package/dist/refine-source.js +147 -0
- package/dist/refine-source.js.map +1 -0
- package/package.json +61 -0
- package/skills/skillit-cli-docs/SKILL.md +26 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-present Pradeep Mouli
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @skillit/cli
|
|
2
|
+
|
|
3
|
+
> Extract CLI command structure from commander/yargs for AI agent skill generation.
|
|
4
|
+
|
|
5
|
+
Part of the [skillit](https://github.com/pradeepmouli/skillit) ecosystem.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Commander introspection** — enumerate commands, options, arguments from a Program object
|
|
10
|
+
- **`--help` fallback** — parse standard help text for any CLI framework
|
|
11
|
+
- **Flag-to-property correlation** — merge JSDoc tags from typed options interfaces into CLI metadata
|
|
12
|
+
- **Token-budgeted output** — generated skills fit LLM context windows
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add -D @skillit/cli
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { extractCliSkill, writeCliSkill } from '@skillit/cli';
|
|
24
|
+
|
|
25
|
+
const skill = await extractCliSkill({
|
|
26
|
+
program, // commander Program object
|
|
27
|
+
metadata: { name: 'my-tool', keywords: ['build', 'deploy'] }
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
console.log(skill.audit); // structured C1-C8 findings with suggestions
|
|
31
|
+
|
|
32
|
+
writeCliSkill(skill, {
|
|
33
|
+
outDir: 'skills',
|
|
34
|
+
installTargets: ['.claude/skills', '.agents/skills']
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`writeCliSkill()` writes the generated skill, installs it into any configured
|
|
39
|
+
agent discovery directories, and adds the bundled `skillit-cli-docs` guidance
|
|
40
|
+
skill to those install targets when install targets are enabled.
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
MIT
|
package/dist/audit.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ExtractedSkill } from '@skillit/core';
|
|
2
|
+
export interface CliAuditIssue {
|
|
3
|
+
readonly code: `C${number}`;
|
|
4
|
+
readonly severity: 'warning' | 'alert';
|
|
5
|
+
readonly message: string;
|
|
6
|
+
readonly suggestion: string;
|
|
7
|
+
readonly location?: {
|
|
8
|
+
readonly command?: string;
|
|
9
|
+
readonly option?: string;
|
|
10
|
+
readonly argument?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare function runCliAudit(skill: ExtractedSkill): CliAuditIssue[];
|
|
14
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,cAAc,EACf,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAClB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,aAAa,EAAE,CASlE"}
|
package/dist/audit.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export function runCliAudit(skill) {
|
|
2
|
+
const issues = [];
|
|
3
|
+
for (const surface of skill.configSurfaces ?? []) {
|
|
4
|
+
if (surface.sourceType !== 'cli')
|
|
5
|
+
continue;
|
|
6
|
+
auditSurface(surface, issues, surface.name);
|
|
7
|
+
}
|
|
8
|
+
return issues;
|
|
9
|
+
}
|
|
10
|
+
function auditSurface(surface, issues, commandPath) {
|
|
11
|
+
if (!surface.description.trim()) {
|
|
12
|
+
issues.push({
|
|
13
|
+
code: 'C1',
|
|
14
|
+
severity: 'warning',
|
|
15
|
+
message: `Command "${commandPath}" has no description.`,
|
|
16
|
+
suggestion: `Add .description('[One sentence: what this command does and why]') to Commander command`,
|
|
17
|
+
location: { command: commandPath }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (!surface.usage?.trim()) {
|
|
21
|
+
issues.push({
|
|
22
|
+
code: 'C3',
|
|
23
|
+
severity: 'alert',
|
|
24
|
+
message: `Command "${commandPath}" has no usage or examples.`,
|
|
25
|
+
suggestion: "Add .usage('[command] [options] <required-arg>') and .addHelpText('after', 'Examples:\\n $ [command] [typical-args]')",
|
|
26
|
+
location: { command: commandPath }
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (!(surface.useWhen?.length ?? 0)) {
|
|
30
|
+
issues.push({
|
|
31
|
+
code: 'C8',
|
|
32
|
+
severity: 'warning',
|
|
33
|
+
message: `Command "${commandPath}" has no useWhen guidance.`,
|
|
34
|
+
suggestion: 'Add @useWhen to the config interface or .addHelpText() with scenario: when to prefer this command over alternatives',
|
|
35
|
+
location: { command: commandPath }
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
for (const option of surface.options) {
|
|
39
|
+
auditOption(commandPath, option, issues);
|
|
40
|
+
}
|
|
41
|
+
for (const argument of surface.arguments ?? []) {
|
|
42
|
+
auditArgument(commandPath, argument, issues);
|
|
43
|
+
}
|
|
44
|
+
for (const subcommand of surface.subcommands ?? []) {
|
|
45
|
+
const subcommandPath = `${commandPath} ${subcommand.name}`;
|
|
46
|
+
if (!subcommand.description.trim()) {
|
|
47
|
+
issues.push({
|
|
48
|
+
code: 'C5',
|
|
49
|
+
severity: 'warning',
|
|
50
|
+
message: `Subcommand "${subcommandPath}" has no description.`,
|
|
51
|
+
suggestion: `Add .description('[One sentence]') to subcommand '${subcommand.name}'`,
|
|
52
|
+
location: { command: subcommandPath }
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
auditSurface(subcommand, issues, subcommandPath);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function auditOption(commandName, option, issues) {
|
|
59
|
+
if (!option.description.trim()) {
|
|
60
|
+
issues.push({
|
|
61
|
+
code: 'C2',
|
|
62
|
+
severity: 'warning',
|
|
63
|
+
message: `Option "${option.cliFlag ?? option.name}" on "${commandName}" has no description.`,
|
|
64
|
+
suggestion: "Add description to .option(): .option('[flag]', '[What this option controls — effect on behavior, not the type]')",
|
|
65
|
+
location: { command: commandName, option: option.cliFlag ?? option.name }
|
|
66
|
+
});
|
|
67
|
+
issues.push({
|
|
68
|
+
code: 'C7',
|
|
69
|
+
severity: 'warning',
|
|
70
|
+
message: `Option "${option.cliFlag ?? option.name}" on "${commandName}" is undocumented after CLI/config correlation.`,
|
|
71
|
+
suggestion: `Neither --help text nor typed config interface has a description for '${option.name}'. Add JSDoc to the config interface property or .option() description.`,
|
|
72
|
+
location: { command: commandName, option: option.cliFlag ?? option.name }
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (option.envVar &&
|
|
76
|
+
!includesEnvVar(option.description, option.envVar) &&
|
|
77
|
+
!includesEnvVar(option.remarks, option.envVar)) {
|
|
78
|
+
issues.push({
|
|
79
|
+
code: 'C6',
|
|
80
|
+
severity: 'alert',
|
|
81
|
+
message: `Option "${option.cliFlag ?? option.name}" on "${commandName}" supports ${option.envVar} but does not document it.`,
|
|
82
|
+
suggestion: `Add .env('${option.envVar}') to option or document in help text: 'Also settable via ${option.envVar}'`,
|
|
83
|
+
location: { command: commandName, option: option.cliFlag ?? option.name }
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function auditArgument(commandName, argument, issues) {
|
|
88
|
+
if (argument.description.trim())
|
|
89
|
+
return;
|
|
90
|
+
issues.push({
|
|
91
|
+
code: 'C4',
|
|
92
|
+
severity: 'warning',
|
|
93
|
+
message: `Argument "${argument.name}" on "${commandName}" has no description.`,
|
|
94
|
+
suggestion: `Add .argument('<${argument.name}>', '[What this argument represents — expected format/values]')`,
|
|
95
|
+
location: { command: commandName, argument: argument.name }
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function includesEnvVar(text, envVar) {
|
|
99
|
+
return typeof text === 'string' && text.includes(envVar);
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,WAAW,CAAC,KAAqB;IAC/C,MAAM,MAAM,GAAoB,EAAE,CAAC;IAEnC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AAC,IAAI,iEAAiE;QAC7G,QAAQ,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE;KAC5D,CAAC,CAAC;AACL,CAAC;AAED,SAAS,cAAc,CAAC,IAAwB,EAAE,MAAc;IAC9D,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ExtractedConfigSurface } from '@skillit/core';
|
|
2
|
+
/**
|
|
3
|
+
* Merges JSDoc tag metadata from a typed config interface surface into CLI
|
|
4
|
+
* option metadata extracted from commander/--help output.
|
|
5
|
+
*
|
|
6
|
+
* The CLI surface is treated as authoritative for structural fields (flags,
|
|
7
|
+
* description, required, defaultValue). The config surface contributes rich
|
|
8
|
+
* JSDoc metadata (remarks, useWhen, avoidWhen, pitfalls, category) that the
|
|
9
|
+
* CLI help text does not capture.
|
|
10
|
+
*
|
|
11
|
+
* @param cliSurface - The surface extracted from CLI introspection/help parsing
|
|
12
|
+
* @param configSurface - The surface extracted from a typed config interface (optional)
|
|
13
|
+
* @returns A new ExtractedConfigSurface combining both sources
|
|
14
|
+
*
|
|
15
|
+
* @category Correlation
|
|
16
|
+
* @useWhen
|
|
17
|
+
* - You have both CLI surfaces (from introspection/help) and typed config interfaces (from TypeDoc)
|
|
18
|
+
* - You want JSDoc @useWhen/@avoidWhen/@never tags to appear on CLI options in the generated skill
|
|
19
|
+
*/
|
|
20
|
+
export declare function correlateFlags(cliSurface: ExtractedConfigSurface, configSurface: ExtractedConfigSurface | undefined): ExtractedConfigSurface;
|
|
21
|
+
//# sourceMappingURL=correlator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correlator.d.ts","sourceRoot":"","sources":["../src/correlator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAyB,MAAM,eAAe,CAAC;AAEnF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,sBAAsB,EAClC,aAAa,EAAE,sBAAsB,GAAG,SAAS,GAChD,sBAAsB,CA0CxB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merges JSDoc tag metadata from a typed config interface surface into CLI
|
|
3
|
+
* option metadata extracted from commander/--help output.
|
|
4
|
+
*
|
|
5
|
+
* The CLI surface is treated as authoritative for structural fields (flags,
|
|
6
|
+
* description, required, defaultValue). The config surface contributes rich
|
|
7
|
+
* JSDoc metadata (remarks, useWhen, avoidWhen, pitfalls, category) that the
|
|
8
|
+
* CLI help text does not capture.
|
|
9
|
+
*
|
|
10
|
+
* @param cliSurface - The surface extracted from CLI introspection/help parsing
|
|
11
|
+
* @param configSurface - The surface extracted from a typed config interface (optional)
|
|
12
|
+
* @returns A new ExtractedConfigSurface combining both sources
|
|
13
|
+
*
|
|
14
|
+
* @category Correlation
|
|
15
|
+
* @useWhen
|
|
16
|
+
* - You have both CLI surfaces (from introspection/help) and typed config interfaces (from TypeDoc)
|
|
17
|
+
* - You want JSDoc @useWhen/@avoidWhen/@never tags to appear on CLI options in the generated skill
|
|
18
|
+
*/
|
|
19
|
+
export function correlateFlags(cliSurface, configSurface) {
|
|
20
|
+
if (!configSurface)
|
|
21
|
+
return cliSurface;
|
|
22
|
+
// Build lookup: lowercase property name → config option
|
|
23
|
+
const configLookup = new Map();
|
|
24
|
+
for (const opt of configSurface.options) {
|
|
25
|
+
configLookup.set(opt.name.toLowerCase(), opt);
|
|
26
|
+
}
|
|
27
|
+
// Merge each CLI option with matching config property
|
|
28
|
+
const mergedOptions = cliSurface.options.map((cliOpt) => {
|
|
29
|
+
const configOpt = configLookup.get(cliOpt.name.toLowerCase());
|
|
30
|
+
if (!configOpt)
|
|
31
|
+
return cliOpt;
|
|
32
|
+
return {
|
|
33
|
+
// CLI is authoritative for structural/presentation fields
|
|
34
|
+
...cliOpt,
|
|
35
|
+
// Use config description as fallback when CLI description is empty
|
|
36
|
+
description: cliOpt.description || configOpt.description,
|
|
37
|
+
// Config provides JSDoc-enriched metadata
|
|
38
|
+
remarks: cliOpt.remarks ?? configOpt.remarks,
|
|
39
|
+
useWhen: cliOpt.useWhen ?? configOpt.useWhen,
|
|
40
|
+
avoidWhen: cliOpt.avoidWhen ?? configOpt.avoidWhen,
|
|
41
|
+
pitfalls: cliOpt.pitfalls ?? configOpt.pitfalls,
|
|
42
|
+
category: cliOpt.category ?? configOpt.category
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
// Merge command-level tags from config surface into CLI surface
|
|
46
|
+
return {
|
|
47
|
+
...cliSurface,
|
|
48
|
+
options: mergedOptions,
|
|
49
|
+
useWhen: cliSurface.useWhen ?? configSurface.useWhen,
|
|
50
|
+
avoidWhen: cliSurface.avoidWhen ?? configSurface.avoidWhen,
|
|
51
|
+
pitfalls: cliSurface.pitfalls ?? configSurface.pitfalls,
|
|
52
|
+
remarks: cliSurface.remarks ?? configSurface.remarks,
|
|
53
|
+
// A config-provided usage example (e.g. from JSDoc @example) is preferred
|
|
54
|
+
// over commander's synthesized boilerplate (`[options]`, `[options] <args>`).
|
|
55
|
+
usage: isBoilerplateUsage(cliSurface.usage)
|
|
56
|
+
? (configSurface.usage ?? cliSurface.usage)
|
|
57
|
+
: (cliSurface.usage ?? configSurface.usage)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Whether a usage string is commander's synthesized default (no authored
|
|
62
|
+
* example), e.g. `[options]`, `[options] [command]`, `[options] <file>`.
|
|
63
|
+
*/
|
|
64
|
+
function isBoilerplateUsage(usage) {
|
|
65
|
+
if (usage === undefined)
|
|
66
|
+
return true;
|
|
67
|
+
return usage.match(/^\[options\]([\s]+[<[].*)?$/) !== null;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=correlator.js.map
|
|
@@ -0,0 +1 @@
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ACtB,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,aAAa,CAAC,OAAO;QACpD,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,aAAa,CAAC,SAAS;QAC1D,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,aAAa,CAAC,QAAQ;QACvD,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,aAAa,CAAC,OAAO;QACpD,0EAA0E;QAC1E,8EAA8E;QAC9E,KAAK,EAAE,kBAAkB,CAAC,UAAU,CAAC,KAAK,CAAC;YACzC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC;YAC3C,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,IAAI,aAAa,CAAC,KAAK,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,kBAAkB,CAAC,KAAyB;IACnD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACrC,OAAO,KAAK,CAAC,KAAK,CAAC,6BAA6B,CAAC,KAAK,IAAI,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ExtractedSkill, type ExtractedConfigSurface, type SkillRenderOptions, type SkillWriteOptions } from '@skillit/core';
|
|
2
|
+
export interface CliExtractionOptions {
|
|
3
|
+
/** Commander program object (preferred) */
|
|
4
|
+
program?: any;
|
|
5
|
+
/** Help text per command (fallback) */
|
|
6
|
+
helpTexts?: Record<string, string>;
|
|
7
|
+
/** Package metadata */
|
|
8
|
+
metadata?: {
|
|
9
|
+
name?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
keywords?: string[];
|
|
12
|
+
repository?: string;
|
|
13
|
+
author?: string;
|
|
14
|
+
};
|
|
15
|
+
/** Config surfaces from TypeDoc for JSDoc correlation */
|
|
16
|
+
configSurfaces?: ExtractedConfigSurface[];
|
|
17
|
+
}
|
|
18
|
+
export interface CliWriteOptions extends SkillWriteOptions, Partial<Pick<SkillRenderOptions, 'includeExamples' | 'includeSignatures' | 'maxTokens' | 'namePrefix' | 'license'>> {
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Extract a structured skill from a CLI program.
|
|
22
|
+
*
|
|
23
|
+
* Runs the three-phase pipeline: introspect (or parse help) → correlate with typed interfaces → produce ExtractedSkill.
|
|
24
|
+
*
|
|
25
|
+
* @category Extraction
|
|
26
|
+
* @useWhen
|
|
27
|
+
* - You have a Commander program and want to generate a skill from its command structure
|
|
28
|
+
* - You have raw --help output and no runtime access to the program object
|
|
29
|
+
* @avoidWhen
|
|
30
|
+
* - Your CLI is built with a framework other than Commander — use parseHelpOutput directly instead
|
|
31
|
+
* @never
|
|
32
|
+
* - NEVER pass both `program` and `helpTexts` — program takes precedence and helpTexts is silently ignored
|
|
33
|
+
* - NEVER forget to pass configSurfaces when you have typed option interfaces — JSDoc metadata won't be correlated
|
|
34
|
+
*/
|
|
35
|
+
export declare function extractCliSkill(options: CliExtractionOptions): Promise<ExtractedSkill>;
|
|
36
|
+
export declare function writeCliSkill(skill: ExtractedSkill, options: CliWriteOptions): import("@skillit/core").SkillWriteResult[];
|
|
37
|
+
//# sourceMappingURL=extract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAE3B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AAMvB,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,uBAAuB;IACvB,QAAQ,CAAC,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,yDAAyD;IACzD,cAAc,CAAC,EAAE,sBAAsB,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,eACf,SACE,iBAAiB,EACjB,OAAO,CACL,IAAI,CACF,kBAAkB,EAClB,iBAAiB,GAAG,mBAAmB,GAAG,WAAW,GAAG,YAAY,GAAG,SAAS,CACjF,CACF;CAAG;AAER;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,cAAc,CAAC,CAsE5F;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,8CA8B5E"}
|
package/dist/extract.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { renderSkills, writeSkills } from '@skillit/core';
|
|
4
|
+
import { introspectCommander } from './introspect-commander.js';
|
|
5
|
+
import { parseHelpOutput } from './help-parser.js';
|
|
6
|
+
import { correlateFlags } from './correlator.js';
|
|
7
|
+
import { runCliAudit } from './audit.js';
|
|
8
|
+
/**
|
|
9
|
+
* Extract a structured skill from a CLI program.
|
|
10
|
+
*
|
|
11
|
+
* Runs the three-phase pipeline: introspect (or parse help) → correlate with typed interfaces → produce ExtractedSkill.
|
|
12
|
+
*
|
|
13
|
+
* @category Extraction
|
|
14
|
+
* @useWhen
|
|
15
|
+
* - You have a Commander program and want to generate a skill from its command structure
|
|
16
|
+
* - You have raw --help output and no runtime access to the program object
|
|
17
|
+
* @avoidWhen
|
|
18
|
+
* - Your CLI is built with a framework other than Commander — use parseHelpOutput directly instead
|
|
19
|
+
* @never
|
|
20
|
+
* - NEVER pass both `program` and `helpTexts` — program takes precedence and helpTexts is silently ignored
|
|
21
|
+
* - NEVER forget to pass configSurfaces when you have typed option interfaces — JSDoc metadata won't be correlated
|
|
22
|
+
*/
|
|
23
|
+
export async function extractCliSkill(options) {
|
|
24
|
+
const { program, helpTexts, metadata = {}, configSurfaces = [] } = options;
|
|
25
|
+
// Extract command structure (introspection or help)
|
|
26
|
+
let cliSurfaces = [];
|
|
27
|
+
if (program !== undefined) {
|
|
28
|
+
cliSurfaces = introspectCommander(program);
|
|
29
|
+
}
|
|
30
|
+
else if (helpTexts !== undefined) {
|
|
31
|
+
cliSurfaces = Object.entries(helpTexts).map(([commandName, text]) => parseHelpOutput(text, commandName));
|
|
32
|
+
}
|
|
33
|
+
// Correlate with typed interfaces
|
|
34
|
+
// Build lookup from config surfaces by their name (case-insensitive)
|
|
35
|
+
const configSurfaceLookup = new Map();
|
|
36
|
+
for (const surface of configSurfaces) {
|
|
37
|
+
configSurfaceLookup.set(surface.name.toLowerCase(), surface);
|
|
38
|
+
}
|
|
39
|
+
// For each CLI surface, find a matching config surface by convention:
|
|
40
|
+
// command "generate" → look for "GenerateOptions" or "generateoptions" (case-insensitive)
|
|
41
|
+
const correlatedCliSurfaces = cliSurfaces.map((cliSurface) => {
|
|
42
|
+
const commandNameLower = cliSurface.name.toLowerCase();
|
|
43
|
+
// Try exact name match first
|
|
44
|
+
let matchingConfig = configSurfaceLookup.get(commandNameLower);
|
|
45
|
+
// If not found, try "<commandName>options" convention
|
|
46
|
+
if (!matchingConfig) {
|
|
47
|
+
matchingConfig = configSurfaceLookup.get(`${commandNameLower}options`);
|
|
48
|
+
}
|
|
49
|
+
// Call correlateFlags to merge JSDoc
|
|
50
|
+
return correlateFlags(cliSurface, matchingConfig);
|
|
51
|
+
});
|
|
52
|
+
// Collect non-CLI config surfaces (sourceType === 'config') from configSurfaces
|
|
53
|
+
const nonCliConfigSurfaces = configSurfaces.filter((s) => s.sourceType !== 'cli');
|
|
54
|
+
// Build the final configSurfaces array: correlated CLI surfaces + non-CLI config surfaces
|
|
55
|
+
const allConfigSurfaces = [
|
|
56
|
+
...correlatedCliSurfaces,
|
|
57
|
+
...nonCliConfigSurfaces
|
|
58
|
+
];
|
|
59
|
+
// Build ExtractedSkill with empty functions/classes/types/enums/variables
|
|
60
|
+
// but populated configSurfaces
|
|
61
|
+
const skillWithoutAudit = {
|
|
62
|
+
name: metadata.name ?? '',
|
|
63
|
+
description: metadata.description ?? '',
|
|
64
|
+
keywords: metadata.keywords,
|
|
65
|
+
repository: metadata.repository,
|
|
66
|
+
author: metadata.author,
|
|
67
|
+
functions: [],
|
|
68
|
+
classes: [],
|
|
69
|
+
types: [],
|
|
70
|
+
enums: [],
|
|
71
|
+
variables: [],
|
|
72
|
+
examples: [],
|
|
73
|
+
...(allConfigSurfaces.length > 0 ? { configSurfaces: allConfigSurfaces } : {})
|
|
74
|
+
};
|
|
75
|
+
const auditIssues = runCliAudit(skillWithoutAudit);
|
|
76
|
+
return {
|
|
77
|
+
...skillWithoutAudit,
|
|
78
|
+
audit: { status: 'completed', issues: auditIssues },
|
|
79
|
+
auditIssues
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export function writeCliSkill(skill, options) {
|
|
83
|
+
const renderedSkills = renderSkills([skill], {
|
|
84
|
+
outDir: options.outDir,
|
|
85
|
+
...(options.includeExamples !== undefined ? { includeExamples: options.includeExamples } : {}),
|
|
86
|
+
...(options.includeSignatures !== undefined
|
|
87
|
+
? { includeSignatures: options.includeSignatures }
|
|
88
|
+
: {}),
|
|
89
|
+
...(options.maxTokens !== undefined ? { maxTokens: options.maxTokens } : {}),
|
|
90
|
+
...(options.namePrefix !== undefined ? { namePrefix: options.namePrefix } : {}),
|
|
91
|
+
...(options.license !== undefined ? { license: options.license } : {})
|
|
92
|
+
});
|
|
93
|
+
const installTargets = options.installTargets ?? [];
|
|
94
|
+
const results = writeSkills(renderedSkills, {
|
|
95
|
+
outDir: options.outDir,
|
|
96
|
+
installTargets,
|
|
97
|
+
...(options.includeOutDir !== undefined ? { includeOutDir: options.includeOutDir } : {})
|
|
98
|
+
});
|
|
99
|
+
if (installTargets.length === 0) {
|
|
100
|
+
return results;
|
|
101
|
+
}
|
|
102
|
+
return [
|
|
103
|
+
...results,
|
|
104
|
+
...writeSkills([loadBundledCliGuidanceSkill()], {
|
|
105
|
+
outDir: options.outDir,
|
|
106
|
+
installTargets,
|
|
107
|
+
includeOutDir: false
|
|
108
|
+
})
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
function loadBundledCliGuidanceSkill() {
|
|
112
|
+
const skillPath = fileURLToPath(new URL('../skills/skillit-cli-docs/SKILL.md', import.meta.url));
|
|
113
|
+
let content;
|
|
114
|
+
try {
|
|
115
|
+
content = readFileSync(skillPath, 'utf-8');
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
throw new Error(`Failed to read bundled CLI guidance from ${skillPath}: ${messageOf(error)}`, {
|
|
119
|
+
cause: error
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
skill: {
|
|
124
|
+
filename: 'skillit-cli-docs/SKILL.md',
|
|
125
|
+
content
|
|
126
|
+
},
|
|
127
|
+
references: []
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function messageOf(error) {
|
|
131
|
+
return error instanceof Error ? error.message : String(error);
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=extract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extract.js","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,YAAY,EACZ,WAAW,EAMZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO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AC,CAAC,2BAA2B,EAAE,CAAC,EAAE;YAC9C,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,cAAc;YACd,aAAa,EAAE,KAAK;SACrB,CAAC;KACH,CAAC;AACJ,CAAC;AAED,SAAS,2BAA2B;IAClC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,qCAAqC,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACjG,IAAI,OAAe,CAAC;IACpB,IAAI,CAAC;QACH,OAAO,GAAG,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,4CAA4C,SAAS,KAAK,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE;YAC5F,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;IACL,CAAC;IACD,OAAO;QACL,KAAK,EAAE;YACL,QAAQ,EAAE,2BAA2B;YACrC,OAAO;SACR;QACD,UAAU,EAAE,EAAE;KACf,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ExtractedConfigSurface } from '@skillit/core';
|
|
2
|
+
/**
|
|
3
|
+
* Parse standard `--help` text output into an {@link ExtractedConfigSurface}.
|
|
4
|
+
*
|
|
5
|
+
* This is the framework-agnostic fallback used when runtime introspection of a
|
|
6
|
+
* commander/yargs program is not available.
|
|
7
|
+
*
|
|
8
|
+
* @param text Raw text emitted by `program --help`
|
|
9
|
+
* @param commandName Canonical name for this surface (e.g. `"generate"`)
|
|
10
|
+
*
|
|
11
|
+
* @category Fallback
|
|
12
|
+
* @useWhen
|
|
13
|
+
* - Runtime introspection is unavailable (no access to the program object)
|
|
14
|
+
* - The CLI uses a framework other than Commander (yargs, oclif, custom)
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseHelpOutput(text: string, commandName: string): ExtractedConfigSurface;
|
|
17
|
+
//# sourceMappingURL=help-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-parser.d.ts","sourceRoot":"","sources":["../src/help-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EAGvB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,sBAAsB,CA6IzF"}
|