@codyswann/lisa 1.0.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.
- package/LICENSE +21 -0
- package/README.md +867 -0
- package/all/copy-overwrite/.claude/README.md +205 -0
- package/all/copy-overwrite/.claude/agents/agent-architect.md +311 -0
- package/all/copy-overwrite/.claude/agents/codebase-analyzer.md +146 -0
- package/all/copy-overwrite/.claude/agents/codebase-locator.md +125 -0
- package/all/copy-overwrite/.claude/agents/codebase-pattern-finder.md +237 -0
- package/all/copy-overwrite/.claude/agents/git-history-analyzer.md +183 -0
- package/all/copy-overwrite/.claude/agents/hooks-expert.md +74 -0
- package/all/copy-overwrite/.claude/agents/skill-evaluator.md +246 -0
- package/all/copy-overwrite/.claude/agents/slash-command-architect.md +87 -0
- package/all/copy-overwrite/.claude/agents/web-search-researcher.md +112 -0
- package/all/copy-overwrite/.claude/commands/git/commit-and-submit-pr.md +8 -0
- package/all/copy-overwrite/.claude/commands/git/commit.md +44 -0
- package/all/copy-overwrite/.claude/commands/git/prune.md +34 -0
- package/all/copy-overwrite/.claude/commands/git/submit-pr.md +50 -0
- package/all/copy-overwrite/.claude/commands/jira/create.md +50 -0
- package/all/copy-overwrite/.claude/commands/jira/verify.md +34 -0
- package/all/copy-overwrite/.claude/commands/project/archive.md +8 -0
- package/all/copy-overwrite/.claude/commands/project/bootstrap.md +49 -0
- package/all/copy-overwrite/.claude/commands/project/complete-task.md +7 -0
- package/all/copy-overwrite/.claude/commands/project/debrief.md +65 -0
- package/all/copy-overwrite/.claude/commands/project/execute.md +94 -0
- package/all/copy-overwrite/.claude/commands/project/implement.md +42 -0
- package/all/copy-overwrite/.claude/commands/project/local-code-review.md +88 -0
- package/all/copy-overwrite/.claude/commands/project/lower-code-complexity.md +74 -0
- package/all/copy-overwrite/.claude/commands/project/plan.md +314 -0
- package/all/copy-overwrite/.claude/commands/project/research.md +248 -0
- package/all/copy-overwrite/.claude/commands/project/review.md +63 -0
- package/all/copy-overwrite/.claude/commands/project/setup.md +19 -0
- package/all/copy-overwrite/.claude/commands/project/verify.md +38 -0
- package/all/copy-overwrite/.claude/commands/pull-request/review.md +12 -0
- package/all/copy-overwrite/.claude/commands/rules/format-md.md +72 -0
- package/all/copy-overwrite/.claude/commands/sonarqube/check.md +6 -0
- package/all/copy-overwrite/.claude/commands/sonarqube/fix.md +3 -0
- package/all/copy-overwrite/.claude/hooks/README.md +301 -0
- package/all/copy-overwrite/.claude/hooks/notify-ntfy.sh +181 -0
- package/all/copy-overwrite/.claude/settings.json +41 -0
- package/all/copy-overwrite/.claude/settings.local.json.example +14 -0
- package/all/copy-overwrite/.claude/skills/coding-philosophy/SKILL.md +405 -0
- package/all/copy-overwrite/.claude/skills/coding-philosophy/references/function-structure.md +416 -0
- package/all/copy-overwrite/.claude/skills/coding-philosophy/references/immutable-patterns.md +316 -0
- package/all/copy-overwrite/.claude/skills/prompt-complexity-scorer/SKILL.md +118 -0
- package/all/copy-overwrite/.claude/skills/skill-creator/LICENSE.txt +202 -0
- package/all/copy-overwrite/.claude/skills/skill-creator/SKILL.md +210 -0
- package/all/copy-overwrite/.claude/skills/skill-creator/scripts/__pycache__/quick_validate.cpython-312.pyc +0 -0
- package/all/copy-overwrite/.claude/skills/skill-creator/scripts/init_skill.py +303 -0
- package/all/copy-overwrite/.claude/skills/skill-creator/scripts/package_skill.py +110 -0
- package/all/copy-overwrite/.claude/skills/skill-creator/scripts/quick_validate.py +65 -0
- package/all/copy-overwrite/CLAUDE.md +77 -0
- package/all/copy-overwrite/HUMAN.md +17 -0
- package/all/copy-overwrite/specs/.keep +0 -0
- package/all/create-only/PROJECT_RULES.md +0 -0
- package/cdk/merge/package.json +20 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +107 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/prompts.d.ts +45 -0
- package/dist/cli/prompts.d.ts.map +1 -0
- package/dist/cli/prompts.js +58 -0
- package/dist/cli/prompts.js.map +1 -0
- package/dist/core/config.d.ts +73 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +36 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +4 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/lisa.d.ts +81 -0
- package/dist/core/lisa.d.ts.map +1 -0
- package/dist/core/lisa.js +459 -0
- package/dist/core/lisa.js.map +1 -0
- package/dist/core/manifest.d.ts +58 -0
- package/dist/core/manifest.d.ts.map +1 -0
- package/dist/core/manifest.js +104 -0
- package/dist/core/manifest.js.map +1 -0
- package/dist/detection/detector.interface.d.ts +15 -0
- package/dist/detection/detector.interface.d.ts.map +1 -0
- package/dist/detection/detector.interface.js +2 -0
- package/dist/detection/detector.interface.js.map +1 -0
- package/dist/detection/detectors/cdk.d.ts +10 -0
- package/dist/detection/detectors/cdk.d.ts.map +1 -0
- package/dist/detection/detectors/cdk.js +34 -0
- package/dist/detection/detectors/cdk.js.map +1 -0
- package/dist/detection/detectors/expo.d.ts +10 -0
- package/dist/detection/detectors/expo.d.ts.map +1 -0
- package/dist/detection/detectors/expo.js +30 -0
- package/dist/detection/detectors/expo.js.map +1 -0
- package/dist/detection/detectors/nestjs.d.ts +10 -0
- package/dist/detection/detectors/nestjs.d.ts.map +1 -0
- package/dist/detection/detectors/nestjs.js +34 -0
- package/dist/detection/detectors/nestjs.js.map +1 -0
- package/dist/detection/detectors/npm-package.d.ts +13 -0
- package/dist/detection/detectors/npm-package.d.ts.map +1 -0
- package/dist/detection/detectors/npm-package.js +30 -0
- package/dist/detection/detectors/npm-package.js.map +1 -0
- package/dist/detection/detectors/typescript.d.ts +10 -0
- package/dist/detection/detectors/typescript.d.ts.map +1 -0
- package/dist/detection/detectors/typescript.js +25 -0
- package/dist/detection/detectors/typescript.js.map +1 -0
- package/dist/detection/index.d.ts +24 -0
- package/dist/detection/index.d.ts.map +1 -0
- package/dist/detection/index.js +57 -0
- package/dist/detection/index.js.map +1 -0
- package/dist/errors/index.d.ts +69 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +110 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/console-logger.d.ts +12 -0
- package/dist/logging/console-logger.d.ts.map +1 -0
- package/dist/logging/console-logger.js +22 -0
- package/dist/logging/console-logger.js.map +1 -0
- package/dist/logging/index.d.ts +4 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +3 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/logger.interface.d.ts +20 -0
- package/dist/logging/logger.interface.d.ts.map +1 -0
- package/dist/logging/logger.interface.js +2 -0
- package/dist/logging/logger.interface.js.map +1 -0
- package/dist/logging/silent-logger.d.ts +12 -0
- package/dist/logging/silent-logger.d.ts.map +1 -0
- package/dist/logging/silent-logger.js +21 -0
- package/dist/logging/silent-logger.js.map +1 -0
- package/dist/strategies/copy-contents.d.ts +14 -0
- package/dist/strategies/copy-contents.d.ts.map +1 -0
- package/dist/strategies/copy-contents.js +69 -0
- package/dist/strategies/copy-contents.js.map +1 -0
- package/dist/strategies/copy-overwrite.d.ts +14 -0
- package/dist/strategies/copy-overwrite.d.ts.map +1 -0
- package/dist/strategies/copy-overwrite.js +47 -0
- package/dist/strategies/copy-overwrite.js.map +1 -0
- package/dist/strategies/create-only.d.ts +13 -0
- package/dist/strategies/create-only.d.ts.map +1 -0
- package/dist/strategies/create-only.js +30 -0
- package/dist/strategies/create-only.js.map +1 -0
- package/dist/strategies/index.d.ts +31 -0
- package/dist/strategies/index.d.ts.map +1 -0
- package/dist/strategies/index.js +52 -0
- package/dist/strategies/index.js.map +1 -0
- package/dist/strategies/merge.d.ts +13 -0
- package/dist/strategies/merge.d.ts.map +1 -0
- package/dist/strategies/merge.js +60 -0
- package/dist/strategies/merge.js.map +1 -0
- package/dist/strategies/strategy.interface.d.ts +31 -0
- package/dist/strategies/strategy.interface.d.ts.map +1 -0
- package/dist/strategies/strategy.interface.js +2 -0
- package/dist/strategies/strategy.interface.js.map +1 -0
- package/dist/transaction/backup.d.ts +38 -0
- package/dist/transaction/backup.d.ts.map +1 -0
- package/dist/transaction/backup.js +97 -0
- package/dist/transaction/backup.js.map +1 -0
- package/dist/transaction/index.d.ts +4 -0
- package/dist/transaction/index.d.ts.map +1 -0
- package/dist/transaction/index.js +3 -0
- package/dist/transaction/index.js.map +1 -0
- package/dist/transaction/transaction.d.ts +34 -0
- package/dist/transaction/transaction.d.ts.map +1 -0
- package/dist/transaction/transaction.js +68 -0
- package/dist/transaction/transaction.js.map +1 -0
- package/dist/utils/file-operations.d.ts +29 -0
- package/dist/utils/file-operations.d.ts.map +1 -0
- package/dist/utils/file-operations.js +84 -0
- package/dist/utils/file-operations.js.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/json-utils.d.ts +22 -0
- package/dist/utils/json-utils.d.ts.map +1 -0
- package/dist/utils/json-utils.js +57 -0
- package/dist/utils/json-utils.js.map +1 -0
- package/dist/utils/path-utils.d.ts +21 -0
- package/dist/utils/path-utils.d.ts.map +1 -0
- package/dist/utils/path-utils.js +35 -0
- package/dist/utils/path-utils.js.map +1 -0
- package/eslint-plugin-code-organization/README.md +149 -0
- package/eslint-plugin-code-organization/__tests__/enforce-statement-order.test.js +468 -0
- package/eslint-plugin-code-organization/index.js +23 -0
- package/eslint-plugin-code-organization/package.json +10 -0
- package/eslint-plugin-code-organization/rules/enforce-statement-order.js +157 -0
- package/expo/copy-overwrite/.claude/skills/apollo-client/SKILL.md +238 -0
- package/expo/copy-overwrite/.claude/skills/apollo-client/references/mutation-patterns.md +360 -0
- package/expo/copy-overwrite/.claude/skills/atomic-design-gluestack/SKILL.md +360 -0
- package/expo/copy-overwrite/.claude/skills/atomic-design-gluestack/references/atomic-levels.md +417 -0
- package/expo/copy-overwrite/.claude/skills/atomic-design-gluestack/references/folder-structure.md +257 -0
- package/expo/copy-overwrite/.claude/skills/atomic-design-gluestack/references/gluestack-mapping.md +233 -0
- package/expo/copy-overwrite/.claude/skills/atomic-design-gluestack/scripts/validate_atomic_structure.py +327 -0
- package/expo/copy-overwrite/.claude/skills/container-view-pattern/SKILL.md +299 -0
- package/expo/copy-overwrite/.claude/skills/container-view-pattern/references/examples.md +749 -0
- package/expo/copy-overwrite/.claude/skills/container-view-pattern/references/patterns.md +318 -0
- package/expo/copy-overwrite/.claude/skills/container-view-pattern/scripts/create_component.py +198 -0
- package/expo/copy-overwrite/.claude/skills/container-view-pattern/scripts/validate_component.py +207 -0
- package/expo/copy-overwrite/.claude/skills/cross-platform-compatibility/SKILL.md +268 -0
- package/expo/copy-overwrite/.claude/skills/cross-platform-compatibility/references/common-issues.md +619 -0
- package/expo/copy-overwrite/.claude/skills/cross-platform-compatibility/references/file-extensions.md +340 -0
- package/expo/copy-overwrite/.claude/skills/cross-platform-compatibility/references/platform-api.md +276 -0
- package/expo/copy-overwrite/.claude/skills/cross-platform-compatibility/scripts/validate_cross_platform.py +414 -0
- package/expo/copy-overwrite/.claude/skills/directory-structure/SKILL.md +202 -0
- package/expo/copy-overwrite/.claude/skills/directory-structure/scripts/validate_structure.py +443 -0
- package/expo/copy-overwrite/.claude/skills/expo-env-config/SKILL.md +309 -0
- package/expo/copy-overwrite/.claude/skills/expo-env-config/references/validation-patterns.md +417 -0
- package/expo/copy-overwrite/.claude/skills/expo-router-best-practices/SKILL.md +431 -0
- package/expo/copy-overwrite/.claude/skills/expo-router-best-practices/references/official-docs.md +290 -0
- package/expo/copy-overwrite/.claude/skills/expo-router-best-practices/scripts/generate-route.py +169 -0
- package/expo/copy-overwrite/.claude/skills/gluestack-nativewind/SKILL.md +411 -0
- package/expo/copy-overwrite/.claude/skills/gluestack-nativewind/references/color-tokens.md +343 -0
- package/expo/copy-overwrite/.claude/skills/gluestack-nativewind/references/component-mapping.md +307 -0
- package/expo/copy-overwrite/.claude/skills/gluestack-nativewind/references/spacing-scale.md +300 -0
- package/expo/copy-overwrite/.claude/skills/gluestack-nativewind/scripts/validate_styling.py +354 -0
- package/expo/copy-overwrite/.claude/skills/local-state/SKILL.md +362 -0
- package/expo/copy-overwrite/.claude/skills/local-state/references/async-storage.md +505 -0
- package/expo/copy-overwrite/.claude/skills/local-state/references/persistence-patterns.md +711 -0
- package/expo/copy-overwrite/.claude/skills/local-state/references/reactive-variables.md +446 -0
- package/expo/copy-overwrite/.claude/skills/playwright-selectors/SKILL.md +223 -0
- package/expo/copy-overwrite/.claude/skills/testing-library/SKILL.md +319 -0
- package/expo/copy-overwrite/.claude/skills/testing-library/references/async-patterns.md +420 -0
- package/expo/copy-overwrite/.claude/skills/testing-library/references/expo-router-testing.md +556 -0
- package/expo/copy-overwrite/.claude/skills/testing-library/references/mocking-patterns.md +590 -0
- package/expo/copy-overwrite/.claude/skills/testing-library/references/query-priority.md +291 -0
- package/expo/copy-overwrite/.easignore.extra +2 -0
- package/expo/copy-overwrite/.mcp.json +33 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/README.md +234 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/__tests__/plugin-index.test.js +84 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/__tests__/require-memo-in-view.test.js +196 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/__tests__/single-component-per-file.test.js +289 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/index.js +32 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/package.json +10 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/rules/enforce-component-structure.js +230 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/rules/no-return-in-view.js +91 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/rules/require-memo-in-view.js +178 -0
- package/expo/copy-overwrite/eslint-plugin-component-structure/rules/single-component-per-file.js +238 -0
- package/expo/copy-overwrite/eslint-plugin-ui-standards/README.md +260 -0
- package/expo/copy-overwrite/eslint-plugin-ui-standards/index.js +29 -0
- package/expo/copy-overwrite/eslint-plugin-ui-standards/package.json +10 -0
- package/expo/copy-overwrite/eslint-plugin-ui-standards/rules/no-classname-outside-ui.js +51 -0
- package/expo/copy-overwrite/eslint-plugin-ui-standards/rules/no-direct-rn-imports.js +55 -0
- package/expo/copy-overwrite/eslint-plugin-ui-standards/rules/no-inline-styles.js +73 -0
- package/expo/copy-overwrite/eslint.config.mjs +560 -0
- package/expo/copy-overwrite/lighthouserc.js +194 -0
- package/expo/create-only/lighthouserc-config.json +28 -0
- package/expo/merge/package.json +132 -0
- package/lisa.sh +35 -0
- package/nestjs/copy-overwrite/.claude/skills/nestjs-graphql/SKILL.md +176 -0
- package/nestjs/copy-overwrite/.claude/skills/nestjs-graphql/references/advanced-features.md +527 -0
- package/nestjs/copy-overwrite/.claude/skills/nestjs-graphql/references/project-patterns.md +483 -0
- package/nestjs/copy-overwrite/.claude/skills/nestjs-graphql/references/quick-start.md +257 -0
- package/nestjs/copy-overwrite/.claude/skills/nestjs-graphql/references/resolvers-mutations.md +413 -0
- package/nestjs/copy-overwrite/.claude/skills/nestjs-graphql/references/types-scalars.md +513 -0
- package/nestjs/copy-overwrite/.claude/skills/nestjs-rules/SKILL.md +536 -0
- package/nestjs/copy-overwrite/.claude/skills/typeorm-patterns/SKILL.md +275 -0
- package/nestjs/copy-overwrite/.claude/skills/typeorm-patterns/references/configuration-patterns.md +487 -0
- package/nestjs/copy-overwrite/.claude/skills/typeorm-patterns/references/entity-patterns.md +450 -0
- package/nestjs/copy-overwrite/.claude/skills/typeorm-patterns/references/observability-patterns.md +536 -0
- package/nestjs/merge/package.json +75 -0
- package/package.json +124 -0
- package/typescript/copy-contents/.husky/commit-msg +91 -0
- package/typescript/copy-contents/.husky/pre-commit +96 -0
- package/typescript/copy-contents/.husky/pre-push +211 -0
- package/typescript/copy-overwrite/.claude/hooks/format-on-edit.sh +74 -0
- package/typescript/copy-overwrite/.claude/hooks/install_pkgs.sh +59 -0
- package/typescript/copy-overwrite/.claude/hooks/lint-on-edit.sh +103 -0
- package/typescript/copy-overwrite/.claude/skills/jsdoc-best-practices/SKILL.md +388 -0
- package/typescript/copy-overwrite/.github/README.md +455 -0
- package/typescript/copy-overwrite/.github/dependabot.yml +40 -0
- package/typescript/copy-overwrite/.github/k6/BROWSER_TESTING_NOTE.md +129 -0
- package/typescript/copy-overwrite/.github/k6/INTEGRATION_GUIDE.md +354 -0
- package/typescript/copy-overwrite/.github/k6/README.md +386 -0
- package/typescript/copy-overwrite/.github/k6/SCENARIO_SELECTION_GUIDE.md +264 -0
- package/typescript/copy-overwrite/.github/k6/examples/customer-deploy-integration.yml +115 -0
- package/typescript/copy-overwrite/.github/k6/examples/data-driven-test.js +268 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/load.js +142 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/load.json +27 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/smoke.js +26 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/smoke.json +20 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/soak.js +244 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/soak.json +29 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/spike.js +180 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/spike.json +32 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/stress.js +206 -0
- package/typescript/copy-overwrite/.github/k6/scenarios/stress.json +38 -0
- package/typescript/copy-overwrite/.github/k6/scripts/api-test.js +452 -0
- package/typescript/copy-overwrite/.github/k6/scripts/default-test.js +185 -0
- package/typescript/copy-overwrite/.github/k6/thresholds/normal.json +30 -0
- package/typescript/copy-overwrite/.github/k6/thresholds/relaxed.json +21 -0
- package/typescript/copy-overwrite/.github/k6/thresholds/strict.json +29 -0
- package/typescript/copy-overwrite/.github/workflows/build.yml +72 -0
- package/typescript/copy-overwrite/.github/workflows/ci.yml +49 -0
- package/typescript/copy-overwrite/.github/workflows/claude.yml +51 -0
- package/typescript/copy-overwrite/.github/workflows/create-github-issue-on-failure.yml +113 -0
- package/typescript/copy-overwrite/.github/workflows/create-jira-issue-on-failure.yml +195 -0
- package/typescript/copy-overwrite/.github/workflows/create-sentry-issue-on-failure.yml +267 -0
- package/typescript/copy-overwrite/.github/workflows/deploy.yml +228 -0
- package/typescript/copy-overwrite/.github/workflows/k6-load-test-README.md +230 -0
- package/typescript/copy-overwrite/.github/workflows/lighthouse.yml +68 -0
- package/typescript/copy-overwrite/.github/workflows/load-test.yml +282 -0
- package/typescript/copy-overwrite/.github/workflows/quality.yml +1737 -0
- package/typescript/copy-overwrite/.github/workflows/release.yml +1599 -0
- package/typescript/copy-overwrite/.gitleaksignore +28 -0
- package/typescript/copy-overwrite/.nvmrc +1 -0
- package/typescript/copy-overwrite/.prettierignore +23 -0
- package/typescript/copy-overwrite/.prettierrc.json +22 -0
- package/typescript/copy-overwrite/.versionrc +42 -0
- package/typescript/copy-overwrite/.yamllint +20 -0
- package/typescript/copy-overwrite/commitlint.config.js +11 -0
- package/typescript/copy-overwrite/eslint-plugin-code-organization/README.md +149 -0
- package/typescript/copy-overwrite/eslint-plugin-code-organization/__tests__/enforce-statement-order.test.js +468 -0
- package/typescript/copy-overwrite/eslint-plugin-code-organization/index.js +23 -0
- package/typescript/copy-overwrite/eslint-plugin-code-organization/package.json +10 -0
- package/typescript/copy-overwrite/eslint-plugin-code-organization/rules/enforce-statement-order.js +157 -0
- package/typescript/copy-overwrite/eslint.config.mjs +390 -0
- package/typescript/copy-overwrite/eslint.ignore.config.json +57 -0
- package/typescript/copy-overwrite/eslint.thresholds.config.json +5 -0
- package/typescript/github-rulesets/base.json +106 -0
- package/typescript/merge/.claude/settings.json +28 -0
- package/typescript/merge/package.json +71 -0
package/expo/copy-overwrite/.claude/skills/atomic-design-gluestack/references/atomic-levels.md
ADDED
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
# Atomic Design Levels - Detailed Reference
|
|
2
|
+
|
|
3
|
+
## Atoms
|
|
4
|
+
|
|
5
|
+
### Definition
|
|
6
|
+
The foundational building blocks of the interface - smallest functional UI elements that cannot be broken down further while remaining functional.
|
|
7
|
+
|
|
8
|
+
### Characteristics
|
|
9
|
+
- **Stateless**: No useState, useReducer, or other state hooks
|
|
10
|
+
- **Purely presentational**: Only render UI based on props
|
|
11
|
+
- **No business logic**: No calculations, transformations, or side effects
|
|
12
|
+
- **Highly reusable**: Used across the entire application
|
|
13
|
+
- **Single responsibility**: One visual element
|
|
14
|
+
|
|
15
|
+
### Examples
|
|
16
|
+
|
|
17
|
+
#### Good Atoms
|
|
18
|
+
```typescript
|
|
19
|
+
// ✅ Stateless, presentational
|
|
20
|
+
const AppBadge = memo(function AppBadge({ variant, children }: AppBadgeProps) {
|
|
21
|
+
return (
|
|
22
|
+
<Badge action={variant}>
|
|
23
|
+
<BadgeText>{children}</BadgeText>
|
|
24
|
+
</Badge>
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// ✅ Wrapper with default styling
|
|
29
|
+
const PrimaryButton = memo(function PrimaryButton({
|
|
30
|
+
children,
|
|
31
|
+
onPress
|
|
32
|
+
}: PrimaryButtonProps) {
|
|
33
|
+
return (
|
|
34
|
+
<Button action="primary" onPress={onPress}>
|
|
35
|
+
<ButtonText>{children}</ButtonText>
|
|
36
|
+
</Button>
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### Bad Atoms (Anti-patterns)
|
|
42
|
+
```typescript
|
|
43
|
+
// ❌ Has state - should be a molecule
|
|
44
|
+
const ToggleButton = memo(function ToggleButton() {
|
|
45
|
+
const [isOn, setIsOn] = useState(false); // WRONG: Atoms shouldn't have state
|
|
46
|
+
return <Button onPress={() => setIsOn(!isOn)}>{isOn ? 'On' : 'Off'}</Button>;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// ❌ Fetches data - should be a page
|
|
50
|
+
const UserAvatar = memo(function UserAvatar({ userId }: { userId: string }) {
|
|
51
|
+
const { data } = useUserQuery({ variables: { userId } }); // WRONG: No data fetching
|
|
52
|
+
return <Avatar source={data?.user?.avatar} />;
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Molecules
|
|
59
|
+
|
|
60
|
+
### Definition
|
|
61
|
+
Simple groups of UI elements (atoms) functioning together as a unit, adhering to the single responsibility principle.
|
|
62
|
+
|
|
63
|
+
### Characteristics
|
|
64
|
+
- **Combines 2-5 atoms**: Simple composition
|
|
65
|
+
- **Single purpose**: Does one thing well
|
|
66
|
+
- **UI state allowed**: useState for toggles, form values, validation
|
|
67
|
+
- **No data fetching**: Receives all data via props
|
|
68
|
+
- **Reusable**: Can be used in multiple organisms
|
|
69
|
+
|
|
70
|
+
### Examples
|
|
71
|
+
|
|
72
|
+
#### Good Molecules
|
|
73
|
+
```typescript
|
|
74
|
+
// ✅ Combines atoms, has UI state, single purpose
|
|
75
|
+
const PasswordField = memo(function PasswordField({
|
|
76
|
+
value,
|
|
77
|
+
onChangeText,
|
|
78
|
+
error
|
|
79
|
+
}: PasswordFieldProps) {
|
|
80
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<FormControl isInvalid={!!error}>
|
|
84
|
+
<FormControlLabel>
|
|
85
|
+
<FormControlLabelText>Password</FormControlLabelText>
|
|
86
|
+
</FormControlLabel>
|
|
87
|
+
<Input>
|
|
88
|
+
<InputField
|
|
89
|
+
type={showPassword ? "text" : "password"}
|
|
90
|
+
value={value}
|
|
91
|
+
onChangeText={onChangeText}
|
|
92
|
+
/>
|
|
93
|
+
<InputSlot onPress={() => setShowPassword(!showPassword)}>
|
|
94
|
+
<InputIcon as={showPassword ? EyeOffIcon : EyeIcon} />
|
|
95
|
+
</InputSlot>
|
|
96
|
+
</Input>
|
|
97
|
+
{error && (
|
|
98
|
+
<FormControlError>
|
|
99
|
+
<FormControlErrorText>{error}</FormControlErrorText>
|
|
100
|
+
</FormControlError>
|
|
101
|
+
)}
|
|
102
|
+
</FormControl>
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// ✅ Simple composition of atoms
|
|
107
|
+
const AvatarWithName = memo(function AvatarWithName({
|
|
108
|
+
name,
|
|
109
|
+
imageUrl,
|
|
110
|
+
size = "md"
|
|
111
|
+
}: AvatarWithNameProps) {
|
|
112
|
+
return (
|
|
113
|
+
<HStack space="sm" className="items-center">
|
|
114
|
+
<Avatar size={size}>
|
|
115
|
+
<AvatarImage source={{ uri: imageUrl }} />
|
|
116
|
+
<AvatarFallbackText>{name}</AvatarFallbackText>
|
|
117
|
+
</Avatar>
|
|
118
|
+
<Text size={size}>{name}</Text>
|
|
119
|
+
</HStack>
|
|
120
|
+
);
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### Bad Molecules (Anti-patterns)
|
|
125
|
+
```typescript
|
|
126
|
+
// ❌ Too complex - should be an organism
|
|
127
|
+
const UserProfile = memo(function UserProfile({ user }: UserProfileProps) {
|
|
128
|
+
return (
|
|
129
|
+
<VStack>
|
|
130
|
+
<Avatar />
|
|
131
|
+
<Text>{user.name}</Text>
|
|
132
|
+
<Text>{user.email}</Text>
|
|
133
|
+
<Text>{user.bio}</Text>
|
|
134
|
+
<Button>Edit Profile</Button>
|
|
135
|
+
<Button>Settings</Button>
|
|
136
|
+
<RecentActivityList activities={user.activities} />
|
|
137
|
+
<FriendsList friends={user.friends} />
|
|
138
|
+
</VStack>
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// ❌ Fetches data - data fetching belongs in pages
|
|
143
|
+
const SearchResults = memo(function SearchResults({ query }: { query: string }) {
|
|
144
|
+
const { data } = useSearchQuery({ variables: { query } }); // WRONG
|
|
145
|
+
return <FlatList data={data?.results} />;
|
|
146
|
+
});
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Organisms
|
|
152
|
+
|
|
153
|
+
### Definition
|
|
154
|
+
Relatively complex components composed of molecules and atoms, forming distinct sections of the interface.
|
|
155
|
+
|
|
156
|
+
### Characteristics
|
|
157
|
+
- **Combines molecules and atoms**: Complex composition
|
|
158
|
+
- **Distinct interface section**: Has clear visual boundaries
|
|
159
|
+
- **Feature state allowed**: Can use custom hooks for feature logic
|
|
160
|
+
- **Coordinates children**: Manages interaction between child components
|
|
161
|
+
- **Receives data as props**: Does NOT fetch data itself
|
|
162
|
+
|
|
163
|
+
### Examples
|
|
164
|
+
|
|
165
|
+
#### Good Organisms
|
|
166
|
+
```typescript
|
|
167
|
+
// ✅ Distinct section, combines molecules, coordinates children
|
|
168
|
+
const ProductCard = memo(function ProductCard({
|
|
169
|
+
product,
|
|
170
|
+
onAddToCart,
|
|
171
|
+
onFavorite
|
|
172
|
+
}: ProductCardProps) {
|
|
173
|
+
const [quantity, setQuantity] = useState(1);
|
|
174
|
+
|
|
175
|
+
const handleAddToCart = useCallback(() => {
|
|
176
|
+
onAddToCart(product.id, quantity);
|
|
177
|
+
}, [onAddToCart, product.id, quantity]);
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<Card variant="elevated">
|
|
181
|
+
<ProductImage source={product.image} badge={product.isNew ? "New" : undefined} />
|
|
182
|
+
<VStack space="sm" className="p-4">
|
|
183
|
+
<HStack className="justify-between">
|
|
184
|
+
<Heading size="sm">{product.name}</Heading>
|
|
185
|
+
<FavoriteButton isFavorite={product.isFavorite} onPress={onFavorite} />
|
|
186
|
+
</HStack>
|
|
187
|
+
<PriceDisplay price={product.price} originalPrice={product.originalPrice} />
|
|
188
|
+
<RatingStars rating={product.rating} reviewCount={product.reviewCount} />
|
|
189
|
+
<QuantitySelector value={quantity} onChange={setQuantity} max={product.stock} />
|
|
190
|
+
<Button onPress={handleAddToCart}>
|
|
191
|
+
<ButtonText>Add to Cart</ButtonText>
|
|
192
|
+
</Button>
|
|
193
|
+
</VStack>
|
|
194
|
+
</Card>
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// ✅ Navigation section with multiple molecules
|
|
199
|
+
const Header = memo(function Header({
|
|
200
|
+
user,
|
|
201
|
+
onSearch,
|
|
202
|
+
onMenuPress,
|
|
203
|
+
onNotificationsPress
|
|
204
|
+
}: HeaderProps) {
|
|
205
|
+
return (
|
|
206
|
+
<HStack className="items-center justify-between px-4 py-2 bg-background-0">
|
|
207
|
+
<HStack space="md" className="items-center">
|
|
208
|
+
<IconButton icon={MenuIcon} onPress={onMenuPress} />
|
|
209
|
+
<AppLogo size="sm" />
|
|
210
|
+
</HStack>
|
|
211
|
+
<SearchField onSearch={onSearch} placeholder="Search..." />
|
|
212
|
+
<HStack space="sm" className="items-center">
|
|
213
|
+
<NotificationBadge count={user.unreadCount} onPress={onNotificationsPress} />
|
|
214
|
+
<UserAvatarMenu user={user} />
|
|
215
|
+
</HStack>
|
|
216
|
+
</HStack>
|
|
217
|
+
);
|
|
218
|
+
});
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
#### Bad Organisms (Anti-patterns)
|
|
222
|
+
```typescript
|
|
223
|
+
// ❌ Fetches data - should be in page
|
|
224
|
+
const ProductList = memo(function ProductList({ categoryId }: { categoryId: string }) {
|
|
225
|
+
const { data, loading } = useProductsQuery({ variables: { categoryId } }); // WRONG
|
|
226
|
+
return <FlatList data={data?.products} renderItem={...} />;
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
// ❌ Too simple - should be a molecule
|
|
230
|
+
const IconWithLabel = memo(function IconWithLabel({ icon, label }: IconWithLabelProps) {
|
|
231
|
+
return (
|
|
232
|
+
<VStack className="items-center">
|
|
233
|
+
<Icon as={icon} />
|
|
234
|
+
<Text>{label}</Text>
|
|
235
|
+
</VStack>
|
|
236
|
+
);
|
|
237
|
+
});
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Templates
|
|
243
|
+
|
|
244
|
+
### Definition
|
|
245
|
+
Page-level objects that place components into a layout, articulating the design's underlying content structure.
|
|
246
|
+
|
|
247
|
+
### Characteristics
|
|
248
|
+
- **Layout skeleton**: Defines where components go
|
|
249
|
+
- **No real content**: Uses children/slots, not actual data
|
|
250
|
+
- **Handles responsiveness**: Adapts layout to screen size
|
|
251
|
+
- **Layout state only**: Safe area, scroll position, layout dimensions
|
|
252
|
+
- **Reusable across pages**: Same layout, different content
|
|
253
|
+
|
|
254
|
+
### Examples
|
|
255
|
+
|
|
256
|
+
#### Good Templates
|
|
257
|
+
```typescript
|
|
258
|
+
// ✅ Layout skeleton with slots
|
|
259
|
+
const MainLayout = memo(function MainLayout({
|
|
260
|
+
children,
|
|
261
|
+
header,
|
|
262
|
+
footer,
|
|
263
|
+
showHeader = true,
|
|
264
|
+
showFooter = true
|
|
265
|
+
}: MainLayoutProps) {
|
|
266
|
+
const insets = useSafeAreaInsets();
|
|
267
|
+
|
|
268
|
+
return (
|
|
269
|
+
<View className="flex-1 bg-background-0" style={{ paddingTop: insets.top }}>
|
|
270
|
+
{showHeader && (header || <Header />)}
|
|
271
|
+
<KeyboardAvoidingView className="flex-1">
|
|
272
|
+
<ScrollView className="flex-1" contentContainerClassName="pb-20">
|
|
273
|
+
{children}
|
|
274
|
+
</ScrollView>
|
|
275
|
+
</KeyboardAvoidingView>
|
|
276
|
+
{showFooter && (footer || <TabBar />)}
|
|
277
|
+
</View>
|
|
278
|
+
);
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
// ✅ Auth-specific layout
|
|
282
|
+
const AuthLayout = memo(function AuthLayout({
|
|
283
|
+
children,
|
|
284
|
+
title,
|
|
285
|
+
subtitle
|
|
286
|
+
}: AuthLayoutProps) {
|
|
287
|
+
return (
|
|
288
|
+
<SafeAreaView className="flex-1 bg-primary-500">
|
|
289
|
+
<ScrollView contentContainerClassName="flex-1 justify-center p-6">
|
|
290
|
+
<VStack space="xl" className="items-center">
|
|
291
|
+
<AppLogo size="lg" variant="white" />
|
|
292
|
+
{title && <Heading size="2xl" className="text-white">{title}</Heading>}
|
|
293
|
+
{subtitle && <Text className="text-white/80">{subtitle}</Text>}
|
|
294
|
+
<Card className="w-full max-w-md p-6">
|
|
295
|
+
{children}
|
|
296
|
+
</Card>
|
|
297
|
+
</VStack>
|
|
298
|
+
</ScrollView>
|
|
299
|
+
</SafeAreaView>
|
|
300
|
+
);
|
|
301
|
+
});
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
#### Bad Templates (Anti-patterns)
|
|
305
|
+
```typescript
|
|
306
|
+
// ❌ Has business logic - move to page
|
|
307
|
+
const DashboardLayout = memo(function DashboardLayout({ userId }: { userId: string }) {
|
|
308
|
+
const { data } = useUserDashboardQuery({ variables: { userId } }); // WRONG
|
|
309
|
+
return (
|
|
310
|
+
<View>
|
|
311
|
+
<Header user={data?.user} />
|
|
312
|
+
<DashboardContent data={data?.dashboard} />
|
|
313
|
+
</View>
|
|
314
|
+
);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
// ❌ Too specific - not reusable
|
|
318
|
+
const JohnsDashboardLayout = memo(function JohnsDashboardLayout() {
|
|
319
|
+
return (
|
|
320
|
+
<View>
|
|
321
|
+
<Text>Welcome John!</Text>
|
|
322
|
+
<JohnsSpecificContent />
|
|
323
|
+
</View>
|
|
324
|
+
);
|
|
325
|
+
});
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## Pages
|
|
331
|
+
|
|
332
|
+
### Definition
|
|
333
|
+
Specific instances of templates that show what the UI looks like with real representative content.
|
|
334
|
+
|
|
335
|
+
### Characteristics
|
|
336
|
+
- **Real content**: Actual data, not placeholders
|
|
337
|
+
- **Data fetching**: Queries, mutations, subscriptions
|
|
338
|
+
- **Global state**: Connected to Apollo, Context, etc.
|
|
339
|
+
- **Route-specific**: One page per route
|
|
340
|
+
- **Passes data down**: Provides data to organisms/molecules
|
|
341
|
+
|
|
342
|
+
### Examples
|
|
343
|
+
|
|
344
|
+
#### Good Pages
|
|
345
|
+
```typescript
|
|
346
|
+
// ✅ Fetches data, uses template, passes data to children
|
|
347
|
+
export default function HomeScreen() {
|
|
348
|
+
const { data, loading, error, refetch } = useHomeDataQuery();
|
|
349
|
+
|
|
350
|
+
if (loading) return <LoadingScreen />;
|
|
351
|
+
if (error) return <ErrorScreen error={error} onRetry={refetch} />;
|
|
352
|
+
|
|
353
|
+
return (
|
|
354
|
+
<MainLayout>
|
|
355
|
+
<VStack space="lg" className="p-4">
|
|
356
|
+
<WelcomeBanner user={data.currentUser} />
|
|
357
|
+
<FeaturedProducts products={data.featuredProducts} />
|
|
358
|
+
<RecentOrders orders={data.recentOrders} />
|
|
359
|
+
<RecommendedForYou items={data.recommendations} />
|
|
360
|
+
</VStack>
|
|
361
|
+
</MainLayout>
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// ✅ Form page with mutations
|
|
366
|
+
export default function CheckoutScreen() {
|
|
367
|
+
const { cartItems, total } = useCart();
|
|
368
|
+
const [createOrder, { loading }] = useCreateOrderMutation();
|
|
369
|
+
const router = useRouter();
|
|
370
|
+
|
|
371
|
+
const handleSubmit = useCallback(async (formData: CheckoutFormData) => {
|
|
372
|
+
const result = await createOrder({ variables: { input: formData } });
|
|
373
|
+
if (result.data?.createOrder.success) {
|
|
374
|
+
router.push(`/orders/${result.data.createOrder.orderId}`);
|
|
375
|
+
}
|
|
376
|
+
}, [createOrder, router]);
|
|
377
|
+
|
|
378
|
+
return (
|
|
379
|
+
<MainLayout showFooter={false}>
|
|
380
|
+
<CheckoutForm
|
|
381
|
+
items={cartItems}
|
|
382
|
+
total={total}
|
|
383
|
+
onSubmit={handleSubmit}
|
|
384
|
+
isSubmitting={loading}
|
|
385
|
+
/>
|
|
386
|
+
</MainLayout>
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
#### Bad Pages (Anti-patterns)
|
|
392
|
+
```typescript
|
|
393
|
+
// ❌ No data fetching - this is just an organism
|
|
394
|
+
export default function ProductListScreen() {
|
|
395
|
+
return (
|
|
396
|
+
<MainLayout>
|
|
397
|
+
<ProductList /> {/* Where does data come from? */}
|
|
398
|
+
</MainLayout>
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// ❌ Business logic that should be in a hook
|
|
403
|
+
export default function DashboardScreen() {
|
|
404
|
+
const [data, setData] = useState(null);
|
|
405
|
+
|
|
406
|
+
useEffect(() => {
|
|
407
|
+
fetch('/api/dashboard')
|
|
408
|
+
.then(res => res.json())
|
|
409
|
+
.then(json => {
|
|
410
|
+
// 50 lines of data transformation... WRONG: Extract to hook
|
|
411
|
+
setData(transformedData);
|
|
412
|
+
});
|
|
413
|
+
}, []);
|
|
414
|
+
|
|
415
|
+
return <MainLayout>{/* ... */}</MainLayout>;
|
|
416
|
+
}
|
|
417
|
+
```
|
package/expo/copy-overwrite/.claude/skills/atomic-design-gluestack/references/folder-structure.md
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# Folder Structure Reference
|
|
2
|
+
|
|
3
|
+
## Complete Directory Structure
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
thumbwar-frontend/
|
|
7
|
+
├── app/ # Expo Router - PAGES live here
|
|
8
|
+
│ ├── (auth)/ # Auth route group
|
|
9
|
+
│ │ ├── login.tsx # Login page
|
|
10
|
+
│ │ ├── register.tsx # Register page
|
|
11
|
+
│ │ └── _layout.tsx # Auth layout
|
|
12
|
+
│ ├── (tabs)/ # Tab route group
|
|
13
|
+
│ │ ├── index.tsx # Home page
|
|
14
|
+
│ │ ├── profile.tsx # Profile page
|
|
15
|
+
│ │ └── _layout.tsx # Tab layout
|
|
16
|
+
│ └── _layout.tsx # Root layout
|
|
17
|
+
│
|
|
18
|
+
├── components/
|
|
19
|
+
│ ├── ui/ # Gluestack UI library (DO NOT MODIFY)
|
|
20
|
+
│ │ ├── accordion/
|
|
21
|
+
│ │ ├── actionsheet/
|
|
22
|
+
│ │ ├── alert/
|
|
23
|
+
│ │ ├── alert-dialog/
|
|
24
|
+
│ │ ├── avatar/
|
|
25
|
+
│ │ ├── badge/
|
|
26
|
+
│ │ ├── box/
|
|
27
|
+
│ │ ├── button/
|
|
28
|
+
│ │ ├── card/
|
|
29
|
+
│ │ ├── center/
|
|
30
|
+
│ │ ├── checkbox/
|
|
31
|
+
│ │ ├── divider/
|
|
32
|
+
│ │ ├── drawer/
|
|
33
|
+
│ │ ├── form-control/
|
|
34
|
+
│ │ ├── gluestack-ui-provider/ # Theme config lives here
|
|
35
|
+
│ │ │ └── config.ts # Design tokens
|
|
36
|
+
│ │ ├── grid/
|
|
37
|
+
│ │ ├── heading/
|
|
38
|
+
│ │ ├── hstack/
|
|
39
|
+
│ │ ├── icon/
|
|
40
|
+
│ │ ├── image/
|
|
41
|
+
│ │ ├── input/
|
|
42
|
+
│ │ ├── link/
|
|
43
|
+
│ │ ├── menu/
|
|
44
|
+
│ │ ├── modal/
|
|
45
|
+
│ │ ├── popover/
|
|
46
|
+
│ │ ├── pressable/
|
|
47
|
+
│ │ ├── progress/
|
|
48
|
+
│ │ ├── radio/
|
|
49
|
+
│ │ ├── select/
|
|
50
|
+
│ │ ├── slider/
|
|
51
|
+
│ │ ├── spinner/
|
|
52
|
+
│ │ ├── switch/
|
|
53
|
+
│ │ ├── text/
|
|
54
|
+
│ │ ├── textarea/
|
|
55
|
+
│ │ ├── toast/
|
|
56
|
+
│ │ ├── tooltip/
|
|
57
|
+
│ │ └── vstack/
|
|
58
|
+
│ │
|
|
59
|
+
│ ├── atoms/ # Project-specific atoms
|
|
60
|
+
│ │ ├── AppLogo/
|
|
61
|
+
│ │ │ ├── index.tsx # Main component
|
|
62
|
+
│ │ │ ├── AppLogo.test.tsx # Unit tests
|
|
63
|
+
│ │ │ └── types.ts # TypeScript types
|
|
64
|
+
│ │ ├── BrandIcon/
|
|
65
|
+
│ │ │ └── ...
|
|
66
|
+
│ │ └── index.ts # Barrel export
|
|
67
|
+
│ │
|
|
68
|
+
│ ├── molecules/ # Simple compositions
|
|
69
|
+
│ │ ├── SearchField/
|
|
70
|
+
│ │ │ ├── index.tsx # Container (if needed)
|
|
71
|
+
│ │ │ ├── SearchFieldView.tsx # View component
|
|
72
|
+
│ │ │ ├── SearchField.test.tsx # Tests
|
|
73
|
+
│ │ │ └── types.ts # Types
|
|
74
|
+
│ │ ├── FormField/
|
|
75
|
+
│ │ │ └── ...
|
|
76
|
+
│ │ ├── AvatarWithName/
|
|
77
|
+
│ │ │ └── ...
|
|
78
|
+
│ │ └── index.ts # Barrel export
|
|
79
|
+
│ │
|
|
80
|
+
│ ├── organisms/ # Complex sections
|
|
81
|
+
│ │ ├── Header/
|
|
82
|
+
│ │ │ ├── index.tsx # Container
|
|
83
|
+
│ │ │ ├── HeaderView.tsx # View
|
|
84
|
+
│ │ │ ├── Header.test.tsx # Tests
|
|
85
|
+
│ │ │ ├── useHeader.ts # Hook (if needed)
|
|
86
|
+
│ │ │ └── types.ts # Types
|
|
87
|
+
│ │ ├── ProductCard/
|
|
88
|
+
│ │ │ └── ...
|
|
89
|
+
│ │ ├── NavigationDrawer/
|
|
90
|
+
│ │ │ └── ...
|
|
91
|
+
│ │ └── index.ts # Barrel export
|
|
92
|
+
│ │
|
|
93
|
+
│ ├── templates/ # Page layouts
|
|
94
|
+
│ │ ├── MainLayout/
|
|
95
|
+
│ │ │ ├── index.tsx # Layout component
|
|
96
|
+
│ │ │ ├── MainLayoutView.tsx # View
|
|
97
|
+
│ │ │ └── types.ts # Types
|
|
98
|
+
│ │ ├── AuthLayout/
|
|
99
|
+
│ │ │ └── ...
|
|
100
|
+
│ │ ├── DashboardLayout/
|
|
101
|
+
│ │ │ └── ...
|
|
102
|
+
│ │ └── index.ts # Barrel export
|
|
103
|
+
│ │
|
|
104
|
+
│ └── shared/ # Cross-cutting components
|
|
105
|
+
│ └── ...
|
|
106
|
+
│
|
|
107
|
+
├── features/ # Feature modules
|
|
108
|
+
│ └── [feature-name]/
|
|
109
|
+
│ ├── components/ # Feature-specific components
|
|
110
|
+
│ │ ├── atoms/ # Feature atoms
|
|
111
|
+
│ │ │ └── ...
|
|
112
|
+
│ │ ├── molecules/ # Feature molecules
|
|
113
|
+
│ │ │ └── ...
|
|
114
|
+
│ │ └── organisms/ # Feature organisms
|
|
115
|
+
│ │ └── ...
|
|
116
|
+
│ ├── screens/ # Feature pages (if not in app/)
|
|
117
|
+
│ │ └── ...
|
|
118
|
+
│ ├── hooks/ # Feature hooks
|
|
119
|
+
│ │ └── ...
|
|
120
|
+
│ └── types/ # Feature types
|
|
121
|
+
│ └── ...
|
|
122
|
+
│
|
|
123
|
+
└── hooks/ # Global hooks
|
|
124
|
+
└── ...
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## File Naming Conventions
|
|
128
|
+
|
|
129
|
+
### Component Files
|
|
130
|
+
|
|
131
|
+
| File | Purpose | Example |
|
|
132
|
+
|------|---------|---------|
|
|
133
|
+
| `index.tsx` | Main export / Container | `components/molecules/SearchField/index.tsx` |
|
|
134
|
+
| `*View.tsx` | View component (presentation) | `SearchFieldView.tsx` |
|
|
135
|
+
| `*.test.tsx` | Unit/integration tests | `SearchField.test.tsx` |
|
|
136
|
+
| `types.ts` | TypeScript interfaces | `types.ts` |
|
|
137
|
+
| `use*.ts` | Custom hook | `useSearchField.ts` |
|
|
138
|
+
|
|
139
|
+
### Platform-Specific Files
|
|
140
|
+
|
|
141
|
+
| Suffix | Platform | Example |
|
|
142
|
+
|--------|----------|---------|
|
|
143
|
+
| `.native.tsx` | iOS + Android | `Button.native.tsx` |
|
|
144
|
+
| `.web.tsx` | Web only | `Button.web.tsx` |
|
|
145
|
+
| `.ios.tsx` | iOS only | `Button.ios.tsx` |
|
|
146
|
+
| `.android.tsx` | Android only | `Button.android.tsx` |
|
|
147
|
+
|
|
148
|
+
## Import Patterns
|
|
149
|
+
|
|
150
|
+
### Path Aliases (from tsconfig.json)
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
// Recommended imports
|
|
154
|
+
import { Button, Text } from "@/components/ui/button";
|
|
155
|
+
import { SearchField } from "@/components/molecules/SearchField";
|
|
156
|
+
import { Header } from "@/components/organisms/Header";
|
|
157
|
+
import { MainLayout } from "@/components/templates/MainLayout";
|
|
158
|
+
|
|
159
|
+
// Feature imports
|
|
160
|
+
import { useAuth } from "@/features/auth/hooks/useAuth";
|
|
161
|
+
import { LoginForm } from "@/features/auth/components/organisms/LoginForm";
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Barrel Exports
|
|
165
|
+
|
|
166
|
+
Each atomic level folder should have an `index.ts` barrel:
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
// components/atoms/index.ts
|
|
170
|
+
export { AppLogo } from "./AppLogo";
|
|
171
|
+
export { BrandIcon } from "./BrandIcon";
|
|
172
|
+
export type { AppLogoProps } from "./AppLogo/types";
|
|
173
|
+
export type { BrandIconProps } from "./BrandIcon/types";
|
|
174
|
+
|
|
175
|
+
// components/molecules/index.ts
|
|
176
|
+
export { SearchField } from "./SearchField";
|
|
177
|
+
export { FormField } from "./FormField";
|
|
178
|
+
// ... etc
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Import Rules
|
|
182
|
+
|
|
183
|
+
1. **Atoms** can only import:
|
|
184
|
+
- Other atoms from `@/components/ui/`
|
|
185
|
+
- Design tokens from `@/components/ui/gluestack-ui-provider/config`
|
|
186
|
+
- Utility functions from `@/utils/`
|
|
187
|
+
|
|
188
|
+
2. **Molecules** can only import:
|
|
189
|
+
- Atoms from `@/components/ui/` or `@/components/atoms/`
|
|
190
|
+
- Other molecules (sparingly)
|
|
191
|
+
- Utility functions
|
|
192
|
+
|
|
193
|
+
3. **Organisms** can only import:
|
|
194
|
+
- Atoms
|
|
195
|
+
- Molecules
|
|
196
|
+
- Other organisms (sparingly)
|
|
197
|
+
- Feature hooks
|
|
198
|
+
|
|
199
|
+
4. **Templates** can only import:
|
|
200
|
+
- Atoms
|
|
201
|
+
- Molecules
|
|
202
|
+
- Organisms
|
|
203
|
+
- Layout utilities
|
|
204
|
+
|
|
205
|
+
5. **Pages** can import:
|
|
206
|
+
- Everything above
|
|
207
|
+
- Data fetching hooks (Apollo queries/mutations)
|
|
208
|
+
- Global state (Context)
|
|
209
|
+
|
|
210
|
+
## Creating New Components
|
|
211
|
+
|
|
212
|
+
### Checklist for New Atom
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
components/atoms/MyAtom/
|
|
216
|
+
├── index.tsx # Required
|
|
217
|
+
├── MyAtom.test.tsx # Required
|
|
218
|
+
└── types.ts # Required if props > 3
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Checklist for New Molecule
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
components/molecules/MyMolecule/
|
|
225
|
+
├── index.tsx # Container (optional if no logic)
|
|
226
|
+
├── MyMoleculeView.tsx # Required
|
|
227
|
+
├── MyMolecule.test.tsx # Required
|
|
228
|
+
└── types.ts # Required
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Checklist for New Organism
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
components/organisms/MyOrganism/
|
|
235
|
+
├── index.tsx # Container (handles state/logic)
|
|
236
|
+
├── MyOrganismView.tsx # View (presentation only)
|
|
237
|
+
├── MyOrganism.test.tsx # Required
|
|
238
|
+
├── useMyOrganism.ts # Optional custom hook
|
|
239
|
+
└── types.ts # Required
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Checklist for New Template
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
components/templates/MyLayout/
|
|
246
|
+
├── index.tsx # Layout component
|
|
247
|
+
├── MyLayoutView.tsx # View with slots
|
|
248
|
+
└── types.ts # Required
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Checklist for New Page
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
app/my-page.tsx # Expo Router page
|
|
255
|
+
# OR
|
|
256
|
+
features/my-feature/screens/MyScreen.tsx
|
|
257
|
+
```
|