Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f765a0878d | |||
| e3a7b09df4 |
@@ -1,5 +1,5 @@
|
|||||||
import type { Payload } from "../external.ts";
|
import type { Payload } from "../external.ts";
|
||||||
import { ghPullfrogMcpName } from "../mcp/index.ts";
|
import { ghPullfrogMcpName } from "../external.ts";
|
||||||
import { modes } from "../modes.ts";
|
import { modes } from "../modes.ts";
|
||||||
|
|
||||||
export const addInstructions = (payload: Payload) =>
|
export const addInstructions = (payload: Payload) =>
|
||||||
|
|||||||
@@ -32888,7 +32888,7 @@ function query({
|
|||||||
// package.json
|
// package.json
|
||||||
var package_default = {
|
var package_default = {
|
||||||
name: "@pullfrog/action",
|
name: "@pullfrog/action",
|
||||||
version: "0.0.108",
|
version: "0.0.109",
|
||||||
type: "module",
|
type: "module",
|
||||||
files: [
|
files: [
|
||||||
"index.js",
|
"index.js",
|
||||||
@@ -33236,7 +33236,7 @@ function formatToolCall({
|
|||||||
return logEntry;
|
return logEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
// mcp/index.ts
|
// external.ts
|
||||||
var ghPullfrogMcpName = "gh-pullfrog";
|
var ghPullfrogMcpName = "gh-pullfrog";
|
||||||
|
|
||||||
// modes.ts
|
// modes.ts
|
||||||
@@ -42413,7 +42413,7 @@ var keyInputDefs = flatMorph(
|
|||||||
var Inputs = type({
|
var Inputs = type({
|
||||||
prompt: "string",
|
prompt: "string",
|
||||||
...keyInputDefs,
|
...keyInputDefs,
|
||||||
"agent?": AgentName.or("undefined")
|
"agent?": type.enumerated(...Object.values(agents).map((agent2) => agent2.name)).or("undefined")
|
||||||
});
|
});
|
||||||
async function main(inputs) {
|
async function main(inputs) {
|
||||||
const partialCtx = await initializeContext(inputs);
|
const partialCtx = await initializeContext(inputs);
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point for GitHub Action
|
* Entry point for GitHub Action
|
||||||
*/
|
*/
|
||||||
|
|||||||
+33
-1
@@ -1,6 +1,38 @@
|
|||||||
import type { AgentName } from "./main.ts";
|
/**
|
||||||
|
* ⚠️ NO IMPORTS except modes.ts - this file is imported by Next.js and must avoid pulling in backend code.
|
||||||
|
* All shared constants, types, and data used by both the Next.js app and the action runtime live here.
|
||||||
|
* Other files in action/ re-export from this file for backward compatibility.
|
||||||
|
*/
|
||||||
|
|
||||||
import type { Mode } from "./modes.ts";
|
import type { Mode } from "./modes.ts";
|
||||||
|
|
||||||
|
// mcp name constant
|
||||||
|
export const ghPullfrogMcpName = "gh-pullfrog";
|
||||||
|
|
||||||
|
// agent manifest - static metadata about available agents
|
||||||
|
export const agentsManifest = {
|
||||||
|
claude: {
|
||||||
|
name: "claude",
|
||||||
|
apiKeys: ["anthropic_api_key"],
|
||||||
|
},
|
||||||
|
codex: {
|
||||||
|
name: "codex",
|
||||||
|
apiKeys: ["openai_api_key"],
|
||||||
|
},
|
||||||
|
cursor: {
|
||||||
|
name: "cursor",
|
||||||
|
apiKeys: ["cursor_api_key"],
|
||||||
|
},
|
||||||
|
gemini: {
|
||||||
|
name: "gemini",
|
||||||
|
apiKeys: ["google_api_key", "gemini_api_key"],
|
||||||
|
},
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
// agent name type - union of agent slugs
|
||||||
|
export type AgentName = keyof typeof agentsManifest;
|
||||||
|
|
||||||
|
// payload type for agent execution
|
||||||
export type Payload = {
|
export type Payload = {
|
||||||
"~pullfrog": true;
|
"~pullfrog": true;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { join } from "node:path";
|
|||||||
import { flatMorph } from "@ark/util";
|
import { flatMorph } from "@ark/util";
|
||||||
import { type } from "arktype";
|
import { type } from "arktype";
|
||||||
import { agents } from "./agents/index.ts";
|
import { agents } from "./agents/index.ts";
|
||||||
import type { Payload } from "./external.ts";
|
import type { AgentName as AgentNameType, Payload } from "./external.ts";
|
||||||
import { createMcpConfigs } from "./mcp/config.ts";
|
import { createMcpConfigs } from "./mcp/config.ts";
|
||||||
import { modes } from "./modes.ts";
|
import { modes } from "./modes.ts";
|
||||||
import packageJson from "./package.json" with { type: "json" };
|
import packageJson from "./package.json" with { type: "json" };
|
||||||
@@ -19,8 +19,9 @@ import {
|
|||||||
} from "./utils/github.ts";
|
} from "./utils/github.ts";
|
||||||
import { setupGitAuth, setupGitConfig } from "./utils/setup.ts";
|
import { setupGitAuth, setupGitConfig } from "./utils/setup.ts";
|
||||||
|
|
||||||
|
// runtime validation using agents (needed for ArkType)
|
||||||
|
// Note: The AgentName type is defined in external.ts, this is the runtime validator
|
||||||
export const AgentName = type.enumerated(...Object.values(agents).map((agent) => agent.name));
|
export const AgentName = type.enumerated(...Object.values(agents).map((agent) => agent.name));
|
||||||
export type AgentName = typeof AgentName.infer;
|
|
||||||
|
|
||||||
export const AgentInputKey = type.enumerated(
|
export const AgentInputKey = type.enumerated(
|
||||||
...Object.values(agents).flatMap((agent) => agent.inputKeys)
|
...Object.values(agents).flatMap((agent) => agent.inputKeys)
|
||||||
@@ -34,7 +35,7 @@ const keyInputDefs = flatMorph(agents, (_, agent) =>
|
|||||||
export const Inputs = type({
|
export const Inputs = type({
|
||||||
prompt: "string",
|
prompt: "string",
|
||||||
...keyInputDefs,
|
...keyInputDefs,
|
||||||
"agent?": AgentName.or("undefined"),
|
"agent?": type.enumerated(...Object.values(agents).map((agent) => agent.name)).or("undefined"),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type Inputs = typeof Inputs.infer;
|
export type Inputs = typeof Inputs.infer;
|
||||||
@@ -129,8 +130,8 @@ interface MainContext {
|
|||||||
githubInstallationToken: string;
|
githubInstallationToken: string;
|
||||||
tokenToRevoke: string | null;
|
tokenToRevoke: string | null;
|
||||||
repoContext: RepoContext;
|
repoContext: RepoContext;
|
||||||
agentName: AgentName;
|
agentName: AgentNameType;
|
||||||
agent: (typeof agents)[AgentName];
|
agent: (typeof agents)[AgentNameType];
|
||||||
sharedTempDir: string;
|
sharedTempDir: string;
|
||||||
mcpLogPath: string;
|
mcpLogPath: string;
|
||||||
pollInterval: NodeJS.Timeout | null;
|
pollInterval: NodeJS.Timeout | null;
|
||||||
@@ -156,7 +157,7 @@ async function initializeContext(
|
|||||||
githubInstallationToken,
|
githubInstallationToken,
|
||||||
tokenToRevoke,
|
tokenToRevoke,
|
||||||
repoContext,
|
repoContext,
|
||||||
agentName: "claude" as AgentName,
|
agentName: "claude" as AgentNameType,
|
||||||
agent: agents.claude,
|
agent: agents.claude,
|
||||||
sharedTempDir: "",
|
sharedTempDir: "",
|
||||||
mcpLogPath: "",
|
mcpLogPath: "",
|
||||||
@@ -230,7 +231,7 @@ async function installAgentCli(ctx: MainContext): Promise<void> {
|
|||||||
|
|
||||||
function validateApiKey(ctx: MainContext): void {
|
function validateApiKey(ctx: MainContext): void {
|
||||||
const matchingInputKey = ctx.agent.inputKeys.find(
|
const matchingInputKey = ctx.agent.inputKeys.find(
|
||||||
(inputKey) => ctx.inputs[inputKey as AgentInputKey]
|
(inputKey: string) => ctx.inputs[inputKey as AgentInputKey]
|
||||||
);
|
);
|
||||||
if (!matchingInputKey) {
|
if (!matchingInputKey) {
|
||||||
throwMissingApiKeyError({
|
throwMissingApiKeyError({
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ import type { McpStdioServerConfig } from "@anthropic-ai/claude-agent-sdk";
|
|||||||
import { fromHere } from "@ark/fs";
|
import { fromHere } from "@ark/fs";
|
||||||
import type { Mode } from "../modes.ts";
|
import type { Mode } from "../modes.ts";
|
||||||
import { parseRepoContext } from "../utils/github.ts";
|
import { parseRepoContext } from "../utils/github.ts";
|
||||||
import { ghPullfrogMcpName } from "./index.ts";
|
import { ghPullfrogMcpName } from "../external.ts";
|
||||||
|
|
||||||
export type McpName = typeof ghPullfrogMcpName;
|
export type McpName = typeof ghPullfrogMcpName;
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -1,4 +1,2 @@
|
|||||||
// for reasos this can't live alongide config.ts
|
// re-export from external.ts for backward compatibility
|
||||||
// because its imported into the frontend UI
|
export { ghPullfrogMcpName } from "../external.ts";
|
||||||
// and we don't want to pull in FastMCP, etc
|
|
||||||
export const ghPullfrogMcpName = "gh-pullfrog";
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ghPullfrogMcpName } from "./mcp/index.ts";
|
import { ghPullfrogMcpName } from "./external.ts";
|
||||||
|
|
||||||
export interface Mode {
|
export interface Mode {
|
||||||
name: string;
|
name: string;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pullfrog/action",
|
"name": "@pullfrog/action",
|
||||||
"version": "0.0.108",
|
"version": "0.0.109",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"files": [
|
"files": [
|
||||||
"index.js",
|
"index.js",
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import type { AgentName } from "../main.ts";
|
import type { AgentName } from "../external.ts";
|
||||||
import { log } from "./cli.ts";
|
import { log } from "./cli.ts";
|
||||||
import type { RepoContext } from "./github.ts";
|
import type { RepoContext } from "./github.ts";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user