@tanstack/intent 0.0.37 → 0.0.38
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-BON5hn4L.mjs} +11 -11
- package/dist/{cli-support-CHEYZ9xj.mjs → cli-support-BlSsqyx7.mjs} +3 -3
- package/dist/cli.mjs +9 -9
- package/dist/{core-BlJqkv0a.mjs → core-baYs6H7Z.mjs} +4 -4
- package/dist/core.mjs +5 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +5 -5
- package/dist/{install-DA19Vg17.mjs → install-BPWtaOuo.mjs} +1 -1
- package/dist/install-RZpz279M.mjs +7 -0
- package/dist/intent-library.mjs +4 -4
- package/dist/{list-D6osUZl7.mjs → list-iLIL-EO3.mjs} +6 -6
- package/dist/{load-CzvLUFur.mjs → load-8868G50-.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-DgRSm4y0.mjs → scanner-ByG70-E3.mjs} +2 -2
- package/dist/{scanner-W6797hWs.mjs → scanner-DwYsjXzI.mjs} +1 -1
- 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/{validate-ugk2DZBd.mjs → validate-BL1SYAwh.mjs} +3 -3
- package/dist/workspace-patterns-BWMz7TsI.mjs +4 -0
- package/dist/workspace-patterns-BZLEaMcS.mjs +195 -0
- package/package.json +3 -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-ByG70-E3.mjs");
|
|
35
35
|
try {
|
|
36
36
|
return scanForIntents(void 0, options);
|
|
37
37
|
} catch (err) {
|
|
@@ -74,20 +74,20 @@ async function resolveStaleTargets(targetDir) {
|
|
|
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-BON5hn4L.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-iLIL-EO3.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-8868G50-.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-BlSsqyx7.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-BL1SYAwh.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-BlSsqyx7.mjs"), import("./install-RZpz279M.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-BlSsqyx7.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-BlSsqyx7.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-BlSsqyx7.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-BlSsqyx7.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-DwYsjXzI.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-DwYsjXzI.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-baYs6H7Z.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-DwYsjXzI.mjs";
|
|
4
|
+
import "./workspace-patterns-BZLEaMcS.mjs";
|
|
5
5
|
import { t as readIntentArtifacts } from "./artifact-coverage-DgWuVqUp.mjs";
|
|
6
6
|
import { n as checkStaleness } from "./staleness-CFr3W-RI.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-BON5hn4L.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-BON5hn4L.mjs";
|
|
5
|
+
import { n as runInstallCommand, t as INSTALL_PROMPT } from "./install-BPWtaOuo.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-BON5hn4L.mjs";
|
|
8
|
+
import { t as INSTALL_PROMPT } from "./install-BPWtaOuo.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-DwYsjXzI.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-BON5hn4L.mjs";
|
|
8
|
+
import { n as listIntentSkills } from "./core-baYs6H7Z.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-DwYsjXzI.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-BON5hn4L.mjs";
|
|
9
|
+
import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-baYs6H7Z.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,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-DwYsjXzI.mjs";
|
|
4
|
+
import "./workspace-patterns-BZLEaMcS.mjs";
|
|
5
5
|
|
|
6
6
|
export { scanForIntents };
|
|
@@ -1,6 +1,6 @@
|
|
|
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";
|
|
@@ -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,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-BON5hn4L.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.38",
|
|
4
4
|
"description": "Ship compositional knowledge for AI coding agents alongside your npm packages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"cac": "^6.7.14",
|
|
35
|
-
"
|
|
35
|
+
"jsonc-parser": "^3.3.1",
|
|
36
|
+
"yaml": "2.8.3"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@verdaccio/node-api": "6.0.0-6-next.76",
|
|
@@ -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 };
|