codingbuddy 0.0.0-canary.20260101071903.14d223c → 0.0.0-canary.20260105020105.901e4c5
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/src/custom/custom.module.d.ts +2 -0
- package/dist/src/custom/custom.module.js +21 -0
- package/dist/src/custom/custom.module.js.map +1 -0
- package/dist/src/custom/custom.service.d.ts +8 -0
- package/dist/src/custom/custom.service.js +134 -0
- package/dist/src/custom/custom.service.js.map +1 -0
- package/dist/src/custom/custom.types.d.ts +33 -0
- package/dist/src/custom/custom.types.js +10 -0
- package/dist/src/custom/custom.types.js.map +1 -0
- package/dist/src/custom/index.d.ts +3 -0
- package/dist/src/custom/index.js +20 -0
- package/dist/src/custom/index.js.map +1 -0
- package/dist/src/rules/rules.module.js +2 -0
- package/dist/src/rules/rules.module.js.map +1 -1
- package/dist/src/rules/rules.service.d.ts +3 -1
- package/dist/src/rules/rules.service.js +27 -4
- package/dist/src/rules/rules.service.js.map +1 -1
- package/dist/src/rules/rules.types.d.ts +3 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CustomModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const custom_service_1 = require("./custom.service");
|
|
12
|
+
let CustomModule = class CustomModule {
|
|
13
|
+
};
|
|
14
|
+
exports.CustomModule = CustomModule;
|
|
15
|
+
exports.CustomModule = CustomModule = __decorate([
|
|
16
|
+
(0, common_1.Module)({
|
|
17
|
+
providers: [custom_service_1.CustomService],
|
|
18
|
+
exports: [custom_service_1.CustomService],
|
|
19
|
+
})
|
|
20
|
+
], CustomModule);
|
|
21
|
+
//# sourceMappingURL=custom.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.module.js","sourceRoot":"","sources":["../../../src/custom/custom.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AAM1C,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,oCAAY;uBAAZ,YAAY;IAJxB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,8BAAa,CAAC;QAC1B,OAAO,EAAE,CAAC,8BAAa,CAAC;KACzB,CAAC;GACW,YAAY,CAAG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CustomRule, CustomAgent, CustomSkill } from './custom.types';
|
|
2
|
+
export declare class CustomService {
|
|
3
|
+
private readonly logger;
|
|
4
|
+
findCustomPath(projectRoot: string): Promise<string | null>;
|
|
5
|
+
listCustomRules(projectRoot: string): Promise<CustomRule[]>;
|
|
6
|
+
listCustomAgents(projectRoot: string): Promise<CustomAgent[]>;
|
|
7
|
+
listCustomSkills(projectRoot: string): Promise<CustomSkill[]>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var CustomService_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.CustomService = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const fs = require("fs/promises");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
const custom_types_1 = require("./custom.types");
|
|
15
|
+
let CustomService = CustomService_1 = class CustomService {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.logger = new common_1.Logger(CustomService_1.name);
|
|
18
|
+
}
|
|
19
|
+
async findCustomPath(projectRoot) {
|
|
20
|
+
const customPath = path.join(projectRoot, custom_types_1.CUSTOM_DIR);
|
|
21
|
+
try {
|
|
22
|
+
await fs.access(customPath);
|
|
23
|
+
this.logger.debug(`Found custom rules at: ${customPath}`);
|
|
24
|
+
return customPath;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async listCustomRules(projectRoot) {
|
|
31
|
+
const customPath = await this.findCustomPath(projectRoot);
|
|
32
|
+
if (!customPath)
|
|
33
|
+
return [];
|
|
34
|
+
const rulesPath = path.join(customPath, custom_types_1.CUSTOM_SUBDIRS.rules);
|
|
35
|
+
try {
|
|
36
|
+
await fs.access(rulesPath);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
const entries = await fs.readdir(rulesPath, { withFileTypes: true });
|
|
42
|
+
const rules = [];
|
|
43
|
+
for (const entry of entries) {
|
|
44
|
+
if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
45
|
+
const filePath = path.join(rulesPath, entry.name);
|
|
46
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
47
|
+
rules.push({
|
|
48
|
+
type: 'rule',
|
|
49
|
+
name: entry.name,
|
|
50
|
+
path: filePath,
|
|
51
|
+
content,
|
|
52
|
+
source: 'custom',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return rules;
|
|
57
|
+
}
|
|
58
|
+
async listCustomAgents(projectRoot) {
|
|
59
|
+
const customPath = await this.findCustomPath(projectRoot);
|
|
60
|
+
if (!customPath)
|
|
61
|
+
return [];
|
|
62
|
+
const agentsPath = path.join(customPath, custom_types_1.CUSTOM_SUBDIRS.agents);
|
|
63
|
+
try {
|
|
64
|
+
await fs.access(agentsPath);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
const entries = await fs.readdir(agentsPath, { withFileTypes: true });
|
|
70
|
+
const agents = [];
|
|
71
|
+
for (const entry of entries) {
|
|
72
|
+
if (entry.isFile() && entry.name.endsWith('.json')) {
|
|
73
|
+
const filePath = path.join(agentsPath, entry.name);
|
|
74
|
+
try {
|
|
75
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
76
|
+
const parsed = JSON.parse(content);
|
|
77
|
+
if (!parsed.name || !parsed.description || !parsed.role) {
|
|
78
|
+
this.logger.warn(`Invalid agent file (missing required fields): ${filePath}`);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
agents.push({
|
|
82
|
+
type: 'agent',
|
|
83
|
+
name: entry.name,
|
|
84
|
+
path: filePath,
|
|
85
|
+
content,
|
|
86
|
+
source: 'custom',
|
|
87
|
+
parsed,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
this.logger.warn(`Invalid JSON in agent file: ${filePath}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return agents;
|
|
96
|
+
}
|
|
97
|
+
async listCustomSkills(projectRoot) {
|
|
98
|
+
const customPath = await this.findCustomPath(projectRoot);
|
|
99
|
+
if (!customPath)
|
|
100
|
+
return [];
|
|
101
|
+
const skillsPath = path.join(customPath, custom_types_1.CUSTOM_SUBDIRS.skills);
|
|
102
|
+
try {
|
|
103
|
+
await fs.access(skillsPath);
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
const entries = await fs.readdir(skillsPath, { withFileTypes: true });
|
|
109
|
+
const skills = [];
|
|
110
|
+
for (const entry of entries) {
|
|
111
|
+
if (entry.isDirectory()) {
|
|
112
|
+
const skillFile = path.join(skillsPath, entry.name, 'SKILL.md');
|
|
113
|
+
try {
|
|
114
|
+
const content = await fs.readFile(skillFile, 'utf-8');
|
|
115
|
+
skills.push({
|
|
116
|
+
type: 'skill',
|
|
117
|
+
name: entry.name,
|
|
118
|
+
path: skillFile,
|
|
119
|
+
content,
|
|
120
|
+
source: 'custom',
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return skills;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
exports.CustomService = CustomService;
|
|
131
|
+
exports.CustomService = CustomService = CustomService_1 = __decorate([
|
|
132
|
+
(0, common_1.Injectable)()
|
|
133
|
+
], CustomService);
|
|
134
|
+
//# sourceMappingURL=custom.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.service.js","sourceRoot":"","sources":["../../../src/custom/custom.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAoD;AACpD,kCAAkC;AAClC,6BAA6B;AAC7B,iDAOwB;AAGjB,IAAM,aAAa,qBAAnB,MAAM,aAAa;IAAnB;QACY,WAAM,GAAG,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;IA6H3D,CAAC;IA3HC,KAAK,CAAC,cAAc,CAAC,WAAmB;QACtC,MAAM,UAAU,GAAG,IAAI,CAA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AAG,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;oBACtD,MAAM,CAAC,IAAI,CAAC;wBACV,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,KAAK,CAAC,IAAI;wBAChB,IAAI,EAAE,SAAS;wBACf,OAAO;wBACP,MAAM,EAAE,QAAQ;qBACjB,CAAC,CAAC;gBACL,CAAC;gBAAC,MAAM,CAAC;gBAET,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AA9HY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CA8HzB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface CustomFile {
|
|
2
|
+
name: string;
|
|
3
|
+
path: string;
|
|
4
|
+
content: string;
|
|
5
|
+
source: 'custom' | 'default';
|
|
6
|
+
}
|
|
7
|
+
export interface CustomRule extends CustomFile {
|
|
8
|
+
type: 'rule';
|
|
9
|
+
}
|
|
10
|
+
export interface CustomAgent extends CustomFile {
|
|
11
|
+
type: 'agent';
|
|
12
|
+
parsed: CustomAgentSchema;
|
|
13
|
+
}
|
|
14
|
+
export interface CustomSkill extends CustomFile {
|
|
15
|
+
type: 'skill';
|
|
16
|
+
}
|
|
17
|
+
export interface CustomAgentSchema {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
role: {
|
|
21
|
+
title: string;
|
|
22
|
+
expertise: string[];
|
|
23
|
+
tech_stack_reference?: string;
|
|
24
|
+
responsibilities?: string[];
|
|
25
|
+
};
|
|
26
|
+
[key: string]: unknown;
|
|
27
|
+
}
|
|
28
|
+
export declare const CUSTOM_DIR = ".codingbuddy";
|
|
29
|
+
export declare const CUSTOM_SUBDIRS: {
|
|
30
|
+
readonly rules: "rules";
|
|
31
|
+
readonly agents: "agents";
|
|
32
|
+
readonly skills: "skills";
|
|
33
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CUSTOM_SUBDIRS = exports.CUSTOM_DIR = void 0;
|
|
4
|
+
exports.CUSTOM_DIR = '.codingbuddy';
|
|
5
|
+
exports.CUSTOM_SUBDIRS = {
|
|
6
|
+
rules: 'rules',
|
|
7
|
+
agents: 'agents',
|
|
8
|
+
skills: 'skills',
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=custom.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.types.js","sourceRoot":"","sources":["../../../src/custom/custom.types.ts"],"names":[],"mappings":";;;AAoCa,QAAA,UAAU,GAAG,cAAc,CAAC;AAE5B,QAAA,cAAc,GAAG;IAC5B,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACR,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./custom.module"), exports);
|
|
18
|
+
__exportStar(require("./custom.service"), exports);
|
|
19
|
+
__exportStar(require("./custom.types"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/custom/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,mDAAiC;AACjC,iDAA+B"}
|
|
@@ -9,11 +9,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.RulesModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const rules_service_1 = require("./rules.service");
|
|
12
|
+
const custom_1 = require("../custom");
|
|
12
13
|
let RulesModule = class RulesModule {
|
|
13
14
|
};
|
|
14
15
|
exports.RulesModule = RulesModule;
|
|
15
16
|
exports.RulesModule = RulesModule = __decorate([
|
|
16
17
|
(0, common_1.Module)({
|
|
18
|
+
imports: [custom_1.CustomModule],
|
|
17
19
|
providers: [rules_service_1.RulesService],
|
|
18
20
|
exports: [rules_service_1.RulesService],
|
|
19
21
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.module.js","sourceRoot":"","sources":["../../../src/rules/rules.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,mDAA+C;
|
|
1
|
+
{"version":3,"file":"rules.module.js","sourceRoot":"","sources":["../../../src/rules/rules.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,mDAA+C;AAC/C,sCAAyC;AAOlC,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,kCAAW;sBAAX,WAAW;IALvB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,qBAAY,CAAC;QACvB,SAAS,EAAE,CAAC,4BAAY,CAAC;QACzB,OAAO,EAAE,CAAC,4BAAY,CAAC;KACxB,CAAC;GACW,WAAW,CAAG"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AgentProfile, SearchResult } from './rules.types';
|
|
2
|
+
import { CustomService } from '../custom';
|
|
2
3
|
export declare class RulesService {
|
|
4
|
+
private readonly customService;
|
|
3
5
|
private readonly logger;
|
|
4
6
|
private readonly rulesDir;
|
|
5
|
-
constructor();
|
|
7
|
+
constructor(customService: CustomService);
|
|
6
8
|
private findDevRulesDir;
|
|
7
9
|
private checkExists;
|
|
8
10
|
getRuleContent(relativePath: string): Promise<string>;
|
|
@@ -17,8 +17,10 @@ const fs_1 = require("fs");
|
|
|
17
17
|
const path = require("path");
|
|
18
18
|
const security_utils_1 = require("../shared/security.utils");
|
|
19
19
|
const agent_schema_1 = require("./agent.schema");
|
|
20
|
+
const custom_1 = require("../custom");
|
|
20
21
|
let RulesService = RulesService_1 = class RulesService {
|
|
21
|
-
constructor() {
|
|
22
|
+
constructor(customService) {
|
|
23
|
+
this.customService = customService;
|
|
22
24
|
this.logger = new common_1.Logger(RulesService_1.name);
|
|
23
25
|
if (process.env.CODINGBUDDY_RULES_DIR) {
|
|
24
26
|
this.rulesDir = process.env.CODINGBUDDY_RULES_DIR;
|
|
@@ -90,7 +92,7 @@ let RulesService = RulesService_1 = class RulesService {
|
|
|
90
92
|
try {
|
|
91
93
|
const parsed = JSON.parse(content);
|
|
92
94
|
const validated = (0, agent_schema_1.parseAgentProfile)(parsed);
|
|
93
|
-
return validated;
|
|
95
|
+
return { ...validated, source: 'default' };
|
|
94
96
|
}
|
|
95
97
|
catch (error) {
|
|
96
98
|
if (error instanceof agent_schema_1.AgentSchemaError) {
|
|
@@ -103,6 +105,27 @@ let RulesService = RulesService_1 = class RulesService {
|
|
|
103
105
|
async searchRules(query) {
|
|
104
106
|
const results = [];
|
|
105
107
|
const queryLower = query.toLowerCase();
|
|
108
|
+
const projectRoot = process.cwd();
|
|
109
|
+
const customRules = await this.customService.listCustomRules(projectRoot);
|
|
110
|
+
for (const customRule of customRules) {
|
|
111
|
+
const lines = customRule.content.split('\n');
|
|
112
|
+
const matches = [];
|
|
113
|
+
let score = 0;
|
|
114
|
+
lines.forEach((line, index) => {
|
|
115
|
+
if (line.toLowerCase().includes(queryLower)) {
|
|
116
|
+
matches.push(`Line ${index + 1}: ${line.trim()}`);
|
|
117
|
+
score++;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
if (score > 0) {
|
|
121
|
+
results.push({
|
|
122
|
+
file: customRule.name,
|
|
123
|
+
matches,
|
|
124
|
+
score,
|
|
125
|
+
source: 'custom',
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
106
129
|
const agents = await this.listAgents();
|
|
107
130
|
const filesToSearch = [
|
|
108
131
|
'rules/core.md',
|
|
@@ -123,7 +146,7 @@ let RulesService = RulesService_1 = class RulesService {
|
|
|
123
146
|
}
|
|
124
147
|
});
|
|
125
148
|
if (score > 0) {
|
|
126
|
-
results.push({ file, matches, score });
|
|
149
|
+
results.push({ file, matches, score, source: 'default' });
|
|
127
150
|
}
|
|
128
151
|
}
|
|
129
152
|
catch {
|
|
@@ -135,6 +158,6 @@ let RulesService = RulesService_1 = class RulesService {
|
|
|
135
158
|
exports.RulesService = RulesService;
|
|
136
159
|
exports.RulesService = RulesService = RulesService_1 = __decorate([
|
|
137
160
|
(0, common_1.Injectable)(),
|
|
138
|
-
__metadata("design:paramtypes", [])
|
|
161
|
+
__metadata("design:paramtypes", [custom_1.CustomService])
|
|
139
162
|
], RulesService);
|
|
140
163
|
//# sourceMappingURL=rules.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.service.js","sourceRoot":"","sources":["../../../src/rules/rules.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,kCAAkC;AAClC,2BAAgC;AAChC,6BAA6B;AAE7B,6DAAsD;AACtD,iDAAqE;
|
|
1
|
+
{"version":3,"file":"rules.service.js","sourceRoot":"","sources":["../../../src/rules/rules.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAA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AAM,OAAO,GAAa,EAAE,CAAC;gBAC7B,IAAI,KAAK,GAAG,CAAC,CAAC;gBAEd,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;oBAC5B,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;wBAC5C,OAAO,CAAC,IAAI,CAAC,QAAQ,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;wBAClD,KAAK,EAAE,CAAC;oBACV,CAAC;gBACH,CAAC,CAAC,CAAC;gBAEH,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;oBACd,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;gBAC5D,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;YAET,CAAC;QACH,CAAC;QAED,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;CACF,CAAA;AAzKY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;qCAKiC,sBAAa;GAJ9C,YAAY,CAyKxB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type RuleSource = 'custom' | 'default';
|
|
1
2
|
export interface AgentProfile {
|
|
2
3
|
name: string;
|
|
3
4
|
description: string;
|
|
@@ -7,10 +8,12 @@ export interface AgentProfile {
|
|
|
7
8
|
tech_stack_reference?: string;
|
|
8
9
|
responsibilities?: string[];
|
|
9
10
|
};
|
|
11
|
+
source?: RuleSource;
|
|
10
12
|
[key: string]: unknown;
|
|
11
13
|
}
|
|
12
14
|
export interface SearchResult {
|
|
13
15
|
file: string;
|
|
14
16
|
matches: string[];
|
|
15
17
|
score: number;
|
|
18
|
+
source?: RuleSource;
|
|
16
19
|
}
|