@skillit/core 1.5.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 +55 -0
- package/dist/audit-formatter.d.ts +36 -0
- package/dist/audit-formatter.d.ts.map +1 -0
- package/dist/audit-formatter.js +173 -0
- package/dist/audit-formatter.js.map +1 -0
- package/dist/audit-score.d.ts +76 -0
- package/dist/audit-score.d.ts.map +1 -0
- package/dist/audit-score.js +490 -0
- package/dist/audit-score.js.map +1 -0
- package/dist/audit-types.d.ts +81 -0
- package/dist/audit-types.d.ts.map +1 -0
- package/dist/audit-types.js +2 -0
- package/dist/audit-types.js.map +1 -0
- package/dist/audit.d.ts +17 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +567 -0
- package/dist/audit.js.map +1 -0
- package/dist/canonical.d.ts +36 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +148 -0
- package/dist/canonical.js.map +1 -0
- package/dist/config-renderer.d.ts +16 -0
- package/dist/config-renderer.d.ts.map +1 -0
- package/dist/config-renderer.js +296 -0
- package/dist/config-renderer.js.map +1 -0
- package/dist/config-types.d.ts +144 -0
- package/dist/config-types.d.ts.map +1 -0
- package/dist/config-types.js +2 -0
- package/dist/config-types.js.map +1 -0
- package/dist/docs-scanner.d.ts +40 -0
- package/dist/docs-scanner.d.ts.map +1 -0
- package/dist/docs-scanner.js +176 -0
- package/dist/docs-scanner.js.map +1 -0
- package/dist/examples-scanner.d.ts +39 -0
- package/dist/examples-scanner.d.ts.map +1 -0
- package/dist/examples-scanner.js +221 -0
- package/dist/examples-scanner.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/llms-txt.d.ts +20 -0
- package/dist/llms-txt.d.ts.map +1 -0
- package/dist/llms-txt.js +187 -0
- package/dist/llms-txt.js.map +1 -0
- package/dist/markdown-parser.d.ts +11 -0
- package/dist/markdown-parser.d.ts.map +1 -0
- package/dist/markdown-parser.js +222 -0
- package/dist/markdown-parser.js.map +1 -0
- package/dist/markdown-types.d.ts +48 -0
- package/dist/markdown-types.d.ts.map +1 -0
- package/dist/markdown-types.js +2 -0
- package/dist/markdown-types.js.map +1 -0
- package/dist/readme-parser.d.ts +21 -0
- package/dist/readme-parser.d.ts.map +1 -0
- package/dist/readme-parser.js +137 -0
- package/dist/readme-parser.js.map +1 -0
- package/dist/references-mcp.d.ts +79 -0
- package/dist/references-mcp.d.ts.map +1 -0
- package/dist/references-mcp.js +130 -0
- package/dist/references-mcp.js.map +1 -0
- package/dist/refine/ast-edit.d.ts +21 -0
- package/dist/refine/ast-edit.d.ts.map +1 -0
- package/dist/refine/ast-edit.js +147 -0
- package/dist/refine/ast-edit.js.map +1 -0
- package/dist/refine/index.d.ts +7 -0
- package/dist/refine/index.d.ts.map +1 -0
- package/dist/refine/index.js +6 -0
- package/dist/refine/index.js.map +1 -0
- package/dist/refine/jsdoc-edit.d.ts +4 -0
- package/dist/refine/jsdoc-edit.d.ts.map +1 -0
- package/dist/refine/jsdoc-edit.js +6 -0
- package/dist/refine/jsdoc-edit.js.map +1 -0
- package/dist/refine/loop.d.ts +8 -0
- package/dist/refine/loop.d.ts.map +1 -0
- package/dist/refine/loop.js +98 -0
- package/dist/refine/loop.js.map +1 -0
- package/dist/refine/select-targets.d.ts +5 -0
- package/dist/refine/select-targets.d.ts.map +1 -0
- package/dist/refine/select-targets.js +30 -0
- package/dist/refine/select-targets.js.map +1 -0
- package/dist/refine/types.d.ts +67 -0
- package/dist/refine/types.d.ts.map +1 -0
- package/dist/refine/types.js +2 -0
- package/dist/refine/types.js.map +1 -0
- package/dist/renderer.d.ts +27 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +1244 -0
- package/dist/renderer.js.map +1 -0
- package/dist/tokens.d.ts +14 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +26 -0
- package/dist/tokens.js.map +1 -0
- package/dist/types.d.ts +519 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/writer.d.ts +17 -0
- package/dist/writer.d.ts.map +1 -0
- package/dist/writer.js +313 -0
- package/dist/writer.js.map +1 -0
- package/package.json +54 -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,55 @@
|
|
|
1
|
+
# @skillit/core
|
|
2
|
+
|
|
3
|
+
Shared types, renderers, and utilities for the [skillit](https://github.com/pradeepmouli/skillit) plugin ecosystem.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
This package is used by source adapters (like `@skillit/typedoc`) to render extracted API info into SKILL.md and llms.txt files. You typically don't install this directly — it's a dependency of the plugins.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import {
|
|
11
|
+
renderSkills,
|
|
12
|
+
renderSkill,
|
|
13
|
+
writeSkills,
|
|
14
|
+
renderLlmsTxt,
|
|
15
|
+
estimateTokens
|
|
16
|
+
} from '@skillit/core';
|
|
17
|
+
|
|
18
|
+
// Render extracted skills into SKILL.md files
|
|
19
|
+
const rendered = renderSkills(extractedSkills, {
|
|
20
|
+
outDir: 'skills',
|
|
21
|
+
maxTokens: 4000,
|
|
22
|
+
license: 'MIT'
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Write to disk
|
|
26
|
+
writeSkills(rendered, { outDir: 'skills' });
|
|
27
|
+
|
|
28
|
+
// Optionally render llms.txt
|
|
29
|
+
const llms = renderLlmsTxt(extractedSkills, {
|
|
30
|
+
projectName: 'my-lib',
|
|
31
|
+
projectDescription: 'A great library'
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## API
|
|
36
|
+
|
|
37
|
+
### `renderSkills(skills, options?)` / `renderSkill(skill, options?)`
|
|
38
|
+
|
|
39
|
+
Renders extracted API data into SKILL.md content with agentskills.io-compliant frontmatter.
|
|
40
|
+
|
|
41
|
+
### `renderLlmsTxt(skills, options)`
|
|
42
|
+
|
|
43
|
+
Renders llms.txt (summary index) and llms-full.txt (complete API) following the llmstxt.org spec.
|
|
44
|
+
|
|
45
|
+
### `writeSkills(rendered, options)`
|
|
46
|
+
|
|
47
|
+
Writes rendered skill files to disk.
|
|
48
|
+
|
|
49
|
+
### `estimateTokens(text)` / `truncateToTokenBudget(text, maxTokens)`
|
|
50
|
+
|
|
51
|
+
Token budgeting utilities (~4 chars/token estimation).
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AuditResult } from './audit-types.js';
|
|
2
|
+
import type { SkillJudgeEstimate } from './audit-score.js';
|
|
3
|
+
/**
|
|
4
|
+
* Format an {@link AuditResult} as human-readable text suitable for TypeDoc logs.
|
|
5
|
+
*
|
|
6
|
+
* Output groups issues by severity (fatal → error → warning → alert),
|
|
7
|
+
* then lists passing checks at the end. Empty severity groups are omitted.
|
|
8
|
+
*
|
|
9
|
+
* @category Audit
|
|
10
|
+
*/
|
|
11
|
+
export declare function formatAuditText(result: AuditResult): string;
|
|
12
|
+
/**
|
|
13
|
+
* Format an {@link AuditResult} as pretty-printed JSON for machine consumption.
|
|
14
|
+
*
|
|
15
|
+
* Returns the full result object serialized with 2-space indentation so it
|
|
16
|
+
* can be parsed by downstream tooling without any further transformation.
|
|
17
|
+
*
|
|
18
|
+
* @category Audit
|
|
19
|
+
*/
|
|
20
|
+
export declare function formatAuditJson(result: AuditResult): string;
|
|
21
|
+
/**
|
|
22
|
+
* Format a {@link SkillJudgeEstimate} as human-readable text.
|
|
23
|
+
*
|
|
24
|
+
* Shows total score, grade, per-dimension breakdown with inline suggestions
|
|
25
|
+
* for dimensions below 80% of their max, and a numbered improvement list.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const estimate = estimateSkillJudgeScore(auditResult);
|
|
30
|
+
* console.log(formatScoreEstimate(estimate));
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @category Audit
|
|
34
|
+
*/
|
|
35
|
+
export declare function formatScoreEstimate(estimate: SkillJudgeEstimate): string;
|
|
36
|
+
//# sourceMappingURL=audit-formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-formatter.d.ts","sourceRoot":"","sources":["../src/audit-formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,WAAW,EAAiB,MAAM,kBAAkB,CAAC;AAC/E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAuD3D;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAwC3D;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAE3D;AAmCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,CAyCxE"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Severity display configuration
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
const SEVERITY_ORDER = ['fatal', 'error', 'warning', 'alert'];
|
|
5
|
+
const SEVERITY_EMOJI = {
|
|
6
|
+
fatal: '🔴',
|
|
7
|
+
error: '🔴',
|
|
8
|
+
warning: '🟡',
|
|
9
|
+
alert: '🔵'
|
|
10
|
+
};
|
|
11
|
+
const SEVERITY_LABEL = {
|
|
12
|
+
fatal: 'FATAL',
|
|
13
|
+
error: 'ERROR',
|
|
14
|
+
warning: 'WARNING',
|
|
15
|
+
alert: 'ALERT'
|
|
16
|
+
};
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Helpers
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
function fileRef(issue) {
|
|
21
|
+
return issue.line !== null ? `${issue.file}:${issue.line}` : issue.file;
|
|
22
|
+
}
|
|
23
|
+
function groupBySeverity(issues) {
|
|
24
|
+
const map = new Map();
|
|
25
|
+
for (const sev of SEVERITY_ORDER) {
|
|
26
|
+
map.set(sev, []);
|
|
27
|
+
}
|
|
28
|
+
for (const issue of issues) {
|
|
29
|
+
map.get(issue.severity).push(issue);
|
|
30
|
+
}
|
|
31
|
+
return map;
|
|
32
|
+
}
|
|
33
|
+
function groupByFile(issues) {
|
|
34
|
+
const map = new Map();
|
|
35
|
+
for (const issue of issues) {
|
|
36
|
+
const ref = fileRef(issue);
|
|
37
|
+
if (!map.has(ref))
|
|
38
|
+
map.set(ref, []);
|
|
39
|
+
map.get(ref).push(issue);
|
|
40
|
+
}
|
|
41
|
+
return map;
|
|
42
|
+
}
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// Public API
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
/**
|
|
47
|
+
* Format an {@link AuditResult} as human-readable text suitable for TypeDoc logs.
|
|
48
|
+
*
|
|
49
|
+
* Output groups issues by severity (fatal → error → warning → alert),
|
|
50
|
+
* then lists passing checks at the end. Empty severity groups are omitted.
|
|
51
|
+
*
|
|
52
|
+
* @category Audit
|
|
53
|
+
*/
|
|
54
|
+
export function formatAuditText(result) {
|
|
55
|
+
const lines = [];
|
|
56
|
+
// Header
|
|
57
|
+
lines.push(`📊 Skill Documentation Audit: ${result.package}`);
|
|
58
|
+
const { fatal, error, warning, alert } = result.summary;
|
|
59
|
+
lines.push(` ${fatal} fatal · ${error} error · ${warning} warning · ${alert} alert`);
|
|
60
|
+
// Issue groups
|
|
61
|
+
const bySeverity = groupBySeverity(result.issues);
|
|
62
|
+
for (const sev of SEVERITY_ORDER) {
|
|
63
|
+
const sevIssues = bySeverity.get(sev);
|
|
64
|
+
if (sevIssues.length === 0)
|
|
65
|
+
continue;
|
|
66
|
+
lines.push('');
|
|
67
|
+
lines.push(`${SEVERITY_EMOJI[sev]} ${SEVERITY_LABEL[sev]} (${sevIssues.length})`);
|
|
68
|
+
lines.push('');
|
|
69
|
+
const byFile = groupByFile(sevIssues);
|
|
70
|
+
for (const [ref, fileIssues] of byFile) {
|
|
71
|
+
lines.push(` ${ref}`);
|
|
72
|
+
for (const issue of fileIssues) {
|
|
73
|
+
lines.push(` ⚠ ${issue.message}`);
|
|
74
|
+
lines.push(` Suggestion: ${issue.suggestion}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Passing checks
|
|
79
|
+
if (result.passing.length > 0) {
|
|
80
|
+
lines.push('');
|
|
81
|
+
lines.push(`✅ PASSING (${result.passing.length} checks)`);
|
|
82
|
+
for (const pass of result.passing) {
|
|
83
|
+
const detail = pass.detail ? ` — ${pass.detail}` : '';
|
|
84
|
+
lines.push(` ✓ ${pass.message}${detail}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return lines.join('\n');
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Format an {@link AuditResult} as pretty-printed JSON for machine consumption.
|
|
91
|
+
*
|
|
92
|
+
* Returns the full result object serialized with 2-space indentation so it
|
|
93
|
+
* can be parsed by downstream tooling without any further transformation.
|
|
94
|
+
*
|
|
95
|
+
* @category Audit
|
|
96
|
+
*/
|
|
97
|
+
export function formatAuditJson(result) {
|
|
98
|
+
return JSON.stringify(result, null, 2);
|
|
99
|
+
}
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
// Dimension metadata for formatting
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
const DIMENSION_LABELS = [
|
|
104
|
+
{
|
|
105
|
+
key: 'd1_knowledgeDelta',
|
|
106
|
+
label: 'D1 Knowledge Delta',
|
|
107
|
+
max: 20,
|
|
108
|
+
hint: 'add @remarks to complex functions'
|
|
109
|
+
},
|
|
110
|
+
{ key: 'd2_procedures', label: 'D2 Procedures', max: 15, hint: 'add @useWhen' },
|
|
111
|
+
{ key: 'd3_antiPatterns', label: 'D3 Anti-Patterns', max: 15, hint: 'add @never' },
|
|
112
|
+
{ key: 'd4_description', label: 'D4 Description', max: 15, hint: 'add package.json description' },
|
|
113
|
+
{
|
|
114
|
+
key: 'd5_progressiveDisclosure',
|
|
115
|
+
label: 'D5 Progressive Disclosure',
|
|
116
|
+
max: 15,
|
|
117
|
+
hint: 'add @category'
|
|
118
|
+
},
|
|
119
|
+
{ key: 'd6_freedom', label: 'D6 Freedom', max: 15, hint: 'add @avoidWhen' },
|
|
120
|
+
{ key: 'd7_pattern', label: 'D7 Pattern', max: 10, hint: 'add @category' },
|
|
121
|
+
{ key: 'd8_usability', label: 'D8 Usability', max: 15, hint: 'add @param/@returns' }
|
|
122
|
+
];
|
|
123
|
+
// Width of the longest label (for alignment)
|
|
124
|
+
const LABEL_WIDTH = Math.max(...DIMENSION_LABELS.map((d) => d.label.length));
|
|
125
|
+
/**
|
|
126
|
+
* Format a {@link SkillJudgeEstimate} as human-readable text.
|
|
127
|
+
*
|
|
128
|
+
* Shows total score, grade, per-dimension breakdown with inline suggestions
|
|
129
|
+
* for dimensions below 80% of their max, and a numbered improvement list.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* const estimate = estimateSkillJudgeScore(auditResult);
|
|
134
|
+
* console.log(formatScoreEstimate(estimate));
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* @category Audit
|
|
138
|
+
*/
|
|
139
|
+
export function formatScoreEstimate(estimate) {
|
|
140
|
+
const lines = [];
|
|
141
|
+
// Header
|
|
142
|
+
lines.push(`📊 Skill-Judge Estimate: ${estimate.total}/${120} (${estimate.percentage}%) — Grade ${estimate.grade}`);
|
|
143
|
+
lines.push('');
|
|
144
|
+
// Per-dimension rows
|
|
145
|
+
for (const dim of DIMENSION_LABELS) {
|
|
146
|
+
const score = estimate.dimensions[dim.key];
|
|
147
|
+
const pctOfMax = score / dim.max;
|
|
148
|
+
const needsHint = pctOfMax < 0.8;
|
|
149
|
+
const labelPadded = dim.label.padEnd(LABEL_WIDTH);
|
|
150
|
+
const scoreStr = `${score}/${dim.max}`;
|
|
151
|
+
// Right-align score within a 5-char field
|
|
152
|
+
const scoreField = scoreStr.padStart(5);
|
|
153
|
+
const hintStr = needsHint ? ` ← ${dim.hint}` : '';
|
|
154
|
+
lines.push(` ${labelPadded}: ${scoreField}${hintStr}`);
|
|
155
|
+
}
|
|
156
|
+
// Top improvements
|
|
157
|
+
if (estimate.improvements.length > 0) {
|
|
158
|
+
lines.push('');
|
|
159
|
+
lines.push(' Top improvements:');
|
|
160
|
+
estimate.improvements.forEach((imp, i) => {
|
|
161
|
+
const hasTargets = imp.targets && imp.targets.length > 0;
|
|
162
|
+
const suffix = hasTargets ? ' — missing on:' : '';
|
|
163
|
+
lines.push(` ${i + 1}. ${imp.suggestion}${suffix}`);
|
|
164
|
+
if (hasTargets && imp.targets) {
|
|
165
|
+
for (const t of imp.targets) {
|
|
166
|
+
lines.push(` ${t.file} → ${t.name} (${t.kind})`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return lines.join('\n');
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=audit-formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-formatter.js","sourceRoot":"","sources":["../src/audit-formatter.ts"],"names":[],"mappings":"AAGA,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E,MAAM,cAAc,GAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAE/E,MAAM,cAAc,GAAkC;IACpD,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,MAAM,cAAc,GAAkC;IACpD,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,SAAS,OAAO,CAAC,KAAiB;IAChC,OAAO,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;AAC1E,CAA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,KAAK,UAAU,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1D,CAAC;IAED,mBAAmB;IACnB,IAAI,QAAQ,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAClC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;YACvC,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;YACzD,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;YAClD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,UAAU,GAAG,MAAM,EAAE,CAAC,CAAC;YACrD,IAAI,UAAU,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;gBAC9B,KAAK,MAAM,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;oBAC5B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;gBACvD,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { AuditResult } from './audit-types.js';
|
|
2
|
+
import type { ExtractedSkill } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* An agent-actionable improvement suggestion with specific file/export targets.
|
|
5
|
+
*
|
|
6
|
+
* @category Audit
|
|
7
|
+
*/
|
|
8
|
+
export interface ActionableImprovement {
|
|
9
|
+
/** Human-readable suggestion */
|
|
10
|
+
suggestion: string;
|
|
11
|
+
/** Points gained if fixed */
|
|
12
|
+
points: number;
|
|
13
|
+
/** Dimension affected (e.g. "D3") */
|
|
14
|
+
dimension: string;
|
|
15
|
+
/** Specific exports to annotate (file path → export name + kind) */
|
|
16
|
+
targets?: Array<{
|
|
17
|
+
file: string;
|
|
18
|
+
name: string;
|
|
19
|
+
kind: string;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A skill-judge score estimate derived from audit check results.
|
|
24
|
+
*
|
|
25
|
+
* Maps the 20+ audit checks to the 8 skill-judge dimensions and produces
|
|
26
|
+
* a total score, percentage, letter grade, and top improvement suggestions.
|
|
27
|
+
*
|
|
28
|
+
* @category Audit
|
|
29
|
+
*/
|
|
30
|
+
export interface SkillJudgeEstimate {
|
|
31
|
+
dimensions: {
|
|
32
|
+
/** /20 — How much new knowledge the skill imparts */
|
|
33
|
+
d1_knowledgeDelta: number;
|
|
34
|
+
/** /15 — Quality of usage procedures and conditions */
|
|
35
|
+
d2_procedures: number;
|
|
36
|
+
/** /15 — Coverage of known pitfalls and anti-patterns */
|
|
37
|
+
d3_antiPatterns: number;
|
|
38
|
+
/** /15 — Clarity and completeness of descriptions */
|
|
39
|
+
d4_description: number;
|
|
40
|
+
/** /15 — Progressive disclosure: discovery vs. depth */
|
|
41
|
+
d5_progressiveDisclosure: number;
|
|
42
|
+
/** /15 — Freedom from prescriptive over-constraints */
|
|
43
|
+
d6_freedom: number;
|
|
44
|
+
/** /10 — Pattern consistency and grouping */
|
|
45
|
+
d7_pattern: number;
|
|
46
|
+
/** /15 — Developer usability: params, returns, examples */
|
|
47
|
+
d8_usability: number;
|
|
48
|
+
};
|
|
49
|
+
/** Sum of all dimensions (max 120) */
|
|
50
|
+
total: number;
|
|
51
|
+
/** total / 120 * 100, rounded to one decimal */
|
|
52
|
+
percentage: number;
|
|
53
|
+
/** Letter grade based on percentage */
|
|
54
|
+
grade: 'A' | 'B' | 'C' | 'D' | 'F';
|
|
55
|
+
/** Top 3 actionable improvement suggestions (may be fewer if all dimensions pass 80%) */
|
|
56
|
+
improvements: ActionableImprovement[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Estimate the 8-dimension skill-judge score from an {@link AuditResult}.
|
|
60
|
+
*
|
|
61
|
+
* Each dimension starts at a baseline and adds/deducts based on which audit
|
|
62
|
+
* checks pass or fail. Dimensions are capped at their respective maxima.
|
|
63
|
+
*
|
|
64
|
+
* @param audit - The completed audit result to score
|
|
65
|
+
* @param skill - Optional extracted skill; when provided, improvements include specific file/export targets
|
|
66
|
+
* @returns A {@link SkillJudgeEstimate} with dimension breakdown, total, grade, and improvements
|
|
67
|
+
*
|
|
68
|
+
* @category Audit
|
|
69
|
+
* @useWhen
|
|
70
|
+
* - You want a quick human-readable quality rating after running an audit
|
|
71
|
+
* - Building dashboards that track skill quality over time
|
|
72
|
+
* @avoidWhen
|
|
73
|
+
* - Using as a hard CI gate — prefer explicit audit codes (F1, E4, etc.) for gating
|
|
74
|
+
*/
|
|
75
|
+
export declare function estimateSkillJudgeScore(audit: AuditResult, skill?: ExtractedSkill): SkillJudgeEstimate;
|
|
76
|
+
//# sourceMappingURL=audit-score.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-score.d.ts","sourceRoot":"","sources":["../src/audit-score.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAMjD;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,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