@bakers-build/ui 0.11.1-next.8 → 0.12.0
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/src/ui.d.ts +8 -1
- package/dist/src/ui.js +24 -2
- package/package.json +5 -5
package/dist/src/ui.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BbCommandHost, type BbCommandPlugin, type BbConnectionConfig, type WorkspaceRecoveryOptions } from '@bakers-build/core';
|
|
1
|
+
import { type BbCommandHost, type BbCommandPlugin, type BbConnectionConfig, createBbConnectionContext, type WorkspaceRecoveryOptions } from '@bakers-build/core';
|
|
2
2
|
import { type UiInitialRoute } from './route.js';
|
|
3
3
|
import { type HomeConnection } from './ui-home.js';
|
|
4
4
|
/** A dropsh program (only the `parseAsync` the launcher drives). */
|
|
@@ -52,6 +52,13 @@ export interface BuildWriteClientOptions {
|
|
|
52
52
|
stateDir?: string;
|
|
53
53
|
plugins: BbConnectionConfig['plugins'];
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Reads a run's stored log from the download route, signed in like the client
|
|
57
|
+
* ('' for 204, no log). JSON:API returns `log`/`error_log` empty, so a
|
|
58
|
+
* read-modify-write of either needs this; any other answer throws rather than
|
|
59
|
+
* read as empty and let the write replace the log.
|
|
60
|
+
*/
|
|
61
|
+
export declare function runLogReader(context: Pick<Awaited<ReturnType<typeof createBbConnectionContext>>, 'http' | 'auth' | 'baseUrl'>): (runId: string, kind: "log" | "error_log") => Promise<string>;
|
|
55
62
|
/** Test/composition seams for `bakers ui`. */
|
|
56
63
|
export interface UiDeps {
|
|
57
64
|
workspaceRecovery?: WorkspaceRecoveryOptions;
|
package/dist/src/ui.js
CHANGED
|
@@ -3,7 +3,7 @@ import { homedir } from 'node:os';
|
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import { workspacePlugin } from '@bakers-build/addon-workspace';
|
|
6
|
-
import { CommandRunner,
|
|
6
|
+
import { CommandRunner, createBbConnectionContext, createLogger, exec, fetchUpdateNotice, loadReadyBbConnection, resolveCliVersion, setDefaultCommandRunner, } from '@bakers-build/core';
|
|
7
7
|
import { buildProgram as buildDropshProgram } from 'dropsh';
|
|
8
8
|
import { applyOpentuiLibc, reExecUnderBun, resolveBunBinary, shouldReExecUnderBun, } from './bun-runtime.js';
|
|
9
9
|
import { parseTarget, resolveHere, UI_VIEW_MODES, } from './route.js';
|
|
@@ -28,10 +28,32 @@ import { resolveProjectRooting } from './ui-home.js';
|
|
|
28
28
|
* with no resolvable provider still reads.
|
|
29
29
|
*/
|
|
30
30
|
async function buildWriteClientDefault(o) {
|
|
31
|
-
|
|
31
|
+
const context = await createBbConnectionContext({
|
|
32
32
|
site: { base_url: o.baseUrl, jsonapi_prefix: o.jsonapiPrefix },
|
|
33
33
|
plugins: o.plugins,
|
|
34
34
|
}, o.stateDir ? { stateDir: o.stateDir } : {});
|
|
35
|
+
return { ...context.client, runLog: runLogReader(context) };
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Reads a run's stored log from the download route, signed in like the client
|
|
39
|
+
* ('' for 204, no log). JSON:API returns `log`/`error_log` empty, so a
|
|
40
|
+
* read-modify-write of either needs this; any other answer throws rather than
|
|
41
|
+
* read as empty and let the write replace the log.
|
|
42
|
+
*/
|
|
43
|
+
export function runLogReader(context) {
|
|
44
|
+
return async (runId, kind) => {
|
|
45
|
+
const base = context.baseUrl.replace(/\/+$/, '');
|
|
46
|
+
const response = await context.http.send(await context.auth.apply({
|
|
47
|
+
method: 'GET',
|
|
48
|
+
url: `${base}/_bakers-api/run/${runId}/log/${kind}`,
|
|
49
|
+
headers: { 'Accept-Encoding': 'gzip' },
|
|
50
|
+
}));
|
|
51
|
+
if (response.status === 204)
|
|
52
|
+
return '';
|
|
53
|
+
if (response.status !== 200)
|
|
54
|
+
throw new Error(`Run ${runId} ${kind}: HTTP ${response.status}`);
|
|
55
|
+
return response.body;
|
|
56
|
+
};
|
|
35
57
|
}
|
|
36
58
|
/**
|
|
37
59
|
* The current branch of `cwd`. Git resolves this PER WORKTREE, so
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "bakers.build project-first cockpit: the `bakers ui` command plugin (renderer resolved dynamically).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"directory": "bakers-cli/ui"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@bakers-build/core": "^0.
|
|
30
|
-
"@bakers-build/addon-workspace": "^0.
|
|
29
|
+
"@bakers-build/core": "^0.12.0",
|
|
30
|
+
"@bakers-build/addon-workspace": "^0.12.0",
|
|
31
31
|
"commander": "^12.1.0",
|
|
32
32
|
"dropsh": "^0.8.2"
|
|
33
33
|
},
|
|
34
34
|
"bakersBuild": {
|
|
35
|
-
"commit": "
|
|
36
|
-
"channel": "
|
|
35
|
+
"commit": "4c0c7ffab0be833fb9cbb50b0784a949593f08e6",
|
|
36
|
+
"channel": "latest"
|
|
37
37
|
}
|
|
38
38
|
}
|