@tanstack/intent 0.0.37 → 0.0.39
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-support-Dk2rgYli.mjs → cli-support-Dmpj1iyQ.mjs} +12 -12
- package/dist/{cli-support-CHEYZ9xj.mjs → cli-support-OrWuIzI3.mjs} +3 -3
- package/dist/cli.mjs +9 -9
- package/dist/{core-BlJqkv0a.mjs → core-0H8zUKIh.mjs} +4 -4
- package/dist/core.mjs +5 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +6 -6
- package/dist/{install-DA19Vg17.mjs → install-7BAmUZFB.mjs} +1 -1
- package/dist/install-Brf5PORN.mjs +7 -0
- package/dist/intent-library.mjs +4 -4
- package/dist/{list-D6osUZl7.mjs → list-DNPHxYpR.mjs} +6 -6
- package/dist/{load-CzvLUFur.mjs → load-CK7vr50h.mjs} +6 -6
- package/dist/{project-context-CfSZGJFC.mjs → project-context-Dx6XIJJo.mjs} +1 -1
- package/dist/{resolver-BTeG2oyZ.mjs → resolver-CP0S8UjZ.mjs} +1 -1
- package/dist/{scanner-W6797hWs.mjs → scanner-BaOA18pn.mjs} +12 -40
- package/dist/{scanner-DgRSm4y0.mjs → scanner-BoB20xOF.mjs} +2 -2
- package/dist/{setup-ldoQOQot.d.mts → setup-2SE9zYJk.d.mts} +1 -0
- package/dist/{setup-B-1hsdmA.mjs → setup-kvWN4xCr.mjs} +2 -2
- package/dist/setup.d.mts +1 -1
- package/dist/setup.mjs +3 -3
- package/dist/{staleness-DpyuNdd5.mjs → staleness-IIyVmUxU.mjs} +1 -1
- package/dist/{staleness-CFr3W-RI.mjs → staleness-V-nwqFUh.mjs} +37 -17
- package/dist/{validate-ugk2DZBd.mjs → validate-BYUd0qb8.mjs} +3 -3
- package/dist/workspace-patterns-BWMz7TsI.mjs +4 -0
- package/dist/workspace-patterns-BZLEaMcS.mjs +195 -0
- package/package.json +5 -2
- package/dist/install-BAUG1FD8.mjs +0 -7
- package/dist/workspace-patterns-BGQcoSy7.mjs +0 -4
- package/dist/workspace-patterns-CNhdqCO4.mjs +0 -172
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
1
|
+
import { t as resolveProjectContext } from "./project-context-Dx6XIJJo.mjs";
|
|
2
2
|
import { t as fail } from "./cli-error-BrMXlbtx.mjs";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { dirname, join, relative, resolve } from "node:path";
|
|
@@ -31,7 +31,7 @@ function getCheckSkillsWorkflowAdvisories(root) {
|
|
|
31
31
|
return [`Intent workflow update available: run \`npx @tanstack/intent@latest setup\` to refresh ${relative(process.cwd(), workflowPath) || workflowPath}.`];
|
|
32
32
|
}
|
|
33
33
|
async function scanIntentsOrFail(options) {
|
|
34
|
-
const { scanForIntents } = await import("./scanner-
|
|
34
|
+
const { scanForIntents } = await import("./scanner-BoB20xOF.mjs");
|
|
35
35
|
try {
|
|
36
36
|
return scanForIntents(void 0, options);
|
|
37
37
|
} catch (err) {
|
|
@@ -68,26 +68,26 @@ async function resolveStaleTargets(targetDir) {
|
|
|
68
68
|
targetPath: targetDir
|
|
69
69
|
});
|
|
70
70
|
const workflowAdvisories = getCheckSkillsWorkflowAdvisories(context.workspaceRoot ?? context.packageRoot ?? resolvedRoot);
|
|
71
|
-
const { buildWorkspaceCoverageSignals, checkStaleness, readPackageName } = await import("./staleness-
|
|
71
|
+
const { buildWorkspaceCoverageSignals, checkStaleness, readPackageName } = await import("./staleness-IIyVmUxU.mjs");
|
|
72
72
|
const isWorkspaceRootTarget = context.workspaceRoot !== null && resolvedRoot === context.workspaceRoot;
|
|
73
73
|
if (context.packageRoot && !isWorkspaceRootTarget && (context.targetSkillsDir !== null || context.workspaceRoot === null)) return {
|
|
74
74
|
reports: [await checkStaleness(context.packageRoot, readPackageName(context.packageRoot), context.workspaceRoot ?? context.packageRoot)],
|
|
75
75
|
workflowAdvisories
|
|
76
76
|
};
|
|
77
|
-
const {
|
|
77
|
+
const { findWorkspaceRoot, getWorkspaceInfo } = await import("./workspace-patterns-BWMz7TsI.mjs");
|
|
78
78
|
const workspaceRoot = findWorkspaceRoot(resolvedRoot);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
const reports = await Promise.all(packageDirsWithSkills.map((packageDir) => checkStaleness(packageDir, readPackageName(packageDir), workspaceRoot)));
|
|
79
|
+
const workspaceInfo = workspaceRoot ? getWorkspaceInfo(workspaceRoot) : null;
|
|
80
|
+
if (workspaceInfo) {
|
|
81
|
+
const reports = await Promise.all(workspaceInfo.packageDirsWithSkills.map((packageDir) => checkStaleness(packageDir, readPackageName(packageDir), workspaceInfo.root)));
|
|
83
82
|
const { readIntentArtifacts } = await import("./artifact-coverage-DA26utB1.mjs");
|
|
83
|
+
const artifacts = existsSync(join(workspaceInfo.root, "_artifacts")) ? readIntentArtifacts(workspaceInfo.root) : null;
|
|
84
84
|
const coverageSignals = buildWorkspaceCoverageSignals({
|
|
85
|
-
artifactRoot:
|
|
86
|
-
artifacts
|
|
87
|
-
packageDirs:
|
|
85
|
+
artifactRoot: workspaceInfo.root,
|
|
86
|
+
artifacts,
|
|
87
|
+
packageDirs: workspaceInfo.packageDirs
|
|
88
88
|
});
|
|
89
89
|
if (coverageSignals.length > 0) reports.push({
|
|
90
|
-
library: relative(process.cwd(),
|
|
90
|
+
library: relative(process.cwd(), workspaceInfo.root) || "workspace",
|
|
91
91
|
currentVersion: null,
|
|
92
92
|
skillVersion: null,
|
|
93
93
|
versionDrift: null,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./utils-mdb4i6VA.mjs";
|
|
2
|
-
import "./workspace-patterns-
|
|
3
|
-
import "./project-context-
|
|
4
|
-
import { a as printDebugInfo, c as scanOptionsFromGlobalFlags, i as getMetaDir, l as printWarnings, n as coreOptionsFromGlobalFlags, o as resolveStaleTargets, r as getCheckSkillsWorkflowAdvisories, s as scanIntentsOrFail, t as INTENT_CHECK_SKILLS_WORKFLOW_VERSION } from "./cli-support-
|
|
2
|
+
import "./workspace-patterns-BZLEaMcS.mjs";
|
|
3
|
+
import "./project-context-Dx6XIJJo.mjs";
|
|
4
|
+
import { a as printDebugInfo, c as scanOptionsFromGlobalFlags, i as getMetaDir, l as printWarnings, n as coreOptionsFromGlobalFlags, o as resolveStaleTargets, r as getCheckSkillsWorkflowAdvisories, s as scanIntentsOrFail, t as INTENT_CHECK_SKILLS_WORKFLOW_VERSION } from "./cli-support-Dmpj1iyQ.mjs";
|
|
5
5
|
|
|
6
6
|
export { INTENT_CHECK_SKILLS_WORKFLOW_VERSION, coreOptionsFromGlobalFlags, getCheckSkillsWorkflowAdvisories, getMetaDir, printDebugInfo, printWarnings, resolveStaleTargets, scanIntentsOrFail, scanOptionsFromGlobalFlags };
|
package/dist/cli.mjs
CHANGED
|
@@ -9,31 +9,31 @@ function createCli() {
|
|
|
9
9
|
const cli = cac("intent");
|
|
10
10
|
cli.usage("<command> [options]");
|
|
11
11
|
cli.command("list", "Discover intent-enabled packages from the project or workspace").usage("list [--json] [--debug] [--exclude <pattern>] [--global] [--global-only]").option("--json", "Output JSON").option("--debug", "Print discovery debug details to stderr").option("--exclude <pattern>", "Exclude package name glob").option("--global", "Include global packages after project packages").option("--global-only", "List global packages only").example("list").example("list --json").example("list --global").action(async (options) => {
|
|
12
|
-
const { runListCommand } = await import("./list-
|
|
12
|
+
const { runListCommand } = await import("./list-DNPHxYpR.mjs");
|
|
13
13
|
await runListCommand(options);
|
|
14
14
|
});
|
|
15
15
|
cli.command("load [use]", "Load a compact skill use and print its SKILL.md").usage("load <use> [--path] [--json] [--debug] [--exclude <pattern>] [--global] [--global-only]").option("--path", "Print the resolved skill path instead of file content").option("--json", "Output JSON").option("--debug", "Print resolution debug details to stderr").option("--exclude <pattern>", "Exclude package name glob").option("--global", "Load from project packages, then global packages").option("--global-only", "Load from global packages only").example("load @tanstack/query#core").example("load @tanstack/query#core --path").action(async (use, options) => {
|
|
16
|
-
const { runLoadCommand } = await import("./load-
|
|
16
|
+
const { runLoadCommand } = await import("./load-CK7vr50h.mjs");
|
|
17
17
|
await runLoadCommand(use, options);
|
|
18
18
|
});
|
|
19
19
|
cli.command("meta [name]", "List meta-skills, or print one by name").usage("meta [name]").example("meta").example("meta domain-discovery").action(async (name) => {
|
|
20
|
-
const [{ getMetaDir }, { runMetaCommand }] = await Promise.all([import("./cli-support-
|
|
20
|
+
const [{ getMetaDir }, { runMetaCommand }] = await Promise.all([import("./cli-support-OrWuIzI3.mjs"), import("./meta-CYV9EzM8.mjs")]);
|
|
21
21
|
await runMetaCommand(name, getMetaDir());
|
|
22
22
|
});
|
|
23
23
|
cli.command("validate [dir]", "Validate skill files").usage("validate [dir] [--github-summary]").option("--github-summary", "Write a GitHub Actions step summary").example("validate").example("validate packages/query/skills").action(async (dir, options) => {
|
|
24
|
-
const { runValidateCommand } = await import("./validate-
|
|
24
|
+
const { runValidateCommand } = await import("./validate-BYUd0qb8.mjs");
|
|
25
25
|
await runValidateCommand(dir, options);
|
|
26
26
|
});
|
|
27
27
|
cli.command("install", "Create or update skill loading guidance in an agent config file").usage("install [--map] [--dry-run] [--print-prompt] [--global] [--global-only]").option("--map", "Write explicit skill-to-task mappings").option("--dry-run", "Print the generated block without writing").option("--print-prompt", "Print the legacy agent setup prompt instead of writing").option("--global", "Include global packages after project packages").option("--global-only", "Install mappings from global packages only").example("install").example("install --map").example("install --dry-run").example("install --print-prompt").example("install --global").action(async (options) => {
|
|
28
|
-
const [{ scanIntentsOrFail }, { runInstallCommand }] = await Promise.all([import("./cli-support-
|
|
28
|
+
const [{ scanIntentsOrFail }, { runInstallCommand }] = await Promise.all([import("./cli-support-OrWuIzI3.mjs"), import("./install-Brf5PORN.mjs")]);
|
|
29
29
|
await runInstallCommand(options, scanIntentsOrFail);
|
|
30
30
|
});
|
|
31
31
|
cli.command("scaffold", "Print maintainer scaffold prompt").usage("scaffold").action(async () => {
|
|
32
|
-
const [{ getMetaDir }, { runScaffoldCommand }] = await Promise.all([import("./cli-support-
|
|
32
|
+
const [{ getMetaDir }, { runScaffoldCommand }] = await Promise.all([import("./cli-support-OrWuIzI3.mjs"), import("./scaffold-D2vwv9ls.mjs")]);
|
|
33
33
|
runScaffoldCommand(getMetaDir());
|
|
34
34
|
});
|
|
35
35
|
cli.command("stale [dir]", "Check skills for staleness in the current package or workspace").usage("stale [dir] [--json] [--github-review]").option("--json", "Output JSON").option("--github-review", "Write GitHub Actions review PR files").option("--package-label <label>", "Fallback package label for review PRs").example("stale").example("stale packages/query").example("stale --json").action(async (targetDir, options) => {
|
|
36
|
-
const [{ resolveStaleTargets }, { runStaleCommand }] = await Promise.all([import("./cli-support-
|
|
36
|
+
const [{ resolveStaleTargets }, { runStaleCommand }] = await Promise.all([import("./cli-support-OrWuIzI3.mjs"), import("./stale-flPZnWfI.mjs")]);
|
|
37
37
|
await runStaleCommand(targetDir, options, resolveStaleTargets);
|
|
38
38
|
});
|
|
39
39
|
cli.command("edit-package-json", "Update package.json files so skills are published").usage("edit-package-json").action(async () => {
|
|
@@ -41,11 +41,11 @@ function createCli() {
|
|
|
41
41
|
await runEditPackageJsonCommand(process.cwd());
|
|
42
42
|
});
|
|
43
43
|
cli.command("setup", "Copy Intent CI workflow templates into .github/workflows/").usage("setup").action(async () => {
|
|
44
|
-
const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-
|
|
44
|
+
const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-OrWuIzI3.mjs"), import("./setup-github-actions-emXSyGy3.mjs")]);
|
|
45
45
|
await runSetupGithubActionsCommand(process.cwd(), getMetaDir());
|
|
46
46
|
});
|
|
47
47
|
cli.command("setup-github-actions", "Copy Intent CI workflow templates into .github/workflows/").usage("setup-github-actions").action(async () => {
|
|
48
|
-
const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-
|
|
48
|
+
const [{ getMetaDir }, { runSetupGithubActionsCommand }] = await Promise.all([import("./cli-support-OrWuIzI3.mjs"), import("./setup-github-actions-emXSyGy3.mjs")]);
|
|
49
49
|
await runSetupGithubActionsCommand(process.cwd(), getMetaDir());
|
|
50
50
|
});
|
|
51
51
|
cli.command("help [command]", "Display help for a command").action((commandName) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { o as resolveDepDir, r as getDeps, s as toPosixPath } from "./utils-mdb4i6VA.mjs";
|
|
2
|
-
import { n as scanIntentPackageAtRoot, t as scanForIntents } from "./scanner-
|
|
3
|
-
import {
|
|
2
|
+
import { n as scanIntentPackageAtRoot, t as scanForIntents } from "./scanner-BaOA18pn.mjs";
|
|
3
|
+
import { o as resolveWorkspacePackages } from "./workspace-patterns-BZLEaMcS.mjs";
|
|
4
4
|
import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-umYvZl94.mjs";
|
|
5
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
6
|
-
import { a as compileExcludePatterns, c as warningMentionsPackage, i as resolveSkillUse, l as readPackageJson, o as getEffectiveExcludePatterns, r as resolveSkillEntry, s as isPackageExcluded, t as ResolveSkillUseError } from "./resolver-
|
|
5
|
+
import { t as resolveProjectContext } from "./project-context-Dx6XIJJo.mjs";
|
|
6
|
+
import { a as compileExcludePatterns, c as warningMentionsPackage, i as resolveSkillUse, l as readPackageJson, o as getEffectiveExcludePatterns, r as resolveSkillEntry, s as isPackageExcluded, t as ResolveSkillUseError } from "./resolver-CP0S8UjZ.mjs";
|
|
7
7
|
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
8
8
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
9
9
|
|
package/dist/core.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./utils-mdb4i6VA.mjs";
|
|
2
2
|
import "./skill-paths-DNOHrvL5.mjs";
|
|
3
|
-
import "./scanner-
|
|
4
|
-
import "./workspace-patterns-
|
|
5
|
-
import "./project-context-
|
|
6
|
-
import "./resolver-
|
|
7
|
-
import { i as resolveIntentSkill, n as listIntentSkills, r as loadIntentSkill, t as IntentCoreError } from "./core-
|
|
3
|
+
import "./scanner-BaOA18pn.mjs";
|
|
4
|
+
import "./workspace-patterns-BZLEaMcS.mjs";
|
|
5
|
+
import "./project-context-Dx6XIJJo.mjs";
|
|
6
|
+
import "./resolver-CP0S8UjZ.mjs";
|
|
7
|
+
import { i as resolveIntentSkill, n as listIntentSkills, r as loadIntentSkill, t as IntentCoreError } from "./core-0H8zUKIh.mjs";
|
|
8
8
|
|
|
9
9
|
export { IntentCoreError, listIntentSkills, loadIntentSkill, resolveIntentSkill };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as SkillStaleness, a as IntentArtifactSet, b as VersionConflict, c as IntentConfig, d as MetaFeedbackPayload, f as MetaSkillName, g as SkillEntry, i as IntentArtifactFile, l as IntentPackage, m as ScanResult, n as FeedbackPayload, o as IntentArtifactSkill, p as ScanOptions, r as IntentArtifactCoverageIgnore, s as IntentArtifactWarning, t as AgentName, u as IntentProjectConfig, v as StalenessReport, y as StalenessSignal } from "./types-S2zpibHp.mjs";
|
|
2
|
-
import { i as runEditPackageJson, o as runSetupGithubActions, r as SetupGithubActionsResult, t as EditPackageJsonResult } from "./setup-
|
|
2
|
+
import { i as runEditPackageJson, o as runSetupGithubActions, r as SetupGithubActionsResult, t as EditPackageJsonResult } from "./setup-2SE9zYJk.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/scanner.d.ts
|
|
5
5
|
declare function scanForIntents(root?: string, options?: ScanOptions): ScanResult;
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { a as parseFrontmatter, n as findSkillFiles, o as resolveDepDir, r as getDeps } from "./utils-mdb4i6VA.mjs";
|
|
2
2
|
import "./skill-paths-DNOHrvL5.mjs";
|
|
3
|
-
import { t as scanForIntents } from "./scanner-
|
|
4
|
-
import "./workspace-patterns-
|
|
3
|
+
import { t as scanForIntents } from "./scanner-BaOA18pn.mjs";
|
|
4
|
+
import "./workspace-patterns-BZLEaMcS.mjs";
|
|
5
5
|
import { t as readIntentArtifacts } from "./artifact-coverage-DgWuVqUp.mjs";
|
|
6
|
-
import { n as checkStaleness } from "./staleness-
|
|
6
|
+
import { n as checkStaleness } from "./staleness-V-nwqFUh.mjs";
|
|
7
7
|
import { n as collectStaleReviewItems, r as createFailedStaleReviewItem, t as buildStaleReviewBody } from "./workflow-review-CwcR2ge4.mjs";
|
|
8
8
|
import { i as parseSkillUse, n as formatSkillUse, r as isSkillUseParseError, t as SkillUseParseError } from "./skill-use-umYvZl94.mjs";
|
|
9
|
-
import "./project-context-
|
|
10
|
-
import { i as resolveSkillUse, n as isResolveSkillUseError, t as ResolveSkillUseError } from "./resolver-
|
|
11
|
-
import { r as runSetupGithubActions, t as runEditPackageJson } from "./setup-
|
|
9
|
+
import "./project-context-Dx6XIJJo.mjs";
|
|
10
|
+
import { i as resolveSkillUse, n as isResolveSkillUseError, t as ResolveSkillUseError } from "./resolver-CP0S8UjZ.mjs";
|
|
11
|
+
import { r as runSetupGithubActions, t as runEditPackageJson } from "./setup-kvWN4xCr.mjs";
|
|
12
12
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
13
13
|
import { join } from "node:path";
|
|
14
14
|
import { execFileSync, execSync } from "node:child_process";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-umYvZl94.mjs";
|
|
2
2
|
import { t as fail } from "./cli-error-BrMXlbtx.mjs";
|
|
3
|
-
import { c as scanOptionsFromGlobalFlags, l as printWarnings } from "./cli-support-
|
|
3
|
+
import { c as scanOptionsFromGlobalFlags, l as printWarnings } from "./cli-support-Dmpj1iyQ.mjs";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { dirname, join, relative } from "node:path";
|
|
6
6
|
import { parse } from "yaml";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "./utils-mdb4i6VA.mjs";
|
|
2
|
+
import "./workspace-patterns-BZLEaMcS.mjs";
|
|
3
|
+
import "./project-context-Dx6XIJJo.mjs";
|
|
4
|
+
import "./cli-support-Dmpj1iyQ.mjs";
|
|
5
|
+
import { n as runInstallCommand, t as INSTALL_PROMPT } from "./install-7BAmUZFB.mjs";
|
|
6
|
+
|
|
7
|
+
export { INSTALL_PROMPT, runInstallCommand };
|
package/dist/intent-library.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "./utils-mdb4i6VA.mjs";
|
|
3
3
|
import "./skill-paths-DNOHrvL5.mjs";
|
|
4
|
-
import "./workspace-patterns-
|
|
5
|
-
import "./project-context-
|
|
4
|
+
import "./workspace-patterns-BZLEaMcS.mjs";
|
|
5
|
+
import "./project-context-Dx6XIJJo.mjs";
|
|
6
6
|
import { n as printSkillTree, r as printTable, t as computeSkillNameWidth } from "./display-CVeoAwBd.mjs";
|
|
7
|
-
import "./cli-support-
|
|
8
|
-
import { t as INSTALL_PROMPT } from "./install-
|
|
7
|
+
import "./cli-support-Dmpj1iyQ.mjs";
|
|
8
|
+
import { t as INSTALL_PROMPT } from "./install-7BAmUZFB.mjs";
|
|
9
9
|
import { t as scanLibrary } from "./library-scanner-CHepLJQJ.mjs";
|
|
10
10
|
|
|
11
11
|
//#region src/intent-library.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./utils-mdb4i6VA.mjs";
|
|
2
2
|
import "./skill-paths-DNOHrvL5.mjs";
|
|
3
|
-
import "./scanner-
|
|
4
|
-
import "./workspace-patterns-
|
|
5
|
-
import "./project-context-
|
|
6
|
-
import "./resolver-
|
|
7
|
-
import { a as printDebugInfo, l as printWarnings, n as coreOptionsFromGlobalFlags } from "./cli-support-
|
|
8
|
-
import { n as listIntentSkills } from "./core-
|
|
3
|
+
import "./scanner-BaOA18pn.mjs";
|
|
4
|
+
import "./workspace-patterns-BZLEaMcS.mjs";
|
|
5
|
+
import "./project-context-Dx6XIJJo.mjs";
|
|
6
|
+
import "./resolver-CP0S8UjZ.mjs";
|
|
7
|
+
import { a as printDebugInfo, l as printWarnings, n as coreOptionsFromGlobalFlags } from "./cli-support-Dmpj1iyQ.mjs";
|
|
8
|
+
import { n as listIntentSkills } from "./core-0H8zUKIh.mjs";
|
|
9
9
|
|
|
10
10
|
//#region src/commands/list.ts
|
|
11
11
|
function printListDebug(result) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "./utils-mdb4i6VA.mjs";
|
|
2
2
|
import "./skill-paths-DNOHrvL5.mjs";
|
|
3
|
-
import "./scanner-
|
|
4
|
-
import "./workspace-patterns-
|
|
5
|
-
import "./project-context-
|
|
6
|
-
import "./resolver-
|
|
3
|
+
import "./scanner-BaOA18pn.mjs";
|
|
4
|
+
import "./workspace-patterns-BZLEaMcS.mjs";
|
|
5
|
+
import "./project-context-Dx6XIJJo.mjs";
|
|
6
|
+
import "./resolver-CP0S8UjZ.mjs";
|
|
7
7
|
import { t as fail } from "./cli-error-BrMXlbtx.mjs";
|
|
8
|
-
import { a as printDebugInfo, n as coreOptionsFromGlobalFlags } from "./cli-support-
|
|
9
|
-
import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-
|
|
8
|
+
import { a as printDebugInfo, n as coreOptionsFromGlobalFlags } from "./cli-support-Dmpj1iyQ.mjs";
|
|
9
|
+
import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-0H8zUKIh.mjs";
|
|
10
10
|
|
|
11
11
|
//#region src/commands/load.ts
|
|
12
12
|
function printLoadDebug(loaded) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as readWorkspacePatterns, r as findWorkspaceRoot } from "./workspace-patterns-BZLEaMcS.mjs";
|
|
2
2
|
import { existsSync, statSync } from "node:fs";
|
|
3
3
|
import { dirname, join, relative, resolve } from "node:path";
|
|
4
4
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as parseSkillUse } from "./skill-use-umYvZl94.mjs";
|
|
2
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
2
|
+
import { t as resolveProjectContext } from "./project-context-Dx6XIJJo.mjs";
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
5
5
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { a as parseFrontmatter, i as listNodeModulesPackageDirs, o as resolveDepDir, r as getDeps, s as toPosixPath, t as detectGlobalNodeModules } from "./utils-mdb4i6VA.mjs";
|
|
2
2
|
import { r as rewriteSkillLoadPaths } from "./skill-paths-DNOHrvL5.mjs";
|
|
3
|
-
import { a as
|
|
3
|
+
import { a as readWorkspacePatterns, o as resolveWorkspacePackages, r as findWorkspaceRoot } from "./workspace-patterns-BZLEaMcS.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
6
6
|
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
7
|
+
import semver from "semver";
|
|
7
8
|
|
|
8
9
|
//#region src/discovery/register.ts
|
|
9
10
|
function isLocalToProject(dirPath, projectRoot) {
|
|
@@ -325,49 +326,20 @@ function topoSort(packages) {
|
|
|
325
326
|
function getPackageDepth(packageRoot, projectRoot) {
|
|
326
327
|
return relative(projectRoot, packageRoot).split(sep).length;
|
|
327
328
|
}
|
|
328
|
-
function
|
|
329
|
-
const
|
|
330
|
-
if (
|
|
331
|
-
|
|
332
|
-
return /^\d+$/.test(identifier) ? Number(identifier) : identifier;
|
|
333
|
-
}) : [];
|
|
334
|
-
return {
|
|
335
|
-
major: Number(match[1]),
|
|
336
|
-
minor: Number(match[2]),
|
|
337
|
-
patch: Number(match[3]),
|
|
338
|
-
prerelease
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
function comparePrereleaseIdentifiers(a, b) {
|
|
342
|
-
if (a === void 0) return b === void 0 ? 0 : 1;
|
|
343
|
-
if (b === void 0) return -1;
|
|
344
|
-
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
345
|
-
if (typeof a === "number") return -1;
|
|
346
|
-
if (typeof b === "number") return 1;
|
|
347
|
-
return a.localeCompare(b);
|
|
329
|
+
function normalizeVersion(version) {
|
|
330
|
+
const validVersion = semver.valid(version);
|
|
331
|
+
if (validVersion) return validVersion;
|
|
332
|
+
return semver.coerce(version)?.version ?? null;
|
|
348
333
|
}
|
|
349
334
|
function comparePackageVersions(a, b) {
|
|
350
|
-
const
|
|
351
|
-
const
|
|
352
|
-
if (!
|
|
353
|
-
if (
|
|
354
|
-
if (
|
|
335
|
+
const versionA = normalizeVersion(a);
|
|
336
|
+
const versionB = normalizeVersion(b);
|
|
337
|
+
if (!versionA || !versionB) {
|
|
338
|
+
if (versionA) return 1;
|
|
339
|
+
if (versionB) return -1;
|
|
355
340
|
return 0;
|
|
356
341
|
}
|
|
357
|
-
|
|
358
|
-
"major",
|
|
359
|
-
"minor",
|
|
360
|
-
"patch"
|
|
361
|
-
]) {
|
|
362
|
-
const diff = parsedA[key] - parsedB[key];
|
|
363
|
-
if (diff !== 0) return diff;
|
|
364
|
-
}
|
|
365
|
-
const length = Math.max(parsedA.prerelease.length, parsedB.prerelease.length);
|
|
366
|
-
for (let i = 0; i < length; i++) {
|
|
367
|
-
const diff = comparePrereleaseIdentifiers(parsedA.prerelease[i], parsedB.prerelease[i]);
|
|
368
|
-
if (diff !== 0) return diff;
|
|
369
|
-
}
|
|
370
|
-
return 0;
|
|
342
|
+
return semver.compare(versionA, versionB);
|
|
371
343
|
}
|
|
372
344
|
function formatVariantWarning(name, variants, chosen) {
|
|
373
345
|
const uniqueVersions = new Set(variants.map((variant) => variant.version));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./utils-mdb4i6VA.mjs";
|
|
2
2
|
import "./skill-paths-DNOHrvL5.mjs";
|
|
3
|
-
import { n as scanIntentPackageAtRoot, t as scanForIntents } from "./scanner-
|
|
4
|
-
import "./workspace-patterns-
|
|
3
|
+
import { n as scanIntentPackageAtRoot, t as scanForIntents } from "./scanner-BaOA18pn.mjs";
|
|
4
|
+
import "./workspace-patterns-BZLEaMcS.mjs";
|
|
5
5
|
|
|
6
6
|
export { scanForIntents };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
//#region src/workspace-patterns.d.ts
|
|
2
|
+
|
|
2
3
|
declare function readWorkspacePatterns(root: string): Array<string> | null;
|
|
3
4
|
declare function resolveWorkspacePackages(root: string, patterns: Array<string>): Array<string>;
|
|
4
5
|
declare function findWorkspaceRoot(start: string): string | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
1
|
+
import { a as readWorkspacePatterns, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-BZLEaMcS.mjs";
|
|
2
|
+
import { t as resolveProjectContext } from "./project-context-Dx6XIJJo.mjs";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { basename, join, relative } from "node:path";
|
|
5
5
|
|
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 "./setup-2SE9zYJk.mjs";
|
|
2
2
|
export { EditPackageJsonResult, MonorepoResult, SetupGithubActionsResult, findPackagesWithSkills, findWorkspaceRoot, readWorkspacePatterns, resolveWorkspacePackages, runEditPackageJson, runEditPackageJsonAll, runSetupGithubActions };
|
package/dist/setup.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./utils-mdb4i6VA.mjs";
|
|
2
|
-
import { a as
|
|
3
|
-
import "./project-context-
|
|
4
|
-
import { n as runEditPackageJsonAll, r as runSetupGithubActions, t as runEditPackageJson } from "./setup-
|
|
2
|
+
import { a as readWorkspacePatterns, o as resolveWorkspacePackages, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-BZLEaMcS.mjs";
|
|
3
|
+
import "./project-context-Dx6XIJJo.mjs";
|
|
4
|
+
import { n as runEditPackageJsonAll, r as runSetupGithubActions, t as runEditPackageJson } from "./setup-kvWN4xCr.mjs";
|
|
5
5
|
|
|
6
6
|
export { findPackagesWithSkills, findWorkspaceRoot, readWorkspacePatterns, resolveWorkspacePackages, runEditPackageJson, runEditPackageJsonAll, runSetupGithubActions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./utils-mdb4i6VA.mjs";
|
|
2
2
|
import "./artifact-coverage-DgWuVqUp.mjs";
|
|
3
|
-
import { n as checkStaleness, r as readPackageName, t as buildWorkspaceCoverageSignals } from "./staleness-
|
|
3
|
+
import { n as checkStaleness, r as readPackageName, t as buildWorkspaceCoverageSignals } from "./staleness-V-nwqFUh.mjs";
|
|
4
4
|
|
|
5
5
|
export { buildWorkspaceCoverageSignals, checkStaleness, readPackageName };
|
|
@@ -1,17 +1,34 @@
|
|
|
1
|
-
import { a as parseFrontmatter, n as findSkillFiles } from "./utils-mdb4i6VA.mjs";
|
|
1
|
+
import { a as parseFrontmatter, n as findSkillFiles, s as toPosixPath } from "./utils-mdb4i6VA.mjs";
|
|
2
2
|
import { t as readIntentArtifacts } from "./artifact-coverage-DgWuVqUp.mjs";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
-
import { isAbsolute, join, relative, resolve
|
|
4
|
+
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
5
|
+
import semver from "semver";
|
|
5
6
|
|
|
6
7
|
//#region src/staleness.ts
|
|
7
8
|
function classifyVersionDrift(oldVer, newVer) {
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
if ((
|
|
12
|
-
if ((
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const oldVersion = normalizeVersion(oldVer);
|
|
10
|
+
const newVersion = normalizeVersion(newVer);
|
|
11
|
+
if (!oldVersion || !newVersion) return null;
|
|
12
|
+
if (semver.eq(oldVersion, newVersion)) return null;
|
|
13
|
+
if (!semver.gt(newVersion, oldVersion)) return null;
|
|
14
|
+
const oldParsed = semver.parse(oldVersion);
|
|
15
|
+
const newParsed = semver.parse(newVersion);
|
|
16
|
+
if (oldParsed && newParsed && oldParsed.major === newParsed.major && oldParsed.minor === newParsed.minor && oldParsed.patch === newParsed.patch && oldParsed.prerelease.length > 0) return "patch";
|
|
17
|
+
switch (semver.diff(oldVersion, newVersion)) {
|
|
18
|
+
case "major":
|
|
19
|
+
case "premajor": return "major";
|
|
20
|
+
case "minor":
|
|
21
|
+
case "preminor": return "minor";
|
|
22
|
+
case "patch":
|
|
23
|
+
case "prepatch":
|
|
24
|
+
case "prerelease": return "patch";
|
|
25
|
+
default: return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function normalizeVersion(version) {
|
|
29
|
+
const validVersion = semver.valid(version);
|
|
30
|
+
if (validVersion) return validVersion;
|
|
31
|
+
return semver.coerce(version)?.version ?? null;
|
|
15
32
|
}
|
|
16
33
|
function readLocalVersion(packageDir) {
|
|
17
34
|
try {
|
|
@@ -75,7 +92,10 @@ function readPackageJson(packageDir) {
|
|
|
75
92
|
}
|
|
76
93
|
}
|
|
77
94
|
function normalizeFilePath(path) {
|
|
78
|
-
return resolve(path)
|
|
95
|
+
return toPosixPath(resolve(path));
|
|
96
|
+
}
|
|
97
|
+
function getRelativePackageDir(artifactRoot, packageDir) {
|
|
98
|
+
return toPosixPath(relative(artifactRoot, packageDir));
|
|
79
99
|
}
|
|
80
100
|
function normalizeList(values) {
|
|
81
101
|
return [...new Set(values ?? [])].sort((a, b) => a.localeCompare(b));
|
|
@@ -86,7 +106,7 @@ function sameStringList(a, b) {
|
|
|
86
106
|
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
87
107
|
}
|
|
88
108
|
function artifactPackageMatches(artifact, packageDir, packageName, artifactRoot) {
|
|
89
|
-
const relPackageDir =
|
|
109
|
+
const relPackageDir = getRelativePackageDir(artifactRoot, packageDir);
|
|
90
110
|
if (!relPackageDir) return true;
|
|
91
111
|
if (artifact.packages.includes(packageName)) return true;
|
|
92
112
|
if (artifact.packages.includes(relPackageDir)) return true;
|
|
@@ -163,11 +183,11 @@ function buildArtifactSignals({ artifactRoot, artifacts, library, packageDir, sk
|
|
|
163
183
|
return signals;
|
|
164
184
|
}
|
|
165
185
|
function artifactCoversPackage(artifact, packageDir, packageName, artifactRoot) {
|
|
166
|
-
const relPackageDir =
|
|
186
|
+
const relPackageDir = getRelativePackageDir(artifactRoot, packageDir);
|
|
167
187
|
return artifact.packages.includes(packageName) || artifact.packages.includes(relPackageDir) || artifact.package === packageName || artifact.package === relPackageDir || artifact.path?.startsWith(`${relPackageDir}/`) === true;
|
|
168
188
|
}
|
|
169
189
|
function artifactIgnoresPackage(artifacts, packageDir, packageName, artifactRoot) {
|
|
170
|
-
const relPackageDir =
|
|
190
|
+
const relPackageDir = getRelativePackageDir(artifactRoot, packageDir);
|
|
171
191
|
return artifacts.ignoredPackages.some((ignored) => ignored.packageName === packageName || ignored.packageName === relPackageDir);
|
|
172
192
|
}
|
|
173
193
|
function buildWorkspaceCoverageSignals({ artifactRoot, artifacts, packageDirs }) {
|
|
@@ -187,17 +207,17 @@ function buildWorkspaceCoverageSignals({ artifactRoot, artifacts, packageDirs })
|
|
|
187
207
|
reasons: ["workspace package is not represented by generated skills or _artifacts coverage"],
|
|
188
208
|
needsReview: true,
|
|
189
209
|
packageName,
|
|
190
|
-
packageRoot:
|
|
210
|
+
packageRoot: getRelativePackageDir(artifactRoot, packageDir)
|
|
191
211
|
});
|
|
192
212
|
}
|
|
193
213
|
return signals;
|
|
194
214
|
}
|
|
195
215
|
async function checkStaleness(packageDir, packageName, artifactRoot = packageDir) {
|
|
196
216
|
const skillsDir = join(packageDir, "skills");
|
|
197
|
-
const library = packageName ??
|
|
217
|
+
const library = packageName ?? readPackageName(packageDir);
|
|
198
218
|
const skillMetas = findSkillFiles(skillsDir).map((filePath) => {
|
|
199
219
|
const fm = parseFrontmatter(filePath);
|
|
200
|
-
const relName = relative(skillsDir, filePath).replace(/[/\\]SKILL\.md$/, "")
|
|
220
|
+
const relName = toPosixPath(relative(skillsDir, filePath)).replace(/[/\\]SKILL\.md$/, "");
|
|
201
221
|
return {
|
|
202
222
|
name: typeof fm?.name === "string" ? fm.name : relName,
|
|
203
223
|
relName,
|
|
@@ -218,7 +238,7 @@ async function checkStaleness(packageDir, packageName, artifactRoot = packageDir
|
|
|
218
238
|
versionDrift,
|
|
219
239
|
skills: skillMetas.map((skill) => {
|
|
220
240
|
const reasons = [];
|
|
221
|
-
if (currentVersion && skill.libraryVersion && skill.libraryVersion !==
|
|
241
|
+
if (currentVersion && skill.libraryVersion && classifyVersionDrift(skill.libraryVersion, currentVersion) !== null) reasons.push(`version drift (${skill.libraryVersion} → ${currentVersion})`);
|
|
222
242
|
const storedShas = syncState?.skills?.[skill.name]?.sources_sha ?? {};
|
|
223
243
|
if (skill.sources && Object.keys(storedShas).length > 0) {
|
|
224
244
|
for (const source of skill.sources) if (!storedShas[source]) reasons.push(`new source (${source})`);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./utils-mdb4i6VA.mjs";
|
|
2
|
-
import { n as findWorkspacePackages } from "./workspace-patterns-
|
|
3
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
2
|
+
import { n as findWorkspacePackages } from "./workspace-patterns-BZLEaMcS.mjs";
|
|
3
|
+
import { t as resolveProjectContext } from "./project-context-Dx6XIJJo.mjs";
|
|
4
4
|
import { n as isCliFailure, t as fail } from "./cli-error-BrMXlbtx.mjs";
|
|
5
|
-
import { l as printWarnings } from "./cli-support-
|
|
5
|
+
import { l as printWarnings } from "./cli-support-Dmpj1iyQ.mjs";
|
|
6
6
|
import { appendFileSync, existsSync, readFileSync } from "node:fs";
|
|
7
7
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
8
8
|
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "./utils-mdb4i6VA.mjs";
|
|
2
|
+
import { a as readWorkspacePatterns, i as getWorkspaceInfo, n as findWorkspacePackages, o as resolveWorkspacePackages, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-BZLEaMcS.mjs";
|
|
3
|
+
|
|
4
|
+
export { findWorkspaceRoot, getWorkspaceInfo };
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { n as findSkillFiles } from "./utils-mdb4i6VA.mjs";
|
|
2
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { parse } from "yaml";
|
|
5
|
+
import { parse as parse$1 } from "jsonc-parser";
|
|
6
|
+
|
|
7
|
+
//#region src/workspace-patterns.ts
|
|
8
|
+
function normalizeWorkspacePattern(pattern) {
|
|
9
|
+
return pattern.replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/+$/, "");
|
|
10
|
+
}
|
|
11
|
+
function normalizeWorkspacePatterns(patterns) {
|
|
12
|
+
return [...new Set(patterns.map(normalizeWorkspacePattern).filter(Boolean))].sort((a, b) => a.localeCompare(b));
|
|
13
|
+
}
|
|
14
|
+
function isRecord(value) {
|
|
15
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16
|
+
}
|
|
17
|
+
function parseWorkspacePatternList(value, fieldName) {
|
|
18
|
+
if (value === void 0 || value === null) return null;
|
|
19
|
+
if (!Array.isArray(value)) throw new TypeError(`${fieldName} must be an array of strings`);
|
|
20
|
+
if (value.some((pattern) => typeof pattern !== "string")) throw new TypeError(`${fieldName} must be an array of strings`);
|
|
21
|
+
return normalizeWorkspacePatterns(value);
|
|
22
|
+
}
|
|
23
|
+
function parseWorkspacePatternField(value, fieldName, nestedKey) {
|
|
24
|
+
if (value === void 0 || value === null) return null;
|
|
25
|
+
if (Array.isArray(value)) return parseWorkspacePatternList(value, fieldName);
|
|
26
|
+
if (isRecord(value)) return parseWorkspacePatternList(value[nestedKey], `${fieldName}.${nestedKey}`);
|
|
27
|
+
throw new TypeError(`${fieldName} must be an array of strings or an object with ${nestedKey}`);
|
|
28
|
+
}
|
|
29
|
+
function hasWorkspaceManifest(dir) {
|
|
30
|
+
return existsSync(join(dir, "package.json")) || existsSync(join(dir, "deno.json")) || existsSync(join(dir, "deno.jsonc"));
|
|
31
|
+
}
|
|
32
|
+
function readYamlFile(path) {
|
|
33
|
+
return parse(readFileSync(path, "utf8"));
|
|
34
|
+
}
|
|
35
|
+
function readJsonFile(path) {
|
|
36
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
37
|
+
}
|
|
38
|
+
function readJsoncFile(path) {
|
|
39
|
+
const errors = [];
|
|
40
|
+
const value = parse$1(readFileSync(path, "utf8"), errors, { allowTrailingComma: true });
|
|
41
|
+
if (errors.length > 0) throw new SyntaxError(errors.map((error) => `JSONC parse error ${error.error} at offset ${error.offset}`).join("; "));
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
function warnConfigError(path, err) {
|
|
45
|
+
const verb = err instanceof SyntaxError ? "parse" : "read";
|
|
46
|
+
console.error(`Warning: failed to ${verb} ${path}: ${err instanceof Error ? err.message : err}`);
|
|
47
|
+
}
|
|
48
|
+
const workspacePatternSources = [
|
|
49
|
+
{
|
|
50
|
+
fileName: "pnpm-workspace.yaml",
|
|
51
|
+
read: readYamlFile,
|
|
52
|
+
getPatterns: (config) => parseWorkspacePatternList(isRecord(config) ? config.packages : void 0, "pnpm-workspace.yaml#packages")
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
fileName: "package.json",
|
|
56
|
+
read: readJsonFile,
|
|
57
|
+
getPatterns: (config) => parseWorkspacePatternField(isRecord(config) ? config.workspaces : void 0, "package.json#workspaces", "packages")
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
fileName: "deno.json",
|
|
61
|
+
read: readJsoncFile,
|
|
62
|
+
getPatterns: (config) => parseWorkspacePatternField(isRecord(config) ? config.workspace : void 0, "deno.json#workspace", "members")
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
fileName: "deno.jsonc",
|
|
66
|
+
read: readJsoncFile,
|
|
67
|
+
getPatterns: (config) => parseWorkspacePatternField(isRecord(config) ? config.workspace : void 0, "deno.jsonc#workspace", "members")
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
const workspacePatternsCache = /* @__PURE__ */ new Map();
|
|
71
|
+
const workspaceRootCache = /* @__PURE__ */ new Map();
|
|
72
|
+
const workspacePackageDirsCache = /* @__PURE__ */ new Map();
|
|
73
|
+
const workspaceInfoCache = /* @__PURE__ */ new Map();
|
|
74
|
+
function readWorkspacePatterns(root) {
|
|
75
|
+
if (workspacePatternsCache.has(root)) return workspacePatternsCache.get(root) ?? null;
|
|
76
|
+
const patterns = readWorkspacePatternsUncached(root);
|
|
77
|
+
workspacePatternsCache.set(root, patterns);
|
|
78
|
+
return patterns;
|
|
79
|
+
}
|
|
80
|
+
function readWorkspacePatternsUncached(root) {
|
|
81
|
+
for (const source of workspacePatternSources) {
|
|
82
|
+
const path = join(root, source.fileName);
|
|
83
|
+
if (!existsSync(path)) continue;
|
|
84
|
+
try {
|
|
85
|
+
const patterns = source.getPatterns(source.read(path));
|
|
86
|
+
if (patterns) return patterns;
|
|
87
|
+
} catch (err) {
|
|
88
|
+
warnConfigError(path, err);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
function readWorkspacePackageDirs(root) {
|
|
94
|
+
if (workspacePackageDirsCache.has(root)) return workspacePackageDirsCache.get(root) ?? null;
|
|
95
|
+
const patterns = readWorkspacePatterns(root);
|
|
96
|
+
if (!patterns) {
|
|
97
|
+
workspacePackageDirsCache.set(root, null);
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
const packageDirs = resolveWorkspacePackages(root, patterns);
|
|
101
|
+
workspacePackageDirsCache.set(root, packageDirs);
|
|
102
|
+
return packageDirs;
|
|
103
|
+
}
|
|
104
|
+
function getWorkspaceInfo(root) {
|
|
105
|
+
if (workspaceInfoCache.has(root)) return workspaceInfoCache.get(root) ?? null;
|
|
106
|
+
const patterns = readWorkspacePatterns(root);
|
|
107
|
+
if (!patterns) {
|
|
108
|
+
workspaceInfoCache.set(root, null);
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
const packageDirs = readWorkspacePackageDirs(root) ?? [];
|
|
112
|
+
const info = {
|
|
113
|
+
root,
|
|
114
|
+
patterns,
|
|
115
|
+
packageDirs,
|
|
116
|
+
packageDirsWithSkills: packageDirs.filter((dir) => {
|
|
117
|
+
const skillsDir = join(dir, "skills");
|
|
118
|
+
return existsSync(skillsDir) && findSkillFiles(skillsDir).length > 0;
|
|
119
|
+
})
|
|
120
|
+
};
|
|
121
|
+
workspaceInfoCache.set(root, info);
|
|
122
|
+
return info;
|
|
123
|
+
}
|
|
124
|
+
function resolveWorkspacePackages(root, patterns) {
|
|
125
|
+
const includedDirs = /* @__PURE__ */ new Set();
|
|
126
|
+
const excludedDirs = /* @__PURE__ */ new Set();
|
|
127
|
+
for (const pattern of normalizeWorkspacePatterns(patterns)) {
|
|
128
|
+
if (pattern.startsWith("!")) {
|
|
129
|
+
resolveWorkspacePatternSegments(root, pattern.slice(1).split("/"), excludedDirs);
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
resolveWorkspacePatternSegments(root, pattern.split("/"), includedDirs);
|
|
133
|
+
}
|
|
134
|
+
return [...includedDirs].filter((dir) => !excludedDirs.has(dir)).sort((a, b) => a.localeCompare(b));
|
|
135
|
+
}
|
|
136
|
+
/** Recursively matches path segments: `*` matches one level, `**` matches zero or more levels. */
|
|
137
|
+
function resolveWorkspacePatternSegments(dir, segments, result) {
|
|
138
|
+
if (segments.length === 0) {
|
|
139
|
+
if (hasWorkspaceManifest(dir)) result.add(dir);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const segment = segments[0];
|
|
143
|
+
const remainingSegments = segments.slice(1);
|
|
144
|
+
if (segment === "**") {
|
|
145
|
+
resolveWorkspacePatternSegments(dir, remainingSegments, result);
|
|
146
|
+
for (const childDir of readChildDirectories(dir)) resolveWorkspacePatternSegments(childDir, segments, result);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (segment === "*") {
|
|
150
|
+
for (const childDir of readChildDirectories(dir)) resolveWorkspacePatternSegments(childDir, remainingSegments, result);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const nextDir = join(dir, segment);
|
|
154
|
+
if (!existsSync(nextDir)) return;
|
|
155
|
+
resolveWorkspacePatternSegments(nextDir, remainingSegments, result);
|
|
156
|
+
}
|
|
157
|
+
function readChildDirectories(dir) {
|
|
158
|
+
try {
|
|
159
|
+
return readdirSync(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name !== "node_modules" && !entry.name.startsWith(".")).map((entry) => join(dir, entry.name));
|
|
160
|
+
} catch (err) {
|
|
161
|
+
console.error(`Warning: could not read directory ${dir}: ${err instanceof Error ? err.message : err}`);
|
|
162
|
+
return [];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function findWorkspaceRoot(start) {
|
|
166
|
+
let dir = start;
|
|
167
|
+
const visited = [];
|
|
168
|
+
while (true) {
|
|
169
|
+
const cached = workspaceRootCache.get(dir);
|
|
170
|
+
if (cached !== void 0) {
|
|
171
|
+
for (const visitedDir of visited) workspaceRootCache.set(visitedDir, cached);
|
|
172
|
+
return cached;
|
|
173
|
+
}
|
|
174
|
+
visited.push(dir);
|
|
175
|
+
if (readWorkspacePatterns(dir)) {
|
|
176
|
+
for (const visitedDir of visited) workspaceRootCache.set(visitedDir, dir);
|
|
177
|
+
return dir;
|
|
178
|
+
}
|
|
179
|
+
const next = dirname(dir);
|
|
180
|
+
if (next === dir) {
|
|
181
|
+
for (const visitedDir of visited) workspaceRootCache.set(visitedDir, null);
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
dir = next;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function findPackagesWithSkills(root) {
|
|
188
|
+
return getWorkspaceInfo(root)?.packageDirsWithSkills ?? [];
|
|
189
|
+
}
|
|
190
|
+
function findWorkspacePackages(root) {
|
|
191
|
+
return readWorkspacePackageDirs(root) ?? [];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
//#endregion
|
|
195
|
+
export { readWorkspacePatterns as a, getWorkspaceInfo as i, findWorkspacePackages as n, resolveWorkspacePackages as o, findWorkspaceRoot as r, findPackagesWithSkills as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/intent",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"description": "Ship compositional knowledge for AI coding agents alongside your npm packages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,9 +32,12 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"cac": "^6.7.14",
|
|
35
|
-
"
|
|
35
|
+
"jsonc-parser": "^3.3.1",
|
|
36
|
+
"semver": "^7.7.4",
|
|
37
|
+
"yaml": "2.8.3"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
40
|
+
"@types/semver": "^7.7.1",
|
|
38
41
|
"@verdaccio/node-api": "6.0.0-6-next.76",
|
|
39
42
|
"tsdown": "^0.19.0",
|
|
40
43
|
"verdaccio": "^6.3.2"
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import "./utils-mdb4i6VA.mjs";
|
|
2
|
-
import "./workspace-patterns-CNhdqCO4.mjs";
|
|
3
|
-
import "./project-context-CfSZGJFC.mjs";
|
|
4
|
-
import "./cli-support-Dk2rgYli.mjs";
|
|
5
|
-
import { n as runInstallCommand, t as INSTALL_PROMPT } from "./install-DA19Vg17.mjs";
|
|
6
|
-
|
|
7
|
-
export { INSTALL_PROMPT, runInstallCommand };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import "./utils-mdb4i6VA.mjs";
|
|
2
|
-
import { a as resolveWorkspacePackages, i as readWorkspacePatterns, n as findWorkspacePackages, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-CNhdqCO4.mjs";
|
|
3
|
-
|
|
4
|
-
export { findPackagesWithSkills, findWorkspacePackages, findWorkspaceRoot };
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { n as findSkillFiles } from "./utils-mdb4i6VA.mjs";
|
|
2
|
-
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
import { parse } from "yaml";
|
|
5
|
-
|
|
6
|
-
//#region src/workspace-patterns.ts
|
|
7
|
-
function normalizeWorkspacePattern(pattern) {
|
|
8
|
-
return pattern.replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/+$/, "");
|
|
9
|
-
}
|
|
10
|
-
function normalizeWorkspacePatterns(patterns) {
|
|
11
|
-
return [...new Set(patterns.map(normalizeWorkspacePattern).filter(Boolean))].sort((a, b) => a.localeCompare(b));
|
|
12
|
-
}
|
|
13
|
-
function parseWorkspacePatterns(value) {
|
|
14
|
-
if (!Array.isArray(value)) return null;
|
|
15
|
-
return normalizeWorkspacePatterns(value.filter((pattern) => typeof pattern === "string"));
|
|
16
|
-
}
|
|
17
|
-
function hasPackageJson(dir) {
|
|
18
|
-
return existsSync(join(dir, "package.json"));
|
|
19
|
-
}
|
|
20
|
-
function stripJsonCommentsAndTrailingCommas(source) {
|
|
21
|
-
let result = "";
|
|
22
|
-
let inString = false;
|
|
23
|
-
let escaped = false;
|
|
24
|
-
for (let index = 0; index < source.length; index += 1) {
|
|
25
|
-
const char = source[index];
|
|
26
|
-
const next = source[index + 1];
|
|
27
|
-
if (inString) {
|
|
28
|
-
result += char;
|
|
29
|
-
if (escaped) escaped = false;
|
|
30
|
-
else if (char === "\\") escaped = true;
|
|
31
|
-
else if (char === "\"") inString = false;
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
if (char === "\"") {
|
|
35
|
-
inString = true;
|
|
36
|
-
result += char;
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
if (char === "/" && next === "/") {
|
|
40
|
-
while (index < source.length && source[index] !== "\n") index += 1;
|
|
41
|
-
if (index < source.length) result += source[index];
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
if (char === "/" && next === "*") {
|
|
45
|
-
const commentStart = index;
|
|
46
|
-
index += 2;
|
|
47
|
-
while (index < source.length && !(source[index] === "*" && source[index + 1] === "/")) index += 1;
|
|
48
|
-
if (index >= source.length) throw new SyntaxError(`Unterminated block comment starting at position ${commentStart}`);
|
|
49
|
-
index += 1;
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
if (char === ",") {
|
|
53
|
-
let lookahead = index + 1;
|
|
54
|
-
while (lookahead < source.length) {
|
|
55
|
-
const la = source[lookahead];
|
|
56
|
-
if (/\s/.test(la)) lookahead += 1;
|
|
57
|
-
else if (la === "/" && source[lookahead + 1] === "/") {
|
|
58
|
-
lookahead += 2;
|
|
59
|
-
while (lookahead < source.length && source[lookahead] !== "\n") lookahead += 1;
|
|
60
|
-
} else if (la === "/" && source[lookahead + 1] === "*") {
|
|
61
|
-
lookahead += 2;
|
|
62
|
-
while (lookahead < source.length && !(source[lookahead] === "*" && source[lookahead + 1] === "/")) lookahead += 1;
|
|
63
|
-
lookahead += 2;
|
|
64
|
-
} else break;
|
|
65
|
-
}
|
|
66
|
-
if (source[lookahead] === "}" || source[lookahead] === "]") continue;
|
|
67
|
-
}
|
|
68
|
-
result += char;
|
|
69
|
-
}
|
|
70
|
-
return result;
|
|
71
|
-
}
|
|
72
|
-
function readJsonFile(path, jsonc = false) {
|
|
73
|
-
const source = readFileSync(path, "utf8");
|
|
74
|
-
return JSON.parse(jsonc ? stripJsonCommentsAndTrailingCommas(source) : source);
|
|
75
|
-
}
|
|
76
|
-
function readWorkspacePatterns(root) {
|
|
77
|
-
const pnpmWs = join(root, "pnpm-workspace.yaml");
|
|
78
|
-
if (existsSync(pnpmWs)) try {
|
|
79
|
-
const patterns = parseWorkspacePatterns(parse(readFileSync(pnpmWs, "utf8")).packages);
|
|
80
|
-
if (patterns) return patterns;
|
|
81
|
-
} catch (err) {
|
|
82
|
-
const verb = err instanceof SyntaxError ? "parse" : "read";
|
|
83
|
-
console.error(`Warning: failed to ${verb} ${pnpmWs}: ${err instanceof Error ? err.message : err}`);
|
|
84
|
-
}
|
|
85
|
-
const pkgPath = join(root, "package.json");
|
|
86
|
-
if (existsSync(pkgPath)) try {
|
|
87
|
-
const workspaces = readJsonFile(pkgPath).workspaces;
|
|
88
|
-
const patterns = parseWorkspacePatterns(workspaces) ?? parseWorkspacePatterns(workspaces?.packages);
|
|
89
|
-
if (patterns) return patterns;
|
|
90
|
-
} catch (err) {
|
|
91
|
-
const verb = err instanceof SyntaxError ? "parse" : "read";
|
|
92
|
-
console.error(`Warning: failed to ${verb} ${pkgPath}: ${err instanceof Error ? err.message : err}`);
|
|
93
|
-
}
|
|
94
|
-
for (const denoConfigName of ["deno.json", "deno.jsonc"]) {
|
|
95
|
-
const denoConfigPath = join(root, denoConfigName);
|
|
96
|
-
if (!existsSync(denoConfigPath)) continue;
|
|
97
|
-
try {
|
|
98
|
-
const patterns = parseWorkspacePatterns(readJsonFile(denoConfigPath, true).workspace);
|
|
99
|
-
if (patterns) return patterns;
|
|
100
|
-
} catch (err) {
|
|
101
|
-
const verb = err instanceof SyntaxError ? "parse" : "read";
|
|
102
|
-
console.error(`Warning: failed to ${verb} ${denoConfigPath}: ${err instanceof Error ? err.message : err}`);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
function resolveWorkspacePackages(root, patterns) {
|
|
108
|
-
const includedDirs = /* @__PURE__ */ new Set();
|
|
109
|
-
const excludedDirs = /* @__PURE__ */ new Set();
|
|
110
|
-
for (const pattern of normalizeWorkspacePatterns(patterns)) {
|
|
111
|
-
if (pattern.startsWith("!")) {
|
|
112
|
-
resolveWorkspacePatternSegments(root, pattern.slice(1).split("/"), excludedDirs);
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
resolveWorkspacePatternSegments(root, pattern.split("/"), includedDirs);
|
|
116
|
-
}
|
|
117
|
-
return [...includedDirs].filter((dir) => !excludedDirs.has(dir)).sort((a, b) => a.localeCompare(b));
|
|
118
|
-
}
|
|
119
|
-
/** Recursively matches path segments: `*` matches one level, `**` matches zero or more levels. */
|
|
120
|
-
function resolveWorkspacePatternSegments(dir, segments, result) {
|
|
121
|
-
if (segments.length === 0) {
|
|
122
|
-
if (hasPackageJson(dir)) result.add(dir);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
const segment = segments[0];
|
|
126
|
-
const remainingSegments = segments.slice(1);
|
|
127
|
-
if (segment === "**") {
|
|
128
|
-
resolveWorkspacePatternSegments(dir, remainingSegments, result);
|
|
129
|
-
for (const childDir of readChildDirectories(dir)) resolveWorkspacePatternSegments(childDir, segments, result);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
if (segment === "*") {
|
|
133
|
-
for (const childDir of readChildDirectories(dir)) resolveWorkspacePatternSegments(childDir, remainingSegments, result);
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const nextDir = join(dir, segment);
|
|
137
|
-
if (!existsSync(nextDir)) return;
|
|
138
|
-
resolveWorkspacePatternSegments(nextDir, remainingSegments, result);
|
|
139
|
-
}
|
|
140
|
-
function readChildDirectories(dir) {
|
|
141
|
-
try {
|
|
142
|
-
return readdirSync(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && entry.name !== "node_modules" && !entry.name.startsWith(".")).map((entry) => join(dir, entry.name));
|
|
143
|
-
} catch (err) {
|
|
144
|
-
console.error(`Warning: could not read directory ${dir}: ${err instanceof Error ? err.message : err}`);
|
|
145
|
-
return [];
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function findWorkspaceRoot(start) {
|
|
149
|
-
let dir = start;
|
|
150
|
-
while (true) {
|
|
151
|
-
if (readWorkspacePatterns(dir)) return dir;
|
|
152
|
-
const next = dirname(dir);
|
|
153
|
-
if (next === dir) return null;
|
|
154
|
-
dir = next;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function findPackagesWithSkills(root) {
|
|
158
|
-
const patterns = readWorkspacePatterns(root);
|
|
159
|
-
if (!patterns) return [];
|
|
160
|
-
return resolveWorkspacePackages(root, patterns).filter((dir) => {
|
|
161
|
-
const skillsDir = join(dir, "skills");
|
|
162
|
-
return existsSync(skillsDir) && findSkillFiles(skillsDir).length > 0;
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
function findWorkspacePackages(root) {
|
|
166
|
-
const patterns = readWorkspacePatterns(root);
|
|
167
|
-
if (!patterns) return [];
|
|
168
|
-
return resolveWorkspacePackages(root, patterns);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
//#endregion
|
|
172
|
-
export { resolveWorkspacePackages as a, readWorkspacePatterns as i, findWorkspacePackages as n, findWorkspaceRoot as r, findPackagesWithSkills as t };
|