@better-update/cli 0.39.2 → 0.40.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/index.mjs CHANGED
@@ -35,7 +35,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
35
35
 
36
36
  //#endregion
37
37
  //#region package.json
38
- var version = "0.39.2";
38
+ var version = "0.40.0";
39
39
 
40
40
  //#endregion
41
41
  //#region src/lib/interactive-mode.ts
@@ -2402,6 +2402,8 @@ var Project = class extends Schema.Class("Project")({
2402
2402
  slug: Schema.String,
2403
2403
  createdAt: DateTimeString,
2404
2404
  lastActivityAt: DateTimeString,
2405
+ /** ISO-8601 timestamp the project was archived (read-only); `null` when active. */
2406
+ archivedAt: Schema.NullOr(DateTimeString),
2405
2407
  branchCount: Schema.Number,
2406
2408
  channelCount: Schema.Number,
2407
2409
  updateCount: Schema.Number
@@ -2411,7 +2413,8 @@ const ProjectSort = sortParam(ProjectSortColumn);
2411
2413
  const ListProjectsParams = Schema.Struct({
2412
2414
  ...PaginationParams.fields,
2413
2415
  query: Schema.optional(Schema.String),
2414
- sort: Schema.optional(ProjectSort)
2416
+ sort: Schema.optional(ProjectSort),
2417
+ status: Schema.optional(Schema.Literal("active", "archived", "all"))
2415
2418
  });
2416
2419
  const CreateProjectBody = Schema.Struct({
2417
2420
  name: Schema.String.pipe(Schema.minLength(1)),
@@ -2441,6 +2444,12 @@ var ProjectsGroup = class extends HttpApiGroup.make("projects").add(HttpApiEndpo
2441
2444
  }))).add(HttpApiEndpoint.del("delete")`/api/projects/${idParam}`.addSuccess(DeleteProjectResult).annotateContext(OpenApi.annotations({
2442
2445
  title: "Delete project",
2443
2446
  description: "Delete a project and all its branches, channels, and updates"
2447
+ }))).add(HttpApiEndpoint.post("archive")`/api/projects/${idParam}/archive`.addSuccess(Project).annotateContext(OpenApi.annotations({
2448
+ title: "Archive project",
2449
+ description: "Archive a project: it is hidden from the default project list and becomes read-only (publishes, builds and other writes are blocked) until unarchived. OTA serving to existing devices is unaffected. Reversible."
2450
+ }))).add(HttpApiEndpoint.post("unarchive")`/api/projects/${idParam}/unarchive`.addSuccess(Project).annotateContext(OpenApi.annotations({
2451
+ title: "Unarchive project",
2452
+ description: "Restore an archived project to active, writable state"
2444
2453
  }))).addError(NotFound).addError(Conflict).addError(Forbidden).annotateContext(OpenApi.annotations({
2445
2454
  title: "Projects",
2446
2455
  description: "Project management endpoints"
@@ -33574,6 +33583,11 @@ const policiesCommand = defineCommand({
33574
33583
 
33575
33584
  //#endregion
33576
33585
  //#region src/commands/projects.ts
33586
+ const projectStatus = (archivedAt) => archivedAt === null ? "active" : "archived";
33587
+ const listStatus = (all, archived) => {
33588
+ if (all) return "all";
33589
+ if (archived) return "archived";
33590
+ };
33577
33591
  const listCommand$1 = defineCommand({
33578
33592
  meta: {
33579
33593
  name: "list",
@@ -33589,6 +33603,14 @@ const listCommand$1 = defineCommand({
33589
33603
  description: "Sort key: lastActivityAt (default) or name",
33590
33604
  default: "lastActivityAt"
33591
33605
  },
33606
+ archived: {
33607
+ type: "boolean",
33608
+ description: "List only archived projects"
33609
+ },
33610
+ all: {
33611
+ type: "boolean",
33612
+ description: "List both active and archived projects"
33613
+ },
33592
33614
  limit: {
33593
33615
  type: "string",
33594
33616
  description: "Page size (default 50, max 100)",
@@ -33605,21 +33627,25 @@ const listCommand$1 = defineCommand({
33605
33627
  const sort = args.sort === "name" ? "name" : "lastActivityAt";
33606
33628
  const page = yield* parseLimit(args.page, 1);
33607
33629
  const limit = yield* parseLimit(args.limit, 50);
33630
+ const status = listStatus(args.all, args.archived);
33608
33631
  const result = yield* api.projects.list({ urlParams: {
33609
33632
  page,
33610
33633
  limit,
33611
33634
  sort,
33612
- ...args.query ? { query: args.query } : {}
33635
+ ...args.query ? { query: args.query } : {},
33636
+ ...status ? { status } : {}
33613
33637
  } });
33614
33638
  yield* printList([
33615
33639
  "ID",
33616
33640
  "Name",
33617
33641
  "Slug",
33642
+ "Status",
33618
33643
  "Last activity"
33619
33644
  ], result.items.map((project) => [
33620
33645
  project.id,
33621
33646
  project.name,
33622
33647
  project.slug,
33648
+ projectStatus(project.archivedAt),
33623
33649
  project.lastActivityAt
33624
33650
  ]), "No projects found.");
33625
33651
  yield* printHuman(`Page ${result.page} · ${result.items.length} of ${result.total} project(s)`);
@@ -33672,6 +33698,7 @@ const getCommand = defineCommand({
33672
33698
  ["ID", project.id],
33673
33699
  ["Name", project.name],
33674
33700
  ["Slug", project.slug],
33701
+ ["Status", projectStatus(project.archivedAt)],
33675
33702
  ["Created", project.createdAt]
33676
33703
  ]);
33677
33704
  return project;
@@ -33703,10 +33730,38 @@ const renameCommand = defineCommand({
33703
33730
  return project;
33704
33731
  }), { json: "value" })
33705
33732
  });
33706
- const deleteCommand$1 = defineCommand({
33733
+ const archiveCommand = defineCommand({
33707
33734
  meta: {
33708
- name: "delete",
33709
- description: "Delete a project"
33735
+ name: "archive",
33736
+ description: "Archive a project (hides it and makes it read-only until unarchived)"
33737
+ },
33738
+ args: {
33739
+ id: {
33740
+ type: "positional",
33741
+ required: true,
33742
+ description: "Project ID"
33743
+ },
33744
+ yes: {
33745
+ type: "boolean",
33746
+ description: "Skip confirmation prompt"
33747
+ }
33748
+ },
33749
+ run: async ({ args }) => runEffect(Effect.gen(function* () {
33750
+ if (!args.yes) {
33751
+ if (!(yield* promptConfirm(`Archive project ${args.id}? It becomes read-only (no publishes or builds) until unarchived.`, { initialValue: false }))) {
33752
+ yield* printHuman("Cancelled.");
33753
+ return;
33754
+ }
33755
+ }
33756
+ const project = yield* (yield* apiClient).projects.archive({ path: { id: args.id } });
33757
+ yield* printHuman(`Project ${project.name} archived. Unarchive with: projects unarchive ${project.id}`);
33758
+ return project;
33759
+ }), { json: "value" })
33760
+ });
33761
+ const unarchiveCommand = defineCommand({
33762
+ meta: {
33763
+ name: "unarchive",
33764
+ description: "Restore an archived project to active, writable state"
33710
33765
  },
33711
33766
  args: { id: {
33712
33767
  type: "positional",
@@ -33714,6 +33769,34 @@ const deleteCommand$1 = defineCommand({
33714
33769
  description: "Project ID"
33715
33770
  } },
33716
33771
  run: async ({ args }) => runEffect(Effect.gen(function* () {
33772
+ const project = yield* (yield* apiClient).projects.unarchive({ path: { id: args.id } });
33773
+ yield* printHuman(`Project ${project.name} unarchived. It is writable again.`);
33774
+ return project;
33775
+ }), { json: "value" })
33776
+ });
33777
+ const deleteCommand$1 = defineCommand({
33778
+ meta: {
33779
+ name: "delete",
33780
+ description: "Delete a project and all its branches, channels, and updates"
33781
+ },
33782
+ args: {
33783
+ id: {
33784
+ type: "positional",
33785
+ required: true,
33786
+ description: "Project ID"
33787
+ },
33788
+ yes: {
33789
+ type: "boolean",
33790
+ description: "Skip confirmation prompt"
33791
+ }
33792
+ },
33793
+ run: async ({ args }) => runEffect(Effect.gen(function* () {
33794
+ if (!args.yes) {
33795
+ if (!(yield* promptConfirm(`Delete project ${args.id}? This permanently removes all its branches, channels, and updates.`, { initialValue: false }))) {
33796
+ yield* printHuman("Cancelled.");
33797
+ return;
33798
+ }
33799
+ }
33717
33800
  yield* (yield* apiClient).projects.delete({ path: { id: args.id } });
33718
33801
  yield* printHuman(`Project ${args.id} deleted.`);
33719
33802
  return {
@@ -33732,6 +33815,8 @@ const projectsCommand = defineCommand({
33732
33815
  create: createCommand,
33733
33816
  get: getCommand,
33734
33817
  rename: renameCommand,
33818
+ archive: archiveCommand,
33819
+ unarchive: unarchiveCommand,
33735
33820
  delete: deleteCommand$1
33736
33821
  }
33737
33822
  });