caik-cli 0.1.1 → 0.6.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.
Files changed (55) hide show
  1. package/README.md +8 -7
  2. package/dist/api-6OX4ICXN.js +9 -0
  3. package/dist/auto-improve-skills-2COKTU5C.js +8 -0
  4. package/dist/autoresearch-Y7WW6L4O.js +24 -0
  5. package/dist/chunk-2YHUDOJL.js +54 -0
  6. package/dist/chunk-3TXNZINH.js +775 -0
  7. package/dist/chunk-5MHNQAV4.js +317 -0
  8. package/dist/chunk-7AIZTHHZ.js +152 -0
  9. package/dist/chunk-D4IM3YRX.js +166 -0
  10. package/dist/chunk-DJJHS7KK.js +62 -0
  11. package/dist/chunk-DKZBQRR3.js +91 -0
  12. package/dist/chunk-FLSHJZLC.js +613 -0
  13. package/dist/chunk-H2ZKCXMJ.js +202 -0
  14. package/dist/chunk-ILMOSMD3.js +83 -0
  15. package/dist/chunk-KYTHKH6V.js +79 -0
  16. package/dist/chunk-LTKHLRM4.js +272 -0
  17. package/dist/chunk-T32AEP3O.js +146 -0
  18. package/dist/chunk-T73Z5UMA.js +14437 -0
  19. package/dist/chunk-TFKT7V7H.js +1545 -0
  20. package/dist/chunk-US4CYDNS.js +524 -0
  21. package/dist/chunk-ZLRN7Q7C.js +27 -0
  22. package/dist/claude-code-6DF4YARB.js +8 -0
  23. package/dist/config-CS7734SA.js +24 -0
  24. package/dist/correction-classifier-TLPKRNLI.js +93 -0
  25. package/dist/cursor-Z4XXDCAM.js +8 -0
  26. package/dist/daemon/autoresearch-2MAEM2YI.js +272 -0
  27. package/dist/daemon/chunk-545XA5CB.js +77 -0
  28. package/dist/daemon/chunk-HEYFAUHL.js +90 -0
  29. package/dist/daemon/chunk-MLKGABMK.js +9 -0
  30. package/dist/daemon/chunk-NJICGNCK.js +150 -0
  31. package/dist/daemon/chunk-OD5NUFH2.js +181 -0
  32. package/dist/daemon/chunk-SM2FSXIP.js +60 -0
  33. package/dist/daemon/chunk-UMDJFPN6.js +163 -0
  34. package/dist/daemon/config-F7HE3JRY.js +23 -0
  35. package/dist/daemon/db-QEXVVTAL.js +15 -0
  36. package/dist/daemon/eval-generator-OR2FAYLB.js +316 -0
  37. package/dist/daemon/improver-TGEK6MPE.js +186 -0
  38. package/dist/daemon/llm-FUJ2TBYT.js +11 -0
  39. package/dist/daemon/nudge-detector-NFRHWZY6.js +140 -0
  40. package/dist/daemon/platform-7N3LQDIB.js +16381 -0
  41. package/dist/daemon/registry-FI4GTO3H.js +20 -0
  42. package/dist/daemon/server.js +356 -0
  43. package/dist/daemon/trace-store-T7XFGQSX.js +19 -0
  44. package/dist/daemon-UXYMG46V.js +85 -0
  45. package/dist/db-TLNRIXLK.js +18 -0
  46. package/dist/eval-generator-GGMRPO3K.js +21 -0
  47. package/dist/eval-runner-EF4K6T5Y.js +15 -0
  48. package/dist/index.js +8033 -568
  49. package/dist/llm-3UUZX6PX.js +12 -0
  50. package/dist/platform-52NREMBS.js +33 -0
  51. package/dist/repo-installer-K6ADOW3E.js +25 -0
  52. package/dist/setup-P744STZE.js +16 -0
  53. package/dist/test-loop-Y7QQE55P.js +127 -0
  54. package/dist/trace-store-FVLMNNDK.js +20 -0
  55. package/package.json +9 -3
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ callAnthropic,
4
+ getAnthropicApiKey,
5
+ parseLLMJson
6
+ } from "./chunk-DJJHS7KK.js";
7
+ import "./chunk-ZLRN7Q7C.js";
8
+ export {
9
+ callAnthropic,
10
+ getAnthropicApiKey,
11
+ parseLLMJson
12
+ };
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ detectPlatform,
4
+ detectPlatforms,
5
+ getDefaultMcpConfig,
6
+ getPlatformAdapter
7
+ } from "./chunk-TFKT7V7H.js";
8
+ import {
9
+ cleanupFiles,
10
+ findRegistryEntry,
11
+ listRegistryEntries,
12
+ readRegistry,
13
+ removeRegistryEntry,
14
+ upsertRegistryEntry,
15
+ writeRegistry
16
+ } from "./chunk-DKZBQRR3.js";
17
+ import "./chunk-KYTHKH6V.js";
18
+ import "./chunk-US4CYDNS.js";
19
+ import "./chunk-T73Z5UMA.js";
20
+ import "./chunk-ZLRN7Q7C.js";
21
+ export {
22
+ cleanupFiles,
23
+ detectPlatform,
24
+ detectPlatforms,
25
+ findRegistryEntry,
26
+ getDefaultMcpConfig,
27
+ getPlatformAdapter,
28
+ listRegistryEntries,
29
+ readRegistry,
30
+ removeRegistryEntry,
31
+ upsertRegistryEntry,
32
+ writeRegistry
33
+ };
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ applyRepoInstallPlan,
4
+ createRepoInstallPlan,
5
+ getRepoInstallStatePath,
6
+ getRepoInstallerManifest,
7
+ isRepoInstallerManifest,
8
+ readRepoInstallState,
9
+ resolveRepoInstallPlan,
10
+ uninstallRepoInstall,
11
+ uninstallRepoInstallState
12
+ } from "./chunk-FLSHJZLC.js";
13
+ import "./chunk-2YHUDOJL.js";
14
+ import "./chunk-ZLRN7Q7C.js";
15
+ export {
16
+ applyRepoInstallPlan,
17
+ createRepoInstallPlan,
18
+ getRepoInstallStatePath,
19
+ getRepoInstallerManifest,
20
+ isRepoInstallerManifest,
21
+ readRepoInstallState,
22
+ resolveRepoInstallPlan,
23
+ uninstallRepoInstall,
24
+ uninstallRepoInstallState
25
+ };
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ registerSetupCommand,
4
+ runRepair
5
+ } from "./chunk-3TXNZINH.js";
6
+ import "./chunk-TFKT7V7H.js";
7
+ import "./chunk-DKZBQRR3.js";
8
+ import "./chunk-KYTHKH6V.js";
9
+ import "./chunk-US4CYDNS.js";
10
+ import "./chunk-T73Z5UMA.js";
11
+ import "./chunk-T32AEP3O.js";
12
+ import "./chunk-ZLRN7Q7C.js";
13
+ export {
14
+ registerSetupCommand,
15
+ runRepair
16
+ };
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ generateEvalSuite,
4
+ getEvalSuite,
5
+ validateJudges
6
+ } from "./chunk-5MHNQAV4.js";
7
+ import {
8
+ persistTraces
9
+ } from "./chunk-7AIZTHHZ.js";
10
+ import {
11
+ autoResearchLoop
12
+ } from "./chunk-LTKHLRM4.js";
13
+ import "./chunk-D4IM3YRX.js";
14
+ import {
15
+ callAnthropic,
16
+ getAnthropicApiKey,
17
+ parseLLMJson
18
+ } from "./chunk-DJJHS7KK.js";
19
+ import "./chunk-DKZBQRR3.js";
20
+ import "./chunk-KYTHKH6V.js";
21
+ import "./chunk-ZLRN7Q7C.js";
22
+
23
+ // src/daemon/test-loop.ts
24
+ import { readFileSync, existsSync } from "fs";
25
+ import { randomUUID } from "crypto";
26
+ var CRITIQUE_SYSTEM = `You are an artifact quality analyst. Given a Claude Code artifact (skill, prompt, rule, subagent, or command), identify 5 specific, actionable weaknesses. For each weakness, write a realistic user correction \u2014 what a user would say after the artifact produced bad output due to this weakness.
27
+
28
+ Return a JSON array of objects:
29
+ [{
30
+ "correctionType": "output_rejected" | "scope_adjusted" | "format_changed" | "approach_changed" | "output_modified",
31
+ "correctionPrompt": "What the user would say (realistic, 1-2 sentences)",
32
+ "category": "short category name (e.g., verbosity, missing_context, wrong_format)",
33
+ "weakness": "What's wrong with the skill"
34
+ }]
35
+
36
+ Be specific and grounded. Don't invent generic complaints \u2014 find real weaknesses in THIS skill.`;
37
+ async function generateSyntheticTraces(slug, skillContent, apiKey) {
38
+ const result = await callAnthropic(apiKey, {
39
+ model: "claude-haiku-4-5-20251001",
40
+ system: CRITIQUE_SYSTEM,
41
+ userMessage: `Skill slug: ${slug}
42
+
43
+ <skill>
44
+ ${skillContent}
45
+ </skill>`,
46
+ maxTokens: 2048
47
+ });
48
+ const corrections = parseLLMJson(result.text);
49
+ return corrections.map((c, i) => ({
50
+ id: randomUUID(),
51
+ sessionId: `synthetic-${Date.now()}`,
52
+ slug,
53
+ timestamp: new Date(Date.now() + i * 1e3).toISOString(),
54
+ kind: "correction",
55
+ toolName: "mcp__caik__get_artifact",
56
+ toolInput: { slug },
57
+ toolResponse: { success: true, content: skillContent.slice(0, 500) },
58
+ correctionType: c.correctionType,
59
+ correctionPrompt: c.correctionPrompt
60
+ }));
61
+ }
62
+ async function runTestLoop(db, slug, skillPath, config) {
63
+ const apiKey = getAnthropicApiKey();
64
+ if (!apiKey) {
65
+ return { slug, skillPath, tracesGenerated: 0, evalCases: 0, loopResult: null, error: "No ANTHROPIC_API_KEY set" };
66
+ }
67
+ if (!existsSync(skillPath)) {
68
+ return { slug, skillPath, tracesGenerated: 0, evalCases: 0, loopResult: null, error: `Skill file not found: ${skillPath}` };
69
+ }
70
+ const skillContent = readFileSync(skillPath, "utf-8");
71
+ if (skillContent.trim().length < 20) {
72
+ return { slug, skillPath, tracesGenerated: 0, evalCases: 0, loopResult: null, error: "Skill content too short (< 20 chars)" };
73
+ }
74
+ const traces = await generateSyntheticTraces(slug, skillContent, apiKey);
75
+ persistTraces(db, traces);
76
+ const successTraces = [
77
+ {
78
+ id: randomUUID(),
79
+ sessionId: `synthetic-success-${Date.now()}`,
80
+ slug,
81
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
82
+ kind: "success",
83
+ toolName: "mcp__caik__get_artifact",
84
+ toolInput: { slug },
85
+ toolResponse: { success: true, content: skillContent.slice(0, 200) }
86
+ },
87
+ {
88
+ id: randomUUID(),
89
+ sessionId: `synthetic-success-${Date.now()}`,
90
+ slug,
91
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
92
+ kind: "success",
93
+ toolName: "mcp__caik__search",
94
+ toolInput: { query: slug },
95
+ toolResponse: { success: true, results: [{ slug, quality: 80 }] }
96
+ }
97
+ ];
98
+ persistTraces(db, successTraces);
99
+ await generateEvalSuite(db, slug, apiKey);
100
+ const validation = await validateJudges(db, slug, apiKey, skillContent, config.mutationModel);
101
+ const finalSuite = getEvalSuite(db, slug);
102
+ if (!finalSuite || finalSuite.cases.length === 0) {
103
+ return {
104
+ slug,
105
+ skillPath,
106
+ tracesGenerated: traces.length,
107
+ evalCases: 0,
108
+ tpr: validation.tpr,
109
+ tnr: validation.tnr,
110
+ loopResult: null,
111
+ error: "No eval cases generated \u2014 LLM may not have produced valid assertions"
112
+ };
113
+ }
114
+ const loopResult = await autoResearchLoop(slug, skillPath, finalSuite, config, apiKey);
115
+ return {
116
+ slug,
117
+ skillPath,
118
+ tracesGenerated: traces.length,
119
+ evalCases: finalSuite.cases.length,
120
+ tpr: validation.tpr,
121
+ tnr: validation.tnr,
122
+ loopResult
123
+ };
124
+ }
125
+ export {
126
+ runTestLoop
127
+ };
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ bufferPrompt,
4
+ bufferToolCall,
5
+ buildTraces,
6
+ clearSessionBuffer,
7
+ getTraceCount,
8
+ getTraces,
9
+ persistTraces
10
+ } from "./chunk-7AIZTHHZ.js";
11
+ import "./chunk-ZLRN7Q7C.js";
12
+ export {
13
+ bufferPrompt,
14
+ bufferToolCall,
15
+ buildTraces,
16
+ clearSessionBuffer,
17
+ getTraceCount,
18
+ getTraces,
19
+ persistTraces
20
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "caik-cli",
3
- "version": "0.1.1",
3
+ "version": "0.6.0",
4
4
  "type": "module",
5
5
  "description": "CAIK CLI — Search, install, and publish AI artifacts from your terminal",
6
6
  "keywords": [
@@ -17,7 +17,7 @@
17
17
  "homepage": "https://caik.dev",
18
18
  "repository": {
19
19
  "type": "git",
20
- "url": "https://github.com/open-lattice-ai/caik",
20
+ "url": "https://github.com/caikdev/caik",
21
21
  "directory": "packages/cli"
22
22
  },
23
23
  "license": "MIT",
@@ -34,13 +34,19 @@
34
34
  "typecheck": "tsc --noEmit"
35
35
  },
36
36
  "dependencies": {
37
+ "@inquirer/prompts": "^8.3.2",
38
+ "better-sqlite3": "^12.8.0",
37
39
  "chalk": "^5.6.2",
38
40
  "cli-table3": "^0.6.5",
39
41
  "commander": "^14.0.3",
42
+ "gray-matter": "^4.0.3",
40
43
  "ora": "^9.3.0"
41
44
  },
42
45
  "devDependencies": {
46
+ "@anthropic-ai/claude-agent-sdk": "^0.2.81",
47
+ "@caik/shared": "workspace:*",
48
+ "@types/better-sqlite3": "^7.6.13",
43
49
  "tsup": "^8.5.1",
44
50
  "tsx": "^4.21.0"
45
51
  }
46
- }
52
+ }