wiki-graph 0.7.1 → 0.8.0
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 +665 -630
- package/dist/cli.js.map +1 -1
- package/dist/data/help/commands/library-predicate.jinja +13 -0
- package/dist/data/help/commands/library.jinja +2 -0
- package/dist/gc-worker.js +102 -85
- package/dist/gc-worker.js.map +1 -1
- package/dist/index.cjs +523 -171
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +438 -82
- package/dist/index.js.map +1 -1
- package/dist/queue-worker.js +657 -622
- package/dist/queue-worker.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -556,6 +556,30 @@ var init_version = __esm({
|
|
|
556
556
|
}
|
|
557
557
|
});
|
|
558
558
|
|
|
559
|
+
// src/support/archive-target.ts
|
|
560
|
+
import {
|
|
561
|
+
parseLocatedWikiGraphUri as parseLocatedWikiGraphUri2
|
|
562
|
+
} from "wiki-graph-sdk";
|
|
563
|
+
function parseCLIArchiveTarget(locator) {
|
|
564
|
+
if (locator.startsWith("wikg://lib/")) {
|
|
565
|
+
return { kind: "library", uri: locator };
|
|
566
|
+
}
|
|
567
|
+
if (!locator.includes("://")) {
|
|
568
|
+
return { kind: "standalone", path: locator };
|
|
569
|
+
}
|
|
570
|
+
const parsed = parseLocatedWikiGraphUri2(locator);
|
|
571
|
+
return {
|
|
572
|
+
kind: "standalone",
|
|
573
|
+
path: parsed.archivePath ?? locator,
|
|
574
|
+
...parsed.objectUri === void 0 ? {} : { objectUri: parsed.objectUri }
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
var init_archive_target = __esm({
|
|
578
|
+
"src/support/archive-target.ts"() {
|
|
579
|
+
"use strict";
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
|
|
559
583
|
// src/support/index.ts
|
|
560
584
|
var init_support = __esm({
|
|
561
585
|
"src/support/index.ts"() {
|
|
@@ -569,6 +593,7 @@ var init_support = __esm({
|
|
|
569
593
|
init_uri();
|
|
570
594
|
init_version();
|
|
571
595
|
init_command();
|
|
596
|
+
init_archive_target();
|
|
572
597
|
}
|
|
573
598
|
});
|
|
574
599
|
|
|
@@ -1321,17 +1346,315 @@ var init_create = __esm({
|
|
|
1321
1346
|
});
|
|
1322
1347
|
|
|
1323
1348
|
// src/commands/archive-command/inspect.ts
|
|
1349
|
+
import {
|
|
1350
|
+
createGenerationPerformanceHints,
|
|
1351
|
+
DEFAULT_GENERATION_JOB_CONCURRENCY,
|
|
1352
|
+
DEFAULT_GENERATION_REQUEST_CONCURRENCY,
|
|
1353
|
+
formatGenerationPlanningModel,
|
|
1354
|
+
loadWikiGraphRuntimeConfig as loadWikiGraphRuntimeConfig2,
|
|
1355
|
+
planGenerationTask
|
|
1356
|
+
} from "wiki-graph-sdk";
|
|
1324
1357
|
async function writeArchiveInspectReport(args) {
|
|
1325
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
1358
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
1359
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
1360
|
+
);
|
|
1326
1361
|
const report = toCLIInspectReport(
|
|
1327
|
-
await
|
|
1328
|
-
|
|
1329
|
-
|
|
1362
|
+
await createInspectReport(
|
|
1363
|
+
await archive.inspect({
|
|
1364
|
+
...args.chapterId === void 0 ? {} : { chapterId: args.chapterId }
|
|
1365
|
+
})
|
|
1366
|
+
)
|
|
1330
1367
|
);
|
|
1331
1368
|
await writeTextToStdout(
|
|
1332
1369
|
args.json === true ? formatCLIJSON(report) : formatArchiveInspectText(report)
|
|
1333
1370
|
);
|
|
1334
1371
|
}
|
|
1372
|
+
async function createInspectReport(inspection) {
|
|
1373
|
+
const config = await loadWikiGraphRuntimeConfig2();
|
|
1374
|
+
const chapters = inspection.chapters;
|
|
1375
|
+
const contentChapters = chapters.filter(
|
|
1376
|
+
({ chapter }) => chapter.stage !== "planned"
|
|
1377
|
+
);
|
|
1378
|
+
const readingGraphCovered = contentChapters.filter(
|
|
1379
|
+
({ capabilities }) => capabilities.readingGraph.completed
|
|
1380
|
+
);
|
|
1381
|
+
const knowledgeGraphCovered = contentChapters.filter(
|
|
1382
|
+
({ capabilities }) => capabilities.knowledgeGraph.completed
|
|
1383
|
+
);
|
|
1384
|
+
const summaryCovered = contentChapters.filter(
|
|
1385
|
+
({ capabilities }) => capabilities.readingSummary.completed
|
|
1386
|
+
);
|
|
1387
|
+
const ftsArtifactCovered = contentChapters.filter(
|
|
1388
|
+
({ indexes }) => indexes.fts.current
|
|
1389
|
+
);
|
|
1390
|
+
const sourceEmbeddingArtifactCovered = contentChapters.filter(
|
|
1391
|
+
({ indexes }) => indexes.sourceEmbedding.current
|
|
1392
|
+
);
|
|
1393
|
+
const summaryEmbeddingArtifactCovered = contentChapters.filter(
|
|
1394
|
+
({ indexes }) => indexes.summaryEmbedding.current
|
|
1395
|
+
);
|
|
1396
|
+
const queryBlockedChapters = contentChapters.filter(
|
|
1397
|
+
(chapter) => !ftsArtifactCovered.includes(chapter) && !sourceEmbeddingArtifactCovered.includes(chapter)
|
|
1398
|
+
);
|
|
1399
|
+
const queryReady = queryBlockedChapters.length === 0;
|
|
1400
|
+
const concurrent = {
|
|
1401
|
+
job: config.concurrent?.job ?? DEFAULT_GENERATION_JOB_CONCURRENCY,
|
|
1402
|
+
request: config.concurrent?.request ?? DEFAULT_GENERATION_REQUEST_CONCURRENCY
|
|
1403
|
+
};
|
|
1404
|
+
const improvements = createInspectImprovements({
|
|
1405
|
+
concurrent,
|
|
1406
|
+
contentChapters,
|
|
1407
|
+
indexCacheCurrent: inspection.localIndexCache.current,
|
|
1408
|
+
knowledgeGraphCovered,
|
|
1409
|
+
planningModel: formatGenerationPlanningModel(config.llm),
|
|
1410
|
+
queryBlockedChapters,
|
|
1411
|
+
readingGraphCovered,
|
|
1412
|
+
summaryCovered
|
|
1413
|
+
});
|
|
1414
|
+
const performanceHints = createGenerationPerformanceHints({
|
|
1415
|
+
chapters: Math.max(
|
|
1416
|
+
0,
|
|
1417
|
+
...improvements.map((improvement) => improvement.missingChapters ?? 0)
|
|
1418
|
+
),
|
|
1419
|
+
concurrent,
|
|
1420
|
+
hasJobWork: improvements.some(
|
|
1421
|
+
(improvement) => improvement.planning !== void 0
|
|
1422
|
+
),
|
|
1423
|
+
hasRequestWork: improvements.some(
|
|
1424
|
+
(improvement) => improvement.planning !== void 0
|
|
1425
|
+
)
|
|
1426
|
+
});
|
|
1427
|
+
const sourceWords = sumWords(contentChapters);
|
|
1428
|
+
const indexCacheCurrent = inspection.localIndexCache.current;
|
|
1429
|
+
return {
|
|
1430
|
+
archiveUri: inspection.archiveUri,
|
|
1431
|
+
content: {
|
|
1432
|
+
chapters: {
|
|
1433
|
+
content: contentChapters.length,
|
|
1434
|
+
planned: chapters.length - contentChapters.length,
|
|
1435
|
+
total: chapters.length
|
|
1436
|
+
},
|
|
1437
|
+
sourceWords,
|
|
1438
|
+
summaryWords: chapters.reduce(
|
|
1439
|
+
(total, chapter) => total + chapter.summaryWords,
|
|
1440
|
+
0
|
|
1441
|
+
)
|
|
1442
|
+
},
|
|
1443
|
+
coverage: {
|
|
1444
|
+
ftsIndexArtifact: createInspectCoverage(
|
|
1445
|
+
ftsArtifactCovered,
|
|
1446
|
+
contentChapters
|
|
1447
|
+
),
|
|
1448
|
+
knowledgeGraph: createInspectCoverage(
|
|
1449
|
+
knowledgeGraphCovered,
|
|
1450
|
+
contentChapters
|
|
1451
|
+
),
|
|
1452
|
+
readingGraph: createInspectCoverage(readingGraphCovered, contentChapters),
|
|
1453
|
+
sourceEmbeddingIndexArtifact: createInspectCoverage(
|
|
1454
|
+
sourceEmbeddingArtifactCovered,
|
|
1455
|
+
contentChapters
|
|
1456
|
+
),
|
|
1457
|
+
summary: createInspectCoverage(summaryCovered, contentChapters),
|
|
1458
|
+
summaryEmbeddingIndexArtifact: createInspectCoverage(
|
|
1459
|
+
summaryEmbeddingArtifactCovered,
|
|
1460
|
+
contentChapters
|
|
1461
|
+
)
|
|
1462
|
+
},
|
|
1463
|
+
improvements,
|
|
1464
|
+
localIndexCache: {
|
|
1465
|
+
current: indexCacheCurrent,
|
|
1466
|
+
...!queryReady ? {
|
|
1467
|
+
blockedBy: "missing-search-artifacts",
|
|
1468
|
+
impact: "The cache cannot be built until every content chapter has a current FTS or source embedding artifact."
|
|
1469
|
+
} : indexCacheCurrent ? {} : {
|
|
1470
|
+
impact: "The next archive query may need to sync index cache first.",
|
|
1471
|
+
resource: "local CPU/disk time only; no provider calls."
|
|
1472
|
+
},
|
|
1473
|
+
status: !queryReady ? "blocked" : indexCacheCurrent ? "current" : "missing-or-outdated",
|
|
1474
|
+
syncAvailable: queryReady && !indexCacheCurrent
|
|
1475
|
+
},
|
|
1476
|
+
performanceHints,
|
|
1477
|
+
query: { ready: queryReady },
|
|
1478
|
+
retrievalGuidance: formatRetrievalGuidance({
|
|
1479
|
+
contentChapters,
|
|
1480
|
+
indexCacheCurrent,
|
|
1481
|
+
knowledgeGraphCovered,
|
|
1482
|
+
queryReady,
|
|
1483
|
+
readingGraphCovered,
|
|
1484
|
+
sourceWords
|
|
1485
|
+
}),
|
|
1486
|
+
scope: inspection.scope,
|
|
1487
|
+
searchArtifacts: {
|
|
1488
|
+
blockedChapters: queryBlockedChapters.map(
|
|
1489
|
+
(item) => createInspectChapterReference(inspection.archiveUri, item)
|
|
1490
|
+
),
|
|
1491
|
+
...!queryReady ? { resource: "local CPU/disk time only; no provider calls." } : {},
|
|
1492
|
+
ready: queryReady,
|
|
1493
|
+
status: queryReady ? "ready" : "incomplete"
|
|
1494
|
+
},
|
|
1495
|
+
summaryCoverageNote: "Summary coverage means a current summary artifact exists for the chapter; it does not guarantee that every source topic is represented in the summary text.",
|
|
1496
|
+
uri: inspection.uri
|
|
1497
|
+
};
|
|
1498
|
+
}
|
|
1499
|
+
function createInspectChapterReference(archiveUri, inspection) {
|
|
1500
|
+
return {
|
|
1501
|
+
chapterId: inspection.chapter.chapterId,
|
|
1502
|
+
locatedUri: `${archiveUri.replace(/\/+$/u, "")}/${inspection.chapter.uri.replace(/^wikg:\/\//u, "")}`,
|
|
1503
|
+
title: inspection.chapter.title,
|
|
1504
|
+
uri: inspection.chapter.uri
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
function createInspectCoverage(covered, total) {
|
|
1508
|
+
const coveredWords = sumWords(covered);
|
|
1509
|
+
const totalWords = sumWords(total);
|
|
1510
|
+
return {
|
|
1511
|
+
coveredChapters: covered.length,
|
|
1512
|
+
coveredWords,
|
|
1513
|
+
percent: formatPercent(coveredWords, totalWords),
|
|
1514
|
+
totalChapters: total.length,
|
|
1515
|
+
totalWords
|
|
1516
|
+
};
|
|
1517
|
+
}
|
|
1518
|
+
function createInspectImprovements(input) {
|
|
1519
|
+
if (input.contentChapters.length === 0) {
|
|
1520
|
+
return [
|
|
1521
|
+
{
|
|
1522
|
+
kind: "add-source",
|
|
1523
|
+
recommendation: "No source content is available yet; add or import source text before graph or summary generation.",
|
|
1524
|
+
title: "Add source content"
|
|
1525
|
+
}
|
|
1526
|
+
];
|
|
1527
|
+
}
|
|
1528
|
+
const improvements = [];
|
|
1529
|
+
if (input.queryBlockedChapters.length > 0) {
|
|
1530
|
+
improvements.push({
|
|
1531
|
+
kind: "build",
|
|
1532
|
+
missingChapters: input.queryBlockedChapters.length,
|
|
1533
|
+
missingWords: sumWords(input.queryBlockedChapters),
|
|
1534
|
+
recommendation: "Build local FTS artifacts to make this scope queryable. This does not call a provider.",
|
|
1535
|
+
task: "index-fts",
|
|
1536
|
+
title: "Enable query with local FTS"
|
|
1537
|
+
});
|
|
1538
|
+
} else if (!input.indexCacheCurrent) {
|
|
1539
|
+
improvements.push({
|
|
1540
|
+
kind: "sync-index",
|
|
1541
|
+
recommendation: "Sync the index cache from chapter index artifacts so query starts without a lazy cache rebuild.",
|
|
1542
|
+
title: "Sync index cache"
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
improvements.push(
|
|
1546
|
+
...createGraphImprovement({
|
|
1547
|
+
concurrent: input.concurrent,
|
|
1548
|
+
covered: input.readingGraphCovered,
|
|
1549
|
+
planningModel: input.planningModel,
|
|
1550
|
+
task: "reading-graph",
|
|
1551
|
+
title: "Complete Reading Graph coverage",
|
|
1552
|
+
total: input.contentChapters
|
|
1553
|
+
}),
|
|
1554
|
+
...createGraphImprovement({
|
|
1555
|
+
concurrent: input.concurrent,
|
|
1556
|
+
covered: input.knowledgeGraphCovered,
|
|
1557
|
+
planningModel: input.planningModel,
|
|
1558
|
+
task: "knowledge-graph",
|
|
1559
|
+
title: "Complete Knowledge Graph coverage",
|
|
1560
|
+
total: input.contentChapters
|
|
1561
|
+
}),
|
|
1562
|
+
...createGraphImprovement({
|
|
1563
|
+
concurrent: input.concurrent,
|
|
1564
|
+
covered: input.summaryCovered,
|
|
1565
|
+
planningModel: input.planningModel,
|
|
1566
|
+
task: "reading-summary",
|
|
1567
|
+
title: "Complete Summary coverage",
|
|
1568
|
+
total: input.contentChapters
|
|
1569
|
+
})
|
|
1570
|
+
);
|
|
1571
|
+
return improvements;
|
|
1572
|
+
}
|
|
1573
|
+
function createGraphImprovement(input) {
|
|
1574
|
+
const coveredIds = new Set(
|
|
1575
|
+
input.covered.map(({ chapter }) => chapter.chapterId)
|
|
1576
|
+
);
|
|
1577
|
+
const missing = input.total.filter(
|
|
1578
|
+
({ chapter }) => !coveredIds.has(chapter.chapterId)
|
|
1579
|
+
);
|
|
1580
|
+
if (missing.length === 0) return [];
|
|
1581
|
+
const missingWords = sumWords(missing);
|
|
1582
|
+
return [
|
|
1583
|
+
{
|
|
1584
|
+
kind: "build",
|
|
1585
|
+
missingChapters: missing.length,
|
|
1586
|
+
missingWords,
|
|
1587
|
+
planning: planGenerationTask(
|
|
1588
|
+
input.task,
|
|
1589
|
+
missingWords,
|
|
1590
|
+
missing.length,
|
|
1591
|
+
input.concurrent,
|
|
1592
|
+
input.planningModel
|
|
1593
|
+
),
|
|
1594
|
+
recommendation: formatImprovementRecommendation(
|
|
1595
|
+
input.covered,
|
|
1596
|
+
input.total,
|
|
1597
|
+
missingWords
|
|
1598
|
+
),
|
|
1599
|
+
task: input.task,
|
|
1600
|
+
title: input.title
|
|
1601
|
+
}
|
|
1602
|
+
];
|
|
1603
|
+
}
|
|
1604
|
+
function formatImprovementRecommendation(covered, total, missingWords) {
|
|
1605
|
+
const totalWords = sumWords(total);
|
|
1606
|
+
const coveredWords = sumWords(covered);
|
|
1607
|
+
if (totalWords === 0) return "No source content is available.";
|
|
1608
|
+
if (total.length === 1 || coveredWords / totalWords >= 0.9 || missingWords <= 1e3) {
|
|
1609
|
+
return "Queue the full scope to finish the remaining gap.";
|
|
1610
|
+
}
|
|
1611
|
+
return "Queue selected chapters first if only part of the scope matters.";
|
|
1612
|
+
}
|
|
1613
|
+
function formatRetrievalGuidance(input) {
|
|
1614
|
+
if (input.sourceWords === 0 || input.contentChapters.length === 0) {
|
|
1615
|
+
return [
|
|
1616
|
+
"Source content: empty.",
|
|
1617
|
+
"Add source text before using query coverage or graph-based retrieval."
|
|
1618
|
+
];
|
|
1619
|
+
}
|
|
1620
|
+
return [
|
|
1621
|
+
input.queryReady ? `Query: available; local index cache is ${input.indexCacheCurrent ? "current" : "missing or outdated and can be synced from artifacts"}.` : "Query: unavailable until every content chapter has a current FTS or source embedding artifact.",
|
|
1622
|
+
formatObjectSearchGuidance(
|
|
1623
|
+
"Reading Graph object retrieval",
|
|
1624
|
+
input.readingGraphCovered,
|
|
1625
|
+
input.contentChapters
|
|
1626
|
+
),
|
|
1627
|
+
formatObjectSearchGuidance(
|
|
1628
|
+
"Entity/triple retrieval",
|
|
1629
|
+
input.knowledgeGraphCovered,
|
|
1630
|
+
input.contentChapters
|
|
1631
|
+
)
|
|
1632
|
+
];
|
|
1633
|
+
}
|
|
1634
|
+
function formatObjectSearchGuidance(label, covered, total) {
|
|
1635
|
+
const coveredWords = sumWords(covered);
|
|
1636
|
+
const totalWords = sumWords(total);
|
|
1637
|
+
const ratio = totalWords === 0 ? 0 : coveredWords / totalWords;
|
|
1638
|
+
const coverage = formatPercent(coveredWords, totalWords);
|
|
1639
|
+
if (ratio >= 1) {
|
|
1640
|
+
return `${label}: covers all source content; it can represent the full scope for object retrieval.`;
|
|
1641
|
+
}
|
|
1642
|
+
if (ratio >= 0.9) {
|
|
1643
|
+
return `${label}: covers ${coverage}; use it as the main path, but source --query is needed for uncovered content.`;
|
|
1644
|
+
}
|
|
1645
|
+
if (ratio >= 0.5) {
|
|
1646
|
+
return `${label}: covers ${coverage}; use it as leads, not as a full-scope substitute for source --query.`;
|
|
1647
|
+
}
|
|
1648
|
+
return `${label}: covers ${coverage}; build missing graph coverage before relying on object retrieval.`;
|
|
1649
|
+
}
|
|
1650
|
+
function sumWords(chapters) {
|
|
1651
|
+
return chapters.reduce((total, { chapter }) => total + chapter.words, 0);
|
|
1652
|
+
}
|
|
1653
|
+
function formatPercent(numerator, denominator) {
|
|
1654
|
+
if (denominator === 0) return "n/a";
|
|
1655
|
+
const percent = numerator / denominator * 100;
|
|
1656
|
+
return `${Number.isInteger(percent) ? percent.toFixed(0) : percent.toFixed(1)}%`;
|
|
1657
|
+
}
|
|
1335
1658
|
function toCLIInspectReport(report) {
|
|
1336
1659
|
const { archiveUri, summaryCoverageNote, ...base } = report;
|
|
1337
1660
|
return {
|
|
@@ -1493,6 +1816,7 @@ var init_inspect = __esm({
|
|
|
1493
1816
|
init_runtime();
|
|
1494
1817
|
init_context();
|
|
1495
1818
|
init_support();
|
|
1819
|
+
init_archive_target();
|
|
1496
1820
|
}
|
|
1497
1821
|
});
|
|
1498
1822
|
|
|
@@ -3030,30 +3354,15 @@ var init_types2 = __esm({
|
|
|
3030
3354
|
});
|
|
3031
3355
|
|
|
3032
3356
|
// src/commands/archive-command/run/uri.ts
|
|
3033
|
-
import {
|
|
3034
|
-
|
|
3035
|
-
resolveWikiGraphArchiveLocation
|
|
3036
|
-
} from "wiki-graph-sdk";
|
|
3037
|
-
async function resolveArchiveRuntimeLocation(uriOrPath) {
|
|
3038
|
-
return await resolveWikiGraphArchiveLocation(uriOrPath);
|
|
3039
|
-
}
|
|
3040
|
-
async function resolveArchiveCommandRuntimeArguments(args) {
|
|
3357
|
+
import { parseWikiGraphLibraryUri as parseWikiGraphLibraryUri4 } from "wiki-graph-sdk";
|
|
3358
|
+
function resolveArchiveCommandRuntimeArguments(args) {
|
|
3041
3359
|
if (args.action === "create" || args.action === "export") {
|
|
3042
|
-
|
|
3043
|
-
return { ...args, archivePath: location2.archivePath };
|
|
3044
|
-
}
|
|
3045
|
-
if (args.action === "inspect" || args.action === "next") return args;
|
|
3046
|
-
if (!args.archivePath.startsWith("wikg://lib/")) {
|
|
3047
|
-
return args;
|
|
3360
|
+
return { ...args, archivePath: getArchivePath(args.archivePath) };
|
|
3048
3361
|
}
|
|
3049
|
-
|
|
3050
|
-
return {
|
|
3051
|
-
...args,
|
|
3052
|
-
archivePath: location.locatedUri,
|
|
3053
|
-
...args.objectId === args.archivePath ? { objectId: location.locatedUri } : {}
|
|
3054
|
-
};
|
|
3362
|
+
return args;
|
|
3055
3363
|
}
|
|
3056
3364
|
function getArchivePath(uri) {
|
|
3365
|
+
if (!uri.includes("://")) return uri;
|
|
3057
3366
|
if (parseWikiGraphLibraryUri4(uri)?.kind === "scope") {
|
|
3058
3367
|
return uri;
|
|
3059
3368
|
}
|
|
@@ -3094,7 +3403,7 @@ var init_uri3 = __esm({
|
|
|
3094
3403
|
|
|
3095
3404
|
// src/commands/archive-command/run/options.ts
|
|
3096
3405
|
import {
|
|
3097
|
-
parseLocatedWikiGraphUri as
|
|
3406
|
+
parseLocatedWikiGraphUri as parseLocatedWikiGraphUri3
|
|
3098
3407
|
} from "wiki-graph-sdk";
|
|
3099
3408
|
function createFindOptions(args) {
|
|
3100
3409
|
const types = args.kinds?.map((kind) => {
|
|
@@ -3206,7 +3515,7 @@ function createScopeOptions(args) {
|
|
|
3206
3515
|
if (args.chapters !== void 0) {
|
|
3207
3516
|
return { chapters: args.chapters };
|
|
3208
3517
|
}
|
|
3209
|
-
const objectUri =
|
|
3518
|
+
const objectUri = parseLocatedWikiGraphUri3(args.archivePath).objectUri;
|
|
3210
3519
|
if (objectUri === void 0) {
|
|
3211
3520
|
return {};
|
|
3212
3521
|
}
|
|
@@ -3261,7 +3570,7 @@ var init_options = __esm({
|
|
|
3261
3570
|
async function runNextArchivePage(args) {
|
|
3262
3571
|
const cursorId = args.cursor ?? args.archivePath;
|
|
3263
3572
|
const page = await getWikiGraphSDK().continuations.next({
|
|
3264
|
-
...args.cursor === void 0 ? {} : { archive: args.archivePath },
|
|
3573
|
+
...args.cursor === void 0 ? {} : { archive: parseCLIArchiveTarget(args.archivePath) },
|
|
3265
3574
|
cursor: cursorId,
|
|
3266
3575
|
...args.format === void 0 ? {} : { format: args.format },
|
|
3267
3576
|
...args.limit === void 0 ? {} : { limit: args.limit }
|
|
@@ -3331,6 +3640,7 @@ function createCursorOutputContext(cursor, format, limit) {
|
|
|
3331
3640
|
var init_next = __esm({
|
|
3332
3641
|
"src/commands/archive-command/run/next.ts"() {
|
|
3333
3642
|
"use strict";
|
|
3643
|
+
init_archive_target();
|
|
3334
3644
|
init_context();
|
|
3335
3645
|
init_archive_output();
|
|
3336
3646
|
init_options();
|
|
@@ -3385,7 +3695,7 @@ async function runArchiveCommand(args) {
|
|
|
3385
3695
|
await runLibraryIndexArchiveCommand(args, libraryTarget);
|
|
3386
3696
|
return;
|
|
3387
3697
|
}
|
|
3388
|
-
args =
|
|
3698
|
+
args = resolveArchiveCommandRuntimeArguments(args);
|
|
3389
3699
|
switch (args.action) {
|
|
3390
3700
|
case "create":
|
|
3391
3701
|
await createArchive(args);
|
|
@@ -3430,7 +3740,9 @@ async function runArchiveCommand(args) {
|
|
|
3430
3740
|
return;
|
|
3431
3741
|
case "pack":
|
|
3432
3742
|
await writePack(
|
|
3433
|
-
await (await getWikiGraphSDK().archives.open(
|
|
3743
|
+
await (await getWikiGraphSDK().archives.open(
|
|
3744
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
3745
|
+
)).pack(getObjectUri(args.objectId), args.budget ?? 5e3),
|
|
3434
3746
|
createArchiveOutputContext(args),
|
|
3435
3747
|
args.format ?? "text"
|
|
3436
3748
|
);
|
|
@@ -3438,7 +3750,9 @@ async function runArchiveCommand(args) {
|
|
|
3438
3750
|
}
|
|
3439
3751
|
}
|
|
3440
3752
|
async function runArchiveList(args) {
|
|
3441
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
3753
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
3754
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
3755
|
+
);
|
|
3442
3756
|
const objectUri = getObjectUri(args.archivePath);
|
|
3443
3757
|
if (isSourceLocatorScopeUri(objectUri)) {
|
|
3444
3758
|
const context2 = createArchiveOutputContext(args, {
|
|
@@ -3507,7 +3821,9 @@ async function runArchiveList(args) {
|
|
|
3507
3821
|
);
|
|
3508
3822
|
}
|
|
3509
3823
|
async function runArchiveSearch(args) {
|
|
3510
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
3824
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
3825
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
3826
|
+
);
|
|
3511
3827
|
const scope = await archive.resolveScope({
|
|
3512
3828
|
...args.depth === void 0 ? {} : { depth: args.depth }
|
|
3513
3829
|
});
|
|
@@ -3541,7 +3857,9 @@ async function runArchiveGet(args) {
|
|
|
3541
3857
|
const objectUri = getObjectUri(args.objectId);
|
|
3542
3858
|
const evidenceLimit = getSingleObjectEvidenceLimit(args, objectUri);
|
|
3543
3859
|
const context = evidenceLimit === void 0 ? createArchiveOutputContext(args) : createArchiveOutputContext({ ...args, evidenceLimit });
|
|
3544
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
3860
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
3861
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
3862
|
+
);
|
|
3545
3863
|
await writePage(
|
|
3546
3864
|
await archive.page(objectUri, {
|
|
3547
3865
|
...args.backlinks === void 0 ? {} : { backlinks: args.backlinks },
|
|
@@ -3555,7 +3873,9 @@ async function runArchiveGet(args) {
|
|
|
3555
3873
|
}
|
|
3556
3874
|
async function runArchiveRelated(args) {
|
|
3557
3875
|
const objectUri = getObjectUri(args.objectId);
|
|
3558
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
3876
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
3877
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
3878
|
+
);
|
|
3559
3879
|
const scope = await archive.resolveScope();
|
|
3560
3880
|
const context = createArchiveOutputContext(
|
|
3561
3881
|
scope === void 0 ? args : { ...args, chapters: scope.chapterIds },
|
|
@@ -3587,7 +3907,9 @@ async function runArchiveRelated(args) {
|
|
|
3587
3907
|
}
|
|
3588
3908
|
async function runArchiveEvidence(args) {
|
|
3589
3909
|
const objectUri = getObjectUri(args.objectId);
|
|
3590
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
3910
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
3911
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
3912
|
+
);
|
|
3591
3913
|
const scope = await archive.resolveScope();
|
|
3592
3914
|
const context = createArchiveOutputContext(
|
|
3593
3915
|
scope === void 0 ? args : { ...args, chapters: scope.chapterIds },
|
|
@@ -3913,6 +4235,7 @@ var init_archive_command = __esm({
|
|
|
3913
4235
|
init_inspect();
|
|
3914
4236
|
init_archive_output();
|
|
3915
4237
|
init_run();
|
|
4238
|
+
init_archive_target();
|
|
3916
4239
|
}
|
|
3917
4240
|
});
|
|
3918
4241
|
|
|
@@ -4239,16 +4562,6 @@ var init_estimate = __esm({
|
|
|
4239
4562
|
}
|
|
4240
4563
|
});
|
|
4241
4564
|
|
|
4242
|
-
// src/runtime/node-platform.ts
|
|
4243
|
-
var node_platform_exports = {};
|
|
4244
|
-
import * as node_platform_star from "wiki-graph-sdk/node-platform";
|
|
4245
|
-
var init_node_platform = __esm({
|
|
4246
|
-
"src/runtime/node-platform.ts"() {
|
|
4247
|
-
"use strict";
|
|
4248
|
-
__reExport(node_platform_exports, node_platform_star);
|
|
4249
|
-
}
|
|
4250
|
-
});
|
|
4251
|
-
|
|
4252
4565
|
// src/commands/queue/output.ts
|
|
4253
4566
|
import {
|
|
4254
4567
|
formatLocatedChapterUri as formatLocatedChapterUri2
|
|
@@ -4500,26 +4813,23 @@ async function resolveJobChapter(job) {
|
|
|
4500
4813
|
}
|
|
4501
4814
|
function getJobResourcePath(job, resourceKey, legacyKey) {
|
|
4502
4815
|
const record = job;
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
const managedPath = getManagedJobResourcePath(resource);
|
|
4506
|
-
if (managedPath !== void 0) return managedPath;
|
|
4507
|
-
return (0, node_platform_exports.getNodeResourcePath)(resource);
|
|
4816
|
+
if (resourceKey === "archive") {
|
|
4817
|
+
return job.archive.kind === "library" ? job.archive.uri : job.archive.path;
|
|
4508
4818
|
}
|
|
4509
4819
|
const legacyPath = record[legacyKey];
|
|
4510
|
-
if (typeof legacyPath === "string")
|
|
4820
|
+
if (typeof legacyPath === "string") {
|
|
4821
|
+
return resolveManagedJobResourcePath(legacyPath) ?? legacyPath;
|
|
4822
|
+
}
|
|
4511
4823
|
return void 0;
|
|
4512
4824
|
}
|
|
4513
|
-
function
|
|
4514
|
-
if (
|
|
4515
|
-
|
|
4516
|
-
}
|
|
4517
|
-
const relativePath = resource.identity.slice("managed:library:".length);
|
|
4825
|
+
function resolveManagedJobResourcePath(identity) {
|
|
4826
|
+
if (!identity.startsWith("managed:library:")) return void 0;
|
|
4827
|
+
const relativePath = identity.slice("managed:library:".length);
|
|
4518
4828
|
const segments = relativePath.split("/");
|
|
4519
4829
|
if (relativePath === "" || segments.some(
|
|
4520
4830
|
(segment) => segment === "" || segment === "." || segment === ".." || segment.includes("\\")
|
|
4521
4831
|
)) {
|
|
4522
|
-
throw new TypeError(`Invalid managed job resource: ${
|
|
4832
|
+
throw new TypeError(`Invalid managed job resource: ${identity}`);
|
|
4523
4833
|
}
|
|
4524
4834
|
const environmentHome = getCLIEnvValue("HOME")?.trim();
|
|
4525
4835
|
const stateDirectory = getCLIStateDir() ?? join5(
|
|
@@ -4538,7 +4848,6 @@ var init_output = __esm({
|
|
|
4538
4848
|
"use strict";
|
|
4539
4849
|
init_support();
|
|
4540
4850
|
init_estimate();
|
|
4541
|
-
init_node_platform();
|
|
4542
4851
|
init_context();
|
|
4543
4852
|
}
|
|
4544
4853
|
});
|
|
@@ -4569,6 +4878,7 @@ var init_add = __esm({
|
|
|
4569
4878
|
init_internal_child();
|
|
4570
4879
|
init_estimate();
|
|
4571
4880
|
init_output();
|
|
4881
|
+
init_archive_target();
|
|
4572
4882
|
}
|
|
4573
4883
|
});
|
|
4574
4884
|
|
|
@@ -4585,7 +4895,7 @@ import {
|
|
|
4585
4895
|
} from "wiki-graph-sdk";
|
|
4586
4896
|
async function runArchiveChapterCommand(args) {
|
|
4587
4897
|
const sdk = getWikiGraphSDK();
|
|
4588
|
-
const archive = await sdk.archives.open(args.path);
|
|
4898
|
+
const archive = await sdk.archives.open(parseCLIArchiveTarget(args.path));
|
|
4589
4899
|
switch (args.action) {
|
|
4590
4900
|
case "add": {
|
|
4591
4901
|
const details = await archive.addChapter({
|
|
@@ -4615,7 +4925,7 @@ async function runArchiveChapterCommand(args) {
|
|
|
4615
4925
|
requireChapterPath2(args.chapterPath)
|
|
4616
4926
|
);
|
|
4617
4927
|
const job = await sdk.jobs.create({
|
|
4618
|
-
archive: archive.
|
|
4928
|
+
archive: archive.target,
|
|
4619
4929
|
chapterId: chapter.chapterId,
|
|
4620
4930
|
target: requireIndexArtifactTarget(args.indexArtifactTarget)
|
|
4621
4931
|
});
|
|
@@ -4929,6 +5239,7 @@ var init_chapter = __esm({
|
|
|
4929
5239
|
"use strict";
|
|
4930
5240
|
init_context();
|
|
4931
5241
|
init_support();
|
|
5242
|
+
init_archive_target();
|
|
4932
5243
|
init_support();
|
|
4933
5244
|
init_add();
|
|
4934
5245
|
init_output();
|
|
@@ -4954,11 +5265,15 @@ async function runArchiveIndexCommand(args) {
|
|
|
4954
5265
|
}
|
|
4955
5266
|
}
|
|
4956
5267
|
async function readIndexCache(args) {
|
|
4957
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
5268
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
5269
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
5270
|
+
);
|
|
4958
5271
|
await writeIndexOutput(args, await archive.getSearchIndexStatus());
|
|
4959
5272
|
}
|
|
4960
5273
|
async function syncIndexCache(args) {
|
|
4961
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
5274
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
5275
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
5276
|
+
);
|
|
4962
5277
|
const writer = new ProgressOutputWriter({
|
|
4963
5278
|
jsonl: args.jsonl ?? false,
|
|
4964
5279
|
throttleMs: INDEX_PROGRESS_OUTPUT_INTERVAL_MS
|
|
@@ -5007,7 +5322,9 @@ async function syncIndexCache(args) {
|
|
|
5007
5322
|
});
|
|
5008
5323
|
}
|
|
5009
5324
|
async function cleanIndexCache(args) {
|
|
5010
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
5325
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
5326
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
5327
|
+
);
|
|
5011
5328
|
await writeIndexOutput(args, await archive.cleanSearchIndex());
|
|
5012
5329
|
}
|
|
5013
5330
|
function formatIndexCounter(input) {
|
|
@@ -5076,6 +5393,7 @@ var init_search_index = __esm({
|
|
|
5076
5393
|
"src/commands/archive-command/search-index.ts"() {
|
|
5077
5394
|
"use strict";
|
|
5078
5395
|
init_support();
|
|
5396
|
+
init_archive_target();
|
|
5079
5397
|
init_support();
|
|
5080
5398
|
init_runtime();
|
|
5081
5399
|
init_context();
|
|
@@ -5094,13 +5412,17 @@ async function runArchiveMetaCommand(args) {
|
|
|
5094
5412
|
await updateArchiveMeta(args.inputPath, args.metaPatch);
|
|
5095
5413
|
return;
|
|
5096
5414
|
}
|
|
5097
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
5415
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
5416
|
+
parseCLIArchiveTarget(args.inputPath)
|
|
5417
|
+
);
|
|
5098
5418
|
await writeArchiveMeta(await archive.readBookMeta(), {
|
|
5099
5419
|
json: args.json ?? false
|
|
5100
5420
|
});
|
|
5101
5421
|
}
|
|
5102
5422
|
async function runArchiveCoverCommand(args) {
|
|
5103
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
5423
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
5424
|
+
parseCLIArchiveTarget(args.inputPath)
|
|
5425
|
+
);
|
|
5104
5426
|
if (process.stdout.isTTY === true) {
|
|
5105
5427
|
throw new Error(
|
|
5106
5428
|
"Refusing to write binary cover data to an interactive terminal. Redirect stdout or pipe it."
|
|
@@ -5113,7 +5435,9 @@ async function runArchiveCoverCommand(args) {
|
|
|
5113
5435
|
await writeBinaryToStdout(cover.data);
|
|
5114
5436
|
}
|
|
5115
5437
|
async function updateArchiveMeta(path, patch) {
|
|
5116
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
5438
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
5439
|
+
parseCLIArchiveTarget(path)
|
|
5440
|
+
);
|
|
5117
5441
|
const meta = await archive.readBookMeta();
|
|
5118
5442
|
if (meta === void 0) {
|
|
5119
5443
|
throw new Error("Archive metadata is missing.");
|
|
@@ -5176,6 +5500,7 @@ var init_maintenance = __esm({
|
|
|
5176
5500
|
"src/commands/archive-command/maintenance.ts"() {
|
|
5177
5501
|
"use strict";
|
|
5178
5502
|
init_support();
|
|
5503
|
+
init_archive_target();
|
|
5179
5504
|
init_support();
|
|
5180
5505
|
init_context();
|
|
5181
5506
|
}
|
|
@@ -5814,6 +6139,20 @@ async function runLibraryCommand(args) {
|
|
|
5814
6139
|
);
|
|
5815
6140
|
return;
|
|
5816
6141
|
}
|
|
6142
|
+
case "replace": {
|
|
6143
|
+
if (args.inputPath === void 0) {
|
|
6144
|
+
throw new Error("Missing --input <path> for library archive replace.");
|
|
6145
|
+
}
|
|
6146
|
+
await writeLibraryArchive(
|
|
6147
|
+
await libraries.replaceArchive({
|
|
6148
|
+
inputPath: args.inputPath,
|
|
6149
|
+
target: args.target
|
|
6150
|
+
}),
|
|
6151
|
+
args.json ?? false,
|
|
6152
|
+
"Replaced library archive"
|
|
6153
|
+
);
|
|
6154
|
+
return;
|
|
6155
|
+
}
|
|
5817
6156
|
case "get": {
|
|
5818
6157
|
if (args.target.kind === "path") {
|
|
5819
6158
|
await writeLibraryPath(
|
|
@@ -5911,9 +6250,8 @@ async function writeLibrary(library, json) {
|
|
|
5911
6250
|
formatCLIJSON({
|
|
5912
6251
|
uri: library.uri,
|
|
5913
6252
|
id: library.publicId,
|
|
5914
|
-
folderPath:
|
|
6253
|
+
folderPath: library.folderPath,
|
|
5915
6254
|
isDefault: library.isDefault,
|
|
5916
|
-
stagingPath: (0, node_platform_exports.getNodeResourcePath)(library.staging),
|
|
5917
6255
|
createdAt: library.createdAt,
|
|
5918
6256
|
updatedAt: library.updatedAt
|
|
5919
6257
|
})
|
|
@@ -5930,7 +6268,7 @@ async function writeLibraries(libraries, json) {
|
|
|
5930
6268
|
items: libraries.map((library) => ({
|
|
5931
6269
|
uri: library.uri,
|
|
5932
6270
|
id: library.publicId,
|
|
5933
|
-
path:
|
|
6271
|
+
path: library.folderPath,
|
|
5934
6272
|
isDefault: library.isDefault
|
|
5935
6273
|
}))
|
|
5936
6274
|
})
|
|
@@ -5942,7 +6280,7 @@ async function writeLibraries(libraries, json) {
|
|
|
5942
6280
|
(library) => [
|
|
5943
6281
|
library.uri,
|
|
5944
6282
|
library.publicId,
|
|
5945
|
-
|
|
6283
|
+
library.folderPath,
|
|
5946
6284
|
library.isDefault ? "default" : ""
|
|
5947
6285
|
].join(" ")
|
|
5948
6286
|
).join("\n") + (libraries.length === 0 ? "" : "\n")
|
|
@@ -5953,12 +6291,12 @@ async function writeLibraryPath(library, json) {
|
|
|
5953
6291
|
await writeTextToStdout(
|
|
5954
6292
|
formatCLIJSON({
|
|
5955
6293
|
uri: `${library.uri}/path`,
|
|
5956
|
-
path:
|
|
6294
|
+
path: library.folderPath
|
|
5957
6295
|
})
|
|
5958
6296
|
);
|
|
5959
6297
|
return;
|
|
5960
6298
|
}
|
|
5961
|
-
await writeTextToStdout(`${
|
|
6299
|
+
await writeTextToStdout(`${library.folderPath}
|
|
5962
6300
|
`);
|
|
5963
6301
|
}
|
|
5964
6302
|
async function writeLibraryArchivePath(archive, json) {
|
|
@@ -6297,7 +6635,7 @@ function formatMetadataTextValue(value) {
|
|
|
6297
6635
|
return String(value);
|
|
6298
6636
|
}
|
|
6299
6637
|
function formatArchiveHostPath(archive) {
|
|
6300
|
-
return archive.
|
|
6638
|
+
return archive.relativePath;
|
|
6301
6639
|
}
|
|
6302
6640
|
var INDEX_PROGRESS_OUTPUT_INTERVAL_MS2;
|
|
6303
6641
|
var init_library = __esm({
|
|
@@ -6306,7 +6644,6 @@ var init_library = __esm({
|
|
|
6306
6644
|
init_context();
|
|
6307
6645
|
init_support();
|
|
6308
6646
|
init_run();
|
|
6309
|
-
init_node_platform();
|
|
6310
6647
|
init_archive_output();
|
|
6311
6648
|
init_runtime();
|
|
6312
6649
|
INDEX_PROGRESS_OUTPUT_INTERVAL_MS2 = 6e3;
|
|
@@ -6320,7 +6657,9 @@ __export(object_metadata_exports, {
|
|
|
6320
6657
|
});
|
|
6321
6658
|
import { readFile as readFile3 } from "fs/promises";
|
|
6322
6659
|
async function runObjectMetadataCommand(args) {
|
|
6323
|
-
const archive = await getWikiGraphSDK().archives.open(
|
|
6660
|
+
const archive = await getWikiGraphSDK().archives.open(
|
|
6661
|
+
parseCLIArchiveTarget(args.archivePath)
|
|
6662
|
+
);
|
|
6324
6663
|
switch (args.action) {
|
|
6325
6664
|
case "get": {
|
|
6326
6665
|
await writeMetadataMap2(
|
|
@@ -6449,6 +6788,7 @@ var init_object_metadata = __esm({
|
|
|
6449
6788
|
"use strict";
|
|
6450
6789
|
init_context();
|
|
6451
6790
|
init_support();
|
|
6791
|
+
init_archive_target();
|
|
6452
6792
|
init_support();
|
|
6453
6793
|
}
|
|
6454
6794
|
});
|
|
@@ -6681,7 +7021,7 @@ async function runQueueCommand(args) {
|
|
|
6681
7021
|
(await getWikiGraphSDK().jobs.list({
|
|
6682
7022
|
...args.activeOnly === void 0 ? {} : { activeOnly: args.activeOnly },
|
|
6683
7023
|
...args.all === void 0 ? {} : { all: args.all },
|
|
6684
|
-
...args.archivePath === void 0 ? {} : { archive:
|
|
7024
|
+
...args.archivePath === void 0 ? {} : { archive: parseCLIArchiveTarget(args.archivePath) }
|
|
6685
7025
|
})).map((job) => job.snapshot),
|
|
6686
7026
|
{ json: args.json ?? false }
|
|
6687
7027
|
);
|
|
@@ -6733,7 +7073,7 @@ async function getQueueJob(args) {
|
|
|
6733
7073
|
}
|
|
6734
7074
|
function createEnqueueOptions(args) {
|
|
6735
7075
|
return {
|
|
6736
|
-
archive: args.archivePath,
|
|
7076
|
+
archive: parseCLIArchiveTarget(args.archivePath),
|
|
6737
7077
|
...args.boost === void 0 ? {} : { boost: args.boost },
|
|
6738
7078
|
...args.chapterId === void 0 ? {} : { chapterId: args.chapterId },
|
|
6739
7079
|
...args.chapterIds === void 0 ? {} : { chapterIds: args.chapterIds },
|
|
@@ -6750,11 +7090,11 @@ var init_queue = __esm({
|
|
|
6750
7090
|
init_config();
|
|
6751
7091
|
init_context();
|
|
6752
7092
|
init_support();
|
|
7093
|
+
init_archive_target();
|
|
6753
7094
|
init_add();
|
|
6754
7095
|
init_estimate();
|
|
6755
7096
|
init_output();
|
|
6756
7097
|
init_watch();
|
|
6757
|
-
init_node_platform();
|
|
6758
7098
|
init_worker();
|
|
6759
7099
|
}
|
|
6760
7100
|
});
|
|
@@ -11185,7 +11525,7 @@ init_support();
|
|
|
11185
11525
|
import {
|
|
11186
11526
|
parseWikiGraphLibraryUri as parseWikiGraphLibraryUri3
|
|
11187
11527
|
} from "wiki-graph-sdk";
|
|
11188
|
-
var LIBRARY_ARCHIVE_ACTIONS = /* @__PURE__ */ new Set(["get", "remove"]);
|
|
11528
|
+
var LIBRARY_ARCHIVE_ACTIONS = /* @__PURE__ */ new Set(["get", "remove", "replace"]);
|
|
11189
11529
|
var LIBRARY_ARCHIVE_COLLECTION_ACTIONS = /* @__PURE__ */ new Set(["add", "get", "scan"]);
|
|
11190
11530
|
var LIBRARY_ARCHIVE_PATH_ACTIONS = /* @__PURE__ */ new Set(["get", "set"]);
|
|
11191
11531
|
var LIBRARY_ARCHIVE_TREE_ACTIONS = /* @__PURE__ */ new Set(["archive-tree"]);
|
|
@@ -11892,10 +12232,22 @@ function parseLibraryArchiveArguments(uri, target, action, tail, values) {
|
|
|
11892
12232
|
allowConfirm: action === "remove"
|
|
11893
12233
|
});
|
|
11894
12234
|
rejectArchiveFlag(action, "--path", values.path, helpRoute);
|
|
11895
|
-
rejectArchiveFlag(action, "--input", values.input, helpRoute);
|
|
11896
12235
|
rejectArchiveFlag(action, "--json-input", values["json-input"], helpRoute);
|
|
11897
12236
|
rejectArchiveBooleanFlag(action, "--jsonl", values.jsonl, helpRoute);
|
|
11898
12237
|
rejectExtraPositionals(action, tail, 0, helpRoute);
|
|
12238
|
+
if (action === "replace") {
|
|
12239
|
+
if (values.input === void 0) {
|
|
12240
|
+
throw new Error(withHelpRoute("Missing --input <path>.", helpRoute));
|
|
12241
|
+
}
|
|
12242
|
+
rejectArchiveFlag(action, "--to", values.to, helpRoute);
|
|
12243
|
+
rejectArchiveBooleanFlag(action, "--confirm", values.confirm, helpRoute);
|
|
12244
|
+
return {
|
|
12245
|
+
args: { action, inputPath: values.input, json: values.json, target },
|
|
12246
|
+
help: false,
|
|
12247
|
+
kind: "library"
|
|
12248
|
+
};
|
|
12249
|
+
}
|
|
12250
|
+
rejectArchiveFlag(action, "--input", values.input, helpRoute);
|
|
11899
12251
|
if (action === "get") {
|
|
11900
12252
|
rejectArchiveFlag(action, "--to", values.to, helpRoute);
|
|
11901
12253
|
rejectArchiveBooleanFlag(action, "--confirm", values.confirm, helpRoute);
|
|
@@ -11992,6 +12344,7 @@ function parseLibraryScopeArguments(uri, target, action, tail, values) {
|
|
|
11992
12344
|
case "add":
|
|
11993
12345
|
case "create":
|
|
11994
12346
|
case "rebind":
|
|
12347
|
+
case "replace":
|
|
11995
12348
|
case "scan":
|
|
11996
12349
|
throw new Error(
|
|
11997
12350
|
"Internal error: unsupported action routed to library scope."
|
|
@@ -12059,6 +12412,7 @@ function parseLibraryMetadataArguments(uri, target, action, tail, values) {
|
|
|
12059
12412
|
case "create":
|
|
12060
12413
|
case "list":
|
|
12061
12414
|
case "remove":
|
|
12415
|
+
case "replace":
|
|
12062
12416
|
case "add":
|
|
12063
12417
|
case "rebind":
|
|
12064
12418
|
case "clean-index":
|
|
@@ -12103,7 +12457,7 @@ function rejectExtraPositionals(action, positionals, expected, helpRoute) {
|
|
|
12103
12457
|
}
|
|
12104
12458
|
}
|
|
12105
12459
|
function isLibraryAction(action) {
|
|
12106
|
-
return action === "add" || action === "archive-tree" || action === "clear" || action === "clean-index" || action === "create" || action === "delete" || action === "get" || action === "get-index" || action === "list" || action === "put" || action === "rebind" || action === "remove" || action === "scan" || action === "set" || action === "sync-index";
|
|
12460
|
+
return action === "add" || action === "archive-tree" || action === "clear" || action === "clean-index" || action === "create" || action === "delete" || action === "get" || action === "get-index" || action === "list" || action === "put" || action === "rebind" || action === "replace" || action === "remove" || action === "scan" || action === "set" || action === "sync-index";
|
|
12107
12461
|
}
|
|
12108
12462
|
function validateTargetAction(uri, label, actions, action) {
|
|
12109
12463
|
if (!actions.has(action)) {
|
|
@@ -12898,8 +13252,10 @@ var CaptureWritable = class extends Writable2 {
|
|
|
12898
13252
|
}
|
|
12899
13253
|
};
|
|
12900
13254
|
|
|
12901
|
-
// src/
|
|
12902
|
-
|
|
13255
|
+
// src/runtime/node-platform.ts
|
|
13256
|
+
var node_platform_exports = {};
|
|
13257
|
+
__reExport(node_platform_exports, node_platform_star);
|
|
13258
|
+
import * as node_platform_star from "wiki-graph-sdk/node-platform";
|
|
12903
13259
|
export {
|
|
12904
13260
|
createWikiGraphCLI,
|
|
12905
13261
|
runWikiGraphCLI,
|