@ankhorage/devtools 1.8.5 → 1.9.0

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.
Files changed (28) hide show
  1. package/README.md +29 -2
  2. package/dist/cli/commands.d.ts +2 -2
  3. package/dist/cli/commands.js +4 -0
  4. package/dist/cli/index.d.ts +2 -2
  5. package/dist/cli/index.js +5 -5
  6. package/dist/cli/runRepositoryCommand.js +20 -0
  7. package/dist/internal/readmeDocs.js +5 -0
  8. package/dist/tools/agents/index.d.ts +6 -0
  9. package/dist/tools/agents/index.js +70 -0
  10. package/dist/tools/shared/managedFiles.d.ts +2 -2
  11. package/dist/tools/skills/assets/ankhorage-coding-rules/SKILL.md +81 -0
  12. package/dist/tools/skills/assets/ankhorage-coding-rules/agents/openai.yaml +7 -0
  13. package/dist/tools/skills/assets/ankhorage-project-structure/SKILL.md +90 -0
  14. package/dist/tools/skills/assets/ankhorage-project-structure/agents/openai.yaml +7 -0
  15. package/dist/tools/skills/assets/ankhorage-project-structure/references/cli.md +117 -0
  16. package/dist/tools/skills/assets/ankhorage-project-structure/references/expo-apps.md +43 -0
  17. package/dist/tools/skills/assets/ankhorage-project-structure/references/hexagonal-architecture.md +120 -0
  18. package/dist/tools/skills/assets/ankhorage-project-structure/references/migration.md +61 -0
  19. package/dist/tools/skills/assets/ankhorage-project-structure/references/repository-profiles.md +91 -0
  20. package/dist/tools/skills/assets/ankhorage-project-structure/references/skill-distribution.md +115 -0
  21. package/dist/tools/skills/assets/ankhorage-project-structure/references/studio.md +134 -0
  22. package/dist/tools/skills/assets/ankhorage-project-structure/references/ui-libraries.md +79 -0
  23. package/dist/tools/skills/assets/ankhorage-project-structure/references/utilities.md +62 -0
  24. package/dist/tools/skills/managed.d.ts +5 -0
  25. package/dist/tools/skills/managed.js +224 -0
  26. package/dist/tools/skills/manifest.d.ts +16 -0
  27. package/dist/tools/skills/manifest.js +95 -0
  28. package/package.json +10 -6
@@ -0,0 +1,43 @@
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.
@@ -0,0 +1,120 @@
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.
@@ -0,0 +1,61 @@
1
+ # Structural Migration
2
+
3
+ Use this reference when the user requests repository cleanup, file movement, boundary correction,
4
+ or adoption of the project structure.
5
+
6
+ ## Establish the target first
7
+
8
+ Before moving code:
9
+
10
+ 1. inventory direct `src/` files, current domains, entrypoints, tests, and generated sources;
11
+ 2. inventory package exports and consumers of public subpaths;
12
+ 3. classify the repository profile;
13
+ 4. identify code that belongs in another package;
14
+ 5. define the intended final directory tree and dependency direction;
15
+ 6. identify Utility additions and release gates;
16
+ 7. identify obsolete behavior that should be deleted rather than relocated.
17
+
18
+ Do not begin with a mechanical folder move while ownership remains unresolved.
19
+
20
+ ## Migration units
21
+
22
+ Migrate cohesive domains or vertical capabilities, not arbitrary batches of similarly named files.
23
+ For each unit:
24
+
25
+ 1. extract any required cross-repository utility first;
26
+ 2. release the owning package before updating consumers;
27
+ 3. move domain/application code and tests together;
28
+ 4. move concrete edge behavior to its package-level adapter area;
29
+ 5. preserve intentional public package subpaths by remapping exports to nested output;
30
+ 6. remove obsolete barrels, aliases, and duplicate paths;
31
+ 7. validate the focused unit before the full repository gates.
32
+
33
+ Avoid a single repository-wide move when smaller coherent migrations give clearer review and
34
+ rollback boundaries. Avoid tiny PRs that leave two competing architectures active for long periods.
35
+
36
+ ## Root source policy
37
+
38
+ At the target state, direct `src/` files are limited to intentional entrypoints such as `index.ts`,
39
+ `root.ts`, required environment declarations, or other explicitly documented build entrypoints.
40
+ Public export status alone does not justify root placement.
41
+
42
+ ## Acceptance and enforcement
43
+
44
+ After the structure is proven in a representative repository:
45
+
46
+ - distribute the canonical structure skills through `ankh devtools sync` into
47
+ `.agents/skills/<skill-name>/` as described in
48
+ [skill-distribution.md](skill-distribution.md);
49
+ - add Devtools import-boundary rules where static enforcement is reliable;
50
+ - add Doctor profile checks for allowed root files and required package entrypoints;
51
+ - use Knip to verify public exports and dead compatibility barrels;
52
+ - keep repository `AGENTS.md` focused on repository-specific ownership rather than duplicating this
53
+ skill.
54
+
55
+ Enforcement belongs to Devtools and Doctor, not prose-only repository exceptions.
56
+
57
+ ## No behavior drift
58
+
59
+ A structural migration preserves current valid behavior unless deletion is an explicit part of the
60
+ approved target architecture. Do not add compatibility implementations solely because files move.
61
+ Use characterization or focused public-surface tests when a move crosses a meaningful boundary.
@@ -0,0 +1,91 @@
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.
@@ -0,0 +1,115 @@
1
+ # Repository Skill Distribution
2
+
3
+ Use this reference when adding Ankhorage-owned skills to repositories or changing Devtools
4
+ synchronization.
5
+
6
+ ## Canonical destination
7
+
8
+ Repository-local skills live at:
9
+
10
+ ```text
11
+ .agents/
12
+ skills/
13
+ <skill-name>/
14
+ SKILL.md
15
+ agents/ # optional
16
+ references/ # optional
17
+ scripts/ # optional
18
+ assets/ # optional
19
+ ```
20
+
21
+ The directory name must equal the skill's frontmatter `name`. Synchronize the complete skill
22
+ directory, not only `SKILL.md`. Do not use `.agent/`, `.codex/skills/`, or a package source
23
+ directory as the shared repository location.
24
+
25
+ ## Devtools ownership
26
+
27
+ `@ankhorage/devtools` is the distribution authority for canonical Ankhorage-owned repository
28
+ skills. It packages immutable skill sources with the released Devtools version; synchronization
29
+ must not fetch mutable files from GitHub at runtime.
30
+
31
+ The aggregate commands include the skills scope:
32
+
33
+ ```text
34
+ ankh devtools sync [target]
35
+ ankh devtools status [target]
36
+ ```
37
+
38
+ Also expose focused commands for diagnosis and intentional updates:
39
+
40
+ ```text
41
+ ankh devtools skills sync [target]
42
+ ankh devtools skills status [target]
43
+ ```
44
+
45
+ Their provider capabilities are `devtools.skills.sync` and `devtools.skills.status`.
46
+
47
+ ## Skill selection
48
+
49
+ Do not copy every available skill into every repository.
50
+
51
+ - Devtools defines a small baseline of organization-wide Ankhorage skills.
52
+ - Profile-specific Ankhorage skills are selected from repository traits or explicit package
53
+ metadata when automatic detection would be ambiguous.
54
+ - External, personal, experimental, and task-specific skills are not part of Devtools sync.
55
+ - A repository may own additional skill directories beside the Devtools-managed set.
56
+
57
+ Prefer the same repository-trait detection used by other Devtools profiles. Add explicit metadata
58
+ only for an actual ambiguity; do not require each repository to repeat a default skill list.
59
+
60
+ ## Managed-tree semantics
61
+
62
+ Treat each selected canonical skill as an exactly managed directory while preserving the rest of
63
+ `.agents/skills/`.
64
+
65
+ - Create or replace every canonical file in a selected managed skill.
66
+ - Remove stale files and obsolete skills only when prior Devtools ownership is recorded.
67
+ - Never delete an unowned skill directory or an untracked file merely because it is absent from
68
+ the Devtools bundle.
69
+ - Record the managed skill names, relative file paths, source Devtools version, and content hashes
70
+ in a Devtools ownership manifest.
71
+ - Make `sync` idempotent. Make `status` and `--dry-run` report created, updated, removed, and
72
+ unchanged paths without mutation.
73
+
74
+ The ordinary single-file managed-file abstraction is insufficient if it cannot report or remove
75
+ stale owned files. Use a managed-tree abstraction or extend the ownership manifest rather than
76
+ deleting `.agents/skills/` wholesale.
77
+
78
+ ## Suggested Devtools source layout
79
+
80
+ Keep the package-level CLI edge separate from synchronization policy and packaged skill assets:
81
+
82
+ ```text
83
+ src/
84
+ cli/
85
+ commands.ts
86
+ runRepositoryCommand.ts
87
+ tools/
88
+ skills/
89
+ index.ts
90
+ managed.ts
91
+ selection.ts
92
+ assets/
93
+ <skill-name>/
94
+ SKILL.md
95
+ ...
96
+ ```
97
+
98
+ The exact filenames may follow the existing Devtools conventions. The important boundaries are:
99
+
100
+ - `src/cli/` declares and dispatches `skills sync` and `skills status`;
101
+ - skill selection and managed-tree policy stay outside the CLI;
102
+ - packaged skill directories are release artifacts, not runtime network dependencies.
103
+
104
+ ## Validation
105
+
106
+ Doctor should validate that:
107
+
108
+ - every selected managed skill exists at `.agents/skills/<skill-name>/`;
109
+ - directory and frontmatter names agree;
110
+ - managed files match the released Devtools bundle;
111
+ - the ownership manifest contains no unsafe paths;
112
+ - repository-owned skills remain permitted and are not falsely reported as drift.
113
+
114
+ Devtools remains responsible for applying and reporting synchronization. Doctor reports contract
115
+ violations; it does not rewrite skill trees.
@@ -0,0 +1,134 @@
1
+ # Studio Structure Example
2
+
3
+ Read this only for `ankhorage/studio`. It is a structural target and ownership checklist, not a
4
+ license to move every file in one change.
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`.
8
+
9
+ ## Target source tree
10
+
11
+ ```text
12
+ src/
13
+ index.ts
14
+ root.ts
15
+
16
+ app/ # React/RN application edge and composition
17
+ cli/ # one Studio Ankh provider
18
+ 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/
37
+
38
+ utils/
39
+
40
+ test/
41
+ acceptance/
42
+ e2e/
43
+ fixtures/
44
+ smoke/
45
+ ```
46
+
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
+
50
+ ## Studio CLI
51
+
52
+ The command tree mirrors paths after the `studio` prefix:
53
+
54
+ ```text
55
+ src/cli/
56
+ index.ts
57
+ commands/
58
+ dev.ts
59
+ projects/
60
+ create.ts
61
+ delete.ts
62
+ list.ts
63
+ sync.ts
64
+ ```
65
+
66
+ Mappings:
67
+
68
+ ```text
69
+ ankh studio dev -> commands/dev.ts
70
+ ankh studio projects create -> commands/projects/create.ts
71
+ ankh studio projects delete -> commands/projects/delete.ts
72
+ ankh studio projects list -> commands/projects/list.ts
73
+ ankh studio projects sync -> commands/projects/sync.ts
74
+ ```
75
+
76
+ `ankh studio workspace install` is not part of the target. Generated apps are standalone and own
77
+ their installation. Remove the obsolete command, handler, capability, tests, and documentation
78
+ rather than relocating them.
79
+
80
+ ## Current directory disposition
81
+
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.
88
+ - 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`.
100
+ - 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.
104
+ - 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/`.
109
+ - Host smoke and acceptance infrastructure moves outside production source to `test/`.
110
+
111
+ ## Utility gates
112
+
113
+ The existing own-property helpers explicitly marked for Utility extraction should move through
114
+ `@ankhorage/utility` before Studio consumes them. Repeated generic unknown-value narrowing should
115
+ be evaluated under `@ankhorage/utility/object` or `@ankhorage/utility/value`; semantic payload
116
+ parsers remain domain-owned.
117
+
118
+ ## Suggested migration order
119
+
120
+ Use lower-entanglement domains to prove the structure before moving the largest state models:
121
+
122
+ 1. external APIs;
123
+ 2. modules;
124
+ 3. media;
125
+ 4. secrets;
126
+ 5. projects and templates;
127
+ 6. deploy;
128
+ 7. auth;
129
+ 8. canvas and selection;
130
+ 9. routes;
131
+ 10. manifest.
132
+
133
+ Reassess cross-package ownership during every unit. Moving a misplaced behavior deeper into Studio
134
+ is not a successful migration when another Ankhorage package owns it.
@@ -0,0 +1,79 @@
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.