@qlucent/fishi-core 0.2.0 → 0.4.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/index.d.ts CHANGED
@@ -452,6 +452,7 @@ interface ScaffoldOptions extends InitOptions {
452
452
  brownfieldAnalysis?: BrownfieldAnalysisData;
453
453
  resolutions?: FileResolutionMap;
454
454
  docsReadmeExists?: boolean;
455
+ rootClaudeMdExists?: boolean;
455
456
  }
456
457
  interface ScaffoldResult {
457
458
  agentCount: number;
@@ -476,6 +477,7 @@ interface ConflictMap {
476
477
  hasConflicts: boolean;
477
478
  totalConflicts: number;
478
479
  docsReadmeExists: boolean;
480
+ rootClaudeMdExists: boolean;
479
481
  }
480
482
  declare function detectConflicts(targetDir: string): ConflictMap;
481
483
 
@@ -489,6 +491,14 @@ interface BackupManifest {
489
491
  }
490
492
  declare function createBackup(targetDir: string, conflictingFiles: string[]): Promise<string>;
491
493
 
494
+ /**
495
+ * Prepend FISHI content to the TOP of an existing CLAUDE.md (for root CLAUDE.md).
496
+ * FISHI rules go first so they have higher priority in Claude Code.
497
+ */
498
+ declare function mergeClaudeMdTop(existing: string, fishiContent: string): string;
499
+ /**
500
+ * Append FISHI content to the BOTTOM of an existing CLAUDE.md (for .claude/CLAUDE.md).
501
+ */
492
502
  declare function mergeClaudeMd(existing: string, fishiContent: string): string;
493
503
  interface HookEntry {
494
504
  matcher: string;
@@ -513,4 +523,4 @@ interface McpJson {
513
523
  declare function mergeMcpJson(existing: McpJson, fishi: McpJson): McpJson;
514
524
  declare function mergeGitignore(existing: string, fishiAdditions: string): string;
515
525
 
516
- export { type AgentDefinition, type AgentRole, type AgentTemplate, type BackupManifest, type BrownfieldAnalysisData, type ClaudeMdOptions, type CommandTemplate, type ConflictCategory, type ConflictMap, type ConflictResolution, type CostMode, type DetectionCheck, type DetectionResult, type DynamicAgentConfig, type ExecutionConfig, type FileConflict, type FileResolutionMap, type FishiConfig, type FishiYamlOptions, type GateConfig, type GateStatus, type GitConfig, type HookTemplate, type InitOptions, type McpConfig, type McpServerConfig, type ModelRoutingConfig, type ModelTier, type ProjectConfig, type ProjectType, type ProjectYamlOptions, type ScaffoldOptions, type ScaffoldResult, type SkillTemplate, type StateConfig, type TaskStatus, type TaskboardConfig, type TemplateContext, architectAgentTemplate, backendAgentTemplate, createBackup, detectConflicts, devLeadTemplate, devopsAgentTemplate, docsAgentTemplate, frontendAgentTemplate, fullstackAgentTemplate, generateScaffold, getAdaptiveTaskGraphSkill, getAgentCompleteHook, getAgentFactoryTemplate, getAgentRegistryTemplate, getApiDesignSkill, getAutoCheckpointHook, getBoardCommand, getBrainstormingSkill, getBrownfieldAnalysisSkill, getBrownfieldDiscoverySkill, getClaudeMdTemplate, getCodeGenSkill, getCoordinatorFactoryTemplate, getDebuggingSkill, getDeploymentSkill, getDocCheckerScript, getDocumentationSkill, getFishiYamlTemplate, getGateCommand, getGateManagerScript, getGitignoreAdditions, getInitCommand, getLearningsManagerScript, getMasterOrchestratorTemplate, getMcpJsonTemplate, getMemoryManagerScript, getModelRoutingReference, getPhaseRunnerScript, getPostEditHook, getPrdCommand, getPrdSkill, getProjectYamlTemplate, getResetCommand, getResumeCommand, getSafetyCheckHook, getSessionStartHook, getSettingsJsonTemplate, getSprintCommand, getStatusCommand, getTaskboardOpsSkill, getTaskboardUpdateHook, getTestingSkill, getTodoManagerScript, getValidateScaffoldScript, getWorktreeManagerScript, getWorktreeSetupHook, marketingAgentTemplate, mergeClaudeMd, mergeGitignore, mergeMcpJson, mergeSettingsJson, opsLeadTemplate, planningAgentTemplate, planningLeadTemplate, qualityLeadTemplate, researchAgentTemplate, securityAgentTemplate, testingAgentTemplate, uiuxAgentTemplate, writingAgentTemplate };
526
+ export { type AgentDefinition, type AgentRole, type AgentTemplate, type BackupManifest, type BrownfieldAnalysisData, type ClaudeMdOptions, type CommandTemplate, type ConflictCategory, type ConflictMap, type ConflictResolution, type CostMode, type DetectionCheck, type DetectionResult, type DynamicAgentConfig, type ExecutionConfig, type FileConflict, type FileResolutionMap, type FishiConfig, type FishiYamlOptions, type GateConfig, type GateStatus, type GitConfig, type HookTemplate, type InitOptions, type McpConfig, type McpServerConfig, type ModelRoutingConfig, type ModelTier, type ProjectConfig, type ProjectType, type ProjectYamlOptions, type ScaffoldOptions, type ScaffoldResult, type SkillTemplate, type StateConfig, type TaskStatus, type TaskboardConfig, type TemplateContext, architectAgentTemplate, backendAgentTemplate, createBackup, detectConflicts, devLeadTemplate, devopsAgentTemplate, docsAgentTemplate, frontendAgentTemplate, fullstackAgentTemplate, generateScaffold, getAdaptiveTaskGraphSkill, getAgentCompleteHook, getAgentFactoryTemplate, getAgentRegistryTemplate, getApiDesignSkill, getAutoCheckpointHook, getBoardCommand, getBrainstormingSkill, getBrownfieldAnalysisSkill, getBrownfieldDiscoverySkill, getClaudeMdTemplate, getCodeGenSkill, getCoordinatorFactoryTemplate, getDebuggingSkill, getDeploymentSkill, getDocCheckerScript, getDocumentationSkill, getFishiYamlTemplate, getGateCommand, getGateManagerScript, getGitignoreAdditions, getInitCommand, getLearningsManagerScript, getMasterOrchestratorTemplate, getMcpJsonTemplate, getMemoryManagerScript, getModelRoutingReference, getPhaseRunnerScript, getPostEditHook, getPrdCommand, getPrdSkill, getProjectYamlTemplate, getResetCommand, getResumeCommand, getSafetyCheckHook, getSessionStartHook, getSettingsJsonTemplate, getSprintCommand, getStatusCommand, getTaskboardOpsSkill, getTaskboardUpdateHook, getTestingSkill, getTodoManagerScript, getValidateScaffoldScript, getWorktreeManagerScript, getWorktreeSetupHook, marketingAgentTemplate, mergeClaudeMd, mergeClaudeMdTop, mergeGitignore, mergeMcpJson, mergeSettingsJson, opsLeadTemplate, planningAgentTemplate, planningLeadTemplate, qualityLeadTemplate, researchAgentTemplate, securityAgentTemplate, testingAgentTemplate, uiuxAgentTemplate, writingAgentTemplate };
package/dist/index.js CHANGED
@@ -10383,6 +10383,27 @@ import { join, dirname } from "path";
10383
10383
  // src/generators/merge-strategies.ts
10384
10384
  var FISHI_START = "<!-- FISHI:START \u2014 Auto-generated by FISHI. Do not edit between markers. -->";
10385
10385
  var FISHI_END = "<!-- FISHI:END -->";
10386
+ function mergeClaudeMdTop(existing, fishiContent) {
10387
+ const section = `${FISHI_START}
10388
+ ### FISHI Framework
10389
+ ${fishiContent}
10390
+ ${FISHI_END}
10391
+ ---
10392
+ `;
10393
+ const startIdx = existing.indexOf(FISHI_START);
10394
+ const endIdx = existing.indexOf(FISHI_END);
10395
+ if (startIdx !== -1 && endIdx !== -1) {
10396
+ const sectionEnd = endIdx + FISHI_END.length;
10397
+ let afterEnd = sectionEnd;
10398
+ const afterContent = existing.slice(afterEnd);
10399
+ const separatorMatch = afterContent.match(/^\n?---\n/);
10400
+ if (separatorMatch) {
10401
+ afterEnd += separatorMatch[0].length;
10402
+ }
10403
+ return section + existing.slice(afterEnd);
10404
+ }
10405
+ return section + "\n" + existing;
10406
+ }
10386
10407
  function mergeClaudeMd(existing, fishiContent) {
10387
10408
  const section = `
10388
10409
  ---
@@ -10613,7 +10634,20 @@ async function generateScaffold(targetDir, options) {
10613
10634
  framework: options.framework,
10614
10635
  brownfieldAnalysis: options.brownfieldAnalysis
10615
10636
  });
10616
- if (resolutions?.categories["claude-md"] === "merge") {
10637
+ if (options.rootClaudeMdExists) {
10638
+ const rootResolution = resolutions?.categories["root-claude-md"];
10639
+ if (rootResolution === "merge") {
10640
+ const existingMd = await fsReadFile(join(targetDir, "CLAUDE.md"), "utf-8");
10641
+ const merged = mergeClaudeMdTop(existingMd, claudeMdContent);
10642
+ const fullPath = join(targetDir, "CLAUDE.md");
10643
+ await writeFile(fullPath, merged, "utf-8");
10644
+ filesCreated++;
10645
+ } else if (rootResolution === "replace") {
10646
+ const fullPath = join(targetDir, "CLAUDE.md");
10647
+ await writeFile(fullPath, claudeMdContent, "utf-8");
10648
+ filesCreated++;
10649
+ }
10650
+ } else if (resolutions?.categories["claude-md"] === "merge") {
10617
10651
  const existingMd = await fsReadFile(join(targetDir, ".claude", "CLAUDE.md"), "utf-8");
10618
10652
  const merged = mergeClaudeMd(existingMd, claudeMdContent);
10619
10653
  await write(".claude/CLAUDE.md", merged, "claude-md");
@@ -10837,7 +10871,12 @@ var FISHI_FILES = {
10837
10871
  function detectConflicts(targetDir) {
10838
10872
  const categories = [];
10839
10873
  let totalConflicts = 0;
10874
+ const rootClaudeMdExists = existsSync2(join2(targetDir, "CLAUDE.md"));
10840
10875
  for (const [name, def] of Object.entries(FISHI_FILES)) {
10876
+ if (name === "claude-md" && rootClaudeMdExists) {
10877
+ categories.push({ name, label: def.label, conflicts: [] });
10878
+ continue;
10879
+ }
10841
10880
  const conflicts = [];
10842
10881
  for (const relPath of def.files) {
10843
10882
  const fullPath = join2(targetDir, relPath);
@@ -10849,12 +10888,22 @@ function detectConflicts(targetDir) {
10849
10888
  categories.push({ name, label: def.label, conflicts });
10850
10889
  totalConflicts += conflicts.length;
10851
10890
  }
10891
+ if (rootClaudeMdExists) {
10892
+ const stat = statSync(join2(targetDir, "CLAUDE.md"));
10893
+ categories.unshift({
10894
+ name: "root-claude-md",
10895
+ label: "CLAUDE.md (root)",
10896
+ conflicts: [{ path: "CLAUDE.md", size: stat.size }]
10897
+ });
10898
+ totalConflicts += 1;
10899
+ }
10852
10900
  const docsReadmeExists = existsSync2(join2(targetDir, "docs", "README.md"));
10853
10901
  return {
10854
10902
  categories,
10855
10903
  hasConflicts: totalConflicts > 0,
10856
10904
  totalConflicts,
10857
- docsReadmeExists
10905
+ docsReadmeExists,
10906
+ rootClaudeMdExists
10858
10907
  };
10859
10908
  }
10860
10909
 
@@ -10878,7 +10927,7 @@ async function createBackup(targetDir, conflictingFiles) {
10878
10927
  manifestFiles.push({ path: relPath, size: stat.size });
10879
10928
  }
10880
10929
  }
10881
- const fishiVersion = "0.2.0";
10930
+ const fishiVersion = "0.4.0";
10882
10931
  const manifest = {
10883
10932
  timestamp: now.toISOString(),
10884
10933
  fishi_version: fishiVersion,
@@ -10949,6 +10998,7 @@ export {
10949
10998
  getWorktreeSetupHook,
10950
10999
  marketingAgentTemplate,
10951
11000
  mergeClaudeMd,
11001
+ mergeClaudeMdTop,
10952
11002
  mergeGitignore,
10953
11003
  mergeMcpJson,
10954
11004
  mergeSettingsJson,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qlucent/fishi-core",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Shared templates, types, and generators for the FISHI framework",
5
5
  "license": "MIT",
6
6
  "type": "module",