@fenglimg/fabric-server 1.8.0-rc.1 → 1.8.0-rc.2

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.
@@ -1142,7 +1142,7 @@ async function reconcileRules(projectRoot, opts) {
1142
1142
  }
1143
1143
 
1144
1144
  // src/services/doctor.ts
1145
- import { existsSync as existsSync4, mkdirSync, readdirSync, readFileSync, rmdirSync, renameSync, statSync as statSync3 } from "fs";
1145
+ import { existsSync as existsSync4, mkdirSync, readdirSync, readFileSync, rmdirSync, renameSync, statSync as statSync3, unlinkSync } from "fs";
1146
1146
  import { access, readFile as readFile7, writeFile as writeFile2 } from "fs/promises";
1147
1147
  import { constants } from "fs";
1148
1148
  import { isAbsolute as isAbsolute3, join as join8, posix as posix2, resolve as resolve4 } from "path";
@@ -1911,6 +1911,7 @@ async function runDoctorReport(target) {
1911
1911
  const rulesDirUnindexed = inspectRulesDirUnindexed(projectRoot, meta);
1912
1912
  const stableIdCollision = await inspectStableIdCollisions(projectRoot);
1913
1913
  const claudeSkillLegacyPath = inspectClaudeSkillLegacyPath(projectRoot);
1914
+ const claudeHookLegacyPath = inspectClaudeHookLegacyPath(projectRoot);
1914
1915
  const preexistingRootFiles = inspectPreexistingRootFiles(projectRoot);
1915
1916
  const legacyClientPaths = inspectLegacyClientPaths(projectRoot);
1916
1917
  const taxonomyExists = existsSync4(join8(projectRoot, ".fabric", "INITIAL_TAXONOMY.md"));
@@ -1931,6 +1932,7 @@ async function runDoctorReport(target) {
1931
1932
  createRulesDirUnindexedCheck(rulesDirUnindexed),
1932
1933
  createStableIdCollisionCheck(stableIdCollision),
1933
1934
  createClaudeSkillLegacyPathCheck(claudeSkillLegacyPath),
1935
+ createClaudeHookLegacyPathCheck(claudeHookLegacyPath),
1934
1936
  createPreexistingRootFilesCheck(preexistingRootFiles),
1935
1937
  createLegacyClientPathCheck(legacyClientPaths)
1936
1938
  ];
@@ -2023,6 +2025,10 @@ async function runDoctorFix(target) {
2023
2025
  await fixClaudeSkillLegacyPath(projectRoot);
2024
2026
  fixed.push(findIssue(before.fixable_errors, "claude_skill_legacy_path"));
2025
2027
  }
2028
+ if (before.fixable_errors.some((issue) => issue.code === "claude_hook_legacy_path")) {
2029
+ await fixClaudeHookLegacyPath(projectRoot);
2030
+ fixed.push(findIssue(before.fixable_errors, "claude_hook_legacy_path"));
2031
+ }
2026
2032
  if (before.warnings.some((issue) => issue.code === "legacy_client_path_present")) {
2027
2033
  await fixLegacyClientPaths(projectRoot);
2028
2034
  fixed.push(findIssue(before.warnings, "legacy_client_path_present"));
@@ -2641,6 +2647,65 @@ async function fixClaudeSkillLegacyPath(projectRoot) {
2641
2647
  to: newPath
2642
2648
  });
2643
2649
  }
2650
+ var LEGACY_HOOK_FILENAME = "agents-md-init-reminder.cjs";
2651
+ var NEW_HOOK_FILENAME = "fabric-init-reminder.cjs";
2652
+ function inspectClaudeHookLegacyPath(projectRoot) {
2653
+ const legacyHookPath = join8(projectRoot, ".claude", "hooks", LEGACY_HOOK_FILENAME);
2654
+ const newHookPath = join8(projectRoot, ".claude", "hooks", NEW_HOOK_FILENAME);
2655
+ const settingsPath = join8(projectRoot, ".claude", "settings.json");
2656
+ const hasLegacyFile = existsSync4(legacyHookPath);
2657
+ let hasLegacySettingsCommand = false;
2658
+ if (existsSync4(settingsPath)) {
2659
+ try {
2660
+ const raw = readFileSync(settingsPath, "utf8");
2661
+ hasLegacySettingsCommand = raw.includes(LEGACY_HOOK_FILENAME);
2662
+ } catch {
2663
+ }
2664
+ }
2665
+ return { hasLegacyFile, hasLegacySettingsCommand, legacyHookPath, newHookPath, settingsPath };
2666
+ }
2667
+ function createClaudeHookLegacyPathCheck(inspection) {
2668
+ if (inspection.hasLegacyFile || inspection.hasLegacySettingsCommand) {
2669
+ return issueCheck(
2670
+ "Claude hook path",
2671
+ "error",
2672
+ "fixable_error",
2673
+ "claude_hook_legacy_path",
2674
+ `.claude/hooks/${LEGACY_HOOK_FILENAME} (or its reference in .claude/settings.json) exists at the legacy path. Run --fix to migrate to ${NEW_HOOK_FILENAME}.`,
2675
+ `Run \`fab doctor --fix\` to rename ${LEGACY_HOOK_FILENAME} to ${NEW_HOOK_FILENAME} and update .claude/settings.json hook commands.`
2676
+ );
2677
+ }
2678
+ return okCheck("Claude hook path", `.claude/hooks/${NEW_HOOK_FILENAME} is at the canonical path (or not present).`);
2679
+ }
2680
+ async function fixClaudeHookLegacyPath(projectRoot) {
2681
+ const { hasLegacyFile, hasLegacySettingsCommand, legacyHookPath, newHookPath, settingsPath } = inspectClaudeHookLegacyPath(projectRoot);
2682
+ if (hasLegacyFile) {
2683
+ if (existsSync4(newHookPath)) {
2684
+ unlinkSync(legacyHookPath);
2685
+ } else {
2686
+ mkdirSync(join8(newHookPath, ".."), { recursive: true });
2687
+ renameSync(legacyHookPath, newHookPath);
2688
+ }
2689
+ }
2690
+ if (hasLegacySettingsCommand) {
2691
+ try {
2692
+ const raw = readFileSync(settingsPath, "utf8");
2693
+ const updated = raw.split(LEGACY_HOOK_FILENAME).join(NEW_HOOK_FILENAME);
2694
+ if (updated !== raw) {
2695
+ const parsed = JSON.parse(updated);
2696
+ await atomicWriteJson2(settingsPath, parsed);
2697
+ }
2698
+ } catch {
2699
+ }
2700
+ }
2701
+ if (hasLegacyFile || hasLegacySettingsCommand) {
2702
+ await appendEventLedgerEvent(projectRoot, {
2703
+ event_type: "claude_hook_path_migrated",
2704
+ from: legacyHookPath,
2705
+ to: newHookPath
2706
+ });
2707
+ }
2708
+ }
2644
2709
  function inspectLegacyClientPaths(projectRoot) {
2645
2710
  const configPath = join8(projectRoot, "fabric.config.json");
2646
2711
  if (!existsSync4(configPath)) {
@@ -15,7 +15,7 @@ import {
15
15
  readEventLedger,
16
16
  runDoctorReport,
17
17
  sha256
18
- } from "./chunk-E3BHIUIW.js";
18
+ } from "./chunk-EGGZFXMO.js";
19
19
 
20
20
  // src/http.ts
21
21
  import { randomUUID as randomUUID2 } from "crypto";
package/dist/index.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  runDoctorReport,
23
23
  stableStringify,
24
24
  writeRuleMeta
25
- } from "./chunk-E3BHIUIW.js";
25
+ } from "./chunk-EGGZFXMO.js";
26
26
 
27
27
  // src/index.ts
28
28
  import { existsSync as existsSync2 } from "fs";
@@ -312,7 +312,7 @@ function formatPreexistingRootMessage(projectRoot) {
312
312
  function createFabricServer(tracker) {
313
313
  const server = new McpServer({
314
314
  name: "fabric-context-server",
315
- version: "1.8.0-rc.1"
315
+ version: "1.8.0-rc.2"
316
316
  });
317
317
  registerPlanContext(server, tracker);
318
318
  registerRuleSections(server, tracker);
@@ -406,7 +406,7 @@ function createShutdownHandler(deps) {
406
406
  };
407
407
  }
408
408
  async function startHttpServer(options) {
409
- const { createFabricHttpApp } = await import("./http-MEFXOG3L.js");
409
+ const { createFabricHttpApp } = await import("./http-Q7GIL23Y.js");
410
410
  const { port, projectRoot, host = "127.0.0.1", authToken, dashboardDistPath, dev } = options;
411
411
  const app = createFabricHttpApp({ projectRoot, host, authToken, dashboardDistPath, dev });
412
412
  return await new Promise((resolveServer, rejectServer) => {