@dashclaw/cli 0.6.0 → 0.6.1

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/README.md CHANGED
@@ -48,7 +48,7 @@ npx dashclaw up --yes # non-interactive, accept all defaults
48
48
  npx dashclaw up --no-browser # skip opening /setup in the browser
49
49
  npx dashclaw up --db docker # force Docker Postgres
50
50
  npx dashclaw up --db embedded # force embedded Postgres (~40 MB download)
51
- npx dashclaw up --db <url> # use an existing postgresql:// connection string
51
+ npx dashclaw up --db url # bring your own Postgres — prompts for a postgresql:// connection string
52
52
  npx dashclaw up --dir <path> # install to a custom directory (default: ~/.dashclaw)
53
53
  npx dashclaw up --port <n> # bind to a custom port (default: 3000)
54
54
  npx dashclaw up --source-dir <path> # use a local repo checkout instead of the published tarball
@@ -16,17 +16,37 @@ const REPO = 'ucsandman/DashClaw';
16
16
  * Fetch the latest published platform version from the npm registry.
17
17
  * The `dashclaw` npm package version mirrors the platform version (unified versioning).
18
18
  *
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.
22
+ *
19
23
  * @param {typeof fetch} fetchImpl - injectable for tests
24
+ * @param {{ error: (...args: any[]) => void }} logger
20
25
  * @returns {Promise<string>} semver string e.g. '4.21.0'
21
26
  */
22
- export async function resolveAppVersion(fetchImpl = fetch) {
27
+ export async function resolveAppVersion(fetchImpl = fetch, logger = console) {
23
28
  const res = await fetchImpl('https://registry.npmjs.org/dashclaw/latest');
24
29
  if (!res.ok) {
25
30
  throw new Error(`npm registry lookup failed (${res.status}) — check your network and retry.`);
26
31
  }
27
32
  const { version } = await res.json();
28
33
  if (!version) throw new Error('npm registry returned no version for dashclaw.');
29
- return version;
34
+
35
+ 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) {
44
+ 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.`,
46
+ );
47
+ }
48
+ logger.error(`[warn] npm reports ${version} but tag v${version} is missing; using latest GitHub release ${fallback} instead.`);
49
+ return fallback;
30
50
  }
31
51
 
32
52
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashclaw/cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "DashClaw terminal client — approve agent actions and diagnose your instance",
5
5
  "type": "module",
6
6
  "keywords": [