@m8t-stack/cli 0.2.60 → 0.2.62
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/cli.js +111 -34
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1364,7 +1364,7 @@ var init_enable_hosted_brain = __esm({
|
|
|
1364
1364
|
import { Builtins, Cli } from "clipanion";
|
|
1365
1365
|
|
|
1366
1366
|
// src/lib/package-version.ts
|
|
1367
|
-
var CLI_VERSION = "0.2.
|
|
1367
|
+
var CLI_VERSION = "0.2.62";
|
|
1368
1368
|
|
|
1369
1369
|
// src/lib/render-error.ts
|
|
1370
1370
|
init_errors();
|
|
@@ -28858,7 +28858,7 @@ ${colors.error("\u2717")} The GitHub App on disk is installed on ${colors.field(
|
|
|
28858
28858
|
// src/commands/bootstrap/launch.ts
|
|
28859
28859
|
var DEFAULT_RG = "rg-m8t-stack";
|
|
28860
28860
|
var DEFAULT_INSTALLER = "ghcr.io/m8t-labs/m8t-installer";
|
|
28861
|
-
var DEFAULT_INSTALLER_TAG = "v0.1.
|
|
28861
|
+
var DEFAULT_INSTALLER_TAG = "v0.1.53";
|
|
28862
28862
|
var ACI_NAME = "m8t-installer";
|
|
28863
28863
|
var MI_NAME = "m8t-installer-mi";
|
|
28864
28864
|
var BootstrapLaunchCommand = class extends M8tCommand {
|
|
@@ -31086,13 +31086,16 @@ function defaultLocalCompanionInstallOptions() {
|
|
|
31086
31086
|
getStartAtLogin: (executable) => getCompanionStartAtLogin({ homeDirectory, platform, executable })
|
|
31087
31087
|
};
|
|
31088
31088
|
}
|
|
31089
|
-
async function convergeCompanionFromChannel(converge2,
|
|
31089
|
+
async function convergeCompanionFromChannel(converge2, options = {}) {
|
|
31090
|
+
const { from: stagedDirectory, resourceGroup, platformVersion } = options;
|
|
31090
31091
|
let artifactManifestPath;
|
|
31091
31092
|
let dispose = () => Promise.resolve();
|
|
31092
31093
|
if (stagedDirectory !== void 0) {
|
|
31093
31094
|
artifactManifestPath = path37.resolve(stagedDirectory, "artifact-v1.json");
|
|
31094
31095
|
} else {
|
|
31095
|
-
const release = await readCompanionRelease(
|
|
31096
|
+
const release = await readCompanionRelease(
|
|
31097
|
+
platformVersion !== void 0 ? { channel: true, version: platformTag(platformVersion) } : { url: CHANNEL_LATEST_URL }
|
|
31098
|
+
);
|
|
31096
31099
|
if (release === null) return { state: "not-released" };
|
|
31097
31100
|
const build = await downloadCompanionArtifact(release.component);
|
|
31098
31101
|
artifactManifestPath = build.artifactManifestPath;
|
|
@@ -31113,7 +31116,7 @@ async function runCompanionInstallCommand(stdout, install) {
|
|
|
31113
31116
|
const state = await install();
|
|
31114
31117
|
if (state.state === "not-released") {
|
|
31115
31118
|
stdout.write(
|
|
31116
|
-
"The
|
|
31119
|
+
"The latest platform release carries no desktop companions.\nThey arrive with a platform release \u2014 run: m8t platform update\n"
|
|
31117
31120
|
);
|
|
31118
31121
|
return 1;
|
|
31119
31122
|
}
|
|
@@ -31149,7 +31152,10 @@ var CompanionInstallCommand = class extends M8tCommand {
|
|
|
31149
31152
|
async executeCommand() {
|
|
31150
31153
|
return runCompanionInstallCommand(
|
|
31151
31154
|
this.context.stdout,
|
|
31152
|
-
() => convergeCompanionFromChannel(installCompanion,
|
|
31155
|
+
() => convergeCompanionFromChannel(installCompanion, {
|
|
31156
|
+
...this.from !== void 0 ? { from: this.from } : {},
|
|
31157
|
+
...this.resourceGroup !== void 0 ? { resourceGroup: this.resourceGroup } : {}
|
|
31158
|
+
})
|
|
31153
31159
|
);
|
|
31154
31160
|
}
|
|
31155
31161
|
};
|
|
@@ -31175,7 +31181,10 @@ var defaultDeps2 = {
|
|
|
31175
31181
|
runUsagePhase,
|
|
31176
31182
|
reactiveSeed: reactiveSeedOnInstallComplete,
|
|
31177
31183
|
companionsSupportHost,
|
|
31178
|
-
|
|
31184
|
+
companionStatus: () => statusCompanion(defaultLocalCompanionInstallOptions()),
|
|
31185
|
+
convergeCompanion: (platformVersion) => convergeCompanionFromChannel(installCompanion, {
|
|
31186
|
+
...platformVersion !== void 0 ? { platformVersion } : {}
|
|
31187
|
+
}),
|
|
31179
31188
|
homedir: () => os18.homedir()
|
|
31180
31189
|
};
|
|
31181
31190
|
async function finalizeInstall(args, deps = defaultDeps2) {
|
|
@@ -31266,25 +31275,6 @@ async function finalizeInstall(args, deps = defaultDeps2) {
|
|
|
31266
31275
|
` : "") + "\n"
|
|
31267
31276
|
);
|
|
31268
31277
|
}
|
|
31269
|
-
if (webappUrl !== void 0 && deps.companionsSupportHost()) {
|
|
31270
|
-
try {
|
|
31271
|
-
const companion = await deps.convergeCompanion();
|
|
31272
|
-
if (companion.state === "installed") {
|
|
31273
|
-
args.stdout("Desktop companions installed: Stacey and Azzy are ready.\n\n");
|
|
31274
|
-
} else if (companion.state !== "not-released") {
|
|
31275
|
-
throw new Error("companion installation is not verified");
|
|
31276
|
-
}
|
|
31277
|
-
} catch (e) {
|
|
31278
|
-
const reason = e instanceof Error ? e.message : String(e);
|
|
31279
|
-
args.stdout(
|
|
31280
|
-
`Platform installation succeeded, but the desktop companions need repair.
|
|
31281
|
-
Run: m8t companion repair
|
|
31282
|
-
${colors.hint(reason)}
|
|
31283
|
-
|
|
31284
|
-
`
|
|
31285
|
-
);
|
|
31286
|
-
}
|
|
31287
|
-
}
|
|
31288
31278
|
let brainOrg = null;
|
|
31289
31279
|
try {
|
|
31290
31280
|
const credsRaw = await fs34.readFile(path38.join(markerDir, "github-app.json"), "utf8");
|
|
@@ -31315,6 +31305,49 @@ ${colors.field("Then open a brand new chat/session")} \u2014 new skills + MCP se
|
|
|
31315
31305
|
`
|
|
31316
31306
|
);
|
|
31317
31307
|
}
|
|
31308
|
+
if (webappUrl === void 0) {
|
|
31309
|
+
} else if (!deps.companionsSupportHost()) {
|
|
31310
|
+
args.stdout(
|
|
31311
|
+
`Desktop companions are not built for ${process.platform}-${process.arch} \u2014 skipped.
|
|
31312
|
+
${colors.hint("They are macOS and Windows only.")}
|
|
31313
|
+
|
|
31314
|
+
`
|
|
31315
|
+
);
|
|
31316
|
+
} else {
|
|
31317
|
+
const alreadyHasCompanion = await deps.companionStatus().then((s) => s.state !== "not-installed").catch(() => true);
|
|
31318
|
+
const pinned = alreadyHasCompanion ? void 0 : args.doc.result?.platformVersion;
|
|
31319
|
+
args.stdout(
|
|
31320
|
+
(pinned === void 0 ? "Putting Stacey and Azzy on your desktop \u2014 fetching the latest released build\n" : `Putting Stacey and Azzy on your desktop \u2014 fetching the build ${pinned} pins
|
|
31321
|
+
`) + ` ${colors.hint("(about 120 MB; on a slow link this takes a few minutes)")}
|
|
31322
|
+
`
|
|
31323
|
+
);
|
|
31324
|
+
try {
|
|
31325
|
+
const companion = await deps.convergeCompanion(pinned);
|
|
31326
|
+
if (companion.state === "installed") {
|
|
31327
|
+
args.stdout("Desktop companions installed: Stacey and Azzy are ready.\n\n");
|
|
31328
|
+
} else if (companion.state === "not-released") {
|
|
31329
|
+
args.stdout(
|
|
31330
|
+
`${pinned === void 0 ? "The latest platform release carries no desktop companions." : `The release this platform is pinned to (${pinned}) carries no desktop companions.`}
|
|
31331
|
+
They arrive with a platform release \u2014 run: m8t platform update
|
|
31332
|
+
|
|
31333
|
+
`
|
|
31334
|
+
);
|
|
31335
|
+
} else {
|
|
31336
|
+
throw new Error(
|
|
31337
|
+
companion.state === "needs-repair" ? companion.reason : `companion installation is not verified (${companion.state})`
|
|
31338
|
+
);
|
|
31339
|
+
}
|
|
31340
|
+
} catch (e) {
|
|
31341
|
+
const reason = e instanceof Error ? e.message : String(e);
|
|
31342
|
+
args.stdout(
|
|
31343
|
+
`Platform installation succeeded, but the desktop companions need repair.
|
|
31344
|
+
Run: m8t companion repair
|
|
31345
|
+
${colors.hint(reason)}
|
|
31346
|
+
|
|
31347
|
+
`
|
|
31348
|
+
);
|
|
31349
|
+
}
|
|
31350
|
+
}
|
|
31318
31351
|
}
|
|
31319
31352
|
|
|
31320
31353
|
// src/commands/bootstrap/status.ts
|
|
@@ -33568,10 +33601,52 @@ var CompanionBridgeCommand = class extends Command61 {
|
|
|
33568
33601
|
|
|
33569
33602
|
// src/commands/companion/status.ts
|
|
33570
33603
|
import { Command as Command62 } from "clipanion";
|
|
33571
|
-
async function
|
|
33604
|
+
async function withTimeout(work, ms) {
|
|
33605
|
+
let timer;
|
|
33606
|
+
try {
|
|
33607
|
+
return await Promise.race([
|
|
33608
|
+
work,
|
|
33609
|
+
new Promise((_, reject) => {
|
|
33610
|
+
timer = setTimeout(() => {
|
|
33611
|
+
reject(new Error("channel timed out"));
|
|
33612
|
+
}, ms);
|
|
33613
|
+
})
|
|
33614
|
+
]);
|
|
33615
|
+
} finally {
|
|
33616
|
+
if (timer) clearTimeout(timer);
|
|
33617
|
+
}
|
|
33618
|
+
}
|
|
33619
|
+
async function runCompanionStatusCommand(stdout, status, options = {}) {
|
|
33620
|
+
const { update, channel, timeoutMs = 1e4, host } = options;
|
|
33572
33621
|
const state = await status();
|
|
33573
33622
|
if (state.state === "not-installed") {
|
|
33574
33623
|
stdout.write("Desktop companions are not installed.\n");
|
|
33624
|
+
let answered = null;
|
|
33625
|
+
if (channel) {
|
|
33626
|
+
try {
|
|
33627
|
+
answered = { release: await withTimeout(channel(), timeoutMs) };
|
|
33628
|
+
} catch {
|
|
33629
|
+
answered = null;
|
|
33630
|
+
}
|
|
33631
|
+
}
|
|
33632
|
+
if (answered === null) return 0;
|
|
33633
|
+
const { release } = answered;
|
|
33634
|
+
if (release === null) {
|
|
33635
|
+
stdout.write(
|
|
33636
|
+
"The latest platform release carries no desktop companions.\nThey arrive with a platform release \u2014 run: m8t platform update\n"
|
|
33637
|
+
);
|
|
33638
|
+
} else if (companionAssetFor(release.component, host?.platform, host?.architecture) === null) {
|
|
33639
|
+
stdout.write(
|
|
33640
|
+
`The latest platform release (${platformTag(release.platformVersion)}) carries no companion build for this host.
|
|
33641
|
+
`
|
|
33642
|
+
);
|
|
33643
|
+
} else {
|
|
33644
|
+
stdout.write(
|
|
33645
|
+
`A companion build is available (${release.component.version}).
|
|
33646
|
+
Run: m8t companion install
|
|
33647
|
+
`
|
|
33648
|
+
);
|
|
33649
|
+
}
|
|
33575
33650
|
return 0;
|
|
33576
33651
|
}
|
|
33577
33652
|
if (state.state === "needs-repair") {
|
|
@@ -33602,11 +33677,11 @@ var CompanionStatusCommand = class extends M8tCommand {
|
|
|
33602
33677
|
});
|
|
33603
33678
|
async executeCommand() {
|
|
33604
33679
|
const options = defaultLocalCompanionInstallOptions();
|
|
33605
|
-
return runCompanionStatusCommand(
|
|
33606
|
-
|
|
33607
|
-
() =>
|
|
33608
|
-
|
|
33609
|
-
);
|
|
33680
|
+
return runCompanionStatusCommand(this.context.stdout, () => statusCompanion(options), {
|
|
33681
|
+
update: () => checkCompanionUpdate(options),
|
|
33682
|
+
channel: () => readCompanionRelease(),
|
|
33683
|
+
host: { platform: options.platform, architecture: options.architecture }
|
|
33684
|
+
});
|
|
33610
33685
|
}
|
|
33611
33686
|
};
|
|
33612
33687
|
|
|
@@ -33616,7 +33691,7 @@ async function runCompanionRepairCommand(stdout, repair) {
|
|
|
33616
33691
|
const state = await repair();
|
|
33617
33692
|
if (state.state === "not-released") {
|
|
33618
33693
|
stdout.write(
|
|
33619
|
-
"The
|
|
33694
|
+
"The latest platform release carries no desktop companions.\nThere is nothing to repair to \u2014 run: m8t platform update\n"
|
|
33620
33695
|
);
|
|
33621
33696
|
return 1;
|
|
33622
33697
|
}
|
|
@@ -33639,7 +33714,9 @@ var CompanionRepairCommand = class extends M8tCommand {
|
|
|
33639
33714
|
async executeCommand() {
|
|
33640
33715
|
return runCompanionRepairCommand(
|
|
33641
33716
|
this.context.stdout,
|
|
33642
|
-
() => convergeCompanionFromChannel(repairCompanion,
|
|
33717
|
+
() => convergeCompanionFromChannel(repairCompanion, {
|
|
33718
|
+
...this.resourceGroup !== void 0 ? { resourceGroup: this.resourceGroup } : {}
|
|
33719
|
+
})
|
|
33643
33720
|
);
|
|
33644
33721
|
}
|
|
33645
33722
|
};
|