@tanstack/intent 0.0.1 → 0.0.2
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 +10 -10
- package/dist/cli.mjs +70 -7
- package/meta/domain-discovery/SKILL.md +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -50,16 +50,16 @@ npx intent setup
|
|
|
50
50
|
|
|
51
51
|
## CLI Commands
|
|
52
52
|
|
|
53
|
-
| Command
|
|
54
|
-
|
|
|
55
|
-
| `intent init`
|
|
56
|
-
| `intent list [--json]`
|
|
57
|
-
| `intent meta`
|
|
58
|
-
| `intent scaffold`
|
|
59
|
-
| `intent validate [dir]`
|
|
60
|
-
| `intent setup`
|
|
61
|
-
| `intent stale [--json]`
|
|
62
|
-
| `intent feedback`
|
|
53
|
+
| Command | Description |
|
|
54
|
+
| ----------------------- | ----------------------------------------------- |
|
|
55
|
+
| `intent init` | Inject intent discovery into agent config files |
|
|
56
|
+
| `intent list [--json]` | Discover intent-enabled packages |
|
|
57
|
+
| `intent meta` | List meta-skills for library maintainers |
|
|
58
|
+
| `intent scaffold` | Print the guided skill generation prompt |
|
|
59
|
+
| `intent validate [dir]` | Validate SKILL.md files |
|
|
60
|
+
| `intent setup` | Copy CI/Oz workflow templates |
|
|
61
|
+
| `intent stale [--json]` | Check skills for version drift |
|
|
62
|
+
| `intent feedback` | Submit skill feedback |
|
|
63
63
|
|
|
64
64
|
## License
|
|
65
65
|
|
package/dist/cli.mjs
CHANGED
|
@@ -12,6 +12,55 @@ import { fileURLToPath } from "node:url";
|
|
|
12
12
|
function getMetaDir() {
|
|
13
13
|
return join(dirname(fileURLToPath(import.meta.url)), "..", "meta");
|
|
14
14
|
}
|
|
15
|
+
function padColumn(text, width) {
|
|
16
|
+
return text.length >= width ? text + " " : text.padEnd(width);
|
|
17
|
+
}
|
|
18
|
+
function printTable(headers, rows) {
|
|
19
|
+
const widths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => (r[i] ?? "").length)) + 2);
|
|
20
|
+
const headerLine = headers.map((h, i) => padColumn(h, widths[i])).join("");
|
|
21
|
+
const separator = widths.map((w) => "─".repeat(w)).join("");
|
|
22
|
+
console.log(headerLine);
|
|
23
|
+
console.log(separator);
|
|
24
|
+
for (const row of rows) console.log(row.map((cell, i) => padColumn(cell, widths[i])).join(""));
|
|
25
|
+
}
|
|
26
|
+
function printSkillTree(skills, opts) {
|
|
27
|
+
const roots = [];
|
|
28
|
+
const children = /* @__PURE__ */ new Map();
|
|
29
|
+
for (const skill of skills) {
|
|
30
|
+
const slashIdx = skill.name.indexOf("/");
|
|
31
|
+
if (slashIdx === -1) roots.push(skill.name);
|
|
32
|
+
else {
|
|
33
|
+
const parent = skill.name.slice(0, slashIdx);
|
|
34
|
+
if (!children.has(parent)) children.set(parent, []);
|
|
35
|
+
children.get(parent).push(skill);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (roots.length === 0) {
|
|
39
|
+
for (const skill of skills) if (!roots.includes(skill.name)) roots.push(skill.name);
|
|
40
|
+
}
|
|
41
|
+
for (const rootName of roots) {
|
|
42
|
+
const rootSkill = skills.find((s) => s.name === rootName);
|
|
43
|
+
if (!rootSkill) continue;
|
|
44
|
+
printSkillLine(rootName, rootSkill, 4, opts);
|
|
45
|
+
for (const sub of children.get(rootName) ?? []) printSkillLine(sub.name.slice(sub.name.indexOf("/") + 1), sub, 6, opts);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function printSkillLine(displayName, skill, indent, opts) {
|
|
49
|
+
const nameStr = " ".repeat(indent) + displayName;
|
|
50
|
+
const padding = " ".repeat(Math.max(2, opts.nameWidth - nameStr.length));
|
|
51
|
+
const typeCol = opts.showTypes ? (skill.type ? `[${skill.type}]` : "").padEnd(14) : "";
|
|
52
|
+
console.log(`${nameStr}${padding}${typeCol}${skill.description}`);
|
|
53
|
+
}
|
|
54
|
+
function computeSkillNameWidth(allPackageSkills) {
|
|
55
|
+
let max = 0;
|
|
56
|
+
for (const skills of allPackageSkills) for (const s of skills) {
|
|
57
|
+
const slashIdx = s.name.indexOf("/");
|
|
58
|
+
const displayName = slashIdx === -1 ? s.name : s.name.slice(slashIdx + 1);
|
|
59
|
+
const indent = slashIdx === -1 ? 4 : 6;
|
|
60
|
+
max = Math.max(max, indent + displayName.length);
|
|
61
|
+
}
|
|
62
|
+
return max + 2;
|
|
63
|
+
}
|
|
15
64
|
async function cmdList(args) {
|
|
16
65
|
const jsonOutput = args.includes("--json");
|
|
17
66
|
let result;
|
|
@@ -33,14 +82,28 @@ async function cmdList(args) {
|
|
|
33
82
|
}
|
|
34
83
|
return;
|
|
35
84
|
}
|
|
36
|
-
|
|
85
|
+
const totalSkills = result.packages.reduce((sum, p) => sum + p.skills.length, 0);
|
|
86
|
+
console.log(`\n${result.packages.length} intent-enabled packages, ${totalSkills} skills (${result.packageManager})\n`);
|
|
87
|
+
printTable([
|
|
88
|
+
"PACKAGE",
|
|
89
|
+
"VERSION",
|
|
90
|
+
"SKILLS",
|
|
91
|
+
"REQUIRES"
|
|
92
|
+
], result.packages.map((pkg) => [
|
|
93
|
+
pkg.name,
|
|
94
|
+
pkg.version,
|
|
95
|
+
String(pkg.skills.length),
|
|
96
|
+
pkg.intent.requires?.join(", ") || "–"
|
|
97
|
+
]));
|
|
98
|
+
const nameWidth = computeSkillNameWidth(result.packages.map((p) => p.skills));
|
|
99
|
+
const showTypes = result.packages.some((p) => p.skills.some((s) => s.type));
|
|
100
|
+
console.log(`\nSkills:\n`);
|
|
37
101
|
for (const pkg of result.packages) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
102
|
+
console.log(` ${pkg.name}`);
|
|
103
|
+
printSkillTree(pkg.skills, {
|
|
104
|
+
nameWidth,
|
|
105
|
+
showTypes
|
|
106
|
+
});
|
|
44
107
|
console.log();
|
|
45
108
|
}
|
|
46
109
|
if (result.warnings.length > 0) {
|
|
@@ -64,7 +64,7 @@ Log (but do not group yet):
|
|
|
64
64
|
- What the library does in one sentence
|
|
65
65
|
- The core abstractions a developer interacts with
|
|
66
66
|
- Which frameworks it supports
|
|
67
|
-
- Any existing skill files, agent configs, or
|
|
67
|
+
- Any existing skill files, agent configs, or intents
|
|
68
68
|
- Whether the library is a monorepo and which packages matter
|
|
69
69
|
|
|
70
70
|
---
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/intent",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Ship compositional knowledge for AI coding agents alongside your npm packages",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "tsdown src/index.ts src/cli.ts src/setup.ts src/intent-library.ts src/library-scanner.ts --format esm --dts",
|
|
36
|
-
"test:lib": "vitest run"
|
|
36
|
+
"test:lib": "vitest run",
|
|
37
|
+
"test:types": "tsc --noEmit"
|
|
37
38
|
}
|
|
38
39
|
}
|