@tanstack/intent 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{artifact-coverage-DFtI6V_H.mjs → artifact-coverage-DerRKsWw.mjs} +1 -1
- package/dist/artifact-coverage-Dia0ZRPy.mjs +2 -0
- package/dist/{cli-error-DDAO6DIL.mjs → cli-error-BebkXaTJ.mjs} +1 -1
- package/dist/cli.mjs +18 -13
- package/dist/command-BBzoalDz.mjs +388 -0
- package/dist/{install-Bv2qdHwd.mjs → command-BMdho_4n.mjs} +85 -55
- package/dist/{command-runner-B5OofX0E.mjs → command-runner-BFvtjLMh.mjs} +1 -1
- package/dist/{core-DaAr5MBD.mjs → core-Bqyle4Vm.mjs} +12 -10
- package/dist/core.d.mts +10 -2
- package/dist/core.mjs +1 -1
- package/dist/{display-CnpA7XuV.mjs → display-Dc1feMcZ.mjs} +2 -2
- package/dist/{edit-package-json-D8xfcy2X.mjs → edit-package-json-CdnA7_TA.mjs} +2 -2
- package/dist/{exclude-DbHwcgQQ.mjs → exclude-IfSv-XI_.mjs} +2 -2
- package/dist/{excludes-ByvSbmmj.mjs → excludes-BEi9N7Ys.mjs} +1 -1
- package/dist/{setup-github-actions-IxZTZihi.mjs → github-actions-D41VZqWh.mjs} +2 -2
- package/dist/index.d.mts +9 -9
- package/dist/index.mjs +8 -8
- package/dist/{list-C-eGocZP.mjs → list-DUXFVM5r.mjs} +21 -5
- package/dist/{load-DDNrmeBz.mjs → load-DieqITz5.mjs} +3 -3
- package/dist/{meta-CF4XIYOo.mjs → meta-Dk7d0N2J.mjs} +2 -2
- package/dist/{package-manager-Dw7lYcI0.mjs → package-manager-C63Zi9q1.mjs} +1 -1
- package/dist/{skill-paths-Bm1P6IYe.mjs → paths-B0KW7rmz.mjs} +2 -2
- package/dist/{project-context-oi_m7paK.mjs → project-context-CALU5-15.mjs} +1 -1
- package/dist/{setup-CdfBc7Oe.d.mts → project-setup-Bvmg5uYy.d.mts} +2 -2
- package/dist/{resolver-Uwx8B5jv.mjs → resolver-6i-WBbh8.mjs} +3 -3
- package/dist/{scanner-C5bzzri5.mjs → scanner-B1pcLFee.mjs} +68 -68
- package/dist/{setup-Cx1r2y-1.mjs → setup-D5qLjoqf.mjs} +16 -9
- package/dist/setup-DFajGERl.mjs +3 -0
- package/dist/setup.d.mts +1 -1
- package/dist/setup.mjs +2 -2
- package/dist/source-policy-C5S58Cno.mjs +2 -0
- package/dist/{source-policy-D__bcpoU.mjs → source-policy-CzZqrSTS.mjs} +36 -11
- package/dist/{stale-DhjSTIt-.mjs → stale-DlNJHwga.mjs} +2 -2
- package/dist/{staleness-DoZU3lzy.mjs → staleness-I_jAT1Ge.mjs} +3 -3
- package/dist/{staleness-B5Cqe77_.mjs → staleness-bEZ8BeGq.mjs} +1 -1
- package/dist/{cli-support-BANzHEBM.mjs → support-CDhR09kb.mjs} +1 -1
- package/dist/{cli-support-z64kSJOO.mjs → support-D7lyVf_J.mjs} +9 -9
- package/dist/{types-ByXUTBJ2.d.mts → types-Bx6-umBo.d.mts} +1 -1
- package/dist/{skill-use-B2xRF1i9.mjs → use-plp2M918.mjs} +1 -1
- package/dist/{utils-BKBDYbCx.mjs → utils-BpmAIjiN.mjs} +1 -1
- package/dist/{utils-6FtqhOYf.mjs → utils-Bw7HwOo5.mjs} +1 -1
- package/dist/{validate-BAU0uzvQ.mjs → validate-Cm-gfxGX.mjs} +5 -5
- package/dist/{workflow-review-Bo2kPVXV.mjs → workflow-review-Bx8x6_uF.mjs} +1 -1
- package/dist/{workflow-review-B4AfwtHH.mjs → workflow-review-CEwwmDdD.mjs} +1 -1
- package/dist/{workspace-patterns-BDoJIWk-.mjs → workspace-patterns-hW0v_meY.mjs} +2 -2
- package/dist/{workspace-patterns-CrL8hAbd.mjs → workspace-patterns-qoXkCfEX.mjs} +1 -1
- package/package.json +2 -1
- package/dist/artifact-coverage-CXX6wav1.mjs +0 -2
- package/dist/source-policy-CTeI29oF.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-
|
|
2
|
-
import { r as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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 + "/");
|
|
@@ -156,70 +219,7 @@ function createDependencyWalker(opts) {
|
|
|
156
219
|
};
|
|
157
220
|
}
|
|
158
221
|
//#endregion
|
|
159
|
-
//#region src/
|
|
160
|
-
function isRecord(value) {
|
|
161
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
162
|
-
}
|
|
163
|
-
function createIntentFsCache() {
|
|
164
|
-
const packageJsonCache = /* @__PURE__ */ new Map();
|
|
165
|
-
const skillFilesCache = /* @__PURE__ */ new Map();
|
|
166
|
-
let activeFs = nodeReadFs;
|
|
167
|
-
const getFsIdentity = createFsIdentityCache(() => activeFs);
|
|
168
|
-
const stats = {
|
|
169
|
-
packageJsonReadCount: 0,
|
|
170
|
-
packageJsonCacheHits: 0
|
|
171
|
-
};
|
|
172
|
-
function readPackageJsonResult(dir) {
|
|
173
|
-
const key = getFsIdentity(dir);
|
|
174
|
-
const cached = packageJsonCache.get(key);
|
|
175
|
-
if (cached) {
|
|
176
|
-
stats.packageJsonCacheHits += 1;
|
|
177
|
-
return cached;
|
|
178
|
-
}
|
|
179
|
-
stats.packageJsonReadCount += 1;
|
|
180
|
-
try {
|
|
181
|
-
const parsed = JSON.parse(activeFs.readFileSync(join(dir, "package.json"), "utf8"));
|
|
182
|
-
const result = {
|
|
183
|
-
packageJson: isRecord(parsed) ? parsed : null,
|
|
184
|
-
error: null
|
|
185
|
-
};
|
|
186
|
-
packageJsonCache.set(key, result);
|
|
187
|
-
return result;
|
|
188
|
-
} catch (error) {
|
|
189
|
-
const result = {
|
|
190
|
-
packageJson: null,
|
|
191
|
-
error
|
|
192
|
-
};
|
|
193
|
-
packageJsonCache.set(key, result);
|
|
194
|
-
return result;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
function readPackageJson(dir) {
|
|
198
|
-
return readPackageJsonResult(dir).packageJson;
|
|
199
|
-
}
|
|
200
|
-
function findSkillFiles$1(dir) {
|
|
201
|
-
const key = getFsIdentity(dir);
|
|
202
|
-
const cached = skillFilesCache.get(key);
|
|
203
|
-
if (cached) return [...cached];
|
|
204
|
-
const files = findSkillFiles(dir, activeFs);
|
|
205
|
-
skillFilesCache.set(key, files);
|
|
206
|
-
return [...files];
|
|
207
|
-
}
|
|
208
|
-
return {
|
|
209
|
-
readPackageJson,
|
|
210
|
-
readPackageJsonResult,
|
|
211
|
-
findSkillFiles: findSkillFiles$1,
|
|
212
|
-
getFsIdentity,
|
|
213
|
-
getStats: () => ({ ...stats }),
|
|
214
|
-
useFs: (fs) => {
|
|
215
|
-
activeFs = fs;
|
|
216
|
-
},
|
|
217
|
-
getReadFs: () => activeFs,
|
|
218
|
-
exists: (path) => activeFs.existsSync(path)
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
//#endregion
|
|
222
|
-
//#region src/scanner.ts
|
|
222
|
+
//#region src/discovery/scanner.ts
|
|
223
223
|
const requireFromHere = createRequire(import.meta.url);
|
|
224
224
|
function findPnpFile(start) {
|
|
225
225
|
let dir = resolve(start);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as readWorkspacePatterns, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-
|
|
2
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
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
|
|
46
|
-
if (
|
|
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
|
|
78
|
+
DOCS_PATH: docsPath ?? "docs/**",
|
|
72
79
|
SRC_PATH: srcPath,
|
|
73
|
-
WATCH_PATHS:
|
|
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
|
|
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
|
}
|
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-
|
|
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-
|
|
2
|
-
import { n as runEditPackageJsonAll, r as runSetupGithubActions, t as runEditPackageJson } from "./setup-
|
|
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 };
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import { t as scanForIntents } from "./scanner-
|
|
2
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
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-
|
|
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
|
+
import { detectAgent, env } from "std-env";
|
|
5
|
+
//#region src/shared/environment.ts
|
|
6
|
+
function detectIntentAudience(explicit) {
|
|
7
|
+
if (explicit) return explicit;
|
|
8
|
+
const override = env.INTENT_AUDIENCE?.trim().toLowerCase();
|
|
9
|
+
if (override === "agent" || override === "human") return override;
|
|
10
|
+
if (override) throw new Error("Invalid INTENT_AUDIENCE value. Expected \"agent\" or \"human\".");
|
|
11
|
+
return detectAgent().name ? "agent" : "human";
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
4
14
|
//#region src/core/skill-sources.ts
|
|
5
15
|
var SkillSourcesParseError = class extends Error {
|
|
6
16
|
constructor(issues) {
|
|
@@ -164,13 +174,19 @@ function checkLoadAllowed(use, parsed, params) {
|
|
|
164
174
|
};
|
|
165
175
|
return null;
|
|
166
176
|
}
|
|
167
|
-
function
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
177
|
+
function pluralize(count, singular, plural) {
|
|
178
|
+
return count === 1 ? singular : plural;
|
|
179
|
+
}
|
|
180
|
+
function formatUnlistedNotice(hiddenSources, audience) {
|
|
181
|
+
const sorted = [...hiddenSources].sort((a, b) => a.name.localeCompare(b.name));
|
|
182
|
+
const sourceCount = sorted.length;
|
|
183
|
+
const skillCount = sorted.reduce((sum, source) => sum + source.skillCount, 0);
|
|
184
|
+
if (audience === "agent") return `${sourceCount} discovered ${pluralize(sourceCount, "skill source", "skill sources")} with ${skillCount} ${pluralize(skillCount, "skill", "skills")} ${pluralize(sourceCount, "is", "are")} hidden because ${pluralize(sourceCount, "it is", "they are")} not listed in intent.skills. Ask the user to run \`intent list --show-hidden\` outside the agent session to review candidates.`;
|
|
185
|
+
return `${sourceCount} discovered ${sourceCount === 1 ? "package ships" : "packages ship"} skills but ${sourceCount === 1 ? "is" : "are"} not listed in intent.skills: ${sorted.map((source) => source.name).join(", ")}. Add to opt in.`;
|
|
171
186
|
}
|
|
172
187
|
function applySourcePolicy(scanResult, options) {
|
|
173
188
|
const { config, excludeMatchers } = options;
|
|
189
|
+
const audience = options.audience ?? "human";
|
|
174
190
|
const seen = /* @__PURE__ */ new Set();
|
|
175
191
|
const notices = [];
|
|
176
192
|
const emit = (notice) => {
|
|
@@ -179,11 +195,14 @@ function applySourcePolicy(scanResult, options) {
|
|
|
179
195
|
notices.push(notice);
|
|
180
196
|
};
|
|
181
197
|
const packages = [];
|
|
182
|
-
const
|
|
198
|
+
const hiddenSources = [];
|
|
183
199
|
for (const pkg of scanResult.packages) {
|
|
184
200
|
if (isPackageExcluded(pkg.name, excludeMatchers)) continue;
|
|
185
201
|
if (!isSourcePermitted(config, pkg.name)) {
|
|
186
|
-
if (config.mode === "explicit")
|
|
202
|
+
if (config.mode === "explicit") hiddenSources.push({
|
|
203
|
+
name: pkg.name,
|
|
204
|
+
skillCount: pkg.skills.length
|
|
205
|
+
});
|
|
187
206
|
continue;
|
|
188
207
|
}
|
|
189
208
|
const skills = pkg.skills.filter((skill) => !isSkillExcluded(pkg.name, skill.name, excludeMatchers));
|
|
@@ -192,7 +211,7 @@ function applySourcePolicy(scanResult, options) {
|
|
|
192
211
|
skills
|
|
193
212
|
});
|
|
194
213
|
}
|
|
195
|
-
if (
|
|
214
|
+
if (hiddenSources.length > 0) emit(formatUnlistedNotice(hiddenSources, audience));
|
|
196
215
|
if (config.mode === "explicit") {
|
|
197
216
|
const discoveredNames = new Set(scanResult.packages.map((pkg) => pkg.name));
|
|
198
217
|
for (const source of config.sources) if (!discoveredNames.has(source.id)) emit(`"${source.raw}" is declared in intent.skills but was not discovered.`);
|
|
@@ -201,6 +220,8 @@ function applySourcePolicy(scanResult, options) {
|
|
|
201
220
|
else if (config.mode === "allow-all") emit(ALLOW_ALL_NOTICE);
|
|
202
221
|
else if (config.mode === "empty") emit(EMPTY_NOTE);
|
|
203
222
|
return {
|
|
223
|
+
hiddenSourceCount: hiddenSources.length,
|
|
224
|
+
hiddenSources,
|
|
204
225
|
packages,
|
|
205
226
|
notices
|
|
206
227
|
};
|
|
@@ -220,16 +241,20 @@ function readSkillSourcesConfig(cwd, context = resolveProjectContext({ cwd })) {
|
|
|
220
241
|
function scanForPolicedIntents(params) {
|
|
221
242
|
const { cwd, scanOptions, coreOptions } = params;
|
|
222
243
|
const context = params.context ?? resolveProjectContext({ cwd });
|
|
244
|
+
const audience = detectIntentAudience(coreOptions.audience);
|
|
223
245
|
const scanResult = scanForIntents(cwd, scanOptions);
|
|
224
246
|
const config = readSkillSourcesConfig(cwd, context);
|
|
225
247
|
const excludePatterns = getEffectiveExcludePatterns(coreOptions, context);
|
|
226
248
|
const policy = applySourcePolicy(scanResult, {
|
|
249
|
+
audience,
|
|
227
250
|
config,
|
|
228
251
|
excludeMatchers: compileExcludePatterns(excludePatterns)
|
|
229
252
|
});
|
|
230
253
|
const survivingNames = new Set(policy.packages.map((pkg) => pkg.name));
|
|
231
254
|
const droppedNames = scanResult.packages.map((pkg) => pkg.name).filter((name) => !survivingNames.has(name));
|
|
232
255
|
return {
|
|
256
|
+
hiddenSourceCount: policy.hiddenSourceCount,
|
|
257
|
+
hiddenSources: audience === "agent" ? [] : policy.hiddenSources,
|
|
233
258
|
scan: {
|
|
234
259
|
...scanResult,
|
|
235
260
|
packages: policy.packages,
|
|
@@ -241,4 +266,4 @@ function scanForPolicedIntents(params) {
|
|
|
241
266
|
};
|
|
242
267
|
}
|
|
243
268
|
//#endregion
|
|
244
|
-
export { checkLoadAllowed as a, applySourcePolicy as i, EMPTY_NOTE as n, readSkillSourcesConfig as o, MIGRATION_NOTICE as r, scanForPolicedIntents as s, ALLOW_ALL_NOTICE as t };
|
|
269
|
+
export { checkLoadAllowed as a, detectIntentAudience as c, applySourcePolicy as i, EMPTY_NOTE as n, readSkillSourcesConfig as o, MIGRATION_NOTICE as r, scanForPolicedIntents as s, ALLOW_ALL_NOTICE as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as isCliFailure } from "./cli-error-
|
|
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-
|
|
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-
|
|
2
|
-
import { t as readIntentArtifacts } from "./artifact-coverage-
|
|
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-
|
|
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 "./
|
|
1
|
+
import { a as noticeOptionsFromGlobalFlags, c as scanIntentsOrFail, i as getMetaDir, l as printNotices, n as coreOptionsFromGlobalFlags, o as printDebugInfo, r as getCheckSkillsWorkflowAdvisories, s as resolveStaleTargets, t as INTENT_CHECK_SKILLS_WORKFLOW_VERSION, u as printWarnings } from "./support-D7lyVf_J.mjs";
|
|
2
2
|
export { INTENT_CHECK_SKILLS_WORKFLOW_VERSION, coreOptionsFromGlobalFlags, getCheckSkillsWorkflowAdvisories, getMetaDir, noticeOptionsFromGlobalFlags, printDebugInfo, printNotices, printWarnings, resolveStaleTargets, scanIntentsOrFail };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
2
|
-
import { t as fail } from "./cli-error-
|
|
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/
|
|
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-
|
|
51
|
+
const { scanForPolicedIntents } = await import("./source-policy-C5S58Cno.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-
|
|
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-
|
|
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-
|
|
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,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-
|
|
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-
|
|
2
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
3
|
-
import { n as isCliFailure, t as fail } from "./cli-error-
|
|
4
|
-
import { u as printWarnings } from "./
|
|
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-D7lyVf_J.mjs";
|
|
5
5
|
import { appendFileSync, existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { basename, dirname, join, relative, resolve } from "node:path";
|
|
7
7
|
//#region src/commands/validate.ts
|
|
@@ -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-
|
|
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-
|
|
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,9 +1,9 @@
|
|
|
1
|
-
import { r as findSkillFiles } from "./utils-
|
|
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-
|
|
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.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Ship compositional knowledge for AI coding agents alongside your npm packages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"cac": "^6.7.14",
|
|
30
30
|
"jsonc-parser": "^3.3.1",
|
|
31
31
|
"semver": "^7.8.4",
|
|
32
|
+
"std-env": "^4.1.0",
|
|
32
33
|
"yaml": "2.9.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|