Skip to content

Commit a1c6ada

Browse files
nghyane“nghyane”alvinunrealgreptile-apps[bot]
authored
refactor(background): implement event-driven fire-and-forget tasks (alvinunreal#89)
* refactor(background): implement event-driven fire-and-forget tasks - BackgroundTaskManager now launches tasks in ~1ms (fire-and-forget) - Uses session.status events instead of deprecated session.idle - Adds start queue with configurable concurrency limit (default: 10) - Optional notification to parent session on completion - Removes sync mode and legacy polling-based approach - Simplified tool API: background_task, background_output, background_cancel BREAKING CHANGE: Removed sync/async mode, session.create, sendPrompt, pollSession, resolveSessionId, extractResponseText exports * fix(PR#89): address review comments - TmuxSessionManager: call startPolling() for fallback reliability - Remove redundant assignments before completeTask() in cancel() - Remove unused model parameter from LaunchOptions - Remove unused POLL_INTERVAL_BACKGROUND_MS import - Remove unused createSessionCreatedHandler/createSessionStatusHandler methods - Fix misplaced comment in schema.ts * fix(PR#89): add cancelled status checks - completeTask: guard now checks cancelled status - background.ts: waitForCompletion skips cancelled tasks * fix(PR#89): address remaining review comments - Fix activeStarts leak in startTask early return - Add resolver cleanup to prevent memory leak - Fix race condition in cancel() by marking cancelled first * Update src/background/background-manager.ts Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: “nghyane” <“hoangvananhnghia99@gmail.com”> Co-authored-by: Alvin <alvin@cmngoal.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
1 parent 2582d57 commit a1c6ada

8 files changed

Lines changed: 961 additions & 1265 deletions

File tree

AGENTS.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Agent Coding Guidelines
2+
3+
This document provides guidelines for AI agents operating in this repository.
4+
5+
## Project Overview
6+
7+
**oh-my-opencode-slim** - A lightweight agent orchestration plugin for OpenCode, a slimmed-down fork of oh-my-opencode. Built with TypeScript, Bun, and Biome.
8+
9+
## Commands
10+
11+
| Command | Description |
12+
|---------|-------------|
13+
| `bun run build` | Build TypeScript to `dist/` (both index.ts and cli/index.ts) |
14+
| `bun run typecheck` | Run TypeScript type checking without emitting |
15+
| `bun test` | Run all tests with Bun |
16+
| `bun run lint` | Run Biome linter on entire codebase |
17+
| `bun run format` | Format entire codebase with Biome |
18+
| `bun run check` | Run Biome check with auto-fix (lint + format + organize imports) |
19+
| `bun run check:ci` | Run Biome check without auto-fix (CI mode) |
20+
| `bun run dev` | Build and run with OpenCode |
21+
22+
**Running a single test:** Use Bun's test filtering with the `-t` flag:
23+
```bash
24+
bun test -t "test-name-pattern"
25+
```
26+
27+
## Code Style
28+
29+
### General Rules
30+
- **Formatter/Linter:** Biome (configured in `biome.json`)
31+
- **Line width:** 80 characters
32+
- **Indentation:** 2 spaces
33+
- **Line endings:** LF (Unix)
34+
- **Quotes:** Single quotes in JavaScript/TypeScript
35+
- **Trailing commas:** Always enabled
36+
37+
### TypeScript Guidelines
38+
- **Strict mode:** Enabled in `tsconfig.json`
39+
- **No explicit `any`:** Generates a linter warning (disabled for test files)
40+
- **Module resolution:** `bundler` strategy
41+
- **Declarations:** Generate `.d.ts` files in `dist/`
42+
43+
### Imports
44+
- Biome auto-organizes imports on save (`organizeImports: "on"`)
45+
- Let the formatter handle import sorting
46+
- Use path aliases defined in TypeScript configuration if present
47+
48+
### Naming Conventions
49+
- **Variables/functions:** camelCase
50+
- **Classes/interfaces:** PascalCase
51+
- **Constants:** SCREAMING_SNAKE_CASE
52+
- **Files:** kebab-case for most, PascalCase for React components
53+
54+
### Error Handling
55+
- Use typed errors with descriptive messages
56+
- Let errors propagate appropriately rather than catching silently
57+
- Use Zod for runtime validation (already a dependency)
58+
59+
### Git Integration
60+
- Biome integrates with git (VCS enabled)
61+
- Commits should pass `bun run check:ci` before pushing
62+
63+
## Project Structure
64+
65+
```
66+
oh-my-opencode-slim/
67+
├── src/ # TypeScript source files
68+
├── dist/ # Built JavaScript and declarations
69+
├── node_modules/ # Dependencies
70+
├── biome.json # Biome configuration
71+
├── tsconfig.json # TypeScript configuration
72+
└── package.json # Project manifest and scripts
73+
```
74+
75+
## Key Dependencies
76+
77+
- `@modelcontextprotocol/sdk` - MCP protocol implementation
78+
- `@opencode-ai/sdk` - OpenCode AI SDK
79+
- `zod` - Runtime validation
80+
- `vscode-jsonrpc` / `vscode-languageserver-protocol` - LSP support
81+
82+
## Development Workflow
83+
84+
1. Make code changes
85+
2. Run `bun run check:ci` to verify linting and formatting
86+
3. Run `bun run typecheck` to verify types
87+
4. Run `bun test` to verify tests pass
88+
5. Commit changes
89+
90+
## Common Patterns
91+
92+
- This is an OpenCode plugin - most functionality lives in `src/`
93+
- The CLI entry point is `src/cli/index.ts`
94+
- The main plugin export is `src/index.ts`
95+
- Skills are located in `src/skills/` (included in package publish)

0 commit comments

Comments
 (0)