@h-rig/standard-plugin 0.0.6-alpha.77 → 0.0.6-alpha.79

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.
@@ -0,0 +1,18 @@
1
+ import type { RegisteredTaskSource } from "@rig/contracts";
2
+ export interface FilesTaskSourceOptions {
3
+ /**
4
+ * Directory containing one JSON file per task. Use either `path` (matches
5
+ * the `taskSource.path` field in rig.config.ts) or `dir` (back-compat).
6
+ */
7
+ path?: string;
8
+ dir?: string;
9
+ pattern?: RegExp;
10
+ /**
11
+ * Root a relative `path`/`dir` resolves against. The serving process's cwd
12
+ * is NOT the project (workspace-spawned servers run from the engine
13
+ * checkout), so without this a relative path silently reads the WRONG
14
+ * repo's tasks. Defaults to cwd for direct programmatic use.
15
+ */
16
+ projectRoot?: string;
17
+ }
18
+ export declare function createFilesTaskSource(opts: FilesTaskSourceOptions): RegisteredTaskSource;
@@ -0,0 +1,67 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import type { RegisteredTaskSource, TaskRecord } from "@rig/contracts";
3
+ export type GitHubCredentialPurpose = "selected-repo" | "admin-fallback";
4
+ export interface GitHubCredentialProvider {
5
+ resolveGitHubToken(input: {
6
+ owner: string;
7
+ repo: string;
8
+ workspaceId: string;
9
+ userId?: string;
10
+ purpose: GitHubCredentialPurpose;
11
+ }): Promise<{
12
+ token: string;
13
+ source: "signed-in-user" | "host-admin-fallback";
14
+ }>;
15
+ }
16
+ export interface GitHubIssuesOptions {
17
+ owner: string;
18
+ repo: string;
19
+ labels?: readonly string[];
20
+ state?: "open" | "closed" | "all";
21
+ assignee?: string;
22
+ ghBinary?: string;
23
+ workspaceId?: string;
24
+ userId?: string;
25
+ credentialProvider?: GitHubCredentialProvider;
26
+ /** Timeout for every gh CLI call. Defaults to 15 seconds. */
27
+ timeoutMs?: number;
28
+ /** Maximum issue-list rows before Rig fails loudly instead of silently truncating. Defaults to 1,000. */
29
+ listLimit?: number;
30
+ /** @internal — for testing. Override the spawnSync used by the adapter. */
31
+ spawn?: typeof spawnSync;
32
+ /** Notify the host that issue-backed task state changed and snapshots should refresh. */
33
+ onTaskChanged?: (event: {
34
+ repo: string;
35
+ id: string;
36
+ status?: string;
37
+ reason: "github-issue-updated";
38
+ }) => void;
39
+ }
40
+ export interface GitHubIssueCreateInput {
41
+ title: string;
42
+ body?: string;
43
+ labels?: readonly string[];
44
+ }
45
+ export interface GitHubIssuesTaskSource extends RegisteredTaskSource {
46
+ addLabels(id: string, labels: readonly string[]): Promise<void>;
47
+ removeLabels(id: string, labels: readonly string[]): Promise<void>;
48
+ createIssue(input: GitHubIssueCreateInput): Promise<TaskRecord>;
49
+ getIssueBody(id: string): Promise<string | undefined>;
50
+ }
51
+ export declare function createEnvGitHubCredentialProvider(): GitHubCredentialProvider;
52
+ export declare function createStateGitHubCredentialProvider(options?: {
53
+ stateFile?: string;
54
+ stateDir?: string;
55
+ }): GitHubCredentialProvider;
56
+ export declare const RIG_STATUS_COMMENT_MARKER = "<!-- rig:status-comment -->";
57
+ export declare const RIG_METADATA_START = "<!-- rig:metadata:start -->";
58
+ export declare const RIG_METADATA_END = "<!-- rig:metadata:end -->";
59
+ export declare function updateRigOwnedMetadataBlock(body: string, metadata: Record<string, unknown>): string;
60
+ export declare function buildRigStickyStatusComment(input: {
61
+ status: "running" | "prOpen" | "ciFixing" | "done" | "needsAttention" | string;
62
+ summary: string;
63
+ runId?: string;
64
+ prUrl?: string;
65
+ details?: readonly string[];
66
+ }): string;
67
+ export declare function createGitHubIssuesTaskSource(opts: GitHubIssuesOptions): GitHubIssuesTaskSource;
@@ -0,0 +1,14 @@
1
+ import { type RigPluginWithRuntime } from "@rig/core";
2
+ import { createEnvGitHubCredentialProvider, createStateGitHubCredentialProvider, createGitHubIssuesTaskSource, type GitHubCredentialProvider, type GitHubIssuesOptions } from "./github-issues-source";
3
+ import { createFilesTaskSource } from "./files-source";
4
+ export { createGitHubIssuesTaskSource, createEnvGitHubCredentialProvider, createStateGitHubCredentialProvider, createFilesTaskSource };
5
+ export type { GitHubIssuesOptions } from "./github-issues-source";
6
+ export type { FilesTaskSourceOptions } from "./files-source";
7
+ export interface StandardPluginOptions {
8
+ githubCredentialProvider?: GitHubCredentialProvider;
9
+ githubWorkspaceId?: string;
10
+ githubUserId?: string;
11
+ githubSpawn?: GitHubIssuesOptions["spawn"];
12
+ onGitHubTaskChanged?: GitHubIssuesOptions["onTaskChanged"];
13
+ }
14
+ export default function standardPlugin(opts?: StandardPluginOptions): RigPluginWithRuntime;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/standard-plugin",
3
- "version": "0.0.6-alpha.77",
3
+ "version": "0.0.6-alpha.79",
4
4
  "type": "module",
5
5
  "description": "Rig package",
6
6
  "license": "UNLICENSED",
@@ -10,6 +10,7 @@
10
10
  ],
11
11
  "exports": {
12
12
  ".": {
13
+ "types": "./dist/src/index.d.ts",
13
14
  "import": "./dist/src/index.js"
14
15
  }
15
16
  },
@@ -18,9 +19,10 @@
18
19
  },
19
20
  "main": "./dist/src/index.js",
20
21
  "module": "./dist/src/index.js",
22
+ "types": "./dist/src/index.d.ts",
21
23
  "dependencies": {
22
- "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.77",
23
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.77",
24
+ "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.79",
25
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.79",
24
26
  "effect": "4.0.0-beta.78"
25
27
  }
26
28
  }