@tanstack/intent 0.3.0 → 0.3.1
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.mjs +10 -10
- package/dist/{command-DFQVnfAz.mjs → command-BMdho_4n.mjs} +1 -1
- package/dist/{core-BNH_SWxi.mjs → core-Bqyle4Vm.mjs} +4 -2
- package/dist/core.d.mts +8 -0
- package/dist/core.mjs +1 -1
- package/dist/{list-zVJERMh0.mjs → list-DUXFVM5r.mjs} +19 -3
- package/dist/{load-BsCRJMxP.mjs → load-DieqITz5.mjs} +2 -2
- package/dist/source-policy-C5S58Cno.mjs +2 -0
- package/dist/{source-policy-CXjjpHNc.mjs → source-policy-CzZqrSTS.mjs} +33 -8
- package/dist/{support-DKP_LLRd.mjs → support-CDhR09kb.mjs} +1 -1
- package/dist/{support-XEVbBenU.mjs → support-D7lyVf_J.mjs} +1 -1
- package/dist/{validate-D5bt8Q0r.mjs → validate-Cm-gfxGX.mjs} +1 -1
- package/package.json +2 -1
- package/dist/source-policy-BDNiixOv.mjs +0 -2
package/dist/cli.mjs
CHANGED
|
@@ -7,8 +7,8 @@ import { cac } from "cac";
|
|
|
7
7
|
function createCli() {
|
|
8
8
|
const cli = cac("intent");
|
|
9
9
|
cli.usage("<command> [options]");
|
|
10
|
-
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) => {
|
|
11
|
-
const { runListCommand } = await import("./list-
|
|
10
|
+
cli.command("list", "Discover intent-enabled packages from the project or workspace").usage("list [--json] [--debug] [--global] [--global-only] [--show-hidden] [--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("--show-hidden", "Show hidden skill sources not listed in intent.skills").option("--no-notices", "Suppress non-critical notices on stderr").example("list").example("list --json").example("list --global").action(async (options) => {
|
|
11
|
+
const { runListCommand } = await import("./list-DUXFVM5r.mjs");
|
|
12
12
|
await runListCommand(options);
|
|
13
13
|
});
|
|
14
14
|
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,19 +16,19 @@ function createCli() {
|
|
|
16
16
|
await runExcludeCommand(action, pattern, options);
|
|
17
17
|
});
|
|
18
18
|
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) => {
|
|
19
|
-
const { runLoadCommand } = await import("./load-
|
|
19
|
+
const { runLoadCommand } = await import("./load-DieqITz5.mjs");
|
|
20
20
|
await runLoadCommand(use, options);
|
|
21
21
|
});
|
|
22
22
|
cli.command("meta [name]", "List meta-skills, or print one by name").usage("meta [name]").example("meta").example("meta domain-discovery").action(async (name) => {
|
|
23
|
-
const [{ getMetaDir }, { runMetaCommand }] = await Promise.all([import("./support-
|
|
23
|
+
const [{ getMetaDir }, { runMetaCommand }] = await Promise.all([import("./support-CDhR09kb.mjs"), import("./meta-Dk7d0N2J.mjs")]);
|
|
24
24
|
await runMetaCommand(name, getMetaDir());
|
|
25
25
|
});
|
|
26
26
|
cli.command("validate [dir]", "Validate skill files").usage("validate [dir] [--github-summary] [--fix] [--check]").option("--github-summary", "Write a GitHub Actions step summary").option("--fix", "Rewrite fixable SKILL.md frontmatter issues").option("--check", "Fail if fixable SKILL.md frontmatter issues would be rewritten").example("validate").example("validate packages/query/skills").action(async (dir, options) => {
|
|
27
|
-
const { runValidateCommand } = await import("./validate-
|
|
27
|
+
const { runValidateCommand } = await import("./validate-Cm-gfxGX.mjs");
|
|
28
28
|
await runValidateCommand(dir, options);
|
|
29
29
|
});
|
|
30
30
|
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) => {
|
|
31
|
-
const [{ scanIntentsOrFail }, { runInstallCommand }] = await Promise.all([import("./support-
|
|
31
|
+
const [{ scanIntentsOrFail }, { runInstallCommand }] = await Promise.all([import("./support-CDhR09kb.mjs"), import("./command-BMdho_4n.mjs")]);
|
|
32
32
|
await runInstallCommand(options, scanIntentsOrFail);
|
|
33
33
|
});
|
|
34
34
|
cli.command("hooks [action]", "Manage agent hooks that enforce skill loading").usage("hooks install [--scope project|user] [--agents copilot,claude,codex|all]").option("--scope <scope>", "Hook install scope: project or user").option("--agents <agents>", "Hook agents: copilot,claude,codex, or all").example("hooks install").example("hooks install --scope user --agents copilot").action(async (action, options) => {
|
|
@@ -37,11 +37,11 @@ function createCli() {
|
|
|
37
37
|
runHooksInstallCommand(options);
|
|
38
38
|
});
|
|
39
39
|
cli.command("scaffold", "Print maintainer scaffold prompt").usage("scaffold").action(async () => {
|
|
40
|
-
const [{ getMetaDir }, { runScaffoldCommand }] = await Promise.all([import("./support-
|
|
40
|
+
const [{ getMetaDir }, { runScaffoldCommand }] = await Promise.all([import("./support-CDhR09kb.mjs"), import("./scaffold-D8TAMXvs.mjs")]);
|
|
41
41
|
runScaffoldCommand(getMetaDir());
|
|
42
42
|
});
|
|
43
43
|
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) => {
|
|
44
|
-
const [{ resolveStaleTargets }, { runStaleCommand }] = await Promise.all([import("./support-
|
|
44
|
+
const [{ resolveStaleTargets }, { runStaleCommand }] = await Promise.all([import("./support-CDhR09kb.mjs"), import("./stale-DlNJHwga.mjs")]);
|
|
45
45
|
await runStaleCommand(targetDir, options, resolveStaleTargets);
|
|
46
46
|
});
|
|
47
47
|
cli.command("edit-package-json", "Update package.json files so skills are published").usage("edit-package-json").action(async () => {
|
|
@@ -49,11 +49,11 @@ function createCli() {
|
|
|
49
49
|
await runEditPackageJsonCommand(process.cwd());
|
|
50
50
|
});
|
|
51
51
|
cli.command("setup", "Copy Intent CI workflow templates into .github/workflows/").usage("setup").action(async () => {
|
|
52
|
-
const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./support-
|
|
52
|
+
const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./support-CDhR09kb.mjs"), import("./github-actions-D41VZqWh.mjs")]);
|
|
53
53
|
await runSetupGithubActionsCommand(process.cwd(), getMetaDir());
|
|
54
54
|
});
|
|
55
55
|
cli.command("setup-github-actions", "Copy Intent CI workflow templates into .github/workflows/").usage("setup-github-actions").action(async () => {
|
|
56
|
-
const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./support-
|
|
56
|
+
const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./support-CDhR09kb.mjs"), import("./github-actions-D41VZqWh.mjs")]);
|
|
57
57
|
await runSetupGithubActionsCommand(process.cwd(), getMetaDir());
|
|
58
58
|
});
|
|
59
59
|
cli.command("help [command]", "Display help for a command").action((commandName) => {
|
|
@@ -2,7 +2,7 @@ import { t as detectPackageManager } from "./package-manager-C63Zi9q1.mjs";
|
|
|
2
2
|
import { i as parseSkillUse, n as formatSkillUse } from "./use-plp2M918.mjs";
|
|
3
3
|
import { t as fail } from "./cli-error-BebkXaTJ.mjs";
|
|
4
4
|
import { t as formatIntentCommand } from "./command-runner-BFvtjLMh.mjs";
|
|
5
|
-
import { a as noticeOptionsFromGlobalFlags, l as printNotices, n as coreOptionsFromGlobalFlags, u as printWarnings } from "./support-
|
|
5
|
+
import { a as noticeOptionsFromGlobalFlags, l as printNotices, n as coreOptionsFromGlobalFlags, u as printWarnings } from "./support-D7lyVf_J.mjs";
|
|
6
6
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { dirname, join, relative } from "node:path";
|
|
8
8
|
import { parse } from "yaml";
|
|
@@ -5,7 +5,7 @@ import { i as parseSkillUse, n as formatSkillUse } from "./use-plp2M918.mjs";
|
|
|
5
5
|
import { t as resolveProjectContext } from "./project-context-CALU5-15.mjs";
|
|
6
6
|
import { o as warningMentionsPackage, r as getEffectiveExcludePatterns, t as compileExcludePatterns } from "./excludes-BEi9N7Ys.mjs";
|
|
7
7
|
import { i as resolveSkillUse, r as resolveSkillEntry, t as ResolveSkillUseError } from "./resolver-6i-WBbh8.mjs";
|
|
8
|
-
import { a as checkLoadAllowed, o as readSkillSourcesConfig, s as scanForPolicedIntents } from "./source-policy-
|
|
8
|
+
import { a as checkLoadAllowed, o as readSkillSourcesConfig, s as scanForPolicedIntents } from "./source-policy-CzZqrSTS.mjs";
|
|
9
9
|
import { existsSync } from "node:fs";
|
|
10
10
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
11
11
|
//#region src/core/markdown.ts
|
|
@@ -360,7 +360,7 @@ function listIntentSkills(options = {}) {
|
|
|
360
360
|
const scanOptions = toScanOptions(options);
|
|
361
361
|
const fsCache = createIntentFsCache();
|
|
362
362
|
const projectContext = resolveProjectContext({ cwd });
|
|
363
|
-
const { scan, excludePatterns } = scanForPolicedIntents({
|
|
363
|
+
const { hiddenSourceCount, hiddenSources, scan, excludePatterns } = scanForPolicedIntents({
|
|
364
364
|
cwd,
|
|
365
365
|
scanOptions: withFsCache(scanOptions, fsCache),
|
|
366
366
|
coreOptions: options,
|
|
@@ -390,6 +390,8 @@ function listIntentSkills(options = {}) {
|
|
|
390
390
|
packageRoot: pkg.packageRoot,
|
|
391
391
|
skillCount: pkg.skills.length
|
|
392
392
|
})),
|
|
393
|
+
hiddenSourceCount,
|
|
394
|
+
hiddenSources,
|
|
393
395
|
warnings: scan.warnings,
|
|
394
396
|
notices: scan.notices,
|
|
395
397
|
conflicts: scan.conflicts
|
package/dist/core.d.mts
CHANGED
|
@@ -2,12 +2,18 @@ import { _ as VersionConflict, c as PackageManager, d as ScanScope, f as ScanSta
|
|
|
2
2
|
|
|
3
3
|
//#region src/core/types.d.ts
|
|
4
4
|
interface IntentCoreOptions {
|
|
5
|
+
audience?: IntentAudience;
|
|
5
6
|
cwd?: string;
|
|
6
7
|
debug?: boolean;
|
|
7
8
|
global?: boolean;
|
|
8
9
|
globalOnly?: boolean;
|
|
9
10
|
exclude?: Array<string>;
|
|
10
11
|
}
|
|
12
|
+
type IntentAudience = 'agent' | 'human';
|
|
13
|
+
interface IntentHiddenSourceSummary {
|
|
14
|
+
name: string;
|
|
15
|
+
skillCount: number;
|
|
16
|
+
}
|
|
11
17
|
interface IntentSkillSummary {
|
|
12
18
|
use: string;
|
|
13
19
|
packageName: string;
|
|
@@ -30,6 +36,8 @@ interface IntentSkillList {
|
|
|
30
36
|
packageManager: PackageManager;
|
|
31
37
|
skills: Array<IntentSkillSummary>;
|
|
32
38
|
packages: Array<IntentPackageSummary>;
|
|
39
|
+
hiddenSourceCount: number;
|
|
40
|
+
hiddenSources: Array<IntentHiddenSourceSummary>;
|
|
33
41
|
warnings: Array<string>;
|
|
34
42
|
notices: Array<string>;
|
|
35
43
|
conflicts: Array<VersionConflict>;
|
package/dist/core.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as resolveIntentSkill, n as listIntentSkills, r as loadIntentSkill, t as IntentCoreError } from "./core-
|
|
1
|
+
import { i as resolveIntentSkill, n as listIntentSkills, r as loadIntentSkill, t as IntentCoreError } from "./core-Bqyle4Vm.mjs";
|
|
2
2
|
export { IntentCoreError, listIntentSkills, loadIntentSkill, resolveIntentSkill };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { n as listIntentSkills } from "./core-
|
|
1
|
+
import { n as listIntentSkills } from "./core-Bqyle4Vm.mjs";
|
|
2
|
+
import { c as detectIntentAudience } from "./source-policy-CzZqrSTS.mjs";
|
|
2
3
|
import { t as formatIntentCommand } from "./command-runner-BFvtjLMh.mjs";
|
|
3
|
-
import { a as noticeOptionsFromGlobalFlags, l as printNotices, n as coreOptionsFromGlobalFlags, o as printDebugInfo, u as printWarnings } from "./support-
|
|
4
|
+
import { a as noticeOptionsFromGlobalFlags, l as printNotices, n as coreOptionsFromGlobalFlags, o as printDebugInfo, u as printWarnings } from "./support-D7lyVf_J.mjs";
|
|
4
5
|
//#region src/commands/list.ts
|
|
5
6
|
function printListDebug(result) {
|
|
6
7
|
if (!result.debug) return;
|
|
@@ -45,8 +46,21 @@ function getPackageSkills(pkg, skillsByPackageRoot) {
|
|
|
45
46
|
function formatLoadCommand(skill, packageManager, scopeFlag) {
|
|
46
47
|
return formatIntentCommand(packageManager, `load ${skill.use}${scopeFlag}`);
|
|
47
48
|
}
|
|
49
|
+
function printHiddenSources(result, audience) {
|
|
50
|
+
if (audience === "agent") {
|
|
51
|
+
console.log("Hidden skill sources are not revealed in agent sessions. Run this command outside the agent session to review candidates.");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (result.hiddenSources.length === 0) return;
|
|
55
|
+
console.log("\nHidden skill sources:\n");
|
|
56
|
+
for (const source of result.hiddenSources) console.log(` ${source.name} (${source.skillCount} ${source.skillCount === 1 ? "skill" : "skills"})`);
|
|
57
|
+
}
|
|
48
58
|
async function runListCommand(options) {
|
|
49
|
-
const
|
|
59
|
+
const audience = detectIntentAudience();
|
|
60
|
+
const result = listIntentSkills({
|
|
61
|
+
...coreOptionsFromGlobalFlags(options),
|
|
62
|
+
audience
|
|
63
|
+
});
|
|
50
64
|
const noticeOptions = noticeOptionsFromGlobalFlags(options);
|
|
51
65
|
printListDebug(result);
|
|
52
66
|
if (options.json) {
|
|
@@ -57,6 +71,7 @@ async function runListCommand(options) {
|
|
|
57
71
|
const { computeSkillNameWidth, printSkillTree, printTable } = await import("./display-Dc1feMcZ.mjs");
|
|
58
72
|
if (result.packages.length === 0) {
|
|
59
73
|
console.log("No intent-enabled packages found.");
|
|
74
|
+
if (options.showHidden && result.hiddenSourceCount > 0) printHiddenSources(result, audience);
|
|
60
75
|
if (result.warnings.length > 0) {
|
|
61
76
|
console.log();
|
|
62
77
|
printWarnings(result.warnings);
|
|
@@ -77,6 +92,7 @@ async function runListCommand(options) {
|
|
|
77
92
|
String(pkg.skillCount)
|
|
78
93
|
]));
|
|
79
94
|
printVersionConflicts(result);
|
|
95
|
+
if (options.showHidden) printHiddenSources(result, audience);
|
|
80
96
|
const skillsByPackageRoot = groupSkillsByPackageRoot(result.skills);
|
|
81
97
|
const nameWidth = computeSkillNameWidth(result.packages.map((pkg) => getPackageSkills(pkg, skillsByPackageRoot).map((skill) => ({
|
|
82
98
|
name: skill.skillName,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as fail } from "./cli-error-BebkXaTJ.mjs";
|
|
2
|
-
import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-
|
|
3
|
-
import { n as coreOptionsFromGlobalFlags, o as printDebugInfo } from "./support-
|
|
2
|
+
import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-Bqyle4Vm.mjs";
|
|
3
|
+
import { n as coreOptionsFromGlobalFlags, o as printDebugInfo } from "./support-D7lyVf_J.mjs";
|
|
4
4
|
//#region src/commands/load.ts
|
|
5
5
|
function printLoadDebug(loaded) {
|
|
6
6
|
if (!loaded.debug) return;
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { t as scanForIntents } from "./scanner-B1pcLFee.mjs";
|
|
2
2
|
import { t as resolveProjectContext } from "./project-context-CALU5-15.mjs";
|
|
3
3
|
import { a as isSkillExcluded, i as isPackageExcluded, n as getConfigDirs, o as warningMentionsPackage, r as getEffectiveExcludePatterns, s as readPackageJson, t as compileExcludePatterns } from "./excludes-BEi9N7Ys.mjs";
|
|
4
|
+
import { detectAgent, env } from "std-env";
|
|
5
|
+
//#region src/shared/environment.ts
|
|
6
|
+
function detectIntentAudience(explicit) {
|
|
7
|
+
if (explicit) return explicit;
|
|
8
|
+
const override = env.INTENT_AUDIENCE?.trim().toLowerCase();
|
|
9
|
+
if (override === "agent" || override === "human") return override;
|
|
10
|
+
if (override) throw new Error("Invalid INTENT_AUDIENCE value. Expected \"agent\" or \"human\".");
|
|
11
|
+
return detectAgent().name ? "agent" : "human";
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
4
14
|
//#region src/core/skill-sources.ts
|
|
5
15
|
var SkillSourcesParseError = class extends Error {
|
|
6
16
|
constructor(issues) {
|
|
@@ -164,13 +174,19 @@ function checkLoadAllowed(use, parsed, params) {
|
|
|
164
174
|
};
|
|
165
175
|
return null;
|
|
166
176
|
}
|
|
167
|
-
function
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
177
|
+
function pluralize(count, singular, plural) {
|
|
178
|
+
return count === 1 ? singular : plural;
|
|
179
|
+
}
|
|
180
|
+
function formatUnlistedNotice(hiddenSources, audience) {
|
|
181
|
+
const sorted = [...hiddenSources].sort((a, b) => a.name.localeCompare(b.name));
|
|
182
|
+
const sourceCount = sorted.length;
|
|
183
|
+
const skillCount = sorted.reduce((sum, source) => sum + source.skillCount, 0);
|
|
184
|
+
if (audience === "agent") return `${sourceCount} discovered ${pluralize(sourceCount, "skill source", "skill sources")} with ${skillCount} ${pluralize(skillCount, "skill", "skills")} ${pluralize(sourceCount, "is", "are")} hidden because ${pluralize(sourceCount, "it is", "they are")} not listed in intent.skills. Ask the user to run \`intent list --show-hidden\` outside the agent session to review candidates.`;
|
|
185
|
+
return `${sourceCount} discovered ${sourceCount === 1 ? "package ships" : "packages ship"} skills but ${sourceCount === 1 ? "is" : "are"} not listed in intent.skills: ${sorted.map((source) => source.name).join(", ")}. Add to opt in.`;
|
|
171
186
|
}
|
|
172
187
|
function applySourcePolicy(scanResult, options) {
|
|
173
188
|
const { config, excludeMatchers } = options;
|
|
189
|
+
const audience = options.audience ?? "human";
|
|
174
190
|
const seen = /* @__PURE__ */ new Set();
|
|
175
191
|
const notices = [];
|
|
176
192
|
const emit = (notice) => {
|
|
@@ -179,11 +195,14 @@ function applySourcePolicy(scanResult, options) {
|
|
|
179
195
|
notices.push(notice);
|
|
180
196
|
};
|
|
181
197
|
const packages = [];
|
|
182
|
-
const
|
|
198
|
+
const hiddenSources = [];
|
|
183
199
|
for (const pkg of scanResult.packages) {
|
|
184
200
|
if (isPackageExcluded(pkg.name, excludeMatchers)) continue;
|
|
185
201
|
if (!isSourcePermitted(config, pkg.name)) {
|
|
186
|
-
if (config.mode === "explicit")
|
|
202
|
+
if (config.mode === "explicit") hiddenSources.push({
|
|
203
|
+
name: pkg.name,
|
|
204
|
+
skillCount: pkg.skills.length
|
|
205
|
+
});
|
|
187
206
|
continue;
|
|
188
207
|
}
|
|
189
208
|
const skills = pkg.skills.filter((skill) => !isSkillExcluded(pkg.name, skill.name, excludeMatchers));
|
|
@@ -192,7 +211,7 @@ function applySourcePolicy(scanResult, options) {
|
|
|
192
211
|
skills
|
|
193
212
|
});
|
|
194
213
|
}
|
|
195
|
-
if (
|
|
214
|
+
if (hiddenSources.length > 0) emit(formatUnlistedNotice(hiddenSources, audience));
|
|
196
215
|
if (config.mode === "explicit") {
|
|
197
216
|
const discoveredNames = new Set(scanResult.packages.map((pkg) => pkg.name));
|
|
198
217
|
for (const source of config.sources) if (!discoveredNames.has(source.id)) emit(`"${source.raw}" is declared in intent.skills but was not discovered.`);
|
|
@@ -201,6 +220,8 @@ function applySourcePolicy(scanResult, options) {
|
|
|
201
220
|
else if (config.mode === "allow-all") emit(ALLOW_ALL_NOTICE);
|
|
202
221
|
else if (config.mode === "empty") emit(EMPTY_NOTE);
|
|
203
222
|
return {
|
|
223
|
+
hiddenSourceCount: hiddenSources.length,
|
|
224
|
+
hiddenSources,
|
|
204
225
|
packages,
|
|
205
226
|
notices
|
|
206
227
|
};
|
|
@@ -220,16 +241,20 @@ function readSkillSourcesConfig(cwd, context = resolveProjectContext({ cwd })) {
|
|
|
220
241
|
function scanForPolicedIntents(params) {
|
|
221
242
|
const { cwd, scanOptions, coreOptions } = params;
|
|
222
243
|
const context = params.context ?? resolveProjectContext({ cwd });
|
|
244
|
+
const audience = detectIntentAudience(coreOptions.audience);
|
|
223
245
|
const scanResult = scanForIntents(cwd, scanOptions);
|
|
224
246
|
const config = readSkillSourcesConfig(cwd, context);
|
|
225
247
|
const excludePatterns = getEffectiveExcludePatterns(coreOptions, context);
|
|
226
248
|
const policy = applySourcePolicy(scanResult, {
|
|
249
|
+
audience,
|
|
227
250
|
config,
|
|
228
251
|
excludeMatchers: compileExcludePatterns(excludePatterns)
|
|
229
252
|
});
|
|
230
253
|
const survivingNames = new Set(policy.packages.map((pkg) => pkg.name));
|
|
231
254
|
const droppedNames = scanResult.packages.map((pkg) => pkg.name).filter((name) => !survivingNames.has(name));
|
|
232
255
|
return {
|
|
256
|
+
hiddenSourceCount: policy.hiddenSourceCount,
|
|
257
|
+
hiddenSources: audience === "agent" ? [] : policy.hiddenSources,
|
|
233
258
|
scan: {
|
|
234
259
|
...scanResult,
|
|
235
260
|
packages: policy.packages,
|
|
@@ -241,4 +266,4 @@ function scanForPolicedIntents(params) {
|
|
|
241
266
|
};
|
|
242
267
|
}
|
|
243
268
|
//#endregion
|
|
244
|
-
export { checkLoadAllowed as a, applySourcePolicy as i, EMPTY_NOTE as n, readSkillSourcesConfig as o, MIGRATION_NOTICE as r, scanForPolicedIntents as s, ALLOW_ALL_NOTICE as t };
|
|
269
|
+
export { checkLoadAllowed as a, detectIntentAudience as c, applySourcePolicy as i, EMPTY_NOTE as n, readSkillSourcesConfig as o, MIGRATION_NOTICE as r, scanForPolicedIntents as s, ALLOW_ALL_NOTICE as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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 "./support-
|
|
1
|
+
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 "./support-D7lyVf_J.mjs";
|
|
2
2
|
export { INTENT_CHECK_SKILLS_WORKFLOW_VERSION, coreOptionsFromGlobalFlags, getCheckSkillsWorkflowAdvisories, getMetaDir, noticeOptionsFromGlobalFlags, printDebugInfo, printNotices, printWarnings, resolveStaleTargets, scanIntentsOrFail };
|
|
@@ -48,7 +48,7 @@ function getCheckSkillsWorkflowAdvisories(root) {
|
|
|
48
48
|
return [`Intent workflow update available: run \`npx @tanstack/intent@latest setup\` to refresh ${relative(process.cwd(), workflowPath) || workflowPath}.`];
|
|
49
49
|
}
|
|
50
50
|
async function scanIntentsOrFail(coreOptions = {}) {
|
|
51
|
-
const { scanForPolicedIntents } = await import("./source-policy-
|
|
51
|
+
const { scanForPolicedIntents } = await import("./source-policy-C5S58Cno.mjs");
|
|
52
52
|
try {
|
|
53
53
|
const { scan } = scanForPolicedIntents({
|
|
54
54
|
cwd: process.cwd(),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as findWorkspacePackages } from "./workspace-patterns-hW0v_meY.mjs";
|
|
2
2
|
import { t as resolveProjectContext } from "./project-context-CALU5-15.mjs";
|
|
3
3
|
import { n as isCliFailure, t as fail } from "./cli-error-BebkXaTJ.mjs";
|
|
4
|
-
import { u as printWarnings } from "./support-
|
|
4
|
+
import { u as printWarnings } from "./support-D7lyVf_J.mjs";
|
|
5
5
|
import { appendFileSync, existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
7
7
|
//#region src/commands/validate.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/intent",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Ship compositional knowledge for AI coding agents alongside your npm packages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"cac": "^6.7.14",
|
|
30
30
|
"jsonc-parser": "^3.3.1",
|
|
31
31
|
"semver": "^7.8.4",
|
|
32
|
+
"std-env": "^4.1.0",
|
|
32
33
|
"yaml": "2.9.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|