@dashclaw/cli 0.7.0 → 0.7.3

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.
@@ -13,40 +13,55 @@ import * as tar from 'tar';
13
13
  const REPO = 'ucsandman/DashClaw';
14
14
 
15
15
  /**
16
- * Fetch the latest published platform version from the npm registry.
17
- * The `dashclaw` npm package version mirrors the platform version (unified versioning).
16
+ * Resolve the latest installable platform version.
18
17
  *
19
- * npm's version number is only trusted after verifying its git tag exists —
20
- * a publish that shipped without cutting its tag would otherwise 404 every
21
- * install. When the tag is missing, fall back to the latest GitHub release.
18
+ * GitHub releases are the platform-version pointer: a GitHub Release rides
19
+ * every ship, while npm's `dashclaw` version lags behind on platform-only
20
+ * releases the SDK packages republish only when SDK source changes, which
21
+ * once froze fresh installs at platform 4.63.2 while main was at 4.66.0
22
+ * (dropping, among others, the workspace-import route that trial graduation
23
+ * depends on). npm latest stays as the fallback for GitHub API failures or
24
+ * rate limits; either path is only trusted after a HEAD check confirms the
25
+ * tag's tarball actually exists.
22
26
  *
23
27
  * @param {typeof fetch} fetchImpl - injectable for tests
24
28
  * @param {{ error: (...args: any[]) => void }} logger
25
- * @returns {Promise<string>} semver string e.g. '4.21.0'
29
+ * @returns {Promise<string>} semver string e.g. '4.66.0'
26
30
  */
27
31
  export async function resolveAppVersion(fetchImpl = fetch, logger = console) {
32
+ try {
33
+ const rel = await fetchImpl(`https://api.github.com/repos/${REPO}/releases/latest`, {
34
+ headers: { accept: 'application/vnd.github+json' },
35
+ });
36
+ if (rel.ok) {
37
+ const tagName = (await rel.json()).tag_name;
38
+ const version = typeof tagName === 'string' ? tagName.replace(/^v/, '') : null;
39
+ if (version) {
40
+ const head = await fetchImpl(tarballUrl(version), { method: 'HEAD' });
41
+ if (head.ok) return version;
42
+ }
43
+ }
44
+ } catch {
45
+ // Network/API failure — fall through to the npm path below.
46
+ }
47
+
28
48
  const res = await fetchImpl('https://registry.npmjs.org/dashclaw/latest');
29
49
  if (!res.ok) {
30
- throw new Error(`npm registry lookup failed (${res.status}) — check your network and retry.`);
50
+ throw new Error(
51
+ `Version lookup failed: GitHub releases unavailable and npm registry answered ${res.status} — check your network and retry.`,
52
+ );
31
53
  }
32
54
  const { version } = await res.json();
33
55
  if (!version) throw new Error('npm registry returned no version for dashclaw.');
34
56
 
35
57
  const head = await fetchImpl(tarballUrl(version), { method: 'HEAD' });
36
- if (head.ok) return version;
37
-
38
- const rel = await fetchImpl(`https://api.github.com/repos/${REPO}/releases/latest`, {
39
- headers: { accept: 'application/vnd.github+json' },
40
- });
41
- const tagName = rel.ok ? (await rel.json()).tag_name : null;
42
- const fallback = typeof tagName === 'string' ? tagName.replace(/^v/, '') : null;
43
- if (!fallback) {
58
+ if (!head.ok) {
44
59
  throw new Error(
45
- `Tag v${version} (npm latest) is missing on GitHub and no release fallback was found — report this at https://github.com/${REPO}/issues.`,
60
+ `No installable version found: GitHub releases lookup failed and tag v${version} (npm latest) is missing on GitHub — report this at https://github.com/${REPO}/issues.`,
46
61
  );
47
62
  }
48
- logger.error(`[warn] npm reports ${version} but tag v${version} is missing; using latest GitHub release ${fallback} instead.`);
49
- return fallback;
63
+ logger.error(`[warn] GitHub releases lookup failed; using npm latest ${version} (may lag behind the newest platform release).`);
64
+ return version;
50
65
  }
51
66
 
52
67
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashclaw/cli",
3
- "version": "0.7.0",
3
+ "version": "0.7.3",
4
4
  "description": "DashClaw terminal client — approve agent actions and diagnose your instance",
5
5
  "type": "module",
6
6
  "keywords": [