kraken-code 1.1.1 → 1.1.3
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 +130 -377
- package/dist/cli/index.js +130 -63
- package/dist/google-auth.js +3 -15
- package/dist/index.js +16173 -13677
- package/dist/kraken-code.schema.json +1865 -0
- package/package.json +15 -4
package/dist/cli/index.js
CHANGED
|
@@ -1262,67 +1262,106 @@ async function runInstall() {
|
|
|
1262
1262
|
if (false) {}
|
|
1263
1263
|
|
|
1264
1264
|
// src/cli/init.ts
|
|
1265
|
-
import { writeFileSync as writeFileSync2, existsSync as existsSync6, mkdirSync } from "fs";
|
|
1265
|
+
import { writeFileSync as writeFileSync2, existsSync as existsSync6, mkdirSync, readFileSync as readFileSync6 } from "fs";
|
|
1266
1266
|
import * as path4 from "path";
|
|
1267
1267
|
import * as os4 from "os";
|
|
1268
1268
|
import color4 from "picocolors";
|
|
1269
|
-
var __dirname = "/
|
|
1269
|
+
var __dirname = "/tmp/kraken-code/src/cli";
|
|
1270
1270
|
async function runInit(options) {
|
|
1271
1271
|
console.log(color4.cyan("\uD83D\uDC19 Initializing Kraken Code..."));
|
|
1272
1272
|
const configDir = path4.join(os4.homedir(), ".config", "opencode");
|
|
1273
|
-
const
|
|
1273
|
+
const opencodeConfigPath = path4.join(configDir, "opencode.json");
|
|
1274
|
+
const krakenConfigPath = path4.join(configDir, "kraken-code.json");
|
|
1274
1275
|
if (!existsSync6(configDir)) {
|
|
1275
1276
|
mkdirSync(configDir, { recursive: true });
|
|
1276
1277
|
}
|
|
1277
1278
|
const isMinimal = options.minimal;
|
|
1278
1279
|
const isFull = options.full;
|
|
1279
|
-
const
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1280
|
+
const krakenConfig = {
|
|
1281
|
+
default_agent: "Kraken",
|
|
1282
|
+
blitzkrieg: {
|
|
1283
|
+
enabled: true,
|
|
1284
|
+
testPlan: {
|
|
1285
|
+
requiredBeforeImplementation: true,
|
|
1286
|
+
minTestCases: 3,
|
|
1287
|
+
requireCoverageThreshold: true,
|
|
1288
|
+
coverageThresholdPercent: 80
|
|
1289
|
+
},
|
|
1290
|
+
tddWorkflow: {
|
|
1291
|
+
enforceWriteTestFirst: true,
|
|
1292
|
+
forbidCodeWithoutTest: true,
|
|
1293
|
+
allowRefactorWithoutTest: true
|
|
1294
|
+
},
|
|
1295
|
+
evidence: {
|
|
1296
|
+
requireTestExecutionEvidence: true,
|
|
1297
|
+
requireAssertionEvidence: true,
|
|
1298
|
+
requireEdgeCaseEvidence: true
|
|
1285
1299
|
},
|
|
1300
|
+
plannerConstraints: {
|
|
1301
|
+
requireTestStep: true,
|
|
1302
|
+
requireVerificationStep: true,
|
|
1303
|
+
maxImplementationStepComplexity: 3
|
|
1304
|
+
}
|
|
1305
|
+
},
|
|
1306
|
+
kratos: {
|
|
1307
|
+
enabled: true,
|
|
1308
|
+
autoSave: true,
|
|
1309
|
+
storagePath: "~/.kratos"
|
|
1310
|
+
},
|
|
1311
|
+
modes: {
|
|
1286
1312
|
blitzkrieg: {
|
|
1313
|
+
enabled: true
|
|
1314
|
+
},
|
|
1315
|
+
ultrathink: {
|
|
1287
1316
|
enabled: true,
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
minTestCases: 3,
|
|
1291
|
-
requireCoverageThreshold: !isMinimal,
|
|
1292
|
-
coverageThresholdPercent: 80
|
|
1293
|
-
},
|
|
1294
|
-
tddWorkflow: {
|
|
1295
|
-
enforceWriteTestFirst: !isMinimal,
|
|
1296
|
-
forbidCodeWithoutTest: !isMinimal,
|
|
1297
|
-
allowRefactorWithoutTest: true
|
|
1298
|
-
},
|
|
1299
|
-
evidence: {
|
|
1300
|
-
requireTestExecutionEvidence: !isMinimal,
|
|
1301
|
-
requireAssertionEvidence: !isMinimal,
|
|
1302
|
-
requireEdgeCaseEvidence: !isMinimal
|
|
1303
|
-
},
|
|
1304
|
-
plannerConstraints: {
|
|
1305
|
-
requireTestStep: !isMinimal,
|
|
1306
|
-
requireVerificationStep: !isMinimal,
|
|
1307
|
-
maxImplementationStepComplexity: 3
|
|
1308
|
-
}
|
|
1317
|
+
thinkingBudget: 32000,
|
|
1318
|
+
autoVariantSwitch: true
|
|
1309
1319
|
},
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1320
|
+
ultrawork: {
|
|
1321
|
+
enabled: true,
|
|
1322
|
+
parallelAgents: 4
|
|
1323
|
+
},
|
|
1324
|
+
search: {
|
|
1325
|
+
enabled: true,
|
|
1326
|
+
maxResults: 50
|
|
1316
1327
|
},
|
|
1317
|
-
|
|
1328
|
+
analyze: {
|
|
1318
1329
|
enabled: true,
|
|
1319
|
-
|
|
1320
|
-
storagePath: path4.join(os4.homedir(), ".kratos")
|
|
1330
|
+
consultationPhases: 3
|
|
1321
1331
|
}
|
|
1322
1332
|
}
|
|
1323
1333
|
};
|
|
1324
|
-
|
|
1325
|
-
|
|
1334
|
+
let existingKrakenConfig = {};
|
|
1335
|
+
if (existsSync6(krakenConfigPath)) {
|
|
1336
|
+
try {
|
|
1337
|
+
existingKrakenConfig = JSON.parse(readFileSync6(krakenConfigPath, "utf-8"));
|
|
1338
|
+
} catch {
|
|
1339
|
+
existingKrakenConfig = {};
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
const mergedKrakenConfig = {
|
|
1343
|
+
...krakenConfig,
|
|
1344
|
+
...existingKrakenConfig
|
|
1345
|
+
};
|
|
1346
|
+
writeFileSync2(krakenConfigPath, JSON.stringify(mergedKrakenConfig, null, 2));
|
|
1347
|
+
console.log(color4.green(`\u2713 Kraken Code configuration written to ${krakenConfigPath}`));
|
|
1348
|
+
let existingOpencodeConfig = {};
|
|
1349
|
+
if (existsSync6(opencodeConfigPath)) {
|
|
1350
|
+
try {
|
|
1351
|
+
existingOpencodeConfig = JSON.parse(readFileSync6(opencodeConfigPath, "utf-8"));
|
|
1352
|
+
} catch {
|
|
1353
|
+
existingOpencodeConfig = {};
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
const mergedOpencodeConfig = {
|
|
1357
|
+
...existingOpencodeConfig,
|
|
1358
|
+
plugin: Array.from(new Set([
|
|
1359
|
+
...existingOpencodeConfig.plugin || [],
|
|
1360
|
+
"kraken-code"
|
|
1361
|
+
]))
|
|
1362
|
+
};
|
|
1363
|
+
writeFileSync2(opencodeConfigPath, JSON.stringify(mergedOpencodeConfig, null, 2));
|
|
1364
|
+
console.log(color4.green(`\u2713 OpenCode configuration updated at ${opencodeConfigPath}`));
|
|
1326
1365
|
await installSkillTemplates();
|
|
1327
1366
|
console.log(color4.green(`
|
|
1328
1367
|
\uD83C\uDF89 Kraken Code initialized!`));
|
|
@@ -1364,53 +1403,81 @@ async function installSkillTemplates() {
|
|
|
1364
1403
|
}
|
|
1365
1404
|
|
|
1366
1405
|
// src/cli/status.ts
|
|
1367
|
-
import { readFileSync as
|
|
1406
|
+
import { readFileSync as readFileSync7, existsSync as existsSync7 } from "fs";
|
|
1368
1407
|
import * as path5 from "path";
|
|
1369
1408
|
import * as os5 from "os";
|
|
1370
1409
|
import color5 from "picocolors";
|
|
1371
1410
|
async function runStatus() {
|
|
1372
1411
|
console.log(color5.cyan(`\uD83D\uDC19 Kraken Code Status
|
|
1373
1412
|
`));
|
|
1374
|
-
const
|
|
1375
|
-
|
|
1376
|
-
|
|
1413
|
+
const opencodeConfigPath = path5.join(os5.homedir(), ".config", "opencode", "opencode.json");
|
|
1414
|
+
const krakenConfigPath = path5.join(os5.homedir(), ".config", "opencode", "kraken-code.json");
|
|
1415
|
+
if (!existsSync7(opencodeConfigPath)) {
|
|
1416
|
+
console.log(color5.red("\u2717 OpenCode configuration not found"));
|
|
1377
1417
|
console.log(color5.dim(" Run: kraken-code init"));
|
|
1378
1418
|
return;
|
|
1379
1419
|
}
|
|
1380
|
-
const
|
|
1381
|
-
const
|
|
1420
|
+
const opencodeConfig = JSON.parse(readFileSync7(opencodeConfigPath, "utf-8"));
|
|
1421
|
+
const isPluginRegistered = opencodeConfig.plugin?.includes("kraken-code") || false;
|
|
1422
|
+
console.log(color5.bold("Plugin:"));
|
|
1423
|
+
if (isPluginRegistered) {
|
|
1424
|
+
console.log(color5.green(" \u2713 Registered: kraken-code"));
|
|
1425
|
+
} else {
|
|
1426
|
+
console.log(color5.red(" \u2717 Not registered"));
|
|
1427
|
+
console.log(color5.dim(" Run: kraken-code init"));
|
|
1428
|
+
}
|
|
1429
|
+
if (!existsSync7(krakenConfigPath)) {
|
|
1430
|
+
console.log(color5.yellow(`
|
|
1431
|
+
\u26A0 Kraken Code configuration not found`));
|
|
1432
|
+
console.log(color5.dim(" Run: kraken-code init"));
|
|
1433
|
+
return;
|
|
1434
|
+
}
|
|
1435
|
+
const config2 = JSON.parse(readFileSync7(krakenConfigPath, "utf-8"));
|
|
1382
1436
|
console.log(color5.bold("Plugin:"));
|
|
1383
1437
|
console.log(color5.green(" \u2713 Registered: kraken-code"));
|
|
1384
|
-
if (
|
|
1438
|
+
if (config2.default_agent) {
|
|
1385
1439
|
console.log(color5.bold(`
|
|
1386
|
-
|
|
1387
|
-
console.log(`
|
|
1388
|
-
|
|
1440
|
+
Default Agent:`));
|
|
1441
|
+
console.log(` ${config2.default_agent}`);
|
|
1442
|
+
}
|
|
1443
|
+
if (config2.agents) {
|
|
1444
|
+
const enabledAgents = Object.entries(config2.agents).filter(([_, agent]) => !agent.disable).map(([name]) => name);
|
|
1445
|
+
if (enabledAgents.length > 0) {
|
|
1446
|
+
console.log(color5.bold(`
|
|
1447
|
+
Enabled Agents:`));
|
|
1448
|
+
console.log(` ${enabledAgents.join(", ")}`);
|
|
1449
|
+
}
|
|
1389
1450
|
}
|
|
1390
|
-
if (
|
|
1391
|
-
const status =
|
|
1451
|
+
if (config2.blitzkrieg) {
|
|
1452
|
+
const status = config2.blitzkrieg.enabled ? color5.green("\u2713 Enabled") : color5.red("\u2717 Disabled");
|
|
1392
1453
|
console.log(color5.bold(`
|
|
1393
1454
|
Blitzkrieg Mode:`));
|
|
1394
1455
|
console.log(` Status: ${status}`);
|
|
1395
1456
|
console.log(color5.dim(" Activate with: 'blitz' or 'blz'"));
|
|
1396
1457
|
}
|
|
1397
|
-
if (
|
|
1398
|
-
const status =
|
|
1458
|
+
if (config2.kratos) {
|
|
1459
|
+
const status = config2.kratos.enabled ? color5.green("\u2713 Enabled") : color5.red("\u2717 Disabled");
|
|
1399
1460
|
console.log(color5.bold(`
|
|
1400
1461
|
Memory (Kratos):`));
|
|
1401
1462
|
console.log(` Status: ${status}`);
|
|
1402
|
-
console.log(` Storage: ${
|
|
1463
|
+
console.log(` Storage: ${config2.kratos.storagePath || config2.kratos.storagePath || "~/.kratos"}`);
|
|
1403
1464
|
}
|
|
1404
|
-
if (
|
|
1405
|
-
const
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1465
|
+
if (config2.modes) {
|
|
1466
|
+
const modeNames = [];
|
|
1467
|
+
for (const [modeName, modeConfig] of Object.entries(config2.modes)) {
|
|
1468
|
+
if (typeof modeConfig === "object" && modeConfig && modeConfig.enabled) {
|
|
1469
|
+
modeNames.push(modeName);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
if (modeNames.length > 0) {
|
|
1473
|
+
console.log(color5.bold(`
|
|
1474
|
+
Active Modes:`));
|
|
1475
|
+
console.log(` ${modeNames.join(", ")}`);
|
|
1476
|
+
}
|
|
1410
1477
|
}
|
|
1411
1478
|
}
|
|
1412
1479
|
// package.json
|
|
1413
|
-
var version2 = "1.1.
|
|
1480
|
+
var version2 = "1.1.3";
|
|
1414
1481
|
|
|
1415
1482
|
// src/cli/index.ts
|
|
1416
1483
|
var program = new Command;
|
package/dist/google-auth.js
CHANGED
|
@@ -3,7 +3,6 @@ var __create = Object.create;
|
|
|
3
3
|
var __getProtoOf = Object.getPrototypeOf;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
7
|
var __toESM = (mod, isNodeMode, target) => {
|
|
9
8
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
@@ -16,20 +15,6 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
16
15
|
});
|
|
17
16
|
return to;
|
|
18
17
|
};
|
|
19
|
-
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
20
|
-
var __toCommonJS = (from) => {
|
|
21
|
-
var entry = __moduleCache.get(from), desc;
|
|
22
|
-
if (entry)
|
|
23
|
-
return entry;
|
|
24
|
-
entry = __defProp({}, "__esModule", { value: true });
|
|
25
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
26
|
-
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
27
|
-
get: () => from[key],
|
|
28
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
29
|
-
}));
|
|
30
|
-
__moduleCache.set(from, entry);
|
|
31
|
-
return entry;
|
|
32
|
-
};
|
|
33
18
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
19
|
var __export = (target, all) => {
|
|
35
20
|
for (var name in all)
|
|
@@ -329,6 +314,9 @@ async function generatePKCEChallenge() {
|
|
|
329
314
|
};
|
|
330
315
|
}
|
|
331
316
|
async function buildAuthURL(projectId, clientId = ANTIGRAVITY_CLIENT_ID, port = ANTIGRAVITY_CALLBACK_PORT, usePKCE = true) {
|
|
317
|
+
if (!usePKCE) {
|
|
318
|
+
console.warn("[OAuth] PKCE is disabled. This weakens security and is not recommended. PKCE (RFC 7636) prevents authorization code interception attacks.");
|
|
319
|
+
}
|
|
332
320
|
const state = crypto.randomUUID().replace(/-/g, "");
|
|
333
321
|
const redirectUri = `http://localhost:${port}/oauth-callback`;
|
|
334
322
|
const url = new URL(GOOGLE_AUTH_URL);
|