@jetbrains/junie-cli 802.7.0 → 849.19.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
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@jetbrains/junie-cli",
3
- "version": "802.7.0",
4
- "junieVersion": "802.7",
3
+ "version": "849.19.0",
4
+ "junieVersion": "849.19",
5
5
  "description": "Junie command‑line client",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
7
- "repository": "https://github.com/jetbrains-junie/junie",
8
- "homepage": "https://github.com/jetbrains-junie/junie#readme",
7
+ "repository": "https://github.com/JetBrains/junie",
8
+ "homepage": "https://github.com/JetBrains/junie#readme",
9
9
  "bugs": {
10
- "url": "https://github.com/jetbrains-junie/junie/issues"
10
+ "url": "https://github.com/JetBrains/junie/issues"
11
11
  },
12
12
  "main": "bin/index.js",
13
13
  "bin": {
@@ -26,6 +26,6 @@
26
26
  "getExecutable.js"
27
27
  ],
28
28
  "dependencies": {
29
- "unzipper": "0.12.3"
29
+ "yauzl": "^3.2.0"
30
30
  }
31
31
  }
package/postinstall.js CHANGED
@@ -3,7 +3,7 @@
3
3
  const path = require("path")
4
4
  const fs = require("fs")
5
5
  const { pipeline } = require("stream/promises")
6
- const unzipper = require('unzipper')
6
+ const yauzl = require('yauzl')
7
7
  const os = require("os")
8
8
  const { execSync } = require("child_process")
9
9
 
@@ -51,7 +51,7 @@ function resolveTarget() {
51
51
  function buildUrl({arch, osName}) {
52
52
  const JUNIE_VERSION = require("./package.json").junieVersion
53
53
  const tag = `${JUNIE_VERSION}`
54
- return `https://github.com/jetbrains-junie/junie/releases/download/${tag}/junie-eap-${JUNIE_VERSION}-${osName}-${arch}.zip`
54
+ return `https://github.com/JetBrains/junie/releases/download/${tag}/junie-eap-${JUNIE_VERSION}-${osName}-${arch}.zip`
55
55
  }
56
56
 
57
57
  function stripQuarantine(targetPath) {
@@ -126,6 +126,53 @@ function printPathInstructions() {
126
126
  }
127
127
  }
128
128
 
129
+ function extractWithYauzl(zipPath, targetDir) {
130
+ return new Promise((resolve, reject) => {
131
+ yauzl.open(zipPath, { lazyEntries: true }, (err, zipfile) => {
132
+ if (err) return reject(err)
133
+ zipfile.on('entry', (entry) => {
134
+ const fullPath = path.join(targetDir, entry.fileName)
135
+ if (!fullPath.startsWith(path.normalize(targetDir) + path.sep)) {
136
+ zipfile.close()
137
+ return reject(new Error('Zip Slip attempt detected: ' + entry.fileName))
138
+ }
139
+ if (/\/$/.test(entry.fileName)) {
140
+ fs.mkdirSync(fullPath, { recursive: true })
141
+ zipfile.readEntry()
142
+ } else {
143
+ fs.mkdirSync(path.dirname(fullPath), { recursive: true })
144
+ zipfile.openReadStream(entry, (err, readStream) => {
145
+ if (err) {
146
+ zipfile.close()
147
+ return reject(err)
148
+ }
149
+ const writeStream = fs.createWriteStream(fullPath)
150
+ readStream.on('error', (err) => {
151
+ zipfile.close()
152
+ reject(err)
153
+ })
154
+ writeStream.on('error', (err) => {
155
+ zipfile.close()
156
+ reject(err)
157
+ })
158
+ writeStream.on('close', () => zipfile.readEntry())
159
+ readStream.pipe(writeStream)
160
+ })
161
+ }
162
+ })
163
+ zipfile.on('end', () => {
164
+ zipfile.close()
165
+ resolve()
166
+ })
167
+ zipfile.on('error', (err) => {
168
+ zipfile.close()
169
+ reject(err)
170
+ })
171
+ zipfile.readEntry()
172
+ })
173
+ })
174
+ }
175
+
129
176
  async function downloadAndInstall() {
130
177
  const {arch, osName} = resolveTarget()
131
178
  const url = buildUrl({arch, osName})
@@ -163,7 +210,13 @@ async function downloadAndInstall() {
163
210
  await pipeline(res.body, fs.createWriteStream(zipPath))
164
211
 
165
212
  console.log('[Junie] Extracting...')
166
- await fs.createReadStream(zipPath).pipe(unzipper.Extract({ path: targetDir })).promise()
213
+ try {
214
+ // Prefer system unzip for reliability
215
+ execSync(`unzip -q -o "${zipPath}" -d "${targetDir}"`, { stdio: 'ignore' })
216
+ } catch {
217
+ // Fallback to yauzl (reads central directory, reliable for large archives)
218
+ await extractWithYauzl(zipPath, targetDir)
219
+ }
167
220
 
168
221
  chmodRecursive(targetDir)
169
222
  stripQuarantine(targetDir)
@@ -192,4 +245,9 @@ async function main() {
192
245
  }
193
246
  }
194
247
 
195
- main()
248
+ // Allow importing for tests
249
+ if (require.main === module) {
250
+ main()
251
+ }
252
+
253
+ module.exports = { extractWithYauzl }
package/shim/junie CHANGED
@@ -76,10 +76,13 @@ get_binary_path() {
76
76
  # macOS: look for .app bundle
77
77
  if [[ -d "$version_dir/Applications/junie.app" ]]; then
78
78
  echo "$version_dir/Applications/junie.app/Contents/MacOS/junie"
79
- # Linux: look for junie/bin/junie
79
+ # Linux jpackage: look for junie-app/bin/junie
80
+ elif [[ -f "$version_dir/junie-app/bin/junie" ]]; then
81
+ echo "$version_dir/junie-app/bin/junie"
82
+ # Linux legacy: look for junie/bin/junie
80
83
  elif [[ -f "$version_dir/junie/bin/junie" ]]; then
81
84
  echo "$version_dir/junie/bin/junie"
82
- # Fallback: direct junie binary
85
+ # Fallback: direct junie binary/script
83
86
  elif [[ -f "$version_dir/junie" ]]; then
84
87
  echo "$version_dir/junie"
85
88
  else