This file provides guidelines for coding agents working in the @involvex/super-agent-cli repository.
bun run build- Build project to dist/bun run build:bun- Alternative build using bunbun run build:plugins- Build all pluginsbun run compile- Compile to standalone executablebun run dev- Development mode with hot reloadbun run dev:node- Run with tsx instead of bun
bun run lint- Run ESLint to check code qualitybun run lint:fix- Auto-fix ESLint issuesbun run typecheck- Run TypeScript compiler for type checkingbun run format- Format code with Prettier (includes import organization)bun run format:check- Check formatting without modifying files
The prebuild script runs automatically: bun run format && bun run lint:fix && bun run typecheck
Always run this before building.
No test framework is currently configured in this project. No test files (.test.ts, .spec.ts) exist and there are no test scripts in package.json.
- Imports are automatically organized and sorted by Prettier plugins
- Group external library imports first, then internal imports
- Use
import type { ... }for type-only imports - Prefer named exports over default exports where possible
- Example:
import { ConfirmationService } from "../utils/confirmation-service"; import type { ChatEntry } from "../types/index"; import * as fs from "fs-extra";
- 80 character line width
- 2 space indentation (no tabs)
- Double quotes for strings (
"string", not'string') - Trailing commas required (in objects, arrays, functions)
- Semicolons required at end of statements
- No parentheses around single arrow function parameters:
x => x - JSX bracket on new line
- Target: ES2022, Module: ESNext
strict: true- Strict type checking enablednoImplicitAny: false- Some flexibility allowedresolveJsonModule: true- Can import JSON filesjsx: "react-jsx"- JSX transforms for ReactmoduleResolution: "bundler"- Bundler-style module resolution
- Export interfaces from type files:
export interface InterfaceName { } - Use PascalCase for interfaces and type names
- Optional properties:
propertyName?: string; - Avoid
anywhen possible; useunknownfor truly unknown types - Function return types can be inferred but should be explicit for public APIs
- Classes: PascalCase (
class TextEditorTool) - Interfaces: PascalCase (
interface ToolResult) - Functions/Methods: camelCase (
async execute()) - Constants: UPPER_SNAKE_CASE for true constants (
MAX_TOOL_ROUNDS) - Variables: camelCase (
const chatHistory) - Files: kebab-case for utilities, PascalCase for components
- Utilities:
text-editor.ts,settings-manager.ts - Components:
chat-interface.tsx
- Utilities:
Always use try/catch with typed error handling:
async execute(): Promise<ToolResult> {
try {
// operation logic
return { success: true, output: "result" };
} catch (error: any) {
return {
success: false,
error: `Operation failed: ${error.message}`,
};
}
}- Return
ToolResultobjects withsuccess: boolean,output?: string,error?: string - Error messages should be descriptive and include context
- Use
error: anyfor catch blocks to access.messageproperty
src/agent/- Core agent logic (SuperAgentclass)src/commands/- CLI command implementationssrc/core/- Core abstractions (LLM providers, tools)src/tools/- Tool implementations (bash, text-editor, etc.)src/ui/- React/Ink UI componentssrc/utils/- Utility functions and servicessrc/types/- TypeScript type definitionssrc/hooks/- React hooks for UI state
- Use functional components with hooks
- Explicitly type component props with interfaces
- Use
useRef,useState,useEffectfrom React - Components using Ink's
Box,Textprimitives - Example:
interface Props { isActive: boolean; } function MyComponent({ isActive }: Props) { const [state, setState] = useState(false); return <Box><Text>Hello</Text></Box>; } export default MyComponent;
curly: warn- Always use curly braces for conditionalseqeqeq: warn- Use strict equality (===,!==)no-throw-literal: warn- Don't throw non-Error objectssemi: warn- Semicolons required- Import naming: camelCase or PascalCase allowed for imports
Tools should implement a standard interface:
export class MyTool {
async execute(args: any): Promise<ToolResult> {
// implementation
return { success: true, output: "result" };
}
}- Always return
ToolResultobjects - Handle errors gracefully
- Log meaningful error messages
- Build output (
dist/) is ignored - Plugin
node_modulesare ignored - Environment files (
.env) are ignored - Use conventional commits when creating commits manually