@tanstack/intent 0.0.19 → 0.0.20
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/dist/cli.mjs +11 -7
- package/dist/index.d.mts +5 -6
- package/dist/index.mjs +4 -4
- package/dist/intent-library.mjs +2 -2
- package/dist/{library-scanner-CU0OozQE.mjs → library-scanner-DBOEhfm8.mjs} +3 -4
- package/dist/library-scanner.d.mts +1 -1
- package/dist/library-scanner.mjs +2 -2
- package/dist/scanner-BHPl60jH.mjs +5 -0
- package/dist/{scanner-f82qRq7h.mjs → scanner-DVepyEwz.mjs} +38 -11
- package/dist/{setup-6m3IfxyO.d.mts → setup-B-zdCBu4.d.mts} +7 -1
- package/dist/{setup-CncHbQlb.mjs → setup-mGV2dZrq.mjs} +15 -8
- package/dist/setup.d.mts +2 -2
- package/dist/setup.mjs +3 -3
- package/dist/{staleness-D_ZiK4Tf.mjs → staleness-DZKvsLVq.mjs} +1 -1
- package/dist/staleness-Dr5-5wj5.mjs +4 -0
- package/dist/{utils-DY1eH2E_.mjs → utils-BfjM1mQe.mjs} +16 -21
- package/dist/{utils-XSyO19J6.mjs → utils-D7OKi0Rn.mjs} +1 -1
- package/package.json +6 -3
- package/dist/scanner-B1UvuEBQ.mjs +0 -4
- package/dist/staleness-CWWuoPop.mjs +0 -4
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { t as INSTALL_PROMPT } from "./install-prompt-C0M-U3WZ.mjs";
|
|
3
|
-
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
3
|
+
import { existsSync, readFileSync, readdirSync, realpathSync } from "node:fs";
|
|
4
4
|
import { dirname, join, relative, sep } from "node:path";
|
|
5
|
-
import { fileURLToPath
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
6
|
|
|
7
7
|
//#region src/cli.ts
|
|
8
8
|
function getMetaDir() {
|
|
@@ -18,7 +18,7 @@ function isCliFailure(value) {
|
|
|
18
18
|
return !!value && typeof value === "object" && "message" in value && typeof value.message === "string" && "exitCode" in value && typeof value.exitCode === "number";
|
|
19
19
|
}
|
|
20
20
|
async function scanIntentsOrFail() {
|
|
21
|
-
const { scanForIntents } = await import("./scanner-
|
|
21
|
+
const { scanForIntents } = await import("./scanner-BHPl60jH.mjs");
|
|
22
22
|
try {
|
|
23
23
|
return await scanForIntents();
|
|
24
24
|
} catch (err) {
|
|
@@ -113,7 +113,7 @@ async function cmdList(args) {
|
|
|
113
113
|
printWarnings(result.warnings);
|
|
114
114
|
}
|
|
115
115
|
async function cmdMeta(args) {
|
|
116
|
-
const { parseFrontmatter } = await import("./utils-
|
|
116
|
+
const { parseFrontmatter } = await import("./utils-D7OKi0Rn.mjs");
|
|
117
117
|
const metaDir = getMetaDir();
|
|
118
118
|
if (!existsSync(metaDir)) fail("Meta-skills directory not found.");
|
|
119
119
|
if (args.length > 0) {
|
|
@@ -186,7 +186,7 @@ function readPackageName(root) {
|
|
|
186
186
|
}
|
|
187
187
|
async function resolveStaleTargets(targetDir) {
|
|
188
188
|
const resolvedRoot = targetDir ? join(process.cwd(), targetDir) : process.cwd();
|
|
189
|
-
const { checkStaleness } = await import("./staleness-
|
|
189
|
+
const { checkStaleness } = await import("./staleness-Dr5-5wj5.mjs");
|
|
190
190
|
if (existsSync(join(resolvedRoot, "skills"))) return { reports: [await checkStaleness(resolvedRoot, readPackageName(resolvedRoot))] };
|
|
191
191
|
const { findPackagesWithSkills, findWorkspaceRoot } = await import("./setup.mjs");
|
|
192
192
|
const workspaceRoot = findWorkspaceRoot(resolvedRoot);
|
|
@@ -198,7 +198,7 @@ async function resolveStaleTargets(targetDir) {
|
|
|
198
198
|
return { reports: await Promise.all(staleResult.packages.map((pkg) => checkStaleness(pkg.packageRoot, pkg.name))) };
|
|
199
199
|
}
|
|
200
200
|
async function cmdValidate(args) {
|
|
201
|
-
const [{ parse: parseYaml }, { findSkillFiles }] = await Promise.all([import("yaml"), import("./utils-
|
|
201
|
+
const [{ parse: parseYaml }, { findSkillFiles }] = await Promise.all([import("yaml"), import("./utils-D7OKi0Rn.mjs")]);
|
|
202
202
|
const targetDir = args[0] ?? "skills";
|
|
203
203
|
const skillsDir = join(process.cwd(), targetDir);
|
|
204
204
|
const packageRoot = resolvePackageRoot(skillsDir);
|
|
@@ -518,7 +518,11 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
518
518
|
throw err;
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
|
|
521
|
+
let isMain = false;
|
|
522
|
+
try {
|
|
523
|
+
isMain = process.argv[1] !== void 0 && fileURLToPath(import.meta.url) === realpathSync(process.argv[1]);
|
|
524
|
+
} catch {}
|
|
525
|
+
if (isMain) {
|
|
522
526
|
const exitCode = await main();
|
|
523
527
|
process.exit(exitCode);
|
|
524
528
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as IntentProjectConfig, c as ScanResult, d as StalenessReport, i as IntentPackage, l as SkillEntry, n as FeedbackPayload, o as MetaFeedbackPayload, r as IntentConfig, s as MetaSkillName, t as AgentName, u as SkillStaleness } from "./types-ddLtccfV.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { d as runEditPackageJson, i as SetupGithubActionsResult, l as runAddLibraryBin, n as EditPackageJsonResult, p as runSetupGithubActions, t as AddLibraryBinResult } from "./setup-B-zdCBu4.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/scanner.d.ts
|
|
5
5
|
declare function scanForIntents(root?: string): Promise<ScanResult>;
|
|
@@ -45,12 +45,11 @@ declare function findSkillFiles(dir: string): Array<string>;
|
|
|
45
45
|
*/
|
|
46
46
|
declare function getDeps(pkgJson: Record<string, unknown>, includeDevDeps?: boolean): Array<string>;
|
|
47
47
|
/**
|
|
48
|
-
* Resolve the directory of a dependency by name.
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* transitive deps are siblings in the .pnpm virtual store node_modules.
|
|
48
|
+
* Resolve the directory of a dependency by name. Tries createRequire first
|
|
49
|
+
* (handles pnpm symlinks), then falls back to walking up node_modules
|
|
50
|
+
* directories (handles packages with export maps that block ./package.json).
|
|
52
51
|
*/
|
|
53
|
-
declare function resolveDepDir(depName: string, parentDir: string
|
|
52
|
+
declare function resolveDepDir(depName: string, parentDir: string): string | null;
|
|
54
53
|
/**
|
|
55
54
|
* Parse YAML frontmatter from a file. Returns null if no frontmatter or on error.
|
|
56
55
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as parseFrontmatter, n as findSkillFiles, o as resolveDepDir, r as getDeps } from "./utils-
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
1
|
+
import { a as parseFrontmatter, n as findSkillFiles, o as resolveDepDir, r as getDeps } from "./utils-BfjM1mQe.mjs";
|
|
2
|
+
import { a as runAddLibraryBin, l as runSetupGithubActions, s as runEditPackageJson } from "./setup-mGV2dZrq.mjs";
|
|
3
|
+
import { t as scanForIntents } from "./scanner-DVepyEwz.mjs";
|
|
4
|
+
import { t as checkStaleness } from "./staleness-DZKvsLVq.mjs";
|
|
5
5
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { execFileSync, execSync } from "node:child_process";
|
package/dist/intent-library.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./utils-
|
|
2
|
+
import "./utils-BfjM1mQe.mjs";
|
|
3
3
|
import { t as INSTALL_PROMPT } from "./install-prompt-C0M-U3WZ.mjs";
|
|
4
4
|
import { n as printSkillTree, r as printTable, t as computeSkillNameWidth } from "./display-DhsUxNJW.mjs";
|
|
5
|
-
import { t as scanLibrary } from "./library-scanner-
|
|
5
|
+
import { t as scanLibrary } from "./library-scanner-DBOEhfm8.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/intent-library.ts
|
|
8
8
|
async function cmdList() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as parseFrontmatter, o as resolveDepDir, r as getDeps } from "./utils-
|
|
1
|
+
import { a as parseFrontmatter, o as resolveDepDir, r as getDeps } from "./utils-BfjM1mQe.mjs";
|
|
2
2
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
3
3
|
import { dirname, join, relative, sep } from "node:path";
|
|
4
4
|
|
|
@@ -57,8 +57,7 @@ function discoverSkills(skillsDir) {
|
|
|
57
57
|
walk(skillsDir);
|
|
58
58
|
return skills;
|
|
59
59
|
}
|
|
60
|
-
async function scanLibrary(scriptPath,
|
|
61
|
-
const nodeModulesDir = join(projectRoot ?? process.cwd(), "node_modules");
|
|
60
|
+
async function scanLibrary(scriptPath, _projectRoot) {
|
|
62
61
|
const packages = [];
|
|
63
62
|
const warnings = [];
|
|
64
63
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -89,7 +88,7 @@ async function scanLibrary(scriptPath, projectRoot) {
|
|
|
89
88
|
skills: existsSync(skillsDir) ? discoverSkills(skillsDir) : []
|
|
90
89
|
});
|
|
91
90
|
for (const depName of getDeps(pkg)) {
|
|
92
|
-
const depDir = resolveDepDir(depName, dir
|
|
91
|
+
const depDir = resolveDepDir(depName, dir);
|
|
93
92
|
if (!depDir) continue;
|
|
94
93
|
const depPkg = readPkgJson(depDir);
|
|
95
94
|
if (depPkg && hasIntentBin(depPkg)) processPackage(depName, depDir);
|
|
@@ -11,6 +11,6 @@ interface LibraryScanResult {
|
|
|
11
11
|
packages: Array<LibraryPackage>;
|
|
12
12
|
warnings: Array<string>;
|
|
13
13
|
}
|
|
14
|
-
declare function scanLibrary(scriptPath: string,
|
|
14
|
+
declare function scanLibrary(scriptPath: string, _projectRoot?: string): Promise<LibraryScanResult>;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { LibraryPackage, LibraryScanResult, scanLibrary };
|
package/dist/library-scanner.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { a as parseFrontmatter, i as listNodeModulesPackageDirs, o as resolveDepDir, r as getDeps, t as detectGlobalNodeModules } from "./utils-
|
|
1
|
+
import { a as parseFrontmatter, i as listNodeModulesPackageDirs, o as resolveDepDir, r as getDeps, t as detectGlobalNodeModules } from "./utils-BfjM1mQe.mjs";
|
|
2
|
+
import { i as resolveWorkspacePackages, n as findWorkspaceRoot, r as readWorkspacePatterns } from "./setup-mGV2dZrq.mjs";
|
|
2
3
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
3
4
|
import { join, relative, sep } from "node:path";
|
|
4
5
|
|
|
@@ -6,10 +7,15 @@ import { join, relative, sep } from "node:path";
|
|
|
6
7
|
function detectPackageManager(root) {
|
|
7
8
|
if (existsSync(join(root, ".pnp.cjs")) || existsSync(join(root, ".pnp.js"))) throw new Error("Yarn PnP is not yet supported. Add `nodeLinker: node-modules` to your .yarnrc.yml to use intent.");
|
|
8
9
|
if (existsSync(join(root, "deno.json")) && !existsSync(join(root, "node_modules"))) throw new Error("Deno without node_modules is not yet supported. Add `\"nodeModulesDir\": \"auto\"` to your deno.json to use intent.");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (
|
|
12
|
-
|
|
10
|
+
const dirsToCheck = [root];
|
|
11
|
+
const wsRoot = findWorkspaceRoot(root);
|
|
12
|
+
if (wsRoot && wsRoot !== root) dirsToCheck.push(wsRoot);
|
|
13
|
+
for (const dir of dirsToCheck) {
|
|
14
|
+
if (existsSync(join(dir, "pnpm-lock.yaml"))) return "pnpm";
|
|
15
|
+
if (existsSync(join(dir, "bun.lockb")) || existsSync(join(dir, "bun.lock"))) return "bun";
|
|
16
|
+
if (existsSync(join(dir, "yarn.lock"))) return "yarn";
|
|
17
|
+
if (existsSync(join(dir, "package-lock.json"))) return "npm";
|
|
18
|
+
}
|
|
13
19
|
return "unknown";
|
|
14
20
|
}
|
|
15
21
|
function validateIntentField(_pkgName, intent) {
|
|
@@ -186,7 +192,6 @@ async function scanForIntents(root) {
|
|
|
186
192
|
source: explicitGlobalNodeModules ? "INTENT_GLOBAL_NODE_MODULES" : void 0
|
|
187
193
|
}
|
|
188
194
|
};
|
|
189
|
-
const resolutionRoots = [nodeModulesDir];
|
|
190
195
|
const packageIndexes = /* @__PURE__ */ new Map();
|
|
191
196
|
const packageJsonCache = /* @__PURE__ */ new Map();
|
|
192
197
|
const packageVariants = /* @__PURE__ */ new Map();
|
|
@@ -209,7 +214,6 @@ async function scanForIntents(root) {
|
|
|
209
214
|
nodeModules.global.detected = Boolean(detected.path);
|
|
210
215
|
nodeModules.global.exists = detected.path ? existsSync(detected.path) : false;
|
|
211
216
|
}
|
|
212
|
-
if (nodeModules.global.exists && nodeModules.global.path && nodeModules.global.path !== nodeModulesDir && !resolutionRoots.includes(nodeModules.global.path)) resolutionRoots.push(nodeModules.global.path);
|
|
213
217
|
}
|
|
214
218
|
function readPkgJson(dirPath) {
|
|
215
219
|
if (packageJsonCache.has(dirPath)) return packageJsonCache.get(dirPath) ?? null;
|
|
@@ -280,7 +284,7 @@ async function scanForIntents(root) {
|
|
|
280
284
|
return;
|
|
281
285
|
}
|
|
282
286
|
for (const depName of getDeps(pkgJson)) {
|
|
283
|
-
const depDir = resolveDepDir(depName, pkgDir
|
|
287
|
+
const depDir = resolveDepDir(depName, pkgDir);
|
|
284
288
|
if (!depDir || walkVisited.has(depDir)) continue;
|
|
285
289
|
tryRegister(depDir, depName);
|
|
286
290
|
walkDeps(depDir, depName);
|
|
@@ -297,11 +301,34 @@ async function scanForIntents(root) {
|
|
|
297
301
|
if (!(err && typeof err === "object" && "code" in err && err.code === "ENOENT")) warnings.push(`Could not read project package.json: ${err instanceof Error ? err.message : String(err)}`);
|
|
298
302
|
}
|
|
299
303
|
if (!projectPkg) return;
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
304
|
+
walkDepsFromPkgJson(projectPkg, projectRoot, true);
|
|
305
|
+
}
|
|
306
|
+
/** Resolve and walk deps listed in a package.json. */
|
|
307
|
+
function walkDepsFromPkgJson(pkgJson, fromDir, includeDevDeps = false) {
|
|
308
|
+
for (const depName of getDeps(pkgJson, includeDevDeps)) {
|
|
309
|
+
const depDir = resolveDepDir(depName, fromDir);
|
|
310
|
+
if (depDir && !walkVisited.has(depDir)) {
|
|
311
|
+
tryRegister(depDir, depName);
|
|
312
|
+
walkDeps(depDir, depName);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* In monorepos, discover workspace packages and walk their deps.
|
|
318
|
+
* Handles pnpm monorepos (workspace-specific node_modules) and ensures
|
|
319
|
+
* transitive skills packages are found through workspace package dependencies.
|
|
320
|
+
*/
|
|
321
|
+
function walkWorkspacePackages() {
|
|
322
|
+
const workspacePatterns = readWorkspacePatterns(projectRoot);
|
|
323
|
+
if (!workspacePatterns) return;
|
|
324
|
+
for (const wsDir of resolveWorkspacePackages(projectRoot, workspacePatterns)) {
|
|
325
|
+
const wsNodeModules = join(wsDir, "node_modules");
|
|
326
|
+
if (existsSync(wsNodeModules)) for (const dirPath of listNodeModulesPackageDirs(wsNodeModules)) tryRegister(dirPath, "unknown");
|
|
327
|
+
const wsPkg = readPkgJson(wsDir);
|
|
328
|
+
if (wsPkg) walkDepsFromPkgJson(wsPkg, wsDir);
|
|
303
329
|
}
|
|
304
330
|
}
|
|
331
|
+
walkWorkspacePackages();
|
|
305
332
|
walkKnownPackages();
|
|
306
333
|
walkProjectDeps();
|
|
307
334
|
if (explicitGlobalNodeModules || packages.length === 0 || !nodeModules.local.exists) {
|
|
@@ -18,6 +18,12 @@ interface MonorepoResult<T> {
|
|
|
18
18
|
declare function runAddLibraryBin(root: string): AddLibraryBinResult;
|
|
19
19
|
declare function runEditPackageJson(root: string): EditPackageJsonResult;
|
|
20
20
|
declare function readWorkspacePatterns(root: string): Array<string> | null;
|
|
21
|
+
/**
|
|
22
|
+
* Resolve workspace glob patterns to actual package directories.
|
|
23
|
+
* Handles simple patterns like "packages/*" and "packages/**".
|
|
24
|
+
* Each resolved directory must contain a package.json.
|
|
25
|
+
*/
|
|
26
|
+
declare function resolveWorkspacePackages(root: string, patterns: Array<string>): Array<string>;
|
|
21
27
|
declare function findWorkspaceRoot(start: string): string | null;
|
|
22
28
|
/**
|
|
23
29
|
* Find workspace packages that contain at least one SKILL.md file.
|
|
@@ -27,4 +33,4 @@ declare function runEditPackageJsonAll(root: string): Array<MonorepoResult<EditP
|
|
|
27
33
|
declare function runAddLibraryBinAll(root: string): Array<MonorepoResult<AddLibraryBinResult>> | AddLibraryBinResult;
|
|
28
34
|
declare function runSetupGithubActions(root: string, metaDir: string): SetupGithubActionsResult;
|
|
29
35
|
//#endregion
|
|
30
|
-
export { findPackagesWithSkills as a,
|
|
36
|
+
export { findPackagesWithSkills as a, resolveWorkspacePackages as c, runEditPackageJson as d, runEditPackageJsonAll as f, SetupGithubActionsResult as i, runAddLibraryBin as l, EditPackageJsonResult as n, findWorkspaceRoot as o, runSetupGithubActions as p, MonorepoResult as r, readWorkspacePatterns as s, AddLibraryBinResult as t, runAddLibraryBinAll as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as findSkillFiles } from "./utils-
|
|
1
|
+
import { n as findSkillFiles } from "./utils-BfjM1mQe.mjs";
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { basename, join, relative } from "node:path";
|
|
4
4
|
import { parse } from "yaml";
|
|
@@ -258,12 +258,19 @@ function resolveWorkspacePackages(root, patterns) {
|
|
|
258
258
|
const baseDir = join(root, pattern.replace(/\/\*\*?(\/\*)?$/, ""));
|
|
259
259
|
if (!existsSync(baseDir)) continue;
|
|
260
260
|
if (pattern.includes("**")) collectPackageDirs(baseDir, dirs);
|
|
261
|
-
else if (pattern.endsWith("/*"))
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
261
|
+
else if (pattern.endsWith("/*")) {
|
|
262
|
+
let entries;
|
|
263
|
+
try {
|
|
264
|
+
entries = readdirSync(baseDir, { withFileTypes: true });
|
|
265
|
+
} catch {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
for (const entry of entries) {
|
|
269
|
+
if (!entry.isDirectory()) continue;
|
|
270
|
+
const dir = join(baseDir, entry.name);
|
|
271
|
+
if (existsSync(join(dir, "package.json"))) dirs.push(dir);
|
|
272
|
+
}
|
|
273
|
+
} else {
|
|
267
274
|
const dir = join(root, pattern);
|
|
268
275
|
if (existsSync(join(dir, "package.json"))) dirs.push(dir);
|
|
269
276
|
}
|
|
@@ -357,4 +364,4 @@ function runSetupGithubActions(root, metaDir) {
|
|
|
357
364
|
}
|
|
358
365
|
|
|
359
366
|
//#endregion
|
|
360
|
-
export {
|
|
367
|
+
export { runAddLibraryBin as a, runEditPackageJsonAll as c, resolveWorkspacePackages as i, runSetupGithubActions as l, findWorkspaceRoot as n, runAddLibraryBinAll as o, readWorkspacePatterns as r, runEditPackageJson as s, findPackagesWithSkills as t };
|
package/dist/setup.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as findPackagesWithSkills, c as
|
|
2
|
-
export { AddLibraryBinResult, EditPackageJsonResult, MonorepoResult, SetupGithubActionsResult, findPackagesWithSkills, findWorkspaceRoot, readWorkspacePatterns, runAddLibraryBin, runAddLibraryBinAll, runEditPackageJson, runEditPackageJsonAll, runSetupGithubActions };
|
|
1
|
+
import { a as findPackagesWithSkills, c as resolveWorkspacePackages, d as runEditPackageJson, f as runEditPackageJsonAll, i as SetupGithubActionsResult, l as runAddLibraryBin, n as EditPackageJsonResult, o as findWorkspaceRoot, p as runSetupGithubActions, r as MonorepoResult, s as readWorkspacePatterns, t as AddLibraryBinResult, u as runAddLibraryBinAll } from "./setup-B-zdCBu4.mjs";
|
|
2
|
+
export { AddLibraryBinResult, EditPackageJsonResult, MonorepoResult, SetupGithubActionsResult, findPackagesWithSkills, findWorkspaceRoot, readWorkspacePatterns, resolveWorkspacePackages, runAddLibraryBin, runAddLibraryBinAll, runEditPackageJson, runEditPackageJsonAll, runSetupGithubActions };
|
package/dist/setup.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import { a as
|
|
1
|
+
import "./utils-BfjM1mQe.mjs";
|
|
2
|
+
import { a as runAddLibraryBin, c as runEditPackageJsonAll, i as resolveWorkspacePackages, l as runSetupGithubActions, n as findWorkspaceRoot, o as runAddLibraryBinAll, r as readWorkspacePatterns, s as runEditPackageJson, t as findPackagesWithSkills } from "./setup-mGV2dZrq.mjs";
|
|
3
3
|
|
|
4
|
-
export { findPackagesWithSkills, findWorkspaceRoot, readWorkspacePatterns, runAddLibraryBin, runAddLibraryBinAll, runEditPackageJson, runEditPackageJsonAll, runSetupGithubActions };
|
|
4
|
+
export { findPackagesWithSkills, findWorkspaceRoot, readWorkspacePatterns, resolveWorkspacePackages, runAddLibraryBin, runAddLibraryBinAll, runEditPackageJson, runEditPackageJsonAll, runSetupGithubActions };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
2
3
|
import { dirname, join } from "node:path";
|
|
3
4
|
import { execFileSync } from "node:child_process";
|
|
4
5
|
import { parse } from "yaml";
|
|
@@ -107,30 +108,24 @@ function detectGlobalNodeModules(packageManager) {
|
|
|
107
108
|
return { path: null };
|
|
108
109
|
}
|
|
109
110
|
/**
|
|
110
|
-
* Resolve the directory of a dependency by name.
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* transitive deps are siblings in the .pnpm virtual store node_modules.
|
|
111
|
+
* Resolve the directory of a dependency by name. Tries createRequire first
|
|
112
|
+
* (handles pnpm symlinks), then falls back to walking up node_modules
|
|
113
|
+
* directories (handles packages with export maps that block ./package.json).
|
|
114
114
|
*/
|
|
115
|
-
function resolveDepDir(depName, parentDir
|
|
116
|
-
if (!parentName) return null;
|
|
117
|
-
const roots = Array.isArray(nodeModulesDirs) ? nodeModulesDirs : [nodeModulesDirs];
|
|
118
|
-
for (const nodeModulesDir of roots) {
|
|
119
|
-
const topLevel = join(nodeModulesDir, depName);
|
|
120
|
-
if (existsSync(join(topLevel, "package.json"))) return topLevel;
|
|
121
|
-
}
|
|
122
|
-
const nestedNodeModules = join(parentDir, "node_modules", depName);
|
|
123
|
-
if (existsSync(join(nestedNodeModules, "package.json"))) return nestedNodeModules;
|
|
115
|
+
function resolveDepDir(depName, parentDir) {
|
|
124
116
|
try {
|
|
125
|
-
|
|
126
|
-
const segments = parentName.split("/").length;
|
|
127
|
-
let nmDir = realParent;
|
|
128
|
-
for (let i = 0; i < segments; i++) nmDir = dirname(nmDir);
|
|
129
|
-
const nested = join(nmDir, depName);
|
|
130
|
-
if (existsSync(join(nested, "package.json"))) return nested;
|
|
117
|
+
return dirname(createRequire(join(parentDir, "package.json")).resolve(join(depName, "package.json")));
|
|
131
118
|
} catch (err) {
|
|
132
119
|
const code = err && typeof err === "object" && "code" in err ? err.code : void 0;
|
|
133
|
-
if (code !== "
|
|
120
|
+
if (code && code !== "MODULE_NOT_FOUND" && code !== "ERR_PACKAGE_PATH_NOT_EXPORTED") console.warn(`Warning: could not resolve ${depName} from ${parentDir}: ${err instanceof Error ? err.message : String(err)}`);
|
|
121
|
+
}
|
|
122
|
+
let dir = parentDir;
|
|
123
|
+
while (true) {
|
|
124
|
+
const candidate = join(dir, "node_modules", depName);
|
|
125
|
+
if (existsSync(join(candidate, "package.json"))) return candidate;
|
|
126
|
+
const parent = dirname(dir);
|
|
127
|
+
if (parent === dir) break;
|
|
128
|
+
dir = parent;
|
|
134
129
|
}
|
|
135
130
|
return null;
|
|
136
131
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as parseFrontmatter, i as listNodeModulesPackageDirs, n as findSkillFiles, o as resolveDepDir, r as getDeps, t as detectGlobalNodeModules } from "./utils-
|
|
1
|
+
import { a as parseFrontmatter, i as listNodeModulesPackageDirs, n as findSkillFiles, o as resolveDepDir, r as getDeps, t as detectGlobalNodeModules } from "./utils-BfjM1mQe.mjs";
|
|
2
2
|
|
|
3
3
|
export { detectGlobalNodeModules, findSkillFiles, getDeps, listNodeModulesPackageDirs, parseFrontmatter, resolveDepDir };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/intent",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"description": "Ship compositional knowledge for AI coding agents alongside your npm packages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -30,12 +30,15 @@
|
|
|
30
30
|
"yaml": "^2.7.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"
|
|
33
|
+
"@verdaccio/node-api": "6.0.0-6-next.76",
|
|
34
|
+
"tsdown": "^0.19.0",
|
|
35
|
+
"verdaccio": "^6.3.2"
|
|
34
36
|
},
|
|
35
37
|
"scripts": {
|
|
36
38
|
"prepack": "npm run build",
|
|
37
39
|
"build": "tsdown src/index.ts src/cli.ts src/setup.ts src/intent-library.ts src/library-scanner.ts --format esm --dts",
|
|
38
|
-
"test:lib": "vitest run",
|
|
40
|
+
"test:lib": "vitest run --exclude 'tests/integration/**'",
|
|
41
|
+
"test:integration": "vitest run tests/integration/",
|
|
39
42
|
"test:types": "tsc --noEmit"
|
|
40
43
|
}
|
|
41
44
|
}
|