vibes-diy 14.3.412 → 14.3.413
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/cli/cmd-evento.d.ts +333 -318
- package/cli/cmd-evento.js +2 -1
- package/cli/cmds/app/index.d.ts +29 -0
- package/cli/cmds/app/index.js +3 -0
- package/cli/cmds/app/tick-cmd.d.ts +46 -0
- package/cli/cmds/app/tick-cmd.js +135 -0
- package/cli/cmds/db/del-cmd.d.ts +2 -0
- package/cli/cmds/db/del-cmd.js +3 -1
- package/cli/cmds/db/get-cmd.d.ts +2 -0
- package/cli/cmds/db/get-cmd.js +3 -1
- package/cli/cmds/db/index.d.ts +8 -0
- package/cli/cmds/db/put-cmd.d.ts +2 -0
- package/cli/cmds/db/put-cmd.js +4 -2
- package/cli/cmds/db/query-cmd.d.ts +2 -0
- package/cli/cmds/db/query-cmd.js +3 -1
- package/cli/cmds/db/shared.d.ts +6 -0
- package/cli/cmds/db/shared.js +18 -2
- package/cli/cmds/run/backend-worker/run-backend-entry.js +328 -34
- package/cli/cmds/run/bundle-inputs.json +1 -0
- package/cli/cmds/run/run-bundle.js +569 -294
- package/cli/main.js +13 -1
- package/package.json +8 -8
package/cli/cmd-evento.js
CHANGED
|
@@ -21,7 +21,7 @@ import { pullEvento } from "./cmds/pull-cmd.js";
|
|
|
21
21
|
import { runEvento } from "./cmds/run/run-cmd.js";
|
|
22
22
|
import { versionsEvento } from "./cmds/versions-cmd.js";
|
|
23
23
|
import { assetsLsEvento } from "./cmds/assets-cmd.js";
|
|
24
|
-
import { appStatusEvento, appRearmEvento, appScheduleOffEvento, appLogsEvento, appChipsEvento, appScreenshotEvento, appLookEvento, appAnonWriteEvento, appAutoEnhanceEvento, appCallEvento, } from "./cmds/app/index.js";
|
|
24
|
+
import { appStatusEvento, appRearmEvento, appTickEvento, appScheduleOffEvento, appLogsEvento, appChipsEvento, appScreenshotEvento, appLookEvento, appAnonWriteEvento, appAutoEnhanceEvento, appCallEvento, } from "./cmds/app/index.js";
|
|
25
25
|
import { setUnpublishEvento, publishEvento } from "./cmds/unpublish-cmd.js";
|
|
26
26
|
import { secretsEvento } from "./cmds/secrets/secrets-cmd.js";
|
|
27
27
|
import { recommendEvento } from "./cmds/recommend/recommend-cmd.js";
|
|
@@ -61,6 +61,7 @@ export function cliEventoHandlers() {
|
|
|
61
61
|
assetsLsEvento,
|
|
62
62
|
appStatusEvento,
|
|
63
63
|
appRearmEvento,
|
|
64
|
+
appTickEvento,
|
|
64
65
|
appScreenshotEvento,
|
|
65
66
|
appScheduleOffEvento,
|
|
66
67
|
appLogsEvento,
|
package/cli/cmds/app/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CliCtx } from "../../cli-ctx.js";
|
|
2
2
|
export { appStatusEvento, isResAppStatusCli, renderAppStatusLines, type ResAppStatusCli } from "./status-cmd.js";
|
|
3
3
|
export { appRearmEvento, isResAppRearmCli, renderAppRearmLines, type ResAppRearmCli } from "./rearm-cmd.js";
|
|
4
|
+
export { appTickEvento, isResAppTickCli, renderAppTickLines, type ResAppTickCli } from "./tick-cmd.js";
|
|
4
5
|
export { appScheduleOffEvento, isResAppScheduleOffCli, renderAppScheduleOffLines, type ResAppScheduleOffCli, } from "./schedule-cmd.js";
|
|
5
6
|
export { appLogsEvento, isResAppLogsCli, renderAppLogLines, parseSince, type ResAppLogsCli } from "./logs-cmd.js";
|
|
6
7
|
export { appChipsEvento, isResAppChipsCli, renderAppChipsLines, type ResAppChipsCli } from "./chips-cmd.js";
|
|
@@ -155,6 +156,17 @@ export declare function appSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist
|
|
|
155
156
|
vibe: string;
|
|
156
157
|
handle: string;
|
|
157
158
|
};
|
|
159
|
+
} | {
|
|
160
|
+
command: "tick";
|
|
161
|
+
args: {
|
|
162
|
+
apiUrl: string;
|
|
163
|
+
json: boolean;
|
|
164
|
+
text: boolean;
|
|
165
|
+
appSlug: string | undefined;
|
|
166
|
+
vibe: string;
|
|
167
|
+
handle: string;
|
|
168
|
+
at: string;
|
|
169
|
+
};
|
|
158
170
|
}>>;
|
|
159
171
|
} & import("cmd-ts/dist/cjs/helpdoc.js").Named & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Descriptive & import("cmd-ts/dist/cjs/helpdoc.js").Versioned> & import("cmd-ts/dist/cjs/helpdoc.js").PrintHelp & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned> & import("cmd-ts/dist/cjs/argparser.js").Register & import("cmd-ts/dist/cjs/runner.js").Handling<{
|
|
160
172
|
command: "anon-write";
|
|
@@ -301,6 +313,17 @@ export declare function appSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist
|
|
|
301
313
|
vibe: string;
|
|
302
314
|
handle: string;
|
|
303
315
|
};
|
|
316
|
+
} | {
|
|
317
|
+
command: "tick";
|
|
318
|
+
args: {
|
|
319
|
+
apiUrl: string;
|
|
320
|
+
json: boolean;
|
|
321
|
+
text: boolean;
|
|
322
|
+
appSlug: string | undefined;
|
|
323
|
+
vibe: string;
|
|
324
|
+
handle: string;
|
|
325
|
+
at: string;
|
|
326
|
+
};
|
|
304
327
|
}, {
|
|
305
328
|
command: "anon-write";
|
|
306
329
|
value: never;
|
|
@@ -340,6 +363,9 @@ export declare function appSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist
|
|
|
340
363
|
} | {
|
|
341
364
|
command: "status";
|
|
342
365
|
value: never;
|
|
366
|
+
} | {
|
|
367
|
+
command: "tick";
|
|
368
|
+
value: never;
|
|
343
369
|
}> & {
|
|
344
370
|
run(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
|
|
345
371
|
command: "anon-write";
|
|
@@ -380,5 +406,8 @@ export declare function appSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist
|
|
|
380
406
|
} | {
|
|
381
407
|
command: "status";
|
|
382
408
|
value: never;
|
|
409
|
+
} | {
|
|
410
|
+
command: "tick";
|
|
411
|
+
value: never;
|
|
383
412
|
}>>;
|
|
384
413
|
};
|
package/cli/cmds/app/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { subcommands } from "cmd-ts";
|
|
2
2
|
import { appStatusCmd } from "./status-cmd.js";
|
|
3
3
|
import { appRearmCmd } from "./rearm-cmd.js";
|
|
4
|
+
import { appTickCmd } from "./tick-cmd.js";
|
|
4
5
|
import { appScheduleCmd } from "./schedule-cmd.js";
|
|
5
6
|
import { appLogsCmd } from "./logs-cmd.js";
|
|
6
7
|
import { appChipsCmd } from "./chips-cmd.js";
|
|
@@ -11,6 +12,7 @@ import { appAutoEnhanceCmd } from "./auto-enhance-cmd.js";
|
|
|
11
12
|
import { appCallCmd } from "./call-cmd.js";
|
|
12
13
|
export { appStatusEvento, isResAppStatusCli, renderAppStatusLines } from "./status-cmd.js";
|
|
13
14
|
export { appRearmEvento, isResAppRearmCli, renderAppRearmLines } from "./rearm-cmd.js";
|
|
15
|
+
export { appTickEvento, isResAppTickCli, renderAppTickLines } from "./tick-cmd.js";
|
|
14
16
|
export { appScheduleOffEvento, isResAppScheduleOffCli, renderAppScheduleOffLines, } from "./schedule-cmd.js";
|
|
15
17
|
export { appLogsEvento, isResAppLogsCli, renderAppLogLines, parseSince } from "./logs-cmd.js";
|
|
16
18
|
export { appChipsEvento, isResAppChipsCli, renderAppChipsLines } from "./chips-cmd.js";
|
|
@@ -26,6 +28,7 @@ export function appSubcommands(ctx) {
|
|
|
26
28
|
cmds: {
|
|
27
29
|
status: appStatusCmd(ctx),
|
|
28
30
|
rearm: appRearmCmd(ctx),
|
|
31
|
+
tick: appTickCmd(ctx),
|
|
29
32
|
schedule: appScheduleCmd(ctx),
|
|
30
33
|
logs: appLogsCmd(ctx),
|
|
31
34
|
chips: appChipsCmd(ctx),
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EventoHandler } from "@adviser/cement";
|
|
2
|
+
import { CliCtx } from "../../cli-ctx.js";
|
|
3
|
+
import { WrapCmdTSMsg } from "../../cmd-evento.js";
|
|
4
|
+
export declare const ReqAppTick: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
5
|
+
type: "vibes-diy.cli.app-tick";
|
|
6
|
+
appSlug: string;
|
|
7
|
+
ownerHandle: string;
|
|
8
|
+
at: string;
|
|
9
|
+
apiUrl: string;
|
|
10
|
+
}, {}>;
|
|
11
|
+
export type ReqAppTick = typeof ReqAppTick.infer;
|
|
12
|
+
export declare function isReqAppTick(obj: unknown): obj is ReqAppTick;
|
|
13
|
+
export declare const ResAppTickCli: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
14
|
+
type: "vibes-diy.cli.res-app-tick";
|
|
15
|
+
appSlug: string;
|
|
16
|
+
ownerHandle: string;
|
|
17
|
+
scheduledTime: string;
|
|
18
|
+
ran: boolean;
|
|
19
|
+
reason: string | null;
|
|
20
|
+
detail: string | null;
|
|
21
|
+
}, {}>;
|
|
22
|
+
export type ResAppTickCli = typeof ResAppTickCli.infer;
|
|
23
|
+
export declare function isResAppTickCli(obj: unknown): obj is ResAppTickCli;
|
|
24
|
+
export declare function renderAppTickLines(msg: ResAppTickCli): string[];
|
|
25
|
+
export declare const appTickEvento: EventoHandler<WrapCmdTSMsg<unknown>, ReqAppTick, ResAppTickCli>;
|
|
26
|
+
export declare function appTickCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
|
|
27
|
+
parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
|
|
28
|
+
apiUrl: string;
|
|
29
|
+
json: boolean;
|
|
30
|
+
text: boolean;
|
|
31
|
+
appSlug: string | undefined;
|
|
32
|
+
vibe: string;
|
|
33
|
+
handle: string;
|
|
34
|
+
at: string;
|
|
35
|
+
}>>;
|
|
36
|
+
} & import("cmd-ts/dist/cjs/helpdoc.js").PrintHelp & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & import("cmd-ts/dist/cjs/helpdoc.js").Named & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned> & import("cmd-ts/dist/cjs/argparser.js").Register & import("cmd-ts/dist/cjs/runner.js").Handling<{
|
|
37
|
+
apiUrl: string;
|
|
38
|
+
json: boolean;
|
|
39
|
+
text: boolean;
|
|
40
|
+
appSlug: string | undefined;
|
|
41
|
+
vibe: string;
|
|
42
|
+
handle: string;
|
|
43
|
+
at: string;
|
|
44
|
+
}, never> & {
|
|
45
|
+
run(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<never>>;
|
|
46
|
+
} & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned & import("cmd-ts/dist/cjs/helpdoc.js").Descriptive & import("cmd-ts/dist/cjs/helpdoc.js").Aliased>;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { command, option, optional, positional, string } from "cmd-ts";
|
|
2
|
+
import { Result, Option } from "@adviser/cement";
|
|
3
|
+
import { type } from "arktype";
|
|
4
|
+
import { cmdTsDefaultArgs } from "../../cli-ctx.js";
|
|
5
|
+
import { sendMsg } from "../../cmd-evento.js";
|
|
6
|
+
import { resolveHandle } from "../../resolve-handle.js";
|
|
7
|
+
import { resolveVibePositionals } from "../../parse-vibe.js";
|
|
8
|
+
import { formatErr } from "../format-err.js";
|
|
9
|
+
import { HANDLE_REQUIRED_CLI_MESSAGE } from "../../handle-required.js";
|
|
10
|
+
import { HANDLE_FLAG_HELP, VIBE_FLAG_HELP, VIBE_POSITIONAL_HELP } from "../../vibe-arg-help.js";
|
|
11
|
+
export const ReqAppTick = type({
|
|
12
|
+
type: "'vibes-diy.cli.app-tick'",
|
|
13
|
+
appSlug: "string",
|
|
14
|
+
ownerHandle: "string",
|
|
15
|
+
at: "string",
|
|
16
|
+
apiUrl: "string",
|
|
17
|
+
});
|
|
18
|
+
export function isReqAppTick(obj) {
|
|
19
|
+
return ReqAppTick.allows(obj);
|
|
20
|
+
}
|
|
21
|
+
export const ResAppTickCli = type({
|
|
22
|
+
type: "'vibes-diy.cli.res-app-tick'",
|
|
23
|
+
appSlug: "string",
|
|
24
|
+
ownerHandle: "string",
|
|
25
|
+
scheduledTime: "string",
|
|
26
|
+
ran: "boolean",
|
|
27
|
+
reason: "string|null",
|
|
28
|
+
detail: "string|null",
|
|
29
|
+
});
|
|
30
|
+
export function isResAppTickCli(obj) {
|
|
31
|
+
return ResAppTickCli.allows(obj);
|
|
32
|
+
}
|
|
33
|
+
export function renderAppTickLines(msg) {
|
|
34
|
+
const app = `${msg.ownerHandle}/${msg.appSlug}`;
|
|
35
|
+
if (msg.ran) {
|
|
36
|
+
return [
|
|
37
|
+
`${app}: ran the scheduled task as of ${msg.scheduledTime}.`,
|
|
38
|
+
" the real schedule is unchanged; its next tick comes when it was due",
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
if (msg.reason === "no_schedule") {
|
|
42
|
+
return [`${app}: nothing ran — the live release exports no \`scheduled\` handler, or scheduled runs are paused.`];
|
|
43
|
+
}
|
|
44
|
+
return [
|
|
45
|
+
`${app}: the scheduled task as of ${msg.scheduledTime} did not finish (${msg.reason ?? "unknown"}).`,
|
|
46
|
+
...(msg.detail === null ? [] : [` ${msg.detail}`]),
|
|
47
|
+
" the real schedule is unchanged",
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
export const appTickEvento = {
|
|
51
|
+
hash: "vibes-diy.cli.app-tick",
|
|
52
|
+
validate: (ctx) => {
|
|
53
|
+
if (isReqAppTick(ctx.enRequest)) {
|
|
54
|
+
return Promise.resolve(Result.Ok(Option.Some(ctx.enRequest)));
|
|
55
|
+
}
|
|
56
|
+
return Promise.resolve(Result.Ok(Option.None()));
|
|
57
|
+
},
|
|
58
|
+
handle: async (ctx) => {
|
|
59
|
+
const ectx = ctx.ctx.getOrThrow("cliCtx");
|
|
60
|
+
if (!ectx.vibesDiyApiFactory) {
|
|
61
|
+
return Result.Err("Not logged in. Run 'vibes-diy login' first.");
|
|
62
|
+
}
|
|
63
|
+
const args = ctx.validated;
|
|
64
|
+
if (args.at === "" || !Number.isFinite(Date.parse(args.at))) {
|
|
65
|
+
return Result.Err("Pass --at with an ISO date and time, e.g. --at 2026-11-26T21:05:00-08:00");
|
|
66
|
+
}
|
|
67
|
+
const api = ectx.vibesDiyApiFactory(args.apiUrl);
|
|
68
|
+
const ownerHandle = await resolveHandle(api, args.ownerHandle === "" ? undefined : args.ownerHandle);
|
|
69
|
+
if (ownerHandle === undefined) {
|
|
70
|
+
return Result.Err(HANDLE_REQUIRED_CLI_MESSAGE);
|
|
71
|
+
}
|
|
72
|
+
if (args.appSlug === "") {
|
|
73
|
+
return Result.Err("Missing vibe — pass an app slug or handle/app-slug.");
|
|
74
|
+
}
|
|
75
|
+
const rTick = await api.appTickAt({ appSlug: args.appSlug, ownerHandle, at: args.at });
|
|
76
|
+
if (rTick.isErr()) {
|
|
77
|
+
return Result.Err(formatErr(rTick.Err()));
|
|
78
|
+
}
|
|
79
|
+
const r = rTick.Ok();
|
|
80
|
+
return sendMsg(ctx, {
|
|
81
|
+
type: "vibes-diy.cli.res-app-tick",
|
|
82
|
+
appSlug: r.appSlug,
|
|
83
|
+
ownerHandle: r.ownerHandle,
|
|
84
|
+
scheduledTime: r.scheduledTime,
|
|
85
|
+
ran: r.ran,
|
|
86
|
+
reason: r.reason ?? null,
|
|
87
|
+
detail: r.detail ?? null,
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
export function appTickCmd(ctx) {
|
|
92
|
+
return command({
|
|
93
|
+
name: "tick",
|
|
94
|
+
description: "Run a vibe's scheduled task once, now, as if the clock read --at (try Thursday 9pm today). Leaves the real schedule as it is.",
|
|
95
|
+
args: {
|
|
96
|
+
...cmdTsDefaultArgs(ctx),
|
|
97
|
+
appSlug: positional({
|
|
98
|
+
displayName: "vibe",
|
|
99
|
+
description: VIBE_POSITIONAL_HELP,
|
|
100
|
+
type: optional(string),
|
|
101
|
+
}),
|
|
102
|
+
vibe: option({
|
|
103
|
+
long: "vibe",
|
|
104
|
+
description: VIBE_FLAG_HELP,
|
|
105
|
+
type: string,
|
|
106
|
+
defaultValue: () => "",
|
|
107
|
+
defaultValueIsSerializable: true,
|
|
108
|
+
}),
|
|
109
|
+
handle: option({
|
|
110
|
+
long: "handle",
|
|
111
|
+
description: HANDLE_FLAG_HELP,
|
|
112
|
+
type: string,
|
|
113
|
+
defaultValue: () => "",
|
|
114
|
+
defaultValueIsSerializable: true,
|
|
115
|
+
}),
|
|
116
|
+
at: option({
|
|
117
|
+
long: "at",
|
|
118
|
+
description: "The instant the task sees as event.scheduledTime, ISO 8601 (e.g. 2026-11-26T21:05:00-08:00)",
|
|
119
|
+
type: string,
|
|
120
|
+
defaultValue: () => "",
|
|
121
|
+
defaultValueIsSerializable: true,
|
|
122
|
+
}),
|
|
123
|
+
},
|
|
124
|
+
handler: ctx.cliStream.enqueue((args) => {
|
|
125
|
+
const resolved = resolveVibePositionals({ vibe: args.vibe, handle: args.handle, positionals: [args.appSlug] });
|
|
126
|
+
return {
|
|
127
|
+
type: "vibes-diy.cli.app-tick",
|
|
128
|
+
appSlug: resolved.appSlug,
|
|
129
|
+
ownerHandle: resolved.handle,
|
|
130
|
+
at: args.at,
|
|
131
|
+
apiUrl: args.apiUrl,
|
|
132
|
+
};
|
|
133
|
+
}),
|
|
134
|
+
});
|
|
135
|
+
}
|
package/cli/cmds/db/del-cmd.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare function dbDelCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs/a
|
|
|
31
31
|
ownerHandle: string;
|
|
32
32
|
ownerHandleDeprecated: string;
|
|
33
33
|
dbName: string;
|
|
34
|
+
asHandle: string;
|
|
34
35
|
docIdPositional: string | undefined;
|
|
35
36
|
docIdFlag: string;
|
|
36
37
|
admin: boolean;
|
|
@@ -44,6 +45,7 @@ export declare function dbDelCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs/a
|
|
|
44
45
|
ownerHandle: string;
|
|
45
46
|
ownerHandleDeprecated: string;
|
|
46
47
|
dbName: string;
|
|
48
|
+
asHandle: string;
|
|
47
49
|
docIdPositional: string | undefined;
|
|
48
50
|
docIdFlag: string;
|
|
49
51
|
admin: boolean;
|
package/cli/cmds/db/del-cmd.js
CHANGED
|
@@ -5,7 +5,7 @@ import { FireflyApiAdapter } from "@vibes.diy/api-impl";
|
|
|
5
5
|
import { isResDeleteDoc } from "@vibes.diy/api-types";
|
|
6
6
|
import { cmdTsDefaultArgs } from "../../cli-ctx.js";
|
|
7
7
|
import { sendMsg } from "../../cmd-evento.js";
|
|
8
|
-
import { dbCommonArgs, openVibeDbApi, resolveDbVibeArgs } from "./shared.js";
|
|
8
|
+
import { dbActAsArg, dbCommonArgs, openVibeDbApi, resolveDbVibeArgs } from "./shared.js";
|
|
9
9
|
export const ReqDbDel = type({
|
|
10
10
|
type: "'vibes-diy.cli.db.del'",
|
|
11
11
|
apiUrl: "string",
|
|
@@ -71,6 +71,7 @@ export function dbDelCmd(ctx) {
|
|
|
71
71
|
args: {
|
|
72
72
|
...cmdTsDefaultArgs(ctx),
|
|
73
73
|
...dbCommonArgs(),
|
|
74
|
+
...dbActAsArg(),
|
|
74
75
|
docIdPositional: positional({
|
|
75
76
|
type: optional(string),
|
|
76
77
|
displayName: "docId",
|
|
@@ -98,6 +99,7 @@ export function dbDelCmd(ctx) {
|
|
|
98
99
|
appSlug: args.appSlug,
|
|
99
100
|
ownerHandle: args.ownerHandle,
|
|
100
101
|
ownerHandleDeprecated: args.ownerHandleDeprecated,
|
|
102
|
+
asHandle: args.asHandle,
|
|
101
103
|
});
|
|
102
104
|
return {
|
|
103
105
|
type: "vibes-diy.cli.db.del",
|
package/cli/cmds/db/get-cmd.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export declare function dbGetCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs/a
|
|
|
32
32
|
ownerHandle: string;
|
|
33
33
|
ownerHandleDeprecated: string;
|
|
34
34
|
dbName: string;
|
|
35
|
+
asHandle: string;
|
|
35
36
|
docIdPositional: string | undefined;
|
|
36
37
|
docIdFlag: string;
|
|
37
38
|
admin: boolean;
|
|
@@ -45,6 +46,7 @@ export declare function dbGetCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs/a
|
|
|
45
46
|
ownerHandle: string;
|
|
46
47
|
ownerHandleDeprecated: string;
|
|
47
48
|
dbName: string;
|
|
49
|
+
asHandle: string;
|
|
48
50
|
docIdPositional: string | undefined;
|
|
49
51
|
docIdFlag: string;
|
|
50
52
|
admin: boolean;
|
package/cli/cmds/db/get-cmd.js
CHANGED
|
@@ -5,7 +5,7 @@ import { FireflyApiAdapter } from "@vibes.diy/api-impl";
|
|
|
5
5
|
import { isResGetDoc, isResGetDocNotFound } from "@vibes.diy/api-types";
|
|
6
6
|
import { cmdTsDefaultArgs } from "../../cli-ctx.js";
|
|
7
7
|
import { sendMsg } from "../../cmd-evento.js";
|
|
8
|
-
import { adminHintOnDenied, dbCommonArgs, openVibeDbApi, resolveDbVibeArgs } from "./shared.js";
|
|
8
|
+
import { adminHintOnDenied, dbActAsArg, dbCommonArgs, openVibeDbApi, resolveDbVibeArgs } from "./shared.js";
|
|
9
9
|
export const ReqDbGet = type({
|
|
10
10
|
type: "'vibes-diy.cli.db.get'",
|
|
11
11
|
apiUrl: "string",
|
|
@@ -75,6 +75,7 @@ export function dbGetCmd(ctx) {
|
|
|
75
75
|
args: {
|
|
76
76
|
...cmdTsDefaultArgs(ctx),
|
|
77
77
|
...dbCommonArgs(),
|
|
78
|
+
...dbActAsArg(),
|
|
78
79
|
docIdPositional: positional({
|
|
79
80
|
type: optional(string),
|
|
80
81
|
displayName: "docId",
|
|
@@ -102,6 +103,7 @@ export function dbGetCmd(ctx) {
|
|
|
102
103
|
appSlug: args.appSlug,
|
|
103
104
|
ownerHandle: args.ownerHandle,
|
|
104
105
|
ownerHandleDeprecated: args.ownerHandleDeprecated,
|
|
106
|
+
asHandle: args.asHandle,
|
|
105
107
|
});
|
|
106
108
|
return {
|
|
107
109
|
type: "vibes-diy.cli.db.get",
|
package/cli/cmds/db/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare function dbSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist/
|
|
|
18
18
|
ownerHandle: string;
|
|
19
19
|
ownerHandleDeprecated: string;
|
|
20
20
|
dbName: string;
|
|
21
|
+
asHandle: string;
|
|
21
22
|
docIdPositional: string | undefined;
|
|
22
23
|
docIdFlag: string;
|
|
23
24
|
admin: boolean;
|
|
@@ -33,6 +34,7 @@ export declare function dbSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist/
|
|
|
33
34
|
ownerHandle: string;
|
|
34
35
|
ownerHandleDeprecated: string;
|
|
35
36
|
dbName: string;
|
|
37
|
+
asHandle: string;
|
|
36
38
|
docIdPositional: string | undefined;
|
|
37
39
|
docIdFlag: string;
|
|
38
40
|
admin: boolean;
|
|
@@ -61,6 +63,7 @@ export declare function dbSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist/
|
|
|
61
63
|
ownerHandle: string;
|
|
62
64
|
ownerHandleDeprecated: string;
|
|
63
65
|
dbName: string;
|
|
66
|
+
asHandle: string;
|
|
64
67
|
docJson: string;
|
|
65
68
|
docId: string;
|
|
66
69
|
file: string[];
|
|
@@ -79,6 +82,7 @@ export declare function dbSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist/
|
|
|
79
82
|
ownerHandle: string;
|
|
80
83
|
ownerHandleDeprecated: string;
|
|
81
84
|
dbName: string;
|
|
85
|
+
asHandle: string;
|
|
82
86
|
field: string;
|
|
83
87
|
key: string;
|
|
84
88
|
prefix: string;
|
|
@@ -134,6 +138,7 @@ export declare function dbSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist/
|
|
|
134
138
|
ownerHandle: string;
|
|
135
139
|
ownerHandleDeprecated: string;
|
|
136
140
|
dbName: string;
|
|
141
|
+
asHandle: string;
|
|
137
142
|
docIdPositional: string | undefined;
|
|
138
143
|
docIdFlag: string;
|
|
139
144
|
admin: boolean;
|
|
@@ -149,6 +154,7 @@ export declare function dbSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist/
|
|
|
149
154
|
ownerHandle: string;
|
|
150
155
|
ownerHandleDeprecated: string;
|
|
151
156
|
dbName: string;
|
|
157
|
+
asHandle: string;
|
|
152
158
|
docIdPositional: string | undefined;
|
|
153
159
|
docIdFlag: string;
|
|
154
160
|
admin: boolean;
|
|
@@ -177,6 +183,7 @@ export declare function dbSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist/
|
|
|
177
183
|
ownerHandle: string;
|
|
178
184
|
ownerHandleDeprecated: string;
|
|
179
185
|
dbName: string;
|
|
186
|
+
asHandle: string;
|
|
180
187
|
docJson: string;
|
|
181
188
|
docId: string;
|
|
182
189
|
file: string[];
|
|
@@ -195,6 +202,7 @@ export declare function dbSubcommands(ctx: CliCtx): Partial<import("cmd-ts/dist/
|
|
|
195
202
|
ownerHandle: string;
|
|
196
203
|
ownerHandleDeprecated: string;
|
|
197
204
|
dbName: string;
|
|
205
|
+
asHandle: string;
|
|
198
206
|
field: string;
|
|
199
207
|
key: string;
|
|
200
208
|
prefix: string;
|
package/cli/cmds/db/put-cmd.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export declare function dbPutCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs/a
|
|
|
39
39
|
ownerHandle: string;
|
|
40
40
|
ownerHandleDeprecated: string;
|
|
41
41
|
dbName: string;
|
|
42
|
+
asHandle: string;
|
|
42
43
|
docJson: string;
|
|
43
44
|
docId: string;
|
|
44
45
|
file: string[];
|
|
@@ -55,6 +56,7 @@ export declare function dbPutCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs/a
|
|
|
55
56
|
ownerHandle: string;
|
|
56
57
|
ownerHandleDeprecated: string;
|
|
57
58
|
dbName: string;
|
|
59
|
+
asHandle: string;
|
|
58
60
|
docJson: string;
|
|
59
61
|
docId: string;
|
|
60
62
|
file: string[];
|
package/cli/cmds/db/put-cmd.js
CHANGED
|
@@ -7,7 +7,7 @@ import { cmdTsDefaultArgs } from "../../cli-ctx.js";
|
|
|
7
7
|
import { sendMsg } from "../../cmd-evento.js";
|
|
8
8
|
import { readStdinText } from "../../read-stdin.js";
|
|
9
9
|
import { formatErr } from "../format-err.js";
|
|
10
|
-
import { dbCommonArgs, openVibeDbApi, resolveDbVibeArgs, resolveDocId } from "./shared.js";
|
|
10
|
+
import { dbActAsArg, dbCommonArgs, openVibeDbApi, resolveDbVibeArgs, resolveDocId } from "./shared.js";
|
|
11
11
|
import { attachFiles, mergeFilesBase, resolveFilePatterns } from "./put-files.js";
|
|
12
12
|
export const ReqDbPut = type({
|
|
13
13
|
type: "'vibes-diy.cli.db.put'",
|
|
@@ -118,6 +118,7 @@ export function dbPutCmd(ctx) {
|
|
|
118
118
|
args: {
|
|
119
119
|
...cmdTsDefaultArgs(ctx),
|
|
120
120
|
...dbCommonArgs(),
|
|
121
|
+
...dbActAsArg(),
|
|
121
122
|
docJson: positional({
|
|
122
123
|
type: string,
|
|
123
124
|
displayName: "json",
|
|
@@ -146,7 +147,7 @@ export function dbPutCmd(ctx) {
|
|
|
146
147
|
}),
|
|
147
148
|
actAs: option({
|
|
148
149
|
long: "act-as",
|
|
149
|
-
description: "
|
|
150
|
+
description: "Same as --as (kept for existing scripts): write as this bound handle while --vibe addresses someone else's vibe",
|
|
150
151
|
type: string,
|
|
151
152
|
defaultValue: () => "",
|
|
152
153
|
defaultValueIsSerializable: true,
|
|
@@ -162,6 +163,7 @@ export function dbPutCmd(ctx) {
|
|
|
162
163
|
appSlug: args.appSlug,
|
|
163
164
|
ownerHandle: args.ownerHandle,
|
|
164
165
|
ownerHandleDeprecated: args.ownerHandleDeprecated,
|
|
166
|
+
asHandle: args.asHandle,
|
|
165
167
|
});
|
|
166
168
|
return {
|
|
167
169
|
type: "vibes-diy.cli.db.put",
|
|
@@ -37,6 +37,7 @@ export declare function dbQueryCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs
|
|
|
37
37
|
ownerHandle: string;
|
|
38
38
|
ownerHandleDeprecated: string;
|
|
39
39
|
dbName: string;
|
|
40
|
+
asHandle: string;
|
|
40
41
|
field: string;
|
|
41
42
|
key: string;
|
|
42
43
|
prefix: string;
|
|
@@ -54,6 +55,7 @@ export declare function dbQueryCmd(ctx: CliCtx): Partial<import("cmd-ts/dist/cjs
|
|
|
54
55
|
ownerHandle: string;
|
|
55
56
|
ownerHandleDeprecated: string;
|
|
56
57
|
dbName: string;
|
|
58
|
+
asHandle: string;
|
|
57
59
|
field: string;
|
|
58
60
|
key: string;
|
|
59
61
|
prefix: string;
|
package/cli/cmds/db/query-cmd.js
CHANGED
|
@@ -6,7 +6,7 @@ import { isResQueryDocs } from "@vibes.diy/api-types";
|
|
|
6
6
|
import charwise from "charwise";
|
|
7
7
|
import { cmdTsDefaultArgs } from "../../cli-ctx.js";
|
|
8
8
|
import { sendMsg } from "../../cmd-evento.js";
|
|
9
|
-
import { adminHintOnDenied, dbCommonArgs, openVibeDbApi, resolveDbVibeArgs } from "./shared.js";
|
|
9
|
+
import { adminHintOnDenied, dbActAsArg, dbCommonArgs, openVibeDbApi, resolveDbVibeArgs } from "./shared.js";
|
|
10
10
|
export const ReqDbQuery = type({
|
|
11
11
|
type: "'vibes-diy.cli.db.query'",
|
|
12
12
|
apiUrl: "string",
|
|
@@ -119,6 +119,7 @@ export function dbQueryCmd(ctx) {
|
|
|
119
119
|
args: {
|
|
120
120
|
...cmdTsDefaultArgs(ctx),
|
|
121
121
|
...dbCommonArgs(),
|
|
122
|
+
...dbActAsArg(),
|
|
122
123
|
field: positional({
|
|
123
124
|
type: string,
|
|
124
125
|
displayName: "field",
|
|
@@ -167,6 +168,7 @@ export function dbQueryCmd(ctx) {
|
|
|
167
168
|
appSlug: args.appSlug,
|
|
168
169
|
ownerHandle: args.ownerHandle,
|
|
169
170
|
ownerHandleDeprecated: args.ownerHandleDeprecated,
|
|
171
|
+
asHandle: args.asHandle,
|
|
170
172
|
});
|
|
171
173
|
return {
|
|
172
174
|
type: "vibes-diy.cli.db.query",
|
package/cli/cmds/db/shared.d.ts
CHANGED
|
@@ -18,11 +18,17 @@ export declare function dbCommonArgs(): {
|
|
|
18
18
|
parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<string>>;
|
|
19
19
|
} & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Descriptive>;
|
|
20
20
|
};
|
|
21
|
+
export declare function dbActAsArg(): {
|
|
22
|
+
asHandle: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
|
|
23
|
+
parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<string>>;
|
|
24
|
+
} & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Descriptive>;
|
|
25
|
+
};
|
|
21
26
|
export declare function resolveDbVibeArgs(ctx: CliCtx, args: {
|
|
22
27
|
vibe: string;
|
|
23
28
|
appSlug: string;
|
|
24
29
|
ownerHandle: string;
|
|
25
30
|
ownerHandleDeprecated: string;
|
|
31
|
+
asHandle?: string;
|
|
26
32
|
}): {
|
|
27
33
|
appSlug: string;
|
|
28
34
|
ownerHandle: string;
|
package/cli/cmds/db/shared.js
CHANGED
|
@@ -22,7 +22,7 @@ export function dbCommonArgs() {
|
|
|
22
22
|
}),
|
|
23
23
|
ownerHandle: option({
|
|
24
24
|
long: "handle",
|
|
25
|
-
description: "
|
|
25
|
+
description: "Does two jobs: names the vibe's owner handle when --vibe is absent, and acts as that handle for this call only (your default handle is unchanged). With --vibe it must match the owner in --vibe.",
|
|
26
26
|
type: string,
|
|
27
27
|
defaultValue: () => "",
|
|
28
28
|
defaultValueIsSerializable: true,
|
|
@@ -43,6 +43,17 @@ export function dbCommonArgs() {
|
|
|
43
43
|
}),
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
+
export function dbActAsArg() {
|
|
47
|
+
return {
|
|
48
|
+
asHandle: option({
|
|
49
|
+
long: "as",
|
|
50
|
+
description: "Act as this bound handle for this call only, without changing which vibe --vibe addresses (e.g. --vibe owner/app --as my-bot). Leaves your default handle unchanged; a handle you don't hold is refused",
|
|
51
|
+
type: string,
|
|
52
|
+
defaultValue: () => "",
|
|
53
|
+
defaultValueIsSerializable: true,
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
46
57
|
export function resolveDbVibeArgs(ctx, args) {
|
|
47
58
|
if (args.ownerHandleDeprecated) {
|
|
48
59
|
process.stderr.write("[deprecated] --user-slug is deprecated, use --handle or --vibe instead\n");
|
|
@@ -54,7 +65,12 @@ export function resolveDbVibeArgs(ctx, args) {
|
|
|
54
65
|
positionalAppSlug: "",
|
|
55
66
|
});
|
|
56
67
|
const appSlug = resolved.appSlug || ctx.sthis.env.get("VIBES_APP_SLUG") || basename(process.cwd());
|
|
57
|
-
|
|
68
|
+
const asHandle = (args.asHandle ?? "").trim().replace(/^@/, "");
|
|
69
|
+
return {
|
|
70
|
+
appSlug,
|
|
71
|
+
ownerHandle: resolved.handle,
|
|
72
|
+
actingHandle: asHandle || args.ownerHandle || args.ownerHandleDeprecated,
|
|
73
|
+
};
|
|
58
74
|
}
|
|
59
75
|
export function resolveDocId(explicitId, doc, warn = (m) => process.stderr.write(m)) {
|
|
60
76
|
const flag = explicitId === undefined || explicitId === "" ? undefined : explicitId;
|