@scopeide/cli 0.1.4 → 0.1.5

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import Ls from"dns";import Fs from"net";import{createRequire as Ci}from"module";import{Command as Pi,Option as Ai}from"commander";var h={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.0"};var L={maxSteps:100,hardMaxSteps:500,maxToolOutputBytes:12e3,maxContextTokens:32e3,warnContextTokens:24e3,maxRunTokens:0,charsPerToken:4};var Ct={strings:{}},Ys=["maxSteps","hardMaxSteps","maxToolOutputBytes","maxContextTokens","warnContextTokens","maxRunTokens"];function hn(t){if(!t)return;let e=L;for(let n of Ys){let o=t.limits?.[n];typeof o=="number"&&Number.isFinite(o)&&o>=0&&(e[n]=o)}if(t.strings&&typeof t.strings=="object"){Ct.strings={};for(let[n,o]of Object.entries(t.strings))/^(cli|agent|desktop)\./.test(n)&&typeof o=="string"&&(Ct.strings[n]=o.slice(0,4e3))}}function l(t,e,...n){let o=Ct.strings[t]??e;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 Pe from"os";import wt from"path";import{execFile as is,spawn as si}from"child_process";import T from"fs/promises";import nr from"fs";import fo from"os";import or from"crypto";import M from"path";import{spawn as sr}from"child_process";import{z as N}from"zod";import{zodToJsonSchema as rr}from"zod-to-json-schema";import Ge from"path";function pe(t,e){let n=Ge.resolve(t,e),o=Ge.relative(t,n),s=o===""||!o.startsWith("..")&&!Ge.isAbsolute(o);return{abs:n,inside:s}}function Oe(t,e){let n=Ge.posix.resolve(t,e),o=Ge.posix.relative(t,n),s=o===""||!o.startsWith("..")&&!Ge.posix.isAbsolute(o);return{abs:n,inside:s}}import Se from"path";function ce(t,e){if(t.length<=e)return t;let n=Math.floor(e*.6),o=e-n;return`${t.slice(0,n)}
1
+ import Ls from"dns";import Fs from"net";import{createRequire as Ci}from"module";import{Command as Pi,Option as Ai}from"commander";var h={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.1"};var L={maxSteps:100,hardMaxSteps:500,maxToolOutputBytes:12e3,maxContextTokens:32e3,warnContextTokens:24e3,maxRunTokens:0,charsPerToken:4};var Ct={strings:{}},Ys=["maxSteps","hardMaxSteps","maxToolOutputBytes","maxContextTokens","warnContextTokens","maxRunTokens"];function hn(t){if(!t)return;let e=L;for(let n of Ys){let o=t.limits?.[n];typeof o=="number"&&Number.isFinite(o)&&o>=0&&(e[n]=o)}if(t.strings&&typeof t.strings=="object"){Ct.strings={};for(let[n,o]of Object.entries(t.strings))/^(cli|agent|desktop)\./.test(n)&&typeof o=="string"&&(Ct.strings[n]=o.slice(0,4e3))}}function l(t,e,...n){let o=Ct.strings[t]??e;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 Pe from"os";import wt from"path";import{execFile as is,spawn as si}from"child_process";import T from"fs/promises";import nr from"fs";import fo from"os";import or from"crypto";import M from"path";import{spawn as sr}from"child_process";import{z as N}from"zod";import{zodToJsonSchema as rr}from"zod-to-json-schema";import Ge from"path";function pe(t,e){let n=Ge.resolve(t,e),o=Ge.relative(t,n),s=o===""||!o.startsWith("..")&&!Ge.isAbsolute(o);return{abs:n,inside:s}}function Oe(t,e){let n=Ge.posix.resolve(t,e),o=Ge.posix.relative(t,n),s=o===""||!o.startsWith("..")&&!Ge.posix.isAbsolute(o);return{abs:n,inside:s}}import Se from"path";function ce(t,e){if(t.length<=e)return t;let n=Math.floor(e*.6),o=e-n;return`${t.slice(0,n)}
2
2
  \u2026[${t.length-e} chars omitted]\u2026
3
3
  ${t.slice(t.length-o)}`}import _n from"path";var Vs=[[/(^|[\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"]],Xs=/^(\/|\/\*|~|~\/|~\/\*|\$HOME|\$\{HOME\}|\$HOME\/|\$HOME\/\*|\*|\/(usr|etc|bin|sbin|var|lib|opt|home|Users|System|Library|Applications)\/?\*?)$/;function Zs(t){let e=t.trim().split(/\s+/),n=e.findIndex(c=>_n.basename(c.replace(/^["']|["']$/g,""))==="rm");if(n<0)return null;let o=e.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=>Xs.test(c));return a?`recursive delete of "${a}"`:null}function Pt(t,e){for(let[n,o]of Vs)if(n.test(t))return{ok:!1,reason:`blocked: ${o}`};for(let n of t.split(/&&|\|\||[;|\n]/)){let o=Zs(n);if(o)return{ok:!1,reason:`blocked: ${o}`}}if(!e.allowAll){let n=e.posix?_n.posix:_n,o=n.relative(e.root,e.cwd);if(o.startsWith("..")||n.isAbsolute(o))return{ok:!1,reason:"blocked: cwd is outside the project root"}}return{ok:!0}}var Qs=/(KEY|TOKEN|SECRET|PASSWORD|PASSWD|CREDENTIAL)/i;function At(t){let e={};for(let[n,o]of Object.entries(t))Qs.test(n)||n.startsWith("FORGE_")||n==="DATABASE_URL"||(e[n]=o);return e}var er=1e6,wn=(t,e=L.maxToolOutputBytes)=>ce(t,e);function ve(t,e,n){let{abs:o,inside:s}=Oe(t.root,e);if(t.allowAll)return o;if(!s){if(n&&t.allowOutside)return o;throw new Error(l("agent.tools.path_0_is_outside_the",'path "{0}" is outside the project root',e))}if(n&&Se.posix.relative(t.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 uo(t,e,n){let o=await t.stat(e);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>er)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 t.readFile(e);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 tr=(t,e)=>t.slice(0,e).split(`
4
4
  `).length;async function mo(t,e,n){let o=n.remote;switch(t){case"read_file":return wn(await uo(o,ve(n,e.path,!1),e.path));case"write_file":{let s=ve(n,e.path,!0),r=await o.stat(s);if(r?.isDir)throw new Error(l("agent.tools.0_is_a_directory","{0} is a directory",e.path));return await o.writeFile(s,e.content),l("agent.tools.wrote_file","{0} {1} ({2} chars)",r?"overwrote":"created",e.path,e.content.length)}case"edit_file":{let s=ve(n,e.path,!0),r=await uo(o,s,e.path),{old_string:a,new_string:c}=e;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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scopeide/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Scope — the AI coding agent for your terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",