toolnet-memory 0.3.9 → 0.3.11
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 +8 -1
- package/bin/toolnet-memory +53 -0
- package/bundle/auto-integrate.js +113 -28
- package/bundle/continuity-certify.js +1 -1
- package/bundle/copilot-hook.js +208 -0
- package/bundle/copilot.js +29 -0
- package/bundle/cursor-hook.js +206 -0
- package/bundle/cursor.js +30 -0
- package/bundle/grok-hook.js +114 -0
- package/bundle/grok.js +32 -0
- package/bundle/help-cli.js +4 -4
- package/bundle/init.js +118 -33
- package/bundle/integration-status.js +55 -0
- package/bundle/kiro-hook.js +1 -1
- package/bundle/production-certify.js +5 -5
- package/bundle/setup.js +116 -31
- package/bundle/status-cli.js +4 -4
- package/bundle/update.js +5 -4
- package/package.json +26 -3
package/bundle/grok.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import{homedir as bo}from"node:os";import{join as f,resolve as jo}from"node:path";function T(o={}){return o.grokHome??process.env.GROK_HOME??f(o.home??bo(),".grok")}function m(o={}){return f(T(o),"config.toml")}function So(o={}){return f(T(o),"hooks")}function h(o={}){return f(So(o),"toolnet-memory.json")}function vo(o={}){return f(T(o),"skills")}function Fo(o={}){return f(vo(o),"toolnet-continuity")}function y(o={}){return f(Fo(o),"SKILL.md")}function M(o){return f(jo(o),".grok")}function P(o){return f(M(o),"config.toml")}function Io(o){return f(M(o),"hooks")}function x(o){return f(Io(o),"toolnet-memory.json")}function wo(o){return f(M(o),"skills")}function Co(o){return f(wo(o),"toolnet-continuity")}function O(o){return f(Co(o),"SKILL.md")}import{existsSync as Po,mkdirSync as xo,readFileSync as Y,renameSync as Oo,rmSync as Ro,writeFileSync as Go}from"node:fs";import{dirname as Ho}from"node:path";var N=`---
|
|
2
|
+
name: toolnet-continuity
|
|
3
|
+
description: Restore previous ToolNet project work when the user asks to continue, resume, pick up, finish unfinished work, or asks where work stopped.
|
|
4
|
+
when-to-use: continue, resume, pick up, carry on, ti\u1EBFp t\u1EE5c, l\xE0m ti\u1EBFp, l\xE0m n\u1ED1t, \u0111ang l\xE0m \u0111\u1EBFn \u0111\xE2u, d\u1EEBng \u1EDF \u0111\xE2u
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# ToolNet Continuity
|
|
8
|
+
|
|
9
|
+
When the user asks to continue or resume previous work:
|
|
10
|
+
|
|
11
|
+
1. Use the ToolNet Memory MCP server as the continuity source.
|
|
12
|
+
2. Invoke \`memory_agent_ask\` before exploring old history if the current
|
|
13
|
+
ToolNet handoff is missing, stale, or ambiguous.
|
|
14
|
+
3. Prefer \`mode="local"\` for current task, last file, blocker, completed
|
|
15
|
+
work, TODOs, and next action.
|
|
16
|
+
4. Use \`mode="ai"\` only when continuity requires synthesis.
|
|
17
|
+
5. Do not reconstruct previous work from:
|
|
18
|
+
- \`.toolnet/sessions/**\`
|
|
19
|
+
- ToolNet \`events.jsonl\` or \`state.json\`
|
|
20
|
+
- raw transcripts
|
|
21
|
+
- another coding agent's private session/history files
|
|
22
|
+
6. After ToolNet continuity is known, verify current git and repository
|
|
23
|
+
source truth before changing code.
|
|
24
|
+
7. Do not ask the user to repeat context ToolNet already provides.
|
|
25
|
+
|
|
26
|
+
Current repository evidence overrides stale memory.
|
|
27
|
+
`;function Ao(o,e){xo(Ho(o),{recursive:!0,mode:448});let t=`${o}.toolnet-${process.pid}-${Date.now()}.tmp`;try{Go(t,e,{encoding:"utf8",mode:384}),Oo(t,o)}finally{Ro(t,{force:!0})}}function D(o={}){let e=o.skillFile??y();if(Po(e)&&Y(e,"utf8")===N)return{skillFile:e,changed:!1};if(Ao(e,N),Y(e,"utf8")!==N)throw new Error("Grok ToolNet continuity skill was written but verification failed.");return{skillFile:e,changed:!0}}import{existsSync as Eo,mkdirSync as $o,readFileSync as To,renameSync as Mo,rmSync as No,writeFileSync as Do}from"node:fs";import{dirname as _o}from"node:path";function j(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}function _(o,e){if(!Eo(o))return{};let t=To(o,"utf8").trim();if(!t)return{};let r;try{r=JSON.parse(t)}catch(n){throw new Error(`Invalid existing ${e} hooks file: ${n instanceof Error?n.message:String(n)}`)}if(!j(r))throw new Error(`Invalid existing ${e} hooks file: root must be a JSON object.`);return r}function Q(o,e){$o(_o(o),{recursive:!0,mode:448});let t=`${o}.toolnet-${process.pid}-${Date.now()}.tmp`;try{Do(t,`${JSON.stringify(e,null,2)}
|
|
28
|
+
`,{encoding:"utf8",mode:384}),Mo(t,o)}finally{No(t,{force:!0})}}var w=[["SessionStart",10],["UserPromptSubmit",10],["PreToolUse",10],["PostToolUse",15],["Stop",30]];function Z(o){return!j(o)||!Array.isArray(o.hooks)?!1:o.hooks.some(e=>j(e)&&typeof e.command=="string"&&e.command.includes("session:grok-hook"))}function Jo(o,e,t){let r={hooks:[{type:"command",command:`${e} session:grok-hook`,timeout:t,env:{TOOLNET_HOOK_EVENT:o}}]};return o==="PreToolUse"&&(r.matcher=".*"),r}function J(o={}){let e=o.hooksFile??h(),t=o.binary??process.env.TOOLNET_MEMORY_BIN??"toolnet-memory",r=_(e,"Grok Build"),n=r.hooks;if(n!==void 0&&!j(n))throw new Error("Invalid existing Grok Build hooks file: hooks must be an object.");let i=j(n)?{...n}:{};for(let[l,c]of w){let g=i[l];if(g!==void 0&&!Array.isArray(g))throw new Error(`Invalid existing Grok Build hooks file: hooks.${l} must be an array.`);let p=Array.isArray(g)?g.filter(d=>!Z(d)):[];i[l]=[...p,Jo(l,t,c)]}let s={...r,hooks:i};if(JSON.stringify(r)===JSON.stringify(s))return{hooksFile:e,changed:!1,hookCount:w.length};Q(e,s);let a=_(e,"Grok Build");if(!j(a.hooks))throw new Error("Grok Build hooks were written but verification failed.");let u=0;for(let[l]of w){let c=a.hooks[l];if(!Array.isArray(c))throw new Error("Grok Build hooks were written but verification failed.");u+=c.filter(Z).length}if(u!==w.length)throw new Error("Grok Build hooks were written but verification failed.");return{hooksFile:e,changed:!0,hookCount:w.length}}import{existsSync as qo,mkdirSync as Bo,readFileSync as Uo,renameSync as Lo,rmSync as Ko,writeFileSync as Wo}from"node:fs";import{dirname as zo}from"node:path";function oo(o){return qo(o)?Uo(o,"utf8"):""}function Vo(o,e){Bo(zo(o),{recursive:!0,mode:448});let t=`${o}.tmp-${process.pid}-${Date.now()}`;try{Wo(t,e,{encoding:"utf8",mode:384}),Lo(t,o)}finally{Ko(t,{force:!0})}}function q(o){return o.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function Xo(o){return`[mcp_servers."${q(o)}"]`}function Yo(o,e){return[Xo(o),`command = "${q(e)}"`,'args = ["mcp"]',"enabled = true"].join(`
|
|
29
|
+
`)}function Qo(o){let e=o.trim();return e.startsWith("[")&&e.includes("]")}function R(o){return o.trim().replace(/\s+/g,"")}function Zo(o){return new Set([R(`[mcp_servers.${o}]`),R(`[mcp_servers."${o}"]`),R(`[mcp_servers.'${o}']`)])}function to(o,e){let t=o.split(/\r?\n/),r=Zo(e),n=-1;for(let c=0;c<t.length;c+=1){let g=R(t[c].replace(/\s+#.*$/,""));if(r.has(g)){n=c;break}}if(n<0)return null;let i=t.length;for(let c=n+1;c<t.length;c+=1)if(Qo(t[c])){i=c;break}let s=[],a=0;for(let c of t)s.push(a),a+=c.length+1;let u=s[n]??0,l=i>=t.length?o.length:s[i]??o.length;return{start:u,end:l}}function oe(o,e,t){let r=`${Yo(e,t)}
|
|
30
|
+
`,n=to(o,e);if(n){let i=o.slice(0,n.start),s=o.slice(n.end);return`${i}${r}${s.replace(/^\n+/,"")}`}return o.trim()?`${o.replace(/\s*$/,"")}
|
|
31
|
+
|
|
32
|
+
${r}`:r}function eo(o,e,t){let r=to(o,e);if(!r)return!1;let n=o.slice(r.start,r.end);return n.includes(`command = "${q(t)}"`)&&/args\s*=\s*\[\s*"mcp"\s*\]/.test(n)&&/enabled\s*=\s*true/.test(n)}function B(o={}){let e=o.configFile??m(),t=o.binary??process.env.TOOLNET_MEMORY_BIN??"toolnet-memory",r=o.serverName??"toolnet-memory",n=oo(e);if(eo(n,r,t))return{installed:!0,changed:!1,configFile:e,serverName:r,command:t,args:["mcp"]};let i=oe(n,r,t);Vo(e,i);let s=oo(e);if(!eo(s,r,t))throw new Error("Grok Build MCP configuration was written but verification failed.");return{installed:!0,changed:!0,configFile:e,serverName:r,command:t,args:["mcp"]}}import{spawnSync as ee}from"node:child_process";import{existsSync as S,statSync as te}from"node:fs";import{dirname as re,join as ne,parse as ie,resolve as L}from"node:path";function ro(o){let e=L(o);if(!S(e))throw new Error(`Project path does not exist: ${e}`);if(!te(e).isDirectory())throw new Error(`Project path is not a directory: ${e}`);return e}function G(o){return ne(o,".toolnet","project.json")}function se(o){let e=L(o),t=ie(e).root;for(;;){if(S(G(e)))return e;if(e===t)return;let r=re(e);if(r===e)return;e=r}}function U(o){let e=ee("git",["rev-parse","--show-toplevel"],{cwd:o,encoding:"utf8",timeout:5e3});if(e.status!==0)return;let t=e.stdout.trim();return t?L(t):void 0}function v(o={}){let e=ro(o.cwd??process.cwd());if(o.project){let n=ro(o.project),i=G(n),s=U(n);return{root:n,source:"explicit",eligible:!0,toolnetProject:S(i),manifestFile:S(i)?i:void 0,gitRoot:s}}let t=se(e);if(t){let n=G(t);return{root:t,source:"toolnet",eligible:!0,toolnetProject:!0,manifestFile:n,gitRoot:U(t)}}let r=U(e);if(r){let n=G(r);return{root:r,source:"git",eligible:!0,toolnetProject:S(n),manifestFile:S(n)?n:void 0,gitRoot:r}}return{root:e,source:"cwd",eligible:!1,toolnetProject:!1}}function lo(o,e={}){let t=[],r=o.indexOf("--scope");if(r>=0){let i=o[r+1];if(i!=="global"&&i!=="project"&&i!=="both")throw new Error(`Invalid --scope value: ${String(i)}`);t.push(i)}o.includes("--global")&&t.push("global"),o.includes("--both")&&t.push("both");let n=Array.from(new Set(t));if(n.length>1)throw new Error(`Conflicting integration scopes: ${n.join(", ")}`);return n[0]??e.defaultScope??"global"}function no(o,e){return{install:o,effective:e}}function k(o,e){return{surface:o,global:no(e.globalInstall,e.effective==="global"||e.effective==="both"),project:no(e.projectInstall,e.effective==="project"||e.effective==="both"),effective:e.effective,risk:e.risk??"none",dedupeRequired:e.dedupeRequired??!1,trustRequired:e.trustRequired??e.projectInstall,note:e.note}}function le(o){return{mcp:k("mcp",{globalInstall:!0,projectInstall:!1,effective:"global"}),hooks:k("hooks",{globalInstall:!0,projectInstall:!1,effective:"global"}),work:k("work",{globalInstall:o==="grok",projectInstall:!1,effective:o==="grok"?"global":"none",note:o==="grok"?"Grok supports a global ToolNet continuity skill.":"Cursor/Copilot work instructions remain project-scoped."})}}function io(o){return{mcp:k("mcp",{globalInstall:!1,projectInstall:!0,effective:"project",trustRequired:!0}),hooks:k("hooks",{globalInstall:!1,projectInstall:!0,effective:"project",trustRequired:!0}),work:k("work",{globalInstall:!1,projectInstall:!0,effective:"project",trustRequired:!1,note:o==="cursor"?"Use .cursor/rules/toolnet-memory.mdc.":o==="copilot"?"Use .github/instructions/toolnet-memory.instructions.md.":"Use .grok/skills/toolnet-continuity/SKILL.md."})}}function so(o){return{mcp:k("mcp",{globalInstall:!0,projectInstall:!0,effective:"project",risk:o==="cursor"?"precedence-unverified":"shadowed-global",trustRequired:!0,note:o==="cursor"?"Project ToolNet MCP is the intended effective definition; native same-name precedence must be E2E certified before release.":"Global remains useful outside the project; same-name project definition wins inside the project."}),hooks:k("hooks",{globalInstall:!0,projectInstall:!0,effective:"both",risk:"additive-duplicate",dedupeRequired:!0,trustRequired:!0,note:"Global and project hook sources can both execute for the same native event."}),work:k("work",{globalInstall:o==="grok",projectInstall:!0,effective:"project",risk:o==="grok"?"shadowed-global":"none",trustRequired:!1,note:o==="cursor"?"Project rule is authoritative.":o==="copilot"?"Project instruction is authoritative.":"Project skill shadows the same-name global skill inside the project."})}}function H(o){let{agent:e,scope:t,project:r}=o;return(t==="project"||t==="both")&&(!r||!r.eligible)?{agent:e,requestedScope:t,project:r,surfaces:t==="both"?so(e):io(e),canInstall:!1,reason:"Project scope requires an explicit project, existing ToolNet project, or Git repository root."}:{agent:e,requestedScope:t,project:r,surfaces:t==="global"?le(e):t==="project"?io(e):so(e),canInstall:!0}}function co(o){return!!(o?.mcp?.changed||o?.hooks?.changed||o?.skill?.changed)}function ao(o={}){let e=o.binary??process.env.TOOLNET_MEMORY_BIN??"toolnet-memory",t=o.scope??"global",r=t==="global"?void 0:v({project:o.projectRoot}),n=H({agent:"grok",scope:t,project:r});if(!n.canInstall)throw new Error(n.reason??"Grok project integration scope cannot be resolved.");let i,s;if((n.surfaces.mcp.global.install||n.surfaces.hooks.global.install||n.surfaces.work.global.install)&&(i={},n.surfaces.mcp.global.install&&(i.mcp=B({binary:e,configFile:o.configFile??m()})),n.surfaces.hooks.global.install&&(i.hooks=J({binary:e,hooksFile:o.hooksFile??h()})),n.surfaces.work.global.install&&(i.skill=D({skillFile:o.skillFile??y()}))),n.surfaces.mcp.project.install||n.surfaces.hooks.project.install||n.surfaces.work.project.install){if(!r?.eligible)throw new Error("Grok project integration requires an eligible project root.");s={},n.surfaces.mcp.project.install&&(s.mcp=B({binary:e,configFile:o.projectConfigFile??P(r.root)})),n.surfaces.hooks.project.install&&(s.hooks=J({binary:e,hooksFile:o.projectHooksFile??x(r.root)})),n.surfaces.work.project.install&&(s.skill=D({skillFile:o.projectSkillFile??O(r.root)}))}let a=s?.mcp??i?.mcp,u=s?.hooks??i?.hooks,l=s?.skill??i?.skill;if(!a||!u||!l)throw new Error("Grok integration did not produce effective MCP/hooks/skill.");let c=Array.from(new Set([i?.mcp?.configFile,i?.hooks?.hooksFile,i?.skill?.skillFile,s?.mcp?.configFile,s?.hooks?.hooksFile,s?.skill?.skillFile].filter(g=>typeof g=="string")));return{installed:!0,changed:co(i)||co(s),scope:t,plan:n,project:r,global:i,projectScope:s,mcp:a,hooks:u,skill:l,files:c}}import{existsSync as X}from"node:fs";import{existsSync as F,readFileSync as z}from"node:fs";import{homedir as ce}from"node:os";import{join as K,resolve as ot}from"node:path";function uo(o={}){return o.cursorHome??K(o.home??ce(),".cursor")}function go(o={}){return K(uo(o),"mcp.json")}function fo(o={}){return K(uo(o),"hooks.json")}import{homedir as ae}from"node:os";import{join as A,resolve as nt}from"node:path";function po(o={}){return o.copilotHome??process.env.COPILOT_HOME??A(o.home??ae(),".copilot")}function ko(o={}){return A(po(o),"mcp-config.json")}function ue(o={}){return A(po(o),"hooks")}function mo(o={}){return A(ue(o),"toolnet-memory.json")}function b(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}function C(o){if(!F(o))return{};try{let e=JSON.parse(z(o,"utf8"));return b(e)?{value:e}:{error:"root must be a JSON object"}}catch(e){return{error:e instanceof Error?e.message:String(e)}}}function ho(o,e){if(!o||!b(o.mcpServers))return!1;let t=o.mcpServers["toolnet-memory"];return!b(t)||typeof t.command!="string"||!t.command.trim()||!Array.isArray(t.args)||t.args.length!==1||t.args[0]!=="mcp"?!1:!e||Array.isArray(t.tools)&&t.tools.includes("*")}function yo(o,e,t){if(!o||!b(o.hooks))return[];let r=o.hooks;return e.filter(n=>{let i=r[n];return Array.isArray(i)&&i.some(s=>b(s)&&(typeof s.command=="string"&&s.command.includes(t)||typeof s.bash=="string"&&s.bash.includes(t)))})}function ge(o,e){if(!o||!b(o.hooks))return[];let t=o.hooks;return e.filter(r=>{let n=t[r];return Array.isArray(n)&&n.some(i=>!b(i)||!Array.isArray(i.hooks)?!1:i.hooks.some(s=>b(s)&&typeof s.command=="string"&&s.command.includes("session:grok-hook")))})}function fe(o){if(!F(o))return!1;let e=z(o,"utf8"),t=/\[mcp_servers\.(?:"toolnet-memory"|'toolnet-memory'|toolnet-memory)\]/,r=e.search(t);if(r<0)return!1;let n=e.slice(r),i=n.slice(1).search(/\n\s*\[[^\]]+\]/),s=i>=0?n.slice(0,i+1):n;return/command\s*=\s*"[^"]+"/.test(s)&&/args\s*=\s*\[\s*"mcp"\s*\]/.test(s)&&!/enabled\s*=\s*false/.test(s)}function W(o){let e=[];o.mcpError&&e.push(`MCP config: ${o.mcpError}`),o.hookError&&e.push(`Hooks config: ${o.hookError}`);let t=o.mcpConfigured&&o.hooksConfigured&&(o.skill?.configured??!0),r=F(o.configFile)||F(o.hooksFile)||(o.skill?F(o.skill.skillFile):!1),n=e.length>0?"invalid":t?"ready":r?"partial":"not-installed";return{installed:t,state:n,mcp:{configured:o.mcpConfigured,configFile:o.configFile,error:o.mcpError},hooks:{configured:o.hooksConfigured,hooksFile:o.hooksFile,events:o.events,error:o.hookError},skill:o.skill,errors:e}}function V(o,e={}){if(o==="cursor"){let l=["sessionStart","beforeSubmitPrompt","preToolUse","postToolUse","afterAgentResponse","stop"],c=e.configFile??go(),g=e.hooksFile??fo(),p=C(c),d=C(g),I=d.error?[]:yo(d.value,l,"session:cursor-hook");return W({mcpConfigured:!p.error&&ho(p.value,!1),configFile:c,mcpError:p.error,hooksConfigured:l.every($=>I.includes($)),hooksFile:g,events:I,hookError:d.error})}if(o==="copilot"){let l=["sessionStart","userPromptSubmitted","userPromptTransformed","preToolUse","postToolUse","agentStop"],c=e.configFile??ko(),g=e.hooksFile??mo(),p=C(c),d=C(g),I=d.error?[]:yo(d.value,l,"session:copilot-hook");return W({mcpConfigured:!p.error&&ho(p.value,!0),configFile:c,mcpError:p.error,hooksConfigured:l.every($=>I.includes($)),hooksFile:g,events:I,hookError:d.error})}let t=["SessionStart","UserPromptSubmit","PreToolUse","PostToolUse","Stop"],r=e.configFile??m(),n=e.hooksFile??h(),i=e.skillFile??y(),s=C(n),a=s.error?[]:ge(s.value,t),u=F(i)&&z(i,"utf8").includes("memory_agent_ask");return W({mcpConfigured:fe(r),configFile:r,hooksConfigured:t.every(l=>a.includes(l)),hooksFile:n,events:a,hookError:s.error,skill:{configured:u,skillFile:i}})}function pe(o,e){return e.some(r=>r?.state==="invalid")?"invalid":o?"ready":e.some(r=>r&&(r.state==="partial"||r.state==="ready"||X(r.mcp.configFile)||X(r.hooks.hooksFile)||!!(r.skill&&X(r.skill.skillFile))))?"partial":"not-installed"}function E(o={}){let e=o.scope??"global",t=e==="global"?void 0:v({project:o.projectRoot}),r=H({agent:"grok",scope:e,project:t}),n=e==="global"||e==="both"?V("grok",{configFile:o.globalConfigFile??m(),hooksFile:o.globalHooksFile??h(),skillFile:o.globalSkillFile??y()}):void 0,i=(e==="project"||e==="both")&&t?.eligible?V("grok",{configFile:o.projectConfigFile??P(t.root),hooksFile:o.projectHooksFile??x(t.root),skillFile:o.projectSkillFile??O(t.root)}):void 0,s=e==="project"?!0:n?.installed===!0,a=e==="global"?!0:i?.installed===!0,u=r.canInstall&&s&&a,l=[];return!r.canInstall&&r.reason&&l.push(r.reason),e==="both"&&(l.push("Global + project Grok hooks are layered; ToolNet cross-process dedupe is enabled."),l.push('Project [mcp_servers."toolnet-memory"] fully replaces the same-name global server inside this project.'),l.push("Project toolnet-continuity skill shadows the same-name global skill inside this project.")),{installed:u,state:pe(u,[n,i]),requestedScope:e,plan:r,project:t,global:n,projectScope:i,effective:{mcp:r.surfaces.mcp.effective==="project"?"project":r.surfaces.mcp.effective==="global"?"global":"none",hooks:r.surfaces.hooks.effective==="both"?"both":r.surfaces.hooks.effective==="project"?"project":r.surfaces.hooks.effective==="global"?"global":"none",skill:r.surfaces.work.effective==="project"?"project":r.surfaces.work.effective==="global"?"global":"none"},dedupeReady:!0,trustRequired:e==="project"||e==="both",warnings:l}}function de(o,e){let t=o.indexOf(e);return t>=0?o[t+1]:void 0}function ke(){let o=process.argv.slice(2);return o[0]==="install"?o.slice(1):o}function me(o,e){let t=E({scope:o,projectRoot:e});console.log("Grok Build Integration"),console.log("======================"),console.log(""),console.log(`State : ${t.state}`),console.log(`Scope : ${t.requestedScope}`),t.global&&(console.log(""),console.log("Global"),console.log(` MCP : ${t.global.mcp.configured?"ready":"missing"} \u2014 ${t.global.mcp.configFile}`),console.log(` Hooks : ${t.global.hooks.configured?"ready":"missing"} \u2014 ${t.global.hooks.hooksFile}`),console.log(` Skill : ${t.global.skill?.configured?"ready":"missing"} \u2014 ${t.global.skill?.skillFile??"-"}`)),t.projectScope&&(console.log(""),console.log("Project"),console.log(` Root : ${t.project?.root??"-"}`),console.log(` MCP : ${t.projectScope.mcp.configured?"ready":"missing"} \u2014 ${t.projectScope.mcp.configFile}`),console.log(` Hooks : ${t.projectScope.hooks.configured?"ready":"missing"} \u2014 ${t.projectScope.hooks.hooksFile}`),console.log(` Skill : ${t.projectScope.skill?.configured?"ready":"missing"} \u2014 ${t.projectScope.skill?.skillFile??"-"}`),console.log(` Trust : ${t.trustRequired?"required":"n/a"}`)),console.log(""),console.log(`Effective MCP : ${t.effective.mcp}`),console.log(`Effective Hooks : ${t.effective.hooks}`),console.log(`Effective Skill : ${t.effective.skill}`),console.log(`Dedupe : ${t.dedupeReady?"ready":"missing"}`);for(let r of t.warnings)console.log(`Note : ${r}`);console.log(""),t.installed||(process.exitCode=1)}function he(){let o=ke(),e=o.includes("--json"),t=o.includes("--status")||o[0]==="status",r=lo(o),n=de(o,"--project"),i=r==="global"?void 0:v({project:n});if(t){let u=E({scope:r,projectRoot:i?.root});if(e){console.log(JSON.stringify(u,null,2)),u.installed||(process.exitCode=1);return}me(r,i?.root);return}let s=ao({scope:r,projectRoot:i?.root}),a=E({scope:r,projectRoot:i?.root});if(!a.installed)throw new Error(`Grok Build integration installation did not verify successfully (state=${a.state}).`);if(e){console.log(JSON.stringify({installed:!0,changed:s.changed,scope:s.scope,files:s.files,status:a},null,2));return}console.log("\u2705 Grok Build integration installed"),console.log(`Scope: ${r}`);for(let u of s.files)console.log(`File: ${u}`);r==="both"&&(console.log("Hook dedupe: enabled"),console.log("Project MCP precedence: project fully replaces global same-name server"),console.log("Project skill precedence: project > global"),console.log("Project trust: required by Grok Build")),console.log("Server: toolnet-memory")}try{he()}catch(o){console.error(o instanceof Error?o.message:String(o)),process.exitCode=1}
|
package/bundle/help-cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{readFileSync as G}from"node:fs";import{dirname as D,resolve as E}from"node:path";import{fileURLToPath as j}from"node:url";var R={spinner:["\xB7","\u2722","\u2733","\u2736","\u273B","\u273D"],barFilled:"\u2588",barEmpty:"\u2591",phaseDone:"\u25C6",phaseActive:"\u25C7",rail:"\u2502",branch:"\u251C",corner:"\u2514",dash:"\u2014"},U={spinner:[".","*","+","x","*","+"],barFilled:"#",barEmpty:"-",phaseDone:"[OK]",phaseActive:"[>>]",rail:"|",branch:"|",corner:"\\",dash:"-"};function A(){if(process.env.TOOLNET_ASCII==="1")return!1;if(process.env.TOOLNET_UNICODE==="1")return!0;if(process.platform==="win32"){let t=process.env.TERM_PROGRAM,e=process.env.WT_SESSION,o=process.env.VSCODE_PID,n=process.env.ConEmuPID;return!!(e||o||n||t==="vscode")}return process.env.TERM!=="linux"}var h;function v(){return h||(h=A()?R:U),h}var d={reset:"\x1B[0m",green:"\x1B[32m",cyan:"\x1B[36m",red:"\x1B[31m",yellow:"\x1B[33m",amber:"\x1B[38;5;214m",white:"\x1B[97m",dim:"\x1B[2m",bold:"\x1B[1m"};function T(t){return t.noColor||process.env.NO_COLOR?!1:t.tty??process.stdout.isTTY??!1}function f(t,e,o){return T(o)?`${e}${t}${d.reset}`:t}function N(t,e){return f(t,d.dim,e)}function M(t,e){return f(t,d.bold,e)}function O(t,e){return f(t,d.cyan,e)}function u(t,e,o){let n=v(),i=e?` ${N(`v${e}`,o)}`:"";return`${O(n.phaseDone,o)} ${t}${i}`}function a(t,e){return M(t,e)}function l(t,e,o,n){let i=" ".repeat(Math.max(0,o-t.length));return` ${O(t,n)}${i} ${e}`}var m=[{name:"setup",description:"Configure ToolNet",category:"core"},{name:"init",description:"Initialize current project",usage:"toolnet-memory init [path]",category:"core"},{name:"doctor",description:"Check system health",category:"core"},{name:"ask",description:"Ask project memory",usage:"toolnet-memory ask <question>",category:"memory"},{name:"context",description:"Show current project context",category:"memory",aliases:["context:print"]},{name:"work",description:"Show current work state",category:"memory",aliases:["work:status"]},{name:"index",description:"Build code intelligence",category:"code",pipeline:["Scanning files","Parsing code","Type Resolution","Rich Graph","Semantic Code Index","Architecture Intelligence","Graph Analysis","3D Visualization Dataset"]},{name:"semantic",description:"Semantic code search",usage:"toolnet-memory semantic <query>",category:"code"},{name:"impact",description:"Analyze change impact",usage:"toolnet-memory impact <file>",category:"code"},{name:"graph",description:"Open code graph UI",category:"code"},{name:"graph:ui",description:"Open code graph UI",category:"code",hidden:!0},{name:"model",description:"View/change AI model",category:"ai"},{name:"provider",description:"Manage AI providers",category:"ai",aliases:["provider:status"]},{name:"status",description:"Show ToolNet status",category:"system"},{name:"update",description:"Update ToolNet Memory",category:"system"},{name:"context:print",description:"Print fast project context",category:"context",hidden:!0},{name:"context:sync",description:"Show context hash/size",category:"context"},{name:"context:refresh",description:"Rebuild deep startup brief cache",category:"context"},{name:"brief",description:"Show full project brief",category:"context"},{name:"brief:json",description:"Show brief as JSON",category:"context"},{name:"profile:show",description:"Show .toolnet/profile.md",category:"context"},{name:"profile:sync",description:"Sync profile to agent files",category:"context"},{name:"work:status",description:"Show current work state",category:"work",hidden:!0},{name:"work:json",description:"Show work state as JSON",category:"work"},{name:"work:reconcile",description:"Reconcile work continuity",category:"work"},{name:"handoff:latest",description:"Show latest session handoff",category:"work"},{name:"handoff:refresh",description:"Refresh handoff data",category:"work"},{name:"index:graph",description:"Build graph index only",category:"code"},{name:"incremental",description:"Incremental code indexing",category:"code"},{name:"config",description:"Manage configuration",usage:"toolnet-memory config <get|set|list|open>",category:"ai"},{name:"provider:list",description:"List available AI providers",category:"ai"},{name:"provider:status",description:"Show AI provider status",category:"ai",hidden:!0},{name:"provider:test",description:"Test AI provider connection",category:"ai"},{name:"integrate:detect",description:"Detect agent integrations",category:"integration"},{name:"integrate:auto",description:"Auto-enable integrations",category:"integration"},{name:"integrate:agy",description:"Install Agy hooks",category:"integration"},{name:"integrate:codex",description:"Install Codex integration",category:"integration"},{name:"integrate:opencode",description:"Install OpenCode plugin",category:"integration"},{name:"integrate:claude",description:"Install Claude Code integration",category:"integration"},{name:"integrate:kiro",description:"Install Kiro CLI integration",usage:"toolnet-memory integrate:kiro [--status] [--json]",category:"integration"},{name:"session:agy-sync",description:"Sync Agy session",category:"session"},{name:"session:agy-recover",description:"Recover Agy sessions",category:"session"},{name:"session:agy-hook",description:"Agy session hook",category:"session",hidden:!0},{name:"session:codex-sync",description:"Sync Codex session",category:"session"},{name:"session:codex-recover",description:"Recover Codex sessions",category:"session"},{name:"session:codex-notify",description:"Codex notification hook",category:"session",hidden:!0},{name:"session:codex-context",description:"Codex context hook",category:"session",hidden:!0},{name:"session:opencode-sync",description:"Sync OpenCode session",category:"session"},{name:"session:opencode-recover",description:"Recover OpenCode sessions",category:"session"},{name:"session:claude-hook",description:"Claude session hook",category:"session",hidden:!0},{name:"session:kiro-hook",description:"Kiro lifecycle hook",category:"session",hidden:!0},{name:"memory:review",description:"Review memory entries",category:"session"},{name:"memory:reconcile",description:"Reconcile memory state",category:"session"},{name:"guard:check",description:"Check project rules",category:"guard"},{name:"guard:explain",description:"Show rules and evidence",category:"guard"},{name:"guard:json",description:"Output guard result as JSON",category:"guard",hidden:!0},{name:"project:manual-init",description:"Initialize project manual",category:"project"},{name:"project:manual-show",description:"Show project manual",category:"project"},{name:"project:manual-sync",description:"Sync project manual",category:"project"},{name:"snapshot:list",description:"List snapshots",category:"snapshot"},{name:"snapshot:create",description:"Create snapshot",category:"snapshot"},{name:"snapshot:restore",description:"Restore snapshot",category:"snapshot"},{name:"recover",description:"Recover latest snapshot",category:"snapshot"},{name:"service",description:"Run daemon in foreground",category:"service"},{name:"service:install",description:"Install/start daemon",category:"service"},{name:"service:start",description:"Start daemon",category:"service"},{name:"service:stop",description:"Stop daemon",category:"service"},{name:"service:restart",description:"Restart daemon",category:"service"},{name:"service:status",description:"Show daemon status",category:"service"},{name:"service:remove",description:"Remove daemon",category:"service"},{name:"mcp",description:"Run MCP server",category:"advanced"},{name:"api",description:"Run API server",category:"advanced"},{name:"run",description:"Run ToolNet runtime",category:"advanced",hidden:!0},{name:"production:certify",description:"Verify production runtime",category:"advanced"},{name:"certify:continuity",description:"Certify work continuity",category:"advanced"},{name:"ask-ai",description:"Ask AI agent (advanced)",category:"advanced",hidden:!0}];function x(t){return{tty:t.tty,noColor:t.noColor}}function S(t){let e=[],o=t.version??"0.0.0",n=x(t);e.push(""),e.push(u("ToolNet Memory",o,n)),e.push(" Persistent memory & code intelligence for AI coding agents"),e.push(""),e.push(a("USAGE",n)),e.push(" toolnet-memory <command> [options]"),e.push("");let i=[{key:"core",title:"GET STARTED"},{key:"memory",title:"MEMORY"},{key:"code",title:"CODE"},{key:"ai",title:"AI"},{key:"system",title:"SYSTEM"}];for(let{key:s,title:g}of i){let c=m.filter(r=>r.category===s&&!r.hidden);if(c.length===0)continue;e.push(a(g,n));let y=Math.max(...c.map(r=>r.name.length));for(let r of c)e.push(l(r.name,r.description,y,n));e.push("")}return e.push(a("MORE",n)),e.push(l("help --all","Show all advanced commands",15,n)),e.push(l("help <command>","Show command details",15,n)),e.push(""),e.join(`
|
|
2
|
-
`)}function
|
|
3
|
-
`)}function
|
|
4
|
-
`)}function
|
|
1
|
+
import{readFileSync as N}from"node:fs";import{dirname as M,resolve as w}from"node:path";import{fileURLToPath as D}from"node:url";var E={spinner:["\xB7","\u2722","\u2733","\u2736","\u273B","\u273D"],barFilled:"\u2588",barEmpty:"\u2591",phaseDone:"\u25C6",phaseActive:"\u25C7",rail:"\u2502",branch:"\u251C",corner:"\u2514",dash:"\u2014"},R={spinner:[".","*","+","x","*","+"],barFilled:"#",barEmpty:"-",phaseDone:"[OK]",phaseActive:"[>>]",rail:"|",branch:"|",corner:"\\",dash:"-"};function U(){if(process.env.TOOLNET_ASCII==="1")return!1;if(process.env.TOOLNET_UNICODE==="1")return!0;if(process.platform==="win32"){let o=process.env.TERM_PROGRAM,e=process.env.WT_SESSION,n=process.env.VSCODE_PID,t=process.env.ConEmuPID;return!!(e||n||t||o==="vscode")}return process.env.TERM!=="linux"}var h;function v(){return h||(h=U()?E:R),h}var m={reset:"\x1B[0m",green:"\x1B[32m",cyan:"\x1B[36m",red:"\x1B[31m",yellow:"\x1B[33m",amber:"\x1B[38;5;214m",white:"\x1B[97m",dim:"\x1B[2m",bold:"\x1B[1m"};function A(o){return o.noColor||process.env.NO_COLOR?!1:o.tty??process.stdout.isTTY??!1}function f(o,e,n){return A(n)?`${e}${o}${m.reset}`:o}function T(o,e){return f(o,m.dim,e)}function G(o,e){return f(o,m.bold,e)}function k(o,e){return f(o,m.cyan,e)}function d(o,e,n){let t=v(),i=e?` ${T(`v${e}`,n)}`:"";return`${k(t.phaseDone,n)} ${o}${i}`}function a(o,e){return G(o,e)}function l(o,e,n,t){let i=" ".repeat(Math.max(0,n-o.length));return` ${k(o,t)}${i} ${e}`}var g=[{name:"setup",description:"Configure ToolNet",category:"core"},{name:"init",description:"Initialize current project",usage:"toolnet-memory init [path]",category:"core"},{name:"doctor",description:"Check system health",category:"core"},{name:"ask",description:"Ask project memory",usage:"toolnet-memory ask <question>",category:"memory"},{name:"context",description:"Show current project context",category:"memory",aliases:["context:print"]},{name:"work",description:"Show current work state",category:"memory",aliases:["work:status"]},{name:"index",description:"Build code intelligence",category:"code",pipeline:["Scanning files","Parsing code","Type Resolution","Rich Graph","Semantic Code Index","Architecture Intelligence","Graph Analysis","3D Visualization Dataset"]},{name:"semantic",description:"Semantic code search",usage:"toolnet-memory semantic <query>",category:"code"},{name:"impact",description:"Analyze change impact",usage:"toolnet-memory impact <file>",category:"code"},{name:"graph",description:"Open code graph UI",category:"code"},{name:"graph:ui",description:"Open code graph UI",category:"code",hidden:!0},{name:"model",description:"View/change AI model",category:"ai"},{name:"provider",description:"Manage AI providers",category:"ai",aliases:["provider:status"]},{name:"status",description:"Show ToolNet status",category:"system"},{name:"update",description:"Update ToolNet Memory",category:"system"},{name:"context:print",description:"Print fast project context",category:"context",hidden:!0},{name:"context:sync",description:"Show context hash/size",category:"context"},{name:"context:refresh",description:"Rebuild deep startup brief cache",category:"context"},{name:"brief",description:"Show full project brief",category:"context"},{name:"brief:json",description:"Show brief as JSON",category:"context"},{name:"profile:show",description:"Show .toolnet/profile.md",category:"context"},{name:"profile:sync",description:"Sync profile to agent files",category:"context"},{name:"work:status",description:"Show current work state",category:"work",hidden:!0},{name:"work:json",description:"Show work state as JSON",category:"work"},{name:"work:reconcile",description:"Reconcile work continuity",category:"work"},{name:"handoff:latest",description:"Show latest session handoff",category:"work"},{name:"handoff:refresh",description:"Refresh handoff data",category:"work"},{name:"index:graph",description:"Build graph index only",category:"code"},{name:"incremental",description:"Incremental code indexing",category:"code"},{name:"config",description:"Manage configuration",usage:"toolnet-memory config <get|set|list|open>",category:"ai"},{name:"provider:list",description:"List available AI providers",category:"ai"},{name:"provider:status",description:"Show AI provider status",category:"ai",hidden:!0},{name:"provider:test",description:"Test AI provider connection",category:"ai"},{name:"integrate:detect",description:"Detect agent integrations",category:"integration"},{name:"integrate:auto",description:"Auto-enable integrations with safe project scope policy",usage:"toolnet-memory integrate:auto [--all] [--scope global|project|both] [--project <path>] [--json]",category:"integration",examples:["toolnet-memory integrate:auto","toolnet-memory integrate:auto --project /path/to/toolnet-project","toolnet-memory integrate:auto --scope global","toolnet-memory integrate:auto --scope both --project /path/to/project"]},{name:"integrate:agy",description:"Install Agy hooks",category:"integration"},{name:"integrate:codex",description:"Install Codex integration",category:"integration"},{name:"integrate:opencode",description:"Install OpenCode plugin",category:"integration"},{name:"integrate:claude",description:"Install Claude Code integration",category:"integration"},{name:"integrate:kiro",description:"Install Kiro CLI integration",usage:"toolnet-memory integrate:kiro [--status] [--json]",category:"integration"},{name:"integrate:cursor",description:"Install Cursor CLI integration",usage:"toolnet-memory integrate:cursor [--scope global|project|both] [--project <path>] [--status] [--json]",category:"integration",examples:["toolnet-memory integrate:cursor --scope global","toolnet-memory integrate:cursor --scope project --project /path/to/project","toolnet-memory integrate:cursor --scope both --project /path/to/project"]},{name:"integrate:copilot",description:"Install GitHub Copilot CLI integration",usage:"toolnet-memory integrate:copilot [--scope global|project|both] [--project <path>] [--status] [--json]",category:"integration",examples:["toolnet-memory integrate:copilot --scope global","toolnet-memory integrate:copilot --scope project --project /path/to/project","toolnet-memory integrate:copilot --scope both --project /path/to/project"]},{name:"integrate:grok",description:"Install Grok Build integration",usage:"toolnet-memory integrate:grok [--scope global|project|both] [--project <path>] [--status] [--json]",category:"integration",examples:["toolnet-memory integrate:grok --scope global","toolnet-memory integrate:grok --scope project --project /path/to/project","toolnet-memory integrate:grok --scope both --project /path/to/project"]},{name:"integrate:status",description:"Show unified Cursor/Copilot/Grok scoped integration status",usage:"toolnet-memory integrate:status [--scope global|project|both] [--project <path>] [--agent cursor|copilot|grok] [--json]",category:"integration",examples:["toolnet-memory integrate:status --scope global","toolnet-memory integrate:status --scope both --project /path/to/project","toolnet-memory integrate:status --scope both --project /path/to/project --agent cursor"]},{name:"session:agy-sync",description:"Sync Agy session",category:"session"},{name:"session:agy-recover",description:"Recover Agy sessions",category:"session"},{name:"session:agy-hook",description:"Agy session hook",category:"session",hidden:!0},{name:"session:codex-sync",description:"Sync Codex session",category:"session"},{name:"session:codex-recover",description:"Recover Codex sessions",category:"session"},{name:"session:codex-notify",description:"Codex notification hook",category:"session",hidden:!0},{name:"session:codex-context",description:"Codex context hook",category:"session",hidden:!0},{name:"session:opencode-sync",description:"Sync OpenCode session",category:"session"},{name:"session:opencode-recover",description:"Recover OpenCode sessions",category:"session"},{name:"session:claude-hook",description:"Claude session hook",category:"session",hidden:!0},{name:"session:kiro-hook",description:"Kiro lifecycle hook",category:"session",hidden:!0},{name:"session:cursor-hook",description:"Cursor lifecycle hook",category:"session",hidden:!0},{name:"session:copilot-hook",description:"Copilot lifecycle hook",category:"session",hidden:!0},{name:"session:grok-hook",description:"Grok lifecycle hook",category:"session",hidden:!0},{name:"memory:review",description:"Review memory entries",category:"session"},{name:"memory:reconcile",description:"Reconcile memory state",category:"session"},{name:"guard:check",description:"Check project rules",category:"guard"},{name:"guard:explain",description:"Show rules and evidence",category:"guard"},{name:"guard:json",description:"Output guard result as JSON",category:"guard",hidden:!0},{name:"project:manual-init",description:"Initialize project manual",category:"project"},{name:"project:manual-show",description:"Show project manual",category:"project"},{name:"project:manual-sync",description:"Sync project manual",category:"project"},{name:"snapshot:list",description:"List snapshots",category:"snapshot"},{name:"snapshot:create",description:"Create snapshot",category:"snapshot"},{name:"snapshot:restore",description:"Restore snapshot",category:"snapshot"},{name:"recover",description:"Recover latest snapshot",category:"snapshot"},{name:"service",description:"Run daemon in foreground",category:"service"},{name:"service:install",description:"Install/start daemon",category:"service"},{name:"service:start",description:"Start daemon",category:"service"},{name:"service:stop",description:"Stop daemon",category:"service"},{name:"service:restart",description:"Restart daemon",category:"service"},{name:"service:status",description:"Show daemon status",category:"service"},{name:"service:remove",description:"Remove daemon",category:"service"},{name:"mcp",description:"Run MCP server",category:"advanced"},{name:"api",description:"Run API server",category:"advanced"},{name:"run",description:"Run ToolNet runtime",category:"advanced",hidden:!0},{name:"production:certify",description:"Verify production runtime",category:"advanced"},{name:"certify:continuity",description:"Certify work continuity",category:"advanced"},{name:"ask-ai",description:"Ask AI agent (advanced)",category:"advanced",hidden:!0}];function x(o){return{tty:o.tty,noColor:o.noColor}}function b(o){let e=[],n=o.version??"0.0.0",t=x(o);e.push(""),e.push(d("ToolNet Memory",n,t)),e.push(" Persistent memory & code intelligence for AI coding agents"),e.push(""),e.push(a("USAGE",t)),e.push(" toolnet-memory <command> [options]"),e.push("");let i=[{key:"core",title:"GET STARTED"},{key:"memory",title:"MEMORY"},{key:"code",title:"CODE"},{key:"ai",title:"AI"},{key:"system",title:"SYSTEM"}];for(let{key:s,title:u}of i){let c=g.filter(r=>r.category===s&&!r.hidden);if(c.length===0)continue;e.push(a(u,t));let y=Math.max(...c.map(r=>r.name.length));for(let r of c)e.push(l(r.name,r.description,y,t));e.push("")}return e.push(a("MORE",t)),e.push(l("help --all","Show all advanced commands",15,t)),e.push(l("help <command>","Show command details",15,t)),e.push(""),e.join(`
|
|
2
|
+
`)}function O(o){let e=[],n=o.version??"0.0.0",t=x(o);e.push(""),e.push(d("ToolNet Memory",n,t)),e.push(" Persistent memory & code intelligence for AI coding agents"),e.push(""),e.push(a("USAGE",t)),e.push(" toolnet-memory <command> [options]"),e.push("");let i=[{key:"core",title:"PROJECT SETUP"},{key:"memory",title:"MEMORY"},{key:"code",title:"CODE INTELLIGENCE"},{key:"ai",title:"AI / PROVIDERS"},{key:"system",title:"SYSTEM"},{key:"context",title:"CONTEXT & MEMORY"},{key:"work",title:"WORK CONTINUITY"},{key:"integration",title:"AGENT INTEGRATIONS"},{key:"session",title:"SESSIONS"},{key:"guard",title:"GUARD"},{key:"project",title:"PROJECT MANUAL"},{key:"snapshot",title:"SNAPSHOTS & RECOVERY"},{key:"service",title:"BACKGROUND SERVICE"},{key:"advanced",title:"DEVELOPER / PRODUCTION"}];for(let{key:s,title:u}of i){let c=g.filter(r=>r.category===s&&!r.hidden);if(c.length===0)continue;e.push(a(u,t));let y=Math.max(...c.map(r=>r.name.length));for(let r of c)e.push(l(r.name,r.description,y,t));e.push("")}return e.join(`
|
|
3
|
+
`)}function S(o,e){let n=g.find(s=>s.name===o||s.aliases?.includes(o));if(!n)return null;let t=[],i=x(e);if(t.push(""),t.push(d(n.name,void 0,i)),t.push(""),t.push(n.description),t.push(""),n.usage&&(t.push(a("USAGE",i)),t.push(` ${n.usage}`),t.push("")),n.aliases&&n.aliases.length>0){t.push(a("ALIASES",i));for(let s of n.aliases)t.push(` ${s}`);t.push("")}if(n.pipeline&&n.pipeline.length>0){t.push(a("PIPELINE",i));for(let s of n.pipeline)t.push(` ${s}`);t.push("")}if(n.examples&&n.examples.length>0){t.push(a("EXAMPLES",i));for(let s of n.examples)t.push(` ${s}`);t.push("")}return t.join(`
|
|
4
|
+
`)}function j(o){return g.flatMap(t=>[t.name,...t.aliases??[]]).filter(t=>t===o?!1:!!(t.startsWith(o)||o.length>=3&&t.includes(o))).slice(0,3)}function $(){let o=M(D(import.meta.url)),e=[w(o,"../package.json"),w(o,"../../package.json")];for(let n of e)try{let t=JSON.parse(N(n,"utf8"));if(t.version)return t.version}catch{}return process.env.npm_package_version??"unknown"}var p=process.argv.slice(2),C={version:$(),tty:!!process.stdout.isTTY};function I(o){let e=j(o);if(console.error(""),console.error(`\u2715 Unknown command: ${o}`),e.length>0){console.error(""),console.error(" Did you mean:");for(let n of e)console.error(` ${n}`)}console.error(""),console.error(" Run `toolnet-memory help` to see available commands."),console.error("")}if(p[0]==="--unknown")I(p[1]??""),process.exitCode=1;else if(p[0]==="--all")console.log(O(C));else if(p[0]){let o=S(p[0],C);o?console.log(o):(I(p[0]),process.exitCode=1)}else console.log(b(C));
|