kodingo-cli 1.0.3 → 1.0.4

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.
@@ -1,43 +1,22 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.inferDecisionSummary = inferDecisionSummary;
7
- const sdk_1 = __importDefault(require("@anthropic-ai/sdk"));
4
+ exports.inferMemoryFromCode = inferMemoryFromCode;
5
+ const KODINGO_API_URL = process.env.KODINGO_API_URL ?? "https://kodingo-api.onrender.com";
8
6
  async function inferDecisionSummary(input) {
9
- const apiKey = process.env.ANTHROPIC_API_KEY;
10
- if (!apiKey) {
11
- return buildFallback(input);
12
- }
13
7
  try {
14
- const client = new sdk_1.default({ apiKey });
15
- const prompt = [
16
- "You are a senior software engineer reviewing a code change.",
17
- "Your job is to interpret what this change represents as a decision or evolution in the codebase.",
18
- "",
19
- "Write 2 to 4 sentences of plain prose. No markdown, no bullet points, no headers.",
20
- "Focus on intent and reasoning, not on describing the diff mechanically.",
21
- "Treat the commit message as a low-trust hint only, not as truth.",
22
- "Use the symbol and file paths to understand what part of the system changed.",
23
- "If intent cannot be confidently inferred, say so honestly in plain English.",
24
- "",
25
- `Repository: ${input.repoName}`,
26
- `Symbol: ${input.symbol}`,
27
- `Changed files: ${input.changedFiles.join(", ")}`,
28
- `Commit message (low-trust hint): ${input.commitMessage}`,
29
- "",
30
- "Diff:",
31
- input.diff.slice(0, 8000),
32
- ].join("\n");
33
- const response = await client.messages.create({
34
- model: "claude-opus-4-5",
35
- max_tokens: 300,
36
- messages: [{ role: "user", content: prompt }],
8
+ const code = input.diff.slice(0, 2000);
9
+ const res = await fetch(`${KODINGO_API_URL}/infer`, {
10
+ method: "POST",
11
+ headers: { "Content-Type": "application/json" },
12
+ body: JSON.stringify({ symbol: input.symbol, code }),
37
13
  });
38
- const textBlock = response.content.find((b) => b.type === "text");
39
- if (textBlock && textBlock.type === "text") {
40
- return textBlock.text.trim();
14
+ if (!res.ok) {
15
+ return buildFallback(input);
16
+ }
17
+ const data = await res.json();
18
+ if (data.content) {
19
+ return data.content.trim();
41
20
  }
42
21
  return buildFallback(input);
43
22
  }
@@ -45,6 +24,22 @@ async function inferDecisionSummary(input) {
45
24
  return buildFallback(input);
46
25
  }
47
26
  }
27
+ async function inferMemoryFromCode(input) {
28
+ try {
29
+ const res = await fetch(`${KODINGO_API_URL}/infer`, {
30
+ method: "POST",
31
+ headers: { "Content-Type": "application/json" },
32
+ body: JSON.stringify({ symbol: input.symbol, code: input.code }),
33
+ });
34
+ if (!res.ok)
35
+ return null;
36
+ const data = await res.json();
37
+ return data;
38
+ }
39
+ catch {
40
+ return null;
41
+ }
42
+ }
48
43
  function buildFallback(input) {
49
44
  const shortHash = extractShortHash(input.diff);
50
45
  return `Changes to ${input.symbol} across ${input.changedFiles.length} file(s)${shortHash ? ` in commit ${shortHash}` : ""}. Commit message: ${input.commitMessage}.`;
@@ -65,3 +65,5 @@ async function readStdin() {
65
65
  process.stdin.on("error", reject);
66
66
  });
67
67
  }
68
+ // review test
69
+ // review test
@@ -82,3 +82,9 @@ function findRepoRoot(startPath) {
82
82
  current = parent;
83
83
  }
84
84
  }
85
+ function testKodingoSaveWatcher() {
86
+ return false;
87
+ }
88
+ function testKodingoSaveWatchers() {
89
+ return false;
90
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kodingo-cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Kodingo CLI",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -20,7 +20,6 @@
20
20
  "prepare": "npm run build"
21
21
  },
22
22
  "dependencies": {
23
- "@anthropic-ai/sdk": "^0.78.0",
24
23
  "@babel/parser": "^7.29.0",
25
24
  "@babel/traverse": "^7.29.0",
26
25
  "commander": "^12.1.0",