@tanstack/intent 0.1.0 → 0.2.0
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-CXX6wav1.mjs +2 -0
- package/dist/{artifact-coverage-nGwun1tt.mjs → artifact-coverage-DFtI6V_H.mjs} +1 -3
- package/dist/{cli-error-BrMXlbtx.mjs → cli-error-DDAO6DIL.mjs} +1 -2
- package/dist/{cli-support-BevVu4gw.mjs → cli-support-BQSl7gAE.mjs} +8 -11
- package/dist/{cli-support-Cpo_9JfL.mjs → cli-support-DK1Kq8Ue.mjs} +2 -6
- package/dist/cli.d.mts +0 -1
- package/dist/cli.mjs +14 -16
- package/dist/{command-runner-fstUIUhe.mjs → command-runner-B5OofX0E.mjs} +1 -2
- package/dist/{core-6UP6jyL8.mjs → core-BRUBEMwe.mjs} +9 -13
- package/dist/core.d.mts +3 -4
- package/dist/core.mjs +2 -11
- package/dist/{display-CVMGtcHz.mjs → display-CnpA7XuV.mjs} +3 -7
- package/dist/{edit-package-json-DKyJ04t1.mjs → edit-package-json-D8xfcy2X.mjs} +1 -2
- package/dist/{exclude-BTaE6TNh.mjs → exclude-DbHwcgQQ.mjs} +6 -11
- package/dist/{excludes-DG83YEzb.mjs → excludes-ByvSbmmj.mjs} +3 -6
- package/dist/index.d.mts +3 -31
- package/dist/index.mjs +9 -280
- package/dist/{install-DXQsQQIL.mjs → install-CTGQvXoB.mjs} +18 -24
- package/dist/{list-CxB37mvm.mjs → list-9SbFGUd5.mjs} +5 -19
- package/dist/{load-Ch4UjIza.mjs → load-BY8vh7Gp.mjs} +4 -14
- package/dist/{meta-C-t9P5Ls.mjs → meta-CF4XIYOo.mjs} +3 -5
- package/dist/{package-manager-BUgTjW9Q.mjs → package-manager-Dw7lYcI0.mjs} +1 -3
- package/dist/{project-context-DBSibDPb.mjs → project-context-oi_m7paK.mjs} +2 -4
- package/dist/{resolver-CDbVXv4g.mjs → resolver-Uwx8B5jv.mjs} +4 -6
- package/dist/{scaffold-D2vwv9ls.mjs → scaffold-D8TAMXvs.mjs} +1 -3
- package/dist/{scanner-CRCZwhKS.mjs → scanner-qT_M6nV5.mjs} +9 -16
- package/dist/{setup-DW3pn0QW.d.mts → setup-CdfBc7Oe.d.mts} +0 -1
- package/dist/{setup-DpCYUVSf.mjs → setup-Cx1r2y-1.mjs} +3 -5
- package/dist/{setup-github-actions-emXSyGy3.mjs → setup-github-actions-IxZTZihi.mjs} +1 -2
- package/dist/setup.d.mts +1 -1
- package/dist/setup.mjs +3 -6
- package/dist/{skill-paths-B-j0dWDA.mjs → skill-paths-Bm1P6IYe.mjs} +2 -4
- package/dist/{skill-use-CUrNHf-u.mjs → skill-use-B2xRF1i9.mjs} +1 -2
- package/dist/{source-policy-DaImacFt.mjs → source-policy-DkR80hkL.mjs} +4 -7
- package/dist/source-policy-hMYcpIgm.mjs +2 -0
- package/dist/{stale-DxZyYibt.mjs → stale-DhjSTIt-.mjs} +3 -5
- package/dist/staleness-B5Cqe77_.mjs +2 -0
- package/dist/{staleness-DVFARTES.mjs → staleness-DoZU3lzy.mjs} +10 -17
- package/dist/{types-DhITOzhi.d.mts → types-P6UfPVdp.d.mts} +1 -33
- package/dist/{utils-9fhWAVua.mjs → utils-6FtqhOYf.mjs} +14 -3
- package/dist/utils-BKBDYbCx.mjs +2 -0
- package/dist/{validate-CnQBn6v9.mjs → validate-BSfTOq0v.mjs} +134 -47
- package/dist/{workflow-review-wL1Iu2Sf.mjs → workflow-review-B4AfwtHH.mjs} +1 -3
- package/dist/{workflow-review-CtOR1bgh.mjs → workflow-review-Bo2kPVXV.mjs} +2 -3
- package/dist/{workspace-patterns-BffPlZ1D.mjs → workspace-patterns-BDoJIWk-.mjs} +2 -4
- package/dist/workspace-patterns-CrL8hAbd.mjs +2 -0
- package/meta/domain-discovery/SKILL.md +1 -1
- package/meta/generate-skill/SKILL.md +35 -28
- package/meta/tree-generator/SKILL.md +43 -39
- package/package.json +5 -6
- package/dist/artifact-coverage-BfJ7f-S9.mjs +0 -3
- package/dist/source-policy-y3sktvzu.mjs +0 -9
- package/dist/staleness-BoFc6DMh.mjs +0 -5
- package/dist/utils-CSPzvaFu.mjs +0 -3
- package/dist/workspace-patterns-Bjq_cXww.mjs +0 -4
- package/meta/feedback-collection/SKILL.md +0 -234
package/dist/index.mjs
CHANGED
|
@@ -1,280 +1,9 @@
|
|
|
1
|
-
import { c as parseFrontmatter, i as getDeps,
|
|
2
|
-
import "./
|
|
3
|
-
import { t as
|
|
4
|
-
import "./
|
|
5
|
-
import { t as
|
|
6
|
-
import { n as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import "./excludes-DG83YEzb.mjs";
|
|
11
|
-
import { i as resolveSkillUse, n as isResolveSkillUseError, t as ResolveSkillUseError } from "./resolver-CDbVXv4g.mjs";
|
|
12
|
-
import { r as runSetupGithubActions, t as runEditPackageJson } from "./setup-DpCYUVSf.mjs";
|
|
13
|
-
import { readFileSync, writeFileSync } from "node:fs";
|
|
14
|
-
import { join } from "node:path";
|
|
15
|
-
import { execFileSync, execSync } from "node:child_process";
|
|
16
|
-
|
|
17
|
-
//#region src/feedback.ts
|
|
18
|
-
const META_FEEDBACK_REPO = "TanStack/intent";
|
|
19
|
-
const SECRET_PATTERNS = [
|
|
20
|
-
/(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36,}/,
|
|
21
|
-
/(?:sk|pk)[-_](?:live|test)[-_][A-Za-z0-9]{24,}/,
|
|
22
|
-
/AKIA[0-9A-Z]{16}/,
|
|
23
|
-
/-----BEGIN (?:RSA |EC )?PRIVATE KEY-----/,
|
|
24
|
-
/eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/,
|
|
25
|
-
/(?:Bearer|token)\s+[A-Za-z0-9_\-.~+/]{20,}/i,
|
|
26
|
-
/[A-Za-z0-9]{32,}(?=.*(?:key|secret|token|password))/i
|
|
27
|
-
];
|
|
28
|
-
function containsSecrets(text) {
|
|
29
|
-
return SECRET_PATTERNS.some((pattern) => pattern.test(text));
|
|
30
|
-
}
|
|
31
|
-
function hasGhCli() {
|
|
32
|
-
try {
|
|
33
|
-
execSync("gh --version", { stdio: "ignore" });
|
|
34
|
-
return true;
|
|
35
|
-
} catch {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function getHomeConfigDir() {
|
|
40
|
-
return process.env.XDG_CONFIG_HOME ?? join(process.env.HOME ?? process.env.USERPROFILE ?? "", ".config");
|
|
41
|
-
}
|
|
42
|
-
function parseFrequency(value) {
|
|
43
|
-
if (value === "always" || value === "never") return value;
|
|
44
|
-
if (typeof value !== "string") return null;
|
|
45
|
-
const match = /^every-(\d+)$/.exec(value);
|
|
46
|
-
if (!match) return null;
|
|
47
|
-
const count = Number(match[1]);
|
|
48
|
-
return Number.isInteger(count) && count > 0 ? `every-${count}` : null;
|
|
49
|
-
}
|
|
50
|
-
function readFrequency(filePath) {
|
|
51
|
-
try {
|
|
52
|
-
return parseFrequency(JSON.parse(readFileSync(filePath, "utf8")).feedback?.frequency);
|
|
53
|
-
} catch {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function resolveFrequency(root) {
|
|
58
|
-
const userFrequency = readFrequency(join(getHomeConfigDir(), "intent", "config.json"));
|
|
59
|
-
if (userFrequency) return userFrequency;
|
|
60
|
-
const projectFrequency = readFrequency(join(root, "intent.config.json"));
|
|
61
|
-
if (projectFrequency) return projectFrequency;
|
|
62
|
-
return "every-5";
|
|
63
|
-
}
|
|
64
|
-
const REQUIRED_FIELDS = [
|
|
65
|
-
"skill",
|
|
66
|
-
"package",
|
|
67
|
-
"skillVersion",
|
|
68
|
-
"task",
|
|
69
|
-
"whatWorked",
|
|
70
|
-
"whatFailed",
|
|
71
|
-
"missing",
|
|
72
|
-
"selfCorrections",
|
|
73
|
-
"userRating"
|
|
74
|
-
];
|
|
75
|
-
function validatePayload(payload) {
|
|
76
|
-
const errors = [];
|
|
77
|
-
if (!payload || typeof payload !== "object") return {
|
|
78
|
-
valid: false,
|
|
79
|
-
errors: ["Payload must be a JSON object"]
|
|
80
|
-
};
|
|
81
|
-
const obj = payload;
|
|
82
|
-
for (const field of REQUIRED_FIELDS) if (typeof obj[field] !== "string" || obj[field].trim() === "") errors.push(`Missing or empty required field: ${field}`);
|
|
83
|
-
if (obj.userRating && ![
|
|
84
|
-
"good",
|
|
85
|
-
"mixed",
|
|
86
|
-
"bad"
|
|
87
|
-
].includes(obj.userRating)) errors.push("userRating must be one of: good, mixed, bad");
|
|
88
|
-
if (containsSecrets(Object.values(obj).filter((v) => typeof v === "string").join("\n"))) errors.push("Payload appears to contain secrets or tokens — submission rejected");
|
|
89
|
-
return {
|
|
90
|
-
valid: errors.length === 0,
|
|
91
|
-
errors
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
const META_REQUIRED_FIELDS = [
|
|
95
|
-
"metaSkill",
|
|
96
|
-
"library",
|
|
97
|
-
"agentUsed",
|
|
98
|
-
"artifactQuality",
|
|
99
|
-
"whatWorked",
|
|
100
|
-
"whatFailed",
|
|
101
|
-
"suggestions",
|
|
102
|
-
"userRating"
|
|
103
|
-
];
|
|
104
|
-
const VALID_META_SKILLS = [
|
|
105
|
-
"domain-discovery",
|
|
106
|
-
"tree-generator",
|
|
107
|
-
"generate-skill",
|
|
108
|
-
"skill-staleness-check"
|
|
109
|
-
];
|
|
110
|
-
const VALID_AGENTS = [
|
|
111
|
-
"claude-code",
|
|
112
|
-
"cursor",
|
|
113
|
-
"copilot",
|
|
114
|
-
"codex",
|
|
115
|
-
"other"
|
|
116
|
-
];
|
|
117
|
-
const VALID_QUALITY_RATINGS = [
|
|
118
|
-
"good",
|
|
119
|
-
"mixed",
|
|
120
|
-
"bad"
|
|
121
|
-
];
|
|
122
|
-
const VALID_INTERVIEW_QUALITY_RATINGS = [
|
|
123
|
-
"good",
|
|
124
|
-
"mixed",
|
|
125
|
-
"bad",
|
|
126
|
-
"skipped"
|
|
127
|
-
];
|
|
128
|
-
const VALID_FAILURE_MODE_QUALITY_RATINGS = [
|
|
129
|
-
"good",
|
|
130
|
-
"mixed",
|
|
131
|
-
"bad",
|
|
132
|
-
"not-applicable"
|
|
133
|
-
];
|
|
134
|
-
function validateMetaPayload(payload) {
|
|
135
|
-
const errors = [];
|
|
136
|
-
if (!payload || typeof payload !== "object") return {
|
|
137
|
-
valid: false,
|
|
138
|
-
errors: ["Payload must be a JSON object"]
|
|
139
|
-
};
|
|
140
|
-
const obj = payload;
|
|
141
|
-
for (const field of META_REQUIRED_FIELDS) if (typeof obj[field] !== "string" || obj[field].trim() === "") errors.push(`Missing or empty required field: ${field}`);
|
|
142
|
-
if (obj.metaSkill && !VALID_META_SKILLS.includes(obj.metaSkill)) errors.push(`metaSkill must be one of: ${VALID_META_SKILLS.join(", ")}`);
|
|
143
|
-
if (obj.agentUsed && !VALID_AGENTS.includes(obj.agentUsed)) errors.push(`agentUsed must be one of: ${VALID_AGENTS.join(", ")}`);
|
|
144
|
-
if (obj.artifactQuality && !VALID_QUALITY_RATINGS.includes(obj.artifactQuality)) errors.push("artifactQuality must be one of: good, mixed, bad");
|
|
145
|
-
if (obj.userRating && !VALID_QUALITY_RATINGS.includes(obj.userRating)) errors.push("userRating must be one of: good, mixed, bad");
|
|
146
|
-
if (obj.interviewQuality && !VALID_INTERVIEW_QUALITY_RATINGS.includes(obj.interviewQuality)) errors.push("interviewQuality must be one of: good, mixed, bad, skipped");
|
|
147
|
-
if (obj.failureModeQuality && !VALID_FAILURE_MODE_QUALITY_RATINGS.includes(obj.failureModeQuality)) errors.push("failureModeQuality must be one of: good, mixed, bad, not-applicable");
|
|
148
|
-
if (containsSecrets(Object.values(obj).filter((v) => typeof v === "string").join("\n"))) errors.push("Payload appears to contain secrets or tokens — submission rejected");
|
|
149
|
-
return {
|
|
150
|
-
valid: errors.length === 0,
|
|
151
|
-
errors
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
function metaToMarkdown(payload) {
|
|
155
|
-
const lines = [
|
|
156
|
-
`# Meta-Skill Feedback: ${payload.metaSkill}`,
|
|
157
|
-
"",
|
|
158
|
-
`**Library:** ${payload.library}`,
|
|
159
|
-
`**Agent:** ${payload.agentUsed}`,
|
|
160
|
-
`**Artifact quality:** ${payload.artifactQuality}`,
|
|
161
|
-
`**Rating:** ${payload.userRating}`
|
|
162
|
-
];
|
|
163
|
-
if (payload.interviewQuality) lines.push(`**Interview quality:** ${payload.interviewQuality}`);
|
|
164
|
-
if (payload.failureModeQuality) lines.push(`**Failure mode quality:** ${payload.failureModeQuality}`);
|
|
165
|
-
lines.push("", "## What Worked", payload.whatWorked, "", "## What Failed", payload.whatFailed, "", "## Suggestions", payload.suggestions);
|
|
166
|
-
return lines.join("\n") + "\n";
|
|
167
|
-
}
|
|
168
|
-
function toMarkdown(payload) {
|
|
169
|
-
const lines = [
|
|
170
|
-
`# Skill Feedback: ${payload.skill}`,
|
|
171
|
-
"",
|
|
172
|
-
`**Package:** ${payload.package}`,
|
|
173
|
-
`**Skill version:** ${payload.skillVersion}`,
|
|
174
|
-
`**Rating:** ${payload.userRating}`,
|
|
175
|
-
"",
|
|
176
|
-
"## Task",
|
|
177
|
-
payload.task,
|
|
178
|
-
"",
|
|
179
|
-
"## What Worked",
|
|
180
|
-
payload.whatWorked,
|
|
181
|
-
"",
|
|
182
|
-
"## What Failed",
|
|
183
|
-
payload.whatFailed,
|
|
184
|
-
"",
|
|
185
|
-
"## Missing",
|
|
186
|
-
payload.missing,
|
|
187
|
-
"",
|
|
188
|
-
"## Self-Corrections",
|
|
189
|
-
payload.selfCorrections
|
|
190
|
-
];
|
|
191
|
-
if (payload.userComments) lines.push("", "## User Comments", payload.userComments);
|
|
192
|
-
return lines.join("\n") + "\n";
|
|
193
|
-
}
|
|
194
|
-
function submitFeedback(payload, repo, opts) {
|
|
195
|
-
const md = toMarkdown(payload);
|
|
196
|
-
if (opts.ghAvailable) try {
|
|
197
|
-
execFileSync("gh", [
|
|
198
|
-
"issue",
|
|
199
|
-
"create",
|
|
200
|
-
"--repo",
|
|
201
|
-
repo,
|
|
202
|
-
"--title",
|
|
203
|
-
`Skill Feedback: ${payload.skill} (${payload.userRating})`,
|
|
204
|
-
"--body",
|
|
205
|
-
"-"
|
|
206
|
-
], {
|
|
207
|
-
input: md,
|
|
208
|
-
stdio: [
|
|
209
|
-
"pipe",
|
|
210
|
-
"pipe",
|
|
211
|
-
"pipe"
|
|
212
|
-
]
|
|
213
|
-
});
|
|
214
|
-
return {
|
|
215
|
-
method: "gh",
|
|
216
|
-
detail: `Submitted issue to ${repo}`
|
|
217
|
-
};
|
|
218
|
-
} catch (err) {
|
|
219
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
220
|
-
console.error(`GitHub submission failed: ${msg}`);
|
|
221
|
-
console.error("Falling back to file output.");
|
|
222
|
-
}
|
|
223
|
-
if (opts.outputPath) {
|
|
224
|
-
writeFileSync(opts.outputPath, md, "utf8");
|
|
225
|
-
return {
|
|
226
|
-
method: "file",
|
|
227
|
-
detail: `Saved to ${opts.outputPath}`
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
return {
|
|
231
|
-
method: "stdout",
|
|
232
|
-
detail: md
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
function submitMetaFeedback(payload, opts) {
|
|
236
|
-
const md = metaToMarkdown(payload);
|
|
237
|
-
if (opts.ghAvailable) try {
|
|
238
|
-
execFileSync("gh", [
|
|
239
|
-
"issue",
|
|
240
|
-
"create",
|
|
241
|
-
"--repo",
|
|
242
|
-
META_FEEDBACK_REPO,
|
|
243
|
-
"--title",
|
|
244
|
-
`Meta-Skill Feedback: ${payload.metaSkill} (${payload.userRating})`,
|
|
245
|
-
"--label",
|
|
246
|
-
`skill:${payload.metaSkill}`,
|
|
247
|
-
"--body",
|
|
248
|
-
"-"
|
|
249
|
-
], {
|
|
250
|
-
input: md,
|
|
251
|
-
stdio: [
|
|
252
|
-
"pipe",
|
|
253
|
-
"pipe",
|
|
254
|
-
"pipe"
|
|
255
|
-
]
|
|
256
|
-
});
|
|
257
|
-
return {
|
|
258
|
-
method: "gh",
|
|
259
|
-
detail: `Submitted issue to ${META_FEEDBACK_REPO}`
|
|
260
|
-
};
|
|
261
|
-
} catch (err) {
|
|
262
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
263
|
-
console.error(`GitHub submission failed: ${msg}`);
|
|
264
|
-
console.error("Falling back to file output.");
|
|
265
|
-
}
|
|
266
|
-
if (opts.outputPath) {
|
|
267
|
-
writeFileSync(opts.outputPath, md, "utf8");
|
|
268
|
-
return {
|
|
269
|
-
method: "file",
|
|
270
|
-
detail: `Saved to ${opts.outputPath}`
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
return {
|
|
274
|
-
method: "stdout",
|
|
275
|
-
detail: md
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
//#endregion
|
|
280
|
-
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 };
|
|
1
|
+
import { c as parseFrontmatter, i as getDeps, r as findSkillFiles, u as resolveDepDir } from "./utils-6FtqhOYf.mjs";
|
|
2
|
+
import { t as scanForIntents } from "./scanner-qT_M6nV5.mjs";
|
|
3
|
+
import { t as readIntentArtifacts } from "./artifact-coverage-DFtI6V_H.mjs";
|
|
4
|
+
import { n as checkStaleness } from "./staleness-DoZU3lzy.mjs";
|
|
5
|
+
import { n as collectStaleReviewItems, r as createFailedStaleReviewItem, t as buildStaleReviewBody } from "./workflow-review-B4AfwtHH.mjs";
|
|
6
|
+
import { i as parseSkillUse, n as formatSkillUse, r as isSkillUseParseError, t as SkillUseParseError } from "./skill-use-B2xRF1i9.mjs";
|
|
7
|
+
import { i as resolveSkillUse, n as isResolveSkillUseError, t as ResolveSkillUseError } from "./resolver-Uwx8B5jv.mjs";
|
|
8
|
+
import { r as runSetupGithubActions, t as runEditPackageJson } from "./setup-Cx1r2y-1.mjs";
|
|
9
|
+
export { ResolveSkillUseError, SkillUseParseError, buildStaleReviewBody, checkStaleness, collectStaleReviewItems, createFailedStaleReviewItem, findSkillFiles, formatSkillUse, getDeps, isResolveSkillUseError, isSkillUseParseError, parseFrontmatter, parseSkillUse, readIntentArtifacts, resolveDepDir, resolveSkillUse, runEditPackageJson, runSetupGithubActions, scanForIntents };
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
5
|
-
import "./
|
|
6
|
-
import { t as fail } from "./cli-error-BrMXlbtx.mjs";
|
|
7
|
-
import { a as noticeOptionsFromGlobalFlags, l as printNotices, n as coreOptionsFromGlobalFlags, u as printWarnings } from "./cli-support-BevVu4gw.mjs";
|
|
8
|
-
import { t as formatIntentCommand } from "./command-runner-fstUIUhe.mjs";
|
|
1
|
+
import { t as detectPackageManager } from "./package-manager-Dw7lYcI0.mjs";
|
|
2
|
+
import { i as parseSkillUse, n as formatSkillUse } from "./skill-use-B2xRF1i9.mjs";
|
|
3
|
+
import { t as fail } from "./cli-error-DDAO6DIL.mjs";
|
|
4
|
+
import { a as noticeOptionsFromGlobalFlags, l as printNotices, n as coreOptionsFromGlobalFlags, u as printWarnings } from "./cli-support-BQSl7gAE.mjs";
|
|
5
|
+
import { t as formatIntentCommand } from "./command-runner-B5OofX0E.mjs";
|
|
9
6
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
10
7
|
import { dirname, join, relative } from "node:path";
|
|
11
8
|
import { parse } from "yaml";
|
|
12
|
-
|
|
13
9
|
//#region src/commands/install-writer.ts
|
|
14
10
|
const INTENT_SKILLS_START = "<!-- intent-skills:start -->";
|
|
15
11
|
const INTENT_SKILLS_END = "<!-- intent-skills:end -->";
|
|
@@ -233,7 +229,6 @@ function writeIntentSkillsBlock({ block, mappingCount, root, skipWhenEmpty = tru
|
|
|
233
229
|
targetPath
|
|
234
230
|
};
|
|
235
231
|
}
|
|
236
|
-
|
|
237
232
|
//#endregion
|
|
238
233
|
//#region src/commands/install.ts
|
|
239
234
|
const INSTALL_PROMPT = `You are an AI assistant helping a developer set up skill-to-task mappings for their project.
|
|
@@ -387,27 +382,27 @@ async function runInstallCommand(options, scanIntentsOrFail) {
|
|
|
387
382
|
const coreOptions = coreOptionsFromGlobalFlags(options);
|
|
388
383
|
const noticeOptions = noticeOptionsFromGlobalFlags(options);
|
|
389
384
|
if (!options.map) {
|
|
390
|
-
const generated
|
|
385
|
+
const generated = buildIntentSkillGuidanceBlock(detectPackageManager());
|
|
391
386
|
if (options.dryRun) {
|
|
392
387
|
const targetPath = resolveIntentSkillsBlockTargetPath(process.cwd(), 1);
|
|
393
388
|
console.log(`Generated skill loading guidance for ${formatTargetPath(targetPath)}.`);
|
|
394
|
-
console.log(generated
|
|
389
|
+
console.log(generated.block);
|
|
395
390
|
return;
|
|
396
391
|
}
|
|
397
|
-
const result
|
|
398
|
-
...generated
|
|
392
|
+
const result = writeIntentSkillsBlock({
|
|
393
|
+
...generated,
|
|
399
394
|
root: process.cwd(),
|
|
400
395
|
skipWhenEmpty: false
|
|
401
396
|
});
|
|
402
|
-
if (!result
|
|
403
|
-
const verification
|
|
404
|
-
expectedBlock: generated
|
|
405
|
-
targetPath: result
|
|
397
|
+
if (!result.targetPath) fail("Install guidance target was not created.");
|
|
398
|
+
const verification = verifyIntentSkillsBlockFile({
|
|
399
|
+
expectedBlock: generated.block,
|
|
400
|
+
targetPath: result.targetPath
|
|
406
401
|
});
|
|
407
|
-
const target
|
|
408
|
-
if (!verification
|
|
409
|
-
printWriteResult(result
|
|
410
|
-
printPlacementTip(result
|
|
402
|
+
const target = formatTargetPath(result.targetPath);
|
|
403
|
+
if (!verification.ok) fail([`Install verification failed for ${target}:`, ...verification.errors.map((error) => `- ${error}`)].join("\n"));
|
|
404
|
+
printWriteResult(result);
|
|
405
|
+
printPlacementTip(result.targetPath);
|
|
411
406
|
return;
|
|
412
407
|
}
|
|
413
408
|
const scanResult = await scanIntentsOrFail(coreOptions);
|
|
@@ -444,6 +439,5 @@ async function runInstallCommand(options, scanIntentsOrFail) {
|
|
|
444
439
|
printWarnings(scanResult.warnings);
|
|
445
440
|
printNotices(scanResult.notices, noticeOptions);
|
|
446
441
|
}
|
|
447
|
-
|
|
448
442
|
//#endregion
|
|
449
|
-
export { INSTALL_PROMPT, runInstallCommand };
|
|
443
|
+
export { INSTALL_PROMPT, runInstallCommand };
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./
|
|
3
|
-
import "./
|
|
4
|
-
import "./workspace-patterns-BffPlZ1D.mjs";
|
|
5
|
-
import "./project-context-DBSibDPb.mjs";
|
|
6
|
-
import "./excludes-DG83YEzb.mjs";
|
|
7
|
-
import "./resolver-CDbVXv4g.mjs";
|
|
8
|
-
import { n as listIntentSkills } from "./core-6UP6jyL8.mjs";
|
|
9
|
-
import "./source-policy-DaImacFt.mjs";
|
|
10
|
-
import { a as noticeOptionsFromGlobalFlags, l as printNotices, n as coreOptionsFromGlobalFlags, o as printDebugInfo, u as printWarnings } from "./cli-support-BevVu4gw.mjs";
|
|
11
|
-
import { t as formatIntentCommand } from "./command-runner-fstUIUhe.mjs";
|
|
12
|
-
|
|
1
|
+
import { n as listIntentSkills } from "./core-BRUBEMwe.mjs";
|
|
2
|
+
import { a as noticeOptionsFromGlobalFlags, l as printNotices, n as coreOptionsFromGlobalFlags, o as printDebugInfo, u as printWarnings } from "./cli-support-BQSl7gAE.mjs";
|
|
3
|
+
import { t as formatIntentCommand } from "./command-runner-B5OofX0E.mjs";
|
|
13
4
|
//#region src/commands/list.ts
|
|
14
5
|
function printListDebug(result) {
|
|
15
6
|
if (!result.debug) return;
|
|
@@ -63,7 +54,7 @@ async function runListCommand(options) {
|
|
|
63
54
|
console.log(JSON.stringify(jsonResult, null, 2));
|
|
64
55
|
return;
|
|
65
56
|
}
|
|
66
|
-
const { computeSkillNameWidth, printSkillTree, printTable } = await import("./display-
|
|
57
|
+
const { computeSkillNameWidth, printSkillTree, printTable } = await import("./display-CnpA7XuV.mjs");
|
|
67
58
|
if (result.packages.length === 0) {
|
|
68
59
|
console.log("No intent-enabled packages found.");
|
|
69
60
|
if (result.warnings.length > 0) {
|
|
@@ -109,13 +100,8 @@ async function runListCommand(options) {
|
|
|
109
100
|
});
|
|
110
101
|
console.log();
|
|
111
102
|
}
|
|
112
|
-
console.log("Feedback:");
|
|
113
|
-
console.log(" Submit feedback on skill usage to help maintainers improve the skills.");
|
|
114
|
-
console.log(" Load: node_modules/@tanstack/intent/meta/feedback-collection/SKILL.md");
|
|
115
|
-
console.log();
|
|
116
103
|
printWarnings(result.warnings);
|
|
117
104
|
printNotices(result.notices, noticeOptions);
|
|
118
105
|
}
|
|
119
|
-
|
|
120
106
|
//#endregion
|
|
121
|
-
export { runListCommand };
|
|
107
|
+
export { runListCommand };
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./
|
|
3
|
-
import "./
|
|
4
|
-
import "./workspace-patterns-BffPlZ1D.mjs";
|
|
5
|
-
import "./project-context-DBSibDPb.mjs";
|
|
6
|
-
import "./excludes-DG83YEzb.mjs";
|
|
7
|
-
import "./resolver-CDbVXv4g.mjs";
|
|
8
|
-
import { t as fail } from "./cli-error-BrMXlbtx.mjs";
|
|
9
|
-
import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-6UP6jyL8.mjs";
|
|
10
|
-
import "./source-policy-DaImacFt.mjs";
|
|
11
|
-
import { n as coreOptionsFromGlobalFlags, o as printDebugInfo } from "./cli-support-BevVu4gw.mjs";
|
|
12
|
-
|
|
1
|
+
import { t as fail } from "./cli-error-DDAO6DIL.mjs";
|
|
2
|
+
import { i as resolveIntentSkill, r as loadIntentSkill, t as IntentCoreError } from "./core-BRUBEMwe.mjs";
|
|
3
|
+
import { n as coreOptionsFromGlobalFlags, o as printDebugInfo } from "./cli-support-BQSl7gAE.mjs";
|
|
13
4
|
//#region src/commands/load.ts
|
|
14
5
|
function printLoadDebug(loaded) {
|
|
15
6
|
if (!loaded.debug) return;
|
|
@@ -69,6 +60,5 @@ async function runLoadCommand(use, options) {
|
|
|
69
60
|
process.stdout.write(loaded.content);
|
|
70
61
|
for (const warning of loaded.warnings) console.error(`Warning: ${warning}`);
|
|
71
62
|
}
|
|
72
|
-
|
|
73
63
|
//#endregion
|
|
74
|
-
export { runLoadCommand };
|
|
64
|
+
export { runLoadCommand };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { t as fail } from "./cli-error-
|
|
1
|
+
import { t as fail } from "./cli-error-DDAO6DIL.mjs";
|
|
2
2
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
|
|
5
4
|
//#region src/commands/meta.ts
|
|
6
5
|
async function runMetaCommand(name, metaDir) {
|
|
7
6
|
if (!existsSync(metaDir)) fail("Meta-skills directory not found.");
|
|
@@ -16,7 +15,7 @@ async function runMetaCommand(name, metaDir) {
|
|
|
16
15
|
}
|
|
17
16
|
return;
|
|
18
17
|
}
|
|
19
|
-
const { parseFrontmatter } = await import("./utils-
|
|
18
|
+
const { parseFrontmatter } = await import("./utils-BKBDYbCx.mjs");
|
|
20
19
|
const entries = readdirSync(metaDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => existsSync(join(metaDir, entry.name, "SKILL.md")));
|
|
21
20
|
if (entries.length === 0) {
|
|
22
21
|
console.log("No meta-skills found.");
|
|
@@ -33,6 +32,5 @@ async function runMetaCommand(name, metaDir) {
|
|
|
33
32
|
console.log("\nUsage: load the SKILL.md into your AI agent conversation.");
|
|
34
33
|
console.log("Path: node_modules/@tanstack/intent/meta/<name>/SKILL.md");
|
|
35
34
|
}
|
|
36
|
-
|
|
37
35
|
//#endregion
|
|
38
|
-
export { runMetaCommand };
|
|
36
|
+
export { runMetaCommand };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import { dirname, join, resolve } from "node:path";
|
|
3
|
-
|
|
4
3
|
//#region src/package-manager.ts
|
|
5
4
|
function readPackageManagerField(dir) {
|
|
6
5
|
try {
|
|
@@ -43,6 +42,5 @@ function detectPackageManager(cwd = process.cwd(), extraDirs = []) {
|
|
|
43
42
|
}
|
|
44
43
|
return "unknown";
|
|
45
44
|
}
|
|
46
|
-
|
|
47
45
|
//#endregion
|
|
48
|
-
export { detectPackageManager as t };
|
|
46
|
+
export { detectPackageManager as t };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { a as readWorkspacePatterns, r as findWorkspaceRoot } from "./workspace-patterns-
|
|
1
|
+
import { a as readWorkspacePatterns, r as findWorkspaceRoot } from "./workspace-patterns-BDoJIWk-.mjs";
|
|
2
2
|
import { existsSync, statSync } from "node:fs";
|
|
3
3
|
import { dirname, join, relative, resolve } from "node:path";
|
|
4
|
-
|
|
5
4
|
//#region src/core/project-context.ts
|
|
6
5
|
/**
|
|
7
6
|
* Resolves project structure by walking up from targetPath (or cwd) to find the
|
|
@@ -49,6 +48,5 @@ function isWithinOrEqual(path, parentDir) {
|
|
|
49
48
|
const rel = relative(parentDir, path);
|
|
50
49
|
return rel === "" || !rel.startsWith("..") && !rel.startsWith("/");
|
|
51
50
|
}
|
|
52
|
-
|
|
53
51
|
//#endregion
|
|
54
|
-
export { resolveProjectContext as t };
|
|
52
|
+
export { resolveProjectContext as t };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { i as parseSkillUse } from "./skill-use-
|
|
2
|
-
import { o as warningMentionsPackage } from "./excludes-
|
|
3
|
-
|
|
1
|
+
import { i as parseSkillUse } from "./skill-use-B2xRF1i9.mjs";
|
|
2
|
+
import { o as warningMentionsPackage } from "./excludes-ByvSbmmj.mjs";
|
|
4
3
|
//#region src/resolver.ts
|
|
5
4
|
var ResolveSkillUseError = class extends Error {
|
|
6
5
|
constructor({ availablePackages = [], availableSkills = [], code, packageName, skillName, suggestedSkills = [], use }) {
|
|
@@ -65,7 +64,7 @@ function resolveSkillEntry(packageName, skillName, skills) {
|
|
|
65
64
|
}
|
|
66
65
|
function resolveSkillUse(use, scanResult) {
|
|
67
66
|
const { packageName, skillName } = parseSkillUse(use);
|
|
68
|
-
const packages = scanResult.packages.filter((pkg
|
|
67
|
+
const packages = scanResult.packages.filter((pkg) => pkg.name === packageName);
|
|
69
68
|
const pkg = packages.find((candidate) => candidate.source === "local") ?? packages[0];
|
|
70
69
|
if (!pkg) throw new ResolveSkillUseError({
|
|
71
70
|
availablePackages: scanResult.packages.map((candidate) => candidate.name),
|
|
@@ -107,6 +106,5 @@ function formatSkillSuggestions(packageName, skillNames) {
|
|
|
107
106
|
if (uses.length <= 2) return uses.join(" or ");
|
|
108
107
|
return `${uses.slice(0, -1).join(", ")}, or ${uses.at(-1)}`;
|
|
109
108
|
}
|
|
110
|
-
|
|
111
109
|
//#endregion
|
|
112
|
-
export { resolveSkillUse as i, isResolveSkillUseError as n, resolveSkillEntry as r, ResolveSkillUseError as t };
|
|
110
|
+
export { resolveSkillUse as i, isResolveSkillUseError as n, resolveSkillEntry as r, ResolveSkillUseError as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
|
|
3
2
|
//#region src/commands/scaffold.ts
|
|
4
3
|
function runScaffoldCommand(metaDir) {
|
|
5
4
|
function metaSkillPath(name) {
|
|
@@ -70,6 +69,5 @@ This produces: individual SKILL.md files.
|
|
|
70
69
|
`;
|
|
71
70
|
console.log(prompt);
|
|
72
71
|
}
|
|
73
|
-
|
|
74
72
|
//#endregion
|
|
75
|
-
export { runScaffoldCommand };
|
|
73
|
+
export { runScaffoldCommand };
|
|
@@ -1,12 +1,11 @@
|
|
|
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-
|
|
4
|
-
import { t as detectPackageManager } from "./package-manager-
|
|
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-6FtqhOYf.mjs";
|
|
2
|
+
import { r as rewriteSkillLoadPaths } from "./skill-paths-Bm1P6IYe.mjs";
|
|
3
|
+
import { n as findWorkspacePackages, r as findWorkspaceRoot } from "./workspace-patterns-BDoJIWk-.mjs";
|
|
4
|
+
import { t as detectPackageManager } from "./package-manager-Dw7lYcI0.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
8
8
|
import semver from "semver";
|
|
9
|
-
|
|
10
9
|
//#region src/discovery/register.ts
|
|
11
10
|
function isLocalToProject(dirPath, projectRoot) {
|
|
12
11
|
return dirPath.startsWith(projectRoot + sep) || dirPath.startsWith(projectRoot + "/");
|
|
@@ -84,7 +83,6 @@ function createPackageRegistrar(opts) {
|
|
|
84
83
|
tryRegister
|
|
85
84
|
};
|
|
86
85
|
}
|
|
87
|
-
|
|
88
86
|
//#endregion
|
|
89
87
|
//#region src/discovery/walk.ts
|
|
90
88
|
function createDependencyWalker(opts) {
|
|
@@ -156,7 +154,6 @@ function createDependencyWalker(opts) {
|
|
|
156
154
|
walkWorkspacePackages
|
|
157
155
|
};
|
|
158
156
|
}
|
|
159
|
-
|
|
160
157
|
//#endregion
|
|
161
158
|
//#region src/fs-cache.ts
|
|
162
159
|
function isRecord(value) {
|
|
@@ -220,7 +217,6 @@ function createIntentFsCache() {
|
|
|
220
217
|
exists: (path) => activeFs.existsSync(path)
|
|
221
218
|
};
|
|
222
219
|
}
|
|
223
|
-
|
|
224
220
|
//#endregion
|
|
225
221
|
//#region src/scanner.ts
|
|
226
222
|
const requireFromHere = createRequire(import.meta.url);
|
|
@@ -325,14 +321,12 @@ function deriveIntentConfig(pkgJson) {
|
|
|
325
321
|
}
|
|
326
322
|
function readSkillEntry(skillsDir, childDir, skillFile, readFs = nodeReadFs) {
|
|
327
323
|
const fm = parseFrontmatter(skillFile, readFs);
|
|
328
|
-
const relName = toPosixPath(relative(skillsDir, childDir));
|
|
329
|
-
const desc = typeof fm?.description === "string" ? fm.description.replace(/\s+/g, " ").trim() : "";
|
|
330
324
|
return {
|
|
331
|
-
name:
|
|
325
|
+
name: toPosixPath(relative(skillsDir, childDir)),
|
|
332
326
|
path: skillFile,
|
|
333
|
-
description:
|
|
334
|
-
type:
|
|
335
|
-
framework:
|
|
327
|
+
description: typeof fm?.description === "string" ? fm.description.replace(/\s+/g, " ").trim() : "",
|
|
328
|
+
type: readScalarField(fm, "type"),
|
|
329
|
+
framework: readScalarField(fm, "framework")
|
|
336
330
|
};
|
|
337
331
|
}
|
|
338
332
|
function discoverSkillByNameHint(skillsDir, packageName, skillNameHint, readFs = nodeReadFs) {
|
|
@@ -640,6 +634,5 @@ function scanIntentPackageAtRoot(packageRoot, options = {}) {
|
|
|
640
634
|
warnings
|
|
641
635
|
};
|
|
642
636
|
}
|
|
643
|
-
|
|
644
637
|
//#endregion
|
|
645
|
-
export { scanIntentPackageAtRoot as n, createIntentFsCache as r, scanForIntents as t };
|
|
638
|
+
export { scanIntentPackageAtRoot as n, createIntentFsCache as r, scanForIntents as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region src/workspace-patterns.d.ts
|
|
2
|
-
|
|
3
2
|
declare function readWorkspacePatterns(root: string): Array<string> | null;
|
|
4
3
|
declare function resolveWorkspacePackages(root: string, patterns: Array<string>): Array<string>;
|
|
5
4
|
declare function findWorkspaceRoot(start: string): string | null;
|
|
@@ -1,8 +1,7 @@
|
|
|
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-BDoJIWk-.mjs";
|
|
2
|
+
import { t as resolveProjectContext } from "./project-context-oi_m7paK.mjs";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { basename, join, relative } from "node:path";
|
|
5
|
-
|
|
6
5
|
//#region src/setup.ts
|
|
7
6
|
function isGenericWorkspaceName(name, root) {
|
|
8
7
|
const normalized = name.trim().toLowerCase();
|
|
@@ -195,6 +194,5 @@ function runSetupGithubActions(root, metaDir) {
|
|
|
195
194
|
}
|
|
196
195
|
return result;
|
|
197
196
|
}
|
|
198
|
-
|
|
199
197
|
//#endregion
|
|
200
|
-
export { runEditPackageJsonAll as n, runSetupGithubActions as r, runEditPackageJson as t };
|
|
198
|
+
export { runEditPackageJsonAll as n, runSetupGithubActions as r, runEditPackageJson as t };
|
|
@@ -3,6 +3,5 @@ async function runSetupGithubActionsCommand(root, metaDir) {
|
|
|
3
3
|
const { runSetupGithubActions } = await import("./setup.mjs");
|
|
4
4
|
runSetupGithubActions(root, metaDir);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
6
|
//#endregion
|
|
8
|
-
export { runSetupGithubActionsCommand };
|
|
7
|
+
export { runSetupGithubActionsCommand };
|
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-CdfBc7Oe.mjs";
|
|
2
2
|
export { EditPackageJsonResult, MonorepoResult, SetupGithubActionsResult, findPackagesWithSkills, findWorkspaceRoot, readWorkspacePatterns, resolveWorkspacePackages, runEditPackageJson, runEditPackageJsonAll, runSetupGithubActions };
|
package/dist/setup.mjs
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { n as runEditPackageJsonAll, r as runSetupGithubActions, t as runEditPackageJson } from "./setup-DpCYUVSf.mjs";
|
|
5
|
-
|
|
6
|
-
export { findPackagesWithSkills, findWorkspaceRoot, readWorkspacePatterns, resolveWorkspacePackages, runEditPackageJson, runEditPackageJsonAll, runSetupGithubActions };
|
|
1
|
+
import { a as readWorkspacePatterns, o as resolveWorkspacePackages, r as findWorkspaceRoot, t as findPackagesWithSkills } from "./workspace-patterns-BDoJIWk-.mjs";
|
|
2
|
+
import { n as runEditPackageJsonAll, r as runSetupGithubActions, t as runEditPackageJson } from "./setup-Cx1r2y-1.mjs";
|
|
3
|
+
export { findPackagesWithSkills, findWorkspaceRoot, readWorkspacePatterns, resolveWorkspacePackages, runEditPackageJson, runEditPackageJsonAll, runSetupGithubActions };
|