Repository navigation
docs: add project and architecture guides #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@mynameistito/opencode-plugins-docs": patch | ||
| --- | ||
|
|
||
| Add project and architecture documentation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| --- | ||
| title: Architecture | ||
| description: Runtime boundaries and data flow for the OpenCode plugins and documentation site. | ||
| sidebar: | ||
| label: Architecture | ||
| order: 3 | ||
| --- | ||
|
|
||
| The repository has two separately published TUI plugins and a documentation app. Each plugin runs inside the OpenCode terminal UI and contributes a focused interaction. The website is a separate static site and is not required at plugin runtime. | ||
|
|
||
| ## Plugin boundaries | ||
|
|
||
| ```text | ||
| OpenCode v2 TUI | ||
| ├── Force Input | ||
| │ ├── keymap layer: Ctrl+Enter / Ctrl+Return | ||
| │ └── prompt-footer slot: state-aware hint | ||
| └── Usage Limits | ||
| ├── configuration + OpenCode auth | ||
| ├── provider adapters and runtime services | ||
| ├── refresh coordinator + latest snapshot | ||
| └── sidebar and prompt-footer slots | ||
| ``` | ||
|
|
||
| Both packages declare their TUI entrypoint separately from any server plugin interface. OpenCode owns the plugin lifecycle and supplies session, theme, keymap, and UI-slot context. | ||
|
|
||
| ## Force Input flow | ||
|
|
||
| The plugin registers high-priority bindings for both common Ctrl+Enter key names. When invoked, it dispatches OpenCode's guarded `session.interrupt` command three times and then dispatches `prompt.submit`. The host decides whether the submitted prompt steers the active session or starts a new turn. The footer hint follows the session state and is hidden in shell mode or when there is no applicable composer. | ||
|
|
||
| ## Usage Limits flow | ||
|
|
||
| 1. The plugin loads its JSONC configuration and OpenCode authentication data. | ||
| 2. Enabled providers are fetched through provider-specific adapters. Adapters normalize API or authenticated-CLI results into common usage windows and balances. | ||
| 3. A coordinator refreshes on the configured interval, retains successful snapshots, and records provider errors without exposing credentials or response bodies in the UI. | ||
| 4. The sidebar renders configured provider results. The prompt footer selects a compact result based on the active session's provider. | ||
|
|
||
| Provider adapters are isolated from rendering. This keeps provider-specific response parsing and credential handling out of the UI components. See [Usage Limits](/usage-limits) for provider-specific credential rules and supported windows. | ||
|
|
||
| ## Documentation and deployment | ||
|
|
||
| The site under `apps/web/` reads its Markdown/MDX content from `apps/web/docs/`. Blume builds the site into `apps/web/dist/`, while Alchemy's `Website.StaticSite` deploys those assets to Cloudflare. The production custom domain is configured in `apps/web/alchemy.run.ts`; content and build settings are configured in `apps/web/blume.config.ts`. | ||
|
|
||
| The website and plugins have independent release/deployment paths: Changesets describe package releases, and the deployment workflow publishes the documentation site. Documentation content should be checked with the web app's test/build scripts and accompanied by a `docs` Changeset when it is user-facing site content. | ||
|
|
||
| ## Source map | ||
|
|
||
| - `packages/opencode-force-input/src/`: keybinding registration, hint state, and TUI entrypoint. | ||
| - `packages/opencode-usage-limits/src/`: plugin lifecycle, UI components, configuration, coordinator, provider adapters, and shared types. | ||
| - `apps/web/docs/`: website content. | ||
| - `apps/web/blume.config.ts`: content sources, navigation, site metadata, and generated agent docs. | ||
| - `apps/web/alchemy.run.ts`: static-site build and Cloudflare deployment declaration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| --- | ||
| title: Project overview | ||
| description: How the OpenCode Plugins repository and its packages are organized. | ||
| sidebar: | ||
| label: Project overview | ||
| order: 2 | ||
| --- | ||
|
|
||
| This repository contains focused [OpenCode v2](https://opencode.ai/v2) TUI plugins and the documentation site that explains how to install and use them. The plugins extend the terminal interface; they do not replace models, prompts, or OpenCode server configuration. | ||
|
|
||
| ## Packages | ||
|
|
||
| | Package | Purpose | Published entrypoints | | ||
| | --- | --- | --- | | ||
| | [`@mynameistito/opencode-force-input`](https://www.npmjs.com/package/@mynameistito/opencode-force-input) | Interrupt an active run and submit the current prompt with `Ctrl+Enter` or `Ctrl+Return`. | `./tui` | | ||
| | [`@mynameistito/opencode-usage-limits`](https://www.npmjs.com/package/@mynameistito/opencode-usage-limits) | Show supported provider usage windows and balances in the sidebar and prompt footer. | `./tui`, `./schema` | | ||
|
|
||
| The package READMEs and the [plugin guides](/force-input) and [usage guide](/usage-limits) are the detailed user-facing references. Package versions are released independently. | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| ## Repository layout | ||
|
|
||
| ```text | ||
| packages/ | ||
| opencode-force-input/ Force Input plugin source, tests, and package metadata | ||
| opencode-usage-limits/ Usage Limits plugin source, tests, schema, and examples | ||
| apps/ | ||
| web/ Blume documentation site and Cloudflare deployment | ||
| .changeset/ Pending package release and documentation notes | ||
| ``` | ||
|
|
||
| The root `package.json` defines the Bun workspace and common checks. Each package owns its runtime dependencies, build, tests, and published files. The website content is sourced from `apps/web/docs/` and its release history is generated from GitHub releases. | ||
|
|
||
| ## Technology and compatibility | ||
|
|
||
| - **OpenCode v2 TUI plugin API** provides keybindings, session context, and UI slots. | ||
| - **TypeScript** is used for plugin implementations; Usage Limits uses Effect for provider runtime workflows. | ||
| - **Bun workspaces** manage installation and run the repository's scripts. | ||
| - **Blume** builds the documentation site, including searchable and agent-oriented documentation outputs. | ||
| - **Alchemy** deploys the static site to Cloudflare Workers assets. | ||
|
|
||
| The plugins target OpenCode v2 and are distributed through npm. Consult each package's README for current installation instructions, configuration, provider support, and troubleshooting. | ||
|
|
||
| ## Start here | ||
|
|
||
| - [Force Input](/force-input): keybinding behavior and configuration. | ||
| - [Usage Limits](/usage-limits): providers, credentials, display, and configuration. | ||
| - [Architecture](/architecture): runtime boundaries and data flow. | ||
| - [Development and releases](/development): local commands, checks, and deployment. | ||
| - [Source repository](https://github.com/mynameistito/opencode-plugins) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.