@shardflux/cli 0.6.0 → 0.6.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.
- package/CHANGELOG.md +69 -25
- package/README.md +68 -67
- package/dist/account-args.js +1 -1
- package/dist/account-commands.js +10 -3
- package/dist/args.d.ts +1 -1
- package/dist/args.js +18 -19
- package/dist/browser.js +1 -1
- package/dist/commands.d.ts +2 -2
- package/dist/commands.js +16 -14
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +3 -3
- package/dist/format.d.ts +17 -5
- package/dist/format.js +37 -15
- package/dist/http.d.ts +3 -10
- package/dist/http.js +4 -10
- package/dist/main.js +13 -15
- package/dist/template-yaml.js +1 -1
- package/dist/update-check.js +1 -1
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -47,7 +47,7 @@ function hintFor(info, cred, file) {
|
|
|
47
47
|
if (info.code === 'timeout' && info.operation_id)
|
|
48
48
|
return `the operation continues server side; keep waiting with: shard operations wait ${info.operation_id}`;
|
|
49
49
|
if (info.code === 'operation_failed' && info.retryable) {
|
|
50
|
-
return info.details?.error_code === 'capacity_unavailable' ? '
|
|
50
|
+
return info.details?.error_code === 'capacity_unavailable' ? 'nothing was started; run the same command again' : 'the operation may succeed if you retry it later.';
|
|
51
51
|
}
|
|
52
52
|
if (info.code === 'interrupted' && info.operation_id)
|
|
53
53
|
return `keep waiting with: shard operations wait ${info.operation_id}`;
|
|
@@ -79,7 +79,7 @@ function hintFor(info, cred, file) {
|
|
|
79
79
|
const policyHint = spendPolicyHint(info);
|
|
80
80
|
if (policyHint)
|
|
81
81
|
return policyHint;
|
|
82
|
-
// File patches
|
|
82
|
+
// File patches: what to do about each refusal. details.index is the 0-based edit (--old) index.
|
|
83
83
|
const reason = info.details?.reason;
|
|
84
84
|
const index = typeof info.details?.index === 'number' ? ` #${info.details.index + 1}` : '';
|
|
85
85
|
if (reason === 'revision_mismatch') {
|
|
@@ -93,7 +93,7 @@ function hintFor(info, cred, file) {
|
|
|
93
93
|
if (reason === 'edit_not_text')
|
|
94
94
|
return 'the file is not UTF-8 text; use files write for binary data';
|
|
95
95
|
if (reason === 'host_capacity')
|
|
96
|
-
return 'the workspace
|
|
96
|
+
return 'the workspace cannot be woken right now and the call did not run; retry in a few seconds';
|
|
97
97
|
if (reason === 'host_feature_unavailable')
|
|
98
98
|
return hostFeatureHint(info.details?.feature);
|
|
99
99
|
// A processful command that could not start (0.5.1): what to change, from the workspace's reason.
|
|
@@ -167,17 +167,15 @@ function spendPolicyHint(info) {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
|
-
* 409 conflict host_feature_unavailable (
|
|
171
|
-
*
|
|
172
|
-
* another way to do it now.
|
|
170
|
+
* 409 conflict host_feature_unavailable (0.5.0): the call is not available for this workspace. Not retryable, so the
|
|
171
|
+
* hint names the fallback that works now.
|
|
173
172
|
*/
|
|
174
173
|
function hostFeatureHint(feature) {
|
|
175
|
-
const later = 'it will once the workspace runs on an upgraded host (retrying now does not help)';
|
|
176
174
|
if (feature === 'file_search')
|
|
177
|
-
return
|
|
175
|
+
return 'files search is not available for this workspace (retrying does not help); search with a command instead: shard ws exec <id|key> -- grep -rn <pattern> <path>';
|
|
178
176
|
if (feature === 'file_patch')
|
|
179
|
-
return
|
|
180
|
-
return
|
|
177
|
+
return 'files patch is not available for this workspace (retrying does not help); rewrite the file instead: shard files read <id|key> <path> --out F, edit F, then shard files write <id|key> <path> --from F';
|
|
178
|
+
return 'this call is not available for this workspace (retrying does not help)';
|
|
181
179
|
}
|
|
182
180
|
/** What an execution that ended failed or lost ran into (error.details.reason), where the reason alone says little. */
|
|
183
181
|
const EXECUTION_CAUSES = {
|
|
@@ -186,10 +184,10 @@ const EXECUTION_CAUSES = {
|
|
|
186
184
|
host_unreachable: 'its host stopped answering',
|
|
187
185
|
host_restarted: 'its host restarted',
|
|
188
186
|
tree_moved: 'the tree changed while it ran',
|
|
189
|
-
no_execution_host: '
|
|
187
|
+
no_execution_host: 'the execution could not be placed',
|
|
190
188
|
workspace_deleted: 'the workspace was deleted',
|
|
191
189
|
};
|
|
192
|
-
/** Hints for file-first workspaces (0.5.0
|
|
190
|
+
/** Hints for file-first workspaces (0.5.0): the mode refusals, tree revisions and executions. */
|
|
193
191
|
function fileFirstHint(info) {
|
|
194
192
|
const d = info.details ?? {};
|
|
195
193
|
const reason = d.reason;
|
|
@@ -211,7 +209,7 @@ function fileFirstHint(info) {
|
|
|
211
209
|
return `this key already belongs to a ${has} workspace and a workspace’s mode never changes; use another key for a ${wants} workspace (or reopen this one without --mode)`;
|
|
212
210
|
}
|
|
213
211
|
case 'mode_not_available':
|
|
214
|
-
return 'this deployment does not offer file-first workspaces
|
|
212
|
+
return 'this deployment does not offer file-first workspaces; leave out --mode file-first to open a processful workspace';
|
|
215
213
|
case 'layout_unsupported':
|
|
216
214
|
return d.mode === 'file_first' ? 'file-first workspaces run on layered template versions only; open a template version whose disk layouts include layered (shard templates get <slug> lists them)' : undefined;
|
|
217
215
|
case 'tree_revision_mismatch': {
|
|
@@ -229,7 +227,7 @@ function fileFirstHint(info) {
|
|
|
229
227
|
case 'execution_id_reused':
|
|
230
228
|
return 'this --execution-id was already used for a different request (the same id with the same request returns its recorded result); pass a new --execution-id';
|
|
231
229
|
case 'no_execution_host':
|
|
232
|
-
return '
|
|
230
|
+
return 'the execution cannot be placed right now, also after retries with the same execution id; nothing ran. Retry';
|
|
233
231
|
default:
|
|
234
232
|
return undefined;
|
|
235
233
|
}
|
|
@@ -271,7 +269,7 @@ function nudges(info, command) {
|
|
|
271
269
|
const reason = reasonOf(info);
|
|
272
270
|
return !NO_NUDGE_CODES.has(info.code) && !(reason !== undefined && NO_NUDGE_REASONS.has(reason));
|
|
273
271
|
}
|
|
274
|
-
/** `shard feedback` could not send: how to fix it, and the way to still reach the
|
|
272
|
+
/** `shard feedback` could not send: how to fix it, and the way to still reach the Shardflux team. */
|
|
275
273
|
function feedbackHint(info, credentialHint) {
|
|
276
274
|
if (info.code === 'usage')
|
|
277
275
|
return 'run "shard feedback --help"';
|
package/dist/template-yaml.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* template.yaml text (
|
|
2
|
+
* template.yaml text (the recipe v2 document in YAML; only clients parse YAML): the starter file of
|
|
3
3
|
* `shard templates init` and the export of a version (`shard templates export`), written like the dashboard's
|
|
4
4
|
* Template file section (keys in the recipe's order, long scripts as block literals, no line folding).
|
|
5
5
|
*/
|
package/dist/update-check.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `shard` tells its user when it is outdated or no longer supported (0.5.0
|
|
2
|
+
* `shard` tells its user when it is outdated or no longer supported (0.5.0+). The API's
|
|
3
3
|
* GET /v1/client-versions names the latest published version of every client and the oldest one it still serves.
|
|
4
4
|
*
|
|
5
5
|
* - At most one request per 24 hours per API URL and package: the answer is cached in
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shardflux/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "shard: the Shardflux command line. Create an account, sign in, set up keys and billing, then open, run commands in, move files to, suspend, resume and fork persistent agent workspaces.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"yaml": "2.9.1",
|
|
47
|
-
"@shardflux/sdk": "^0.11.
|
|
47
|
+
"@shardflux/sdk": "^0.11.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@eslint/js": "10.0.1",
|