@tanstack/intent 0.0.40 → 0.0.42

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 (49) hide show
  1. package/dist/{cli-support-Cb9lNXhL.mjs → cli-support-B26oUGbf.mjs} +4 -4
  2. package/dist/{cli-support-DtqVDiJv.mjs → cli-support-C-t4xQw0.mjs} +4 -4
  3. package/dist/cli.d.mts +2 -1
  4. package/dist/cli.mjs +20 -16
  5. package/dist/command-runner-C0yCOHLi.mjs +16 -0
  6. package/dist/{core-BOSjgetf.mjs → core-CEeo37aT.mjs} +26 -23
  7. package/dist/core.d.mts +2 -1
  8. package/dist/core.mjs +7 -7
  9. package/dist/{display-DHNuzSqR.mjs → display-BdSvrwWJ.mjs} +14 -3
  10. package/dist/index.d.mts +2 -2
  11. package/dist/index.mjs +9 -9
  12. package/dist/{install-CLkmoPOY.mjs → install-t4jkDdD0.mjs} +16 -9
  13. package/dist/{list-CxSm8YYl.mjs → list-DQxqa1AT.mjs} +16 -10
  14. package/dist/{load-DF-zIT3-.mjs → load-3ACx3170.mjs} +8 -8
  15. package/dist/{meta-BNSVXFQu.mjs → meta-DZgsju5x.mjs} +1 -1
  16. package/dist/package-manager-BUgTjW9Q.mjs +48 -0
  17. package/dist/{project-context-Bv9BDh8B.mjs → project-context-4wzbLY9c.mjs} +6 -5
  18. package/dist/{resolver-BDsZ3kWg.mjs → resolver-D8sX72Lg.mjs} +5 -6
  19. package/dist/scanner-BK8rIEA3.mjs +6 -0
  20. package/dist/{scanner-BGyQTQ3U.mjs → scanner-QujEINYm.mjs} +44 -44
  21. package/dist/{setup-DQMKxEoA.mjs → setup-BElEzHxS.mjs} +2 -2
  22. package/dist/setup.d.mts +1 -1
  23. package/dist/setup.mjs +4 -4
  24. package/dist/{skill-paths-BHbdWniB.mjs → skill-paths-Cc0-Y331.mjs} +1 -1
  25. package/dist/{stale-flPZnWfI.mjs → stale-C6dPKQ98.mjs} +1 -1
  26. package/dist/{staleness-CGLs-swr.mjs → staleness-BwcLygsY.mjs} +1 -1
  27. package/dist/{staleness-Dl-m8JWM.mjs → staleness-Dd1kWwCz.mjs} +2 -2
  28. package/dist/{types-Cq5cY9h9.d.mts → types-CIha6LtJ.d.mts} +3 -2
  29. package/dist/{utils-BPDvfmcd.mjs → utils-CF7OL__5.mjs} +64 -7
  30. package/dist/utils-DTvYXAsM.mjs +3 -0
  31. package/dist/{validate-Divq4AiV.mjs → validate-D0n-rBpp.mjs} +5 -5
  32. package/dist/{workflow-review-CIdJXmKP.mjs → workflow-review-CrWkP7Hc.mjs} +1 -1
  33. package/dist/{workflow-review-CwcR2ge4.mjs → workflow-review-D9Fg1G0P.mjs} +15 -15
  34. package/dist/{workspace-patterns-Diy5gtz_.mjs → workspace-patterns-CnGMcicG.mjs} +2 -2
  35. package/dist/{workspace-patterns-CIJQCwbJ.mjs → workspace-patterns-FljtM2Xb.mjs} +7 -8
  36. package/package.json +3 -8
  37. package/dist/display-CmLzVAae.mjs +0 -5
  38. package/dist/install-ChddjnhO.mjs +0 -7
  39. package/dist/intent-library.d.mts +0 -1
  40. package/dist/intent-library.mjs +0 -84
  41. package/dist/library-scanner-BAJ7bXtW.mjs +0 -116
  42. package/dist/library-scanner.d.mts +0 -16
  43. package/dist/library-scanner.mjs +0 -5
  44. package/dist/scanner-Ix6MmxfB.mjs +0 -6
  45. package/dist/utils-DqdIC3RY.mjs +0 -3
  46. /package/dist/{edit-package-json-CzWlMXOf.mjs → edit-package-json-CtuelQ_q.mjs} +0 -0
  47. /package/dist/{scaffold-D2vwv9ls.mjs → scaffold-CLM6bt3c.mjs} +0 -0
  48. /package/dist/{setup-2SE9zYJk.d.mts → setup-DhMqESd3.d.mts} +0 -0
  49. /package/dist/{setup-github-actions-emXSyGy3.mjs → setup-github-actions-CUd1oncY.mjs} +0 -0
@@ -1,6 +1,6 @@
1
- import "./utils-BPDvfmcd.mjs";
2
- import "./workspace-patterns-CIJQCwbJ.mjs";
3
- import "./project-context-Bv9BDh8B.mjs";
4
- import { a as printDebugInfo, c as scanOptionsFromGlobalFlags, i as getMetaDir, l as printWarnings, n as coreOptionsFromGlobalFlags, o as resolveStaleTargets, r as getCheckSkillsWorkflowAdvisories, s as scanIntentsOrFail, t as INTENT_CHECK_SKILLS_WORKFLOW_VERSION } from "./cli-support-DtqVDiJv.mjs";
1
+ import "./utils-CF7OL__5.mjs";
2
+ import "./workspace-patterns-FljtM2Xb.mjs";
3
+ import "./project-context-4wzbLY9c.mjs";
4
+ import { a as printDebugInfo, c as scanOptionsFromGlobalFlags, i as getMetaDir, l as printWarnings, n as coreOptionsFromGlobalFlags, o as resolveStaleTargets, r as getCheckSkillsWorkflowAdvisories, s as scanIntentsOrFail, t as INTENT_CHECK_SKILLS_WORKFLOW_VERSION } from "./cli-support-C-t4xQw0.mjs";
5
5
 
6
6
  export { INTENT_CHECK_SKILLS_WORKFLOW_VERSION, coreOptionsFromGlobalFlags, getCheckSkillsWorkflowAdvisories, getMetaDir, printDebugInfo, printWarnings, resolveStaleTargets, scanIntentsOrFail, scanOptionsFromGlobalFlags };
@@ -1,4 +1,4 @@
1
- import { t as resolveProjectContext } from "./project-context-Bv9BDh8B.mjs";
1
+ import { t as resolveProjectContext } from "./project-context-4wzbLY9c.mjs";
2
2
  import { t as fail } from "./cli-error-BrMXlbtx.mjs";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { dirname, join, relative, resolve } from "node:path";
@@ -31,7 +31,7 @@ function getCheckSkillsWorkflowAdvisories(root) {
31
31
  return [`Intent workflow update available: run \`npx @tanstack/intent@latest setup\` to refresh ${relative(process.cwd(), workflowPath) || workflowPath}.`];
32
32
  }
33
33
  async function scanIntentsOrFail(options) {
34
- const { scanForIntents } = await import("./scanner-Ix6MmxfB.mjs");
34
+ const { scanForIntents } = await import("./scanner-BK8rIEA3.mjs");
35
35
  try {
36
36
  return scanForIntents(void 0, options);
37
37
  } catch (err) {
@@ -68,13 +68,13 @@ async function resolveStaleTargets(targetDir) {
68
68
  targetPath: targetDir
69
69
  });
70
70
  const workflowAdvisories = getCheckSkillsWorkflowAdvisories(context.workspaceRoot ?? context.packageRoot ?? resolvedRoot);
71
- const { buildWorkspaceCoverageSignals, checkStaleness, readPackageName } = await import("./staleness-Dl-m8JWM.mjs");
71
+ const { buildWorkspaceCoverageSignals, checkStaleness, readPackageName } = await import("./staleness-Dd1kWwCz.mjs");
72
72
  const isWorkspaceRootTarget = context.workspaceRoot !== null && resolvedRoot === context.workspaceRoot;
73
73
  if (context.packageRoot && !isWorkspaceRootTarget && (context.targetSkillsDir !== null || context.workspaceRoot === null)) return {
74
74
  reports: [await checkStaleness(context.packageRoot, readPackageName(context.packageRoot), context.workspaceRoot ?? context.packageRoot)],
75
75
  workflowAdvisories
76
76
  };
77
- const { findWorkspaceRoot, getWorkspaceInfo } = await import("./workspace-patterns-Diy5gtz_.mjs");
77
+ const { findWorkspaceRoot, getWorkspaceInfo } = await import("./workspace-patterns-CnGMcicG.mjs");
78
78
  const workspaceRoot = findWorkspaceRoot(resolvedRoot);
79
79
  const workspaceInfo = workspaceRoot ? getWorkspaceInfo(workspaceRoot) : null;
80
80
  if (workspaceInfo) {
package/dist/cli.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  //#region src/cli.d.ts
3
3
  declare function main(argv?: Array<string>): Promise<number>;
4
+ declare function isMainModule(metaUrl: string, argvPath: string | undefined, realpath?: (path: string) => string): boolean;
4
5
  //#endregion
5
- export { main };
6
+ export { isMainModule, main };
package/dist/cli.mjs CHANGED
@@ -9,43 +9,43 @@ function createCli() {
9
9
  const cli = cac("intent");
10
10
  cli.usage("<command> [options]");
11
11
  cli.command("list", "Discover intent-enabled packages from the project or workspace").usage("list [--json] [--debug] [--exclude <pattern>] [--global] [--global-only]").option("--json", "Output JSON").option("--debug", "Print discovery debug details to stderr").option("--exclude <pattern>", "Exclude package name glob").option("--global", "Include global packages after project packages").option("--global-only", "List global packages only").example("list").example("list --json").example("list --global").action(async (options) => {
12
- const { runListCommand } = await import("./list-CxSm8YYl.mjs");
12
+ const { runListCommand } = await import("./list-DQxqa1AT.mjs");
13
13
  await runListCommand(options);
14
14
  });
15
15
  cli.command("load [use]", "Load a compact skill use and print its SKILL.md").usage("load <use> [--path] [--json] [--debug] [--exclude <pattern>] [--global] [--global-only]").option("--path", "Print the resolved skill path instead of file content").option("--json", "Output JSON").option("--debug", "Print resolution debug details to stderr").option("--exclude <pattern>", "Exclude package name glob").option("--global", "Load from project packages, then global packages").option("--global-only", "Load from global packages only").example("load @tanstack/query#core").example("load @tanstack/query#core --path").action(async (use, options) => {
16
- const { runLoadCommand } = await import("./load-DF-zIT3-.mjs");
16
+ const { runLoadCommand } = await import("./load-3ACx3170.mjs");
17
17
  await runLoadCommand(use, options);
18
18
  });
19
19
  cli.command("meta [name]", "List meta-skills, or print one by name").usage("meta [name]").example("meta").example("meta domain-discovery").action(async (name) => {
20
- const [{ getMetaDir }, { runMetaCommand }] = await Promise.all([import("./cli-support-Cb9lNXhL.mjs"), import("./meta-BNSVXFQu.mjs")]);
20
+ const [{ getMetaDir }, { runMetaCommand }] = await Promise.all([import("./cli-support-B26oUGbf.mjs"), import("./meta-DZgsju5x.mjs")]);
21
21
  await runMetaCommand(name, getMetaDir());
22
22
  });
23
23
  cli.command("validate [dir]", "Validate skill files").usage("validate [dir] [--github-summary]").option("--github-summary", "Write a GitHub Actions step summary").example("validate").example("validate packages/query/skills").action(async (dir, options) => {
24
- const { runValidateCommand } = await import("./validate-Divq4AiV.mjs");
24
+ const { runValidateCommand } = await import("./validate-D0n-rBpp.mjs");
25
25
  await runValidateCommand(dir, options);
26
26
  });
27
27
  cli.command("install", "Create or update skill loading guidance in an agent config file").usage("install [--map] [--dry-run] [--print-prompt] [--global] [--global-only]").option("--map", "Write explicit skill-to-task mappings").option("--dry-run", "Print the generated block without writing").option("--print-prompt", "Print the legacy agent setup prompt instead of writing").option("--global", "Include global packages after project packages").option("--global-only", "Install mappings from global packages only").example("install").example("install --map").example("install --dry-run").example("install --print-prompt").example("install --global").action(async (options) => {
28
- const [{ scanIntentsOrFail }, { runInstallCommand }] = await Promise.all([import("./cli-support-Cb9lNXhL.mjs"), import("./install-ChddjnhO.mjs")]);
28
+ const [{ scanIntentsOrFail }, { runInstallCommand }] = await Promise.all([import("./cli-support-B26oUGbf.mjs"), import("./install-t4jkDdD0.mjs")]);
29
29
  await runInstallCommand(options, scanIntentsOrFail);
30
30
  });
31
31
  cli.command("scaffold", "Print maintainer scaffold prompt").usage("scaffold").action(async () => {
32
- const [{ getMetaDir }, { runScaffoldCommand }] = await Promise.all([import("./cli-support-Cb9lNXhL.mjs"), import("./scaffold-D2vwv9ls.mjs")]);
32
+ const [{ getMetaDir }, { runScaffoldCommand }] = await Promise.all([import("./cli-support-B26oUGbf.mjs"), import("./scaffold-CLM6bt3c.mjs")]);
33
33
  runScaffoldCommand(getMetaDir());
34
34
  });
35
35
  cli.command("stale [dir]", "Check skills for staleness in the current package or workspace").usage("stale [dir] [--json] [--github-review]").option("--json", "Output JSON").option("--github-review", "Write GitHub Actions review PR files").option("--package-label <label>", "Fallback package label for review PRs").example("stale").example("stale packages/query").example("stale --json").action(async (targetDir, options) => {
36
- const [{ resolveStaleTargets }, { runStaleCommand }] = await Promise.all([import("./cli-support-Cb9lNXhL.mjs"), import("./stale-flPZnWfI.mjs")]);
36
+ const [{ resolveStaleTargets }, { runStaleCommand }] = await Promise.all([import("./cli-support-B26oUGbf.mjs"), import("./stale-C6dPKQ98.mjs")]);
37
37
  await runStaleCommand(targetDir, options, resolveStaleTargets);
38
38
  });
39
39
  cli.command("edit-package-json", "Update package.json files so skills are published").usage("edit-package-json").action(async () => {
40
- const { runEditPackageJsonCommand } = await import("./edit-package-json-CzWlMXOf.mjs");
40
+ const { runEditPackageJsonCommand } = await import("./edit-package-json-CtuelQ_q.mjs");
41
41
  await runEditPackageJsonCommand(process.cwd());
42
42
  });
43
43
  cli.command("setup", "Copy Intent CI workflow templates into .github/workflows/").usage("setup").action(async () => {
44
- const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-Cb9lNXhL.mjs"), import("./setup-github-actions-emXSyGy3.mjs")]);
44
+ const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-B26oUGbf.mjs"), import("./setup-github-actions-CUd1oncY.mjs")]);
45
45
  await runSetupGithubActionsCommand(process.cwd(), getMetaDir());
46
46
  });
47
47
  cli.command("setup-github-actions", "Copy Intent CI workflow templates into .github/workflows/").usage("setup-github-actions").action(async () => {
48
- const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-Cb9lNXhL.mjs"), import("./setup-github-actions-emXSyGy3.mjs")]);
48
+ const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-B26oUGbf.mjs"), import("./setup-github-actions-CUd1oncY.mjs")]);
49
49
  await runSetupGithubActionsCommand(process.cwd(), getMetaDir());
50
50
  });
51
51
  cli.command("help [command]", "Display help for a command").action((commandName) => {
@@ -91,14 +91,18 @@ async function main(argv = process.argv.slice(2)) {
91
91
  throw err;
92
92
  }
93
93
  }
94
- let isMain = false;
95
- try {
96
- isMain = process.argv[1] !== void 0 && fileURLToPath(import.meta.url) === realpathSync(process.argv[1]);
97
- } catch {}
98
- if (isMain) {
94
+ function isMainModule(metaUrl, argvPath, realpath = realpathSync) {
95
+ if (argvPath === void 0) return false;
96
+ try {
97
+ return fileURLToPath(metaUrl) === realpath(argvPath);
98
+ } catch {
99
+ return false;
100
+ }
101
+ }
102
+ if (isMainModule(import.meta.url, process.argv[1])) {
99
103
  const exitCode = await main();
100
104
  process.exit(exitCode);
101
105
  }
102
106
 
103
107
  //#endregion
104
- export { main };
108
+ export { isMainModule, main };
@@ -0,0 +1,16 @@
1
+ //#region src/command-runner.ts
2
+ const runnerByPackageManager = {
3
+ bun: "bunx @tanstack/intent@latest",
4
+ npm: "npx @tanstack/intent@latest",
5
+ pnpm: "pnpm dlx @tanstack/intent@latest",
6
+ unknown: "npx @tanstack/intent@latest",
7
+ yarn: "yarn dlx @tanstack/intent@latest"
8
+ };
9
+ function formatIntentCommand(packageManager, args) {
10
+ const command = runnerByPackageManager[packageManager];
11
+ const trimmedArgs = args.trim();
12
+ return trimmedArgs ? `${command} ${trimmedArgs}` : command;
13
+ }
14
+
15
+ //#endregion
16
+ export { formatIntentCommand as t };
@@ -1,9 +1,9 @@
1
- import { o as resolveDepDir, r as getDeps, s as toPosixPath } from "./utils-BPDvfmcd.mjs";
2
- import { n as scanIntentPackageAtRoot, r as createIntentFsCache, t as scanForIntents } from "./scanner-BGyQTQ3U.mjs";
3
- import { n as findWorkspacePackages } from "./workspace-patterns-CIJQCwbJ.mjs";
1
+ import { c as resolveDepDir, i as getDeps, l as toPosixPath } from "./utils-CF7OL__5.mjs";
2
+ import { n as scanIntentPackageAtRoot, r as createIntentFsCache, t as scanForIntents } from "./scanner-QujEINYm.mjs";
3
+ import { n as findWorkspacePackages } from "./workspace-patterns-FljtM2Xb.mjs";
4
4
  import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-umYvZl94.mjs";
5
- import { t as resolveProjectContext } from "./project-context-Bv9BDh8B.mjs";
6
- import { a as compileExcludePatterns, c as warningMentionsPackage, i as resolveSkillUse, o as getEffectiveExcludePatterns, r as resolveSkillEntry, s as isPackageExcluded, t as ResolveSkillUseError } from "./resolver-BDsZ3kWg.mjs";
5
+ import { t as resolveProjectContext } from "./project-context-4wzbLY9c.mjs";
6
+ import { a as compileExcludePatterns, c as warningMentionsPackage, i as resolveSkillUse, o as getEffectiveExcludePatterns, r as resolveSkillEntry, s as isPackageExcluded, t as ResolveSkillUseError } from "./resolver-D8sX72Lg.mjs";
7
7
  import { existsSync, readFileSync, realpathSync } from "node:fs";
8
8
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
9
9
 
@@ -239,13 +239,14 @@ function addCandidateDir(candidates, seen, dir) {
239
239
  }
240
240
  function findVisibleDependencyDir(packageName, fromDir) {
241
241
  let dir = fromDir;
242
- while (true) {
242
+ let prev;
243
+ while (dir !== prev) {
243
244
  const candidate = join(dir, "node_modules", packageName);
244
245
  if (existsSync(join(candidate, "package.json"))) return candidate;
245
- const next = dirname(dir);
246
- if (next === dir) return null;
247
- dir = next;
246
+ prev = dir;
247
+ dir = dirname(dir);
248
248
  }
249
+ return null;
249
250
  }
250
251
  function resolveDependencyPackageDir(packageName, fromDir) {
251
252
  return findVisibleDependencyDir(packageName, fromDir) ?? resolveDepDir(packageName, fromDir);
@@ -266,7 +267,7 @@ function getDirectLoadFastPathCandidateDirs(packageName, context, cwd) {
266
267
  addCandidateDir(candidates, seen, resolveDependencyPackageDir(packageName, context.packageRoot ?? cwd));
267
268
  return candidates;
268
269
  }
269
- addCandidateDir(candidates, seen, resolveDependencyPackageDir(packageName, context.packageRoot ?? context.workspaceRoot ?? cwd));
270
+ addCandidateDir(candidates, seen, resolveDependencyPackageDir(packageName, context.packageRoot ?? context.workspaceRoot));
270
271
  if (context.workspaceRoot && context.workspaceRoot !== context.packageRoot) addCandidateDir(candidates, seen, resolveDependencyPackageDir(packageName, context.workspaceRoot));
271
272
  return candidates;
272
273
  }
@@ -365,20 +366,22 @@ function listIntentSkills(options = {}) {
365
366
  const excludeMatchers = compileExcludePatterns(excludePatterns);
366
367
  const excludedPackages = scanResult.packages.filter((pkg) => isPackageExcluded(pkg.name, excludeMatchers)).map((pkg) => pkg.name);
367
368
  const packages = scanResult.packages.filter((pkg) => !isPackageExcluded(pkg.name, excludeMatchers));
369
+ const skills = packages.flatMap((pkg) => pkg.skills.map((skill) => {
370
+ return {
371
+ use: formatSkillUse(pkg.name, skill.name),
372
+ packageName: pkg.name,
373
+ packageRoot: pkg.packageRoot,
374
+ packageVersion: pkg.version,
375
+ packageSource: pkg.source,
376
+ skillName: skill.name,
377
+ description: skill.description,
378
+ type: skill.type,
379
+ framework: skill.framework
380
+ };
381
+ }));
368
382
  const result = {
369
- skills: packages.flatMap((pkg) => pkg.skills.map((skill) => {
370
- return {
371
- use: formatSkillUse(pkg.name, skill.name),
372
- packageName: pkg.name,
373
- packageRoot: pkg.packageRoot,
374
- packageVersion: pkg.version,
375
- packageSource: pkg.source,
376
- skillName: skill.name,
377
- description: skill.description,
378
- type: skill.type,
379
- framework: skill.framework
380
- };
381
- })),
383
+ packageManager: scanResult.packageManager,
384
+ skills,
382
385
  packages: packages.map((pkg) => ({
383
386
  name: pkg.name,
384
387
  version: pkg.version,
package/dist/core.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { g as ScanStats, h as ScanScope, l as IntentPackage, x as VersionConflict } from "./types-Cq5cY9h9.mjs";
1
+ import { S as VersionConflict, _ as ScanStats, g as ScanScope, l as IntentPackage, p as PackageManager } from "./types-CIha6LtJ.mjs";
2
2
 
3
3
  //#region src/core/types.d.ts
4
4
  interface IntentCoreOptions {
@@ -27,6 +27,7 @@ interface IntentPackageSummary {
27
27
  skillCount: number;
28
28
  }
29
29
  interface IntentSkillList {
30
+ packageManager: PackageManager;
30
31
  skills: Array<IntentSkillSummary>;
31
32
  packages: Array<IntentPackageSummary>;
32
33
  warnings: Array<string>;
package/dist/core.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import "./utils-BPDvfmcd.mjs";
2
- import "./skill-paths-BHbdWniB.mjs";
3
- import "./scanner-BGyQTQ3U.mjs";
4
- import "./workspace-patterns-CIJQCwbJ.mjs";
5
- import "./project-context-Bv9BDh8B.mjs";
6
- import "./resolver-BDsZ3kWg.mjs";
7
- import { i as resolveIntentSkill, n as listIntentSkills, r as loadIntentSkill, t as IntentCoreError } from "./core-BOSjgetf.mjs";
1
+ import "./utils-CF7OL__5.mjs";
2
+ import "./skill-paths-Cc0-Y331.mjs";
3
+ import "./scanner-QujEINYm.mjs";
4
+ import "./workspace-patterns-FljtM2Xb.mjs";
5
+ import "./project-context-4wzbLY9c.mjs";
6
+ import "./resolver-D8sX72Lg.mjs";
7
+ import { i as resolveIntentSkill, n as listIntentSkills, r as loadIntentSkill, t as IntentCoreError } from "./core-CEeo37aT.mjs";
8
8
 
9
9
  export { IntentCoreError, listIntentSkills, loadIntentSkill, resolveIntentSkill };
@@ -1,4 +1,5 @@
1
- import { n as isStableLoadPath, t as formatRuntimeSkillLookupHint } from "./skill-paths-BHbdWniB.mjs";
1
+ import "./utils-CF7OL__5.mjs";
2
+ import { n as isStableLoadPath, t as formatRuntimeSkillLookupHint } from "./skill-paths-Cc0-Y331.mjs";
2
3
 
3
4
  //#region src/display.ts
4
5
  function padColumn(text, width) {
@@ -17,6 +18,7 @@ function printSkillLine(displayName, skill, indent, opts) {
17
18
  const padding = " ".repeat(Math.max(2, opts.nameWidth - nameStr.length));
18
19
  const typeCol = opts.showTypes ? (skill.type ? `[${skill.type}]` : "").padEnd(14) : "";
19
20
  console.log(`${nameStr}${padding}${typeCol}${skill.description}`);
21
+ if (skill.loadCommand) console.log(`${" ".repeat(indent + 2)}Load: ${skill.loadCommand}`);
20
22
  if (skill.path) {
21
23
  const pathIndent = " ".repeat(indent + 2);
22
24
  if (isStableLoadPath(skill.path)) console.log(`${pathIndent}${skill.path}`);
@@ -29,6 +31,7 @@ function printSkillLine(displayName, skill, indent, opts) {
29
31
  function printSkillTree(skills, opts) {
30
32
  const roots = [];
31
33
  const children = /* @__PURE__ */ new Map();
34
+ const printedSkills = /* @__PURE__ */ new Set();
32
35
  for (const skill of skills) {
33
36
  const slashIdx = skill.name.indexOf("/");
34
37
  if (slashIdx === -1) roots.push(skill.name);
@@ -45,7 +48,15 @@ function printSkillTree(skills, opts) {
45
48
  const rootSkill = skills.find((s) => s.name === rootName);
46
49
  if (!rootSkill) continue;
47
50
  printSkillLine(rootName, rootSkill, 4, opts);
48
- for (const sub of children.get(rootName) ?? []) printSkillLine(sub.name.slice(sub.name.indexOf("/") + 1), sub, 6, opts);
51
+ printedSkills.add(rootSkill.name);
52
+ for (const sub of children.get(rootName) ?? []) {
53
+ printSkillLine(sub.name.slice(sub.name.indexOf("/") + 1), sub, 6, opts);
54
+ printedSkills.add(sub.name);
55
+ }
56
+ }
57
+ for (const skill of skills) {
58
+ if (printedSkills.has(skill.name)) continue;
59
+ printSkillLine(skill.name, skill, 4, opts);
49
60
  }
50
61
  }
51
62
  function computeSkillNameWidth(allPackageSkills) {
@@ -60,4 +71,4 @@ function computeSkillNameWidth(allPackageSkills) {
60
71
  }
61
72
 
62
73
  //#endregion
63
- export { printSkillTree as n, printTable as r, computeSkillNameWidth as t };
74
+ export { computeSkillNameWidth, printSkillTree, printTable };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as SkillEntry, a as IntentArtifactSet, b as StalenessSignal, c as IntentConfig, d as MetaFeedbackPayload, f as MetaSkillName, i as IntentArtifactFile, l as IntentPackage, m as ScanResult, n as FeedbackPayload, o as IntentArtifactSkill, p as ScanOptions, r as IntentArtifactCoverageIgnore, s as IntentArtifactWarning, t as AgentName, u as IntentProjectConfig, v as SkillStaleness, x as VersionConflict, y as StalenessReport } from "./types-Cq5cY9h9.mjs";
2
- import { i as runEditPackageJson, o as runSetupGithubActions, r as SetupGithubActionsResult, t as EditPackageJsonResult } from "./setup-2SE9zYJk.mjs";
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-CIha6LtJ.mjs";
2
+ import { i as runEditPackageJson, o as runSetupGithubActions, r as SetupGithubActionsResult, t as EditPackageJsonResult } from "./setup-DhMqESd3.mjs";
3
3
 
4
4
  //#region src/scanner.d.ts
5
5
  declare function scanForIntents(root?: string, options?: ScanOptions): ScanResult;
package/dist/index.mjs CHANGED
@@ -1,14 +1,14 @@
1
- import { a as parseFrontmatter, n as findSkillFiles, o as resolveDepDir, r as getDeps } from "./utils-BPDvfmcd.mjs";
2
- import "./skill-paths-BHbdWniB.mjs";
3
- import { t as scanForIntents } from "./scanner-BGyQTQ3U.mjs";
4
- import "./workspace-patterns-CIJQCwbJ.mjs";
1
+ import { c as resolveDepDir, i as getDeps, r as findSkillFiles, s as parseFrontmatter } from "./utils-CF7OL__5.mjs";
2
+ import "./skill-paths-Cc0-Y331.mjs";
3
+ import { t as scanForIntents } from "./scanner-QujEINYm.mjs";
4
+ import "./workspace-patterns-FljtM2Xb.mjs";
5
5
  import { t as readIntentArtifacts } from "./artifact-coverage-DgWuVqUp.mjs";
6
- import { n as checkStaleness } from "./staleness-CGLs-swr.mjs";
7
- import { n as collectStaleReviewItems, r as createFailedStaleReviewItem, t as buildStaleReviewBody } from "./workflow-review-CwcR2ge4.mjs";
6
+ import { n as checkStaleness } from "./staleness-BwcLygsY.mjs";
7
+ import { n as collectStaleReviewItems, r as createFailedStaleReviewItem, t as buildStaleReviewBody } from "./workflow-review-D9Fg1G0P.mjs";
8
8
  import { i as parseSkillUse, n as formatSkillUse, r as isSkillUseParseError, t as SkillUseParseError } from "./skill-use-umYvZl94.mjs";
9
- import "./project-context-Bv9BDh8B.mjs";
10
- import { i as resolveSkillUse, n as isResolveSkillUseError, t as ResolveSkillUseError } from "./resolver-BDsZ3kWg.mjs";
11
- import { r as runSetupGithubActions, t as runEditPackageJson } from "./setup-DQMKxEoA.mjs";
9
+ import "./project-context-4wzbLY9c.mjs";
10
+ import { i as resolveSkillUse, n as isResolveSkillUseError, t as ResolveSkillUseError } from "./resolver-D8sX72Lg.mjs";
11
+ import { r as runSetupGithubActions, t as runEditPackageJson } from "./setup-BElEzHxS.mjs";
12
12
  import { readFileSync, writeFileSync } from "node:fs";
13
13
  import { join } from "node:path";
14
14
  import { execFileSync, execSync } from "node:child_process";
@@ -1,6 +1,11 @@
1
+ import "./utils-CF7OL__5.mjs";
2
+ import "./workspace-patterns-FljtM2Xb.mjs";
3
+ import { t as detectPackageManager } from "./package-manager-BUgTjW9Q.mjs";
1
4
  import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-umYvZl94.mjs";
5
+ import "./project-context-4wzbLY9c.mjs";
2
6
  import { t as fail } from "./cli-error-BrMXlbtx.mjs";
3
- import { c as scanOptionsFromGlobalFlags, l as printWarnings } from "./cli-support-DtqVDiJv.mjs";
7
+ import { c as scanOptionsFromGlobalFlags, l as printWarnings } from "./cli-support-C-t4xQw0.mjs";
8
+ import { t as formatIntentCommand } from "./command-runner-C0yCOHLi.mjs";
4
9
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
5
10
  import { dirname, join, relative } from "node:path";
6
11
  import { parse } from "yaml";
@@ -126,7 +131,7 @@ function formatWhen(packageName, skill) {
126
131
  function buildIntentSkillsBlock(scanResult) {
127
132
  const lines = [
128
133
  INTENT_SKILLS_START,
129
- "# Skill mappings - load `use` with `npx @tanstack/intent@latest load <use>`.",
134
+ `# Skill mappings - load \`use\` with \`${formatIntentCommand(scanResult.packageManager, "load <use>")}\`.`,
130
135
  "skills:"
131
136
  ];
132
137
  let mappingCount = 0;
@@ -143,15 +148,17 @@ function buildIntentSkillsBlock(scanResult) {
143
148
  mappingCount
144
149
  };
145
150
  }
146
- function buildIntentSkillGuidanceBlock() {
151
+ function buildIntentSkillGuidanceBlock(packageManager = "unknown") {
152
+ const listCommand = formatIntentCommand(packageManager, "list");
153
+ const loadCommand = formatIntentCommand(packageManager, "load <package>#<skill>");
147
154
  return {
148
155
  block: `${[
149
156
  INTENT_SKILLS_START,
150
157
  "## Skill Loading",
151
158
  "",
152
159
  "Before substantial work:",
153
- "- Skill check: run `npx @tanstack/intent@latest list`, or use skills already listed in context.",
154
- "- Skill guidance: if one local skill clearly matches the task, run `npx @tanstack/intent@latest load <package>#<skill>` and follow the returned `SKILL.md`.",
160
+ `- Skill check: run \`${listCommand}\`, or use skills already listed in context.`,
161
+ `- Skill guidance: if one local skill clearly matches the task, run \`${loadCommand}\` and follow the returned \`SKILL.md\`.`,
155
162
  "- Monorepos: when working across packages, run the skill check from the workspace root and prefer the local skill for the package being changed.",
156
163
  "- 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.",
157
164
  INTENT_SKILLS_END
@@ -376,9 +383,9 @@ async function runInstallCommand(options, scanIntentsOrFail) {
376
383
  console.log(INSTALL_PROMPT);
377
384
  return;
378
385
  }
379
- scanOptionsFromGlobalFlags(options);
386
+ const scanOptions = scanOptionsFromGlobalFlags(options);
380
387
  if (!options.map) {
381
- const generated$1 = buildIntentSkillGuidanceBlock();
388
+ const generated$1 = buildIntentSkillGuidanceBlock(detectPackageManager());
382
389
  if (options.dryRun) {
383
390
  const targetPath = resolveIntentSkillsBlockTargetPath(process.cwd(), 1);
384
391
  console.log(`Generated skill loading guidance for ${formatTargetPath(targetPath)}.`);
@@ -401,7 +408,7 @@ async function runInstallCommand(options, scanIntentsOrFail) {
401
408
  printPlacementTip(result$1.targetPath);
402
409
  return;
403
410
  }
404
- const scanResult = await scanIntentsOrFail(scanOptionsFromGlobalFlags(options));
411
+ const scanResult = await scanIntentsOrFail(scanOptions);
405
412
  const generated = buildIntentSkillsBlock(scanResult);
406
413
  if (options.dryRun) {
407
414
  const targetPath = resolveIntentSkillsBlockTargetPath(process.cwd(), generated.mappingCount);
@@ -435,4 +442,4 @@ async function runInstallCommand(options, scanIntentsOrFail) {
435
442
  }
436
443
 
437
444
  //#endregion
438
- export { runInstallCommand as n, INSTALL_PROMPT as t };
445
+ export { INSTALL_PROMPT, runInstallCommand };
@@ -1,11 +1,12 @@
1
- import "./utils-BPDvfmcd.mjs";
2
- import "./skill-paths-BHbdWniB.mjs";
3
- import "./scanner-BGyQTQ3U.mjs";
4
- import "./workspace-patterns-CIJQCwbJ.mjs";
5
- import "./project-context-Bv9BDh8B.mjs";
6
- import "./resolver-BDsZ3kWg.mjs";
7
- import { a as printDebugInfo, l as printWarnings, n as coreOptionsFromGlobalFlags } from "./cli-support-DtqVDiJv.mjs";
8
- import { n as listIntentSkills } from "./core-BOSjgetf.mjs";
1
+ import "./utils-CF7OL__5.mjs";
2
+ import "./skill-paths-Cc0-Y331.mjs";
3
+ import "./scanner-QujEINYm.mjs";
4
+ import "./workspace-patterns-FljtM2Xb.mjs";
5
+ import "./project-context-4wzbLY9c.mjs";
6
+ import "./resolver-D8sX72Lg.mjs";
7
+ import { n as listIntentSkills } from "./core-CEeo37aT.mjs";
8
+ import { a as printDebugInfo, l as printWarnings, n as coreOptionsFromGlobalFlags } from "./cli-support-C-t4xQw0.mjs";
9
+ import { t as formatIntentCommand } from "./command-runner-C0yCOHLi.mjs";
9
10
 
10
11
  //#region src/commands/list.ts
11
12
  function printListDebug(result) {
@@ -47,15 +48,18 @@ function groupSkillsByPackageRoot(skills) {
47
48
  function getPackageSkills(pkg, skillsByPackageRoot) {
48
49
  return skillsByPackageRoot.get(pkg.packageRoot) ?? [];
49
50
  }
51
+ function formatLoadCommand(skill, packageManager, scopeFlag) {
52
+ return formatIntentCommand(packageManager, `load ${skill.use}${scopeFlag}`);
53
+ }
50
54
  async function runListCommand(options, _scanIntentsOrFail) {
51
55
  const result = listIntentSkills(coreOptionsFromGlobalFlags(options));
52
56
  printListDebug(result);
53
57
  if (options.json) {
54
- const { debug: _debug, ...jsonResult } = result;
58
+ const { debug: _debug, packageManager: _packageManager, ...jsonResult } = result;
55
59
  console.log(JSON.stringify(jsonResult, null, 2));
56
60
  return;
57
61
  }
58
- const { computeSkillNameWidth, printSkillTree, printTable } = await import("./display-CmLzVAae.mjs");
62
+ const { computeSkillNameWidth, printSkillTree, printTable } = await import("./display-BdSvrwWJ.mjs");
59
63
  if (result.packages.length === 0) {
60
64
  console.log("No intent-enabled packages found.");
61
65
  if (result.warnings.length > 0) {
@@ -84,12 +88,14 @@ async function runListCommand(options, _scanIntentsOrFail) {
84
88
  type: skill.type
85
89
  }))));
86
90
  const showTypes = result.skills.some((skill) => skill.type);
91
+ const scopeFlag = options.globalOnly ? " --global-only" : options.global ? " --global" : "";
87
92
  console.log(`\nSkills:\n`);
88
93
  for (const pkg of result.packages) {
89
94
  console.log(` ${pkg.name}`);
90
95
  printSkillTree(getPackageSkills(pkg, skillsByPackageRoot).map((skill) => ({
91
96
  name: skill.skillName,
92
97
  description: skill.description,
98
+ loadCommand: formatLoadCommand(skill, result.packageManager, scopeFlag),
93
99
  type: skill.type
94
100
  })), {
95
101
  nameWidth,
@@ -1,12 +1,12 @@
1
- import "./utils-BPDvfmcd.mjs";
2
- import "./skill-paths-BHbdWniB.mjs";
3
- import "./scanner-BGyQTQ3U.mjs";
4
- import "./workspace-patterns-CIJQCwbJ.mjs";
5
- import "./project-context-Bv9BDh8B.mjs";
6
- import "./resolver-BDsZ3kWg.mjs";
1
+ import "./utils-CF7OL__5.mjs";
2
+ import "./skill-paths-Cc0-Y331.mjs";
3
+ import "./scanner-QujEINYm.mjs";
4
+ import "./workspace-patterns-FljtM2Xb.mjs";
5
+ import "./project-context-4wzbLY9c.mjs";
6
+ import "./resolver-D8sX72Lg.mjs";
7
7
  import { t as fail } from "./cli-error-BrMXlbtx.mjs";
8
- import { a as printDebugInfo, n as coreOptionsFromGlobalFlags } from "./cli-support-DtqVDiJv.mjs";
9
- import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-BOSjgetf.mjs";
8
+ import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-CEeo37aT.mjs";
9
+ import { a as printDebugInfo, n as coreOptionsFromGlobalFlags } from "./cli-support-C-t4xQw0.mjs";
10
10
 
11
11
  //#region src/commands/load.ts
12
12
  function printLoadDebug(loaded) {
@@ -16,7 +16,7 @@ async function runMetaCommand(name, metaDir) {
16
16
  }
17
17
  return;
18
18
  }
19
- const { parseFrontmatter } = await import("./utils-DqdIC3RY.mjs");
19
+ const { parseFrontmatter } = await import("./utils-DTvYXAsM.mjs");
20
20
  const entries = readdirSync(metaDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => existsSync(join(metaDir, entry.name, "SKILL.md")));
21
21
  if (entries.length === 0) {
22
22
  console.log("No meta-skills found.");
@@ -0,0 +1,48 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { dirname, join, resolve } from "node:path";
3
+
4
+ //#region src/package-manager.ts
5
+ function readPackageManagerField(dir) {
6
+ try {
7
+ const parsed = JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
8
+ if (!parsed || typeof parsed !== "object") return null;
9
+ const value = parsed.packageManager;
10
+ if (typeof value !== "string") return null;
11
+ if (value.startsWith("pnpm@")) return "pnpm";
12
+ if (value.startsWith("yarn@")) return "yarn";
13
+ if (value.startsWith("bun@")) return "bun";
14
+ if (value.startsWith("npm@")) return "npm";
15
+ } catch {
16
+ return null;
17
+ }
18
+ return null;
19
+ }
20
+ function detectPackageManagerInDir(dir) {
21
+ const packageManager = readPackageManagerField(dir);
22
+ if (packageManager) return packageManager;
23
+ if (existsSync(join(dir, ".pnp.cjs")) || existsSync(join(dir, ".pnp.js"))) return "yarn";
24
+ if (existsSync(join(dir, "pnpm-lock.yaml"))) return "pnpm";
25
+ if (existsSync(join(dir, "bun.lockb")) || existsSync(join(dir, "bun.lock"))) return "bun";
26
+ if (existsSync(join(dir, "yarn.lock"))) return "yarn";
27
+ if (existsSync(join(dir, "package-lock.json"))) return "npm";
28
+ return null;
29
+ }
30
+ function detectPackageManager(cwd = process.cwd(), extraDirs = []) {
31
+ const seen = /* @__PURE__ */ new Set();
32
+ const startDirs = [cwd, ...extraDirs].filter((dir) => Boolean(dir));
33
+ for (const startDir of startDirs) {
34
+ let dir = resolve(startDir);
35
+ while (!seen.has(dir)) {
36
+ seen.add(dir);
37
+ const packageManager = detectPackageManagerInDir(dir);
38
+ if (packageManager) return packageManager;
39
+ const next = dirname(dir);
40
+ if (next === dir) break;
41
+ dir = next;
42
+ }
43
+ }
44
+ return "unknown";
45
+ }
46
+
47
+ //#endregion
48
+ export { detectPackageManager as t };
@@ -1,4 +1,4 @@
1
- import { a as readWorkspacePatterns, r as findWorkspaceRoot } from "./workspace-patterns-CIJQCwbJ.mjs";
1
+ import { a as readWorkspacePatterns, r as findWorkspaceRoot } from "./workspace-patterns-FljtM2Xb.mjs";
2
2
  import { existsSync, statSync } from "node:fs";
3
3
  import { dirname, join, relative, resolve } from "node:path";
4
4
 
@@ -26,12 +26,13 @@ function resolveProjectContext({ cwd, targetPath }) {
26
26
  }
27
27
  function findOwningPackageRoot(startPath) {
28
28
  let dir = toSearchDir(startPath);
29
- while (true) {
29
+ let prev;
30
+ while (dir !== prev) {
30
31
  if (existsSync(join(dir, "package.json"))) return dir;
31
- const next = dirname(dir);
32
- if (next === dir) return null;
33
- dir = next;
32
+ prev = dir;
33
+ dir = dirname(dir);
34
34
  }
35
+ return null;
35
36
  }
36
37
  function toSearchDir(path) {
37
38
  if (!existsSync(path)) return path;
@@ -1,5 +1,5 @@
1
1
  import { i as parseSkillUse } from "./skill-use-umYvZl94.mjs";
2
- import { t as resolveProjectContext } from "./project-context-Bv9BDh8B.mjs";
2
+ import { t as resolveProjectContext } from "./project-context-4wzbLY9c.mjs";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
5
5
 
@@ -73,15 +73,14 @@ function isPackageExcluded(packageName, matchers) {
73
73
  return matchers.some((matcher) => matcher.matches(packageName));
74
74
  }
75
75
  function warningMentionsPackage(warning, packageName) {
76
- let fromIndex = 0;
77
- while (true) {
78
- const idx = warning.indexOf(packageName, fromIndex);
79
- if (idx === -1) return false;
76
+ let idx = warning.indexOf(packageName);
77
+ while (idx !== -1) {
80
78
  const before = warning[idx - 1];
81
79
  const after = warning[idx + packageName.length];
82
80
  if ((before === void 0 || PACKAGE_NAME_BOUNDARY.test(before)) && (after === void 0 || PACKAGE_NAME_BOUNDARY.test(after))) return true;
83
- fromIndex = idx + packageName.length;
81
+ idx = warning.indexOf(packageName, idx + packageName.length);
84
82
  }
83
+ return false;
85
84
  }
86
85
 
87
86
  //#endregion
@@ -0,0 +1,6 @@
1
+ import "./utils-CF7OL__5.mjs";
2
+ import "./skill-paths-Cc0-Y331.mjs";
3
+ import { n as scanIntentPackageAtRoot, t as scanForIntents } from "./scanner-QujEINYm.mjs";
4
+ import "./workspace-patterns-FljtM2Xb.mjs";
5
+
6
+ export { scanForIntents };