@h-rig/plugin-testkit 0.0.6-alpha.155 → 0.0.6-alpha.157

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.
@@ -9,24 +9,24 @@
9
9
  * vitest and `bun test`.
10
10
  */
11
11
  import type { HookContext, HookResult, RegisteredTaskSource, TaskSourceConfig } from "@rig/contracts";
12
- import type { RigPluginWithRuntime, ValidatorContext, ValidatorResult } from "@rig/core";
12
+ import type { RigPlugin, ValidatorContext, ValidatorResult } from "@rig/core";
13
13
  /**
14
14
  * Invoke the plugin's executable validator `id` with a mock
15
15
  * ValidatorContext (missing fields filled with testkit defaults), assert
16
16
  * the result shape (id/passed/summary present, id matches), and return it.
17
17
  */
18
- export declare function testValidatorContext(plugin: RigPluginWithRuntime, id: string, mockCtx?: Partial<ValidatorContext>): Promise<ValidatorResult>;
18
+ export declare function testValidatorContext(plugin: RigPlugin, id: string, mockCtx?: Partial<ValidatorContext>): Promise<ValidatorResult>;
19
19
  /**
20
20
  * Assert the plugin ships an executable task-source factory for `kind`,
21
21
  * instantiate it (with `config` or a minimal `{ kind }`), assert the
22
22
  * returned RegisteredTaskSource carries the required surface (kind, id,
23
23
  * list()), and return it for further assertions.
24
24
  */
25
- export declare function expectTaskSourceRuntime(plugin: RigPluginWithRuntime, kind: string, config?: TaskSourceConfig): RegisteredTaskSource;
25
+ export declare function expectTaskSourceRuntime(plugin: RigPlugin, kind: string, config?: TaskSourceConfig): RegisteredTaskSource;
26
26
  /**
27
27
  * Invoke the plugin's typed hook implementation `id` with a mock
28
28
  * HookContext (missing fields filled with testkit defaults; the event
29
29
  * defaults to the hook's metadata registration), assert the HookResult
30
30
  * shape, and return it.
31
31
  */
32
- export declare function testHook(plugin: RigPluginWithRuntime, id: string, mockInput?: Partial<HookContext>): Promise<HookResult>;
32
+ export declare function testHook(plugin: RigPlugin, id: string, mockInput?: Partial<HookContext>): Promise<HookResult>;
@@ -9,7 +9,7 @@ var DEFAULT_VALIDATOR_CONTEXT = {
9
9
  scope: []
10
10
  };
11
11
  async function testValidatorContext(plugin, id, mockCtx = {}) {
12
- const validator = plugin.validators?.find((v) => v.id === id);
12
+ const validator = plugin.contributes?.validators?.find((v) => v.id === id);
13
13
  if (!validator) {
14
14
  fail(plugin, `no executable validator "${id}" in the plugin object`);
15
15
  }
@@ -26,7 +26,7 @@ async function testValidatorContext(plugin, id, mockCtx = {}) {
26
26
  return result;
27
27
  }
28
28
  function expectTaskSourceRuntime(plugin, kind, config) {
29
- const entry = plugin.taskSources?.find((s) => s.kind === kind);
29
+ const entry = plugin.contributes?.taskSources?.find((s) => s.kind === kind);
30
30
  if (!entry) {
31
31
  fail(plugin, `no executable task-source factory for kind "${kind}" in the plugin object`);
32
32
  }
@@ -46,14 +46,14 @@ function expectTaskSourceRuntime(plugin, kind, config) {
46
46
  return source;
47
47
  }
48
48
  async function testHook(plugin, id, mockInput = {}) {
49
- const implementation = plugin.hooks?.[id];
50
- if (!implementation) {
51
- fail(plugin, `no typed hook implementation "${id}" in the plugin object`);
52
- }
53
49
  const registration = (plugin.contributes?.hooks ?? []).find((h) => h.id === id);
54
50
  if (!registration) {
55
51
  fail(plugin, `typed hook "${id}" has no metadata entry in contributes.hooks`);
56
52
  }
53
+ const implementation = registration.handler;
54
+ if (!implementation) {
55
+ fail(plugin, `no typed hook implementation "${id}" in the plugin object`);
56
+ }
57
57
  const input = {
58
58
  event: registration.event,
59
59
  toolInput: {},
package/dist/src/index.js CHANGED
@@ -14,7 +14,7 @@ var DEFAULT_VALIDATOR_CONTEXT = {
14
14
  scope: []
15
15
  };
16
16
  async function testValidatorContext(plugin, id, mockCtx = {}) {
17
- const validator = plugin.validators?.find((v) => v.id === id);
17
+ const validator = plugin.contributes?.validators?.find((v) => v.id === id);
18
18
  if (!validator) {
19
19
  fail(plugin, `no executable validator "${id}" in the plugin object`);
20
20
  }
@@ -31,7 +31,7 @@ async function testValidatorContext(plugin, id, mockCtx = {}) {
31
31
  return result;
32
32
  }
33
33
  function expectTaskSourceRuntime(plugin, kind, config) {
34
- const entry = plugin.taskSources?.find((s) => s.kind === kind);
34
+ const entry = plugin.contributes?.taskSources?.find((s) => s.kind === kind);
35
35
  if (!entry) {
36
36
  fail(plugin, `no executable task-source factory for kind "${kind}" in the plugin object`);
37
37
  }
@@ -51,14 +51,14 @@ function expectTaskSourceRuntime(plugin, kind, config) {
51
51
  return source;
52
52
  }
53
53
  async function testHook(plugin, id, mockInput = {}) {
54
- const implementation = plugin.hooks?.[id];
55
- if (!implementation) {
56
- fail(plugin, `no typed hook implementation "${id}" in the plugin object`);
57
- }
58
54
  const registration = (plugin.contributes?.hooks ?? []).find((h) => h.id === id);
59
55
  if (!registration) {
60
56
  fail(plugin, `typed hook "${id}" has no metadata entry in contributes.hooks`);
61
57
  }
58
+ const implementation = registration.handler;
59
+ if (!implementation) {
60
+ fail(plugin, `no typed hook implementation "${id}" in the plugin object`);
61
+ }
62
62
  const input = {
63
63
  event: registration.event,
64
64
  toolInput: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/plugin-testkit",
3
- "version": "0.0.6-alpha.155",
3
+ "version": "0.0.6-alpha.157",
4
4
  "type": "module",
5
5
  "description": "Test helpers for Rig plugin packages; not a runtime runner, host, or control plane.",
6
6
  "license": "UNLICENSED",
@@ -21,8 +21,8 @@
21
21
  "module": "./dist/src/index.js",
22
22
  "types": "./dist/src/index.d.ts",
23
23
  "dependencies": {
24
- "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.155",
25
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.155",
24
+ "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.157",
25
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.157",
26
26
  "effect": "4.0.0-beta.90",
27
27
  "vitest": "^4.0.0"
28
28
  }