@mp-lb/forum-cli 0.1.8 → 0.1.10
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/index.js +74 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18693,7 +18693,8 @@ var listSearchReconciliationStoresInputSchema = external_exports.object({
|
|
|
18693
18693
|
touchedAfter: external_exports.string().datetime()
|
|
18694
18694
|
});
|
|
18695
18695
|
var listOwnStoresInputSchema = external_exports.object({
|
|
18696
|
-
workspaceId: external_exports.string().trim().min(1).optional()
|
|
18696
|
+
workspaceId: external_exports.string().trim().min(1).optional(),
|
|
18697
|
+
workspaceSlug: external_exports.string().trim().min(1).optional()
|
|
18697
18698
|
});
|
|
18698
18699
|
var readStoreMetadataInputSchema = external_exports.object({
|
|
18699
18700
|
workspaceId: storeWorkspaceIdSchema,
|
|
@@ -31403,7 +31404,7 @@ var createStoreClient = ({
|
|
|
31403
31404
|
);
|
|
31404
31405
|
return {
|
|
31405
31406
|
createRawFileUrl: (fileId) => `${apiBaseUrl.replace(/\/+$/, "")}/raw-file/${encodeURIComponent(fileId)}`,
|
|
31406
|
-
listStores: () => call("stores.list", () => trpc.stores.list.query(
|
|
31407
|
+
listStores: (input = {}) => call("stores.list", () => trpc.stores.list.query(input)),
|
|
31407
31408
|
createStore: (input) => call("stores.create", () => trpc.stores.create.mutate(input)),
|
|
31408
31409
|
deleteStore: (input) => call("stores.delete", () => trpc.stores.delete.mutate(input)),
|
|
31409
31410
|
readStoreByRef: (input) => call("stores.readByRef", () => trpc.stores.readByRef.query(input)),
|
|
@@ -32246,7 +32247,11 @@ var rawFileId = (href) => {
|
|
|
32246
32247
|
try {
|
|
32247
32248
|
const url2 = new URL(href);
|
|
32248
32249
|
const parts = url2.pathname.split("/").filter(Boolean);
|
|
32249
|
-
|
|
32250
|
+
if (url2.search || url2.hash) return null;
|
|
32251
|
+
if ((url2.hostname === "hyperdoc.forumlabs.net" || url2.hostname === "dx.ink") && parts.length === 1) {
|
|
32252
|
+
return decodeURIComponent(parts[0] ?? "");
|
|
32253
|
+
}
|
|
32254
|
+
return url2.hostname === "app.forumlabs.net" && parts.length === 2 && parts[0] === "raw-file" ? decodeURIComponent(parts[1] ?? "") : null;
|
|
32250
32255
|
} catch {
|
|
32251
32256
|
return null;
|
|
32252
32257
|
}
|
|
@@ -32364,15 +32369,16 @@ var usage = `Forum CLI
|
|
|
32364
32369
|
|
|
32365
32370
|
Usage:
|
|
32366
32371
|
Remote workspace commands:
|
|
32367
|
-
fm store create <storeId|workspace/storeId> [--token <jwt>]
|
|
32368
|
-
fm store list [--token <jwt>]
|
|
32369
|
-
fm store ls [--token <jwt>]
|
|
32370
|
-
fm store info <storeId> [--token <jwt>] [--json]
|
|
32372
|
+
fm store create <storeId|workspace/storeId> [--workspace <slug>] [--token <jwt>]
|
|
32373
|
+
fm store list [--workspace <slug>] [--token <jwt>]
|
|
32374
|
+
fm store ls [--workspace <slug>] [--token <jwt>]
|
|
32375
|
+
fm store info <storeId> [--workspace <slug>] [--token <jwt>] [--json]
|
|
32371
32376
|
fm store duplicate <sourceStoreId> <newStoreId> [--token <jwt>]
|
|
32372
32377
|
fm store delete <storeId> [--yes|-y] [--token <jwt>]
|
|
32373
32378
|
fm file ls [directoryPath] [--store <storeId>] [--token <jwt>]
|
|
32374
32379
|
fm file read <filePath> [--store <storeId>] [--token <jwt>]
|
|
32375
32380
|
fm compile <workspace>/<store> <entry-file> [-o <output-file>] [--optional] [--token <jwt>]
|
|
32381
|
+
fm compile --stdin [-o <output-file>] [--optional] [--token <jwt>]
|
|
32376
32382
|
fm file info <filePath> [--store <storeId>] [--token <jwt>]
|
|
32377
32383
|
fm file move <sourcePath> <destinationPath> [--store <storeId>] [--token <jwt>]
|
|
32378
32384
|
fm file delete <filePath> [--store <storeId>] [--token <jwt>]
|
|
@@ -32453,6 +32459,7 @@ Usage:
|
|
|
32453
32459
|
Store creation:
|
|
32454
32460
|
fm store create <storeId> creates in defaults.store's workspace from .forum/sync.yaml when present, otherwise in the authenticated workspace.
|
|
32455
32461
|
fm store create <workspace/storeId> creates in that explicitly selected workspace.
|
|
32462
|
+
For store create, list, and info, --workspace <slug> selects a workspace without changing the saved login.
|
|
32456
32463
|
|
|
32457
32464
|
Auth:
|
|
32458
32465
|
Provide a Clerk session token via --token or DOCTRINE_TOKEN.
|
|
@@ -32513,6 +32520,7 @@ var parseArgs = (argv) => {
|
|
|
32513
32520
|
const isSyncCommand = parseArgvCommandName(argv) === "sync";
|
|
32514
32521
|
const isCatCommand = parseArgvCommandName(argv) === "cat";
|
|
32515
32522
|
let token = null;
|
|
32523
|
+
let workspace = null;
|
|
32516
32524
|
const storeFilters = [];
|
|
32517
32525
|
let searchLimit = null;
|
|
32518
32526
|
let searchType = null;
|
|
@@ -32539,6 +32547,7 @@ var parseArgs = (argv) => {
|
|
|
32539
32547
|
let notify = false;
|
|
32540
32548
|
let openBrowser = true;
|
|
32541
32549
|
let optional2 = false;
|
|
32550
|
+
let stdin = false;
|
|
32542
32551
|
let readonly2 = false;
|
|
32543
32552
|
let verbose = false;
|
|
32544
32553
|
let watch3 = false;
|
|
@@ -32558,6 +32567,14 @@ var parseArgs = (argv) => {
|
|
|
32558
32567
|
index += 1;
|
|
32559
32568
|
continue;
|
|
32560
32569
|
}
|
|
32570
|
+
if (current === "--workspace") {
|
|
32571
|
+
if (!next || next.startsWith("-")) {
|
|
32572
|
+
throw new Error("--workspace requires a workspace slug.");
|
|
32573
|
+
}
|
|
32574
|
+
workspace = next;
|
|
32575
|
+
index += 1;
|
|
32576
|
+
continue;
|
|
32577
|
+
}
|
|
32561
32578
|
if (current === "--store" || current === "-s" && !isCatCommand) {
|
|
32562
32579
|
storeFilters.push(
|
|
32563
32580
|
...(next ?? "").split(",").map((storeId) => storeId.trim()).filter(Boolean)
|
|
@@ -32693,6 +32710,10 @@ var parseArgs = (argv) => {
|
|
|
32693
32710
|
optional2 = true;
|
|
32694
32711
|
continue;
|
|
32695
32712
|
}
|
|
32713
|
+
if (current === "--stdin") {
|
|
32714
|
+
stdin = true;
|
|
32715
|
+
continue;
|
|
32716
|
+
}
|
|
32696
32717
|
if (isSyncCommand && (current === "-p" || current === "--prioritize" || current.startsWith("--prioritize="))) {
|
|
32697
32718
|
const value = current.startsWith("--prioritize=") ? current.slice("--prioritize=".length) : next;
|
|
32698
32719
|
if (value !== "local" && value !== "remote") {
|
|
@@ -32756,6 +32777,7 @@ var parseArgs = (argv) => {
|
|
|
32756
32777
|
args: positional,
|
|
32757
32778
|
conflictPolicy,
|
|
32758
32779
|
token,
|
|
32780
|
+
workspace,
|
|
32759
32781
|
storeFilters,
|
|
32760
32782
|
searchLimit,
|
|
32761
32783
|
searchType,
|
|
@@ -32781,6 +32803,7 @@ var parseArgs = (argv) => {
|
|
|
32781
32803
|
notify,
|
|
32782
32804
|
openBrowser,
|
|
32783
32805
|
optional: optional2,
|
|
32806
|
+
stdin,
|
|
32784
32807
|
readonly: readonly2,
|
|
32785
32808
|
verbose,
|
|
32786
32809
|
watch: watch3,
|
|
@@ -37302,6 +37325,11 @@ var main = async (argv = process.argv.slice(2)) => {
|
|
|
37302
37325
|
renderOutput(usage);
|
|
37303
37326
|
return;
|
|
37304
37327
|
}
|
|
37328
|
+
if (parsed.workspace && (command !== "store" || !["create", "list", "ls", "info", "metadata"].includes(rest[0] ?? ""))) {
|
|
37329
|
+
throw new Error(
|
|
37330
|
+
"--workspace is supported by store create, list, and info. Use a qualified workspace/store ref for file commands."
|
|
37331
|
+
);
|
|
37332
|
+
}
|
|
37305
37333
|
assertDryRunSupported(parsed, command, rest);
|
|
37306
37334
|
if (command === "schema") {
|
|
37307
37335
|
if (rest.length > 1) {
|
|
@@ -37479,7 +37507,7 @@ var main = async (argv = process.argv.slice(2)) => {
|
|
|
37479
37507
|
const storePath = await withActivity(
|
|
37480
37508
|
"Creating store",
|
|
37481
37509
|
() => createStore(
|
|
37482
|
-
storePathInput,
|
|
37510
|
+
parsed.workspace && !storePathInput.includes("/") ? `${parsed.workspace}/${storePathInput}` : storePathInput,
|
|
37483
37511
|
(input) => client.createStore(input),
|
|
37484
37512
|
(input) => client.writeTextFileByRef(input)
|
|
37485
37513
|
)
|
|
@@ -37490,7 +37518,11 @@ var main = async (argv = process.argv.slice(2)) => {
|
|
|
37490
37518
|
if (subcommand === "list" || subcommand === "ls") {
|
|
37491
37519
|
await withActivity(
|
|
37492
37520
|
"Loading stores",
|
|
37493
|
-
() => listStores(
|
|
37521
|
+
() => listStores(
|
|
37522
|
+
() => client.listStores(
|
|
37523
|
+
parsed.workspace ? { workspaceSlug: parsed.workspace } : {}
|
|
37524
|
+
)
|
|
37525
|
+
)
|
|
37494
37526
|
);
|
|
37495
37527
|
return;
|
|
37496
37528
|
}
|
|
@@ -37501,7 +37533,13 @@ var main = async (argv = process.argv.slice(2)) => {
|
|
|
37501
37533
|
}
|
|
37502
37534
|
await withActivity(
|
|
37503
37535
|
"Loading store",
|
|
37504
|
-
() => storeInfo(
|
|
37536
|
+
() => storeInfo(
|
|
37537
|
+
storeInput,
|
|
37538
|
+
() => client.listStores(
|
|
37539
|
+
parsed.workspace ? { workspaceSlug: parsed.workspace } : {}
|
|
37540
|
+
),
|
|
37541
|
+
parsed.json
|
|
37542
|
+
)
|
|
37505
37543
|
);
|
|
37506
37544
|
return;
|
|
37507
37545
|
}
|
|
@@ -37965,19 +38003,33 @@ var main = async (argv = process.argv.slice(2)) => {
|
|
|
37965
38003
|
}
|
|
37966
38004
|
if (command === "compile") {
|
|
37967
38005
|
const [storeInput, entryPath, ...extra] = rest;
|
|
37968
|
-
|
|
37969
|
-
|
|
37970
|
-
|
|
37971
|
-
|
|
37972
|
-
|
|
37973
|
-
|
|
37974
|
-
|
|
37975
|
-
|
|
37976
|
-
|
|
38006
|
+
let entry;
|
|
38007
|
+
if (parsed.stdin) {
|
|
38008
|
+
if (rest.length > 0) {
|
|
38009
|
+
throw new Error(
|
|
38010
|
+
`Usage: ${commandNames} compile --stdin [-o <output-file>] [--optional]`
|
|
38011
|
+
);
|
|
38012
|
+
}
|
|
38013
|
+
entry = {
|
|
38014
|
+
id: "stdin",
|
|
38015
|
+
path: "stdin",
|
|
38016
|
+
content: { text: await readStdinText() }
|
|
38017
|
+
};
|
|
38018
|
+
} else {
|
|
38019
|
+
if (!storeInput || !entryPath || extra.length > 0) {
|
|
38020
|
+
throw new Error(
|
|
38021
|
+
`Usage: ${commandNames} compile <workspace>/<store> <entry-file> [-o <output-file>] [--optional]`
|
|
38022
|
+
);
|
|
38023
|
+
}
|
|
38024
|
+
if (!isMarkdownStorePath(entryPath)) {
|
|
38025
|
+
throw new Error(
|
|
38026
|
+
`Compile only supports Forum-hosted Markdown files: ${entryPath}`
|
|
38027
|
+
);
|
|
38028
|
+
}
|
|
38029
|
+
const storeRef = await resolveOwnStoreRef(storeInput, client);
|
|
38030
|
+
entry = await client.readFileByRef({ ...storeRef, path: entryPath });
|
|
38031
|
+
if (!entry) throw new Error(`Entry file not found: ${entryPath}`);
|
|
37977
38032
|
}
|
|
37978
|
-
const storeRef = await resolveOwnStoreRef(storeInput, client);
|
|
37979
|
-
const entry = await client.readFileByRef({ ...storeRef, path: entryPath });
|
|
37980
|
-
if (!entry) throw new Error(`Entry file not found: ${entryPath}`);
|
|
37981
38033
|
const result = await compileMarkdown({
|
|
37982
38034
|
entry,
|
|
37983
38035
|
optional: parsed.optional,
|