@cyberstrike-io/cyberstrike 1.1.11 → 1.1.12-beta.0

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/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "scripts": {
8
8
  "postinstall": "bun ./postinstall.mjs || node ./postinstall.mjs"
9
9
  },
10
- "version": "1.1.11",
10
+ "version": "1.1.12-beta.0",
11
11
  "license": "AGPL-3.0-only",
12
12
  "keywords": [
13
13
  "cyberstrike",
@@ -36,7 +36,20 @@
36
36
  "type": "git",
37
37
  "url": "https://github.com/CyberStrikeus/CyberStrike.git"
38
38
  },
39
+ "dependencies": {
40
+ "playwright": "1.58.2"
41
+ },
39
42
  "optionalDependencies": {
40
- "@cyberstrike-io/cyberstrike-darwin-arm64": "1.1.11"
43
+ "@cyberstrike-io/cyberstrike-darwin-x64": "1.1.12-beta.0",
44
+ "@cyberstrike-io/cyberstrike-linux-x64-baseline": "1.1.12-beta.0",
45
+ "@cyberstrike-io/cyberstrike-linux-arm64": "1.1.12-beta.0",
46
+ "@cyberstrike-io/cyberstrike-windows-x64-baseline": "1.1.12-beta.0",
47
+ "@cyberstrike-io/cyberstrike-darwin-x64-baseline": "1.1.12-beta.0",
48
+ "@cyberstrike-io/cyberstrike-linux-arm64-musl": "1.1.12-beta.0",
49
+ "@cyberstrike-io/cyberstrike-linux-x64": "1.1.12-beta.0",
50
+ "@cyberstrike-io/cyberstrike-windows-x64": "1.1.12-beta.0",
51
+ "@cyberstrike-io/cyberstrike-linux-x64-baseline-musl": "1.1.12-beta.0",
52
+ "@cyberstrike-io/cyberstrike-linux-x64-musl": "1.1.12-beta.0",
53
+ "@cyberstrike-io/cyberstrike-darwin-arm64": "1.1.12-beta.0"
41
54
  }
42
55
  }
package/postinstall.mjs CHANGED
@@ -5,6 +5,7 @@ import path from "path"
5
5
  import os from "os"
6
6
  import { fileURLToPath } from "url"
7
7
  import { createRequire } from "module"
8
+ import { execSync } from "child_process"
8
9
 
9
10
  const __dirname = path.dirname(fileURLToPath(import.meta.url))
10
11
  const require = createRequire(import.meta.url)
@@ -149,6 +150,65 @@ function installSkills() {
149
150
  console.log(`Skills installed to ${skillDest}`)
150
151
  }
151
152
 
153
+ /**
154
+ * Install hackbrowser worker JS to Global.Path.bin equivalent
155
+ * (~/.local/share/cyberstrike/bin/hackbrowser-worker.js).
156
+ *
157
+ * The worker is the subprocess that runs playwright/hackbrowser so that
158
+ * the main cyberstrike binary has zero playwright references at startup
159
+ * (subprocess.md). The main binary locates the worker at this path.
160
+ *
161
+ * Playwright JS package is also installed to
162
+ * ~/.local/share/cyberstrike/node_modules/ so the worker can resolve it
163
+ * at runtime without relying on the npm global node_modules layout.
164
+ * The actual chromium binary requires a separate one-time step:
165
+ * npx playwright install chromium
166
+ */
167
+ function installHackbrowserWorker() {
168
+ const workerSrc = path.join(__dirname, "hackbrowser-worker.js")
169
+ if (!fs.existsSync(workerSrc)) {
170
+ console.warn("Warning: hackbrowser-worker.js not found in package — hackbrowser subcommand will not work")
171
+ return
172
+ }
173
+
174
+ const dataDir = path.join(xdgDataDir(), "cyberstrike")
175
+ const binDir = path.join(dataDir, "bin")
176
+ const workerDest = path.join(binDir, "hackbrowser-worker.js")
177
+
178
+ fs.mkdirSync(binDir, { recursive: true })
179
+ fs.copyFileSync(workerSrc, workerDest)
180
+ console.log(`hackbrowser worker installed to ${workerDest}`)
181
+
182
+ // Install playwright JS package next to the worker so Node/Bun upward
183
+ // traversal from binDir finds it at dataDir/node_modules/playwright/.
184
+ // The playwright package itself is small (~5 MB); chromium is separate.
185
+ const nodeModulesDir = path.join(dataDir, "node_modules")
186
+ const playwrightDir = path.join(nodeModulesDir, "playwright")
187
+ if (!fs.existsSync(playwrightDir)) {
188
+ console.log("Installing playwright npm package for hackbrowser worker...")
189
+ try {
190
+ execSync(`npm install --prefix "${dataDir}" playwright@1.58.2 --no-fund --no-audit --loglevel=error`, {
191
+ stdio: "inherit",
192
+ timeout: 120000,
193
+ })
194
+ console.log("playwright installed to", nodeModulesDir)
195
+ } catch (err) {
196
+ console.warn(
197
+ "Warning: Failed to install playwright automatically:",
198
+ err.message,
199
+ "\nTo install manually: npm install --prefix ~/.local/share/cyberstrike playwright@1.58.2",
200
+ )
201
+ }
202
+ } else {
203
+ console.log("playwright already installed at", playwrightDir)
204
+ }
205
+
206
+ console.log(
207
+ "\nTo use hackbrowser, install the Chromium browser (one-time setup):",
208
+ "\n npx playwright install chromium",
209
+ )
210
+ }
211
+
152
212
  async function main() {
153
213
  try {
154
214
  if (os.platform() === "win32") {
@@ -157,6 +217,7 @@ async function main() {
157
217
  console.log("Windows detected: binary setup not needed (using packaged .exe)")
158
218
  installWebUI()
159
219
  installSkills()
220
+ installHackbrowserWorker()
160
221
  return
161
222
  }
162
223
 
@@ -168,6 +229,7 @@ async function main() {
168
229
 
169
230
  installWebUI()
170
231
  installSkills()
232
+ installHackbrowserWorker()
171
233
  } catch (error) {
172
234
  console.error("Failed to setup cyberstrike binary:", error.message)
173
235
  process.exit(1)