opencode-azure-devops-pr-review 0.3.0 → 0.3.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/CHANGELOG.md +42 -0
- package/README.md +189 -109
- package/package.json +2 -11
- package/src/attribution.mjs +2 -2
- package/src/azure.mjs +18 -3
- package/src/config.mjs +5 -0
- package/src/host.mjs +44 -0
- package/src/plugin.js +2 -1
- package/src/runtime.mjs +27 -5
- package/src/setup.mjs +49 -21
- package/AGENTS.md +0 -164
- package/CODE_OF_CONDUCT.md +0 -83
- package/CONTRIBUTING.md +0 -84
- package/SECURITY.md +0 -38
- package/config/settings.example.json +0 -55
- package/config/settings.schema.json +0 -316
- package/docs/ARCHITECTURE.md +0 -408
- package/docs/AZURE_DEVOPS.md +0 -214
- package/docs/COMMENTING.md +0 -399
- package/docs/DEBUGGING.md +0 -144
- package/docs/DEMO.md +0 -195
- package/docs/ENTERPRISE.md +0 -205
- package/docs/QUICKSTART.md +0 -219
- package/docs/RELEASING.md +0 -95
- package/docs/ROADMAP.md +0 -241
- package/docs/VALIDATION.md +0 -2066
- package/docs/VALIDATION_HISTORY.md +0 -1845
- package/docs/VERIFICATION.md +0 -42
- package/docs/assets/RECORDING.md +0 -131
- package/docs/assets/adjust-findings-teaser.gif +0 -0
- package/docs/assets/adjust-preview.png +0 -0
- package/docs/assets/adjust-publication.png +0 -0
- package/docs/assets/example-comments.md +0 -38
- package/docs/assets/generate-demo-gif.py +0 -25
- package/docs/assets/generate-demo.mjs +0 -141
- package/docs/assets/live-azure-readback.png +0 -0
- package/docs/assets/live-preview.png +0 -0
- package/docs/assets/live-review-teaser.gif +0 -0
- package/docs/assets/live-review.png +0 -0
- package/docs/assets/quick-review-demo.gif +0 -0
- package/docs/assets/record-terminal.py +0 -124
- package/docs/assets/render-terminal-demo.py +0 -168
- package/docs/assets/review-example.svg +0 -1
- package/docs/assets/walkthrough.svg +0 -1
- package/docs/releases/v0.1.0.md +0 -74
- package/docs/releases/v0.2.0.md +0 -107
- package/docs/releases/v0.2.1.md +0 -65
- package/docs/releases/v0.2.2.md +0 -76
- package/docs/releases/v0.2.3.md +0 -93
- package/docs/releases/v0.3.0.md +0 -125
- package/install.sh +0 -171
- package/scripts/merge-settings.py +0 -120
- package/uninstall.sh +0 -50
package/src/host.mjs
CHANGED
|
@@ -44,9 +44,53 @@ export function hostCapabilities(context) {
|
|
|
44
44
|
toolTransform: fn('tool.transform'),
|
|
45
45
|
sessionRemove: fn('session.remove'),
|
|
46
46
|
eventSubscribe: fn('event.subscribe'),
|
|
47
|
+
pluginList: fn('plugin.list'),
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
/** Whether a package specification names the npm package, or the Git repository (github:, git URLs, owner/repo). */
|
|
52
|
+
export function packageNamed(target, name, repository) {
|
|
53
|
+
const spec = typeof target === 'string' ? target.trim() : '';
|
|
54
|
+
if (spec === name || spec.startsWith(`${name}@`)) return true;
|
|
55
|
+
const repo = repository.toLowerCase().replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
56
|
+
return new RegExp(`(?:^|[:/])${repo}(?:\\.git)?(?:[?#]|$)`).test(spec.toLowerCase());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* This plugin's entries in the host's plugin list. OpenCode 2.1.4 lists
|
|
61
|
+
* { id?, source: { type: package|local|builtin|sdk, target?, version? },
|
|
62
|
+
* state: { status: active|failed, error? } } and keeps only the first entry
|
|
63
|
+
* of a plugin ID: a second one is listed as failed with "Duplicate plugin ID".
|
|
64
|
+
* `running` is the active entry with the plugin's ID; `others` are the other
|
|
65
|
+
* entries with that ID or naming one of its packages. null without a list.
|
|
66
|
+
*/
|
|
67
|
+
export function pluginEntries(value, { id, ownPackage }) {
|
|
68
|
+
const entries = listOf(value);
|
|
69
|
+
if (!entries) return null;
|
|
70
|
+
const ours = entries.filter(entry => isRecord(entry) && (entry.id === id || (entry.source?.type === 'package' && ownPackage(entry.source.target))));
|
|
71
|
+
const running = ours.find(entry => entry.id === id && entry.state?.status === 'active') ?? null;
|
|
72
|
+
return { running, others: ours.filter(entry => entry !== running) };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Text with each URL's user name, password and query string masked: a Git or
|
|
77
|
+
* tarball package specification, and host messages that quote one, can carry
|
|
78
|
+
* a token there.
|
|
79
|
+
*/
|
|
80
|
+
export function withoutCredentials(text) {
|
|
81
|
+
return String(text ?? '').replace(/\b([a-z][a-z0-9+.-]*:\/\/)([^\s/?#]*@)?([^\s?#]*)(\?[^\s#]*)?/gi,
|
|
82
|
+
(match, scheme, userinfo, rest, query) => `${scheme}${userinfo ? '***@' : ''}${rest}${query ? '?***' : ''}`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** A path- and credential-free label for a plugin list entry's source: its package specification and installed version or commit. */
|
|
86
|
+
export function pluginSourceLabel(source) {
|
|
87
|
+
if (source?.type === 'local') return 'a local source installation';
|
|
88
|
+
if (source?.type !== 'package' || typeof source.target !== 'string') return 'an entry of unknown origin';
|
|
89
|
+
const version = typeof source.version === 'string' && source.version && !source.target.endsWith(`@${source.version}`) && !source.target.endsWith(`#${source.version}`)
|
|
90
|
+
? /^[a-f0-9]{40}(?:[a-f0-9]{24})?$/i.test(source.version) ? `commit ${source.version.slice(0, 7)}` : `version ${source.version}` : '';
|
|
91
|
+
return `${withoutCredentials(source.target)}${version ? ` (${version})` : ''}`;
|
|
92
|
+
}
|
|
93
|
+
|
|
50
94
|
/**
|
|
51
95
|
* Session events that show a turn progressing while no hook runs. OpenCode
|
|
52
96
|
* 2.1.2 and 2.1.4 emit one delta event per streamed chunk of answer text,
|
package/src/plugin.js
CHANGED
package/src/runtime.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import { dirname, join } from 'node:path';
|
|
|
15
15
|
import { fileURLToPath } from 'node:url';
|
|
16
16
|
import { randomUUID, X509Certificate } from 'node:crypto';
|
|
17
17
|
import { createReviewSession, requestReview, interruptSession, appendReport, classifyFailure } from './session.mjs';
|
|
18
|
-
import { COMMANDS, MODES, ROLES, PROMPTS, roleFor, privateAgent, commentRole, allowedTools, buildAgents, validateSettings, modelRef, modelSlots, commentSlot, patProblem } from './config.mjs';
|
|
18
|
+
import { COMMANDS, MODES, ROLES, PROMPTS, PLUGIN_ID, PACKAGE_NAME, REPOSITORY, roleFor, privateAgent, commentRole, allowedTools, buildAgents, validateSettings, modelRef, modelSlots, commentSlot, patProblem } from './config.mjs';
|
|
19
19
|
import { parseUniqueJSON, parseReviewRequest, parseCommentRequest, visibleText } from './output.mjs';
|
|
20
20
|
import { createDiagnostics, diagnosticResponse, diagnosticToolError, createStageTiming, collectToolObservations } from './diagnostics.mjs';
|
|
21
21
|
import { createCommentData, captureObservation, PAGE_CHARACTERS, COMMENT_TURN_CHARACTERS } from './comment-data.mjs';
|
|
@@ -27,7 +27,7 @@ import { API_VERSION, createAzureClient, fetchTransport, pemCertificates, proxyL
|
|
|
27
27
|
import { REVIEW_TOOL_NAMES, reviewToolDefinitions, runReviewTool } from './review-tools.mjs';
|
|
28
28
|
import { runReview } from './review-work.mjs';
|
|
29
29
|
import { createReviewStore, stateRoot, REVIEW_LIMIT } from './store.mjs';
|
|
30
|
-
import { TESTED_HOST_VERSION, fetchTransportSupported, hostCapabilities, listOf, recordOf, requireMethods, sessionProgress, tokenUsage, usageTotals } from './host.mjs';
|
|
30
|
+
import { TESTED_HOST_VERSION, fetchTransportSupported, hostCapabilities, listOf, packageNamed, pluginEntries, pluginSourceLabel, recordOf, requireMethods, sessionProgress, tokenUsage, usageTotals, withoutCredentials } from './host.mjs';
|
|
31
31
|
import {
|
|
32
32
|
reviewProvenance, provenanceReport, commentAttribution, renderFinalReport, renderCommentActions,
|
|
33
33
|
renderIncompleteDraft, renderReceipt, renderDiagnosticNotices, renderCheckReport, renderPublication,
|
|
@@ -270,9 +270,9 @@ export async function setupAzurePrReview(context, baseDirectory = DEFAULT_DIR, o
|
|
|
270
270
|
const signal = run.controller.signal;
|
|
271
271
|
let now;
|
|
272
272
|
try { now = await scoped(() => readFile(settingsPath, 'utf8'), signal); } catch { throw new Error('[AZPR] settings.json is not readable.'); }
|
|
273
|
-
if (now !== state.raw) throw new Error('[AZPR] settings.json changed since OpenCode loaded it. Restart OpenCode to use the new settings; running reviews are unaffected.');
|
|
273
|
+
if (now !== state.raw) throw new Error('[AZPR] settings.json changed since OpenCode loaded it. Restart the OpenCode service (opencode service restart) to use the new settings; running reviews are unaffected.');
|
|
274
274
|
if (settings.azure.patFile && await scoped(() => readPatFile(settings.azure.patFile), signal) !== pat) {
|
|
275
|
-
throw new Error('[AZPR] azure.patFile changed since OpenCode loaded it. Restart OpenCode to use the new PAT; running reviews are unaffected.');
|
|
275
|
+
throw new Error('[AZPR] azure.patFile changed since OpenCode loaded it. Restart the OpenCode service (opencode service restart) to use the new PAT; running reviews are unaffected.');
|
|
276
276
|
}
|
|
277
277
|
await checkCommands(signal);
|
|
278
278
|
await pinAgents(run.profile, signal);
|
|
@@ -728,6 +728,27 @@ export async function setupAzurePrReview(context, baseDirectory = DEFAULT_DIR, o
|
|
|
728
728
|
const ownerOf = sessionID => [...completed.values()].find(review => review.reportSessions.has(sessionID))?.origin
|
|
729
729
|
?? [...runs.values()].find(run => run.stages.some(stage => stage.sessionID === sessionID))?.origin ?? sessionID;
|
|
730
730
|
|
|
731
|
+
// Which installation answers, and other AZPR entries the host configured but does not run (such as a second version).
|
|
732
|
+
async function installationCheck(run) {
|
|
733
|
+
if (!capabilities.pluginList) return { name: 'AZPR', ok: true, detail: 'This OpenCode does not list its plugins, so the running version is not shown.' };
|
|
734
|
+
let entries;
|
|
735
|
+
try {
|
|
736
|
+
entries = pluginEntries(await bounded(() => context.plugin.list(), run.controller.signal),
|
|
737
|
+
{ id: PLUGIN_ID, ownPackage: target => packageNamed(target, PACKAGE_NAME, REPOSITORY) });
|
|
738
|
+
} catch (error) {
|
|
739
|
+
if (!run.active) throw error;
|
|
740
|
+
return { name: 'AZPR', ok: true, detail: `The plugin list could not be read (${errorText(error)}).` };
|
|
741
|
+
}
|
|
742
|
+
if (!entries) return { name: 'AZPR', ok: true, detail: 'OpenCode returned no plugin list, so the running version is not shown.' };
|
|
743
|
+
const running = entries.running ? `Running ${pluginSourceLabel(entries.running.source)}` : 'This installation is not listed as running';
|
|
744
|
+
if (!entries.others.length) return { name: 'AZPR', ok: true, detail: `${running}.` };
|
|
745
|
+
// The advice comes first: a long package specification may be cut off at the end of the row.
|
|
746
|
+
// Host errors can quote the entry's specification, so mask credentials before shortening them.
|
|
747
|
+
const others = entries.others.map(entry => `${pluginSourceLabel(entry.source)}${typeof entry.state?.error === 'string' ? ` (${withoutCredentials(entry.state.error).slice(0, 80)})` : ''}`);
|
|
748
|
+
return { name: 'AZPR', ok: true, warning: true,
|
|
749
|
+
detail: `Another AZPR entry is configured but not running; keep one (see Upgrading in the README). ${running}; not running: ${others.join('; ')}.` };
|
|
750
|
+
}
|
|
751
|
+
|
|
731
752
|
async function runCheck(run, request) {
|
|
732
753
|
const checks = [];
|
|
733
754
|
for (const problem of run.readiness?.modelProblems ?? []) checks.push({ name: 'Model', ok: false, detail: problem });
|
|
@@ -744,6 +765,7 @@ export async function setupAzurePrReview(context, baseDirectory = DEFAULT_DIR, o
|
|
|
744
765
|
else if (modelSlots('deep').every(slot => settings.models.deep[slot] === settings.models.review[slot])) {
|
|
745
766
|
checks.push({ name: 'Deep models', ok: true, warning: true, detail: 'models.deep repeats models.review, so /pr-deep would only repeat /pr-review; set stronger models there for the PRs that need them.' });
|
|
746
767
|
}
|
|
768
|
+
checks.push(await installationCheck(run));
|
|
747
769
|
// What follows a COMPLETE review of each mode; automatic publication posts as the PAT owner.
|
|
748
770
|
const publishing = MODES.filter(mode => settings.afterReview[mode] === 'publish').map(mode => `/pr-${mode}`);
|
|
749
771
|
const listed = publishing.length > 1 ? `${publishing.slice(0, -1).join(', ')} or ${publishing.at(-1)}` : publishing[0];
|
|
@@ -797,7 +819,7 @@ export async function setupAzurePrReview(context, baseDirectory = DEFAULT_DIR, o
|
|
|
797
819
|
if (request.target.organization.toLowerCase() !== settings.azure.organization.toLowerCase()) {
|
|
798
820
|
throw new Error(`[AZPR] The PR belongs to organization "${request.target.organization}", but azure.organization is "${settings.azure.organization}". Use a PAT and settings for that organization.`);
|
|
799
821
|
}
|
|
800
|
-
if (mode === 'deep' && !settings.deepReady) throw new Error(`[AZPR] /pr-deep runs the review with the models of models.deep: set all three roles${settings.deepPartial ? ' (only some are set)' : ''}, preferably to models stronger than models.review, then restart OpenCode. No fallback to review models.`);
|
|
822
|
+
if (mode === 'deep' && !settings.deepReady) throw new Error(`[AZPR] /pr-deep runs the review with the models of models.deep: set all three roles${settings.deepPartial ? ' (only some are set)' : ''}, preferably to models stronger than models.review, then restart the OpenCode service (opencode service restart). No fallback to review models.`);
|
|
801
823
|
if (mode === 'quick' && !settings.quickReady) throw new Error('[AZPR] Set models.quick.reviewer before /pr-quick. No fallback to other models.');
|
|
802
824
|
// /pr-check checks the review profile's models.
|
|
803
825
|
const profile = mode === 'check' ? 'review' : mode;
|
package/src/setup.mjs
CHANGED
|
@@ -9,14 +9,26 @@ import { COMMANDS, modelRef, privateAgent, validateSettings } from './config.mjs
|
|
|
9
9
|
import { parseUniqueJSON } from './output.mjs';
|
|
10
10
|
import { appendReport } from './session.mjs';
|
|
11
11
|
import { listOf, recordOf, requireMethods } from './host.mjs';
|
|
12
|
+
import { organizationName } from './azure.mjs';
|
|
12
13
|
import { readPatFile, setupAzurePrReview } from './runtime.mjs';
|
|
13
14
|
|
|
14
15
|
const SOURCE_DIRECTORY = dirname(fileURLToPath(import.meta.url));
|
|
15
16
|
const SETUP_DESCRIPTION = 'Configure AZPR with one model and an existing PAT file; no model or Azure calls';
|
|
16
|
-
const USAGE = '/pr-setup --organization ORG --model PROVIDER/MODEL --pat-file "/absolute/path/to/pat"';
|
|
17
|
+
const USAGE = '/pr-setup --organization ORG --model PROVIDER/MODEL [--pat-file "/absolute/path/to/pat"]';
|
|
18
|
+
const RESTART = 'restart the OpenCode service (in a terminal: opencode service restart; if you run opencode serve yourself, restart that process)';
|
|
17
19
|
const MAX_SETTINGS_BYTES = 1024 * 1024;
|
|
18
20
|
const object = value => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
19
21
|
|
|
22
|
+
/** AZPR's directory for user files: $XDG_CONFIG_HOME/azpr, otherwise ~/.config/azpr. */
|
|
23
|
+
function userDirectory(environment) {
|
|
24
|
+
const root = environment.XDG_CONFIG_HOME || join(environment.HOME || homedir(), '.config');
|
|
25
|
+
if (!isAbsolute(root)) throw new Error('[AZPR] XDG_CONFIG_HOME must be an absolute path.');
|
|
26
|
+
return join(root, 'azpr');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The PAT file setup uses without --pat-file, where the quickstart creates it. */
|
|
30
|
+
export const defaultPatFile = (environment = process.env) => join(userDirectory(environment), 'pat');
|
|
31
|
+
|
|
20
32
|
/** Explicit path wins; source installations retain their adjacent settings. */
|
|
21
33
|
export async function settingsFileFor(options = {}, sourceDirectory = SOURCE_DIRECTORY, environment = process.env) {
|
|
22
34
|
if (!object(options) || Object.keys(options).some(key => key !== 'settingsFile')) {
|
|
@@ -30,9 +42,7 @@ export async function settingsFileFor(options = {}, sourceDirectory = SOURCE_DIR
|
|
|
30
42
|
}
|
|
31
43
|
const legacy = join(sourceDirectory, 'settings.json');
|
|
32
44
|
try { await lstat(legacy); return legacy; } catch (error) { if (error.code !== 'ENOENT') throw error; }
|
|
33
|
-
|
|
34
|
-
if (!isAbsolute(root)) throw new Error('[AZPR] XDG_CONFIG_HOME must be an absolute path.');
|
|
35
|
-
return join(root, 'azpr', 'settings.json');
|
|
45
|
+
return join(userDirectory(environment), 'settings.json');
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
/** Do not expose JSON parser excerpts: an existing profile can contain a PAT. */
|
|
@@ -72,8 +82,8 @@ export function parseSetupArguments(text) {
|
|
|
72
82
|
result[flag] = tokens[++index];
|
|
73
83
|
}
|
|
74
84
|
}
|
|
75
|
-
if (['--organization', '--model'
|
|
76
|
-
throw new Error('[AZPR] Supply --organization
|
|
85
|
+
if (['--organization', '--model'].some(flag => !result[flag])) {
|
|
86
|
+
throw new Error('[AZPR] Supply --organization and --model (--pat-file is optional). Use /pr-setup --help.');
|
|
77
87
|
}
|
|
78
88
|
return result;
|
|
79
89
|
}
|
|
@@ -108,8 +118,12 @@ async function readExisting(path) {
|
|
|
108
118
|
} finally { await handle?.close(); }
|
|
109
119
|
}
|
|
110
120
|
|
|
111
|
-
/**
|
|
112
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Atomic, owner-only save; serialize setup calls and preserve unrelated values.
|
|
123
|
+
* Without --pat-file, a replacement keeps the PAT file already set and a first
|
|
124
|
+
* setup uses the default PAT file. Returns the saved organization and PAT file.
|
|
125
|
+
*/
|
|
126
|
+
export async function saveSetup(context, path, arguments_, environment = process.env) {
|
|
113
127
|
const previous = await readExisting(path);
|
|
114
128
|
if (previous !== null && !arguments_['--replace']) {
|
|
115
129
|
throw new Error('[AZPR] Settings already exist. Add --replace to change organization, PAT file and all review/quick model slots while keeping other settings.');
|
|
@@ -120,16 +134,24 @@ export async function saveSetup(context, path, arguments_) {
|
|
|
120
134
|
throw new Error('[AZPR] Repair models and azure objects in settings.json before setup; existing data was preserved.');
|
|
121
135
|
}
|
|
122
136
|
const model = arguments_['--model'];
|
|
123
|
-
const
|
|
137
|
+
const organization = organizationName(arguments_['--organization']);
|
|
138
|
+
const kept = typeof raw.azure?.patFile === 'string' && raw.azure.patFile ? raw.azure.patFile : '';
|
|
139
|
+
const patFile = arguments_['--pat-file'] ?? (kept || defaultPatFile(environment));
|
|
124
140
|
if (typeof patFile !== 'string' || !isAbsolute(patFile) || resolve(patFile) === resolve(path)) {
|
|
125
141
|
throw new Error('[AZPR] --pat-file must name an absolute path separate from settings.json.');
|
|
126
142
|
}
|
|
127
143
|
const next = { ...raw, models: { ...raw.models,
|
|
128
144
|
review: { functional: model, risk: model, verifier: model }, quick: { reviewer: model } },
|
|
129
|
-
azure: { ...raw.azure, organization
|
|
145
|
+
azure: { ...raw.azure, organization, pat: '', patFile } };
|
|
130
146
|
validateSettings(next);
|
|
131
147
|
await checkModel(context, model);
|
|
132
|
-
await readPatFile(patFile);
|
|
148
|
+
try { await readPatFile(patFile); }
|
|
149
|
+
catch (error) {
|
|
150
|
+
if (arguments_['--pat-file'] !== undefined) throw error;
|
|
151
|
+
// Name the file setup chose, so the reader knows where to put the PAT.
|
|
152
|
+
const problem = error.message.replace(/^\[AZPR\] azure\.patFile /, '');
|
|
153
|
+
throw new Error(`[AZPR] No --pat-file was given, and the ${kept ? 'PAT file in the current settings' : 'default PAT file'} ${patFile} ${problem} Create it as the quickstart shows, or name another file with --pat-file.`);
|
|
154
|
+
}
|
|
133
155
|
const parent = dirname(path);
|
|
134
156
|
await mkdir(parent, { recursive: true, mode: 0o700 });
|
|
135
157
|
const parentInfo = await lstat(parent);
|
|
@@ -150,6 +172,7 @@ export async function saveSetup(context, path, arguments_) {
|
|
|
150
172
|
await handle?.close();
|
|
151
173
|
if (acquired) await unlink(lock);
|
|
152
174
|
}
|
|
175
|
+
return { organization, patFile };
|
|
153
176
|
}
|
|
154
177
|
|
|
155
178
|
async function writeTemporary(path, text) {
|
|
@@ -157,16 +180,18 @@ async function writeTemporary(path, text) {
|
|
|
157
180
|
try { await handle.writeFile(text); await handle.sync(); } finally { await handle.close(); }
|
|
158
181
|
}
|
|
159
182
|
|
|
160
|
-
async function guide(context, path, problem) {
|
|
161
|
-
let catalog = [];
|
|
183
|
+
async function guide(context, path, problem, environment) {
|
|
184
|
+
let catalog = [], patFile;
|
|
162
185
|
try { catalog = (listOf(await context.model.list()) ?? []).filter(item => item.enabled !== false && item.capabilities?.tools === true); } catch { /* Help remains usable before provider setup. */ }
|
|
186
|
+
try { patFile = defaultPatFile(environment); } catch { patFile = '$XDG_CONFIG_HOME/azpr/pat'; }
|
|
163
187
|
const models = catalog.slice(0, 12).map(item => `${item.providerID}/${item.id}`);
|
|
164
188
|
return `[AZPR] SETUP${problem ? ' REQUIRED' : ''}\nSettings: ${path}\n${problem ? `Problem when OpenCode loaded AZPR: ${problem}\n` : ''}\n` +
|
|
165
189
|
`1. Connect your provider in OpenCode and choose one tool-capable model ID (${models.length ? models.join(', ') : 'run opencode models'}).\n` +
|
|
166
|
-
|
|
190
|
+
`2. Create an Azure DevOps PAT for one organization with Code (Read) and Pull Request Threads (Read & write). Keep it alone in a regular file owned by you, with mode 600 (by default ${patFile}); never paste it into this conversation.\n` +
|
|
167
191
|
`3. Run ${USAGE}\n\n` +
|
|
192
|
+
'--organization also takes a PR or organization URL. Without --pat-file, setup uses the default PAT file, or with --replace the PAT file already set. ' +
|
|
168
193
|
'The selected model fills the three review roles and the quick reviewer. Deep remains unchanged (off for a new profile). Existing settings require --replace; other settings are kept. No model request or Azure request is made.\n' +
|
|
169
|
-
|
|
194
|
+
`After saving, ${RESTART}, then run /pr-check <PR URL>. Settings changes do not affect reviews already running.`;
|
|
170
195
|
}
|
|
171
196
|
|
|
172
197
|
/**
|
|
@@ -192,7 +217,8 @@ async function settingsProblem(path) {
|
|
|
192
217
|
|
|
193
218
|
/** Missing/invalid settings expose only setup and blocked command explanations, with the reason. */
|
|
194
219
|
export async function setupPlugin(context, sourceDirectory = SOURCE_DIRECTORY, testOptions = {}) {
|
|
195
|
-
const
|
|
220
|
+
const { environment = process.env, ...runtimeOptions } = testOptions;
|
|
221
|
+
const path = await settingsFileFor(context.options ?? {}, sourceDirectory, environment);
|
|
196
222
|
const { problem, disabled } = await settingsProblem(path);
|
|
197
223
|
const blocked = Boolean(problem);
|
|
198
224
|
if (disabled) return async () => {};
|
|
@@ -210,12 +236,14 @@ export async function setupPlugin(context, sourceDirectory = SOURCE_DIRECTORY, t
|
|
|
210
236
|
let text;
|
|
211
237
|
try {
|
|
212
238
|
const arguments_ = parseSetupArguments(event.prompt.text ?? '');
|
|
213
|
-
if (arguments_ === null) text = await guide(context, path, problem);
|
|
239
|
+
if (arguments_ === null) text = await guide(context, path, problem, environment);
|
|
214
240
|
else {
|
|
215
241
|
if (pending) throw new Error('[AZPR] Another setup is active.');
|
|
216
242
|
pending = true;
|
|
217
|
-
|
|
218
|
-
|
|
243
|
+
let saved;
|
|
244
|
+
try { saved = await saveSetup(context, path, arguments_, environment); } finally { pending = false; }
|
|
245
|
+
text = `[AZPR] SETTINGS SAVED\nSettings: ${path}\nOrganization: ${saved.organization}; PAT file: ${saved.patFile}\n` +
|
|
246
|
+
`To load them, ${RESTART}, then run /pr-check <PR URL>. No model or Azure request was made. Existing reviews keep their original settings.`;
|
|
219
247
|
}
|
|
220
248
|
} catch (error) {
|
|
221
249
|
// OS errors may include file contents only through custom providers; report codes, not arbitrary text.
|
|
@@ -225,11 +253,11 @@ export async function setupPlugin(context, sourceDirectory = SOURCE_DIRECTORY, t
|
|
|
225
253
|
} });
|
|
226
254
|
if (blocked) for (const name of Object.keys(COMMANDS)) editor.add({ name, description: 'AZPR setup required; run /pr-setup', async execute(event) {
|
|
227
255
|
await appendReport(context, { sessionID: event.sessionID,
|
|
228
|
-
text: `[AZPR] SETUP REQUIRED\nNo review or Azure request was started. Settings at ${path} could not be used when OpenCode loaded AZPR: ${problem} Run /pr-setup --help; repair an existing settings file if necessary, then
|
|
256
|
+
text: `[AZPR] SETUP REQUIRED\nNo review or Azure request was started. Settings at ${path} could not be used when OpenCode loaded AZPR: ${problem} Run /pr-setup --help; repair an existing settings file if necessary, then ${RESTART}.` });
|
|
229
257
|
} });
|
|
230
258
|
});
|
|
231
259
|
let cleanup;
|
|
232
|
-
try { if (!blocked) cleanup = await setupAzurePrReview(context, sourceDirectory, { ...
|
|
260
|
+
try { if (!blocked) cleanup = await setupAzurePrReview(context, sourceDirectory, { ...runtimeOptions, settingsPath: path }); }
|
|
233
261
|
catch (error) { await registration.dispose(); throw error; }
|
|
234
262
|
return async () => { await cleanup?.(); await registration.dispose(); };
|
|
235
263
|
}
|
package/AGENTS.md
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
# AI development guide
|
|
2
|
-
|
|
3
|
-
This repository targets the OpenCode V2 plugin API (tested with
|
|
4
|
-
`@opencode/cli@2.1.4`), the Azure DevOps Services REST API (api-version 7.1)
|
|
5
|
-
and Ubuntu 22.04. Public source and documentation use English. Follow the user's
|
|
6
|
-
conversation language and current authorization scope.
|
|
7
|
-
|
|
8
|
-
## Before changing anything
|
|
9
|
-
|
|
10
|
-
Confirm the Git root, branch, HEAD, working tree and installed paths. Read
|
|
11
|
-
README, architecture, roadmap and the task-relevant docs. Local handover notes
|
|
12
|
-
under `.local/` (their file name differs between checkouts) give background
|
|
13
|
-
and hand-off state, never new authorization; check what they say against Git
|
|
14
|
-
and the actual environment. Preserve unrelated changes, credentials, private
|
|
15
|
-
settings, backups and failure records. Never upload `.local/`.
|
|
16
|
-
|
|
17
|
-
## Design rules
|
|
18
|
-
|
|
19
|
-
**Deterministic facts are code; judgment is model work.**
|
|
20
|
-
- PR identity, commit SHAs, the changed-file list, version rechecks, existing
|
|
21
|
-
threads and all Azure DevOps writes go through `azure.mjs`, which calls the
|
|
22
|
-
REST API with `azure.organization` and the PAT from AZPR's settings
|
|
23
|
-
(`azure.pat`, or the owner-only file named by `azure.patFile`, which is read
|
|
24
|
-
only through its symbolic-link, owner and mode checks). Keep
|
|
25
|
-
REST paths and the pinned api-version in `azure.mjs` only; never log, echo or
|
|
26
|
-
persist the PAT, and send it only to the organization's REST endpoint.
|
|
27
|
-
`azure.proxy`, `azure.caFile` and `azure.verifyTls` shape only that
|
|
28
|
-
connection; never show proxy credentials.
|
|
29
|
-
- Models read the repository only through the read-only tools in
|
|
30
|
-
`review-tools.mjs`, registered with `codemode: false`; private roles see an
|
|
31
|
-
explicit tool allowlist and ordinary sessions never see AZPR's tools.
|
|
32
|
-
- Models review, verify and plan comment text. They never echo identity or SHAs
|
|
33
|
-
and never write to Azure DevOps.
|
|
34
|
-
|
|
35
|
-
**Quick reviews are not verified, and say so.**
|
|
36
|
-
- `/pr-quick` runs one reviewer per shard and no verifier or duplicate check.
|
|
37
|
-
The runtime checks only the form and source of its findings (fields, a
|
|
38
|
-
location that exists at that commit, a file this session's own tools read);
|
|
39
|
-
it never judges whether a defect is real. Passing findings are `REPORTED`,
|
|
40
|
-
the rest `NEEDS_INFO`, and the review records `verification: "none"`.
|
|
41
|
-
- Never present quick findings as verified: shared prompts carry
|
|
42
|
-
`<!-- azpr:verified -->` / `<!-- azpr:quick -->` variants for the passages
|
|
43
|
-
about where findings come from, the report and receipt state status,
|
|
44
|
-
coverage and verification separately, and the comment disclosure line names
|
|
45
|
-
the quick method. The review system prompts, which deep shares, stay
|
|
46
|
-
byte-identical unless a change to them is deliberate (a hash test locks them).
|
|
47
|
-
- Only records identical in every field are merged as duplicates; findings on
|
|
48
|
-
the same lines stay separate. A parsed answer without a usable review never
|
|
49
|
-
makes a commentable COMPLETE, and zero findings never hide unreviewed files.
|
|
50
|
-
|
|
51
|
-
**Deep reviews differ only in their models.**
|
|
52
|
-
- `/pr-deep` runs the review's stages and system prompts with the models of
|
|
53
|
-
`models.deep`, which are meant to be stronger than the review models, and
|
|
54
|
-
never falls back to the review models. Deep-only prompt text was removed
|
|
55
|
-
after live runs showed it changed neither model's results; add
|
|
56
|
-
mode-specific instructions only with a measured benefit.
|
|
57
|
-
|
|
58
|
-
**Keep useful work; degrade per item.**
|
|
59
|
-
- Answers that break the output contract get a correction turn in the same
|
|
60
|
-
session (`workflow.repairAttempts`) listing concrete problems. After that,
|
|
61
|
-
degrade the affected item (UNREVIEWED, NEEDS_INFO, skipped comment) and keep the
|
|
62
|
-
rest. Never discard a whole review for one bad item, and never invent a
|
|
63
|
-
decision, evidence or a location.
|
|
64
|
-
- A quick reviewer whose usable answer is PARTIAL with named unfinished work
|
|
65
|
-
gets one follow-up turn in the same session, within the same budget; a
|
|
66
|
-
follow-up that fails or gives no usable answer never replaces the answer it
|
|
67
|
-
followed.
|
|
68
|
-
- Transient execution failures retry once in a new session; overflow splits the
|
|
69
|
-
shard. Permanent failures and cancellations are not retried.
|
|
70
|
-
- Only a changed source commit makes a review STALE.
|
|
71
|
-
|
|
72
|
-
**Bounded, recoverable execution.**
|
|
73
|
-
- All AZPR Azure DevOps traffic shares the queue in `tool-queue.mjs` (concurrency and
|
|
74
|
-
per-call timeout). Release slots in `finally`; never depend on a hook running.
|
|
75
|
-
- Large PRs are handled by sharding, not by compaction: private sessions may not
|
|
76
|
-
compact, and a compaction the host attempts in a reviewer's turn means "split
|
|
77
|
-
this shard". A refused background summary (`experimental.background_compaction`)
|
|
78
|
-
ends nothing, so the turn's own failure decides its class.
|
|
79
|
-
- There is deliberately no default whole-run timeout and no per-stage step cap;
|
|
80
|
-
see the roadmap's Deferred section before adding either.
|
|
81
|
-
|
|
82
|
-
**Authorization.**
|
|
83
|
-
- Only explicit commands start private sessions, and the comment step a
|
|
84
|
-
COMPLETE review hands on when `afterReview` or the review command's flag
|
|
85
|
-
(`--preview`, `--publish`) asks for it; that step is a run of its own with a
|
|
86
|
-
STARTED notice and a receipt. Every private prompt is the
|
|
87
|
-
exact runtime-pending text with a fresh nonce; private agents cannot be
|
|
88
|
-
mentioned, delegated, compacted or used for auxiliary requests.
|
|
89
|
-
- Settings are read once; a changed file blocks new runs only. Hooks check the
|
|
90
|
-
grant, not files or catalogs.
|
|
91
|
-
- Pin private agent definitions at first use and refuse later host changes.
|
|
92
|
-
- Shell for private roles follows the `shell` setting (default deny), enforced
|
|
93
|
-
through the `permission` hook and by hiding the tool. Native edit, write,
|
|
94
|
-
patch, delegation, web, question, session/model control and CodeMode execute
|
|
95
|
-
stay denied. Allowed shell has real host authority; never call it a sandbox.
|
|
96
|
-
- `/pr-comment` and `/pr-stop` act only within the caller's conversation (or a
|
|
97
|
-
session of that review).
|
|
98
|
-
|
|
99
|
-
**Publication is idempotent.**
|
|
100
|
-
- Recheck the PR (active, unchanged head) before writing; skip existing markers;
|
|
101
|
-
save each result immediately; read markers back. Re-running is always safe.
|
|
102
|
-
- Automatic publication (`afterReview: publish` or `--publish` after the PR
|
|
103
|
-
URL) follows only a COMPLETE review with findings to comment on that nothing
|
|
104
|
-
stopped. It posts item by item: an item whose text has an `@<…>` mention,
|
|
105
|
-
an image, HTML that embeds content, runs a script or hides text, or a `javascript:`,
|
|
106
|
-
`vbscript:`, `data:` or `file://` link (mentions and script links also after
|
|
107
|
-
decoding escapes and character references, script links also without tabs
|
|
108
|
-
and line breaks) waits for a person, and the
|
|
109
|
-
receipt names it; ordinary links are posted, and literal code is skipped
|
|
110
|
-
(except for mentions) only where every reading of the Markdown agrees. A
|
|
111
|
-
plan that would post only a
|
|
112
|
-
repeated summary (every finding skipped as already discussed on the PR) is
|
|
113
|
-
`NOTHING_TO_POST`. Its checks are deterministic and prefer a false alarm;
|
|
114
|
-
never relax them to model judgment. Commands the user types keep their
|
|
115
|
-
behavior.
|
|
116
|
-
- Inline markers are stable (PR, path, normalized anchor, ordinal); do not put a
|
|
117
|
-
review ID or model wording into them.
|
|
118
|
-
- A person's adjustments (`/pr-comment <review-id> --exclude`, `--severity`,
|
|
119
|
-
`--reset`) change only the findings handed to comment planning, never the
|
|
120
|
-
review record or a prompt file; the planner input carries `adjustments` only
|
|
121
|
-
when some exist, so unadjusted reviews plan exactly as before. A review
|
|
122
|
-
adjusted once is posted only from a preview planned after its latest
|
|
123
|
-
adjustment (an adjustment drops the earlier preview in the same save) and is
|
|
124
|
-
neither adjusted nor planned again once its publication started. That save
|
|
125
|
-
and the new preview's save must succeed; never let a failed save report an
|
|
126
|
-
adjustment as applied. Text the runtime renders that names an excluded
|
|
127
|
-
finding holds publication. Items an earlier publication already put on the
|
|
128
|
-
PR are skipped as always; its receipt names those whose text differs, since
|
|
129
|
-
posted comments are never changed.
|
|
130
|
-
- Comment planning pages run side by side, so nothing a page sees or produces
|
|
131
|
-
may depend on which page finishes first: only the first page writes the
|
|
132
|
-
summary note, each page keeps its own continuation state and evidence, and
|
|
133
|
-
pages are assembled in page order (ordinals follow page order).
|
|
134
|
-
|
|
135
|
-
**Persistence and privacy.**
|
|
136
|
-
- Completed reviews, plans and ledgers persist under the private state directory
|
|
137
|
-
(owner-only permissions, newest 20). Clean only stale, unreferenced data.
|
|
138
|
-
- Diagnostics are opt-in and never record reasoning, headers or provider
|
|
139
|
-
configuration.
|
|
140
|
-
|
|
141
|
-
**Compatibility.** Host response shapes and constants belong in `host.mjs`.
|
|
142
|
-
Detect capabilities; do not assume them.
|
|
143
|
-
|
|
144
|
-
## Verification and delivery
|
|
145
|
-
|
|
146
|
-
Run `npm run check` and `npm test`. For changes touching hooks, sessions, tools, Azure access or
|
|
147
|
-
publication, also run `node tests/host-v2-smoke.mjs <opencode binary>` (fresh and
|
|
148
|
-
`--replace`), `node tests/host-v2-comment-scale.mjs <opencode binary>` and
|
|
149
|
-
`node tests/host-v2-background-compaction.mjs <opencode binary>`.
|
|
150
|
-
For package entry points, first-run setup or settings-path changes, also run
|
|
151
|
-
`node tests/host-v2-smoke.mjs <opencode binary> --native`; this installs the
|
|
152
|
-
packed artifact through OpenCode's plugin manager in an isolated profile.
|
|
153
|
-
Installer tests must preserve unrelated files and private settings, reject
|
|
154
|
-
conflicts and test rollback and archival uninstall. Keep the README manual-copy
|
|
155
|
-
list exact.
|
|
156
|
-
|
|
157
|
-
Fake-service fixtures and live Azure/model runs establish different claims;
|
|
158
|
-
record exact versions, environment and limitations in `docs/VALIDATION.md`, and
|
|
159
|
-
move superseded validation pages to `docs/VALIDATION_HISTORY.md` instead of
|
|
160
|
-
rewriting earlier results.
|
|
161
|
-
|
|
162
|
-
Do not start live models, publish PR comments, change personal settings,
|
|
163
|
-
upgrade installed tools or publish a repository or package without authorization
|
|
164
|
-
for that action. Authorization applies to the current request only.
|
package/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
|
6
|
-
|
|
7
|
-
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
-
|
|
9
|
-
## Our Standards
|
|
10
|
-
|
|
11
|
-
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
-
|
|
13
|
-
* Demonstrating empathy and kindness toward other people
|
|
14
|
-
* Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
-
* Giving and gracefully accepting constructive feedback
|
|
16
|
-
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
-
* Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
-
|
|
19
|
-
Examples of unacceptable behavior include:
|
|
20
|
-
|
|
21
|
-
* The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
22
|
-
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
23
|
-
* Public or private harassment
|
|
24
|
-
* Publishing others' private information, such as a physical or email address, without their explicit permission
|
|
25
|
-
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
26
|
-
|
|
27
|
-
## Enforcement Responsibilities
|
|
28
|
-
|
|
29
|
-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
-
|
|
31
|
-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
32
|
-
|
|
33
|
-
## Scope
|
|
34
|
-
|
|
35
|
-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
36
|
-
|
|
37
|
-
## Enforcement
|
|
38
|
-
|
|
39
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at weiting.lai.code@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
|
40
|
-
|
|
41
|
-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
42
|
-
|
|
43
|
-
## Enforcement Guidelines
|
|
44
|
-
|
|
45
|
-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
46
|
-
|
|
47
|
-
### 1. Correction
|
|
48
|
-
|
|
49
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
50
|
-
|
|
51
|
-
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
52
|
-
|
|
53
|
-
### 2. Warning
|
|
54
|
-
|
|
55
|
-
**Community Impact**: A violation through a single incident or series of actions.
|
|
56
|
-
|
|
57
|
-
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
58
|
-
|
|
59
|
-
### 3. Temporary Ban
|
|
60
|
-
|
|
61
|
-
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
|
62
|
-
|
|
63
|
-
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
64
|
-
|
|
65
|
-
### 4. Permanent Ban
|
|
66
|
-
|
|
67
|
-
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
68
|
-
|
|
69
|
-
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
|
70
|
-
|
|
71
|
-
## Attribution
|
|
72
|
-
|
|
73
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
74
|
-
|
|
75
|
-
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
76
|
-
|
|
77
|
-
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
|
|
78
|
-
|
|
79
|
-
[homepage]: https://www.contributor-covenant.org
|
|
80
|
-
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
81
|
-
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
82
|
-
[FAQ]: https://www.contributor-covenant.org/faq
|
|
83
|
-
[translations]: https://www.contributor-covenant.org/translations
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# Contributing
|
|
2
|
-
|
|
3
|
-
Bug reports, focused fixes and documentation improvements are welcome. Start
|
|
4
|
-
with the [quickstart](docs/QUICKSTART.md), [architecture](docs/ARCHITECTURE.md)
|
|
5
|
-
and [roadmap](docs/ROADMAP.md). Public source and documentation use English.
|
|
6
|
-
Everyone taking part follows the [code of conduct](CODE_OF_CONDUCT.md), which
|
|
7
|
-
also says where to report a conduct problem.
|
|
8
|
-
|
|
9
|
-
## Report a problem or suggest a change
|
|
10
|
-
|
|
11
|
-
Use the [issue forms](https://github.com/WTLAIB/opencode-azure-devops-pr-review-v2/issues/new/choose).
|
|
12
|
-
Include the AZPR tag or commit, OpenCode version, operating system, command and
|
|
13
|
-
a small reproduction. For a review failure, the sanitized error and relevant
|
|
14
|
-
receipt stage are usually enough to start. Describe the PR's approximate file
|
|
15
|
-
and changed-line counts if its size matters. You do not need to share a company
|
|
16
|
-
repository or run a paid review again to file a report.
|
|
17
|
-
|
|
18
|
-
Issues are public. Never attach raw settings, PATs, provider credentials,
|
|
19
|
-
proxy URLs containing credentials, `.local/`, state directories or complete
|
|
20
|
-
diagnostics. Receipts and screenshots can also contain private organization,
|
|
21
|
-
repository and source details; inspect and redact excerpts before sharing.
|
|
22
|
-
See [debugging](docs/DEBUGGING.md) and [data handling](docs/ENTERPRISE.md).
|
|
23
|
-
Report suspected security vulnerabilities through [private reporting](SECURITY.md).
|
|
24
|
-
|
|
25
|
-
For a larger feature, describe the use case and proposed behavior in an issue
|
|
26
|
-
before investing in an implementation. A documentation fix or small bug fix
|
|
27
|
-
can go straight to a pull request.
|
|
28
|
-
|
|
29
|
-
## Work locally
|
|
30
|
-
|
|
31
|
-
Use Node.js 22.12 or later, POSIX `sh`, Python 3 and Git. The current host
|
|
32
|
-
acceptance target is OpenCode V2 `@opencode/cli@2.1.4` on Ubuntu 22.04; other
|
|
33
|
-
environments are not yet validated. The runtime has no npm dependencies or
|
|
34
|
-
build step. From your checkout:
|
|
35
|
-
|
|
36
|
-
```sh
|
|
37
|
-
npm run check
|
|
38
|
-
npm test
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Read [AGENTS.md](AGENTS.md) for the design rules and change-specific checks.
|
|
42
|
-
Keep deterministic PR facts and Azure writes in the runtime; models supply
|
|
43
|
-
review judgment and comment text. Preserve the distinction between quick
|
|
44
|
-
findings and independently verified findings. Add a focused regression test
|
|
45
|
-
when fixing behavior, and update the relevant documentation when it changes.
|
|
46
|
-
|
|
47
|
-
Changes to hooks, sessions, tools, Azure access or publication also need all
|
|
48
|
-
five host fixture runs. Install the tested host into a disposable local directory
|
|
49
|
-
without changing your everyday OpenCode installation:
|
|
50
|
-
|
|
51
|
-
```sh
|
|
52
|
-
npm install --prefix "$PWD/.local/contributor-host" --no-audit --no-fund @opencode/cli@2.1.4
|
|
53
|
-
AZPR_TEST_HOST="$PWD/.local/contributor-host/node_modules/.bin/opencode"
|
|
54
|
-
node tests/host-v2-smoke.mjs "$AZPR_TEST_HOST"
|
|
55
|
-
node tests/host-v2-smoke.mjs "$AZPR_TEST_HOST" --replace
|
|
56
|
-
node tests/host-v2-smoke.mjs "$AZPR_TEST_HOST" --native
|
|
57
|
-
node tests/host-v2-comment-scale.mjs "$AZPR_TEST_HOST"
|
|
58
|
-
node tests/host-v2-background-compaction.mjs "$AZPR_TEST_HOST"
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
The fixtures need `openssl` and use isolated configuration, a fake model
|
|
62
|
-
provider and fake Azure services. They do not need your PAT or provider account,
|
|
63
|
-
consume paid model quota, or post real comments. Their records stay under the
|
|
64
|
-
ignored `.local/` directory. Passing them establishes host integration, not
|
|
65
|
-
real-model review quality or live Azure acceptance.
|
|
66
|
-
|
|
67
|
-
Installer changes must preserve unrelated files and private settings, reject
|
|
68
|
-
conflicts, and cover rollback and archival uninstall. Keep the README's
|
|
69
|
-
manual-copy file list accurate. Never replace your personal configuration or
|
|
70
|
-
run live models or Azure publication as an incidental test; use a designated
|
|
71
|
-
test environment with explicit permission for those actions.
|
|
72
|
-
|
|
73
|
-
## Open a pull request
|
|
74
|
-
|
|
75
|
-
Keep the change focused. Explain the problem, resulting behavior and checks
|
|
76
|
-
run; name anything you could not verify. A short title such as
|
|
77
|
-
`fix: preserve comment recovery after restart` is useful, but no special commit
|
|
78
|
-
format is required. Do not include generated private records or credentials.
|
|
79
|
-
|
|
80
|
-
For host compatibility or live acceptance evidence, record exact versions,
|
|
81
|
-
environment and limitations in [current validation](docs/VALIDATION.md), and
|
|
82
|
-
preserve superseded results in [validation history](docs/VALIDATION_HISTORY.md).
|
|
83
|
-
Keep fake-service and live results distinct. Documentation-only changes need
|
|
84
|
-
link and example checks; they do not require live reviews or publication.
|