@saasontools/strauss-kb 0.1.18 → 0.1.19
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/{chunk-IOIUS26S.js → chunk-CQBLH7CE.js} +2 -2
- package/dist/{chunk-GSOTMWZZ.js → chunk-MNQNHYWL.js} +150 -51
- package/dist/chunk-MNQNHYWL.js.map +1 -0
- package/dist/{chunk-ROGVYSMV.js → chunk-ZWSCLHG6.js} +2 -2
- package/dist/cli-main.cjs +148 -50
- package/dist/cli-main.cjs.map +1 -1
- package/dist/cli-main.js +2 -2
- package/dist/index.cjs +150 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -6
- package/dist/index.d.ts +41 -6
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp-main.cjs +148 -50
- package/dist/mcp-main.cjs.map +1 -1
- package/dist/mcp-main.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-GSOTMWZZ.js.map +0 -1
- /package/dist/{chunk-IOIUS26S.js.map → chunk-CQBLH7CE.js.map} +0 -0
- /package/dist/{chunk-ROGVYSMV.js.map → chunk-ZWSCLHG6.js.map} +0 -0
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
KB_DIR,
|
|
5
5
|
KbStore,
|
|
6
6
|
VERSION
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MNQNHYWL.js";
|
|
8
8
|
|
|
9
9
|
// src/cli.ts
|
|
10
10
|
import { join } from "path";
|
|
@@ -121,4 +121,4 @@ function usage() {
|
|
|
121
121
|
export {
|
|
122
122
|
runKbCli
|
|
123
123
|
};
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# sourceMappingURL=chunk-CQBLH7CE.js.map
|
|
@@ -2166,14 +2166,17 @@ function asBudgets(value) {
|
|
|
2166
2166
|
if (value === null || typeof value !== "object") return {};
|
|
2167
2167
|
const table2 = value;
|
|
2168
2168
|
const pick = (key, min) => {
|
|
2169
|
-
const
|
|
2170
|
-
return typeof
|
|
2169
|
+
const raw2 = table2[key];
|
|
2170
|
+
return typeof raw2 === "number" && Number.isInteger(raw2) && raw2 >= min ? raw2 : void 0;
|
|
2171
2171
|
};
|
|
2172
2172
|
const budgetTokens = pick("budgetTokens", 1);
|
|
2173
2173
|
const fullUnderTokens = pick("fullUnderTokens", 0);
|
|
2174
|
+
const raw = table2["excludeTags"];
|
|
2175
|
+
const excludeTags = Array.isArray(raw) ? raw.filter((tag) => typeof tag === "string" && tag !== "") : void 0;
|
|
2174
2176
|
return {
|
|
2175
2177
|
...budgetTokens ? { budgetTokens } : {},
|
|
2176
|
-
...fullUnderTokens !== void 0 ? { fullUnderTokens } : {}
|
|
2178
|
+
...fullUnderTokens !== void 0 ? { fullUnderTokens } : {},
|
|
2179
|
+
...excludeTags ? { excludeTags } : {}
|
|
2177
2180
|
};
|
|
2178
2181
|
}
|
|
2179
2182
|
function contextProfileBudgets(manifest, profile) {
|
|
@@ -2570,6 +2573,13 @@ function successors(record, byId) {
|
|
|
2570
2573
|
return { records, missing: missing2 };
|
|
2571
2574
|
}
|
|
2572
2575
|
|
|
2576
|
+
// src/kb-tags.ts
|
|
2577
|
+
function matchesTags(record, filter) {
|
|
2578
|
+
if (!filter.tags?.length && !filter.excludeTags?.length) return true;
|
|
2579
|
+
const carried = new Set(record.frontmatter.tags ?? []);
|
|
2580
|
+
return (filter.tags ?? []).every((tag) => carried.has(tag)) && !(filter.excludeTags ?? []).some((tag) => carried.has(tag));
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2573
2583
|
// src/catalog.ts
|
|
2574
2584
|
var EMPTY_STANDINGS = {
|
|
2575
2585
|
current: 0,
|
|
@@ -2580,7 +2590,7 @@ var EMPTY_STANDINGS = {
|
|
|
2580
2590
|
};
|
|
2581
2591
|
function catalog(bundle, options = {}) {
|
|
2582
2592
|
const wanted = options.type ? bundle.filter((record) => record.frontmatter.type === options.type) : bundle;
|
|
2583
|
-
const entries = adjudicate(wanted, bundle, options.now ?? /* @__PURE__ */ new Date()).map((hit) => ({
|
|
2593
|
+
const entries = adjudicate(wanted, bundle, options.now ?? /* @__PURE__ */ new Date()).filter((hit) => matchesTags(hit.record, options)).map((hit) => ({
|
|
2584
2594
|
conceptId: hit.record.conceptId,
|
|
2585
2595
|
type: hit.record.frontmatter.type,
|
|
2586
2596
|
title: hit.record.frontmatter.title ?? null,
|
|
@@ -2670,7 +2680,7 @@ function preamble() {
|
|
|
2670
2680
|
"tokens."
|
|
2671
2681
|
].join("\n");
|
|
2672
2682
|
}
|
|
2673
|
-
async function renderBase(store, path, absolutePath, fullUnderTokens, pinMode, budgetTokens) {
|
|
2683
|
+
async function renderBase(store, path, absolutePath, fullUnderTokens, pinMode, budgetTokens, excludeTags) {
|
|
2674
2684
|
const bundle = await store.list(absolutePath);
|
|
2675
2685
|
if (bundle.length === 0) {
|
|
2676
2686
|
return {
|
|
@@ -2684,7 +2694,8 @@ async function renderBase(store, path, absolutePath, fullUnderTokens, pinMode, b
|
|
|
2684
2694
|
let degradedFrom;
|
|
2685
2695
|
if (fullCap > 0) {
|
|
2686
2696
|
const full = await store.load(absolutePath, {
|
|
2687
|
-
budgetTokens: fullCap
|
|
2697
|
+
budgetTokens: fullCap,
|
|
2698
|
+
excludeTags
|
|
2688
2699
|
});
|
|
2689
2700
|
if (!full.loaded && pinMode === "full") {
|
|
2690
2701
|
degradedFrom = { approxTokens: full.approxTokens };
|
|
@@ -2714,7 +2725,9 @@ async function renderBase(store, path, absolutePath, fullUnderTokens, pinMode, b
|
|
|
2714
2725
|
};
|
|
2715
2726
|
}
|
|
2716
2727
|
}
|
|
2717
|
-
const adjudicated = adjudicate(bundle, bundle)
|
|
2728
|
+
const adjudicated = adjudicate(bundle, bundle).filter(
|
|
2729
|
+
(hit) => matchesTags(hit.record, { excludeTags })
|
|
2730
|
+
);
|
|
2718
2731
|
const lines = adjudicated.filter((hit) => hit.standing !== "superseded").map((hit) => renderIndexLine(hit.record));
|
|
2719
2732
|
const superseded = adjudicated.filter((hit) => hit.standing === "superseded").map(
|
|
2720
2733
|
(hit) => `- \`${hit.record.conceptId}\` \u2192 superseded by ${hit.heads.map((head) => `\`${head.conceptId}\``).join(", ") || "(missing replacement)"}`
|
|
@@ -2735,6 +2748,7 @@ async function buildContext(store, workspaceDir, options = {}) {
|
|
|
2735
2748
|
const fromManifest = mergedContextBudgets(merged, options.profile);
|
|
2736
2749
|
budgetTokens = options.budgetTokens ?? fromManifest.budgetTokens ?? builtin.budgetTokens ?? DEFAULT_CONTEXT_BUDGET;
|
|
2737
2750
|
fullUnderTokens = options.fullUnderTokens ?? fromManifest.fullUnderTokens ?? builtin.fullUnderTokens ?? 0;
|
|
2751
|
+
const excludeTags = options.excludeTags ?? fromManifest.excludeTags ?? builtin.excludeTags ?? [];
|
|
2738
2752
|
const pins = merged.pins.filter(
|
|
2739
2753
|
(pin) => !pin.profiles?.length || !options.profile || pin.profiles.includes(options.profile)
|
|
2740
2754
|
);
|
|
@@ -2755,7 +2769,8 @@ async function buildContext(store, workspaceDir, options = {}) {
|
|
|
2755
2769
|
pin.absolutePath,
|
|
2756
2770
|
fullUnderTokens,
|
|
2757
2771
|
pin.mode,
|
|
2758
|
-
budgetTokens
|
|
2772
|
+
budgetTokens,
|
|
2773
|
+
excludeTags
|
|
2759
2774
|
),
|
|
2760
2775
|
frozen: pin.frozen === true
|
|
2761
2776
|
}))
|
|
@@ -3881,6 +3896,9 @@ import { z as z9 } from "zod";
|
|
|
3881
3896
|
import { z as z8 } from "zod";
|
|
3882
3897
|
var bundlePath = z8.string().min(1).describe("Absolute path to the knowledge base directory.");
|
|
3883
3898
|
var conceptId = z8.string().min(1).describe("e.g. decision.cursor-v2");
|
|
3899
|
+
var TAGS = z8.array(z8.string().min(1)).optional().describe(
|
|
3900
|
+
"Keep only records carrying every one of these frontmatter tags. Matched exactly."
|
|
3901
|
+
);
|
|
3884
3902
|
var REPO_ROOT = z8.string().min(1).optional().describe(
|
|
3885
3903
|
"Where the anchored source lives, for the drift check. Defaults to the working directory."
|
|
3886
3904
|
);
|
|
@@ -3902,6 +3920,41 @@ function argvFlag(argv, name) {
|
|
|
3902
3920
|
}
|
|
3903
3921
|
return value;
|
|
3904
3922
|
}
|
|
3923
|
+
function argvFlags(argv, name) {
|
|
3924
|
+
const values = [];
|
|
3925
|
+
for (const [at2, arg] of argv.entries()) {
|
|
3926
|
+
if (arg.startsWith(`${name}=`)) {
|
|
3927
|
+
const value = arg.slice(name.length + 1);
|
|
3928
|
+
if (!value) throw new KbMissingFlagValueError(name);
|
|
3929
|
+
values.push(value);
|
|
3930
|
+
} else if (arg === name) {
|
|
3931
|
+
const value = argv[at2 + 1];
|
|
3932
|
+
if (value === void 0 || value.startsWith("--")) {
|
|
3933
|
+
throw new KbMissingFlagValueError(name);
|
|
3934
|
+
}
|
|
3935
|
+
values.push(value);
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3938
|
+
return values;
|
|
3939
|
+
}
|
|
3940
|
+
function argvWithout(argv, ...names) {
|
|
3941
|
+
const kept = [];
|
|
3942
|
+
for (let at2 = 0; at2 < argv.length; at2 += 1) {
|
|
3943
|
+
const arg = argv[at2];
|
|
3944
|
+
if (names.some((name) => arg.startsWith(`${name}=`))) continue;
|
|
3945
|
+
if (names.includes(arg)) {
|
|
3946
|
+
at2 += 1;
|
|
3947
|
+
continue;
|
|
3948
|
+
}
|
|
3949
|
+
kept.push(arg);
|
|
3950
|
+
}
|
|
3951
|
+
return kept;
|
|
3952
|
+
}
|
|
3953
|
+
function argvPositional(argv, ...names) {
|
|
3954
|
+
return argvWithout(argv.slice(1), ...names).find(
|
|
3955
|
+
(arg) => !arg.startsWith("--")
|
|
3956
|
+
);
|
|
3957
|
+
}
|
|
3905
3958
|
|
|
3906
3959
|
// src/commands/anchor-resolve.ts
|
|
3907
3960
|
function resolverSummary(results) {
|
|
@@ -4218,25 +4271,39 @@ import { z as z12 } from "zod";
|
|
|
4218
4271
|
var catalogCommand = define({
|
|
4219
4272
|
name: "catalog",
|
|
4220
4273
|
tool: "kb_catalog",
|
|
4221
|
-
usage: "catalog [type]",
|
|
4274
|
+
usage: "catalog [type] [--tag T]...",
|
|
4222
4275
|
description: "Lists every record as one line \u2014 concept id, type, title, standing, and a stale flag \u2014 at roughly thirty tokens each. Pick this over kb_load once kb_load refuses: kb_catalog never refuses. Superseded records show only their replacement; fetch bodies with kb_load, kb_pack, kb_query, or kb_trace.",
|
|
4223
4276
|
input: z12.object({
|
|
4224
4277
|
bundlePath,
|
|
4225
|
-
type: z12.enum(KB_RECORD_TYPES).optional()
|
|
4226
|
-
|
|
4227
|
-
fromArgv: (argv, path) => ({
|
|
4228
|
-
bundlePath: path,
|
|
4229
|
-
...argv[1] && !argv[1].startsWith("--") ? { type: argv[1] } : {}
|
|
4278
|
+
type: z12.enum(KB_RECORD_TYPES).optional(),
|
|
4279
|
+
tags: TAGS
|
|
4230
4280
|
}),
|
|
4231
|
-
|
|
4232
|
-
|
|
4281
|
+
fromArgv: (argv, path) => {
|
|
4282
|
+
const tags = argvFlags(argv, "--tag");
|
|
4283
|
+
const type = argvPositional(argv, "--tag");
|
|
4284
|
+
return {
|
|
4285
|
+
bundlePath: path,
|
|
4286
|
+
...type ? { type } : {},
|
|
4287
|
+
...tags.length ? { tags } : {}
|
|
4288
|
+
};
|
|
4289
|
+
},
|
|
4290
|
+
run: async ({ store }, { bundlePath: path, type, tags }) => render(
|
|
4291
|
+
await store.catalog(path, {
|
|
4292
|
+
...type ? { type } : {},
|
|
4293
|
+
...tags ? { tags } : {}
|
|
4294
|
+
}),
|
|
4233
4295
|
path,
|
|
4234
|
-
type
|
|
4296
|
+
type,
|
|
4297
|
+
tags
|
|
4235
4298
|
)
|
|
4236
4299
|
});
|
|
4237
|
-
function render(result, bundle, type) {
|
|
4300
|
+
function render(result, bundle, type, tags) {
|
|
4301
|
+
const narrowed = [
|
|
4302
|
+
...type ? [type] : [],
|
|
4303
|
+
...tags?.length ? [`tags: ${tags.join(", ")}`] : []
|
|
4304
|
+
].join(" \xB7 ");
|
|
4238
4305
|
const lines = [
|
|
4239
|
-
`# KB Catalog${
|
|
4306
|
+
`# KB Catalog${narrowed ? ` \u2014 ${narrowed}` : ""}`,
|
|
4240
4307
|
`bundle: ${bundle}`,
|
|
4241
4308
|
`${count(result.recordCount, "record")}: ${standingCounts(result)}`
|
|
4242
4309
|
];
|
|
@@ -4248,7 +4315,7 @@ function render(result, bundle, type) {
|
|
|
4248
4315
|
lines.push("");
|
|
4249
4316
|
if (!result.entries.length) {
|
|
4250
4317
|
lines.push(
|
|
4251
|
-
|
|
4318
|
+
narrowed ? `(no records matching ${narrowed})` : "(no records \u2014 this base is empty)"
|
|
4252
4319
|
);
|
|
4253
4320
|
} else {
|
|
4254
4321
|
for (const entry of result.entries) lines.push(renderCatalogLine(entry));
|
|
@@ -4281,7 +4348,7 @@ import { z as z13 } from "zod";
|
|
|
4281
4348
|
var contextCommand = define({
|
|
4282
4349
|
name: "context",
|
|
4283
4350
|
tool: "kb_context",
|
|
4284
|
-
usage: "context [--profile NAME] [--budget N] [--full-under N] [--format json] [--event NAME]",
|
|
4351
|
+
usage: "context [--profile NAME] [--budget N] [--full-under N] [--exclude-tag T]... [--format json] [--event NAME]",
|
|
4285
4352
|
description: "Index block of pinned bases (ids, titles, standing) for injection at context birth. Takes no bundlePath \u2014 reads the workspace pin manifests. Empty when nothing is pinned; refuses over budget rather than truncating. Budget precedence: flags, then the manifest `context[profile]` over `context.default`, then the built-in profile, then package defaults.",
|
|
4286
4353
|
input: z13.object({
|
|
4287
4354
|
budgetTokens: z13.number().int().positive().optional().describe(
|
|
@@ -4293,6 +4360,9 @@ var contextCommand = define({
|
|
|
4293
4360
|
profile: z13.string().optional().describe(
|
|
4294
4361
|
"Named budget set: built-ins are session-start (full-under 1500), compact and turn (budget 2500); the manifests' `context` tables override per repo. Unknown names fall through to defaults rather than failing."
|
|
4295
4362
|
),
|
|
4363
|
+
excludeTags: z13.array(z13.string().min(1)).optional().describe(
|
|
4364
|
+
"Frontmatter tags whose records stay out of the block. The base stays pinned and stays readable by tool; resolved like the budgets."
|
|
4365
|
+
),
|
|
4296
4366
|
format: z13.enum(["markdown", "json"]).optional().describe(
|
|
4297
4367
|
"CLI envelope for hook protocols that require strict JSON on stdout. MCP callers omit this \u2014 the block itself is identical."
|
|
4298
4368
|
),
|
|
@@ -4306,19 +4376,22 @@ var contextCommand = define({
|
|
|
4306
4376
|
const profile = argvFlag(argv, "--profile");
|
|
4307
4377
|
const format = argvFlag(argv, "--format");
|
|
4308
4378
|
const event = argvFlag(argv, "--event");
|
|
4379
|
+
const excludeTags = argvFlags(argv, "--exclude-tag");
|
|
4309
4380
|
return {
|
|
4310
4381
|
...budget ? { budgetTokens: Number(budget) } : {},
|
|
4311
4382
|
...fullUnder ? { fullUnderTokens: Number(fullUnder) } : {},
|
|
4312
4383
|
...profile ? { profile } : {},
|
|
4384
|
+
...excludeTags.length ? { excludeTags } : {},
|
|
4313
4385
|
...format ? { format } : {},
|
|
4314
4386
|
...event ? { event } : {}
|
|
4315
4387
|
};
|
|
4316
4388
|
},
|
|
4317
|
-
run: async ({ store }, { budgetTokens, fullUnderTokens, profile, format, event }) => {
|
|
4389
|
+
run: async ({ store }, { budgetTokens, fullUnderTokens, profile, excludeTags, format, event }) => {
|
|
4318
4390
|
const result = await buildContext(store, process.cwd(), {
|
|
4319
4391
|
...budgetTokens ? { budgetTokens } : {},
|
|
4320
4392
|
...fullUnderTokens ? { fullUnderTokens } : {},
|
|
4321
4393
|
...profile ? { profile } : {},
|
|
4394
|
+
...excludeTags ? { excludeTags } : {},
|
|
4322
4395
|
// Degradations — a full pin that could not fit, a refused block — go
|
|
4323
4396
|
// to stderr as well as into the block itself: stderr is diagnostics on
|
|
4324
4397
|
// both surfaces (hooks discard it, MCP logs it), so an operator can
|
|
@@ -4720,17 +4793,31 @@ import { z as z17 } from "zod";
|
|
|
4720
4793
|
var listCommand = define({
|
|
4721
4794
|
name: "list",
|
|
4722
4795
|
tool: "kb_list",
|
|
4723
|
-
usage: "list [type]",
|
|
4724
|
-
description: "Every record, optionally one type. For enumerating; use kb_query for a question.",
|
|
4725
|
-
input: z17.object({
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4796
|
+
usage: "list [type] [--tag T]...",
|
|
4797
|
+
description: "Every record, optionally one type or tag. For enumerating; use kb_query for a question.",
|
|
4798
|
+
input: z17.object({
|
|
4799
|
+
bundlePath,
|
|
4800
|
+
type: z17.enum(KB_RECORD_TYPES).optional(),
|
|
4801
|
+
tags: TAGS
|
|
4802
|
+
}),
|
|
4803
|
+
fromArgv: (argv, path) => {
|
|
4804
|
+
const tags = argvFlags(argv, "--tag");
|
|
4805
|
+
const type = argvPositional(argv, "--tag");
|
|
4806
|
+
return {
|
|
4807
|
+
bundlePath: path,
|
|
4808
|
+
...type ? { type } : {},
|
|
4809
|
+
...tags.length ? { tags } : {}
|
|
4810
|
+
};
|
|
4811
|
+
},
|
|
4812
|
+
run: async ({ store }, { bundlePath: path, type, tags }) => (await store.list(path, type, { ...tags ? { tags } : {} })).map(
|
|
4813
|
+
(record) => ({
|
|
4814
|
+
conceptId: record.conceptId,
|
|
4815
|
+
title: record.frontmatter.title ?? null,
|
|
4816
|
+
description: record.frontmatter.description ?? null,
|
|
4817
|
+
status: record.frontmatter.strauss_status,
|
|
4818
|
+
anchors: record.frontmatter.strauss_anchors ?? []
|
|
4819
|
+
})
|
|
4820
|
+
)
|
|
4734
4821
|
});
|
|
4735
4822
|
|
|
4736
4823
|
// src/commands/load.ts
|
|
@@ -4981,31 +5068,33 @@ import { z as z24 } from "zod";
|
|
|
4981
5068
|
var queryCommand = define({
|
|
4982
5069
|
name: "query",
|
|
4983
5070
|
tool: "kb_query",
|
|
4984
|
-
usage: "query <text...> [--repo-root PATH]",
|
|
5071
|
+
usage: "query <text...> [--tag T]... [--repo-root PATH]",
|
|
4985
5072
|
description: "Search; every hit carries its standing. Flagged, never filtered: a superseded hit returns with its replacement, a rejected one is marked. Prefer kb_load when the base fits its budget \u2014 a full read beats search. Results are volatile: place them at the tail, not the cached prefix. Never read record files directly.",
|
|
4986
5073
|
input: z24.object({
|
|
4987
5074
|
bundlePath,
|
|
4988
5075
|
text: z24.string().optional(),
|
|
4989
5076
|
type: z24.enum(KB_RECORD_TYPES).optional(),
|
|
4990
5077
|
includeNonCurrent: z24.boolean().optional(),
|
|
5078
|
+
tags: TAGS,
|
|
4991
5079
|
repoRoot: REPO_ROOT
|
|
4992
5080
|
}),
|
|
4993
|
-
//
|
|
5081
|
+
// Both are flags, so neither's value may fall into the search text.
|
|
4994
5082
|
fromArgv: (argv, path) => {
|
|
4995
5083
|
const repoRoot = argvFlag(argv, "--repo-root");
|
|
4996
|
-
const
|
|
4997
|
-
const
|
|
4998
|
-
if (flag !== -1) words.splice(flag, 2);
|
|
5084
|
+
const tags = argvFlags(argv, "--tag");
|
|
5085
|
+
const words = argvWithout(argv.slice(1), "--repo-root", "--tag");
|
|
4999
5086
|
return {
|
|
5000
5087
|
bundlePath: path,
|
|
5001
5088
|
text: words.join(" ").trim(),
|
|
5002
5089
|
includeNonCurrent: true,
|
|
5090
|
+
...tags.length ? { tags } : {},
|
|
5003
5091
|
...repoRoot !== void 0 ? { repoRoot } : {}
|
|
5004
5092
|
};
|
|
5005
5093
|
},
|
|
5006
|
-
run: async ({ store }, { bundlePath: path, text, type, includeNonCurrent, repoRoot }) => (await store.query(path, text ?? "", {
|
|
5094
|
+
run: async ({ store }, { bundlePath: path, text, type, includeNonCurrent, tags, repoRoot }) => (await store.query(path, text ?? "", {
|
|
5007
5095
|
...type ? { type } : {},
|
|
5008
5096
|
includeNonCurrent: includeNonCurrent === true,
|
|
5097
|
+
...tags ? { tags } : {},
|
|
5009
5098
|
...repoRoot !== void 0 ? { repoRoot } : {}
|
|
5010
5099
|
})).map((hit) => ({
|
|
5011
5100
|
conceptId: hit.record.conceptId,
|
|
@@ -5811,13 +5900,16 @@ var KbStore = class {
|
|
|
5811
5900
|
return this.parse(conceptId2, raw);
|
|
5812
5901
|
}
|
|
5813
5902
|
/**
|
|
5814
|
-
* Every record in the bundle, optionally narrowed to one type
|
|
5903
|
+
* Every record in the bundle, optionally narrowed to one type and to the
|
|
5904
|
+
* records carrying every tag in `filter.tags`. Selection only — `excludeTags`
|
|
5905
|
+
* is not taken here, because `query`, `catalog` and `load` read through this
|
|
5906
|
+
* and must adjudicate over the whole base.
|
|
5815
5907
|
*
|
|
5816
5908
|
* A file that fails to parse is skipped and logged rather than thrown: one
|
|
5817
5909
|
* malformed record — hand-edited, or written by a producer we don't know —
|
|
5818
5910
|
* must not make the whole bundle unreadable.
|
|
5819
5911
|
*/
|
|
5820
|
-
async list(bundlePath2, type) {
|
|
5912
|
+
async list(bundlePath2, type, filter = {}) {
|
|
5821
5913
|
const root = this.root(bundlePath2);
|
|
5822
5914
|
let names;
|
|
5823
5915
|
try {
|
|
@@ -5831,7 +5923,9 @@ var KbStore = class {
|
|
|
5831
5923
|
DEFAULT_IO_CONCURRENCY,
|
|
5832
5924
|
async ({ name, conceptId: conceptId2 }) => this.parse(conceptId2, await readFile7(join7(root, name), "utf8"))
|
|
5833
5925
|
);
|
|
5834
|
-
return records.filter(
|
|
5926
|
+
return records.filter(
|
|
5927
|
+
(record) => record !== null && matchesTags(record, filter)
|
|
5928
|
+
);
|
|
5835
5929
|
}
|
|
5836
5930
|
/**
|
|
5837
5931
|
* Moves a record's status, preserving everything else.
|
|
@@ -5971,9 +6065,10 @@ ${answer}
|
|
|
5971
6065
|
/* @__PURE__ */ new Date(),
|
|
5972
6066
|
await this.detectDrift(narrowed, options.repoRoot)
|
|
5973
6067
|
);
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
6068
|
+
const kept = adjudicated.filter((hit) => matchesTags(hit.record, options));
|
|
6069
|
+
if (options.includeNonCurrent) return kept;
|
|
6070
|
+
const present = new Set(kept.map((hit) => hit.record.conceptId));
|
|
6071
|
+
return kept.filter(
|
|
5977
6072
|
(hit) => hit.standing !== "superseded" || !hit.heads.some((head) => present.has(head.conceptId))
|
|
5978
6073
|
);
|
|
5979
6074
|
}
|
|
@@ -6076,14 +6171,17 @@ ${answer}
|
|
|
6076
6171
|
/* @__PURE__ */ new Date(),
|
|
6077
6172
|
await this.detectDrift(wanted, options.repoRoot)
|
|
6078
6173
|
);
|
|
6079
|
-
const
|
|
6080
|
-
|
|
6174
|
+
const kept = adjudicated.filter(
|
|
6175
|
+
(hit) => matchesTags(hit.record, { excludeTags: options.excludeTags })
|
|
6176
|
+
);
|
|
6177
|
+
const records = kept.filter((hit) => hit.standing !== "superseded");
|
|
6178
|
+
const superseded = kept.filter((hit) => hit.standing === "superseded").map(stub);
|
|
6081
6179
|
const approxTokens2 = records.reduce((total, hit) => total + estimateTokens(hit.record), 0) + superseded.reduce((total, entry) => total + estimateStubTokens(entry), 0);
|
|
6082
6180
|
const bundleDigestValue = bundleDigest(records, superseded);
|
|
6083
6181
|
if (!options.all && approxTokens2 > budgetTokens) {
|
|
6084
6182
|
return {
|
|
6085
6183
|
loaded: false,
|
|
6086
|
-
recordCount:
|
|
6184
|
+
recordCount: kept.length,
|
|
6087
6185
|
approxTokens: approxTokens2,
|
|
6088
6186
|
budgetTokens,
|
|
6089
6187
|
message: refusalMessage({
|
|
@@ -6096,7 +6194,7 @@ ${answer}
|
|
|
6096
6194
|
}
|
|
6097
6195
|
return {
|
|
6098
6196
|
loaded: true,
|
|
6099
|
-
recordCount:
|
|
6197
|
+
recordCount: kept.length,
|
|
6100
6198
|
tokensLoaded: approxTokens2,
|
|
6101
6199
|
budgetTokens: options.all ? null : budgetTokens,
|
|
6102
6200
|
records,
|
|
@@ -6541,7 +6639,7 @@ function typeRank(record) {
|
|
|
6541
6639
|
}
|
|
6542
6640
|
|
|
6543
6641
|
// src/version.ts
|
|
6544
|
-
var VERSION = true ? "0.1.
|
|
6642
|
+
var VERSION = true ? "0.1.19" : "0.0.0-dev";
|
|
6545
6643
|
|
|
6546
6644
|
export {
|
|
6547
6645
|
kbSourceSchema,
|
|
@@ -6618,6 +6716,7 @@ export {
|
|
|
6618
6716
|
unpinBase,
|
|
6619
6717
|
adjudicate,
|
|
6620
6718
|
resolveHeads,
|
|
6719
|
+
matchesTags,
|
|
6621
6720
|
catalog,
|
|
6622
6721
|
renderCatalogLine,
|
|
6623
6722
|
INDEX_FILE,
|
|
@@ -6670,4 +6769,4 @@ export {
|
|
|
6670
6769
|
KbStore,
|
|
6671
6770
|
VERSION
|
|
6672
6771
|
};
|
|
6673
|
-
//# sourceMappingURL=chunk-
|
|
6772
|
+
//# sourceMappingURL=chunk-MNQNHYWL.js.map
|