@tanstack/intent 0.2.1 → 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.
Files changed (50) hide show
  1. package/README.md +1 -0
  2. package/dist/{artifact-coverage-DFtI6V_H.mjs → artifact-coverage-DerRKsWw.mjs} +1 -1
  3. package/dist/artifact-coverage-Dia0ZRPy.mjs +2 -0
  4. package/dist/{cli-error-DDAO6DIL.mjs → cli-error-BebkXaTJ.mjs} +1 -1
  5. package/dist/cli.mjs +18 -13
  6. package/dist/command-BBzoalDz.mjs +388 -0
  7. package/dist/{install-Bv2qdHwd.mjs → command-BMdho_4n.mjs} +85 -55
  8. package/dist/{command-runner-B5OofX0E.mjs → command-runner-BFvtjLMh.mjs} +1 -1
  9. package/dist/{core-DaAr5MBD.mjs → core-Bqyle4Vm.mjs} +12 -10
  10. package/dist/core.d.mts +10 -2
  11. package/dist/core.mjs +1 -1
  12. package/dist/{display-CnpA7XuV.mjs → display-Dc1feMcZ.mjs} +2 -2
  13. package/dist/{edit-package-json-D8xfcy2X.mjs → edit-package-json-CdnA7_TA.mjs} +2 -2
  14. package/dist/{exclude-DbHwcgQQ.mjs → exclude-IfSv-XI_.mjs} +2 -2
  15. package/dist/{excludes-ByvSbmmj.mjs → excludes-BEi9N7Ys.mjs} +1 -1
  16. package/dist/{setup-github-actions-IxZTZihi.mjs → github-actions-D41VZqWh.mjs} +2 -2
  17. package/dist/index.d.mts +9 -9
  18. package/dist/index.mjs +8 -8
  19. package/dist/{list-C-eGocZP.mjs → list-DUXFVM5r.mjs} +21 -5
  20. package/dist/{load-DDNrmeBz.mjs → load-DieqITz5.mjs} +3 -3
  21. package/dist/{meta-CF4XIYOo.mjs → meta-Dk7d0N2J.mjs} +2 -2
  22. package/dist/{package-manager-Dw7lYcI0.mjs → package-manager-C63Zi9q1.mjs} +1 -1
  23. package/dist/{skill-paths-Bm1P6IYe.mjs → paths-B0KW7rmz.mjs} +2 -2
  24. package/dist/{project-context-oi_m7paK.mjs → project-context-CALU5-15.mjs} +1 -1
  25. package/dist/{setup-CdfBc7Oe.d.mts → project-setup-Bvmg5uYy.d.mts} +2 -2
  26. package/dist/{resolver-Uwx8B5jv.mjs → resolver-6i-WBbh8.mjs} +3 -3
  27. package/dist/{scanner-C5bzzri5.mjs → scanner-B1pcLFee.mjs} +68 -68
  28. package/dist/{setup-Cx1r2y-1.mjs → setup-D5qLjoqf.mjs} +16 -9
  29. package/dist/setup-DFajGERl.mjs +3 -0
  30. package/dist/setup.d.mts +1 -1
  31. package/dist/setup.mjs +2 -2
  32. package/dist/source-policy-C5S58Cno.mjs +2 -0
  33. package/dist/{source-policy-D__bcpoU.mjs → source-policy-CzZqrSTS.mjs} +36 -11
  34. package/dist/{stale-DhjSTIt-.mjs → stale-DlNJHwga.mjs} +2 -2
  35. package/dist/{staleness-DoZU3lzy.mjs → staleness-I_jAT1Ge.mjs} +3 -3
  36. package/dist/{staleness-B5Cqe77_.mjs → staleness-bEZ8BeGq.mjs} +1 -1
  37. package/dist/{cli-support-BANzHEBM.mjs → support-CDhR09kb.mjs} +1 -1
  38. package/dist/{cli-support-z64kSJOO.mjs → support-D7lyVf_J.mjs} +9 -9
  39. package/dist/{types-ByXUTBJ2.d.mts → types-Bx6-umBo.d.mts} +1 -1
  40. package/dist/{skill-use-B2xRF1i9.mjs → use-plp2M918.mjs} +1 -1
  41. package/dist/{utils-BKBDYbCx.mjs → utils-BpmAIjiN.mjs} +1 -1
  42. package/dist/{utils-6FtqhOYf.mjs → utils-Bw7HwOo5.mjs} +1 -1
  43. package/dist/{validate-BAU0uzvQ.mjs → validate-Cm-gfxGX.mjs} +5 -5
  44. package/dist/{workflow-review-Bo2kPVXV.mjs → workflow-review-Bx8x6_uF.mjs} +1 -1
  45. package/dist/{workflow-review-B4AfwtHH.mjs → workflow-review-CEwwmDdD.mjs} +1 -1
  46. package/dist/{workspace-patterns-BDoJIWk-.mjs → workspace-patterns-hW0v_meY.mjs} +2 -2
  47. package/dist/{workspace-patterns-CrL8hAbd.mjs → workspace-patterns-qoXkCfEX.mjs} +1 -1
  48. package/package.json +2 -1
  49. package/dist/artifact-coverage-CXX6wav1.mjs +0 -2
  50. package/dist/source-policy-CTeI29oF.mjs +0 -2
@@ -1,26 +1,34 @@
1
- import { t as detectPackageManager } from "./package-manager-Dw7lYcI0.mjs";
2
- import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-B2xRF1i9.mjs";
3
- import { t as fail } from "./cli-error-DDAO6DIL.mjs";
4
- import { a as noticeOptionsFromGlobalFlags, l as printNotices, n as coreOptionsFromGlobalFlags, u as printWarnings } from "./cli-support-z64kSJOO.mjs";
5
- import { t as formatIntentCommand } from "./command-runner-B5OofX0E.mjs";
1
+ import { t as detectPackageManager } from "./package-manager-C63Zi9q1.mjs";
2
+ import { i as parseSkillUse, n as formatSkillUse } from "./use-plp2M918.mjs";
3
+ import { t as fail } from "./cli-error-BebkXaTJ.mjs";
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-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";
9
- //#region src/commands/install-writer.ts
9
+ //#region src/skills/categories.ts
10
+ const MAINTAINER_TYPES = new Set(["maintainer", "maintainer-only"]);
11
+ function getSkillCategory(skill) {
12
+ const type = skill.type?.trim().toLowerCase();
13
+ if (type === "reference") return "reference";
14
+ if (type === "meta") return "meta";
15
+ if (type && MAINTAINER_TYPES.has(type)) return "maintainer";
16
+ return "task";
17
+ }
18
+ function isGeneratedMappingSkill(skill) {
19
+ return getSkillCategory(skill) === "task";
20
+ }
21
+ //#endregion
22
+ //#region src/commands/install/guidance.ts
10
23
  const INTENT_SKILLS_START = "<!-- intent-skills:start -->";
11
24
  const INTENT_SKILLS_END = "<!-- intent-skills:end -->";
25
+ const LOCAL_PATH_VALUE_PATTERN = /(?:^|[\s"'])(?:\.{1,2}[\\/]|~[\\/]|[A-Za-z]:[\\/]|\/(?:Users|home|private|tmp|var\/folders)[\\/]|[^\s"']*(?:node_modules|\.pnpm|\.bun|\.yarn|\.intent)[\\/])/i;
12
26
  const SUPPORTED_AGENT_CONFIG_FILES = [
13
27
  "AGENTS.md",
14
28
  "CLAUDE.md",
15
29
  ".cursorrules",
16
30
  ".github/copilot-instructions.md"
17
31
  ];
18
- const NON_ACTIONABLE_SKILL_TYPES = new Set([
19
- "maintainer",
20
- "maintainer-only",
21
- "meta",
22
- "reference"
23
- ]);
24
32
  function normalizeBlock(content) {
25
33
  return content.replace(/\r\n/g, "\n").trimEnd();
26
34
  }
@@ -51,21 +59,27 @@ function parseSkillsList(block) {
51
59
  const yamlBody = normalizeBlock(block).split("\n").filter((line) => line !== INTENT_SKILLS_START && line !== INTENT_SKILLS_END).join("\n");
52
60
  try {
53
61
  const parsed = parse(yamlBody);
54
- if (!parsed || !Array.isArray(parsed.skills)) return {
55
- errors: ["Managed block must contain a skills list."],
56
- skills: []
62
+ if (!parsed || !Array.isArray(parsed.tanstackIntent)) return {
63
+ errors: ["Managed block must contain a tanstackIntent list."],
64
+ mappings: []
57
65
  };
58
66
  return {
59
67
  errors: [],
60
- skills: parsed.skills
68
+ mappings: parsed.tanstackIntent
61
69
  };
62
70
  } catch (err) {
63
71
  return {
64
72
  errors: [`Managed block contains invalid YAML: ${err instanceof Error ? err.message : String(err)}`],
65
- skills: []
73
+ mappings: []
66
74
  };
67
75
  }
68
76
  }
77
+ function containsLocalPathValue(value) {
78
+ return LOCAL_PATH_VALUE_PATTERN.test(value);
79
+ }
80
+ function parseLoadedSkillUse(command) {
81
+ return command.match(/(?:^|&&|\|\||;|\|)\s*(?:bunx\s+@tanstack\/intent(?:@latest)?|pnpm\s+exec\s+intent|pnpm\s+dlx\s+@tanstack\/intent(?:@latest)?|npx\s+@tanstack\/intent(?:@latest)?|yarn\s+dlx\s+@tanstack\/intent(?:@latest)?|intent)\s+load\s+([^\s|;&]+)/i)?.[1] ?? null;
82
+ }
69
83
  function verifyIntentSkillsBlockFile({ expectedBlock, expectedMappingCount, targetPath }) {
70
84
  const errors = [];
71
85
  if (!existsSync(targetPath)) return {
@@ -80,27 +94,44 @@ function verifyIntentSkillsBlockFile({ expectedBlock, expectedMappingCount, targ
80
94
  };
81
95
  const block = managedBlock.text;
82
96
  if (normalizeBlock(block) !== normalizeBlock(expectedBlock)) errors.push("Managed block does not match generated mappings.");
97
+ if (containsLocalPathValue(block)) errors.push("Managed block must not include local file paths.");
83
98
  if (expectedMappingCount === void 0) return {
84
99
  errors,
85
100
  ok: errors.length === 0
86
101
  };
87
- const { skills, errors: parseErrors } = parseSkillsList(block);
102
+ const { mappings, errors: parseErrors } = parseSkillsList(block);
88
103
  errors.push(...parseErrors);
89
- if (skills.length !== expectedMappingCount) errors.push(`Expected ${expectedMappingCount} skill mappings, found ${skills.length}.`);
90
- for (const skill of skills) {
91
- if (!skill || typeof skill !== "object") {
104
+ if (mappings.length !== expectedMappingCount) errors.push(`Expected ${expectedMappingCount} skill mappings, found ${mappings.length}.`);
105
+ for (const mappingValue of mappings) {
106
+ if (!mappingValue || typeof mappingValue !== "object") {
92
107
  errors.push("Each skill mapping must be an object.");
93
108
  continue;
94
109
  }
95
- const mapping = skill;
96
- if (mapping.load !== void 0) errors.push("Skill mappings must use compact `use` entries, not `load`.");
97
- if (typeof mapping.when !== "string" || mapping.when.trim() === "") errors.push("Each skill mapping must include a non-empty `when` field.");
98
- if (typeof mapping.use !== "string") errors.push("Each skill mapping must include a `use` field.");
99
- else try {
100
- parseSkillUse(mapping.use);
101
- } catch (err) {
102
- errors.push(err instanceof Error ? err.message : String(err));
110
+ const mapping = mappingValue;
111
+ if (mapping.use !== void 0) errors.push("Skill mappings must use `id` entries, not `use`.");
112
+ if (mapping.when !== void 0) errors.push("Skill mappings must use compact `for` entries, not `when`.");
113
+ let parsedId = null;
114
+ if (typeof mapping.id !== "string") errors.push("Each skill mapping must include an `id` field.");
115
+ else {
116
+ try {
117
+ parsedId = parseSkillUse(mapping.id);
118
+ } catch (err) {
119
+ errors.push(err instanceof Error ? err.message : String(err));
120
+ }
121
+ if (containsLocalPathValue(mapping.id)) errors.push("Skill mapping `id` must not include local file paths.");
122
+ }
123
+ if (typeof mapping.run !== "string" || mapping.run.trim() === "") errors.push("Each skill mapping must include a non-empty `run` field.");
124
+ else {
125
+ const loadedSkillUse = parseLoadedSkillUse(mapping.run);
126
+ if (!loadedSkillUse) errors.push("Each skill mapping `run` must load its `id`.");
127
+ else if (parsedId) {
128
+ const expectedSkillUse = formatSkillUse(parsedId.packageName, parsedId.skillName);
129
+ if (loadedSkillUse !== expectedSkillUse) errors.push(`Skill mapping \`run\` must load matching \`id\` ${expectedSkillUse}.`);
130
+ }
131
+ if (containsLocalPathValue(mapping.run)) errors.push("Skill mapping `run` must not include local file paths.");
103
132
  }
133
+ if (typeof mapping.for !== "string" || mapping.for.trim() === "") errors.push("Each skill mapping must include a non-empty `for` field.");
134
+ else if (containsLocalPathValue(mapping.for)) errors.push("Skill mapping `for` must not include local file paths.");
104
135
  }
105
136
  return {
106
137
  errors,
@@ -117,27 +148,24 @@ function compareNames(a, b) {
117
148
  function quoteYamlString(value) {
118
149
  return `"${value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t")}"`;
119
150
  }
120
- function isActionableSkill(skill) {
121
- const type = skill.type?.trim().toLowerCase();
122
- return !type || !NON_ACTIONABLE_SKILL_TYPES.has(type);
123
- }
124
151
  function formatWhen(packageName, skill) {
125
152
  return skill.description.replace(/\s+/g, " ").trim() || `Use ${packageName} ${skill.name}`;
126
153
  }
127
154
  function buildIntentSkillsBlock(scanResult) {
128
155
  const lines = [
129
156
  INTENT_SKILLS_START,
130
- `# Skill mappings - load \`use\` with \`${formatIntentCommand(scanResult.packageManager, "load <use>")}\`.`,
131
- "skills:"
157
+ "# TanStack Intent - before editing files, run the matching guidance command.",
158
+ "tanstackIntent:"
132
159
  ];
133
160
  let mappingCount = 0;
134
161
  for (const pkg of [...scanResult.packages].sort(compareNames)) for (const skill of [...pkg.skills].sort(compareNames)) {
135
- if (!isActionableSkill(skill)) continue;
162
+ if (!isGeneratedMappingSkill(skill)) continue;
136
163
  mappingCount++;
137
- lines.push(` - when: ${quoteYamlString(formatWhen(pkg.name, skill))}`);
138
- lines.push(` use: ${quoteYamlString(formatSkillUse(pkg.name, skill.name))}`);
164
+ lines.push(` - id: ${quoteYamlString(formatSkillUse(pkg.name, skill.name))}`);
165
+ lines.push(` run: ${quoteYamlString(formatIntentCommand(scanResult.packageManager, `load ${formatSkillUse(pkg.name, skill.name)}`))}`);
166
+ lines.push(` for: ${quoteYamlString(formatWhen(pkg.name, skill))}`);
139
167
  }
140
- if (mappingCount === 0) lines[2] = "skills: []";
168
+ if (mappingCount === 0) lines[2] = "tanstackIntent: []";
141
169
  lines.push(INTENT_SKILLS_END);
142
170
  return {
143
171
  block: `${lines.join("\n")}\n`,
@@ -152,9 +180,10 @@ function buildIntentSkillGuidanceBlock(packageManager = "unknown") {
152
180
  INTENT_SKILLS_START,
153
181
  "## Skill Loading",
154
182
  "",
155
- "Before substantial work:",
156
- `- Skill check: run \`${listCommand}\`, or use skills already listed in context.`,
157
- `- Skill guidance: if one local skill clearly matches the task, run \`${loadCommand}\` and follow the returned \`SKILL.md\`.`,
183
+ "Before editing files for a substantial task:",
184
+ `- Run \`${listCommand}\` from the workspace root to see available local skills.`,
185
+ `- If a listed skill matches the task, run \`${loadCommand}\` before changing files.`,
186
+ "- Use the loaded `SKILL.md` guidance while making the change.",
158
187
  "- Monorepos: when working across packages, run the skill check from the workspace root and prefer the local skill for the package being changed.",
159
188
  "- Multiple matches: prefer the most specific local skill for the package or concern you are changing; load additional skills only when the task spans multiple packages or concerns.",
160
189
  INTENT_SKILLS_END
@@ -230,7 +259,7 @@ function writeIntentSkillsBlock({ block, mappingCount, root, skipWhenEmpty = tru
230
259
  };
231
260
  }
232
261
  //#endregion
233
- //#region src/commands/install.ts
262
+ //#region src/commands/install/command.ts
234
263
  const INSTALL_PROMPT = `You are an AI assistant helping a developer set up skill-to-task mappings for their project.
235
264
 
236
265
  Goal: create or update one agent config file with an intent-skills mapping block.
@@ -240,7 +269,7 @@ Hard rules:
240
269
  - If skills are discovered and no mapping block exists, create AGENTS.md unless the user asks for another supported config file.
241
270
  - If a mapping block already exists in a supported config file, update that file.
242
271
  - Preserve all content outside the managed block unchanged.
243
- - Store compact \`use\` values in the managed block; do not write \`load\` paths.
272
+ - Store compact \`id\` values and runnable \`run\` commands in the managed block; do not write local paths.
244
273
  - Never write absolute local file paths, node_modules paths, or package-manager-internal paths in the managed block.
245
274
  - Verify the target file before your final response.
246
275
 
@@ -300,19 +329,20 @@ Follow these steps in order:
300
329
  Use this exact block:
301
330
 
302
331
  <!-- intent-skills:start -->
303
- # Skill mappings - load \`use\` with \`npx @tanstack/intent@latest load <use>\`.
304
- skills:
305
- - when: "describe the task or code area here"
306
- use: "@scope/package#skill-name"
332
+ # TanStack Intent - before editing files, run the matching guidance command.
333
+ tanstackIntent:
334
+ - id: "@scope/package#skill-name"
335
+ run: "npx @tanstack/intent@latest load @scope/package#skill-name"
336
+ for: "describe the task or code area here"
307
337
  <!-- intent-skills:end -->
308
338
 
309
339
  Rules:
310
- - Use the user's own words for \`when\` descriptions
311
- - Use compact \`use\` values in \`<package>#<skill>\` format
312
- - Do not include \`load\`
340
+ - Use the user's own words for \`for\` descriptions
341
+ - Use compact \`id\` values in \`<package>#<skill>\` format
342
+ - Include a \`run\` command that loads the matching \`id\`
313
343
  - Do not include machine-specific directories such as \`/Users/...\`, \`/home/...\`, \`/private/...\`,
314
344
  drive letters, temp workspace paths, \`.pnpm/\`, \`.bun/\`, or \`.yarn/\`.
315
- - Agents should load \`use\` at runtime with \`npx @tanstack/intent@latest load <use>\`
345
+ - Agents should run the \`run\` command before editing matching files
316
346
  - Keep entries concise - this block is read on every agent task
317
347
  - Preserve all content outside the block tags unchanged
318
348
  - If the user is on Deno, note that this setup is best-effort today and relies on npm interop
@@ -321,9 +351,9 @@ skills:
321
351
  Before reporting completion:
322
352
  - Confirm the target file exists
323
353
  - Confirm it contains both managed block markers
324
- - Confirm every mapping has \`when\` and \`use\`
325
- - Confirm every \`use\` parses as \`<package>#<skill>\`
326
- - Confirm no mapping includes \`load\`
354
+ - Confirm every mapping has \`id\`, \`run\`, and \`for\`
355
+ - Confirm every \`id\` parses as \`<package>#<skill>\`
356
+ - Confirm every \`run\` command loads the matching \`id\`
327
357
  - Confirm no path-like machine-specific values are stored in the managed block
328
358
  - Confirm every discovered actionable skill is mapped, skipped by rule, or deferred by user choice
329
359
 
@@ -1,4 +1,4 @@
1
- //#region src/command-runner.ts
1
+ //#region src/shared/command-runner.ts
2
2
  const runnerByPackageManager = {
3
3
  bun: "bunx @tanstack/intent@latest",
4
4
  npm: "npx @tanstack/intent@latest",
@@ -1,11 +1,11 @@
1
- import { d as toPosixPath, i as getDeps, u as resolveDepDir } from "./utils-6FtqhOYf.mjs";
2
- import { n as scanIntentPackageAtRoot, r as createIntentFsCache } from "./scanner-C5bzzri5.mjs";
3
- import { n as findWorkspacePackages } from "./workspace-patterns-BDoJIWk-.mjs";
4
- import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-B2xRF1i9.mjs";
5
- import { t as resolveProjectContext } from "./project-context-oi_m7paK.mjs";
6
- import { o as warningMentionsPackage, r as getEffectiveExcludePatterns, t as compileExcludePatterns } from "./excludes-ByvSbmmj.mjs";
7
- import { i as resolveSkillUse, r as resolveSkillEntry, t as ResolveSkillUseError } from "./resolver-Uwx8B5jv.mjs";
8
- import { a as checkLoadAllowed, o as readSkillSourcesConfig, s as scanForPolicedIntents } from "./source-policy-D__bcpoU.mjs";
1
+ import { d as toPosixPath, i as getDeps, u as resolveDepDir } from "./utils-Bw7HwOo5.mjs";
2
+ import { n as findWorkspacePackages } from "./workspace-patterns-hW0v_meY.mjs";
3
+ import { n as scanIntentPackageAtRoot, r as createIntentFsCache } from "./scanner-B1pcLFee.mjs";
4
+ import { i as parseSkillUse, n as formatSkillUse } from "./use-plp2M918.mjs";
5
+ import { t as resolveProjectContext } from "./project-context-CALU5-15.mjs";
6
+ import { o as warningMentionsPackage, r as getEffectiveExcludePatterns, t as compileExcludePatterns } from "./excludes-BEi9N7Ys.mjs";
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-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
@@ -328,7 +328,7 @@ function resolveSkillUseFastPath(parsedUse, options, context = resolveProjectCon
328
328
  return resolveFromPackageRoots(getWorkspaceLoadFastPathCandidateDirs(parsedUse.packageName, context, fsCache), parsedUse, cwd, fsCache);
329
329
  }
330
330
  //#endregion
331
- //#region src/core.ts
331
+ //#region src/core/intent-core.ts
332
332
  var IntentCoreError = class extends Error {
333
333
  constructor(code, message, options = {}) {
334
334
  super(message);
@@ -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
@@ -1,13 +1,19 @@
1
- import { _ as VersionConflict, c as PackageManager, d as ScanScope, f as ScanStats, s as IntentPackage } from "./types-ByXUTBJ2.mjs";
1
+ import { _ as VersionConflict, c as PackageManager, d as ScanScope, f as ScanStats, s as IntentPackage } from "./types-Bx6-umBo.mjs";
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>;
@@ -75,7 +83,7 @@ interface LoadedIntentSkillDebug {
75
83
  }
76
84
  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';
77
85
  //#endregion
78
- //#region src/core.d.ts
86
+ //#region src/core/intent-core.d.ts
79
87
  declare class IntentCoreError extends Error {
80
88
  readonly code: IntentCoreErrorCode;
81
89
  readonly suggestedSkills?: Array<string>;
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-DaAr5MBD.mjs";
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,5 +1,5 @@
1
- import { n as isStableLoadPath, t as formatRuntimeSkillLookupHint } from "./skill-paths-Bm1P6IYe.mjs";
2
- //#region src/display.ts
1
+ import { n as isStableLoadPath, t as formatRuntimeSkillLookupHint } from "./paths-B0KW7rmz.mjs";
2
+ //#region src/shared/display.ts
3
3
  function padColumn(text, width) {
4
4
  return text.length >= width ? text + " " : text.padEnd(width);
5
5
  }
@@ -1,6 +1,6 @@
1
- //#region src/commands/edit-package-json.ts
1
+ //#region src/commands/setup/edit-package-json.ts
2
2
  async function runEditPackageJsonCommand(root) {
3
- const { runEditPackageJsonAll } = await import("./setup.mjs");
3
+ const { runEditPackageJsonAll } = await import("./setup-DFajGERl.mjs");
4
4
  runEditPackageJsonAll(root);
5
5
  }
6
6
  //#endregion
@@ -1,5 +1,5 @@
1
- import { t as compileExcludePatterns } from "./excludes-ByvSbmmj.mjs";
2
- import { t as fail } from "./cli-error-DDAO6DIL.mjs";
1
+ import { t as compileExcludePatterns } from "./excludes-BEi9N7Ys.mjs";
2
+ import { t as fail } from "./cli-error-BebkXaTJ.mjs";
3
3
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  //#region src/commands/exclude.ts
@@ -1,4 +1,4 @@
1
- import { t as resolveProjectContext } from "./project-context-oi_m7paK.mjs";
1
+ import { t as resolveProjectContext } from "./project-context-CALU5-15.mjs";
2
2
  import { readFileSync } from "node:fs";
3
3
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
4
4
  //#region src/core/package-json.ts
@@ -1,6 +1,6 @@
1
- //#region src/commands/setup-github-actions.ts
1
+ //#region src/commands/setup/github-actions.ts
2
2
  async function runSetupGithubActionsCommand(root, metaDir) {
3
- const { runSetupGithubActions } = await import("./setup.mjs");
3
+ const { runSetupGithubActions } = await import("./setup-DFajGERl.mjs");
4
4
  runSetupGithubActions(root, metaDir);
5
5
  }
6
6
  //#endregion
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { _ as VersionConflict, a as IntentArtifactWarning, g as StalenessSignal, h as StalenessReport, i as IntentArtifactSkill, l as ScanOptions, m as SkillStaleness, n as IntentArtifactFile, o as IntentConfig, p as SkillEntry, r as IntentArtifactSet, s as IntentPackage, t as IntentArtifactCoverageIgnore, u as ScanResult } from "./types-ByXUTBJ2.mjs";
2
- import { i as runEditPackageJson, o as runSetupGithubActions, r as SetupGithubActionsResult, t as EditPackageJsonResult } from "./setup-CdfBc7Oe.mjs";
1
+ import { _ as VersionConflict, a as IntentArtifactWarning, g as StalenessSignal, h as StalenessReport, i as IntentArtifactSkill, l as ScanOptions, m as SkillStaleness, n as IntentArtifactFile, o as IntentConfig, p as SkillEntry, r as IntentArtifactSet, s as IntentPackage, t as IntentArtifactCoverageIgnore, u as ScanResult } from "./types-Bx6-umBo.mjs";
2
+ import { i as runEditPackageJson, o as runSetupGithubActions, r as SetupGithubActionsResult, t as EditPackageJsonResult } from "./project-setup-Bvmg5uYy.mjs";
3
3
  import { closeSync, existsSync, lstatSync, openSync, readFileSync, readSync, readdirSync, realpathSync } from "node:fs";
4
4
 
5
- //#region src/utils.d.ts
5
+ //#region src/shared/utils.d.ts
6
6
  /**
7
7
  * The subset of `node:fs` the scanner reads through. Under Yarn PnP this is
8
8
  * swapped for Yarn's libzip-patched `fs` so reads can reach files inside
@@ -40,16 +40,16 @@ declare function resolveDepDir(depName: string, parentDir: string): string | nul
40
40
  */
41
41
  declare function parseFrontmatter(filePath: string, fs?: ReadFs): Record<string, unknown> | null;
42
42
  //#endregion
43
- //#region src/scanner.d.ts
43
+ //#region src/discovery/scanner.d.ts
44
44
  declare function scanForIntents(root?: string, options?: ScanOptions): ScanResult;
45
45
  //#endregion
46
- //#region src/staleness.d.ts
46
+ //#region src/staleness/check.d.ts
47
47
  declare function checkStaleness(packageDir: string, packageName?: string, artifactRoot?: string): Promise<StalenessReport>;
48
48
  //#endregion
49
- //#region src/artifact-coverage.d.ts
49
+ //#region src/staleness/artifact-coverage.d.ts
50
50
  declare function readIntentArtifacts(root: string): IntentArtifactSet | null;
51
51
  //#endregion
52
- //#region src/workflow-review.d.ts
52
+ //#region src/staleness/workflow-review.d.ts
53
53
  interface StaleReviewItem {
54
54
  type: string;
55
55
  library: string;
@@ -64,7 +64,7 @@ declare function collectStaleReviewItems(reports: Array<StalenessReport>): Array
64
64
  declare function createFailedStaleReviewItem(library: string): StaleReviewItem;
65
65
  declare function buildStaleReviewBody(items: Array<StaleReviewItem>): string;
66
66
  //#endregion
67
- //#region src/skill-use.d.ts
67
+ //#region src/skills/use.d.ts
68
68
  interface SkillUse {
69
69
  packageName: string;
70
70
  skillName: string;
@@ -79,7 +79,7 @@ declare function isSkillUseParseError(error: unknown): error is SkillUseParseErr
79
79
  declare function formatSkillUse(packageName: string, skillName: string): string;
80
80
  declare function parseSkillUse(value: string): SkillUse;
81
81
  //#endregion
82
- //#region src/resolver.d.ts
82
+ //#region src/skills/resolver.d.ts
83
83
  interface ResolveSkillResult {
84
84
  packageName: string;
85
85
  skillName: string;
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { c as parseFrontmatter, i as getDeps, r as findSkillFiles, u as resolveDepDir } from "./utils-6FtqhOYf.mjs";
2
- import { t as scanForIntents } from "./scanner-C5bzzri5.mjs";
3
- import { t as readIntentArtifacts } from "./artifact-coverage-DFtI6V_H.mjs";
4
- import { n as checkStaleness } from "./staleness-DoZU3lzy.mjs";
5
- import { n as collectStaleReviewItems, r as createFailedStaleReviewItem, t as buildStaleReviewBody } from "./workflow-review-B4AfwtHH.mjs";
6
- import { i as parseSkillUse, n as formatSkillUse, r as isSkillUseParseError, t as SkillUseParseError } from "./skill-use-B2xRF1i9.mjs";
7
- import { i as resolveSkillUse, n as isResolveSkillUseError, t as ResolveSkillUseError } from "./resolver-Uwx8B5jv.mjs";
8
- import { r as runSetupGithubActions, t as runEditPackageJson } from "./setup-Cx1r2y-1.mjs";
1
+ import { c as parseFrontmatter, i as getDeps, r as findSkillFiles, u as resolveDepDir } from "./utils-Bw7HwOo5.mjs";
2
+ import { t as scanForIntents } from "./scanner-B1pcLFee.mjs";
3
+ import { t as readIntentArtifacts } from "./artifact-coverage-DerRKsWw.mjs";
4
+ import { n as checkStaleness } from "./staleness-I_jAT1Ge.mjs";
5
+ import { n as collectStaleReviewItems, r as createFailedStaleReviewItem, t as buildStaleReviewBody } from "./workflow-review-CEwwmDdD.mjs";
6
+ import { i as parseSkillUse, n as formatSkillUse, r as isSkillUseParseError, t as SkillUseParseError } from "./use-plp2M918.mjs";
7
+ import { i as resolveSkillUse, n as isResolveSkillUseError, t as ResolveSkillUseError } from "./resolver-6i-WBbh8.mjs";
8
+ import { r as runSetupGithubActions, t as runEditPackageJson } from "./setup-D5qLjoqf.mjs";
9
9
  export { ResolveSkillUseError, SkillUseParseError, buildStaleReviewBody, checkStaleness, collectStaleReviewItems, createFailedStaleReviewItem, findSkillFiles, formatSkillUse, getDeps, isResolveSkillUseError, isSkillUseParseError, parseFrontmatter, parseSkillUse, readIntentArtifacts, resolveDepDir, resolveSkillUse, runEditPackageJson, runSetupGithubActions, scanForIntents };
@@ -1,6 +1,7 @@
1
- import { n as listIntentSkills } from "./core-DaAr5MBD.mjs";
2
- import { a as noticeOptionsFromGlobalFlags, l as printNotices, n as coreOptionsFromGlobalFlags, o as printDebugInfo, u as printWarnings } from "./cli-support-z64kSJOO.mjs";
3
- import { t as formatIntentCommand } from "./command-runner-B5OofX0E.mjs";
1
+ import { n as listIntentSkills } from "./core-Bqyle4Vm.mjs";
2
+ import { c as detectIntentAudience } from "./source-policy-CzZqrSTS.mjs";
3
+ import { t as formatIntentCommand } from "./command-runner-BFvtjLMh.mjs";
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 result = listIntentSkills(coreOptionsFromGlobalFlags(options));
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) {
@@ -54,9 +68,10 @@ async function runListCommand(options) {
54
68
  console.log(JSON.stringify(jsonResult, null, 2));
55
69
  return;
56
70
  }
57
- const { computeSkillNameWidth, printSkillTree, printTable } = await import("./display-CnpA7XuV.mjs");
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
- import { t as fail } from "./cli-error-DDAO6DIL.mjs";
2
- import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-DaAr5MBD.mjs";
3
- import { n as coreOptionsFromGlobalFlags, o as printDebugInfo } from "./cli-support-z64kSJOO.mjs";
1
+ import { t as fail } from "./cli-error-BebkXaTJ.mjs";
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,4 +1,4 @@
1
- import { t as fail } from "./cli-error-DDAO6DIL.mjs";
1
+ import { t as fail } from "./cli-error-BebkXaTJ.mjs";
2
2
  import { existsSync, readFileSync, readdirSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  //#region src/commands/meta.ts
@@ -15,7 +15,7 @@ async function runMetaCommand(name, metaDir) {
15
15
  }
16
16
  return;
17
17
  }
18
- const { parseFrontmatter } = await import("./utils-BKBDYbCx.mjs");
18
+ const { parseFrontmatter } = await import("./utils-BpmAIjiN.mjs");
19
19
  const entries = readdirSync(metaDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => existsSync(join(metaDir, entry.name, "SKILL.md")));
20
20
  if (entries.length === 0) {
21
21
  console.log("No meta-skills found.");
@@ -1,6 +1,6 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
2
  import { dirname, join, resolve } from "node:path";
3
- //#region src/package-manager.ts
3
+ //#region src/discovery/package-manager.ts
4
4
  function readPackageManagerField(dir) {
5
5
  try {
6
6
  const parsed = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
@@ -1,7 +1,7 @@
1
- import { d as toPosixPath } from "./utils-6FtqhOYf.mjs";
1
+ import { d as toPosixPath } from "./utils-Bw7HwOo5.mjs";
2
2
  import { existsSync } from "node:fs";
3
3
  import { join, relative } from "node:path";
4
- //#region src/skill-paths.ts
4
+ //#region src/skills/paths.ts
5
5
  function isAbsolutePath(path) {
6
6
  return path.startsWith("/") || path.startsWith("\\") || /^[A-Za-z]:[\\/]/.test(path);
7
7
  }
@@ -1,4 +1,4 @@
1
- import { a as readWorkspacePatterns, r as findWorkspaceRoot } from "./workspace-patterns-BDoJIWk-.mjs";
1
+ import { a as readWorkspacePatterns, r as findWorkspaceRoot } from "./workspace-patterns-hW0v_meY.mjs";
2
2
  import { existsSync, statSync } from "node:fs";
3
3
  import { dirname, join, relative, resolve } from "node:path";
4
4
  //#region src/core/project-context.ts
@@ -1,10 +1,10 @@
1
- //#region src/workspace-patterns.d.ts
1
+ //#region src/setup/workspace-patterns.d.ts
2
2
  declare function readWorkspacePatterns(root: string): Array<string> | null;
3
3
  declare function resolveWorkspacePackages(root: string, patterns: Array<string>): Array<string>;
4
4
  declare function findWorkspaceRoot(start: string): string | null;
5
5
  declare function findPackagesWithSkills(root: string): Array<string>;
6
6
  //#endregion
7
- //#region src/setup.d.ts
7
+ //#region src/setup/project-setup.d.ts
8
8
  interface EditPackageJsonResult {
9
9
  added: Array<string>;
10
10
  alreadyPresent: Array<string>;
@@ -1,6 +1,6 @@
1
- import { i as parseSkillUse } from "./skill-use-B2xRF1i9.mjs";
2
- import { o as warningMentionsPackage } from "./excludes-ByvSbmmj.mjs";
3
- //#region src/resolver.ts
1
+ import { i as parseSkillUse } from "./use-plp2M918.mjs";
2
+ import { o as warningMentionsPackage } from "./excludes-BEi9N7Ys.mjs";
3
+ //#region src/skills/resolver.ts
4
4
  var ResolveSkillUseError = class extends Error {
5
5
  constructor({ availablePackages = [], availableSkills = [], code, packageName, skillName, suggestedSkills = [], use }) {
6
6
  super(formatResolveSkillUseErrorMessage({