wiki-graph 0.8.0 → 0.8.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/cli.js +485 -485
- package/dist/cli.js.map +1 -1
- package/dist/data/help/commands/library.jinja +7 -2
- package/dist/data/help/commands/predicate.jinja +11 -9
- package/dist/data/help/commands/uri.jinja +13 -0
- package/dist/data/help/topics/library.jinja +3 -1
- package/dist/data/help/topics/readiness.jinja +3 -3
- package/dist/data/help/topics/recipe.jinja +1 -1
- package/dist/data/help/topics/uri.jinja +6 -1
- package/dist/gc-worker.js +54 -54
- package/dist/gc-worker.js.map +1 -1
- package/dist/index.cjs +164 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +164 -17
- package/dist/index.js.map +1 -1
- package/dist/queue-worker.js +475 -475
- package/dist/queue-worker.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -45,6 +45,7 @@ async function withWikiGraphCLIRuntimeContext(context, operation) {
|
|
|
45
45
|
cwd: context.cwd,
|
|
46
46
|
env: context.env,
|
|
47
47
|
envPolicy: context.envPolicy,
|
|
48
|
+
providers: {},
|
|
48
49
|
...context.stateDir === void 0 ? {} : { stateDir: context.stateDir }
|
|
49
50
|
},
|
|
50
51
|
operation
|
|
@@ -1969,7 +1970,7 @@ function toWikiGraphUri(id) {
|
|
|
1969
1970
|
case "fragment":
|
|
1970
1971
|
return `wikg://chapter/${first ?? ""}/source/${second ?? "0"}`;
|
|
1971
1972
|
case "meta":
|
|
1972
|
-
return "wikg://";
|
|
1973
|
+
return "wikg://meta";
|
|
1973
1974
|
case "node":
|
|
1974
1975
|
return `wikg://chunk/${first ?? ""}`;
|
|
1975
1976
|
case "summary":
|
|
@@ -2263,6 +2264,14 @@ function createObjectResultPage(objects, nextCursor, limit, warnings = []) {
|
|
|
2263
2264
|
async function createFindObject(hit, context) {
|
|
2264
2265
|
const uri = toWikiGraphUri(hit.id);
|
|
2265
2266
|
const librarySource = createLibrarySourceObject(hit);
|
|
2267
|
+
if (hit.type === "archive-title") {
|
|
2268
|
+
return {
|
|
2269
|
+
...librarySource,
|
|
2270
|
+
title: hit.title,
|
|
2271
|
+
type: "archive-title",
|
|
2272
|
+
uri
|
|
2273
|
+
};
|
|
2274
|
+
}
|
|
2266
2275
|
if (hit.type === "chapter") {
|
|
2267
2276
|
return {
|
|
2268
2277
|
...librarySource,
|
|
@@ -2410,6 +2419,13 @@ async function createPageObject(page, context) {
|
|
|
2410
2419
|
uri: toWikiGraphUri(page.id)
|
|
2411
2420
|
};
|
|
2412
2421
|
}
|
|
2422
|
+
case "archive-title":
|
|
2423
|
+
return {
|
|
2424
|
+
...librarySource,
|
|
2425
|
+
title: page.title,
|
|
2426
|
+
type: "archive-title",
|
|
2427
|
+
uri: toWikiGraphUri(page.id)
|
|
2428
|
+
};
|
|
2413
2429
|
case "chapter-title":
|
|
2414
2430
|
return {
|
|
2415
2431
|
...librarySource,
|
|
@@ -2599,6 +2615,7 @@ async function formatPackAnchor(anchor, context) {
|
|
|
2599
2615
|
switch (anchor.type) {
|
|
2600
2616
|
case "artifact":
|
|
2601
2617
|
return formatPlainObject(await createPageObject(anchor, context));
|
|
2618
|
+
case "archive-title":
|
|
2602
2619
|
case "chapter-title":
|
|
2603
2620
|
case "chapter":
|
|
2604
2621
|
return formatPlainObject(await createPageObject(anchor, context));
|
|
@@ -3133,6 +3150,7 @@ async function writePage(page, context, format) {
|
|
|
3133
3150
|
`
|
|
3134
3151
|
);
|
|
3135
3152
|
return;
|
|
3153
|
+
case "archive-title":
|
|
3136
3154
|
case "chapter-title":
|
|
3137
3155
|
await writeTextToStdout(
|
|
3138
3156
|
`${formatPlainObject(await createPageObject(page, context))}
|
|
@@ -3363,7 +3381,8 @@ function resolveArchiveCommandRuntimeArguments(args) {
|
|
|
3363
3381
|
}
|
|
3364
3382
|
function getArchivePath(uri) {
|
|
3365
3383
|
if (!uri.includes("://")) return uri;
|
|
3366
|
-
|
|
3384
|
+
const libraryTarget = parseWikiGraphLibraryUri4(uri);
|
|
3385
|
+
if (libraryTarget?.kind === "scope" || libraryTarget?.kind === "archive-collection") {
|
|
3367
3386
|
return uri;
|
|
3368
3387
|
}
|
|
3369
3388
|
const archivePath = parseLocatedWikiGraphUri(uri).archivePath;
|
|
@@ -3373,7 +3392,8 @@ function getArchivePath(uri) {
|
|
|
3373
3392
|
return archivePath;
|
|
3374
3393
|
}
|
|
3375
3394
|
function getArchiveIndexScope(uri) {
|
|
3376
|
-
|
|
3395
|
+
const libraryTarget = parseWikiGraphLibraryUri4(uri);
|
|
3396
|
+
if (libraryTarget?.kind === "scope" || libraryTarget?.kind === "archive-collection") {
|
|
3377
3397
|
return { kind: "library-index", libraryId: -1 };
|
|
3378
3398
|
}
|
|
3379
3399
|
const archivePath = getArchivePath(uri);
|
|
@@ -3421,6 +3441,7 @@ function createFindOptions(args) {
|
|
|
3421
3441
|
...createOptionalEvidenceLimit(args),
|
|
3422
3442
|
...args.limit === void 0 ? {} : { limit: args.limit },
|
|
3423
3443
|
...args.reverse === true ? { order: "doc-desc" } : {},
|
|
3444
|
+
...args.queryMode === void 0 ? {} : { queryMode: args.queryMode },
|
|
3424
3445
|
...args.skipUnindexed === true ? { skipUnindexed: true } : {},
|
|
3425
3446
|
...createOptionalSourceContext(args),
|
|
3426
3447
|
...args.triplePattern === void 0 ? {} : { triplePattern: args.triplePattern },
|
|
@@ -3442,6 +3463,7 @@ function createArchiveOutputContext(args, options = {}) {
|
|
|
3442
3463
|
...args.reverse === true ? { order: "doc-desc" } : {},
|
|
3443
3464
|
...args.action !== "evidence" && args.action !== "related" && args.action !== "search" ? {} : args.query === void 0 ? {} : { query: args.query },
|
|
3444
3465
|
...args.role === void 0 ? {} : { role: args.role },
|
|
3466
|
+
...args.queryMode === void 0 ? {} : { queryMode: args.queryMode },
|
|
3445
3467
|
...args.skipUnindexed === true ? { skipUnindexed: true } : {},
|
|
3446
3468
|
...options.continuationKind === "collection" ? createScopeOptions(args) : {},
|
|
3447
3469
|
...args.triplePattern === void 0 ? {} : { triplePattern: args.triplePattern },
|
|
@@ -3632,6 +3654,7 @@ function createCursorOutputContext(cursor, format, limit) {
|
|
|
3632
3654
|
targetUri: cursor.targetUri
|
|
3633
3655
|
} : {},
|
|
3634
3656
|
...cursor.kind === "related" && cursor.role !== void 0 ? { role: cursor.role } : {},
|
|
3657
|
+
...(cursor.kind === "search" || cursor.kind === "evidence" || cursor.kind === "related") && cursor.queryMode !== void 0 ? { queryMode: cursor.queryMode } : {},
|
|
3635
3658
|
...cursor.kind === "source-locators" ? { targetUri: cursor.targetUri } : {},
|
|
3636
3659
|
..."evidenceLimit" in cursor && cursor.evidenceLimit !== void 0 ? { evidenceLimit: cursor.evidenceLimit } : {},
|
|
3637
3660
|
..."sourceContext" in cursor && cursor.sourceContext !== void 0 ? { sourceContext: cursor.sourceContext } : {}
|
|
@@ -3691,7 +3714,7 @@ import {
|
|
|
3691
3714
|
} from "wiki-graph-sdk";
|
|
3692
3715
|
async function runArchiveCommand(args) {
|
|
3693
3716
|
const libraryTarget = parseWikiGraphLibraryUri5(args.archivePath);
|
|
3694
|
-
if (libraryTarget?.kind === "scope" && libraryTarget.objectUri !== "wikg://index" && (libraryTarget.objectUri !== void 0 || args.action === "related" || args.action === "evidence" || args.action === "pack" || args.action === "search" || args.action === "list")) {
|
|
3717
|
+
if (libraryTarget?.kind === "scope" && libraryTarget.objectUri !== "wikg://index" && (libraryTarget.objectUri !== void 0 || args.action === "related" || args.action === "evidence" || args.action === "pack" || args.action === "search" || args.action === "list") || libraryTarget?.kind === "archive-collection" && args.action === "search") {
|
|
3695
3718
|
await runLibraryIndexArchiveCommand(args, libraryTarget);
|
|
3696
3719
|
return;
|
|
3697
3720
|
}
|
|
@@ -3890,6 +3913,7 @@ async function runArchiveRelated(args) {
|
|
|
3890
3913
|
...args.limit === void 0 ? {} : { limit: args.limit },
|
|
3891
3914
|
...args.reverse === true ? { order: "doc-desc" } : {},
|
|
3892
3915
|
...args.query === void 0 ? {} : { query: args.query },
|
|
3916
|
+
...args.queryMode === void 0 ? {} : { queryMode: args.queryMode },
|
|
3893
3917
|
...args.role === void 0 ? {} : { role: args.role },
|
|
3894
3918
|
...args.skipUnindexed === true ? { skipUnindexed: true } : {},
|
|
3895
3919
|
...createOptionalSourceContext(args)
|
|
@@ -3923,6 +3947,7 @@ async function runArchiveEvidence(args) {
|
|
|
3923
3947
|
...args.limit === void 0 ? {} : { limit: args.limit },
|
|
3924
3948
|
...args.reverse === true ? { order: "doc-desc" } : {},
|
|
3925
3949
|
...args.query === void 0 ? {} : { query: args.query },
|
|
3950
|
+
...args.queryMode === void 0 ? {} : { queryMode: args.queryMode },
|
|
3926
3951
|
...args.skipUnindexed === true ? { skipUnindexed: true } : {},
|
|
3927
3952
|
...createOptionalSourceContext(args)
|
|
3928
3953
|
});
|
|
@@ -3970,8 +3995,9 @@ async function runLibraryIndexArchiveCommand(args, target) {
|
|
|
3970
3995
|
const library = await libraries.get(
|
|
3971
3996
|
formatWikiGraphLibraryUri2(target.publicId)
|
|
3972
3997
|
);
|
|
3973
|
-
const
|
|
3974
|
-
const
|
|
3998
|
+
const isArchiveMemberCollection = target.kind === "archive-collection";
|
|
3999
|
+
const isLibraryRootCollection = !isArchiveMemberCollection && target.objectUri === void 0 && args.objectId === void 0;
|
|
4000
|
+
const objectUri = isLibraryRootCollection ? void 0 : isArchiveMemberCollection ? void 0 : getObjectUri(args.objectId ?? args.archivePath);
|
|
3975
4001
|
const context = {
|
|
3976
4002
|
...createArchiveOutputContext(args),
|
|
3977
4003
|
archiveKey: args.archivePath,
|
|
@@ -3980,25 +4006,25 @@ async function runLibraryIndexArchiveCommand(args, target) {
|
|
|
3980
4006
|
kind: "library-index",
|
|
3981
4007
|
libraryId: library.snapshot.id
|
|
3982
4008
|
},
|
|
3983
|
-
libraryQuery: "objects"
|
|
4009
|
+
libraryQuery: isArchiveMemberCollection ? "archive-members" : "objects"
|
|
3984
4010
|
};
|
|
3985
4011
|
switch (args.action) {
|
|
3986
4012
|
case "search": {
|
|
3987
4013
|
const findOptions = createSearchFindOptions(args);
|
|
3988
4014
|
if (objectUri === void 0) {
|
|
4015
|
+
const search = async (cursor) => await (isArchiveMemberCollection ? libraries.searchArchiveMembers(target, args.query, {
|
|
4016
|
+
...findOptions,
|
|
4017
|
+
...cursor === void 0 ? {} : { cursor }
|
|
4018
|
+
}) : libraries.search(target, args.query, {
|
|
4019
|
+
...findOptions,
|
|
4020
|
+
...cursor === void 0 ? {} : { cursor }
|
|
4021
|
+
}));
|
|
3989
4022
|
if (args.all === true) {
|
|
3990
|
-
await writeAllFindHits(
|
|
3991
|
-
async (cursor) => await libraries.search(target, args.query, {
|
|
3992
|
-
...findOptions,
|
|
3993
|
-
...cursor === void 0 ? {} : { cursor }
|
|
3994
|
-
}),
|
|
3995
|
-
context,
|
|
3996
|
-
args.format ?? "text"
|
|
3997
|
-
);
|
|
4023
|
+
await writeAllFindHits(search, context, args.format ?? "text");
|
|
3998
4024
|
return;
|
|
3999
4025
|
}
|
|
4000
4026
|
await writeFindHits(
|
|
4001
|
-
await
|
|
4027
|
+
await search(args.cursor),
|
|
4002
4028
|
context,
|
|
4003
4029
|
args.format ?? "text"
|
|
4004
4030
|
);
|
|
@@ -4139,6 +4165,7 @@ async function runLibraryIndexArchiveCommand(args, target) {
|
|
|
4139
4165
|
...args.limit === void 0 ? {} : { limit: args.limit },
|
|
4140
4166
|
...args.reverse === true ? { order: "doc-desc" } : {},
|
|
4141
4167
|
...args.query === void 0 ? {} : { query: args.query },
|
|
4168
|
+
...args.queryMode === void 0 ? {} : { queryMode: args.queryMode },
|
|
4142
4169
|
...args.role === void 0 ? {} : { role: args.role },
|
|
4143
4170
|
...args.skipUnindexed === true ? { skipUnindexed: true } : {},
|
|
4144
4171
|
...createOptionalSourceContext(args)
|
|
@@ -4173,6 +4200,7 @@ async function runLibraryIndexArchiveCommand(args, target) {
|
|
|
4173
4200
|
...args.limit === void 0 ? {} : { limit: args.limit },
|
|
4174
4201
|
...args.reverse === true ? { order: "doc-desc" } : {},
|
|
4175
4202
|
...args.query === void 0 ? {} : { query: args.query },
|
|
4203
|
+
...args.queryMode === void 0 ? {} : { queryMode: args.queryMode },
|
|
4176
4204
|
...args.skipUnindexed === true ? { skipUnindexed: true } : {},
|
|
4177
4205
|
...createOptionalSourceContext(args)
|
|
4178
4206
|
}),
|
|
@@ -4188,6 +4216,7 @@ async function runLibraryIndexArchiveCommand(args, target) {
|
|
|
4188
4216
|
...args.limit === void 0 ? {} : { limit: args.limit },
|
|
4189
4217
|
...args.reverse === true ? { order: "doc-desc" } : {},
|
|
4190
4218
|
...args.query === void 0 ? {} : { query: args.query },
|
|
4219
|
+
...args.queryMode === void 0 ? {} : { queryMode: args.queryMode },
|
|
4191
4220
|
...args.skipUnindexed === true ? { skipUnindexed: true } : {},
|
|
4192
4221
|
...createOptionalSourceContext(args)
|
|
4193
4222
|
}),
|
|
@@ -4239,6 +4268,37 @@ var init_archive_command = __esm({
|
|
|
4239
4268
|
}
|
|
4240
4269
|
});
|
|
4241
4270
|
|
|
4271
|
+
// src/commands/archive-title.ts
|
|
4272
|
+
var archive_title_exports = {};
|
|
4273
|
+
__export(archive_title_exports, {
|
|
4274
|
+
runArchiveTitleCommand: () => runArchiveTitleCommand
|
|
4275
|
+
});
|
|
4276
|
+
async function runArchiveTitleCommand(args) {
|
|
4277
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
4278
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
4279
|
+
);
|
|
4280
|
+
if (args.action === "clear") {
|
|
4281
|
+
await archive.setArchiveTitle(null);
|
|
4282
|
+
await writeTextToStdout("Cleared archive title.\n");
|
|
4283
|
+
return;
|
|
4284
|
+
}
|
|
4285
|
+
const title = args.title;
|
|
4286
|
+
if (title === void 0) {
|
|
4287
|
+
throw new Error("Missing archive title.");
|
|
4288
|
+
}
|
|
4289
|
+
const stored = await archive.setArchiveTitle(title);
|
|
4290
|
+
await writeTextToStdout(`${stored}
|
|
4291
|
+
`);
|
|
4292
|
+
}
|
|
4293
|
+
var init_archive_title = __esm({
|
|
4294
|
+
"src/commands/archive-title.ts"() {
|
|
4295
|
+
"use strict";
|
|
4296
|
+
init_context();
|
|
4297
|
+
init_archive_target();
|
|
4298
|
+
init_support();
|
|
4299
|
+
}
|
|
4300
|
+
});
|
|
4301
|
+
|
|
4242
4302
|
// src/runtime/entry-context.ts
|
|
4243
4303
|
var entry_context_exports = {};
|
|
4244
4304
|
import * as entry_context_star from "wiki-graph-sdk/entry-context";
|
|
@@ -7335,6 +7395,7 @@ var URI_HELP_TARGETS = [
|
|
|
7335
7395
|
name: "archive-scope",
|
|
7336
7396
|
predicates: ["create", "export", "inspect"]
|
|
7337
7397
|
},
|
|
7398
|
+
{ name: "archive-title-object", predicates: ["clear", "set"] },
|
|
7338
7399
|
{ name: "artifact-object", predicates: [] },
|
|
7339
7400
|
{
|
|
7340
7401
|
name: "chapter-collection-scope",
|
|
@@ -9130,6 +9191,7 @@ function parseArchiveArguments(action, positionals, values, helpRoute = `wg ${ac
|
|
|
9130
9191
|
);
|
|
9131
9192
|
}
|
|
9132
9193
|
rejectNonQuerySkipUnindexedFlag(action, values, helpRoute);
|
|
9194
|
+
const queryMode = parseQueryModeFlag(values, helpRoute);
|
|
9133
9195
|
switch (action) {
|
|
9134
9196
|
case "create": {
|
|
9135
9197
|
rejectArchiveExtraPositionals(action, positionals, 1, helpRoute);
|
|
@@ -9307,6 +9369,7 @@ function parseArchiveArguments(action, positionals, values, helpRoute = `wg ${ac
|
|
|
9307
9369
|
)
|
|
9308
9370
|
},
|
|
9309
9371
|
query,
|
|
9372
|
+
...queryMode,
|
|
9310
9373
|
...values["skip-unindexed"] === true ? { skipUnindexed: true } : {},
|
|
9311
9374
|
...options.defaultKinds === void 0 ? {} : { kinds: options.defaultKinds },
|
|
9312
9375
|
...options.triplePattern === void 0 ? {} : { triplePattern: options.triplePattern }
|
|
@@ -9427,6 +9490,7 @@ function parseArchiveArguments(action, positionals, values, helpRoute = `wg ${ac
|
|
|
9427
9490
|
},
|
|
9428
9491
|
objectId: archivePath,
|
|
9429
9492
|
...values.query === void 0 ? {} : { query: values.query },
|
|
9493
|
+
...queryMode,
|
|
9430
9494
|
...values.reverse === true ? { reverse: true } : {},
|
|
9431
9495
|
...values["skip-unindexed"] === true ? { skipUnindexed: true } : {},
|
|
9432
9496
|
...relatedTarget === "entity" ? parseRelatedRoleFlag(values.role, helpRoute) : {}
|
|
@@ -9471,6 +9535,7 @@ function parseArchiveArguments(action, positionals, values, helpRoute = `wg ${ac
|
|
|
9471
9535
|
},
|
|
9472
9536
|
objectId: archivePath,
|
|
9473
9537
|
...values.query === void 0 ? {} : { query: values.query },
|
|
9538
|
+
...queryMode,
|
|
9474
9539
|
...values.reverse === true ? { reverse: true } : {},
|
|
9475
9540
|
...values["skip-unindexed"] === true ? { skipUnindexed: true } : {}
|
|
9476
9541
|
},
|
|
@@ -9569,6 +9634,24 @@ function rejectNonQuerySkipUnindexedFlag(action, values, helpRoute) {
|
|
|
9569
9634
|
helpRoute
|
|
9570
9635
|
);
|
|
9571
9636
|
}
|
|
9637
|
+
function parseQueryModeFlag(values, helpRoute) {
|
|
9638
|
+
const value = values["query-mode"];
|
|
9639
|
+
if (value === void 0) return {};
|
|
9640
|
+
if (values.query === void 0) {
|
|
9641
|
+
throw new Error(
|
|
9642
|
+
withHelpRoute("`--query-mode` requires `--query`.", helpRoute)
|
|
9643
|
+
);
|
|
9644
|
+
}
|
|
9645
|
+
if (value !== "hybrid" && value !== "fts" && value !== "embedding") {
|
|
9646
|
+
throw new Error(
|
|
9647
|
+
withHelpRoute(
|
|
9648
|
+
"--query-mode must be one of: hybrid, fts, embedding.",
|
|
9649
|
+
helpRoute
|
|
9650
|
+
)
|
|
9651
|
+
);
|
|
9652
|
+
}
|
|
9653
|
+
return { queryMode: value };
|
|
9654
|
+
}
|
|
9572
9655
|
|
|
9573
9656
|
// src/args/parse.ts
|
|
9574
9657
|
import { parseArgs } from "util";
|
|
@@ -10462,6 +10545,9 @@ function classifyArchiveUriHelpTarget(uri) {
|
|
|
10462
10545
|
if (path === "index") {
|
|
10463
10546
|
return "index-object";
|
|
10464
10547
|
}
|
|
10548
|
+
if (path === "title") {
|
|
10549
|
+
return "archive-title-object";
|
|
10550
|
+
}
|
|
10465
10551
|
if (/^artifact\/[0-9a-f]{12,64}(?:#.+)?$/iu.test(path)) {
|
|
10466
10552
|
return "artifact-object";
|
|
10467
10553
|
}
|
|
@@ -10628,6 +10714,48 @@ function parseArchiveUriTargetArguments(uri, action, tail, values) {
|
|
|
10628
10714
|
if (objectUri === "wikg://index") {
|
|
10629
10715
|
return parseArchiveIndexUriArguments(archivePath, action, tail, values);
|
|
10630
10716
|
}
|
|
10717
|
+
if (objectUri === "wikg://title") {
|
|
10718
|
+
if (action === "get") {
|
|
10719
|
+
return parseArchiveArguments("get", [uri, ...tail], values, helpRoute);
|
|
10720
|
+
}
|
|
10721
|
+
if (action !== "set" && action !== "clear") {
|
|
10722
|
+
throw new Error(
|
|
10723
|
+
withHelpRoute(
|
|
10724
|
+
`The archive title resource does not support \`${action}\`. Read it directly, or use set or clear.`,
|
|
10725
|
+
"wg <archive-uri>/title --help"
|
|
10726
|
+
)
|
|
10727
|
+
);
|
|
10728
|
+
}
|
|
10729
|
+
const expected = action === "set" ? 1 : 0;
|
|
10730
|
+
if (tail.length !== expected) {
|
|
10731
|
+
throw new Error(
|
|
10732
|
+
withHelpRoute(
|
|
10733
|
+
action === "set" ? "Archive title set requires exactly one title value." : "Archive title clear does not accept a value.",
|
|
10734
|
+
helpRoute
|
|
10735
|
+
)
|
|
10736
|
+
);
|
|
10737
|
+
}
|
|
10738
|
+
const unsupported = Object.entries(values).find(
|
|
10739
|
+
([key, value]) => key !== "help" && value !== void 0 && value !== false
|
|
10740
|
+
);
|
|
10741
|
+
if (unsupported !== void 0) {
|
|
10742
|
+
throw new Error(
|
|
10743
|
+
withHelpRoute(
|
|
10744
|
+
`Archive title ${action} does not support --${unsupported[0]}.`,
|
|
10745
|
+
helpRoute
|
|
10746
|
+
)
|
|
10747
|
+
);
|
|
10748
|
+
}
|
|
10749
|
+
return {
|
|
10750
|
+
args: {
|
|
10751
|
+
action,
|
|
10752
|
+
archivePath,
|
|
10753
|
+
...tail[0] === void 0 ? {} : { title: tail[0] }
|
|
10754
|
+
},
|
|
10755
|
+
help: false,
|
|
10756
|
+
kind: "archive-title"
|
|
10757
|
+
};
|
|
10758
|
+
}
|
|
10631
10759
|
const chapterTarget = parseChapterTarget(objectUri);
|
|
10632
10760
|
if (chapterTarget !== void 0) {
|
|
10633
10761
|
return parseArchiveChapterUriArguments(
|
|
@@ -11558,7 +11686,7 @@ function parseLibraryUriFirstArguments(positionals, values) {
|
|
|
11558
11686
|
if (target === void 0) {
|
|
11559
11687
|
throw new Error(`Expected a Wiki Graph library URI: ${uri}`);
|
|
11560
11688
|
}
|
|
11561
|
-
const action = explicitAction ?? (target.kind === "scope" && (target.objectUri !== void 0 && target.objectUri !== "wikg://index" || values.query !== void 0 || values.limit !== void 0 || values.cursor !== void 0) ? resolveImplicitLibraryQueryAction(target.objectUri, values.query) : target.kind === "scope" || target.kind === "archive-collection" || target.kind === "metadata" || target.kind === "path" || target.kind === "archive" || target.kind === "archive-path" || target.objectUri === "wikg://index" ? "get" : target.kind === "archive-tree" ? "archive-tree" : "list");
|
|
11689
|
+
const action = explicitAction ?? ((target.kind === "scope" || target.kind === "archive-collection") && (target.kind === "scope" && target.objectUri !== void 0 && target.objectUri !== "wikg://index" || values.query !== void 0 || target.kind === "scope" && values.limit !== void 0 || target.kind === "scope" && values.cursor !== void 0) ? resolveImplicitLibraryQueryAction(target.objectUri, values.query) : target.kind === "scope" || target.kind === "archive-collection" || target.kind === "metadata" || target.kind === "path" || target.kind === "archive" || target.kind === "archive-path" || target.objectUri === "wikg://index" ? "get" : target.kind === "archive-tree" ? "archive-tree" : "list");
|
|
11562
11690
|
if (action === "inspect" && target.kind !== "archive") {
|
|
11563
11691
|
throw new Error(
|
|
11564
11692
|
withHelpRoute(
|
|
@@ -11611,6 +11739,15 @@ function parseLibraryUriFirstArguments(positionals, values) {
|
|
|
11611
11739
|
values
|
|
11612
11740
|
);
|
|
11613
11741
|
}
|
|
11742
|
+
if (target.kind === "archive-collection" && (action === "search" || values.query !== void 0)) {
|
|
11743
|
+
return parseLibraryQueryArguments(
|
|
11744
|
+
uri,
|
|
11745
|
+
target,
|
|
11746
|
+
action,
|
|
11747
|
+
explicitAction === void 0 ? [] : positionals.slice(2),
|
|
11748
|
+
values
|
|
11749
|
+
);
|
|
11750
|
+
}
|
|
11614
11751
|
if (target.kind === "archive-collection") {
|
|
11615
11752
|
return parseLibraryArchiveCollectionArguments(
|
|
11616
11753
|
uri,
|
|
@@ -12692,6 +12829,9 @@ function parseCLIArguments(argv = process.argv.slice(2)) {
|
|
|
12692
12829
|
query: {
|
|
12693
12830
|
type: "string"
|
|
12694
12831
|
},
|
|
12832
|
+
"query-mode": {
|
|
12833
|
+
type: "string"
|
|
12834
|
+
},
|
|
12695
12835
|
replace: {
|
|
12696
12836
|
type: "boolean"
|
|
12697
12837
|
},
|
|
@@ -12879,6 +13019,10 @@ async function runArchiveCommand2(args) {
|
|
|
12879
13019
|
const command = await Promise.resolve().then(() => (init_archive_command(), archive_command_exports));
|
|
12880
13020
|
return command.runArchiveCommand(args);
|
|
12881
13021
|
}
|
|
13022
|
+
async function runArchiveTitleCommand2(args) {
|
|
13023
|
+
const command = await Promise.resolve().then(() => (init_archive_title(), archive_title_exports));
|
|
13024
|
+
return command.runArchiveTitleCommand(args);
|
|
13025
|
+
}
|
|
12882
13026
|
async function runArchiveChapterCommand2(args) {
|
|
12883
13027
|
const command = await Promise.resolve().then(() => (init_chapter(), chapter_exports));
|
|
12884
13028
|
return command.runArchiveChapterCommand(args);
|
|
@@ -12982,6 +13126,9 @@ async function dispatchWikiGraphCLI(input) {
|
|
|
12982
13126
|
case "archive":
|
|
12983
13127
|
await runArchiveCommand2(parsed.args);
|
|
12984
13128
|
return { exitCode: 0 };
|
|
13129
|
+
case "archive-title":
|
|
13130
|
+
await runArchiveTitleCommand2(parsed.args);
|
|
13131
|
+
return { exitCode: 0 };
|
|
12985
13132
|
case "archive-index":
|
|
12986
13133
|
await runArchiveIndexCommand2(parsed.args);
|
|
12987
13134
|
return { exitCode: 0 };
|