@ankhorage/devtools 1.10.10 → 1.10.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,20 +2,19 @@
2
2
  name: ankhorage-project-structure
3
3
  description: >
4
4
  Design, review, or migrate the source structure of Ankhorage repositories and generated
5
- applications. Use for directory ownership, package boundaries, architectural profiles,
6
- ports and adapters, package CLI layout, repository skill distribution, public entrypoints,
7
- or cross-repository cleanup.
5
+ applications. Use for directory ownership, package boundaries, package CLI layout, repository
6
+ skill distribution, public entrypoints, or cross-repository cleanup.
8
7
  ---
9
8
 
10
9
  # Ankhorage Project Structure
11
10
 
12
- Apply a repository profile instead of forcing one folder tree onto every package.
11
+ Apply the general ownership rules first. Only Studio currently has a mandated source taxonomy.
13
12
 
14
13
  Before deciding structure:
15
14
 
16
15
  1. Read the repository `AGENTS.md`, `package.json`, exports, source tree, and representative tests.
17
16
  2. Load `ankhorage-coding-rules` as the complementary implementation and testing authority.
18
- 3. Identify the repository's owning capability and its profile below.
17
+ 3. Identify the repository's owning capability.
19
18
  4. Identify current public subpaths and cross-package release boundaries.
20
19
 
21
20
  Repository-specific rules may refine this skill, but must not silently reverse package ownership
@@ -24,35 +23,23 @@ or dependency direction.
24
23
  ## Primary boundary
25
24
 
26
25
  An Ankhorage repository/package is the primary bounded capability and independently released
27
- unit. Do not create a generic `src/features/` layer that imitates package boundaries.
26
+ unit. Do not force a Studio directory tree onto libraries, providers, tooling, or generated
27
+ applications.
28
28
 
29
29
  - Independently bindable capabilities belong in standalone packages.
30
- - Substantial responsibilities inside a package use cohesive domain directories directly under
31
- `src/`.
30
+ - Substantial responsibilities inside a package use cohesive directories owned by the package.
32
31
  - Cross-package access uses published APIs and declared dependencies, never sibling source.
33
32
  - A package owns its application behavior; adapters belonging to another package are not copied
34
33
  or proxied locally.
35
34
 
36
- ## Select a profile
37
-
38
- Read [repository-profiles.md](references/repository-profiles.md), select one primary profile, and
39
- apply only the references routed by that profile.
40
-
41
- | Profile | Typical repositories | Required references |
42
- | ---------------------------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
43
- | Application, engine, or hybrid | Studio, Runtime, Orchestrator, Deploy, Infra | [hexagonal-architecture.md](references/hexagonal-architecture.md) |
44
- | React Native / Expo application | generated apps, Studio app host | [hexagonal-architecture.md](references/hexagonal-architecture.md), [expo-apps.md](references/expo-apps.md) |
45
- | Component or design-system library | ZORA, Surface | [ui-libraries.md](references/ui-libraries.md) |
46
- | Contracts or value library | Contracts and other portable models | [repository-profiles.md](references/repository-profiles.md) |
47
- | Utility library | Utility | [utilities.md](references/utilities.md) |
48
- | Platform/provider adapter | Expo Runtime, Supabase packages, orchestrator modules | [repository-profiles.md](references/repository-profiles.md) |
49
- | Tooling or CLI package | Ankh, Doctor, Devtools and any package exposing Ankh commands | [cli.md](references/cli.md) |
50
-
51
35
  When a package declares an Ankh provider or changes `src/cli/`, always read
52
- [cli.md](references/cli.md), regardless of its primary profile.
36
+ [cli.md](references/cli.md).
37
+
38
+ When classifying a local or cross-repository utility, also read
39
+ [utilities.md](references/utilities.md).
53
40
 
54
41
  When the task is a structural cleanup or migration, also read
55
- [migration.md](references/migration.md). For Studio specifically, read
42
+ [migration.md](references/migration.md). For `ankhorage/studio`, always also read
56
43
  [studio.md](references/studio.md).
57
44
 
58
45
  When adding, distributing, or synchronizing repository-local agent skills, read
@@ -63,13 +50,8 @@ When adding, distributing, or synchronizing repository-local agent skills, read
63
50
  - Keep only intentional package entrypoints and required declaration shims directly under `src/`.
64
51
  - Keep one abstraction level and responsibility among siblings.
65
52
  - Prefer domain ownership over technical dumping grounds such as `common`, `core`, `helpers`,
66
- `misc`, or `shared`.
67
- - `app/`, `cli/`, `host/`, and `platform/` are package-level edges or composition areas, not
68
- alternate owners of domain behavior.
69
- - Ports are owned by the application/domain code that requires the capability.
70
- - Adapters depend inward; domain/application code does not import concrete adapters.
71
- - Add a port only for a real external or replaceable boundary. Do not wrap every function in
72
- architecture ceremony.
53
+ `misc`, or `shared`. `utils/` is the canonical local directory for genuine package-level
54
+ utilities.
73
55
  - Colocate focused unit tests. Put cross-domain acceptance, E2E, smoke infrastructure, and large
74
56
  fixtures outside production source.
75
57
  - Public package subpaths may point to nested source. Do not keep files at `src/` merely because
@@ -88,3 +70,10 @@ For every file or new symbol, decide in order:
88
70
  4. Is it reusable enough to belong in `@ankhorage/utility` instead?
89
71
 
90
72
  If any answer is unclear, resolve ownership before moving or creating code.
73
+
74
+ ## Studio enforcement
75
+
76
+ Only `ankhorage/studio` has a mandatory source taxonomy and hexagonal feature architecture. Its
77
+ complete allowlist, exceptions, port/adapter rules, and generated-app policy are in
78
+ [studio.md](references/studio.md). Other repositories remain structurally unconstrained beyond the
79
+ universal invariants until their owning repository is deliberately brought into scope.
@@ -3,8 +3,8 @@
3
3
  Read this only for `ankhorage/studio`. It is a structural target and ownership checklist, not a
4
4
  license to move every file in one change.
5
5
 
6
- Studio is an application/hybrid package. The Studio package is the bounded capability; its internal
7
- responsibilities are domains, not independently bound `features`.
6
+ Studio is the bounded capability. `features/` is its internal organizational boundary; its contents
7
+ are not independently bound packages.
8
8
 
9
9
  ## Target source tree
10
10
 
@@ -13,29 +13,31 @@ src/
13
13
  index.ts
14
14
  root.ts
15
15
 
16
- app/ # React/RN application edge and composition
17
16
  cli/ # one Studio Ankh provider
18
17
  host/ # Bun/Fastify/filesystem edges and host composition
19
- platform/ # Studio-local native/web implementations only
20
-
21
- auth/
22
- bindings/
23
- canvas/
24
- deploy/
25
- diagnostics/
26
- external-apis/
27
- manifest/
28
- media/
29
- modules/
30
- projects/
31
- properties/
32
- routes/
33
- secrets/
34
- selection/
35
- templates/
36
- workspace/
18
+ apps/ # generated applications; Studio-only directory
19
+ <generated-app>/ # generated; never edited by hand
20
+ studio/ # temporary exception until Studio is generated
21
+
22
+ features/ # Studio-owned capabilities
23
+ auth/
24
+ bindings/
25
+ canvas/
26
+ deploy/
27
+ diagnostics/
28
+ external-apis/
29
+ manifest/
30
+ media/
31
+ modules/
32
+ projects/
33
+ properties/
34
+ routes/
35
+ secrets/
36
+ selection/
37
+ templates/
38
+ workspace/
37
39
 
38
- utils/
40
+ utils/ # the canonical Studio-local utility directory
39
41
 
40
42
  test/
41
43
  acceptance/
@@ -44,8 +46,20 @@ test/
44
46
  smoke/
45
47
  ```
46
48
 
47
- Substantial domains may contain `contracts`, `domain`, `application`, `ports`, and domain-local
48
- `utils` when those roles genuinely exist. Do not pre-create all role directories.
49
+ `index.ts`, `root.ts`, `cli/`, `host/`, `apps/`, `features/`, and `utils/` are the complete Studio
50
+ root taxonomy, apart from required declaration shims. Do not create `app/`, `platform/`, `common/`,
51
+ `core/`, `helpers/`, or `shared/`.
52
+
53
+ Substantial features may contain `contracts`, `domain`, `application`, `ports`, `adapters`, and
54
+ focused colocated `tests` when those roles genuinely exist. Do not pre-create role directories.
55
+
56
+ `apps/` contains complete generator-owned applications. Nothing under it is manually maintained.
57
+ `apps/studio/` is a temporary exception while Studio is still hand-authored; it must disappear when
58
+ the Studio app is generated.
59
+
60
+ `utils/` is the one canonical local utility directory. It contains only reusable Studio-local,
61
+ framework-neutral helpers; behavior with feature semantics remains in that feature, and behavior
62
+ reused across repositories belongs in `@ankhorage/utility`.
49
63
 
50
64
  ## Studio CLI
51
65
 
@@ -73,41 +87,73 @@ ankh studio projects list -> commands/projects/list.ts
73
87
  ankh studio projects sync -> commands/projects/sync.ts
74
88
  ```
75
89
 
90
+ `cli/commands/` contains inbound adapters only: parse command input, invoke a feature application
91
+ operation, and render the result. It must not own feature rules or external-package integrations.
92
+
93
+ ## Studio host
94
+
95
+ ```text
96
+ src/host/
97
+ createStudioHost.ts
98
+ middleware/
99
+ routes/
100
+ <feature>/
101
+ ```
102
+
103
+ `host/` contains inbound HTTP, filesystem, and process adapters plus their composition. Route and
104
+ middleware modules translate into feature application operations; they do not own feature rules.
105
+
76
106
  `ankh studio workspace install` is not part of the target. Generated apps are standalone and own
77
107
  their installation. Remove the obsolete command, handler, capability, tests, and documentation
78
108
  rather than relocating them.
79
109
 
80
110
  ## Current directory disposition
81
111
 
82
- - Root `binding*` modules move into `bindings/`.
83
- - Root `canvas*` and insert/placement behavior move into `canvas/`.
84
- - Root `projectDeploy*`, host deploy code, deploy routes, and deploy UI converge under the `deploy`
85
- domain and package-level edges.
86
- - Root auth settings/health/OAuth behavior and host auth implementations converge under `auth` and
87
- package-level edges.
112
+ - Root `binding*` modules move into `features/bindings/`.
113
+ - Root `canvas*` and insert/placement behavior move into `features/canvas/`.
114
+ - Root `projectDeploy*`, host deploy code, deploy routes, and deploy UI converge under
115
+ `features/deploy/`, with host routes remaining in `host/routes/deploy/`.
116
+ - Root auth settings/health/OAuth behavior and host auth implementations converge under
117
+ `features/auth/`, with host routes remaining in `host/routes/auth/`.
88
118
  - Root external API contracts/model code, host API services, routes, and UI converge under
89
- `external-apis` and package-level edges.
90
- - Root media authoring code, host media implementations, and media UI converge under `media` and
91
- package-level edges.
92
- - Root module admin code and host module integration converge under `modules` and package-level
93
- edges.
94
- - Root project/workspace models, current app project screens, hooks, project store/generation
95
- operations, and matching adapters converge under `projects`, `templates`, or `workspace` according
96
- to actual ownership.
97
- - Root secret API/usage/response behavior, host secret implementations, routes, and UI converge
98
- under `secrets` and package-level edges.
99
- - Route and admin-route behavior moves under `routes`.
119
+ `features/external-apis/`, with host routes remaining in `host/routes/external-apis/`.
120
+ - Root media authoring code, host media implementations, and media UI converge under
121
+ `features/media/`.
122
+ - Root module admin code and host module integration converge under `features/modules/`.
123
+ - Root project/workspace models, project screens, hooks, project store/generation operations, and
124
+ matching adapters converge under `features/projects/`, `features/templates/`, or
125
+ `features/workspace/` according to actual ownership.
126
+ - Root secret API/usage/response behavior and host secret implementations converge under
127
+ `features/secrets/`, with host routes remaining in `host/routes/secrets/`.
128
+ - Route and admin-route policy moves under `features/routes/`; the corresponding host adapters stay
129
+ in `host/routes/`.
100
130
  - Selection, measurement, stationary selection, and canvas interaction behavior must be separated
101
- between `selection` and `canvas` by actual invariant ownership.
102
- - The current generic `core/` directory disappears; each file moves to its owning domain or package
103
- edge.
131
+ between `features/selection/` and `features/canvas/` by actual invariant ownership.
132
+ - The current generic `core/` directory disappears; each file moves to its owning feature role or
133
+ package edge.
104
134
  - The current generic `runtime/` directory is reviewed symbol by symbol. Shared runtime behavior
105
- moves to `@ankhorage/runtime`; Studio-specific application integration moves to `app/` or its
106
- owning domain.
107
- - Feature-specific UI moves beside its owning domain. Only package-wide UI composition remains in
108
- `app/`.
135
+ moves to `@ankhorage/runtime`; Studio-specific integration becomes a feature-local adapter.
136
+ - Feature-specific UI becomes generated-app code under `apps/`; it is never rehomed in a generic
137
+ Studio UI directory.
109
138
  - Host smoke and acceptance infrastructure moves outside production source to `test/`.
110
139
 
140
+ ## External package integrations
141
+
142
+ An Ankhorage or third-party package is connected in the owning feature, not in a global
143
+ `platform/` directory. For example:
144
+
145
+ ```text
146
+ src/features/templates/
147
+ ports/
148
+ templateCatalogPort.ts
149
+ adapters/
150
+ createAnkhorageTemplatesAdapter.ts
151
+ ```
152
+
153
+ The port states the capability that Templates requires. The adapter imports
154
+ `@ankhorage/templates`, translates its API, and implements that port. The composition root chooses
155
+ the adapter. Do not duplicate an adapter in `host/`, `cli/`, or another feature.
156
+
111
157
  ## Utility gates
112
158
 
113
159
  The existing own-property helpers explicitly marked for Utility extraction should move through
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/devtools",
3
- "version": "1.10.10",
3
+ "version": "1.10.11",
4
4
  "description": "Shared development tools and repository standards for Ankhorage",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/ankhorage/devtools#readme",
@@ -105,9 +105,9 @@
105
105
  "version-packages": "bun src/cli/bin/changeset.ts version"
106
106
  },
107
107
  "dependencies": {
108
- "@ankhorage/utility": "^0.2.0",
108
+ "@ankhorage/utility": "^0.3.0",
109
109
  "@changesets/cli": "^3.0.1",
110
- "@eslint/compat": "^2.1.0",
110
+ "@eslint/compat": "^2.1.1",
111
111
  "@eslint/js": "^10.0.1",
112
112
  "eslint": "^10.9.1",
113
113
  "eslint-config-prettier": "^10.1.8",
@@ -1,43 +0,0 @@
1
- # Expo and React Native Applications
2
-
3
- An Expo application is an independently installable application and may use ports-and-adapters
4
- principles for its application behavior. Expo Router route files are framework-owned inbound
5
- adapters, not the home of domain logic.
6
-
7
- ## Structure
8
-
9
- ```text
10
- app/ # Expo Router route tree
11
- src/
12
- app/ # providers and app composition
13
- <domain>/ # application-owned domains
14
- domain/
15
- application/
16
- ports/
17
- platform/ # app-local native/web adapters only
18
- utils/ # app-wide internal utilities
19
- ```
20
-
21
- Keep route files thin: resolve route parameters and navigation context, invoke or render the owning
22
- application boundary, and declare route-specific framework configuration. Substantial UI belongs
23
- with its owning domain or reusable UI package.
24
-
25
- ## Ankhorage ownership
26
-
27
- - Use Contracts for portable authored state.
28
- - Use Runtime for manifest/action/data execution.
29
- - Use ZORA and Surface for reusable UI.
30
- - Use Expo Runtime and provider packages for platform integration.
31
- - Do not copy package behavior into the generated app merely to avoid a public API or release.
32
- - Do not import Studio source or rely on the Studio workspace.
33
-
34
- ## Standalone lifecycle
35
-
36
- Each generated app owns its package manifest, lockfile, installation, validation, build, and
37
- deployment inputs. A parent dashboard may invoke commands with the app as `cwd`, but must not
38
- install it through a hidden shared workspace contract.
39
-
40
- ## Platform variants
41
-
42
- Use `.native`, `.web`, `.ios`, and `.android` variants only when the platform behavior genuinely
43
- differs. Keep the portable contract in the unsuffixed module and concrete behavior at the edge.
@@ -1,120 +0,0 @@
1
- # Ankhorage Ports and Adapters
2
-
3
- Use ports-and-adapters principles for application, engine, service, and hybrid packages. The
4
- Ankhorage package is the hexagon; internal domains are not independent feature packages.
5
-
6
- ## Purpose
7
-
8
- Protect stable package policy from React, Expo, HTTP, Fastify, Bun, filesystem, process, database,
9
- provider SDK, and test-harness details. The useful rule is dependency direction, not a mandatory
10
- folder ceremony.
11
-
12
- ```text
13
- package edge / adapter -> application -> domain
14
- |
15
- v
16
- required ports
17
-
18
- concrete adapter -> required port
19
- ```
20
-
21
- ## Roles
22
-
23
- - **Domain:** pure rules, values, invariants, and deterministic transformations owned by the
24
- package.
25
- - **Application:** command-independent use cases and orchestration of domain behavior.
26
- - **Port:** a capability contract required by application/domain code to reach an external edge.
27
- - **Inbound adapter:** converts CLI, HTTP, UI, Runtime, worker, or test input into an application
28
- invocation.
29
- - **Outbound adapter:** implements a required port using filesystem, process, provider, storage,
30
- network, Expo, or another package.
31
- - **Composition:** selects implementations and wires adapters to application operations.
32
-
33
- Ports belong beside the application/domain code that needs them. Do not create a global
34
- `src/ports/` dumping ground.
35
-
36
- ## Package-level edges
37
-
38
- Ankhorage preserves recognizable package edges:
39
-
40
- ```text
41
- src/app/ React or React Native composition and package-wide UI entrypoints
42
- src/cli/ one package-level Ankh provider
43
- src/host/ Bun/Node/Fastify/filesystem composition and shared host infrastructure
44
- src/platform/ native, web, Expo, or provider-specific implementations
45
- ```
46
-
47
- Internal domain behavior must not migrate into these directories merely because an adapter calls
48
- it. Edges translate and compose; domains own behavior.
49
-
50
- ## Domain-first organization
51
-
52
- Substantial domains may use role directories:
53
-
54
- ```text
55
- src/
56
- projects/
57
- contracts/
58
- domain/
59
- application/
60
- ports/
61
- deploy/
62
- contracts/
63
- domain/
64
- application/
65
- ports/
66
- ```
67
-
68
- Small domains remain flat while their siblings have the same role. Introduce role directories
69
- when definitions, parsers, use cases, adapters, or utilities begin mixing at one level.
70
-
71
- Do not use:
72
-
73
- ```text
74
- src/features/
75
- src/common/
76
- src/core/
77
- src/shared/
78
- src/ports/
79
- ```
80
-
81
- unless a repository has an explicit, narrower meaning that cannot be represented by an owning
82
- domain or package edge.
83
-
84
- ## When a port is justified
85
-
86
- Create a port when at least one is true:
87
-
88
- - more than one real adapter exists or is planned by current architecture;
89
- - deterministic tests need to replace a side effect;
90
- - the dependency is volatile or provider-specific;
91
- - the same application operation is invoked through multiple inbound edges;
92
- - the capability crosses a package, process, storage, network, platform, or credential boundary.
93
-
94
- Do not create a port merely because a function calls another function. Pure utilities, component
95
- composition, value transformations, and React-local presentation state usually do not need ports.
96
-
97
- ## React and React Native
98
-
99
- React/RN UI is an inbound edge. Components may collect input, render state, and invoke application
100
- actions. Provider execution and durable business rules remain outside components and hooks.
101
-
102
- - Keep navigation route modules thin.
103
- - Keep UI-specific transient state near the UI.
104
- - Move reusable business decisions and cross-interface operations into the owning domain or
105
- application layer.
106
- - Inject values, callbacks, or capability interfaces into reusable UI rather than importing
107
- concrete providers.
108
-
109
- ## Composition roots
110
-
111
- Keep wiring explicit and limited to package entrypoints such as app startup, host creation, CLI
112
- provider construction, or a focused factory. Do not use ambient service locators or hidden mutable
113
- registries as dependency injection.
114
-
115
- ## Testing
116
-
117
- - Test domain and application behavior with deterministic inputs and fake ports.
118
- - Test concrete adapters against their real protocol boundary.
119
- - Test user-facing flows through inbound edges only where the integration adds evidence.
120
- - Do not duplicate the full acceptance matrix for every internal refactor.
@@ -1,91 +0,0 @@
1
- # Repository Profiles
2
-
3
- Select one primary profile from the repository's actual ownership and consumers. A package may
4
- also expose secondary edges such as CLI or Expo without changing its primary profile.
5
-
6
- ## Application, engine, or hybrid
7
-
8
- Use for packages that coordinate use cases, state transitions, external systems, or several
9
- delivery mechanisms.
10
-
11
- Typical structure:
12
-
13
- ```text
14
- src/
15
- index.ts
16
- <domain>/
17
- contracts/
18
- domain/
19
- application/
20
- ports/
21
- app/ # optional React/RN edge and composition
22
- cli/ # optional package-level Ankh edge
23
- host/ # optional Bun/Node/HTTP/filesystem edge
24
- platform/ # optional native/web/provider edge
25
- utils/ # internal cross-domain utilities only
26
- ```
27
-
28
- Create role subdirectories only when a domain has enough distinct responsibilities to need them.
29
- Do not pre-create empty `contracts`, `domain`, `application`, or `ports` directories.
30
-
31
- ## Contracts or value library
32
-
33
- Contracts own portable shape and structural validation, not provider execution.
34
-
35
- ```text
36
- src/
37
- index.ts
38
- <domain>/
39
- contracts/
40
- parsers/
41
- constants/
42
- tests colocated with their owner
43
- ```
44
-
45
- - Keep modules deterministic and side-effect free.
46
- - Type definitions and structural parsers change together.
47
- - Provider readiness, network state, filesystem state, and UI behavior stay in their owner.
48
- - Avoid `Record<string, unknown>` escape hatches when a canonical concept can be modeled.
49
-
50
- ## Platform or provider adapter
51
-
52
- These packages deliberately implement an external technology boundary.
53
-
54
- ```text
55
- src/
56
- index.ts
57
- contracts/ # provider-facing public configuration when owned here
58
- planning/ # pure capability/configuration planning
59
- adapters/ # concrete provider/platform implementations
60
- composition/ # factories or provider registration
61
- cli/ # only when this package exposes Ankh commands
62
- ```
63
-
64
- - Depend on portable contracts or ports from lower-level owning packages.
65
- - Do not redefine the application/domain model locally.
66
- - Keep provider SDK values from leaking through portable public contracts.
67
- - Separate build-time planning from runtime execution when both exist.
68
-
69
- ## Tooling package
70
-
71
- Tooling packages may be command-centric but still keep parsing, policy, and side effects distinct.
72
-
73
- ```text
74
- src/
75
- cli/
76
- policy/ # deterministic rules and diagnostics
77
- application/ # command-independent operations
78
- adapters/ # filesystem, process, GitHub, registry, etc.
79
- composition/
80
- index.ts
81
- ```
82
-
83
- The package remains the boundary. Do not create internal pseudo-packages beneath `features/`.
84
-
85
- ## Generated or standalone application
86
-
87
- A generated application is an independently installable and buildable project. It is not a
88
- workspace child of Studio and must not depend on Studio-local source or installation state.
89
-
90
- Use the Expo application profile when applicable. Application-specific domains live under `src/`;
91
- route entrypoints remain thin.
@@ -1,79 +0,0 @@
1
- # UI and Design-System Libraries
2
-
3
- ZORA and Surface are layered reusable UI libraries, not hexagonal applications. From an
4
- application's perspective, they help build the inbound UI adapter; internally they use component
5
- ownership and dependency direction rather than application ports and use cases.
6
-
7
- ## Recommended layers
8
-
9
- ```text
10
- src/
11
- foundation/
12
- theme/
13
- layout/
14
- primitives/
15
- components/
16
- patterns/
17
- registry/
18
- internal/
19
- index.ts
20
- ```
21
-
22
- Use only the layers owned by the package. Surface and ZORA must not duplicate the same abstraction.
23
-
24
- Dependency direction moves from composed UI toward stable foundations:
25
-
26
- ```text
27
- patterns -> components -> primitives/foundation
28
- patterns -> layout -> foundation
29
- components -> theme -> foundation
30
- registry -> component/pattern metadata
31
- ```
32
-
33
- Lower layers do not import higher layers. Components do not import the global registry.
34
-
35
- ## Component ownership
36
-
37
- Colocate artifacts that change with the component:
38
-
39
- ```text
40
- components/
41
- Button/
42
- Button.tsx
43
- Button.types.ts
44
- Button.metadata.ts
45
- Button.test.tsx
46
- ```
47
-
48
- Keep a component as a single file while it has one homogeneous responsibility. Introduce its
49
- directory when tests, metadata, platform variants, styles, or private helpers justify it.
50
-
51
- Component-specific authoring metadata belongs beside the component. Registry composition may be
52
- central, but metadata must not become a parallel model detached from implementation and props.
53
-
54
- ## Patterns
55
-
56
- Patterns are reusable UI solutions, not application use cases. Group substantial collections by
57
- UI capability:
58
-
59
- ```text
60
- patterns/
61
- auth/
62
- content/
63
- navigation/
64
- onboarding/
65
- settings/
66
- ```
67
-
68
- A pattern may accept state, values, errors, and callbacks. It must not execute Supabase, HTTP,
69
- filesystem, deployment, or application authorization behavior.
70
-
71
- ## Platform behavior
72
-
73
- Keep provider and platform execution in the owning adapter package unless it is an unavoidable
74
- peer-backed UI implementation. Prefer injected values/callbacks and platform-neutral component
75
- contracts. Expo Runtime and provider packages own application/platform integration.
76
-
77
- Do not introduce `domain`, `application`, `ports`, or `adapters` for ordinary components. A complex
78
- subsystem such as an editor, canvas, or data grid may use internal model/platform boundaries when
79
- real complexity warrants them.