caveat-cli 0.18.0 → 0.19.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.
@@ -5122,10 +5122,10 @@ var require_truncate = __commonJS({
5122
5122
  "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/truncate.js"(exports2, module2) {
5123
5123
  "use strict";
5124
5124
  var parse2 = require_parse2();
5125
- var constants2 = require_constants();
5125
+ var constants = require_constants();
5126
5126
  var SemVer = require_semver();
5127
5127
  var truncate2 = (version, truncation, options2) => {
5128
- if (!constants2.RELEASE_TYPES.includes(truncation)) {
5128
+ if (!constants.RELEASE_TYPES.includes(truncation)) {
5129
5129
  return null;
5130
5130
  }
5131
5131
  const clonedVersion = cloneInputVersion(version, options2);
@@ -6174,7 +6174,7 @@ var require_semver2 = __commonJS({
6174
6174
  "../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/index.js"(exports2, module2) {
6175
6175
  "use strict";
6176
6176
  var internalRe = require_re();
6177
- var constants2 = require_constants();
6177
+ var constants = require_constants();
6178
6178
  var SemVer = require_semver();
6179
6179
  var identifiers = require_identifiers();
6180
6180
  var parse2 = require_parse2();
@@ -6258,8 +6258,8 @@ var require_semver2 = __commonJS({
6258
6258
  re: internalRe.re,
6259
6259
  src: internalRe.src,
6260
6260
  tokens: internalRe.t,
6261
- SEMVER_SPEC_VERSION: constants2.SEMVER_SPEC_VERSION,
6262
- RELEASE_TYPES: constants2.RELEASE_TYPES,
6261
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
6262
+ RELEASE_TYPES: constants.RELEASE_TYPES,
6263
6263
  compareIdentifiers: identifiers.compareIdentifiers,
6264
6264
  rcompareIdentifiers: identifiers.rcompareIdentifiers
6265
6265
  };
@@ -9648,6 +9648,26 @@ function withSourceSavepoint(db, fn) {
9648
9648
  }
9649
9649
  }
9650
9650
 
9651
+ // ../../packages/core/dist/platform.js
9652
+ function isWindows(platform = process.platform) {
9653
+ return platform === "win32";
9654
+ }
9655
+ function isWindowsEnv(env, platform = process.platform) {
9656
+ return env.OS === "Windows_NT" || isWindows(platform);
9657
+ }
9658
+ function isPrivateOwnerStat(stat, uid, platform = process.platform) {
9659
+ return isWindows(platform) || (stat.mode & 63) === 0 && (uid === void 0 || stat.uid === uid);
9660
+ }
9661
+ function powershellCallPrefix(platform = process.platform) {
9662
+ return isWindows(platform) ? "& " : "";
9663
+ }
9664
+ function nodeExecutableNames(platform = process.platform) {
9665
+ return isWindows(platform) ? ["node.exe", "node.cmd", "node.bat", "node"] : ["node"];
9666
+ }
9667
+ function normalizePathCase(normalizedPath, platform = process.platform) {
9668
+ return isWindows(platform) ? normalizedPath.toLowerCase() : normalizedPath;
9669
+ }
9670
+
9651
9671
  // ../../packages/core/dist/community.js
9652
9672
  import { existsSync as existsSync5, readdirSync as readdirSync5, rmSync, statSync as statSync4 } from "node:fs";
9653
9673
  import { join as join5 } from "node:path";
@@ -14638,6 +14658,8 @@ function createGit(baseDir, opts) {
14638
14658
  // Git unwind its own helper first; it is not a general process-tree or
14639
14659
  // total elapsed-time guarantee.
14640
14660
  config: [
14661
+ // Windowsの長いentryパスを扱う。ユーザーのGit設定は変更しない。
14662
+ ...isWindows() ? ["core.longpaths=true"] : [],
14641
14663
  "http.lowSpeedLimit=1",
14642
14664
  `http.lowSpeedTime=${lowSpeedTimeSeconds}`
14643
14665
  ],
@@ -15233,28 +15255,8 @@ function createKeyserverKeyProvider(opts) {
15233
15255
  };
15234
15256
  }
15235
15257
 
15236
- // ../../packages/core/dist/platform.js
15237
- function isWindows(platform = process.platform) {
15238
- return platform === "win32";
15239
- }
15240
- function isWindowsEnv(env, platform = process.platform) {
15241
- return env.OS === "Windows_NT" || isWindows(platform);
15242
- }
15243
- function isPrivateOwnerStat(stat, uid, platform = process.platform) {
15244
- return isWindows(platform) || (stat.mode & 63) === 0 && (uid === void 0 || stat.uid === uid);
15245
- }
15246
- function powershellCallPrefix(platform = process.platform) {
15247
- return isWindows(platform) ? "& " : "";
15248
- }
15249
- function nodeExecutableNames(platform = process.platform) {
15250
- return isWindows(platform) ? ["node.exe", "node.cmd", "node.bat", "node"] : ["node"];
15251
- }
15252
- function normalizePathCase(normalizedPath, platform = process.platform) {
15253
- return isWindows(platform) ? normalizedPath.toLowerCase() : normalizedPath;
15254
- }
15255
-
15256
15258
  // ../../packages/core/dist/sync.js
15257
- import { existsSync as existsSync8, mkdirSync as mkdirSync5, readdirSync as readdirSync7, realpathSync, rmSync as rmSync4, writeFileSync as writeFileSync4 } from "node:fs";
15259
+ import { existsSync as existsSync8, mkdirSync as mkdirSync5, readFileSync as readFileSync7, readdirSync as readdirSync7, realpathSync, rmSync as rmSync4, writeFileSync as writeFileSync4 } from "node:fs";
15258
15260
  import { dirname as dirname4, join as join8, resolve } from "node:path";
15259
15261
 
15260
15262
  // ../../packages/core/dist/remoteVisibility.js
@@ -15462,6 +15464,12 @@ function scaffold(ownDir) {
15462
15464
  const gitignore = join8(ownDir, ".gitignore");
15463
15465
  if (!existsSync8(gitignore)) writeFileSync4(gitignore, KNOWLEDGE_GITIGNORE, "utf-8");
15464
15466
  }
15467
+ function removeCanonicalScaffoldBeforeCheckout(ownDir) {
15468
+ const gitignore = join8(ownDir, ".gitignore");
15469
+ if (existsSync8(gitignore) && readFileSync7(gitignore, "utf-8") === KNOWLEDGE_GITIGNORE) {
15470
+ rmSync4(gitignore);
15471
+ }
15472
+ }
15465
15473
  async function defaultRemoteBranch(git, url) {
15466
15474
  const symref = await git.raw(["ls-remote", "--symref", url, "HEAD"]);
15467
15475
  const match = /^ref: refs\/heads\/([^\s]+)\s+HEAD$/m.exec(symref);
@@ -15501,6 +15509,7 @@ async function initOwnSync(opts) {
15501
15509
  }
15502
15510
  const branch = await defaultRemoteBranch(git, opts.url);
15503
15511
  await git.fetch("origin", branch);
15512
+ removeCanonicalScaffoldBeforeCheckout(ownDir);
15504
15513
  await git.checkout(["--track", "-B", branch, `origin/${branch}`]);
15505
15514
  await reindexAndMark(opts);
15506
15515
  return { ownDir, branch, remoteWasEmpty: false };
@@ -15519,7 +15528,7 @@ function errorMessage2(err) {
15519
15528
  // ../../packages/core/dist/autoSync.js
15520
15529
  import { spawn as spawn2 } from "node:child_process";
15521
15530
  import { createHash as createHash4 } from "node:crypto";
15522
- import { existsSync as existsSync9, mkdirSync as mkdirSync6, readFileSync as readFileSync7, renameSync as renameSync3, statSync as statSync6, writeFileSync as writeFileSync5 } from "node:fs";
15531
+ import { existsSync as existsSync9, mkdirSync as mkdirSync6, readFileSync as readFileSync8, renameSync as renameSync3, statSync as statSync6, writeFileSync as writeFileSync5 } from "node:fs";
15523
15532
  import { dirname as dirname5, join as join9 } from "node:path";
15524
15533
  var AUTO_SYNC_DEBOUNCE_MS = 15 * 60 * 1e3;
15525
15534
  var AUTO_SYNC_RECORD_DEBOUNCE_MS = 60 * 1e3;
@@ -15539,7 +15548,7 @@ function autoSyncLockPath(caveatHome) {
15539
15548
  }
15540
15549
  function readAutoSyncState(caveatHome) {
15541
15550
  try {
15542
- const value = JSON.parse(readFileSync7(autoSyncStatePath(caveatHome), "utf-8"));
15551
+ const value = JSON.parse(readFileSync8(autoSyncStatePath(caveatHome), "utf-8"));
15543
15552
  if (!isAutoSyncState(value)) return null;
15544
15553
  return value;
15545
15554
  } catch {
@@ -15891,16 +15900,17 @@ function resolvePaths(caveatHome, knowledgeRepo, userHome) {
15891
15900
  }
15892
15901
 
15893
15902
  // ../../packages/core/dist/config.js
15894
- import { existsSync as existsSync11, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "node:fs";
15903
+ import { existsSync as existsSync11, readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "node:fs";
15895
15904
  var DEFAULT_CONFIG = {
15896
15905
  knowledgeRepo: "own",
15897
15906
  semverKeys: ["driver", "cuda", "node"],
15898
15907
  publishTarget: null,
15899
15908
  sealedKeyId: "v1",
15900
- sealedKeyserverUrl: null
15909
+ sealedKeyserverUrl: null,
15910
+ runtimeErrors: false
15901
15911
  };
15902
15912
  function loadConfig(userConfigPath) {
15903
- const userCfg = existsSync11(userConfigPath) ? JSON.parse(readFileSync8(userConfigPath, "utf-8")) : {};
15913
+ const userCfg = existsSync11(userConfigPath) ? JSON.parse(readFileSync9(userConfigPath, "utf-8")) : {};
15904
15914
  return deepMerge(DEFAULT_CONFIG, userCfg);
15905
15915
  }
15906
15916
  function ensureUserConfig(userConfigPath) {
@@ -15909,7 +15919,7 @@ function ensureUserConfig(userConfigPath) {
15909
15919
  }
15910
15920
  }
15911
15921
  function writeUserConfigPatch(userConfigPath, patch) {
15912
- const existing = existsSync11(userConfigPath) ? JSON.parse(readFileSync8(userConfigPath, "utf-8")) : {};
15922
+ const existing = existsSync11(userConfigPath) ? JSON.parse(readFileSync9(userConfigPath, "utf-8")) : {};
15913
15923
  writeFileSync6(userConfigPath, `${JSON.stringify({ ...existing, ...patch }, null, 2)}
15914
15924
  `, "utf-8");
15915
15925
  }
@@ -16128,7 +16138,19 @@ function reminderSymptomLine(symptomExcerpt) {
16128
16138
  const excerpt2 = sanitizeReminderDisplay(symptomExcerpt, SYMPTOM_LINE_MAX);
16129
16139
  return excerpt2 ? ` \u75C7\u72B6: ${excerpt2}` : null;
16130
16140
  }
16131
- function toolErrorReminderText(hits) {
16141
+ function detailGuidance(surface) {
16142
+ if (surface === "native-cli") {
16143
+ return "\u8A73\u7D30\u306F `caveat show <id> --source <source>` \u3067\u53D6\u5F97\u3057\u3001documented \u306A\u5BFE\u51E6\u3068 environment \u304C\u4E00\u81F4\u3059\u308B\u304B\u78BA\u8A8D\u3057\u3066\u304B\u3089\u9069\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u7121\u95A2\u4FC2\u3068\u5224\u65AD\u3057\u305F\u3089\u7121\u8996\u3057\u3066\u7D9A\u884C\u3067 OK\u3002";
16144
+ }
16145
+ return "mcp__caveat__caveat_get \u3067\u8A73\u7D30\u3092\u78BA\u8A8D\u3057\u3001documented \u306A\u5BFE\u51E6\u304C\u3042\u308C\u3070\u9069\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u7121\u95A2\u4FC2\u3068\u5224\u65AD\u3057\u305F\u3089\u7121\u8996\u3057\u3066\u7D9A\u884C\u3067 OK\u3002";
16146
+ }
16147
+ function promptDetailGuidance(surface) {
16148
+ if (surface === "native-cli") {
16149
+ return "\u8A73\u7D30\u306F `caveat show <id> --source <source>` \u3067\u53D6\u5F97\u3002environment \u304C\u4E00\u81F4\u3059\u308B\u304B\u78BA\u8A8D\u3057\u3066\u304B\u3089\u9069\u7528\u5224\u65AD\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u7121\u95A2\u4FC2\u3068\u5224\u65AD\u3057\u305F\u3089\u7121\u8996\u3057\u3066\u7D9A\u884C\u3067 OK\u3002";
16150
+ }
16151
+ return "\u8A73\u7D30\u306F mcp__caveat__caveat_get \u306B id + source \u3092\u6E21\u3057\u3066\u53D6\u5F97\u3002environment \u304C\u4E00\u81F4\u3059\u308B\u304B\u78BA\u8A8D\u3057\u3066\u304B\u3089\u9069\u7528\u5224\u65AD\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u7121\u95A2\u4FC2\u3068\u5224\u65AD\u3057\u305F\u3089\u7121\u8996\u3057\u3066\u7D9A\u884C\u3067 OK\u3002";
16152
+ }
16153
+ function toolErrorReminderText(hits, actionSurface = "claude-mcp") {
16132
16154
  const lines = [];
16133
16155
  lines.push(
16134
16156
  `[caveat] \u76F4\u524D\u306E\u30A8\u30E9\u30FC\u306B\u4E00\u81F4\u3059\u308B\u53EF\u80FD\u6027\u306E\u3042\u308B\u65E2\u77E5\u306E\u7F60\u304C ${hits.length} \u4EF6\u3042\u308A\u307E\u3059:`
@@ -16140,12 +16162,10 @@ function toolErrorReminderText(hits) {
16140
16162
  if (symptomLine) lines.push(symptomLine);
16141
16163
  });
16142
16164
  lines.push("");
16143
- lines.push(
16144
- "mcp__caveat__caveat_get \u3067\u8A73\u7D30\u3092\u78BA\u8A8D\u3057\u3001documented \u306A\u5BFE\u51E6\u304C\u3042\u308C\u3070\u9069\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u7121\u95A2\u4FC2\u3068\u5224\u65AD\u3057\u305F\u3089\u7121\u8996\u3057\u3066\u7D9A\u884C\u3067 OK\u3002"
16145
- );
16165
+ lines.push(detailGuidance(actionSurface));
16146
16166
  return lines.join("\n");
16147
16167
  }
16148
- function userPromptSubmitReminderText(hits) {
16168
+ function userPromptSubmitReminderText(hits, actionSurface = "claude-mcp") {
16149
16169
  const lines = [];
16150
16170
  lines.push(
16151
16171
  `[caveat] \u3053\u306E\u30D7\u30ED\u30F3\u30D7\u30C8\u306B\u95A2\u9023\u3059\u308B\u53EF\u80FD\u6027\u306E\u3042\u308B\u65E2\u77E5\u306E\u7F60\u304C ${hits.length} \u4EF6\u3042\u308A\u307E\u3059:`
@@ -16157,16 +16177,14 @@ function userPromptSubmitReminderText(hits) {
16157
16177
  if (symptomLine) lines.push(symptomLine);
16158
16178
  });
16159
16179
  lines.push("");
16160
- lines.push(
16161
- "\u8A73\u7D30\u306F mcp__caveat__caveat_get \u306B id + source \u3092\u6E21\u3057\u3066\u53D6\u5F97\u3002environment \u304C\u4E00\u81F4\u3059\u308B\u304B\u78BA\u8A8D\u3057\u3066\u304B\u3089\u9069\u7528\u5224\u65AD\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u7121\u95A2\u4FC2\u3068\u5224\u65AD\u3057\u305F\u3089\u7121\u8996\u3057\u3066\u7D9A\u884C\u3067 OK\u3002"
16162
- );
16180
+ lines.push(promptDetailGuidance(actionSurface));
16163
16181
  return lines.join("\n");
16164
16182
  }
16165
16183
  function shortPath(p2) {
16166
16184
  const parts = p2.split(/[\\/]/);
16167
16185
  return parts[parts.length - 1] ?? p2;
16168
16186
  }
16169
- function stopReminderText(signals, related) {
16187
+ function stopReminderText(signals, related, actionSurface = "claude-mcp") {
16170
16188
  const lines = [];
16171
16189
  lines.push("[caveat] \u3053\u306E\u30BB\u30C3\u30B7\u30E7\u30F3\u3067\u5916\u90E8\u4ED5\u69D8\u306E\u7F60\u306B\u5F53\u305F\u3063\u305F\u53EF\u80FD\u6027\u3092\u793A\u3059\u30B7\u30B0\u30CA\u30EB:");
16172
16190
  if (signals.toolFailureCount > 0) {
@@ -16196,29 +16214,21 @@ function stopReminderText(signals, related) {
16196
16214
  );
16197
16215
  lines.push("");
16198
16216
  if (related.length > 0) {
16199
- lines.push(
16200
- `\u30BB\u30C3\u30B7\u30E7\u30F3\u5185\u5BB9\u3068\u5171\u8D77\u3059\u308B\u65E2\u5B58\u7F60 ${related.length} \u4EF6\uFF08\u95A2\u9023\u304C\u3042\u308C\u3070 mcp__caveat__caveat_update \u3067 last_verified \u3092\u66F4\u65B0 or \u8FFD\u8A18\uFF09:`
16201
- );
16217
+ lines.push(actionSurface === "native-cli" ? `\u30BB\u30C3\u30B7\u30E7\u30F3\u5185\u5BB9\u3068\u5171\u8D77\u3059\u308B\u65E2\u5B58\u7F60 ${related.length} \u4EF6\uFF08\u8A73\u7D30\u306F \`caveat show <id> --source <source>\` \u3067\u78BA\u8A8D\uFF09:` : `\u30BB\u30C3\u30B7\u30E7\u30F3\u5185\u5BB9\u3068\u5171\u8D77\u3059\u308B\u65E2\u5B58\u7F60 ${related.length} \u4EF6\uFF08\u95A2\u9023\u304C\u3042\u308C\u3070 mcp__caveat__caveat_update \u3067 last_verified \u3092\u66F4\u65B0 or \u8FFD\u8A18\uFF09:`);
16202
16218
  related.forEach((h2, i2) => {
16203
16219
  lines.push(reminderHitLine(h2, i2));
16204
16220
  });
16205
16221
  lines.push("");
16206
- lines.push(
16207
- "\u4E0A\u8A18\u3068\u7570\u306A\u308B\u65B0\u898F\u306E\u7F60\u3092\u8E0F\u3093\u3067\u3044\u305F\u3089 mcp__caveat__caveat_record \u3067\u767B\u9332\u3057\u3066\u304F\u3060\u3055\u3044\u3002outcome: impossible\uFF08\u73FE\u72B6\u306E\u5236\u7D04\u3067\u306F\u4E0D\u53EF\u80FD\u3068\u5224\u5B9A\u3057\u305F\u7D50\u8AD6\uFF09\u3082\u8A18\u9332\u5BFE\u8C61\u3002"
16208
- );
16222
+ lines.push(actionSurface === "native-cli" ? "\u95A2\u9023\u3059\u308B own \u30A8\u30F3\u30C8\u30EA\u306F `caveat show <id> --source own` \u304C\u793A\u3059 path \u306E Markdown\u3067 last_verified \u3084\u672C\u6587\u3092\u66F4\u65B0\u3057\u3001`caveat index` \u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002community \u30A8\u30F3\u30C8\u30EA\u306F\u8CFC\u8AAD\u7269\u306A\u306E\u3067\u76F4\u63A5\u7DE8\u96C6\u3057\u307E\u305B\u3093\u3002\u4E0A\u8A18\u3068\u7570\u306A\u308B\u65B0\u898F\u306E\u7F60\u306F Caveat \u306E own knowledge repo \u3078 Markdown \u3067\u8A18\u9332\u3057\u3001`caveat index` \u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002outcome: impossible\uFF08\u73FE\u72B6\u306E\u5236\u7D04\u3067\u306F\u4E0D\u53EF\u80FD\u3068\u5224\u5B9A\u3057\u305F\u7D50\u8AD6\uFF09\u3082\u8A18\u9332\u5BFE\u8C61\u3002" : "\u4E0A\u8A18\u3068\u7570\u306A\u308B\u65B0\u898F\u306E\u7F60\u3092\u8E0F\u3093\u3067\u3044\u305F\u3089 mcp__caveat__caveat_record \u3067\u767B\u9332\u3057\u3066\u304F\u3060\u3055\u3044\u3002outcome: impossible\uFF08\u73FE\u72B6\u306E\u5236\u7D04\u3067\u306F\u4E0D\u53EF\u80FD\u3068\u5224\u5B9A\u3057\u305F\u7D50\u8AD6\uFF09\u3082\u8A18\u9332\u5BFE\u8C61\u3002");
16209
16223
  } else {
16210
- lines.push(
16211
- "\u65E2\u5B58\u7F60\u306B\u8A72\u5F53\u306A\u3057\u3002\u5916\u90E8\u4ED5\u69D8\u306E\u7F60\u306B\u82E6\u6226\u3057\u3066\u3044\u305F\u306A\u3089 mcp__caveat__caveat_record \u3067\u767B\u9332\u3057\u3066\u304F\u3060\u3055\u3044\u3002outcome: impossible \u3082\u8A18\u9332\u5BFE\u8C61\u3002"
16212
- );
16224
+ lines.push(actionSurface === "native-cli" ? "\u65E2\u5B58\u7F60\u306B\u8A72\u5F53\u306A\u3057\u3002\u5916\u90E8\u4ED5\u69D8\u306E\u7F60\u306B\u82E6\u6226\u3057\u3066\u3044\u305F\u306A\u3089 Caveat \u306E own knowledge repo \u3078 Markdown \u3067\u8A18\u9332\u3057\u3001`caveat index` \u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002outcome: impossible \u3082\u8A18\u9332\u5BFE\u8C61\u3002" : "\u65E2\u5B58\u7F60\u306B\u8A72\u5F53\u306A\u3057\u3002\u5916\u90E8\u4ED5\u69D8\u306E\u7F60\u306B\u82E6\u6226\u3057\u3066\u3044\u305F\u306A\u3089 mcp__caveat__caveat_record \u3067\u767B\u9332\u3057\u3066\u304F\u3060\u3055\u3044\u3002outcome: impossible \u3082\u8A18\u9332\u5BFE\u8C61\u3002");
16213
16225
  }
16214
- lines.push(
16215
- "\u8A18\u9332\u6642\u306F tool \u8AAC\u660E\u306E\u4E8C\u9805\u57FA\u6E96\u3067 visibility \u3092\u9078\u3076\uFF08public = \u7B2C\u4E09\u8005\u518D\u73FE\u53EF\u80FD / private = repo \u56FA\u6709\uFF09\u3002\u8FF7\u3063\u305F\u3089 private\u3002"
16216
- );
16226
+ lines.push(actionSurface === "native-cli" ? "\u8A18\u9332\u6642\u306F visibility \u3092\u4E8C\u9805\u57FA\u6E96\u3067\u9078\u3076\uFF08public = \u7B2C\u4E09\u8005\u518D\u73FE\u53EF\u80FD / private = repo \u56FA\u6709\uFF09\u3002\u8FF7\u3063\u305F\u3089 private\u3002" : "\u8A18\u9332\u6642\u306F tool \u8AAC\u660E\u306E\u4E8C\u9805\u57FA\u6E96\u3067 visibility \u3092\u9078\u3076\uFF08public = \u7B2C\u4E09\u8005\u518D\u73FE\u53EF\u80FD / private = repo \u56FA\u6709\uFF09\u3002\u8FF7\u3063\u305F\u3089 private\u3002");
16217
16227
  return lines.join("\n");
16218
16228
  }
16219
16229
 
16220
16230
  // ../../packages/core/dist/transcriptSignals.js
16221
- import { existsSync as existsSync12, readFileSync as readFileSync9 } from "node:fs";
16231
+ import { existsSync as existsSync12, readFileSync as readFileSync10 } from "node:fs";
16222
16232
  var MAX_ERROR_SNIPPETS = 10;
16223
16233
  var MAX_ERROR_SNIPPET_LENGTH = 300;
16224
16234
  var MAX_SEARCH_QUERIES = 10;
@@ -16247,7 +16257,7 @@ function readSessionSignals(transcriptPath) {
16247
16257
  if (!transcriptPath || !existsSync12(transcriptPath)) return null;
16248
16258
  let raw;
16249
16259
  try {
16250
- raw = readFileSync9(transcriptPath, "utf-8");
16260
+ raw = readFileSync10(transcriptPath, "utf-8");
16251
16261
  } catch {
16252
16262
  return null;
16253
16263
  }
@@ -16328,7 +16338,7 @@ function struggleSearchText(s) {
16328
16338
  }
16329
16339
 
16330
16340
  // ../../packages/core/dist/codexTranscriptSignals.js
16331
- import { existsSync as existsSync13, readFileSync as readFileSync10 } from "node:fs";
16341
+ import { existsSync as existsSync13, readFileSync as readFileSync11 } from "node:fs";
16332
16342
  var MAX_ERROR_SNIPPETS2 = 10;
16333
16343
  var MAX_ERROR_SNIPPET_LENGTH2 = 300;
16334
16344
  var MAX_SEARCH_QUERIES2 = 10;
@@ -16396,7 +16406,7 @@ function readCodexSessionSignals(transcriptPath) {
16396
16406
  if (!transcriptPath || !existsSync13(transcriptPath)) return null;
16397
16407
  let raw;
16398
16408
  try {
16399
- raw = readFileSync10(transcriptPath, "utf-8");
16409
+ raw = readFileSync11(transcriptPath, "utf-8");
16400
16410
  } catch {
16401
16411
  return null;
16402
16412
  }
@@ -16542,7 +16552,7 @@ function listStale(db, opts = {}) {
16542
16552
 
16543
16553
  // ../../packages/core/dist/publishScan.js
16544
16554
  import { createHash as createHash5 } from "node:crypto";
16545
- import { existsSync as existsSync14, readFileSync as readFileSync11, writeFileSync as writeFileSync7 } from "node:fs";
16555
+ import { existsSync as existsSync14, readFileSync as readFileSync12, writeFileSync as writeFileSync7 } from "node:fs";
16546
16556
  import { join as join11, basename as basename2 } from "node:path";
16547
16557
  import { homedir as homedir2, userInfo as userInfo2 } from "node:os";
16548
16558
  var ALLOW_FILE = ".caveat-publish-allow.json";
@@ -16774,7 +16784,7 @@ function publishSelfIdentityTokens() {
16774
16784
  function loadPublishAllow(knowledgeRepo) {
16775
16785
  const path = join11(knowledgeRepo, ALLOW_FILE);
16776
16786
  if (!existsSync14(path)) return /* @__PURE__ */ new Set();
16777
- const parsed = JSON.parse(readFileSync11(path, "utf-8"));
16787
+ const parsed = JSON.parse(readFileSync12(path, "utf-8"));
16778
16788
  if (!Array.isArray(parsed.allow)) throw new Error(`${ALLOW_FILE} must contain an "allow" array`);
16779
16789
  return new Set(parsed.allow.filter((value) => typeof value === "string" && DIGEST_RE.test(value)));
16780
16790
  }
@@ -16803,7 +16813,7 @@ var PublishScanError = class extends Error {
16803
16813
 
16804
16814
  // ../../packages/core/dist/publish.js
16805
16815
  import { createHash as createHash6 } from "node:crypto";
16806
- import { existsSync as existsSync15, mkdirSync as mkdirSync7, readFileSync as readFileSync12, readdirSync as readdirSync8, rmSync as rmSync5, writeFileSync as writeFileSync8 } from "node:fs";
16816
+ import { existsSync as existsSync15, mkdirSync as mkdirSync7, readFileSync as readFileSync13, readdirSync as readdirSync8, rmSync as rmSync5, writeFileSync as writeFileSync8 } from "node:fs";
16807
16817
  import { dirname as dirname7, join as join12, relative as relative3 } from "node:path";
16808
16818
 
16809
16819
  // ../../packages/core/dist/visibility.js
@@ -16822,7 +16832,7 @@ function collectPublishSet(entriesDir) {
16822
16832
  if (!existsSync15(entriesDir)) return { files, invalid };
16823
16833
  for (const path of walkMarkdown(entriesDir)) {
16824
16834
  const relPath = relative3(entriesDir, path).replace(/\\/g, "/");
16825
- const content = readFileSync12(path);
16835
+ const content = readFileSync13(path);
16826
16836
  try {
16827
16837
  const parsed = parseMarkdown(content.toString("utf-8"));
16828
16838
  const visibility = classifyVisibility(parsed.frontmatter.visibility);
@@ -16877,7 +16887,7 @@ function buildSealedReadme(fileCount, files) {
16877
16887
  "",
16878
16888
  `Public entries: ${fileCount}`,
16879
16889
  "",
16880
- "Caveat: https://github.com/kitepon-rgb/Caveat",
16890
+ "Caveat: https://github.com/kitepon/Caveat",
16881
16891
  ""
16882
16892
  ];
16883
16893
  const showcase = files.filter((f) => f.showcase).sort((a, b2) => Buffer.compare(Buffer.from(a.relPath, "utf-8"), Buffer.from(b2.relPath, "utf-8")));
@@ -16915,11 +16925,11 @@ function verifySealedMirror(opts) {
16915
16925
  throw new Error(`publish mirror verification failed:
16916
16926
  unexpected sealed mirror tree: ${files.join(", ") || "(empty)"}`);
16917
16927
  }
16918
- const diskReadme = readFileSync12(join12(opts.mirrorDir, "README.md"), "utf-8");
16928
+ const diskReadme = readFileSync13(join12(opts.mirrorDir, "README.md"), "utf-8");
16919
16929
  if (diskReadme !== opts.readme) {
16920
16930
  throw new Error("publish mirror verification failed: README.md content changed after generation");
16921
16931
  }
16922
- const diskBundle = readFileSync12(join12(opts.mirrorDir, BUNDLE_RELPATH));
16932
+ const diskBundle = readFileSync13(join12(opts.mirrorDir, BUNDLE_RELPATH));
16923
16933
  if (!diskBundle.equals(opts.bundle)) {
16924
16934
  throw new Error("publish mirror verification failed: sealed bundle bytes changed after generation");
16925
16935
  }
@@ -17013,8 +17023,8 @@ function readExistingMirror(mirrorDir) {
17013
17023
  const readmePath = join12(mirrorDir, "README.md");
17014
17024
  const bundlePath = join12(mirrorDir, BUNDLE_RELPATH);
17015
17025
  return {
17016
- readme: existsSync15(readmePath) ? readFileSync12(readmePath, "utf-8") : null,
17017
- bundle: existsSync15(bundlePath) ? readFileSync12(bundlePath) : null
17026
+ readme: existsSync15(readmePath) ? readFileSync13(readmePath, "utf-8") : null,
17027
+ bundle: existsSync15(bundlePath) ? readFileSync13(bundlePath) : null
17018
17028
  };
17019
17029
  }
17020
17030
  async function publishOwn(opts) {
@@ -17305,7 +17315,7 @@ function boundedCount(value) {
17305
17315
  // ../../packages/core/dist/runtimeErrors.js
17306
17316
  import { spawnSync } from "node:child_process";
17307
17317
  import { createHash as createHash7, randomBytes as randomBytes3 } from "node:crypto";
17308
- import { closeSync as closeSync2, constants, existsSync as existsSync16, fstatSync, lstatSync, mkdirSync as mkdirSync8, openSync as openSync2, readFileSync as readFileSync13, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync7, writeFileSync as writeFileSync9 } from "node:fs";
17318
+ import { existsSync as existsSync16, lstatSync, mkdirSync as mkdirSync8, readFileSync as readFileSync14, renameSync as renameSync4, rmSync as rmSync6, statSync as statSync7, writeFileSync as writeFileSync9 } from "node:fs";
17309
17319
  import { arch as hostArch, homedir as homedir3, platform as hostPlatform } from "node:os";
17310
17320
  import { dirname as dirname8, join as join13 } from "node:path";
17311
17321
  import { DatabaseSync as DatabaseSync3 } from "node:sqlite";
@@ -17313,7 +17323,6 @@ var RUNTIME_ERRORS_SCHEMA = "caveat.runtime_errors.v1";
17313
17323
  var STATE_VERSION = "1.0";
17314
17324
  var MAX_RECORDS = 256;
17315
17325
  var RETENTION_MS = 30 * 864e5;
17316
- var MAX_CONFIG_BYTES = 64 * 1024;
17317
17326
  var definitions = {
17318
17327
  "CAVEAT.DATABASE_OPEN_FAILED": { component: "database", severity: "high", template: "Caveat database open failed" },
17319
17328
  "CAVEAT.INDEX_FAILED": { component: "index", severity: "high", template: "Caveat index operation failed" },
@@ -17334,9 +17343,9 @@ var validVersion = (v) => typeof v === "string" && /^\d+\.\d+\.\d+(?:[-+][0-9A-Z
17334
17343
  var validOs = (v) => typeof v === "string" && ["darwin", "linux", "windows"].includes(v);
17335
17344
  var validArch = (v) => typeof v === "string" && ["x64", "arm64", "arm", "ia32"].includes(v);
17336
17345
  var windows = (env) => isWindowsEnv(env, hostPlatform());
17337
- function defaultFactoryReporterConfigPath(env = process.env) {
17338
- const home = env.HOME || env.USERPROFILE || homedir3();
17339
- return windows(env) ? join13(env.LOCALAPPDATA || join13(home, "AppData", "Local"), "dotagents", "factory-reporter", "config.json") : join13(env.XDG_CONFIG_HOME || join13(home, ".config"), "dotagents", "factory-reporter.json");
17346
+ function runtimeErrorsConfigPath(env = process.env) {
17347
+ const home = windows(env) ? env.USERPROFILE || env.HOME || homedir3() : env.HOME || env.USERPROFILE || homedir3();
17348
+ return join13(home, ".caveatrc.json");
17340
17349
  }
17341
17350
  function runtimeErrorsStatePath(env = process.env) {
17342
17351
  const home = env.HOME || env.USERPROFILE || homedir3();
@@ -17345,24 +17354,8 @@ function runtimeErrorsStatePath(env = process.env) {
17345
17354
  function collectionEnabled(options2 = {}) {
17346
17355
  const env = options2.env ?? process.env;
17347
17356
  try {
17348
- const path = options2.configPath ?? defaultFactoryReporterConfigPath(env);
17349
- const isWin = (options2.isWindows ?? windows)(env);
17350
- const before = lstatSync(path);
17351
- if (!before.isFile() || before.isSymbolicLink() || before.size > MAX_CONFIG_BYTES) return false;
17352
- if (isWin) secureWindowsAcl(path, options2.aclRunner);
17353
- else assertPosix(before, 384);
17354
- const fd = openSync2(path, constants.O_RDONLY | constants.O_NONBLOCK | (constants.O_NOFOLLOW ?? 0));
17355
- let text;
17356
- try {
17357
- const after = fstatSync(fd);
17358
- if (before.dev !== after.dev || before.ino !== after.ino || after.size > MAX_CONFIG_BYTES) return false;
17359
- if (!isWin) assertPosix(after, 384);
17360
- text = readFileSync13(fd, "utf8");
17361
- } finally {
17362
- closeSync2(fd);
17363
- }
17364
- const config = JSON.parse(text);
17365
- return plain(config) && exact(config, ["schema_version", "host", "collection", "reporting"]) && config.schema_version === "1.0" && plain(config.host) && exact(config.host, ["id", "profile"]) && typeof config.host.id === "string" && /^[a-z0-9][a-z0-9._-]{0,63}$/.test(config.host.id) && ["server", "mac", "wsl", "windows-native"].includes(config.host.profile) && plain(config.collection) && exact(config.collection, ["enabled"]) && config.collection.enabled === true && canonicalReporting(config.reporting);
17357
+ const path = options2.configPath ?? runtimeErrorsConfigPath(env);
17358
+ return loadConfig(path).runtimeErrors === true;
17366
17359
  } catch {
17367
17360
  return false;
17368
17361
  }
@@ -17380,32 +17373,19 @@ function ensureSafeDir(dir, isWin, options2 = {}) {
17380
17373
  if (isWin) secureWindowsAcl(dir, options2.aclRunner, true, !existed);
17381
17374
  else assertPosix(s, 448);
17382
17375
  }
17383
- function canonicalReporting(value) {
17384
- if (!plain(value) || !Object.keys(value).every((key) => ["enabled", "endpoint", "credential_file"].includes(key)) || typeof value.enabled !== "boolean") return false;
17385
- if (value.endpoint !== void 0) {
17386
- if (typeof value.endpoint !== "string" || value.endpoint.length > 2048) return false;
17387
- try {
17388
- if (!["http:", "https:"].includes(new URL(value.endpoint).protocol)) return false;
17389
- } catch {
17390
- return false;
17391
- }
17392
- }
17393
- if (value.credential_file !== void 0 && (typeof value.credential_file !== "string" || value.credential_file.length < 1 || value.credential_file.length > 4096)) return false;
17394
- return !value.enabled || value.endpoint !== void 0 && value.credential_file !== void 0;
17395
- }
17396
- var WINDOWS_ACL_VERIFY = String.raw`$p=$env:CAVEAT_ACL_PATH;$isDir=$env:CAVEAT_ACL_DIRECTORY -eq '1';$sid=[System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value;$acl=if($isDir){[System.IO.Directory]::GetAccessControl($p)}else{[System.IO.File]::GetAccessControl($p)};$owner=$acl.GetOwner([System.Security.Principal.SecurityIdentifier]).Value;if($owner -ne $sid){exit 41};$rules=@($acl.GetAccessRules($true,$true,[System.Security.Principal.SecurityIdentifier]));if($rules.Count -ne 1){exit 42};$r=$rules[0];if($r.IdentityReference.Value -ne $sid -or $r.AccessControlType -ne 'Allow' -or $r.IsInherited -or ($r.FileSystemRights -band [System.Security.AccessControl.FileSystemRights]::FullControl) -ne [System.Security.AccessControl.FileSystemRights]::FullControl){exit 43}`;
17397
- var WINDOWS_ACL_APPLY = String.raw`$p=$env:CAVEAT_ACL_PATH;$isDir=$env:CAVEAT_ACL_DIRECTORY -eq '1';$sid=[System.Security.Principal.WindowsIdentity]::GetCurrent().User;$acl=if($isDir){New-Object System.Security.AccessControl.DirectorySecurity}else{New-Object System.Security.AccessControl.FileSecurity};$acl.SetAccessRuleProtection($true,$false);$flags=if($isDir){[System.Security.AccessControl.InheritanceFlags]'ContainerInherit, ObjectInherit'}else{[System.Security.AccessControl.InheritanceFlags]::None};$rule=New-Object System.Security.AccessControl.FileSystemAccessRule($sid,'FullControl',$flags,[System.Security.AccessControl.PropagationFlags]::None,[System.Security.AccessControl.AccessControlType]::Allow);$acl.SetOwner($sid);$acl.AddAccessRule($rule);if($isDir){[System.IO.Directory]::SetAccessControl($p,$acl)}else{[System.IO.File]::SetAccessControl($p,$acl)};` + WINDOWS_ACL_VERIFY;
17376
+ var WINDOWS_ACL_VERIFY = String.raw`$ErrorActionPreference='Stop';$p=$env:CAVEAT_ACL_PATH;$sid=[System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value;$acl=Get-Acl -LiteralPath $p;$owner=$acl.GetOwner([System.Security.Principal.SecurityIdentifier]).Value;if($owner -ne $sid){exit 41};$rules=@($acl.GetAccessRules($true,$true,[System.Security.Principal.SecurityIdentifier]));if($rules.Count -ne 1){exit 42};$r=$rules[0];if($r.IdentityReference.Value -ne $sid -or $r.AccessControlType -ne 'Allow' -or $r.IsInherited -or ($r.FileSystemRights -band [System.Security.AccessControl.FileSystemRights]::FullControl) -ne [System.Security.AccessControl.FileSystemRights]::FullControl){exit 43}`;
17377
+ var WINDOWS_ACL_APPLY = String.raw`$ErrorActionPreference='Stop';$p=$env:CAVEAT_ACL_PATH;$isDir=$env:CAVEAT_ACL_DIRECTORY -eq '1';$sid=[System.Security.Principal.WindowsIdentity]::GetCurrent().User;$acl=if($isDir){New-Object System.Security.AccessControl.DirectorySecurity}else{New-Object System.Security.AccessControl.FileSecurity};$acl.SetAccessRuleProtection($true,$false);$flags=if($isDir){[System.Security.AccessControl.InheritanceFlags]'ContainerInherit, ObjectInherit'}else{[System.Security.AccessControl.InheritanceFlags]::None};$rule=New-Object System.Security.AccessControl.FileSystemAccessRule($sid,'FullControl',$flags,[System.Security.AccessControl.PropagationFlags]::None,[System.Security.AccessControl.AccessControlType]::Allow);$acl.SetOwner($sid);$acl.AddAccessRule($rule);Set-Acl -LiteralPath $p -AclObject $acl;` + WINDOWS_ACL_VERIFY;
17398
17378
  var WINDOWS_ACL_TIMEOUT_MS = 3e4;
17399
17379
  function runWindowsAcl(path, directory, apply) {
17400
- const result = spawnSync("powershell.exe", ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", apply ? WINDOWS_ACL_APPLY : WINDOWS_ACL_VERIFY], { env: { ...process.env, CAVEAT_ACL_PATH: path, CAVEAT_ACL_DIRECTORY: directory ? "1" : "0" }, encoding: "utf-8", timeout: WINDOWS_ACL_TIMEOUT_MS, windowsHide: true });
17380
+ const result = spawnSync("pwsh.exe", ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", apply ? WINDOWS_ACL_APPLY : WINDOWS_ACL_VERIFY], { env: { ...process.env, CAVEAT_ACL_PATH: path, CAVEAT_ACL_DIRECTORY: directory ? "1" : "0" }, encoding: "utf-8", timeout: WINDOWS_ACL_TIMEOUT_MS, windowsHide: true });
17401
17381
  if (result.error !== void 0) throw Error(`store_unsafe: powershell spawn ${result.error.code ?? result.error.message}`);
17402
17382
  if (result.status !== 0) throw Error(`store_unsafe: powershell exit=${result.status} signal=${result.signal ?? "none"} stderr=${(result.stderr ?? "").replace(/\s+/g, " ").trim().slice(0, 400) || "(empty)"}`);
17403
17383
  }
17404
17384
  function secureWindowsAcl(path, runner, directory = false, apply = false) {
17405
17385
  try {
17406
17386
  (runner ?? runWindowsAcl)(path, directory, apply);
17407
- } catch {
17408
- throw Error("store_unsafe");
17387
+ } catch (cause) {
17388
+ throw Error("store_unsafe", { cause });
17409
17389
  }
17410
17390
  }
17411
17391
  function assertPosix(info, mode) {
@@ -17435,7 +17415,7 @@ function validate(store) {
17435
17415
  function readStore(path, isWin, options2 = {}) {
17436
17416
  if (!existsSync16(path)) return empty();
17437
17417
  ensureSafeFile(path, isWin, options2);
17438
- const value = JSON.parse(readFileSync13(path, "utf8"));
17418
+ const value = JSON.parse(readFileSync14(path, "utf8"));
17439
17419
  validate(value);
17440
17420
  return value;
17441
17421
  }
@@ -17748,7 +17728,7 @@ function formatYmd(d) {
17748
17728
  }
17749
17729
 
17750
17730
  // ../../packages/core/dist/update.js
17751
- import { readFileSync as readFileSync14, statSync as statSync9, writeFileSync as writeFileSync11 } from "node:fs";
17731
+ import { readFileSync as readFileSync15, statSync as statSync9, writeFileSync as writeFileSync11 } from "node:fs";
17752
17732
  import { join as join15 } from "node:path";
17753
17733
  var IMMUTABLE_KEYS = /* @__PURE__ */ new Set([
17754
17734
  "id",
@@ -17769,7 +17749,7 @@ function updateEntry(id, patch, opts) {
17769
17749
  }
17770
17750
  const relPath = row.path;
17771
17751
  const filePath = join15(opts.entriesRoot, relPath);
17772
- const raw = readFileSync14(filePath, "utf-8");
17752
+ const raw = readFileSync15(filePath, "utf-8");
17773
17753
  const parsed = parseMarkdown(raw);
17774
17754
  if (patch.frontmatter) {
17775
17755
  for (const key of Object.keys(patch.frontmatter)) {
@@ -17926,6 +17906,10 @@ export {
17926
17906
  acquireReindexLock,
17927
17907
  releaseReindexLock,
17928
17908
  reindexAllSources,
17909
+ isWindows,
17910
+ isPrivateOwnerStat,
17911
+ powershellCallPrefix,
17912
+ nodeExecutableNames,
17929
17913
  communityAdd,
17930
17914
  communityPull,
17931
17915
  communityList,
@@ -17936,11 +17920,6 @@ export {
17936
17920
  maybeSweepPendingDirs,
17937
17921
  drainPendingRemindersDetailed,
17938
17922
  createKeyserverKeyProvider,
17939
- isWindows,
17940
- isPrivateOwnerStat,
17941
- powershellCallPrefix,
17942
- nodeExecutableNames,
17943
- SyncError,
17944
17923
  syncOwn,
17945
17924
  KNOWLEDGE_GITIGNORE,
17946
17925
  initOwnSync,
@@ -18009,4 +17988,4 @@ strip-bom-string/index.js:
18009
17988
  js-yaml/dist/js-yaml.mjs:
18010
17989
  (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
18011
17990
  */
18012
- //# sourceMappingURL=chunk-KAULUIC4.js.map
17991
+ //# sourceMappingURL=chunk-NZD3FHU6.js.map