maskweaver 0.11.0 → 0.11.2
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/LICENSE +21 -21
- package/README.ko.md +640 -640
- package/README.md +672 -672
- package/assets/agents/dummy-human.md +31 -31
- package/assets/agents/dummy-template.md +57 -57
- package/assets/agents/mask-weaver.md +412 -412
- package/assets/agents/squad-operator.md +242 -242
- package/assets/masks/ai-ml/andrew-ng.yaml +207 -207
- package/assets/masks/architecture/jeff-dean.yaml +208 -208
- package/assets/masks/index.json +65 -65
- package/assets/masks/software-engineering/dan-abramov.yaml +188 -188
- package/assets/masks/software-engineering/kent-beck.yaml +191 -191
- package/assets/masks/software-engineering/linus-torvalds.yaml +152 -152
- package/assets/masks/software-engineering/martin-fowler.yaml +173 -173
- package/dist/memory/store/sqlite.js +102 -102
- package/dist/plugin/tools/context.js +15 -15
- package/dist/plugin/tools/maskSave.js +8 -8
- package/dist/plugin/tools/memoryIndexer.js +5 -5
- package/dist/plugin/tools/memorySearch.js +8 -8
- package/dist/plugin/tools/memoryWrite.js +3 -3
- package/dist/plugin/tools/retrospect.js +3 -3
- package/dist/plugin/tools/squad.js +39 -39
- package/dist/retrospect/mask-save.js +21 -21
- package/dist/retrospect/retrospect.js +9 -9
- package/dist/shared/generate-agents.d.ts +3 -15
- package/dist/shared/generate-agents.js +13 -172
- package/dist/shared/subscription-detection.d.ts +20 -0
- package/dist/shared/subscription-detection.js +162 -0
- package/dist/verify/prompts.js +114 -114
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/weave/knowledge/global.js +86 -86
- package/dist/weave/verification/playwright.js +127 -127
- package/masks/ai-ml/andrew-ng.yaml +207 -207
- package/masks/architecture/jeff-dean.yaml +208 -208
- package/masks/index.json +65 -65
- package/masks/orchestration/squad-operator.yaml +205 -205
- package/masks/software-engineering/dan-abramov.yaml +188 -188
- package/masks/software-engineering/kent-beck.yaml +191 -191
- package/masks/software-engineering/linus-torvalds.yaml +152 -152
- package/masks/software-engineering/martin-fowler.yaml +173 -173
- package/package.json +1 -1
- package/postinstall.mjs +22 -112
|
@@ -2,6 +2,8 @@ import * as fs from 'node:fs';
|
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import * as os from 'node:os';
|
|
4
4
|
import { loadRuntimeConfig, normalizeDummyHumansConfig } from './config.js';
|
|
5
|
+
import { defaultSubscriptionDetection, detectSubscriptionsFromConfig, detectSubscriptionsFromCli, hasSubscriptionHints, readOpencodeConfig, } from './subscription-detection.js';
|
|
6
|
+
export { detectSubscriptionsFromCli, detectSubscriptionsFromConfig, };
|
|
5
7
|
function buildAgentFileContent(entry) {
|
|
6
8
|
const lines = [
|
|
7
9
|
'---',
|
|
@@ -100,168 +102,6 @@ export function generatePoolAgentFilesFromConfig(projectDir, agentsDir, options
|
|
|
100
102
|
errors: ['No maskweaver.config.json found with dummyHumans configuration. Create one or run `weave init-config` to generate a default.'],
|
|
101
103
|
};
|
|
102
104
|
}
|
|
103
|
-
import { spawnSync } from 'node:child_process';
|
|
104
|
-
function readOpencodeConfig(basePath) {
|
|
105
|
-
const candidates = [
|
|
106
|
-
path.join(basePath, 'opencode.json'),
|
|
107
|
-
path.join(basePath, 'opencode.jsonc'),
|
|
108
|
-
path.join(os.homedir(), '.config', 'opencode', 'opencode.json'),
|
|
109
|
-
path.join(os.homedir(), '.config', 'opencode', 'opencode.jsonc'),
|
|
110
|
-
];
|
|
111
|
-
for (const candidate of candidates) {
|
|
112
|
-
if (!fs.existsSync(candidate))
|
|
113
|
-
continue;
|
|
114
|
-
try {
|
|
115
|
-
let content = fs.readFileSync(candidate, 'utf-8');
|
|
116
|
-
content = content.replace(/\/\/.*$/gm, '').replace(/\/\*[\s\S]*?\*\//g, '');
|
|
117
|
-
const parsed = JSON.parse(content);
|
|
118
|
-
if (parsed && typeof parsed === 'object')
|
|
119
|
-
return parsed;
|
|
120
|
-
}
|
|
121
|
-
catch {
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
function runCli(command, args) {
|
|
128
|
-
try {
|
|
129
|
-
const result = spawnSync(command, args, {
|
|
130
|
-
encoding: 'utf-8',
|
|
131
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
132
|
-
timeout: 8000,
|
|
133
|
-
windowsHide: true,
|
|
134
|
-
});
|
|
135
|
-
if (result.error || result.status !== 0)
|
|
136
|
-
return null;
|
|
137
|
-
return result.stdout || null;
|
|
138
|
-
}
|
|
139
|
-
catch {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
const PROVIDER_MAP = {
|
|
144
|
-
'opencode go': 'opencode-go',
|
|
145
|
-
'opencode-go': 'opencode-go',
|
|
146
|
-
'z.ai coding plan': 'zai-coding-plan',
|
|
147
|
-
'zai-coding-plan': 'zai-coding-plan',
|
|
148
|
-
'z.ai': 'zai-coding-plan',
|
|
149
|
-
};
|
|
150
|
-
function parseProvidersList(output) {
|
|
151
|
-
const providers = [];
|
|
152
|
-
const lines = output.split('\n');
|
|
153
|
-
for (const line of lines) {
|
|
154
|
-
const stripped = line.replace(/\x1b\[[0-9;]*m/g, '').trim();
|
|
155
|
-
if (!stripped || stripped.startsWith('┌') || stripped.startsWith('└') || stripped.startsWith('│') || stripped.includes('credentials') || stripped.includes('environment'))
|
|
156
|
-
continue;
|
|
157
|
-
const match = stripped.match(/[●○◉◘]\s+(.+?)\s+(api|oauth|env)$/i);
|
|
158
|
-
if (match) {
|
|
159
|
-
const name = match[1].trim();
|
|
160
|
-
const authType = match[2].trim();
|
|
161
|
-
let subscription = null;
|
|
162
|
-
const nameLower = name.toLowerCase();
|
|
163
|
-
for (const [key, sub] of Object.entries(PROVIDER_MAP)) {
|
|
164
|
-
if (nameLower.includes(key)) {
|
|
165
|
-
subscription = sub;
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
providers.push({
|
|
170
|
-
name,
|
|
171
|
-
subscription,
|
|
172
|
-
authType,
|
|
173
|
-
active: stripped.includes('●'),
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return providers;
|
|
178
|
-
}
|
|
179
|
-
function detectFromModels(output) {
|
|
180
|
-
const subs = new Set();
|
|
181
|
-
for (const line of output.split('\n')) {
|
|
182
|
-
const trimmed = line.trim();
|
|
183
|
-
if (trimmed.startsWith('opencode-go/'))
|
|
184
|
-
subs.add('opencode-go');
|
|
185
|
-
if (trimmed.startsWith('zai-coding-plan/'))
|
|
186
|
-
subs.add('zai-coding-plan');
|
|
187
|
-
}
|
|
188
|
-
return Array.from(subs);
|
|
189
|
-
}
|
|
190
|
-
export function detectSubscriptionsFromCli() {
|
|
191
|
-
const evidence = [];
|
|
192
|
-
const allProviders = [];
|
|
193
|
-
const subs = new Set();
|
|
194
|
-
const providersOutput = runCli('opencode', ['providers', 'list']);
|
|
195
|
-
if (providersOutput) {
|
|
196
|
-
const providers = parseProvidersList(providersOutput);
|
|
197
|
-
allProviders.push(...providers);
|
|
198
|
-
for (const p of providers) {
|
|
199
|
-
if (p.subscription) {
|
|
200
|
-
subs.add(p.subscription);
|
|
201
|
-
evidence.push(`provider: ${p.name} (${p.authType})`);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
const modelsOutput = runCli('opencode', ['models']);
|
|
206
|
-
if (modelsOutput) {
|
|
207
|
-
const modelSubs = detectFromModels(modelsOutput);
|
|
208
|
-
for (const sub of modelSubs) {
|
|
209
|
-
if (!subs.has(sub)) {
|
|
210
|
-
subs.add(sub);
|
|
211
|
-
evidence.push(`models: ${sub}/* models available`);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
if (subs.size === 0) {
|
|
216
|
-
subs.add('opencode-go');
|
|
217
|
-
evidence.push('No subscription detected via CLI, defaulting to opencode-go');
|
|
218
|
-
}
|
|
219
|
-
const primary = subs.has('zai-coding-plan') ? 'zai-coding-plan' : 'opencode-go';
|
|
220
|
-
return {
|
|
221
|
-
subscriptions: Array.from(subs),
|
|
222
|
-
primary,
|
|
223
|
-
evidence,
|
|
224
|
-
allProviders,
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
export function detectSubscriptionsFromConfig(opencodeConfig) {
|
|
228
|
-
const subs = new Set();
|
|
229
|
-
const evidence = [];
|
|
230
|
-
const modelFields = ['model', 'small_model', 'large_model'];
|
|
231
|
-
const configs = [opencodeConfig];
|
|
232
|
-
if (opencodeConfig.agent) {
|
|
233
|
-
for (const agentConfig of Object.values(opencodeConfig.agent)) {
|
|
234
|
-
if (agentConfig && typeof agentConfig === 'object')
|
|
235
|
-
configs.push(agentConfig);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
for (const cfg of configs) {
|
|
239
|
-
for (const field of modelFields) {
|
|
240
|
-
const val = cfg[field];
|
|
241
|
-
if (typeof val !== 'string' || !val)
|
|
242
|
-
continue;
|
|
243
|
-
if (val.startsWith('opencode-go/')) {
|
|
244
|
-
subs.add('opencode-go');
|
|
245
|
-
evidence.push(`${field}: ${val}`);
|
|
246
|
-
}
|
|
247
|
-
else if (val.startsWith('zai-coding-plan/')) {
|
|
248
|
-
subs.add('zai-coding-plan');
|
|
249
|
-
evidence.push(`${field}: ${val}`);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
if (subs.size === 0) {
|
|
254
|
-
subs.add('opencode-go');
|
|
255
|
-
evidence.push('No provider detected in config, defaulting to opencode-go');
|
|
256
|
-
}
|
|
257
|
-
const primary = subs.has('zai-coding-plan') ? 'zai-coding-plan' : 'opencode-go';
|
|
258
|
-
return {
|
|
259
|
-
subscriptions: Array.from(subs),
|
|
260
|
-
primary,
|
|
261
|
-
evidence,
|
|
262
|
-
allProviders: [],
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
105
|
function buildZaiPool() {
|
|
266
106
|
return [
|
|
267
107
|
{
|
|
@@ -414,16 +254,6 @@ export function formatProviderChecklist(detection) {
|
|
|
414
254
|
return lines.join('\n');
|
|
415
255
|
}
|
|
416
256
|
export function writeAutoDetectedConfig(projectDir, force) {
|
|
417
|
-
let detection;
|
|
418
|
-
try {
|
|
419
|
-
detection = detectSubscriptionsFromCli();
|
|
420
|
-
}
|
|
421
|
-
catch {
|
|
422
|
-
const opencodeConfig = readOpencodeConfig(projectDir);
|
|
423
|
-
if (!opencodeConfig)
|
|
424
|
-
return null;
|
|
425
|
-
detection = detectSubscriptionsFromConfig(opencodeConfig);
|
|
426
|
-
}
|
|
427
257
|
const targetPath = path.join(projectDir, 'maskweaver.config.json');
|
|
428
258
|
const existingConfig = fs.existsSync(targetPath)
|
|
429
259
|
? (() => { try {
|
|
@@ -436,6 +266,17 @@ export function writeAutoDetectedConfig(projectDir, force) {
|
|
|
436
266
|
if (!force && existingConfig?.dummyHumans?.pool?.length > 0) {
|
|
437
267
|
return null;
|
|
438
268
|
}
|
|
269
|
+
let detection;
|
|
270
|
+
const opencodeConfig = readOpencodeConfig(projectDir);
|
|
271
|
+
if (opencodeConfig && hasSubscriptionHints(opencodeConfig)) {
|
|
272
|
+
detection = detectSubscriptionsFromConfig(opencodeConfig);
|
|
273
|
+
}
|
|
274
|
+
else if (opencodeConfig) {
|
|
275
|
+
detection = detectSubscriptionsFromConfig(opencodeConfig);
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
detection = defaultSubscriptionDetection('No opencode config found, defaulting to opencode-go');
|
|
279
|
+
}
|
|
439
280
|
const newConfig = buildConfigFromDetection(detection);
|
|
440
281
|
try {
|
|
441
282
|
fs.writeFileSync(targetPath, JSON.stringify(newConfig, null, 2) + '\n', 'utf-8');
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type DetectedSubscription = 'opencode-go' | 'zai-coding-plan';
|
|
2
|
+
export interface SubscriptionDetectionResult {
|
|
3
|
+
subscriptions: DetectedSubscription[];
|
|
4
|
+
primary: DetectedSubscription;
|
|
5
|
+
evidence: string[];
|
|
6
|
+
allProviders: ProviderInfo[];
|
|
7
|
+
}
|
|
8
|
+
export interface ProviderInfo {
|
|
9
|
+
name: string;
|
|
10
|
+
subscription: DetectedSubscription | null;
|
|
11
|
+
authType: string;
|
|
12
|
+
active: boolean;
|
|
13
|
+
}
|
|
14
|
+
type JsonObject = Record<string, unknown>;
|
|
15
|
+
export declare function defaultSubscriptionDetection(evidence: string): SubscriptionDetectionResult;
|
|
16
|
+
export declare function readOpencodeConfig(basePath: string): JsonObject | null;
|
|
17
|
+
export declare function hasSubscriptionHints(opencodeConfig: JsonObject): boolean;
|
|
18
|
+
export declare function detectSubscriptionsFromCli(): SubscriptionDetectionResult;
|
|
19
|
+
export declare function detectSubscriptionsFromConfig(opencodeConfig: JsonObject): SubscriptionDetectionResult;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import * as os from 'node:os';
|
|
4
|
+
import * as path from 'node:path';
|
|
5
|
+
const MODEL_FIELDS = ['model', 'small_model', 'large_model'];
|
|
6
|
+
function isJsonObject(value) {
|
|
7
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
8
|
+
}
|
|
9
|
+
function stripJsonComments(content) {
|
|
10
|
+
return content.replace(/\/\/.*$/gm, '').replace(/\/\*[\s\S]*?\*\//g, '');
|
|
11
|
+
}
|
|
12
|
+
export function defaultSubscriptionDetection(evidence) {
|
|
13
|
+
return {
|
|
14
|
+
subscriptions: ['opencode-go'],
|
|
15
|
+
primary: 'opencode-go',
|
|
16
|
+
evidence: [evidence],
|
|
17
|
+
allProviders: [],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function readOpencodeConfig(basePath) {
|
|
21
|
+
const candidates = [
|
|
22
|
+
path.join(basePath, 'opencode.json'),
|
|
23
|
+
path.join(basePath, 'opencode.jsonc'),
|
|
24
|
+
path.join(os.homedir(), '.config', 'opencode', 'opencode.json'),
|
|
25
|
+
path.join(os.homedir(), '.config', 'opencode', 'opencode.jsonc'),
|
|
26
|
+
];
|
|
27
|
+
for (const candidate of candidates) {
|
|
28
|
+
if (!fs.existsSync(candidate))
|
|
29
|
+
continue;
|
|
30
|
+
try {
|
|
31
|
+
const content = stripJsonComments(fs.readFileSync(candidate, 'utf-8'));
|
|
32
|
+
const parsed = JSON.parse(content);
|
|
33
|
+
if (isJsonObject(parsed))
|
|
34
|
+
return parsed;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
function collectConfigObjects(opencodeConfig) {
|
|
43
|
+
const configs = [opencodeConfig];
|
|
44
|
+
const agent = opencodeConfig.agent;
|
|
45
|
+
if (!isJsonObject(agent))
|
|
46
|
+
return configs;
|
|
47
|
+
for (const agentConfig of Object.values(agent)) {
|
|
48
|
+
if (isJsonObject(agentConfig))
|
|
49
|
+
configs.push(agentConfig);
|
|
50
|
+
}
|
|
51
|
+
return configs;
|
|
52
|
+
}
|
|
53
|
+
function collectModelValues(opencodeConfig) {
|
|
54
|
+
const values = [];
|
|
55
|
+
for (const cfg of collectConfigObjects(opencodeConfig)) {
|
|
56
|
+
for (const field of MODEL_FIELDS) {
|
|
57
|
+
const value = cfg[field];
|
|
58
|
+
if (typeof value === 'string' && value)
|
|
59
|
+
values.push(value);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return values;
|
|
63
|
+
}
|
|
64
|
+
export function hasSubscriptionHints(opencodeConfig) {
|
|
65
|
+
return collectModelValues(opencodeConfig).some((value) => value.startsWith('opencode-go/') || value.startsWith('zai-coding-plan/'));
|
|
66
|
+
}
|
|
67
|
+
const PROVIDER_MAP = {
|
|
68
|
+
'opencode go': 'opencode-go',
|
|
69
|
+
'opencode-go': 'opencode-go',
|
|
70
|
+
'z.ai coding plan': 'zai-coding-plan',
|
|
71
|
+
'zai-coding-plan': 'zai-coding-plan',
|
|
72
|
+
'z.ai': 'zai-coding-plan',
|
|
73
|
+
};
|
|
74
|
+
function parseProvidersList(output) {
|
|
75
|
+
const providers = [];
|
|
76
|
+
for (const line of output.split('\n')) {
|
|
77
|
+
const stripped = line.replace(/\x1b\[[0-9;]*m/g, '').trim();
|
|
78
|
+
if (!stripped || stripped.startsWith('┌') || stripped.startsWith('└') || stripped.startsWith('│') || stripped.includes('credentials') || stripped.includes('environment'))
|
|
79
|
+
continue;
|
|
80
|
+
const match = stripped.match(/[●○◉◘]\s+(.+?)\s+(api|oauth|env)$/i);
|
|
81
|
+
if (!match)
|
|
82
|
+
continue;
|
|
83
|
+
const name = match[1].trim();
|
|
84
|
+
const authType = match[2].trim();
|
|
85
|
+
const nameLower = name.toLowerCase();
|
|
86
|
+
let subscription = null;
|
|
87
|
+
for (const [key, sub] of Object.entries(PROVIDER_MAP)) {
|
|
88
|
+
if (nameLower.includes(key)) {
|
|
89
|
+
subscription = sub;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
providers.push({
|
|
94
|
+
name,
|
|
95
|
+
subscription,
|
|
96
|
+
authType,
|
|
97
|
+
active: stripped.includes('●'),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return providers;
|
|
101
|
+
}
|
|
102
|
+
export function detectSubscriptionsFromCli() {
|
|
103
|
+
const result = spawnSync('opencode', ['providers', 'list'], {
|
|
104
|
+
encoding: 'utf-8',
|
|
105
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
106
|
+
timeout: 5000,
|
|
107
|
+
windowsHide: true,
|
|
108
|
+
env: {
|
|
109
|
+
...process.env,
|
|
110
|
+
OPENCODE_DISABLE_AUTOUPDATE: '1',
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
if (result.error || result.status !== 0) {
|
|
114
|
+
return defaultSubscriptionDetection('No subscription detected via provider list, defaulting to opencode-go');
|
|
115
|
+
}
|
|
116
|
+
const providers = parseProvidersList(result.stdout || '');
|
|
117
|
+
const subscriptions = new Set();
|
|
118
|
+
const evidence = [];
|
|
119
|
+
for (const provider of providers) {
|
|
120
|
+
if (!provider.subscription)
|
|
121
|
+
continue;
|
|
122
|
+
subscriptions.add(provider.subscription);
|
|
123
|
+
evidence.push(`provider: ${provider.name} (${provider.authType})`);
|
|
124
|
+
}
|
|
125
|
+
if (subscriptions.size === 0) {
|
|
126
|
+
return defaultSubscriptionDetection('No subscription detected via provider list, defaulting to opencode-go');
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
subscriptions: Array.from(subscriptions),
|
|
130
|
+
primary: subscriptions.has('zai-coding-plan') ? 'zai-coding-plan' : 'opencode-go',
|
|
131
|
+
evidence,
|
|
132
|
+
allProviders: providers,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
export function detectSubscriptionsFromConfig(opencodeConfig) {
|
|
136
|
+
const subscriptions = new Set();
|
|
137
|
+
const evidence = [];
|
|
138
|
+
for (const cfg of collectConfigObjects(opencodeConfig)) {
|
|
139
|
+
for (const field of MODEL_FIELDS) {
|
|
140
|
+
const value = cfg[field];
|
|
141
|
+
if (typeof value !== 'string' || !value)
|
|
142
|
+
continue;
|
|
143
|
+
if (value.startsWith('opencode-go/')) {
|
|
144
|
+
subscriptions.add('opencode-go');
|
|
145
|
+
evidence.push(`${field}: ${value}`);
|
|
146
|
+
}
|
|
147
|
+
else if (value.startsWith('zai-coding-plan/')) {
|
|
148
|
+
subscriptions.add('zai-coding-plan');
|
|
149
|
+
evidence.push(`${field}: ${value}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (subscriptions.size === 0) {
|
|
154
|
+
return defaultSubscriptionDetection('No provider detected in config, defaulting to opencode-go');
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
subscriptions: Array.from(subscriptions),
|
|
158
|
+
primary: subscriptions.has('zai-coding-plan') ? 'zai-coding-plan' : 'opencode-go',
|
|
159
|
+
evidence,
|
|
160
|
+
allProviders: [],
|
|
161
|
+
};
|
|
162
|
+
}
|
package/dist/verify/prompts.js
CHANGED
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
export const FLASH_REVIEW_PROMPT = `You are a fast code reviewer. Perform a quick check for:
|
|
2
|
-
|
|
3
|
-
1. **Syntax errors** - obvious compilation/parsing issues
|
|
4
|
-
2. **Critical bugs** - null pointer dereferences, infinite loops, etc.
|
|
5
|
-
3. **Security vulnerabilities** - SQL injection, XSS, hardcoded credentials
|
|
6
|
-
4. **Missing error handling** - unhandled exceptions, missing validation
|
|
7
|
-
|
|
8
|
-
Keep it quick and focused. Only flag clear, serious issues.
|
|
9
|
-
|
|
10
|
-
Respond in JSON format:
|
|
11
|
-
{
|
|
12
|
-
"result": "pass" | "warn" | "fail",
|
|
13
|
-
"summary": "Brief overall assessment",
|
|
14
|
-
"issues": [
|
|
15
|
-
{
|
|
16
|
-
"severity": "error" | "warning" | "info",
|
|
17
|
-
"message": "Description of the issue",
|
|
18
|
-
"line": 42,
|
|
19
|
-
"suggestion": "How to fix it"
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
"suggestions": ["Optional improvement suggestions"]
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
Result guide:
|
|
26
|
-
- "pass": No issues found
|
|
27
|
-
- "warn": Minor issues or potential concerns
|
|
28
|
-
- "fail": Critical issues that must be fixed
|
|
29
|
-
|
|
30
|
-
Code to review:
|
|
31
|
-
|
|
32
|
-
\`\`\`
|
|
33
|
-
{{CONTENT}}
|
|
34
|
-
\`\`\`
|
|
35
|
-
|
|
1
|
+
export const FLASH_REVIEW_PROMPT = `You are a fast code reviewer. Perform a quick check for:
|
|
2
|
+
|
|
3
|
+
1. **Syntax errors** - obvious compilation/parsing issues
|
|
4
|
+
2. **Critical bugs** - null pointer dereferences, infinite loops, etc.
|
|
5
|
+
3. **Security vulnerabilities** - SQL injection, XSS, hardcoded credentials
|
|
6
|
+
4. **Missing error handling** - unhandled exceptions, missing validation
|
|
7
|
+
|
|
8
|
+
Keep it quick and focused. Only flag clear, serious issues.
|
|
9
|
+
|
|
10
|
+
Respond in JSON format:
|
|
11
|
+
{
|
|
12
|
+
"result": "pass" | "warn" | "fail",
|
|
13
|
+
"summary": "Brief overall assessment",
|
|
14
|
+
"issues": [
|
|
15
|
+
{
|
|
16
|
+
"severity": "error" | "warning" | "info",
|
|
17
|
+
"message": "Description of the issue",
|
|
18
|
+
"line": 42,
|
|
19
|
+
"suggestion": "How to fix it"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"suggestions": ["Optional improvement suggestions"]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Result guide:
|
|
26
|
+
- "pass": No issues found
|
|
27
|
+
- "warn": Minor issues or potential concerns
|
|
28
|
+
- "fail": Critical issues that must be fixed
|
|
29
|
+
|
|
30
|
+
Code to review:
|
|
31
|
+
|
|
32
|
+
\`\`\`
|
|
33
|
+
{{CONTENT}}
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
36
36
|
{{CONTEXT}}`;
|
|
37
|
-
export const HUMAN_REVIEW_PROMPT = `You are an experienced code reviewer. Perform a thorough review:
|
|
38
|
-
|
|
39
|
-
1. **Code quality** - readability, maintainability, style
|
|
40
|
-
2. **Logic correctness** - algorithm correctness, edge cases
|
|
41
|
-
3. **Best practices** - design patterns, SOLID principles
|
|
42
|
-
4. **Error handling** - comprehensive error handling and validation
|
|
43
|
-
5. **Security** - authentication, authorization, data validation
|
|
44
|
-
6. **Performance** - obvious performance issues
|
|
45
|
-
7. **Testing** - testability, missing test cases
|
|
46
|
-
|
|
47
|
-
Provide constructive feedback with specific suggestions.
|
|
48
|
-
|
|
49
|
-
Respond in JSON format:
|
|
50
|
-
{
|
|
51
|
-
"result": "pass" | "warn" | "fail",
|
|
52
|
-
"summary": "Comprehensive review summary",
|
|
53
|
-
"issues": [
|
|
54
|
-
{
|
|
55
|
-
"severity": "error" | "warning" | "info",
|
|
56
|
-
"message": "Detailed issue description",
|
|
57
|
-
"line": 42,
|
|
58
|
-
"suggestion": "Specific fix or improvement"
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
"suggestions": ["General improvement suggestions"]
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
Result guide:
|
|
65
|
-
- "pass": Code meets quality standards
|
|
66
|
-
- "warn": Has issues but acceptable with improvements
|
|
67
|
-
- "fail": Significant issues requiring fixes
|
|
68
|
-
|
|
69
|
-
Code to review:
|
|
70
|
-
|
|
71
|
-
\`\`\`
|
|
72
|
-
{{CONTENT}}
|
|
73
|
-
\`\`\`
|
|
74
|
-
|
|
37
|
+
export const HUMAN_REVIEW_PROMPT = `You are an experienced code reviewer. Perform a thorough review:
|
|
38
|
+
|
|
39
|
+
1. **Code quality** - readability, maintainability, style
|
|
40
|
+
2. **Logic correctness** - algorithm correctness, edge cases
|
|
41
|
+
3. **Best practices** - design patterns, SOLID principles
|
|
42
|
+
4. **Error handling** - comprehensive error handling and validation
|
|
43
|
+
5. **Security** - authentication, authorization, data validation
|
|
44
|
+
6. **Performance** - obvious performance issues
|
|
45
|
+
7. **Testing** - testability, missing test cases
|
|
46
|
+
|
|
47
|
+
Provide constructive feedback with specific suggestions.
|
|
48
|
+
|
|
49
|
+
Respond in JSON format:
|
|
50
|
+
{
|
|
51
|
+
"result": "pass" | "warn" | "fail",
|
|
52
|
+
"summary": "Comprehensive review summary",
|
|
53
|
+
"issues": [
|
|
54
|
+
{
|
|
55
|
+
"severity": "error" | "warning" | "info",
|
|
56
|
+
"message": "Detailed issue description",
|
|
57
|
+
"line": 42,
|
|
58
|
+
"suggestion": "Specific fix or improvement"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"suggestions": ["General improvement suggestions"]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
Result guide:
|
|
65
|
+
- "pass": Code meets quality standards
|
|
66
|
+
- "warn": Has issues but acceptable with improvements
|
|
67
|
+
- "fail": Significant issues requiring fixes
|
|
68
|
+
|
|
69
|
+
Code to review:
|
|
70
|
+
|
|
71
|
+
\`\`\`
|
|
72
|
+
{{CONTENT}}
|
|
73
|
+
\`\`\`
|
|
74
|
+
|
|
75
75
|
{{CONTEXT}}`;
|
|
76
|
-
export const PREMIUM_REVIEW_PROMPT = `You are a senior architect and security expert. Perform a comprehensive, deep review:
|
|
77
|
-
|
|
78
|
-
1. **Architecture** - system design, modularity, scalability
|
|
79
|
-
2. **Security** - comprehensive security analysis (OWASP Top 10)
|
|
80
|
-
3. **Performance** - algorithmic complexity, memory usage, bottlenecks
|
|
81
|
-
4. **Maintainability** - long-term code health, technical debt
|
|
82
|
-
5. **Reliability** - error recovery, fault tolerance, edge cases
|
|
83
|
-
6. **Best practices** - industry standards, design patterns
|
|
84
|
-
7. **Testing strategy** - test coverage, test quality
|
|
85
|
-
8. **Documentation** - code clarity, comments, API documentation
|
|
86
|
-
9. **Compliance** - licensing, regulatory requirements
|
|
87
|
-
10. **Future-proofing** - extensibility, backward compatibility
|
|
88
|
-
|
|
89
|
-
Provide expert-level analysis with architectural insights.
|
|
90
|
-
|
|
91
|
-
Respond in JSON format:
|
|
92
|
-
{
|
|
93
|
-
"result": "pass" | "warn" | "fail",
|
|
94
|
-
"summary": "Expert architectural and security assessment",
|
|
95
|
-
"issues": [
|
|
96
|
-
{
|
|
97
|
-
"severity": "error" | "warning" | "info",
|
|
98
|
-
"message": "In-depth issue analysis",
|
|
99
|
-
"line": 42,
|
|
100
|
-
"suggestion": "Expert recommendation with rationale"
|
|
101
|
-
}
|
|
102
|
-
],
|
|
103
|
-
"suggestions": ["Strategic improvement recommendations"]
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
Result guide:
|
|
107
|
-
- "pass": Production-ready, meets enterprise standards
|
|
108
|
-
- "warn": Acceptable but has architectural concerns
|
|
109
|
-
- "fail": Requires significant redesign or security fixes
|
|
110
|
-
|
|
111
|
-
Code to review:
|
|
112
|
-
|
|
113
|
-
\`\`\`
|
|
114
|
-
{{CONTENT}}
|
|
115
|
-
\`\`\`
|
|
116
|
-
|
|
76
|
+
export const PREMIUM_REVIEW_PROMPT = `You are a senior architect and security expert. Perform a comprehensive, deep review:
|
|
77
|
+
|
|
78
|
+
1. **Architecture** - system design, modularity, scalability
|
|
79
|
+
2. **Security** - comprehensive security analysis (OWASP Top 10)
|
|
80
|
+
3. **Performance** - algorithmic complexity, memory usage, bottlenecks
|
|
81
|
+
4. **Maintainability** - long-term code health, technical debt
|
|
82
|
+
5. **Reliability** - error recovery, fault tolerance, edge cases
|
|
83
|
+
6. **Best practices** - industry standards, design patterns
|
|
84
|
+
7. **Testing strategy** - test coverage, test quality
|
|
85
|
+
8. **Documentation** - code clarity, comments, API documentation
|
|
86
|
+
9. **Compliance** - licensing, regulatory requirements
|
|
87
|
+
10. **Future-proofing** - extensibility, backward compatibility
|
|
88
|
+
|
|
89
|
+
Provide expert-level analysis with architectural insights.
|
|
90
|
+
|
|
91
|
+
Respond in JSON format:
|
|
92
|
+
{
|
|
93
|
+
"result": "pass" | "warn" | "fail",
|
|
94
|
+
"summary": "Expert architectural and security assessment",
|
|
95
|
+
"issues": [
|
|
96
|
+
{
|
|
97
|
+
"severity": "error" | "warning" | "info",
|
|
98
|
+
"message": "In-depth issue analysis",
|
|
99
|
+
"line": 42,
|
|
100
|
+
"suggestion": "Expert recommendation with rationale"
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"suggestions": ["Strategic improvement recommendations"]
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
Result guide:
|
|
107
|
+
- "pass": Production-ready, meets enterprise standards
|
|
108
|
+
- "warn": Acceptable but has architectural concerns
|
|
109
|
+
- "fail": Requires significant redesign or security fixes
|
|
110
|
+
|
|
111
|
+
Code to review:
|
|
112
|
+
|
|
113
|
+
\`\`\`
|
|
114
|
+
{{CONTENT}}
|
|
115
|
+
\`\`\`
|
|
116
|
+
|
|
117
117
|
{{CONTEXT}}`;
|
|
118
118
|
export function getPromptForReviewer(reviewer) {
|
|
119
119
|
switch (reviewer) {
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.11.2";
|
|
2
2
|
export declare function getVersionString(): string;
|
package/dist/version.js
CHANGED