caveat-cli 0.1.0 → 0.2.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/index.js +30 -36
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -15678,7 +15678,6 @@ function extractSections(body) {
|
|
|
15678
15678
|
|
|
15679
15679
|
// ../../packages/core/dist/env.js
|
|
15680
15680
|
var import_semver = __toESM(require_semver2(), 1);
|
|
15681
|
-
var DEFAULT_PROJECT_ROOTS = [];
|
|
15682
15681
|
function fingerprint() {
|
|
15683
15682
|
return {
|
|
15684
15683
|
os: process.platform,
|
|
@@ -15686,21 +15685,6 @@ function fingerprint() {
|
|
|
15686
15685
|
node: process.versions.node ?? ""
|
|
15687
15686
|
};
|
|
15688
15687
|
}
|
|
15689
|
-
function normalizePath(p2) {
|
|
15690
|
-
return p2.replace(/\\/g, "/").toLowerCase();
|
|
15691
|
-
}
|
|
15692
|
-
function inferSourceProject(cwd, projectRoots = DEFAULT_PROJECT_ROOTS) {
|
|
15693
|
-
const normalized = normalizePath(cwd);
|
|
15694
|
-
for (const root of projectRoots) {
|
|
15695
|
-
const normalizedRoot = normalizePath(root);
|
|
15696
|
-
if (normalized.startsWith(normalizedRoot)) {
|
|
15697
|
-
const rest = normalized.slice(normalizedRoot.length);
|
|
15698
|
-
const first2 = rest.split("/")[0];
|
|
15699
|
-
if (first2) return first2;
|
|
15700
|
-
}
|
|
15701
|
-
}
|
|
15702
|
-
return null;
|
|
15703
|
-
}
|
|
15704
15688
|
|
|
15705
15689
|
// ../../packages/core/dist/indexer.js
|
|
15706
15690
|
import { readFileSync as readFileSync2, readdirSync as readdirSync2, statSync, existsSync as existsSync2 } from "node:fs";
|
|
@@ -15952,7 +15936,6 @@ function recordEntry(input, opts) {
|
|
|
15952
15936
|
...fingerprint(),
|
|
15953
15937
|
...input.environment ?? {}
|
|
15954
15938
|
};
|
|
15955
|
-
const sourceProject = input.cwd ? inferSourceProject(input.cwd, opts.projectRoots) : null;
|
|
15956
15939
|
const frontmatter = {
|
|
15957
15940
|
id,
|
|
15958
15941
|
title: input.title,
|
|
@@ -15961,7 +15944,7 @@ function recordEntry(input, opts) {
|
|
|
15961
15944
|
outcome: input.outcome ?? "resolved",
|
|
15962
15945
|
tags: input.tags ?? [],
|
|
15963
15946
|
environment: mergedEnv,
|
|
15964
|
-
source_project:
|
|
15947
|
+
source_project: null,
|
|
15965
15948
|
source_session: generateSourceSession(now),
|
|
15966
15949
|
created_at: ymd,
|
|
15967
15950
|
updated_at: ymd,
|
|
@@ -16159,7 +16142,6 @@ import { existsSync as existsSync5, readFileSync as readFileSync4, writeFileSync
|
|
|
16159
16142
|
var DEFAULT_CONFIG = {
|
|
16160
16143
|
knowledgeRepo: "own",
|
|
16161
16144
|
semverKeys: ["driver", "cuda", "node"],
|
|
16162
|
-
projectRoots: [],
|
|
16163
16145
|
communitySources: []
|
|
16164
16146
|
};
|
|
16165
16147
|
function loadConfig(userConfigPath) {
|
|
@@ -21269,7 +21251,7 @@ var stdoutLogger = {
|
|
|
21269
21251
|
};
|
|
21270
21252
|
|
|
21271
21253
|
// src/commands/init.ts
|
|
21272
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync4 } from "node:fs";
|
|
21254
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "node:fs";
|
|
21273
21255
|
import { join as join9 } from "node:path";
|
|
21274
21256
|
|
|
21275
21257
|
// src/claudeInstall.ts
|
|
@@ -21421,6 +21403,20 @@ function uninstallClaudeIntegration(opts) {
|
|
|
21421
21403
|
}
|
|
21422
21404
|
|
|
21423
21405
|
// src/commands/init.ts
|
|
21406
|
+
var KNOWLEDGE_GITIGNORE = [
|
|
21407
|
+
"# Never commit entries flagged private (visibility: private is enforced by the",
|
|
21408
|
+
"# pre-commit gate, but this is a filename-level backup guard).",
|
|
21409
|
+
"*.private.md",
|
|
21410
|
+
"",
|
|
21411
|
+
"# Obsidian per-user config: workspace layout, theme, plugin state, cache.",
|
|
21412
|
+
".obsidian/",
|
|
21413
|
+
"",
|
|
21414
|
+
"# community/ is a local cache of shallow-cloned third-party caveat repos",
|
|
21415
|
+
"# (populated by `caveat community add`). Each contains its own .git and is not",
|
|
21416
|
+
"# part of this repo's tracked knowledge.",
|
|
21417
|
+
"community/",
|
|
21418
|
+
""
|
|
21419
|
+
].join("\n");
|
|
21424
21420
|
function runInit(ctx, opts = { skipClaude: false, dryRun: false }) {
|
|
21425
21421
|
ensureUserConfig(ctx.userConfigPath);
|
|
21426
21422
|
ctx.logger.info(`user config: ${ctx.userConfigPath}`);
|
|
@@ -21431,6 +21427,11 @@ function runInit(ctx, opts = { skipClaude: false, dryRun: false }) {
|
|
|
21431
21427
|
} else {
|
|
21432
21428
|
ctx.logger.info(`knowledge repo: ${ctx.paths.knowledgeRepo}`);
|
|
21433
21429
|
}
|
|
21430
|
+
const gitignorePath = join9(ctx.paths.knowledgeRepo, ".gitignore");
|
|
21431
|
+
if (!existsSync8(gitignorePath)) {
|
|
21432
|
+
writeFileSync5(gitignorePath, KNOWLEDGE_GITIGNORE, "utf-8");
|
|
21433
|
+
ctx.logger.info(`.gitignore created: ${gitignorePath}`);
|
|
21434
|
+
}
|
|
21434
21435
|
const db = openDb({ path: ctx.paths.dbPath, logger: ctx.logger });
|
|
21435
21436
|
db.close();
|
|
21436
21437
|
ctx.logger.info(`db initialized: ${ctx.paths.dbPath}`);
|
|
@@ -44336,9 +44337,8 @@ function buildMcpContext(overrides = {}) {
|
|
|
44336
44337
|
const logger = overrides.logger ?? stderrLogger;
|
|
44337
44338
|
const config3 = loadConfig(userConfigPath);
|
|
44338
44339
|
const paths = resolvePaths(caveatHome, config3.knowledgeRepo, userHome);
|
|
44339
|
-
const cwd = overrides.cwd ?? process.cwd();
|
|
44340
44340
|
const db = openDb({ path: paths.dbPath, logger });
|
|
44341
|
-
return { caveatHome, userHome, userConfigPath, config: config3, paths, logger, db
|
|
44341
|
+
return { caveatHome, userHome, userConfigPath, config: config3, paths, logger, db };
|
|
44342
44342
|
}
|
|
44343
44343
|
|
|
44344
44344
|
// ../mcp/dist/tools/search.js
|
|
@@ -44396,14 +44396,10 @@ var recordInputShape = {
|
|
|
44396
44396
|
brief_id: external_exports.string().optional()
|
|
44397
44397
|
};
|
|
44398
44398
|
function handleRecord(ctx, args) {
|
|
44399
|
-
return recordEntry(
|
|
44400
|
-
|
|
44401
|
-
|
|
44402
|
-
|
|
44403
|
-
entriesRoot: ctx.paths.entriesDir,
|
|
44404
|
-
projectRoots: ctx.config.projectRoots
|
|
44405
|
-
}
|
|
44406
|
-
);
|
|
44399
|
+
return recordEntry(args, {
|
|
44400
|
+
db: ctx.db,
|
|
44401
|
+
entriesRoot: ctx.paths.entriesDir
|
|
44402
|
+
});
|
|
44407
44403
|
}
|
|
44408
44404
|
|
|
44409
44405
|
// ../mcp/dist/tools/update.js
|
|
@@ -44477,13 +44473,11 @@ function handleIngestResearch(ctx, args) {
|
|
|
44477
44473
|
outcome: "resolved",
|
|
44478
44474
|
tags: args.tags,
|
|
44479
44475
|
category: args.category,
|
|
44480
|
-
brief_id: args.brief_id
|
|
44481
|
-
cwd: ctx.cwd
|
|
44476
|
+
brief_id: args.brief_id
|
|
44482
44477
|
},
|
|
44483
44478
|
{
|
|
44484
44479
|
db: ctx.db,
|
|
44485
|
-
entriesRoot: ctx.paths.entriesDir
|
|
44486
|
-
projectRoots: ctx.config.projectRoots
|
|
44480
|
+
entriesRoot: ctx.paths.entriesDir
|
|
44487
44481
|
}
|
|
44488
44482
|
);
|
|
44489
44483
|
}
|
|
@@ -44522,7 +44516,7 @@ function registerAllTools(server, ctx) {
|
|
|
44522
44516
|
"caveat_record",
|
|
44523
44517
|
{
|
|
44524
44518
|
title: "caveat_record",
|
|
44525
|
-
description: "Create a new caveat markdown file. Auto-fills source_session
|
|
44519
|
+
description: "Create a new caveat markdown file. Auto-fills source_session and environment fingerprint for unspecified keys. source_project is left null by design (publicly-shared knowledge should not leak per-user project names).",
|
|
44526
44520
|
inputSchema: recordInputShape
|
|
44527
44521
|
},
|
|
44528
44522
|
async (args) => jsonResult(handleRecord(ctx, args))
|
|
@@ -44706,7 +44700,7 @@ function runCommunityList(ctx) {
|
|
|
44706
44700
|
|
|
44707
44701
|
// src/index.ts
|
|
44708
44702
|
var program = new Command();
|
|
44709
|
-
program.name("caveat").description("External spec gotcha knowledge base CLI").version("0.
|
|
44703
|
+
program.name("caveat").description("External spec gotcha knowledge base CLI").version("0.2.1");
|
|
44710
44704
|
program.command("init").description(
|
|
44711
44705
|
"Initialize ~/.caveatrc.json, ~/.caveat/, and register Claude Code integration"
|
|
44712
44706
|
).option("--skip-claude", "skip Claude Code MCP + hook registration", false).option("--dry-run", "show planned changes without writing", false).action((opts) => {
|