@tanstack/intent 0.0.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.
Files changed (37) hide show
  1. package/README.md +66 -0
  2. package/dist/cli.d.mts +1 -0
  3. package/dist/cli.mjs +327 -0
  4. package/dist/feedback-DKreHfB1.mjs +300 -0
  5. package/dist/feedback-FIUBOL0g.mjs +3 -0
  6. package/dist/index.d.mts +61 -0
  7. package/dist/index.mjs +8 -0
  8. package/dist/init-DEzzXm9j.mjs +3 -0
  9. package/dist/init-DNxmjQfU.mjs +70 -0
  10. package/dist/intent-library.d.mts +1 -0
  11. package/dist/intent-library.mjs +123 -0
  12. package/dist/library-scanner-BrznE00j.mjs +111 -0
  13. package/dist/library-scanner.d.mts +16 -0
  14. package/dist/library-scanner.mjs +4 -0
  15. package/dist/scanner-BuWPDJ4P.mjs +4 -0
  16. package/dist/scanner-CpsJAHXT.mjs +147 -0
  17. package/dist/setup-CNGz26qL.mjs +116 -0
  18. package/dist/setup-N5dttGp_.d.mts +10 -0
  19. package/dist/setup.d.mts +2 -0
  20. package/dist/setup.mjs +3 -0
  21. package/dist/staleness-CnomT9Hm.mjs +72 -0
  22. package/dist/staleness-DyhsrqQ5.mjs +4 -0
  23. package/dist/types-kbQfN_is.d.mts +70 -0
  24. package/dist/utils-DjkEPBxu.mjs +39 -0
  25. package/meta/domain-discovery/SKILL.md +681 -0
  26. package/meta/generate-skill/SKILL.md +419 -0
  27. package/meta/skill-staleness-check/SKILL.md +282 -0
  28. package/meta/templates/oz/domain-discovery.md +53 -0
  29. package/meta/templates/oz/feedback-collection.md +69 -0
  30. package/meta/templates/oz/skill-update.md +47 -0
  31. package/meta/templates/oz/tree-generation.md +48 -0
  32. package/meta/templates/workflows/generate-skills-oz.yml +86 -0
  33. package/meta/templates/workflows/notify-playbooks.yml +52 -0
  34. package/meta/templates/workflows/update-skills-oz.yml +98 -0
  35. package/meta/templates/workflows/validate-skills.yml +52 -0
  36. package/meta/tree-generator/SKILL.md +859 -0
  37. package/package.json +38 -0
@@ -0,0 +1,2 @@
1
+ import { n as runSetup, t as SetupResult } from "./setup-N5dttGp_.mjs";
2
+ export { SetupResult, runSetup };
package/dist/setup.mjs ADDED
@@ -0,0 +1,3 @@
1
+ import { t as runSetup } from "./setup-CNGz26qL.mjs";
2
+
3
+ export { runSetup };
@@ -0,0 +1,72 @@
1
+ import { n as parseFrontmatter, t as findSkillFiles } from "./utils-DjkEPBxu.mjs";
2
+ import { readFileSync } from "node:fs";
3
+ import { join, relative, sep } from "node:path";
4
+
5
+ //#region src/staleness.ts
6
+ function classifyVersionDrift(oldVer, newVer) {
7
+ if (oldVer === newVer) return null;
8
+ const oldParts = oldVer.replace(/[^0-9.]/g, "").split(".").map(Number);
9
+ const newParts = newVer.replace(/[^0-9.]/g, "").split(".").map(Number);
10
+ if ((newParts[0] ?? 0) > (oldParts[0] ?? 0)) return "major";
11
+ if ((newParts[1] ?? 0) > (oldParts[1] ?? 0)) return "minor";
12
+ if ((newParts[2] ?? 0) > (oldParts[2] ?? 0)) return "patch";
13
+ return null;
14
+ }
15
+ async function fetchNpmVersion(packageName) {
16
+ try {
17
+ const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`);
18
+ if (!res.ok) return null;
19
+ const data = await res.json();
20
+ return typeof data.version === "string" ? data.version : null;
21
+ } catch {
22
+ return null;
23
+ }
24
+ }
25
+ function readSyncState(packageDir) {
26
+ const statePath = join(packageDir, "skills", "sync-state.json");
27
+ try {
28
+ return JSON.parse(readFileSync(statePath, "utf8"));
29
+ } catch {
30
+ return null;
31
+ }
32
+ }
33
+ async function checkStaleness(packageDir, packageName) {
34
+ const skillsDir = join(packageDir, "skills");
35
+ const library = packageName ?? "unknown";
36
+ const skillMetas = findSkillFiles(skillsDir).map((filePath) => {
37
+ const fm = parseFrontmatter(filePath);
38
+ const relName = relative(skillsDir, filePath).replace(/[/\\]SKILL\.md$/, "").split(sep).join("/");
39
+ return {
40
+ name: fm?.name ?? relName,
41
+ filePath,
42
+ libraryVersion: fm?.library_version,
43
+ sources: Array.isArray(fm?.sources) ? fm.sources : void 0
44
+ };
45
+ });
46
+ const skillVersion = skillMetas.find((s) => s.libraryVersion)?.libraryVersion ?? null;
47
+ const currentVersion = await fetchNpmVersion(library);
48
+ const versionDrift = skillVersion && currentVersion ? classifyVersionDrift(skillVersion, currentVersion) : null;
49
+ const syncState = readSyncState(packageDir);
50
+ return {
51
+ library,
52
+ currentVersion,
53
+ skillVersion,
54
+ versionDrift,
55
+ skills: skillMetas.map((skill) => {
56
+ const reasons = [];
57
+ if (currentVersion && skill.libraryVersion && skill.libraryVersion !== currentVersion) reasons.push(`version drift (${skill.libraryVersion} → ${currentVersion})`);
58
+ const storedShas = syncState?.skills?.[skill.name]?.sources_sha ?? {};
59
+ if (skill.sources && Object.keys(storedShas).length > 0) {
60
+ for (const source of skill.sources) if (!storedShas[source]) reasons.push(`new source (${source})`);
61
+ }
62
+ return {
63
+ name: skill.name,
64
+ reasons,
65
+ needsReview: reasons.length > 0
66
+ };
67
+ })
68
+ };
69
+ }
70
+
71
+ //#endregion
72
+ export { checkStaleness as t };
@@ -0,0 +1,4 @@
1
+ import "./utils-DjkEPBxu.mjs";
2
+ import { t as checkStaleness } from "./staleness-CnomT9Hm.mjs";
3
+
4
+ export { checkStaleness };
@@ -0,0 +1,70 @@
1
+ //#region src/types.d.ts
2
+ interface IntentConfig {
3
+ version: number;
4
+ repo: string;
5
+ docs: string;
6
+ requires?: string[];
7
+ }
8
+ interface ScanResult {
9
+ packageManager: 'npm' | 'pnpm' | 'yarn' | 'bun' | 'unknown';
10
+ packages: IntentPackage[];
11
+ warnings: string[];
12
+ }
13
+ interface IntentPackage {
14
+ name: string;
15
+ version: string;
16
+ intent: IntentConfig;
17
+ skills: SkillEntry[];
18
+ }
19
+ interface SkillEntry {
20
+ name: string;
21
+ path: string;
22
+ description: string;
23
+ type?: string;
24
+ framework?: string;
25
+ }
26
+ interface StalenessReport {
27
+ library: string;
28
+ currentVersion: string | null;
29
+ skillVersion: string | null;
30
+ versionDrift: 'major' | 'minor' | 'patch' | null;
31
+ skills: SkillStaleness[];
32
+ }
33
+ interface SkillStaleness {
34
+ name: string;
35
+ reasons: string[];
36
+ needsReview: boolean;
37
+ }
38
+ interface FeedbackPayload {
39
+ skill: string;
40
+ package: string;
41
+ skillVersion: string;
42
+ task: string;
43
+ whatWorked: string;
44
+ whatFailed: string;
45
+ missing: string;
46
+ selfCorrections: string;
47
+ userRating: 'good' | 'mixed' | 'bad';
48
+ userComments?: string;
49
+ }
50
+ type MetaSkillName = 'domain-discovery' | 'tree-generator' | 'generate-skill' | 'skill-staleness-check';
51
+ type AgentName = 'oz' | 'claude-code' | 'cursor' | 'copilot' | 'codex' | 'other';
52
+ interface MetaFeedbackPayload {
53
+ metaSkill: MetaSkillName;
54
+ library: string;
55
+ agentUsed: AgentName;
56
+ artifactQuality: 'good' | 'mixed' | 'bad';
57
+ interviewQuality?: 'good' | 'mixed' | 'bad' | 'skipped';
58
+ failureModeQuality?: 'good' | 'mixed' | 'bad' | 'not-applicable';
59
+ whatWorked: string;
60
+ whatFailed: string;
61
+ suggestions: string;
62
+ userRating: 'good' | 'mixed' | 'bad';
63
+ }
64
+ interface IntentProjectConfig {
65
+ feedback: {
66
+ frequency: string;
67
+ };
68
+ }
69
+ //#endregion
70
+ export { IntentProjectConfig as a, ScanResult as c, StalenessReport as d, IntentPackage as i, SkillEntry as l, FeedbackPayload as n, MetaFeedbackPayload as o, IntentConfig as r, MetaSkillName as s, AgentName as t, SkillStaleness as u };
@@ -0,0 +1,39 @@
1
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { parse } from "yaml";
4
+
5
+ //#region src/utils.ts
6
+ /**
7
+ * Recursively find all SKILL.md files under a directory.
8
+ */
9
+ function findSkillFiles(dir) {
10
+ const files = [];
11
+ if (!existsSync(dir)) return files;
12
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
13
+ const fullPath = join(dir, entry.name);
14
+ if (entry.isDirectory()) files.push(...findSkillFiles(fullPath));
15
+ else if (entry.name === "SKILL.md") files.push(fullPath);
16
+ }
17
+ return files;
18
+ }
19
+ /**
20
+ * Parse YAML frontmatter from a file. Returns null if no frontmatter or on error.
21
+ */
22
+ function parseFrontmatter(filePath) {
23
+ let content;
24
+ try {
25
+ content = readFileSync(filePath, "utf8");
26
+ } catch {
27
+ return null;
28
+ }
29
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
30
+ if (!match) return null;
31
+ try {
32
+ return parse(match[1]);
33
+ } catch {
34
+ return null;
35
+ }
36
+ }
37
+
38
+ //#endregion
39
+ export { parseFrontmatter as n, findSkillFiles as t };