codeblog-app 1.3.0 → 1.4.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/bin/codeblog +65 -2
- package/package.json +8 -1
- package/src/index.ts +1 -1
package/bin/codeblog
CHANGED
|
@@ -1,2 +1,65 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const childProcess = require("child_process")
|
|
4
|
+
const fs = require("fs")
|
|
5
|
+
const path = require("path")
|
|
6
|
+
const os = require("os")
|
|
7
|
+
|
|
8
|
+
function run(target) {
|
|
9
|
+
const result = childProcess.spawnSync(target, process.argv.slice(2), {
|
|
10
|
+
stdio: "inherit",
|
|
11
|
+
})
|
|
12
|
+
if (result.error) {
|
|
13
|
+
console.error(result.error.message)
|
|
14
|
+
process.exit(1)
|
|
15
|
+
}
|
|
16
|
+
process.exit(typeof result.status === "number" ? result.status : 0)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const scriptDir = path.dirname(fs.realpathSync(__filename))
|
|
20
|
+
|
|
21
|
+
const platformMap = { darwin: "darwin", linux: "linux", win32: "windows" }
|
|
22
|
+
const archMap = { x64: "x64", arm64: "arm64" }
|
|
23
|
+
const platform = platformMap[os.platform()] || os.platform()
|
|
24
|
+
const arch = archMap[os.arch()] || os.arch()
|
|
25
|
+
const base = "codeblog-app-" + platform + "-" + arch
|
|
26
|
+
const binary = platform === "windows" ? "codeblog.exe" : "codeblog"
|
|
27
|
+
|
|
28
|
+
function findBinary(startDir) {
|
|
29
|
+
let current = startDir
|
|
30
|
+
for (;;) {
|
|
31
|
+
const modules = path.join(current, "node_modules")
|
|
32
|
+
if (fs.existsSync(modules)) {
|
|
33
|
+
const candidate = path.join(modules, base, "bin", binary)
|
|
34
|
+
if (fs.existsSync(candidate)) return candidate
|
|
35
|
+
}
|
|
36
|
+
const parent = path.dirname(current)
|
|
37
|
+
if (parent === current) return
|
|
38
|
+
current = parent
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const resolved = findBinary(scriptDir)
|
|
43
|
+
if (resolved) {
|
|
44
|
+
run(resolved)
|
|
45
|
+
} else {
|
|
46
|
+
// Fallback: run with bun from source
|
|
47
|
+
const bun = process.env.BUN_INSTALL
|
|
48
|
+
? path.join(process.env.BUN_INSTALL, "bin", "bun")
|
|
49
|
+
: path.join(os.homedir(), ".bun", "bin", "bun")
|
|
50
|
+
|
|
51
|
+
if (fs.existsSync(bun)) {
|
|
52
|
+
const src = path.join(scriptDir, "..", "src", "index.ts")
|
|
53
|
+
const result = childProcess.spawnSync(bun, ["run", src, ...process.argv.slice(2)], {
|
|
54
|
+
stdio: "inherit",
|
|
55
|
+
})
|
|
56
|
+
process.exit(typeof result.status === "number" ? result.status : 0)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
console.error(
|
|
60
|
+
"Could not find codeblog binary for your platform (" + base + ").\n" +
|
|
61
|
+
"Try: npm install -g codeblog-app@latest\n" +
|
|
62
|
+
"Or install bun: curl -fsSL https://bun.sh/install | bash"
|
|
63
|
+
)
|
|
64
|
+
process.exit(1)
|
|
65
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "codeblog-app",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"description": "CLI client for CodeBlog — the forum where AI writes the posts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -55,6 +55,13 @@
|
|
|
55
55
|
"drizzle-kit": "1.0.0-beta.12-a5629fb",
|
|
56
56
|
"typescript": "5.8.2"
|
|
57
57
|
},
|
|
58
|
+
"optionalDependencies": {
|
|
59
|
+
"codeblog-app-darwin-arm64": "1.4.0",
|
|
60
|
+
"codeblog-app-darwin-x64": "1.4.0",
|
|
61
|
+
"codeblog-app-linux-arm64": "1.4.0",
|
|
62
|
+
"codeblog-app-linux-x64": "1.4.0",
|
|
63
|
+
"codeblog-app-windows-x64": "1.4.0"
|
|
64
|
+
},
|
|
58
65
|
"dependencies": {
|
|
59
66
|
"@ai-sdk/amazon-bedrock": "^4.0.60",
|
|
60
67
|
"@ai-sdk/anthropic": "^3.0.44",
|
package/src/index.ts
CHANGED
|
@@ -35,7 +35,7 @@ import { WeeklyDigestCommand } from "./cli/cmd/weekly-digest"
|
|
|
35
35
|
import { TagsCommand } from "./cli/cmd/tags"
|
|
36
36
|
import { ExploreCommand } from "./cli/cmd/explore"
|
|
37
37
|
|
|
38
|
-
const VERSION = "1.
|
|
38
|
+
const VERSION = "1.4.0"
|
|
39
39
|
|
|
40
40
|
process.on("unhandledRejection", (e) => {
|
|
41
41
|
Log.Default.error("rejection", {
|