fourth-spark 0.5.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.
@@ -0,0 +1,41 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "postgresql",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "7",
8
+ "when": 1784713224173,
9
+ "tag": "0000_cute_hemingway",
10
+ "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "7",
15
+ "when": 1784735504613,
16
+ "tag": "0001_add-repos-table",
17
+ "breakpoints": true
18
+ },
19
+ {
20
+ "idx": 2,
21
+ "version": "7",
22
+ "when": 1785051553506,
23
+ "tag": "0002_tearful_gorilla_man",
24
+ "breakpoints": true
25
+ },
26
+ {
27
+ "idx": 3,
28
+ "version": "7",
29
+ "when": 1785205787698,
30
+ "tag": "0003_damp_frightful_four",
31
+ "breakpoints": true
32
+ },
33
+ {
34
+ "idx": 4,
35
+ "version": "7",
36
+ "when": 1785477958268,
37
+ "tag": "0004_brown_the_call",
38
+ "breakpoints": true
39
+ }
40
+ ]
41
+ }
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "fourth-spark",
3
+ "version": "0.5.0",
4
+ "description": "AI Agent Platform — multi-repo agent management based on OpenCode",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/kinminghao/fourth-spark"
9
+ },
10
+ "bin": {
11
+ "fourth-spark": "./bin/cli.js"
12
+ },
13
+ "files": [
14
+ "bin/",
15
+ "public/",
16
+ "drizzle/",
17
+ "docker-compose.yml",
18
+ "postinstall.js"
19
+ ],
20
+ "scripts": {
21
+ "postinstall": "node postinstall.js"
22
+ },
23
+ "os": ["darwin", "linux", "win32"],
24
+ "cpu": ["x64", "arm64"]
25
+ }
package/postinstall.js ADDED
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env node
2
+ "use strict"
3
+
4
+ const { execSync } = require("child_process")
5
+ const { createWriteStream, mkdirSync, chmodSync, existsSync, unlinkSync } = require("fs")
6
+ const { join } = require("path")
7
+
8
+ const REPO = "kinminghao/fourth-spark"
9
+
10
+ const PLATFORM_MAP = {
11
+ "darwin-x64": "fourth-spark-darwin-x64",
12
+ "darwin-arm64": "fourth-spark-darwin-arm64",
13
+ "linux-x64": "fourth-spark-linux-x64",
14
+ "linux-arm64": "fourth-spark-linux-arm64",
15
+ "win32-x64": "fourth-spark-windows-x64",
16
+ }
17
+
18
+ async function main() {
19
+ const key = `${process.platform}-${process.arch}`
20
+ const asset = PLATFORM_MAP[key]
21
+ if (!asset) {
22
+ console.error(`fourth-spark: unsupported platform ${key}`)
23
+ process.exit(1)
24
+ }
25
+
26
+ const version = require("./package.json").version
27
+ const tag = `v${version}`
28
+ const isWindows = process.platform === "win32"
29
+ const ext = isWindows ? "zip" : "tar.gz"
30
+ const url = `https://github.com/${REPO}/releases/download/${tag}/${asset}.${ext}`
31
+
32
+ const pkgDir = __dirname
33
+ const binaryName = isWindows ? "fourth-spark.exe" : "fourth-spark"
34
+ const binaryPath = join(pkgDir, binaryName)
35
+
36
+ if (existsSync(binaryPath)) {
37
+ console.log("fourth-spark: binary already exists, skipping download")
38
+ return
39
+ }
40
+
41
+ console.log(`fourth-spark: downloading ${version} for ${key}...`)
42
+ const tmpFile = join(pkgDir, `_download.${ext}`)
43
+
44
+ await download(url, tmpFile)
45
+
46
+ if (isWindows) {
47
+ execSync(
48
+ `powershell -Command "Expand-Archive -Path '${tmpFile}' -DestinationPath '${pkgDir}' -Force"`,
49
+ )
50
+ } else {
51
+ execSync(`tar xzf "${tmpFile}" -C "${pkgDir}" fourth-spark`, { stdio: "pipe" })
52
+ chmodSync(binaryPath, 0o755)
53
+ }
54
+
55
+ try { unlinkSync(tmpFile) } catch {}
56
+ console.log(`fourth-spark: ${version} installed successfully`)
57
+ }
58
+
59
+ function download(url, dest) {
60
+ return new Promise((resolve, reject) => {
61
+ const follow = (href) => {
62
+ const mod = href.startsWith("https") ? require("https") : require("http")
63
+ mod
64
+ .get(href, { headers: { "User-Agent": "fourth-spark-npm" } }, (res) => {
65
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
66
+ follow(res.headers.location)
67
+ return
68
+ }
69
+ if (res.statusCode !== 200) {
70
+ reject(new Error(`HTTP ${res.statusCode} from ${href}`))
71
+ return
72
+ }
73
+ const file = createWriteStream(dest)
74
+ res.pipe(file)
75
+ file.on("finish", () => { file.close(); resolve() })
76
+ file.on("error", reject)
77
+ })
78
+ .on("error", reject)
79
+ }
80
+ follow(url)
81
+ })
82
+ }
83
+
84
+ main().catch((err) => {
85
+ console.error("fourth-spark: install failed —", err.message)
86
+ process.exit(1)
87
+ })