@termiq/cli 3.17.10 → 3.17.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/dist/bin.js +2 -2
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
`),s=(i[i.length-1]||"").trim();for(let a of Ss.waiting)if(a.test(s))return"waiting";for(let a of Ss.working)if(a.test(s))return"working";for(let a of Ss.completed)if(a.test(n))return"completed";for(let a of Ss.idle)if(a.test(s))return"idle";return null}detectPrompt(e){let n=this.normalizeBuffer(this.stripAnsi(e)).split(`
|
|
10
10
|
`).slice(-20),s=n.join(`
|
|
11
11
|
`),a=n[n.length-1]||"",c=this.extractNumberedChoices(e);if(c.length>=2)return{type:"numbered-choice",question:this.extractQuestion(s)||"Select an option:",choices:c};let u=[/\[Y\/n\]/i,/\[y\/N\]/i,/\(y\/n\)/i,/\(yes\/no\)/i];for(let m of u)if(m.test(s))return{type:"yes-no",question:this.extractQuestion(s)||"Confirm?"};let d=[/Press Enter to continue/i,/Press Enter/i,/Hit Enter/i,/\[Enter\]/i,/press return/i];for(let m of d)if(m.test(s))return{type:"enter",question:this.extractQuestion(s)||"Press Enter to continue"};let p=[/Press any key/i,/press a key/i];for(let m of p)if(m.test(s))return{type:"any-key",question:this.extractQuestion(s)||"Press any key"};return(a.endsWith("?")||a.endsWith(":"))&&!a.startsWith("/")&&!a.includes("error")&&a.length<100?{type:"free-input",question:a}:null}extractNumberedChoices(e){let t=[],n=this.normalizeBuffer(this.stripAnsi(e)).split(`
|
|
12
|
-
`),s
|
|
13
|
-
`).filter(i=>i.trim());for(let i=t.length-1;i>=Math.max(0,t.length-5);i--){let n=t[i].trim();if(!n
|
|
12
|
+
`),s=/^[\s│┃┊┋┆┇╎╏]*(?:[❯▶▸›●>*]\s*)?(?:(\d+)[.)]\s*|\[(\d+)\]\s*)(.+?)[\s│┃]*$/u;for(let a of n){let c=a.match(s);if(c){let u=c[1]||c[2],d=c[3].trim();if(u&&d&&d.length<100&&!d.includes("error")){let p=t.length+1;parseInt(u)===p&&t.push({key:u,label:d})}}}return t}extractQuestion(e){let t=e.split(`
|
|
13
|
+
`).filter(i=>i.trim());for(let i=t.length-1;i>=Math.max(0,t.length-5);i--){let n=t[i].trim();if(!n||/^[\s│┃]*(?:[❯▶▸›●>*]\s*)?\d+[.)]\s/.test(n)||/^[\s│┃]*\[/.test(n))continue;let s=this.stripAnsi(n).replace(/^[\s│┃┊┋┆┇╎╏]+/u,"").replace(/[\s│┃┊┋┆┇╎╏]+$/u,"");if(s.endsWith("?")||s.endsWith(":"))return s.replace(/\s*\[Y\/n\]\s*$/i,"").replace(/\s*\(y\/n\)\s*$/i,"").replace(/\s*\(yes\/no\)\s*$/i,"").trim()}return null}stripAnsi(e){return e.replace(/\x1b\[[0-9;?]*[a-zA-Z]/g,"").replace(/\x1b\][^\x07]*\x07/g,"").replace(/\x1b[()][AB012]/g,"").replace(/\x1b[=>]/g,"").replace(/\x1b[78DMEHc]/g,"").replace(/[\x00-\x08\x0b\x0c\x0e-\x1f]/g,"")}normalizeBuffer(e){return e.replace(/\r\n/g,`
|
|
14
14
|
`).replace(/\r/g,`
|
|
15
15
|
`).replace(/\n{3,}/g,`
|
|
16
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@termiq/cli",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.11",
|
|
4
4
|
"description": "Run Claude Code, Gemini CLI, or any shell over SSH/CI and control it from your phone — push on done/waiting/error, answer Y/n from the notification. End-to-end encrypted.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"terminal",
|