@h-rig/doctor-plugin 0.0.6-alpha.157 → 0.0.6-alpha.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/index.js +25 -16
- package/dist/src/plugin.d.ts +2 -2
- package/dist/src/plugin.js +25 -16
- package/dist/src/service.d.ts +1 -2
- package/dist/src/service.js +18 -9
- package/package.json +4 -6
package/dist/src/index.js
CHANGED
|
@@ -23,12 +23,13 @@ __export(exports_service, {
|
|
|
23
23
|
});
|
|
24
24
|
import { existsSync, readFileSync } from "fs";
|
|
25
25
|
import { resolve } from "path";
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
26
|
+
import { defineCapability } from "@rig/core/capability";
|
|
27
|
+
import { loadCapabilityForRoot } from "@rig/core/capability-loaders";
|
|
28
|
+
import { isSupportedBunVersion, MIN_SUPPORTED_BUN_VERSION } from "@rig/core/setup-version";
|
|
29
|
+
import { checkGitHubRepoPermissions, resolveGitHubAuthStatus } from "@rig/github-lib";
|
|
28
30
|
import { loadConfig } from "@rig/core/load-config";
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import { listRuns } from "@rig/run-worker/runs";
|
|
31
|
+
import { readSelection, listPlacements } from "@rig/core/placement";
|
|
32
|
+
import { RUN_IDENTITY_ENV, RUN_READ_MODEL } from "@rig/contracts";
|
|
32
33
|
function check(id, label, status, detail, remediation) {
|
|
33
34
|
return { id, label, status, level: status === "pass" ? "ok" : status, ...detail ? { detail } : {}, ...remediation ? { remediation } : {} };
|
|
34
35
|
}
|
|
@@ -110,7 +111,7 @@ function prMergeCheck(config) {
|
|
|
110
111
|
}
|
|
111
112
|
async function defaultPiChecks() {
|
|
112
113
|
const pi = Bun.which("pi");
|
|
113
|
-
return [{ ok: Boolean(pi), label: "pi",
|
|
114
|
+
return [{ ok: Boolean(pi), label: "pi", ...pi ? { detail: pi } : { hint: "Install Pi/OMP and the Rig extension." } }];
|
|
114
115
|
}
|
|
115
116
|
async function defaultRequestJson(projectRoot, pathname, _init) {
|
|
116
117
|
if (pathname === "/api/github/auth/status")
|
|
@@ -164,14 +165,20 @@ async function runDoctorChecks(options) {
|
|
|
164
165
|
const piChecks = await (options.piChecks ?? defaultPiChecks)().catch((error) => [{ ok: false, label: "pi/pi-rig checks", detail: undefined, hint: errorMessage(error) }]);
|
|
165
166
|
for (const pi of piChecks)
|
|
166
167
|
checks.push(check(pi.label === "pi" ? "pi" : "pi-rig", pi.label, pi.ok ? "pass" : "warn", pi.detail, pi.hint ?? (pi.ok ? undefined : "Install Pi/OMP and the Rig extension.")));
|
|
167
|
-
const
|
|
168
|
+
const identityService = options.identityContext ? await loadCapabilityForRoot(projectRoot, RunIdentityEnvCap) : null;
|
|
169
|
+
const identity = options.identityContext ? identityService?.resolveRigIdentity(options.identityContext) ?? null : null;
|
|
168
170
|
if (options.identityContext) {
|
|
169
|
-
const filter = resolveRigIdentityFilter(options.identityContext);
|
|
171
|
+
const filter = identityService?.resolveRigIdentityFilter(options.identityContext) ?? null;
|
|
170
172
|
checks.push({ label: "identity", status: identity ? "pass" : "warn", level: identity ? "ok" : "warn", detail: identity?.source ?? "GitHub identity unavailable" });
|
|
171
173
|
checks.push({ label: "github-repo", status: filter?.selectedRepo ? "pass" : "warn", level: filter?.selectedRepo ? "ok" : "warn", detail: filter?.selectedRepo ?? "repo not selected" });
|
|
172
174
|
}
|
|
173
175
|
try {
|
|
174
|
-
const runs =
|
|
176
|
+
const runs = options.listRuns ? await options.listRuns(projectRoot) : await (async () => {
|
|
177
|
+
const service = await loadCapabilityForRoot(projectRoot, RunReadModelCap);
|
|
178
|
+
if (!service)
|
|
179
|
+
throw new Error("RUN_READ_MODEL capability is not registered for this project");
|
|
180
|
+
return service.listRuns({ projectRoot });
|
|
181
|
+
})();
|
|
175
182
|
checks.push({ label: "run-discovery", status: "pass", level: "ok", detail: `${runs.length} run session(s)` });
|
|
176
183
|
} catch (error) {
|
|
177
184
|
checks.push({ label: "run-discovery", status: "fail", level: "fail", detail: errorMessage(error) });
|
|
@@ -184,26 +191,28 @@ async function runDoctorChecks(options) {
|
|
|
184
191
|
}
|
|
185
192
|
return checks;
|
|
186
193
|
}
|
|
187
|
-
var doctorRunner;
|
|
194
|
+
var RunIdentityEnvCap, RunReadModelCap, doctorRunner;
|
|
188
195
|
var init_service = __esm(() => {
|
|
196
|
+
RunIdentityEnvCap = defineCapability(RUN_IDENTITY_ENV);
|
|
197
|
+
RunReadModelCap = defineCapability(RUN_READ_MODEL);
|
|
189
198
|
doctorRunner = { runDoctorChecks };
|
|
190
199
|
});
|
|
191
200
|
|
|
192
201
|
// packages/doctor-plugin/src/plugin.ts
|
|
193
202
|
import { definePlugin } from "@rig/core/config";
|
|
194
|
-
import {
|
|
203
|
+
import { defineCapability as defineCapability2 } from "@rig/core/capability";
|
|
204
|
+
import { DOCTOR } from "@rig/contracts";
|
|
195
205
|
var DOCTOR_PLUGIN_NAME = "@rig/doctor-plugin";
|
|
206
|
+
var DoctorCap = defineCapability2(DOCTOR);
|
|
196
207
|
var doctorPlugin = definePlugin({
|
|
197
208
|
name: DOCTOR_PLUGIN_NAME,
|
|
198
209
|
version: "0.0.0-alpha.1",
|
|
199
210
|
contributes: {
|
|
200
211
|
capabilities: [
|
|
201
|
-
{
|
|
202
|
-
id: DOCTOR_RUNNER_CAPABILITY_ID,
|
|
212
|
+
DoctorCap.provide(async () => (await Promise.resolve().then(() => (init_service(), exports_service))).doctorRunner, {
|
|
203
213
|
title: "Diagnostic doctor checks",
|
|
204
|
-
description: "Local toolchain, rig.config loadability, GitHub auth/permissions, Pi, and run/relay diagnostics with remediation copy."
|
|
205
|
-
|
|
206
|
-
}
|
|
214
|
+
description: "Local toolchain, rig.config loadability, GitHub auth/permissions, Pi, and run/relay diagnostics with remediation copy."
|
|
215
|
+
})
|
|
207
216
|
]
|
|
208
217
|
}
|
|
209
218
|
});
|
package/dist/src/plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const DOCTOR_PLUGIN_NAME = "@rig/doctor-plugin";
|
|
2
|
-
export declare const doctorPlugin: import("@rig/core").RigPlugin;
|
|
3
|
-
export declare function createDoctorPlugin(): import("@rig/core").RigPlugin;
|
|
2
|
+
export declare const doctorPlugin: import("@rig/core/config").RigPlugin;
|
|
3
|
+
export declare function createDoctorPlugin(): import("@rig/core/config").RigPlugin;
|
|
4
4
|
export default doctorPlugin;
|
package/dist/src/plugin.js
CHANGED
|
@@ -23,12 +23,13 @@ __export(exports_service, {
|
|
|
23
23
|
});
|
|
24
24
|
import { existsSync, readFileSync } from "fs";
|
|
25
25
|
import { resolve } from "path";
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
26
|
+
import { defineCapability } from "@rig/core/capability";
|
|
27
|
+
import { loadCapabilityForRoot } from "@rig/core/capability-loaders";
|
|
28
|
+
import { isSupportedBunVersion, MIN_SUPPORTED_BUN_VERSION } from "@rig/core/setup-version";
|
|
29
|
+
import { checkGitHubRepoPermissions, resolveGitHubAuthStatus } from "@rig/github-lib";
|
|
28
30
|
import { loadConfig } from "@rig/core/load-config";
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import { listRuns } from "@rig/run-worker/runs";
|
|
31
|
+
import { readSelection, listPlacements } from "@rig/core/placement";
|
|
32
|
+
import { RUN_IDENTITY_ENV, RUN_READ_MODEL } from "@rig/contracts";
|
|
32
33
|
function check(id, label, status, detail, remediation) {
|
|
33
34
|
return { id, label, status, level: status === "pass" ? "ok" : status, ...detail ? { detail } : {}, ...remediation ? { remediation } : {} };
|
|
34
35
|
}
|
|
@@ -110,7 +111,7 @@ function prMergeCheck(config) {
|
|
|
110
111
|
}
|
|
111
112
|
async function defaultPiChecks() {
|
|
112
113
|
const pi = Bun.which("pi");
|
|
113
|
-
return [{ ok: Boolean(pi), label: "pi",
|
|
114
|
+
return [{ ok: Boolean(pi), label: "pi", ...pi ? { detail: pi } : { hint: "Install Pi/OMP and the Rig extension." } }];
|
|
114
115
|
}
|
|
115
116
|
async function defaultRequestJson(projectRoot, pathname, _init) {
|
|
116
117
|
if (pathname === "/api/github/auth/status")
|
|
@@ -164,14 +165,20 @@ async function runDoctorChecks(options) {
|
|
|
164
165
|
const piChecks = await (options.piChecks ?? defaultPiChecks)().catch((error) => [{ ok: false, label: "pi/pi-rig checks", detail: undefined, hint: errorMessage(error) }]);
|
|
165
166
|
for (const pi of piChecks)
|
|
166
167
|
checks.push(check(pi.label === "pi" ? "pi" : "pi-rig", pi.label, pi.ok ? "pass" : "warn", pi.detail, pi.hint ?? (pi.ok ? undefined : "Install Pi/OMP and the Rig extension.")));
|
|
167
|
-
const
|
|
168
|
+
const identityService = options.identityContext ? await loadCapabilityForRoot(projectRoot, RunIdentityEnvCap) : null;
|
|
169
|
+
const identity = options.identityContext ? identityService?.resolveRigIdentity(options.identityContext) ?? null : null;
|
|
168
170
|
if (options.identityContext) {
|
|
169
|
-
const filter = resolveRigIdentityFilter(options.identityContext);
|
|
171
|
+
const filter = identityService?.resolveRigIdentityFilter(options.identityContext) ?? null;
|
|
170
172
|
checks.push({ label: "identity", status: identity ? "pass" : "warn", level: identity ? "ok" : "warn", detail: identity?.source ?? "GitHub identity unavailable" });
|
|
171
173
|
checks.push({ label: "github-repo", status: filter?.selectedRepo ? "pass" : "warn", level: filter?.selectedRepo ? "ok" : "warn", detail: filter?.selectedRepo ?? "repo not selected" });
|
|
172
174
|
}
|
|
173
175
|
try {
|
|
174
|
-
const runs =
|
|
176
|
+
const runs = options.listRuns ? await options.listRuns(projectRoot) : await (async () => {
|
|
177
|
+
const service = await loadCapabilityForRoot(projectRoot, RunReadModelCap);
|
|
178
|
+
if (!service)
|
|
179
|
+
throw new Error("RUN_READ_MODEL capability is not registered for this project");
|
|
180
|
+
return service.listRuns({ projectRoot });
|
|
181
|
+
})();
|
|
175
182
|
checks.push({ label: "run-discovery", status: "pass", level: "ok", detail: `${runs.length} run session(s)` });
|
|
176
183
|
} catch (error) {
|
|
177
184
|
checks.push({ label: "run-discovery", status: "fail", level: "fail", detail: errorMessage(error) });
|
|
@@ -184,26 +191,28 @@ async function runDoctorChecks(options) {
|
|
|
184
191
|
}
|
|
185
192
|
return checks;
|
|
186
193
|
}
|
|
187
|
-
var doctorRunner;
|
|
194
|
+
var RunIdentityEnvCap, RunReadModelCap, doctorRunner;
|
|
188
195
|
var init_service = __esm(() => {
|
|
196
|
+
RunIdentityEnvCap = defineCapability(RUN_IDENTITY_ENV);
|
|
197
|
+
RunReadModelCap = defineCapability(RUN_READ_MODEL);
|
|
189
198
|
doctorRunner = { runDoctorChecks };
|
|
190
199
|
});
|
|
191
200
|
|
|
192
201
|
// packages/doctor-plugin/src/plugin.ts
|
|
193
202
|
import { definePlugin } from "@rig/core/config";
|
|
194
|
-
import {
|
|
203
|
+
import { defineCapability as defineCapability2 } from "@rig/core/capability";
|
|
204
|
+
import { DOCTOR } from "@rig/contracts";
|
|
195
205
|
var DOCTOR_PLUGIN_NAME = "@rig/doctor-plugin";
|
|
206
|
+
var DoctorCap = defineCapability2(DOCTOR);
|
|
196
207
|
var doctorPlugin = definePlugin({
|
|
197
208
|
name: DOCTOR_PLUGIN_NAME,
|
|
198
209
|
version: "0.0.0-alpha.1",
|
|
199
210
|
contributes: {
|
|
200
211
|
capabilities: [
|
|
201
|
-
{
|
|
202
|
-
id: DOCTOR_RUNNER_CAPABILITY_ID,
|
|
212
|
+
DoctorCap.provide(async () => (await Promise.resolve().then(() => (init_service(), exports_service))).doctorRunner, {
|
|
203
213
|
title: "Diagnostic doctor checks",
|
|
204
|
-
description: "Local toolchain, rig.config loadability, GitHub auth/permissions, Pi, and run/relay diagnostics with remediation copy."
|
|
205
|
-
|
|
206
|
-
}
|
|
214
|
+
description: "Local toolchain, rig.config loadability, GitHub auth/permissions, Pi, and run/relay diagnostics with remediation copy."
|
|
215
|
+
})
|
|
207
216
|
]
|
|
208
217
|
}
|
|
209
218
|
});
|
package/dist/src/service.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { DoctorService, RunDoctorChecksOptions } from "@rig/runtime/control-plane/doctor-service-port";
|
|
1
|
+
import { type DoctorCheck, type DoctorService, type RunDoctorChecksOptions } from "@rig/contracts";
|
|
3
2
|
export declare function runDoctorChecks(options: RunDoctorChecksOptions): Promise<DoctorCheck[]>;
|
|
4
3
|
/** The concrete diagnostic service the runtime port resolves and consumes. */
|
|
5
4
|
export declare const doctorRunner: DoctorService;
|
package/dist/src/service.js
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
// packages/doctor-plugin/src/service.ts
|
|
3
3
|
import { existsSync, readFileSync } from "fs";
|
|
4
4
|
import { resolve } from "path";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { defineCapability } from "@rig/core/capability";
|
|
6
|
+
import { loadCapabilityForRoot } from "@rig/core/capability-loaders";
|
|
7
|
+
import { isSupportedBunVersion, MIN_SUPPORTED_BUN_VERSION } from "@rig/core/setup-version";
|
|
8
|
+
import { checkGitHubRepoPermissions, resolveGitHubAuthStatus } from "@rig/github-lib";
|
|
7
9
|
import { loadConfig } from "@rig/core/load-config";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
10
|
+
import { readSelection, listPlacements } from "@rig/core/placement";
|
|
11
|
+
import { RUN_IDENTITY_ENV, RUN_READ_MODEL } from "@rig/contracts";
|
|
12
|
+
var RunIdentityEnvCap = defineCapability(RUN_IDENTITY_ENV);
|
|
13
|
+
var RunReadModelCap = defineCapability(RUN_READ_MODEL);
|
|
11
14
|
function check(id, label, status, detail, remediation) {
|
|
12
15
|
return { id, label, status, level: status === "pass" ? "ok" : status, ...detail ? { detail } : {}, ...remediation ? { remediation } : {} };
|
|
13
16
|
}
|
|
@@ -89,7 +92,7 @@ function prMergeCheck(config) {
|
|
|
89
92
|
}
|
|
90
93
|
async function defaultPiChecks() {
|
|
91
94
|
const pi = Bun.which("pi");
|
|
92
|
-
return [{ ok: Boolean(pi), label: "pi",
|
|
95
|
+
return [{ ok: Boolean(pi), label: "pi", ...pi ? { detail: pi } : { hint: "Install Pi/OMP and the Rig extension." } }];
|
|
93
96
|
}
|
|
94
97
|
async function defaultRequestJson(projectRoot, pathname, _init) {
|
|
95
98
|
if (pathname === "/api/github/auth/status")
|
|
@@ -143,14 +146,20 @@ async function runDoctorChecks(options) {
|
|
|
143
146
|
const piChecks = await (options.piChecks ?? defaultPiChecks)().catch((error) => [{ ok: false, label: "pi/pi-rig checks", detail: undefined, hint: errorMessage(error) }]);
|
|
144
147
|
for (const pi of piChecks)
|
|
145
148
|
checks.push(check(pi.label === "pi" ? "pi" : "pi-rig", pi.label, pi.ok ? "pass" : "warn", pi.detail, pi.hint ?? (pi.ok ? undefined : "Install Pi/OMP and the Rig extension.")));
|
|
146
|
-
const
|
|
149
|
+
const identityService = options.identityContext ? await loadCapabilityForRoot(projectRoot, RunIdentityEnvCap) : null;
|
|
150
|
+
const identity = options.identityContext ? identityService?.resolveRigIdentity(options.identityContext) ?? null : null;
|
|
147
151
|
if (options.identityContext) {
|
|
148
|
-
const filter = resolveRigIdentityFilter(options.identityContext);
|
|
152
|
+
const filter = identityService?.resolveRigIdentityFilter(options.identityContext) ?? null;
|
|
149
153
|
checks.push({ label: "identity", status: identity ? "pass" : "warn", level: identity ? "ok" : "warn", detail: identity?.source ?? "GitHub identity unavailable" });
|
|
150
154
|
checks.push({ label: "github-repo", status: filter?.selectedRepo ? "pass" : "warn", level: filter?.selectedRepo ? "ok" : "warn", detail: filter?.selectedRepo ?? "repo not selected" });
|
|
151
155
|
}
|
|
152
156
|
try {
|
|
153
|
-
const runs =
|
|
157
|
+
const runs = options.listRuns ? await options.listRuns(projectRoot) : await (async () => {
|
|
158
|
+
const service = await loadCapabilityForRoot(projectRoot, RunReadModelCap);
|
|
159
|
+
if (!service)
|
|
160
|
+
throw new Error("RUN_READ_MODEL capability is not registered for this project");
|
|
161
|
+
return service.listRuns({ projectRoot });
|
|
162
|
+
})();
|
|
154
163
|
checks.push({ label: "run-discovery", status: "pass", level: "ok", detail: `${runs.length} run session(s)` });
|
|
155
164
|
} catch (error) {
|
|
156
165
|
checks.push({ label: "run-discovery", status: "fail", level: "fail", detail: errorMessage(error) });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h-rig/doctor-plugin",
|
|
3
|
-
"version": "0.0.6-alpha.
|
|
3
|
+
"version": "0.0.6-alpha.159",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "First-party diagnostic doctor capability plugin for Rig.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -29,10 +29,8 @@
|
|
|
29
29
|
"module": "./dist/src/index.js",
|
|
30
30
|
"types": "./dist/src/index.d.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.
|
|
33
|
-
"@rig/
|
|
34
|
-
"@rig/
|
|
35
|
-
"@rig/github-provider-plugin": "npm:@h-rig/github-provider-plugin@0.0.6-alpha.157",
|
|
36
|
-
"@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.157"
|
|
32
|
+
"@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.159",
|
|
33
|
+
"@rig/core": "npm:@h-rig/core@0.0.6-alpha.159",
|
|
34
|
+
"@rig/github-lib": "npm:@h-rig/github-lib@0.0.6-alpha.159"
|
|
37
35
|
}
|
|
38
36
|
}
|