@getxflow/cli 0.12.0 → 0.12.1

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/api.js CHANGED
@@ -94,7 +94,7 @@ async function send(client, path, options = {}) {
94
94
  }
95
95
  catch (e) {
96
96
  const reason = e instanceof Error ? e.message : String(e);
97
- throw new ApiError(`The platform is unreachable: ${reason}`, 'network', 0, `Check the connection and the address ${client.apiUrl}`);
97
+ throw new ApiError(`The platform is unreachable: ${reason}`, 'network', 0, `Check the connection and the address ${client.apiUrl}. Inside an agent sandbox the network is usually switched off: then the command belongs to a person in their own terminal`);
98
98
  }
99
99
  assertProtocol(response);
100
100
  return response;
@@ -73,13 +73,29 @@ function skillPath(base, agent, global) {
73
73
  function installed(base, agent, global) {
74
74
  return (0, node_fs_1.existsSync)(skillPath(base, agent, global));
75
75
  }
76
+ /**
77
+ * A refused write turned into an answer. Agent sandboxes keep `.agents`, `.codex` and
78
+ * `.git` read-only precisely so that an agent cannot rewrite its own instructions, so
79
+ * this is the ordinary outcome of an agent running the command, not a broken machine.
80
+ */
81
+ function writeRefused(path, e) {
82
+ const code = e instanceof Error ? e.code : undefined;
83
+ if (code !== 'EACCES' && code !== 'EPERM' && code !== 'EROFS')
84
+ return e;
85
+ return new errors_1.CliError(`No permission to write ${path}`, 'An agent sandbox usually keeps .agents, .codex and .git read-only. Ask the person to run this command in their own terminal');
86
+ }
76
87
  /** Writes only when the content differs. */
77
88
  function writeIfChanged(path, content) {
78
89
  const before = (0, node_fs_1.existsSync)(path) ? (0, node_fs_1.readFileSync)(path, 'utf-8') : null;
79
90
  if (before === content)
80
91
  return null;
81
- (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(path), { recursive: true });
82
- (0, node_fs_1.writeFileSync)(path, content, 'utf-8');
92
+ try {
93
+ (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(path), { recursive: true });
94
+ (0, node_fs_1.writeFileSync)(path, content, 'utf-8');
95
+ }
96
+ catch (e) {
97
+ throw writeRefused(path, e);
98
+ }
83
99
  return before === null ? 'new' : 'updated';
84
100
  }
85
101
  /**
@@ -118,7 +134,12 @@ function writePointer(base, create) {
118
134
  }
119
135
  if (before === next)
120
136
  return null;
121
- (0, node_fs_1.writeFileSync)(path, next, 'utf-8');
137
+ try {
138
+ (0, node_fs_1.writeFileSync)(path, next, 'utf-8');
139
+ }
140
+ catch (e) {
141
+ throw writeRefused(path, e);
142
+ }
122
143
  return { path, state: before === null ? 'new' : 'updated' };
123
144
  }
124
145
  function install(base, ids, global) {
@@ -268,8 +289,11 @@ function installSkillQuietly(base) {
268
289
  }
269
290
  return true;
270
291
  }
271
- catch {
272
- (0, ui_1.note)((0, ui_1.dim)(' Could not lay out the AI agent instructions: xflow skills'));
292
+ catch (e) {
293
+ // The reason travels with the failure: a refused write is fixed by a person running
294
+ // the command, and "try xflow skills" alone sends the agent round the same wall.
295
+ (0, ui_1.note)((0, ui_1.dim)(` Could not lay out the AI agent instructions: ${e instanceof Error ? e.message : e}`));
296
+ (0, ui_1.note)((0, ui_1.dim)(` ${e instanceof errors_1.CliError && e.hint ? e.hint : 'Try again: xflow skills'}`));
273
297
  return false;
274
298
  }
275
299
  }
package/dist/version.js CHANGED
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULT_API_URL = exports.CLI_VERSION = void 0;
4
4
  /** Keep in sync with cli/package.json. */
5
- exports.CLI_VERSION = '0.12.0';
5
+ exports.CLI_VERSION = '0.12.1';
6
6
  /** Overridden by XFLOW_API_URL or the `api` field in xflow.json. */
7
7
  exports.DEFAULT_API_URL = 'https://app.getxflow.com';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getxflow/cli",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "CLI for the XFlow platform: source sync, deployment and publishing of applications",
5
5
  "license": "UNLICENSED",
6
6
  "engines": {
@@ -24,7 +24,7 @@ contains the fix.
24
24
 
25
25
  ## Keeping these instructions current
26
26
 
27
- These instructions ship with xflow CLI 0.12.0. They travel inside the package, so the copy
27
+ These instructions ship with xflow CLI 0.12.1. They travel inside the package, so the copy
28
28
  you are reading can be older than the CLI answering your commands, and nothing about that
29
29
  is visible in the text itself.
30
30