@tanstack/intent 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +17 -12
  6. package/dist/command-BBzoalDz.mjs +388 -0
  7. package/dist/{install-CTGQvXoB.mjs → command-DFQVnfAz.mjs} +85 -55
  8. package/dist/{command-runner-B5OofX0E.mjs → command-runner-BFvtjLMh.mjs} +1 -1
  9. package/dist/{core-BRUBEMwe.mjs → core-BNH_SWxi.mjs} +11 -11
  10. package/dist/core.d.mts +2 -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-9SbFGUd5.mjs → list-zVJERMh0.mjs} +4 -4
  20. package/dist/{load-BY8vh7Gp.mjs → load-BsCRJMxP.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-qT_M6nV5.mjs → scanner-B1pcLFee.mjs} +82 -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-BDNiixOv.mjs +2 -0
  33. package/dist/{source-policy-DkR80hkL.mjs → source-policy-CXjjpHNc.mjs} +3 -3
  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-DK1Kq8Ue.mjs → support-DKP_LLRd.mjs} +1 -1
  38. package/dist/{cli-support-BQSl7gAE.mjs → support-XEVbBenU.mjs} +9 -9
  39. package/dist/{types-P6UfPVdp.d.mts → types-Bx6-umBo.d.mts} +3 -2
  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-BSfTOq0v.mjs → validate-D5bt8Q0r.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 +1 -1
  49. package/dist/artifact-coverage-CXX6wav1.mjs +0 -2
  50. package/dist/source-policy-hMYcpIgm.mjs +0 -2
@@ -1,11 +1,74 @@
1
- import { a as listNestedNodeModulesPackageDirs, c as parseFrontmatter, d as toPosixPath, i as getDeps, l as readScalarField, n as detectGlobalNodeModules, o as listNodeModulesPackageDirs, r as findSkillFiles, s as nodeReadFs, t as createFsIdentityCache, u as resolveDepDir } from "./utils-6FtqhOYf.mjs";
2
- import { r as rewriteSkillLoadPaths } from "./skill-paths-Bm1P6IYe.mjs";
3
- import { n as findWorkspacePackages, r as findWorkspaceRoot } from "./workspace-patterns-BDoJIWk-.mjs";
4
- import { t as detectPackageManager } from "./package-manager-Dw7lYcI0.mjs";
1
+ import { a as listNestedNodeModulesPackageDirs, c as parseFrontmatter, d as toPosixPath, i as getDeps, l as readScalarField, n as detectGlobalNodeModules, o as listNodeModulesPackageDirs, r as findSkillFiles, s as nodeReadFs, t as createFsIdentityCache, u as resolveDepDir } from "./utils-Bw7HwOo5.mjs";
2
+ import { n as findWorkspacePackages, r as findWorkspaceRoot } from "./workspace-patterns-hW0v_meY.mjs";
3
+ import { t as detectPackageManager } from "./package-manager-C63Zi9q1.mjs";
4
+ import { r as rewriteSkillLoadPaths } from "./paths-B0KW7rmz.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import { existsSync } from "node:fs";
7
7
  import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
8
8
  import semver from "semver";
9
+ //#region src/discovery/fs-cache.ts
10
+ function isRecord(value) {
11
+ return typeof value === "object" && value !== null && !Array.isArray(value);
12
+ }
13
+ function createIntentFsCache() {
14
+ const packageJsonCache = /* @__PURE__ */ new Map();
15
+ const skillFilesCache = /* @__PURE__ */ new Map();
16
+ let activeFs = nodeReadFs;
17
+ const getFsIdentity = createFsIdentityCache(() => activeFs);
18
+ const stats = {
19
+ packageJsonReadCount: 0,
20
+ packageJsonCacheHits: 0
21
+ };
22
+ function readPackageJsonResult(dir) {
23
+ const key = getFsIdentity(dir);
24
+ const cached = packageJsonCache.get(key);
25
+ if (cached) {
26
+ stats.packageJsonCacheHits += 1;
27
+ return cached;
28
+ }
29
+ stats.packageJsonReadCount += 1;
30
+ try {
31
+ const parsed = JSON.parse(activeFs.readFileSync(join(dir, "package.json"), "utf8"));
32
+ const result = {
33
+ packageJson: isRecord(parsed) ? parsed : null,
34
+ error: null
35
+ };
36
+ packageJsonCache.set(key, result);
37
+ return result;
38
+ } catch (error) {
39
+ const result = {
40
+ packageJson: null,
41
+ error
42
+ };
43
+ packageJsonCache.set(key, result);
44
+ return result;
45
+ }
46
+ }
47
+ function readPackageJson(dir) {
48
+ return readPackageJsonResult(dir).packageJson;
49
+ }
50
+ function findSkillFiles$1(dir) {
51
+ const key = getFsIdentity(dir);
52
+ const cached = skillFilesCache.get(key);
53
+ if (cached) return [...cached];
54
+ const files = findSkillFiles(dir, activeFs);
55
+ skillFilesCache.set(key, files);
56
+ return [...files];
57
+ }
58
+ return {
59
+ readPackageJson,
60
+ readPackageJsonResult,
61
+ findSkillFiles: findSkillFiles$1,
62
+ getFsIdentity,
63
+ getStats: () => ({ ...stats }),
64
+ useFs: (fs) => {
65
+ activeFs = fs;
66
+ },
67
+ getReadFs: () => activeFs,
68
+ exists: (path) => activeFs.existsSync(path)
69
+ };
70
+ }
71
+ //#endregion
9
72
  //#region src/discovery/register.ts
10
73
  function isLocalToProject(dirPath, projectRoot) {
11
74
  return dirPath.startsWith(projectRoot + sep) || dirPath.startsWith(projectRoot + "/");
@@ -60,6 +123,7 @@ function createPackageRegistrar(opts) {
60
123
  intent,
61
124
  skills,
62
125
  packageRoot: dirPath,
126
+ kind: opts.getPackageKind(dirPath),
63
127
  source
64
128
  };
65
129
  const existingIndex = opts.packageIndexes.get(name);
@@ -155,70 +219,7 @@ function createDependencyWalker(opts) {
155
219
  };
156
220
  }
157
221
  //#endregion
158
- //#region src/fs-cache.ts
159
- function isRecord(value) {
160
- return typeof value === "object" && value !== null && !Array.isArray(value);
161
- }
162
- function createIntentFsCache() {
163
- const packageJsonCache = /* @__PURE__ */ new Map();
164
- const skillFilesCache = /* @__PURE__ */ new Map();
165
- let activeFs = nodeReadFs;
166
- const getFsIdentity = createFsIdentityCache(() => activeFs);
167
- const stats = {
168
- packageJsonReadCount: 0,
169
- packageJsonCacheHits: 0
170
- };
171
- function readPackageJsonResult(dir) {
172
- const key = getFsIdentity(dir);
173
- const cached = packageJsonCache.get(key);
174
- if (cached) {
175
- stats.packageJsonCacheHits += 1;
176
- return cached;
177
- }
178
- stats.packageJsonReadCount += 1;
179
- try {
180
- const parsed = JSON.parse(activeFs.readFileSync(join(dir, "package.json"), "utf8"));
181
- const result = {
182
- packageJson: isRecord(parsed) ? parsed : null,
183
- error: null
184
- };
185
- packageJsonCache.set(key, result);
186
- return result;
187
- } catch (error) {
188
- const result = {
189
- packageJson: null,
190
- error
191
- };
192
- packageJsonCache.set(key, result);
193
- return result;
194
- }
195
- }
196
- function readPackageJson(dir) {
197
- return readPackageJsonResult(dir).packageJson;
198
- }
199
- function findSkillFiles$1(dir) {
200
- const key = getFsIdentity(dir);
201
- const cached = skillFilesCache.get(key);
202
- if (cached) return [...cached];
203
- const files = findSkillFiles(dir, activeFs);
204
- skillFilesCache.set(key, files);
205
- return [...files];
206
- }
207
- return {
208
- readPackageJson,
209
- readPackageJsonResult,
210
- findSkillFiles: findSkillFiles$1,
211
- getFsIdentity,
212
- getStats: () => ({ ...stats }),
213
- useFs: (fs) => {
214
- activeFs = fs;
215
- },
216
- getReadFs: () => activeFs,
217
- exists: (path) => activeFs.existsSync(path)
218
- };
219
- }
220
- //#endregion
221
- //#region src/scanner.ts
222
+ //#region src/discovery/scanner.ts
222
223
  const requireFromHere = createRequire(import.meta.url);
223
224
  function findPnpFile(start) {
224
225
  let dir = resolve(start);
@@ -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,
@@ -1,8 +1,8 @@
1
- import { a as readWorkspacePatterns, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-BDoJIWk-.mjs";
2
- import { t as resolveProjectContext } from "./project-context-oi_m7paK.mjs";
1
+ import { a as readWorkspacePatterns, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-hW0v_meY.mjs";
2
+ import { t as resolveProjectContext } from "./project-context-CALU5-15.mjs";
3
3
  import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
4
4
  import { basename, join, relative } from "node:path";
5
- //#region src/setup.ts
5
+ //#region src/setup/project-setup.ts
6
6
  function isGenericWorkspaceName(name, root) {
7
7
  const normalized = name.trim().toLowerCase();
8
8
  return normalized.length === 0 || normalized === "unknown" || normalized === "root" || normalized === "workspace" || normalized === "monorepo" || normalized === basename(root).toLowerCase();
@@ -35,6 +35,12 @@ function detectRepo(pkgJson, fallback) {
35
35
  function normalizePattern(pattern) {
36
36
  return pattern.endsWith("**") ? pattern : pattern.replace(/\/$/, "") + "/**";
37
37
  }
38
+ function isRemoteUrl(value) {
39
+ return value.startsWith("http://") || value.startsWith("https://");
40
+ }
41
+ function localDocsPattern(value) {
42
+ return isRemoteUrl(value) ? null : normalizePattern(value);
43
+ }
38
44
  function buildWatchPaths(root, packageDirs) {
39
45
  const paths = /* @__PURE__ */ new Set();
40
46
  if (existsSync(join(root, "docs"))) paths.add("docs/**");
@@ -42,8 +48,8 @@ function buildWatchPaths(root, packageDirs) {
42
48
  const relDir = relative(root, packageDir).split("\\").join("/");
43
49
  if (existsSync(join(packageDir, "src"))) paths.add(`${relDir}/src/**`);
44
50
  const intent = readPackageJson(packageDir).intent;
45
- const docs = typeof intent?.docs === "string" ? intent.docs : "docs/";
46
- if (!docs.startsWith("http://") && !docs.startsWith("https://")) paths.add(normalizePattern(join(relDir, docs).split("\\").join("/")));
51
+ const docsPattern = localDocsPattern(typeof intent?.docs === "string" ? intent.docs : "docs/");
52
+ if (docsPattern) paths.add(normalizePattern(join(relDir, docsPattern).split("\\").join("/")));
47
53
  }
48
54
  if (paths.size === 0) {
49
55
  paths.add("packages/*/src/**");
@@ -62,15 +68,16 @@ function detectVars(root, packageDirs) {
62
68
  const shortName = packageName.replace(/^@[^/]+\//, "");
63
69
  let srcPath = isMonorepo ? "packages/*/src/**" : `packages/${shortName}/src/**`;
64
70
  if (!isMonorepo && existsSync(join(root, "src"))) srcPath = "src/**";
65
- const docsPath = isMonorepo ? "packages/*/docs/**" : docs;
71
+ const docsPath = isMonorepo ? "packages/*/docs/**" : localDocsPattern(docs);
72
+ const watchPaths = isMonorepo ? buildWatchPaths(root, packageDirs) : [docsPath, srcPath].filter((path) => Boolean(path)).map((path) => ` - '${path}'`).join("\n");
66
73
  return {
67
74
  PACKAGE_NAME: packageName,
68
75
  PACKAGE_LABEL: packageName,
69
76
  PAYLOAD_PACKAGE: packageName,
70
77
  REPO: repo,
71
- DOCS_PATH: docsPath.endsWith("**") ? docsPath : docsPath.replace(/\/$/, "") + "/**",
78
+ DOCS_PATH: docsPath ?? "docs/**",
72
79
  SRC_PATH: srcPath,
73
- WATCH_PATHS: isMonorepo ? buildWatchPaths(root, packageDirs) : ` - '${docs.endsWith("**") ? docs : docs.replace(/\/$/, "") + "/**"}'\n - '${srcPath}'`
80
+ WATCH_PATHS: watchPaths
74
81
  };
75
82
  }
76
83
  function applyVars(content, vars) {
@@ -92,7 +99,7 @@ function copyTemplates(srcDir, destDir, vars) {
92
99
  continue;
93
100
  }
94
101
  let content = readFileSync(srcPath, "utf8");
95
- if (vars.WATCH_PATHS.includes("\n")) content = content.replace(/\s+- '?\{\{DOCS_PATH\}\}'?\n\s+- '?\{\{SRC_PATH\}\}'?/, vars.WATCH_PATHS);
102
+ if (vars.WATCH_PATHS) content = content.replace(/\s+- '?\{\{DOCS_PATH\}\}'?\n\s+- '?\{\{SRC_PATH\}\}'?/, vars.WATCH_PATHS);
96
103
  writeFileSync(destPath, applyVars(content, vars));
97
104
  copied.push(destPath);
98
105
  }
@@ -0,0 +1,3 @@
1
+ import "./workspace-patterns-hW0v_meY.mjs";
2
+ import { n as runEditPackageJsonAll, r as runSetupGithubActions } from "./setup-D5qLjoqf.mjs";
3
+ export { runEditPackageJsonAll, runSetupGithubActions };
package/dist/setup.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as runEditPackageJsonAll, c as findWorkspaceRoot, i as runEditPackageJson, l as readWorkspacePatterns, n as MonorepoResult, o as runSetupGithubActions, r as SetupGithubActionsResult, s as findPackagesWithSkills, t as EditPackageJsonResult, u as resolveWorkspacePackages } from "./setup-CdfBc7Oe.mjs";
1
+ import { a as runEditPackageJsonAll, c as findWorkspaceRoot, i as runEditPackageJson, l as readWorkspacePatterns, n as MonorepoResult, o as runSetupGithubActions, r as SetupGithubActionsResult, s as findPackagesWithSkills, t as EditPackageJsonResult, u as resolveWorkspacePackages } from "./project-setup-Bvmg5uYy.mjs";
2
2
  export { EditPackageJsonResult, MonorepoResult, SetupGithubActionsResult, findPackagesWithSkills, findWorkspaceRoot, readWorkspacePatterns, resolveWorkspacePackages, runEditPackageJson, runEditPackageJsonAll, runSetupGithubActions };
package/dist/setup.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { a as readWorkspacePatterns, o as resolveWorkspacePackages, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-BDoJIWk-.mjs";
2
- import { n as runEditPackageJsonAll, r as runSetupGithubActions, t as runEditPackageJson } from "./setup-Cx1r2y-1.mjs";
1
+ import { a as readWorkspacePatterns, o as resolveWorkspacePackages, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-hW0v_meY.mjs";
2
+ import { n as runEditPackageJsonAll, r as runSetupGithubActions, t as runEditPackageJson } from "./setup-D5qLjoqf.mjs";
3
3
  export { findPackagesWithSkills, findWorkspaceRoot, readWorkspacePatterns, resolveWorkspacePackages, runEditPackageJson, runEditPackageJsonAll, runSetupGithubActions };
@@ -0,0 +1,2 @@
1
+ import { s as scanForPolicedIntents } from "./source-policy-CXjjpHNc.mjs";
2
+ export { scanForPolicedIntents };
@@ -1,6 +1,6 @@
1
- import { t as scanForIntents } from "./scanner-qT_M6nV5.mjs";
2
- import { t as resolveProjectContext } from "./project-context-oi_m7paK.mjs";
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";
1
+ import { t as scanForIntents } from "./scanner-B1pcLFee.mjs";
2
+ import { t as resolveProjectContext } from "./project-context-CALU5-15.mjs";
3
+ import { a as isSkillExcluded, i as isPackageExcluded, n as getConfigDirs, o as warningMentionsPackage, r as getEffectiveExcludePatterns, s as readPackageJson, t as compileExcludePatterns } from "./excludes-BEi9N7Ys.mjs";
4
4
  //#region src/core/skill-sources.ts
5
5
  var SkillSourcesParseError = class extends Error {
6
6
  constructor(issues) {
@@ -1,4 +1,4 @@
1
- import { n as isCliFailure } from "./cli-error-DDAO6DIL.mjs";
1
+ import { n as isCliFailure } from "./cli-error-BebkXaTJ.mjs";
2
2
  //#region src/commands/stale.ts
3
3
  async function runStaleCommand(targetDir, options, resolveStaleTargets) {
4
4
  if (options.githubReview) {
@@ -34,7 +34,7 @@ async function runStaleCommand(targetDir, options, resolveStaleTargets) {
34
34
  }
35
35
  }
36
36
  async function runGithubReview(targetDir, options, resolveStaleTargets) {
37
- const { collectStaleReviewItems, createFailedStaleReviewItem, createWorkflowAdvisoryReviewItems, writeStaleReviewWorkflowFiles } = await import("./workflow-review-Bo2kPVXV.mjs");
37
+ const { collectStaleReviewItems, createFailedStaleReviewItem, createWorkflowAdvisoryReviewItems, writeStaleReviewWorkflowFiles } = await import("./workflow-review-Bx8x6_uF.mjs");
38
38
  const packageLabel = options.packageLabel ?? "workspace";
39
39
  try {
40
40
  const { reports, workflowAdvisories = [] } = await resolveStaleTargets(targetDir);
@@ -1,9 +1,9 @@
1
- import { c as parseFrontmatter, d as toPosixPath, l as readScalarField, r as findSkillFiles } from "./utils-6FtqhOYf.mjs";
2
- import { t as readIntentArtifacts } from "./artifact-coverage-DFtI6V_H.mjs";
1
+ import { c as parseFrontmatter, d as toPosixPath, l as readScalarField, r as findSkillFiles } from "./utils-Bw7HwOo5.mjs";
2
+ import { t as readIntentArtifacts } from "./artifact-coverage-DerRKsWw.mjs";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { isAbsolute, join, relative, resolve } from "node:path";
5
5
  import semver from "semver";
6
- //#region src/staleness.ts
6
+ //#region src/staleness/check.ts
7
7
  function classifyVersionDrift(oldVer, newVer) {
8
8
  const oldVersion = normalizeVersion(oldVer);
9
9
  const newVersion = normalizeVersion(newVer);
@@ -1,2 +1,2 @@
1
- import { n as checkStaleness, r as readPackageName, t as buildWorkspaceCoverageSignals } from "./staleness-DoZU3lzy.mjs";
1
+ import { n as checkStaleness, r as readPackageName, t as buildWorkspaceCoverageSignals } from "./staleness-I_jAT1Ge.mjs";
2
2
  export { buildWorkspaceCoverageSignals, checkStaleness, readPackageName };
@@ -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 "./support-XEVbBenU.mjs";
2
2
  export { INTENT_CHECK_SKILLS_WORKFLOW_VERSION, coreOptionsFromGlobalFlags, getCheckSkillsWorkflowAdvisories, getMetaDir, noticeOptionsFromGlobalFlags, printDebugInfo, printNotices, printWarnings, resolveStaleTargets, scanIntentsOrFail };
@@ -1,9 +1,9 @@
1
- import { t as resolveProjectContext } from "./project-context-oi_m7paK.mjs";
2
- import { t as fail } from "./cli-error-DDAO6DIL.mjs";
1
+ import { t as resolveProjectContext } from "./project-context-CALU5-15.mjs";
2
+ import { t as fail } from "./cli-error-BebkXaTJ.mjs";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { dirname, join, relative, resolve } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
- //#region src/cli-output.ts
6
+ //#region src/shared/cli-output.ts
7
7
  function printWarnings(warnings) {
8
8
  if (warnings.length === 0) return;
9
9
  console.log("Warnings:");
@@ -29,10 +29,10 @@ function printNotices(notices, options = {}) {
29
29
  for (const notice of notices) console.error(` ℹ ${notice}`);
30
30
  }
31
31
  //#endregion
32
- //#region src/cli-support.ts
32
+ //#region src/commands/support.ts
33
33
  const INTENT_CHECK_SKILLS_WORKFLOW_VERSION = 3;
34
34
  function getMetaDir() {
35
- return join(dirname(fileURLToPath(import.meta.url)), "..", "meta");
35
+ return join(dirname(fileURLToPath(import.meta.url)), "..", "..", "meta");
36
36
  }
37
37
  function getCheckSkillsWorkflowAdvisories(root) {
38
38
  const workflowPath = join(root, ".github", "workflows", "check-skills.yml");
@@ -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-BDNiixOv.mjs");
52
52
  try {
53
53
  const { scan } = scanForPolicedIntents({
54
54
  cwd: process.cwd(),
@@ -92,18 +92,18 @@ async function resolveStaleTargets(targetDir) {
92
92
  targetPath: targetDir
93
93
  });
94
94
  const workflowAdvisories = getCheckSkillsWorkflowAdvisories(context.workspaceRoot ?? context.packageRoot ?? resolvedRoot);
95
- const { buildWorkspaceCoverageSignals, checkStaleness, readPackageName } = await import("./staleness-B5Cqe77_.mjs");
95
+ const { buildWorkspaceCoverageSignals, checkStaleness, readPackageName } = await import("./staleness-bEZ8BeGq.mjs");
96
96
  const isWorkspaceRootTarget = context.workspaceRoot !== null && resolvedRoot === context.workspaceRoot;
97
97
  if (context.packageRoot && !isWorkspaceRootTarget && (context.targetSkillsDir !== null || context.workspaceRoot === null)) return {
98
98
  reports: [await checkStaleness(context.packageRoot, readPackageName(context.packageRoot), context.workspaceRoot ?? context.packageRoot)],
99
99
  workflowAdvisories
100
100
  };
101
- const { findWorkspaceRoot, getWorkspaceInfo } = await import("./workspace-patterns-CrL8hAbd.mjs");
101
+ const { findWorkspaceRoot, getWorkspaceInfo } = await import("./workspace-patterns-qoXkCfEX.mjs");
102
102
  const workspaceRoot = findWorkspaceRoot(resolvedRoot);
103
103
  const workspaceInfo = workspaceRoot ? getWorkspaceInfo(workspaceRoot) : null;
104
104
  if (workspaceInfo) {
105
105
  const reports = await Promise.all(workspaceInfo.packageDirsWithSkills.map((packageDir) => checkStaleness(packageDir, readPackageName(packageDir), workspaceInfo.root)));
106
- const { readIntentArtifacts } = await import("./artifact-coverage-CXX6wav1.mjs");
106
+ const { readIntentArtifacts } = await import("./artifact-coverage-Dia0ZRPy.mjs");
107
107
  const artifacts = existsSync(join(workspaceInfo.root, "_artifacts")) ? readIntentArtifacts(workspaceInfo.root) : null;
108
108
  const coverageSignals = buildWorkspaceCoverageSignals({
109
109
  artifactRoot: workspaceInfo.root,
@@ -1,4 +1,4 @@
1
- //#region src/types.d.ts
1
+ //#region src/shared/types.d.ts
2
2
  interface IntentConfig {
3
3
  version: number;
4
4
  repo: string;
@@ -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,4 +1,4 @@
1
- //#region src/skill-use.ts
1
+ //#region src/skills/use.ts
2
2
  var SkillUseParseError = class extends Error {
3
3
  constructor(code, value) {
4
4
  super(formatSkillUseParseErrorMessage(code, value));
@@ -1,2 +1,2 @@
1
- import { a as listNestedNodeModulesPackageDirs, c as parseFrontmatter, d as toPosixPath, i as getDeps, l as readScalarField, n as detectGlobalNodeModules, o as listNodeModulesPackageDirs, r as findSkillFiles, s as nodeReadFs, t as createFsIdentityCache, u as resolveDepDir } from "./utils-6FtqhOYf.mjs";
1
+ import { a as listNestedNodeModulesPackageDirs, c as parseFrontmatter, d as toPosixPath, i as getDeps, l as readScalarField, n as detectGlobalNodeModules, o as listNodeModulesPackageDirs, r as findSkillFiles, s as nodeReadFs, t as createFsIdentityCache, u as resolveDepDir } from "./utils-Bw7HwOo5.mjs";
2
2
  export { createFsIdentityCache, detectGlobalNodeModules, findSkillFiles, getDeps, listNestedNodeModulesPackageDirs, listNodeModulesPackageDirs, nodeReadFs, parseFrontmatter, readScalarField, resolveDepDir, toPosixPath };
@@ -3,7 +3,7 @@ import { closeSync, existsSync, lstatSync, openSync, readFileSync, readSync, rea
3
3
  import { dirname, join, resolve, sep } from "node:path";
4
4
  import { execFileSync } from "node:child_process";
5
5
  import { parse } from "yaml";
6
- //#region src/utils.ts
6
+ //#region src/shared/utils.ts
7
7
  const nodeReadFs = {
8
8
  existsSync,
9
9
  lstatSync,
@@ -1,7 +1,7 @@
1
- import { n as findWorkspacePackages } from "./workspace-patterns-BDoJIWk-.mjs";
2
- import { t as resolveProjectContext } from "./project-context-oi_m7paK.mjs";
3
- import { n as isCliFailure, t as fail } from "./cli-error-DDAO6DIL.mjs";
4
- import { u as printWarnings } from "./cli-support-BQSl7gAE.mjs";
1
+ import { n as findWorkspacePackages } from "./workspace-patterns-hW0v_meY.mjs";
2
+ import { t as resolveProjectContext } from "./project-context-CALU5-15.mjs";
3
+ import { n as isCliFailure, t as fail } from "./cli-error-BebkXaTJ.mjs";
4
+ import { u as printWarnings } from "./support-XEVbBenU.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
@@ -156,7 +156,7 @@ async function runValidateCommand(dir, options = {}) {
156
156
  }
157
157
  }
158
158
  async function runValidateCommandInternal(dir, options = {}) {
159
- const [{ parse: parseYaml }, { findSkillFiles, readScalarField }] = await Promise.all([import("yaml"), import("./utils-BKBDYbCx.mjs")]);
159
+ const [{ parse: parseYaml }, { findSkillFiles, readScalarField }] = await Promise.all([import("yaml"), import("./utils-BpmAIjiN.mjs")]);
160
160
  const context = resolveProjectContext({
161
161
  cwd: process.cwd(),
162
162
  targetPath: dir
@@ -1,2 +1,2 @@
1
- import { a as writeStaleReviewWorkflowFiles, i as createWorkflowAdvisoryReviewItems, n as collectStaleReviewItems, r as createFailedStaleReviewItem } from "./workflow-review-B4AfwtHH.mjs";
1
+ import { a as writeStaleReviewWorkflowFiles, i as createWorkflowAdvisoryReviewItems, n as collectStaleReviewItems, r as createFailedStaleReviewItem } from "./workflow-review-CEwwmDdD.mjs";
2
2
  export { collectStaleReviewItems, createFailedStaleReviewItem, createWorkflowAdvisoryReviewItems, writeStaleReviewWorkflowFiles };
@@ -1,5 +1,5 @@
1
1
  import { appendFileSync, writeFileSync } from "node:fs";
2
- //#region src/workflow-review.ts
2
+ //#region src/staleness/workflow-review.ts
3
3
  function collectStaleReviewItems(reports) {
4
4
  const items = [];
5
5
  for (const report of reports) {
@@ -1,9 +1,9 @@
1
- import { r as findSkillFiles } from "./utils-6FtqhOYf.mjs";
1
+ import { r as findSkillFiles } from "./utils-Bw7HwOo5.mjs";
2
2
  import { existsSync, readFileSync, readdirSync } from "node:fs";
3
3
  import { dirname, join } from "node:path";
4
4
  import { parse } from "yaml";
5
5
  import { parse as parse$1 } from "jsonc-parser";
6
- //#region src/workspace-patterns.ts
6
+ //#region src/setup/workspace-patterns.ts
7
7
  function normalizeWorkspacePattern(pattern) {
8
8
  return pattern.replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/+$/, "");
9
9
  }
@@ -1,2 +1,2 @@
1
- import { i as getWorkspaceInfo, r as findWorkspaceRoot } from "./workspace-patterns-BDoJIWk-.mjs";
1
+ import { i as getWorkspaceInfo, r as findWorkspaceRoot } from "./workspace-patterns-hW0v_meY.mjs";
2
2
  export { findWorkspaceRoot, getWorkspaceInfo };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/intent",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
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 { t as readIntentArtifacts } from "./artifact-coverage-DFtI6V_H.mjs";
2
- export { readIntentArtifacts };
@@ -1,2 +0,0 @@
1
- import { s as scanForPolicedIntents } from "./source-policy-DkR80hkL.mjs";
2
- export { scanForPolicedIntents };