@fugood/bricks-cli 2.25.0-beta.62 → 2.25.0-beta.64
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/lib/1010.js +1 -0
- package/lib/1178.js +1 -0
- package/lib/1215.js +1 -0
- package/lib/1708.js +9 -0
- package/lib/1759.js +1 -0
- package/lib/1936.js +1 -0
- package/lib/2151.js +1 -0
- package/lib/{209.js → 2209.js} +3 -3
- package/lib/2247.js +1 -0
- package/lib/2486.js +1 -0
- package/lib/2557.js +1 -0
- package/lib/{223.js → 3223.js} +1 -1
- package/lib/3332.js +13 -0
- package/lib/3690.js +1 -0
- package/lib/3774.js +44 -0
- package/lib/3976.js +14 -0
- package/lib/4305.js +1 -0
- package/lib/4456.js +3 -0
- package/lib/{192.js → 4479.js} +4 -4
- package/lib/4530.js +22 -0
- package/lib/4642.js +9 -0
- package/lib/4685.js +1202 -0
- package/lib/5212.js +1 -0
- package/lib/{658.js → 5658.js} +1 -1
- package/lib/5785.js +1 -0
- package/lib/6194.js +3 -0
- package/lib/6370.js +1 -0
- package/lib/6645.js +1 -0
- package/lib/6818.js +1 -0
- package/lib/7111.js +2 -0
- package/lib/7456.js +1 -0
- package/lib/7511.js +1 -0
- package/lib/7574.js +1 -0
- package/lib/7648.js +1 -0
- package/lib/8026.js +1 -0
- package/lib/{117.js → 8117.js} +2 -2
- package/lib/8166.js +1 -0
- package/lib/853.js +1 -0
- package/lib/915.js +4 -4
- package/lib/9320.js +3 -0
- package/lib/{387.js → 9387.js} +1 -1
- package/lib/9405.js +1 -0
- package/lib/9430.js +1 -0
- package/lib/{583.js → 9583.js} +1 -1
- package/lib/9663.js +1 -0
- package/lib/{866.js → 9866.js} +1 -1
- package/lib/9940.js +19 -0
- package/lib/index.js +17 -17
- package/lib/simulator-host-bridge.cjs +1 -0
- package/lib/simulator-main.mjs +3 -3
- package/package.json +5 -5
- package/lib/10.js +0 -1
- package/lib/111.js +0 -2
- package/lib/166.js +0 -1
- package/lib/178.js +0 -1
- package/lib/212.js +0 -1
- package/lib/215.js +0 -1
- package/lib/247.js +0 -1
- package/lib/274.js +0 -16
- package/lib/305.js +0 -1
- package/lib/306.js +0 -1
- package/lib/320.js +0 -3
- package/lib/332.js +0 -13
- package/lib/358.js +0 -1
- package/lib/370.js +0 -1
- package/lib/405.js +0 -1
- package/lib/430.js +0 -1
- package/lib/456.js +0 -3
- package/lib/479.js +0 -1231
- package/lib/486.js +0 -1
- package/lib/511.js +0 -1
- package/lib/557.js +0 -1
- package/lib/574.js +0 -1
- package/lib/645.js +0 -1
- package/lib/648.js +0 -1
- package/lib/663.js +0 -1
- package/lib/690.js +0 -1
- package/lib/708.js +0 -9
- package/lib/75.js +0 -1
- package/lib/759.js +0 -1
- package/lib/785.js +0 -1
- package/lib/818.js +0 -1
- package/lib/917.js +0 -1
- package/lib/936.js +0 -1
- package/lib/940.js +0 -19
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const path=require("node:path"),AUTOMATION_SCREENSHOT_PROJECT_DIR=path.join(".bricks","automation_screenshots");function resolveAutomationScreenshotPath(t,e=""){let o=path.resolve(t,AUTOMATION_SCREENSHOT_PROJECT_DIR),r=String(e||AUTOMATION_SCREENSHOT_PROJECT_DIR),n=path.resolve(t,r),s=n===o||n.startsWith(`${o}${path.sep}`)?n:path.resolve(o,r);if(s!==o&&!s.startsWith(`${o}${path.sep}`))throw Error("Automation screenshot path must stay inside the project screenshot directory.");return s}function normalizeAutomationScreenshotEncoding(t){return"base64"===t?"base64":"utf8"}module.exports={AUTOMATION_SCREENSHOT_PROJECT_DIR,resolveAutomationScreenshotPath,normalizeAutomationScreenshotEncoding};
|
package/lib/simulator-main.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{app as e,BrowserWindow as t,ipcMain as o}from"electron";import{mkdir as s,readdir as r,readFile as n,rm as a,writeFile as i}from"fs/promises";import{watchFile as l}from"fs";import{createServer as c}from"http";import p from"node:path";import{fileURLToPath as d}from"node:url";import{parseArgs as u}from"util";import*as w from"@toon-format/toon";for(let e of[process.stdout,process.stderr])e.on("error",e=>{if("EPIPE"!==e.code)throw e});let{values:
|
|
1
|
+
import{app as e,BrowserWindow as t,ipcMain as o}from"electron";import{mkdir as s,readdir as r,readFile as n,rm as a,writeFile as i}from"fs/promises";import{watchFile as l}from"fs";import{createServer as c}from"http";import p from"node:path";import{fileURLToPath as d}from"node:url";import{parseArgs as u}from"util";import*as w from"@toon-format/toon";import h from"./simulator-host-bridge.cjs";let{resolveAutomationScreenshotPath:m,normalizeAutomationScreenshotEncoding:f}=h;for(let e of[process.stdout,process.stderr])e.on("error",e=>{if("EPIPE"!==e.code)throw e});let{values:g}=u({args:process.argv,options:{"clear-cache":{type:"boolean"},"take-screenshot":{type:"string"},"show-menu":{type:"boolean"},"test-id":{type:"string"},"test-title-like":{type:"string"},"no-keep-open":{type:"boolean"},"cdp-port":{type:"string"}},strict:!0,allowPositionals:!0}),y=process.cwd(),S=p.dirname(d(import.meta.url)),b=Object.freeze({allowedInsecureHosts:[]}),v=(e={})=>{let t=e&&"object"==typeof e&&!Array.isArray(e)?e:{};return{allowedInsecureHosts:(Array.isArray(t.allowedInsecureHosts)?t.allowedInsecureHosts:b.allowedInsecureHosts).filter(e=>"string"==typeof e).map(e=>e.trim().toLowerCase()).filter(Boolean)}},C=e=>{try{let t=new URL(String(e||""));if("http:"!==t.protocol&&"ws:"!==t.protocol)return null;return t.host.toLowerCase()}catch{return null}},I=async()=>{try{return v(JSON.parse(await n(`${y}/simulator.json`,"utf8")))}catch{return v()}},k=null;try{g["take-screenshot"]&&((k=JSON.parse(g["take-screenshot"])).path||(k.path=`${y}/screenshot.jpg`),k.width||(k.width=1280),k.height||(k.height=768),k.delay||(k.delay=1e3))}catch(e){console.error("Invalid take-screenshot config",e),process.exit(1)}let J=JSON.parse(await n(`${y}/.bricks/build/application-config.json`)),O=await I(),T=g["test-id"]||null;if(!T&&g["test-title-like"]){let e=g["test-title-like"].toLowerCase();for(let t of Object.values(J.automation_map||{})){let o=Object.entries(t.map||{}).find(([,t])=>t.title?.toLowerCase().includes(e));if(o){[T]=o;break}}if(!T)throw Error(`No automation found matching title: ${g["test-title-like"]}`)}let j=g["no-keep-open"]??!1,N=process.env.BRICKS_STAGE||"production",L={production:"https://control.bricks.tools/applicationPreview.html",beta:"https://control-beta.bricks.tools/applicationPreview.html",development:"http://localhost:3006/dev-applicationPreview.html"}[N];if(!L)throw Error(`Invalid BRICKS_STAGE: ${N}`);O=v({...O,allowedInsecureHosts:[...O.allowedInsecureHosts,C(L)].filter(Boolean)});let R=async(e,t)=>{let{WebSocketServer:o}=await import("ws"),s=new Set;e.webContents.on("console-message",(e,...t)=>{let o="object"==typeof t[0]?t[0].message:t[1];if(o?.startsWith("[CDP]"))try{let e=JSON.parse(o.slice(5)),t="cdp-response"===e.type?{id:e.id,result:e.result,error:e.error}:{method:e.method,params:e.params};e.sessionId&&(t.sessionId=e.sessionId);let r=JSON.stringify(t);for(let e of s)1===e.readyState&&e.send(r)}catch{}});let r=e=>new Promise(o=>{let s=c();s.once("error",()=>{e<t+100?o(r(e+1)):o(null)}),s.listen(e,()=>s.close(()=>o(e)))}),n=await r(t);if(!n)return void console.warn(`CDP server: no available port in range ${t}-${t+99}`);let a=c((e,t)=>{if("/json/list"===e.url||"/json"===e.url){t.writeHead(200,{"Content-Type":"application/json"}),t.end(JSON.stringify([{description:"BRICKS Simulator",id:"bricks-simulator",title:"BRICKS Simulator",type:"page",url:L,webSocketDebuggerUrl:`ws://localhost:${n}/ws`}]));return}if("/json/version"===e.url){t.writeHead(200,{"Content-Type":"application/json"}),t.end(JSON.stringify({Browser:"BRICKS Simulator","Protocol-Version":"1.3"}));return}if("/devtools/info"===e.url){t.writeHead(200,{"Content-Type":"application/json"}),t.end(JSON.stringify({name:"BRICKS Simulator",port:n,protocols:["cdp"],hasPasscode:!1}));return}t.writeHead(404),t.end()});new o({server:a,path:"/ws"}).on("connection",t=>{s.add(t),e.webContents.executeJavaScript(`
|
|
2
2
|
if (!window.__cdpRelayInstalled) {
|
|
3
3
|
window.__cdpRelayInstalled = true
|
|
4
4
|
window.addEventListener('message', (evt) => {
|
|
@@ -9,7 +9,7 @@ import{app as e,BrowserWindow as t,ipcMain as o}from"electron";import{mkdir as s
|
|
|
9
9
|
} catch {}
|
|
10
10
|
})
|
|
11
11
|
}
|
|
12
|
-
`),t.on("message",t=>{try{let o=JSON.parse(t.toString()),s=JSON.stringify({type:"cdp-request",id:o.id,method:o.method,params:o.params||{},sessionId:o.sessionId});e.webContents.executeJavaScript(`window.postMessage(${JSON.stringify(s)})`)}catch{}}),t.on("close",()=>s.delete(t))}),a.listen(n,()=>{console.log(`CDP server: ws://localhost:${n}/ws`),console.log(`Inspect: devtools://devtools/bundled/inspector.html?ws=localhost:${n}/ws`)})};e.on("ready",()=>{o.handle("bricks-automation-screenshots:exists",async(e,t)=>{try{return await n(
|
|
12
|
+
`),t.on("message",t=>{try{let o=JSON.parse(t.toString()),s=JSON.stringify({type:"cdp-request",id:o.id,method:o.method,params:o.params||{},sessionId:o.sessionId});e.webContents.executeJavaScript(`window.postMessage(${JSON.stringify(s)})`)}catch{}}),t.on("close",()=>s.delete(t))}),a.listen(n,()=>{console.log(`CDP server: ws://localhost:${n}/ws`),console.log(`Inspect: devtools://devtools/bundled/inspector.html?ws=localhost:${n}/ws`)})};e.on("ready",()=>{o.handle("bricks-automation-screenshots:exists",async(e,t)=>{try{return await n(((e="")=>m(y,e))(t)),!0}catch{return!1}}),o.handle("bricks-automation-screenshots:readdir",async(e,t)=>{try{return await r(((e="")=>m(y,e))(t))}catch{return[]}}),o.handle("bricks-automation-screenshots:mkdir",async(e,t)=>{await s(((e="")=>m(y,e))(t),{recursive:!0})}),o.handle("bricks-automation-screenshots:unlink",async(e,t)=>{await a(((e="")=>m(y,e))(t),{recursive:!0,force:!0})}),o.handle("bricks-automation-screenshots:read-file",async(e,t,o)=>n(((e="")=>m(y,e))(t),f(o))),o.handle("bricks-automation-screenshots:write-file",async(e,t,o,r)=>{let n=((e="")=>m(y,e))(t);await s(p.dirname(n),{recursive:!0}),await i(n,o,f(r))});let c=!0;k&&!k.noHeadless&&(c=!1);let d=new t({width:k?.width||1280,height:k?.height||768,frame:!k,show:c,webPreferences:{preload:p.join(S,"simulator-preload.cjs"),contextIsolation:!0,nodeIntegration:!1}});d.setBackgroundColor("#333"),d.webContents.session.webRequest.onBeforeRequest({urls:["http://*/*","ws://*/*"]},(e,t)=>{t({cancel:((e,t={})=>{let o=v(t);try{let t=new URL(String(e||""));if("http:"!==t.protocol&&"ws:"!==t.protocol)return!1;let s=t.host.toLowerCase(),r=t.hostname.toLowerCase().replace(/^\[|\]$/g,"");return!o.allowedInsecureHosts.some(e=>{let o=(e=>{let t=String(e||"").trim().toLowerCase();if(!t)return null;if(!/^[a-z][a-z0-9+.-]*:\/\//i.test(t))return{host:t,protocol:null};try{let e=new URL(t);return{host:e.host.toLowerCase(),protocol:e.protocol}}catch{return null}})(e);return!!o&&(!o.protocol||o.protocol===t.protocol)&&(o.host===s||o.host===r)})}catch{return!1}})(e.url,O)})}),d.loadURL(L);let u=()=>{let t={type:"config",configFile:{_originTitle:"Test",...J,title:Math.random().toString()},workspace:{billing:{lock:{},plan:"free"}},showMenu:g["show-menu"]||!1,testId:T};if(d.webContents.executeJavaScript(`window.postMessage(JSON.stringify(${JSON.stringify(t)}))`),k){let{delay:t,width:o,height:s,path:r}=k;setTimeout(async()=>{let t=!1;console.log("Taking screenshot");try{let e=await d.webContents.capturePage();console.log("Writing screenshot to",r),await i(r,e.resize({width:o,height:s}).toJPEG(75))}catch(e){t=!0,console.error("Screenshot capture/write failed",e)}finally{j&&(console.log("Closing app"),t?e.exit(1):e.quit())}},t)}};d.webContents.once("dom-ready",()=>{u(),T&&d.webContents.executeJavaScript(`
|
|
13
13
|
window.addEventListener('message', (evt) => {
|
|
14
14
|
try {
|
|
15
15
|
const data = JSON.parse(evt.data)
|
|
@@ -18,4 +18,4 @@ import{app as e,BrowserWindow as t,ipcMain as o}from"electron";import{mkdir as s
|
|
|
18
18
|
}
|
|
19
19
|
} catch (e) {}
|
|
20
20
|
})
|
|
21
|
-
`);let e=
|
|
21
|
+
`);let e=g["cdp-port"]?parseInt(g["cdp-port"],10):null;e&&R(d,e)}),T&&d.webContents.on("console-message",(t,...o)=>{let s="object"==typeof o[0]?o[0].message:o[1];if(s?.startsWith("[TEST_RESULT]")){let t=JSON.parse(s.replace("[TEST_RESULT]",""));console.log(`[TEST_RESULT_TOON]${w.encode(t.result)}`),!k&&j&&e.quit()}}),g["clear-cache"]&&(console.log("Clearing cache"),d.webContents.session.clearCache()),d.on("close",()=>e.quit()),l(`${y}/.bricks/build/application-config.json`,{bigint:!1,persistent:!0,interval:1e3},async()=>{console.log("Detected config changed"),J=JSON.parse(await n(`${y}/.bricks/build/application-config.json`));let e=await I();O=v({...e,allowedInsecureHosts:[...e.allowedInsecureHosts,C(L)].filter(Boolean)}),u()}),l(`${y}/simulator.json`,{bigint:!1,persistent:!0,interval:1e3},async()=>{console.log("Detected simulator settings changed");let e=await I();O=v({...e,allowedInsecureHosts:[...e.allowedInsecureHosts,C(L)].filter(Boolean)})})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fugood/bricks-cli",
|
|
3
|
-
"version": "2.25.0-beta.
|
|
3
|
+
"version": "2.25.0-beta.64",
|
|
4
4
|
"description": "BRICKS CLI - Command-line interface for BRICKS Workspace API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bricks",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"@babel/parser": "7.28.5",
|
|
57
57
|
"@babel/traverse": "7.28.5",
|
|
58
58
|
"@babel/types": "7.28.5",
|
|
59
|
-
"@fugood/bricks-config-core": "^2.25.0-beta.
|
|
60
|
-
"@fugood/bricks-core-generated": "^2.25.0-beta.
|
|
59
|
+
"@fugood/bricks-config-core": "^2.25.0-beta.64",
|
|
60
|
+
"@fugood/bricks-core-generated": "^2.25.0-beta.64",
|
|
61
61
|
"@fugood/bricks-system-properties-definition": "^2.24.0",
|
|
62
|
-
"@fugood/property-bank-calc-generated": "^2.25.0-beta.
|
|
62
|
+
"@fugood/property-bank-calc-generated": "^2.25.0-beta.64",
|
|
63
63
|
"@huggingface/gguf": "^0.3.2",
|
|
64
64
|
"@iarna/toml": "^3.0.0",
|
|
65
65
|
"@inquirer/prompts": "^7.0.0",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"engines": {
|
|
91
91
|
"node": ">=18.0.0"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "5ab88b3211de83793a76d6ea97cf9552132eb3bf"
|
|
94
94
|
}
|