@apono-io/apono-mcp 0.2.2 → 0.2.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/lib/download.js +23 -41
  2. package/package.json +1 -1
package/lib/download.js CHANGED
@@ -7,6 +7,11 @@ const os = require("os");
7
7
  const { execFileSync } = require("child_process");
8
8
  const { BINARY_DIR, BINARY_NAME, BINARY_PATH, RELEASES_BASE_URL } = require("./paths");
9
9
 
10
+ function getPackageVersion() {
11
+ const pkg = require("../package.json");
12
+ return pkg.version;
13
+ }
14
+
10
15
  function getPlatform() {
11
16
  const platform = process.platform;
12
17
  switch (platform) {
@@ -127,49 +132,26 @@ function extractZip(archivePath, destDir) {
127
132
  }
128
133
  }
129
134
 
130
- const UPDATE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24 hours
131
- const LAST_CHECK_FILE = path.join(BINARY_DIR, ".last-update-check");
132
-
133
- function shouldCheckForUpdate() {
134
- try {
135
- if (!fs.existsSync(LAST_CHECK_FILE)) return true;
136
- const lastCheck = parseInt(fs.readFileSync(LAST_CHECK_FILE, "utf8"), 10);
137
- return Date.now() - lastCheck > UPDATE_CHECK_INTERVAL_MS;
138
- } catch {
139
- return true;
140
- }
141
- }
142
-
143
- function recordUpdateCheck() {
144
- try {
145
- fs.mkdirSync(BINARY_DIR, { recursive: true });
146
- fs.writeFileSync(LAST_CHECK_FILE, String(Date.now()));
147
- } catch {
148
- // ignore
149
- }
150
- }
151
-
152
135
  async function ensureBinary() {
136
+ const packageVersion = getPackageVersion();
153
137
  const installedVersion = getInstalledVersion();
154
138
 
155
- // If binary exists and we checked recently, skip the network call
156
- if (installedVersion && !shouldCheckForUpdate()) {
157
- return BINARY_PATH;
158
- }
159
-
160
- let latestVersion;
161
- try {
162
- latestVersion = await getLatestVersion();
163
- recordUpdateCheck();
164
- } catch (err) {
165
- if (installedVersion) {
166
- process.stderr.write(`Warning: Could not check for updates: ${err.message}\n`);
167
- return BINARY_PATH;
139
+ let targetVersion;
140
+ if (packageVersion !== "0.0.0") {
141
+ targetVersion = packageVersion;
142
+ } else {
143
+ try {
144
+ targetVersion = await getLatestVersion();
145
+ } catch (err) {
146
+ if (installedVersion) {
147
+ process.stderr.write(`Warning: Could not check for updates: ${err.message}\n`);
148
+ return BINARY_PATH;
149
+ }
150
+ throw new Error(`Failed to fetch latest version: ${err.message}`);
168
151
  }
169
- throw new Error(`Failed to fetch latest version: ${err.message}`);
170
152
  }
171
153
 
172
- if (installedVersion === latestVersion) {
154
+ if (installedVersion === targetVersion) {
173
155
  return BINARY_PATH;
174
156
  }
175
157
 
@@ -177,10 +159,10 @@ async function ensureBinary() {
177
159
  const archStr = getArch();
178
160
  validatePlatformArch(platformStr, archStr);
179
161
  const ext = getArchiveExtension();
180
- const archiveName = `apono-agentic-cli_${latestVersion}_${platformStr}_${archStr}.${ext}`;
181
- const downloadUrl = `${RELEASES_BASE_URL}/cli/v${latestVersion}/${archiveName}`;
162
+ const archiveName = `apono-agentic-cli_${targetVersion}_${platformStr}_${archStr}.${ext}`;
163
+ const downloadUrl = `${RELEASES_BASE_URL}/cli/v${targetVersion}/${archiveName}`;
182
164
 
183
- process.stderr.write(`Downloading Apono CLI v${latestVersion}...\n`);
165
+ process.stderr.write(`Downloading Apono CLI v${targetVersion}...\n`);
184
166
 
185
167
  const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "apono-"));
186
168
  const archivePath = path.join(tmpDir, archiveName);
@@ -223,7 +205,7 @@ async function ensureBinary() {
223
205
 
224
206
  fs.renameSync(tmpBinary, BINARY_PATH);
225
207
 
226
- process.stderr.write(`Apono CLI v${latestVersion} installed to ${BINARY_PATH}\n`);
208
+ process.stderr.write(`Apono CLI v${targetVersion} installed to ${BINARY_PATH}\n`);
227
209
  } finally {
228
210
  fs.rmSync(tmpDir, { recursive: true, force: true });
229
211
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apono-io/apono-mcp",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Apono MCP server for Claude Code, Claude Desktop, and Cursor",
5
5
  "bin": {
6
6
  "apono-mcp": "./bin/run.js"