@tanstack/intent 0.0.38 → 0.0.40
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/{cli-support-BlSsqyx7.mjs → cli-support-Cb9lNXhL.mjs} +4 -4
- package/dist/{cli-support-BON5hn4L.mjs → cli-support-DtqVDiJv.mjs} +4 -4
- package/dist/cli.mjs +9 -9
- package/dist/{core-baYs6H7Z.mjs → core-BOSjgetf.mjs} +34 -20
- package/dist/core.d.mts +4 -1
- package/dist/core.mjs +7 -7
- package/dist/display-CmLzVAae.mjs +5 -0
- package/dist/{display-CVeoAwBd.mjs → display-DHNuzSqR.mjs} +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +8 -8
- package/dist/{install-BPWtaOuo.mjs → install-CLkmoPOY.mjs} +1 -1
- package/dist/install-ChddjnhO.mjs +7 -0
- package/dist/intent-library.mjs +8 -8
- package/dist/{library-scanner-CHepLJQJ.mjs → library-scanner-BAJ7bXtW.mjs} +2 -2
- package/dist/library-scanner.d.mts +1 -1
- package/dist/library-scanner.mjs +3 -3
- package/dist/{list-iLIL-EO3.mjs → list-CxSm8YYl.mjs} +12 -10
- package/dist/{load-8868G50-.mjs → load-DF-zIT3-.mjs} +11 -9
- package/dist/{meta-CYV9EzM8.mjs → meta-BNSVXFQu.mjs} +1 -1
- package/dist/{project-context-Dx6XIJJo.mjs → project-context-Bv9BDh8B.mjs} +1 -1
- package/dist/{resolver-CP0S8UjZ.mjs → resolver-BDsZ3kWg.mjs} +2 -2
- package/dist/{scanner-DwYsjXzI.mjs → scanner-BGyQTQ3U.mjs} +124 -101
- package/dist/scanner-Ix6MmxfB.mjs +6 -0
- package/dist/{setup-kvWN4xCr.mjs → setup-DQMKxEoA.mjs} +2 -2
- package/dist/setup.mjs +4 -4
- package/dist/{skill-paths-DNOHrvL5.mjs → skill-paths-BHbdWniB.mjs} +1 -1
- package/dist/{staleness-CFr3W-RI.mjs → staleness-CGLs-swr.mjs} +37 -17
- package/dist/{staleness-DpyuNdd5.mjs → staleness-Dl-m8JWM.mjs} +2 -2
- package/dist/{types-S2zpibHp.d.mts → types-Cq5cY9h9.d.mts} +6 -1
- package/dist/{utils-mdb4i6VA.mjs → utils-BPDvfmcd.mjs} +10 -1
- package/dist/{utils-BHzSyNeJ.mjs → utils-DqdIC3RY.mjs} +1 -1
- package/dist/{validate-BL1SYAwh.mjs → validate-Divq4AiV.mjs} +5 -5
- package/dist/{workspace-patterns-BZLEaMcS.mjs → workspace-patterns-CIJQCwbJ.mjs} +1 -1
- package/dist/{workspace-patterns-BWMz7TsI.mjs → workspace-patterns-Diy5gtz_.mjs} +2 -2
- package/package.json +3 -1
- package/dist/display-COlw5FaB.mjs +0 -5
- package/dist/install-RZpz279M.mjs +0 -7
- package/dist/scanner-ByG70-E3.mjs +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import "./workspace-patterns-
|
|
3
|
-
import "./project-context-
|
|
4
|
-
import { a as printDebugInfo, c as scanOptionsFromGlobalFlags, i as getMetaDir, l as printWarnings, n as coreOptionsFromGlobalFlags, o as resolveStaleTargets, r as getCheckSkillsWorkflowAdvisories, s as scanIntentsOrFail, t as INTENT_CHECK_SKILLS_WORKFLOW_VERSION } from "./cli-support-
|
|
1
|
+
import "./utils-BPDvfmcd.mjs";
|
|
2
|
+
import "./workspace-patterns-CIJQCwbJ.mjs";
|
|
3
|
+
import "./project-context-Bv9BDh8B.mjs";
|
|
4
|
+
import { a as printDebugInfo, c as scanOptionsFromGlobalFlags, i as getMetaDir, l as printWarnings, n as coreOptionsFromGlobalFlags, o as resolveStaleTargets, r as getCheckSkillsWorkflowAdvisories, s as scanIntentsOrFail, t as INTENT_CHECK_SKILLS_WORKFLOW_VERSION } from "./cli-support-DtqVDiJv.mjs";
|
|
5
5
|
|
|
6
6
|
export { INTENT_CHECK_SKILLS_WORKFLOW_VERSION, coreOptionsFromGlobalFlags, getCheckSkillsWorkflowAdvisories, getMetaDir, printDebugInfo, printWarnings, resolveStaleTargets, scanIntentsOrFail, scanOptionsFromGlobalFlags };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
1
|
+
import { t as resolveProjectContext } from "./project-context-Bv9BDh8B.mjs";
|
|
2
2
|
import { t as fail } from "./cli-error-BrMXlbtx.mjs";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { dirname, join, relative, resolve } from "node:path";
|
|
@@ -31,7 +31,7 @@ function getCheckSkillsWorkflowAdvisories(root) {
|
|
|
31
31
|
return [`Intent workflow update available: run \`npx @tanstack/intent@latest setup\` to refresh ${relative(process.cwd(), workflowPath) || workflowPath}.`];
|
|
32
32
|
}
|
|
33
33
|
async function scanIntentsOrFail(options) {
|
|
34
|
-
const { scanForIntents } = await import("./scanner-
|
|
34
|
+
const { scanForIntents } = await import("./scanner-Ix6MmxfB.mjs");
|
|
35
35
|
try {
|
|
36
36
|
return scanForIntents(void 0, options);
|
|
37
37
|
} catch (err) {
|
|
@@ -68,13 +68,13 @@ async function resolveStaleTargets(targetDir) {
|
|
|
68
68
|
targetPath: targetDir
|
|
69
69
|
});
|
|
70
70
|
const workflowAdvisories = getCheckSkillsWorkflowAdvisories(context.workspaceRoot ?? context.packageRoot ?? resolvedRoot);
|
|
71
|
-
const { buildWorkspaceCoverageSignals, checkStaleness, readPackageName } = await import("./staleness-
|
|
71
|
+
const { buildWorkspaceCoverageSignals, checkStaleness, readPackageName } = await import("./staleness-Dl-m8JWM.mjs");
|
|
72
72
|
const isWorkspaceRootTarget = context.workspaceRoot !== null && resolvedRoot === context.workspaceRoot;
|
|
73
73
|
if (context.packageRoot && !isWorkspaceRootTarget && (context.targetSkillsDir !== null || context.workspaceRoot === null)) return {
|
|
74
74
|
reports: [await checkStaleness(context.packageRoot, readPackageName(context.packageRoot), context.workspaceRoot ?? context.packageRoot)],
|
|
75
75
|
workflowAdvisories
|
|
76
76
|
};
|
|
77
|
-
const { findWorkspaceRoot, getWorkspaceInfo } = await import("./workspace-patterns-
|
|
77
|
+
const { findWorkspaceRoot, getWorkspaceInfo } = await import("./workspace-patterns-Diy5gtz_.mjs");
|
|
78
78
|
const workspaceRoot = findWorkspaceRoot(resolvedRoot);
|
|
79
79
|
const workspaceInfo = workspaceRoot ? getWorkspaceInfo(workspaceRoot) : null;
|
|
80
80
|
if (workspaceInfo) {
|
package/dist/cli.mjs
CHANGED
|
@@ -9,31 +9,31 @@ function createCli() {
|
|
|
9
9
|
const cli = cac("intent");
|
|
10
10
|
cli.usage("<command> [options]");
|
|
11
11
|
cli.command("list", "Discover intent-enabled packages from the project or workspace").usage("list [--json] [--debug] [--exclude <pattern>] [--global] [--global-only]").option("--json", "Output JSON").option("--debug", "Print discovery debug details to stderr").option("--exclude <pattern>", "Exclude package name glob").option("--global", "Include global packages after project packages").option("--global-only", "List global packages only").example("list").example("list --json").example("list --global").action(async (options) => {
|
|
12
|
-
const { runListCommand } = await import("./list-
|
|
12
|
+
const { runListCommand } = await import("./list-CxSm8YYl.mjs");
|
|
13
13
|
await runListCommand(options);
|
|
14
14
|
});
|
|
15
15
|
cli.command("load [use]", "Load a compact skill use and print its SKILL.md").usage("load <use> [--path] [--json] [--debug] [--exclude <pattern>] [--global] [--global-only]").option("--path", "Print the resolved skill path instead of file content").option("--json", "Output JSON").option("--debug", "Print resolution debug details to stderr").option("--exclude <pattern>", "Exclude package name glob").option("--global", "Load from project packages, then global packages").option("--global-only", "Load from global packages only").example("load @tanstack/query#core").example("load @tanstack/query#core --path").action(async (use, options) => {
|
|
16
|
-
const { runLoadCommand } = await import("./load-
|
|
16
|
+
const { runLoadCommand } = await import("./load-DF-zIT3-.mjs");
|
|
17
17
|
await runLoadCommand(use, options);
|
|
18
18
|
});
|
|
19
19
|
cli.command("meta [name]", "List meta-skills, or print one by name").usage("meta [name]").example("meta").example("meta domain-discovery").action(async (name) => {
|
|
20
|
-
const [{ getMetaDir }, { runMetaCommand }] = await Promise.all([import("./cli-support-
|
|
20
|
+
const [{ getMetaDir }, { runMetaCommand }] = await Promise.all([import("./cli-support-Cb9lNXhL.mjs"), import("./meta-BNSVXFQu.mjs")]);
|
|
21
21
|
await runMetaCommand(name, getMetaDir());
|
|
22
22
|
});
|
|
23
23
|
cli.command("validate [dir]", "Validate skill files").usage("validate [dir] [--github-summary]").option("--github-summary", "Write a GitHub Actions step summary").example("validate").example("validate packages/query/skills").action(async (dir, options) => {
|
|
24
|
-
const { runValidateCommand } = await import("./validate-
|
|
24
|
+
const { runValidateCommand } = await import("./validate-Divq4AiV.mjs");
|
|
25
25
|
await runValidateCommand(dir, options);
|
|
26
26
|
});
|
|
27
27
|
cli.command("install", "Create or update skill loading guidance in an agent config file").usage("install [--map] [--dry-run] [--print-prompt] [--global] [--global-only]").option("--map", "Write explicit skill-to-task mappings").option("--dry-run", "Print the generated block without writing").option("--print-prompt", "Print the legacy agent setup prompt instead of writing").option("--global", "Include global packages after project packages").option("--global-only", "Install mappings from global packages only").example("install").example("install --map").example("install --dry-run").example("install --print-prompt").example("install --global").action(async (options) => {
|
|
28
|
-
const [{ scanIntentsOrFail }, { runInstallCommand }] = await Promise.all([import("./cli-support-
|
|
28
|
+
const [{ scanIntentsOrFail }, { runInstallCommand }] = await Promise.all([import("./cli-support-Cb9lNXhL.mjs"), import("./install-ChddjnhO.mjs")]);
|
|
29
29
|
await runInstallCommand(options, scanIntentsOrFail);
|
|
30
30
|
});
|
|
31
31
|
cli.command("scaffold", "Print maintainer scaffold prompt").usage("scaffold").action(async () => {
|
|
32
|
-
const [{ getMetaDir }, { runScaffoldCommand }] = await Promise.all([import("./cli-support-
|
|
32
|
+
const [{ getMetaDir }, { runScaffoldCommand }] = await Promise.all([import("./cli-support-Cb9lNXhL.mjs"), import("./scaffold-D2vwv9ls.mjs")]);
|
|
33
33
|
runScaffoldCommand(getMetaDir());
|
|
34
34
|
});
|
|
35
35
|
cli.command("stale [dir]", "Check skills for staleness in the current package or workspace").usage("stale [dir] [--json] [--github-review]").option("--json", "Output JSON").option("--github-review", "Write GitHub Actions review PR files").option("--package-label <label>", "Fallback package label for review PRs").example("stale").example("stale packages/query").example("stale --json").action(async (targetDir, options) => {
|
|
36
|
-
const [{ resolveStaleTargets }, { runStaleCommand }] = await Promise.all([import("./cli-support-
|
|
36
|
+
const [{ resolveStaleTargets }, { runStaleCommand }] = await Promise.all([import("./cli-support-Cb9lNXhL.mjs"), import("./stale-flPZnWfI.mjs")]);
|
|
37
37
|
await runStaleCommand(targetDir, options, resolveStaleTargets);
|
|
38
38
|
});
|
|
39
39
|
cli.command("edit-package-json", "Update package.json files so skills are published").usage("edit-package-json").action(async () => {
|
|
@@ -41,11 +41,11 @@ function createCli() {
|
|
|
41
41
|
await runEditPackageJsonCommand(process.cwd());
|
|
42
42
|
});
|
|
43
43
|
cli.command("setup", "Copy Intent CI workflow templates into .github/workflows/").usage("setup").action(async () => {
|
|
44
|
-
const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-
|
|
44
|
+
const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-Cb9lNXhL.mjs"), import("./setup-github-actions-emXSyGy3.mjs")]);
|
|
45
45
|
await runSetupGithubActionsCommand(process.cwd(), getMetaDir());
|
|
46
46
|
});
|
|
47
47
|
cli.command("setup-github-actions", "Copy Intent CI workflow templates into .github/workflows/").usage("setup-github-actions").action(async () => {
|
|
48
|
-
const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-
|
|
48
|
+
const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-Cb9lNXhL.mjs"), import("./setup-github-actions-emXSyGy3.mjs")]);
|
|
49
49
|
await runSetupGithubActionsCommand(process.cwd(), getMetaDir());
|
|
50
50
|
});
|
|
51
51
|
cli.command("help [command]", "Display help for a command").action((commandName) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { o as resolveDepDir, r as getDeps, s as toPosixPath } from "./utils-
|
|
2
|
-
import { n as scanIntentPackageAtRoot, t as scanForIntents } from "./scanner-
|
|
3
|
-
import {
|
|
1
|
+
import { o as resolveDepDir, r as getDeps, s as toPosixPath } from "./utils-BPDvfmcd.mjs";
|
|
2
|
+
import { n as scanIntentPackageAtRoot, r as createIntentFsCache, t as scanForIntents } from "./scanner-BGyQTQ3U.mjs";
|
|
3
|
+
import { n as findWorkspacePackages } from "./workspace-patterns-CIJQCwbJ.mjs";
|
|
4
4
|
import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-umYvZl94.mjs";
|
|
5
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
6
|
-
import { a as compileExcludePatterns, c as warningMentionsPackage, i as resolveSkillUse,
|
|
5
|
+
import { t as resolveProjectContext } from "./project-context-Bv9BDh8B.mjs";
|
|
6
|
+
import { a as compileExcludePatterns, c as warningMentionsPackage, i as resolveSkillUse, o as getEffectiveExcludePatterns, r as resolveSkillEntry, s as isPackageExcluded, t as ResolveSkillUseError } from "./resolver-BDsZ3kWg.mjs";
|
|
7
7
|
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
8
8
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
9
9
|
|
|
@@ -213,15 +213,15 @@ function rewriteLoadedSkillMarkdownDestinations({ content, cwd, packageRoot, ski
|
|
|
213
213
|
|
|
214
214
|
//#endregion
|
|
215
215
|
//#region src/core/load-resolution.ts
|
|
216
|
-
function readWorkspacePackageInfos(context) {
|
|
216
|
+
function readWorkspacePackageInfos(context, fsCache) {
|
|
217
217
|
const dirs = /* @__PURE__ */ new Set();
|
|
218
218
|
if (context.packageRoot) dirs.add(context.packageRoot);
|
|
219
219
|
if (context.workspaceRoot) {
|
|
220
220
|
dirs.add(context.workspaceRoot);
|
|
221
|
-
for (const dir of
|
|
221
|
+
for (const dir of findWorkspacePackages(context.workspaceRoot)) dirs.add(dir);
|
|
222
222
|
}
|
|
223
223
|
return [...dirs].flatMap((dir) => {
|
|
224
|
-
const packageJson = readPackageJson(dir);
|
|
224
|
+
const packageJson = fsCache.readPackageJson(dir);
|
|
225
225
|
if (!packageJson) return [];
|
|
226
226
|
return [{
|
|
227
227
|
dir,
|
|
@@ -270,10 +270,10 @@ function getDirectLoadFastPathCandidateDirs(packageName, context, cwd) {
|
|
|
270
270
|
if (context.workspaceRoot && context.workspaceRoot !== context.packageRoot) addCandidateDir(candidates, seen, resolveDependencyPackageDir(packageName, context.workspaceRoot));
|
|
271
271
|
return candidates;
|
|
272
272
|
}
|
|
273
|
-
function getWorkspaceLoadFastPathCandidateDirs(packageName, context) {
|
|
273
|
+
function getWorkspaceLoadFastPathCandidateDirs(packageName, context, fsCache) {
|
|
274
274
|
const candidates = [];
|
|
275
275
|
const seen = /* @__PURE__ */ new Set();
|
|
276
|
-
const workspacePackages = readWorkspacePackageInfos(context);
|
|
276
|
+
const workspacePackages = readWorkspacePackageInfos(context, fsCache);
|
|
277
277
|
for (const pkg of workspacePackages) if (pkg.name === packageName) addCandidateDir(candidates, seen, pkg.dir);
|
|
278
278
|
for (const pkg of workspacePackages) {
|
|
279
279
|
if (!workspacePackageDeclaresDependency(pkg.packageJson, packageName)) continue;
|
|
@@ -297,10 +297,11 @@ function resolveScannedPackageSkill(scanned, parsedUse) {
|
|
|
297
297
|
conflict: null
|
|
298
298
|
};
|
|
299
299
|
}
|
|
300
|
-
function resolveFromPackageRoots(packageRoots, parsedUse, cwd) {
|
|
300
|
+
function resolveFromPackageRoots(packageRoots, parsedUse, cwd, fsCache) {
|
|
301
301
|
for (const packageRoot of packageRoots) {
|
|
302
302
|
const scanned = scanIntentPackageAtRoot(packageRoot, {
|
|
303
303
|
fallbackName: parsedUse.packageName,
|
|
304
|
+
fsCache,
|
|
304
305
|
projectRoot: cwd,
|
|
305
306
|
skillNameHint: parsedUse.skillName
|
|
306
307
|
});
|
|
@@ -309,6 +310,7 @@ function resolveFromPackageRoots(packageRoots, parsedUse, cwd) {
|
|
|
309
310
|
if (scanned.package?.name === parsedUse.packageName) {
|
|
310
311
|
const fallbackResolved = resolveScannedPackageSkill(scanIntentPackageAtRoot(packageRoot, {
|
|
311
312
|
fallbackName: parsedUse.packageName,
|
|
313
|
+
fsCache,
|
|
312
314
|
projectRoot: cwd
|
|
313
315
|
}), parsedUse);
|
|
314
316
|
if (fallbackResolved) return fallbackResolved;
|
|
@@ -316,13 +318,13 @@ function resolveFromPackageRoots(packageRoots, parsedUse, cwd) {
|
|
|
316
318
|
}
|
|
317
319
|
return null;
|
|
318
320
|
}
|
|
319
|
-
function resolveSkillUseFastPath(parsedUse, options, context = resolveProjectContext({ cwd: process.cwd() }), cwd = context.cwd) {
|
|
321
|
+
function resolveSkillUseFastPath(parsedUse, options, context = resolveProjectContext({ cwd: process.cwd() }), cwd = context.cwd, fsCache = createIntentFsCache()) {
|
|
320
322
|
if (options.globalOnly) return null;
|
|
321
323
|
if (shouldSkipFastPathForYarnPnp(context, cwd)) return null;
|
|
322
|
-
const directResolved = resolveFromPackageRoots(getDirectLoadFastPathCandidateDirs(parsedUse.packageName, context, cwd), parsedUse, cwd);
|
|
324
|
+
const directResolved = resolveFromPackageRoots(getDirectLoadFastPathCandidateDirs(parsedUse.packageName, context, cwd), parsedUse, cwd, fsCache);
|
|
323
325
|
if (directResolved) return directResolved;
|
|
324
326
|
if (!context.workspaceRoot) return null;
|
|
325
|
-
return resolveFromPackageRoots(getWorkspaceLoadFastPathCandidateDirs(parsedUse.packageName, context), parsedUse, cwd);
|
|
327
|
+
return resolveFromPackageRoots(getWorkspaceLoadFastPathCandidateDirs(parsedUse.packageName, context, fsCache), parsedUse, cwd, fsCache);
|
|
326
328
|
}
|
|
327
329
|
|
|
328
330
|
//#endregion
|
|
@@ -344,14 +346,21 @@ function toScanOptions(options) {
|
|
|
344
346
|
function getScanScope(options) {
|
|
345
347
|
return options.scope ?? (options.includeGlobal ? "local-and-global" : "local");
|
|
346
348
|
}
|
|
349
|
+
function withFsCache(options, fsCache) {
|
|
350
|
+
return {
|
|
351
|
+
...options,
|
|
352
|
+
fsCache
|
|
353
|
+
};
|
|
354
|
+
}
|
|
347
355
|
function resolveCoreCwd(options) {
|
|
348
356
|
return resolve(process.cwd(), options.cwd ?? process.cwd());
|
|
349
357
|
}
|
|
350
358
|
function listIntentSkills(options = {}) {
|
|
351
359
|
const cwd = resolveCoreCwd(options);
|
|
352
360
|
const scanOptions = toScanOptions(options);
|
|
361
|
+
const fsCache = createIntentFsCache();
|
|
353
362
|
const projectContext = resolveProjectContext({ cwd });
|
|
354
|
-
const scanResult = scanForIntents(cwd, scanOptions);
|
|
363
|
+
const scanResult = scanForIntents(cwd, withFsCache(scanOptions, fsCache));
|
|
355
364
|
const excludePatterns = getEffectiveExcludePatterns(options, projectContext);
|
|
356
365
|
const excludeMatchers = compileExcludePatterns(excludePatterns);
|
|
357
366
|
const excludedPackages = scanResult.packages.filter((pkg) => isPackageExcluded(pkg.name, excludeMatchers)).map((pkg) => pkg.name);
|
|
@@ -387,7 +396,8 @@ function listIntentSkills(options = {}) {
|
|
|
387
396
|
packageCount: result.packages.length,
|
|
388
397
|
skillCount: result.skills.length,
|
|
389
398
|
warningCount: result.warnings.length,
|
|
390
|
-
conflictCount: result.conflicts.length
|
|
399
|
+
conflictCount: result.conflicts.length,
|
|
400
|
+
scan: scanResult.stats ?? fsCache.getStats()
|
|
391
401
|
};
|
|
392
402
|
return result;
|
|
393
403
|
}
|
|
@@ -424,7 +434,7 @@ function toResolvedIntentSkill(cwd, use, resolved, debug) {
|
|
|
424
434
|
result
|
|
425
435
|
};
|
|
426
436
|
}
|
|
427
|
-
function createLoadedSkillDebug({ cwd, excludes, resolution, resolved, scope }) {
|
|
437
|
+
function createLoadedSkillDebug({ cwd, excludes, scan, resolution, resolved, scope }) {
|
|
428
438
|
return {
|
|
429
439
|
cwd,
|
|
430
440
|
scope,
|
|
@@ -435,7 +445,8 @@ function createLoadedSkillDebug({ cwd, excludes, resolution, resolved, scope })
|
|
|
435
445
|
version: resolved.version,
|
|
436
446
|
source: resolved.source,
|
|
437
447
|
path: resolved.path,
|
|
438
|
-
warningCount: resolved.warnings.length
|
|
448
|
+
warningCount: resolved.warnings.length,
|
|
449
|
+
scan
|
|
439
450
|
};
|
|
440
451
|
}
|
|
441
452
|
function resolveIntentSkillInCwd(cwd, use, options = {}) {
|
|
@@ -445,21 +456,23 @@ function resolveIntentSkillInCwd(cwd, use, options = {}) {
|
|
|
445
456
|
} catch (err) {
|
|
446
457
|
throw new IntentCoreError("invalid-skill-use", err instanceof Error ? err.message : String(err));
|
|
447
458
|
}
|
|
459
|
+
const fsCache = createIntentFsCache();
|
|
448
460
|
const projectContext = resolveProjectContext({ cwd });
|
|
449
461
|
const excludePatterns = getEffectiveExcludePatterns(options, projectContext);
|
|
450
462
|
const excludeMatchers = compileExcludePatterns(excludePatterns);
|
|
451
463
|
if (isPackageExcluded(parsedUse.packageName, excludeMatchers)) throw new IntentCoreError("package-excluded", `Cannot load skill use "${use}": package "${parsedUse.packageName}" is excluded by Intent configuration.`);
|
|
452
464
|
const scanOptions = toScanOptions(options);
|
|
453
465
|
const scope = getScanScope(scanOptions);
|
|
454
|
-
const fastPathResolved = resolveSkillUseFastPath(parsedUse, options, projectContext, cwd);
|
|
466
|
+
const fastPathResolved = resolveSkillUseFastPath(parsedUse, options, projectContext, cwd, fsCache);
|
|
455
467
|
if (fastPathResolved) return toResolvedIntentSkill(cwd, use, fastPathResolved, options.debug ? createLoadedSkillDebug({
|
|
456
468
|
cwd,
|
|
457
469
|
excludes: excludePatterns,
|
|
458
470
|
resolution: "fast-path",
|
|
459
471
|
resolved: fastPathResolved,
|
|
472
|
+
scan: fsCache.getStats(),
|
|
460
473
|
scope
|
|
461
474
|
}) : void 0);
|
|
462
|
-
const scanResult = scanForIntents(cwd, scanOptions);
|
|
475
|
+
const scanResult = scanForIntents(cwd, withFsCache(scanOptions, fsCache));
|
|
463
476
|
let resolved;
|
|
464
477
|
try {
|
|
465
478
|
resolved = resolveSkillUse(use, scanResult);
|
|
@@ -472,6 +485,7 @@ function resolveIntentSkillInCwd(cwd, use, options = {}) {
|
|
|
472
485
|
excludes: excludePatterns,
|
|
473
486
|
resolution: "full-scan",
|
|
474
487
|
resolved,
|
|
488
|
+
scan: scanResult.stats ?? fsCache.getStats(),
|
|
475
489
|
scope
|
|
476
490
|
}) : void 0);
|
|
477
491
|
}
|
package/dist/core.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as ScanStats, h as ScanScope, l as IntentPackage, x as VersionConflict } from "./types-Cq5cY9h9.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/core/types.d.ts
|
|
4
4
|
interface IntentCoreOptions {
|
|
@@ -55,6 +55,7 @@ interface IntentSkillListDebug {
|
|
|
55
55
|
skillCount: number;
|
|
56
56
|
warningCount: number;
|
|
57
57
|
conflictCount: number;
|
|
58
|
+
scan: IntentScanDebugStats;
|
|
58
59
|
}
|
|
59
60
|
interface LoadedIntentSkillDebug {
|
|
60
61
|
cwd: string;
|
|
@@ -67,7 +68,9 @@ interface LoadedIntentSkillDebug {
|
|
|
67
68
|
source: IntentPackage['source'];
|
|
68
69
|
path: string;
|
|
69
70
|
warningCount: number;
|
|
71
|
+
scan: IntentScanDebugStats;
|
|
70
72
|
}
|
|
73
|
+
interface IntentScanDebugStats extends ScanStats {}
|
|
71
74
|
type IntentCoreErrorCode = 'invalid-options' | 'invalid-skill-use' | 'package-not-found' | 'package-excluded' | 'skill-not-found' | 'skill-path-outside-package' | 'skill-file-not-found';
|
|
72
75
|
//#endregion
|
|
73
76
|
//#region src/core.d.ts
|
package/dist/core.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import "./skill-paths-
|
|
3
|
-
import "./scanner-
|
|
4
|
-
import "./workspace-patterns-
|
|
5
|
-
import "./project-context-
|
|
6
|
-
import "./resolver-
|
|
7
|
-
import { i as resolveIntentSkill, n as listIntentSkills, r as loadIntentSkill, t as IntentCoreError } from "./core-
|
|
1
|
+
import "./utils-BPDvfmcd.mjs";
|
|
2
|
+
import "./skill-paths-BHbdWniB.mjs";
|
|
3
|
+
import "./scanner-BGyQTQ3U.mjs";
|
|
4
|
+
import "./workspace-patterns-CIJQCwbJ.mjs";
|
|
5
|
+
import "./project-context-Bv9BDh8B.mjs";
|
|
6
|
+
import "./resolver-BDsZ3kWg.mjs";
|
|
7
|
+
import { i as resolveIntentSkill, n as listIntentSkills, r as loadIntentSkill, t as IntentCoreError } from "./core-BOSjgetf.mjs";
|
|
8
8
|
|
|
9
9
|
export { IntentCoreError, listIntentSkills, loadIntentSkill, resolveIntentSkill };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as isStableLoadPath, t as formatRuntimeSkillLookupHint } from "./skill-paths-
|
|
1
|
+
import { n as isStableLoadPath, t as formatRuntimeSkillLookupHint } from "./skill-paths-BHbdWniB.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/display.ts
|
|
4
4
|
function padColumn(text, width) {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as SkillEntry, a as IntentArtifactSet, b as StalenessSignal, c as IntentConfig, d as MetaFeedbackPayload, f as MetaSkillName, i as IntentArtifactFile, l as IntentPackage, m as ScanResult, n as FeedbackPayload, o as IntentArtifactSkill, p as ScanOptions, r as IntentArtifactCoverageIgnore, s as IntentArtifactWarning, t as AgentName, u as IntentProjectConfig, v as SkillStaleness, x as VersionConflict, y as StalenessReport } from "./types-Cq5cY9h9.mjs";
|
|
2
2
|
import { i as runEditPackageJson, o as runSetupGithubActions, r as SetupGithubActionsResult, t as EditPackageJsonResult } from "./setup-2SE9zYJk.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/scanner.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { a as parseFrontmatter, n as findSkillFiles, o as resolveDepDir, r as getDeps } from "./utils-
|
|
2
|
-
import "./skill-paths-
|
|
3
|
-
import { t as scanForIntents } from "./scanner-
|
|
4
|
-
import "./workspace-patterns-
|
|
1
|
+
import { a as parseFrontmatter, n as findSkillFiles, o as resolveDepDir, r as getDeps } from "./utils-BPDvfmcd.mjs";
|
|
2
|
+
import "./skill-paths-BHbdWniB.mjs";
|
|
3
|
+
import { t as scanForIntents } from "./scanner-BGyQTQ3U.mjs";
|
|
4
|
+
import "./workspace-patterns-CIJQCwbJ.mjs";
|
|
5
5
|
import { t as readIntentArtifacts } from "./artifact-coverage-DgWuVqUp.mjs";
|
|
6
|
-
import { n as checkStaleness } from "./staleness-
|
|
6
|
+
import { n as checkStaleness } from "./staleness-CGLs-swr.mjs";
|
|
7
7
|
import { n as collectStaleReviewItems, r as createFailedStaleReviewItem, t as buildStaleReviewBody } from "./workflow-review-CwcR2ge4.mjs";
|
|
8
8
|
import { i as parseSkillUse, n as formatSkillUse, r as isSkillUseParseError, t as SkillUseParseError } from "./skill-use-umYvZl94.mjs";
|
|
9
|
-
import "./project-context-
|
|
10
|
-
import { i as resolveSkillUse, n as isResolveSkillUseError, t as ResolveSkillUseError } from "./resolver-
|
|
11
|
-
import { r as runSetupGithubActions, t as runEditPackageJson } from "./setup-
|
|
9
|
+
import "./project-context-Bv9BDh8B.mjs";
|
|
10
|
+
import { i as resolveSkillUse, n as isResolveSkillUseError, t as ResolveSkillUseError } from "./resolver-BDsZ3kWg.mjs";
|
|
11
|
+
import { r as runSetupGithubActions, t as runEditPackageJson } from "./setup-DQMKxEoA.mjs";
|
|
12
12
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
13
13
|
import { join } from "node:path";
|
|
14
14
|
import { execFileSync, execSync } from "node:child_process";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-umYvZl94.mjs";
|
|
2
2
|
import { t as fail } from "./cli-error-BrMXlbtx.mjs";
|
|
3
|
-
import { c as scanOptionsFromGlobalFlags, l as printWarnings } from "./cli-support-
|
|
3
|
+
import { c as scanOptionsFromGlobalFlags, l as printWarnings } from "./cli-support-DtqVDiJv.mjs";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { dirname, join, relative } from "node:path";
|
|
6
6
|
import { parse } from "yaml";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "./utils-BPDvfmcd.mjs";
|
|
2
|
+
import "./workspace-patterns-CIJQCwbJ.mjs";
|
|
3
|
+
import "./project-context-Bv9BDh8B.mjs";
|
|
4
|
+
import "./cli-support-DtqVDiJv.mjs";
|
|
5
|
+
import { n as runInstallCommand, t as INSTALL_PROMPT } from "./install-CLkmoPOY.mjs";
|
|
6
|
+
|
|
7
|
+
export { INSTALL_PROMPT, runInstallCommand };
|
package/dist/intent-library.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./utils-
|
|
3
|
-
import "./skill-paths-
|
|
4
|
-
import "./workspace-patterns-
|
|
5
|
-
import "./project-context-
|
|
6
|
-
import { n as printSkillTree, r as printTable, t as computeSkillNameWidth } from "./display-
|
|
7
|
-
import "./cli-support-
|
|
8
|
-
import { t as INSTALL_PROMPT } from "./install-
|
|
9
|
-
import { t as scanLibrary } from "./library-scanner-
|
|
2
|
+
import "./utils-BPDvfmcd.mjs";
|
|
3
|
+
import "./skill-paths-BHbdWniB.mjs";
|
|
4
|
+
import "./workspace-patterns-CIJQCwbJ.mjs";
|
|
5
|
+
import "./project-context-Bv9BDh8B.mjs";
|
|
6
|
+
import { n as printSkillTree, r as printTable, t as computeSkillNameWidth } from "./display-DHNuzSqR.mjs";
|
|
7
|
+
import "./cli-support-DtqVDiJv.mjs";
|
|
8
|
+
import { t as INSTALL_PROMPT } from "./install-CLkmoPOY.mjs";
|
|
9
|
+
import { t as scanLibrary } from "./library-scanner-BAJ7bXtW.mjs";
|
|
10
10
|
|
|
11
11
|
//#region src/intent-library.ts
|
|
12
12
|
function cmdList() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as parseFrontmatter, o as resolveDepDir, r as getDeps, s as toPosixPath } from "./utils-
|
|
2
|
-
import { r as rewriteSkillLoadPaths } from "./skill-paths-
|
|
1
|
+
import { a as parseFrontmatter, o as resolveDepDir, r as getDeps, s as toPosixPath } from "./utils-BPDvfmcd.mjs";
|
|
2
|
+
import { r as rewriteSkillLoadPaths } from "./skill-paths-BHbdWniB.mjs";
|
|
3
3
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
4
4
|
import { dirname, join, relative } from "node:path";
|
|
5
5
|
|
package/dist/library-scanner.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import "./skill-paths-
|
|
3
|
-
import { t as scanLibrary } from "./library-scanner-
|
|
1
|
+
import "./utils-BPDvfmcd.mjs";
|
|
2
|
+
import "./skill-paths-BHbdWniB.mjs";
|
|
3
|
+
import { t as scanLibrary } from "./library-scanner-BAJ7bXtW.mjs";
|
|
4
4
|
|
|
5
5
|
export { scanLibrary };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import "./skill-paths-
|
|
3
|
-
import "./scanner-
|
|
4
|
-
import "./workspace-patterns-
|
|
5
|
-
import "./project-context-
|
|
6
|
-
import "./resolver-
|
|
7
|
-
import { a as printDebugInfo, l as printWarnings, n as coreOptionsFromGlobalFlags } from "./cli-support-
|
|
8
|
-
import { n as listIntentSkills } from "./core-
|
|
1
|
+
import "./utils-BPDvfmcd.mjs";
|
|
2
|
+
import "./skill-paths-BHbdWniB.mjs";
|
|
3
|
+
import "./scanner-BGyQTQ3U.mjs";
|
|
4
|
+
import "./workspace-patterns-CIJQCwbJ.mjs";
|
|
5
|
+
import "./project-context-Bv9BDh8B.mjs";
|
|
6
|
+
import "./resolver-BDsZ3kWg.mjs";
|
|
7
|
+
import { a as printDebugInfo, l as printWarnings, n as coreOptionsFromGlobalFlags } from "./cli-support-DtqVDiJv.mjs";
|
|
8
|
+
import { n as listIntentSkills } from "./core-BOSjgetf.mjs";
|
|
9
9
|
|
|
10
10
|
//#region src/commands/list.ts
|
|
11
11
|
function printListDebug(result) {
|
|
@@ -17,7 +17,9 @@ function printListDebug(result) {
|
|
|
17
17
|
["packages", result.debug.packageCount],
|
|
18
18
|
["skills", result.debug.skillCount],
|
|
19
19
|
["warnings", result.debug.warningCount],
|
|
20
|
-
["conflicts", result.debug.conflictCount]
|
|
20
|
+
["conflicts", result.debug.conflictCount],
|
|
21
|
+
["packageJsonReadCount", result.debug.scan.packageJsonReadCount],
|
|
22
|
+
["packageJsonCacheHits", result.debug.scan.packageJsonCacheHits]
|
|
21
23
|
]);
|
|
22
24
|
}
|
|
23
25
|
function printVersionConflicts(result) {
|
|
@@ -53,7 +55,7 @@ async function runListCommand(options, _scanIntentsOrFail) {
|
|
|
53
55
|
console.log(JSON.stringify(jsonResult, null, 2));
|
|
54
56
|
return;
|
|
55
57
|
}
|
|
56
|
-
const { computeSkillNameWidth, printSkillTree, printTable } = await import("./display-
|
|
58
|
+
const { computeSkillNameWidth, printSkillTree, printTable } = await import("./display-CmLzVAae.mjs");
|
|
57
59
|
if (result.packages.length === 0) {
|
|
58
60
|
console.log("No intent-enabled packages found.");
|
|
59
61
|
if (result.warnings.length > 0) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import "./skill-paths-
|
|
3
|
-
import "./scanner-
|
|
4
|
-
import "./workspace-patterns-
|
|
5
|
-
import "./project-context-
|
|
6
|
-
import "./resolver-
|
|
1
|
+
import "./utils-BPDvfmcd.mjs";
|
|
2
|
+
import "./skill-paths-BHbdWniB.mjs";
|
|
3
|
+
import "./scanner-BGyQTQ3U.mjs";
|
|
4
|
+
import "./workspace-patterns-CIJQCwbJ.mjs";
|
|
5
|
+
import "./project-context-Bv9BDh8B.mjs";
|
|
6
|
+
import "./resolver-BDsZ3kWg.mjs";
|
|
7
7
|
import { t as fail } from "./cli-error-BrMXlbtx.mjs";
|
|
8
|
-
import { a as printDebugInfo, n as coreOptionsFromGlobalFlags } from "./cli-support-
|
|
9
|
-
import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-
|
|
8
|
+
import { a as printDebugInfo, n as coreOptionsFromGlobalFlags } from "./cli-support-DtqVDiJv.mjs";
|
|
9
|
+
import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-BOSjgetf.mjs";
|
|
10
10
|
|
|
11
11
|
//#region src/commands/load.ts
|
|
12
12
|
function printLoadDebug(loaded) {
|
|
@@ -21,7 +21,9 @@ function printLoadDebug(loaded) {
|
|
|
21
21
|
["source", loaded.debug.source],
|
|
22
22
|
["skill", loaded.debug.skillName],
|
|
23
23
|
["path", loaded.debug.path],
|
|
24
|
-
["warnings", loaded.debug.warningCount]
|
|
24
|
+
["warnings", loaded.debug.warningCount],
|
|
25
|
+
["packageJsonReadCount", loaded.debug.scan.packageJsonReadCount],
|
|
26
|
+
["packageJsonCacheHits", loaded.debug.scan.packageJsonCacheHits]
|
|
25
27
|
]);
|
|
26
28
|
}
|
|
27
29
|
async function runLoadCommand(use, options, _scanIntentsOrFail) {
|
|
@@ -16,7 +16,7 @@ async function runMetaCommand(name, metaDir) {
|
|
|
16
16
|
}
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
const { parseFrontmatter } = await import("./utils-
|
|
19
|
+
const { parseFrontmatter } = await import("./utils-DqdIC3RY.mjs");
|
|
20
20
|
const entries = readdirSync(metaDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => existsSync(join(metaDir, entry.name, "SKILL.md")));
|
|
21
21
|
if (entries.length === 0) {
|
|
22
22
|
console.log("No meta-skills found.");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as readWorkspacePatterns, r as findWorkspaceRoot } from "./workspace-patterns-
|
|
1
|
+
import { a as readWorkspacePatterns, r as findWorkspaceRoot } from "./workspace-patterns-CIJQCwbJ.mjs";
|
|
2
2
|
import { existsSync, statSync } from "node:fs";
|
|
3
3
|
import { dirname, join, relative, resolve } from "node:path";
|
|
4
4
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as parseSkillUse } from "./skill-use-umYvZl94.mjs";
|
|
2
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
2
|
+
import { t as resolveProjectContext } from "./project-context-Bv9BDh8B.mjs";
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
5
5
|
|
|
@@ -193,4 +193,4 @@ function formatSkillSuggestions(packageName, skillNames) {
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
//#endregion
|
|
196
|
-
export { compileExcludePatterns as a, warningMentionsPackage as c, resolveSkillUse as i,
|
|
196
|
+
export { compileExcludePatterns as a, warningMentionsPackage as c, resolveSkillUse as i, isResolveSkillUseError as n, getEffectiveExcludePatterns as o, resolveSkillEntry as r, isPackageExcluded as s, ResolveSkillUseError as t };
|
|
@@ -1,21 +1,41 @@
|
|
|
1
|
-
import { a as parseFrontmatter, i as listNodeModulesPackageDirs, o as resolveDepDir, r as getDeps, s as toPosixPath, t as detectGlobalNodeModules } from "./utils-
|
|
2
|
-
import { r as rewriteSkillLoadPaths } from "./skill-paths-
|
|
3
|
-
import {
|
|
1
|
+
import { a as parseFrontmatter, i as listNodeModulesPackageDirs, n as findSkillFiles, o as resolveDepDir, r as getDeps, s as toPosixPath, t as detectGlobalNodeModules } from "./utils-BPDvfmcd.mjs";
|
|
2
|
+
import { r as rewriteSkillLoadPaths } from "./skill-paths-BHbdWniB.mjs";
|
|
3
|
+
import { n as findWorkspacePackages, r as findWorkspaceRoot } from "./workspace-patterns-CIJQCwbJ.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
|
-
import { existsSync, readFileSync
|
|
5
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
7
|
+
import semver from "semver";
|
|
7
8
|
|
|
8
9
|
//#region src/discovery/register.ts
|
|
9
10
|
function isLocalToProject(dirPath, projectRoot) {
|
|
10
11
|
return dirPath.startsWith(projectRoot + sep) || dirPath.startsWith(projectRoot + "/");
|
|
11
12
|
}
|
|
13
|
+
function getFsIdentity(path) {
|
|
14
|
+
return resolve(path);
|
|
15
|
+
}
|
|
12
16
|
function createPackageRegistrar(opts) {
|
|
17
|
+
const attemptedPackageRoots = /* @__PURE__ */ new Set();
|
|
18
|
+
const scannedNodeModulesDirs = /* @__PURE__ */ new Set();
|
|
19
|
+
function shouldAttemptPackageRoot(dirPath) {
|
|
20
|
+
const key = getFsIdentity(dirPath);
|
|
21
|
+
if (attemptedPackageRoots.has(key)) return false;
|
|
22
|
+
attemptedPackageRoots.add(key);
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
function scanNodeModulesDir(nodeModulesDir, source = "local") {
|
|
26
|
+
if (!existsSync(nodeModulesDir)) return;
|
|
27
|
+
const key = getFsIdentity(nodeModulesDir);
|
|
28
|
+
if (scannedNodeModulesDirs.has(key)) return;
|
|
29
|
+
scannedNodeModulesDirs.add(key);
|
|
30
|
+
for (const dirPath of listNodeModulesPackageDirs(nodeModulesDir)) tryRegister(dirPath, "unknown", source);
|
|
31
|
+
}
|
|
13
32
|
function scanTarget(target, source = "local") {
|
|
14
33
|
if (!target.path || !target.exists || target.scanned) return;
|
|
15
34
|
target.scanned = true;
|
|
16
|
-
|
|
35
|
+
scanNodeModulesDir(target.path, source);
|
|
17
36
|
}
|
|
18
37
|
function tryRegister(dirPath, fallbackName, source = "local") {
|
|
38
|
+
if (!shouldAttemptPackageRoot(dirPath)) return false;
|
|
19
39
|
const skillsDir = join(dirPath, "skills");
|
|
20
40
|
if (!existsSync(skillsDir)) return false;
|
|
21
41
|
const pkgJson = opts.readPkgJson(dirPath);
|
|
@@ -61,6 +81,7 @@ function createPackageRegistrar(opts) {
|
|
|
61
81
|
return true;
|
|
62
82
|
}
|
|
63
83
|
return {
|
|
84
|
+
scanNodeModulesDir,
|
|
64
85
|
scanTarget,
|
|
65
86
|
tryRegister
|
|
66
87
|
};
|
|
@@ -107,19 +128,16 @@ function createDependencyWalker(opts) {
|
|
|
107
128
|
walkDepsOf(projectPkg, opts.projectRoot, true);
|
|
108
129
|
}
|
|
109
130
|
function readPkgJsonWithWarning(dirPath, label) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (err.code !== "ENOENT") opts.warnings.push(`Could not read ${label} package.json at ${dirPath}: ${err.message}`);
|
|
131
|
+
const result = opts.fsCache.readPackageJsonResult(dirPath);
|
|
132
|
+
if (!result.packageJson) {
|
|
133
|
+
if (result.error?.code !== "ENOENT") opts.warnings.push(`Could not read ${label} package.json at ${dirPath}: ${result.error instanceof Error ? result.error.message : "invalid package.json"}`);
|
|
114
134
|
return null;
|
|
115
135
|
}
|
|
136
|
+
return result.packageJson;
|
|
116
137
|
}
|
|
117
138
|
function walkWorkspacePackages() {
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
for (const wsDir of resolveWorkspacePackages(opts.projectRoot, workspacePatterns)) {
|
|
121
|
-
const wsNodeModules = join(wsDir, "node_modules");
|
|
122
|
-
if (existsSync(wsNodeModules)) for (const dirPath of listNodeModulesPackageDirs(wsNodeModules)) opts.tryRegister(dirPath, "unknown");
|
|
139
|
+
for (const wsDir of findWorkspacePackages(opts.projectRoot)) {
|
|
140
|
+
opts.scanNodeModulesDir(join(wsDir, "node_modules"));
|
|
123
141
|
const wsPkg = readPkgJsonWithWarning(wsDir, "workspace");
|
|
124
142
|
if (wsPkg) walkDepsOf(wsPkg, wsDir);
|
|
125
143
|
}
|
|
@@ -131,6 +149,65 @@ function createDependencyWalker(opts) {
|
|
|
131
149
|
};
|
|
132
150
|
}
|
|
133
151
|
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/fs-cache.ts
|
|
154
|
+
function normalizeCacheKey(path) {
|
|
155
|
+
return resolve(path);
|
|
156
|
+
}
|
|
157
|
+
function isRecord(value) {
|
|
158
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
159
|
+
}
|
|
160
|
+
function createIntentFsCache() {
|
|
161
|
+
const packageJsonCache = /* @__PURE__ */ new Map();
|
|
162
|
+
const skillFilesCache = /* @__PURE__ */ new Map();
|
|
163
|
+
const stats = {
|
|
164
|
+
packageJsonReadCount: 0,
|
|
165
|
+
packageJsonCacheHits: 0
|
|
166
|
+
};
|
|
167
|
+
function readPackageJsonResult(dir) {
|
|
168
|
+
const key = normalizeCacheKey(dir);
|
|
169
|
+
const cached = packageJsonCache.get(key);
|
|
170
|
+
if (cached) {
|
|
171
|
+
stats.packageJsonCacheHits += 1;
|
|
172
|
+
return cached;
|
|
173
|
+
}
|
|
174
|
+
stats.packageJsonReadCount += 1;
|
|
175
|
+
try {
|
|
176
|
+
const parsed = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
|
|
177
|
+
const result = {
|
|
178
|
+
packageJson: isRecord(parsed) ? parsed : null,
|
|
179
|
+
error: null
|
|
180
|
+
};
|
|
181
|
+
packageJsonCache.set(key, result);
|
|
182
|
+
return result;
|
|
183
|
+
} catch (error) {
|
|
184
|
+
const result = {
|
|
185
|
+
packageJson: null,
|
|
186
|
+
error
|
|
187
|
+
};
|
|
188
|
+
packageJsonCache.set(key, result);
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function readPackageJson(dir) {
|
|
193
|
+
return readPackageJsonResult(dir).packageJson;
|
|
194
|
+
}
|
|
195
|
+
function findSkillFiles$1(dir) {
|
|
196
|
+
const key = normalizeCacheKey(dir);
|
|
197
|
+
const cached = skillFilesCache.get(key);
|
|
198
|
+
if (cached) return [...cached];
|
|
199
|
+
const files = findSkillFiles(dir);
|
|
200
|
+
skillFilesCache.set(key, files);
|
|
201
|
+
return [...files];
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
readPackageJson,
|
|
205
|
+
readPackageJsonResult,
|
|
206
|
+
findSkillFiles: findSkillFiles$1,
|
|
207
|
+
getStats: () => ({ ...stats })
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
134
211
|
//#endregion
|
|
135
212
|
//#region src/scanner.ts
|
|
136
213
|
const requireFromHere = createRequire(import.meta.url);
|
|
@@ -260,28 +337,12 @@ function discoverSkillByNameHint(skillsDir, packageName, skillNameHint) {
|
|
|
260
337
|
}
|
|
261
338
|
return skills;
|
|
262
339
|
}
|
|
263
|
-
function discoverSkills(skillsDir) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
withFileTypes: true,
|
|
270
|
-
encoding: "utf8"
|
|
271
|
-
});
|
|
272
|
-
} catch {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
for (const entry of entries) {
|
|
276
|
-
if (!entry.isDirectory()) continue;
|
|
277
|
-
const childDir = join(dir, entry.name);
|
|
278
|
-
const skillFile = join(childDir, "SKILL.md");
|
|
279
|
-
if (existsSync(skillFile)) skills.push(readSkillEntry(skillsDir, childDir, skillFile));
|
|
280
|
-
walk(childDir);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
walk(skillsDir);
|
|
284
|
-
return skills;
|
|
340
|
+
function discoverSkills(skillsDir, fsCache) {
|
|
341
|
+
return fsCache.findSkillFiles(skillsDir).flatMap((skillFile) => {
|
|
342
|
+
const childDir = dirname(skillFile);
|
|
343
|
+
if (childDir === skillsDir) return [];
|
|
344
|
+
return [readSkillEntry(skillsDir, childDir, skillFile)];
|
|
345
|
+
});
|
|
285
346
|
}
|
|
286
347
|
function getPackageShortName(packageName) {
|
|
287
348
|
return packageName.split("/").pop() ?? packageName;
|
|
@@ -325,49 +386,20 @@ function topoSort(packages) {
|
|
|
325
386
|
function getPackageDepth(packageRoot, projectRoot) {
|
|
326
387
|
return relative(projectRoot, packageRoot).split(sep).length;
|
|
327
388
|
}
|
|
328
|
-
function
|
|
329
|
-
const
|
|
330
|
-
if (
|
|
331
|
-
|
|
332
|
-
return /^\d+$/.test(identifier) ? Number(identifier) : identifier;
|
|
333
|
-
}) : [];
|
|
334
|
-
return {
|
|
335
|
-
major: Number(match[1]),
|
|
336
|
-
minor: Number(match[2]),
|
|
337
|
-
patch: Number(match[3]),
|
|
338
|
-
prerelease
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
function comparePrereleaseIdentifiers(a, b) {
|
|
342
|
-
if (a === void 0) return b === void 0 ? 0 : 1;
|
|
343
|
-
if (b === void 0) return -1;
|
|
344
|
-
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
345
|
-
if (typeof a === "number") return -1;
|
|
346
|
-
if (typeof b === "number") return 1;
|
|
347
|
-
return a.localeCompare(b);
|
|
389
|
+
function normalizeVersion(version) {
|
|
390
|
+
const validVersion = semver.valid(version);
|
|
391
|
+
if (validVersion) return validVersion;
|
|
392
|
+
return semver.coerce(version)?.version ?? null;
|
|
348
393
|
}
|
|
349
394
|
function comparePackageVersions(a, b) {
|
|
350
|
-
const
|
|
351
|
-
const
|
|
352
|
-
if (!
|
|
353
|
-
if (
|
|
354
|
-
if (
|
|
395
|
+
const versionA = normalizeVersion(a);
|
|
396
|
+
const versionB = normalizeVersion(b);
|
|
397
|
+
if (!versionA || !versionB) {
|
|
398
|
+
if (versionA) return 1;
|
|
399
|
+
if (versionB) return -1;
|
|
355
400
|
return 0;
|
|
356
401
|
}
|
|
357
|
-
|
|
358
|
-
"major",
|
|
359
|
-
"minor",
|
|
360
|
-
"patch"
|
|
361
|
-
]) {
|
|
362
|
-
const diff = parsedA[key] - parsedB[key];
|
|
363
|
-
if (diff !== 0) return diff;
|
|
364
|
-
}
|
|
365
|
-
const length = Math.max(parsedA.prerelease.length, parsedB.prerelease.length);
|
|
366
|
-
for (let i = 0; i < length; i++) {
|
|
367
|
-
const diff = comparePrereleaseIdentifiers(parsedA.prerelease[i], parsedB.prerelease[i]);
|
|
368
|
-
if (diff !== 0) return diff;
|
|
369
|
-
}
|
|
370
|
-
return 0;
|
|
402
|
+
return semver.compare(versionA, versionB);
|
|
371
403
|
}
|
|
372
404
|
function formatVariantWarning(name, variants, chosen) {
|
|
373
405
|
const uniqueVersions = new Set(variants.map((variant) => variant.version));
|
|
@@ -392,6 +424,7 @@ function getScanScope(options) {
|
|
|
392
424
|
function scanForIntents(root, options = {}) {
|
|
393
425
|
const projectRoot = root ?? process.cwd();
|
|
394
426
|
const scanScope = getScanScope(options);
|
|
427
|
+
const fsCache = options.fsCache ?? createIntentFsCache();
|
|
395
428
|
const packageManager = detectPackageManager(projectRoot);
|
|
396
429
|
const nodeModulesDir = join(projectRoot, "node_modules");
|
|
397
430
|
const explicitGlobalNodeModules = process.env.INTENT_GLOBAL_NODE_MODULES?.trim() || null;
|
|
@@ -414,7 +447,6 @@ function scanForIntents(root, options = {}) {
|
|
|
414
447
|
}
|
|
415
448
|
};
|
|
416
449
|
const packageIndexes = /* @__PURE__ */ new Map();
|
|
417
|
-
const packageJsonCache = /* @__PURE__ */ new Map();
|
|
418
450
|
const packageVariants = /* @__PURE__ */ new Map();
|
|
419
451
|
let pnpApi;
|
|
420
452
|
function getPnpApi() {
|
|
@@ -422,6 +454,9 @@ function scanForIntents(root, options = {}) {
|
|
|
422
454
|
if (pnpApi === void 0) pnpApi = loadPnpApi(projectRoot);
|
|
423
455
|
return pnpApi;
|
|
424
456
|
}
|
|
457
|
+
function getStats() {
|
|
458
|
+
return fsCache.getStats();
|
|
459
|
+
}
|
|
425
460
|
function rememberVariant(pkg) {
|
|
426
461
|
let variants = packageVariants.get(pkg.name);
|
|
427
462
|
if (!variants) {
|
|
@@ -443,20 +478,12 @@ function scanForIntents(root, options = {}) {
|
|
|
443
478
|
}
|
|
444
479
|
}
|
|
445
480
|
function readPkgJson(dirPath) {
|
|
446
|
-
|
|
447
|
-
try {
|
|
448
|
-
const pkgJson = JSON.parse(readFileSync(join(dirPath, "package.json"), "utf8"));
|
|
449
|
-
packageJsonCache.set(dirPath, pkgJson);
|
|
450
|
-
return pkgJson;
|
|
451
|
-
} catch {
|
|
452
|
-
packageJsonCache.set(dirPath, null);
|
|
453
|
-
return null;
|
|
454
|
-
}
|
|
481
|
+
return fsCache.readPackageJson(dirPath);
|
|
455
482
|
}
|
|
456
|
-
const { scanTarget, tryRegister } = createPackageRegistrar({
|
|
483
|
+
const { scanNodeModulesDir, scanTarget, tryRegister } = createPackageRegistrar({
|
|
457
484
|
comparePackageVersions,
|
|
458
485
|
deriveIntentConfig,
|
|
459
|
-
discoverSkills,
|
|
486
|
+
discoverSkills: (skillsDir) => discoverSkills(skillsDir, fsCache),
|
|
460
487
|
getPackageDepth,
|
|
461
488
|
packageIndexes,
|
|
462
489
|
packages,
|
|
@@ -467,9 +494,11 @@ function scanForIntents(root, options = {}) {
|
|
|
467
494
|
warnings
|
|
468
495
|
});
|
|
469
496
|
const { walkKnownPackages, walkProjectDeps, walkWorkspacePackages } = createDependencyWalker({
|
|
497
|
+
fsCache,
|
|
470
498
|
packages,
|
|
471
499
|
projectRoot,
|
|
472
500
|
readPkgJson,
|
|
501
|
+
scanNodeModulesDir,
|
|
473
502
|
tryRegister,
|
|
474
503
|
warnings
|
|
475
504
|
});
|
|
@@ -534,7 +563,8 @@ function scanForIntents(root, options = {}) {
|
|
|
534
563
|
packages,
|
|
535
564
|
warnings,
|
|
536
565
|
conflicts,
|
|
537
|
-
nodeModules
|
|
566
|
+
nodeModules,
|
|
567
|
+
stats: getStats()
|
|
538
568
|
};
|
|
539
569
|
for (const pkg of packages) {
|
|
540
570
|
const variants = packageVariants.get(pkg.name);
|
|
@@ -549,7 +579,8 @@ function scanForIntents(root, options = {}) {
|
|
|
549
579
|
packages: topoSort(packages),
|
|
550
580
|
warnings,
|
|
551
581
|
conflicts,
|
|
552
|
-
nodeModules
|
|
582
|
+
nodeModules,
|
|
583
|
+
stats: getStats()
|
|
553
584
|
};
|
|
554
585
|
}
|
|
555
586
|
function scanIntentPackageAtRoot(packageRoot, options = {}) {
|
|
@@ -557,22 +588,14 @@ function scanIntentPackageAtRoot(packageRoot, options = {}) {
|
|
|
557
588
|
const packages = [];
|
|
558
589
|
const warnings = [];
|
|
559
590
|
const packageIndexes = /* @__PURE__ */ new Map();
|
|
560
|
-
const
|
|
591
|
+
const fsCache = options.fsCache ?? createIntentFsCache();
|
|
561
592
|
function readPkgJson(dirPath) {
|
|
562
|
-
|
|
563
|
-
try {
|
|
564
|
-
const pkgJson = JSON.parse(readFileSync(join(dirPath, "package.json"), "utf8"));
|
|
565
|
-
packageJsonCache.set(dirPath, pkgJson);
|
|
566
|
-
return pkgJson;
|
|
567
|
-
} catch {
|
|
568
|
-
packageJsonCache.set(dirPath, null);
|
|
569
|
-
return null;
|
|
570
|
-
}
|
|
593
|
+
return fsCache.readPackageJson(dirPath);
|
|
571
594
|
}
|
|
572
595
|
const { tryRegister } = createPackageRegistrar({
|
|
573
596
|
comparePackageVersions,
|
|
574
597
|
deriveIntentConfig,
|
|
575
|
-
discoverSkills: options.skillNameHint ? (skillsDir, packageName) => discoverSkillByNameHint(skillsDir, packageName, options.skillNameHint) : discoverSkills,
|
|
598
|
+
discoverSkills: options.skillNameHint ? (skillsDir, packageName) => discoverSkillByNameHint(skillsDir, packageName, options.skillNameHint) : (skillsDir) => discoverSkills(skillsDir, fsCache),
|
|
576
599
|
getPackageDepth,
|
|
577
600
|
packageIndexes,
|
|
578
601
|
packages,
|
|
@@ -590,4 +613,4 @@ function scanIntentPackageAtRoot(packageRoot, options = {}) {
|
|
|
590
613
|
}
|
|
591
614
|
|
|
592
615
|
//#endregion
|
|
593
|
-
export { scanIntentPackageAtRoot as n, scanForIntents as t };
|
|
616
|
+
export { scanIntentPackageAtRoot as n, createIntentFsCache as r, scanForIntents as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as readWorkspacePatterns, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-
|
|
2
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
1
|
+
import { a as readWorkspacePatterns, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-CIJQCwbJ.mjs";
|
|
2
|
+
import { t as resolveProjectContext } from "./project-context-Bv9BDh8B.mjs";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { basename, join, relative } from "node:path";
|
|
5
5
|
|
package/dist/setup.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import { a as readWorkspacePatterns, o as resolveWorkspacePackages, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-
|
|
3
|
-
import "./project-context-
|
|
4
|
-
import { n as runEditPackageJsonAll, r as runSetupGithubActions, t as runEditPackageJson } from "./setup-
|
|
1
|
+
import "./utils-BPDvfmcd.mjs";
|
|
2
|
+
import { a as readWorkspacePatterns, o as resolveWorkspacePackages, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-CIJQCwbJ.mjs";
|
|
3
|
+
import "./project-context-Bv9BDh8B.mjs";
|
|
4
|
+
import { n as runEditPackageJsonAll, r as runSetupGithubActions, t as runEditPackageJson } from "./setup-DQMKxEoA.mjs";
|
|
5
5
|
|
|
6
6
|
export { findPackagesWithSkills, findWorkspaceRoot, readWorkspacePatterns, resolveWorkspacePackages, runEditPackageJson, runEditPackageJsonAll, runSetupGithubActions };
|
|
@@ -1,17 +1,34 @@
|
|
|
1
|
-
import { a as parseFrontmatter, n as findSkillFiles } from "./utils-
|
|
1
|
+
import { a as parseFrontmatter, n as findSkillFiles, s as toPosixPath } from "./utils-BPDvfmcd.mjs";
|
|
2
2
|
import { t as readIntentArtifacts } from "./artifact-coverage-DgWuVqUp.mjs";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
-
import { isAbsolute, join, relative, resolve
|
|
4
|
+
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
5
|
+
import semver from "semver";
|
|
5
6
|
|
|
6
7
|
//#region src/staleness.ts
|
|
7
8
|
function classifyVersionDrift(oldVer, newVer) {
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
if ((
|
|
12
|
-
if ((
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const oldVersion = normalizeVersion(oldVer);
|
|
10
|
+
const newVersion = normalizeVersion(newVer);
|
|
11
|
+
if (!oldVersion || !newVersion) return null;
|
|
12
|
+
if (semver.eq(oldVersion, newVersion)) return null;
|
|
13
|
+
if (!semver.gt(newVersion, oldVersion)) return null;
|
|
14
|
+
const oldParsed = semver.parse(oldVersion);
|
|
15
|
+
const newParsed = semver.parse(newVersion);
|
|
16
|
+
if (oldParsed && newParsed && oldParsed.major === newParsed.major && oldParsed.minor === newParsed.minor && oldParsed.patch === newParsed.patch && oldParsed.prerelease.length > 0) return "patch";
|
|
17
|
+
switch (semver.diff(oldVersion, newVersion)) {
|
|
18
|
+
case "major":
|
|
19
|
+
case "premajor": return "major";
|
|
20
|
+
case "minor":
|
|
21
|
+
case "preminor": return "minor";
|
|
22
|
+
case "patch":
|
|
23
|
+
case "prepatch":
|
|
24
|
+
case "prerelease": return "patch";
|
|
25
|
+
default: return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function normalizeVersion(version) {
|
|
29
|
+
const validVersion = semver.valid(version);
|
|
30
|
+
if (validVersion) return validVersion;
|
|
31
|
+
return semver.coerce(version)?.version ?? null;
|
|
15
32
|
}
|
|
16
33
|
function readLocalVersion(packageDir) {
|
|
17
34
|
try {
|
|
@@ -75,7 +92,10 @@ function readPackageJson(packageDir) {
|
|
|
75
92
|
}
|
|
76
93
|
}
|
|
77
94
|
function normalizeFilePath(path) {
|
|
78
|
-
return resolve(path)
|
|
95
|
+
return toPosixPath(resolve(path));
|
|
96
|
+
}
|
|
97
|
+
function getRelativePackageDir(artifactRoot, packageDir) {
|
|
98
|
+
return toPosixPath(relative(artifactRoot, packageDir));
|
|
79
99
|
}
|
|
80
100
|
function normalizeList(values) {
|
|
81
101
|
return [...new Set(values ?? [])].sort((a, b) => a.localeCompare(b));
|
|
@@ -86,7 +106,7 @@ function sameStringList(a, b) {
|
|
|
86
106
|
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
87
107
|
}
|
|
88
108
|
function artifactPackageMatches(artifact, packageDir, packageName, artifactRoot) {
|
|
89
|
-
const relPackageDir =
|
|
109
|
+
const relPackageDir = getRelativePackageDir(artifactRoot, packageDir);
|
|
90
110
|
if (!relPackageDir) return true;
|
|
91
111
|
if (artifact.packages.includes(packageName)) return true;
|
|
92
112
|
if (artifact.packages.includes(relPackageDir)) return true;
|
|
@@ -163,11 +183,11 @@ function buildArtifactSignals({ artifactRoot, artifacts, library, packageDir, sk
|
|
|
163
183
|
return signals;
|
|
164
184
|
}
|
|
165
185
|
function artifactCoversPackage(artifact, packageDir, packageName, artifactRoot) {
|
|
166
|
-
const relPackageDir =
|
|
186
|
+
const relPackageDir = getRelativePackageDir(artifactRoot, packageDir);
|
|
167
187
|
return artifact.packages.includes(packageName) || artifact.packages.includes(relPackageDir) || artifact.package === packageName || artifact.package === relPackageDir || artifact.path?.startsWith(`${relPackageDir}/`) === true;
|
|
168
188
|
}
|
|
169
189
|
function artifactIgnoresPackage(artifacts, packageDir, packageName, artifactRoot) {
|
|
170
|
-
const relPackageDir =
|
|
190
|
+
const relPackageDir = getRelativePackageDir(artifactRoot, packageDir);
|
|
171
191
|
return artifacts.ignoredPackages.some((ignored) => ignored.packageName === packageName || ignored.packageName === relPackageDir);
|
|
172
192
|
}
|
|
173
193
|
function buildWorkspaceCoverageSignals({ artifactRoot, artifacts, packageDirs }) {
|
|
@@ -187,17 +207,17 @@ function buildWorkspaceCoverageSignals({ artifactRoot, artifacts, packageDirs })
|
|
|
187
207
|
reasons: ["workspace package is not represented by generated skills or _artifacts coverage"],
|
|
188
208
|
needsReview: true,
|
|
189
209
|
packageName,
|
|
190
|
-
packageRoot:
|
|
210
|
+
packageRoot: getRelativePackageDir(artifactRoot, packageDir)
|
|
191
211
|
});
|
|
192
212
|
}
|
|
193
213
|
return signals;
|
|
194
214
|
}
|
|
195
215
|
async function checkStaleness(packageDir, packageName, artifactRoot = packageDir) {
|
|
196
216
|
const skillsDir = join(packageDir, "skills");
|
|
197
|
-
const library = packageName ??
|
|
217
|
+
const library = packageName ?? readPackageName(packageDir);
|
|
198
218
|
const skillMetas = findSkillFiles(skillsDir).map((filePath) => {
|
|
199
219
|
const fm = parseFrontmatter(filePath);
|
|
200
|
-
const relName = relative(skillsDir, filePath).replace(/[/\\]SKILL\.md$/, "")
|
|
220
|
+
const relName = toPosixPath(relative(skillsDir, filePath)).replace(/[/\\]SKILL\.md$/, "");
|
|
201
221
|
return {
|
|
202
222
|
name: typeof fm?.name === "string" ? fm.name : relName,
|
|
203
223
|
relName,
|
|
@@ -218,7 +238,7 @@ async function checkStaleness(packageDir, packageName, artifactRoot = packageDir
|
|
|
218
238
|
versionDrift,
|
|
219
239
|
skills: skillMetas.map((skill) => {
|
|
220
240
|
const reasons = [];
|
|
221
|
-
if (currentVersion && skill.libraryVersion && skill.libraryVersion !==
|
|
241
|
+
if (currentVersion && skill.libraryVersion && classifyVersionDrift(skill.libraryVersion, currentVersion) !== null) reasons.push(`version drift (${skill.libraryVersion} → ${currentVersion})`);
|
|
222
242
|
const storedShas = syncState?.skills?.[skill.name]?.sources_sha ?? {};
|
|
223
243
|
if (skill.sources && Object.keys(storedShas).length > 0) {
|
|
224
244
|
for (const source of skill.sources) if (!storedShas[source]) reasons.push(`new source (${source})`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./utils-
|
|
1
|
+
import "./utils-BPDvfmcd.mjs";
|
|
2
2
|
import "./artifact-coverage-DgWuVqUp.mjs";
|
|
3
|
-
import { n as checkStaleness, r as readPackageName, t as buildWorkspaceCoverageSignals } from "./staleness-
|
|
3
|
+
import { n as checkStaleness, r as readPackageName, t as buildWorkspaceCoverageSignals } from "./staleness-CGLs-swr.mjs";
|
|
4
4
|
|
|
5
5
|
export { buildWorkspaceCoverageSignals, checkStaleness, readPackageName };
|
|
@@ -14,12 +14,17 @@ interface ScanResult {
|
|
|
14
14
|
local: NodeModulesScanTarget;
|
|
15
15
|
global: NodeModulesScanTarget;
|
|
16
16
|
};
|
|
17
|
+
stats?: ScanStats;
|
|
17
18
|
}
|
|
18
19
|
type ScanScope = 'local' | 'local-and-global' | 'global';
|
|
19
20
|
interface ScanOptions {
|
|
20
21
|
includeGlobal?: boolean;
|
|
21
22
|
scope?: ScanScope;
|
|
22
23
|
}
|
|
24
|
+
interface ScanStats {
|
|
25
|
+
packageJsonReadCount: number;
|
|
26
|
+
packageJsonCacheHits: number;
|
|
27
|
+
}
|
|
23
28
|
interface NodeModulesScanTarget {
|
|
24
29
|
path: string | null;
|
|
25
30
|
detected: boolean;
|
|
@@ -143,4 +148,4 @@ interface IntentProjectConfig {
|
|
|
143
148
|
};
|
|
144
149
|
}
|
|
145
150
|
//#endregion
|
|
146
|
-
export {
|
|
151
|
+
export { SkillEntry as _, IntentArtifactSet as a, StalenessSignal as b, IntentConfig as c, MetaFeedbackPayload as d, MetaSkillName as f, ScanStats as g, ScanScope as h, IntentArtifactFile as i, IntentPackage as l, ScanResult as m, FeedbackPayload as n, IntentArtifactSkill as o, ScanOptions as p, IntentArtifactCoverageIgnore as r, IntentArtifactWarning as s, AgentName as t, IntentProjectConfig as u, SkillStaleness as v, VersionConflict as x, StalenessReport as y };
|
|
@@ -17,7 +17,16 @@ function toPosixPath(p) {
|
|
|
17
17
|
function findSkillFiles(dir) {
|
|
18
18
|
const files = [];
|
|
19
19
|
if (!existsSync(dir)) return files;
|
|
20
|
-
|
|
20
|
+
let entries;
|
|
21
|
+
try {
|
|
22
|
+
entries = readdirSync(dir, {
|
|
23
|
+
withFileTypes: true,
|
|
24
|
+
encoding: "utf8"
|
|
25
|
+
});
|
|
26
|
+
} catch {
|
|
27
|
+
return files;
|
|
28
|
+
}
|
|
29
|
+
for (const entry of entries) {
|
|
21
30
|
const fullPath = join(dir, entry.name);
|
|
22
31
|
if (entry.isDirectory()) files.push(...findSkillFiles(fullPath));
|
|
23
32
|
else if (entry.name === "SKILL.md") files.push(fullPath);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as parseFrontmatter, i as listNodeModulesPackageDirs, n as findSkillFiles, o as resolveDepDir, r as getDeps, s as toPosixPath, t as detectGlobalNodeModules } from "./utils-
|
|
1
|
+
import { a as parseFrontmatter, i as listNodeModulesPackageDirs, n as findSkillFiles, o as resolveDepDir, r as getDeps, s as toPosixPath, t as detectGlobalNodeModules } from "./utils-BPDvfmcd.mjs";
|
|
2
2
|
|
|
3
3
|
export { detectGlobalNodeModules, findSkillFiles, getDeps, listNodeModulesPackageDirs, parseFrontmatter, resolveDepDir, toPosixPath };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import { n as findWorkspacePackages } from "./workspace-patterns-
|
|
3
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
1
|
+
import "./utils-BPDvfmcd.mjs";
|
|
2
|
+
import { n as findWorkspacePackages } from "./workspace-patterns-CIJQCwbJ.mjs";
|
|
3
|
+
import { t as resolveProjectContext } from "./project-context-Bv9BDh8B.mjs";
|
|
4
4
|
import { n as isCliFailure, t as fail } from "./cli-error-BrMXlbtx.mjs";
|
|
5
|
-
import { l as printWarnings } from "./cli-support-
|
|
5
|
+
import { l as printWarnings } from "./cli-support-DtqVDiJv.mjs";
|
|
6
6
|
import { appendFileSync, existsSync, readFileSync } from "node:fs";
|
|
7
7
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
8
8
|
|
|
@@ -115,7 +115,7 @@ async function runValidateCommand(dir, options = {}) {
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
async function runValidateCommandInternal(dir) {
|
|
118
|
-
const [{ parse: parseYaml }, { findSkillFiles }] = await Promise.all([import("yaml"), import("./utils-
|
|
118
|
+
const [{ parse: parseYaml }, { findSkillFiles }] = await Promise.all([import("yaml"), import("./utils-DqdIC3RY.mjs")]);
|
|
119
119
|
const context = resolveProjectContext({
|
|
120
120
|
cwd: process.cwd(),
|
|
121
121
|
targetPath: dir
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import { a as readWorkspacePatterns, i as getWorkspaceInfo, n as findWorkspacePackages, o as resolveWorkspacePackages, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-
|
|
1
|
+
import "./utils-BPDvfmcd.mjs";
|
|
2
|
+
import { a as readWorkspacePatterns, i as getWorkspaceInfo, n as findWorkspacePackages, o as resolveWorkspacePackages, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-CIJQCwbJ.mjs";
|
|
3
3
|
|
|
4
4
|
export { findWorkspaceRoot, getWorkspaceInfo };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/intent",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"description": "Ship compositional knowledge for AI coding agents alongside your npm packages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,9 +33,11 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"cac": "^6.7.14",
|
|
35
35
|
"jsonc-parser": "^3.3.1",
|
|
36
|
+
"semver": "^7.7.4",
|
|
36
37
|
"yaml": "2.8.3"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
40
|
+
"@types/semver": "^7.7.1",
|
|
39
41
|
"@verdaccio/node-api": "6.0.0-6-next.76",
|
|
40
42
|
"tsdown": "^0.19.0",
|
|
41
43
|
"verdaccio": "^6.3.2"
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import "./utils-mdb4i6VA.mjs";
|
|
2
|
-
import "./workspace-patterns-BZLEaMcS.mjs";
|
|
3
|
-
import "./project-context-Dx6XIJJo.mjs";
|
|
4
|
-
import "./cli-support-BON5hn4L.mjs";
|
|
5
|
-
import { n as runInstallCommand, t as INSTALL_PROMPT } from "./install-BPWtaOuo.mjs";
|
|
6
|
-
|
|
7
|
-
export { INSTALL_PROMPT, runInstallCommand };
|