@tanstack/intent 0.0.44 → 0.1.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/artifact-coverage-BfJ7f-S9.mjs +3 -0
- package/dist/{cli-support-BNDR3l1g.mjs → cli-support-BevVu4gw.mjs} +34 -8
- package/dist/cli-support-Cpo_9JfL.mjs +6 -0
- package/dist/cli.mjs +17 -13
- package/dist/{core-qlBI_aQL.mjs → core-6UP6jyL8.mjs} +31 -15
- package/dist/core.d.mts +4 -2
- package/dist/core.mjs +6 -4
- package/dist/exclude-BTaE6TNh.mjs +126 -0
- package/dist/excludes-DG83YEzb.mjs +111 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +9 -8
- package/dist/{install-D1dsnbr9.mjs → install-DXQsQQIL.mjs} +13 -9
- package/dist/{list-DrChOziX.mjs → list-CxB37mvm.mjs} +14 -8
- package/dist/{load-ll7s5E3J.mjs → load-Ch4UjIza.mjs} +8 -6
- package/dist/{resolver-D9cjsz11.mjs → resolver-CDbVXv4g.mjs} +3 -86
- package/dist/{scanner-DaG82zNc.mjs → scanner-CRCZwhKS.mjs} +2 -0
- package/dist/{setup-BklJkH_6.mjs → setup-DpCYUVSf.mjs} +1 -1
- package/dist/setup.d.mts +1 -1
- package/dist/setup.mjs +2 -2
- package/dist/source-policy-DaImacFt.mjs +247 -0
- package/dist/source-policy-y3sktvzu.mjs +9 -0
- package/dist/{stale-C6dPKQ98.mjs → stale-DxZyYibt.mjs} +4 -2
- package/dist/{staleness-CB3qpVCq.mjs → staleness-BoFc6DMh.mjs} +2 -2
- package/dist/{staleness-BGFfic-Y.mjs → staleness-DVFARTES.mjs} +1 -1
- package/dist/{types-CIha6LtJ.d.mts → types-DhITOzhi.d.mts} +1 -0
- package/dist/{validate-CEhp9gDs.mjs → validate-CnQBn6v9.mjs} +2 -2
- package/dist/{workflow-review-CrWkP7Hc.mjs → workflow-review-CtOR1bgh.mjs} +1 -1
- package/package.json +1 -1
- package/dist/artifact-coverage-DA26utB1.mjs +0 -3
- package/dist/cli-support-BtHFD7gl.mjs +0 -6
- package/dist/scanner-BV7X5n_z.mjs +0 -6
- /package/dist/{artifact-coverage-DgWuVqUp.mjs → artifact-coverage-nGwun1tt.mjs} +0 -0
- /package/dist/{command-runner-C0yCOHLi.mjs → command-runner-fstUIUhe.mjs} +0 -0
- /package/dist/{display-0FnzlKRq.mjs → display-CVMGtcHz.mjs} +0 -0
- /package/dist/{edit-package-json-CtuelQ_q.mjs → edit-package-json-DKyJ04t1.mjs} +0 -0
- /package/dist/{meta-BEJIfnPG.mjs → meta-C-t9P5Ls.mjs} +0 -0
- /package/dist/{project-context-BRIMzhi4.mjs → project-context-DBSibDPb.mjs} +0 -0
- /package/dist/{scaffold-CLM6bt3c.mjs → scaffold-D2vwv9ls.mjs} +0 -0
- /package/dist/{setup-DhMqESd3.d.mts → setup-DW3pn0QW.d.mts} +0 -0
- /package/dist/{setup-github-actions-CUd1oncY.mjs → setup-github-actions-emXSyGy3.mjs} +0 -0
- /package/dist/{skill-use-umYvZl94.mjs → skill-use-CUrNHf-u.mjs} +0 -0
- /package/dist/{workflow-review-D9Fg1G0P.mjs → workflow-review-wL1Iu2Sf.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
1
|
+
import { t as resolveProjectContext } from "./project-context-DBSibDPb.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";
|
|
@@ -10,6 +10,25 @@ function printWarnings(warnings) {
|
|
|
10
10
|
console.log("Warnings:");
|
|
11
11
|
for (const warning of warnings) console.log(` ⚠ ${warning}`);
|
|
12
12
|
}
|
|
13
|
+
const TRUE_LIKE_VALUES = new Set([
|
|
14
|
+
"1",
|
|
15
|
+
"true",
|
|
16
|
+
"yes",
|
|
17
|
+
"on"
|
|
18
|
+
]);
|
|
19
|
+
function envSuppressesNotices() {
|
|
20
|
+
const value = process.env.INTENT_NO_NOTICES?.trim().toLowerCase();
|
|
21
|
+
return value ? TRUE_LIKE_VALUES.has(value) : false;
|
|
22
|
+
}
|
|
23
|
+
function shouldSuppressNotices(options = {}) {
|
|
24
|
+
return options.noNotices === true || envSuppressesNotices();
|
|
25
|
+
}
|
|
26
|
+
function printNotices(notices, options = {}) {
|
|
27
|
+
if (notices.length === 0) return;
|
|
28
|
+
if (shouldSuppressNotices(options)) return;
|
|
29
|
+
console.error("Notices:");
|
|
30
|
+
for (const notice of notices) console.error(` ℹ ${notice}`);
|
|
31
|
+
}
|
|
13
32
|
|
|
14
33
|
//#endregion
|
|
15
34
|
//#region src/cli-support.ts
|
|
@@ -30,10 +49,15 @@ function getCheckSkillsWorkflowAdvisories(root) {
|
|
|
30
49
|
if ((versionMatch ? Number(versionMatch[1]) : 0) >= INTENT_CHECK_SKILLS_WORKFLOW_VERSION) return [];
|
|
31
50
|
return [`Intent workflow update available: run \`npx @tanstack/intent@latest setup\` to refresh ${relative(process.cwd(), workflowPath) || workflowPath}.`];
|
|
32
51
|
}
|
|
33
|
-
async function scanIntentsOrFail(
|
|
34
|
-
const {
|
|
52
|
+
async function scanIntentsOrFail(coreOptions = {}) {
|
|
53
|
+
const { scanForPolicedIntents } = await import("./source-policy-y3sktvzu.mjs");
|
|
35
54
|
try {
|
|
36
|
-
|
|
55
|
+
const { scan } = scanForPolicedIntents({
|
|
56
|
+
cwd: process.cwd(),
|
|
57
|
+
scanOptions: scanOptionsFromGlobalFlags(coreOptions),
|
|
58
|
+
coreOptions
|
|
59
|
+
});
|
|
60
|
+
return scan;
|
|
37
61
|
} catch (err) {
|
|
38
62
|
fail(err instanceof Error ? err.message : String(err));
|
|
39
63
|
}
|
|
@@ -48,11 +72,13 @@ function coreOptionsFromGlobalFlags(options) {
|
|
|
48
72
|
if (options.global && options.globalOnly) fail("Use either --global or --global-only, not both.");
|
|
49
73
|
return {
|
|
50
74
|
debug: options.debug,
|
|
51
|
-
exclude: Array.isArray(options.exclude) ? options.exclude : options.exclude ? [options.exclude] : void 0,
|
|
52
75
|
global: options.global,
|
|
53
76
|
globalOnly: options.globalOnly
|
|
54
77
|
};
|
|
55
78
|
}
|
|
79
|
+
function noticeOptionsFromGlobalFlags(options) {
|
|
80
|
+
return { noNotices: options.noNotices || options.notices === false };
|
|
81
|
+
}
|
|
56
82
|
function formatDebugValue(value) {
|
|
57
83
|
if (Array.isArray(value)) return value.length > 0 ? value.join(", ") : "(none)";
|
|
58
84
|
return String(value);
|
|
@@ -68,7 +94,7 @@ async function resolveStaleTargets(targetDir) {
|
|
|
68
94
|
targetPath: targetDir
|
|
69
95
|
});
|
|
70
96
|
const workflowAdvisories = getCheckSkillsWorkflowAdvisories(context.workspaceRoot ?? context.packageRoot ?? resolvedRoot);
|
|
71
|
-
const { buildWorkspaceCoverageSignals, checkStaleness, readPackageName } = await import("./staleness-
|
|
97
|
+
const { buildWorkspaceCoverageSignals, checkStaleness, readPackageName } = await import("./staleness-BoFc6DMh.mjs");
|
|
72
98
|
const isWorkspaceRootTarget = context.workspaceRoot !== null && resolvedRoot === context.workspaceRoot;
|
|
73
99
|
if (context.packageRoot && !isWorkspaceRootTarget && (context.targetSkillsDir !== null || context.workspaceRoot === null)) return {
|
|
74
100
|
reports: [await checkStaleness(context.packageRoot, readPackageName(context.packageRoot), context.workspaceRoot ?? context.packageRoot)],
|
|
@@ -79,7 +105,7 @@ async function resolveStaleTargets(targetDir) {
|
|
|
79
105
|
const workspaceInfo = workspaceRoot ? getWorkspaceInfo(workspaceRoot) : null;
|
|
80
106
|
if (workspaceInfo) {
|
|
81
107
|
const reports = await Promise.all(workspaceInfo.packageDirsWithSkills.map((packageDir) => checkStaleness(packageDir, readPackageName(packageDir), workspaceInfo.root)));
|
|
82
|
-
const { readIntentArtifacts } = await import("./artifact-coverage-
|
|
108
|
+
const { readIntentArtifacts } = await import("./artifact-coverage-BfJ7f-S9.mjs");
|
|
83
109
|
const artifacts = existsSync(join(workspaceInfo.root, "_artifacts")) ? readIntentArtifacts(workspaceInfo.root) : null;
|
|
84
110
|
const coverageSignals = buildWorkspaceCoverageSignals({
|
|
85
111
|
artifactRoot: workspaceInfo.root,
|
|
@@ -111,4 +137,4 @@ async function resolveStaleTargets(targetDir) {
|
|
|
111
137
|
}
|
|
112
138
|
|
|
113
139
|
//#endregion
|
|
114
|
-
export {
|
|
140
|
+
export { noticeOptionsFromGlobalFlags as a, scanIntentsOrFail as c, getMetaDir as i, printNotices as l, coreOptionsFromGlobalFlags as n, printDebugInfo as o, getCheckSkillsWorkflowAdvisories as r, resolveStaleTargets as s, INTENT_CHECK_SKILLS_WORKFLOW_VERSION as t, printWarnings as u };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "./utils-9fhWAVua.mjs";
|
|
2
|
+
import "./workspace-patterns-BffPlZ1D.mjs";
|
|
3
|
+
import "./project-context-DBSibDPb.mjs";
|
|
4
|
+
import { a as noticeOptionsFromGlobalFlags, c as scanIntentsOrFail, i as getMetaDir, l as printNotices, n as coreOptionsFromGlobalFlags, o as printDebugInfo, r as getCheckSkillsWorkflowAdvisories, s as resolveStaleTargets, t as INTENT_CHECK_SKILLS_WORKFLOW_VERSION, u as printWarnings } from "./cli-support-BevVu4gw.mjs";
|
|
5
|
+
|
|
6
|
+
export { INTENT_CHECK_SKILLS_WORKFLOW_VERSION, coreOptionsFromGlobalFlags, getCheckSkillsWorkflowAdvisories, getMetaDir, noticeOptionsFromGlobalFlags, printDebugInfo, printNotices, printWarnings, resolveStaleTargets, scanIntentsOrFail };
|
package/dist/cli.mjs
CHANGED
|
@@ -8,44 +8,48 @@ import { cac } from "cac";
|
|
|
8
8
|
function createCli() {
|
|
9
9
|
const cli = cac("intent");
|
|
10
10
|
cli.usage("<command> [options]");
|
|
11
|
-
cli.command("list", "Discover intent-enabled packages from the project or workspace").usage("list [--json] [--debug] [--
|
|
12
|
-
const { runListCommand } = await import("./list-
|
|
11
|
+
cli.command("list", "Discover intent-enabled packages from the project or workspace").usage("list [--json] [--debug] [--global] [--global-only] [--no-notices]").option("--json", "Output JSON").option("--debug", "Print discovery debug details to stderr").option("--global", "Include global packages after project packages").option("--global-only", "List global packages only").option("--no-notices", "Suppress non-critical notices on stderr").example("list").example("list --json").example("list --global").action(async (options) => {
|
|
12
|
+
const { runListCommand } = await import("./list-CxB37mvm.mjs");
|
|
13
13
|
await runListCommand(options);
|
|
14
14
|
});
|
|
15
|
-
cli.command("
|
|
16
|
-
const {
|
|
15
|
+
cli.command("exclude [action] [pattern]", "Manage package.json intent.exclude entries").usage("exclude [list|add|remove] [pattern] [--json]").option("--json", "Output JSON list of configured exclude patterns").example("exclude").example("exclude list --json").example("exclude add @tanstack/router#experimental-*").example("exclude remove @tanstack/router#experimental-*").action(async (action, pattern, options) => {
|
|
16
|
+
const { runExcludeCommand } = await import("./exclude-BTaE6TNh.mjs");
|
|
17
|
+
await runExcludeCommand(action, pattern, options);
|
|
18
|
+
});
|
|
19
|
+
cli.command("load [use]", "Load a compact skill use and print its SKILL.md").usage("load <use> [--path] [--json] [--debug] [--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("--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) => {
|
|
20
|
+
const { runLoadCommand } = await import("./load-Ch4UjIza.mjs");
|
|
17
21
|
await runLoadCommand(use, options);
|
|
18
22
|
});
|
|
19
23
|
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-
|
|
24
|
+
const [{ getMetaDir }, { runMetaCommand }] = await Promise.all([import("./cli-support-Cpo_9JfL.mjs"), import("./meta-C-t9P5Ls.mjs")]);
|
|
21
25
|
await runMetaCommand(name, getMetaDir());
|
|
22
26
|
});
|
|
23
27
|
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-
|
|
28
|
+
const { runValidateCommand } = await import("./validate-CnQBn6v9.mjs");
|
|
25
29
|
await runValidateCommand(dir, options);
|
|
26
30
|
});
|
|
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-
|
|
31
|
+
cli.command("install", "Create or update skill loading guidance in an agent config file").usage("install [--map] [--dry-run] [--print-prompt] [--global] [--global-only] [--no-notices]").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").option("--no-notices", "Suppress non-critical notices on stderr").example("install").example("install --map").example("install --dry-run").example("install --print-prompt").example("install --global").action(async (options) => {
|
|
32
|
+
const [{ scanIntentsOrFail }, { runInstallCommand }] = await Promise.all([import("./cli-support-Cpo_9JfL.mjs"), import("./install-DXQsQQIL.mjs")]);
|
|
29
33
|
await runInstallCommand(options, scanIntentsOrFail);
|
|
30
34
|
});
|
|
31
35
|
cli.command("scaffold", "Print maintainer scaffold prompt").usage("scaffold").action(async () => {
|
|
32
|
-
const [{ getMetaDir }, { runScaffoldCommand }] = await Promise.all([import("./cli-support-
|
|
36
|
+
const [{ getMetaDir }, { runScaffoldCommand }] = await Promise.all([import("./cli-support-Cpo_9JfL.mjs"), import("./scaffold-D2vwv9ls.mjs")]);
|
|
33
37
|
runScaffoldCommand(getMetaDir());
|
|
34
38
|
});
|
|
35
39
|
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-
|
|
40
|
+
const [{ resolveStaleTargets }, { runStaleCommand }] = await Promise.all([import("./cli-support-Cpo_9JfL.mjs"), import("./stale-DxZyYibt.mjs")]);
|
|
37
41
|
await runStaleCommand(targetDir, options, resolveStaleTargets);
|
|
38
42
|
});
|
|
39
43
|
cli.command("edit-package-json", "Update package.json files so skills are published").usage("edit-package-json").action(async () => {
|
|
40
|
-
const { runEditPackageJsonCommand } = await import("./edit-package-json-
|
|
44
|
+
const { runEditPackageJsonCommand } = await import("./edit-package-json-DKyJ04t1.mjs");
|
|
41
45
|
await runEditPackageJsonCommand(process.cwd());
|
|
42
46
|
});
|
|
43
47
|
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-
|
|
48
|
+
const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-Cpo_9JfL.mjs"), import("./setup-github-actions-emXSyGy3.mjs")]);
|
|
45
49
|
await runSetupGithubActionsCommand(process.cwd(), getMetaDir());
|
|
46
50
|
});
|
|
47
51
|
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-
|
|
52
|
+
const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-Cpo_9JfL.mjs"), import("./setup-github-actions-emXSyGy3.mjs")]);
|
|
49
53
|
await runSetupGithubActionsCommand(process.cwd(), getMetaDir());
|
|
50
54
|
});
|
|
51
55
|
cli.command("help [command]", "Display help for a command").action((commandName) => {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { i as getDeps, l as resolveDepDir, u as toPosixPath } from "./utils-9fhWAVua.mjs";
|
|
2
|
-
import { n as scanIntentPackageAtRoot, r as createIntentFsCache
|
|
2
|
+
import { n as scanIntentPackageAtRoot, r as createIntentFsCache } from "./scanner-CRCZwhKS.mjs";
|
|
3
3
|
import { n as findWorkspacePackages } from "./workspace-patterns-BffPlZ1D.mjs";
|
|
4
|
-
import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-
|
|
5
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
6
|
-
import {
|
|
4
|
+
import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-CUrNHf-u.mjs";
|
|
5
|
+
import { t as resolveProjectContext } from "./project-context-DBSibDPb.mjs";
|
|
6
|
+
import { o as warningMentionsPackage, r as getEffectiveExcludePatterns, t as compileExcludePatterns } from "./excludes-DG83YEzb.mjs";
|
|
7
|
+
import { i as resolveSkillUse, r as resolveSkillEntry, t as ResolveSkillUseError } from "./resolver-CDbVXv4g.mjs";
|
|
8
|
+
import { a as checkLoadAllowed, o as readSkillSourcesConfig, s as scanForPolicedIntents } from "./source-policy-DaImacFt.mjs";
|
|
7
9
|
import { existsSync } from "node:fs";
|
|
8
10
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
9
11
|
|
|
@@ -361,11 +363,13 @@ function listIntentSkills(options = {}) {
|
|
|
361
363
|
const scanOptions = toScanOptions(options);
|
|
362
364
|
const fsCache = createIntentFsCache();
|
|
363
365
|
const projectContext = resolveProjectContext({ cwd });
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
366
|
+
const { scan, excludePatterns } = scanForPolicedIntents({
|
|
367
|
+
cwd,
|
|
368
|
+
scanOptions: withFsCache(scanOptions, fsCache),
|
|
369
|
+
coreOptions: options,
|
|
370
|
+
context: projectContext
|
|
371
|
+
});
|
|
372
|
+
const packages = scan.packages;
|
|
369
373
|
const skills = packages.flatMap((pkg) => pkg.skills.map((skill) => {
|
|
370
374
|
return {
|
|
371
375
|
use: formatSkillUse(pkg.name, skill.name),
|
|
@@ -380,7 +384,7 @@ function listIntentSkills(options = {}) {
|
|
|
380
384
|
};
|
|
381
385
|
}));
|
|
382
386
|
const result = {
|
|
383
|
-
packageManager:
|
|
387
|
+
packageManager: scan.packageManager,
|
|
384
388
|
skills,
|
|
385
389
|
packages: packages.map((pkg) => ({
|
|
386
390
|
name: pkg.name,
|
|
@@ -389,8 +393,9 @@ function listIntentSkills(options = {}) {
|
|
|
389
393
|
packageRoot: pkg.packageRoot,
|
|
390
394
|
skillCount: pkg.skills.length
|
|
391
395
|
})),
|
|
392
|
-
warnings:
|
|
393
|
-
|
|
396
|
+
warnings: scan.warnings,
|
|
397
|
+
notices: scan.notices,
|
|
398
|
+
conflicts: scan.conflicts
|
|
394
399
|
};
|
|
395
400
|
if (options.debug) result.debug = {
|
|
396
401
|
cwd,
|
|
@@ -399,8 +404,9 @@ function listIntentSkills(options = {}) {
|
|
|
399
404
|
packageCount: result.packages.length,
|
|
400
405
|
skillCount: result.skills.length,
|
|
401
406
|
warningCount: result.warnings.length,
|
|
407
|
+
noticeCount: result.notices.length,
|
|
402
408
|
conflictCount: result.conflicts.length,
|
|
403
|
-
scan:
|
|
409
|
+
scan: scan.stats ?? fsCache.getStats()
|
|
404
410
|
};
|
|
405
411
|
return result;
|
|
406
412
|
}
|
|
@@ -464,7 +470,12 @@ function resolveIntentSkillInCwd(cwd, use, options = {}) {
|
|
|
464
470
|
const projectContext = resolveProjectContext({ cwd });
|
|
465
471
|
const excludePatterns = getEffectiveExcludePatterns(options, projectContext);
|
|
466
472
|
const excludeMatchers = compileExcludePatterns(excludePatterns);
|
|
467
|
-
|
|
473
|
+
const config = readSkillSourcesConfig(cwd, projectContext);
|
|
474
|
+
const refusal = checkLoadAllowed(use, parsedUse, {
|
|
475
|
+
config,
|
|
476
|
+
excludeMatchers
|
|
477
|
+
});
|
|
478
|
+
if (refusal) throw new IntentCoreError(refusal.code, refusal.message);
|
|
468
479
|
const scanOptions = toScanOptions(options);
|
|
469
480
|
const scope = getScanScope(scanOptions);
|
|
470
481
|
const fastPathResolved = resolveSkillUseFastPath(parsedUse, options, projectContext, cwd, fsCache);
|
|
@@ -476,7 +487,12 @@ function resolveIntentSkillInCwd(cwd, use, options = {}) {
|
|
|
476
487
|
scan: fsCache.getStats(),
|
|
477
488
|
scope
|
|
478
489
|
}) : void 0);
|
|
479
|
-
const scanResult =
|
|
490
|
+
const { scan: scanResult } = scanForPolicedIntents({
|
|
491
|
+
cwd,
|
|
492
|
+
scanOptions: withFsCache(scanOptions, fsCache),
|
|
493
|
+
coreOptions: options,
|
|
494
|
+
context: projectContext
|
|
495
|
+
});
|
|
480
496
|
let resolved;
|
|
481
497
|
try {
|
|
482
498
|
resolved = resolveSkillUse(use, scanResult);
|
package/dist/core.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as VersionConflict, _ as ScanStats, g as ScanScope, l as IntentPackage, p as PackageManager } from "./types-
|
|
1
|
+
import { S as VersionConflict, _ as ScanStats, g as ScanScope, l as IntentPackage, p as PackageManager } from "./types-DhITOzhi.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/core/types.d.ts
|
|
4
4
|
interface IntentCoreOptions {
|
|
@@ -31,6 +31,7 @@ interface IntentSkillList {
|
|
|
31
31
|
skills: Array<IntentSkillSummary>;
|
|
32
32
|
packages: Array<IntentPackageSummary>;
|
|
33
33
|
warnings: Array<string>;
|
|
34
|
+
notices: Array<string>;
|
|
34
35
|
conflicts: Array<VersionConflict>;
|
|
35
36
|
debug?: IntentSkillListDebug;
|
|
36
37
|
}
|
|
@@ -55,6 +56,7 @@ interface IntentSkillListDebug {
|
|
|
55
56
|
packageCount: number;
|
|
56
57
|
skillCount: number;
|
|
57
58
|
warningCount: number;
|
|
59
|
+
noticeCount: number;
|
|
58
60
|
conflictCount: number;
|
|
59
61
|
scan: IntentScanDebugStats;
|
|
60
62
|
}
|
|
@@ -72,7 +74,7 @@ interface LoadedIntentSkillDebug {
|
|
|
72
74
|
scan: IntentScanDebugStats;
|
|
73
75
|
}
|
|
74
76
|
interface IntentScanDebugStats extends ScanStats {}
|
|
75
|
-
type IntentCoreErrorCode = 'invalid-options' | 'invalid-skill-use' | 'package-not-found' | 'package-excluded' | 'skill-not-found' | 'skill-path-outside-package' | 'skill-file-not-found';
|
|
77
|
+
type IntentCoreErrorCode = 'invalid-options' | 'invalid-skill-use' | 'package-not-found' | 'package-excluded' | 'package-not-listed' | 'skill-excluded' | 'skill-not-found' | 'skill-path-outside-package' | 'skill-file-not-found';
|
|
76
78
|
//#endregion
|
|
77
79
|
//#region src/core.d.ts
|
|
78
80
|
declare class IntentCoreError extends Error {
|
package/dist/core.mjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import "./utils-9fhWAVua.mjs";
|
|
2
2
|
import "./skill-paths-B-j0dWDA.mjs";
|
|
3
|
-
import "./scanner-
|
|
3
|
+
import "./scanner-CRCZwhKS.mjs";
|
|
4
4
|
import "./workspace-patterns-BffPlZ1D.mjs";
|
|
5
|
-
import "./project-context-
|
|
6
|
-
import "./
|
|
7
|
-
import
|
|
5
|
+
import "./project-context-DBSibDPb.mjs";
|
|
6
|
+
import "./excludes-DG83YEzb.mjs";
|
|
7
|
+
import "./resolver-CDbVXv4g.mjs";
|
|
8
|
+
import { i as resolveIntentSkill, n as listIntentSkills, r as loadIntentSkill, t as IntentCoreError } from "./core-6UP6jyL8.mjs";
|
|
9
|
+
import "./source-policy-DaImacFt.mjs";
|
|
8
10
|
|
|
9
11
|
export { IntentCoreError, listIntentSkills, loadIntentSkill, resolveIntentSkill };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import "./utils-9fhWAVua.mjs";
|
|
2
|
+
import "./workspace-patterns-BffPlZ1D.mjs";
|
|
3
|
+
import "./project-context-DBSibDPb.mjs";
|
|
4
|
+
import { t as compileExcludePatterns } from "./excludes-DG83YEzb.mjs";
|
|
5
|
+
import { t as fail } from "./cli-error-BrMXlbtx.mjs";
|
|
6
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
|
|
9
|
+
//#region src/commands/exclude.ts
|
|
10
|
+
function normalizeAction(action) {
|
|
11
|
+
if (!action) return "list";
|
|
12
|
+
if (action === "list" || action === "add" || action === "remove") return action;
|
|
13
|
+
fail(`Unknown exclude action: ${action}. Expected list, add, or remove.`);
|
|
14
|
+
}
|
|
15
|
+
function getPackageJsonPath(cwd) {
|
|
16
|
+
return join(cwd, "package.json");
|
|
17
|
+
}
|
|
18
|
+
function readPackageJson(cwd) {
|
|
19
|
+
const packageJsonPath = getPackageJsonPath(cwd);
|
|
20
|
+
if (!existsSync(packageJsonPath)) fail(`No package.json found in ${cwd}`);
|
|
21
|
+
try {
|
|
22
|
+
return JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
23
|
+
} catch (err) {
|
|
24
|
+
fail(`Failed to parse ${packageJsonPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function readConfiguredExcludes(pkg) {
|
|
28
|
+
const intent = pkg.intent;
|
|
29
|
+
if (intent === void 0) return [];
|
|
30
|
+
if (!intent || typeof intent !== "object") fail("Invalid package.json: intent must be an object when present.");
|
|
31
|
+
const raw = intent.exclude;
|
|
32
|
+
if (raw === void 0) return [];
|
|
33
|
+
if (!Array.isArray(raw)) fail("Invalid package.json: intent.exclude must be an array of strings.");
|
|
34
|
+
const excludes = [];
|
|
35
|
+
for (const entry of raw) {
|
|
36
|
+
if (typeof entry !== "string") fail("Invalid package.json: intent.exclude must contain only strings.");
|
|
37
|
+
const trimmed = entry.trim();
|
|
38
|
+
if (trimmed.length === 0) continue;
|
|
39
|
+
excludes.push(trimmed);
|
|
40
|
+
}
|
|
41
|
+
return excludes;
|
|
42
|
+
}
|
|
43
|
+
function setConfiguredExcludes(pkg, excludes) {
|
|
44
|
+
const intent = pkg.intent && typeof pkg.intent === "object" ? pkg.intent : {};
|
|
45
|
+
intent.exclude = excludes;
|
|
46
|
+
pkg.intent = intent;
|
|
47
|
+
}
|
|
48
|
+
function writePackageJson(cwd, pkg) {
|
|
49
|
+
writeFileSync(getPackageJsonPath(cwd), `${JSON.stringify(pkg, null, 2)}\n`, "utf8");
|
|
50
|
+
}
|
|
51
|
+
function normalizePattern(pattern, action) {
|
|
52
|
+
if (!pattern) fail(`Missing exclude pattern. Expected: intent exclude ${action} <pattern>`);
|
|
53
|
+
const trimmed = pattern.trim();
|
|
54
|
+
if (trimmed.length === 0) fail(`Missing exclude pattern. Expected: intent exclude ${action} <pattern>`);
|
|
55
|
+
return trimmed;
|
|
56
|
+
}
|
|
57
|
+
function validatePattern(pattern) {
|
|
58
|
+
try {
|
|
59
|
+
compileExcludePatterns([pattern]);
|
|
60
|
+
} catch (err) {
|
|
61
|
+
fail(`Invalid exclude pattern "${pattern}": ${err instanceof Error ? err.message : String(err)}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function printExcludes(excludes, json) {
|
|
65
|
+
if (json) {
|
|
66
|
+
console.log(JSON.stringify(excludes, null, 2));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (excludes.length === 0) {
|
|
70
|
+
console.log("No excludes configured.");
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
console.log("Configured excludes:");
|
|
74
|
+
for (const pattern of excludes) console.log(`- ${pattern}`);
|
|
75
|
+
}
|
|
76
|
+
async function runExcludeCommand(actionArg, patternArg, options) {
|
|
77
|
+
const action = normalizeAction(actionArg);
|
|
78
|
+
const cwd = process.cwd();
|
|
79
|
+
const pkg = readPackageJson(cwd);
|
|
80
|
+
const currentExcludes = readConfiguredExcludes(pkg);
|
|
81
|
+
if (action === "list") {
|
|
82
|
+
if (patternArg) fail("Unexpected pattern for list. Use: intent exclude list [--json]");
|
|
83
|
+
printExcludes(currentExcludes, options.json);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const pattern = normalizePattern(patternArg, action);
|
|
87
|
+
validatePattern(pattern);
|
|
88
|
+
if (action === "add") {
|
|
89
|
+
if (currentExcludes.includes(pattern)) {
|
|
90
|
+
if (options.json) {
|
|
91
|
+
printExcludes(currentExcludes, true);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
console.log(`Exclude pattern "${pattern}" is already configured.`);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const updated$1 = [...currentExcludes, pattern];
|
|
98
|
+
setConfiguredExcludes(pkg, updated$1);
|
|
99
|
+
writePackageJson(cwd, pkg);
|
|
100
|
+
if (options.json) {
|
|
101
|
+
printExcludes(updated$1, true);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
console.log(`Added exclude pattern "${pattern}" to package.json intent.exclude.`);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const updated = currentExcludes.filter((value) => value !== pattern);
|
|
108
|
+
if (updated.length === currentExcludes.length) {
|
|
109
|
+
if (options.json) {
|
|
110
|
+
printExcludes(currentExcludes, true);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
console.log(`Exclude pattern "${pattern}" is not configured.`);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
setConfiguredExcludes(pkg, updated);
|
|
117
|
+
writePackageJson(cwd, pkg);
|
|
118
|
+
if (options.json) {
|
|
119
|
+
printExcludes(updated, true);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
console.log(`Removed exclude pattern "${pattern}" from package.json intent.exclude.`);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
//#endregion
|
|
126
|
+
export { runExcludeCommand };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { t as resolveProjectContext } from "./project-context-DBSibDPb.mjs";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
4
|
+
|
|
5
|
+
//#region src/core/package-json.ts
|
|
6
|
+
function readPackageJson(dir) {
|
|
7
|
+
try {
|
|
8
|
+
return JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
|
|
9
|
+
} catch {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/core/excludes.ts
|
|
16
|
+
const MAX_EXCLUDE_PATTERN_LENGTH = 200;
|
|
17
|
+
const PACKAGE_NAME_BOUNDARY = /[^a-zA-Z0-9_.-]/;
|
|
18
|
+
function normalizeExcludePatterns(value) {
|
|
19
|
+
if (!Array.isArray(value)) return [];
|
|
20
|
+
return value.filter((pattern) => typeof pattern === "string").map((pattern) => pattern.trim()).filter(Boolean);
|
|
21
|
+
}
|
|
22
|
+
function isWithinOrEqual(path, parentDir) {
|
|
23
|
+
const rel = relative(parentDir, path);
|
|
24
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
|
|
25
|
+
}
|
|
26
|
+
function readPackageExcludes(dir) {
|
|
27
|
+
const intent = readPackageJson(dir)?.intent;
|
|
28
|
+
if (!intent || typeof intent !== "object") return [];
|
|
29
|
+
return normalizeExcludePatterns(intent.exclude);
|
|
30
|
+
}
|
|
31
|
+
function getConfigDirs(cwd, context = resolveProjectContext({ cwd })) {
|
|
32
|
+
const root = context.workspaceRoot ?? context.packageRoot ?? cwd;
|
|
33
|
+
const dirs = [];
|
|
34
|
+
let dir = cwd;
|
|
35
|
+
while (isWithinOrEqual(dir, root)) {
|
|
36
|
+
dirs.push(dir);
|
|
37
|
+
if (dir === root) break;
|
|
38
|
+
const next = dirname(dir);
|
|
39
|
+
if (next === dir) break;
|
|
40
|
+
dir = next;
|
|
41
|
+
}
|
|
42
|
+
return dirs;
|
|
43
|
+
}
|
|
44
|
+
function getConfigExcludePatterns(cwd, context = resolveProjectContext({ cwd })) {
|
|
45
|
+
return [...getConfigDirs(cwd, context)].reverse().flatMap(readPackageExcludes);
|
|
46
|
+
}
|
|
47
|
+
function getEffectiveExcludePatterns(options = {}, context) {
|
|
48
|
+
return [...getConfigExcludePatterns(context?.cwd ?? resolve(process.cwd(), options.cwd ?? process.cwd()), context), ...normalizeExcludePatterns(options.exclude)];
|
|
49
|
+
}
|
|
50
|
+
function assertPatternLength(pattern) {
|
|
51
|
+
if (pattern.length > MAX_EXCLUDE_PATTERN_LENGTH) throw new Error(`Intent exclude pattern is too long: ${pattern.length} characters. Maximum is ${MAX_EXCLUDE_PATTERN_LENGTH}.`);
|
|
52
|
+
}
|
|
53
|
+
function globToRegExp(pattern) {
|
|
54
|
+
const source = pattern.replace(/\*+/g, "*").split("*").map((part) => part.replace(/[\\^$+?.()|[\]{}]/g, "\\$&")).join(".*");
|
|
55
|
+
return /* @__PURE__ */ new RegExp(`^${source}$`);
|
|
56
|
+
}
|
|
57
|
+
function compileSegment(segment) {
|
|
58
|
+
if (!segment.includes("*")) return (value) => value === segment;
|
|
59
|
+
const regex = globToRegExp(segment);
|
|
60
|
+
return (value) => regex.test(value);
|
|
61
|
+
}
|
|
62
|
+
function compileExcludePatterns(patterns) {
|
|
63
|
+
return patterns.map((pattern) => {
|
|
64
|
+
assertPatternLength(pattern);
|
|
65
|
+
const hashIndex = pattern.indexOf("#");
|
|
66
|
+
if (hashIndex === -1) return {
|
|
67
|
+
pattern,
|
|
68
|
+
matchesPackage: compileSegment(pattern)
|
|
69
|
+
};
|
|
70
|
+
const packageSegment = pattern.slice(0, hashIndex);
|
|
71
|
+
const skillSegment = pattern.slice(hashIndex + 1);
|
|
72
|
+
if (skillSegment.replace(/\*+/g, "*") === "*") return {
|
|
73
|
+
pattern,
|
|
74
|
+
matchesPackage: compileSegment(packageSegment)
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
pattern,
|
|
78
|
+
matchesPackage: compileSegment(packageSegment),
|
|
79
|
+
matchesSkill: compileSegment(skillSegment)
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function isPackageExcluded(packageName, matchers) {
|
|
84
|
+
return matchers.some((matcher) => matcher.matchesSkill === void 0 && matcher.matchesPackage(packageName));
|
|
85
|
+
}
|
|
86
|
+
function skillNameVariants(packageName, skillName) {
|
|
87
|
+
const prefix = `${packageName.split("/").pop() ?? packageName}/`;
|
|
88
|
+
if (skillName.startsWith(prefix)) return [skillName, skillName.slice(prefix.length)];
|
|
89
|
+
return [skillName, `${prefix}${skillName}`];
|
|
90
|
+
}
|
|
91
|
+
function isSkillExcluded(packageName, skillName, matchers) {
|
|
92
|
+
const variants = skillNameVariants(packageName, skillName);
|
|
93
|
+
return matchers.some((matcher) => {
|
|
94
|
+
if (!matcher.matchesPackage(packageName)) return false;
|
|
95
|
+
if (matcher.matchesSkill === void 0) return true;
|
|
96
|
+
return variants.some((variant) => matcher.matchesSkill(variant));
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function warningMentionsPackage(warning, packageName) {
|
|
100
|
+
let idx = warning.indexOf(packageName);
|
|
101
|
+
while (idx !== -1) {
|
|
102
|
+
const before = warning[idx - 1];
|
|
103
|
+
const after = warning[idx + packageName.length];
|
|
104
|
+
if ((before === void 0 || PACKAGE_NAME_BOUNDARY.test(before)) && (after === void 0 || PACKAGE_NAME_BOUNDARY.test(after))) return true;
|
|
105
|
+
idx = warning.indexOf(packageName, idx + packageName.length);
|
|
106
|
+
}
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
//#endregion
|
|
111
|
+
export { isSkillExcluded as a, isPackageExcluded as i, getConfigDirs as n, warningMentionsPackage as o, getEffectiveExcludePatterns as r, readPackageJson as s, compileExcludePatterns as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as VersionConflict, a as IntentArtifactSet, b as StalenessReport, c as IntentConfig, d as MetaFeedbackPayload, f as MetaSkillName, h as ScanResult, i as IntentArtifactFile, l as IntentPackage, m as ScanOptions, n as FeedbackPayload, o as IntentArtifactSkill, r as IntentArtifactCoverageIgnore, s as IntentArtifactWarning, t as AgentName, u as IntentProjectConfig, v as SkillEntry, x as StalenessSignal, y as SkillStaleness } from "./types-
|
|
2
|
-
import { i as runEditPackageJson, o as runSetupGithubActions, r as SetupGithubActionsResult, t as EditPackageJsonResult } from "./setup-
|
|
1
|
+
import { S as VersionConflict, a as IntentArtifactSet, b as StalenessReport, c as IntentConfig, d as MetaFeedbackPayload, f as MetaSkillName, h as ScanResult, i as IntentArtifactFile, l as IntentPackage, m as ScanOptions, n as FeedbackPayload, o as IntentArtifactSkill, r as IntentArtifactCoverageIgnore, s as IntentArtifactWarning, t as AgentName, u as IntentProjectConfig, v as SkillEntry, x as StalenessSignal, y as SkillStaleness } from "./types-DhITOzhi.mjs";
|
|
2
|
+
import { i as runEditPackageJson, o as runSetupGithubActions, r as SetupGithubActionsResult, t as EditPackageJsonResult } from "./setup-DW3pn0QW.mjs";
|
|
3
3
|
import { closeSync, existsSync, lstatSync, openSync, readFileSync, readSync, readdirSync, realpathSync } from "node:fs";
|
|
4
4
|
|
|
5
5
|
//#region src/utils.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { c as parseFrontmatter, i as getDeps, l as resolveDepDir, r as findSkillFiles } from "./utils-9fhWAVua.mjs";
|
|
2
2
|
import "./skill-paths-B-j0dWDA.mjs";
|
|
3
|
-
import { t as scanForIntents } from "./scanner-
|
|
3
|
+
import { t as scanForIntents } from "./scanner-CRCZwhKS.mjs";
|
|
4
4
|
import "./workspace-patterns-BffPlZ1D.mjs";
|
|
5
|
-
import { t as readIntentArtifacts } from "./artifact-coverage-
|
|
6
|
-
import { n as checkStaleness } from "./staleness-
|
|
7
|
-
import { n as collectStaleReviewItems, r as createFailedStaleReviewItem, t as buildStaleReviewBody } from "./workflow-review-
|
|
8
|
-
import { i as parseSkillUse, n as formatSkillUse, r as isSkillUseParseError, t as SkillUseParseError } from "./skill-use-
|
|
9
|
-
import "./project-context-
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
5
|
+
import { t as readIntentArtifacts } from "./artifact-coverage-nGwun1tt.mjs";
|
|
6
|
+
import { n as checkStaleness } from "./staleness-DVFARTES.mjs";
|
|
7
|
+
import { n as collectStaleReviewItems, r as createFailedStaleReviewItem, t as buildStaleReviewBody } from "./workflow-review-wL1Iu2Sf.mjs";
|
|
8
|
+
import { i as parseSkillUse, n as formatSkillUse, r as isSkillUseParseError, t as SkillUseParseError } from "./skill-use-CUrNHf-u.mjs";
|
|
9
|
+
import "./project-context-DBSibDPb.mjs";
|
|
10
|
+
import "./excludes-DG83YEzb.mjs";
|
|
11
|
+
import { i as resolveSkillUse, n as isResolveSkillUseError, t as ResolveSkillUseError } from "./resolver-CDbVXv4g.mjs";
|
|
12
|
+
import { r as runSetupGithubActions, t as runEditPackageJson } from "./setup-DpCYUVSf.mjs";
|
|
12
13
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
13
14
|
import { join } from "node:path";
|
|
14
15
|
import { execFileSync, execSync } from "node:child_process";
|