donebear 0.3.1 → 0.3.5
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/README.md +116 -153
- package/dist/cli.mjs +22 -71
- package/dist/cli.mjs.map +1 -1
- package/dist/context-store-D0Z9vbaU.mjs +3 -0
- package/dist/{context-store-BP3Fw5Ki.mjs → context-store-DH561Z1u.mjs} +4 -8
- package/dist/{context-store-BP3Fw5Ki.mjs.map → context-store-DH561Z1u.mjs.map} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{prompt-JbRe_zaa.mjs → prompt-BrfcK2Ry.mjs} +2 -3
- package/dist/{prompt-JbRe_zaa.mjs.map → prompt-BrfcK2Ry.mjs.map} +1 -1
- package/dist/prompt-FRvfbinv.mjs +3 -0
- package/package.json +7 -7
- package/dist/context-store-B78SQdMW.mjs +0 -4
- package/dist/prompt-CYNcGB9p.mjs +0 -4
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { n as readStdin, t as promptForValue } from "./prompt-
|
|
2
|
+
import { a as toCliError, b as DONEBEAR_TOKEN_ENV, d as DEFAULT_OAUTH_CALLBACK_PATH, f as DEFAULT_OAUTH_CALLBACK_PORT, i as EXIT_CODES, l as CONFIG_DIR, n as setCurrentWorkspace, o as AUTH_FILE_PATH, r as CliError, s as CLI_NAME, t as ensureLocalContext } from "./context-store-DH561Z1u.mjs";
|
|
3
|
+
import { n as readStdin, t as promptForValue } from "./prompt-BrfcK2Ry.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { Command, InvalidArgumentError } from "commander";
|
|
6
6
|
import { homedir } from "node:os";
|
|
@@ -18,7 +18,6 @@ import rrule from "rrule";
|
|
|
18
18
|
import { fileURLToPath } from "node:url";
|
|
19
19
|
import Database from "better-sqlite3";
|
|
20
20
|
import { createInterface } from "node:readline";
|
|
21
|
-
|
|
22
21
|
//#region src/jwt.ts
|
|
23
22
|
const parseJwtBase64Url = (input) => {
|
|
24
23
|
const normalized = input.replaceAll("-", "+").replaceAll("_", "/");
|
|
@@ -42,7 +41,6 @@ const parseJwtClaims = (token) => {
|
|
|
42
41
|
return null;
|
|
43
42
|
}
|
|
44
43
|
};
|
|
45
|
-
|
|
46
44
|
//#endregion
|
|
47
45
|
//#region src/oauth-token.ts
|
|
48
46
|
const postTokenRequest = async (url, body) => {
|
|
@@ -75,7 +73,6 @@ const refreshAccessToken = (config, refreshToken) => {
|
|
|
75
73
|
});
|
|
76
74
|
return postTokenRequest(config.tokenUrl, body);
|
|
77
75
|
};
|
|
78
|
-
|
|
79
76
|
//#endregion
|
|
80
77
|
//#region src/storage.ts
|
|
81
78
|
const isRecord = (value) => typeof value === "object" && value !== null;
|
|
@@ -140,7 +137,6 @@ const writeStoredAuthSession = async (session) => {
|
|
|
140
137
|
const clearStoredAuthSession = async () => {
|
|
141
138
|
await rm(AUTH_FILE_PATH, { force: true });
|
|
142
139
|
};
|
|
143
|
-
|
|
144
140
|
//#endregion
|
|
145
141
|
//#region src/env.ts
|
|
146
142
|
const DEFAULT_ENV_FILES = [
|
|
@@ -169,13 +165,12 @@ const readEnvValue = (key) => {
|
|
|
169
165
|
const trimmed = value.trim();
|
|
170
166
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
171
167
|
};
|
|
172
|
-
|
|
173
168
|
//#endregion
|
|
174
169
|
//#region src/supabase.ts
|
|
175
170
|
const resolveSupabaseConfig = () => {
|
|
176
|
-
const url = readEnvValue(
|
|
171
|
+
const url = readEnvValue("DONEBEAR_SUPABASE_URL") ?? "https://kdarvputxmlxqemisnbh.supabase.co";
|
|
177
172
|
return {
|
|
178
|
-
publishableKey: readEnvValue(
|
|
173
|
+
publishableKey: readEnvValue("DONEBEAR_SUPABASE_PUBLISHABLE_KEY") ?? "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImtkYXJ2cHV0eG1seHFlbWlzbmJoIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzIzNTcyNjcsImV4cCI6MjA4NzkzMzI2N30.A8sDPWNe_1EcCy0-GsUw4h1icxSGz_VDc9E9tPTYEU8",
|
|
179
174
|
url
|
|
180
175
|
};
|
|
181
176
|
};
|
|
@@ -183,7 +178,7 @@ const buildOAuthUrls = (config) => ({
|
|
|
183
178
|
authorizeUrl: `${config.url}/auth/v1/oauth/authorize`,
|
|
184
179
|
tokenUrl: `${config.url}/auth/v1/oauth/token`
|
|
185
180
|
});
|
|
186
|
-
const resolveOAuthClientId = () => readEnvValue(
|
|
181
|
+
const resolveOAuthClientId = () => readEnvValue("DONEBEAR_OAUTH_CLIENT_ID") ?? "9cc84e5c-6a0e-4a6d-93a2-334d8d307122";
|
|
187
182
|
const tokenResponseToStoredSession = (response) => {
|
|
188
183
|
const claims = parseJwtClaims(response.access_token);
|
|
189
184
|
let expiresAt = null;
|
|
@@ -215,7 +210,6 @@ const getSupabaseUser = async (supabaseUrl, publishableKey, accessToken) => {
|
|
|
215
210
|
id: data.id
|
|
216
211
|
};
|
|
217
212
|
};
|
|
218
|
-
|
|
219
213
|
//#endregion
|
|
220
214
|
//#region src/auth-session.ts
|
|
221
215
|
const expiryFromClaims = (claims) => {
|
|
@@ -300,7 +294,6 @@ const resolveTokenStatus = (token) => {
|
|
|
300
294
|
expiresInSeconds
|
|
301
295
|
};
|
|
302
296
|
};
|
|
303
|
-
|
|
304
297
|
//#endregion
|
|
305
298
|
//#region src/api/http.ts
|
|
306
299
|
const extractErrorMessage = (value) => {
|
|
@@ -349,7 +342,6 @@ const requestNdjson = async (context, endpoint, options) => {
|
|
|
349
342
|
for (const line of lines) parsed.push(JSON.parse(line));
|
|
350
343
|
return parsed;
|
|
351
344
|
};
|
|
352
|
-
|
|
353
345
|
//#endregion
|
|
354
346
|
//#region src/date-codecs.ts
|
|
355
347
|
const ISO_DATE_ONLY_REGEX = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
@@ -422,7 +414,6 @@ const parseCliDateOnlyToEpoch = (value, fieldLabel) => {
|
|
|
422
414
|
return dateOnlyPartsToEpoch(parts);
|
|
423
415
|
};
|
|
424
416
|
const dateOnlyEpochFromLocalDate = (now = /* @__PURE__ */ new Date()) => Date.UTC(now.getFullYear(), now.getMonth(), now.getDate());
|
|
425
|
-
|
|
426
417
|
//#endregion
|
|
427
418
|
//#region src/manage-api.ts
|
|
428
419
|
const TASK_FIELDS = `
|
|
@@ -790,7 +781,7 @@ const toChecklistItemRecord = (value) => {
|
|
|
790
781
|
const resolveApiBaseUrl = (context) => {
|
|
791
782
|
const fromContext = context.apiUrlOverride?.trim();
|
|
792
783
|
if (fromContext) return normalizeApiUrl(fromContext);
|
|
793
|
-
return normalizeApiUrl(readEnvValue(
|
|
784
|
+
return normalizeApiUrl(readEnvValue("DONEBEAR_API_URL") ?? "https://api.donebear.com");
|
|
794
785
|
};
|
|
795
786
|
const listWorkspaces = async (context, options) => {
|
|
796
787
|
return (await requestGraphql(context, `${options.baseUrl}/graphql`, {
|
|
@@ -989,7 +980,6 @@ const revokeApiKey = async (context, options) => {
|
|
|
989
980
|
variables: { id: options.keyId }
|
|
990
981
|
});
|
|
991
982
|
};
|
|
992
|
-
|
|
993
983
|
//#endregion
|
|
994
984
|
//#region src/command-context.ts
|
|
995
985
|
const getOptionalSupabaseConfig$1 = () => {
|
|
@@ -1022,7 +1012,6 @@ const requireUserId = (resolvedToken) => {
|
|
|
1022
1012
|
if (!(typeof userId === "string" && userId.length > 0)) throw new CliError("Could not determine user id from auth token", EXIT_CODES.AUTH_REQUIRED);
|
|
1023
1013
|
return userId;
|
|
1024
1014
|
};
|
|
1025
|
-
|
|
1026
1015
|
//#endregion
|
|
1027
1016
|
//#region src/output.ts
|
|
1028
1017
|
const writeLine = (stream, message) => {
|
|
@@ -1135,7 +1124,6 @@ const copyToClipboard = (text) => {
|
|
|
1135
1124
|
return false;
|
|
1136
1125
|
}
|
|
1137
1126
|
};
|
|
1138
|
-
|
|
1139
1127
|
//#endregion
|
|
1140
1128
|
//#region src/options.ts
|
|
1141
1129
|
const parseOutputFormat = (value) => {
|
|
@@ -1156,7 +1144,6 @@ const addGlobalOptions = (program) => {
|
|
|
1156
1144
|
program.option("--json", "Output machine-readable JSON").option("-q, --quiet", "Suppress status output (implies --json)").option("--format <format>", "Output format: text|json|csv|tsv|yaml", "text").option("--copy", "Copy output to clipboard").option("--total", "Print count only").option("--token <token>", "Use an explicit token (overrides DONEBEAR_TOKEN)").option("--api-url <url>", "Manage API base URL (overrides DONEBEAR_API_URL)").option("--debug", "Enable debug logs").option("--no-color", "Disable color output").option("--dry-run", "Preview mutations without executing", false).option("--jq <expression>", "Filter output with a JMESPath expression").option("--limit <n>", "Limit output to N items (for array results)", parseLimit).option("-y, --yes", "Skip confirmation prompts", false);
|
|
1157
1145
|
};
|
|
1158
1146
|
const getGlobalOptions = (command) => command.optsWithGlobals();
|
|
1159
|
-
|
|
1160
1147
|
//#endregion
|
|
1161
1148
|
//#region src/runtime.ts
|
|
1162
1149
|
const contextFromCommand = (command) => {
|
|
@@ -1170,7 +1157,7 @@ const contextFromCommand = (command) => {
|
|
|
1170
1157
|
apiUrlOverride: options.apiUrl?.trim() || null,
|
|
1171
1158
|
color: options.color !== false && process.env.NO_COLOR !== "1",
|
|
1172
1159
|
copy: options.copy === true,
|
|
1173
|
-
debug: options.debug === true || process.env[
|
|
1160
|
+
debug: options.debug === true || process.env["DONEBEAR_DEBUG"] === "1",
|
|
1174
1161
|
dryRun: options.dryRun === true,
|
|
1175
1162
|
format,
|
|
1176
1163
|
jq: options.jq?.trim() || null,
|
|
@@ -1194,7 +1181,7 @@ const contextFromArgv = (argv) => {
|
|
|
1194
1181
|
apiUrlOverride: null,
|
|
1195
1182
|
color: !argv.includes("--no-color") && process.env.NO_COLOR !== "1",
|
|
1196
1183
|
copy: argv.includes("--copy"),
|
|
1197
|
-
debug: argv.includes("--debug") || process.env[
|
|
1184
|
+
debug: argv.includes("--debug") || process.env["DONEBEAR_DEBUG"] === "1",
|
|
1198
1185
|
dryRun: argv.includes("--dry-run"),
|
|
1199
1186
|
format,
|
|
1200
1187
|
jq: null,
|
|
@@ -1228,7 +1215,6 @@ const runWithErrorHandling = async (context, action) => {
|
|
|
1228
1215
|
process.exitCode = cliError.exitCode;
|
|
1229
1216
|
}
|
|
1230
1217
|
};
|
|
1231
|
-
|
|
1232
1218
|
//#endregion
|
|
1233
1219
|
//#region src/commands/api-key.ts
|
|
1234
1220
|
const runCreate = async (context, label) => {
|
|
@@ -1321,7 +1307,6 @@ Examples:
|
|
|
1321
1307
|
});
|
|
1322
1308
|
});
|
|
1323
1309
|
};
|
|
1324
|
-
|
|
1325
1310
|
//#endregion
|
|
1326
1311
|
//#region src/browser.ts
|
|
1327
1312
|
const getOpenCommand = (url) => {
|
|
@@ -1363,7 +1348,6 @@ const openUrl = async (url) => {
|
|
|
1363
1348
|
}
|
|
1364
1349
|
});
|
|
1365
1350
|
};
|
|
1366
|
-
|
|
1367
1351
|
//#endregion
|
|
1368
1352
|
//#region src/command-parsers.ts
|
|
1369
1353
|
const parsePositiveInteger = (value, label) => {
|
|
@@ -1371,7 +1355,6 @@ const parsePositiveInteger = (value, label) => {
|
|
|
1371
1355
|
if (!Number.isInteger(parsed) || parsed <= 0) throw new Error(`${label} must be a positive integer`);
|
|
1372
1356
|
return parsed;
|
|
1373
1357
|
};
|
|
1374
|
-
|
|
1375
1358
|
//#endregion
|
|
1376
1359
|
//#region src/oauth-callback.ts
|
|
1377
1360
|
const successHtml = () => `<!doctype html><html><head><meta charset="utf-8"/><title>Done Bear CLI</title></head><body><h1>Authentication complete</h1><p>You can return to your terminal.</p></body></html>`;
|
|
@@ -1444,13 +1427,11 @@ const waitForOAuthCode = async (options) => await new Promise((resolve, reject)
|
|
|
1444
1427
|
}, options.timeoutMs);
|
|
1445
1428
|
server.listen(port, host);
|
|
1446
1429
|
});
|
|
1447
|
-
|
|
1448
1430
|
//#endregion
|
|
1449
1431
|
//#region src/pkce.ts
|
|
1450
1432
|
const createOAuthState = () => randomBytes(24).toString("hex");
|
|
1451
1433
|
const createCodeVerifier = () => randomBytes(64).toString("base64url");
|
|
1452
1434
|
const createCodeChallenge = (verifier) => createHash("sha256").update(verifier).digest().toString("base64url");
|
|
1453
|
-
|
|
1454
1435
|
//#endregion
|
|
1455
1436
|
//#region src/commands/auth.ts
|
|
1456
1437
|
const runLogin = async (context, options) => {
|
|
@@ -1568,7 +1549,7 @@ Non-interactive / CI use:
|
|
|
1568
1549
|
await runStatus(context);
|
|
1569
1550
|
});
|
|
1570
1551
|
});
|
|
1571
|
-
auth.command("login").description("Authenticate with OAuth in the browser").option("--port <port>", "Loopback callback port", (value) => parsePositiveInteger(value, "Port"), DEFAULT_OAUTH_CALLBACK_PORT).option("--timeout <seconds>", "OAuth timeout in seconds", (value) => parsePositiveInteger(value, "Timeout"),
|
|
1552
|
+
auth.command("login").description("Authenticate with OAuth in the browser").option("--port <port>", "Loopback callback port", (value) => parsePositiveInteger(value, "Port"), DEFAULT_OAUTH_CALLBACK_PORT).option("--timeout <seconds>", "OAuth timeout in seconds", (value) => parsePositiveInteger(value, "Timeout"), 180).option("--no-open", "Print URL instead of opening the browser").addHelpText("after", `
|
|
1572
1553
|
Examples:
|
|
1573
1554
|
donebear auth login
|
|
1574
1555
|
donebear auth login --no-open (print URL, copy and paste to browser)
|
|
@@ -1595,7 +1576,6 @@ Non-interactive / CI use:
|
|
|
1595
1576
|
});
|
|
1596
1577
|
});
|
|
1597
1578
|
};
|
|
1598
|
-
|
|
1599
1579
|
//#endregion
|
|
1600
1580
|
//#region src/task-defaults.ts
|
|
1601
1581
|
const DAY_MS = 1440 * 60 * 1e3;
|
|
@@ -1656,7 +1636,6 @@ const resolveTaskView = (task) => {
|
|
|
1656
1636
|
return "anytime";
|
|
1657
1637
|
};
|
|
1658
1638
|
const formatEpochDate = (epochMs) => formatInstantEpoch(epochMs);
|
|
1659
|
-
|
|
1660
1639
|
//#endregion
|
|
1661
1640
|
//#region src/command-helpers.ts
|
|
1662
1641
|
const SHORT_ID_SUFFIX_PATTERN = /-([a-f0-9]{8})$/;
|
|
@@ -1711,7 +1690,6 @@ const taskListLines = (tasks) => tasks.map((task) => {
|
|
|
1711
1690
|
const suffix = deadline ? ` due ${deadline}` : "";
|
|
1712
1691
|
return `${marker} ${task.id.slice(0, 8)} ${task.title}${suffix}`;
|
|
1713
1692
|
});
|
|
1714
|
-
|
|
1715
1693
|
//#endregion
|
|
1716
1694
|
//#region src/workspace-context.ts
|
|
1717
1695
|
const WORKSPACE_URL_KEY_REGEX = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
@@ -1784,7 +1762,6 @@ const resolveWorkspace = async (context, options) => {
|
|
|
1784
1762
|
};
|
|
1785
1763
|
throw new Error("No default workspace selected. Run `donebear workspace use <id-or-slug>`.");
|
|
1786
1764
|
};
|
|
1787
|
-
|
|
1788
1765
|
//#endregion
|
|
1789
1766
|
//#region src/commands/context.ts
|
|
1790
1767
|
const DEFAULT_TASKS_LIMIT = 10;
|
|
@@ -1916,10 +1893,9 @@ Examples:
|
|
|
1916
1893
|
});
|
|
1917
1894
|
});
|
|
1918
1895
|
};
|
|
1919
|
-
|
|
1920
1896
|
//#endregion
|
|
1921
1897
|
//#region src/commands/doctor.ts
|
|
1922
|
-
const packageManifest$1 = createRequire(import.meta.url)("
|
|
1898
|
+
const packageManifest$1 = createRequire(import.meta.url)("../package.json");
|
|
1923
1899
|
const checkCliVersion = async () => {
|
|
1924
1900
|
const current = packageManifest$1.version;
|
|
1925
1901
|
try {
|
|
@@ -1986,7 +1962,7 @@ const checkAuth = async (context) => {
|
|
|
1986
1962
|
};
|
|
1987
1963
|
const checkWorkspace = async () => {
|
|
1988
1964
|
try {
|
|
1989
|
-
const { ensureLocalContext } = await import("./context-store-
|
|
1965
|
+
const { ensureLocalContext } = await import("./context-store-D0Z9vbaU.mjs");
|
|
1990
1966
|
const localContext = await ensureLocalContext();
|
|
1991
1967
|
if (!localContext.workspaceId) return {
|
|
1992
1968
|
message: "No workspace selected (run `donebear workspace use`)",
|
|
@@ -2088,7 +2064,6 @@ const registerDoctorCommand = (program) => {
|
|
|
2088
2064
|
});
|
|
2089
2065
|
});
|
|
2090
2066
|
};
|
|
2091
|
-
|
|
2092
2067
|
//#endregion
|
|
2093
2068
|
//#region src/commands/history.ts
|
|
2094
2069
|
const DEFAULT_HISTORY_LIMIT = 50;
|
|
@@ -2179,7 +2154,6 @@ Examples:
|
|
|
2179
2154
|
});
|
|
2180
2155
|
});
|
|
2181
2156
|
};
|
|
2182
|
-
|
|
2183
2157
|
//#endregion
|
|
2184
2158
|
//#region src/import/things-output.ts
|
|
2185
2159
|
const summarizeThingsImportResult = (result) => {
|
|
@@ -2196,11 +2170,9 @@ const summarizeThingsImportResult = (result) => {
|
|
|
2196
2170
|
successMessage: result.dryRun ? "Things 3 import dry run complete" : "Things 3 import complete"
|
|
2197
2171
|
};
|
|
2198
2172
|
};
|
|
2199
|
-
|
|
2200
2173
|
//#endregion
|
|
2201
2174
|
//#region src/import/things-labels.ts
|
|
2202
2175
|
const normalizeThingsLabelLookupKey = (value) => value.trim().toLocaleLowerCase();
|
|
2203
|
-
|
|
2204
2176
|
//#endregion
|
|
2205
2177
|
//#region src/import/model-id.ts
|
|
2206
2178
|
const IMPORT_ID_NAMESPACE = "b1f9f0ac-9f76-54ed-8eb0-7d6d3a0a0a31";
|
|
@@ -2243,7 +2215,6 @@ const createTeamProjectId = (params) => createCompositeSyncId("TeamProject", [
|
|
|
2243
2215
|
params.teamId,
|
|
2244
2216
|
params.projectId
|
|
2245
2217
|
]);
|
|
2246
|
-
|
|
2247
2218
|
//#endregion
|
|
2248
2219
|
//#region src/import/things-values.ts
|
|
2249
2220
|
const PACKED_DATE_MULTIPLIER = 128;
|
|
@@ -2304,7 +2275,6 @@ const combineThingsReminderAt = (options) => {
|
|
|
2304
2275
|
const baseInstant = dateOnlyEpochToLocalMidnightInstant(baseDate);
|
|
2305
2276
|
return baseInstant === null ? null : baseInstant + offset;
|
|
2306
2277
|
};
|
|
2307
|
-
|
|
2308
2278
|
//#endregion
|
|
2309
2279
|
//#region src/import/time-zone.ts
|
|
2310
2280
|
const formatterCache = /* @__PURE__ */ new Map();
|
|
@@ -2377,7 +2347,6 @@ const getUtcCalendarDayEndEpoch = (date) => {
|
|
|
2377
2347
|
const parts = getUtcCalendarDateParts(date);
|
|
2378
2348
|
return Date.UTC(parts.year, parts.month - 1, parts.day, 23, 59, 59, 999);
|
|
2379
2349
|
};
|
|
2380
|
-
|
|
2381
2350
|
//#endregion
|
|
2382
2351
|
//#region src/import/things-recurrence.ts
|
|
2383
2352
|
const THINGS_FREQUENCY_TO_RRULE = new Map([
|
|
@@ -2520,7 +2489,6 @@ const resolveThingsRepeatInstanceDate = (task, timeZone) => {
|
|
|
2520
2489
|
const repeatTimeZone = resolveTimeZoneOrNull(timeZone);
|
|
2521
2490
|
return decodeThingsPackedCalendarDate(task.startDate, repeatTimeZone) ?? decodeThingsPackedCalendarDate(task.nextInstanceStartDate, repeatTimeZone) ?? null;
|
|
2522
2491
|
};
|
|
2523
|
-
|
|
2524
2492
|
//#endregion
|
|
2525
2493
|
//#region src/import/things-mapper.ts
|
|
2526
2494
|
const MAX_CHECKLIST_TITLE_LENGTH = 500;
|
|
@@ -2671,7 +2639,7 @@ const appendMetadataBlock = (base, metadataMode, metadata) => {
|
|
|
2671
2639
|
"```"
|
|
2672
2640
|
].join("\n");
|
|
2673
2641
|
const trimmed = base?.trim();
|
|
2674
|
-
return trimmed && trimmed.length > 0 ? `${trimmed}\n\n---\n\n${block}` :
|
|
2642
|
+
return trimmed && trimmed.length > 0 ? `${trimmed}\n\n---\n\n${block}` : null;
|
|
2675
2643
|
};
|
|
2676
2644
|
const buildTaskMetadata = (task, contact, extraMetadata) => {
|
|
2677
2645
|
const metadata = { sourceUuid: task.uuid };
|
|
@@ -2685,7 +2653,7 @@ const buildTaskMetadata = (task, contact, extraMetadata) => {
|
|
|
2685
2653
|
lastName: contact.lastName,
|
|
2686
2654
|
uuid: contact.uuid
|
|
2687
2655
|
};
|
|
2688
|
-
if (task.recurrenceRuleRaw !== null || task.repeatTemplateSourceId !== null || task.instanceCreationStartDate !== null || task.instanceCreationPaused || task.
|
|
2656
|
+
if (task.recurrenceRuleRaw !== null || task.repeatTemplateSourceId !== null || task.instanceCreationStartDate !== null || task.instanceCreationPaused || task.afterCompletionReferenceDate !== null || task.nextInstanceStartDate !== null || task.repeaterRaw !== null || task.repeaterMigrationDate !== null) metadata.repeating = {
|
|
2689
2657
|
afterCompletionReferenceDate: decodeThingsPackedDate(task.afterCompletionReferenceDate),
|
|
2690
2658
|
instanceCreationCount: task.instanceCreationCount,
|
|
2691
2659
|
instanceCreationPaused: task.instanceCreationPaused,
|
|
@@ -2696,12 +2664,10 @@ const buildTaskMetadata = (task, contact, extraMetadata) => {
|
|
|
2696
2664
|
repeaterRaw: task.repeaterRaw,
|
|
2697
2665
|
templateSourceId: task.repeatTemplateSourceId
|
|
2698
2666
|
};
|
|
2699
|
-
if (task.deadlineOffset !== null || task.raw.cachedTags !== null || task.raw.experimental !== null
|
|
2667
|
+
if (task.deadlineOffset !== null || task.raw.cachedTags !== null || task.raw.experimental !== null) metadata.raw = {
|
|
2700
2668
|
cachedTags: task.raw.cachedTags,
|
|
2701
2669
|
deadlineOffset: task.deadlineOffset,
|
|
2702
|
-
experimental: task.raw.experimental
|
|
2703
|
-
leavesTombstone: task.raw.leavesTombstone,
|
|
2704
|
-
notesSync: task.raw.notesSync
|
|
2670
|
+
experimental: task.raw.experimental
|
|
2705
2671
|
};
|
|
2706
2672
|
if (extraMetadata) Object.assign(metadata, extraMetadata);
|
|
2707
2673
|
return Object.keys(metadata).length > 1 ? metadata : null;
|
|
@@ -3242,7 +3208,6 @@ const buildThingsImportPlan = (options) => {
|
|
|
3242
3208
|
taskColumns: snapshot.taskColumns
|
|
3243
3209
|
};
|
|
3244
3210
|
};
|
|
3245
|
-
|
|
3246
3211
|
//#endregion
|
|
3247
3212
|
//#region src/import/things-sqlite.ts
|
|
3248
3213
|
const THINGS_CONTAINER_PATH = join(homedir(), "Library/Group Containers/JLMPQHK86H.com.culturedcode.ThingsMac");
|
|
@@ -3459,7 +3424,6 @@ const loadThingsDatabase = (databaseUrl) => {
|
|
|
3459
3424
|
database.close();
|
|
3460
3425
|
}
|
|
3461
3426
|
};
|
|
3462
|
-
|
|
3463
3427
|
//#endregion
|
|
3464
3428
|
//#region src/import/things-runner.ts
|
|
3465
3429
|
const WORKSPACE_SCOPED_MODELS = [
|
|
@@ -3650,7 +3614,6 @@ const runThingsImport = async (options) => {
|
|
|
3650
3614
|
workspace: options.workspace
|
|
3651
3615
|
};
|
|
3652
3616
|
};
|
|
3653
|
-
|
|
3654
3617
|
//#endregion
|
|
3655
3618
|
//#region src/commands/import.ts
|
|
3656
3619
|
const parseMetadataMode = (value) => {
|
|
@@ -3689,7 +3652,7 @@ const runThingsImportCommand = async (context, options, workspaceOverride) => {
|
|
|
3689
3652
|
for (const line of summary.infoLines) writeInfo(context, line);
|
|
3690
3653
|
};
|
|
3691
3654
|
const registerImportCommands = (program, workspaceOverride) => {
|
|
3692
|
-
program.command("import").description("Import external data into Done Bear").command("things").description("Import a Things 3 SQLite export").option("--database-url <database-url>", "Path, file:// URL, sqlite:// URL, .thingsdatabase bundle, or ThingsData-* directory").option("-w, --workspace <workspace>", "Workspace id, slug, or exact name").option("--skip-teams", "Skip importing Things Areas as Teams and TeamProject links", false).option("--metadata-mode <mode>", "How to preserve Things-only metadata: note|none", "
|
|
3655
|
+
program.command("import").description("Import external data into Done Bear").command("things").description("Import a Things 3 SQLite export").option("--database-url <database-url>", "Path, file:// URL, sqlite:// URL, .thingsdatabase bundle, or ThingsData-* directory").option("-w, --workspace <workspace>", "Workspace id, slug, or exact name").option("--skip-teams", "Skip importing Things Areas as Teams and TeamProject links", false).option("--metadata-mode <mode>", "How to preserve Things-only metadata: note|none", "none").option("--batch-size <count>", "Maximum sync mutations per batch", (value) => parsePositiveInteger(value, "Batch size"), 100).addHelpText("after", `
|
|
3693
3656
|
Examples:
|
|
3694
3657
|
donebear import things --dry-run --json
|
|
3695
3658
|
donebear import things --database-url ~/Backups/Things\\ Database.thingsdatabase --json
|
|
@@ -3705,7 +3668,6 @@ Notes:
|
|
|
3705
3668
|
});
|
|
3706
3669
|
});
|
|
3707
3670
|
};
|
|
3708
|
-
|
|
3709
3671
|
//#endregion
|
|
3710
3672
|
//#region src/commands/interactive.ts
|
|
3711
3673
|
const HISTORY_FILE = join(CONFIG_DIR, "history.json");
|
|
@@ -3797,7 +3759,6 @@ const runInteractiveMode = async (context, program) => {
|
|
|
3797
3759
|
});
|
|
3798
3760
|
} catch {}
|
|
3799
3761
|
};
|
|
3800
|
-
|
|
3801
3762
|
//#endregion
|
|
3802
3763
|
//#region src/commands/label.ts
|
|
3803
3764
|
const sortLabels = (labels, sort) => {
|
|
@@ -3918,7 +3879,6 @@ Examples:
|
|
|
3918
3879
|
});
|
|
3919
3880
|
});
|
|
3920
3881
|
};
|
|
3921
|
-
|
|
3922
3882
|
//#endregion
|
|
3923
3883
|
//#region src/confirm.ts
|
|
3924
3884
|
/**
|
|
@@ -3938,7 +3898,6 @@ const confirmAction = (context, message) => {
|
|
|
3938
3898
|
});
|
|
3939
3899
|
});
|
|
3940
3900
|
};
|
|
3941
|
-
|
|
3942
3901
|
//#endregion
|
|
3943
3902
|
//#region src/commands/project.ts
|
|
3944
3903
|
const parseProjectStatus = (value) => {
|
|
@@ -4080,7 +4039,7 @@ const resolveProjectName = async (context, rawName) => {
|
|
|
4080
4039
|
const trimmed = rawName.trim();
|
|
4081
4040
|
if (trimmed.length > 0) return trimmed;
|
|
4082
4041
|
}
|
|
4083
|
-
const { promptForValue } = await import("./prompt-
|
|
4042
|
+
const { promptForValue } = await import("./prompt-FRvfbinv.mjs");
|
|
4084
4043
|
const prompted = await promptForValue(context, "Project name");
|
|
4085
4044
|
if (prompted) return prompted;
|
|
4086
4045
|
throw new CliError("Project name is required.", EXIT_CODES.VALIDATION, "Provide a name: donebear project add \"My project\"");
|
|
@@ -4329,7 +4288,6 @@ Agent tip: run "donebear spec project add" for full option reference
|
|
|
4329
4288
|
});
|
|
4330
4289
|
});
|
|
4331
4290
|
};
|
|
4332
|
-
|
|
4333
4291
|
//#endregion
|
|
4334
4292
|
//#region src/commands/task.ts
|
|
4335
4293
|
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
@@ -5157,7 +5115,6 @@ View (--when): inbox | anytime | today | upcoming | someday
|
|
|
5157
5115
|
});
|
|
5158
5116
|
});
|
|
5159
5117
|
};
|
|
5160
|
-
|
|
5161
5118
|
//#endregion
|
|
5162
5119
|
//#region src/commands/search.ts
|
|
5163
5120
|
const DEFAULT_SEARCH_LIMIT = 20;
|
|
@@ -5230,7 +5187,6 @@ Examples:
|
|
|
5230
5187
|
});
|
|
5231
5188
|
});
|
|
5232
5189
|
};
|
|
5233
|
-
|
|
5234
5190
|
//#endregion
|
|
5235
5191
|
//#region src/commands/spec.ts
|
|
5236
5192
|
const OVERVIEW = {
|
|
@@ -5468,7 +5424,7 @@ const COMMAND_SPECS = {
|
|
|
5468
5424
|
taskColumns: "string[]",
|
|
5469
5425
|
workspace: "WorkspaceSummary"
|
|
5470
5426
|
},
|
|
5471
|
-
notes: "The importer reads the official Things SQLite export (`main.sqlite`)
|
|
5427
|
+
notes: "The importer reads the official Things SQLite export (`main.sqlite`). Pass `--metadata-mode note` to preserve unmapped Things-only fields in descriptions.",
|
|
5472
5428
|
options: {
|
|
5473
5429
|
"--batch-size": {
|
|
5474
5430
|
default: 100,
|
|
@@ -5484,7 +5440,7 @@ const COMMAND_SPECS = {
|
|
|
5484
5440
|
type: "boolean"
|
|
5485
5441
|
},
|
|
5486
5442
|
"--metadata-mode": {
|
|
5487
|
-
default: "
|
|
5443
|
+
default: "none",
|
|
5488
5444
|
description: "Preserve Things-only metadata in descriptions (`note`) or drop it (`none`)",
|
|
5489
5445
|
enum: ["note", "none"],
|
|
5490
5446
|
type: "string"
|
|
@@ -6132,7 +6088,6 @@ Examples:
|
|
|
6132
6088
|
});
|
|
6133
6089
|
});
|
|
6134
6090
|
};
|
|
6135
|
-
|
|
6136
6091
|
//#endregion
|
|
6137
6092
|
//#region src/commands/team.ts
|
|
6138
6093
|
const runTeamList = async (context, workspaceOverride, options) => {
|
|
@@ -6233,7 +6188,6 @@ Examples:
|
|
|
6233
6188
|
});
|
|
6234
6189
|
});
|
|
6235
6190
|
};
|
|
6236
|
-
|
|
6237
6191
|
//#endregion
|
|
6238
6192
|
//#region src/commands/today.ts
|
|
6239
6193
|
const DEFAULT_TODAY_LIMIT = 20;
|
|
@@ -6289,7 +6243,6 @@ Examples:
|
|
|
6289
6243
|
});
|
|
6290
6244
|
});
|
|
6291
6245
|
};
|
|
6292
|
-
|
|
6293
6246
|
//#endregion
|
|
6294
6247
|
//#region src/commands/whoami.ts
|
|
6295
6248
|
const runWhoAmI = async (context) => {
|
|
@@ -6336,7 +6289,6 @@ const registerWhoAmICommand = (program) => {
|
|
|
6336
6289
|
});
|
|
6337
6290
|
});
|
|
6338
6291
|
};
|
|
6339
|
-
|
|
6340
6292
|
//#endregion
|
|
6341
6293
|
//#region src/commands/workspace.ts
|
|
6342
6294
|
const findWorkspace = (workspaceRef, workspaces) => {
|
|
@@ -6670,7 +6622,6 @@ Examples:
|
|
|
6670
6622
|
});
|
|
6671
6623
|
});
|
|
6672
6624
|
};
|
|
6673
|
-
|
|
6674
6625
|
//#endregion
|
|
6675
6626
|
//#region src/cli.ts
|
|
6676
6627
|
const packageManifest = createRequire(import.meta.url)("../package.json");
|
|
@@ -6697,7 +6648,7 @@ const main = async () => {
|
|
|
6697
6648
|
loadCliEnvironmentFiles();
|
|
6698
6649
|
const { processedArgv, workspaceOverride } = extractWorkspaceTarget(process.argv);
|
|
6699
6650
|
const program = new Command();
|
|
6700
|
-
program.name(CLI_NAME).description("Done Bear CLI for auth, workspace, and task workflows").version(packageManifest.version).showHelpAfterError().showSuggestionAfterError();
|
|
6651
|
+
program.name(CLI_NAME).description("Done Bear CLI for auth, workspace, and task workflows").version(packageManifest.version, "-v, --version").showHelpAfterError().showSuggestionAfterError();
|
|
6701
6652
|
addGlobalOptions(program);
|
|
6702
6653
|
program.addHelpText("after", `
|
|
6703
6654
|
Agent quickstart (no auth needed):
|
|
@@ -6748,7 +6699,7 @@ Filtering & output:
|
|
|
6748
6699
|
await program.parseAsync(processedArgv);
|
|
6749
6700
|
};
|
|
6750
6701
|
await runWithErrorHandling(contextFromArgv(process.argv), main);
|
|
6751
|
-
|
|
6752
6702
|
//#endregion
|
|
6753
|
-
export {
|
|
6703
|
+
export {};
|
|
6704
|
+
|
|
6754
6705
|
//# sourceMappingURL=cli.mjs.map
|