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
+31-11Lines changed: 31 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,8 +12,24 @@ The architecture is evolving toward a layered model of **core plus installable e
12
12
Core remains the shared runtime substrate.
13
13
Extensions are separately installed deterministic opinion layers that repositories may enable declaratively.
14
14
15
+
The repository is organized as a **feature-oriented vertical slice architecture** flavored by **Unix philosophy**: small, responsibility-named modules composed through explicit boundaries.
16
+
The main command-facing feature verticals are `auth`, `issue`, `pr`, and `project` under `src/commands/`, while runtime, config, templates, auth, GitHub, CLI, and OpenCode layers support those verticals without taking over their feature ownership.
17
+
15
18
The current command architecture uses explicit vertical command slices under `src/commands/`. Each command owns its own metadata, validation, handler wiring, and co-located tests. A generic registry composes those slices into a single command catalog used by both the CLI and the core.
16
19
20
+
## Feature verticals, command slices, and cross-cutting concerns
21
+
22
+
`orfe` distinguishes between a **feature vertical** and a **command slice**:
23
+
24
+
- a feature vertical is a domain-owned group such as `auth`, `issue`, `pr`, or `project`
25
+
- a command slice is one executable command within that vertical, such as `issue create` or `project set-status`
26
+
27
+
Each vertical should remain understandable and refactorable on its own. Command slices inside that vertical own their contracts, handlers, and slice-local tests, while group-local shared helpers remain subordinate to the vertical rather than becoming alternate owners of behavior.
28
+
29
+
Cross-cutting concerns such as config loading, template handling, CLI formatting, filesystem helpers, auth token minting, and GitHub client construction exist to support slices through narrow interfaces. They should be named by responsibility and kept small enough that they do not turn into replacement dumping grounds.
30
+
31
+
When choosing between incidental deduplication and ownership clarity, prefer **slice autonomy**. Small duplication across slices is acceptable when it preserves encapsulation, keeps feature ownership obvious, and makes a slice easier to change or remove independently.
32
+
17
33
## Major runtime parts
18
34
19
35
### 1. OpenCode plugin entrypoint
@@ -58,7 +74,7 @@ The core is runtime-agnostic and must remain callable from both CLI and plugin e
58
74
It is also the future extension host, but it must preserve the same OpenCode tool/core and plain-data boundaries while doing so.
59
75
60
76
### 4. Config layer
61
-
Current examples include `src/config/repo-config.ts`, `src/config/auth-config.ts`, `src/config/project-defaults.ts`, `src/config/repository-ref.ts`, `src/config/shared.ts`, and `.orfe/config.json`.
77
+
Current examples include `src/config/index.ts`, `src/config/types.ts`, `src/config/schema.ts`, `src/config/json-file.ts`, `src/config/config-paths.ts`, `src/config/repo/config.ts`, `src/config/repo/ref.ts`, `src/config/auth-config.ts`, `src/config/project-defaults.ts`, and `.orfe/config.json`.
62
78
63
79
Responsibilities:
64
80
- hold repo-local non-secret configuration
@@ -70,18 +86,20 @@ Responsibilities:
70
86
71
87
Repo config is declarative and non-secret.
72
88
It may enable or configure extensions, but it must not ship executable extension code.
89
+
The config layer should be composed from narrow modules by responsibility, not a catch-all `shared.ts`.
73
90
74
91
### 5. Template layer
75
-
Current examples include `src/templates/index.ts`, `src/templates/prepare.ts`, `src/templates/loader.ts`, `src/commands/shared/body-input.ts`, and `.orfe/templates/`.
92
+
Current examples include `src/templates.ts`, `src/templates/body-input.ts`, `src/templates/prepare.ts`, `src/templates/loader.ts`, and `.orfe/templates/`.
76
93
77
94
Responsibilities:
78
95
- load versioned declarative issue and PR templates from the repository
79
96
- validate or minimally normalize issue and PR bodies deterministically
80
97
- append and read HTML comment provenance markers
98
+
- prepare command-shared issue/PR body input without placing template concerns under command ownership
81
99
- stay below repository workflow policy rather than interpreting ownership or orchestration semantics
82
100
83
101
### 6. Auth layer
84
-
Current examples include `src/github/installation-auth.ts`, `src/github/jwt.ts`, and machine-local auth config.
102
+
Current examples include `src/github/app-installation-auth.ts`, `src/github/jwt.ts`, and machine-local auth config.
Command behavior is organized as explicit vertical slices under `src/commands/`.
171
189
The registry is generic composition infrastructure; command semantics live with the slices themselves.
190
+
The vertical is the primary semantic owner; the individual command slice is the executable unit inside that vertical.
172
191
173
192
Canonical layout:
174
193
@@ -206,6 +225,7 @@ graph LR
206
225
Each `definition.ts` is the slice-owned contract. It defines the canonical command name, purpose, usage, examples, options, valid input example, success data example, optional validation hook, and the handler to execute. `src/commands/index.ts` explicitly registers those definitions in the `COMMANDS` array, and `src/commands/registry/index.ts` provides generic lookup, listing, grouping, and option validation over that array.
207
226
208
227
When multiple commands in one group reuse logic, place it under `<group>/shared/` using responsibility-named modules such as `github-response.ts`, `github-errors.ts`, `lookup.ts`, or `status-field.ts`. Avoid catch-all replacements like `shared.ts`, `types.ts`, or `utils.ts`.
228
+
If logic belongs to a cross-cutting layer such as templates, config, filesystem, CLI, or auth, keep it there instead of forcing it under command ownership just because multiple commands call it.
209
229
210
230
To add a new command:
211
231
- create a new directory at `src/commands/<group>/<command>/`
0 commit comments