@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.
- package/lib/claude/install.js +4 -1
- package/lib/local-doctor.js +563 -532
- package/lib/up/db.js +355 -318
- package/lib/up/fetch-app.js +33 -18
- package/package.json +1 -1
package/lib/up/fetch-app.js
CHANGED
|
@@ -13,40 +13,55 @@ import * as tar from 'tar';
|
|
|
13
13
|
const REPO = 'ucsandman/DashClaw';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
* The `dashclaw` npm package version mirrors the platform version (unified versioning).
|
|
16
|
+
* Resolve the latest installable platform version.
|
|
18
17
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
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.
|
|
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(
|
|
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)
|
|
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
|
-
`
|
|
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]
|
|
49
|
-
return
|
|
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
|
/**
|