@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
|
@@ -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,61 +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
|
-
|
|
58
|
-
|
|
59
|
-
installed: string[];
|
|
60
|
-
updated: string[];
|
|
61
|
-
removed: string[];
|
|
62
|
-
errors: string[];
|
|
63
|
-
}
|
|
64
|
-
export interface UserSelections {
|
|
65
|
-
install: AgentRecommendation[];
|
|
66
|
-
update: AgentUpdateRecommendation[];
|
|
67
|
-
remove: AgentRemovalRecommendation[];
|
|
30
|
+
skillPermissionsAdded?: string[];
|
|
31
|
+
writtenTechContexts?: string[];
|
|
68
32
|
}
|
|
69
33
|
/**
|
|
70
34
|
* Service for managing repository analysis
|
|
@@ -75,27 +39,12 @@ export declare class AnalyseService {
|
|
|
75
39
|
private repoService;
|
|
76
40
|
private libraryClient;
|
|
77
41
|
private configService;
|
|
42
|
+
private techContextService;
|
|
78
43
|
constructor(context: RequestContext);
|
|
79
44
|
/**
|
|
80
45
|
* Perform repository analysis with unified behavior for initialized/uninitialized repos
|
|
81
46
|
*/
|
|
82
47
|
performAnalysis(options?: AnalyseOptions): Promise<AnalyseResult>;
|
|
83
|
-
/**
|
|
84
|
-
* Extract version from SKILL.md frontmatter
|
|
85
|
-
* @param skillPath - Path to SKILL.md file
|
|
86
|
-
* @returns Version string or null if not found
|
|
87
|
-
*/
|
|
88
|
-
private extractSkillVersion;
|
|
89
|
-
/**
|
|
90
|
-
* Install a single skill with its templates
|
|
91
|
-
* @param skillName - Name of the skill (e.g., 'plan', 'feature', 'fix')
|
|
92
|
-
* @param templates - Array of template files to copy
|
|
93
|
-
* @param skillsDir - Target skills directory
|
|
94
|
-
* @param srcSkillsDir - Source skills directory
|
|
95
|
-
* @param srcTemplatesDir - Source templates directory
|
|
96
|
-
* @returns true if skill was installed/updated
|
|
97
|
-
*/
|
|
98
|
-
private installSkill;
|
|
99
48
|
/**
|
|
100
49
|
* Register repository in dashboard for visibility
|
|
101
50
|
* Called after successful analysis regardless of invocation method
|
|
@@ -106,20 +55,25 @@ export declare class AnalyseService {
|
|
|
106
55
|
*/
|
|
107
56
|
private countPrdsInRepo;
|
|
108
57
|
/**
|
|
109
|
-
* Initialize
|
|
110
|
-
* @returns true if
|
|
58
|
+
* Initialize PRD directory structure for SDD workflow
|
|
59
|
+
* @returns true if directory was created
|
|
60
|
+
*/
|
|
61
|
+
private initializePrdDirectory;
|
|
62
|
+
/**
|
|
63
|
+
* Initialize ADR directory structure
|
|
64
|
+
* @returns true if directory was created
|
|
111
65
|
*/
|
|
112
|
-
private
|
|
66
|
+
private initializeAdrDirectory;
|
|
113
67
|
/**
|
|
114
|
-
* Initialize
|
|
115
|
-
* @returns true if
|
|
68
|
+
* Initialize Quality directory structure
|
|
69
|
+
* @returns true if directory was created
|
|
116
70
|
*/
|
|
117
|
-
private
|
|
71
|
+
private initializeQualityDirectory;
|
|
118
72
|
/**
|
|
119
|
-
* Initialize
|
|
120
|
-
* @returns true if
|
|
73
|
+
* Initialize fixes tracking directory
|
|
74
|
+
* @returns true if directory was created
|
|
121
75
|
*/
|
|
122
|
-
private
|
|
76
|
+
private initializeFixesDirectory;
|
|
123
77
|
/**
|
|
124
78
|
* Initialize git hooks for TDD workflow
|
|
125
79
|
* Copies hook templates to .git/hooks/ if not already present
|
|
@@ -127,39 +81,25 @@ export declare class AnalyseService {
|
|
|
127
81
|
*/
|
|
128
82
|
private initializeGitHooks;
|
|
129
83
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
84
|
+
* Inject skill permissions into .claude/settings.json
|
|
85
|
+
* These permissions allow skills to read/write to specific directories without prompts
|
|
86
|
+
* @returns Array of permissions that were added (empty if none added)
|
|
132
87
|
*/
|
|
133
|
-
private
|
|
88
|
+
private injectSkillPermissions;
|
|
134
89
|
/**
|
|
135
|
-
* Fetch
|
|
90
|
+
* Fetch tech contexts from TBR and write them to .tiny-brain/tech/
|
|
91
|
+
* Only called when enableAgenticCoding=false
|
|
136
92
|
*/
|
|
137
|
-
private
|
|
93
|
+
private fetchAndWriteTechContexts;
|
|
138
94
|
/**
|
|
139
95
|
* Format analysis output for display
|
|
140
96
|
*/
|
|
141
97
|
formatAnalysisOutput(result: AnalyseResult): string;
|
|
142
|
-
/**
|
|
143
|
-
* Format recommendations section for output
|
|
144
|
-
*/
|
|
145
|
-
private formatRecommendations;
|
|
146
|
-
/**
|
|
147
|
-
* Format skills help text explaining model-invoked behavior
|
|
148
|
-
*/
|
|
149
|
-
private formatSkillsHelpText;
|
|
150
98
|
/**
|
|
151
99
|
* Compare two tech stacks and return differences
|
|
152
100
|
* Handles null previous analysis (first run)
|
|
153
101
|
*/
|
|
154
102
|
compareTechStacks(previousAnalysis: RepoAnalysis | null, currentAnalysis: RepoAnalysis): TechStackDiff;
|
|
155
|
-
/**
|
|
156
|
-
* Prompt user for selection of recommendations to apply
|
|
157
|
-
* Always requires user confirmation - defaults to 'all' but user must confirm
|
|
158
|
-
*/
|
|
159
|
-
promptForSelection(recommendations: AgentRecommendations, promptFn?: (question: string, options?: {
|
|
160
|
-
default?: string;
|
|
161
|
-
choices?: string[];
|
|
162
|
-
}) => Promise<string>): Promise<UserSelections>;
|
|
163
103
|
/**
|
|
164
104
|
* Check if tiny-brain block needs updating based on version
|
|
165
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;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,aAAa,EAInB,MAAM,oCAAoC,CAAC;AAW5C,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;
|
|
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,EAInB,MAAM,oCAAoC,CAAC;AAW5C,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAGD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,YAAY,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE;QACR,cAAc,EAAE,MAAM,EAAE,CAAC;QACzB,gBAAgB,EAAE,MAAM,EAAE,CAAC;KAC5B,CAAC;IACF,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC;AAGD;;;GAGG;AACH,qBAAa,cAAc;IAMb,OAAO,CAAC,OAAO;IAL3B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,kBAAkB,CAAqB;gBAE3B,OAAO,EAAE,cAAc;IAO3C;;OAEG;IACG,eAAe,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,aAAa,CAAC;IAwJ3E;;;OAGG;YACW,kBAAkB;IAoBhC;;OAEG;YACW,eAAe;IAc7B;;;OAGG;YACW,sBAAsB;IAwBpC;;;OAGG;YACW,sBAAsB;IAwBpC;;;OAGG;YACW,0BAA0B;IAwBxC;;;OAGG;YACW,wBAAwB;IAwBtC;;;;OAIG;YACW,kBAAkB;IA+EhC;;;;OAIG;YACW,sBAAsB;IAiEpC;;;OAGG;YACW,yBAAyB;IAkCvC;;OAEG;IACH,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM;IAiHnD;;;OAGG;IACH,iBAAiB,CAAC,gBAAgB,EAAE,YAAY,GAAG,IAAI,EAAE,eAAe,EAAE,YAAY,GAAG,aAAa;IA8BtG;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAY5B;;;;;OAKG;IACH,OAAO,CAAC,eAAe;CAWxB"}
|