kraken-code 1.5.0 → 1.5.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/dist/cli/index.js CHANGED
@@ -26,7 +26,7 @@ ${r}`);return{name:n.name,status:"fail",message:s,duration:Math.round(performanc
26
26
  }
27
27
  `}async function oe(){let n=Cn(),t=ie(),e,s;if(t)try{e=te(t.path,"utf-8"),s=t.format}catch(r){return{success:!1,message:`Failed to read config: ${r instanceof Error?r.message:String(r)}`}}else{let r=D.dirname(n.configJson);if(!X(r))try{let{mkdirSync:a}=await import("fs");a(r,{recursive:!0})}catch(a){return{success:!1,message:`Failed to create config directory: ${a instanceof Error?a.message:String(a)}`}}e=ae(),s="json"}try{let r=re(e,s);ee(t?.path??n.configJson,r,"utf-8");let a=t?.path??n.configJson;if(r===e)return{success:!0,message:`Plugin "${R}" is already registered`,configPath:a};return{success:!0,message:`Plugin "${R}" registered successfully`,configPath:a}}catch(r){return{success:!1,message:`Failed to register plugin: ${r instanceof Error?r.message:String(r)}`}}}function ce(n){if(n.success){if(console.log(q.green(`
28
28
  ${String.fromCodePoint(10003)} ${n.message}`)),n.configPath)console.log(q.dim(` Config: ${n.configPath}`))}else console.log(q.red(`
29
- ${String.fromCodePoint(10007)} ${n.message}`))}async function vn(){let n=await oe();ce(n),process.exit(n.success?0:1)}import{writeFileSync as yn,existsSync as j,mkdirSync as Q,readFileSync as W}from"fs";import{parseJsonc as M}from"jsonc-parser";import*as I from"path";import*as T from"os";import u from"picocolors";var __dirname="/home/runner/work/kraken/kraken/src/cli";function Tn(n,t){let e=structuredClone(n)||{};for(let[s,r]of Object.entries(t))if(r!==null&&r!==void 0&&typeof r==="object"&&!Array.isArray(r))if(typeof e[s]==="object"&&e[s]!==null&&!Array.isArray(e[s]))e[s]=Tn(e[s],r);else e[s]=structuredClone(r);else if(r!==null&&r!==void 0)e[s]=r;return e}async function bn(n){if(n.verbose)console.log(u.dim("\uD83D\uDC19 Initializing Kraken Code with verbose output..."));else console.log(u.cyan("\uD83D\uDC19 Initializing Kraken Code..."));let t=I.join(T.homedir(),".config","opencode"),e=I.join(t,"opencode.json"),s=I.join(t,"kraken-code.json");if(!j(t))try{if(Q(t,{recursive:!0}),n.verbose)console.log(u.dim(`\u2139\uFE0F Created config directory: ${t}`));console.log(u.green(`\u2713 Created config directory: ${t}`))}catch(p){console.error(u.red(`\u274C Failed to create config directory: ${p instanceof Error?p.message:String(p)}`)),console.error(u.dim("Try running with elevated permissions or check permissions for ~/.config/opencode")),process.exit(1)}else if(n.verbose)console.log(u.dim(`\u2139\uFE0F Config directory already exists: ${t}`));let{minimal:r,full:a}=n,l={blitzkrieg:{enabled:!0,testPlan:{requiredBeforeImplementation:!0,minTestCases:3,requireCoverageThreshold:!0,coverageThresholdPercent:80},tddWorkflow:{enforceWriteTestFirst:!0,forbidCodeWithoutTest:!0,allowRefactorWithoutTest:!0},evidence:{requireTestExecutionEvidence:!0,requireAssertionEvidence:!0,requireEdgeCaseEvidence:!0},plannerConstraints:{requireTestStep:!0,requireVerificationStep:!0,maxImplementationStepComplexity:3}},kratos:{enabled:!0,autoSave:!0,storagePath:"~/.kratos"},modes:{blitzkrieg:{enabled:!0},ultrathink:{enabled:!0,thinkingBudget:32000,autoVariantSwitch:!0},ultrawork:{enabled:!0,parallelAgents:4},search:{enabled:!0,maxResults:50},analyze:{enabled:!0,consultationPhases:3}}},g={};if(j(s))try{if(g=M(W(s,"utf-8")),n.verbose)console.log(u.dim(`\u2139\uFE0F Found existing Kraken configuration at ${s}, merging with new settings`))}catch(p){console.error(u.red(`\u274C Failed to read existing Kraken configuration: ${p instanceof Error?p.message:String(p)}`)),console.error(u.dim("This might be a corrupted config file. Try removing it manually and re-running init.")),g={}}else if(n.verbose)console.log(u.dim(`\u2139\uFE0F No existing Kraken configuration found at ${s}`));let f=Tn(l,g);try{if(yn(s,JSON.stringify(f,null,2)),n.verbose)console.log(u.dim(`\u2139\uFE0F Wrote configuration with ${Object.keys(f).length} keys`));console.log(u.green(`\u2713 Kraken Code configuration written to ${s}`))}catch(p){console.error(u.red(`\u274C Failed to write Kraken configuration: ${p instanceof Error?p.message:String(p)}`)),console.error(u.dim("Check permissions for the config file and try again.")),process.exit(1)}let c={};if(j(e))try{if(c=M(W(e,"utf-8")),n.verbose)console.log(u.dim(`\u2139\uFE0F Found existing OpenCode configuration at ${e}`))}catch(p){console.error(u.red(`\u274C Failed to read OpenCode configuration: ${p instanceof Error?p.message:String(p)}`)),console.error(u.dim("This might be a corrupted opencode.json file. Try removing it manually and re-running init.")),c={}}else if(n.verbose)console.log(u.dim(`\u2139\uFE0F No existing OpenCode configuration found at ${e}`));let P={...c,plugin:Array.from(new Set([...c.plugin||[],"kraken-code"]))};if(n.verbose)console.log(u.dim(`\u2139\uFE0F Adding kraken-code to plugin list (current plugins: ${c.plugin||[]})`));try{if(yn(e,JSON.stringify(P,null,2)),n.verbose)console.log(u.dim(`\u2139\uFE0F Updated OpenCode configuration with ${P.plugin.length} plugins`));console.log(u.green(`\u2713 OpenCode configuration updated at ${e}`))}catch(p){console.error(u.red(`\u274C Failed to update OpenCode configuration: ${p instanceof Error?p.message:String(p)}`)),console.error(u.dim("Check permissions for the config file and try again.")),process.exit(1)}try{if(await ue(),n.verbose)console.log(u.dim("\u2139\uFE0F Skill templates installation completed successfully"));console.log(u.green("\u2713 Skill templates installed successfully"))}catch(p){console.error(u.yellow(`\u26A0\uFE0F Failed to install skill templates: ${p instanceof Error?p.message:String(p)}`)),console.error(u.dim("You can install them manually later by copying templates/skills to ~/.config/opencode/skill"))}if(console.log(u.green(`
29
+ ${String.fromCodePoint(10007)} ${n.message}`))}async function vn(){let n=await oe();ce(n),process.exit(n.success?0:1)}import{writeFileSync as yn,existsSync as j,mkdirSync as Q,readFileSync as W}from"fs";import{parse as M}from"jsonc-parser";import*as I from"path";import*as T from"os";import u from"picocolors";var __dirname="/home/runner/work/kraken/kraken/src/cli";function Tn(n,t){let e=structuredClone(n)||{};for(let[s,r]of Object.entries(t))if(r!==null&&r!==void 0&&typeof r==="object"&&!Array.isArray(r))if(typeof e[s]==="object"&&e[s]!==null&&!Array.isArray(e[s]))e[s]=Tn(e[s],r);else e[s]=structuredClone(r);else if(r!==null&&r!==void 0)e[s]=r;return e}async function bn(n){if(n.verbose)console.log(u.dim("\uD83D\uDC19 Initializing Kraken Code with verbose output..."));else console.log(u.cyan("\uD83D\uDC19 Initializing Kraken Code..."));let t=I.join(T.homedir(),".config","opencode"),e=I.join(t,"opencode.json"),s=I.join(t,"kraken-code.json");if(!j(t))try{if(Q(t,{recursive:!0}),n.verbose)console.log(u.dim(`\u2139\uFE0F Created config directory: ${t}`));console.log(u.green(`\u2713 Created config directory: ${t}`))}catch(p){console.error(u.red(`\u274C Failed to create config directory: ${p instanceof Error?p.message:String(p)}`)),console.error(u.dim("Try running with elevated permissions or check permissions for ~/.config/opencode")),process.exit(1)}else if(n.verbose)console.log(u.dim(`\u2139\uFE0F Config directory already exists: ${t}`));let{minimal:r,full:a}=n,l={blitzkrieg:{enabled:!0,testPlan:{requiredBeforeImplementation:!0,minTestCases:3,requireCoverageThreshold:!0,coverageThresholdPercent:80},tddWorkflow:{enforceWriteTestFirst:!0,forbidCodeWithoutTest:!0,allowRefactorWithoutTest:!0},evidence:{requireTestExecutionEvidence:!0,requireAssertionEvidence:!0,requireEdgeCaseEvidence:!0},plannerConstraints:{requireTestStep:!0,requireVerificationStep:!0,maxImplementationStepComplexity:3}},kratos:{enabled:!0,autoSave:!0,storagePath:"~/.kratos"},modes:{blitzkrieg:{enabled:!0},ultrathink:{enabled:!0,thinkingBudget:32000,autoVariantSwitch:!0},ultrawork:{enabled:!0,parallelAgents:4},search:{enabled:!0,maxResults:50},analyze:{enabled:!0,consultationPhases:3}}},g={};if(j(s))try{if(g=M(W(s,"utf-8")),n.verbose)console.log(u.dim(`\u2139\uFE0F Found existing Kraken configuration at ${s}, merging with new settings`))}catch(p){console.error(u.red(`\u274C Failed to read existing Kraken configuration: ${p instanceof Error?p.message:String(p)}`)),console.error(u.dim("This might be a corrupted config file. Try removing it manually and re-running init.")),g={}}else if(n.verbose)console.log(u.dim(`\u2139\uFE0F No existing Kraken configuration found at ${s}`));let f=Tn(l,g);try{if(yn(s,JSON.stringify(f,null,2)),n.verbose)console.log(u.dim(`\u2139\uFE0F Wrote configuration with ${Object.keys(f).length} keys`));console.log(u.green(`\u2713 Kraken Code configuration written to ${s}`))}catch(p){console.error(u.red(`\u274C Failed to write Kraken configuration: ${p instanceof Error?p.message:String(p)}`)),console.error(u.dim("Check permissions for the config file and try again.")),process.exit(1)}let c={};if(j(e))try{if(c=M(W(e,"utf-8")),n.verbose)console.log(u.dim(`\u2139\uFE0F Found existing OpenCode configuration at ${e}`))}catch(p){console.error(u.red(`\u274C Failed to read OpenCode configuration: ${p instanceof Error?p.message:String(p)}`)),console.error(u.dim("This might be a corrupted opencode.json file. Try removing it manually and re-running init.")),c={}}else if(n.verbose)console.log(u.dim(`\u2139\uFE0F No existing OpenCode configuration found at ${e}`));let P={...c,plugin:Array.from(new Set([...c.plugin||[],"kraken-code"]))};if(n.verbose)console.log(u.dim(`\u2139\uFE0F Adding kraken-code to plugin list (current plugins: ${c.plugin||[]})`));try{if(yn(e,JSON.stringify(P,null,2)),n.verbose)console.log(u.dim(`\u2139\uFE0F Updated OpenCode configuration with ${P.plugin.length} plugins`));console.log(u.green(`\u2713 OpenCode configuration updated at ${e}`))}catch(p){console.error(u.red(`\u274C Failed to update OpenCode configuration: ${p instanceof Error?p.message:String(p)}`)),console.error(u.dim("Check permissions for the config file and try again.")),process.exit(1)}try{if(await ue(),n.verbose)console.log(u.dim("\u2139\uFE0F Skill templates installation completed successfully"));console.log(u.green("\u2713 Skill templates installed successfully"))}catch(p){console.error(u.yellow(`\u26A0\uFE0F Failed to install skill templates: ${p instanceof Error?p.message:String(p)}`)),console.error(u.dim("You can install them manually later by copying templates/skills to ~/.config/opencode/skill"))}if(console.log(u.green(`
30
30
  \uD83C\uDF89 Kraken Code initialized successfully!`)),console.log(u.dim(`
31
31
  Next steps:`)),console.log(u.dim(" 1. Run: opencode")),console.log(u.dim(" 2. Use 'blitz' or 'blz' to activate Blitzkrieg Mode")),n.verbose)console.log(u.dim(`
32
32
  \uD83D\uDD0D Verifying installation with detailed output...`));else console.log(u.dim(`
@@ -43,4 +43,4 @@ Active Modes:`)),console.log(` ${l.join(", ")}`)}}import*as b from"path";import
43
43
  \uD83D\uDDD1\uFE0F Removing files...`));if(l.forEach((c)=>{try{if(le(c),n.verbose)console.log(m.dim(`\u2139\uFE0F Removed ${c}`));else console.log(m.green(`\u2713 Removed ${c}`))}catch(P){console.log(m.yellow(`\u26A0\uFE0F Could not remove ${c}: ${P instanceof Error?P.message:String(P)}`))}}),n.verbose)console.log(m.dim("\uD83D\uDDD1\uFE0F Removing directories..."));else console.log(m.yellow("\uD83D\uDDD1\uFE0F Removing directories..."));if(f.forEach((c)=>{try{if(pe(c,{recursive:!0,force:!0}),n.verbose)console.log(m.dim(`\u2139\uFE0F Removed ${c}`));else console.log(m.green(`\u2713 Removed ${c}`))}catch(P){console.log(m.yellow(`\u26A0\uFE0F Could not remove ${c}: ${P instanceof Error?P.message:String(P)}`))}}),$(s))try{let c=A($n(s,"utf-8"));if(c.plugin){let P=c.plugin.filter((p)=>p!=="kraken-code");if(P.length!==c.plugin.length){let p={...c,plugin:P};if(me(s,JSON.stringify(p,null,2)),n.verbose)console.log(m.dim("\u2139\uFE0F Updated opencode.json plugin list (removed kraken-code)"));console.log(m.green("\u2713 Removed kraken-code from opencode.json plugin list"))}else if(n.verbose)console.log(m.dim("\u2139\uFE0F kraken-code was not in opencode.json plugin list"))}}catch(c){console.log(m.yellow(`\u26A0\uFE0F Could not update opencode.json: ${c instanceof Error?c.message:String(c)}`))}else if(n.verbose)console.log(m.dim("\u2139\uFE0F opencode.json not found, skipping plugin list update"));if(console.log(m.green(`
44
44
  \uD83C\uDF89 Kraken Code uninstalled successfully!`)),n.verbose)console.log(m.dim(`
45
45
  \uD83D\uDCCB Summary of changes:`)),console.log(m.dim(" - Configuration files removed")),console.log(m.dim(" - Skill templates removed")),console.log(m.dim(" - Plugin registration removed from opencode.json"));console.log(m.dim(`
46
- To reinstall, run: kraken-code install`))}function Gn(n){n.command("uninstall").description("Uninstall and deregister Kraken Code plugin").option("--dry-run","Show what would be removed without actually removing").option("-v, --verbose","Show detailed output").action(async(t)=>{await ge(t)})}var Jn="1.5.0";var E=new de;E.name("kraken-code").description("Kraken Code CLI - Unified OpenCode Plugin Manager").version(Jn);E.command("install").description("Install and register Kraken Code plugin").action(async()=>{await vn()});E.command("init").description("Initialize Kraken Code with recommended configuration").option("--minimal","Minimal setup (agents only)").option("--full","Full setup (all features)").option("-v, --verbose","Show detailed output").action(async(n)=>{await bn(n)});E.command("status").description("Show Kraken Code installation status").action(async()=>{await Dn()});Gn(E);E.command("doctor").description("Run system checks and diagnostics").option("-c, --category <category>","Run checks for a specific category").option("--json","Output results as JSON").option("-v, --verbose","Show detailed output").action(async(n)=>{await wn({category:n.category,json:n.json,verbose:n.verbose})});E.parse(process.argv);if(!process.argv.slice(2).length)E.outputHelp();
46
+ To reinstall, run: kraken-code install`))}function Gn(n){n.command("uninstall").description("Uninstall and deregister Kraken Code plugin").option("--dry-run","Show what would be removed without actually removing").option("-v, --verbose","Show detailed output").action(async(t)=>{await ge(t)})}var Jn="1.5.2";var E=new de;E.name("kraken-code").description("Kraken Code CLI - Unified OpenCode Plugin Manager").version(Jn);E.command("install").description("Install and register Kraken Code plugin").action(async()=>{await vn()});E.command("init").description("Initialize Kraken Code with recommended configuration").option("--minimal","Minimal setup (agents only)").option("--full","Full setup (all features)").option("-v, --verbose","Show detailed output").action(async(n)=>{await bn(n)});E.command("status").description("Show Kraken Code installation status").action(async()=>{await Dn()});Gn(E);E.command("doctor").description("Run system checks and diagnostics").option("-c, --category <category>","Run checks for a specific category").option("--json","Output results as JSON").option("-v, --verbose","Show detailed output").action(async(n)=>{await wn({category:n.category,json:n.json,verbose:n.verbose})});E.parse(process.argv);if(!process.argv.slice(2).length)E.outputHelp();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kraken-code",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Kraken Code - Transforms OpenCode into an autonomous, high-density development environment",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",