@multiclawcli/core 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/dist/index.js +10 -2
- package/dist/providers/detect.d.ts +13 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3238,6 +3238,14 @@ function sumCosts(results) {
|
|
|
3238
3238
|
|
|
3239
3239
|
// src/providers/detect.ts
|
|
3240
3240
|
import { spawn as spawn2 } from "child_process";
|
|
3241
|
+
function parseVersion(raw) {
|
|
3242
|
+
if (!raw) return void 0;
|
|
3243
|
+
const plain = raw.replace(SGR_RE, "");
|
|
3244
|
+
const firstLine = plain.split("\n")[0].trim();
|
|
3245
|
+
if (!firstLine) return void 0;
|
|
3246
|
+
return firstLine.match(/\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?/)?.[0] ?? firstLine;
|
|
3247
|
+
}
|
|
3248
|
+
var SGR_RE = new RegExp(`${String.fromCharCode(27)}\\[[0-9;]*m`, "g");
|
|
3241
3249
|
async function versionFor(command) {
|
|
3242
3250
|
return new Promise((resolve4) => {
|
|
3243
3251
|
let out = "";
|
|
@@ -3277,7 +3285,7 @@ async function detectProviders(opts) {
|
|
|
3277
3285
|
const v = await versionFor(exe);
|
|
3278
3286
|
if (v && spec.confirm(v)) {
|
|
3279
3287
|
matched = cmd;
|
|
3280
|
-
version = v;
|
|
3288
|
+
version = parseVersion(v);
|
|
3281
3289
|
source = bundled ? "bundled" : "path";
|
|
3282
3290
|
resolvedPath = bundled ? exe : void 0;
|
|
3283
3291
|
break;
|
|
@@ -3289,7 +3297,7 @@ async function detectProviders(opts) {
|
|
|
3289
3297
|
source = bundled ? "bundled" : "path";
|
|
3290
3298
|
resolvedPath = bundled ? exe : void 0;
|
|
3291
3299
|
if (opts?.withVersion) {
|
|
3292
|
-
version = await versionFor(exe);
|
|
3300
|
+
version = parseVersion(await versionFor(exe));
|
|
3293
3301
|
}
|
|
3294
3302
|
break;
|
|
3295
3303
|
}
|
|
@@ -20,6 +20,19 @@ export interface DetectedProvider {
|
|
|
20
20
|
/** Absolute path actually spawned, set only for a bundled bridge. */
|
|
21
21
|
resolvedPath?: string;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* The version token inside whatever a CLI prints for `--version`.
|
|
25
|
+
*
|
|
26
|
+
* Providers disagree on the shape: `0.95.0`, `codex-cli 0.162.1`,
|
|
27
|
+
* `@agentclientprotocol/codex-acp 2.5.0`. The package name in front is noise —
|
|
28
|
+
* the row already names the provider — and at 35 characters it is wider than
|
|
29
|
+
* the column it goes in, which pushed `bundled` up against the version and made
|
|
30
|
+
* the table unreadable. So the table gets the number, not the sentence.
|
|
31
|
+
*
|
|
32
|
+
* Falls back to the first line when nothing looks like a version, rather than
|
|
33
|
+
* returning nothing: "it printed something unexpected" is worth seeing.
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseVersion(raw: string | undefined): string | undefined;
|
|
23
36
|
/**
|
|
24
37
|
* Discover which providers are installed on this machine.
|
|
25
38
|
*
|