@magic-ingredients/tiny-brain-local 0.16.1 → 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 +21 -88
- package/dist/services/analyse-service.d.ts.map +1 -1
- package/dist/services/analyse-service.js +175 -466
- 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
|
@@ -5,11 +5,36 @@
|
|
|
5
5
|
* - Fetching full agent data from TBR
|
|
6
6
|
* - Installing/updating agents via AgentService
|
|
7
7
|
* - Removing deprecated agents via AgentService
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
|
+
* Note: Repository context (tech stack) is now managed by TechContextService
|
|
10
|
+
* via .tiny-brain/analysis.json - CLAUDE.md is no longer modified.
|
|
9
11
|
*/
|
|
10
12
|
import type { RequestContext } from '../types/request-context.js';
|
|
11
13
|
import type { RepoAnalysis } from '@magic-ingredients/tiny-brain-core';
|
|
12
|
-
|
|
14
|
+
/** Agent recommendation for installation */
|
|
15
|
+
export interface AgentRecommendation {
|
|
16
|
+
name: string;
|
|
17
|
+
version: string;
|
|
18
|
+
description: string;
|
|
19
|
+
}
|
|
20
|
+
/** Agent update recommendation */
|
|
21
|
+
export interface AgentUpdateRecommendation {
|
|
22
|
+
name: string;
|
|
23
|
+
from: string;
|
|
24
|
+
to: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Agent removal recommendation */
|
|
28
|
+
export interface AgentRemovalRecommendation {
|
|
29
|
+
name: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
}
|
|
32
|
+
/** User selections for agent operations */
|
|
33
|
+
export interface UserSelections {
|
|
34
|
+
install: AgentRecommendation[];
|
|
35
|
+
update: AgentUpdateRecommendation[];
|
|
36
|
+
remove: AgentRemovalRecommendation[];
|
|
37
|
+
}
|
|
13
38
|
export interface ExecutionResult {
|
|
14
39
|
installed: string[];
|
|
15
40
|
updated: string[];
|
|
@@ -26,7 +51,6 @@ export interface ExecutionResult {
|
|
|
26
51
|
export declare class AgentManager {
|
|
27
52
|
private context;
|
|
28
53
|
private agentService;
|
|
29
|
-
private repoService;
|
|
30
54
|
private libraryClient;
|
|
31
55
|
constructor(context: RequestContext);
|
|
32
56
|
/**
|
|
@@ -37,9 +61,5 @@ export declare class AgentManager {
|
|
|
37
61
|
* Fetch full agent data from TBR
|
|
38
62
|
*/
|
|
39
63
|
private fetchAgentData;
|
|
40
|
-
/**
|
|
41
|
-
* Update repository context with current agent state
|
|
42
|
-
*/
|
|
43
|
-
private updateRepositoryContext;
|
|
44
64
|
}
|
|
45
65
|
//# sourceMappingURL=agent-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-manager.d.ts","sourceRoot":"","sources":["../../src/services/agent-manager.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent-manager.d.ts","sourceRoot":"","sources":["../../src/services/agent-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAIlE,OAAO,KAAK,EAGV,YAAY,EACb,MAAM,oCAAoC,CAAC;AAE5C,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,kCAAkC;AAClC,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,mCAAmC;AACnC,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,2CAA2C;AAC3C,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,mBAAmB,EAAE,CAAC;IAC/B,MAAM,EAAE,yBAAyB,EAAE,CAAC;IACpC,MAAM,EAAE,0BAA0B,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACvD;AAED;;GAEG;AACH,qBAAa,YAAY;IAIX,OAAO,CAAC,OAAO;IAH3B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,aAAa,CAAgB;gBAEjB,OAAO,EAAE,cAAc;IAK3C;;OAEG;IACG,sBAAsB,CAC1B,UAAU,EAAE,cAAc,EAC1B,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,eAAe,CAAC;IAoE3B;;OAEG;YACW,cAAc;CAyD7B"}
|
|
@@ -5,24 +5,22 @@
|
|
|
5
5
|
* - Fetching full agent data from TBR
|
|
6
6
|
* - Installing/updating agents via AgentService
|
|
7
7
|
* - Removing deprecated agents via AgentService
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
|
+
* Note: Repository context (tech stack) is now managed by TechContextService
|
|
10
|
+
* via .tiny-brain/analysis.json - CLAUDE.md is no longer modified.
|
|
9
11
|
*/
|
|
10
12
|
import { AgentService } from './agent-service.js';
|
|
11
|
-
import { RepoService } from './repo-service.js';
|
|
12
13
|
import { LibraryClient } from '@magic-ingredients/tiny-brain-core';
|
|
13
|
-
import { getPackageVersion } from '../utils/package-version.js';
|
|
14
14
|
/**
|
|
15
15
|
* Orchestrates agent recommendation execution
|
|
16
16
|
*/
|
|
17
17
|
export class AgentManager {
|
|
18
18
|
context;
|
|
19
19
|
agentService;
|
|
20
|
-
repoService;
|
|
21
20
|
libraryClient;
|
|
22
21
|
constructor(context) {
|
|
23
22
|
this.context = context;
|
|
24
23
|
this.agentService = new AgentService(context);
|
|
25
|
-
this.repoService = new RepoService(context);
|
|
26
24
|
this.libraryClient = new LibraryClient();
|
|
27
25
|
}
|
|
28
26
|
/**
|
|
@@ -69,9 +67,8 @@ export class AgentManager {
|
|
|
69
67
|
});
|
|
70
68
|
});
|
|
71
69
|
}
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
await this.updateRepositoryContext(repoAnalysis, installedAgents);
|
|
70
|
+
// Note: Repository context is now managed by TechContextService
|
|
71
|
+
// via .tiny-brain/analysis.json - no CLAUDE.md update needed
|
|
75
72
|
}
|
|
76
73
|
catch (error) {
|
|
77
74
|
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
@@ -128,29 +125,4 @@ export class AgentManager {
|
|
|
128
125
|
}
|
|
129
126
|
return agentsToProcess;
|
|
130
127
|
}
|
|
131
|
-
/**
|
|
132
|
-
* Update repository context with current agent state
|
|
133
|
-
*/
|
|
134
|
-
async updateRepositoryContext(repoAnalysis, installedAgents) {
|
|
135
|
-
try {
|
|
136
|
-
// Convert to AgentInfo format expected by RepoService
|
|
137
|
-
const agentInfos = installedAgents.map(agent => ({
|
|
138
|
-
name: agent.name,
|
|
139
|
-
description: `Agent ${agent.name}`,
|
|
140
|
-
details: {
|
|
141
|
-
version: agent.version,
|
|
142
|
-
description: `Agent ${agent.name}`
|
|
143
|
-
}
|
|
144
|
-
}));
|
|
145
|
-
// Get current package version to include in context block
|
|
146
|
-
const currentVersion = getPackageVersion();
|
|
147
|
-
// Update context file via RepoService with version
|
|
148
|
-
await this.repoService.writeRepoBlockToContextFile(repoAnalysis, agentInfos, 'CLAUDE.md', currentVersion);
|
|
149
|
-
this.context.logger.info('Updated repository context with installed agents');
|
|
150
|
-
}
|
|
151
|
-
catch (error) {
|
|
152
|
-
// Log but don't fail the operation
|
|
153
|
-
this.context.logger.warn('Failed to update repository context:', error);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
128
|
}
|
|
@@ -10,62 +10,25 @@ export interface AnalyseOptions {
|
|
|
10
10
|
dryRun?: boolean;
|
|
11
11
|
contextPath?: string;
|
|
12
12
|
}
|
|
13
|
-
export interface AgentRecommendation {
|
|
14
|
-
name: string;
|
|
15
|
-
version: string;
|
|
16
|
-
description: string;
|
|
17
|
-
}
|
|
18
|
-
export interface AgentUpdateRecommendation {
|
|
19
|
-
name: string;
|
|
20
|
-
from: string;
|
|
21
|
-
to: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
}
|
|
24
|
-
export interface AgentRemovalRecommendation {
|
|
25
|
-
name: string;
|
|
26
|
-
description?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface SkillInfo {
|
|
29
|
-
name: string;
|
|
30
|
-
version: string;
|
|
31
|
-
}
|
|
32
|
-
export interface AgentRecommendations {
|
|
33
|
-
install: AgentRecommendation[];
|
|
34
|
-
update: AgentUpdateRecommendation[];
|
|
35
|
-
remove: AgentRemovalRecommendation[];
|
|
36
|
-
}
|
|
37
13
|
export interface AnalyseResult {
|
|
38
14
|
analysis: RepoAnalysis;
|
|
39
15
|
isFirstAnalysis: boolean;
|
|
40
16
|
dryRun?: boolean;
|
|
41
17
|
contextPath: string;
|
|
42
|
-
|
|
43
|
-
installedSkills?: SkillInfo[];
|
|
44
|
-
recommendations?: AgentRecommendations | null;
|
|
18
|
+
enableAgenticCoding?: boolean;
|
|
45
19
|
prdInitialized?: boolean;
|
|
46
20
|
adrInitialized?: boolean;
|
|
47
21
|
qualityInitialized?: boolean;
|
|
22
|
+
fixesInitialized?: boolean;
|
|
48
23
|
gitHooksInstalled?: boolean;
|
|
49
24
|
contextBlockVersion?: string;
|
|
50
25
|
contextBlockUpdated?: boolean;
|
|
51
26
|
changes?: {
|
|
52
27
|
techStackAdded: string[];
|
|
53
28
|
techStackRemoved: string[];
|
|
54
|
-
agentsSuggestedNew: string[];
|
|
55
|
-
agentsSuggestedRemove: string[];
|
|
56
29
|
};
|
|
57
30
|
skillPermissionsAdded?: string[];
|
|
58
|
-
|
|
59
|
-
export interface AppliedRecommendationsSummary {
|
|
60
|
-
installed: string[];
|
|
61
|
-
updated: string[];
|
|
62
|
-
removed: string[];
|
|
63
|
-
errors: string[];
|
|
64
|
-
}
|
|
65
|
-
export interface UserSelections {
|
|
66
|
-
install: AgentRecommendation[];
|
|
67
|
-
update: AgentUpdateRecommendation[];
|
|
68
|
-
remove: AgentRemovalRecommendation[];
|
|
31
|
+
writtenTechContexts?: string[];
|
|
69
32
|
}
|
|
70
33
|
/**
|
|
71
34
|
* Service for managing repository analysis
|
|
@@ -76,27 +39,12 @@ export declare class AnalyseService {
|
|
|
76
39
|
private repoService;
|
|
77
40
|
private libraryClient;
|
|
78
41
|
private configService;
|
|
42
|
+
private techContextService;
|
|
79
43
|
constructor(context: RequestContext);
|
|
80
44
|
/**
|
|
81
45
|
* Perform repository analysis with unified behavior for initialized/uninitialized repos
|
|
82
46
|
*/
|
|
83
47
|
performAnalysis(options?: AnalyseOptions): Promise<AnalyseResult>;
|
|
84
|
-
/**
|
|
85
|
-
* Extract version from SKILL.md frontmatter
|
|
86
|
-
* @param skillPath - Path to SKILL.md file
|
|
87
|
-
* @returns Version string or null if not found
|
|
88
|
-
*/
|
|
89
|
-
private extractSkillVersion;
|
|
90
|
-
/**
|
|
91
|
-
* Install a single skill with its templates
|
|
92
|
-
* @param skillName - Name of the skill (e.g., 'plan', 'feature', 'fix')
|
|
93
|
-
* @param templates - Array of template files to copy
|
|
94
|
-
* @param skillsDir - Target skills directory
|
|
95
|
-
* @param srcSkillsDir - Source skills directory
|
|
96
|
-
* @param srcTemplatesDir - Source templates directory
|
|
97
|
-
* @returns true if skill was installed/updated
|
|
98
|
-
*/
|
|
99
|
-
private installSkill;
|
|
100
48
|
/**
|
|
101
49
|
* Register repository in dashboard for visibility
|
|
102
50
|
* Called after successful analysis regardless of invocation method
|
|
@@ -107,20 +55,25 @@ export declare class AnalyseService {
|
|
|
107
55
|
*/
|
|
108
56
|
private countPrdsInRepo;
|
|
109
57
|
/**
|
|
110
|
-
* Initialize
|
|
111
|
-
* @returns true if
|
|
58
|
+
* Initialize PRD directory structure for SDD workflow
|
|
59
|
+
* @returns true if directory was created
|
|
112
60
|
*/
|
|
113
|
-
private
|
|
61
|
+
private initializePrdDirectory;
|
|
114
62
|
/**
|
|
115
|
-
* Initialize ADR
|
|
116
|
-
* @returns true if
|
|
63
|
+
* Initialize ADR directory structure
|
|
64
|
+
* @returns true if directory was created
|
|
117
65
|
*/
|
|
118
|
-
private
|
|
66
|
+
private initializeAdrDirectory;
|
|
119
67
|
/**
|
|
120
|
-
* Initialize Quality
|
|
121
|
-
* @returns true if
|
|
68
|
+
* Initialize Quality directory structure
|
|
69
|
+
* @returns true if directory was created
|
|
122
70
|
*/
|
|
123
|
-
private
|
|
71
|
+
private initializeQualityDirectory;
|
|
72
|
+
/**
|
|
73
|
+
* Initialize fixes tracking directory
|
|
74
|
+
* @returns true if directory was created
|
|
75
|
+
*/
|
|
76
|
+
private initializeFixesDirectory;
|
|
124
77
|
/**
|
|
125
78
|
* Initialize git hooks for TDD workflow
|
|
126
79
|
* Copies hook templates to .git/hooks/ if not already present
|
|
@@ -134,39 +87,19 @@ export declare class AnalyseService {
|
|
|
134
87
|
*/
|
|
135
88
|
private injectSkillPermissions;
|
|
136
89
|
/**
|
|
137
|
-
*
|
|
138
|
-
*
|
|
90
|
+
* Fetch tech contexts from TBR and write them to .tiny-brain/tech/
|
|
91
|
+
* Only called when enableAgenticCoding=false
|
|
139
92
|
*/
|
|
140
|
-
private
|
|
141
|
-
/**
|
|
142
|
-
* Fetch agent recommendations from TBR based on repo analysis and current agents
|
|
143
|
-
*/
|
|
144
|
-
private fetchRecommendationsFromTBR;
|
|
93
|
+
private fetchAndWriteTechContexts;
|
|
145
94
|
/**
|
|
146
95
|
* Format analysis output for display
|
|
147
96
|
*/
|
|
148
97
|
formatAnalysisOutput(result: AnalyseResult): string;
|
|
149
|
-
/**
|
|
150
|
-
* Format recommendations section for output
|
|
151
|
-
*/
|
|
152
|
-
private formatRecommendations;
|
|
153
|
-
/**
|
|
154
|
-
* Format skills help text explaining model-invoked behavior
|
|
155
|
-
*/
|
|
156
|
-
private formatSkillsHelpText;
|
|
157
98
|
/**
|
|
158
99
|
* Compare two tech stacks and return differences
|
|
159
100
|
* Handles null previous analysis (first run)
|
|
160
101
|
*/
|
|
161
102
|
compareTechStacks(previousAnalysis: RepoAnalysis | null, currentAnalysis: RepoAnalysis): TechStackDiff;
|
|
162
|
-
/**
|
|
163
|
-
* Prompt user for selection of recommendations to apply
|
|
164
|
-
* Always requires user confirmation - defaults to 'all' but user must confirm
|
|
165
|
-
*/
|
|
166
|
-
promptForSelection(recommendations: AgentRecommendations, promptFn?: (question: string, options?: {
|
|
167
|
-
default?: string;
|
|
168
|
-
choices?: string[];
|
|
169
|
-
}) => Promise<string>): Promise<UserSelections>;
|
|
170
103
|
/**
|
|
171
104
|
* Check if tiny-brain block needs updating based on version
|
|
172
105
|
* @param existingContent - Content containing existing tiny-brain block
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyse-service.d.ts","sourceRoot":"","sources":["../../src/services/analyse-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;A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