@sift-wiki/cli 0.1.5 → 0.1.6
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/bin/sift.js +18 -8
- package/package.json +1 -1
package/dist/bin/sift.js
CHANGED
|
@@ -2348,6 +2348,17 @@ function validateCommandCapability(input) {
|
|
|
2348
2348
|
}
|
|
2349
2349
|
}
|
|
2350
2350
|
|
|
2351
|
+
// src/commandErrors.ts
|
|
2352
|
+
var ROAM_IMPORT_SCOPE_FIX = "Roam import needs additional Sift access. Run 'npx -y @sift-wiki/cli@latest login --capability record:read,source:manage', then retry 'sift roam import'.";
|
|
2353
|
+
function toCommandError(error, commandKey) {
|
|
2354
|
+
if (commandKey === "roam:import" && error instanceof Error && error.message === "missing capability source:manage") {
|
|
2355
|
+
const permissionError = new Error(ROAM_IMPORT_SCOPE_FIX);
|
|
2356
|
+
permissionError.name = "RuntimePermissionDeniedError";
|
|
2357
|
+
return permissionError;
|
|
2358
|
+
}
|
|
2359
|
+
return error;
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2351
2362
|
// src/contractOption.ts
|
|
2352
2363
|
function extractContractVersion(argv2) {
|
|
2353
2364
|
const index = argv2.indexOf("--contract");
|
|
@@ -3443,7 +3454,7 @@ async function runSiftCli(rawInput) {
|
|
|
3443
3454
|
validateCommandCapability({ commandKey, config: input.config });
|
|
3444
3455
|
return await handler();
|
|
3445
3456
|
} catch (error) {
|
|
3446
|
-
return errorResult(error, json);
|
|
3457
|
+
return errorResult(toCommandError(error, commandKey), json);
|
|
3447
3458
|
}
|
|
3448
3459
|
}
|
|
3449
3460
|
async function searchQuery(executor, rest, json) {
|
|
@@ -5214,6 +5225,11 @@ function handleJsonRpcLine(line, pending) {
|
|
|
5214
5225
|
entry.resolve(parsed.result);
|
|
5215
5226
|
}
|
|
5216
5227
|
|
|
5228
|
+
// src/startupAuthMessage.ts
|
|
5229
|
+
function formatMissingStartupAuthMessage(_args) {
|
|
5230
|
+
return "Not signed in. Run 'npx -y @sift-wiki/cli@latest login', then retry this command.";
|
|
5231
|
+
}
|
|
5232
|
+
|
|
5217
5233
|
// src/bin/sift.ts
|
|
5218
5234
|
var credentialStore = createMacOSKeychainStore();
|
|
5219
5235
|
var authCommands = createSiftCliAuthCommands({
|
|
@@ -5284,7 +5300,7 @@ async function loadAuthForStartup(commands, args) {
|
|
|
5284
5300
|
try {
|
|
5285
5301
|
const loadedAuth = await commands.loadAuth();
|
|
5286
5302
|
if (loadedAuth === void 0 && !canRunWithoutLoadedAuth(args)) {
|
|
5287
|
-
return { ok: false, message:
|
|
5303
|
+
return { ok: false, message: formatMissingStartupAuthMessage(args) };
|
|
5288
5304
|
}
|
|
5289
5305
|
return { ok: true, loadedAuth };
|
|
5290
5306
|
} catch (error) {
|
|
@@ -5297,12 +5313,6 @@ async function loadAuthForStartup(commands, args) {
|
|
|
5297
5313
|
};
|
|
5298
5314
|
}
|
|
5299
5315
|
}
|
|
5300
|
-
function missingAuthMessage(args) {
|
|
5301
|
-
const commandArgs = args.filter((arg) => arg !== "--json");
|
|
5302
|
-
const [group, command] = commandArgs;
|
|
5303
|
-
const capability = group === "roam" && command === "import" ? " --capability record:read,source:manage" : "";
|
|
5304
|
-
return `Not signed in. Run 'npx -y @sift-wiki/cli@latest login --api-base-url ${DEFAULT_SIFT_API_BASE_URL}${capability}', then retry this command.`;
|
|
5305
|
-
}
|
|
5306
5316
|
function canRunWithoutLoadedAuth(args) {
|
|
5307
5317
|
const commandArgs = args.filter((arg) => arg !== "--json");
|
|
5308
5318
|
const [group, command] = commandArgs;
|