@wujiland/cli 1.0.0 → 1.0.2
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/commands/create.js +3 -4
- package/dist/commands/ops.d.ts +2 -0
- package/dist/commands/ops.js +17 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/commands/create.js
CHANGED
|
@@ -137,10 +137,9 @@ export async function create(ctx) {
|
|
|
137
137
|
if (reg.status === "failed") {
|
|
138
138
|
throw new CliError(EXIT.OUTSIDE, "PROVISION_FAILED", `Provisioning ${slug} stopped: ${JSON.stringify(reg.failure)}.`, `inca create ${slug} again resumes from the failed step.`, { failure: reg.failure });
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
//
|
|
142
|
-
|
|
143
|
-
await gitOk(deps, dir, ["push", "origin", "refs/heads/main:refs/heads/main"]);
|
|
140
|
+
// Local main (the template plus the config commit), never HEAD: a resumed run cannot ship local dev.
|
|
141
|
+
// Not forced, so it only ever fast-forwards.
|
|
142
|
+
await gitOk(deps, dir, ["push", "origin", "refs/heads/main:refs/heads/main"]);
|
|
144
143
|
const dev = await gitOk(deps, dir, ["ls-remote", "--heads", "origin", "refs/heads/dev"]);
|
|
145
144
|
if (dev.stdout.trim() === "") {
|
|
146
145
|
await gitOk(deps, dir, ["push", "origin", "HEAD:refs/heads/dev"]);
|
package/dist/commands/ops.d.ts
CHANGED
|
@@ -19,3 +19,5 @@ export declare function versions(ctx: Ctx): Promise<Outcome>;
|
|
|
19
19
|
export declare function rollback(ctx: Ctx): Promise<Outcome>;
|
|
20
20
|
export declare function logs(ctx: Ctx): Promise<Outcome>;
|
|
21
21
|
export declare function accessShow(ctx: Ctx): Promise<Outcome>;
|
|
22
|
+
/** `--since 30m`, `2h`, `1d` or an ISO time → the ISO time the manager takes (04-manager.md §11). */
|
|
23
|
+
export declare function logTime(ctx: Ctx, flag: "since" | "until"): string | undefined;
|
package/dist/commands/ops.js
CHANGED
|
@@ -134,11 +134,12 @@ export async function logs(ctx) {
|
|
|
134
134
|
const interval = Number(str(ctx.flags, "interval") ?? "15");
|
|
135
135
|
if (!Number.isFinite(interval) || interval < 5)
|
|
136
136
|
throw usage("--interval is at least 5 seconds.");
|
|
137
|
+
const times = { since: logTime(ctx, "since"), until: logTime(ctx, "until") };
|
|
137
138
|
const m = await managerClient(ctx.deps);
|
|
138
139
|
const q = (since) => {
|
|
139
140
|
const p = new URLSearchParams({ env });
|
|
140
141
|
for (const k of ["since", "until", "level", "request"]) {
|
|
141
|
-
const v = k === "since" && since ? since : str(ctx.flags, k);
|
|
142
|
+
const v = k === "since" && since ? since : k === "since" || k === "until" ? times[k] : str(ctx.flags, k);
|
|
142
143
|
if (v !== undefined)
|
|
143
144
|
p.set(k, v);
|
|
144
145
|
}
|
|
@@ -176,3 +177,18 @@ export async function accessShow(ctx) {
|
|
|
176
177
|
}
|
|
177
178
|
return { data: { slug, workers: r.workers }, human, pending };
|
|
178
179
|
}
|
|
180
|
+
/** `--since 30m`, `2h`, `1d` or an ISO time → the ISO time the manager takes (04-manager.md §11). */
|
|
181
|
+
export function logTime(ctx, flag) {
|
|
182
|
+
const raw = str(ctx.flags, flag);
|
|
183
|
+
if (raw === undefined)
|
|
184
|
+
return undefined;
|
|
185
|
+
const rel = /^(\d+)(s|m|h|d)$/.exec(raw);
|
|
186
|
+
if (rel) {
|
|
187
|
+
const unit = { s: 1, m: 60, h: 3600, d: 86400 }[rel[2]];
|
|
188
|
+
return new Date(ctx.deps.now() - Number(rel[1]) * unit * 1000).toISOString();
|
|
189
|
+
}
|
|
190
|
+
const t = Date.parse(raw);
|
|
191
|
+
if (Number.isNaN(t))
|
|
192
|
+
throw usage(`--${flag} takes a duration (30m, 2h, 1d) or an ISO time, not ${JSON.stringify(raw)}.`);
|
|
193
|
+
return new Date(t).toISOString();
|
|
194
|
+
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "1.0.
|
|
1
|
+
export declare const CLI_VERSION = "1.0.2";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Equals cli/package.json "version"; a test keeps them in step.
|
|
2
|
-
export const CLI_VERSION = "1.0.
|
|
2
|
+
export const CLI_VERSION = "1.0.2";
|