@simpleplatform/contextualizer 1.0.3 → 1.0.4

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.
Files changed (2) hide show
  1. package/bin/index.js +19 -2
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { spawn } = require('node:child_process')
3
+ const { execFile, spawn } = require('node:child_process')
4
4
  const fs = require('node:fs')
5
5
  const path = require('node:path')
6
6
  const Stream = require('node:stream')
@@ -96,7 +96,24 @@ async function downloadBinary() {
96
96
  }
97
97
 
98
98
  async function run() {
99
- if (!fs.existsSync(binaryPath)) {
99
+ let needsDownload = true
100
+
101
+ if (fs.existsSync(binaryPath)) {
102
+ try {
103
+ // Check version silently
104
+ const execFileP = util.promisify(execFile)
105
+ const { stdout } = await execFileP(binaryPath, ['--version'])
106
+
107
+ if (stdout.trim() === VERSION) {
108
+ needsDownload = false
109
+ }
110
+ }
111
+ catch {
112
+ // Binary exists but might be corrupted or wrong architecture, so re-download
113
+ }
114
+ }
115
+
116
+ if (needsDownload) {
100
117
  // Attempt download
101
118
  await downloadBinary()
102
119
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simpleplatform/contextualizer",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Effortlessly package your project's source code into a single, context-rich file for LLMs.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://docs.simple.dev",