@magic-ingredients/tiny-brain-local 0.20.0 → 0.21.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.
Files changed (37) hide show
  1. package/dist/core/mcp-server.d.ts.map +1 -1
  2. package/dist/core/mcp-server.js +12 -8
  3. package/dist/core/repo-registration.d.ts +30 -0
  4. package/dist/core/repo-registration.d.ts.map +1 -0
  5. package/dist/core/repo-registration.js +34 -0
  6. package/dist/prompts/persona/persona.prompt.js +1 -1
  7. package/dist/prompts/planning/planning.prompt.d.ts +0 -8
  8. package/dist/prompts/planning/planning.prompt.d.ts.map +1 -1
  9. package/dist/prompts/planning/planning.prompt.js +0 -193
  10. package/dist/prompts/prompt-registry.d.ts.map +1 -1
  11. package/dist/prompts/prompt-registry.js +0 -2
  12. package/dist/services/analyse-service.d.ts +15 -29
  13. package/dist/services/analyse-service.d.ts.map +1 -1
  14. package/dist/services/analyse-service.js +99 -236
  15. package/dist/services/dashboard-launcher.service.d.ts +1 -0
  16. package/dist/services/dashboard-launcher.service.d.ts.map +1 -1
  17. package/dist/services/dashboard-launcher.service.js +4 -0
  18. package/dist/services/repo-service.d.ts +5 -0
  19. package/dist/services/repo-service.d.ts.map +1 -1
  20. package/dist/services/repo-service.js +67 -42
  21. package/dist/storage/local-filesystem-adapter.d.ts.map +1 -1
  22. package/dist/storage/local-filesystem-adapter.js +0 -3
  23. package/dist/tools/dashboard/dashboard.tool.d.ts +15 -0
  24. package/dist/tools/dashboard/dashboard.tool.d.ts.map +1 -0
  25. package/dist/tools/dashboard/dashboard.tool.js +81 -0
  26. package/dist/tools/plan/plan.tool.d.ts +0 -1
  27. package/dist/tools/plan/plan.tool.d.ts.map +1 -1
  28. package/dist/tools/plan/plan.tool.js +10 -56
  29. package/dist/tools/quality/quality.tool.js +1 -1
  30. package/dist/tools/recommendations/recommendations.tool.d.ts +13 -0
  31. package/dist/tools/recommendations/recommendations.tool.d.ts.map +1 -0
  32. package/dist/tools/recommendations/recommendations.tool.js +178 -0
  33. package/dist/tools/tool-registry.d.ts.map +1 -1
  34. package/dist/tools/tool-registry.js +8 -0
  35. package/dist/types/local-context.d.ts +2 -0
  36. package/dist/types/local-context.d.ts.map +1 -1
  37. package/package.json +4 -10
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../src/core/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0BH,OAAO,KAAK,EAA4B,QAAQ,EAAkC,MAAM,oCAAoC,CAAC;AAE7H,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAQ5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IAEF,KAAK,CAAC,EAAE;QACN,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,QAAQ,CAAC;KACrB,CAAC;CACH;AAED;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,sBAAsB,CAA0D;IACxF,OAAO,CAAC,mBAAmB,CAA2G;IACtI,OAAO,CAAC,UAAU,CAA6E;IAC/F,OAAO,CAAC,iBAAiB,CAA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YACW,yBAAyB;IA+CvC;;OAEG;YACW,kBAAkB;IAsBhC;;OAEG;YACW,wBAAwB;IA8BtC;;OAEG;YACW,mBAAmB;IA8BjC;;OAEG;IACG,OAAO,CAAC,SAAS,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAK5C;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YAiBjB,eAAe;YAMf,cAAc;YAgGd,iBAAiB;YAMjB,eAAe;YAqEf,iBAAiB;IAS/B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAoB7B;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAkD7B"}
@@ -251,15 +251,18 @@ export class MCPServer {
251
251
  this.logger.debug('Not in a git repository, skipping repo registration');
252
252
  return;
253
253
  }
254
- // Register the repo
255
- const { RepoConfigService } = await import('@magic-ingredients/tiny-brain-core');
254
+ // Detect worktree context and build registration options
255
+ const { RepoConfigService, detectWorktreeInfo } = await import('@magic-ingredients/tiny-brain-core');
256
+ const { resolveRepoRegistration } = await import('./repo-registration.js');
257
+ const worktreeInfo = await detectWorktreeInfo(cwd);
258
+ const registrationOptions = resolveRepoRegistration(cwd, worktreeInfo);
256
259
  const repoConfigService = new RepoConfigService(this.baseContext);
257
- const repoName = cwd.split('/').pop() || 'unknown';
258
- await repoConfigService.registerRepo({
259
- name: repoName,
260
- path: cwd,
261
- });
262
- this.logger.debug(`Registered repository: ${repoName}`);
260
+ await repoConfigService.registerRepo(registrationOptions);
261
+ // Set mainRepositoryRoot on baseContext when in a worktree
262
+ if (registrationOptions.mainRepositoryRoot) {
263
+ this.baseContext.mainRepositoryRoot = registrationOptions.mainRepositoryRoot;
264
+ }
265
+ this.logger.debug(`Registered repository: ${registrationOptions.name}`);
263
266
  }
264
267
  catch (error) {
265
268
  // Don't fail startup if registration fails
@@ -549,6 +552,7 @@ export class MCPServer {
549
552
  activePersona,
550
553
  authToken: this.authToken,
551
554
  config: this.config,
555
+ dashboardLauncher: this.dashboardLauncher ?? undefined,
552
556
  updateActivePersona: (persona) => {
553
557
  const newPersonaId = persona?.id;
554
558
  this.activePersona = newPersonaId;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Repository Registration Utilities
3
+ *
4
+ * Pure functions for computing repo registration options,
5
+ * including worktree-aware logic for generating correct
6
+ * repo names and passing worktree metadata.
7
+ */
8
+ import type { WorktreeInfo } from '@magic-ingredients/tiny-brain-core';
9
+ export interface RepoRegistrationOptions {
10
+ name: string;
11
+ path: string;
12
+ worktree?: {
13
+ mainRepoPath: string;
14
+ branch: string;
15
+ worktreeName: string;
16
+ };
17
+ mainRepositoryRoot?: string;
18
+ }
19
+ /**
20
+ * Compute repo registration options from a working directory and optional worktree info.
21
+ *
22
+ * When in a worktree, the repo name is derived from the main repo path (not the
23
+ * worktree directory name), and worktree metadata is included for tracking.
24
+ *
25
+ * @param cwd - The current working directory
26
+ * @param worktreeInfo - Result from detectWorktreeInfo(), or null if not in a git repo
27
+ * @returns Registration options suitable for RepoConfigService.registerRepo()
28
+ */
29
+ export declare function resolveRepoRegistration(cwd: string, worktreeInfo: WorktreeInfo | null): RepoRegistrationOptions;
30
+ //# sourceMappingURL=repo-registration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-registration.d.ts","sourceRoot":"","sources":["../../src/core/repo-registration.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE;QACT,YAAY,EAAE,MAAM,CAAC;QACrB,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,YAAY,GAAG,IAAI,GAChC,uBAAuB,CAiBzB"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Repository Registration Utilities
3
+ *
4
+ * Pure functions for computing repo registration options,
5
+ * including worktree-aware logic for generating correct
6
+ * repo names and passing worktree metadata.
7
+ */
8
+ /**
9
+ * Compute repo registration options from a working directory and optional worktree info.
10
+ *
11
+ * When in a worktree, the repo name is derived from the main repo path (not the
12
+ * worktree directory name), and worktree metadata is included for tracking.
13
+ *
14
+ * @param cwd - The current working directory
15
+ * @param worktreeInfo - Result from detectWorktreeInfo(), or null if not in a git repo
16
+ * @returns Registration options suitable for RepoConfigService.registerRepo()
17
+ */
18
+ export function resolveRepoRegistration(cwd, worktreeInfo) {
19
+ if (worktreeInfo && worktreeInfo.isWorktree) {
20
+ const repoName = worktreeInfo.mainRepoPath.split('/').pop() || 'unknown';
21
+ return {
22
+ name: repoName,
23
+ path: cwd,
24
+ worktree: {
25
+ mainRepoPath: worktreeInfo.mainRepoPath,
26
+ branch: worktreeInfo.branch,
27
+ worktreeName: worktreeInfo.worktreeName,
28
+ },
29
+ mainRepositoryRoot: worktreeInfo.mainRepoPath,
30
+ };
31
+ }
32
+ const repoName = cwd.split('/').pop() || 'unknown';
33
+ return { name: repoName, path: cwd };
34
+ }
@@ -346,7 +346,7 @@ export class PersonaPrompt {
346
346
  }
347
347
  // Check for learning opportunities (matching tool pattern)
348
348
  const learningEvaluation = PersonaLearningService.evaluateUpdateForLearning(data, context);
349
- let updatesApplied = [];
349
+ const updatesApplied = [];
350
350
  if (learningEvaluation.hasLearning && learningEvaluation.extractedLearning) {
351
351
  await service.updateInsights({
352
352
  personaName: validatedArgs.name,
@@ -36,13 +36,5 @@ export declare class PlanningPrompt {
36
36
  * Handle plan-report prompt
37
37
  */
38
38
  static handlePlanReport(args: Record<string, unknown>, context: RequestContext): Promise<PromptResponse>;
39
- /**
40
- * Handle archive-plan prompt
41
- */
42
- static handleArchivePlan(args: Record<string, unknown>, context: RequestContext): Promise<PromptResponse>;
43
- /**
44
- * Handle switch-plan prompt
45
- */
46
- static handleSwitchPlan(args: Record<string, unknown>, context: RequestContext): Promise<PromptResponse>;
47
39
  }
48
40
  //# sourceMappingURL=planning.prompt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"planning.prompt.d.ts","sourceRoot":"","sources":["../../../src/prompts/planning/planning.prompt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA2ClD,qBAAa,cAAc;IACzB;;OAEG;IACH,MAAM,CAAC,oBAAoB,IAAI,MAAM,EAAE;IAqIvC;;OAEG;WACU,MAAM,CACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC;IAqB1B;;OAEG;WACU,gBAAgB,CAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC;IA0G1B;;OAEG;WACU,gBAAgB,CAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC;IAkJ1B;;OAEG;WACU,gBAAgB,CAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC;IAkF1B;;OAEG;WACU,eAAe,CAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAA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1B;;OAEG;WACU,gBAAgB,CAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC;IAkF1B;;OAEG;WACU,eAAe,CAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC;IAmG1B;;OAEG;WACU,gBAAgB,CAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC;CAgF3B"}
@@ -30,14 +30,6 @@ const PlanReportArgsSchema = z.object({
30
30
  planId: z.string().optional(),
31
31
  format: z.enum(['summary', 'detailed', 'markdown']).optional().default('detailed'),
32
32
  });
33
- const ArchivePlanArgsSchema = z.object({
34
- planId: z.string().optional(),
35
- reason: z.string().optional().default('Completed'),
36
- });
37
- const SwitchPlanArgsSchema = z.object({
38
- planId: z.string(),
39
- // Note: switchToPlan automatically unarchives if needed
40
- });
41
33
  export class PlanningPrompt {
42
34
  /**
43
35
  * Get all planning-related prompt definitions
@@ -139,38 +131,6 @@ export class PlanningPrompt {
139
131
  },
140
132
  ],
141
133
  },
142
- {
143
- name: 'archive-plan',
144
- description: '📦 Archive a completed plan',
145
- arguments: [
146
- {
147
- name: 'planId',
148
- description: 'Plan ID (optional, uses active plan if not provided)',
149
- required: false,
150
- },
151
- {
152
- name: 'reason',
153
- description: 'Reason for archiving the plan',
154
- required: false,
155
- },
156
- ],
157
- },
158
- {
159
- name: 'switch-plan',
160
- description: '🔄 Switch to a different plan as the active plan',
161
- arguments: [
162
- {
163
- name: 'planId',
164
- description: 'ID of the plan to switch to',
165
- required: true,
166
- },
167
- {
168
- name: 'force',
169
- description: 'Allow switching to archived plans',
170
- required: false,
171
- },
172
- ],
173
- },
174
134
  ];
175
135
  }
176
136
  /**
@@ -188,10 +148,6 @@ export class PlanningPrompt {
188
148
  return await PlanningPrompt.handleListPlans(args, context);
189
149
  case 'plan-report':
190
150
  return await PlanningPrompt.handlePlanReport(args, context);
191
- case 'archive-plan':
192
- return await PlanningPrompt.handleArchivePlan(args, context);
193
- case 'switch-plan':
194
- return await PlanningPrompt.handleSwitchPlan(args, context);
195
151
  default:
196
152
  throw new Error(`Unknown planning prompt: ${name}`);
197
153
  }
@@ -679,153 +635,4 @@ export class PlanningPrompt {
679
635
  };
680
636
  }
681
637
  }
682
- /**
683
- * Handle archive-plan prompt
684
- */
685
- static async handleArchivePlan(args, context) {
686
- try {
687
- // Validate args with Zod
688
- const validatedArgs = ArchivePlanArgsSchema.parse(args);
689
- const { planId, reason } = validatedArgs;
690
- if (!context.activePersona?.id) {
691
- throw new Error('No active persona found. Use "as" tool to switch to a persona first.');
692
- }
693
- // Create service with RequestContext
694
- const planningService = new PlanningService(context);
695
- // Get the plan to archive
696
- let plan;
697
- if (planId) {
698
- plan = await planningService.loadPlan({ planId });
699
- if (!plan) {
700
- throw new Error(`Plan not found: ${planId}`);
701
- }
702
- }
703
- else {
704
- plan = await planningService.getActivePlan();
705
- if (!plan) {
706
- throw new Error('No active plan found to archive.');
707
- }
708
- }
709
- // Call service method with validated args
710
- const archived = await planningService.archivePlan({
711
- planId: plan.id,
712
- reason,
713
- });
714
- if (!archived) {
715
- throw new Error('Failed to archive plan.');
716
- }
717
- const resultText = `✅ Archived plan: "${plan.title}"\nReason: ${reason}`;
718
- return {
719
- description: 'Archive a completed plan',
720
- messages: [
721
- {
722
- role: 'user',
723
- content: {
724
- type: 'text',
725
- text: `Archive plan: ${reason}`,
726
- },
727
- },
728
- {
729
- role: 'assistant',
730
- content: {
731
- type: 'text',
732
- text: resultText,
733
- },
734
- },
735
- ],
736
- };
737
- }
738
- catch (error) {
739
- if (error instanceof z.ZodError) {
740
- throw new Error(`Invalid arguments: ${error.errors.map(e => e.message).join(', ')}`);
741
- }
742
- const errorText = `Failed to archive plan: ${error instanceof Error ? error.message : 'Unknown error'}`;
743
- return {
744
- description: 'Error archiving plan',
745
- messages: [
746
- {
747
- role: 'user',
748
- content: {
749
- type: 'text',
750
- text: 'Archive plan',
751
- },
752
- },
753
- {
754
- role: 'assistant',
755
- content: {
756
- type: 'text',
757
- text: errorText,
758
- },
759
- },
760
- ],
761
- };
762
- }
763
- }
764
- /**
765
- * Handle switch-plan prompt
766
- */
767
- static async handleSwitchPlan(args, context) {
768
- try {
769
- // Validate args with Zod
770
- const validatedArgs = SwitchPlanArgsSchema.parse(args);
771
- const { planId } = validatedArgs;
772
- if (!context.activePersona?.id) {
773
- throw new Error('No active persona found. Use "as" tool to switch to a persona first.');
774
- }
775
- // Create service with RequestContext
776
- const planningService = new PlanningService(context);
777
- // Use the new switchToPlan method which handles both active and archived plans
778
- // It will automatically unarchive if needed
779
- const switchedPlan = await planningService.switchToPlan(planId);
780
- const state = switchedPlan.currentState;
781
- const resultText = `✅ Switched active plan to: "${switchedPlan.title}"
782
- Plan ID: ${switchedPlan.id}
783
- Status: ${switchedPlan.status}
784
- Progress: ${state.overallProgress.percentComplete}% (${state.overallProgress.completedFeatures}/${state.overallProgress.totalFeatures} features, ${state.overallProgress.completedTasks}/${state.overallProgress.totalTasks} tasks)`;
785
- return {
786
- description: 'Switch to a different plan',
787
- messages: [
788
- {
789
- role: 'user',
790
- content: {
791
- type: 'text',
792
- text: `Switch to plan: ${planId}`,
793
- },
794
- },
795
- {
796
- role: 'assistant',
797
- content: {
798
- type: 'text',
799
- text: resultText,
800
- },
801
- },
802
- ],
803
- };
804
- }
805
- catch (error) {
806
- if (error instanceof z.ZodError) {
807
- throw new Error(`Invalid arguments: ${error.errors.map(e => e.message).join(', ')}`);
808
- }
809
- const errorText = `Failed to switch plan: ${error instanceof Error ? error.message : 'Unknown error'}`;
810
- return {
811
- description: 'Error switching plan',
812
- messages: [
813
- {
814
- role: 'user',
815
- content: {
816
- type: 'text',
817
- text: 'Switch plan',
818
- },
819
- },
820
- {
821
- role: 'assistant',
822
- content: {
823
- type: 'text',
824
- text: errorText,
825
- },
826
- },
827
- ],
828
- };
829
- }
830
- }
831
638
  }
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-registry.d.ts","sourceRoot":"","sources":["../../src/prompts/prompt-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAMlE,qBAAa,cAAc;IACzB;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,MAAM,EAAE;IAS7B;;OAEG;WACU,MAAM,CACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC;IAS1B;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;CAiC9D;AAGD,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,4BAAyC,CAAC;AACtF,eAAO,MAAM,iBAAiB,gBAAiE,CAAC"}
1
+ {"version":3,"file":"prompt-registry.d.ts","sourceRoot":"","sources":["../../src/prompts/prompt-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAMlE,qBAAa,cAAc;IACzB;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,MAAM,EAAE;IAS7B;;OAEG;WACU,MAAM,CACjB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC;IAS1B;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;CA+B9D;AAGD,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,4BAAyC,CAAC;AACtF,eAAO,MAAM,iBAAiB,gBAAiE,CAAC"}
@@ -53,8 +53,6 @@ export class PromptRegistry {
53
53
  'plan-status': PlanningPrompt,
54
54
  'list-plans': PlanningPrompt,
55
55
  'plan-report': PlanningPrompt,
56
- 'archive-plan': PlanningPrompt,
57
- 'switch-plan': PlanningPrompt,
58
56
  // Thinking prompts
59
57
  think_through: ThinkingPrompt,
60
58
  explain_reasoning: ThinkingPrompt,
@@ -5,7 +5,7 @@
5
5
  * Focused solely on analysis - no context file management.
6
6
  */
7
7
  import type { RequestContext } from '../types/request-context.js';
8
- import { type RepoAnalysis, type TechStackDiff } from '@magic-ingredients/tiny-brain-core';
8
+ import { type RepoAnalysis, type TechStackDiff, type Recommendation } from '@magic-ingredients/tiny-brain-core';
9
9
  export interface AnalyseOptions {
10
10
  dryRun?: boolean;
11
11
  contextPath?: string;
@@ -30,6 +30,7 @@ export interface AnalyseResult {
30
30
  skillPermissionsAdded?: string[];
31
31
  writtenTechContexts?: string[];
32
32
  agentsMdStatus?: 'created' | 'updated' | 'up-to-date';
33
+ recommendations?: readonly Recommendation[];
33
34
  }
34
35
  /**
35
36
  * Service for managing repository analysis
@@ -41,6 +42,7 @@ export declare class AnalyseService {
41
42
  private libraryClient;
42
43
  private configService;
43
44
  private techContextService;
45
+ private recommendationService;
44
46
  constructor(context: RequestContext);
45
47
  /**
46
48
  * Perform repository analysis with unified behavior for initialized/uninitialized repos
@@ -70,42 +72,26 @@ export declare class AnalyseService {
70
72
  */
71
73
  private countPrdsInRepo;
72
74
  /**
73
- * Initialize PRD directory structure for SDD workflow
74
- * @returns true if directory was created
75
+ * Perform config setup using core ConfigSetupService.
76
+ * Delegates directory initialization, git hooks, skill permissions, and CLAUDE.md
77
+ * context block writing to the shared service.
75
78
  */
76
- private initializePrdDirectory;
79
+ private performConfigSetup;
77
80
  /**
78
- * Initialize ADR directory structure
79
- * @returns true if directory was created
81
+ * Resolve hooks template directory from the core package.
82
+ * Tries the core package's templates first (monorepo layout), then falls back
83
+ * to the MCP package's own templates for backward compatibility.
80
84
  */
81
- private initializeAdrDirectory;
82
- /**
83
- * Initialize Quality directory structure
84
- * @returns true if directory was created
85
- */
86
- private initializeQualityDirectory;
87
- /**
88
- * Initialize fixes tracking directory
89
- * @returns true if directory was created
90
- */
91
- private initializeFixesDirectory;
92
- /**
93
- * Initialize git hooks for TDD workflow
94
- * Copies hook templates to .git/hooks/ if not already present
95
- * @returns true if any hooks were installed
96
- */
97
- private initializeGitHooks;
98
- /**
99
- * Inject skill permissions into .claude/settings.json
100
- * These permissions allow skills to read/write to specific directories without prompts
101
- * @returns Array of permissions that were added (empty if none added)
102
- */
103
- private injectSkillPermissions;
85
+ private resolveHooksDir;
104
86
  /**
105
87
  * Fetch tech contexts from TBR and write them to .tiny-brain/tech/
106
88
  * Only called when enableAgenticCoding=false
107
89
  */
108
90
  private fetchAndWriteTechContexts;
91
+ /**
92
+ * Fetch recommendations from TBR and write them via RecommendationService
93
+ */
94
+ private fetchAndWriteRecommendations;
109
95
  /**
110
96
  * Format analysis output for display
111
97
  */
@@ -1 +1 @@
1
- {"version":3,"file":"analyse-service.d.ts","sourceRoot":"","sources":["../../src/services/analyse-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,aAAa,EAQnB,MAAM,oCAAoC,CAAC;AAS5C,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EA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