@bendyline/gezel-cli 1.3.1 → 1.3.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.
@@ -2849,6 +2849,7 @@ import {
2849
2849
  paramAsksUser,
2850
2850
  paramInputSpec,
2851
2851
  projectManagedWorkspaceWritable as projectManagedWorkspaceWritable2,
2852
+ projectManagedWorkspaceWritePolicy,
2852
2853
  stepWorkspaceDeliverableFiles
2853
2854
  } from "@bendyline/gezel";
2854
2855
 
@@ -2999,32 +3000,37 @@ function nameFolderFiles(files) {
2999
3000
  }
3000
3001
  async function ensureProjectEdits(client, options) {
3001
3002
  const files = craftbookFolderFiles(options.craftbook);
3002
- if (files.length === 0) return;
3003
+ if (files.length === 0) return null;
3003
3004
  const project = await client.getProject(options.projectId);
3004
- if (projectManagedWorkspaceWritable2(project)) return;
3005
+ if (projectManagedWorkspaceWritable2(project)) return null;
3005
3006
  const what = nameFolderFiles(files);
3006
3007
  const where = project.workingDir ?? "this project";
3008
+ const before = projectManagedWorkspaceWritePolicy(project);
3007
3009
  const turnOn = async () => {
3008
3010
  await client.updateProject(options.projectId, { managedWorkspaceWritePolicy: "allow" });
3011
+ return async () => {
3012
+ await client.updateProject(options.projectId, { managedWorkspaceWritePolicy: before });
3013
+ };
3009
3014
  };
3010
3015
  if (options.allow) {
3011
- await turnOn();
3016
+ const undo = await turnOn();
3012
3017
  options.write(`Gezel may now change files in ${where} (--allow-edits).
3013
3018
  `);
3014
- return;
3019
+ return undo;
3015
3020
  }
3016
3021
  const saves = `${options.craftbook.name} saves ${what} into ${where}, and Gezel may not change files there yet.`;
3017
3022
  if (options.prompter) {
3018
3023
  if (await options.prompter.confirm(`${saves} Allow it? [y/N] `)) {
3019
- await turnOn();
3024
+ const undo = await turnOn();
3020
3025
  options.write("Project edits: on\n");
3021
- return;
3026
+ return undo;
3022
3027
  }
3023
3028
  }
3024
3029
  options.write(
3025
3030
  `${saves} If it stops for that, run \`${PROJECT_EDITS_CLI_COMMAND}\` here, or start it with --allow-edits.
3026
3031
  `
3027
3032
  );
3033
+ return null;
3028
3034
  }
3029
3035
  function taskInputFailure(err, book, params) {
3030
3036
  if (!(err instanceof Error) || err.name !== "GezelApiError") return null;
@@ -5706,7 +5712,7 @@ Examples:
5706
5712
  return;
5707
5713
  }
5708
5714
  await setUp();
5709
- await ensureProjectEdits(client, {
5715
+ const undoEdits = await ensureProjectEdits(client, {
5710
5716
  projectId,
5711
5717
  craftbook: craftbook2,
5712
5718
  allow: opts.allowEdits === true,
@@ -5718,7 +5724,8 @@ Examples:
5718
5724
  ...craftbookDoLaunch(craftbook2, parsed),
5719
5725
  trustScripts: !opts.strictSandbox,
5720
5726
  roleBasedNameOnlyMode: true
5721
- }).catch((err) => {
5727
+ }).catch(async (err) => {
5728
+ await undoEdits?.().catch(() => void 0);
5722
5729
  throw taskInputFailure(err, book, parsed.params) ?? err;
5723
5730
  });
5724
5731
  if (opts.wait || opts.out) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/gezel-cli",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "The gezel command-line tool: chat with your gezels, run craftbooks, and manage local models from the terminal.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -44,15 +44,15 @@
44
44
  "!dist/**/*.map"
45
45
  ],
46
46
  "dependencies": {
47
- "@bendyline/gezel": "1.3.1",
48
- "@bendyline/gezel-app-sdk": "1.2.1",
49
- "@bendyline/gezel-catalog": "1.3.1",
50
- "@bendyline/gezel-client": "1.3.1",
47
+ "@bendyline/gezel": "1.3.2",
48
+ "@bendyline/gezel-app-sdk": "1.2.2",
49
+ "@bendyline/gezel-catalog": "1.3.2",
50
+ "@bendyline/gezel-client": "1.3.2",
51
51
  "@bendyline/gezel-knowledge": "1.2.11",
52
- "@bendyline/gezel-service": "1.3.1",
53
- "@bendyline/squisq": "2.13.12",
54
- "@bendyline/squisq-formats": "2.8.14",
55
- "@bendyline/squisq-react": "2.12.24",
52
+ "@bendyline/gezel-service": "1.3.2",
53
+ "@bendyline/squisq": "2.13.16",
54
+ "@bendyline/squisq-formats": "2.8.18",
55
+ "@bendyline/squisq-react": "2.12.28",
56
56
  "commander": "^15.0.0",
57
57
  "ink": "^7.1.1",
58
58
  "ink-text-input": "^6.0.0",