@skillit/core 1.5.0 → 1.6.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/dist/audit-score.js +82 -4
- package/dist/audit-score.js.map +1 -1
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +6 -3
- package/dist/audit.js.map +1 -1
- package/dist/config-extract.d.ts +45 -0
- package/dist/config-extract.d.ts.map +1 -0
- package/dist/config-extract.js +227 -0
- package/dist/config-extract.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/refine/ast-edit.d.ts +10 -0
- package/dist/refine/ast-edit.d.ts.map +1 -1
- package/dist/refine/ast-edit.js +89 -18
- package/dist/refine/ast-edit.js.map +1 -1
- package/dist/refine/config-source.d.ts +77 -0
- package/dist/refine/config-source.d.ts.map +1 -0
- package/dist/refine/config-source.js +295 -0
- package/dist/refine/config-source.js.map +1 -0
- package/dist/refine/index.d.ts +3 -1
- package/dist/refine/index.d.ts.map +1 -1
- package/dist/refine/index.js +2 -1
- package/dist/refine/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,4BAA4B,EAC5B,cAAc,EACd,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,WAAW,EACX,WAAW,EACX,gBAAgB,E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MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAElF,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEnG,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAErF,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC1E,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ export { auditSkill } from './audit.js';
|
|
|
24
24
|
export { formatAuditText, formatAuditJson, formatScoreEstimate } from './audit-formatter.js';
|
|
25
25
|
export { estimateSkillJudgeScore } from './audit-score.js';
|
|
26
26
|
export { renderConfigSurfaceSection, renderConfigReference } from './config-renderer.js';
|
|
27
|
+
export { extractConfigSurface } from './config-extract.js';
|
|
27
28
|
export { parseMarkdownDoc } from './markdown-parser.js';
|
|
28
29
|
export { scanDocs, docsToExtractedDocuments, scanRootDocs } from './docs-scanner.js';
|
|
29
30
|
export { scanExamples, linkExamplesToSkill } from './examples-scanner.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAsCH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEvF,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAY9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAU3D,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAsCH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEvF,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAY9C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAU3D,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAI3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAErF,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG1E,cAAc,mBAAmB,CAAC"}
|
|
@@ -10,6 +10,16 @@ import type { RefineTag } from './types.js';
|
|
|
10
10
|
* - If the declaration is not found, the source is returned unchanged.
|
|
11
11
|
*/
|
|
12
12
|
export declare function upsertJsDocTag(source: string, declName: string, tag: RefineTag, content: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Insert or update a JSDoc tag on a property of a config type.
|
|
15
|
+
*
|
|
16
|
+
* `propertyPath` is a dot path into the interface or object-type alias named
|
|
17
|
+
* `typeName` (e.g. `outDir` or `components.prefix`). Otherwise behaves like
|
|
18
|
+
* {@link upsertJsDocTag}. Returns the source unchanged when the type or
|
|
19
|
+
* property is not found. Used by the config refine source to write routing
|
|
20
|
+
* tags back onto a config type's property declarations.
|
|
21
|
+
*/
|
|
22
|
+
export declare function upsertPropertyJsDocTag(source: string, typeName: string, propertyPath: string, tag: RefineTag, content: string): string;
|
|
13
23
|
/**
|
|
14
24
|
* Parse the leading JSDoc block of a named export declaration and return a
|
|
15
25
|
* map of the RefineTag values found in it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-edit.d.ts","sourceRoot":"","sources":["../../src/refine/ast-edit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ast-edit.d.ts","sourceRoot":"","sources":["../../src/refine/ast-edit.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAwF5C;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,SAAS,EACd,OAAO,EAAE,MAAM,GACd,MAAM,CAKR;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,GAAG,EAAE,SAAS,EACd,OAAO,EAAE,MAAM,GACd,MAAM,CAOR;AA4DD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAyCpC"}
|
package/dist/refine/ast-edit.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// packages/core/src/refine/ast-edit.ts
|
|
2
2
|
import { parse, Lang } from '@ast-grep/napi';
|
|
3
|
+
import { escapeJsDocClose, findPropertyByPath, findTypeBody, unescapeJsDocClose } from '../config-extract.js';
|
|
3
4
|
// `satisfies` ensures every listed value is a valid RefineTag. The
|
|
4
5
|
// `MissingTags` assertion below makes the inverse hold too: if a value is added
|
|
5
6
|
// to the RefineTag union but not to this list, compilation fails — so the
|
|
@@ -96,26 +97,74 @@ export function upsertJsDocTag(source, declName, tag, content) {
|
|
|
96
97
|
const anchorNode = findDeclaration(root, declName);
|
|
97
98
|
if (!anchorNode)
|
|
98
99
|
return source;
|
|
99
|
-
|
|
100
|
+
return upsertTagOnAnchor(source, root, anchorNode, tag, content);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Insert or update a JSDoc tag on a property of a config type.
|
|
104
|
+
*
|
|
105
|
+
* `propertyPath` is a dot path into the interface or object-type alias named
|
|
106
|
+
* `typeName` (e.g. `outDir` or `components.prefix`). Otherwise behaves like
|
|
107
|
+
* {@link upsertJsDocTag}. Returns the source unchanged when the type or
|
|
108
|
+
* property is not found. Used by the config refine source to write routing
|
|
109
|
+
* tags back onto a config type's property declarations.
|
|
110
|
+
*/
|
|
111
|
+
export function upsertPropertyJsDocTag(source, typeName, propertyPath, tag, content) {
|
|
112
|
+
const root = parse(Lang.TypeScript, source).root();
|
|
113
|
+
const body = findTypeBody(root, typeName);
|
|
114
|
+
if (!body)
|
|
115
|
+
return source;
|
|
116
|
+
const property = findPropertyByPath(body, propertyPath);
|
|
117
|
+
if (!property)
|
|
118
|
+
return source;
|
|
119
|
+
return upsertTagOnAnchor(source, root, property, tag, content);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Insert or update `@tag content` on the JSDoc block leading `anchorNode`,
|
|
123
|
+
* creating the block when absent. Idempotent per tag (matches the tag NAME, so
|
|
124
|
+
* multi-line content never produces duplicates) and rebuilds the block as
|
|
125
|
+
* well-formed multi-line (handling single-line `/** text *\/` inputs). Shared by
|
|
126
|
+
* the declaration-level ({@link upsertJsDocTag}) and property-level
|
|
127
|
+
* ({@link upsertPropertyJsDocTag}) upserts.
|
|
128
|
+
*/
|
|
129
|
+
function upsertTagOnAnchor(source, root, anchorNode, tag, content) {
|
|
130
|
+
// Escape any comment-close sequence in the content so a value containing it
|
|
131
|
+
// (e.g. a glob like `**/*.ts` in a config pitfall) can't terminate the block
|
|
132
|
+
// early and corrupt the file. readJsDocTags / config extraction unescape it.
|
|
133
|
+
const tagText = escapeJsDocClose(`@${tag} ${content}`);
|
|
100
134
|
const jsdocNode = leadingJsDoc(anchorNode);
|
|
135
|
+
const indent = ' '.repeat(anchorNode.range().start.column);
|
|
101
136
|
if (jsdocNode) {
|
|
102
137
|
const block = jsdocNode.text();
|
|
103
|
-
if (block.
|
|
138
|
+
if (block.match(new RegExp(`(^|\\n)\\s*\\*?\\s*@${tag}\\b`)))
|
|
104
139
|
return source;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
140
|
+
const innerLines = block
|
|
141
|
+
.replace(/^\/\*\*/, '')
|
|
142
|
+
.replace(/\s*\*\/\s*$/, '')
|
|
143
|
+
.split('\n')
|
|
144
|
+
.map((line) => line.replace(/^\s*\*? ?/, '').trimEnd());
|
|
145
|
+
while (innerLines.length > 0 && innerLines[0] === '')
|
|
146
|
+
innerLines.shift();
|
|
147
|
+
while (innerLines.length > 0 && innerLines[innerLines.length - 1] === '')
|
|
148
|
+
innerLines.pop();
|
|
149
|
+
// Prefix every physical line (including multi-line tag content) with ` * `.
|
|
150
|
+
const allLines = [...innerLines, ...tagText.split('\n')];
|
|
151
|
+
const body = allLines
|
|
152
|
+
.map((line) => (line.length > 0 ? `${indent} * ${line}` : `${indent} *`))
|
|
153
|
+
.join('\n');
|
|
154
|
+
const merged = `/**\n${body}\n${indent} */`;
|
|
112
155
|
return root.commitEdits([jsdocNode.replace(merged)]);
|
|
113
156
|
}
|
|
114
|
-
// No existing JSDoc — create one before the anchor node.
|
|
115
|
-
|
|
116
|
-
|
|
157
|
+
// No existing JSDoc — create one before the anchor node. Prefix EVERY physical
|
|
158
|
+
// line of the tag (multi-line content too) with ` * `, mirroring the merge
|
|
159
|
+
// branch above. Without this, a multi-line first tag left continuation lines
|
|
160
|
+
// at column 0 — malformed JSDoc that also broke the re-parse for any tag
|
|
161
|
+
// appended to the same declaration in a later pass.
|
|
117
162
|
const at = anchorNode.range().start.index;
|
|
118
|
-
const
|
|
163
|
+
const body = tagText
|
|
164
|
+
.split('\n')
|
|
165
|
+
.map((line) => (line.length > 0 ? `${indent} * ${line}` : `${indent} *`))
|
|
166
|
+
.join('\n');
|
|
167
|
+
const blockText = `/**\n${body}\n${indent} */\n${indent}`;
|
|
119
168
|
return source.slice(0, at) + blockText + source.slice(at);
|
|
120
169
|
}
|
|
121
170
|
/**
|
|
@@ -134,13 +183,35 @@ export function readJsDocTags(source, declName) {
|
|
|
134
183
|
if (!jsdocNode)
|
|
135
184
|
return {};
|
|
136
185
|
const block = jsdocNode.text();
|
|
186
|
+
// Strip the block to inner content lines (no `/** */` wrapper, no ` * `
|
|
187
|
+
// prefixes), then walk them: a known `@tag` line opens a capture and the
|
|
188
|
+
// following non-tag lines are its continuation. This keeps multi-line tag
|
|
189
|
+
// content (e.g. bullet lists) intact instead of truncating at the first
|
|
190
|
+
// newline — otherwise a refined `@pitfalls` with several bullets would lose
|
|
191
|
+
// everything past line one when re-extracted into SKILL.md.
|
|
192
|
+
const innerLines = block
|
|
193
|
+
.replace(/^\/\*\*/, '')
|
|
194
|
+
.replace(/\s*\*\/\s*$/, '')
|
|
195
|
+
.split('\n')
|
|
196
|
+
.map((line) => line.replace(/^\s*\*? ?/, '').trimEnd());
|
|
197
|
+
const collected = {};
|
|
198
|
+
let current;
|
|
199
|
+
for (const line of innerLines) {
|
|
200
|
+
const tagMatch = line.match(/^@(\w+)\s?(.*)$/);
|
|
201
|
+
const matchedTag = tagMatch ? REFINE_TAGS.find((t) => t === tagMatch[1]) : undefined;
|
|
202
|
+
if (matchedTag) {
|
|
203
|
+
current = matchedTag;
|
|
204
|
+
collected[current] = [tagMatch[2] ?? ''];
|
|
205
|
+
}
|
|
206
|
+
else if (current) {
|
|
207
|
+
collected[current].push(line);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
137
210
|
const result = {};
|
|
138
211
|
for (const tag of REFINE_TAGS) {
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
result[tag] = hit[1]?.trim() ?? '';
|
|
143
|
-
}
|
|
212
|
+
const lines = collected[tag];
|
|
213
|
+
if (lines)
|
|
214
|
+
result[tag] = unescapeJsDocClose(lines.join('\n').trim());
|
|
144
215
|
}
|
|
145
216
|
return result;
|
|
146
217
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast-edit.js","sourceRoot":"","sources":["../../src/refine/ast-edit.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ast-edit.js","sourceRoot":"","sources":["../../src/refine/ast-edit.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAG9B,mEAAmE;AACnE,gFAAgF;AAChF,0EAA0E;AAC1E,qEAAqE;AACrE,MAAM,WAAW,GAAG;IAClB,SAAS;IACT,WAAW;IACX,UAAU;IACV,SAAS;IACT,SAAS;CAC8B,CAAC;AAK1C,MAAM,WAAW,GAAU,SAAwB,CAAC;AACpD,KAAK,WAAW,CAAC;AAEjB;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,IAAY,EAAE,QAAgB;IACxD,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IACtB,IACE,CAAC,KAAK,sBAAsB;QAC5B,CAAC,KAAK,mBAAmB;QACzB,CAAC,KAAK,4BAA4B;QAClC,CAAC,KAAK,uBAAuB;QAC7B,CAAC,KAAK,kBAAkB;QACxB,CAAC,KAAK,wBAAwB,EAC9B,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,QAAQ,EAAE,IAAI,EAAE,KAAK,QAAQ,CAAC;IACvC,CAAC;IACD,IAAI,CAAC,KAAK,qBAAqB,IAAI,CAAC,KAAK,sBAAsB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C,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { AuditContext } from '../audit-types.js';
|
|
2
|
+
import type { ExtractedSkill } from '../types.js';
|
|
3
|
+
import type { DraftedFix, RefineSource } from './types.js';
|
|
4
|
+
export interface ConfigRefineSourceOptions {
|
|
5
|
+
/** Path to the TypeScript file declaring the config type. */
|
|
6
|
+
configFile: string;
|
|
7
|
+
/** Name of the exported interface or object-type alias to document. */
|
|
8
|
+
typeName: string;
|
|
9
|
+
/** Skill name (defaults to the package name, then `typeName`). */
|
|
10
|
+
name?: string;
|
|
11
|
+
/** Skill description (defaults to the package.json description). */
|
|
12
|
+
description?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Globs pointing at the code that CONSUMES this config (e.g. the CLI/filter
|
|
15
|
+
* logic). Their contents are fed to the draft model as an implementation
|
|
16
|
+
* reference so it can state CORRECT runtime behavior instead of guessing it
|
|
17
|
+
* from the type alone. Token-capped. Without grounding the model is told not
|
|
18
|
+
* to assert unverifiable runtime semantics.
|
|
19
|
+
*/
|
|
20
|
+
groundingGlobs?: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* {@link RefineSource} for a TypeScript configuration surface.
|
|
24
|
+
*
|
|
25
|
+
* Reads the consumer's config type with {@link extractConfigSurface}, exposes it
|
|
26
|
+
* as a single `config` surface in an {@link ExtractedSkill}, and writes routing
|
|
27
|
+
* tags back as JSDoc onto the type's individual property declarations. Unlike
|
|
28
|
+
* the CLI source — whose routing lives at the command (surface) level — a config
|
|
29
|
+
* surface is documented per-OPTION: each fix targets one property by its
|
|
30
|
+
* dot-path `configKey` (e.g. `outDir`, `components.prefix`), routed through
|
|
31
|
+
* {@link upsertPropertyJsDocTag}.
|
|
32
|
+
*
|
|
33
|
+
* It also enriches the skill from the package.json nearest the config file (its
|
|
34
|
+
* description, keywords, repository) and a sibling README, supplying the audit
|
|
35
|
+
* context the metadata checks (F1/F2/F3/E5/W4/W5/W6) score against — without it
|
|
36
|
+
* a config skill forfeits those points even when the package already carries
|
|
37
|
+
* the data.
|
|
38
|
+
*/
|
|
39
|
+
export declare class ConfigRefineSource implements RefineSource {
|
|
40
|
+
private readonly opts;
|
|
41
|
+
/** Cached metadata, populated by {@link extract} (which the loop runs first). */
|
|
42
|
+
private metadata;
|
|
43
|
+
/** Cached surface, populated by {@link extract}; read by {@link guidance}. */
|
|
44
|
+
private surface;
|
|
45
|
+
/** Cached implementation-reference grounding, populated by {@link extract}. */
|
|
46
|
+
private grounding;
|
|
47
|
+
constructor(opts: ConfigRefineSourceOptions);
|
|
48
|
+
extract(): Promise<ExtractedSkill>;
|
|
49
|
+
/**
|
|
50
|
+
* Audit context from the discovered package.json + README. Synchronous per the
|
|
51
|
+
* {@link RefineSource} contract; reads the cache that {@link extract} fills (the
|
|
52
|
+
* refine loop always calls `extract()` before scoring). Empty until then.
|
|
53
|
+
*/
|
|
54
|
+
auditContext(_skill: ExtractedSkill): AuditContext;
|
|
55
|
+
applyFixes(fixes: readonly DraftedFix[]): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Drafting conventions passed to the model each iteration. Scopes every
|
|
58
|
+
* routing tag to the single named option, constrains claims to what the type
|
|
59
|
+
* and provided context can support (the model sees the type, NOT the code that
|
|
60
|
+
* consumes the config, so unconstrained drafting invents wrong runtime
|
|
61
|
+
* semantics), and tells it how to draft the `@example` config file. Built from
|
|
62
|
+
* the cached surface that {@link extract} populates first.
|
|
63
|
+
*/
|
|
64
|
+
guidance(): string;
|
|
65
|
+
private loadMetadata;
|
|
66
|
+
/**
|
|
67
|
+
* Sibling example path for the config file: same directory, the config file's
|
|
68
|
+
* base name with any `.ts`/`.tsx`/`.mts`/`.cts` extension replaced by
|
|
69
|
+
* `.example.ts` (e.g. `z2f.config.ts` → `z2f.config.example.ts`,
|
|
70
|
+
* `config.ts` → `config.example.ts`).
|
|
71
|
+
*/
|
|
72
|
+
private exampleFilePath;
|
|
73
|
+
private loadGrounding;
|
|
74
|
+
/** Nearest ancestor directory of the config file that holds a package.json. */
|
|
75
|
+
private findPackageDir;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=config-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-source.d.ts","sourceRoot":"","sources":["../../src/refine/config-source.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,mBAAmB,CAAC;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE3D,MAAM,WAAW,yBAAyB;IACxC,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAkBD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IAQzC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAPjC,iFAAiF;IACjF,OAAO,CAAC,QAAQ,CAAsB;IACtC,8EAA8E;IAC9E,OAAO,CAAC,OAAO,CAAqC;IACpD,+EAA+E;IAC/E,OAAO,CAAC,SAAS,CAAM;IAEvB,YAA6B,IAAI,EAAE,yBAAyB,EAAI;IAE1D,OAAO,IAAI,OAAO,CAAC,cAAc,CAAC,CA8CvC;IAED;;;;OAIG;IACH,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,YAAY,CAOjD;IAEK,UAAU,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2C5D;IAED;;;;;;;OAOG;IACH,QAAQ,IAAI,MAAM,CAoBjB;YAQa,YAAY;IAqC1B;;;;;OAKG;IACH,OAAO,CAAC,eAAe;YAYT,aAAa;IA6B3B,+EAA+E;IAC/E,OAAO,CAAC,cAAc;CAUvB"}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
// packages/core/src/refine/config-source.ts
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { glob, readFile, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { basename, dirname, join, resolve } from 'node:path';
|
|
5
|
+
import { extractConfigSurface } from '../config-extract.js';
|
|
6
|
+
import { parseReadme } from '../readme-parser.js';
|
|
7
|
+
import { truncateToTokenBudget } from '../tokens.js';
|
|
8
|
+
import { upsertPropertyJsDocTag } from './ast-edit.js';
|
|
9
|
+
/** Token cap for the implementation-reference grounding fed to the model. */
|
|
10
|
+
const GROUNDING_TOKEN_CAP = 8000;
|
|
11
|
+
const EXCLUDED_GROUNDING_DIRS = new Set(['node_modules', 'dist', 'build', '.git', 'coverage']);
|
|
12
|
+
/** Maximum directories to walk upward from the config file seeking package.json. */
|
|
13
|
+
const MAX_PACKAGE_LOOKUP_DEPTH = 8;
|
|
14
|
+
/**
|
|
15
|
+
* {@link RefineSource} for a TypeScript configuration surface.
|
|
16
|
+
*
|
|
17
|
+
* Reads the consumer's config type with {@link extractConfigSurface}, exposes it
|
|
18
|
+
* as a single `config` surface in an {@link ExtractedSkill}, and writes routing
|
|
19
|
+
* tags back as JSDoc onto the type's individual property declarations. Unlike
|
|
20
|
+
* the CLI source — whose routing lives at the command (surface) level — a config
|
|
21
|
+
* surface is documented per-OPTION: each fix targets one property by its
|
|
22
|
+
* dot-path `configKey` (e.g. `outDir`, `components.prefix`), routed through
|
|
23
|
+
* {@link upsertPropertyJsDocTag}.
|
|
24
|
+
*
|
|
25
|
+
* It also enriches the skill from the package.json nearest the config file (its
|
|
26
|
+
* description, keywords, repository) and a sibling README, supplying the audit
|
|
27
|
+
* context the metadata checks (F1/F2/F3/E5/W4/W5/W6) score against — without it
|
|
28
|
+
* a config skill forfeits those points even when the package already carries
|
|
29
|
+
* the data.
|
|
30
|
+
*/
|
|
31
|
+
export class ConfigRefineSource {
|
|
32
|
+
opts;
|
|
33
|
+
/** Cached metadata, populated by {@link extract} (which the loop runs first). */
|
|
34
|
+
metadata = {};
|
|
35
|
+
/** Cached surface, populated by {@link extract}; read by {@link guidance}. */
|
|
36
|
+
surface;
|
|
37
|
+
/** Cached implementation-reference grounding, populated by {@link extract}. */
|
|
38
|
+
grounding = '';
|
|
39
|
+
constructor(opts) {
|
|
40
|
+
this.opts = opts;
|
|
41
|
+
}
|
|
42
|
+
async extract() {
|
|
43
|
+
const source = await readFile(this.opts.configFile, 'utf8');
|
|
44
|
+
const surface = extractConfigSurface(source, this.opts.typeName);
|
|
45
|
+
if (!surface) {
|
|
46
|
+
throw new Error(`[skillit] config type '${this.opts.typeName}' not found in ${this.opts.configFile}`);
|
|
47
|
+
}
|
|
48
|
+
this.surface = surface;
|
|
49
|
+
this.grounding = await this.loadGrounding();
|
|
50
|
+
const meta = await this.loadMetadata();
|
|
51
|
+
// An explicit description wins for BOTH fields: the renderer uses
|
|
52
|
+
// packageDescription for the body, so without this a config skill would show
|
|
53
|
+
// the package blurb (which describes the package, not the config surface)
|
|
54
|
+
// even when the caller supplied a config-specific description. The audit's
|
|
55
|
+
// F1 check still reads the real package description from auditContext().
|
|
56
|
+
const description = this.opts.description ?? meta.packageDescription ?? '';
|
|
57
|
+
const skill = {
|
|
58
|
+
name: this.opts.name ?? meta.packageName ?? this.opts.typeName,
|
|
59
|
+
description,
|
|
60
|
+
functions: [],
|
|
61
|
+
classes: [],
|
|
62
|
+
types: [],
|
|
63
|
+
enums: [],
|
|
64
|
+
variables: [],
|
|
65
|
+
examples: [],
|
|
66
|
+
configSurfaces: [surface]
|
|
67
|
+
};
|
|
68
|
+
if (meta.keywords?.length)
|
|
69
|
+
skill.keywords = meta.keywords;
|
|
70
|
+
if (meta.repository)
|
|
71
|
+
skill.repository = meta.repository;
|
|
72
|
+
if (description)
|
|
73
|
+
skill.packageDescription = description;
|
|
74
|
+
// A sibling `<config>.example.ts` (if present) is the skill's usage example
|
|
75
|
+
// — clears E4 and feeds the rendered Examples section. The refine loop
|
|
76
|
+
// drafts it once when absent; reading it back here surfaces it thereafter.
|
|
77
|
+
// Read directly and tolerate ENOENT (no existsSync precheck — that is a
|
|
78
|
+
// check-then-use race).
|
|
79
|
+
try {
|
|
80
|
+
const example = (await readFile(this.exampleFilePath(), 'utf8')).trim();
|
|
81
|
+
if (example)
|
|
82
|
+
skill.examples = [example];
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// No/unreadable example — leave examples empty (E4 stays a gap).
|
|
86
|
+
}
|
|
87
|
+
return skill;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Audit context from the discovered package.json + README. Synchronous per the
|
|
91
|
+
* {@link RefineSource} contract; reads the cache that {@link extract} fills (the
|
|
92
|
+
* refine loop always calls `extract()` before scoring). Empty until then.
|
|
93
|
+
*/
|
|
94
|
+
auditContext(_skill) {
|
|
95
|
+
const ctx = {};
|
|
96
|
+
if (this.metadata.packageDescription)
|
|
97
|
+
ctx.packageDescription = this.metadata.packageDescription;
|
|
98
|
+
if (this.metadata.keywords?.length)
|
|
99
|
+
ctx.keywords = this.metadata.keywords;
|
|
100
|
+
if (this.metadata.repository)
|
|
101
|
+
ctx.repository = this.metadata.repository;
|
|
102
|
+
if (this.metadata.readme)
|
|
103
|
+
ctx.readme = this.metadata.readme;
|
|
104
|
+
return ctx;
|
|
105
|
+
}
|
|
106
|
+
async applyFixes(fixes) {
|
|
107
|
+
// An `@example` fix is the drafted config-example FILE, not a JSDoc tag:
|
|
108
|
+
// write it to the sibling `<config>.example.ts` — but only if one does not
|
|
109
|
+
// already exist, so a hand-authored example is never clobbered.
|
|
110
|
+
const exampleFix = fixes.find((fix) => fix.tag === 'example');
|
|
111
|
+
if (exampleFix) {
|
|
112
|
+
// Write-if-absent atomically with the `wx` flag (create, fail if exists)
|
|
113
|
+
// rather than existsSync-then-write — the latter is a TOCTOU race, and the
|
|
114
|
+
// atomic flag enforces the no-clobber intent at the syscall.
|
|
115
|
+
try {
|
|
116
|
+
await writeFile(this.exampleFilePath(), normalizeExampleFile(exampleFix.value), {
|
|
117
|
+
encoding: 'utf8',
|
|
118
|
+
flag: 'wx'
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
// EEXIST = an example already exists; preserve it. Re-throw anything else.
|
|
123
|
+
if (error.code !== 'EEXIST')
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
let source = await readFile(this.opts.configFile, 'utf8');
|
|
128
|
+
let changed = false;
|
|
129
|
+
for (const fix of fixes) {
|
|
130
|
+
if (fix.tag === 'example')
|
|
131
|
+
continue; // handled above (separate file)
|
|
132
|
+
// `fix.toolName` is the option's dot-path configKey (set by the
|
|
133
|
+
// audit-score config-option target). Route it to the matching property.
|
|
134
|
+
const next = upsertPropertyJsDocTag(source, this.opts.typeName, fix.toolName, fix.tag, fix.value);
|
|
135
|
+
if (next !== source) {
|
|
136
|
+
source = next;
|
|
137
|
+
changed = true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (changed) {
|
|
141
|
+
await writeFile(this.opts.configFile, source, 'utf8');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Drafting conventions passed to the model each iteration. Scopes every
|
|
146
|
+
* routing tag to the single named option, constrains claims to what the type
|
|
147
|
+
* and provided context can support (the model sees the type, NOT the code that
|
|
148
|
+
* consumes the config, so unconstrained drafting invents wrong runtime
|
|
149
|
+
* semantics), and tells it how to draft the `@example` config file. Built from
|
|
150
|
+
* the cached surface that {@link extract} populates first.
|
|
151
|
+
*/
|
|
152
|
+
guidance() {
|
|
153
|
+
const optionList = (this.surface?.options ?? [])
|
|
154
|
+
.map((o) => `- \`${o.configKey ?? o.name}\`: ${o.type}`)
|
|
155
|
+
.join('\n');
|
|
156
|
+
const typeName = this.opts.typeName;
|
|
157
|
+
return [
|
|
158
|
+
`You are documenting the individual options of the TypeScript configuration object \`${typeName}\`.`,
|
|
159
|
+
`Each work item's "Tool" is ONE option, named by its dot-path key (e.g. \`outDir\`, \`components.prefix\`) — except an @example work item, whose "Tool" is the config type \`${typeName}\` itself.`,
|
|
160
|
+
`For @useWhen / @avoidWhen / @pitfalls: write guidance SPECIFIC to that single option — when to set it (and to what kind of value), when to leave it unset, and footguns unique to its value or interactions. Do NOT describe the configuration type as a whole, the annotate-vs-\`defineConfig()\` choice, or anything that applies to every option; never repeat the same point across options.`,
|
|
161
|
+
this.grounding
|
|
162
|
+
? `GROUND every runtime-behavior claim in the IMPLEMENTATION REFERENCE below (the actual code that consumes this config) and the option's type. State behavior the code actually exhibits — e.g. what an empty array/object means, whether an invalid value throws or is silently ignored, what a flag toggles, how options interact. Do NOT contradict the reference, and do NOT assert behavior absent from both the reference and the type; omit it instead. A confidently wrong "NEVER" is worse than no pitfall.`
|
|
163
|
+
: `GROUND every claim in the option's TYPE and the documentation provided to you. You can see the type, not the code that reads this config — so do NOT assert runtime behavior you cannot verify: whether an empty array/object means "all" or "none", whether an invalid value throws or is silently ignored, what a boolean flag actually toggles, or how two options interact at runtime. If a behavior is not evidenced by the type or the docs, omit it or phrase it as a type-level fact ("\`mode\` accepts 'submit' | 'auto-save'"). A confidently wrong "NEVER" is worse than no pitfall — prefer fewer, verifiable points over speculative ones.`,
|
|
164
|
+
`For @example: output a COMPLETE, type-correct example configuration FILE — import statements plus a default export — saved verbatim as a sibling \`*.config.example.ts\` that must compile. Import \`defineConfig\`/\`${typeName}\` from the package by its published name ONLY if the example lives outside that package; if it sits inside the package's own \`src\`, import from the local source entrypoint (a relative path) so the self-import does not resolve to an unbuilt \`dist\`. Use realistic values for required options and a few common optional ones. Output ONLY the file source: no prose, no markdown, no code fences.`,
|
|
165
|
+
`Options (key: type):\n${optionList}`,
|
|
166
|
+
...(this.grounding
|
|
167
|
+
? [
|
|
168
|
+
`IMPLEMENTATION REFERENCE (the code that consumes this config — ground runtime-behavior claims in it):\n${this.grounding}`
|
|
169
|
+
]
|
|
170
|
+
: [])
|
|
171
|
+
].join('\n\n');
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Discover and parse the package.json nearest the config file (walking up to
|
|
175
|
+
* {@link MAX_PACKAGE_LOOKUP_DEPTH} directories) plus a sibling README. Cached
|
|
176
|
+
* so repeated extract/score passes read the filesystem once. Never throws —
|
|
177
|
+
* unreadable or absent files just yield empty fields.
|
|
178
|
+
*/
|
|
179
|
+
async loadMetadata() {
|
|
180
|
+
const pkgDir = this.findPackageDir();
|
|
181
|
+
if (!pkgDir)
|
|
182
|
+
return this.metadata;
|
|
183
|
+
const meta = {};
|
|
184
|
+
try {
|
|
185
|
+
const pkg = JSON.parse(await readFile(join(pkgDir, 'package.json'), 'utf8'));
|
|
186
|
+
if (pkg.name)
|
|
187
|
+
meta.packageName = stripScope(pkg.name);
|
|
188
|
+
if (pkg.description)
|
|
189
|
+
meta.packageDescription = pkg.description;
|
|
190
|
+
if (Array.isArray(pkg.keywords))
|
|
191
|
+
meta.keywords = pkg.keywords;
|
|
192
|
+
const repo = typeof pkg.repository === 'string' ? pkg.repository : pkg.repository?.url;
|
|
193
|
+
if (repo)
|
|
194
|
+
meta.repository = repo;
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
// No/invalid package.json — leave metadata fields unset.
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
meta.readme = parseReadme(await readFile(join(pkgDir, 'README.md'), 'utf8'));
|
|
201
|
+
}
|
|
202
|
+
catch {
|
|
203
|
+
// No README — metadata checks that need it will report the gap.
|
|
204
|
+
}
|
|
205
|
+
this.metadata = {
|
|
206
|
+
...(meta.packageDescription !== undefined
|
|
207
|
+
? { packageDescription: meta.packageDescription }
|
|
208
|
+
: {}),
|
|
209
|
+
...(meta.keywords !== undefined ? { keywords: meta.keywords } : {}),
|
|
210
|
+
...(meta.repository !== undefined ? { repository: meta.repository } : {}),
|
|
211
|
+
...(meta.readme !== undefined ? { readme: meta.readme } : {})
|
|
212
|
+
};
|
|
213
|
+
return meta;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Sibling example path for the config file: same directory, the config file's
|
|
217
|
+
* base name with any `.ts`/`.tsx`/`.mts`/`.cts` extension replaced by
|
|
218
|
+
* `.example.ts` (e.g. `z2f.config.ts` → `z2f.config.example.ts`,
|
|
219
|
+
* `config.ts` → `config.example.ts`).
|
|
220
|
+
*/
|
|
221
|
+
exampleFilePath() {
|
|
222
|
+
const dir = dirname(this.opts.configFile);
|
|
223
|
+
const base = basename(this.opts.configFile).replace(/\.[cm]?tsx?$/, '');
|
|
224
|
+
return join(dir, `${base}.example.ts`);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Read the grounding globs into a single token-capped implementation
|
|
228
|
+
* reference. Skips `.d.ts`, excluded dirs, and the config file itself (the
|
|
229
|
+
* model already has the type). Returns `''` when no globs are configured or
|
|
230
|
+
* nothing matches — never throws.
|
|
231
|
+
*/
|
|
232
|
+
async loadGrounding() {
|
|
233
|
+
const globs = this.opts.groundingGlobs;
|
|
234
|
+
if (!globs?.length)
|
|
235
|
+
return '';
|
|
236
|
+
const configAbs = resolve(this.opts.configFile);
|
|
237
|
+
const seen = new Set();
|
|
238
|
+
const parts = [];
|
|
239
|
+
for (const pattern of globs) {
|
|
240
|
+
let matches;
|
|
241
|
+
try {
|
|
242
|
+
matches = glob(pattern, {
|
|
243
|
+
exclude: (f) => f.endsWith('.d.ts') || f.split(/[\\/]/).some((seg) => EXCLUDED_GROUNDING_DIRS.has(seg))
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
continue; // bad pattern — skip
|
|
248
|
+
}
|
|
249
|
+
for await (const file of matches) {
|
|
250
|
+
const abs = resolve(file);
|
|
251
|
+
if (abs === configAbs || seen.has(abs))
|
|
252
|
+
continue;
|
|
253
|
+
seen.add(abs);
|
|
254
|
+
const content = await readFile(file, 'utf8').catch(() => '');
|
|
255
|
+
if (content.trim())
|
|
256
|
+
parts.push(`// ${file}\n${content.trim()}`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (parts.length === 0)
|
|
260
|
+
return '';
|
|
261
|
+
return truncateToTokenBudget(parts.join('\n\n'), GROUNDING_TOKEN_CAP);
|
|
262
|
+
}
|
|
263
|
+
/** Nearest ancestor directory of the config file that holds a package.json. */
|
|
264
|
+
findPackageDir() {
|
|
265
|
+
let dir = dirname(this.opts.configFile);
|
|
266
|
+
for (let i = 0; i < MAX_PACKAGE_LOOKUP_DEPTH; i++) {
|
|
267
|
+
if (existsSync(join(dir, 'package.json')))
|
|
268
|
+
return dir;
|
|
269
|
+
const parent = dirname(dir);
|
|
270
|
+
if (parent === dir)
|
|
271
|
+
break;
|
|
272
|
+
dir = parent;
|
|
273
|
+
}
|
|
274
|
+
return undefined;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
/** Strip a leading `@scope/` from a package name. */
|
|
278
|
+
function stripScope(name) {
|
|
279
|
+
const slash = name.indexOf('/');
|
|
280
|
+
return name.startsWith('@') && slash !== -1 ? name.slice(slash + 1) : name;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Normalize model-drafted example content into a clean source file: strip a
|
|
284
|
+
* surrounding markdown code fence if the model added one, and ensure a trailing
|
|
285
|
+
* newline. The draft is instructed to omit fences, but a chatty backend may add
|
|
286
|
+
* them anyway.
|
|
287
|
+
*/
|
|
288
|
+
function normalizeExampleFile(raw) {
|
|
289
|
+
let body = raw.trim();
|
|
290
|
+
const fenced = body.match(/^```[a-zA-Z]*\n([\s\S]*?)\n```$/);
|
|
291
|
+
if (fenced?.[1] !== undefined)
|
|
292
|
+
body = fenced[1].trim();
|
|
293
|
+
return `${body}\n`;
|
|
294
|
+
}
|
|
295
|
+
//# sourceMappingURL=config-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-source.js","sourceRoot":"","sources":["../../src/refine/config-source.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAIrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAsBvD,6EAA6E;AAC7E,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;AAU/F,oFAAoF;AACpF,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAEnC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,kBAAkB;IAQA,IAAI;IAPjC,iFAAiF;IACzE,QAAQ,GAAmB,EAAE,CAAC;IACtC,8EAA8E;IACtE,OAAO,CAAqC;IACpD,+EAA+E;IACvE,SAAS,GAAG,EAAE,CAAC;IAEvB,YAA6B,IAA+B;oBAA/B,IAAI;IAA8B,CAAC;IAEhE,KAAK,CAAC,OAAO;QACX,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,C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,CAAC;IACtB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC7D,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS;QAAE,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACvD,OAAO,GAAG,IAAI,IAAI,CAAC;AACrB,CAAC"}
|
package/dist/refine/index.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ export * from './select-targets.js';
|
|
|
3
3
|
export { refineSkill } from './loop.js';
|
|
4
4
|
export type { ScoreSkill } from './loop.js';
|
|
5
5
|
export { insertJsDocTag } from './jsdoc-edit.js';
|
|
6
|
-
export { upsertJsDocTag, readJsDocTags } from './ast-edit.js';
|
|
6
|
+
export { upsertJsDocTag, upsertPropertyJsDocTag, readJsDocTags } from './ast-edit.js';
|
|
7
|
+
export { ConfigRefineSource } from './config-source.js';
|
|
8
|
+
export type { ConfigRefineSourceOptions } from './config-source.js';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/refine/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/refine/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/refine/index.js
CHANGED
|
@@ -2,5 +2,6 @@ export * from './types.js';
|
|
|
2
2
|
export * from './select-targets.js';
|
|
3
3
|
export { refineSkill } from './loop.js';
|
|
4
4
|
export { insertJsDocTag } from './jsdoc-edit.js';
|
|
5
|
-
export { upsertJsDocTag, readJsDocTags } from './ast-edit.js';
|
|
5
|
+
export { upsertJsDocTag, upsertPropertyJsDocTag, readJsDocTags } from './ast-edit.js';
|
|
6
|
+
export { ConfigRefineSource } from './config-source.js';
|
|
6
7
|
//# sourceMappingURL=index.js.map
|