@scopeide/cli 0.1.7 → 0.1.9

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 ADDED
@@ -0,0 +1,94 @@
1
+ # @scopeide/cli
2
+
3
+ > **Scope** — The AI-first coding agent for your terminal.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@scopeide/cli.svg?style=flat-square)](https://www.npmjs.com/package/@scopeide/cli)
6
+ [![License](https://img.shields.io/badge/license-UNLICENSED-blue.svg?style=flat-square)](https://scopeide.com)
7
+ [![Website](https://img.shields.io/badge/website-scopeide.com-green.svg?style=flat-square)](https://scopeide.com)
8
+
9
+ Scope is an intelligent terminal assistant designed to build, edit, test, and troubleshoot code directly inside your terminal workspace.
10
+
11
+ ---
12
+
13
+ ## ⚡ Installation
14
+
15
+ Install globally using `npm`:
16
+
17
+ ```bash
18
+ npm install -g @scopeide/cli
19
+ ```
20
+
21
+ Or using `pnpm` / `yarn`:
22
+
23
+ ```bash
24
+ pnpm add -g @scopeide/cli
25
+ # or
26
+ yarn global add @scopeide/cli
27
+ ```
28
+
29
+ Verify your installation:
30
+
31
+ ```bash
32
+ scope --version
33
+ ```
34
+
35
+ ---
36
+
37
+ ## 🚀 Getting Started
38
+
39
+ ### 1. Authenticate
40
+ Log in with your Scope account to connect your credits and settings:
41
+
42
+ ```bash
43
+ scope login
44
+ ```
45
+
46
+ ### 2. Launch Interactive Agent
47
+ Navigate to any project directory and start an interactive session:
48
+
49
+ ```bash
50
+ scope
51
+ ```
52
+
53
+ ### 3. Headless / Direct Prompts
54
+ Run tasks directly from your command line:
55
+
56
+ ```bash
57
+ scope -p "Add unit tests for auth middleware"
58
+ ```
59
+
60
+ ---
61
+
62
+ ## 🛠️ Key Commands & Flags
63
+
64
+ | Command / Option | Description |
65
+ | :--- | :--- |
66
+ | `scope login` | Authenticate your terminal with Scope IDE |
67
+ | `scope logout` | Log out and clear saved credentials |
68
+ | `scope init` | Initialize project-level Scope configuration |
69
+ | `scope models` | List available AI models on your plan |
70
+ | `scope usage` | Check your monthly token and request usage |
71
+ | `scope doctor` | Check system environment and connection health |
72
+ | `scope -p, --prompt <text>` | Run a prompt directly and exit |
73
+ | `scope --plan` | Plan mode: analyze code and produce a step-by-step plan without modifying files |
74
+ | `scope -c, --continue` | Continue the most recent session in the current project |
75
+ | `scope -r, --resume [id]` | Resume an existing session |
76
+ | `scope --yolo` | Auto-approve tool calls for maximum velocity |
77
+
78
+ ---
79
+
80
+ ## 🔄 Updating Scope CLI
81
+
82
+ To update to the latest release at any time:
83
+
84
+ ```bash
85
+ npm install -g @scopeide/cli@latest
86
+ ```
87
+
88
+ ---
89
+
90
+ ## 🌐 Links & Resources
91
+
92
+ - **Website:** [scopeide.com](https://scopeide.com)
93
+ - **Releases & Desktop Downloads:** [github.com/mdhedayet/scope-releases](https://github.com/mdhedayet/scope-releases/releases)
94
+ - **Support & Issues:** [support@scopeide.com](mailto:support@scopeide.com) / [GitHub Issues](https://github.com/mdhedayet/scope-releases/issues)
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import Ds from"dns";import Us from"net";import{Command as ji,Option as Ni}from"commander";var _={name:"Scope",shortName:"Scope",bin:"scope",dirName:".scope",keyPrefix:"sc_",sessionPrefix:"scs_",defaultApiUrl:"https://api.scopeide.com",installSnippet:"npm i -g @scopeide/cli",domain:"scopeide.com",supportEmail:"support@scopeide.com",salesEmail:"sales@scopeide.com",tagline:"The AI-First Code Editor Built for Flow & Speed.",version:"v0.1.7"};var L={maxSteps:100,hardMaxSteps:500,maxToolOutputBytes:12e3,maxContextTokens:32e3,warnContextTokens:24e3,maxRunTokens:0,charsPerToken:4};var jt={strings:{}},Xs=["maxSteps","hardMaxSteps","maxToolOutputBytes","maxContextTokens","warnContextTokens","maxRunTokens"];function wn(e){if(!e)return;let t=L;for(let n of Xs){let o=e.limits?.[n];typeof o=="number"&&Number.isFinite(o)&&o>=0&&(t[n]=o)}if(e.strings&&typeof e.strings=="object"){jt.strings={};for(let[n,o]of Object.entries(e.strings))/^(cli|agent|desktop)\./.test(n)&&typeof o=="string"&&(jt.strings[n]=o.slice(0,4e3))}}function l(e,t,...n){let o=jt.strings[e]??t;return n.length?o.replace(/\{(\d+)\}/g,(s,r)=>Number(r)<n.length?String(n[Number(r)]):s):o}var me={maxBytes:5*1024*1024,maxPerMessage:6,keepInRequest:3,maxRequestBytes:6*1024*1024};import Ne from"os";import xt from"path";import{execFile as _s,spawn as wi}from"child_process";import T from"fs/promises";import sr from"fs";import _o from"os";import rr from"crypto";import M from"path";import{spawn as ir}from"child_process";import{z as N}from"zod";import{zodToJsonSchema as ar}from"zod-to-json-schema";import Ve from"path";function pe(e,t){let n=Ve.resolve(e,t),o=Ve.relative(e,n),s=o===""||!o.startsWith("..")&&!Ve.isAbsolute(o);return{abs:n,inside:s}}function De(e,t){let n=Ve.posix.resolve(e,t),o=Ve.posix.relative(e,n),s=o===""||!o.startsWith("..")&&!Ve.posix.isAbsolute(o);return{abs:n,inside:s}}import Re from"path";function le(e,t){if(e.length<=t)return e;let n=Math.floor(t*.6),o=t-n;return`${e.slice(0,n)}
1
+ import Ds from"dns";import Us from"net";import{Command as ji,Option as Ni}from"commander";var _={name:"Scope",shortName:"Scope",bin:"scope",dirName:".scope",keyPrefix:"sc_",sessionPrefix:"scs_",defaultApiUrl:"https://api.scopeide.com",installSnippet:"npm i -g @scopeide/cli",domain:"scopeide.com",supportEmail:"support@scopeide.com",salesEmail:"sales@scopeide.com",tagline:"The AI-First Code Editor Built for Flow & Speed.",version:"v0.1.10"};var L={maxSteps:100,hardMaxSteps:500,maxToolOutputBytes:12e3,maxContextTokens:32e3,warnContextTokens:24e3,maxRunTokens:0,charsPerToken:4};var jt={strings:{}},Xs=["maxSteps","hardMaxSteps","maxToolOutputBytes","maxContextTokens","warnContextTokens","maxRunTokens"];function wn(e){if(!e)return;let t=L;for(let n of Xs){let o=e.limits?.[n];typeof o=="number"&&Number.isFinite(o)&&o>=0&&(t[n]=o)}if(e.strings&&typeof e.strings=="object"){jt.strings={};for(let[n,o]of Object.entries(e.strings))/^(cli|agent|desktop)\./.test(n)&&typeof o=="string"&&(jt.strings[n]=o.slice(0,4e3))}}function l(e,t,...n){let o=jt.strings[e]??t;return n.length?o.replace(/\{(\d+)\}/g,(s,r)=>Number(r)<n.length?String(n[Number(r)]):s):o}var me={maxBytes:5*1024*1024,maxPerMessage:6,keepInRequest:3,maxRequestBytes:6*1024*1024};import Ne from"os";import xt from"path";import{execFile as _s,spawn as wi}from"child_process";import T from"fs/promises";import sr from"fs";import _o from"os";import rr from"crypto";import M from"path";import{spawn as ir}from"child_process";import{z as N}from"zod";import{zodToJsonSchema as ar}from"zod-to-json-schema";import Ve from"path";function pe(e,t){let n=Ve.resolve(e,t),o=Ve.relative(e,n),s=o===""||!o.startsWith("..")&&!Ve.isAbsolute(o);return{abs:n,inside:s}}function De(e,t){let n=Ve.posix.resolve(e,t),o=Ve.posix.relative(e,n),s=o===""||!o.startsWith("..")&&!Ve.posix.isAbsolute(o);return{abs:n,inside:s}}import Re from"path";function le(e,t){if(e.length<=t)return e;let n=Math.floor(t*.6),o=t-n;return`${e.slice(0,n)}
2
2
  \u2026[${e.length-t} chars omitted]\u2026
3
3
  ${e.slice(e.length-o)}`}import yn from"path";var Zs=[[/(^|[\s;&|(`])(sudo|doas)\b/,"sudo is not allowed"],[/(^|[\s;&|(`])su\s+(-|root\b)/,"su is not allowed"],[/:\(\)\s*\{\s*:\s*\|\s*:\s*&\s*\}\s*;\s*:/,"fork bomb"],[/\bmkfs(\.\w+)?\b/,"filesystem format"],[/\b(wipefs|shred|fdisk|parted|diskutil\s+(erase|zero|secure))/,"disk wipe/partition command"],[/\bdd\b[^|;&]*\bof=\/dev\//,"raw disk write"],[/>\s*\/dev\/(sd|nvme|disk|rdisk|hd)/,"raw disk write"],[/(^|[\s;&|(`])(shutdown|reboot|halt|poweroff)\b/,"system power command"],[/\bchmod\s+(-\w+\s+)*[0-7]*777\s+\/(\s|$)/,"chmod 777 on root path"],[/\b(curl|wget|nc|ncat|scp|rsync|ftp|sftp)\b[^\n]*(\.env\b|id_rsa|id_ed25519|\.ssh\b|\.aws\b|\.npmrc|\.netrc|credentials|\.forge\/config)/,"possible secret exfiltration"],[/\b(cat|less|more|head|tail|base64|printenv|env)\b[^\n]*\|\s*(curl|wget|nc|ncat)\b/,"possible secret exfiltration"],[/\b(cat|head|tail|base64)\b[^\n|]*(\.env\b|id_rsa|\.ssh\/|\.aws\/|\.netrc)[^\n]*\|\s*(curl|wget|nc|ncat)\b/,"possible secret exfiltration"],[/\b(curl|wget)\b[^\n]*\$\{?\w*(KEY|TOKEN|SECRET|PASSWORD)\w*/i,"possible secret exfiltration"],[/\b(printenv|env)\b[^\n]*\|\s*(curl|wget|nc|ncat)\b/,"possible secret exfiltration"],[/\b(curl|wget)\b[^\n]*\|\s*(sudo\s+)?(sh|bash|zsh|python3?|node)\b/,"piping a remote script to an interpreter"]],Qs=/^(\/|\/\*|~|~\/|~\/\*|\$HOME|\$\{HOME\}|\$HOME\/|\$HOME\/\*|\*|\/(usr|etc|bin|sbin|var|lib|opt|home|Users|System|Library|Applications)\/?\*?)$/;function er(e){let t=e.trim().split(/\s+/),n=t.findIndex(c=>yn.basename(c.replace(/^["']|["']$/g,""))==="rm");if(n<0)return null;let o=t.slice(n+1);if(!o.some(c=>/^-[a-zA-Z]*[rR][a-zA-Z]*$/.test(c)||c==="--recursive"))return null;if(o.includes("--no-preserve-root"))return"rm --no-preserve-root";let a=o.filter(c=>!c.startsWith("-")).map(c=>c.replace(/^["']|["']$/g,"")).find(c=>Qs.test(c));return a?`recursive delete of "${a}"`:null}function Nt(e,t){for(let[n,o]of Zs)if(n.test(e))return{ok:!1,reason:`blocked: ${o}`};for(let n of e.split(/&&|\|\||[;|\n]/)){let o=er(n);if(o)return{ok:!1,reason:`blocked: ${o}`}}if(!t.allowAll){let n=t.posix?yn.posix:yn,o=n.relative(t.root,t.cwd);if(o.startsWith("..")||n.isAbsolute(o))return{ok:!1,reason:"blocked: cwd is outside the project root"}}return{ok:!0}}var tr=/(KEY|TOKEN|SECRET|PASSWORD|PASSWD|CREDENTIAL)/i;function It(e){let t={};for(let[n,o]of Object.entries(e))tr.test(n)||n.startsWith("FORGE_")||n==="DATABASE_URL"||(t[n]=o);return t}var nr=1e6,bn=(e,t=L.maxToolOutputBytes)=>le(e,t);function Te(e,t,n){let{abs:o,inside:s}=De(e.root,t);if(e.allowAll)return o;if(!s){if(n&&e.allowOutside)return o;throw new Error(l("agent.tools.path_0_is_outside_the",'path "{0}" is outside the project root',t))}if(n&&Re.posix.relative(e.root,o).split("/").includes(".git"))throw new Error(l("agent.tools.modifying_git_is_not_allowed","modifying .git is not allowed"));return o}async function po(e,t,n){let o=await e.stat(t);if(!o)throw new Error(l("agent.tools.file_not_found_0","file not found: {0}",n));if(o.isDir)throw new Error(l("agent.tools.0_is_a_directory_use","{0} is a directory; use list_dir",n));if(o.size>nr)throw new Error(l("agent.tools.0_is_too_large_1","{0} is too large ({1} bytes); use grep to find the relevant part",n,o.size));let s=await e.readFile(t);if(s.includes(0))throw new Error(l("agent.tools.0_looks_like_a_binary","{0} looks like a binary file",n));return s.toString("utf8")}var or=(e,t)=>e.slice(0,t).split(`
4
4
  `).length;async function go(e,t,n){let o=n.remote;switch(e){case"read_file":return bn(await po(o,Te(n,t.path,!1),t.path));case"write_file":{let s=Te(n,t.path,!0),r=await o.stat(s);if(r?.isDir)throw new Error(l("agent.tools.0_is_a_directory","{0} is a directory",t.path));return await o.writeFile(s,t.content),l("agent.tools.wrote_file","{0} {1} ({2} chars)",r?"overwrote":"created",t.path,t.content.length)}case"edit_file":{let s=Te(n,t.path,!0),r=await po(o,s,t.path),{old_string:a,new_string:c}=t;if(a===c)throw new Error(l("agent.tools.old_string_and_new_string","old_string and new_string are identical"));!r.includes(a)&&r.includes(`\r
@@ -101,10 +101,10 @@ Re-issue exactly that action as ONE corrected tool call with valid JSON argument
101
101
  ${i.bold}${_.name}${i.reset} ${i.dim}v${xe}${i.reset} ${i.gray}\xB7 ${_.tagline}${i.reset}`);let a=(c,d)=>console.log(` ${i.gray}${c.padEnd(8)}${i.reset}${d}`);a("model",`${i.accent}${e}${i.reset}`),a("taste",`${t} ${t===1?"rule":"rules"} loaded`),a("folder",r),console.log(`
102
102
  ${i.dim} / commands \xB7 @ files \xB7 ! shell \xB7 esc interrupts \xB7 ? shortcuts${i.reset}
103
103
  `)}var ui=["Visualizing\u2026","Demystifying\u2026","Contemplating\u2026","Reasoning\u2026","Reflecting\u2026","Pondering\u2026","Analyzing\u2026","Evaluating\u2026","Examining\u2026","Inspecting\u2026","Investigating\u2026","Reviewing\u2026","Researching\u2026","Studying\u2026","Exploring\u2026","Mapping\u2026","Tracing\u2026","Parsing\u2026","Processing\u2026","Calculating\u2026","Computing\u2026","Synthesizing\u2026","Planning\u2026","Outlining\u2026","Sketching\u2026","Drafting\u2026","Composing\u2026","Crafting\u2026","Building\u2026","Assembling\u2026","Constructing\u2026","Designing\u2026","Formulating\u2026","Structuring\u2026","Organizing\u2026","Preparing\u2026","Refining\u2026","Polishing\u2026","Honing\u2026","Tuning\u2026","Aligning\u2026","Connecting\u2026","Resolving\u2026","Weaving\u2026","Threading\u2026","Sculpting\u2026","Crystallizing\u2026","Channeling\u2026","Conjuring\u2026","Brewing\u2026","Working\u2026","Cogitating\u2026","Ruminating\u2026","Hypothesizing\u2026","Conceptualizing\u2026","Philosophizing\u2026","Deciphering\u2026","Articulating\u2026","Illuminating\u2026","Elaborating\u2026","Orchestrating\u2026","Choreographing\u2026","Architecting\u2026","Calibrating\u2026","Materializing\u2026","Harmonizing\u2026","Contemplificating\u2026"];function Zt(){let e=l("cli.ui.status_words",ui.join("|")).split("|").map(t=>t.trim()).filter(Boolean);return e[Math.floor(Math.random()*e.length)]??"Working\u2026"}var Bn=["\xB7","\u2727","\u2726","\u2736","\u2737","\u2736","\u2726","\u2727","\xB7"],cs=[12,5,4,4,4,4,4,5,16],ds=[5,4,4,4,4,4,5];function mi(e){let t=e%88,n=0;for(let s=0;s<cs.length;s++)if(n+=cs[s],t<n)return Bn[s];let o=t-58;n=0;for(let s=0;s<ds.length;s++)if(n+=ds[s],o<n)return Bn[7-s];return Bn[0]}var us=["#E5733A","#FF9A52","#FFB347","#FFD08A","#FFF1DC","#FFD08A","#FFB347","#FF9A52","#E5733A"],pi="#9A5A3A";function gi(e){let t=parseInt(e.replace("#",""),16);return`\x1B[38;2;${t>>16&255};${t>>8&255};${t&255}m`}function fi(e,t,n,o){let s=mi(4*t),r=t%(e.length+10),a="";for(let u=0;u<e.length;u++){let g=u-(r-5),h=g>=0&&g<us.length?us[g]:pi;a+=gi(h)+e[u]}let c=`${i.statusPillBg} ${i.statusPillFg}${i.bold}${s} ${a}${i.statusPillBg} ${i.reset}`,d=` ${i.bold}${i.gray}esc${i.reset} ${i.dim}${i.gray}to interrupt${i.reset} ${i.dim}${i.gray}\u2022${i.reset} ${i.dim}${i.gray}${n}s${i.reset} ${i.dim}${i.gray}\u2022${i.reset} ${i.gray}\u2193${i.reset} ${i.dim}${i.gray}${o}${i.reset}`;return c+d}var hi=new Intl.Segmenter(void 0,{granularity:"grapheme"}),Je=e=>Array.from(hi.segment(e),t=>t.segment);function fe(e){let t=0;for(let n of e){let o=n.codePointAt(0);new RegExp("\\p{M}","u").test(n)||o>=8203&&o<=8207||o===65039||(t+=o>=4352&&o<=4447||o>=11904&&o<=42191||o>=44032&&o<=55203||o>=63744&&o<=64255||o>=65072&&o<=65135||o>=65280&&o<=65376||o>=65504&&o<=65510||o>=127744&&o<=129791?2:1)}return t}function _i(e,t){let n=Je(e),o=0;for(;o<n.length&&fe(n.slice(o).join(""))>t;)o++;return n.slice(o).join("")}function tn(e,t){let n=Je(e.slice(0,t));return n.pop(),n.join("").length}function zn(e,t){let n=Je(e.slice(t));return t+(n[0]?.length??0)}var Qt=class{constructor(t,n){this.onInterrupt=t;this.input=n}onInterrupt;input;frame=0;startTime=Date.now();status=Zt();tokens=0;timer=null;drawnLines=0;isRunning=!1;isSuspended=!1;stdinListener=null;prevRaw=!1;resizeListener=()=>{this.clear(),this.draw()};selected=-1;start(){process.stdout.isTTY&&(this.isRunning=!0,this.isSuspended=!1,this.startTime=Date.now(),this.frame=0,this.attachInput(),process.stdout.on("resize",this.resizeListener),this.timer=setInterval(()=>{this.frame++,this.frame%35===0&&!this.status.includes("Running")&&!this.status.includes("Reading")&&!this.status.includes("Editing")&&(this.status=Zt()),this.draw()},80),this.draw())}suspend(){this.isSuspended=!0,this.clear(),this.detachInput(),process.stdout.isTTY&&process.stdout.write("\x1B[?25h")}resume(){this.isRunning&&(this.isSuspended=!1,this.attachInput(),this.draw())}attachInput(){let t=process.stdin;if(!t.isTTY||this.stdinListener)return;this.prevRaw=t.isRaw,t.setRawMode(!0),t.resume();let n=new li("utf8");this.stdinListener=o=>{let s=n.write(o);s&&this.onKey(s)},t.on("data",this.stdinListener)}detachInput(){let t=process.stdin;t.isTTY&&this.stdinListener&&(t.removeListener("data",this.stdinListener),this.stdinListener=null,t.setRawMode&&t.setRawMode(this.prevRaw))}removeSelected(){let t=this.input?.queue;!t||this.selected<0||this.selected>=t.length||(t.splice(this.selected,1),this.selected=t.length?Math.min(this.selected,t.length-1):-1)}onKey(t){let n=this.input;if(t==="\x1B"||t===""){this.onInterrupt?.();return}if(!n)return;let o=n.queue;if(t==="\x1B[A")o.length&&(this.selected=this.selected<0?o.length-1:Math.max(0,this.selected-1));else if(t==="\x1B[B")this.selected>=0&&(this.selected=this.selected+1>=o.length?-1:this.selected+1);else if(t==="\x1B[3~"||t==="")this.removeSelected();else if(t==="\x7F"||t==="\b")this.selected>=0?this.removeSelected():n.draft=n.draft.slice(0,tn(n.draft,n.draft.length));else{if(t.startsWith("\x1B"))return;{let s=/[\r\n]$/.test(t),r=t.replace(/[\x00-\x1f\x7f]/g," ").replace(/\s+$/,s?"":" ");if(r&&(n.draft+=r,this.selected=-1),s){let a=n.draft.trim();a&&o.push(a),n.draft="",this.selected=-1}}}this.clear(),this.draw()}setStatus(t){this.status=t,this.draw()}setTokens(t){this.tokens=t,this.draw()}clear(){this.drawnLines>0&&process.stdout.isTTY&&(process.stdout.write(`\r${this.drawnLines>1?`\x1B[${this.drawnLines-1}A`:""}\x1B[J`),this.drawnLines=0)}regionLines(){let t=Math.floor((Date.now()-this.startTime)/1e3),n=[fi(this.status,this.frame,t,this.tokens)],o=this.input;if(!o)return n;let s=Math.max(process.stdout.columns||80,20),r=(d,u)=>{if(fe(d)<=u)return d;let g="";for(let h of Je(d)){if(fe(g+h)>u-1)break;g+=h}return g+"\u2026"};o.queue.forEach((d,u)=>{let g=u===this.selected,h=r(`${u+1}. ${d}`,s-4);n.push(g?`${i.accent}${i.bold}\u276F ${h}${i.reset}`:`${i.gray}\u23F3 ${h}${i.reset}`)});let a=_i(o.draft,s-5),c=this.selected<0;return n.push(o.draft||!c?`${i.userPointer}\u276F${i.reset} ${a}${c?"\x1B[7m \x1B[0m":""}`:`${i.userPointer}\u276F${i.reset} \x1B[7m \x1B[0m${i.dim}Type to queue the next task\u2026${i.reset}`),n.push(`${i.dim}${"\u2500".repeat(s)}${i.reset}`),n.push(o.queue.length?`${i.dim}esc interrupt \xB7 enter queue \xB7 \u2191/\u2193 select queued \xB7 backspace/del remove${i.reset}`:`${i.dim}esc interrupt \xB7 enter queues a task to run next${i.reset}`),n}draw(){if(!this.isRunning||this.isSuspended||!process.stdout.isTTY)return;this.clear();let t=this.regionLines();process.stdout.write(`\x1B[?25l${t.map(n=>`\x1B[2K${n}`).join(`
104
- `)}`),this.drawnLines=t.length}isActive(){return this.isRunning}stop(){this.isRunning&&(this.isRunning=!1,this.isSuspended=!1,this.timer&&(clearInterval(this.timer),this.timer=null),this.clear(),process.stdout.off("resize",this.resizeListener),this.detachInput(),process.stdout.isTTY&&process.stdout.write("\x1B[?25h"))}getElapsedSec(){return Math.max(1,Math.round((Date.now()-this.startTime)/1e3))}},qn=[{command:"/add-dir",get description(){return l("cli.ui.add_directory_to_workspace_context","Add directory to workspace context")}},{command:"/worktree",get description(){return l("cli.ui.create_list_or_switch_git","Create, list, or switch git worktrees \u2014 /worktree [name|list|remove <name>]")}},{command:"/agents",get description(){return l("cli.ui.manage_agent_configurations","Manage agent configurations")}},{command:"/clear",displayCommand:"/clear (new)",get description(){return l("cli.ui.start_a_new_session_with","Start a new session with empty context; previous stays on disk, resumable with /resume")}},{command:"/clone",get description(){return l("cli.ui.clone_the_current_branch_into","Clone the current branch into a new session and switch to it")}},{command:"/theme",get description(){return l("cli.ui.switch_between_dark_and_light","Switch between dark and light themes")}},{command:"/language",get description(){return l("cli.ui.switch_the_interface_language_english","Switch the interface language (English / \u7B80\u4F53\u4E2D\u6587 / \u09AC\u09BE\u0982\u09B2\u09BE)")}},{command:"/compact",get description(){return l("cli.ui.compact_the_conversation_history","Compact the conversation history")}},{command:"/compact-mode",get description(){return l("cli.ui.select_a_compact_mode_to","Select a compact mode to compact sessions")}},{command:"/config",get description(){return l("cli.ui.search_and_change_settings","Search and change settings")}},{command:"/context",get description(){return l("cli.ui.show_context_window_usage_and","Show context window usage and breakdown")}},{command:"/design",get description(){return l("cli.ui.design_partner_audit_build_compose","Design partner: audit, build, compose, and ship UI \u2014 type /design to browse modes")}},{command:"/effort",get description(){return l("cli.ui.set_reasoning_effort_for_the","Set reasoning effort for the current model")}},{command:"/exit",get description(){return l("cli.ui.exit_command_code","Exit "+_.name)}},{command:"/fork",get description(){return l("cli.ui.fork_the_conversation_into_a","Fork the conversation into a new session \u2014 /fork [name]")}},{command:"/quit",get description(){return l("cli.ui.exit_command_code_alias_of","Exit "+_.name+" (alias of /exit)")}},{command:"/feedback",displayCommand:"/feedback (issue)",get description(){return l("cli.ui.report_a_bug_or_share","Report a bug or share feedback on GitHub \u2014 /feedback [title]")}},{command:"/goal",get description(){return l("cli.ui.set_an_objective_for_the","Set an objective for the agent to work towards - /goal <objective>|clear|status")}},{command:"/help",get description(){return l("cli.ui.show_available_shortcuts","Show available shortcuts")}},{command:"/init",get description(){return l("cli.ui.initialize_agents_md_for_this","Initialize AGENTS.md for this project")}},{command:"/import",get description(){return l("cli.ui.import_your_setup_from_another","Import your setup from another coding agent \u2014 /import <agent>")}},{command:"/learn-taste",get description(){return l("cli.ui.learn_taste_from_sessions_with","Learn taste from sessions with other coding agents")}},{command:"/login",get description(){return l("cli.ui.log_in_to_command_code","Log in to "+_.name)}},{command:"/logout",get description(){return l("cli.ui.log_out_of_command_code","Log out of "+_.name)}},{command:"/mcp",get description(){return l("cli.ui.manage_mcp_server_connections","Manage MCP server connections")}},{command:"/memory",get description(){return l("cli.ui.manage_command_code_memory","Manage "+_.name+" memory")}},{command:"/model",get description(){return l("cli.ui.switch_between_command_code_models","Switch between "+_.name+" models")}},{command:"/models",get description(){return l("cli.ui.list_available_models_on_your","List available models on your plan")}},{command:"/mods",get description(){return l("cli.ui.list_loaded_mods_hot_reload","List loaded mods, hot-reload them (/mods reload [name]), or open a pane (/mods open <pane>)")}},{command:"/name",get description(){return l("cli.ui.alias_of_rename_bare_name","Alias of /rename; bare /name shows the current name")}},{command:"/plan",get description(){return l("cli.ui.enter_plan_mode_plan_task","Enter plan mode; /plan <task> plans that task")}},{command:"/plan",get description(){return l("cli.ui.toggle_plan_mode_read_only","Toggle plan mode (read-only: the agent proposes a step-by-step plan, then asks to execute)")}},{command:"/mode",get description(){return l("cli.ui.show_or_switch_the_permission","Show or switch the permission mode \u2014 /mode [default|accept-edits|plan]")}},{command:"/mode:default",get description(){return l("cli.ui.switch_to_default_mode_prompt","Switch to default mode (prompt before edits/commands)")}},{command:"/mode:accept-edits",get description(){return l("cli.ui.switch_to_accept_edits_mode","Switch to accept edits mode (accept edits automatically)")}},{command:"/mode:plan",get description(){return l("cli.ui.switch_to_plan_mode_read","Switch to plan mode (read-only, no side effects)")}},{command:"/plans",get description(){return l("cli.ui.browse_review_and_annotate_saved","Browse, review, and annotate saved plans \u2014 /plans [name]")}},{command:"/plan-review",get description(){return l("cli.ui.review_this_session_s_latest","Review this session's latest plan")}},{command:"/paste",get description(){return l("cli.ui.attach_the_clipboard_image_to","Attach the clipboard image to your next message (or press Ctrl+V)")}},{command:"/image",get description(){return l("cli.ui.attach_an_image_file_to","Attach an image file to your next message \u2014 /image <path> (or use @file.png)")}},{command:"/pr-comments",get description(){return l("cli.ui.fetch_all_pr_comments_for","Fetch all PR comments for current branch")}},{command:"/reload",get description(){return l("cli.ui.restart_command_code_and_resume","Restart "+_.name+" and resume this session")}},{command:"/rename",get description(){return l("cli.ui.rename_the_current_session","Rename the current session")}},{command:"/resume",get description(){return l("cli.ui.resume_a_past_conversation","Resume a past conversation")}},{command:"/sessions",get description(){return l("cli.ui.resume_a_past_conversation_alias","Resume a past conversation (alias of /resume)")}},{command:"/review",get description(){return l("cli.ui.review_a_pull_request_optional","Review a pull request (optional PR number)")}},{command:"/rewind",get description(){return l("cli.ui.restore_to_a_previous_checkpoint","Restore to a previous checkpoint (Press Esc twice)")}},{command:"/tree",get description(){return l("cli.ui.browse_the_session_tree_and","Browse the session tree and jump to any point in it")}},{command:"/share",get description(){return l("cli.ui.share_as_a_github_gist","Share as a GitHub gist \u2014 /share gist [html|jsonl|md]")}},{command:"/skills",get description(){return l("cli.ui.browse_and_open_agent_skills","Browse and open agent skills")}},{command:"/status",get description(){return l("cli.ui.show_comprehensive_environment_status","Show comprehensive environment status")}},{command:"/statusline",get description(){return l("cli.ui.configure_command_code_s_statusline","Configure "+_.name+"'s statusline UI")}},{command:"/taste",get description(){return l("cli.ui.manage_taste_learning_and_usage","Manage Taste learning and usage")}},{command:"/terminal-setup",get description(){return l("cli.ui.setup_vscode_keybindings","Setup VSCode keybindings")}},{command:"/unshare",get description(){return l("cli.ui.stop_sharing_conversation","Stop sharing conversation")}},{command:"/update",get description(){return l("cli.ui.update_command_code_to_the","Update "+_.name+" to the latest version")}},{command:"/usage",get description(){return l("cli.ui.display_credits_plan_and_usage","Display credits, plan, and usage metrics")}},{command:"/upgrade",get description(){return l("cli.ui.open_billing_page_to_upgrade","Open billing page to upgrade your plan")}},{command:"/extra",get description(){return l("cli.ui.buy_extra_usage_at_api","Buy extra usage at API cost, zero markup")}},{command:"/trace",get description(){return l("cli.ui.copy_the_current_trace_id","Copy the current trace id; required for support debugging")}},{command:"/session-file",get description(){return l("cli.ui.show_the_current_session_id","Show the current session id and session file path")}},{command:"/copy",get description(){return l("cli.ui.copy_the_last_response_to","Copy the last response to the clipboard")}},{command:"/export",get description(){return l("cli.ui.export_session_export_html_jsonl","Export session \u2014 /export [html|jsonl|md] or a file path")}},{command:"/changelog",get description(){return l("cli.ui.see_what_s_new_in","See what's new in "+_.name)}},{command:"/hotkeys",get description(){return l("cli.ui.show_all_keyboard_shortcuts","Show all keyboard shortcuts")}},{command:"/shortcuts",get description(){return l("cli.ui.show_all_keyboard_shortcuts","Show all keyboard shortcuts")}},{command:"/todos",get description(){return l("cli.ui.manage_the_session_todo_list","Manage the session todo list \u2014 c completes an item, x removes it, a completes all")}},{command:"/rc",get description(){return l("cli.ui.remote_control_this_session_from","Remote-control this session from Telegram or Discord")}},{command:"/btw",get description(){return l("cli.ui.ask_a_quick_side_question","Ask a quick side question mid-turn")}}],Yl=qn.map(e=>e.command);function Ge(e){if(!e.startsWith("/"))return{showMenu:!1,query:""};let t=e.slice(1);return/[\s/]/.test(t)?{showMenu:!1,query:""}:{showMenu:!0,query:t}}function lt(e){let t=e.trim().toLowerCase();return t?qn.map(n=>{let o=n.command.toLowerCase(),s=(n.displayCommand??n.command).toLowerCase(),r=n.description.toLowerCase(),a=0;return o===`/${t}`?a+=200:o.startsWith(`/${t}`)?a+=100:o.includes(t)&&(a+=50),s!==o&&s.includes(t)&&(a+=60),r.includes(t)&&(a+=25),{item:n,score:a}}).filter(n=>n.score>0).sort((n,o)=>o.score-n.score).map(n=>n.item):[...qn]}function ps(){console.log(l("cli.ui.0_command_code_1_2",`
104
+ `)}`),this.drawnLines=t.length}isActive(){return this.isRunning}stop(){this.isRunning&&(this.isRunning=!1,this.isSuspended=!1,this.timer&&(clearInterval(this.timer),this.timer=null),this.clear(),process.stdout.off("resize",this.resizeListener),this.detachInput(),process.stdout.isTTY&&process.stdout.write("\x1B[?25h"))}getElapsedSec(){return Math.max(1,Math.round((Date.now()-this.startTime)/1e3))}},qn=[{command:"/add-dir",get description(){return l("cli.ui.add_directory_to_workspace_context","Add directory to workspace context")}},{command:"/worktree",get description(){return l("cli.ui.create_list_or_switch_git","Create, list, or switch git worktrees \u2014 /worktree [name|list|remove <name>]")}},{command:"/agents",get description(){return l("cli.ui.manage_agent_configurations","Manage agent configurations")}},{command:"/clear",displayCommand:"/clear (new)",get description(){return l("cli.ui.start_a_new_session_with","Start a new session with empty context; previous stays on disk, resumable with /resume")}},{command:"/clone",get description(){return l("cli.ui.clone_the_current_branch_into","Clone the current branch into a new session and switch to it")}},{command:"/theme",get description(){return l("cli.ui.switch_between_dark_and_light","Switch between dark and light themes")}},{command:"/language",get description(){return l("cli.ui.switch_the_interface_language_english","Switch the interface language (English / \u7B80\u4F53\u4E2D\u6587 / \u09AC\u09BE\u0982\u09B2\u09BE)")}},{command:"/compact",get description(){return l("cli.ui.compact_the_conversation_history","Compact the conversation history")}},{command:"/compact-mode",get description(){return l("cli.ui.select_a_compact_mode_to","Select a compact mode to compact sessions")}},{command:"/config",get description(){return l("cli.ui.search_and_change_settings","Search and change settings")}},{command:"/context",get description(){return l("cli.ui.show_context_window_usage_and","Show context window usage and breakdown")}},{command:"/design",get description(){return l("cli.ui.design_partner_audit_build_compose","Design partner: audit, build, compose, and ship UI \u2014 type /design to browse modes")}},{command:"/effort",get description(){return l("cli.ui.set_reasoning_effort_for_the","Set reasoning effort for the current model")}},{command:"/exit",get description(){return l("cli.ui.exit_command_code","Exit "+_.name)}},{command:"/fork",get description(){return l("cli.ui.fork_the_conversation_into_a","Fork the conversation into a new session \u2014 /fork [name]")}},{command:"/quit",get description(){return l("cli.ui.exit_command_code_alias_of","Exit "+_.name+" (alias of /exit)")}},{command:"/feedback",displayCommand:"/feedback (issue)",get description(){return l("cli.ui.report_a_bug_or_share","Report a bug or share feedback on GitHub \u2014 /feedback [title]")}},{command:"/goal",get description(){return l("cli.ui.set_an_objective_for_the","Set an objective for the agent to work towards - /goal <objective>|clear|status")}},{command:"/help",get description(){return l("cli.ui.show_available_shortcuts","Show available shortcuts")}},{command:"/init",get description(){return l("cli.ui.initialize_agents_md_for_this","Initialize AGENTS.md for this project")}},{command:"/import",get description(){return l("cli.ui.import_your_setup_from_another","Import your setup from another coding agent \u2014 /import <agent>")}},{command:"/learn-taste",get description(){return l("cli.ui.learn_taste_from_sessions_with","Learn taste from sessions with other coding agents")}},{command:"/login",get description(){return l("cli.ui.log_in_to_command_code","Log in to "+_.name)}},{command:"/logout",get description(){return l("cli.ui.log_out_of_command_code","Log out of "+_.name)}},{command:"/mcp",get description(){return l("cli.ui.manage_mcp_server_connections","Manage MCP server connections")}},{command:"/memory",get description(){return l("cli.ui.manage_command_code_memory","Manage "+_.name+" memory")}},{command:"/model",get description(){return l("cli.ui.switch_between_command_code_models","Switch between "+_.name+" models")}},{command:"/models",get description(){return l("cli.ui.list_available_models_on_your","List available models on your plan")}},{command:"/mods",get description(){return l("cli.ui.list_loaded_mods_hot_reload","List loaded mods, hot-reload them (/mods reload [name]), or open a pane (/mods open <pane>)")}},{command:"/name",get description(){return l("cli.ui.alias_of_rename_bare_name","Alias of /rename; bare /name shows the current name")}},{command:"/plan",get description(){return l("cli.ui.enter_plan_mode_plan_task","Enter plan mode; /plan <task> plans that task")}},{command:"/plan",get description(){return l("cli.ui.toggle_plan_mode_read_only","Toggle plan mode (read-only: the agent proposes a step-by-step plan, then asks to execute)")}},{command:"/mode",get description(){return l("cli.ui.show_or_switch_the_permission","Show or switch the permission mode \u2014 /mode [default|accept-edits|plan]")}},{command:"/mode:default",get description(){return l("cli.ui.switch_to_default_mode_prompt","Switch to default mode (prompt before edits/commands)")}},{command:"/mode:accept-edits",get description(){return l("cli.ui.switch_to_accept_edits_mode","Switch to accept edits mode (accept edits automatically)")}},{command:"/mode:plan",get description(){return l("cli.ui.switch_to_plan_mode_read","Switch to plan mode (read-only, no side effects)")}},{command:"/plans",get description(){return l("cli.ui.browse_review_and_annotate_saved","Browse, review, and annotate saved plans \u2014 /plans [name]")}},{command:"/plan-review",get description(){return l("cli.ui.review_this_session_s_latest","Review this session's latest plan")}},{command:"/paste",get description(){return l("cli.ui.attach_the_clipboard_image_to","Attach the clipboard image to your next message (or press Ctrl+V)")}},{command:"/image",get description(){return l("cli.ui.attach_an_image_file_to","Attach an image file to your next message \u2014 /image <path> (or use @file.png)")}},{command:"/pr-comments",get description(){return l("cli.ui.fetch_all_pr_comments_for","Fetch all PR comments for current branch")}},{command:"/reload",get description(){return l("cli.ui.restart_command_code_and_resume","Restart "+_.name+" and resume this session")}},{command:"/rename",get description(){return l("cli.ui.rename_the_current_session","Rename the current session")}},{command:"/resume",get description(){return l("cli.ui.resume_a_past_conversation","Resume a past conversation")}},{command:"/sessions",get description(){return l("cli.ui.resume_a_past_conversation_alias","Resume a past conversation (alias of /resume)")}},{command:"/review",get description(){return l("cli.ui.review_a_pull_request_optional","Review a pull request (optional PR number)")}},{command:"/rewind",get description(){return l("cli.ui.restore_to_a_previous_checkpoint","Restore to a previous checkpoint (Press Esc twice)")}},{command:"/tree",get description(){return l("cli.ui.browse_the_session_tree_and","Browse the session tree and jump to any point in it")}},{command:"/share",get description(){return l("cli.ui.share_as_a_github_gist","Share as a GitHub gist \u2014 /share gist [html|jsonl|md]")}},{command:"/skills",get description(){return l("cli.ui.browse_and_open_agent_skills","Browse and open agent skills")}},{command:"/status",get description(){return l("cli.ui.show_comprehensive_environment_status","Show comprehensive environment status")}},{command:"/statusline",get description(){return l("cli.ui.configure_command_code_s_statusline","Configure "+_.name+"'s statusline UI")}},{command:"/taste",get description(){return l("cli.ui.manage_taste_learning_and_usage","Manage Taste learning and usage")}},{command:"/terminal-setup",get description(){return l("cli.ui.setup_vscode_keybindings","Setup VSCode keybindings")}},{command:"/unshare",get description(){return l("cli.ui.stop_sharing_conversation","Stop sharing conversation")}},{command:"/update",get description(){return l("cli.ui.update_command_code_to_the","Update "+_.name+" to the latest version")}},{command:"/usage",get description(){return l("cli.ui.display_credits_plan_and_usage","Display plan allowance (requests and dollars) and usage")}},{command:"/upgrade",get description(){return l("cli.ui.open_billing_page_to_upgrade","Open billing page to upgrade your plan")}},{command:"/extra",get description(){return l("cli.ui.buy_extra_usage_at_api","Buy extra usage at API cost, zero markup")}},{command:"/trace",get description(){return l("cli.ui.copy_the_current_trace_id","Copy the current trace id; required for support debugging")}},{command:"/session-file",get description(){return l("cli.ui.show_the_current_session_id","Show the current session id and session file path")}},{command:"/copy",get description(){return l("cli.ui.copy_the_last_response_to","Copy the last response to the clipboard")}},{command:"/export",get description(){return l("cli.ui.export_session_export_html_jsonl","Export session \u2014 /export [html|jsonl|md] or a file path")}},{command:"/changelog",get description(){return l("cli.ui.see_what_s_new_in","See what's new in "+_.name)}},{command:"/hotkeys",get description(){return l("cli.ui.show_all_keyboard_shortcuts","Show all keyboard shortcuts")}},{command:"/shortcuts",get description(){return l("cli.ui.show_all_keyboard_shortcuts","Show all keyboard shortcuts")}},{command:"/todos",get description(){return l("cli.ui.manage_the_session_todo_list","Manage the session todo list \u2014 c completes an item, x removes it, a completes all")}},{command:"/rc",get description(){return l("cli.ui.remote_control_this_session_from","Remote-control this session from Telegram or Discord")}},{command:"/btw",get description(){return l("cli.ui.ask_a_quick_side_question","Ask a quick side question mid-turn")}}],Yl=qn.map(e=>e.command);function Ge(e){if(!e.startsWith("/"))return{showMenu:!1,query:""};let t=e.slice(1);return/[\s/]/.test(t)?{showMenu:!1,query:""}:{showMenu:!0,query:t}}function lt(e){let t=e.trim().toLowerCase();return t?qn.map(n=>{let o=n.command.toLowerCase(),s=(n.displayCommand??n.command).toLowerCase(),r=n.description.toLowerCase(),a=0;return o===`/${t}`?a+=200:o.startsWith(`/${t}`)?a+=100:o.includes(t)&&(a+=50),s!==o&&s.includes(t)&&(a+=60),r.includes(t)&&(a+=25),{item:n,score:a}}).filter(n=>n.score>0).sort((n,o)=>o.score-n.score).map(n=>n.item):[...qn]}function ps(){console.log(l("cli.ui.0_command_code_1_2",`
105
105
  {0}{4}{1} {2}v{5}{3}`,i.bold,i.reset,i.dim,i.reset,_.name,xe)),console.log(l("cli.ui.0_ai_agent_that_pairs",`{0}{2}{1}
106
106
  `,i.gray,i.reset,_.tagline)),console.log(l("cli.ui.0_usage_1","{0}Usage:{1}",i.bold,i.reset)),console.log(` ${i.cyan}${_.bin}${i.reset} [options] [prompt]
107
- `),console.log(l("cli.ui.0_slash_commands_1","{0}Slash Commands:{1}",i.bold,i.reset));let t=[{cmd:"/clear, /new",desc:"Start a fresh session with clean context"},{cmd:"/model [id]",desc:"Switch active model (see /models)"},{cmd:"/models",desc:"List all available models on your plan"},{cmd:"/status",desc:"Show current session info, plan, and model"},{cmd:"/context",desc:"Show token usage breakdown in current context"},{cmd:"/skills [add <r>]",desc:"Browse project skills or add a standing rule"},{cmd:"/memory [add <n>]",desc:"Browse project memory or save a learning"},{cmd:"/taste",desc:"Show taste status (loaded skills and memories)"},{cmd:"/usage",desc:"Show monthly credits, requests, and token usage"},{cmd:"/copy",desc:"Copy the last response to clipboard"},{cmd:"/export [format]",desc:"Export session transcript (markdown or jsonl)"},{cmd:"/effort [low|high]",desc:"Set or toggle reasoning effort level"},{cmd:"/init",desc:`Create ${_.dirName}/skills.md and memory.md`},{cmd:"/exit, /quit",desc:"Exit session"}];for(let o of t)console.log(` ${i.cyan}${o.cmd.padEnd(24)}${i.reset} ${i.gray}${o.desc}${i.reset}`);console.log(l("cli.ui.0_keyboard_shortcuts_modes_1",`
107
+ `),console.log(l("cli.ui.0_slash_commands_1","{0}Slash Commands:{1}",i.bold,i.reset));let t=[{cmd:"/clear, /new",desc:"Start a fresh session with clean context"},{cmd:"/model [id]",desc:"Switch active model (see /models)"},{cmd:"/models",desc:"List all available models on your plan"},{cmd:"/status",desc:"Show current session info, plan, and model"},{cmd:"/context",desc:"Show token usage breakdown in current context"},{cmd:"/skills [add <r>]",desc:"Browse project skills or add a standing rule"},{cmd:"/memory [add <n>]",desc:"Browse project memory or save a learning"},{cmd:"/taste",desc:"Show taste status (loaded skills and memories)"},{cmd:"/usage",desc:"Show plan allowance: requests, dollars, and token usage"},{cmd:"/copy",desc:"Copy the last response to clipboard"},{cmd:"/export [format]",desc:"Export session transcript (markdown or jsonl)"},{cmd:"/effort [low|high]",desc:"Set or toggle reasoning effort level"},{cmd:"/init",desc:`Create ${_.dirName}/skills.md and memory.md`},{cmd:"/exit, /quit",desc:"Exit session"}];for(let o of t)console.log(` ${i.cyan}${o.cmd.padEnd(24)}${i.reset} ${i.gray}${o.desc}${i.reset}`);console.log(l("cli.ui.0_keyboard_shortcuts_modes_1",`
108
108
  {0}Keyboard Shortcuts & Modes:{1}`,i.bold,i.reset));let n=[{key:"Tab",desc:"Autocomplete slash commands and @file paths"},{key:"Esc",desc:"Interrupt in-flight model turn"},{key:"\u2191 / \u2193",desc:"Browse prompt history"},{key:"@<path>",desc:"Attach file contents into context (e.g. @src/index.ts)"},{key:"!<cmd>",desc:"Bash mode \u2014 run a shell command directly (e.g. !git status)"},{key:"Ctrl+C",desc:"Cancel current input prompt"},{key:"Ctrl+D",desc:"Exit session when input is empty"}];for(let o of n)console.log(` ${i.accent}${o.key.padEnd(24)}${i.reset} ${i.gray}${o.desc}${i.reset}`);console.log(l("cli.ui.0_1_2_tip_type",`
109
109
  {0}\u276F{1} {2}Tip: Type {3}@{4} followed by a path or {5}/{6} for commands and press Tab to complete.{7}
110
110
  `,i.cyan,i.reset,i.gray,i.cyan,i.reset,i.cyan,i.reset,i.reset))}function Jn(){return[`${i.bold}Available Shortcuts:${i.reset}`,` ${i.accent}!${i.reset} for bash mode ${i.cyan}double tap esc${i.reset} to clear input`,` ${i.accent}/${i.reset} for commands ${i.cyan}\\ + \u21B5 or ctrl + j${i.reset} for newline`,` ${i.accent}@${i.reset} for file paths ${i.cyan}ctrl + v${i.reset} to paste image`,` ${i.accent}Tab${i.reset} for autocomplete ${i.cyan}\u2191 / \u2193${i.reset} to browse history`,` ${i.accent}Esc${i.reset} to interrupt agent ${i.cyan}ctrl + c${i.reset} cancel \xB7 ${i.cyan}ctrl + d${i.reset} exit`]}function Gn(){console.log("");for(let e of Jn())console.log(e);console.log("")}async function gs(e){let n=process.platform==="darwin"?"pbcopy":"wl-copy";return new Promise(o=>{try{let s=ms(n,[],{stdio:["pipe","ignore","ignore"]});s.stdin.write(e),s.stdin.end(),s.on("close",r=>{if(r===0)return o(!0);Wn(e).then(o)}),s.on("error",()=>{Wn(e).then(o)})}catch{Wn(e).then(o)}})}function Wn(e){return new Promise(t=>{try{let n=ms("xclip",["-selection","clipboard"],{stdio:["pipe","ignore","ignore"]});n.stdin.write(e),n.stdin.end(),n.on("close",o=>t(o===0)),n.on("error",()=>t(!1))}catch{t(!1)}})}async function fs(e,t=200){let n=[],o=new Set([".git","node_modules","dist",".next",".turbo",".gemini"]);async function s(r){if(!(n.length>=t))try{let a=await ai.readdir(r,{withFileTypes:!0});for(let c of a){if(n.length>=t)break;if(o.has(c.name))continue;let d=as.join(r,c.name),u=as.relative(e,d);c.isDirectory()?(n.push(u+"/"),await s(d)):n.push(u)}}catch{}}return await s(e),n}var Ae=[];async function Kn(){let{execFile:e}=await import("child_process"),t=await import("fs/promises"),o=`${(await import("os")).tmpdir()}/forge-paste-${Date.now()}.png`,s=(r,a)=>new Promise(c=>e(r,a,{encoding:"buffer",maxBuffer:32*1024*1024},(d,u)=>c(d?null:u)));try{if(process.platform==="darwin"){if(!await new Promise(c=>e("osascript",["-e",`set f to open for access POSIX file "${o}" with write permission`,"-e","set eof f to 0","-e","write (the clipboard as \xABclass PNGf\xBB) to f","-e","close access f"],d=>c(!d))))return await t.rm(o,{force:!0}),null}else{let a=await s("wl-paste",["--type","image/png"])??await s("xclip",["-selection","clipboard","-t","image/png","-o"]);if(!a||a.length<8)return null;await t.writeFile(o,a)}let r=await t.readFile(o).then(a=>a.subarray(0,4)).catch(()=>null);return!r||r[0]!==137||r[1]!==80?(await t.rm(o,{force:!0}),null):o}catch{return null}}var hs=e=>e.replace(/https?:\/\/[^\s"'<>]+/gi,"server").trim();function je(e,t){if(e instanceof Me){let o=e.reason||"network error",s="Unable to connect to the server.";return/timeout/i.test(o)?s="Connection timed out.":/ENOTFOUND|EAI_AGAIN/i.test(o)?s="DNS resolution failed. Please check your internet connection.":/ECONNREFUSED/i.test(o)&&(s="Server connection refused or unreachable."),`Network error: ${s} (${o})
@@ -119,11 +119,10 @@ Open {0}
119
119
  and confirm code: {1}
120
120
  `,e.verificationUrl,e.userCode)),yi(e.verificationUrl);let t=Date.now()+e.expiresIn*1e3;for(;Date.now()<t;){await new Promise(o=>setTimeout(o,e.interval*1e3));let n=await X("/v1/auth/device/token",{method:"POST",auth:!1,body:JSON.stringify({deviceCode:e.deviceCode})}).catch(o=>{throw o});if(n.status==="approved"){await ze({token:n.apiKey});let o=await X("/v1/me");return console.log(l("cli.commands.logged_in_as_0_1","Logged in as {0} ({1} plan).",o.email,o.plan)),o}}throw new Error(l("cli.commands.login_timed_out","login timed out"))}async function on(){await ze({token:void 0}),console.log(l("cli.commands.logged_out","Logged out."))}async function sn(e){let t=await oe();if(e){await ze({defaultModel:e}),console.log(l("cli.commands.default_model_set_to_0","Default model set to: {0}",e));return}let n=await X("/v1/models");console.log(l("cli.commands.models_on_your_0_plan","Models on your {0} plan:",n.plan));let o=t.defaultModel||n.default;for(let s of n.data){let r=s.id===o,c=s.id===n.default?" [default]":"";console.log(l("cli.commands.0_1_2_x_3","{0} {1} x{2} credits/token {3}",r?"*":" ",(s.id+c).padEnd(32),s.multiplier,s.vision?"[images]":""))}n.default&&console.log(`
121
121
  Server default: ${n.default}`),n.data.some(s=>s.vision)&&console.log(l("cli.commands.images_can_read_images_attach",`
122
- [images] = can read images (attach with @file.png, drag a file in, or Ctrl+V)`)),n.data.length||console.log(l("cli.commands.no_models_available_the_server","No models are available for your account right now."))}async function rn(){let e=await X("/v1/usage"),t=r=>r.toLocaleString(),n=(e.promptTokens??0)+(e.completionTokens??0),o=en(n);console.log(l("cli.commands.plan_0_credits_1_of",`Plan: {0}
123
- Credits: {1} of {2} used this month
124
- Remaining: {3}
125
- Requests: {4} Tokens: {5}`,e.plan,t(e.usedCredits),e.monthlyOff?"no cap":t(e.limitCredits),e.monthlyOff?"unlimited":t(e.remainingCredits),e.requests,o));let s=r=>r?`${t(r.usedCredits)} / ${r.limitCredits?t(r.limitCredits):"no cap"}`:"";e.windows&&console.log(`5-hour: ${s(e.windows.fiveHour)}
126
- Weekly: ${s(e.windows.weekly)}`)}async function an(){let e=await Nn(process.cwd());for(let t of[st(process.cwd()),yt(process.cwd())])console.log(`${e.includes(t)?"created":"exists "} ${xt.relative(process.cwd(),t)}`);console.log(l("cli.commands.add_a_rule_0_skills",`
122
+ [images] = can read images (attach with @file.png, drag a file in, or Ctrl+V)`)),n.data.length||console.log(l("cli.commands.no_models_available_the_server","No models are available for your account right now."))}async function rn(){let e=await X("/v1/usage"),t=c=>c.toLocaleString(),n=(e.promptTokens??0)+(e.completionTokens??0),o=en(n),s=!!e.monthlyOff,r=e.estimatedRequests??0,a=e.virtualCreditsUsd??0;console.log(l("cli.commands.plan_usage",`Plan: {0}
123
+ Requests: {1} of {2} used
124
+ Dollars: {3} of {4} used
125
+ Tokens: {5}`,e.plan,t(e.requests),s||!r?"no cap":t(r),`$${(e.usedUsd??0).toFixed(2)}`,s||!a?"no cap":`$${a.toFixed(2)}`,o))}async function an(){let e=await Nn(process.cwd());for(let t of[st(process.cwd()),yt(process.cwd())])console.log(`${e.includes(t)?"created":"exists "} ${xt.relative(process.cwd(),t)}`);console.log(l("cli.commands.add_a_rule_0_skills",`
127
126
  Add a rule: {0} skills add "Use pnpm, not npm"`,_.bin))}async function ws(){let e=process.cwd(),[t,n]=[await qe(e),await Pe(e)];t.length?(console.log(l("cli.commands.skills_0_applied_to_every","Skills ({0}) \u2014 applied to every run:",xt.relative(e,st(e)))),t.forEach((o,s)=>console.log(` ${s+1}. ${o}`))):console.log(l("cli.commands.no_skills_yet_add_one",'No skills yet. Add one: {0} skills add "Prefer pnpm"',_.bin)),console.log(l("cli.commands.memory_notes_0_1",`
128
127
  Memory notes: {0} ({1})`,n.length,xt.relative(e,yt(e))))}async function ys(e){let t=await rt(process.cwd(),e.join(" "));console.log(t.added?`Added skill: ${t.skill}
129
128
  It will be used on the next run.`:`Already a skill: ${t.skill}`)}var bi=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48);async function bs(e,t){let n=process.cwd(),[o,s]=[await qe(n),await Pe(n)];if(!o.length&&!s.length)throw new Error(l("cli.commands.nothing_to_push_0_skills",'nothing to push: {0}/skills.md and memory.md have no bullets. Run `{1} skills add "..."` first.',_.dirName,_.bin));let r=await X("/v1/taste",{method:"POST",body:JSON.stringify({name:bi(e??xt.basename(n)),description:t.description??"",skills:o,memory:s,isPublic:!t.private})});console.log(l("cli.commands.0_1_2_skill_s","{0} {1} ({2} skill(s), {3} memory note(s), {4}).",r.created?"Published":"Updated",r.slug,r.rules,r.memoryNotes,r.isPublic?"public":"private")),console.log(l("cli.commands.teammates_can_run_0_taste","Teammates can run: {0} taste pull {1}",_.bin,r.slug))}async function xs(e){let t=process.cwd();if(!/^[\w.-]+\/[\w.-]+$/.test(e))throw new Error(l("cli.commands.expected_namespace_name_e_g","expected <namespace>/<name>, e.g. {0} taste pull acme/frontend",_.bin));let n=await X(`/v1/taste/${e}`);await Nn(t);let o=0,s=0;for(let a of n.skills)(await rt(t,a)).added&&(o++,console.log(l("cli.commands.skill_0"," + skill: {0}",a)));let r=new Set((await Pe(t)).map(Ce));for(let a of n.memory)r.has(Ce(a))||(await wt(t,a),s++,console.log(l("cli.commands.memory_0"," + memory: {0}",a)));console.log(l("cli.commands.pulled_0_1_new_skill","Pulled {0}: {1} new skill(s), {2} new memory note(s) ({3} skill(s) already present).",n.slug,o,s,n.rules-o))}async function ks(e){let t=await X(`/v1/taste${e?`?q=${encodeURIComponent(e)}`:""}`,{auth:!1});if(!t.data.length)return console.log(l("cli.commands.no_taste_packages_found","No taste packages found."));for(let n of t.data)console.log(l("cli.commands.0_1_rules_2_pulls","{0} {1} rules {2} pulls {3}",n.slug.padEnd(36),String(n.rules).padStart(3),String(n.downloads).padStart(5),n.description))}async function $s(){let e=process.cwd(),t=await bt(e,Ne.homedir()),n=Object.keys(t.servers);if(!n.length)return console.log(l("cli.commands.no_mcp_servers_configured_add","No MCP servers configured. Add one: {0} mcp add fs npx -y @modelcontextprotocol/server-filesystem .",_.bin));t.untrusted.length&&console.log(l("cli.commands.not_started_untrusted_project_servers",`Not started (untrusted project servers: {0}). Review {1}/mcp.json, then run: {2} mcp trust
@@ -331,4 +330,4 @@ ${i.bold}Config:${i.reset}
331
330
 
332
331
  <stdin>
333
332
  ${t}
334
- </stdin>`:t}:e}Bs(ee).action(H(async e=>eo(await Oi(Ws(e)))));Bs(ee.command("chat").description("interactive session in the current directory")).action(H(async e=>eo(Ws(e))));ee.command("doctor").description("check your environment (node, git, login, MCP, hooks)").action(H(ln));ee.command("login").description("log in via browser").action(H(nn));ee.command("logout").description("remove the stored token").action(H(on));ee.command("models").description("list available models or set default").argument("[model]","model id to set as default").action(H(async e=>sn(e)));ee.command("usage").description("show remaining credits").action(H(rn));ee.command("init").description(`create ${_.dirName}/skills.md and memory.md`).action(H(an));var qs=ee.command("skills").description(`project skills (${_.dirName}/skills.md) applied to every run`);qs.command("list").description("show current skills").action(H(ws));qs.command("add").description('add a rule, e.g. skills add "Prefer pnpm"').argument("<text...>").action(H(async e=>ys(e)));var to=ee.command("taste").description("share skills and memory with your team");to.command("push").description("publish this project's skills and memory").argument("[name]","package name (default: folder name)").option("--private","only you can pull it").option("-d, --description <text>","short description").action(H(async(e,t)=>bs(e,t)));to.command("pull").description("merge a package into this project").argument("<package>","namespace/name").action(H(async e=>xs(e)));to.command("list").description("browse public packages").argument("[query]").action(H(async e=>ks(e)));var gn=ee.command("mcp").description("MCP servers whose tools the agent can use");gn.command("list").description("connect and list tools").action(H($s));gn.command("add").description("add a stdio command or HTTP URL").argument("<name>").argument("<command...>").action(H(async(e,t)=>vs(e,t)));gn.command("remove").description("remove a server").argument("<name>").action(H(async e=>Ss(e)));gn.command("trust").description("approve this project's MCP servers after reviewing them").action(H(Ts));var Hs=ee.command("hooks").description(`PreToolUse/PostToolUse hook commands (${_.dirName}/hooks.json)`);Hs.command("list").description("show effective hooks").action(H(Es));Hs.command("trust").description("approve this project's hooks after reviewing them").action(H(Ms));ee.parseAsync();
333
+ </stdin>`:t}:e}Bs(ee).action(H(async e=>eo(await Oi(Ws(e)))));Bs(ee.command("chat").description("interactive session in the current directory")).action(H(async e=>eo(Ws(e))));ee.command("doctor").description("check your environment (node, git, login, MCP, hooks)").action(H(ln));ee.command("login").description("log in via browser").action(H(nn));ee.command("logout").description("remove the stored token").action(H(on));ee.command("models").description("list available models or set default").argument("[model]","model id to set as default").action(H(async e=>sn(e)));ee.command("usage").description("show remaining requests and dollars").action(H(rn));ee.command("init").description(`create ${_.dirName}/skills.md and memory.md`).action(H(an));var qs=ee.command("skills").description(`project skills (${_.dirName}/skills.md) applied to every run`);qs.command("list").description("show current skills").action(H(ws));qs.command("add").description('add a rule, e.g. skills add "Prefer pnpm"').argument("<text...>").action(H(async e=>ys(e)));var to=ee.command("taste").description("share skills and memory with your team");to.command("push").description("publish this project's skills and memory").argument("[name]","package name (default: folder name)").option("--private","only you can pull it").option("-d, --description <text>","short description").action(H(async(e,t)=>bs(e,t)));to.command("pull").description("merge a package into this project").argument("<package>","namespace/name").action(H(async e=>xs(e)));to.command("list").description("browse public packages").argument("[query]").action(H(async e=>ks(e)));var gn=ee.command("mcp").description("MCP servers whose tools the agent can use");gn.command("list").description("connect and list tools").action(H($s));gn.command("add").description("add a stdio command or HTTP URL").argument("<name>").argument("<command...>").action(H(async(e,t)=>vs(e,t)));gn.command("remove").description("remove a server").argument("<name>").action(H(async e=>Ss(e)));gn.command("trust").description("approve this project's MCP servers after reviewing them").action(H(Ts));var Hs=ee.command("hooks").description(`PreToolUse/PostToolUse hook commands (${_.dirName}/hooks.json)`);Hs.command("list").description("show effective hooks").action(H(Es));Hs.command("trust").description("approve this project's hooks after reviewing them").action(H(Ms));ee.parseAsync();
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@scopeide/cli",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Scope — the AI coding agent for your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
7
7
  "homepage": "https://scopeide.com",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/mdhedayet/forgecode.git",
11
- "directory": "apps/cli"
10
+ "url": "git+https://github.com/mdhedayet/scope-releases.git"
12
11
  },
13
12
  "bugs": {
13
+ "url": "https://github.com/mdhedayet/scope-releases/issues",
14
14
  "email": "support@scopeide.com"
15
15
  },
16
16
  "keywords": [
@@ -25,7 +25,8 @@
25
25
  },
26
26
  "files": [
27
27
  "bin/scope.js",
28
- "dist"
28
+ "dist",
29
+ "README.md"
29
30
  ],
30
31
  "engines": {
31
32
  "node": ">=22"