@barnaby.build/barnaby 0.0.171 → 0.0.233
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 +162 -200
- package/dist/assets/index-B2QCc9UL.js +225 -0
- package/dist/assets/index-DY-L_K7b.css +32 -0
- package/dist/index.html +2 -2
- package/dist-electron/main/index.js +8041 -6745
- package/dist-electron/preload/index.mjs +2 -2
- package/docs/screenshots/barnaby-dark.png +0 -0
- package/docs/screenshots/barnaby-light.png +0 -0
- package/docs/screenshots/barnaby-main.png +0 -0
- package/package.json +27 -11
- package/scripts/apply-exe-icon.mjs +51 -0
- package/scripts/build-dispatch.mjs +40 -0
- package/scripts/electron-builder-after-pack.cjs +27 -0
- package/scripts/generate-license-key.mjs +99 -0
- package/scripts/license-keypair-init.mjs +56 -0
- package/scripts/run-with-version-bump.mjs +80 -0
- package/scripts/sync-icon.mjs +20 -0
- package/dist/assets/index-BGgZBU-P.js +0 -280
- package/dist/assets/index-Cmxmzasv.css +0 -32
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const r=require("electron"),i={connect(e,t){return r.ipcRenderer.invoke("agentorchestrator:connect",e,t)},sendMessage(e,t,n,o,
|
|
1
|
+
"use strict";const r=require("electron"),i={connect(e,t){return r.ipcRenderer.invoke("agentorchestrator:connect",e,t)},sendMessage(e,t,n,o,s,p){return r.ipcRenderer.invoke("agentorchestrator:sendMessageEx",e,{text:t,imagePaths:n??[],priorMessagesForContext:o,interactionMode:s,responseStyle:p})},loadChatHistory(){return r.ipcRenderer.invoke("agentorchestrator:loadChatHistory")},saveChatHistory(e){return r.ipcRenderer.invoke("agentorchestrator:saveChatHistory",e)},saveTranscriptFile(e,t,n){return r.ipcRenderer.invoke("agentorchestrator:saveTranscriptFile",e,t,n)},saveTranscriptDirect(e,t,n){return r.ipcRenderer.invoke("agentorchestrator:saveTranscriptDirect",e,t,n)},loadAppState(){return r.ipcRenderer.invoke("agentorchestrator:loadAppState")},saveAppState(e){return r.ipcRenderer.invoke("agentorchestrator:saveAppState",e)},setWindowTheme(e){return r.ipcRenderer.invoke("agentorchestrator:setWindowTheme",e)},setWindowWorkspaceTitle(e){return r.ipcRenderer.invoke("agentorchestrator:setWindowWorkspaceTitle",e)},notifyRendererReady(){return r.ipcRenderer.invoke("agentorchestrator:rendererReady")},getDiagnosticsInfo(){return r.ipcRenderer.invoke("agentorchestrator:getDiagnosticsInfo")},openRuntimeLog(){return r.ipcRenderer.invoke("agentorchestrator:openRuntimeLog")},openDebugOutputWindow(){return r.ipcRenderer.invoke("agentorchestrator:openDebugOutputWindow")},getDebugLogContent(){return r.ipcRenderer.invoke("agentorchestrator:getDebugLogContent")},onDebugLogAppend(e){const t=(n,o)=>e(o);return r.ipcRenderer.on("barnaby:debug-log-append",t),()=>r.ipcRenderer.removeListener("barnaby:debug-log-append",t)},openDiagnosticsPath(e){return r.ipcRenderer.invoke("agentorchestrator:openDiagnosticsPath",e)},readDiagnosticsFile(e){return r.ipcRenderer.invoke("agentorchestrator:readDiagnosticsFile",e)},writeDiagnosticsFile(e,t){return r.ipcRenderer.invoke("agentorchestrator:writeDiagnosticsFile",e,t)},openExternalUrl(e){return r.ipcRenderer.invoke("agentorchestrator:openExternalUrl",e)},getOrchestratorLicenseKeyState(){return r.ipcRenderer.invoke("agentorchestrator:getOrchestratorLicenseKeyState")},setOrchestratorLicenseKey(e){return r.ipcRenderer.invoke("agentorchestrator:setOrchestratorLicenseKey",e)},repairStartMenuShortcut(){return r.ipcRenderer.invoke("barnaby:repairStartMenuShortcut")},openPluginsFolder(){return r.ipcRenderer.invoke("agentorchestrator:openPluginsFolder")},reloadLocalPlugins(){return r.ipcRenderer.invoke("agentorchestrator:reloadLocalPlugins")},syncOrchestratorSettings(e){return r.ipcRenderer.invoke("agentorchestrator:syncOrchestratorSettings",e)},interrupt(e){return r.ipcRenderer.invoke("agentorchestrator:interrupt",e)},disconnect(e){return r.ipcRenderer.invoke("agentorchestrator:disconnect",e)},openFolderDialog(){return r.ipcRenderer.invoke("agentorchestrator:openFolderDialog")},openTerminalInWorkspace(e){return r.ipcRenderer.invoke("agentorchestrator:openTerminalInWorkspace",e)},terminalSpawn(e){return r.ipcRenderer.invoke("agentorchestrator:terminalSpawn",e)},terminalWrite(e){r.ipcRenderer.send("agentorchestrator:terminalWrite",e)},terminalResize(e,t){r.ipcRenderer.invoke("agentorchestrator:terminalResize",e,t)},terminalDestroy(){return r.ipcRenderer.invoke("agentorchestrator:terminalDestroy")},onTerminalData(e){const t=(n,o)=>e(o);return r.ipcRenderer.on("agentorchestrator:terminalData",t),()=>r.ipcRenderer.off("agentorchestrator:terminalData",t)},onTerminalExit(e){const t=()=>e();return r.ipcRenderer.on("agentorchestrator:terminalExit",t),()=>r.ipcRenderer.off("agentorchestrator:terminalExit",t)},writeWorkspaceConfig(e,t){return r.ipcRenderer.invoke("agentorchestrator:writeWorkspaceConfig",e,t)},openWorkspaceInNewWindow(e){return r.ipcRenderer.invoke("agentorchestrator:openWorkspaceInNewWindow",e)},claimWorkspace(e){return r.ipcRenderer.invoke("agentorchestrator:claimWorkspace",e)},releaseWorkspace(e){return r.ipcRenderer.invoke("agentorchestrator:releaseWorkspace",e)},forceClaimWorkspace(e){return r.ipcRenderer.invoke("agentorchestrator:forceClaimWorkspace",e)},savePastedImage(e,t){return r.ipcRenderer.invoke("agentorchestrator:savePastedImage",e,t)},listWorkspaceTree(e,t){return r.ipcRenderer.invoke("agentorchestrator:listWorkspaceTree",e,t)},readWorkspaceFile(e,t){return r.ipcRenderer.invoke("agentorchestrator:readWorkspaceFile",e,t)},readWorkspaceTextFile(e,t){return r.ipcRenderer.invoke("agentorchestrator:readWorkspaceTextFile",e,t)},writeWorkspaceFile(e,t,n){return r.ipcRenderer.invoke("agentorchestrator:writeWorkspaceFile",e,t,n)},pickWorkspaceSavePath(e,t){return r.ipcRenderer.invoke("agentorchestrator:pickWorkspaceSavePath",e,t)},pickWorkspaceOpenPath(e){return r.ipcRenderer.invoke("agentorchestrator:pickWorkspaceOpenPath",e)},getGitStatus(e){return r.ipcRenderer.invoke("agentorchestrator:getGitStatus",e)},gitCommit(e,t){return r.ipcRenderer.invoke("agentorchestrator:gitCommit",e,t)},gitPush(e,t){return r.ipcRenderer.invoke("agentorchestrator:gitPush",e,t)},gitDeploy(e,t){return r.ipcRenderer.invoke("agentorchestrator:gitDeploy",e,t)},gitBuild(e,t){return r.ipcRenderer.invoke("agentorchestrator:gitBuild",e,t)},gitRelease(e,t){return r.ipcRenderer.invoke("agentorchestrator:gitRelease",e,t)},gitRollback(e,t){return r.ipcRenderer.invoke("agentorchestrator:gitRollback",e,t)},setRecentWorkspaces(e){r.ipcRenderer.send("agentorchestrator:setRecentWorkspaces",e)},setEditorMenuState(e){r.ipcRenderer.send("agentorchestrator:setEditorMenuState",!!e)},setDockPanelMenuState(e){r.ipcRenderer.send("agentorchestrator:setDockPanelMenuState",e)},findInPage(e){return r.ipcRenderer.invoke("agentorchestrator:findInPage",e)},showContextMenu(e){return r.ipcRenderer.invoke("agentorchestrator:showContextMenu",e)},getProviderAuthStatus(e){return r.ipcRenderer.invoke("agentorchestrator:getProviderAuthStatus",e)},pingProvider(e){return r.ipcRenderer.invoke("agentorchestrator:pingProvider",e)},pingModel(e,t,n){return r.ipcRenderer.invoke("agentorchestrator:pingModel",e,t,n)},startProviderLogin(e){return r.ipcRenderer.invoke("agentorchestrator:startProviderLogin",e)},upgradeProviderCli(e){return r.ipcRenderer.invoke("agentorchestrator:upgradeProviderCli",e)},setProviderApiKey(e,t){return r.ipcRenderer.invoke("agentorchestrator:setProviderApiKey",e,t)},getProviderApiKeyState(e){return r.ipcRenderer.invoke("agentorchestrator:getProviderApiKeyState",e)},importProviderApiKeyFromEnv(e){return r.ipcRenderer.invoke("agentorchestrator:importProviderApiKeyFromEnv",e)},resetApplicationData(){return r.ipcRenderer.invoke("agentorchestrator:resetApplicationData")},getMcpServers(){return r.ipcRenderer.invoke("agentorchestrator:getMcpServers")},addMcpServer(e,t){return r.ipcRenderer.invoke("agentorchestrator:addMcpServer",e,t)},updateMcpServer(e,t){return r.ipcRenderer.invoke("agentorchestrator:updateMcpServer",e,t)},removeMcpServer(e){return r.ipcRenderer.invoke("agentorchestrator:removeMcpServer",e)},restartMcpServer(e){return r.ipcRenderer.invoke("agentorchestrator:restartMcpServer",e)},getMcpServerTools(e){return r.ipcRenderer.invoke("agentorchestrator:getMcpServerTools",e)},getGeminiAvailableModels(){return r.ipcRenderer.invoke("agentorchestrator:getGeminiAvailableModels")},getAvailableModels(){return r.ipcRenderer.invoke("agentorchestrator:getAvailableModels")},onEvent(e){const t=(n,o)=>e(o);return r.ipcRenderer.on("agentorchestrator:event",t),()=>r.ipcRenderer.off("agentorchestrator:event",t)},onMenu(e){const t=(n,o)=>e(o);return r.ipcRenderer.on("agentorchestrator:menu",t),()=>r.ipcRenderer.off("agentorchestrator:menu",t)},onPluginHostRequest(e){const t=(n,o)=>e(o);return r.ipcRenderer.on("barnaby:plugin-host:request",t),()=>r.ipcRenderer.off("barnaby:plugin-host:request",t)},pluginHostRespond(e,t){return r.ipcRenderer.invoke(e,t)},onPluginHostRecovery(e){const t=(n,o)=>e(o);return r.ipcRenderer.on("barnaby:plugin-host:recovery",t),()=>r.ipcRenderer.off("barnaby:plugin-host:recovery",t)},getLoadedPlugins(){return r.ipcRenderer.invoke("agentorchestrator:getLoadedPlugins")},startOrchestratorComparativeReview(e,t){return r.ipcRenderer.invoke("agentorchestrator:startOrchestratorComparativeReview",e,t)},startOrchestratorGoalRun(e){return r.ipcRenderer.invoke("agentorchestrator:startOrchestratorGoalRun",e)},pauseOrchestratorRun(){return r.ipcRenderer.invoke("agentorchestrator:pauseOrchestratorRun")},cancelOrchestratorRun(){return r.ipcRenderer.invoke("agentorchestrator:cancelOrchestratorRun")},getOrchestratorState(){return r.ipcRenderer.invoke("agentorchestrator:getOrchestratorState")},browseMarkdownFile(){return r.ipcRenderer.invoke("agentorchestrator:browseMarkdownFile")},onPluginsLoaded(e){const t=()=>e();return r.ipcRenderer.on("barnaby:plugin-host:plugins-loaded",t),()=>r.ipcRenderer.off("barnaby:plugin-host:plugins-loaded",t)},zoomIn(){const e=r.webFrame.getZoomLevel();r.webFrame.setZoomLevel(e+1)},zoomOut(){const e=r.webFrame.getZoomLevel();r.webFrame.setZoomLevel(e-1)},resetZoom(){r.webFrame.setZoomLevel(0)},getZoomLevel(){return r.webFrame.getZoomLevel()}};r.contextBridge.exposeInMainWorld("agentOrchestrator",i);r.contextBridge.exposeInMainWorld("fireharness",i);function d(e=["complete","interactive"]){return new Promise(t=>{e.includes(document.readyState)?t(!0):document.addEventListener("readystatechange",()=>{e.includes(document.readyState)&&t(!0)})})}const a={append(e,t){if(!Array.from(e.children).find(n=>n===t))return e.appendChild(t)},remove(e,t){if(Array.from(e.children).find(n=>n===t))return e.removeChild(t)}};function g(){const e="loaders-css__square-spin",t=`
|
|
2
2
|
@keyframes square-spin {
|
|
3
3
|
25% { transform: perspective(100px) rotateX(180deg) rotateY(0); }
|
|
4
4
|
50% { transform: perspective(100px) rotateX(180deg) rotateY(180deg); }
|
|
@@ -24,4 +24,4 @@
|
|
|
24
24
|
background: #282c34;
|
|
25
25
|
z-index: 9;
|
|
26
26
|
}
|
|
27
|
-
`,n=document.createElement("style"),o=document.createElement("div");return n.id="app-loading-style",n.innerHTML=t,o.className="app-loading-wrap",o.innerHTML=`<div class="${e}"><div></div></div>`,{appendLoading(){a.append(document.head,n),a.append(document.body,o)},removeLoading(){a.remove(document.head,n),a.remove(document.body,o)}}}const{appendLoading:u,removeLoading:
|
|
27
|
+
`,n=document.createElement("style"),o=document.createElement("div");return n.id="app-loading-style",n.innerHTML=t,o.className="app-loading-wrap",o.innerHTML=`<div class="${e}"><div></div></div>`,{appendLoading(){a.append(document.head,n),a.append(document.body,o)},removeLoading(){a.remove(document.head,n),a.remove(document.body,o)}}}const{appendLoading:u,removeLoading:c}=g();d().then(u);window.onmessage=e=>{e.data.payload==="removeLoading"&&c()};setTimeout(c,4999);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barnaby.build/barnaby",
|
|
3
3
|
"productName": "Barnaby",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.233",
|
|
5
5
|
"main": "dist-electron/main/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"barnaby": "bin/barnaby.cjs"
|
|
@@ -12,12 +12,21 @@
|
|
|
12
12
|
"public",
|
|
13
13
|
"build",
|
|
14
14
|
"bin",
|
|
15
|
+
"docs/screenshots",
|
|
15
16
|
"scripts",
|
|
16
17
|
"package.json"
|
|
17
18
|
],
|
|
18
19
|
"description": "Barnaby: local agent loops without API keys.",
|
|
19
20
|
"author": "stuart",
|
|
20
21
|
"license": "MIT",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/incendiosoftware/Barnaby.git"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/incendiosoftware/Barnaby",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/incendiosoftware/Barnaby/issues"
|
|
29
|
+
},
|
|
21
30
|
"publishConfig": {
|
|
22
31
|
"access": "public"
|
|
23
32
|
},
|
|
@@ -35,23 +44,28 @@
|
|
|
35
44
|
"predev": "node -e \"const major = Number(process.versions.node.split('.')[0]); if (major < 20 || major >= 27) { console.error('\\nUnsupported Node.js version ' + process.version + '.\\nUse Node >=20 and <27 (recommended: Node 22 LTS).\\n'); process.exit(1); }\"",
|
|
36
45
|
"dev": "vite",
|
|
37
46
|
"dev:clean": "node scripts/dev-clean.mjs && npm run dev",
|
|
47
|
+
"prebuild:dist:raw": "node scripts/sync-icon.mjs",
|
|
38
48
|
"build:dist:raw": "tsc && vite build",
|
|
39
|
-
"build:dist": "
|
|
40
|
-
"build:portable:raw": "npm run build:dist:raw && electron-builder --win portable",
|
|
41
|
-
"build": "
|
|
42
|
-
"build:
|
|
49
|
+
"build:dist": "node scripts/run-with-version-bump.mjs \"npm run build:dist:raw\"",
|
|
50
|
+
"build:portable:raw": "npm run build:dist:raw && electron-builder --win portable && node scripts/apply-exe-icon.mjs",
|
|
51
|
+
"build": "node scripts/build-dispatch.mjs",
|
|
52
|
+
"build:raw": "npm run build:portable:raw",
|
|
53
|
+
"build:portable": "node scripts/run-with-version-bump.mjs \"npm run build:portable:raw\"",
|
|
43
54
|
"package": "npm run build:portable",
|
|
44
55
|
"deploy": "npm run package",
|
|
45
|
-
"build:release": "npm run build:dist && electron-builder",
|
|
56
|
+
"build:release": "npm run build:dist && electron-builder && node scripts/apply-exe-icon.mjs",
|
|
57
|
+
"build:release:raw": "npm run build:dist:raw && electron-builder --publish never && node scripts/apply-exe-icon.mjs",
|
|
46
58
|
"release:notes": "node scripts/create-release-notes.mjs",
|
|
47
|
-
"release:prepare": "
|
|
48
|
-
"publish": "gh workflow run release.yml -f releasable=true --ref main",
|
|
59
|
+
"release:prepare": "node scripts/run-with-version-bump.mjs \"npm run release:notes && npm run build:portable:raw\"",
|
|
49
60
|
"postinstall": "node scripts/shortcut-win.mjs && node scripts/rebuild-native.mjs",
|
|
50
|
-
"publish:npm": "npm run build && npm publish",
|
|
51
|
-
"package:win": "npm run build:dist && electron-packager . Barnaby --platform=win32 --arch=x64 --out=release/0.0.1/packaged --overwrite --asar --prune=true --icon=build/icon.
|
|
61
|
+
"publish:npm": "npm run build:dist:raw && npm pack --dry-run && npm publish",
|
|
62
|
+
"package:win": "npm run build:dist && electron-packager . Barnaby --platform=win32 --arch=x64 --out=release/0.0.1/packaged --overwrite --asar --prune=true --icon=build/icon.ico",
|
|
52
63
|
"preview": "vite preview",
|
|
53
64
|
"pretest": "vite build --mode=test",
|
|
54
|
-
"test": "vitest run"
|
|
65
|
+
"test": "vitest run",
|
|
66
|
+
"orch:build": "cd ../barnaby-orchestrator && npm run build:raw",
|
|
67
|
+
"orch:deploy": "npm run orch:build && node -e \"const fs=require('fs'),path=require('path'),os=require('os');const src=path.resolve('../barnaby-orchestrator');const dest=path.join(os.homedir(),'.barnaby','plugins','barnaby-orchestrator');const distSrc=path.join(src,'dist');const distDest=path.join(dest,'dist');fs.rmSync(dest,{recursive:true,force:true});fs.mkdirSync(distDest,{recursive:true});for(const f of fs.readdirSync(distSrc))fs.copyFileSync(path.join(distSrc,f),path.join(distDest,f));fs.copyFileSync(path.join(src,'package.json'),path.join(dest,'package.json'));console.log('Orchestrator deployed to '+dest)\"",
|
|
68
|
+
"build:all": "npm run build:portable && npm run orch:deploy"
|
|
55
69
|
},
|
|
56
70
|
"dependencies": {
|
|
57
71
|
"@codemirror/lang-cpp": "^6.0.3",
|
|
@@ -69,6 +83,7 @@
|
|
|
69
83
|
"@google/genai": "^1.42.0",
|
|
70
84
|
"@modelcontextprotocol/sdk": "^1.27.0",
|
|
71
85
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
86
|
+
"@uiw/codemirror-theme-vscode": "^4.25.5",
|
|
72
87
|
"@uiw/react-codemirror": "^4.25.4",
|
|
73
88
|
"@xterm/addon-fit": "^0.11.0",
|
|
74
89
|
"@xterm/xterm": "^5.3.0",
|
|
@@ -96,6 +111,7 @@
|
|
|
96
111
|
"electron-builder": "^26.8.1",
|
|
97
112
|
"postcss": "^8.4.49",
|
|
98
113
|
"postcss-import": "^16.1.0",
|
|
114
|
+
"rcedit": "^5.0.2",
|
|
99
115
|
"react": "^18.3.1",
|
|
100
116
|
"react-dom": "^18.3.1",
|
|
101
117
|
"tailwindcss": "^3.4.15",
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Apply build/icon.ico to built Windows executables using rcedit.
|
|
4
|
+
* electron-builder with signAndEditExecutable:false skips icon embedding;
|
|
5
|
+
* this script patches the exe(s) after build so the custom icon appears.
|
|
6
|
+
*/
|
|
7
|
+
import fs from 'node:fs'
|
|
8
|
+
import path from 'node:path'
|
|
9
|
+
import { rcedit } from 'rcedit'
|
|
10
|
+
|
|
11
|
+
const root = process.cwd()
|
|
12
|
+
const iconPath = path.join(root, 'build', 'icon.ico')
|
|
13
|
+
|
|
14
|
+
if (!fs.existsSync(iconPath)) {
|
|
15
|
+
console.warn('[apply-exe-icon] build/icon.ico not found, skipping')
|
|
16
|
+
process.exit(0)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Read version from package.json
|
|
20
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'))
|
|
21
|
+
const version = pkg.version
|
|
22
|
+
const releaseDir = path.join(root, 'release', version)
|
|
23
|
+
|
|
24
|
+
if (!fs.existsSync(releaseDir)) {
|
|
25
|
+
console.warn('[apply-exe-icon] release dir not found:', releaseDir)
|
|
26
|
+
process.exit(0)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Only patch win-unpacked and setup exe. Do NOT patch portable exe - it is a 7-Zip SFX
|
|
30
|
+
// and rcedit corrupts it (replaces archive payload with resource data, shrinking to ~90KB).
|
|
31
|
+
const targets = [
|
|
32
|
+
path.join(releaseDir, 'win-unpacked', 'Barnaby.exe'),
|
|
33
|
+
path.join(releaseDir, `Barnaby_${version}_setup.exe`),
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
let patched = 0
|
|
37
|
+
for (const exePath of targets) {
|
|
38
|
+
if (fs.existsSync(exePath)) {
|
|
39
|
+
try {
|
|
40
|
+
await rcedit(exePath, { icon: iconPath })
|
|
41
|
+
console.log('[apply-exe-icon] Applied icon to', path.relative(root, exePath))
|
|
42
|
+
patched++
|
|
43
|
+
} catch (err) {
|
|
44
|
+
console.error('[apply-exe-icon] Failed to patch', exePath, err.message)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (patched === 0) {
|
|
50
|
+
console.warn('[apply-exe-icon] No executables found to patch')
|
|
51
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process'
|
|
3
|
+
|
|
4
|
+
const args = process.argv
|
|
5
|
+
.slice(2)
|
|
6
|
+
.map((value) => value.trim().toLowerCase())
|
|
7
|
+
.filter(Boolean)
|
|
8
|
+
|
|
9
|
+
let targetScript = ''
|
|
10
|
+
if (args.length === 0) {
|
|
11
|
+
targetScript = 'build:portable:raw'
|
|
12
|
+
} else if (args.length === 1 && args[0] === 'raw') {
|
|
13
|
+
targetScript = 'build:portable:raw'
|
|
14
|
+
} else if (args.length === 1 && (args[0] === 'bump' || args[0] === 'versioned')) {
|
|
15
|
+
targetScript = 'build:portable'
|
|
16
|
+
} else {
|
|
17
|
+
console.error('[build] Invalid arguments.')
|
|
18
|
+
console.error('[build] Allowed usage:')
|
|
19
|
+
console.error(' npm run build')
|
|
20
|
+
console.error(' npm run build raw')
|
|
21
|
+
console.error(' npm run build bump')
|
|
22
|
+
console.error(' npm run build versioned')
|
|
23
|
+
console.error(' npm run build:raw')
|
|
24
|
+
console.error(' npm run build:dist:raw')
|
|
25
|
+
console.error(' npm run build:portable:raw')
|
|
26
|
+
process.exit(1)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const result = spawnSync(`npm run ${targetScript}`, {
|
|
30
|
+
stdio: 'inherit',
|
|
31
|
+
env: process.env,
|
|
32
|
+
shell: true,
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
if (result.error) {
|
|
36
|
+
console.error(`[build] Failed to run "${targetScript}": ${result.error.message}`)
|
|
37
|
+
process.exit(1)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
process.exit(result.status ?? 1)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const fs = require('node:fs')
|
|
2
|
+
const path = require('node:path')
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Patch the packed app executable icon before artifacts (portable/nsis) are produced.
|
|
6
|
+
* This avoids mutating the final portable SFX, which rcedit corrupts.
|
|
7
|
+
*/
|
|
8
|
+
exports.default = async function afterPack(context) {
|
|
9
|
+
if (context.electronPlatformName !== 'win32') return
|
|
10
|
+
|
|
11
|
+
const { rcedit } = await import('rcedit')
|
|
12
|
+
const exeName = `${context.packager.appInfo.productFilename}.exe`
|
|
13
|
+
const exePath = path.join(context.appOutDir, exeName)
|
|
14
|
+
const iconPath = path.join(context.packager.projectDir, 'build', 'icon.ico')
|
|
15
|
+
|
|
16
|
+
if (!fs.existsSync(iconPath)) {
|
|
17
|
+
console.warn('[afterPack] icon missing, skipping:', iconPath)
|
|
18
|
+
return
|
|
19
|
+
}
|
|
20
|
+
if (!fs.existsSync(exePath)) {
|
|
21
|
+
console.warn('[afterPack] app exe missing, skipping:', exePath)
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
await rcedit(exePath, { icon: iconPath })
|
|
26
|
+
console.log('[afterPack] Applied icon to', exePath)
|
|
27
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Generate a license key for a customer.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* node scripts/generate-license-key.mjs --email customer@example.com
|
|
7
|
+
* node scripts/generate-license-key.mjs --email customer@example.com --tier pro
|
|
8
|
+
* node scripts/generate-license-key.mjs --email customer@example.com --exp 2027-01-01
|
|
9
|
+
*
|
|
10
|
+
* Options:
|
|
11
|
+
* --email Customer email (required)
|
|
12
|
+
* --tier License tier: pro, enterprise (default: pro)
|
|
13
|
+
* --exp Expiry date in YYYY-MM-DD format (optional, omit for perpetual)
|
|
14
|
+
*
|
|
15
|
+
* Reads the private key from: ~/.barnaby/license-private-key.pem
|
|
16
|
+
* Run license-keypair-init.mjs first if you haven't generated a keypair.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import crypto from 'node:crypto'
|
|
20
|
+
import fs from 'node:fs'
|
|
21
|
+
import path from 'node:path'
|
|
22
|
+
import os from 'node:os'
|
|
23
|
+
|
|
24
|
+
const PRIVATE_KEY_PATH = path.join(os.homedir(), '.barnaby', 'license-private-key.pem')
|
|
25
|
+
|
|
26
|
+
// Parse args
|
|
27
|
+
const args = process.argv.slice(2)
|
|
28
|
+
function getArg(name) {
|
|
29
|
+
const idx = args.indexOf(`--${name}`)
|
|
30
|
+
if (idx === -1 || idx + 1 >= args.length) return undefined
|
|
31
|
+
return args[idx + 1]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const email = getArg('email')
|
|
35
|
+
const tier = getArg('tier') || 'pro'
|
|
36
|
+
const expStr = getArg('exp')
|
|
37
|
+
|
|
38
|
+
if (!email) {
|
|
39
|
+
console.error('❌ Missing --email argument')
|
|
40
|
+
console.error('Usage: node scripts/generate-license-key.mjs --email customer@example.com')
|
|
41
|
+
process.exit(1)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Read private key
|
|
45
|
+
if (!fs.existsSync(PRIVATE_KEY_PATH)) {
|
|
46
|
+
console.error('❌ Private key not found at:', PRIVATE_KEY_PATH)
|
|
47
|
+
console.error(' Run: node scripts/license-keypair-init.mjs')
|
|
48
|
+
process.exit(1)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const privateKeyPem = fs.readFileSync(PRIVATE_KEY_PATH, 'utf8')
|
|
52
|
+
const privateKey = crypto.createPrivateKey(privateKeyPem)
|
|
53
|
+
|
|
54
|
+
// Build payload
|
|
55
|
+
const payload = {
|
|
56
|
+
email: email.toLowerCase().trim(),
|
|
57
|
+
product: 'orchestrator',
|
|
58
|
+
tier,
|
|
59
|
+
iat: Date.now(),
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (expStr) {
|
|
63
|
+
const expDate = new Date(expStr)
|
|
64
|
+
if (isNaN(expDate.getTime())) {
|
|
65
|
+
console.error('❌ Invalid --exp date format. Use YYYY-MM-DD.')
|
|
66
|
+
process.exit(1)
|
|
67
|
+
}
|
|
68
|
+
payload.exp = expDate.getTime()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Encode payload
|
|
72
|
+
const payloadBuf = Buffer.from(JSON.stringify(payload), 'utf8')
|
|
73
|
+
|
|
74
|
+
// Sign
|
|
75
|
+
const signature = crypto.sign(null, payloadBuf, privateKey)
|
|
76
|
+
|
|
77
|
+
// Base64url encode (no padding)
|
|
78
|
+
function base64urlEncode(buf) {
|
|
79
|
+
return buf.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const key = `ORCH-${base64urlEncode(payloadBuf)}.${base64urlEncode(signature)}`
|
|
83
|
+
|
|
84
|
+
console.log()
|
|
85
|
+
console.log('✅ License key generated for:', email)
|
|
86
|
+
console.log()
|
|
87
|
+
console.log('Details:')
|
|
88
|
+
console.log(' Email:', payload.email)
|
|
89
|
+
console.log(' Tier:', payload.tier)
|
|
90
|
+
console.log(' Issued:', new Date(payload.iat).toISOString())
|
|
91
|
+
console.log(' Expires:', payload.exp ? new Date(payload.exp).toISOString() : 'Never (perpetual)')
|
|
92
|
+
console.log()
|
|
93
|
+
console.log('License Key:')
|
|
94
|
+
console.log('─'.repeat(60))
|
|
95
|
+
console.log(key)
|
|
96
|
+
console.log('─'.repeat(60))
|
|
97
|
+
console.log()
|
|
98
|
+
console.log('Send this key to the customer. They paste it into')
|
|
99
|
+
console.log('Settings → Orchestrator → License Key.')
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* One-time script: Generate an ed25519 keypair for license key signing.
|
|
4
|
+
*
|
|
5
|
+
* Run: node scripts/license-keypair-init.mjs
|
|
6
|
+
*
|
|
7
|
+
* Output:
|
|
8
|
+
* - Prints the PUBLIC key PEM (embed in licenseKeys.ts)
|
|
9
|
+
* - Saves the PRIVATE key to ~/.barnaby/license-private-key.pem
|
|
10
|
+
*
|
|
11
|
+
* IMPORTANT: The private key file must NEVER be committed to version control.
|
|
12
|
+
* Back it up securely — if you lose it, you can't generate new keys.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import crypto from 'node:crypto'
|
|
16
|
+
import fs from 'node:fs'
|
|
17
|
+
import path from 'node:path'
|
|
18
|
+
import os from 'node:os'
|
|
19
|
+
|
|
20
|
+
const PRIVATE_KEY_PATH = path.join(os.homedir(), '.barnaby', 'license-private-key.pem')
|
|
21
|
+
|
|
22
|
+
// Check if keypair already exists
|
|
23
|
+
if (fs.existsSync(PRIVATE_KEY_PATH)) {
|
|
24
|
+
console.log('⚠️ Private key already exists at:', PRIVATE_KEY_PATH)
|
|
25
|
+
console.log(' Delete it first if you want to generate a new keypair.')
|
|
26
|
+
console.log()
|
|
27
|
+
|
|
28
|
+
// Show the existing public key for reference
|
|
29
|
+
const existingPrivate = fs.readFileSync(PRIVATE_KEY_PATH, 'utf8')
|
|
30
|
+
const privateKey = crypto.createPrivateKey(existingPrivate)
|
|
31
|
+
const publicKeyPem = crypto.createPublicKey(privateKey).export({ type: 'spki', format: 'pem' })
|
|
32
|
+
console.log('Existing PUBLIC key (already in licenseKeys.ts):')
|
|
33
|
+
console.log(publicKeyPem)
|
|
34
|
+
process.exit(0)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Generate new ed25519 keypair
|
|
38
|
+
const { publicKey, privateKey } = crypto.generateKeyPairSync('ed25519')
|
|
39
|
+
|
|
40
|
+
const publicKeyPem = publicKey.export({ type: 'spki', format: 'pem' })
|
|
41
|
+
const privateKeyPem = privateKey.export({ type: 'pkcs8', format: 'pem' })
|
|
42
|
+
|
|
43
|
+
// Save private key
|
|
44
|
+
const dir = path.dirname(PRIVATE_KEY_PATH)
|
|
45
|
+
fs.mkdirSync(dir, { recursive: true })
|
|
46
|
+
fs.writeFileSync(PRIVATE_KEY_PATH, privateKeyPem, { mode: 0o600 })
|
|
47
|
+
|
|
48
|
+
console.log('✅ Ed25519 keypair generated successfully!')
|
|
49
|
+
console.log()
|
|
50
|
+
console.log('PRIVATE key saved to:', PRIVATE_KEY_PATH)
|
|
51
|
+
console.log('⚠️ NEVER commit this file. Back it up securely.')
|
|
52
|
+
console.log()
|
|
53
|
+
console.log('PUBLIC key — copy this into electron/main/licenseKeys.ts:')
|
|
54
|
+
console.log('─'.repeat(60))
|
|
55
|
+
console.log(publicKeyPem)
|
|
56
|
+
console.log('─'.repeat(60))
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import { spawn } from 'node:child_process'
|
|
4
|
+
|
|
5
|
+
const command = process.argv.slice(2).join(' ').trim()
|
|
6
|
+
if (!command) {
|
|
7
|
+
console.error('Usage: node scripts/run-with-version-bump.mjs "<command>"')
|
|
8
|
+
process.exit(1)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const root = process.cwd()
|
|
12
|
+
const packageJsonPath = path.join(root, 'package.json')
|
|
13
|
+
const packageLockPath = path.join(root, 'package-lock.json')
|
|
14
|
+
|
|
15
|
+
const originalPackageJsonText = fs.readFileSync(packageJsonPath, 'utf8')
|
|
16
|
+
const hadPackageLock = fs.existsSync(packageLockPath)
|
|
17
|
+
const originalPackageLockText = hadPackageLock ? fs.readFileSync(packageLockPath, 'utf8') : null
|
|
18
|
+
|
|
19
|
+
function bumpPatch(version) {
|
|
20
|
+
const parts = String(version).trim().split('.')
|
|
21
|
+
if (parts.length !== 3) {
|
|
22
|
+
throw new Error(`Expected semantic version x.y.z, got "${version}"`)
|
|
23
|
+
}
|
|
24
|
+
const [major, minor, patch] = parts.map((p) => Number(p))
|
|
25
|
+
if ([major, minor, patch].some((n) => Number.isNaN(n))) {
|
|
26
|
+
throw new Error(`Expected numeric semantic version, got "${version}"`)
|
|
27
|
+
}
|
|
28
|
+
return `${major}.${minor}.${patch + 1}`
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function restoreVersionFiles() {
|
|
32
|
+
fs.writeFileSync(packageJsonPath, originalPackageJsonText, 'utf8')
|
|
33
|
+
if (originalPackageLockText === null) {
|
|
34
|
+
if (fs.existsSync(packageLockPath)) fs.rmSync(packageLockPath)
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
fs.writeFileSync(packageLockPath, originalPackageLockText, 'utf8')
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const packageJson = JSON.parse(originalPackageJsonText)
|
|
41
|
+
const currentVersion = packageJson.version
|
|
42
|
+
const nextVersion = bumpPatch(currentVersion)
|
|
43
|
+
packageJson.version = nextVersion
|
|
44
|
+
fs.writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}\n`, 'utf8')
|
|
45
|
+
|
|
46
|
+
if (hadPackageLock) {
|
|
47
|
+
const packageLock = JSON.parse(originalPackageLockText)
|
|
48
|
+
if (typeof packageLock.version === 'string') packageLock.version = nextVersion
|
|
49
|
+
if (packageLock.packages && packageLock.packages[''] && typeof packageLock.packages[''].version === 'string') {
|
|
50
|
+
packageLock.packages[''].version = nextVersion
|
|
51
|
+
}
|
|
52
|
+
fs.writeFileSync(packageLockPath, `${JSON.stringify(packageLock, null, 2)}\n`, 'utf8')
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
console.log(`Version bumped: ${currentVersion} -> ${nextVersion}`)
|
|
56
|
+
|
|
57
|
+
const child = spawn(command, {
|
|
58
|
+
cwd: root,
|
|
59
|
+
env: process.env,
|
|
60
|
+
shell: true,
|
|
61
|
+
stdio: 'inherit'
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
child.on('error', (error) => {
|
|
65
|
+
console.error(`Failed to start command: ${error.message}`)
|
|
66
|
+
restoreVersionFiles()
|
|
67
|
+
process.exit(1)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
child.on('exit', (code, signal) => {
|
|
71
|
+
if (code === 0) process.exit(0)
|
|
72
|
+
|
|
73
|
+
restoreVersionFiles()
|
|
74
|
+
if (signal) {
|
|
75
|
+
console.error(`Command terminated by signal: ${signal}`)
|
|
76
|
+
} else {
|
|
77
|
+
console.error(`Command failed with exit code ${code}`)
|
|
78
|
+
}
|
|
79
|
+
process.exit(code ?? 1)
|
|
80
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Sync build/icon.ico to public/favicon.ico so the BrowserWindow and packaged
|
|
4
|
+
* app use the same icon. electron-builder reads build/icon.ico for the .exe;
|
|
5
|
+
* the runtime uses public/favicon.ico (copied to dist by Vite).
|
|
6
|
+
*/
|
|
7
|
+
import fs from 'node:fs'
|
|
8
|
+
import path from 'node:path'
|
|
9
|
+
|
|
10
|
+
const root = process.cwd()
|
|
11
|
+
const src = path.join(root, 'build', 'icon.ico')
|
|
12
|
+
const dest = path.join(root, 'public', 'favicon.ico')
|
|
13
|
+
|
|
14
|
+
if (!fs.existsSync(src)) {
|
|
15
|
+
console.warn('[sync-icon] build/icon.ico not found, skipping sync')
|
|
16
|
+
process.exit(0)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
fs.copyFileSync(src, dest)
|
|
20
|
+
console.log('[sync-icon] Copied build/icon.ico → public/favicon.ico')
|