Cleanup packaging
This commit is contained in:
83
AGENTS.md
83
AGENTS.md
@@ -1,22 +1,3 @@
|
||||
<!-- OPENSPEC:START -->
|
||||
# OpenSpec Instructions
|
||||
|
||||
These instructions are for AI assistants working in this project.
|
||||
|
||||
Always open `@/openspec/AGENTS.md` when the request:
|
||||
- Mentions planning or proposals (words like proposal, spec, change, plan)
|
||||
- Introduces new capabilities, breaking changes, architecture shifts, or big performance/security work
|
||||
- Sounds ambiguous and you need the authoritative spec before coding
|
||||
|
||||
Use `@/openspec/AGENTS.md` to learn:
|
||||
- How to create and apply change proposals
|
||||
- Spec format and conventions
|
||||
- Project structure and guidelines
|
||||
|
||||
Keep this managed block so 'openspec update' can refresh the instructions.
|
||||
|
||||
<!-- OPENSPEC:END -->
|
||||
|
||||
# AGENTS.md - Obsidian OpenCode Plugin
|
||||
|
||||
Guidelines for AI coding agents working on the obsidian-opencode plugin.
|
||||
@@ -31,19 +12,11 @@ Obsidian plugin that embeds the OpenCode AI assistant via an iframe. Spawns a lo
|
||||
|
||||
```bash
|
||||
bun install # Install dependencies
|
||||
bun run dev # Development (watch mode)
|
||||
bun run build # Production (type-check + bundle)
|
||||
```
|
||||
|
||||
Output: `main.js` (CommonJS bundle)
|
||||
|
||||
## Testing & Linting
|
||||
|
||||
**Not configured.** If adding:
|
||||
- Tests: Vitest, files in `src/__tests__/` or `*.test.ts`
|
||||
- Linting: ESLint + `@typescript-eslint/parser`
|
||||
- Scripts: `"test": "vitest run"`, `"lint": "eslint src"`
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
@@ -55,25 +28,7 @@ src/
|
||||
└── SettingsTab.ts # Settings UI (PluginSettingTab)
|
||||
```
|
||||
|
||||
## Code Style
|
||||
|
||||
### Imports
|
||||
- ES modules with named imports
|
||||
- Order: Obsidian API, Node.js builtins, local modules
|
||||
- Use `type` for type-only imports
|
||||
- Relative paths with `./` prefix
|
||||
|
||||
```typescript
|
||||
import { Plugin, WorkspaceLeaf, Notice } from "obsidian";
|
||||
import { spawn, ChildProcess } from "child_process";
|
||||
import type OpenCodePlugin from "./main";
|
||||
import { OpenCodeSettings, DEFAULT_SETTINGS } from "./types";
|
||||
```
|
||||
|
||||
### Exports
|
||||
- `export default class` for main plugin
|
||||
- Named exports for other classes/types/constants
|
||||
- One class per file, filename matches class (PascalCase)
|
||||
## Coding guidelines
|
||||
|
||||
### Naming Conventions
|
||||
|
||||
@@ -98,23 +53,6 @@ getProcessState(): ProcessState {
|
||||
}
|
||||
```
|
||||
|
||||
### Error Handling
|
||||
- try/catch for async operations
|
||||
- `console.error()` for debugging
|
||||
- `new Notice()` for user-facing errors
|
||||
- Boolean returns for success/failure
|
||||
- Silent catch for non-critical ops (health checks)
|
||||
|
||||
```typescript
|
||||
try {
|
||||
await this.processManager.start();
|
||||
} catch (error) {
|
||||
console.error("Failed to start:", error);
|
||||
new Notice(`Failed to start OpenCode: ${error.message}`);
|
||||
return false;
|
||||
}
|
||||
```
|
||||
|
||||
### Obsidian API Patterns
|
||||
- Extend `Plugin` with `onload()`/`onunload()` lifecycle
|
||||
- Extend `ItemView` for views: `getViewType()`, `onOpen()`, `onClose()`
|
||||
@@ -152,3 +90,22 @@ Uses Node.js APIs unavailable on mobile:
|
||||
- File system via vault adapter
|
||||
|
||||
Check for desktop environment before adding mobile-incompatible features.
|
||||
|
||||
<!-- OPENSPEC:START -->
|
||||
# OpenSpec Instructions
|
||||
|
||||
These instructions are for AI assistants working in this project.
|
||||
|
||||
Always open `@/openspec/AGENTS.md` when the request:
|
||||
- Mentions planning or proposals (words like proposal, spec, change, plan)
|
||||
- Introduces new capabilities, breaking changes, architecture shifts, or big performance/security work
|
||||
- Sounds ambiguous and you need the authoritative spec before coding
|
||||
|
||||
Use `@/openspec/AGENTS.md` to learn:
|
||||
- How to create and apply change proposals
|
||||
- Spec format and conventions
|
||||
- Project structure and guidelines
|
||||
|
||||
Keep this managed block so 'openspec update' can refresh the instructions.
|
||||
|
||||
<!-- OPENSPEC:END -->
|
||||
Reference in New Issue
Block a user