You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/architecture/overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -215,7 +215,7 @@ To add a new command:
215
215
- register the slice in `src/commands/index.ts`
216
216
- use or extend `<group>/shared/` only for helper logic genuinely shared by multiple commands in that group, and name modules by responsibility
217
217
218
-
Command-specific tests live beside the slice by default. Cross-cutting CLI, core, OpenCode tool/plugin, and package-level tests remain in `test/`.
218
+
Command-specific tests live beside the slice by default when they exercise only that slice's local contract surface, such as `definition.test.ts` and focused runtime-surface tests like `core.test.ts`, `tool.test.ts`, or `cli.test.ts`. Cross-cutting CLI, core, OpenCode tool/plugin, template-runtime, shared mock, and package-level tests remain in `test/`, and test-only support artifacts such as GitHub mocks must not live under `src/`.
Copy file name to clipboardExpand all lines: docs/orfe/spec.md
+23-21Lines changed: 23 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ See also:
15
15
`orfe` is a stand-alone GitHub operations tool with two entrypoints:
16
16
17
17
- an installable CLI named `orfe`
18
-
- an OpenCode custom tool wrapper also named `orfe`
18
+
- an OpenCode plugin that registers the `orfe` tool
19
19
20
20
V1 exists to provide a deterministic, reusable contract for:
21
21
@@ -32,8 +32,8 @@ Accepted architecture direction now also includes installable extensions layered
32
32
## 2. Resolved design decisions
33
33
34
34
1.`orfe` is a stand-alone tool, not a repo-specific workflow engine.
35
-
2. The OpenCode wrapper is the **only** layer allowed to read `context.agent`.
36
-
3. The wrapper resolves a plain `callerName` string and passes that into the `orfe` core.
35
+
2. The OpenCode tool entrypoint is the **only** layer allowed to read `context.agent`.
36
+
3. The tool entrypoint resolves a plain `callerName` string and passes that into the `orfe` core.
37
37
4. The core never reads `context.agent` directly.
38
38
5. Repo-local config maps `callerName` to the GitHub bot used for auth.
39
39
6.`orfe` uses Octokit as the GitHub API client layer.
@@ -70,8 +70,8 @@ For terminology in this spec:
70
70
71
71
- package/runtime architecture
72
72
- CLI contract
73
-
- OpenCode wrapper contract
74
-
-wrapper/core boundary
73
+
- OpenCode tool contract
74
+
-OpenCode tool/core boundary
75
75
- caller resolution rules
76
76
- repo-local config model
77
77
- success/error/help contract
@@ -99,7 +99,7 @@ For terminology in this spec:
99
99
100
100
`orfe` v1 is split into four layers.
101
101
102
-
### 4.1 OpenCode wrapper
102
+
### 4.1 OpenCode tool entrypoint
103
103
104
104
Responsibilities:
105
105
@@ -109,7 +109,7 @@ Responsibilities:
109
109
- reject missing or invalid caller context
110
110
- pass plain structured input plus `callerName` into the core
111
111
112
-
The wrapper must not:
112
+
The tool entrypoint must not:
113
113
114
114
- call GitHub directly
115
115
- load repo config itself except as needed to locate repo context
@@ -130,15 +130,15 @@ Responsibilities:
130
130
- dispatch command handlers
131
131
- return structured success objects or typed errors
132
132
133
-
The core is runtime-agnostic. It must be callable from both CLI and OpenCode wrapper code.
133
+
The core is runtime-agnostic. It must be callable from both CLI and OpenCode tool entrypoint code.
134
134
135
135
### 4.3 Auth adapter
136
136
137
137
V1 auth is bot-aware and internal to `orfe`.
138
138
139
139
Auth flow:
140
140
141
-
1. the wrapper or CLI provides `callerName`
141
+
1. the OpenCode tool entrypoint or CLI provides `callerName`
142
142
2. the core resolves `callerName -> github bot`
143
143
3. the auth adapter loads machine-local auth config for that GitHub bot
144
144
4. the auth adapter reads the GitHub App credentials and private key path for that bot
@@ -169,21 +169,21 @@ For `issue set-state` specifically:
169
169
- non-duplicate open/close transitions use Octokit REST issue update operations
170
170
- duplicate closure uses Octokit GraphQL because REST `state_reason=duplicate` alone does not establish GitHub's canonical duplicate relationship
171
171
172
-
## 5. Wrapper/core boundary
172
+
## 5. OpenCode tool/core boundary
173
173
174
174
The boundary is strict.
175
175
176
-
### 5.1 Wrapper input source
176
+
### 5.1 Tool entrypoint input source
177
177
178
-
At the OpenCode boundary, the wrapper resolves the caller from `context.agent` only.
178
+
At the OpenCode boundary, the tool entrypoint resolves the caller from `context.agent` only.
179
179
180
180
Resolution rules:
181
181
182
182
1. If `context.agent` is a non-empty string, use that string.
183
183
2. Else if `context.agent.name` is a non-empty string, use that string.
184
184
3. Else fail with `caller_context_missing`.
185
185
186
-
After resolution, the wrapper passes only a plain string:
186
+
After resolution, the tool entrypoint passes only a plain string:
187
187
188
188
```ts
189
189
typeCallerName=string;
@@ -576,7 +576,7 @@ The tool name is `orfe`.
576
576
577
577
### 9.1 Tool input shape
578
578
579
-
The wrapper accepts structured JSON input:
579
+
The tool entrypoint accepts structured JSON input:
580
580
581
581
```json
582
582
{
@@ -591,14 +591,14 @@ Rules:
591
591
-`command` is required.
592
592
-`command` uses the canonical space-separated vocabulary, matching the CLI subcommands exactly.
593
593
- command-specific fields use `snake_case`.
594
-
-`config` and `auth_config` are supported wrapper-level path overrides, matching CLI `--config` and `--auth-config`.
594
+
-`config` and `auth_config` are supported tool-level path overrides, matching CLI `--config` and `--auth-config`.
595
595
- template selection uses `template` in tool input when applicable.
596
596
-`caller_name` is **not** accepted from tool input.
597
-
- the wrapper injects `callerName` from `context.agent`.
597
+
- the tool entrypoint injects `callerName` from `context.agent`.
598
598
599
599
### 9.2 Tool output
600
600
601
-
The wrapper returns the same structured success/error object shape produced by the core. The wrapper may translate thrown errors into the shared error envelope, but it must not redefine field names or introduce repo-specific semantics.
601
+
The tool entrypoint returns the same structured success/error object shape produced by the core. The tool entrypoint may translate thrown errors into the shared error envelope, but it must not redefine field names or introduce repo-specific semantics.
- the caller identity is resolved normally through CLI or wrapper caller resolution
664
+
- the caller identity is resolved normally through CLI or tool entrypoint caller resolution
665
665
- the command mints only for that resolved caller bot; it is not a cross-bot impersonation feature
666
666
-`repo` is required and must be `owner/name`
667
667
-`app_slug` is config-derived from the resolved bot auth metadata, not looked up live from GitHub
@@ -1622,7 +1622,7 @@ Representative targeted help shape:
1622
1622
1623
1623
Rules:
1624
1624
1625
-
- help is a deliberate public runtime command, not a wrapper-only special case
1625
+
- help is a deliberate public runtime command, not a tool-entrypoint-only special case
1626
1626
- root help must expose enough structured information for an agent to discover available commands and choose the correct one
1627
1627
- root help is the canonical agent discovery entrypoint for OpenCode tool usage
1628
1628
- root help must make the recommended discovery flow explicit: start with root help, then request targeted help for a canonical command name
@@ -1644,7 +1644,7 @@ Issues #14 and #15 should assume these implementation constraints:
1644
1644
- core handlers return structured result objects
1645
1645
- handlers throw typed errors with stable codes
1646
1646
- CLI formatting is a thin adapter over core success/error objects
1647
-
-custom tool formatting is also a thin adapter over the same core contract
1647
+
-OpenCode tool formatting is also a thin adapter over the same core contract
1648
1648
- unimplemented leaf commands in early scaffolding must fail consistently with `not_implemented`
1649
1649
1650
1650
Placeholder behavior for stubs:
@@ -1666,7 +1666,9 @@ Placeholder behavior for stubs:
1666
1666
### 13.1 Required automated coverage direction
1667
1667
1668
1668
- contract tests for CLI structure and validation
1669
-
- contract tests for wrapper/core separation
1669
+
- contract tests for OpenCode tool/core separation
1670
+
- slice-local `definition.test.ts` files cover command metadata, validation wiring, and help-data construction where applicable
1671
+
- runtime-surface contract coverage should stay split by entrypoint as `core.test.ts`, `tool.test.ts`, and `cli.test.ts` rather than mixing those surfaces in one file
0 commit comments