@hlix/cli 0.2.0 → 0.4.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.
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import{a as w,d as te,e as h,f as D,g as C,h as f,i as v,j as fe,k as xe,l as we,m as ye,n as be,o as ke,p as y}from"./index-qd7p5gqk.js";import{q as ht}from"./index-syeavftx.js";import{relative as gt,resolve as ft}from"node:path";import{parseArgs as xt}from"node:util";import{createMastraCode as wt}from"mastracode";import{loadMcpConfig as yt}from"@mastra/code-sdk/mcp/config";import{executeSubagent as bt}from"@mastra/code-sdk/agents/subagents/execute";import{exploreSubagent as kt}from"@mastra/code-sdk/agents/subagents/explore";import{planSubagent as vt}from"@mastra/code-sdk/agents/subagents/plan";import{hasHeadlessFlag as St,parseHeadlessArgs as Ct,runMC as Ht}from"mastracode/headless";import{MastraTUI as jt}from"mastracode/tui";import{mkdirSync as Re,writeFileSync as Ae}from"node:fs";import{join as U}from"node:path";import{createTool as He}from"@mastra/core/tools";import{z as u}from"zod";var b=(e)=>`hlix_${e.split(" ").join("_")}`,je=u.object({args:u.array(u.string()).optional().describe("Positional arguments that follow the command name."),flags:u.record(u.string(),u.union([u.string(),u.boolean()])).optional().describe('Options without the leading dashes, e.g. { "yes": true, "name": "api" }.')}),Ie=u.object({exitCode:u.number(),stdout:u.string(),stderr:u.string()});function Pe(e,t,s){let r=e.name.split(" ").concat(t.args??[]);for(let[o,n]of Object.entries(t.flags??{})){if(n===!1)continue;if(r.push(`--${o}`),typeof n==="string")r.push(n)}if(!t.flags?.cwd)r.push("--cwd",s);if(e.supportsJson&&!t.flags?.json)r.push("--json");return r}async function _e(e,t,s,r=process.env){let o="",n="";return{exitCode:await D([e],Pe(e,t,s),{stdout:(c)=>{o+=c},stderr:(c)=>{n+=c},env:r}),stdout:o,stderr:n}}function B(e){let t={};for(let s of e.commands??y){let r=b(s.name);t[r]=He({id:r,description:`${s.summary}
3
+
4
+ ${s.usage}`,inputSchema:je,outputSchema:Ie,execute:async(o)=>_e(s,o,e.cwd,e.env)})}return t}var Me=(e)=>`${e.split(" ").join("-")}.md`;function $e(e){return["---",`description: ${e.summary}`,"---","",`Call the tool \`${b(e.name)}\` with the user's arguments: $ARGUMENTS.`,"Show the result.",""].join(`
5
+ `)}var Oe={"follow.md":["---","description: Watch a cloud task being coded, live","---","","Call the tool `hlix_tasks_follow` with `taskId` set to $ARGUMENTS. It streams the","coder's text and tool calls into this session. Summarise what it did.",""].join(`
6
+ `),"harness.md":["---","description: Show or change the harness — which coder does the work","---","","Call the tool `hlix_harness` with `harness` set to $ARGUMENTS when the user","named one, and with no argument when they did not. Show `message` verbatim.",""].join(`
7
+ `)};function q(e,t=y){let s=U(e,".hlix","commands");Re(s,{recursive:!0});let r=[],o=[...t.map((n)=>[Me(n.name),$e(n)]),...Object.entries(Oe)];for(let[n,i]of o){let c=U(s,n);try{Ae(c,i,{flag:"wx"}),r.push(c)}catch(a){if(a.code!=="EEXIST")throw a}}return r}import{execFileSync as Te}from"node:child_process";import{createACPTool as Ne}from"@mastra/acp";import{createTool as Ee}from"@mastra/core/tools";import{z as p}from"zod";var x={"claude-code":{harness:"claude-code",label:"Claude Code",command:"claude-agent-acp",args:[],authEnvVars:["ANTHROPIC_API_KEY"],install:"npm i -g @agentclientprotocol/claude-agent-acp"},codex:{harness:"codex",label:"Codex",command:"codex-acp",args:[],authEnvVars:["OPENAI_API_KEY"],env:{NO_BROWSER:"1"},install:"npm i -g @agentclientprotocol/codex-acp"},"cursor-agent":{harness:"cursor-agent",label:"Cursor Agent",command:"cursor-agent",args:["acp"],authEnvVars:["CURSOR_API_KEY"],install:"curl https://cursor.com/install -fsS | bash"}};function J(e){if(e.flag)return{harness:Fe(e.flag,"--harness"),source:"flag"};if(e.configured)return{harness:e.configured,source:e.configSource??"project"};return{harness:v,source:"default"}}function Fe(e,t){if(f.includes(e))return e;throw Error(`${t} must be one of ${f.join(", ")}; got "${e}".`)}var k="hlix_tasks_follow",We=(e)=>`hlix_coder_${e.split("-").join("_")}`;function V(e,t){let s=t.source==="default"?"":` (${t.source==="flag"?"--harness":t.source})`;return`${e} · harness: ${t.harness}${s}`}function X(e,t=3000){try{return Te("which",[e],{timeout:t,stdio:"ignore"}),!0}catch{return!1}}var S=(e)=>`harness ${e.harness} needs \`${e.command}\` on PATH. Install it with: ${e.install}`;function Le(e){let t=e.options??[],s=t.find((r)=>r.kind==="allow_once")??t.find((r)=>r.kind==="reject_once");if(!s)return{outcome:{outcome:"cancelled"}};return{outcome:{outcome:"selected",optionId:s.optionId}}}var K=["view","search_content","find_files","file_stat","lsp_inspect"],z=["ask_user","task_write","task_update","task_complete","task_check"],De=(e)=>[`harness ${e} runs in the project's Coding Workspace, not on this machine.`,"This session can follow and stream that work, but cannot start it:","which coder the platform uses comes from the project's harness preference,","and this CLI has no command that creates a task."].join(" "),Y=(e)=>[e==="unknown"?"This project's harness could not be read from the server. Do NOT guess which coder it runs — say so, and offer to check with the `hlix_harness` tool.":`This project's harness is ${e}: the platform runs ${e} for the coding work it executes, in the project's Coding Workspace.`,"Change it with the `hlix_harness` tool, which writes the project's setting.","","To do coding work here, dispatch it and then watch it:","1. `hlix_cycles_create` with the project id, a title and a description. That"," is what STARTS work — it enters the project's loop, which plans the cycle,"," creates its tasks and starts the coder. It returns no cycle id.","2. `hlix_tasks_list` with that project to find the tasks planning produced.",`3. \`${k}\` with a task id, which streams that coder's own text and`," tool calls into this session live. Report what it did.","","`hlix_tasks_create` only adds a board row; it does not start anything, and","there is no way to start a single task. Never claim otherwise."].join(`
8
+ `),Be=(e,t)=>[`The user chose the ${e.label} harness. Do not edit files or run commands`,`yourself. Hand the whole task to \`${t}\` as one natural-language brief,`,`then report what it did. ${e.label} reads and writes the same working`,"directory you are in.","",`It authenticates from ${e.authEnvVars.join(" or ")} in this shell's`,"environment. If it reports a credential problem, say so — do not retry."].join(`
9
+ `);function G(e){if(e.sandbox==="cloud"||e.active==="hlix")return[];let t=new Set(e.unavailable??[]),s=e.model?{defaultModelId:e.model}:{},r=[{id:"hlix",name:"Hlix",description:"The hlix agent codes here, with the full toolset.",...s}];for(let o of Object.values(x)){let n=e.active===o.harness,i=We(o.harness);r.push({id:o.harness,name:o.label,description:`${o.label} runs on this machine over ACP and edits ${e.cwd}.`,instructions:Be(o,i),availableTools:t.has(o.harness)?[...K,...z,k]:[i,...K,...z,k],...t.has(o.harness)?{}:{additionalTools:{[i]:Ne({id:i,description:`Run a coding task with ${o.label}. Give it one natural-language brief; it reads and writes the working directory and returns its final output.`,command:o.command,args:o.args,cwd:e.cwd,...o.env?{env:o.env}:{},...e.workspace?{workspace:e.workspace}:{},onPermissionRequest:async(c)=>Le(c)})}},...s,...n?{metadata:{default:!0}}:{}})}return r}function Ue(e){let t=[...e.available],s=(o,n="none")=>({harness:e.current,available:t,action:n,message:o});if(!e.requested)return s(`harness: ${e.current}. Available here: ${t.join(", ")}.`);if(!f.includes(e.requested))return s(`/harness must name one of ${f.join(", ")}; got "${e.requested}".`);let r=e.requested;if(e.sandbox==="cloud"){let o=`${e.sandboxLine} · harness: ${r} (project preference)`;return{harness:r,available:t,action:"preference",message:r==="hlix"?o:`${o}. ${De(r)}`}}if(!t.includes(r))return s(S(x[r]));if(!e.modesBuilt)return s(`This session runs the hlix coder, so there is no ${r} mode to switch to. Restart with \`hlix --harness ${r}\`, or make it the default with \`hlix config set harness ${r}\`.`,"restart");return{harness:r,available:t,action:"mode",message:`${e.sandboxLine} · harness: ${r}`}}function Q(e){return Ee({id:"hlix_harness",description:"Show or change the harness — which coder does the work. In a local or docker sandbox it switches this session's coder; in a cloud sandbox it writes the project's harness preference, which is what the platform runs. With no argument it reports the current harness.",inputSchema:p.object({harness:p.string().optional().describe(`One of ${f.join(", ")}. Omit to report the current one.`)}),outputSchema:p.object({harness:p.string(),available:p.array(p.string()),message:p.string()}),execute:async(t)=>{let s=e.session(),r=Ue({...t.harness?{requested:t.harness}:{},current:s?.mode.get()??v,available:e.available,sandbox:e.sandbox,sandboxLine:e.sandboxLine,modesBuilt:e.modesBuilt}),o={harness:r.harness,available:r.available,message:r.message};if(r.action==="mode"&&s)return await s.mode.switch({modeId:r.harness}),o;if(r.action==="preference"){if(!e.setProjectHarness)return{...o,message:"This folder is not bound to a hlix project, so there is no project preference to write. Run `hlix init` or pass --project <id>."};await e.setProjectHarness(r.harness)}return o}})}import{createTool as qe}from"@mastra/core/tools";import{writeToolProgress as Ke}from"mastracode/plugin";import{z as m}from"zod";function ze(e){switch(e.type){case"on_chat_model_stream":return e.delta?{event:"text",text:e.delta}:null;case"reasoning":return e.delta?{event:"text",text:e.delta}:null;case"on_tool_start":return{event:"tool_start",toolName:e.name,args:e.input};case"on_tool_end":return{event:"tool_end",toolName:e.name,result:e.output,isError:Je(e.output)};case"error":return{event:"finish",isError:!0,result:e.message};case"done":return{event:"finish",isError:!1};default:return null}}function Je(e){return typeof e==="object"&&e!==null&&e.status==="failed"}async function Ve(e,t){let s=[],r=[],o="streamed",n="The coder's turn ended.";for await(let i of e){if(i.type==="idle"){o="idle",n="Nothing is being coded right now. The task is not in build or test.";break}if(i.type==="error")o="error",n=i.message;if(i.type==="on_chat_model_stream")s.push(i.delta);if(i.type==="on_tool_start")r.push(i.name);let c=ze(i);if(c)await t(c)}return{status:o,text:s.join(""),tools:r,message:n}}function Z(e){return qe({id:"hlix_tasks_follow",description:"Watch a hlix task being coded in the cloud, live. Streams the coder's text and tool calls into this session as they happen, and returns what it did. Use it after a task starts building.",inputSchema:m.object({taskId:m.string().describe("The task to follow.")}),outputSchema:m.object({status:m.enum(["streamed","idle","error","unassigned"]),text:m.string(),tools:m.array(m.string()),message:m.string()}),execute:async(t,s)=>{let r=h(e.env??process.env,{cwd:e.cwd,flags:{}}),o=await r.tasks.get(t.taskId);if(!o.agentId)return{status:"unassigned",text:"",tools:[],message:"No agent has picked this task up yet, so there is no coder to watch. Check `hlix_tasks_get` again once it is building."};return Ve(r.projects.observeAgent(o.projectId,o.agentId),(n)=>Ke(s,n))}})}import{buildMode as Xe}from"@mastra/code-sdk/agents/modes/build";import{fastMode as Ye}from"@mastra/code-sdk/agents/modes/explore";import{planMode as Ge}from"@mastra/code-sdk/agents/modes/plan";import{setCustomProvidersSource as Qe}from"@mastra/code-sdk/agents/model";import{getCustomProviderId as ee,loadSettings as Ze}from"@mastra/code-sdk/onboarding/settings";var se="hlix",re="default",et=(e)=>`${se}/${e}`;function tt(e){return{name:se,url:`${e.baseUrl.replace(/\/+$/,"")}/v1/api/ai/w/${e.workspaceId}`,apiKey:e.apiKey,models:[...new Set([re,...e.models??[]])]}}function st(e){let t=[Xe,Ge,Ye];return e?t.map((s)=>({...s,defaultModelId:e})):t}function oe(e){let t=te({env:e.env,flags:{},cwd:e.cwd});if(t.conflict||!t.credential||!t.workspaceId)return null;let s=tt({baseUrl:t.baseUrl,workspaceId:t.workspaceId,apiKey:t.credential.apiKey,...e.models?{models:e.models}:{}}),r=ee(s.name);return Qe(()=>[...Ze().customProviders.filter((o)=>ee(o.name)!==r),s]),{provider:s,modelId:et(re)}}var ne=(e,t)=>e.length>0?[...e]:st(t);function ae(e){if(e.configured)return{id:e.configured,source:e.configuredSource??"config"};return e.wired?{id:e.wired.modelId,source:"workspace"}:null}var ie=(e,t)=>t?`${e} · model: ${t.id} (${t.source})`:e;import{execFileSync as lt}from"node:child_process";import{DockerSandbox as dt}from"@mastra/docker";import{LocalFilesystem as ut,Workspace as mt}from"@mastra/core/workspace";import{posix as ce}from"node:path";import{MastraFilesystem as rt,MastraSandbox as ot,Workspace as nt}from"@mastra/core/workspace";var at=600000,it=["recursive","overwrite","force","maxDepth","extension"];function g(e){let t=e??{},s={};for(let r of it)if(t[r]!==void 0)s[r]=t[r];return Object.keys(s).length>0?{options:s}:{}}var le=(e)=>e instanceof Date?e:new Date(typeof e==="string"||typeof e==="number"?e:0);class de extends rt{id;name="RemoteFilesystem";provider="hlix-coding-workspace";basePath;status="ready";client;constructor(e,t){super({name:"RemoteFilesystem"});this.client=e,this.basePath=t.root,this.id=t.id??`hlix-remote-fs:${t.root}`}getInfo(){return{id:this.id,name:this.name,provider:this.provider,status:this.status,metadata:{root:this.basePath}}}resolveAbsolutePath(e){return ce.isAbsolute(e)?e:ce.join(this.basePath,e)}async call(e){let{result:t}=await this.client.fs({...e,encoding:e.encoding??"utf8",path:this.resolveAbsolutePath(e.path)});return t}async readFile(e,t){let r=await this.call({op:"read",path:e,encoding:"base64"}),o=Buffer.from(r.content,r.encoding);return t?.encoding?o.toString(t.encoding):o}async writeFile(e,t,s){await this.call({op:"write",path:e,content:Buffer.from(t).toString("base64"),encoding:"base64",...g(s)})}async appendFile(e,t){await this.call({op:"append",path:e,content:Buffer.from(t).toString("base64"),encoding:"base64"})}async deleteFile(e,t){await this.call({op:"delete",path:e,...g(t)})}async copyFile(e,t,s){await this.call({op:"copy",path:e,dest:this.resolveAbsolutePath(t),...g(s)})}async moveFile(e,t,s){await this.call({op:"move",path:e,dest:this.resolveAbsolutePath(t),...g(s)})}async mkdir(e,t){await this.call({op:"mkdir",path:e,...g(t)})}async rmdir(e,t){await this.call({op:"rmdir",path:e,...g(t)})}async readdir(e,t){return await this.call({op:"readdir",path:e,...g(t)})??[]}async exists(e){return await this.call({op:"exists",path:e})===!0}async stat(e){let t=await this.call({op:"stat",path:e});return{...t,createdAt:le(t.createdAt),modifiedAt:le(t.modifiedAt)}}}var ct=(e)=>`'${e.split("'").join("'\\''")}'`;class ue extends ot{id;name="RemoteSandbox";provider="hlix-coding-workspace";status="ready";client;constructor(e,t){super({name:"RemoteSandbox"});if(this.client=e,this.id=`hlix-remote-sandbox:${t.projectId}`,t.root)this.setWorkingDirectory(t.root)}async start(){}getInfo(){return{id:this.id,name:this.name,provider:this.provider,status:this.status,createdAt:new Date(0)}}async executeCommand(e,t=[],s){let r=[e,...t.map(ct)].join(" "),o=Date.now(),n=s?.cwd??this.workingDirectory,i=await this.client.exec({command:r,...n?{cwd:n}:{},timeoutMs:s?.timeout??at});return{success:i.exitCode===0,exitCode:i.exitCode,stdout:i.stdout,stderr:i.stderr,executionTimeMs:Date.now()-o,command:e,args:t}}}function me(e,t){let s=t.root??"/workspace";return new nt({id:`hlix-project:${t.projectId}`,name:"Hlix Coding Workspace",filesystem:new de(e,{root:s}),sandbox:new ue(e,{projectId:t.projectId,root:s})})}function pt(e,t){if(C.includes(e))return e;throw new w("invalid_usage",`${t==="flag"?"--sandbox":"sandbox in .hlix/config.json"} must be one of ${C.join(", ")}; got "${e}".`)}function pe(e){if(e.flag){let t=e.flagSource??"flag";return{choice:pt(e.flag,t),reason:t==="flag"?`--sandbox ${e.flag}`:"config"}}if(e.projectId)return{choice:"cloud",reason:`project ${e.projectId}`};if(e.dockerAvailable())return{choice:"docker",reason:"auto"};return{choice:"local",reason:"auto"}}var he=(e)=>`sandbox: ${e.choice} (${e.reason})`;function ge(e=3000){try{return lt("docker",["info"],{timeout:e,stdio:"ignore"}),!0}catch{return!1}}function H(e,t){if(e.choice==="local")return;if(e.choice==="cloud"){if(!t.remote||!t.projectId)throw new w("invalid_usage","The cloud sandbox needs a hlix project. Run `hlix init`, pass --project <id>, or choose --sandbox docker|local.");return me(t.remote,{projectId:t.projectId})}let s="/workspace";return new mt({id:"hlix-code-docker",name:"Hlix Code (Docker)",filesystem:new ut({basePath:t.cwd}),...t.skills&&t.skills.length>0?{skills:t.skills}:{},sandbox:new dt({id:"hlix-code",volumes:{[t.cwd]:s},workingDirectory:s})})}var It=["You are running inside Hlix Code, the terminal harness for the hlix control plane.","Every `hlix` CLI command is available to you as a tool named `hlix_<command>`,","with spaces replaced by underscores — `hlix_status`, `hlix_tasks_list`, `hlix_push`.","Use those tools instead of running `hlix` through the shell: they resolve the","folder's workspace binding and credential the same way the CLI does, and they","return the CLI's machine-readable output.","Report a non-zero exit code and its stderr to the user verbatim. Never invent a","project, task or workspace id — read one with a tool first.","","This project's secrets live in the hlix secrets store, not in a file in this","folder: `hlix_secrets_list` shows them keyed by (key, source file) with every","value masked, and `hlix_secrets_set` changes one. When the user asks for a",'local env file, call `hlix_secrets_export` with `{ flags: { out: ".env" } }` —',"it writes the rendered file at mode 0600 and refuses a path git tracks. Do not","repeat an exported secret value back into the conversation."].join(`
10
+ `);function Pt(e){if(!e||e.entries.length===0)return"";let t=e.entries.length,s=new Set(e.entries.map((r)=>r.source)).size;return`secrets: ${t} ${t===1?"entry":"entries"} (${s} ${s===1?"source":"sources"})`}async function _t(e,t){try{return await h(process.env,{cwd:e,flags:{}}).secrets.listEntries(t)}catch{return null}}function Rt(e){let{values:t}=xt({args:e,allowPositionals:!0,strict:!1,options:{local:{type:"boolean"},sandbox:{type:"string"},harness:{type:"string"},project:{type:"string"},cwd:{type:"string"}}}),s=typeof t.sandbox==="string"?t.sandbox:t.local===!0?"local":void 0;return{...s?{sandbox:s,sandboxSource:"flag"}:{},...typeof t.harness==="string"?{harness:t.harness}:{},...typeof t.project==="string"?{project:t.project}:{},cwd:ft(typeof t.cwd==="string"?t.cwd:".")}}function At(e){let t=Object.keys(x),r=e.sandbox==="cloud"?t:t.filter((a)=>e.installed(a)),o=["hlix",...r],n=t.filter((a)=>!r.includes(a)),i=e.requested.harness;if(i==="hlix"||r.includes(i))return{harness:e.requested,available:o,unavailable:n,refusal:null,warning:null};let c=S(x[i]);if(e.requested.source==="flag")return{harness:e.requested,available:o,unavailable:n,refusal:c,warning:null};return{harness:{harness:"hlix",source:"default"},available:o,unavailable:n,refusal:null,warning:`${c} Falling back to harness hlix.`}}async function Mt(e,t){try{let r=await h(process.env,{cwd:e,flags:{}}).modelConfig.resolvedProjectHarness(t);return{harness:r.harness,source:r.source}}catch{return null}}function $t(e,t){let s=t.skills&&t.skills.length>0?{skills:t.skills}:{};if(e.choice!=="cloud")return H(e,{cwd:t.cwd,...s});if(!t.projectId)throw new w("invalid_usage","The cloud sandbox needs a hlix project. Run `hlix init`, pass --project <id>, or choose --sandbox docker|local.");let o=h(process.env,{cwd:t.cwd,flags:{}}).projects.workspace(t.projectId);return H(e,{cwd:t.cwd,projectId:t.projectId,remote:o})}var j=".hlix";function Ot(e){return e.skills.filter((t)=>!t.harnessReads).map((t)=>t.path)}function Tt(e,t){return e.skills.filter((s)=>s.scope==="project").map((s)=>gt(t,s.path)).filter((s)=>s!==""&&!s.startsWith(".."))}function Nt(e,t){if(e.length===0)return;let s={explore:"fast",plan:"plan",execute:"build"},r=t.find((a)=>a.metadata?.default===!0)?.id??t.find((a)=>a.id==="build")?.id??t[0]?.id,o=(a)=>t.find((d)=>d.id===s[a])?.defaultModelId??t.find((d)=>d.id===r)?.defaultModelId,n=[kt,vt,bt].map((a)=>{let d=o(a.id);return{...a,...d?{defaultModelId:d}:{}}}),i=new Set(n.map((a)=>a.id)),c=e.filter((a)=>!i.has(a.name)).map((a)=>{let d=a.model??o("execute");return{id:a.name,name:a.name,description:a.description||`Project subagent from ${a.path}`,instructions:a.instructions,...a.tools?{allowedControllerTools:a.tools}:{},...d?{defaultModelId:d}:{}}});return[...n,...c]}async function Et(e,t,s){if(St(t)){let r=Ct(t),n=await Ht({controller:e.controller,session:e.session,prompt:r.prompt??"",...r.model?{model:r.model}:{},...r.maxTurns?{maxTurns:r.maxTurns}:{}}).result;if(process.stdout.write(`${n.text}
11
+ `),n.error)process.stderr.write(`${n.error.message}
12
+ `);return n.exitCode}return await new jt({controller:e.controller,session:e.session,...e.hookManager?{hookManager:e.hookManager}:{},...e.mcpManager?{mcpManager:e.mcpManager}:{},...e.pluginManager?{pluginManager:e.pluginManager}:{},...e.knowledgeInspector?{knowledgeInspector:e.knowledgeInspector}:{},authStorage:e.authStorage,storageMaintenance:e.storageMaintenance,appName:"Hlix Code",version:s}).run(),0}async function Bs(e,t={boot:wt,present:Et}){let s=Rt(e),r=fe(s.cwd,process.env),o=s.project??r.merged.projectId,n=we(s.cwd,xe(process.env),{configDir:j}),i,c,a;try{if(c=pe({flag:s.sandbox??r.merged.sandbox,flagSource:s.sandbox?"flag":"config",projectId:o,dockerAvailable:()=>ge()}),a=At({requested:J({...s.harness?{flag:s.harness}:{},...r.merged.harness?{configured:r.merged.harness}:{},...r.sources.harness?{configSource:r.sources.harness}:{}}),sandbox:c.choice,installed:(l)=>X(x[l].command)}),a.refusal)throw new w("invalid_usage",a.refusal);i=$t(c,{cwd:s.cwd,projectId:o,...c.choice==="docker"?{skills:Tt(n,s.cwd)}:{}})}catch(l){return process.stderr.write(`error: ${l instanceof Error?l.message:String(l)}
13
+ `),2}if(a.warning)process.stderr.write(`warning: ${a.warning}
14
+ `);if(c.choice==="cloud"){let l=o?await Mt(s.cwd,o):null;if(l&&s.harness&&s.harness!==l.harness)process.stderr.write(`warning: this project runs ${l.harness}. Run \`/harness ${s.harness}\` to make ${s.harness} the project's setting.
15
+ `);a={...a,harness:l??{harness:"unknown",source:o?"the project's setting could not be read":"no project bound"}}}let d=ae({wired:oe({cwd:s.cwd,env:process.env}),...r.merged.model?{configured:r.merged.model}:{},...r.sources.model?{configuredSource:r.sources.model}:{}}),I=he(c);process.stdout.write(`${ie(V(I,a.harness),d)}
16
+ `);let P=ke(n);if(P)process.stdout.write(`${P}
17
+ `);let _=o?Pt(await _t(s.cwd,o)):"";if(_)process.stdout.write(`${_}
18
+ `);q(s.cwd);let R=null,ve=a.harness.harness==="unknown"?"hlix":a.harness.harness,A=G({sandbox:c.choice,cwd:s.cwd,active:ve,unavailable:a.unavailable,...i?{workspace:i}:{},...d?{model:d.id}:{}}),Se=new Set(Object.keys(yt(s.cwd,j).mcpServers??{})),M=Object.fromEntries(n.mcpServers.filter((l)=>!Se.has(l.name)).map((l)=>[l.name,l.config])),O=ye(n.generatedCommands,s.cwd),T=[...n.commands.map((l)=>l.path),...O?[O]:[]],N=Ot(n),E=ne(A,d?.id),F=Nt(n.subagents,E),W=be(n.instructions,s.cwd),{version:Ce}=await import("./package-w9c40vfc.js"),L=await t.boot({configDir:j,cwd:s.cwd,hostInstructions:[It,...c.choice==="cloud"?[Y(a.harness.harness)]:[],...W?[W]:[]].join(`
19
+
20
+ `),...Object.keys(M).length>0?{mcpServers:M}:{},...F?{subagents:F}:{},...T.length>0||N.length>0?{initialState:{pluginCommandPaths:T,pluginSkillPaths:N}}:{},extraTools:{...B({cwd:s.cwd}),hlix_tasks_follow:Z({cwd:s.cwd}),hlix_harness:Q({sandbox:c.choice,sandboxLine:I,available:a.available,modesBuilt:A.length>0,session:()=>R,...o?{setProjectHarness:async(l)=>{await h(process.env,{cwd:s.cwd,flags:{}}).modelConfig.setProjectHarness(o,l)}}:{}})},modes:E,...i?{workspace:i}:{}});return R=L.session,t.present(L,e,Ce)}export{Ot as extraSkillPaths,Rt as parseHlixCodeArgs,At as planHarness,Bs as runHlixCode,Pt as secretsStatusLine,Nt as standardsSubagents,Tt as workspaceSkillPaths};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import"./index-syeavftx.js";var s="@hlix/cli",i="0.4.0",n="SEE LICENSE IN LICENSE",a="Hlix Code and the hlix control-plane CLI.",r=["hlix","cli","agents"],d="https://hlix.ai",p="module",c="./dist/index.js",o={hlix:"./dist/index.js"},l=["dist","skills","LICENSE","THIRD_PARTY_NOTICES"],u={node:">=22.19.0"},b={access:"public"},h={build:"rm -rf dist && bun build src/index.ts --outdir dist --target node --format esm --splitting --packages external --minify --banner '#!/usr/bin/env node'",test:'bun test --isolate src --path-ignore-patterns "**/*.integration.test.ts" --timeout 20000',typecheck:"tsc --noEmit",prepublishOnly:"bun run typecheck && bun run build && bun run test","test:integration":"NODE_ENV=test bun run ../../apps/backend/scripts/with-aimock.ts -- bun run ../../apps/backend/scripts/with-test-db.ts -- bun test --isolate --preload ../../apps/backend/test/helpers/pool-lifecycle.ts --timeout 60000 .integration.test.ts"},m={"@mastra/acp":"^0.4.1","@mastra/code-sdk":"1.7.0","@mastra/core":"^1.65.0","@mastra/docker":"^0.7.0",ignore:"7.0.8",mastracode:"0.39.0","openapi-fetch":"^0.17.0",zod:"4.5.4"},g={"@hlix/sdk":"^0.2.0","@types/bun":"latest",typescript:"^7.0.2"},k={name:s,version:i,license:n,description:a,keywords:r,homepage:d,type:p,main:c,bin:o,files:l,engines:u,publishConfig:b,scripts:h,dependencies:m,devDependencies:g};export{o as bin,k as default,m as dependencies,a as description,g as devDependencies,u as engines,l as files,d as homepage,r as keywords,n as license,c as main,s as name,b as publishConfig,h as scripts,p as type,i as version};
package/package.json CHANGED
@@ -1,22 +1,14 @@
1
1
  {
2
2
  "name": "@hlix/cli",
3
- "version": "0.2.0",
4
- "license": "Apache-2.0",
5
- "description": "Command-line interface for the hlix control plane, built on @hlix/sdk.",
3
+ "version": "0.4.0",
4
+ "license": "SEE LICENSE IN LICENSE",
5
+ "description": "Hlix Code and the hlix control-plane CLI.",
6
6
  "keywords": [
7
7
  "hlix",
8
8
  "cli",
9
9
  "agents"
10
10
  ],
11
- "homepage": "https://github.com/hlix-ai/hlix#readme",
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/hlix-ai/hlix.git",
15
- "directory": "packages/cli"
16
- },
17
- "bugs": {
18
- "url": "https://github.com/hlix-ai/hlix/issues"
19
- },
11
+ "homepage": "https://hlix.ai",
20
12
  "type": "module",
21
13
  "main": "./dist/index.js",
22
14
  "bin": {
@@ -25,25 +17,35 @@
25
17
  "files": [
26
18
  "dist",
27
19
  "skills",
20
+ "LICENSE",
28
21
  "THIRD_PARTY_NOTICES"
29
22
  ],
30
23
  "engines": {
31
- "node": ">=20"
24
+ "node": ">=22.19.0"
32
25
  },
33
26
  "publishConfig": {
34
27
  "access": "public"
35
28
  },
36
29
  "scripts": {
37
- "build": "tsup",
38
- "test": "bun test --isolate --timeout 20000",
30
+ "build": "rm -rf dist && bun build src/index.ts --outdir dist --target node --format esm --splitting --packages external --minify --banner '#!/usr/bin/env node'",
31
+ "test": "bun test --isolate src --path-ignore-patterns \"**/*.integration.test.ts\" --timeout 20000",
39
32
  "typecheck": "tsc --noEmit",
40
- "prepublishOnly": "bun run typecheck && bun run build && bun test src/boundary.test.ts src/skill.test.ts src/binary.test.ts src/readme.test.ts"
33
+ "prepublishOnly": "bun run typecheck && bun run build && bun run test",
34
+ "test:integration": "NODE_ENV=test bun run ../../apps/backend/scripts/with-aimock.ts -- bun run ../../apps/backend/scripts/with-test-db.ts -- bun test --isolate --preload ../../apps/backend/test/helpers/pool-lifecycle.ts --timeout 60000 .integration.test.ts"
35
+ },
36
+ "dependencies": {
37
+ "@mastra/acp": "^0.4.1",
38
+ "@mastra/code-sdk": "1.7.0",
39
+ "@mastra/core": "^1.65.0",
40
+ "@mastra/docker": "^0.7.0",
41
+ "ignore": "7.0.8",
42
+ "mastracode": "0.39.0",
43
+ "openapi-fetch": "^0.17.0",
44
+ "zod": "4.5.4"
41
45
  },
42
46
  "devDependencies": {
43
47
  "@hlix/sdk": "^0.2.0",
44
- "ignore": "7.0.5",
45
- "tsup": "^8.5.0",
46
- "typescript": "^5.7.2",
47
- "@types/bun": "latest"
48
+ "@types/bun": "latest",
49
+ "typescript": "^7.0.2"
48
50
  }
49
51
  }
@@ -59,19 +59,115 @@ to a second workspace from inside a bound folder still works.
59
59
  binding lookup. `hlix status` prints the resolved answer and the source that
60
60
  decided it.
61
61
 
62
+ ## Settings
63
+
64
+ ```bash
65
+ hlix config list [--json] # every setting in effect, and which file set it
66
+ hlix config get <harness|model|sandbox> [--json]
67
+ hlix config set <harness|model|sandbox> <value> [--global] [--json]
68
+ ```
69
+
70
+ Two files, one shape, and the folder wins per key: the machine-wide
71
+ `~/.hlix/config.json` and this folder's `.hlix/config.json`. `config list`
72
+ names the source of every value — `project`, `global`, or `default` when no
73
+ file sets it — and where it applies. The stored credential stays at
74
+ `~/.config/hlix/credentials.json` and is not part of this cascade.
75
+
76
+ `harness` names the coder Hlix Code runs (`hlix`, `claude-code`, `codex`,
77
+ `cursor-agent`) and applies to the `local` and `docker` sandboxes only — a
78
+ cloud project's coder is the project's own harness setting on the server.
79
+ `model` is the model the hlix agent starts on; `sandbox` is where its files and
80
+ shell live (`cloud`, `docker`, `local`). `config set` writes this folder unless
81
+ `--global` is given, and leaves every other key in the file untouched. It
82
+ refuses `projectId`, `workspaceId` and `apiUrl` — those bind a folder to a
83
+ tenant and are written by `init` and `import`.
84
+
85
+ ## Project secrets
86
+
87
+ ```bash
88
+ hlix secrets list [--project <id>] [--json]
89
+ hlix secrets set <KEY> [value] [--from-stdin] [--source <file>] [--project <id>] [--json]
90
+ hlix secrets delete <KEY> [--source <file>] [--project <id>] [--json]
91
+ hlix secrets import [file...] [--project <id>] [--json]
92
+ hlix secrets export [--source <file>] [--format <id>] [--out <path>] [--project <id>] [--json]
93
+ ```
94
+
95
+ The store is the source of truth for a project's environment; files are
96
+ exports. Every value is keyed by `(key, source file)`, so `.env`,
97
+ `apps/api/.env.local` and `infra/terraform.tfvars` stay three files instead of
98
+ collapsing into one bag of variables. These commands act on the project this
99
+ folder is bound to unless `--project` names another one.
100
+
101
+ `secrets list` masks every value to its last four characters and **no flag
102
+ unmasks it**. Its `warnings` name files whose export is a normalized rebuild
103
+ (comments and untracked neighbouring settings are not reproduced).
104
+
105
+ `secrets set` takes the value as an argument or, better, from stdin:
106
+ `--from-stdin` keeps a real credential out of shell history and out of `ps`,
107
+ and strips exactly one trailing newline. `--source` names the file the value
108
+ belongs to; omitted, it is the project root `.env`.
109
+
110
+ `secrets delete` without `--source` removes the key from every file that
111
+ declares it. Removing nothing exits 1.
112
+
113
+ `secrets import` loads the local files into the store, detected by the same
114
+ scanner `hlix import` uses. It reads the grammars this CLI owns — dotenv and
115
+ literal `.envrc` assignments — and lists every other detected secret file as
116
+ **skipped**, because the store's write API takes parsed values rather than file
117
+ bytes. Those arrive through `hlix import` / `hlix push`, which ship the file
118
+ itself for the backend to parse: Terraform, .NET appsettings, Java properties,
119
+ Spring YAML, Azure Functions local settings, wrangler, fly, serverless, Rails
120
+ `config/database.yml`, and the opaque credentials.
121
+
122
+ `secrets export` is the one command that returns secret **values**, and the
123
+ server audits every call. Without `--out` it writes the rendered file to
124
+ stdout; with `--out` it writes it at mode 0600 and **refuses a path git
125
+ tracks**, because an exported file is plaintext and must not become a commit.
126
+ `--format` re-renders a source as another shape; omitted, it keeps the shape
127
+ the values were parsed as.
128
+
129
+ Secrets are agency-only on every route. A client collaborator gets `forbidden`.
130
+
131
+ ## Dispatching work
132
+
133
+ ```bash
134
+ hlix cycles create <project-id> --title <t> --description <d> [--json]
135
+ hlix tasks create <project-id> --description <d> [--title <t>] [--json]
136
+ hlix harness get [project-id] [--json]
137
+ hlix harness set <hlix|claude-code|codex|cursor-agent> [project-id] [--org] [--json]
138
+ ```
139
+
140
+ `cycles create` is the command that STARTS work. The proposal enters the
141
+ project's own loop, which plans the cycle, creates its tasks and starts the
142
+ coders. `adopted` is true when the loop took it on this call and false when it
143
+ was recorded for the next pass; neither is an error. It returns no cycle id —
144
+ the roadmap owns cycles — so find the resulting tasks with `hlix tasks list
145
+ --project <id>`.
146
+
147
+ `tasks create` adds a board row and does NOT start it. Standalone task
148
+ execution is not implemented server-side and answers `501` by design, so there
149
+ is no flag here that would call it.
150
+
151
+ `harness get`/`harness set` are the coder the PLATFORM runs, stored on the
152
+ server and audited: a project preference with a project id, the workspace-wide
153
+ one with `--org`. That is a different setting from the local `harness` config
154
+ key, which only picks the coder Hlix Code spawns on this machine.
155
+
62
156
  ## Commands
63
157
 
64
158
  ```bash
65
159
  hlix status [--json] # workspace, binding, local and cloud drift
160
+ hlix standards [--json] # instruction files, skills, commands, MCP servers and subagents other agent tools left in this folder
66
161
  hlix projects list [--json] # projects in the workspace
67
162
  hlix projects get [project-id] [--json]
68
- hlix init [folder] [--json] # create committed project configuration
163
+ hlix init [folder] [--project <id>] [--json] # create committed project configuration; --project binds an existing cloud project
164
+ hlix terminal [project-id] [--print] [--web] [--json] # shell into the project's Coding Workspace (ssh here, or the browser terminal)
69
165
  hlix import [folder] [--dry-run] [--env-file <path>] [--history preserve] [--yes] [--json]
70
166
  hlix sync [--dry-run] [--json] # push or pull when only one side changed
71
167
  hlix pull [--force] [--yes] [--dry-run] [--json]
72
168
  hlix push [--dry-run] [--json] # compare-and-swap a new immutable revision
73
169
  hlix skill import <SKILL.md|folder> [--name <slug>] [--json]
74
- hlix agent import <markdown-file> [--name <name>] [--runtime <runtime>] [--profile <profile>] [--json]
170
+ hlix agent import <markdown-file> [--name <name>] [--runtime <runtime>] [--duty <duty>] [--json]
75
171
  hlix mcp import <.mcp.json> [--server <name>] [--allow-stdio] [--json]
76
172
  hlix tasks list [--project <id>] [--status <status>] [--json]
77
173
  hlix tasks get <task-id> [--json] # one task
@@ -187,8 +283,10 @@ document. Read it line by line.
187
283
 
188
284
  ## Not available
189
285
 
190
- - **No execution commands.** There is deliberately no way to start a run,
191
- execute a cycle or dispatch a task from this CLI.
286
+ - **No execution commands** beyond `cycles create`. Starting a single task is
287
+ not offered because the API does not implement it: `POST
288
+ /v1/api/tasks/{id}/execute` publishes no success response and answers `501`
289
+ by design. Work is dispatched by its cycle.
192
290
  - **No `tasks logs`.** The log endpoint is not part of the published API
193
291
  contract, and there is no log stream to follow. `tasks watch` streams task
194
292
  *status*, which is a different thing and is named accordingly.
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env node
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
-
28
- export {
29
- __commonJS,
30
- __toESM
31
- };
@@ -1,88 +0,0 @@
1
- #!/usr/bin/env node
2
- import "./chunk-FYS2JH42.js";
3
-
4
- // package.json
5
- var name = "@hlix/cli";
6
- var version = "0.2.0";
7
- var license = "Apache-2.0";
8
- var description = "Command-line interface for the hlix control plane, built on @hlix/sdk.";
9
- var keywords = [
10
- "hlix",
11
- "cli",
12
- "agents"
13
- ];
14
- var homepage = "https://github.com/hlix-ai/hlix#readme";
15
- var repository = {
16
- type: "git",
17
- url: "git+https://github.com/hlix-ai/hlix.git",
18
- directory: "packages/cli"
19
- };
20
- var bugs = {
21
- url: "https://github.com/hlix-ai/hlix/issues"
22
- };
23
- var type = "module";
24
- var main = "./dist/index.js";
25
- var bin = {
26
- hlix: "./dist/index.js"
27
- };
28
- var files = [
29
- "dist",
30
- "skills",
31
- "THIRD_PARTY_NOTICES"
32
- ];
33
- var engines = {
34
- node: ">=20"
35
- };
36
- var publishConfig = {
37
- access: "public"
38
- };
39
- var scripts = {
40
- build: "tsup",
41
- test: "bun test --isolate --timeout 20000",
42
- typecheck: "tsc --noEmit",
43
- prepublishOnly: "bun run typecheck && bun run build && bun test src/boundary.test.ts src/skill.test.ts src/binary.test.ts src/readme.test.ts"
44
- };
45
- var devDependencies = {
46
- "@hlix/sdk": "^0.2.0",
47
- ignore: "7.0.5",
48
- tsup: "^8.5.0",
49
- typescript: "^5.7.2",
50
- "@types/bun": "latest"
51
- };
52
- var package_default = {
53
- name,
54
- version,
55
- license,
56
- description,
57
- keywords,
58
- homepage,
59
- repository,
60
- bugs,
61
- type,
62
- main,
63
- bin,
64
- files,
65
- engines,
66
- publishConfig,
67
- scripts,
68
- devDependencies
69
- };
70
- export {
71
- bin,
72
- bugs,
73
- package_default as default,
74
- description,
75
- devDependencies,
76
- engines,
77
- files,
78
- homepage,
79
- keywords,
80
- license,
81
- main,
82
- name,
83
- publishConfig,
84
- repository,
85
- scripts,
86
- type,
87
- version
88
- };