@tanstack/intent 0.0.44 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -3
- package/dist/artifact-coverage-BfJ7f-S9.mjs +3 -0
- package/dist/cli-support-BADtMg6z.mjs +6 -0
- package/dist/{cli-support-BNDR3l1g.mjs → cli-support-C8SKYTA4.mjs} +35 -9
- package/dist/cli.mjs +17 -13
- package/dist/{core-qlBI_aQL.mjs → core-hEMP5GMV.mjs} +33 -17
- package/dist/core.d.mts +4 -2
- package/dist/core.mjs +9 -7
- package/dist/{display-0FnzlKRq.mjs → display-CFnFnrtx.mjs} +2 -2
- package/dist/exclude-CBxkyK3Q.mjs +126 -0
- package/dist/excludes-DDMe-4iu.mjs +111 -0
- package/dist/index.d.mts +3 -30
- package/dist/index.mjs +13 -278
- package/dist/{install-D1dsnbr9.mjs → install-BE7gVoNT.mjs} +15 -11
- package/dist/{list-DrChOziX.mjs → list-UqYivAcV.mjs} +17 -15
- package/dist/{load-ll7s5E3J.mjs → load-Dgw151E3.mjs} +11 -9
- package/dist/{meta-BEJIfnPG.mjs → meta-BZMVgIzJ.mjs} +1 -1
- package/dist/{project-context-BRIMzhi4.mjs → project-context-DDCie6Ro.mjs} +1 -1
- package/dist/{resolver-D9cjsz11.mjs → resolver-CZXZ0rft.mjs} +3 -86
- package/dist/{scanner-DaG82zNc.mjs → scanner-2XDBAsbm.mjs} +7 -5
- package/dist/{setup-BklJkH_6.mjs → setup-CMec7fht.mjs} +2 -2
- package/dist/setup.d.mts +1 -1
- package/dist/setup.mjs +4 -4
- package/dist/{skill-paths-B-j0dWDA.mjs → skill-paths-Cr74uFk4.mjs} +1 -1
- package/dist/source-policy-D4slvwwI.mjs +9 -0
- package/dist/source-policy-rGOtjQSM.mjs +247 -0
- package/dist/{stale-C6dPKQ98.mjs → stale-DxZyYibt.mjs} +4 -2
- package/dist/{staleness-BGFfic-Y.mjs → staleness-B8IvDS_9.mjs} +3 -3
- package/dist/staleness-Ctzy2Zac.mjs +5 -0
- package/dist/{types-CIha6LtJ.d.mts → types-oEflMSso.d.mts} +2 -33
- package/dist/utils-BuNMwKct.mjs +3 -0
- package/dist/{utils-9fhWAVua.mjs → utils-Dj49bkF_.mjs} +14 -1
- package/dist/{validate-CEhp9gDs.mjs → validate-B3pkTIZl.mjs} +6 -6
- package/dist/{workflow-review-CrWkP7Hc.mjs → workflow-review-CtOR1bgh.mjs} +1 -1
- package/dist/{workspace-patterns-Bjq_cXww.mjs → workspace-patterns-BBW4c1gr.mjs} +2 -2
- package/dist/{workspace-patterns-BffPlZ1D.mjs → workspace-patterns-Cz_lNhwz.mjs} +1 -1
- package/meta/domain-discovery/SKILL.md +1 -1
- package/meta/generate-skill/SKILL.md +1 -8
- package/meta/tree-generator/SKILL.md +1 -1
- package/package.json +1 -1
- package/dist/artifact-coverage-DA26utB1.mjs +0 -3
- package/dist/cli-support-BtHFD7gl.mjs +0 -6
- package/dist/scanner-BV7X5n_z.mjs +0 -6
- package/dist/staleness-CB3qpVCq.mjs +0 -5
- package/dist/utils-CSPzvaFu.mjs +0 -3
- package/meta/feedback-collection/SKILL.md +0 -234
- /package/dist/{artifact-coverage-DgWuVqUp.mjs → artifact-coverage-nGwun1tt.mjs} +0 -0
- /package/dist/{command-runner-C0yCOHLi.mjs → command-runner-fstUIUhe.mjs} +0 -0
- /package/dist/{edit-package-json-CtuelQ_q.mjs → edit-package-json-DKyJ04t1.mjs} +0 -0
- /package/dist/{scaffold-CLM6bt3c.mjs → scaffold-D2vwv9ls.mjs} +0 -0
- /package/dist/{setup-DhMqESd3.d.mts → setup-DW3pn0QW.d.mts} +0 -0
- /package/dist/{setup-github-actions-CUd1oncY.mjs → setup-github-actions-emXSyGy3.mjs} +0 -0
- /package/dist/{skill-use-umYvZl94.mjs → skill-use-CUrNHf-u.mjs} +0 -0
- /package/dist/{workflow-review-D9Fg1G0P.mjs → workflow-review-wL1Iu2Sf.mjs} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,279 +1,14 @@
|
|
|
1
|
-
import { c as parseFrontmatter, i as getDeps,
|
|
2
|
-
import "./skill-paths-
|
|
3
|
-
import { t as scanForIntents } from "./scanner-
|
|
4
|
-
import "./workspace-patterns-
|
|
5
|
-
import { t as readIntentArtifacts } from "./artifact-coverage-
|
|
6
|
-
import { n as checkStaleness } from "./staleness-
|
|
7
|
-
import { n as collectStaleReviewItems, r as createFailedStaleReviewItem, t as buildStaleReviewBody } from "./workflow-review-
|
|
8
|
-
import { i as parseSkillUse, n as formatSkillUse, r as isSkillUseParseError, t as SkillUseParseError } from "./skill-use-
|
|
9
|
-
import "./project-context-
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { join } from "node:path";
|
|
14
|
-
import { execFileSync, execSync } from "node:child_process";
|
|
1
|
+
import { c as parseFrontmatter, i as getDeps, r as findSkillFiles, u as resolveDepDir } from "./utils-Dj49bkF_.mjs";
|
|
2
|
+
import "./skill-paths-Cr74uFk4.mjs";
|
|
3
|
+
import { t as scanForIntents } from "./scanner-2XDBAsbm.mjs";
|
|
4
|
+
import "./workspace-patterns-Cz_lNhwz.mjs";
|
|
5
|
+
import { t as readIntentArtifacts } from "./artifact-coverage-nGwun1tt.mjs";
|
|
6
|
+
import { n as checkStaleness } from "./staleness-B8IvDS_9.mjs";
|
|
7
|
+
import { n as collectStaleReviewItems, r as createFailedStaleReviewItem, t as buildStaleReviewBody } from "./workflow-review-wL1Iu2Sf.mjs";
|
|
8
|
+
import { i as parseSkillUse, n as formatSkillUse, r as isSkillUseParseError, t as SkillUseParseError } from "./skill-use-CUrNHf-u.mjs";
|
|
9
|
+
import "./project-context-DDCie6Ro.mjs";
|
|
10
|
+
import "./excludes-DDMe-4iu.mjs";
|
|
11
|
+
import { i as resolveSkillUse, n as isResolveSkillUseError, t as ResolveSkillUseError } from "./resolver-CZXZ0rft.mjs";
|
|
12
|
+
import { r as runSetupGithubActions, t as runEditPackageJson } from "./setup-CMec7fht.mjs";
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
const META_FEEDBACK_REPO = "TanStack/intent";
|
|
18
|
-
const SECRET_PATTERNS = [
|
|
19
|
-
/(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36,}/,
|
|
20
|
-
/(?:sk|pk)[-_](?:live|test)[-_][A-Za-z0-9]{24,}/,
|
|
21
|
-
/AKIA[0-9A-Z]{16}/,
|
|
22
|
-
/-----BEGIN (?:RSA |EC )?PRIVATE KEY-----/,
|
|
23
|
-
/eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/,
|
|
24
|
-
/(?:Bearer|token)\s+[A-Za-z0-9_\-.~+/]{20,}/i,
|
|
25
|
-
/[A-Za-z0-9]{32,}(?=.*(?:key|secret|token|password))/i
|
|
26
|
-
];
|
|
27
|
-
function containsSecrets(text) {
|
|
28
|
-
return SECRET_PATTERNS.some((pattern) => pattern.test(text));
|
|
29
|
-
}
|
|
30
|
-
function hasGhCli() {
|
|
31
|
-
try {
|
|
32
|
-
execSync("gh --version", { stdio: "ignore" });
|
|
33
|
-
return true;
|
|
34
|
-
} catch {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function getHomeConfigDir() {
|
|
39
|
-
return process.env.XDG_CONFIG_HOME ?? join(process.env.HOME ?? process.env.USERPROFILE ?? "", ".config");
|
|
40
|
-
}
|
|
41
|
-
function parseFrequency(value) {
|
|
42
|
-
if (value === "always" || value === "never") return value;
|
|
43
|
-
if (typeof value !== "string") return null;
|
|
44
|
-
const match = /^every-(\d+)$/.exec(value);
|
|
45
|
-
if (!match) return null;
|
|
46
|
-
const count = Number(match[1]);
|
|
47
|
-
return Number.isInteger(count) && count > 0 ? `every-${count}` : null;
|
|
48
|
-
}
|
|
49
|
-
function readFrequency(filePath) {
|
|
50
|
-
try {
|
|
51
|
-
return parseFrequency(JSON.parse(readFileSync(filePath, "utf8")).feedback?.frequency);
|
|
52
|
-
} catch {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function resolveFrequency(root) {
|
|
57
|
-
const userFrequency = readFrequency(join(getHomeConfigDir(), "intent", "config.json"));
|
|
58
|
-
if (userFrequency) return userFrequency;
|
|
59
|
-
const projectFrequency = readFrequency(join(root, "intent.config.json"));
|
|
60
|
-
if (projectFrequency) return projectFrequency;
|
|
61
|
-
return "every-5";
|
|
62
|
-
}
|
|
63
|
-
const REQUIRED_FIELDS = [
|
|
64
|
-
"skill",
|
|
65
|
-
"package",
|
|
66
|
-
"skillVersion",
|
|
67
|
-
"task",
|
|
68
|
-
"whatWorked",
|
|
69
|
-
"whatFailed",
|
|
70
|
-
"missing",
|
|
71
|
-
"selfCorrections",
|
|
72
|
-
"userRating"
|
|
73
|
-
];
|
|
74
|
-
function validatePayload(payload) {
|
|
75
|
-
const errors = [];
|
|
76
|
-
if (!payload || typeof payload !== "object") return {
|
|
77
|
-
valid: false,
|
|
78
|
-
errors: ["Payload must be a JSON object"]
|
|
79
|
-
};
|
|
80
|
-
const obj = payload;
|
|
81
|
-
for (const field of REQUIRED_FIELDS) if (typeof obj[field] !== "string" || obj[field].trim() === "") errors.push(`Missing or empty required field: ${field}`);
|
|
82
|
-
if (obj.userRating && ![
|
|
83
|
-
"good",
|
|
84
|
-
"mixed",
|
|
85
|
-
"bad"
|
|
86
|
-
].includes(obj.userRating)) errors.push("userRating must be one of: good, mixed, bad");
|
|
87
|
-
if (containsSecrets(Object.values(obj).filter((v) => typeof v === "string").join("\n"))) errors.push("Payload appears to contain secrets or tokens — submission rejected");
|
|
88
|
-
return {
|
|
89
|
-
valid: errors.length === 0,
|
|
90
|
-
errors
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
const META_REQUIRED_FIELDS = [
|
|
94
|
-
"metaSkill",
|
|
95
|
-
"library",
|
|
96
|
-
"agentUsed",
|
|
97
|
-
"artifactQuality",
|
|
98
|
-
"whatWorked",
|
|
99
|
-
"whatFailed",
|
|
100
|
-
"suggestions",
|
|
101
|
-
"userRating"
|
|
102
|
-
];
|
|
103
|
-
const VALID_META_SKILLS = [
|
|
104
|
-
"domain-discovery",
|
|
105
|
-
"tree-generator",
|
|
106
|
-
"generate-skill",
|
|
107
|
-
"skill-staleness-check"
|
|
108
|
-
];
|
|
109
|
-
const VALID_AGENTS = [
|
|
110
|
-
"claude-code",
|
|
111
|
-
"cursor",
|
|
112
|
-
"copilot",
|
|
113
|
-
"codex",
|
|
114
|
-
"other"
|
|
115
|
-
];
|
|
116
|
-
const VALID_QUALITY_RATINGS = [
|
|
117
|
-
"good",
|
|
118
|
-
"mixed",
|
|
119
|
-
"bad"
|
|
120
|
-
];
|
|
121
|
-
const VALID_INTERVIEW_QUALITY_RATINGS = [
|
|
122
|
-
"good",
|
|
123
|
-
"mixed",
|
|
124
|
-
"bad",
|
|
125
|
-
"skipped"
|
|
126
|
-
];
|
|
127
|
-
const VALID_FAILURE_MODE_QUALITY_RATINGS = [
|
|
128
|
-
"good",
|
|
129
|
-
"mixed",
|
|
130
|
-
"bad",
|
|
131
|
-
"not-applicable"
|
|
132
|
-
];
|
|
133
|
-
function validateMetaPayload(payload) {
|
|
134
|
-
const errors = [];
|
|
135
|
-
if (!payload || typeof payload !== "object") return {
|
|
136
|
-
valid: false,
|
|
137
|
-
errors: ["Payload must be a JSON object"]
|
|
138
|
-
};
|
|
139
|
-
const obj = payload;
|
|
140
|
-
for (const field of META_REQUIRED_FIELDS) if (typeof obj[field] !== "string" || obj[field].trim() === "") errors.push(`Missing or empty required field: ${field}`);
|
|
141
|
-
if (obj.metaSkill && !VALID_META_SKILLS.includes(obj.metaSkill)) errors.push(`metaSkill must be one of: ${VALID_META_SKILLS.join(", ")}`);
|
|
142
|
-
if (obj.agentUsed && !VALID_AGENTS.includes(obj.agentUsed)) errors.push(`agentUsed must be one of: ${VALID_AGENTS.join(", ")}`);
|
|
143
|
-
if (obj.artifactQuality && !VALID_QUALITY_RATINGS.includes(obj.artifactQuality)) errors.push("artifactQuality must be one of: good, mixed, bad");
|
|
144
|
-
if (obj.userRating && !VALID_QUALITY_RATINGS.includes(obj.userRating)) errors.push("userRating must be one of: good, mixed, bad");
|
|
145
|
-
if (obj.interviewQuality && !VALID_INTERVIEW_QUALITY_RATINGS.includes(obj.interviewQuality)) errors.push("interviewQuality must be one of: good, mixed, bad, skipped");
|
|
146
|
-
if (obj.failureModeQuality && !VALID_FAILURE_MODE_QUALITY_RATINGS.includes(obj.failureModeQuality)) errors.push("failureModeQuality must be one of: good, mixed, bad, not-applicable");
|
|
147
|
-
if (containsSecrets(Object.values(obj).filter((v) => typeof v === "string").join("\n"))) errors.push("Payload appears to contain secrets or tokens — submission rejected");
|
|
148
|
-
return {
|
|
149
|
-
valid: errors.length === 0,
|
|
150
|
-
errors
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
function metaToMarkdown(payload) {
|
|
154
|
-
const lines = [
|
|
155
|
-
`# Meta-Skill Feedback: ${payload.metaSkill}`,
|
|
156
|
-
"",
|
|
157
|
-
`**Library:** ${payload.library}`,
|
|
158
|
-
`**Agent:** ${payload.agentUsed}`,
|
|
159
|
-
`**Artifact quality:** ${payload.artifactQuality}`,
|
|
160
|
-
`**Rating:** ${payload.userRating}`
|
|
161
|
-
];
|
|
162
|
-
if (payload.interviewQuality) lines.push(`**Interview quality:** ${payload.interviewQuality}`);
|
|
163
|
-
if (payload.failureModeQuality) lines.push(`**Failure mode quality:** ${payload.failureModeQuality}`);
|
|
164
|
-
lines.push("", "## What Worked", payload.whatWorked, "", "## What Failed", payload.whatFailed, "", "## Suggestions", payload.suggestions);
|
|
165
|
-
return lines.join("\n") + "\n";
|
|
166
|
-
}
|
|
167
|
-
function toMarkdown(payload) {
|
|
168
|
-
const lines = [
|
|
169
|
-
`# Skill Feedback: ${payload.skill}`,
|
|
170
|
-
"",
|
|
171
|
-
`**Package:** ${payload.package}`,
|
|
172
|
-
`**Skill version:** ${payload.skillVersion}`,
|
|
173
|
-
`**Rating:** ${payload.userRating}`,
|
|
174
|
-
"",
|
|
175
|
-
"## Task",
|
|
176
|
-
payload.task,
|
|
177
|
-
"",
|
|
178
|
-
"## What Worked",
|
|
179
|
-
payload.whatWorked,
|
|
180
|
-
"",
|
|
181
|
-
"## What Failed",
|
|
182
|
-
payload.whatFailed,
|
|
183
|
-
"",
|
|
184
|
-
"## Missing",
|
|
185
|
-
payload.missing,
|
|
186
|
-
"",
|
|
187
|
-
"## Self-Corrections",
|
|
188
|
-
payload.selfCorrections
|
|
189
|
-
];
|
|
190
|
-
if (payload.userComments) lines.push("", "## User Comments", payload.userComments);
|
|
191
|
-
return lines.join("\n") + "\n";
|
|
192
|
-
}
|
|
193
|
-
function submitFeedback(payload, repo, opts) {
|
|
194
|
-
const md = toMarkdown(payload);
|
|
195
|
-
if (opts.ghAvailable) try {
|
|
196
|
-
execFileSync("gh", [
|
|
197
|
-
"issue",
|
|
198
|
-
"create",
|
|
199
|
-
"--repo",
|
|
200
|
-
repo,
|
|
201
|
-
"--title",
|
|
202
|
-
`Skill Feedback: ${payload.skill} (${payload.userRating})`,
|
|
203
|
-
"--body",
|
|
204
|
-
"-"
|
|
205
|
-
], {
|
|
206
|
-
input: md,
|
|
207
|
-
stdio: [
|
|
208
|
-
"pipe",
|
|
209
|
-
"pipe",
|
|
210
|
-
"pipe"
|
|
211
|
-
]
|
|
212
|
-
});
|
|
213
|
-
return {
|
|
214
|
-
method: "gh",
|
|
215
|
-
detail: `Submitted issue to ${repo}`
|
|
216
|
-
};
|
|
217
|
-
} catch (err) {
|
|
218
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
219
|
-
console.error(`GitHub submission failed: ${msg}`);
|
|
220
|
-
console.error("Falling back to file output.");
|
|
221
|
-
}
|
|
222
|
-
if (opts.outputPath) {
|
|
223
|
-
writeFileSync(opts.outputPath, md, "utf8");
|
|
224
|
-
return {
|
|
225
|
-
method: "file",
|
|
226
|
-
detail: `Saved to ${opts.outputPath}`
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
return {
|
|
230
|
-
method: "stdout",
|
|
231
|
-
detail: md
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
function submitMetaFeedback(payload, opts) {
|
|
235
|
-
const md = metaToMarkdown(payload);
|
|
236
|
-
if (opts.ghAvailable) try {
|
|
237
|
-
execFileSync("gh", [
|
|
238
|
-
"issue",
|
|
239
|
-
"create",
|
|
240
|
-
"--repo",
|
|
241
|
-
META_FEEDBACK_REPO,
|
|
242
|
-
"--title",
|
|
243
|
-
`Meta-Skill Feedback: ${payload.metaSkill} (${payload.userRating})`,
|
|
244
|
-
"--label",
|
|
245
|
-
`skill:${payload.metaSkill}`,
|
|
246
|
-
"--body",
|
|
247
|
-
"-"
|
|
248
|
-
], {
|
|
249
|
-
input: md,
|
|
250
|
-
stdio: [
|
|
251
|
-
"pipe",
|
|
252
|
-
"pipe",
|
|
253
|
-
"pipe"
|
|
254
|
-
]
|
|
255
|
-
});
|
|
256
|
-
return {
|
|
257
|
-
method: "gh",
|
|
258
|
-
detail: `Submitted issue to ${META_FEEDBACK_REPO}`
|
|
259
|
-
};
|
|
260
|
-
} catch (err) {
|
|
261
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
262
|
-
console.error(`GitHub submission failed: ${msg}`);
|
|
263
|
-
console.error("Falling back to file output.");
|
|
264
|
-
}
|
|
265
|
-
if (opts.outputPath) {
|
|
266
|
-
writeFileSync(opts.outputPath, md, "utf8");
|
|
267
|
-
return {
|
|
268
|
-
method: "file",
|
|
269
|
-
detail: `Saved to ${opts.outputPath}`
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
return {
|
|
273
|
-
method: "stdout",
|
|
274
|
-
detail: md
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
//#endregion
|
|
279
|
-
export { ResolveSkillUseError, SkillUseParseError, buildStaleReviewBody, checkStaleness, collectStaleReviewItems, containsSecrets, createFailedStaleReviewItem, findSkillFiles, formatSkillUse, getDeps, hasGhCli, isResolveSkillUseError, isSkillUseParseError, metaToMarkdown, parseFrontmatter, parseSkillUse, readIntentArtifacts, resolveDepDir, resolveFrequency, resolveSkillUse, runEditPackageJson, runSetupGithubActions, scanForIntents, submitFeedback, submitMetaFeedback, toMarkdown, validateMetaPayload, validatePayload };
|
|
14
|
+
export { ResolveSkillUseError, SkillUseParseError, buildStaleReviewBody, checkStaleness, collectStaleReviewItems, createFailedStaleReviewItem, findSkillFiles, formatSkillUse, getDeps, isResolveSkillUseError, isSkillUseParseError, parseFrontmatter, parseSkillUse, readIntentArtifacts, resolveDepDir, resolveSkillUse, runEditPackageJson, runSetupGithubActions, scanForIntents };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import "./workspace-patterns-
|
|
1
|
+
import "./utils-Dj49bkF_.mjs";
|
|
2
|
+
import "./workspace-patterns-Cz_lNhwz.mjs";
|
|
3
3
|
import { t as detectPackageManager } from "./package-manager-BUgTjW9Q.mjs";
|
|
4
|
-
import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-
|
|
5
|
-
import "./project-context-
|
|
4
|
+
import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-CUrNHf-u.mjs";
|
|
5
|
+
import "./project-context-DDCie6Ro.mjs";
|
|
6
6
|
import { t as fail } from "./cli-error-BrMXlbtx.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { t as formatIntentCommand } from "./command-runner-
|
|
7
|
+
import { a as noticeOptionsFromGlobalFlags, l as printNotices, n as coreOptionsFromGlobalFlags, u as printWarnings } from "./cli-support-C8SKYTA4.mjs";
|
|
8
|
+
import { t as formatIntentCommand } from "./command-runner-fstUIUhe.mjs";
|
|
9
9
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
10
10
|
import { dirname, join, relative } from "node:path";
|
|
11
11
|
import { parse } from "yaml";
|
|
@@ -343,9 +343,10 @@ function formatTargetPath(targetPath) {
|
|
|
343
343
|
function formatMappingCount(mappingCount) {
|
|
344
344
|
return `${mappingCount} ${mappingCount === 1 ? "mapping" : "mappings"}`;
|
|
345
345
|
}
|
|
346
|
-
function printNoActionableSkills(warnings) {
|
|
346
|
+
function printNoActionableSkills(warnings, notices, noticeOptions) {
|
|
347
347
|
console.log("No intent-enabled skills found.");
|
|
348
348
|
printWarnings(warnings);
|
|
349
|
+
printNotices(notices, noticeOptions);
|
|
349
350
|
}
|
|
350
351
|
function printPlacementTip(targetPath) {
|
|
351
352
|
console.log(`Tip: Keep the intent-skills block near the top of ${formatTargetPath(targetPath)} so agents read it before task-specific instructions.`);
|
|
@@ -383,7 +384,8 @@ async function runInstallCommand(options, scanIntentsOrFail) {
|
|
|
383
384
|
console.log(INSTALL_PROMPT);
|
|
384
385
|
return;
|
|
385
386
|
}
|
|
386
|
-
const
|
|
387
|
+
const coreOptions = coreOptionsFromGlobalFlags(options);
|
|
388
|
+
const noticeOptions = noticeOptionsFromGlobalFlags(options);
|
|
387
389
|
if (!options.map) {
|
|
388
390
|
const generated$1 = buildIntentSkillGuidanceBlock(detectPackageManager());
|
|
389
391
|
if (options.dryRun) {
|
|
@@ -408,17 +410,18 @@ async function runInstallCommand(options, scanIntentsOrFail) {
|
|
|
408
410
|
printPlacementTip(result$1.targetPath);
|
|
409
411
|
return;
|
|
410
412
|
}
|
|
411
|
-
const scanResult = await scanIntentsOrFail(
|
|
413
|
+
const scanResult = await scanIntentsOrFail(coreOptions);
|
|
412
414
|
const generated = buildIntentSkillsBlock(scanResult);
|
|
413
415
|
if (options.dryRun) {
|
|
414
416
|
const targetPath = resolveIntentSkillsBlockTargetPath(process.cwd(), generated.mappingCount);
|
|
415
417
|
if (!targetPath) {
|
|
416
|
-
printNoActionableSkills(scanResult.warnings);
|
|
418
|
+
printNoActionableSkills(scanResult.warnings, scanResult.notices, noticeOptions);
|
|
417
419
|
return;
|
|
418
420
|
}
|
|
419
421
|
console.log(`Generated ${formatMappingCount(generated.mappingCount)} for ${formatTargetPath(targetPath)}.`);
|
|
420
422
|
console.log(generated.block);
|
|
421
423
|
printWarnings(scanResult.warnings);
|
|
424
|
+
printNotices(scanResult.notices, noticeOptions);
|
|
422
425
|
return;
|
|
423
426
|
}
|
|
424
427
|
const result = writeIntentSkillsBlock({
|
|
@@ -426,7 +429,7 @@ async function runInstallCommand(options, scanIntentsOrFail) {
|
|
|
426
429
|
root: process.cwd()
|
|
427
430
|
});
|
|
428
431
|
if (!result.targetPath) {
|
|
429
|
-
printNoActionableSkills(scanResult.warnings);
|
|
432
|
+
printNoActionableSkills(scanResult.warnings, scanResult.notices, noticeOptions);
|
|
430
433
|
return;
|
|
431
434
|
}
|
|
432
435
|
const target = formatTargetPath(result.targetPath);
|
|
@@ -439,6 +442,7 @@ async function runInstallCommand(options, scanIntentsOrFail) {
|
|
|
439
442
|
printWriteResult(result);
|
|
440
443
|
printPlacementTip(result.targetPath);
|
|
441
444
|
printWarnings(scanResult.warnings);
|
|
445
|
+
printNotices(scanResult.notices, noticeOptions);
|
|
442
446
|
}
|
|
443
447
|
|
|
444
448
|
//#endregion
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import "./skill-paths-
|
|
3
|
-
import "./scanner-
|
|
4
|
-
import "./workspace-patterns-
|
|
5
|
-
import "./project-context-
|
|
6
|
-
import "./
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
1
|
+
import "./utils-Dj49bkF_.mjs";
|
|
2
|
+
import "./skill-paths-Cr74uFk4.mjs";
|
|
3
|
+
import "./scanner-2XDBAsbm.mjs";
|
|
4
|
+
import "./workspace-patterns-Cz_lNhwz.mjs";
|
|
5
|
+
import "./project-context-DDCie6Ro.mjs";
|
|
6
|
+
import "./excludes-DDMe-4iu.mjs";
|
|
7
|
+
import "./resolver-CZXZ0rft.mjs";
|
|
8
|
+
import { n as listIntentSkills } from "./core-hEMP5GMV.mjs";
|
|
9
|
+
import "./source-policy-rGOtjQSM.mjs";
|
|
10
|
+
import { a as noticeOptionsFromGlobalFlags, l as printNotices, n as coreOptionsFromGlobalFlags, o as printDebugInfo, u as printWarnings } from "./cli-support-C8SKYTA4.mjs";
|
|
11
|
+
import { t as formatIntentCommand } from "./command-runner-fstUIUhe.mjs";
|
|
10
12
|
|
|
11
13
|
//#region src/commands/list.ts
|
|
12
14
|
function printListDebug(result) {
|
|
@@ -18,6 +20,7 @@ function printListDebug(result) {
|
|
|
18
20
|
["packages", result.debug.packageCount],
|
|
19
21
|
["skills", result.debug.skillCount],
|
|
20
22
|
["warnings", result.debug.warningCount],
|
|
23
|
+
["notices", result.debug.noticeCount],
|
|
21
24
|
["conflicts", result.debug.conflictCount],
|
|
22
25
|
["packageJsonReadCount", result.debug.scan.packageJsonReadCount],
|
|
23
26
|
["packageJsonCacheHits", result.debug.scan.packageJsonCacheHits]
|
|
@@ -51,21 +54,23 @@ function getPackageSkills(pkg, skillsByPackageRoot) {
|
|
|
51
54
|
function formatLoadCommand(skill, packageManager, scopeFlag) {
|
|
52
55
|
return formatIntentCommand(packageManager, `load ${skill.use}${scopeFlag}`);
|
|
53
56
|
}
|
|
54
|
-
async function runListCommand(options
|
|
57
|
+
async function runListCommand(options) {
|
|
55
58
|
const result = listIntentSkills(coreOptionsFromGlobalFlags(options));
|
|
59
|
+
const noticeOptions = noticeOptionsFromGlobalFlags(options);
|
|
56
60
|
printListDebug(result);
|
|
57
61
|
if (options.json) {
|
|
58
62
|
const { debug: _debug, packageManager: _packageManager, ...jsonResult } = result;
|
|
59
63
|
console.log(JSON.stringify(jsonResult, null, 2));
|
|
60
64
|
return;
|
|
61
65
|
}
|
|
62
|
-
const { computeSkillNameWidth, printSkillTree, printTable } = await import("./display-
|
|
66
|
+
const { computeSkillNameWidth, printSkillTree, printTable } = await import("./display-CFnFnrtx.mjs");
|
|
63
67
|
if (result.packages.length === 0) {
|
|
64
68
|
console.log("No intent-enabled packages found.");
|
|
65
69
|
if (result.warnings.length > 0) {
|
|
66
70
|
console.log();
|
|
67
71
|
printWarnings(result.warnings);
|
|
68
72
|
}
|
|
73
|
+
printNotices(result.notices, noticeOptions);
|
|
69
74
|
return;
|
|
70
75
|
}
|
|
71
76
|
console.log(`\n${result.packages.length} intent-enabled packages, ${result.skills.length} skills\n`);
|
|
@@ -104,11 +109,8 @@ async function runListCommand(options, _scanIntentsOrFail) {
|
|
|
104
109
|
});
|
|
105
110
|
console.log();
|
|
106
111
|
}
|
|
107
|
-
console.log("Feedback:");
|
|
108
|
-
console.log(" Submit feedback on skill usage to help maintainers improve the skills.");
|
|
109
|
-
console.log(" Load: node_modules/@tanstack/intent/meta/feedback-collection/SKILL.md");
|
|
110
|
-
console.log();
|
|
111
112
|
printWarnings(result.warnings);
|
|
113
|
+
printNotices(result.notices, noticeOptions);
|
|
112
114
|
}
|
|
113
115
|
|
|
114
116
|
//#endregion
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import "./skill-paths-
|
|
3
|
-
import "./scanner-
|
|
4
|
-
import "./workspace-patterns-
|
|
5
|
-
import "./project-context-
|
|
6
|
-
import "./
|
|
1
|
+
import "./utils-Dj49bkF_.mjs";
|
|
2
|
+
import "./skill-paths-Cr74uFk4.mjs";
|
|
3
|
+
import "./scanner-2XDBAsbm.mjs";
|
|
4
|
+
import "./workspace-patterns-Cz_lNhwz.mjs";
|
|
5
|
+
import "./project-context-DDCie6Ro.mjs";
|
|
6
|
+
import "./excludes-DDMe-4iu.mjs";
|
|
7
|
+
import "./resolver-CZXZ0rft.mjs";
|
|
7
8
|
import { t as fail } from "./cli-error-BrMXlbtx.mjs";
|
|
8
|
-
import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-
|
|
9
|
-
import
|
|
9
|
+
import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-hEMP5GMV.mjs";
|
|
10
|
+
import "./source-policy-rGOtjQSM.mjs";
|
|
11
|
+
import { n as coreOptionsFromGlobalFlags, o as printDebugInfo } from "./cli-support-C8SKYTA4.mjs";
|
|
10
12
|
|
|
11
13
|
//#region src/commands/load.ts
|
|
12
14
|
function printLoadDebug(loaded) {
|
|
@@ -26,7 +28,7 @@ function printLoadDebug(loaded) {
|
|
|
26
28
|
["packageJsonCacheHits", loaded.debug.scan.packageJsonCacheHits]
|
|
27
29
|
]);
|
|
28
30
|
}
|
|
29
|
-
async function runLoadCommand(use, options
|
|
31
|
+
async function runLoadCommand(use, options) {
|
|
30
32
|
if (!use) fail("Missing skill use. Expected: intent load <package>#<skill>");
|
|
31
33
|
if (options.json && options.path) fail("Use either --json or --path, not both.");
|
|
32
34
|
const coreOptions = coreOptionsFromGlobalFlags(options);
|
|
@@ -16,7 +16,7 @@ async function runMetaCommand(name, metaDir) {
|
|
|
16
16
|
}
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
const { parseFrontmatter } = await import("./utils-
|
|
19
|
+
const { parseFrontmatter } = await import("./utils-BuNMwKct.mjs");
|
|
20
20
|
const entries = readdirSync(metaDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => existsSync(join(metaDir, entry.name, "SKILL.md")));
|
|
21
21
|
if (entries.length === 0) {
|
|
22
22
|
console.log("No meta-skills found.");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as readWorkspacePatterns, r as findWorkspaceRoot } from "./workspace-patterns-
|
|
1
|
+
import { a as readWorkspacePatterns, r as findWorkspaceRoot } from "./workspace-patterns-Cz_lNhwz.mjs";
|
|
2
2
|
import { existsSync, statSync } from "node:fs";
|
|
3
3
|
import { dirname, join, relative, resolve } from "node:path";
|
|
4
4
|
|
|
@@ -1,89 +1,6 @@
|
|
|
1
|
-
import { i as parseSkillUse } from "./skill-use-
|
|
2
|
-
import {
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
|
-
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
1
|
+
import { i as parseSkillUse } from "./skill-use-CUrNHf-u.mjs";
|
|
2
|
+
import { o as warningMentionsPackage } from "./excludes-DDMe-4iu.mjs";
|
|
5
3
|
|
|
6
|
-
//#region src/core/package-json.ts
|
|
7
|
-
function readPackageJson(dir) {
|
|
8
|
-
try {
|
|
9
|
-
return JSON.parse(readFileSync(join(dir, "package.json"), "utf8"));
|
|
10
|
-
} catch {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/core/excludes.ts
|
|
17
|
-
const MAX_EXCLUDE_PATTERN_LENGTH = 200;
|
|
18
|
-
const PACKAGE_NAME_BOUNDARY = /[^a-zA-Z0-9_.-]/;
|
|
19
|
-
function normalizeExcludePatterns(value) {
|
|
20
|
-
if (!Array.isArray(value)) return [];
|
|
21
|
-
return value.filter((pattern) => typeof pattern === "string").map((pattern) => pattern.trim()).filter(Boolean);
|
|
22
|
-
}
|
|
23
|
-
function isWithinOrEqual(path, parentDir) {
|
|
24
|
-
const rel = relative(parentDir, path);
|
|
25
|
-
return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
|
|
26
|
-
}
|
|
27
|
-
function readPackageExcludes(dir) {
|
|
28
|
-
const intent = readPackageJson(dir)?.intent;
|
|
29
|
-
if (!intent || typeof intent !== "object") return [];
|
|
30
|
-
return normalizeExcludePatterns(intent.exclude);
|
|
31
|
-
}
|
|
32
|
-
function getConfigExcludePatterns(cwd, context = resolveProjectContext({ cwd })) {
|
|
33
|
-
const root = context.workspaceRoot ?? context.packageRoot ?? cwd;
|
|
34
|
-
const dirs = [];
|
|
35
|
-
let dir = cwd;
|
|
36
|
-
while (isWithinOrEqual(dir, root)) {
|
|
37
|
-
dirs.push(dir);
|
|
38
|
-
if (dir === root) break;
|
|
39
|
-
const next = dirname(dir);
|
|
40
|
-
if (next === dir) break;
|
|
41
|
-
dir = next;
|
|
42
|
-
}
|
|
43
|
-
return dirs.reverse().flatMap(readPackageExcludes);
|
|
44
|
-
}
|
|
45
|
-
function getEffectiveExcludePatterns(options = {}, context) {
|
|
46
|
-
return [...getConfigExcludePatterns(context?.cwd ?? resolve(process.cwd(), options.cwd ?? process.cwd()), context), ...normalizeExcludePatterns(options.exclude)];
|
|
47
|
-
}
|
|
48
|
-
function normalizeGlobPattern(pattern) {
|
|
49
|
-
if (pattern.length > MAX_EXCLUDE_PATTERN_LENGTH) throw new Error(`Intent exclude pattern is too long: ${pattern.length} characters. Maximum is ${MAX_EXCLUDE_PATTERN_LENGTH}.`);
|
|
50
|
-
return pattern.replace(/\*+/g, "*");
|
|
51
|
-
}
|
|
52
|
-
function globToRegExp(pattern) {
|
|
53
|
-
const source = normalizeGlobPattern(pattern).split("*").map((part) => part.replace(/[\\^$+?.()|[\]{}]/g, "\\$&")).join(".*");
|
|
54
|
-
return /* @__PURE__ */ new RegExp(`^${source}$`);
|
|
55
|
-
}
|
|
56
|
-
function compileExcludePatterns(patterns) {
|
|
57
|
-
return patterns.map((pattern) => {
|
|
58
|
-
if (!pattern.includes("*")) {
|
|
59
|
-
normalizeGlobPattern(pattern);
|
|
60
|
-
return {
|
|
61
|
-
pattern,
|
|
62
|
-
matches: (packageName) => packageName === pattern
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
const regex = globToRegExp(pattern);
|
|
66
|
-
return {
|
|
67
|
-
pattern,
|
|
68
|
-
matches: (packageName) => regex.test(packageName)
|
|
69
|
-
};
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
function isPackageExcluded(packageName, matchers) {
|
|
73
|
-
return matchers.some((matcher) => matcher.matches(packageName));
|
|
74
|
-
}
|
|
75
|
-
function warningMentionsPackage(warning, packageName) {
|
|
76
|
-
let idx = warning.indexOf(packageName);
|
|
77
|
-
while (idx !== -1) {
|
|
78
|
-
const before = warning[idx - 1];
|
|
79
|
-
const after = warning[idx + packageName.length];
|
|
80
|
-
if ((before === void 0 || PACKAGE_NAME_BOUNDARY.test(before)) && (after === void 0 || PACKAGE_NAME_BOUNDARY.test(after))) return true;
|
|
81
|
-
idx = warning.indexOf(packageName, idx + packageName.length);
|
|
82
|
-
}
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
//#endregion
|
|
87
4
|
//#region src/resolver.ts
|
|
88
5
|
var ResolveSkillUseError = class extends Error {
|
|
89
6
|
constructor({ availablePackages = [], availableSkills = [], code, packageName, skillName, suggestedSkills = [], use }) {
|
|
@@ -192,4 +109,4 @@ function formatSkillSuggestions(packageName, skillNames) {
|
|
|
192
109
|
}
|
|
193
110
|
|
|
194
111
|
//#endregion
|
|
195
|
-
export {
|
|
112
|
+
export { resolveSkillUse as i, isResolveSkillUseError as n, resolveSkillEntry as r, ResolveSkillUseError as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as listNestedNodeModulesPackageDirs, c as parseFrontmatter, i as getDeps, l as
|
|
2
|
-
import { r as rewriteSkillLoadPaths } from "./skill-paths-
|
|
3
|
-
import { n as findWorkspacePackages, r as findWorkspaceRoot } from "./workspace-patterns-
|
|
1
|
+
import { a as listNestedNodeModulesPackageDirs, c as parseFrontmatter, d as toPosixPath, i as getDeps, l as readScalarField, n as detectGlobalNodeModules, o as listNodeModulesPackageDirs, r as findSkillFiles, s as nodeReadFs, t as createFsIdentityCache, u as resolveDepDir } from "./utils-Dj49bkF_.mjs";
|
|
2
|
+
import { r as rewriteSkillLoadPaths } from "./skill-paths-Cr74uFk4.mjs";
|
|
3
|
+
import { n as findWorkspacePackages, r as findWorkspaceRoot } from "./workspace-patterns-Cz_lNhwz.mjs";
|
|
4
4
|
import { t as detectPackageManager } from "./package-manager-BUgTjW9Q.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
@@ -331,8 +331,8 @@ function readSkillEntry(skillsDir, childDir, skillFile, readFs = nodeReadFs) {
|
|
|
331
331
|
name: typeof fm?.name === "string" ? fm.name : relName,
|
|
332
332
|
path: skillFile,
|
|
333
333
|
description: desc,
|
|
334
|
-
type:
|
|
335
|
-
framework:
|
|
334
|
+
type: readScalarField(fm, "type"),
|
|
335
|
+
framework: readScalarField(fm, "framework")
|
|
336
336
|
};
|
|
337
337
|
}
|
|
338
338
|
function discoverSkillByNameHint(skillsDir, packageName, skillNameHint, readFs = nodeReadFs) {
|
|
@@ -587,6 +587,7 @@ function scanForIntents(root, options = {}) {
|
|
|
587
587
|
packageManager,
|
|
588
588
|
packages,
|
|
589
589
|
warnings,
|
|
590
|
+
notices: [],
|
|
590
591
|
conflicts,
|
|
591
592
|
nodeModules,
|
|
592
593
|
stats: getStats()
|
|
@@ -603,6 +604,7 @@ function scanForIntents(root, options = {}) {
|
|
|
603
604
|
packageManager,
|
|
604
605
|
packages: topoSort(packages),
|
|
605
606
|
warnings,
|
|
607
|
+
notices: [],
|
|
606
608
|
conflicts,
|
|
607
609
|
nodeModules,
|
|
608
610
|
stats: getStats()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as readWorkspacePatterns, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-
|
|
2
|
-
import { t as resolveProjectContext } from "./project-context-
|
|
1
|
+
import { a as readWorkspacePatterns, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-Cz_lNhwz.mjs";
|
|
2
|
+
import { t as resolveProjectContext } from "./project-context-DDCie6Ro.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-DW3pn0QW.mjs";
|
|
2
2
|
export { EditPackageJsonResult, MonorepoResult, SetupGithubActionsResult, findPackagesWithSkills, findWorkspaceRoot, readWorkspacePatterns, resolveWorkspacePackages, runEditPackageJson, runEditPackageJsonAll, runSetupGithubActions };
|
package/dist/setup.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./utils-
|
|
2
|
-
import { a as readWorkspacePatterns, o as resolveWorkspacePackages, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-
|
|
3
|
-
import "./project-context-
|
|
4
|
-
import { n as runEditPackageJsonAll, r as runSetupGithubActions, t as runEditPackageJson } from "./setup-
|
|
1
|
+
import "./utils-Dj49bkF_.mjs";
|
|
2
|
+
import { a as readWorkspacePatterns, o as resolveWorkspacePackages, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-Cz_lNhwz.mjs";
|
|
3
|
+
import "./project-context-DDCie6Ro.mjs";
|
|
4
|
+
import { n as runEditPackageJsonAll, r as runSetupGithubActions, t as runEditPackageJson } from "./setup-CMec7fht.mjs";
|
|
5
5
|
|
|
6
6
|
export { findPackagesWithSkills, findWorkspaceRoot, readWorkspacePatterns, resolveWorkspacePackages, runEditPackageJson, runEditPackageJsonAll, runSetupGithubActions };
|