@diff-review-system/drs 1.0.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/.opencode/agent/github-reviewer.md +62 -0
- package/.opencode/agent/gitlab-reviewer.md +62 -0
- package/.opencode/agent/local-reviewer.md +71 -0
- package/.opencode/agent/review/performance.md +151 -0
- package/.opencode/agent/review/quality.md +127 -0
- package/.opencode/agent/review/security.md +115 -0
- package/.opencode/agent/review/style.md +116 -0
- package/.opencode/opencode.jsonc +52 -0
- package/LICENSE +201 -0
- package/README.md +361 -0
- package/dist/ci/runner.d.ts +21 -0
- package/dist/ci/runner.d.ts.map +1 -0
- package/dist/ci/runner.js +82 -0
- package/dist/ci/runner.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +137 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init.d.ts +5 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +166 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/review-local.d.ts +9 -0
- package/dist/cli/review-local.d.ts.map +1 -0
- package/dist/cli/review-local.js +105 -0
- package/dist/cli/review-local.js.map +1 -0
- package/dist/cli/review-mr.d.ts +11 -0
- package/dist/cli/review-mr.d.ts.map +1 -0
- package/dist/cli/review-mr.js +128 -0
- package/dist/cli/review-mr.js.map +1 -0
- package/dist/cli/review-pr.d.ts +12 -0
- package/dist/cli/review-pr.d.ts.map +1 -0
- package/dist/cli/review-pr.js +125 -0
- package/dist/cli/review-pr.js.map +1 -0
- package/dist/github/client.d.ts +1346 -0
- package/dist/github/client.d.ts.map +1 -0
- package/dist/github/client.js +137 -0
- package/dist/github/client.js.map +1 -0
- package/dist/gitlab/client.d.ts +55 -0
- package/dist/gitlab/client.d.ts.map +1 -0
- package/dist/gitlab/client.js +86 -0
- package/dist/gitlab/client.js.map +1 -0
- package/dist/gitlab/comment-formatter.d.ts +36 -0
- package/dist/gitlab/comment-formatter.d.ts.map +1 -0
- package/dist/gitlab/comment-formatter.js +118 -0
- package/dist/gitlab/comment-formatter.js.map +1 -0
- package/dist/gitlab/diff-parser.d.ts +41 -0
- package/dist/gitlab/diff-parser.d.ts.map +1 -0
- package/dist/gitlab/diff-parser.js +147 -0
- package/dist/gitlab/diff-parser.js.map +1 -0
- package/dist/lib/config.d.ts +42 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +144 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/opencode/agent-loader.d.ts +31 -0
- package/dist/opencode/agent-loader.d.ts.map +1 -0
- package/dist/opencode/agent-loader.js +115 -0
- package/dist/opencode/agent-loader.js.map +1 -0
- package/dist/opencode/client.d.ts +82 -0
- package/dist/opencode/client.d.ts.map +1 -0
- package/dist/opencode/client.js +184 -0
- package/dist/opencode/client.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-parser.js","sourceRoot":"","sources":["../../src/gitlab/diff-parser.ts"],"names":[],"mappings":"AAwBA;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,QAAgB;IACxC,MAAM,KAAK,GAAiB,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEnC,IAAI,WAAW,GAAsB,IAAI,CAAC;IAC1C,IAAI,WAAW,GAAoB,IAAI,CAAC;IACxC,IAAI,aAAa,GAAG,CAAC,CAAC;IACtB,IAAI,aAAa,GAAG,CAAC,CAAC;IAEtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAEtB,wCAAwC;QACxC,IAAI,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAClC,IAAI,WAAW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I,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBAC9C,KAAK,CAAC,IAAI,CAAC;oBACT,IAAI,EAAE,IAAI,CAAC,aAAa;oBACxB,OAAO,EAAE,IAAI,CAAC,OAAO;iBACtB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAgB,EAAE,OAAe;IACnE,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;QAC9B,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBACtD,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface DRSConfig {
|
|
2
|
+
opencode: {
|
|
3
|
+
serverUrl: string;
|
|
4
|
+
};
|
|
5
|
+
gitlab: {
|
|
6
|
+
url: string;
|
|
7
|
+
token: string;
|
|
8
|
+
};
|
|
9
|
+
github: {
|
|
10
|
+
token: string;
|
|
11
|
+
};
|
|
12
|
+
review: {
|
|
13
|
+
agents: string[];
|
|
14
|
+
autoReview: boolean;
|
|
15
|
+
reviewOnMention: boolean;
|
|
16
|
+
reviewOnLabel: string[];
|
|
17
|
+
ignorePatterns: string[];
|
|
18
|
+
includePatterns?: string[];
|
|
19
|
+
};
|
|
20
|
+
output: {
|
|
21
|
+
format: 'gitlab' | 'github' | 'terminal' | 'json' | 'markdown';
|
|
22
|
+
verbosity: 'minimal' | 'normal' | 'detailed';
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Load configuration from various sources with precedence:
|
|
27
|
+
* 1. CLI arguments (passed as overrides)
|
|
28
|
+
* 2. Environment variables
|
|
29
|
+
* 3. .drs/drs.config.yaml or .drs/drs.config.json
|
|
30
|
+
* 4. .gitlab-review.yml
|
|
31
|
+
* 5. Default values
|
|
32
|
+
*/
|
|
33
|
+
export declare function loadConfig(projectPath?: string, overrides?: Partial<DRSConfig>): DRSConfig;
|
|
34
|
+
/**
|
|
35
|
+
* Validate that required configuration is present
|
|
36
|
+
*/
|
|
37
|
+
export declare function validateConfig(config: DRSConfig, platform?: 'gitlab' | 'github'): void;
|
|
38
|
+
/**
|
|
39
|
+
* Check if a file should be ignored based on patterns
|
|
40
|
+
*/
|
|
41
|
+
export declare function shouldIgnoreFile(filePath: string, config: DRSConfig): boolean;
|
|
42
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,SAAS;IAExB,QAAQ,EAAE;QACR,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IAGF,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAGF,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAGF,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,UAAU,EAAE,OAAO,CAAC;QACpB,eAAe,EAAE,OAAO,CAAC;QACzB,aAAa,EAAE,MAAM,EAAE,CAAC;QACxB,cAAc,EAAE,MAAM,EAAE,CAAC;QACzB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;KAC5B,CAAC;IAGF,MAAM,EAAE;QACN,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;QAC/D,SAAS,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;KAC9C,CAAC;CACH;AAmCD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,WAAW,CAAC,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAC7B,SAAS,CAyCX;AAeD;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,IAAI,CAsBtF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAqB7E"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { readFileSync, existsSync } from 'fs';
|
|
2
|
+
import { resolve } from 'path';
|
|
3
|
+
import * as yaml from 'yaml';
|
|
4
|
+
const DEFAULT_CONFIG = {
|
|
5
|
+
opencode: {
|
|
6
|
+
serverUrl: process.env.OPENCODE_SERVER || '', // Empty string means use in-process server
|
|
7
|
+
},
|
|
8
|
+
gitlab: {
|
|
9
|
+
url: process.env.GITLAB_URL || 'https://gitlab.com',
|
|
10
|
+
token: process.env.GITLAB_TOKEN || '',
|
|
11
|
+
},
|
|
12
|
+
github: {
|
|
13
|
+
token: process.env.GITHUB_TOKEN || '',
|
|
14
|
+
},
|
|
15
|
+
review: {
|
|
16
|
+
agents: ['security', 'quality', 'style', 'performance'],
|
|
17
|
+
autoReview: true,
|
|
18
|
+
reviewOnMention: true,
|
|
19
|
+
reviewOnLabel: ['needs-review', 'security-review'],
|
|
20
|
+
ignorePatterns: [
|
|
21
|
+
'*.test.ts',
|
|
22
|
+
'*.spec.ts',
|
|
23
|
+
'**/__tests__/**',
|
|
24
|
+
'**/__mocks__/**',
|
|
25
|
+
'*.md',
|
|
26
|
+
'package-lock.json',
|
|
27
|
+
'yarn.lock',
|
|
28
|
+
'pnpm-lock.yaml',
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
output: {
|
|
32
|
+
format: 'terminal',
|
|
33
|
+
verbosity: 'normal',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Load configuration from various sources with precedence:
|
|
38
|
+
* 1. CLI arguments (passed as overrides)
|
|
39
|
+
* 2. Environment variables
|
|
40
|
+
* 3. .drs/drs.config.yaml or .drs/drs.config.json
|
|
41
|
+
* 4. .gitlab-review.yml
|
|
42
|
+
* 5. Default values
|
|
43
|
+
*/
|
|
44
|
+
export function loadConfig(projectPath, overrides) {
|
|
45
|
+
const basePath = projectPath || process.cwd();
|
|
46
|
+
let config = { ...DEFAULT_CONFIG };
|
|
47
|
+
// Try loading from .drs/drs.config.yaml
|
|
48
|
+
const drsConfigPath = resolve(basePath, '.drs/drs.config.yaml');
|
|
49
|
+
if (existsSync(drsConfigPath)) {
|
|
50
|
+
const fileConfig = yaml.parse(readFileSync(drsConfigPath, 'utf-8'));
|
|
51
|
+
config = mergeConfig(config, fileConfig);
|
|
52
|
+
}
|
|
53
|
+
// Try loading from .gitlab-review.yml
|
|
54
|
+
const gitlabReviewPath = resolve(basePath, '.gitlab-review.yml');
|
|
55
|
+
if (existsSync(gitlabReviewPath)) {
|
|
56
|
+
const fileConfig = yaml.parse(readFileSync(gitlabReviewPath, 'utf-8'));
|
|
57
|
+
config = mergeConfig(config, fileConfig);
|
|
58
|
+
}
|
|
59
|
+
// Apply environment variable overrides
|
|
60
|
+
if (process.env.OPENCODE_SERVER) {
|
|
61
|
+
config.opencode.serverUrl = process.env.OPENCODE_SERVER;
|
|
62
|
+
}
|
|
63
|
+
if (process.env.GITLAB_URL) {
|
|
64
|
+
config.gitlab.url = process.env.GITLAB_URL;
|
|
65
|
+
}
|
|
66
|
+
if (process.env.GITLAB_TOKEN) {
|
|
67
|
+
config.gitlab.token = process.env.GITLAB_TOKEN;
|
|
68
|
+
}
|
|
69
|
+
if (process.env.GITHUB_TOKEN) {
|
|
70
|
+
config.github.token = process.env.GITHUB_TOKEN;
|
|
71
|
+
}
|
|
72
|
+
if (process.env.REVIEW_AGENTS) {
|
|
73
|
+
config.review.agents = process.env.REVIEW_AGENTS.split(',').map(a => a.trim());
|
|
74
|
+
}
|
|
75
|
+
// Apply CLI overrides
|
|
76
|
+
if (overrides) {
|
|
77
|
+
config = mergeConfig(config, overrides);
|
|
78
|
+
}
|
|
79
|
+
return config;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Deep merge two config objects
|
|
83
|
+
*/
|
|
84
|
+
function mergeConfig(base, override) {
|
|
85
|
+
return {
|
|
86
|
+
opencode: { ...base.opencode, ...override.opencode },
|
|
87
|
+
gitlab: { ...base.gitlab, ...override.gitlab },
|
|
88
|
+
github: { ...base.github, ...override.github },
|
|
89
|
+
review: { ...base.review, ...override.review },
|
|
90
|
+
output: { ...base.output, ...override.output },
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Validate that required configuration is present
|
|
95
|
+
*/
|
|
96
|
+
export function validateConfig(config, platform) {
|
|
97
|
+
// Validate platform-specific tokens if a platform is specified
|
|
98
|
+
if (platform === 'gitlab' && !config.gitlab.token) {
|
|
99
|
+
throw new Error('GitLab token is required. Set GITLAB_TOKEN environment variable or configure in config file');
|
|
100
|
+
}
|
|
101
|
+
if (platform === 'github' && !config.github.token) {
|
|
102
|
+
throw new Error('GitHub token is required. Set GITHUB_TOKEN environment variable or configure in config file');
|
|
103
|
+
}
|
|
104
|
+
// OPENCODE_SERVER is now optional - we'll start in-process if not provided
|
|
105
|
+
if (!config.opencode.serverUrl) {
|
|
106
|
+
console.log('ℹ️ OPENCODE_SERVER not set. Will start OpenCode server in-process.');
|
|
107
|
+
}
|
|
108
|
+
if (config.review.agents.length === 0) {
|
|
109
|
+
throw new Error('At least one review agent must be configured');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Check if a file should be ignored based on patterns
|
|
114
|
+
*/
|
|
115
|
+
export function shouldIgnoreFile(filePath, config) {
|
|
116
|
+
// Check ignore patterns
|
|
117
|
+
for (const pattern of config.review.ignorePatterns) {
|
|
118
|
+
if (minimatch(filePath, pattern)) {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// If include patterns are specified, check those
|
|
123
|
+
if (config.review.includePatterns && config.review.includePatterns.length > 0) {
|
|
124
|
+
let matches = false;
|
|
125
|
+
for (const pattern of config.review.includePatterns) {
|
|
126
|
+
if (minimatch(filePath, pattern)) {
|
|
127
|
+
matches = true;
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return !matches;
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
// Simple minimatch implementation for pattern matching
|
|
136
|
+
function minimatch(path, pattern) {
|
|
137
|
+
const regexPattern = pattern
|
|
138
|
+
.replace(/\./g, '\\.')
|
|
139
|
+
.replace(/\*/g, '.*')
|
|
140
|
+
.replace(/\?/g, '.');
|
|
141
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
|
142
|
+
return regex.test(path);
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAoC7B,MAAM,cAAc,GAAc;IAChC,QAAQ,EAAE;QACR,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE,EAAE,2CAA2C;KAC1F;IACD,MAAM,EAAE;QACN,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,oBAAoB;QACnD,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AC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,iDAAiD;IACjD,IAAI,MAAM,CAAC,MAAM,CAAC,eAAe,IAAI,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9E,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;YACpD,IAAI,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC;gBACjC,OAAO,GAAG,IAAI,CAAC;gBACf,MAAM;YACR,CAAC;QACH,CAAC;QACD,OAAO,CAAC,OAAO,CAAC;IAClB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,uDAAuD;AACvD,SAAS,SAAS,CAAC,IAAY,EAAE,OAAe;IAC9C,MAAM,YAAY,GAAG,OAAO;SACzB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAEvB,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,YAAY,GAAG,CAAC,CAAC;IAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface AgentDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
path: string;
|
|
4
|
+
description: string;
|
|
5
|
+
color?: string;
|
|
6
|
+
model?: string;
|
|
7
|
+
tools?: Record<string, boolean>;
|
|
8
|
+
hidden?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Load review agents from a project directory
|
|
12
|
+
*
|
|
13
|
+
* Priority order:
|
|
14
|
+
* 1. Project .drs/agents/ (DRS-specific)
|
|
15
|
+
* 2. Project .opencode/agent/ (OpenCode standard)
|
|
16
|
+
* 3. Global DRS agents (fallback)
|
|
17
|
+
*/
|
|
18
|
+
export declare function loadReviewAgents(projectPath: string): AgentDefinition[];
|
|
19
|
+
/**
|
|
20
|
+
* Get a specific agent by name
|
|
21
|
+
*/
|
|
22
|
+
export declare function getAgent(projectPath: string, agentName: string): AgentDefinition | null;
|
|
23
|
+
/**
|
|
24
|
+
* Get all review agents (security, quality, style, performance)
|
|
25
|
+
*/
|
|
26
|
+
export declare function getReviewAgents(projectPath: string): AgentDefinition[];
|
|
27
|
+
/**
|
|
28
|
+
* List all available agents
|
|
29
|
+
*/
|
|
30
|
+
export declare function listAgents(projectPath: string): string[];
|
|
31
|
+
//# sourceMappingURL=agent-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-loader.d.ts","sourceRoot":"","sources":["../../src/opencode/agent-loader.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,EAAE,CA4BvE;AAuED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAGvF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,EAAE,CAGtE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAGxD"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { readFileSync, readdirSync, existsSync, statSync } from 'fs';
|
|
2
|
+
import { join, relative } from 'path';
|
|
3
|
+
import * as yaml from 'yaml';
|
|
4
|
+
/**
|
|
5
|
+
* Load review agents from a project directory
|
|
6
|
+
*
|
|
7
|
+
* Priority order:
|
|
8
|
+
* 1. Project .drs/agents/ (DRS-specific)
|
|
9
|
+
* 2. Project .opencode/agent/ (OpenCode standard)
|
|
10
|
+
* 3. Global DRS agents (fallback)
|
|
11
|
+
*/
|
|
12
|
+
export function loadReviewAgents(projectPath) {
|
|
13
|
+
const agents = [];
|
|
14
|
+
// Define search paths in priority order
|
|
15
|
+
const agentPaths = [
|
|
16
|
+
join(projectPath, '.drs/agents'),
|
|
17
|
+
join(projectPath, '.opencode/agent'),
|
|
18
|
+
];
|
|
19
|
+
const discovered = new Set();
|
|
20
|
+
for (const agentPath of agentPaths) {
|
|
21
|
+
if (!existsSync(agentPath)) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const foundAgents = discoverAgents(agentPath, agentPath);
|
|
25
|
+
for (const agent of foundAgents) {
|
|
26
|
+
// Only add if we haven't seen this agent name before (priority order)
|
|
27
|
+
if (!discovered.has(agent.name)) {
|
|
28
|
+
agents.push(agent);
|
|
29
|
+
discovered.add(agent.name);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return agents;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Recursively discover agent markdown files in a directory
|
|
37
|
+
*/
|
|
38
|
+
function discoverAgents(basePath, currentPath) {
|
|
39
|
+
const agents = [];
|
|
40
|
+
if (!existsSync(currentPath)) {
|
|
41
|
+
return agents;
|
|
42
|
+
}
|
|
43
|
+
const entries = readdirSync(currentPath);
|
|
44
|
+
for (const entry of entries) {
|
|
45
|
+
const fullPath = join(currentPath, entry);
|
|
46
|
+
const stat = statSync(fullPath);
|
|
47
|
+
if (stat.isDirectory()) {
|
|
48
|
+
// Recursively search subdirectories
|
|
49
|
+
agents.push(...discoverAgents(basePath, fullPath));
|
|
50
|
+
}
|
|
51
|
+
else if (stat.isFile() && entry.endsWith('.md')) {
|
|
52
|
+
// Parse markdown file as agent definition
|
|
53
|
+
const agent = parseAgentFile(fullPath, basePath);
|
|
54
|
+
if (agent) {
|
|
55
|
+
agents.push(agent);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return agents;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Parse an agent markdown file and extract frontmatter
|
|
63
|
+
*/
|
|
64
|
+
function parseAgentFile(filePath, basePath) {
|
|
65
|
+
try {
|
|
66
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
67
|
+
// Extract YAML frontmatter
|
|
68
|
+
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
69
|
+
if (!frontmatterMatch) {
|
|
70
|
+
console.warn(`No frontmatter found in ${filePath}`);
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const frontmatter = yaml.parse(frontmatterMatch[1]);
|
|
74
|
+
// Generate agent name from relative path
|
|
75
|
+
const relativePath = relative(basePath, filePath);
|
|
76
|
+
const agentName = relativePath
|
|
77
|
+
.replace(/\.md$/, '')
|
|
78
|
+
.replace(/\\/g, '/');
|
|
79
|
+
return {
|
|
80
|
+
name: agentName,
|
|
81
|
+
path: filePath,
|
|
82
|
+
description: frontmatter.description || '',
|
|
83
|
+
color: frontmatter.color,
|
|
84
|
+
model: frontmatter.model,
|
|
85
|
+
tools: frontmatter.tools,
|
|
86
|
+
hidden: frontmatter.hidden || false,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.error(`Error parsing agent file ${filePath}:`, error);
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get a specific agent by name
|
|
96
|
+
*/
|
|
97
|
+
export function getAgent(projectPath, agentName) {
|
|
98
|
+
const agents = loadReviewAgents(projectPath);
|
|
99
|
+
return agents.find(a => a.name === agentName) || null;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get all review agents (security, quality, style, performance)
|
|
103
|
+
*/
|
|
104
|
+
export function getReviewAgents(projectPath) {
|
|
105
|
+
const agents = loadReviewAgents(projectPath);
|
|
106
|
+
return agents.filter(a => a.name.startsWith('review/'));
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* List all available agents
|
|
110
|
+
*/
|
|
111
|
+
export function listAgents(projectPath) {
|
|
112
|
+
const agents = loadReviewAgents(projectPath);
|
|
113
|
+
return agents.map(a => a.name);
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=agent-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-loader.js","sourceRoot":"","sources":["../../src/opencode/agent-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAY7B;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,MAAM,MAAM,GAAsB,EAAE,CAAC;IAErC,wCAAwC;IACxC,MAAM,UAAU,GAAG;QACjB,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC;QAChC,IAAI,CAAC,WAAW,EAAE,iBAAiB,CAAC;KACrC,CAAC;IAEF,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IAErC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3B,SAAS;QACX,CAAC;QAED,MAAM,WAAW,GA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AC,WAAW,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,IAAI,CAAC;AACxD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,WAAmB;IACjD,MAAM,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,WAAmB;IAC5C,MAAM,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode SDK client wrapper for DRS with in-process server support
|
|
3
|
+
*
|
|
4
|
+
* This client can either:
|
|
5
|
+
* 1. Connect to an existing remote OpenCode server (when baseUrl is provided)
|
|
6
|
+
* 2. Start an OpenCode server in-process (when baseUrl is not provided)
|
|
7
|
+
*/
|
|
8
|
+
export interface OpencodeConfig {
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
directory?: string;
|
|
11
|
+
serverPort?: number;
|
|
12
|
+
serverHostname?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface SessionCreateOptions {
|
|
15
|
+
agent: string;
|
|
16
|
+
message: string;
|
|
17
|
+
context?: Record<string, any>;
|
|
18
|
+
}
|
|
19
|
+
export interface SessionMessage {
|
|
20
|
+
id: string;
|
|
21
|
+
role: 'user' | 'assistant' | 'system';
|
|
22
|
+
content: string;
|
|
23
|
+
timestamp: Date;
|
|
24
|
+
}
|
|
25
|
+
export interface Session {
|
|
26
|
+
id: string;
|
|
27
|
+
agent: string;
|
|
28
|
+
createdAt: Date;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* OpenCode client that can start a server in-process or connect to remote
|
|
32
|
+
*/
|
|
33
|
+
export declare class OpencodeClient {
|
|
34
|
+
private baseUrl?;
|
|
35
|
+
private directory?;
|
|
36
|
+
private inProcessServer?;
|
|
37
|
+
private client?;
|
|
38
|
+
private config;
|
|
39
|
+
constructor(config: OpencodeConfig);
|
|
40
|
+
/**
|
|
41
|
+
* Initialize - either connect to remote server or start in-process
|
|
42
|
+
*/
|
|
43
|
+
initialize(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Create a new session with an agent
|
|
46
|
+
*/
|
|
47
|
+
createSession(options: SessionCreateOptions): Promise<Session>;
|
|
48
|
+
/**
|
|
49
|
+
* Stream messages from a session
|
|
50
|
+
*/
|
|
51
|
+
streamMessages(sessionId: string): AsyncGenerator<SessionMessage>;
|
|
52
|
+
/**
|
|
53
|
+
* Wait for session to complete and return all messages
|
|
54
|
+
*/
|
|
55
|
+
waitForCompletion(sessionId: string): Promise<SessionMessage[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Send a message to an existing session
|
|
58
|
+
*/
|
|
59
|
+
sendMessage(sessionId: string, content: string): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Close a session
|
|
62
|
+
*/
|
|
63
|
+
closeSession(sessionId: string): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Shutdown - close in-process server if applicable
|
|
66
|
+
*/
|
|
67
|
+
shutdown(): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Get server URL
|
|
70
|
+
*/
|
|
71
|
+
getServerUrl(): string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Create an OpenCode client with the given configuration
|
|
75
|
+
* @deprecated Use createOpencodeClientInstance instead, which properly initializes the client
|
|
76
|
+
*/
|
|
77
|
+
export declare function createOpencodeClient(config: OpencodeConfig): OpencodeClient;
|
|
78
|
+
/**
|
|
79
|
+
* Create and initialize an OpenCode client with the given configuration
|
|
80
|
+
*/
|
|
81
|
+
export declare function createOpencodeClientInstance(config: OpencodeConfig): Promise<OpencodeClient>;
|
|
82
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/opencode/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,eAAe,CAAC,CAA6C;IACrE,OAAO,CAAC,MAAM,CAAC,CAAqC;IACpD,OAAO,CAAC,MAAM,CAAiB;gBAEnB,MAAM,EAAE,cAAc;IAMlC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAgCjC;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC;IA2BpE;;OAEG;IACI,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,CAAC,cAAc,CAAC;IA0BxE;;OAEG;IACG,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAQrE;;OAEG;IACG,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBpE;;OAEG;IACG,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBpD;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAO/B;;OAEG;IACH,YAAY,IAAI,MAAM;CAMvB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAE3E;AAED;;GAEG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,cAAc,CAAC,CAIzB"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode SDK client wrapper for DRS with in-process server support
|
|
3
|
+
*
|
|
4
|
+
* This client can either:
|
|
5
|
+
* 1. Connect to an existing remote OpenCode server (when baseUrl is provided)
|
|
6
|
+
* 2. Start an OpenCode server in-process (when baseUrl is not provided)
|
|
7
|
+
*/
|
|
8
|
+
import { createOpencode, createOpencodeClient as createSDKClient } from '@opencode-ai/sdk';
|
|
9
|
+
/**
|
|
10
|
+
* OpenCode client that can start a server in-process or connect to remote
|
|
11
|
+
*/
|
|
12
|
+
export class OpencodeClient {
|
|
13
|
+
baseUrl;
|
|
14
|
+
directory;
|
|
15
|
+
inProcessServer;
|
|
16
|
+
client;
|
|
17
|
+
config;
|
|
18
|
+
constructor(config) {
|
|
19
|
+
this.baseUrl = config.baseUrl;
|
|
20
|
+
this.directory = config.directory;
|
|
21
|
+
this.config = config;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Initialize - either connect to remote server or start in-process
|
|
25
|
+
*/
|
|
26
|
+
async initialize() {
|
|
27
|
+
if (this.baseUrl) {
|
|
28
|
+
// Connect to existing remote server
|
|
29
|
+
this.client = createSDKClient({
|
|
30
|
+
baseUrl: this.baseUrl,
|
|
31
|
+
});
|
|
32
|
+
console.log(`Connected to OpenCode server at ${this.baseUrl}`);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
// Start server in-process
|
|
36
|
+
console.log('Starting OpenCode server in-process...');
|
|
37
|
+
const apiKey = process.env.ANTHROPIC_API_KEY;
|
|
38
|
+
if (!apiKey) {
|
|
39
|
+
throw new Error('ANTHROPIC_API_KEY environment variable is required for in-process OpenCode server');
|
|
40
|
+
}
|
|
41
|
+
// OpenCode SDK reads ANTHROPIC_API_KEY from environment automatically
|
|
42
|
+
this.inProcessServer = await createOpencode({
|
|
43
|
+
hostname: this.config.serverHostname || '127.0.0.1',
|
|
44
|
+
port: this.config.serverPort || 4096,
|
|
45
|
+
timeout: 10000,
|
|
46
|
+
config: {
|
|
47
|
+
model: 'anthropic/claude-opus-4-20250514',
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
this.client = this.inProcessServer.client;
|
|
51
|
+
this.baseUrl = this.inProcessServer.server.url;
|
|
52
|
+
console.log(`OpenCode server started at ${this.baseUrl}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Create a new session with an agent
|
|
57
|
+
*/
|
|
58
|
+
async createSession(options) {
|
|
59
|
+
if (!this.client) {
|
|
60
|
+
throw new Error('OpenCode client not initialized. Call initialize() first.');
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
// Create session using OpenCode SDK
|
|
64
|
+
// Note: This is a simplified implementation that needs to be adapted to the actual SDK API
|
|
65
|
+
const response = await this.client.session.create({
|
|
66
|
+
body: {
|
|
67
|
+
agent: options.agent,
|
|
68
|
+
userMessage: options.message,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
id: response.data?.id || 'session-' + Date.now(),
|
|
73
|
+
agent: options.agent,
|
|
74
|
+
createdAt: new Date(),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
throw new Error(`Failed to create session: ${error instanceof Error ? error.message : String(error)}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Stream messages from a session
|
|
83
|
+
*/
|
|
84
|
+
async *streamMessages(sessionId) {
|
|
85
|
+
if (!this.client) {
|
|
86
|
+
throw new Error('OpenCode client not initialized. Call initialize() first.');
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
const response = await this.client.session.messages({
|
|
90
|
+
path: { id: sessionId },
|
|
91
|
+
});
|
|
92
|
+
const messages = response.data || [];
|
|
93
|
+
for (const msg of messages) {
|
|
94
|
+
yield {
|
|
95
|
+
id: msg.info?.id || 'msg-' + Date.now(),
|
|
96
|
+
role: (msg.info?.role || 'assistant'),
|
|
97
|
+
content: msg.parts?.map((p) => p.text || '').join('') || '',
|
|
98
|
+
timestamp: new Date(),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
throw new Error(`Failed to get messages: ${error instanceof Error ? error.message : String(error)}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Wait for session to complete and return all messages
|
|
108
|
+
*/
|
|
109
|
+
async waitForCompletion(sessionId) {
|
|
110
|
+
const messages = [];
|
|
111
|
+
for await (const message of this.streamMessages(sessionId)) {
|
|
112
|
+
messages.push(message);
|
|
113
|
+
}
|
|
114
|
+
return messages;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Send a message to an existing session
|
|
118
|
+
*/
|
|
119
|
+
async sendMessage(sessionId, content) {
|
|
120
|
+
if (!this.client) {
|
|
121
|
+
throw new Error('OpenCode client not initialized. Call initialize() first.');
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
// Send message using OpenCode SDK
|
|
125
|
+
await this.client.session.sendMessage({
|
|
126
|
+
path: { id: sessionId },
|
|
127
|
+
body: { content },
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
throw new Error(`Failed to send message: ${error instanceof Error ? error.message : String(error)}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Close a session
|
|
136
|
+
*/
|
|
137
|
+
async closeSession(sessionId) {
|
|
138
|
+
if (!this.client) {
|
|
139
|
+
throw new Error('OpenCode client not initialized. Call initialize() first.');
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
await this.client.session.delete({
|
|
143
|
+
path: { id: sessionId },
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
throw new Error(`Failed to close session: ${error instanceof Error ? error.message : String(error)}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Shutdown - close in-process server if applicable
|
|
152
|
+
*/
|
|
153
|
+
async shutdown() {
|
|
154
|
+
if (this.inProcessServer) {
|
|
155
|
+
this.inProcessServer.server.close();
|
|
156
|
+
console.log('OpenCode server stopped');
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get server URL
|
|
161
|
+
*/
|
|
162
|
+
getServerUrl() {
|
|
163
|
+
if (!this.baseUrl) {
|
|
164
|
+
throw new Error('Server not initialized');
|
|
165
|
+
}
|
|
166
|
+
return this.baseUrl;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Create an OpenCode client with the given configuration
|
|
171
|
+
* @deprecated Use createOpencodeClientInstance instead, which properly initializes the client
|
|
172
|
+
*/
|
|
173
|
+
export function createOpencodeClient(config) {
|
|
174
|
+
return new OpencodeClient(config);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Create and initialize an OpenCode client with the given configuration
|
|
178
|
+
*/
|
|
179
|
+
export async function createOpencodeClientInstance(config) {
|
|
180
|
+
const client = new OpencodeClient(config);
|
|
181
|
+
await client.initialize();
|
|
182
|
+
return client;
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/opencode/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,oBAAoB,IAAI,eAAe,EAAE,MAAM,kBAAkB,CAAC;AA4B3F;;GAEG;AACH,MAAM,OAAO,cAAc;IACjB,OAAO,CAAU;IACjB,SAAS,CAAU;IACnB,eAAe,CAA8C;IAC7D,MAAM,CAAsC;IAC5C,MAAM,CAAiB;IAE/B,YAAY,MAAsB;QAChC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,oCAAoC;YACpC,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC;gBAC5B,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,mCAAmC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACN,0BAA0B;YAC1B,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;YAEtD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;YAC7C,IAAI,CAAC,MAAM,EAAE,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