@tanstack/intent 0.2.0 → 0.2.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.
@@ -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 "./cli-support-BQSl7gAE.mjs";
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 "./cli-support-z64kSJOO.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-hMYcpIgm.mjs");
51
+ const { scanForPolicedIntents } = await import("./source-policy-CTeI29oF.mjs");
52
52
  try {
53
53
  const { scan } = scanForPolicedIntents({
54
54
  cwd: process.cwd(),
package/dist/cli.mjs CHANGED
@@ -8,7 +8,7 @@ function createCli() {
8
8
  const cli = cac("intent");
9
9
  cli.usage("<command> [options]");
10
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-9SbFGUd5.mjs");
11
+ const { runListCommand } = await import("./list-C-eGocZP.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,27 +16,27 @@ 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-BY8vh7Gp.mjs");
19
+ const { runLoadCommand } = await import("./load-DDNrmeBz.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("./cli-support-DK1Kq8Ue.mjs"), import("./meta-CF4XIYOo.mjs")]);
23
+ const [{ getMetaDir }, { runMetaCommand }] = await Promise.all([import("./cli-support-BANzHEBM.mjs"), import("./meta-CF4XIYOo.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-BSfTOq0v.mjs");
27
+ const { runValidateCommand } = await import("./validate-BAU0uzvQ.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("./cli-support-DK1Kq8Ue.mjs"), import("./install-CTGQvXoB.mjs")]);
31
+ const [{ scanIntentsOrFail }, { runInstallCommand }] = await Promise.all([import("./cli-support-BANzHEBM.mjs"), import("./install-Bv2qdHwd.mjs")]);
32
32
  await runInstallCommand(options, scanIntentsOrFail);
33
33
  });
34
34
  cli.command("scaffold", "Print maintainer scaffold prompt").usage("scaffold").action(async () => {
35
- const [{ getMetaDir }, { runScaffoldCommand }] = await Promise.all([import("./cli-support-DK1Kq8Ue.mjs"), import("./scaffold-D8TAMXvs.mjs")]);
35
+ const [{ getMetaDir }, { runScaffoldCommand }] = await Promise.all([import("./cli-support-BANzHEBM.mjs"), import("./scaffold-D8TAMXvs.mjs")]);
36
36
  runScaffoldCommand(getMetaDir());
37
37
  });
38
38
  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) => {
39
- const [{ resolveStaleTargets }, { runStaleCommand }] = await Promise.all([import("./cli-support-DK1Kq8Ue.mjs"), import("./stale-DhjSTIt-.mjs")]);
39
+ const [{ resolveStaleTargets }, { runStaleCommand }] = await Promise.all([import("./cli-support-BANzHEBM.mjs"), import("./stale-DhjSTIt-.mjs")]);
40
40
  await runStaleCommand(targetDir, options, resolveStaleTargets);
41
41
  });
42
42
  cli.command("edit-package-json", "Update package.json files so skills are published").usage("edit-package-json").action(async () => {
@@ -44,11 +44,11 @@ function createCli() {
44
44
  await runEditPackageJsonCommand(process.cwd());
45
45
  });
46
46
  cli.command("setup", "Copy Intent CI workflow templates into .github/workflows/").usage("setup").action(async () => {
47
- const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-DK1Kq8Ue.mjs"), import("./setup-github-actions-IxZTZihi.mjs")]);
47
+ const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-BANzHEBM.mjs"), import("./setup-github-actions-IxZTZihi.mjs")]);
48
48
  await runSetupGithubActionsCommand(process.cwd(), getMetaDir());
49
49
  });
50
50
  cli.command("setup-github-actions", "Copy Intent CI workflow templates into .github/workflows/").usage("setup-github-actions").action(async () => {
51
- const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-DK1Kq8Ue.mjs"), import("./setup-github-actions-IxZTZihi.mjs")]);
51
+ const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-BANzHEBM.mjs"), import("./setup-github-actions-IxZTZihi.mjs")]);
52
52
  await runSetupGithubActionsCommand(process.cwd(), getMetaDir());
53
53
  });
54
54
  cli.command("help [command]", "Display help for a command").action((commandName) => {
@@ -1,11 +1,11 @@
1
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-qT_M6nV5.mjs";
2
+ import { n as scanIntentPackageAtRoot, r as createIntentFsCache } from "./scanner-C5bzzri5.mjs";
3
3
  import { n as findWorkspacePackages } from "./workspace-patterns-BDoJIWk-.mjs";
4
4
  import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-B2xRF1i9.mjs";
5
5
  import { t as resolveProjectContext } from "./project-context-oi_m7paK.mjs";
6
6
  import { o as warningMentionsPackage, r as getEffectiveExcludePatterns, t as compileExcludePatterns } from "./excludes-ByvSbmmj.mjs";
7
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-DkR80hkL.mjs";
8
+ import { a as checkLoadAllowed, o as readSkillSourcesConfig, s as scanForPolicedIntents } from "./source-policy-D__bcpoU.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
@@ -403,7 +403,7 @@ function listIntentSkills(options = {}) {
403
403
  warningCount: result.warnings.length,
404
404
  noticeCount: result.notices.length,
405
405
  conflictCount: result.conflicts.length,
406
- scan: scan.stats ?? fsCache.getStats()
406
+ scan: scan.stats
407
407
  };
408
408
  return result;
409
409
  }
@@ -502,7 +502,7 @@ function resolveIntentSkillInCwd(cwd, use, options = {}) {
502
502
  excludes: excludePatterns,
503
503
  resolution: "full-scan",
504
504
  resolved,
505
- scan: scanResult.stats ?? fsCache.getStats(),
505
+ scan: scanResult.stats,
506
506
  scope
507
507
  }) : void 0);
508
508
  }
package/dist/core.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as VersionConflict, c as PackageManager, d as ScanScope, f as ScanStats, s as IntentPackage } from "./types-P6UfPVdp.mjs";
1
+ import { _ as VersionConflict, c as PackageManager, d as ScanScope, f as ScanStats, s as IntentPackage } from "./types-ByXUTBJ2.mjs";
2
2
 
3
3
  //#region src/core/types.d.ts
4
4
  interface IntentCoreOptions {
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-BRUBEMwe.mjs";
1
+ import { i as resolveIntentSkill, n as listIntentSkills, r as loadIntentSkill, t as IntentCoreError } from "./core-DaAr5MBD.mjs";
2
2
  export { IntentCoreError, listIntentSkills, loadIntentSkill, resolveIntentSkill };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
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-P6UfPVdp.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-ByXUTBJ2.mjs";
2
2
  import { i as runEditPackageJson, o as runSetupGithubActions, r as SetupGithubActionsResult, t as EditPackageJsonResult } from "./setup-CdfBc7Oe.mjs";
3
3
  import { closeSync, existsSync, lstatSync, openSync, readFileSync, readSync, readdirSync, realpathSync } from "node:fs";
4
4
 
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
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-qT_M6nV5.mjs";
2
+ import { t as scanForIntents } from "./scanner-C5bzzri5.mjs";
3
3
  import { t as readIntentArtifacts } from "./artifact-coverage-DFtI6V_H.mjs";
4
4
  import { n as checkStaleness } from "./staleness-DoZU3lzy.mjs";
5
5
  import { n as collectStaleReviewItems, r as createFailedStaleReviewItem, t as buildStaleReviewBody } from "./workflow-review-B4AfwtHH.mjs";
@@ -1,7 +1,7 @@
1
1
  import { t as detectPackageManager } from "./package-manager-Dw7lYcI0.mjs";
2
2
  import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-B2xRF1i9.mjs";
3
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-BQSl7gAE.mjs";
4
+ import { a as noticeOptionsFromGlobalFlags, l as printNotices, n as coreOptionsFromGlobalFlags, u as printWarnings } from "./cli-support-z64kSJOO.mjs";
5
5
  import { t as formatIntentCommand } from "./command-runner-B5OofX0E.mjs";
6
6
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
7
7
  import { dirname, join, relative } from "node:path";
@@ -1,5 +1,5 @@
1
- import { n as listIntentSkills } from "./core-BRUBEMwe.mjs";
2
- import { a as noticeOptionsFromGlobalFlags, l as printNotices, n as coreOptionsFromGlobalFlags, o as printDebugInfo, u as printWarnings } from "./cli-support-BQSl7gAE.mjs";
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
3
  import { t as formatIntentCommand } from "./command-runner-B5OofX0E.mjs";
4
4
  //#region src/commands/list.ts
5
5
  function printListDebug(result) {
@@ -1,6 +1,6 @@
1
1
  import { t as fail } from "./cli-error-DDAO6DIL.mjs";
2
- import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-BRUBEMwe.mjs";
3
- import { n as coreOptionsFromGlobalFlags, o as printDebugInfo } from "./cli-support-BQSl7gAE.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";
4
4
  //#region src/commands/load.ts
5
5
  function printLoadDebug(loaded) {
6
6
  if (!loaded.debug) return;
@@ -60,6 +60,7 @@ function createPackageRegistrar(opts) {
60
60
  intent,
61
61
  skills,
62
62
  packageRoot: dirPath,
63
+ kind: opts.getPackageKind(dirPath),
63
64
  source
64
65
  };
65
66
  const existingIndex = opts.packageIndexes.get(name);
@@ -430,6 +431,15 @@ function toVersionConflict(packageName, variants, chosen) {
430
431
  function getScanScope(options) {
431
432
  return options.scope ?? (options.includeGlobal ? "local-and-global" : "local");
432
433
  }
434
+ function createWorkspacePackageKeySet(workspaceRoot, getFsIdentity) {
435
+ if (!workspaceRoot) return /* @__PURE__ */ new Set();
436
+ return new Set(findWorkspacePackages(workspaceRoot).map((dir) => getFsIdentity(dir)));
437
+ }
438
+ function createPackageKindResolver(workspacePackageKeys, getFsIdentity) {
439
+ return (packageRoot) => {
440
+ return workspacePackageKeys.has(getFsIdentity(packageRoot)) ? "workspace" : "npm";
441
+ };
442
+ }
433
443
  function scanForIntents(root, options = {}) {
434
444
  const projectRoot = root ?? process.cwd();
435
445
  const scanScope = getScanScope(options);
@@ -459,6 +469,7 @@ function scanForIntents(root, options = {}) {
459
469
  const packageIndexes = /* @__PURE__ */ new Map();
460
470
  const packageVariants = /* @__PURE__ */ new Map();
461
471
  let pnpApi;
472
+ const getPackageKind = createPackageKindResolver(createWorkspacePackageKeySet(workspaceRoot, fsCache.getFsIdentity), fsCache.getFsIdentity);
462
473
  function getPnpApi() {
463
474
  if (scanScope === "global") return null;
464
475
  if (pnpApi === void 0) {
@@ -499,6 +510,7 @@ function scanForIntents(root, options = {}) {
499
510
  deriveIntentConfig,
500
511
  discoverSkills: (skillsDir) => discoverSkills(skillsDir, fsCache),
501
512
  getPackageDepth,
513
+ getPackageKind,
502
514
  getFsIdentity: fsCache.getFsIdentity,
503
515
  exists: fsCache.exists,
504
516
  packageIndexes,
@@ -610,6 +622,7 @@ function scanIntentPackageAtRoot(packageRoot, options = {}) {
610
622
  const warnings = [];
611
623
  const packageIndexes = /* @__PURE__ */ new Map();
612
624
  const fsCache = options.fsCache ?? createIntentFsCache();
625
+ const getPackageKind = createPackageKindResolver(createWorkspacePackageKeySet(findWorkspaceRoot(projectRoot), fsCache.getFsIdentity), fsCache.getFsIdentity);
613
626
  function readPkgJson(dirPath) {
614
627
  return fsCache.readPackageJson(dirPath);
615
628
  }
@@ -618,6 +631,7 @@ function scanIntentPackageAtRoot(packageRoot, options = {}) {
618
631
  deriveIntentConfig,
619
632
  discoverSkills: options.skillNameHint ? (skillsDir, packageName) => discoverSkillByNameHint(skillsDir, packageName, options.skillNameHint, fsCache.getReadFs()) : (skillsDir) => discoverSkills(skillsDir, fsCache),
620
633
  getPackageDepth,
634
+ getPackageKind,
621
635
  getFsIdentity: fsCache.getFsIdentity,
622
636
  exists: fsCache.exists,
623
637
  packageIndexes,
@@ -0,0 +1,2 @@
1
+ import { s as scanForPolicedIntents } from "./source-policy-D__bcpoU.mjs";
2
+ export { scanForPolicedIntents };
@@ -1,4 +1,4 @@
1
- import { t as scanForIntents } from "./scanner-qT_M6nV5.mjs";
1
+ import { t as scanForIntents } from "./scanner-C5bzzri5.mjs";
2
2
  import { t as resolveProjectContext } from "./project-context-oi_m7paK.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-ByvSbmmj.mjs";
4
4
  //#region src/core/skill-sources.ts
@@ -15,7 +15,7 @@ interface ScanResult {
15
15
  local: NodeModulesScanTarget;
16
16
  global: NodeModulesScanTarget;
17
17
  };
18
- stats?: ScanStats;
18
+ stats: ScanStats;
19
19
  }
20
20
  type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun' | 'unknown';
21
21
  type ScanScope = 'local' | 'local-and-global' | 'global';
@@ -40,6 +40,7 @@ interface IntentPackage {
40
40
  intent: IntentConfig;
41
41
  skills: Array<SkillEntry>;
42
42
  packageRoot: string;
43
+ kind: 'npm' | 'workspace';
43
44
  source: 'local' | 'global';
44
45
  }
45
46
  interface InstalledVariant {
@@ -1,7 +1,7 @@
1
1
  import { n as findWorkspacePackages } from "./workspace-patterns-BDoJIWk-.mjs";
2
2
  import { t as resolveProjectContext } from "./project-context-oi_m7paK.mjs";
3
3
  import { n as isCliFailure, t as fail } from "./cli-error-DDAO6DIL.mjs";
4
- import { u as printWarnings } from "./cli-support-BQSl7gAE.mjs";
4
+ import { u as printWarnings } from "./cli-support-z64kSJOO.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.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Ship compositional knowledge for AI coding agents alongside your npm packages",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,2 +0,0 @@
1
- import { s as scanForPolicedIntents } from "./source-policy-DkR80hkL.mjs";
2
- export { scanForPolicedIntents };