jonsoc 1.1.49 → 1.1.51

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/jonsoc CHANGED
@@ -204,7 +204,7 @@ const version = (() => {
204
204
  return typeof data.version === "string" ? data.version : "latest"
205
205
  })()
206
206
 
207
- const repo = (process.env.JONSOC_REPO ?? process.env.OPENCODE_REPO ?? "Noisemaker111/JonsOpencode").replace(
207
+ const repo = (process.env.JONSOC_REPO ?? process.env.OPENCODE_REPO ?? "Noisemaker111/Jonsoc").replace(
208
208
  /^https?:\/\/github\.com\//,
209
209
  "",
210
210
  )
@@ -253,7 +253,15 @@ function extractArchive(archivePath) {
253
253
  if (code !== 0) process.exit(code)
254
254
  }
255
255
 
256
+ function bundledBinary() {
257
+ const bundle = join(pkgDir, "..", base, "bin", binary)
258
+ if (!existsSync(bundle)) return
259
+ return bundle
260
+ }
261
+
256
262
  function ensureBinary() {
263
+ const bundle = bundledBinary()
264
+ if (bundle) return bundle
257
265
  if (versionMatch()) return binaryPath
258
266
  ensureDir(binDir)
259
267
  const { asset, url } = releaseUrl()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "1.1.49",
3
+ "version": "1.1.51",
4
4
  "name": "jonsoc",
5
5
  "description": "AI-powered development tool - an open source fork of OpenCode (opencode.ai)",
6
6
  "type": "module",
@@ -39,9 +39,9 @@
39
39
  "jonsoc": "./bin/jonsoc"
40
40
  },
41
41
  "optionalDependencies": {
42
- "jonsoc-darwin-arm64": "1.1.49",
43
- "jonsoc-linux-x64": "1.1.49",
44
- "jonsoc-windows-x64": "1.1.49"
42
+ "jonsoc-darwin-arm64": "1.1.51",
43
+ "jonsoc-linux-x64": "1.1.51",
44
+ "jonsoc-windows-x64": "1.1.51"
45
45
  },
46
46
  "exports": {
47
47
  "./*": "./src/*.ts"
@@ -49,7 +49,7 @@
49
49
  "devDependencies": {
50
50
  "@babel/core": "7.28.4",
51
51
  "@octokit/webhooks-types": "7.6.1",
52
- "@jonsoc/script": "1.1.49",
52
+ "@jonsoc/script": "1.1.51",
53
53
  "@parcel/watcher-darwin-arm64": "2.5.1",
54
54
  "@parcel/watcher-darwin-x64": "2.5.1",
55
55
  "@parcel/watcher-linux-arm64-glibc": "2.5.1",
@@ -96,10 +96,10 @@
96
96
  "@gitlab/gitlab-ai-provider": "3.2.0",
97
97
  "@hono/standard-validator": "0.1.5",
98
98
  "@hono/zod-validator": "0.4.2",
99
- "@jonsoc/plugin": "1.1.49",
100
- "@jonsoc/script": "1.1.49",
101
- "@jonsoc/sdk": "1.1.49",
102
- "@jonsoc/util": "1.1.49",
99
+ "@jonsoc/plugin": "1.1.51",
100
+ "@jonsoc/script": "1.1.51",
101
+ "@jonsoc/sdk": "1.1.51",
102
+ "@jonsoc/util": "1.1.51",
103
103
  "@modelcontextprotocol/sdk": "1.25.2",
104
104
  "@octokit/graphql": "9.0.2",
105
105
  "@octokit/rest": "22.0.0",
@@ -0,0 +1,15 @@
1
+ import { arch, platform } from "os"
2
+
3
+ const osMap = {
4
+ win32: "windows",
5
+ darwin: "darwin",
6
+ linux: "linux",
7
+ }
8
+
9
+ const os = osMap[platform()] ?? platform()
10
+ const cpu = arch()
11
+ const pkgName = `jonsoc-${os}-${cpu}`
12
+
13
+ if (process.env.JONSOC_DEBUG_POSTINSTALL === "1") {
14
+ console.log(`[jonsoc] optional dependency: ${pkgName}`)
15
+ }
package/script/publish.ts CHANGED
@@ -2,10 +2,11 @@
2
2
  import { $ } from "bun"
3
3
  import pkg from "../package.json"
4
4
  import { Script } from "@jonsoc/script"
5
+ import { existsSync } from "fs"
5
6
  import { fileURLToPath } from "url"
6
7
  import path, { dirname, join } from "path"
7
8
 
8
- const dir = fileURLToPath(new URL("..", import.meta.url))
9
+ const dir = dirname(dirname(fileURLToPath(import.meta.url)))
9
10
  process.chdir(dir)
10
11
 
11
12
  const { binaries } = await import("./build.ts")
@@ -26,6 +27,11 @@ if (process.platform === "win32") {
26
27
  await $`cp -r ./bin ./dist/${pkg.name}/bin`
27
28
  }
28
29
 
30
+ const postinstallPath = join(dir, "postinstall.mjs")
31
+ if (existsSync(postinstallPath)) {
32
+ await Bun.write(join("dist", pkg.name, "postinstall.mjs"), Bun.file(postinstallPath))
33
+ }
34
+
29
35
  await Bun.file(`./dist/${pkg.name}/package.json`).write(
30
36
  JSON.stringify(
31
37
  {
@@ -45,6 +51,10 @@ await Bun.file(`./dist/${pkg.name}/package.json`).write(
45
51
  )
46
52
 
47
53
  const tags = [Script.channel]
54
+ const skipDocker = process.env.JONSOC_SKIP_DOCKER === "1" || process.env.OPENCODE_SKIP_DOCKER === "1"
55
+ const skipArchive =
56
+ process.env.JONSOC_SKIP_ARCHIVE === "1" || process.env.OPENCODE_SKIP_ARCHIVE === "1" || process.platform === "win32"
57
+ const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
48
58
  const otp = process.argv.find((arg) => arg.startsWith("--otp="))?.split("=")[1]
49
59
  const tokenFlag = process.argv.find((arg) => arg.startsWith("--token="))?.split("=")[1]
50
60
  const npmToken = tokenFlag || process.env.NPM_TOKEN
@@ -64,14 +74,23 @@ for (const [name] of Object.entries(binaries)) {
64
74
  await $`bun pm pack`.cwd(targetDir)
65
75
  const otpArg = otp ? `--otp=${otp}` : ""
66
76
  for (const tag of tags) {
67
- try {
68
- await $`npm publish *.tgz --access public --tag ${tag} ${otpArg}`.cwd(targetDir)
69
- } catch (e: any) {
70
- if (e.stderr?.toString().includes("previously published versions")) {
71
- console.log(` Already published ${name}. Skipping...`)
72
- continue
77
+ for (const attempt of [1, 2, 3]) {
78
+ try {
79
+ await $`npm publish *.tgz --access public --tag ${tag} ${otpArg}`.cwd(targetDir)
80
+ break
81
+ } catch (e: any) {
82
+ const stderr = e.stderr?.toString() ?? ""
83
+ if (stderr.includes("previously published versions")) {
84
+ console.log(` Already published ${name}. Skipping...`)
85
+ break
86
+ }
87
+ if (stderr.includes("E409") && attempt < 3) {
88
+ console.log(` npm publish conflict for ${name}. Retrying...`)
89
+ await sleep(5000)
90
+ continue
91
+ }
92
+ throw e
73
93
  }
74
- throw e
75
94
  }
76
95
  }
77
96
  }
@@ -85,24 +104,44 @@ for (const tag of tags) {
85
104
  }
86
105
 
87
106
  const otpArg = otp ? `--otp=${otp}` : ""
88
- await $`cd ${mainPkgDir} && bun pm pack && npm publish *.tgz --access public --tag ${tag} ${otpArg}`
107
+ await $`bun pm pack`.cwd(mainPkgDir)
108
+ for (const attempt of [1, 2, 3]) {
109
+ try {
110
+ await $`npm publish *.tgz --access public --tag ${tag} ${otpArg}`.cwd(mainPkgDir)
111
+ break
112
+ } catch (e: any) {
113
+ const stderr = e.stderr?.toString() ?? ""
114
+ if (stderr.includes("previously published versions")) {
115
+ console.log(` Already published ${pkg.name}. Skipping...`)
116
+ break
117
+ }
118
+ if (stderr.includes("E409") && attempt < 3) {
119
+ console.log(` npm publish conflict for ${pkg.name}. Retrying...`)
120
+ await sleep(5000)
121
+ continue
122
+ }
123
+ throw e
124
+ }
125
+ }
89
126
  }
90
127
 
91
- if (!Script.preview) {
128
+ if (!Script.preview && !skipArchive) {
92
129
  // Create archives for GitHub release
93
130
  for (const key of Object.keys(binaries)) {
94
131
  if (key.includes("linux")) {
95
132
  await $`tar -czf ../../${key}.tar.gz *`.cwd(`dist/${key}/bin`)
96
- } else {
97
- await $`zip -r ../../${key}.zip *`.cwd(`dist/${key}/bin`)
133
+ continue
98
134
  }
135
+ await $`zip -r ../../${key}.zip *`.cwd(`dist/${key}/bin`)
99
136
  }
137
+ }
100
138
 
101
- const repo = (process.env.JOC_REPO ?? process.env.OPENCODE_REPO ?? "Noisemaker111/Jonsoc").replace(
139
+ if (!Script.preview && !skipDocker) {
140
+ const repo = (process.env.JONSOC_REPO ?? process.env.OPENCODE_REPO ?? "Noisemaker111/Jonsoc").replace(
102
141
  /^https?:\/\/github\.com\//,
103
142
  "",
104
143
  )
105
- const image = process.env.JOC_IMAGE ?? `ghcr.io/${repo}`
144
+ const image = process.env.JONSOC_IMAGE ?? `ghcr.io/${repo}`
106
145
  const platforms = "linux/amd64,linux/arm64"
107
146
  const tags = [`${image}:${Script.version}`, `${image}:latest`]
108
147
  const tagFlags = tags.flatMap((t) => ["-t", t])
@@ -67,8 +67,6 @@ export namespace Agent {
67
67
  [path.join(os.homedir(), ".jonsoc", "commands", "*")]: "allow",
68
68
  [".jonsoc/skills/*"]: "allow",
69
69
  [".jonsoc/commands/*"]: "allow",
70
- [".jonsoc/skills/*"]: "allow",
71
- [".jonsoc/commands/*"]: "allow",
72
70
  },
73
71
  question: "deny",
74
72
  plan_enter: "deny",
@@ -261,7 +261,6 @@ export const GithubInstallCommand = cmd({
261
261
 
262
262
  async function promptProvider() {
263
263
  const priority: Record<string, number> = {
264
- jonsoc: 0,
265
264
  jonsoc: 0,
266
265
  anthropic: 1,
267
266
  openai: 2,
@@ -32,15 +32,15 @@ export const ImportCommand = cmd({
32
32
  const isUrl = args.file.startsWith("http://") || args.file.startsWith("https://")
33
33
 
34
34
  if (isUrl) {
35
- const urlMatch = args.file.match(/https?:\/\/opncd\.ai\/share\/([a-zA-Z0-9_-]+)/)
35
+ const urlMatch = args.file.match(new RegExp(`https?://${Brand.DOMAIN}/share/([a-zA-Z0-9_-]+)`))
36
36
  if (!urlMatch) {
37
- process.stdout.write(`Invalid URL format. Expected: https://joc.ai/share/<slug>`)
37
+ process.stdout.write(`Invalid URL format. Expected: ${Brand.DOMAIN_WITH_PROTOCOL}/share/<slug>`)
38
38
  process.stdout.write(EOL)
39
39
  return
40
40
  }
41
41
 
42
42
  const slug = urlMatch[1]
43
- const response = await fetch(`https://joc.ai/api/share/${slug}`)
43
+ const response = await fetch(`${Brand.DOMAIN_WITH_PROTOCOL}/api/share/${slug}`)
44
44
 
45
45
  if (!response.ok) {
46
46
  process.stdout.write(`Failed to fetch share data: ${response.statusText}`)
@@ -161,7 +161,6 @@ export const DEFAULT_THEMES: Record<string, ThemeJson> = {
161
161
  ["one-dark"]: onedark,
162
162
  ["osaka-jade"]: osakaJade,
163
163
  jonsoc,
164
- jonsoc: jonsoc,
165
164
  orng,
166
165
  ["lucent-orng"]: lucentOrng,
167
166
  palenight,
@@ -7,12 +7,13 @@ import { MessageV2 } from "@/session/message-v2"
7
7
  import { Storage } from "@/storage/storage"
8
8
  import { Log } from "@/util/log"
9
9
  import type * as SDK from "@jonsoc/sdk/v2"
10
+ import { Brand } from "@/brand"
10
11
 
11
12
  export namespace ShareNext {
12
13
  const log = Log.create({ service: "share-next" })
13
14
 
14
15
  async function url() {
15
- return Config.get().then((x) => x.enterprise?.url ?? "https://joc.ai")
16
+ return Config.get().then((x) => x.enterprise?.url ?? Brand.DOMAIN_WITH_PROTOCOL)
16
17
  }
17
18
 
18
19
  const disabled =