pullfrog 0.0.197 → 0.0.198
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/agents/claude.d.ts +1 -0
- package/dist/agents/index.d.ts +6 -0
- package/dist/agents/opentoad.d.ts +1 -0
- package/dist/agents/shared.d.ts +46 -0
- package/dist/cli.mjs +6 -9
- package/dist/external.d.ts +213 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +151703 -0
- package/dist/internal/index.d.ts +12 -0
- package/dist/internal.js +681 -0
- package/dist/lifecycle.d.ts +2 -0
- package/dist/main.d.ts +8 -0
- package/dist/mcp/arkConfig.d.ts +1 -0
- package/dist/mcp/checkSuite.d.ts +9 -0
- package/dist/mcp/checkout.d.ts +63 -0
- package/dist/mcp/comment.d.ts +87 -0
- package/dist/mcp/commitInfo.d.ts +9 -0
- package/dist/mcp/dependencies.d.ts +3 -0
- package/dist/mcp/git.d.ts +38 -0
- package/dist/mcp/issue.d.ts +18 -0
- package/dist/mcp/issueComments.d.ts +9 -0
- package/dist/mcp/issueEvents.d.ts +9 -0
- package/dist/mcp/issueInfo.d.ts +9 -0
- package/dist/mcp/labels.d.ts +12 -0
- package/dist/mcp/learnings.d.ts +6 -0
- package/dist/mcp/output.d.ts +12 -0
- package/dist/mcp/pr.d.ts +29 -0
- package/dist/mcp/prInfo.d.ts +9 -0
- package/dist/mcp/review.d.ts +47 -0
- package/dist/mcp/reviewComments.d.ts +135 -0
- package/dist/mcp/selectMode.d.ts +24 -0
- package/dist/mcp/server.d.ts +93 -0
- package/dist/mcp/shared.d.ts +21 -0
- package/dist/mcp/shell.d.ts +32 -0
- package/dist/mcp/upload.d.ts +6 -0
- package/dist/models.d.ts +69 -0
- package/dist/modes.d.ts +9 -0
- package/dist/prep/index.d.ts +7 -0
- package/dist/prep/installNodeDependencies.d.ts +2 -0
- package/dist/prep/installPythonDependencies.d.ts +2 -0
- package/dist/prep/types.d.ts +29 -0
- package/dist/utils/activity.d.ts +21 -0
- package/dist/utils/agent.d.ts +15 -0
- package/dist/utils/apiFetch.d.ts +19 -0
- package/dist/utils/apiKeys.d.ts +10 -0
- package/dist/utils/apiUrl.d.ts +9 -0
- package/dist/utils/body.d.ts +16 -0
- package/dist/utils/browser.d.ts +21 -0
- package/dist/utils/buildPullfrogFooter.d.ts +30 -0
- package/dist/utils/cli.d.ts +10 -0
- package/dist/utils/errorReport.d.ts +8 -0
- package/dist/utils/exitHandler.d.ts +8 -0
- package/dist/utils/fixDoubleEscapedString.d.ts +1 -0
- package/dist/utils/gitAuth.d.ts +47 -0
- package/dist/utils/gitAuthServer.d.ts +18 -0
- package/dist/utils/github.d.ts +78 -0
- package/dist/utils/globals.d.ts +3 -0
- package/dist/utils/install.d.ts +60 -0
- package/dist/utils/instructions.d.ts +22 -0
- package/dist/utils/lifecycle.d.ts +9 -0
- package/dist/utils/log.d.ts +92 -0
- package/dist/utils/normalizeEnv.d.ts +10 -0
- package/dist/utils/payload.d.ts +41 -0
- package/dist/utils/providerErrors.d.ts +1 -0
- package/dist/utils/rangeDiff.d.ts +51 -0
- package/dist/utils/retry.d.ts +7 -0
- package/dist/utils/reviewCleanup.d.ts +14 -0
- package/dist/utils/run.d.ts +9 -0
- package/dist/utils/runContext.d.ts +36 -0
- package/dist/utils/runContextData.d.ts +24 -0
- package/dist/utils/secrets.d.ts +17 -0
- package/dist/utils/setup.d.ts +33 -0
- package/dist/utils/shell.d.ts +32 -0
- package/dist/utils/skills.d.ts +6 -0
- package/dist/utils/subprocess.d.ts +32 -0
- package/dist/utils/time.d.ts +14 -0
- package/dist/utils/timer.d.ts +12 -0
- package/dist/utils/todoTracking.d.ts +14 -0
- package/dist/utils/token.d.ts +40 -0
- package/dist/utils/version.d.ts +2 -0
- package/dist/utils/versioning.d.ts +7 -0
- package/dist/utils/workflow.d.ts +14 -0
- package/package.json +5 -8
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logging utilities that work well in both local and GitHub Actions environments
|
|
3
|
+
*/
|
|
4
|
+
import type { AgentUsage } from "../agents/shared.ts";
|
|
5
|
+
/** run `fn` with every log line prefixed by `prefix` (e.g. "[task-label]") in magenta */
|
|
6
|
+
export declare function withLogPrefix<T>(prefix: string, fn: () => Promise<T>): Promise<T>;
|
|
7
|
+
/**
|
|
8
|
+
* Start a collapsed group (GitHub Actions) or regular group (local)
|
|
9
|
+
*/
|
|
10
|
+
declare function startGroup(name: string): void;
|
|
11
|
+
/**
|
|
12
|
+
* End a collapsed group
|
|
13
|
+
*/
|
|
14
|
+
declare function endGroup(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Run a callback within a collapsed group
|
|
17
|
+
*/
|
|
18
|
+
declare function group(name: string, fn: () => void): void;
|
|
19
|
+
/**
|
|
20
|
+
* Print a formatted box with text
|
|
21
|
+
*/
|
|
22
|
+
declare function box(text: string, options?: {
|
|
23
|
+
title?: string;
|
|
24
|
+
maxWidth?: number;
|
|
25
|
+
}): void;
|
|
26
|
+
/**
|
|
27
|
+
* Overwrite the job summary with the given text.
|
|
28
|
+
* Skips if:
|
|
29
|
+
* - Not in GitHub Actions
|
|
30
|
+
* - Running inside Docker (CI tests inherit host env vars but can't access host paths)
|
|
31
|
+
* - GITHUB_STEP_SUMMARY not set
|
|
32
|
+
*/
|
|
33
|
+
export declare function writeSummary(text: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Print a formatted table using the table package
|
|
36
|
+
*/
|
|
37
|
+
declare function printTable(rows: Array<Array<{
|
|
38
|
+
data: string;
|
|
39
|
+
header?: boolean;
|
|
40
|
+
} | string>>, options?: {
|
|
41
|
+
title?: string;
|
|
42
|
+
}): void;
|
|
43
|
+
/**
|
|
44
|
+
* Print a separator line
|
|
45
|
+
*/
|
|
46
|
+
declare function separator(length?: number): void;
|
|
47
|
+
/**
|
|
48
|
+
* Main logging utility object - import this once and access all utilities
|
|
49
|
+
*/
|
|
50
|
+
export declare const log: {
|
|
51
|
+
/** Print info message */
|
|
52
|
+
info: (...args: unknown[]) => void;
|
|
53
|
+
/** Print a warning message. Use only for warnings that should be displayed in the job summary. */
|
|
54
|
+
warning: (...args: unknown[]) => void;
|
|
55
|
+
/** Print an error message. Use only for errors that should be displayed in the job summary. */
|
|
56
|
+
error: (...args: unknown[]) => void;
|
|
57
|
+
/** Print success message */
|
|
58
|
+
success: (...args: unknown[]) => void;
|
|
59
|
+
/** Print debug message (only when debug mode is enabled) */
|
|
60
|
+
debug: (...args: unknown[]) => void;
|
|
61
|
+
/** Print a formatted box with text */
|
|
62
|
+
box: typeof box;
|
|
63
|
+
/** Print a formatted table using the table package */
|
|
64
|
+
table: typeof printTable;
|
|
65
|
+
/** Print a separator line */
|
|
66
|
+
separator: typeof separator;
|
|
67
|
+
/** Start a collapsed group (GitHub Actions) or regular group (local) */
|
|
68
|
+
startGroup: typeof startGroup;
|
|
69
|
+
/** End a collapsed group */
|
|
70
|
+
endGroup: typeof endGroup;
|
|
71
|
+
/** Run a callback within a collapsed group */
|
|
72
|
+
group: typeof group;
|
|
73
|
+
/** Log tool call information to console with formatted output */
|
|
74
|
+
toolCall: ({ toolName, input }: {
|
|
75
|
+
toolName: string;
|
|
76
|
+
input: unknown;
|
|
77
|
+
}) => void;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Format a value as JSON, using compact format for simple values and pretty-printed for complex ones
|
|
81
|
+
*/
|
|
82
|
+
export declare function formatJsonValue(value: unknown): string;
|
|
83
|
+
/**
|
|
84
|
+
* Format a multi-line string with proper indentation for tool call output
|
|
85
|
+
* First line has the label, subsequent lines are indented 4 spaces
|
|
86
|
+
*/
|
|
87
|
+
export declare function formatIndentedField(label: string, content: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* format aggregated usage data as a markdown table for the GitHub step summary
|
|
90
|
+
*/
|
|
91
|
+
export declare function formatUsageSummary(entries: AgentUsage[]): string;
|
|
92
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize environment variables to uppercase.
|
|
3
|
+
* This handles case-insensitive env var names (e.g., `anthropic_api_key` -> `ANTHROPIC_API_KEY`).
|
|
4
|
+
*
|
|
5
|
+
* If there are conflicts (same key with different capitalizations but different values),
|
|
6
|
+
* logs a warning and keeps the uppercase version.
|
|
7
|
+
*
|
|
8
|
+
* Also registers sensitive values as masks in GitHub Actions.
|
|
9
|
+
*/
|
|
10
|
+
export declare function normalizeEnv(): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { PayloadEvent } from "../external.ts";
|
|
2
|
+
import type { RepoSettings } from "./runContext.ts";
|
|
3
|
+
export declare const JsonPayload: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
4
|
+
"~pullfrog": true;
|
|
5
|
+
version: string;
|
|
6
|
+
prompt: string;
|
|
7
|
+
model?: string | undefined;
|
|
8
|
+
triggerer?: string | undefined;
|
|
9
|
+
eventInstructions?: string;
|
|
10
|
+
event?: object;
|
|
11
|
+
timeout?: string | undefined;
|
|
12
|
+
progressCommentId?: string | undefined;
|
|
13
|
+
}, {}>;
|
|
14
|
+
export declare const Inputs: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
15
|
+
prompt: string;
|
|
16
|
+
model?: string | undefined;
|
|
17
|
+
timeout?: string | undefined;
|
|
18
|
+
push?: "disabled" | "enabled" | "restricted" | undefined;
|
|
19
|
+
shell?: "disabled" | "enabled" | "restricted" | undefined;
|
|
20
|
+
cwd?: string | undefined;
|
|
21
|
+
output_schema?: string | undefined;
|
|
22
|
+
}, {}>;
|
|
23
|
+
export type Inputs = typeof Inputs.infer;
|
|
24
|
+
export type ResolvedPromptInput = string | typeof JsonPayload.infer;
|
|
25
|
+
export declare function resolvePromptInput(): ResolvedPromptInput;
|
|
26
|
+
export declare function resolvePayload(resolvedPromptInput: ResolvedPromptInput, repoSettings: RepoSettings): {
|
|
27
|
+
"~pullfrog": true;
|
|
28
|
+
version: string;
|
|
29
|
+
model: string | undefined;
|
|
30
|
+
prompt: string;
|
|
31
|
+
triggerer: string | undefined;
|
|
32
|
+
eventInstructions: string | undefined;
|
|
33
|
+
event: PayloadEvent;
|
|
34
|
+
timeout: string | undefined;
|
|
35
|
+
cwd: string | undefined;
|
|
36
|
+
progressCommentId: string | undefined;
|
|
37
|
+
push: import("../external.ts").PushPermission;
|
|
38
|
+
shell: import("../external.ts").ShellPermission;
|
|
39
|
+
proxyModel: string | undefined;
|
|
40
|
+
};
|
|
41
|
+
export type ResolvedPayload = ReturnType<typeof resolvePayload>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function detectProviderError(text: string): string | null;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
type ComputeIncrementalDiffParams = {
|
|
2
|
+
baseBranch: string;
|
|
3
|
+
beforeSha: string;
|
|
4
|
+
headSha: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* computes the incremental diff between two versions of a PR using range-diff
|
|
8
|
+
* on virtual squash commits created via `git commit-tree`.
|
|
9
|
+
*
|
|
10
|
+
* each PR version is squashed into a single synthetic commit (merge-base → tip tree),
|
|
11
|
+
* then range-diff compares those two single-commit ranges. this:
|
|
12
|
+
* - isolates each version's net effect (base branch noise eliminated via per-version merge bases)
|
|
13
|
+
* - avoids commit-matching issues that raw range-diff has with rebases/squashes/reordering
|
|
14
|
+
* - creates only loose git objects, no branches or refs (unlike temp-branch squash approaches)
|
|
15
|
+
*
|
|
16
|
+
* unlike fetchAndFormatPrDiff/formatFilesWithLineNumbers, this output has no line numbers.
|
|
17
|
+
* range-diff compares *patches* (diffs-of-diffs), not file trees — its hunk headers are
|
|
18
|
+
* `@@ file.ts` breadcrumbs, not positional `@@ -X,Y +A,B @@` markers. reconstructing
|
|
19
|
+
* line numbers would require cross-referencing with the v2 diff or content-matching against
|
|
20
|
+
* file trees, both of which are fragile (duplicate lines, hunk boundary shifts after rebase).
|
|
21
|
+
* a structured interdiff approach (diff two parsed patches, compare only +/- keys via Myers)
|
|
22
|
+
* could approximate line numbers but loses semantic precision: range-diff understands patch
|
|
23
|
+
* structure natively (rename detection, hunk-aware matching, dual-prefix inner/outer changes),
|
|
24
|
+
* while flat key-sequence comparison can misalign duplicate lines and can't distinguish
|
|
25
|
+
* "new addition to the PR" from "existing code newly modified by the PR". range-diff is the
|
|
26
|
+
* right abstraction here — the incremental diff answers "how did the changeset evolve?",
|
|
27
|
+
* not "where in the file is this?", and forcing positional line numbers onto it would be
|
|
28
|
+
* semantically misleading.
|
|
29
|
+
*
|
|
30
|
+
* alternatives considered:
|
|
31
|
+
* - plain git diff (two-tree or three-dot): includes base branch changes, no PR isolation
|
|
32
|
+
* - patch-text diffing (interdiff / diff-of-diffs): fragile, hunk offset noise on rebase
|
|
33
|
+
* - range-diff on raw commit ranges: confused by commit reorganization across force-pushes
|
|
34
|
+
*/
|
|
35
|
+
export declare function computeIncrementalDiff(params: ComputeIncrementalDiffParams): string | null;
|
|
36
|
+
/**
|
|
37
|
+
* transforms git range-diff output into a clean incremental diff.
|
|
38
|
+
*
|
|
39
|
+
* range-diff content lines have two prefix characters:
|
|
40
|
+
* 1st (outer): range-diff level — space (same in both), + (new only), - (old only)
|
|
41
|
+
* 2nd (inner): original diff level — space (context), + (added), - (removed)
|
|
42
|
+
*
|
|
43
|
+
* stripping the inner prefix produces a standard unified-diff-like output where
|
|
44
|
+
* +/- means "changed between PR versions" rather than "changed vs base branch".
|
|
45
|
+
*
|
|
46
|
+
* uses a streaming approach: a ring buffer of before-context lines is flushed when
|
|
47
|
+
* a change is hit, then afterCount lines of after-context are emitted directly.
|
|
48
|
+
* nearest preceding ## / @@ headers are force-included when outside the context window.
|
|
49
|
+
*/
|
|
50
|
+
export declare function postProcessRangeDiff(raw: string, contextLines?: number): string | null;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ToolContext } from "../mcp/server.ts";
|
|
2
|
+
/**
|
|
3
|
+
* post-agent review lifecycle: runs after the agent exits (success or timeout).
|
|
4
|
+
*
|
|
5
|
+
* normally the agent handles new commits inline: create_pull_request_review
|
|
6
|
+
* detects HEAD movement and tells the agent to pull and review the delta.
|
|
7
|
+
* this dispatch is a safety net for cases where the agent couldn't handle
|
|
8
|
+
* it (timeout, error, etc).
|
|
9
|
+
*
|
|
10
|
+
* ordering matters: reportReviewNodeId marks this run "done" FIRST so push
|
|
11
|
+
* webhooks stop being suppressed by dedup. the HEAD check runs SECOND to
|
|
12
|
+
* catch any pushes that were suppressed while this run was in-flight.
|
|
13
|
+
*/
|
|
14
|
+
export declare function postReviewCleanup(ctx: ToolContext): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AgentResult } from "../agents/shared.ts";
|
|
2
|
+
import type { MainResult } from "../main.ts";
|
|
3
|
+
import type { ToolState } from "../mcp/server.ts";
|
|
4
|
+
export interface HandleAgentResultParams {
|
|
5
|
+
result: AgentResult;
|
|
6
|
+
toolState: ToolState;
|
|
7
|
+
silent: boolean | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function handleAgentResult(ctx: HandleAgentResultParams): Promise<MainResult>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { PushPermission, ShellPermission } from "../external.ts";
|
|
2
|
+
import type { RepoContext } from "./github.ts";
|
|
3
|
+
export interface Mode {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
prompt: string;
|
|
8
|
+
}
|
|
9
|
+
export interface RepoSettings {
|
|
10
|
+
model: string | null;
|
|
11
|
+
modes: Mode[];
|
|
12
|
+
setupScript: string | null;
|
|
13
|
+
postCheckoutScript: string | null;
|
|
14
|
+
prepushScript: string | null;
|
|
15
|
+
push: PushPermission;
|
|
16
|
+
shell: ShellPermission;
|
|
17
|
+
prApproveEnabled: boolean;
|
|
18
|
+
modeInstructions: Record<string, string>;
|
|
19
|
+
learnings: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface RunContext {
|
|
22
|
+
settings: RepoSettings;
|
|
23
|
+
apiToken: string;
|
|
24
|
+
oss: boolean;
|
|
25
|
+
proxyModel?: string | undefined;
|
|
26
|
+
dbSecrets?: Record<string, string> | undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* fetch run context from Pullfrog API
|
|
30
|
+
* returns settings + API token for subsequent calls
|
|
31
|
+
* returns defaults if fetch fails
|
|
32
|
+
*/
|
|
33
|
+
export declare function fetchRunContext(params: {
|
|
34
|
+
token: string;
|
|
35
|
+
repoContext: RepoContext;
|
|
36
|
+
}): Promise<RunContext>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Octokit } from "@octokit/rest";
|
|
2
|
+
import { type OctokitWithPlugins } from "./github.ts";
|
|
3
|
+
import { type RepoSettings } from "./runContext.ts";
|
|
4
|
+
export interface RunContextData {
|
|
5
|
+
repo: {
|
|
6
|
+
owner: string;
|
|
7
|
+
name: string;
|
|
8
|
+
data: Awaited<ReturnType<Octokit["repos"]["get"]>>["data"];
|
|
9
|
+
};
|
|
10
|
+
repoSettings: RepoSettings;
|
|
11
|
+
apiToken: string;
|
|
12
|
+
oss: boolean;
|
|
13
|
+
proxyModel?: string | undefined;
|
|
14
|
+
dbSecrets?: Record<string, string> | undefined;
|
|
15
|
+
}
|
|
16
|
+
interface ResolveRunContextDataParams {
|
|
17
|
+
octokit: OctokitWithPlugins;
|
|
18
|
+
token: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* initialize run context data: parse context, fetch repo info and settings
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveRunContextData(params: ResolveRunContextDataParams): Promise<RunContextData>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secret detection and redaction utilities
|
|
3
|
+
* Redacts actual secret values rather than using pattern matching
|
|
4
|
+
*/
|
|
5
|
+
export declare const SENSITIVE_PATTERNS: RegExp[];
|
|
6
|
+
export declare function isSensitiveEnvName(key: string): boolean;
|
|
7
|
+
/** filter env vars, removing sensitive values (tokens, keys, secrets) */
|
|
8
|
+
export declare function filterEnv(): Record<string, string>;
|
|
9
|
+
export type EnvMode = "restricted" | "inherit" | Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* resolve env mode to actual env object
|
|
12
|
+
* - "restricted" (default): filterEnv() to prevent secret leakage
|
|
13
|
+
* - "inherit": full process.env
|
|
14
|
+
* - object: custom env merged with restricted base
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveEnv(mode: EnvMode | undefined): Record<string, string | undefined>;
|
|
17
|
+
export declare function redactSecrets(content: string, secrets?: string[]): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ShellPermission } from "../external.ts";
|
|
2
|
+
import type { ToolState } from "../mcp/server.ts";
|
|
3
|
+
import type { OctokitWithPlugins } from "./github.ts";
|
|
4
|
+
export interface SetupOptions {
|
|
5
|
+
tempDir: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Create a shared temp directory for the action
|
|
9
|
+
*/
|
|
10
|
+
export declare function createTempDirectory(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Setup the test repository for running actions
|
|
13
|
+
*/
|
|
14
|
+
export declare function setupTestRepo(options: SetupOptions): void;
|
|
15
|
+
export interface GitContext {
|
|
16
|
+
gitToken: string;
|
|
17
|
+
owner: string;
|
|
18
|
+
name: string;
|
|
19
|
+
octokit: OctokitWithPlugins;
|
|
20
|
+
toolState: ToolState;
|
|
21
|
+
shell: ShellPermission;
|
|
22
|
+
postCheckoutScript: string | null;
|
|
23
|
+
}
|
|
24
|
+
export type SetupGitParams = GitContext;
|
|
25
|
+
/**
|
|
26
|
+
* setup git configuration and authentication for the repository.
|
|
27
|
+
* - configures git identity (user.email, user.name)
|
|
28
|
+
* - sets up authentication via gitToken (minimal contents:write)
|
|
29
|
+
*
|
|
30
|
+
* gitToken is a minimal-permission token (contents + workflows) used for git operations.
|
|
31
|
+
* it is assumed to be potentially exfiltratable, so it has limited scope.
|
|
32
|
+
*/
|
|
33
|
+
export declare function setupGit(params: SetupGitParams): Promise<void>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type EnvMode } from "./secrets.ts";
|
|
2
|
+
interface ShellOptions {
|
|
3
|
+
cwd?: string;
|
|
4
|
+
encoding?: "utf-8" | "utf8" | "ascii" | "base64" | "base64url" | "hex" | "latin1" | "ucs-2" | "ucs2" | "utf16le";
|
|
5
|
+
log?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* env mode: "restricted" (default) filters secrets, "inherit" passes full env,
|
|
8
|
+
* or provide a custom env object (merged with restricted base)
|
|
9
|
+
*/
|
|
10
|
+
env?: EnvMode;
|
|
11
|
+
onError?: (result: {
|
|
12
|
+
status: number;
|
|
13
|
+
stdout: string;
|
|
14
|
+
stderr: string;
|
|
15
|
+
}) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Execute a shell command safely using spawnSync with argument arrays.
|
|
19
|
+
* Prevents shell injection by avoiding string interpolation in shell commands.
|
|
20
|
+
*
|
|
21
|
+
* SECURITY: by default, env vars are filtered to remove secrets (tokens, keys, passwords).
|
|
22
|
+
* this prevents malicious code (git hooks, npm scripts, etc.) from exfiltrating credentials.
|
|
23
|
+
* use env: "inherit" only when absolutely necessary.
|
|
24
|
+
*
|
|
25
|
+
* @param cmd - The command to execute
|
|
26
|
+
* @param args - Array of arguments to pass to the command
|
|
27
|
+
* @param options - Optional configuration (cwd, encoding, onError)
|
|
28
|
+
* @returns The trimmed stdout output
|
|
29
|
+
* @throws Error if command fails and no onError handler is provided
|
|
30
|
+
*/
|
|
31
|
+
export declare function $(cmd: string, args: string[], options?: ShellOptions): string;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ChildProcess } from "node:child_process";
|
|
2
|
+
export type TrackChildOptions = {
|
|
3
|
+
child: ChildProcess;
|
|
4
|
+
killGroup?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type SignalHandler = (signal: NodeJS.Signals) => void;
|
|
7
|
+
export declare function trackChild(options: TrackChildOptions): void;
|
|
8
|
+
export declare function untrackChild(child: ChildProcess): void;
|
|
9
|
+
export declare function setSignalHandler(handler: SignalHandler | null): void;
|
|
10
|
+
export declare function killTrackedChildren(): void;
|
|
11
|
+
export interface SpawnOptions {
|
|
12
|
+
cmd: string;
|
|
13
|
+
args: string[];
|
|
14
|
+
env?: NodeJS.ProcessEnv;
|
|
15
|
+
input?: string;
|
|
16
|
+
timeout?: number;
|
|
17
|
+
activityTimeout?: number;
|
|
18
|
+
cwd?: string;
|
|
19
|
+
stdio?: ("pipe" | "ignore" | "inherit")[];
|
|
20
|
+
onStdout?: (chunk: string) => void;
|
|
21
|
+
onStderr?: (chunk: string) => void;
|
|
22
|
+
}
|
|
23
|
+
export interface SpawnResult {
|
|
24
|
+
stdout: string;
|
|
25
|
+
stderr: string;
|
|
26
|
+
exitCode: number;
|
|
27
|
+
durationMs: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Spawn a subprocess with streaming callbacks and buffered results
|
|
31
|
+
*/
|
|
32
|
+
export declare function spawn(options: SpawnOptions): Promise<SpawnResult>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* time string parsing utilities for timeout configuration.
|
|
3
|
+
* supports formats like "10m", "1h30m", "10m12s", "30s".
|
|
4
|
+
*/
|
|
5
|
+
export declare const TIMEOUT_DISABLED = "none";
|
|
6
|
+
/**
|
|
7
|
+
* parse a time string like "10m", "1h30m", "10m12s" into milliseconds.
|
|
8
|
+
* returns null if the string is not a valid time format.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseTimeString(input: string): number | null;
|
|
11
|
+
/**
|
|
12
|
+
* check if a string is a valid time format.
|
|
13
|
+
*/
|
|
14
|
+
export declare function isValidTimeString(input: string): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class Timer {
|
|
2
|
+
private initialTimestamp;
|
|
3
|
+
private lastCheckpointTimestamp;
|
|
4
|
+
constructor();
|
|
5
|
+
checkpoint(name: string): void;
|
|
6
|
+
}
|
|
7
|
+
export declare class ThinkingTimer {
|
|
8
|
+
private readonly durationFormatter;
|
|
9
|
+
private lastToolResultTimestamp;
|
|
10
|
+
markToolResult(): void;
|
|
11
|
+
markToolCall(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type TodoTracker = {
|
|
2
|
+
update: (input: unknown) => void;
|
|
3
|
+
flush: () => Promise<void>;
|
|
4
|
+
cancel: () => void;
|
|
5
|
+
/** resolves when any in-flight onUpdate call completes */
|
|
6
|
+
settled: () => Promise<void>;
|
|
7
|
+
/** mark in-progress items as completed (for final snapshot before review/progress post) */
|
|
8
|
+
completeInProgress: () => void;
|
|
9
|
+
renderCollapsible: () => string;
|
|
10
|
+
readonly enabled: boolean;
|
|
11
|
+
/** true after the tracker has successfully called onUpdate at least once */
|
|
12
|
+
readonly hasPublished: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function createTodoTracker(onUpdate: (body: string) => Promise<void>): TodoTracker;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PushPermission } from "../external.ts";
|
|
2
|
+
import { acquireNewToken } from "./github.ts";
|
|
3
|
+
export { acquireNewToken as acquireInstallationToken };
|
|
4
|
+
export { revokeGitHubInstallationToken as revokeInstallationToken };
|
|
5
|
+
/**
|
|
6
|
+
* get the job-scoped token from action input.
|
|
7
|
+
* this token has permissions defined by the workflow's permissions block.
|
|
8
|
+
*
|
|
9
|
+
* fallback order:
|
|
10
|
+
* 1. INPUT_TOKEN (from workflow `with: token:`)
|
|
11
|
+
* 2. GH_TOKEN (external token override)
|
|
12
|
+
* 3. GITHUB_TOKEN (pre-acquired in tests or from GHA env)
|
|
13
|
+
*/
|
|
14
|
+
export declare function getJobToken(): string;
|
|
15
|
+
export type TokenRef = {
|
|
16
|
+
gitToken: string;
|
|
17
|
+
mcpToken: string;
|
|
18
|
+
[Symbol.asyncDispose]: () => Promise<void>;
|
|
19
|
+
};
|
|
20
|
+
type ResolveTokensParams = {
|
|
21
|
+
push: PushPermission;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* resolve tokens for the action run.
|
|
25
|
+
*
|
|
26
|
+
* creates two separate tokens:
|
|
27
|
+
* - gitToken: contents permission based on `push` setting (assumed exfiltratable)
|
|
28
|
+
* - push: enabled → contents:write (can push)
|
|
29
|
+
* - push: disabled → contents:read (read-only)
|
|
30
|
+
* - mcpToken: full installation token - used for GitHub API calls in MCP tools (not exfiltratable)
|
|
31
|
+
*
|
|
32
|
+
* security-conscious users can pass their own token via GH_TOKEN env var or inputs.token.
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveTokens(params: ResolveTokensParams): Promise<TokenRef>;
|
|
35
|
+
/**
|
|
36
|
+
* get the MCP token from memory.
|
|
37
|
+
* this is the token used for GitHub API calls in MCP tools.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getGitHubInstallationToken(): string;
|
|
40
|
+
export declare function revokeGitHubInstallationToken(token: string): Promise<void>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @throws Error if the action can't process payload
|
|
3
|
+
* The compatibility is determined according to the COMPATIBILITY_POLICY above.
|
|
4
|
+
* @param payloadVersion the version of the payload
|
|
5
|
+
* @param actionVersion the version of the action (recipient)
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateCompatibility(payloadVersion: string, actionVersion: string): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OctokitWithPlugins } from "./github.ts";
|
|
2
|
+
interface ResolveRunParams {
|
|
3
|
+
octokit: OctokitWithPlugins;
|
|
4
|
+
}
|
|
5
|
+
export interface ResolveRunResult {
|
|
6
|
+
runId: number | undefined;
|
|
7
|
+
jobId: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Resolve GitHub Actions workflow run context.
|
|
11
|
+
* Uses GITHUB_REPOSITORY and GITHUB_RUN_ID env vars.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveRun(params: ResolveRunParams): Promise<ResolveRunResult>;
|
|
14
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pullfrog",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.198",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"pullfrog": "dist/cli.mjs",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"test": "vitest",
|
|
15
15
|
"typecheck": "tsc --noEmit",
|
|
16
|
-
"build": "node esbuild.config.js",
|
|
16
|
+
"build": "node esbuild.config.js && tsc -p tsconfig.exports.json",
|
|
17
17
|
"check:entrypoints": "node scripts/check-entrypoint-imports.ts",
|
|
18
18
|
"play": "node play.ts",
|
|
19
19
|
"runtest": "node test/run.ts",
|
|
@@ -74,22 +74,19 @@
|
|
|
74
74
|
"url": "https://github.com/pullfrog/pullfrog/issues"
|
|
75
75
|
},
|
|
76
76
|
"homepage": "https://github.com/pullfrog/pullfrog#readme",
|
|
77
|
-
"zshy": {
|
|
78
|
-
"exports": "./index.ts"
|
|
79
|
-
},
|
|
80
77
|
"main": "./dist/index.js",
|
|
81
78
|
"module": "./dist/index.js",
|
|
82
79
|
"types": "./dist/index.d.ts",
|
|
83
80
|
"exports": {
|
|
84
81
|
".": {
|
|
85
82
|
"@pullfrog/source": "./index.ts",
|
|
86
|
-
"types": "./dist/index.d.
|
|
83
|
+
"types": "./dist/index.d.ts",
|
|
87
84
|
"import": "./dist/index.js",
|
|
88
|
-
"
|
|
85
|
+
"default": "./dist/index.js"
|
|
89
86
|
},
|
|
90
87
|
"./internal": {
|
|
91
88
|
"@pullfrog/source": "./internal/index.ts",
|
|
92
|
-
"types": "./dist/internal.d.
|
|
89
|
+
"types": "./dist/internal/index.d.ts",
|
|
93
90
|
"import": "./dist/internal.js",
|
|
94
91
|
"default": "./dist/internal.js"
|
|
95
92
|
},
|