gipity 1.1.33 → 1.1.34

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.
@@ -1,7 +1,7 @@
1
1
  import { Command } from 'commander';
2
- import { get, del, post } from '../api.js';
2
+ import { get, del, post, ApiError } from '../api.js';
3
3
  import { resolveProjectContext } from '../config.js';
4
- import { formatSize } from '../utils.js';
4
+ import { formatSize, confirm } from '../utils.js';
5
5
  import { info, muted } from '../colors.js';
6
6
  import { run, printList, printResult } from '../helpers/index.js';
7
7
  export const fileCommand = new Command('file')
@@ -75,12 +75,29 @@ fileCommand
75
75
  }));
76
76
  fileCommand
77
77
  .command('rm <path>')
78
- .description('Delete a file or folder')
78
+ .description('Delete a file or folder (a folder over 5 files asks first; --yes skips that)')
79
+ .option('--yes', 'Delete a large folder without asking')
79
80
  .option('--json', 'Output as JSON')
80
81
  .action((path, opts) => run('Delete', async () => {
81
82
  const { config } = await resolveProjectContext();
82
- const res = await del(`/projects/${config.projectGuid}/files?path=${encodeURIComponent(path)}`);
83
- printResult(`Deleted: ${path}`, opts, res);
83
+ const url = (confirmed) => `/projects/${config.projectGuid}/files?path=${encodeURIComponent(path)}${confirmed ? '&confirm=1' : ''}`;
84
+ let res;
85
+ try {
86
+ res = await del(url(!!opts.yes));
87
+ }
88
+ catch (err) {
89
+ // The server holds a folder delete over 5 files until it is confirmed.
90
+ if (!(err instanceof ApiError && err.code === 'CONFIRM_REQUIRED'))
91
+ throw err;
92
+ const n = Number(err.data?.file_count ?? 0);
93
+ if (!await confirm(`Delete ${path} and the ${n} files under it?`, { skip: opts.yes })) {
94
+ console.log('Cancelled.');
95
+ return;
96
+ }
97
+ res = await del(url(true));
98
+ }
99
+ const n = res.data?.deleted_files;
100
+ printResult(res.data?.folder ? `Deleted folder: ${path} (${n} file${n === 1 ? '' : 's'})` : `Deleted: ${path}`, opts, res);
84
101
  }));
85
102
  fileCommand
86
103
  .command('versions <path>')
package/dist/index.js CHANGED
@@ -41153,12 +41153,23 @@ fileCommand.command("tree [path]").description("Show the file tree").option("--j
41153
41153
  return `${f.path}${size}`;
41154
41154
  });
41155
41155
  }));
41156
- fileCommand.command("rm <path>").description("Delete a file or folder").option("--json", "Output as JSON").action((path5, opts) => run("Delete", async () => {
41156
+ fileCommand.command("rm <path>").description("Delete a file or folder (a folder over 5 files asks first; --yes skips that)").option("--yes", "Delete a large folder without asking").option("--json", "Output as JSON").action((path5, opts) => run("Delete", async () => {
41157
41157
  const { config } = await resolveProjectContext();
41158
- const res = await del(
41159
- `/projects/${config.projectGuid}/files?path=${encodeURIComponent(path5)}`
41160
- );
41161
- printResult(`Deleted: ${path5}`, opts, res);
41158
+ const url = (confirmed) => `/projects/${config.projectGuid}/files?path=${encodeURIComponent(path5)}${confirmed ? "&confirm=1" : ""}`;
41159
+ let res;
41160
+ try {
41161
+ res = await del(url(!!opts.yes));
41162
+ } catch (err) {
41163
+ if (!(err instanceof ApiError && err.code === "CONFIRM_REQUIRED")) throw err;
41164
+ const n7 = Number(err.data?.file_count ?? 0);
41165
+ if (!await confirm(`Delete ${path5} and the ${n7} files under it?`, { skip: opts.yes })) {
41166
+ console.log("Cancelled.");
41167
+ return;
41168
+ }
41169
+ res = await del(url(true));
41170
+ }
41171
+ const n = res.data?.deleted_files;
41172
+ printResult(res.data?.folder ? `Deleted folder: ${path5} (${n} file${n === 1 ? "" : "s"})` : `Deleted: ${path5}`, opts, res);
41162
41173
  }));
41163
41174
  fileCommand.command("versions <path>").description("List file versions").option("--limit <n>", "Max versions to return", "20").option("--json", "Output as JSON").action((path5, opts) => run("Versions", async () => {
41164
41175
  const { config } = await resolveProjectContext();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gipity",
3
- "version": "1.1.33",
3
+ "version": "1.1.34",
4
4
  "description": "The full-stack platform tuned for AI agents. Database, storage, auth, functions, deploy, and drop-in kits - all agent-tuned. Pair with Claude Code or use standalone.",
5
5
  "bin": {
6
6
  "gipity": "dist/updater/shim.js",