@unbound-app/cli 0.8.1 → 0.8.3
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.mjs +49 -45
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { z } from "zod";
|
|
|
7
7
|
import { existsSync, mkdirSync, openAsBlob, readFileSync, readdirSync, rmSync, watch, writeFileSync } from "node:fs";
|
|
8
8
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
9
9
|
import { ControllerClient } from "@unbound-app/debugger-protocol/controller";
|
|
10
|
+
import * as z$1 from "zod/mini";
|
|
10
11
|
import { glob } from "node:fs/promises";
|
|
11
12
|
import { spawn, spawnSync } from "node:child_process";
|
|
12
13
|
import { homedir } from "node:os";
|
|
@@ -260,8 +261,11 @@ function toMcpTool(server, definition, context) {
|
|
|
260
261
|
});
|
|
261
262
|
}
|
|
262
263
|
//#endregion
|
|
264
|
+
//#region ../contracts/src/zod.ts
|
|
265
|
+
z$1.config(z$1.locales.en());
|
|
266
|
+
//#endregion
|
|
263
267
|
//#region ../contracts/src/errors.ts
|
|
264
|
-
const apiErrorCodeSchema = z.enum([
|
|
268
|
+
const apiErrorCodeSchema = z$1.enum([
|
|
265
269
|
"invalid_request",
|
|
266
270
|
"invalid_manifest",
|
|
267
271
|
"unauthorized",
|
|
@@ -290,9 +294,9 @@ const apiErrorCodeSchema = z.enum([
|
|
|
290
294
|
"internal_error"
|
|
291
295
|
]);
|
|
292
296
|
/** The body of every non-2xx JSON response from `/api/v1/*`. */
|
|
293
|
-
const apiErrorResponseSchema = z.object({ error: z.object({
|
|
297
|
+
const apiErrorResponseSchema = z$1.object({ error: z$1.object({
|
|
294
298
|
code: apiErrorCodeSchema,
|
|
295
|
-
message: z.string()
|
|
299
|
+
message: z$1.string()
|
|
296
300
|
}) });
|
|
297
301
|
//#endregion
|
|
298
302
|
//#region ../../apps/web/src/api/client.ts
|
|
@@ -488,38 +492,38 @@ const ADDON_TYPES = [
|
|
|
488
492
|
* A strict SemVer 2.0.0 version (the specification's own pattern): no `v` prefix, no leading zeros.
|
|
489
493
|
* Versions become object-storage path segments and are ordered by the server, so loose forms are refused.
|
|
490
494
|
*/
|
|
491
|
-
const semverSchema = z.string().
|
|
495
|
+
const semverSchema = z$1.string().check(z$1.maxLength(64), z$1.regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/, "Must be a semver version."));
|
|
492
496
|
/**
|
|
493
497
|
* Addon ids become object-storage path segments (`addons/{id}/{version}/...`), so they are limited to
|
|
494
498
|
* path-safe characters: alphanumeric runs joined by single `.`, `_` or `-`.
|
|
495
499
|
*/
|
|
496
|
-
const addonIdSchema = z.string().
|
|
497
|
-
const addonAuthorSchema = z.object({
|
|
498
|
-
name: z.string().
|
|
499
|
-
id: z.templateLiteral([z.int().nonnegative()])
|
|
500
|
+
const addonIdSchema = z$1.string().check(z$1.maxLength(100), z$1.regex(/^[A-Za-z0-9]+(?:[._-][A-Za-z0-9]+)*$/, "Must be alphanumeric segments joined by \".\", \"_\" or \"-\"."));
|
|
501
|
+
const addonAuthorSchema = z$1.object({
|
|
502
|
+
name: z$1.string().check(z$1.minLength(1)),
|
|
503
|
+
id: z$1.templateLiteral([z$1.int().check(z$1.nonnegative())])
|
|
500
504
|
});
|
|
501
505
|
/**
|
|
502
506
|
* The manifest an author publishes. Unknown keys pass through untouched so the stored manifest is
|
|
503
507
|
* exactly what the author shipped; only the fields the platform relies on are validated.
|
|
504
508
|
*/
|
|
505
|
-
const addonManifestSchema = z.looseObject({
|
|
509
|
+
const addonManifestSchema = z$1.looseObject({
|
|
506
510
|
id: addonIdSchema,
|
|
507
|
-
type: z.enum(ADDON_TYPES)
|
|
508
|
-
name: z.string().
|
|
509
|
-
description: z.string(),
|
|
510
|
-
authors: z.array(addonAuthorSchema).
|
|
511
|
-
icon: z.union([z.string(), z.object({ uri: z.string() })])
|
|
512
|
-
main: z.string().regex(/^(?:[\w-][\w.-]*\/)*[\w-][\w.-]*$/, "Must be a relative path inside the addon."),
|
|
511
|
+
type: z$1.optional(z$1.enum(ADDON_TYPES)),
|
|
512
|
+
name: z$1.string().check(z$1.minLength(1)),
|
|
513
|
+
description: z$1.string(),
|
|
514
|
+
authors: z$1.array(addonAuthorSchema).check(z$1.minLength(1)),
|
|
515
|
+
icon: z$1.optional(z$1.union([z$1.string(), z$1.object({ uri: z$1.string() })])),
|
|
516
|
+
main: z$1.string().check(z$1.regex(/^(?:[\w-][\w.-]*\/)*[\w-][\w.-]*$/, "Must be a relative path inside the addon.")),
|
|
513
517
|
version: semverSchema,
|
|
514
|
-
capabilities: z.array(z.enum(NATIVE_PLUGIN_CAPABILITIES))
|
|
515
|
-
minNativePluginApi: z.
|
|
516
|
-
unbound: z.object({ min:
|
|
518
|
+
capabilities: z$1.optional(z$1.array(z$1.enum(NATIVE_PLUGIN_CAPABILITIES))),
|
|
519
|
+
minNativePluginApi: z$1.optional(z$1.string()),
|
|
520
|
+
unbound: z$1.optional(z$1.object({ min: z$1.optional(semverSchema) }))
|
|
517
521
|
});
|
|
518
522
|
//#endregion
|
|
519
523
|
//#region ../contracts/src/publish.ts
|
|
520
524
|
/** `listing` claims a new addon id; `update` publishes a new version of an addon the caller maintains. */
|
|
521
|
-
const submissionKindSchema = z.enum(["listing", "update"]);
|
|
522
|
-
const submissionStatusSchema = z.enum([
|
|
525
|
+
const submissionKindSchema = z$1.enum(["listing", "update"]);
|
|
526
|
+
const submissionStatusSchema = z$1.enum([
|
|
523
527
|
"awaiting_upload",
|
|
524
528
|
"pending_review",
|
|
525
529
|
"changes_requested",
|
|
@@ -529,56 +533,56 @@ const submissionStatusSchema = z.enum([
|
|
|
529
533
|
"expired",
|
|
530
534
|
"cancelled"
|
|
531
535
|
]);
|
|
532
|
-
|
|
536
|
+
z$1.enum([
|
|
533
537
|
"awaiting_upload",
|
|
534
538
|
"pending_review",
|
|
535
539
|
"changes_requested"
|
|
536
540
|
]);
|
|
537
541
|
/** A GitHub repository as `owner/name`. */
|
|
538
|
-
const repositorySchema = z.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\/[A-Za-z0-9._-]+$/, "Must be a GitHub owner/name.");
|
|
542
|
+
const repositorySchema = z$1.string().check(z$1.regex(/^[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\/[A-Za-z0-9._-]+$/, "Must be a GitHub owner/name."));
|
|
539
543
|
/** The statuses a reviewer's decision moves a pending submission to. */
|
|
540
|
-
const reviewDecisionSchema =
|
|
544
|
+
const reviewDecisionSchema = z$1.enum([
|
|
541
545
|
"approved",
|
|
542
546
|
"rejected",
|
|
543
547
|
"changes_requested"
|
|
544
548
|
]);
|
|
545
|
-
const submissionReviewSchema = z.object({
|
|
549
|
+
const submissionReviewSchema = z$1.object({
|
|
546
550
|
decision: reviewDecisionSchema,
|
|
547
551
|
/** The rejection reason or requested changes; optional only on approval. */
|
|
548
|
-
note: z.
|
|
549
|
-
reviewedAt: z.iso.datetime()
|
|
552
|
+
note: z$1.nullable(z$1.string()),
|
|
553
|
+
reviewedAt: z$1.iso.datetime()
|
|
550
554
|
});
|
|
551
|
-
const submissionSchema = z.object({
|
|
552
|
-
id: z.string().
|
|
555
|
+
const submissionSchema = z$1.object({
|
|
556
|
+
id: z$1.string().check(z$1.minLength(1)),
|
|
553
557
|
addonId: addonIdSchema,
|
|
554
|
-
version: z.string(),
|
|
558
|
+
version: z$1.string(),
|
|
555
559
|
kind: submissionKindSchema,
|
|
556
560
|
status: submissionStatusSchema,
|
|
557
|
-
repository:
|
|
561
|
+
repository: z$1.nullable(repositorySchema),
|
|
558
562
|
/** No repository was named, so reviewers cannot tie the artifact to source the author controls. */
|
|
559
|
-
unverifiedSource: z.boolean(),
|
|
563
|
+
unverifiedSource: z$1.boolean(),
|
|
560
564
|
/** The reviewer's decision, once one was made. */
|
|
561
|
-
review:
|
|
565
|
+
review: z$1.nullable(submissionReviewSchema)
|
|
562
566
|
});
|
|
563
|
-
z.object({
|
|
567
|
+
z$1.object({
|
|
564
568
|
manifest: addonManifestSchema,
|
|
565
|
-
bundleSize: z.int().positive(),
|
|
566
|
-
repository:
|
|
567
|
-
changelog: z.string().
|
|
569
|
+
bundleSize: z$1.int().check(z$1.positive()),
|
|
570
|
+
repository: z$1.optional(repositorySchema),
|
|
571
|
+
changelog: z$1.optional(z$1.string().check(z$1.maxLength(1e4)))
|
|
568
572
|
});
|
|
569
573
|
/** A presigned upload for the bundle; send exactly `bundleSize` bytes with `headers` before `expiresAt`. */
|
|
570
|
-
const submissionUploadSchema = z.object({
|
|
571
|
-
url: z.url(),
|
|
572
|
-
method: z.literal("PUT"),
|
|
573
|
-
headers: z.record(z.string(), z.string()),
|
|
574
|
-
expiresAt: z.iso.datetime()
|
|
574
|
+
const submissionUploadSchema = z$1.object({
|
|
575
|
+
url: z$1.url(),
|
|
576
|
+
method: z$1.literal("PUT"),
|
|
577
|
+
headers: z$1.record(z$1.string(), z$1.string()),
|
|
578
|
+
expiresAt: z$1.iso.datetime()
|
|
575
579
|
});
|
|
576
|
-
const createSubmissionResponseSchema = z.object({
|
|
580
|
+
const createSubmissionResponseSchema = z$1.object({
|
|
577
581
|
submission: submissionSchema,
|
|
578
582
|
upload: submissionUploadSchema
|
|
579
583
|
});
|
|
580
|
-
z.object({});
|
|
581
|
-
const finalizeSubmissionResponseSchema = z.object({ submission: submissionSchema });
|
|
584
|
+
z$1.object({});
|
|
585
|
+
const finalizeSubmissionResponseSchema = z$1.object({ submission: submissionSchema });
|
|
582
586
|
//#endregion
|
|
583
587
|
//#region ../../apps/web/src/api/publish.ts
|
|
584
588
|
/**
|
|
@@ -625,7 +629,7 @@ function getBundleName(addon, main) {
|
|
|
625
629
|
//#endregion
|
|
626
630
|
//#region ../contracts/src/api.ts
|
|
627
631
|
/** The origin of the Unbound web API, reduced from any http(s) URL; production when unset. */
|
|
628
|
-
const apiUrlSchema = z.url({ protocol: /^https?$/ }).transform((url) => new URL(url).origin)
|
|
632
|
+
const apiUrlSchema = z$1._default(z$1.pipe(z$1.url({ protocol: /^https?$/ }), z$1.transform((url) => new URL(url).origin)), "https://unbound.rip");
|
|
629
633
|
//#endregion
|
|
630
634
|
//#region src/lib/env.ts
|
|
631
635
|
const schema$3 = z.object({
|