Skip to Content
Packages@cfxdevkit/llm-agents

@cfxdevkit/llm-agents

Typed LLM workflow agents for Conflux DevKit repository automation.

Install

pnpm add @cfxdevkit/llm-agents

Typed workflow agents for Conflux DevKit repository automation.

Agents

AgentDescription
runCommit()Prepares and executes a commit with LLM-assisted message generation and validation
runPrecommit()Runs pre-commit checks (linting, formatting, tests) and reports issues
runDocsUpkeep()Analyzes docs changes and suggests improvements (e.g., missing examples, outdated references)
runTestUpkeep()Suggests test coverage improvements based on changed code paths
runReviewAgent()Performs deterministic, file-scoped review of changed files using LLM context
runAction()Executes a named LLM-driven action (e.g., changelog, release-notes)
listActions()Lists all registered named actions available in the current environment
runAll()Runs all agents sequentially, aggregating results and errors
configure()Configures agent behavior (e.g., model selection, temperature, timeout)
listModels()Lists available LLM models for use with agents
parseCommitFlags()Parses commit flags (e.g., --fix, --feat) into structured metadata

Provider Pattern

Agents resolve providers through the package-local completion runtime, which reads the shared PI-owned config from .pi/providers.json and applies scoped overlays through CFXDEVKIT_LLM_CONFIG_PATH when present. CLI callers usually rely on resolveProvider() indirectly; tests can still pass mocked provider behavior through the lower-level workflow helpers.

import { runReviewAgent, runCommit } from '@cfxdevkit/llm-agents'; import { resolveProvider } from './workers/completion/index.ts'; const provider = await resolveProvider(); await runCommit({ provider, cwd: process.cwd() });

Sub-paths

Sub-pathExports
.runAll, runReviewAgent, configure, listActions, listModels, runAction, parseCommitFlags, runCommit, runPrecommit, runDocsUpkeep, runTestUpkeep, runDocsApi, runDocsApiProbe, runDocsPackagePages, runDocsReadme, runStructureUpkeep, validateModels, runAgentCheck, runAgentSmoke, RepoActionExecutionResult, CommitWorkflowOptions, CommitWorkflowResult, PrecommitWorkflowResult, executeAction, getActionDefinitions, runCommitWorkflow, runPrecommitWorkflow

Usage

import { configure, runAction, runAll } from '@cfxdevkit/llm-agents'; // Configure the agent with your preferred model and API settings configure({ model: 'gpt-4o', apiKey: process.env.OPENAI_API_KEY }); // Run a named repo-aware action through the shared workflow layer await runAction(['repo-health']); // Run all agents in sequence const results = await runAll({ cwd: process.cwd() });

API Reference

See API.md for the full public surface.

Tier

Tier 1 — platform — May import Tier 0 framework packages.

API Reference

.

// Runs all registered agents sequentially. export { runAll } // Executes a single agent check (e.g., linting, formatting, or validation). export { runAgentCheck } // Runs the review agent, typically used for code review automation. export { runReviewAgent } // Runs a lightweight smoke test for agent functionality. export { runAgentSmoke } // Represents the result of executing a repository action. export { RepoActionExecutionResult } // Configures the agent runtime with provided options. export { configure } // Executes a single action definition programmatically. export { executeAction } // Retrieves all registered action definitions. export { getActionDefinitions } // Lists all available actions by name. export { listActions } // Lists all supported LLM models for agent execution. export { listModels } // Runs a specific action by name or definition. export { runAction } // Validates that configured models are supported and available. export { validateModels } // Options for configuring commit workflow execution. export { CommitWorkflowOptions } // Result type returned after executing a commit workflow. export { CommitWorkflowResult } // Result type returned after executing a precommit workflow. export { PrecommitWorkflowResult } // Parses commit-related flags from command-line arguments or config. export { parseCommitFlags } // Runs a commit action (e.g., generating commit message or applying changes). export { runCommit } // Runs a full commit workflow (precommit → commit → postcommit). export { runCommitWorkflow } // Runs a precommit action (e.g., linting, testing, formatting). export { runPrecommit } // Runs a full precommit workflow (e.g., checks before commit). export { runPrecommitWorkflow } // Configuration object for defining an action's behavior. export { ActionConfig } // Resolves an action configuration, merging defaults and overrides. export { resolveActionConfig } // Runs the documentation API generator (e.g., for API reference docs). export { runDocsApi } // Probes the documentation API endpoint for health or availability. export { runDocsApiProbe } // Generates package-level documentation pages. export { runDocsPackagePages } // Generates or updates README content. export { runDocsReadme } // Performs structural upkeep tasks (e.g., file layout, metadata updates). export { runStructureUpkeep } // Generates or updates wiki content (e.g., documentation pages). export { runWikiGenerate } // Defines a repository action with metadata and execution logic. export { RepoActionDefinition } // Enum representing the mode in which an action runs (e.g., `manual`, `auto`, `ci`). export { RepoActionMode } // Type alias for known repository action names (e.g., `"docs/readme"`, `"test/upkeep"`). export { RepoActionName } // Retrieves a specific repository action by name. export { getRepoAction } // Lists all registered repository actions. export { listRepoActions } // A registry of all built-in repository actions. export { repoActions } // Runs a specific repository action by name or definition. export { runTestUpkeep }
Last updated on