@magic-ingredients/tiny-brain-local 0.16.0 → 0.17.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/services/agent-manager.d.ts +27 -7
- package/dist/services/agent-manager.d.ts.map +1 -1
- package/dist/services/agent-manager.js +5 -33
- package/dist/services/analyse-service.d.ts +26 -86
- package/dist/services/analyse-service.d.ts.map +1 -1
- package/dist/services/analyse-service.js +238 -454
- package/dist/services/repo-service.d.ts +33 -177
- package/dist/services/repo-service.d.ts.map +1 -1
- package/dist/services/repo-service.js +351 -1088
- package/dist/services/tech-context-service.d.ts +106 -0
- package/dist/services/tech-context-service.d.ts.map +1 -0
- package/dist/services/tech-context-service.js +365 -0
- package/dist/tools/analyse.tool.d.ts +3 -3
- package/dist/tools/analyse.tool.d.ts.map +1 -1
- package/dist/tools/analyse.tool.js +9 -72
- package/dist/tools/config/config.tool.d.ts.map +1 -1
- package/dist/tools/config/config.tool.js +10 -2
- package/dist/tools/tool-registry.d.ts.map +1 -1
- package/dist/tools/tool-registry.js +4 -0
- package/package.json +3 -2
|
@@ -1,222 +1,78 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Repository Context Service
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Service for repository context operations including:
|
|
5
|
+
* - Writing workflow sections to CLAUDE.md (commit format, TDD, progress tracking)
|
|
6
|
+
* - Tech context now managed by TechContextService (.tiny-brain/analysis.json, .tiny-brain/tech/*.md)
|
|
6
7
|
*/
|
|
7
|
-
import type { RepoAnalysis } from '@magic-ingredients/tiny-brain-core';
|
|
8
|
-
import { type TechStackDiff, ConfigService } from '@magic-ingredients/tiny-brain-core';
|
|
9
8
|
import type { RequestContext } from '../types/request-context.js';
|
|
10
|
-
export interface
|
|
11
|
-
|
|
12
|
-
description: string;
|
|
13
|
-
version?: string;
|
|
14
|
-
usage?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface RepoBlock {
|
|
17
|
-
rawAnalysis: RepoAnalysis;
|
|
18
|
-
analysis: string;
|
|
19
|
-
documentation: string | null;
|
|
20
|
-
agentUsage: string;
|
|
21
|
-
}
|
|
22
|
-
export interface InstalledAgent {
|
|
23
|
-
name: string;
|
|
24
|
-
version: string;
|
|
25
|
-
lastUpdated: string;
|
|
26
|
-
}
|
|
27
|
-
export interface TBStatus extends RepoAnalysis {
|
|
28
|
-
installedAgents?: InstalledAgent[];
|
|
29
|
-
lastUpdated?: string;
|
|
30
|
-
}
|
|
31
|
-
export interface PhaseStructure {
|
|
32
|
-
phases: {
|
|
33
|
-
[phaseKey: string]: {
|
|
34
|
-
agents: string[];
|
|
35
|
-
handoffs: string[];
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
crossPhaseHandoffs: Array<{
|
|
39
|
-
from: string;
|
|
40
|
-
to: string;
|
|
41
|
-
description: string;
|
|
42
|
-
}>;
|
|
43
|
-
prerequisites: {
|
|
44
|
-
[agentName: string]: string[] | string;
|
|
45
|
-
};
|
|
9
|
+
export interface WriteWorkflowSectionsOptions {
|
|
10
|
+
contextPath?: string;
|
|
46
11
|
}
|
|
47
12
|
/**
|
|
48
|
-
* Service for
|
|
49
|
-
*
|
|
13
|
+
* Service for repository context operations
|
|
14
|
+
* Tech context is now managed by TechContextService
|
|
15
|
+
* Workflow sections are written to CLAUDE.md based on config flags
|
|
50
16
|
*/
|
|
51
17
|
export declare class RepoService {
|
|
52
18
|
private context;
|
|
53
19
|
private static readonly REPO_BLOCK_START;
|
|
54
20
|
private static readonly REPO_BLOCK_END;
|
|
55
|
-
private static readonly ANALYSIS_MARKER_PREFIX;
|
|
56
|
-
private static readonly ANALYSIS_MARKER_SUFFIX;
|
|
57
|
-
private static readonly SUBAGENT_PROTOCOL_HEADER;
|
|
58
|
-
private static readonly AGENT_USAGE_HEADER;
|
|
59
|
-
private static readonly REPO_CONTEXT_HEADER;
|
|
60
|
-
private static readonly USAGE_TEMPLATE_HEADER;
|
|
61
|
-
private static readonly EXAMPLE_HEADER;
|
|
62
|
-
private static readonly ANALYSIS_IGNORE_PREFIX;
|
|
63
|
-
private static readonly ANALYSIS_IGNORE_SUFFIX;
|
|
64
|
-
private static readonly STATUS_IGNORE_PREFIX;
|
|
65
|
-
private static readonly STATUS_IGNORE_SUFFIX;
|
|
66
21
|
private configService;
|
|
67
|
-
constructor(context: RequestContext
|
|
22
|
+
constructor(context: RequestContext);
|
|
68
23
|
/**
|
|
69
|
-
*
|
|
24
|
+
* Get repository root using the repo-utils helper
|
|
25
|
+
* This is used as fallback when context.repositoryRoot is not set
|
|
70
26
|
*/
|
|
71
|
-
|
|
27
|
+
private getRepositoryRoot;
|
|
72
28
|
/**
|
|
73
|
-
*
|
|
74
|
-
*/
|
|
75
|
-
writeRepoBlockToContextFile(analysis: RepoAnalysis, agents: AgentInfo[], contextFilePath?: string, version?: string): Promise<string>;
|
|
76
|
-
/**
|
|
77
|
-
* Read the repository block from context file
|
|
29
|
+
* Read the repository block from context file (for legacy migration)
|
|
78
30
|
*/
|
|
79
31
|
readRepoBlockFromContextFile(contextFilePath?: string): Promise<string | null>;
|
|
80
|
-
/**
|
|
81
|
-
* Format the repository block with phase-based agent structure
|
|
82
|
-
*/
|
|
83
|
-
private formatRepoBlockWithPhases;
|
|
84
|
-
/**
|
|
85
|
-
* Format the complete repository block with simplified structure
|
|
86
|
-
*/
|
|
87
|
-
private formatRepoBlock;
|
|
88
|
-
/**
|
|
89
|
-
* Parse the repository block from context file into structured data
|
|
90
|
-
*/
|
|
91
|
-
parseRepoBlock(contextFilePath?: string): Promise<RepoBlock | null>;
|
|
92
|
-
/**
|
|
93
|
-
* Format agents with phase-based structure
|
|
94
|
-
*/
|
|
95
|
-
formatAgentsWithPhases(agentResponse: any): string;
|
|
96
|
-
/**
|
|
97
|
-
* Format agents as a simple table with tech-stack specific "Use for" descriptions
|
|
98
|
-
*/
|
|
99
|
-
private formatAgentTable;
|
|
100
|
-
/**
|
|
101
|
-
* Generate generic "Use for" description based on agent name
|
|
102
|
-
* This is a fallback when TBR doesn't provide contextual usage
|
|
103
|
-
*/
|
|
104
|
-
private generateAgentUseCase;
|
|
105
|
-
/**
|
|
106
|
-
* Format repository context as clean YAML
|
|
107
|
-
*/
|
|
108
|
-
private formatRepositoryContextYaml;
|
|
109
|
-
/**
|
|
110
|
-
* Get the analysis version from package.json
|
|
111
|
-
*/
|
|
112
|
-
private getAnalysisVersion;
|
|
113
32
|
/**
|
|
114
33
|
* Extract version from tiny-brain block frontmatter
|
|
115
34
|
* @param content - The content containing the tiny-brain block
|
|
116
35
|
* @returns Version string or null if not found/invalid
|
|
117
36
|
*/
|
|
118
37
|
extractTinyBrainVersion(content: string): string | null;
|
|
119
|
-
/**
|
|
120
|
-
* Format documentation templates section for PRDs and ADRs
|
|
121
|
-
* Only includes sections for directories that exist
|
|
122
|
-
*/
|
|
123
|
-
private formatDocumentationTemplatesSection;
|
|
124
|
-
/**
|
|
125
|
-
* Extract TB_ANALYSIS from content with new IGNORE format
|
|
126
|
-
*/
|
|
127
|
-
extractTBAnalysis(content: string): RepoAnalysis | null;
|
|
128
|
-
/**
|
|
129
|
-
* Extract TB-STATUS from content with backwards compatibility for TB_ANALYSIS-IGNORE
|
|
130
|
-
*/
|
|
131
|
-
extractTBStatus(content: string): TBStatus | null;
|
|
132
|
-
/**
|
|
133
|
-
* Generate TB-STATUS-IGNORE format string with current timestamp
|
|
134
|
-
*/
|
|
135
|
-
updateTBStatus(analysis: RepoAnalysis, installedAgents?: InstalledAgent[]): string;
|
|
136
|
-
/**
|
|
137
|
-
* Check if repository is initialized (has TB-STATUS-IGNORE or TB_ANALYSIS-IGNORE)
|
|
138
|
-
*/
|
|
139
|
-
isRepoInitialized(content: string): boolean;
|
|
140
38
|
/**
|
|
141
39
|
* Check if we're in a repository context
|
|
142
40
|
*/
|
|
143
41
|
isInRepository(): boolean;
|
|
144
42
|
/**
|
|
145
|
-
* Check if repository is initialized (has
|
|
43
|
+
* Check if repository is initialized (has .tiny-brain/analysis.json)
|
|
44
|
+
* This is the new initialization check - no longer checks CLAUDE.md
|
|
146
45
|
*/
|
|
147
46
|
isRepositoryInitialized(): Promise<boolean>;
|
|
148
47
|
/**
|
|
149
|
-
*
|
|
150
|
-
*/
|
|
151
|
-
compareTechStack(previousAnalysis: RepoAnalysis | TBStatus, currentAnalysis: RepoAnalysis): TechStackDiff;
|
|
152
|
-
/**
|
|
153
|
-
* Migrate legacy TB_ANALYSIS-IGNORE format to new TB-STATUS-IGNORE format
|
|
154
|
-
*/
|
|
155
|
-
migrateToNewFormat(existingContent: string, newAnalysis: RepoAnalysis): string;
|
|
156
|
-
/**
|
|
157
|
-
* Update agent usage section in CLAUDE.md with phase-based structure
|
|
158
|
-
*/
|
|
159
|
-
updateAgentUsageSection(installedAgents: InstalledAgent[], phaseStructure: PhaseStructure, contextFilePath?: string): Promise<void>;
|
|
160
|
-
/**
|
|
161
|
-
* Generate phase structure from installed agents
|
|
162
|
-
*/
|
|
163
|
-
generatePhaseStructure(installedAgents: InstalledAgent[]): PhaseStructure;
|
|
164
|
-
/**
|
|
165
|
-
* Create or update TB-STATUS-IGNORE with analysis and installed agents
|
|
166
|
-
*/
|
|
167
|
-
createOrUpdateTBStatus(analysis: RepoAnalysis, installedAgents: InstalledAgent[], contextFilePath?: string): Promise<void>;
|
|
168
|
-
/**
|
|
169
|
-
* Migrate legacy TB_ANALYSIS-IGNORE to TB-STATUS-IGNORE format
|
|
170
|
-
*/
|
|
171
|
-
migrateTBAnalysisToTBStatus(existingContent: string, installedAgents: InstalledAgent[], contextFilePath?: string): Promise<void>;
|
|
172
|
-
/**
|
|
173
|
-
* Get TB status from CLAUDE.md with fallback to legacy format
|
|
174
|
-
*/
|
|
175
|
-
getTBStatus(contextFilePath?: string): Promise<TBStatus | null>;
|
|
176
|
-
/**
|
|
177
|
-
* Update repository context YAML section with current analysis
|
|
178
|
-
*/
|
|
179
|
-
updateRepositoryContext(analysis: RepoAnalysis, contextFilePath?: string): Promise<void>;
|
|
180
|
-
/**
|
|
181
|
-
* Format phase-based agent usage content
|
|
182
|
-
*/
|
|
183
|
-
private formatPhaseBasedAgentUsage;
|
|
184
|
-
/**
|
|
185
|
-
* Update tiny-brain section in content with new agent usage
|
|
186
|
-
*/
|
|
187
|
-
private updateTinyBrainSection;
|
|
188
|
-
/**
|
|
189
|
-
* Build complete tiny-brain section
|
|
190
|
-
*/
|
|
191
|
-
private buildTinyBrainSection;
|
|
192
|
-
/**
|
|
193
|
-
* Add TB status to content (create tiny-brain section if needed)
|
|
194
|
-
*/
|
|
195
|
-
private addStatusToContent;
|
|
196
|
-
/**
|
|
197
|
-
* Generate handoffs for agents within a phase
|
|
48
|
+
* Get the analysis version from package.json
|
|
198
49
|
*/
|
|
199
|
-
|
|
50
|
+
getAnalysisVersion(): string;
|
|
200
51
|
/**
|
|
201
|
-
*
|
|
52
|
+
* Write workflow sections to CLAUDE.md based on config flags
|
|
53
|
+
*
|
|
54
|
+
* Writes the following sections when their respective flags are enabled:
|
|
55
|
+
* - Commit Message Format (when SDD enabled)
|
|
56
|
+
* - TDD Workflow (when TDD enabled)
|
|
57
|
+
* - Progress Tracking Auto-Commit Configuration (when SDD enabled)
|
|
58
|
+
* - Operational Tracking Directory (when SDD enabled)
|
|
202
59
|
*/
|
|
203
|
-
|
|
60
|
+
writeWorkflowSections(options?: WriteWorkflowSectionsOptions): Promise<void>;
|
|
204
61
|
/**
|
|
205
|
-
*
|
|
62
|
+
* Format the Commit Message Format section
|
|
206
63
|
*/
|
|
207
|
-
private
|
|
64
|
+
private formatCommitMessageSection;
|
|
208
65
|
/**
|
|
209
|
-
*
|
|
66
|
+
* Format the TDD Workflow section
|
|
210
67
|
*/
|
|
211
|
-
private
|
|
68
|
+
private formatTDDWorkflowSection;
|
|
212
69
|
/**
|
|
213
|
-
* Format
|
|
214
|
-
* Each section is independent - enabled features appear regardless of other settings
|
|
70
|
+
* Format the Progress Tracking Auto-Commit Configuration section
|
|
215
71
|
*/
|
|
216
|
-
private
|
|
72
|
+
private formatProgressTrackingSection;
|
|
217
73
|
/**
|
|
218
|
-
* Format
|
|
74
|
+
* Format the Operational Tracking Directory section
|
|
219
75
|
*/
|
|
220
|
-
private
|
|
76
|
+
private formatOperationalTrackingSection;
|
|
221
77
|
}
|
|
222
78
|
//# sourceMappingURL=repo-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-service.d.ts","sourceRoot":"","sources":["../../src/services/repo-service.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"repo-service.d.ts","sourceRoot":"","sources":["../../src/services/repo-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAIlE,MAAM,WAAW,4BAA4B;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,qBAAa,WAAW;IAMV,OAAO,CAAC,OAAO;IAL3B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAA2B;IACnE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAyB;IAE/D,OAAO,CAAC,aAAa,CAAgB;gBAEjB,OAAO,EAAE,cAAc;IAS3C;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAQzB;;OAEG;IACG,4BAA4B,CAChC,eAAe,GAAE,MAAoB,GACpC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAmCzB;;;;OAIG;IACH,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAOvD;;OAEG;IACH,cAAc,IAAI,OAAO;IAUzB;;;OAGG;IACG,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC;IAcjD;;OAEG;IACH,kBAAkB,IAAI,MAAM;IAa5B;;;;;;;;OAQG;IACG,qBAAqB,CAAC,OAAO,GAAE,4BAAiC,GAAG,OAAO,CAAC,IAAI,CAAC;IAwFtF;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAkGlC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAoChC;;OAEG;IACH,OAAO,CAAC,6BAA6B;IAwErC;;OAEG;IACH,OAAO,CAAC,gCAAgC;CAqCzC"}
|