@codyswann/lisa 1.48.0 → 1.49.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/.claude-plugin/marketplace.json +48 -0
- package/all/deletions.json +5 -1
- package/all/merge/.claude/settings.json +28 -0
- package/cdk/copy-overwrite/eslint.config.ts +11 -21
- package/cdk/copy-overwrite/eslint.slow.config.ts +4 -73
- package/cdk/copy-overwrite/jest.config.ts +14 -12
- package/cdk/copy-overwrite/tsconfig.json +1 -1
- package/cdk/merge/.claude/settings.json +29 -0
- package/cdk/package-lisa/package.lisa.json +1 -0
- package/dist/configs/eslint/base.d.ts +1491 -0
- package/dist/configs/eslint/base.d.ts.map +1 -0
- package/dist/configs/eslint/base.js +386 -0
- package/dist/configs/eslint/base.js.map +1 -0
- package/dist/configs/eslint/cdk.d.ts +32 -0
- package/dist/configs/eslint/cdk.d.ts.map +1 -0
- package/dist/configs/eslint/cdk.js +127 -0
- package/dist/configs/eslint/cdk.js.map +1 -0
- package/dist/configs/eslint/expo.d.ts +16 -0
- package/dist/configs/eslint/expo.d.ts.map +1 -0
- package/dist/configs/eslint/expo.js +264 -0
- package/dist/configs/eslint/expo.js.map +1 -0
- package/dist/configs/eslint/index.d.ts +18 -0
- package/dist/configs/eslint/index.d.ts.map +1 -0
- package/dist/configs/eslint/index.js +18 -0
- package/dist/configs/eslint/index.js.map +1 -0
- package/dist/configs/eslint/nestjs.d.ts +32 -0
- package/dist/configs/eslint/nestjs.d.ts.map +1 -0
- package/dist/configs/eslint/nestjs.js +128 -0
- package/dist/configs/eslint/nestjs.js.map +1 -0
- package/dist/configs/eslint/slow.d.ts +80 -0
- package/dist/configs/eslint/slow.d.ts.map +1 -0
- package/dist/configs/eslint/slow.js +83 -0
- package/dist/configs/eslint/slow.js.map +1 -0
- package/dist/configs/eslint/typescript.d.ts +19 -0
- package/dist/configs/eslint/typescript.d.ts.map +1 -0
- package/dist/configs/eslint/typescript.js +81 -0
- package/dist/configs/eslint/typescript.js.map +1 -0
- package/{typescript/copy-overwrite/jest.base.ts → dist/configs/jest/base.d.ts} +9 -69
- package/dist/configs/jest/base.d.ts.map +1 -0
- package/dist/configs/jest/base.js +83 -0
- package/dist/configs/jest/base.js.map +1 -0
- package/dist/configs/jest/cdk.d.ts +35 -0
- package/dist/configs/jest/cdk.d.ts.map +1 -0
- package/dist/configs/jest/cdk.js +30 -0
- package/dist/configs/jest/cdk.js.map +1 -0
- package/dist/configs/jest/expo.d.ts +56 -0
- package/dist/configs/jest/expo.d.ts.map +1 -0
- package/dist/configs/jest/expo.js +60 -0
- package/dist/configs/jest/expo.js.map +1 -0
- package/dist/configs/jest/index.d.ts +14 -0
- package/dist/configs/jest/index.d.ts.map +1 -0
- package/dist/configs/jest/index.js +14 -0
- package/dist/configs/jest/index.js.map +1 -0
- package/dist/configs/jest/nestjs.d.ts +35 -0
- package/dist/configs/jest/nestjs.d.ts.map +1 -0
- package/dist/configs/jest/nestjs.js +47 -0
- package/dist/configs/jest/nestjs.js.map +1 -0
- package/dist/configs/jest/typescript.d.ts +31 -0
- package/dist/configs/jest/typescript.d.ts.map +1 -0
- package/dist/configs/jest/typescript.js +34 -0
- package/dist/configs/jest/typescript.js.map +1 -0
- package/expo/copy-overwrite/eslint.config.ts +5 -20
- package/expo/copy-overwrite/eslint.slow.config.ts +4 -90
- package/expo/copy-overwrite/jest.config.ts +14 -12
- package/expo/copy-overwrite/tsconfig.json +1 -1
- package/expo/merge/.claude/settings.json +29 -0
- package/expo/package-lisa/package.lisa.json +1 -10
- package/nestjs/copy-overwrite/eslint.config.ts +5 -20
- package/nestjs/copy-overwrite/eslint.slow.config.ts +4 -89
- package/nestjs/copy-overwrite/jest.config.ts +14 -12
- package/nestjs/copy-overwrite/tsconfig.json +1 -1
- package/nestjs/merge/.claude/settings.json +29 -0
- package/nestjs/package-lisa/package.lisa.json +1 -0
- package/package.json +82 -43
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +86 -0
- package/plugins/lisa-cdk/agents/agent-architect.md +310 -0
- package/plugins/lisa-cdk/agents/architecture-specialist.md +53 -0
- package/plugins/lisa-cdk/agents/debug-specialist.md +204 -0
- package/plugins/lisa-cdk/agents/git-history-analyzer.md +183 -0
- package/plugins/lisa-cdk/agents/hooks-expert.md +74 -0
- package/plugins/lisa-cdk/agents/implementer.md +54 -0
- package/plugins/lisa-cdk/agents/learner.md +44 -0
- package/plugins/lisa-cdk/agents/performance-specialist.md +95 -0
- package/plugins/lisa-cdk/agents/product-specialist.md +72 -0
- package/plugins/lisa-cdk/agents/quality-specialist.md +55 -0
- package/plugins/lisa-cdk/agents/security-specialist.md +58 -0
- package/plugins/lisa-cdk/agents/skill-evaluator.md +246 -0
- package/plugins/lisa-cdk/agents/slash-command-architect.md +87 -0
- package/plugins/lisa-cdk/agents/test-specialist.md +64 -0
- package/plugins/lisa-cdk/agents/verification-specialist.md +189 -0
- package/plugins/lisa-cdk/agents/web-search-researcher.md +112 -0
- package/plugins/lisa-cdk/commands/git-commit-and-submit-pr.md +7 -0
- package/plugins/lisa-cdk/commands/git-commit-submit-pr-and-verify.md +7 -0
- package/plugins/lisa-cdk/commands/git-commit-submit-pr-deploy-and-verify.md +7 -0
- package/plugins/lisa-cdk/commands/git-commit.md +7 -0
- package/plugins/lisa-cdk/commands/git-prune.md +6 -0
- package/plugins/lisa-cdk/commands/git-submit-pr.md +7 -0
- package/plugins/lisa-cdk/commands/jira-add-journey.md +7 -0
- package/plugins/lisa-cdk/commands/jira-create.md +7 -0
- package/plugins/lisa-cdk/commands/jira-evidence.md +7 -0
- package/plugins/lisa-cdk/commands/jira-fix.md +7 -0
- package/plugins/lisa-cdk/commands/jira-implement.md +7 -0
- package/plugins/lisa-cdk/commands/jira-journey.md +7 -0
- package/plugins/lisa-cdk/commands/jira-sync.md +7 -0
- package/plugins/lisa-cdk/commands/jira-verify.md +7 -0
- package/plugins/lisa-cdk/commands/lisa-review-implementation.md +7 -0
- package/plugins/lisa-cdk/commands/plan-add-test-coverage.md +7 -0
- package/plugins/lisa-cdk/commands/plan-create.md +6 -0
- package/plugins/lisa-cdk/commands/plan-execute.md +7 -0
- package/plugins/lisa-cdk/commands/plan-fix-linter-error.md +7 -0
- package/plugins/lisa-cdk/commands/plan-local-code-review.md +6 -0
- package/plugins/lisa-cdk/commands/plan-lower-code-complexity.md +6 -0
- package/plugins/lisa-cdk/commands/plan-reduce-max-lines-per-function.md +7 -0
- package/plugins/lisa-cdk/commands/plan-reduce-max-lines.md +7 -0
- package/plugins/lisa-cdk/commands/pull-request-review.md +7 -0
- package/plugins/lisa-cdk/commands/security-zap-scan.md +6 -0
- package/plugins/lisa-cdk/commands/sonarqube-check.md +6 -0
- package/plugins/lisa-cdk/commands/sonarqube-fix.md +6 -0
- package/plugins/lisa-cdk/commands/tasks-load.md +7 -0
- package/plugins/lisa-cdk/commands/tasks-sync.md +7 -0
- package/plugins/lisa-cdk/hooks/debug-hook.sh +47 -0
- package/plugins/lisa-cdk/hooks/enforce-plan-rules.sh +15 -0
- package/plugins/lisa-cdk/hooks/format-on-edit.sh +76 -0
- package/plugins/lisa-cdk/hooks/install-pkgs.sh +64 -0
- package/plugins/lisa-cdk/hooks/lint-on-edit.sh +81 -0
- package/plugins/lisa-cdk/hooks/notify-ntfy.sh +183 -0
- package/plugins/lisa-cdk/hooks/setup-jira-cli.sh +52 -0
- package/plugins/lisa-cdk/hooks/sg-scan-on-edit.sh +68 -0
- package/plugins/lisa-cdk/hooks/sync-tasks.sh +107 -0
- package/plugins/lisa-cdk/hooks/ticket-sync-reminder.sh +23 -0
- package/plugins/lisa-cdk/hooks/track-plan-sessions.sh +164 -0
- package/plugins/lisa-cdk/hooks/verify-completion.sh +77 -0
- package/plugins/lisa-cdk/rules/coding-philosophy.md +428 -0
- package/plugins/lisa-cdk/rules/lisa.md +37 -0
- package/plugins/lisa-cdk/rules/verfication.md +596 -0
- package/plugins/lisa-cdk/skills/agent-design-best-practices/SKILL.md +219 -0
- package/plugins/lisa-cdk/skills/git-commit/SKILL.md +48 -0
- package/plugins/lisa-cdk/skills/git-commit-and-submit-pr/SKILL.md +8 -0
- package/plugins/lisa-cdk/skills/git-commit-submit-pr-and-verify/SKILL.md +7 -0
- package/plugins/lisa-cdk/skills/git-commit-submit-pr-deploy-and-verify/SKILL.md +7 -0
- package/plugins/lisa-cdk/skills/git-prune/SKILL.md +35 -0
- package/plugins/lisa-cdk/skills/git-submit-pr/SKILL.md +44 -0
- package/plugins/lisa-cdk/skills/jira-add-journey/SKILL.md +120 -0
- package/plugins/lisa-cdk/skills/jira-create/SKILL.md +95 -0
- package/plugins/lisa-cdk/skills/jira-evidence/SKILL.md +73 -0
- package/plugins/lisa-cdk/skills/jira-evidence/scripts/post-evidence.sh +163 -0
- package/plugins/lisa-cdk/skills/jira-fix/SKILL.md +16 -0
- package/plugins/lisa-cdk/skills/jira-implement/SKILL.md +18 -0
- package/plugins/lisa-cdk/skills/jira-journey/SKILL.md +125 -0
- package/plugins/lisa-cdk/skills/jira-journey/scripts/generate-templates.py +233 -0
- package/plugins/lisa-cdk/skills/jira-journey/scripts/parse-plan.py +368 -0
- package/plugins/lisa-cdk/skills/jira-sync/SKILL.md +63 -0
- package/plugins/lisa-cdk/skills/jira-verify/SKILL.md +48 -0
- package/plugins/lisa-cdk/skills/jsdoc-best-practices/SKILL.md +432 -0
- package/plugins/lisa-cdk/skills/lisa-review-implementation/SKILL.md +209 -0
- package/plugins/lisa-cdk/skills/plan-add-test-coverage/SKILL.md +44 -0
- package/plugins/lisa-cdk/skills/plan-execute/SKILL.md +89 -0
- package/plugins/lisa-cdk/skills/plan-fix-linter-error/SKILL.md +45 -0
- package/plugins/lisa-cdk/skills/plan-local-code-review/SKILL.md +88 -0
- package/plugins/lisa-cdk/skills/plan-lower-code-complexity/SKILL.md +44 -0
- package/plugins/lisa-cdk/skills/plan-reduce-max-lines/SKILL.md +45 -0
- package/plugins/lisa-cdk/skills/plan-reduce-max-lines-per-function/SKILL.md +46 -0
- package/plugins/lisa-cdk/skills/pull-request-review/SKILL.md +68 -0
- package/plugins/lisa-cdk/skills/security-zap-scan/SKILL.md +33 -0
- package/plugins/lisa-cdk/skills/skill-creator/LICENSE.txt +202 -0
- package/plugins/lisa-cdk/skills/skill-creator/SKILL.md +210 -0
- package/plugins/lisa-cdk/skills/skill-creator/scripts/init_skill.py +305 -0
- package/plugins/lisa-cdk/skills/skill-creator/scripts/package_skill.py +112 -0
- package/plugins/lisa-cdk/skills/skill-creator/scripts/quick_validate.py +67 -0
- package/plugins/lisa-cdk/skills/sonarqube-check/SKILL.md +11 -0
- package/plugins/lisa-cdk/skills/sonarqube-fix/SKILL.md +8 -0
- package/plugins/lisa-cdk/skills/tasks-load/SKILL.md +88 -0
- package/plugins/lisa-cdk/skills/tasks-sync/SKILL.md +108 -0
- package/plugins/lisa-expo/.claude-plugin/plugin.json +86 -0
- package/plugins/lisa-expo/agents/agent-architect.md +310 -0
- package/plugins/lisa-expo/agents/architecture-specialist.md +53 -0
- package/plugins/lisa-expo/agents/debug-specialist.md +204 -0
- package/plugins/lisa-expo/agents/git-history-analyzer.md +183 -0
- package/plugins/lisa-expo/agents/hooks-expert.md +74 -0
- package/plugins/lisa-expo/agents/implementer.md +54 -0
- package/plugins/lisa-expo/agents/learner.md +44 -0
- package/plugins/lisa-expo/agents/ops-specialist.md +124 -0
- package/plugins/lisa-expo/agents/performance-specialist.md +95 -0
- package/plugins/lisa-expo/agents/product-specialist.md +72 -0
- package/plugins/lisa-expo/agents/quality-specialist.md +55 -0
- package/plugins/lisa-expo/agents/security-specialist.md +58 -0
- package/plugins/lisa-expo/agents/skill-evaluator.md +246 -0
- package/plugins/lisa-expo/agents/slash-command-architect.md +87 -0
- package/plugins/lisa-expo/agents/test-specialist.md +64 -0
- package/plugins/lisa-expo/agents/verification-specialist.md +189 -0
- package/plugins/lisa-expo/agents/web-search-researcher.md +112 -0
- package/plugins/lisa-expo/commands/git-commit-and-submit-pr.md +7 -0
- package/plugins/lisa-expo/commands/git-commit-submit-pr-and-verify.md +7 -0
- package/plugins/lisa-expo/commands/git-commit-submit-pr-deploy-and-verify.md +7 -0
- package/plugins/lisa-expo/commands/git-commit.md +7 -0
- package/plugins/lisa-expo/commands/git-prune.md +6 -0
- package/plugins/lisa-expo/commands/git-submit-pr.md +7 -0
- package/plugins/lisa-expo/commands/jira-add-journey.md +7 -0
- package/plugins/lisa-expo/commands/jira-create.md +7 -0
- package/plugins/lisa-expo/commands/jira-evidence.md +7 -0
- package/plugins/lisa-expo/commands/jira-fix.md +7 -0
- package/plugins/lisa-expo/commands/jira-implement.md +7 -0
- package/plugins/lisa-expo/commands/jira-journey.md +7 -0
- package/plugins/lisa-expo/commands/jira-sync.md +7 -0
- package/plugins/lisa-expo/commands/jira-verify.md +7 -0
- package/plugins/lisa-expo/commands/lisa-review-implementation.md +7 -0
- package/plugins/lisa-expo/commands/plan-add-test-coverage.md +7 -0
- package/plugins/lisa-expo/commands/plan-create.md +6 -0
- package/plugins/lisa-expo/commands/plan-execute.md +7 -0
- package/plugins/lisa-expo/commands/plan-fix-linter-error.md +7 -0
- package/plugins/lisa-expo/commands/plan-local-code-review.md +6 -0
- package/plugins/lisa-expo/commands/plan-lower-code-complexity.md +6 -0
- package/plugins/lisa-expo/commands/plan-reduce-max-lines-per-function.md +7 -0
- package/plugins/lisa-expo/commands/plan-reduce-max-lines.md +7 -0
- package/plugins/lisa-expo/commands/pull-request-review.md +7 -0
- package/plugins/lisa-expo/commands/security-zap-scan.md +6 -0
- package/plugins/lisa-expo/commands/sonarqube-check.md +6 -0
- package/plugins/lisa-expo/commands/sonarqube-fix.md +6 -0
- package/plugins/lisa-expo/commands/tasks-load.md +7 -0
- package/plugins/lisa-expo/commands/tasks-sync.md +7 -0
- package/plugins/lisa-expo/hooks/debug-hook.sh +47 -0
- package/plugins/lisa-expo/hooks/enforce-plan-rules.sh +15 -0
- package/plugins/lisa-expo/hooks/format-on-edit.sh +76 -0
- package/plugins/lisa-expo/hooks/install-pkgs.sh +64 -0
- package/plugins/lisa-expo/hooks/lint-on-edit.sh +81 -0
- package/plugins/lisa-expo/hooks/notify-ntfy.sh +183 -0
- package/plugins/lisa-expo/hooks/setup-jira-cli.sh +52 -0
- package/plugins/lisa-expo/hooks/sg-scan-on-edit.sh +68 -0
- package/plugins/lisa-expo/hooks/sync-tasks.sh +107 -0
- package/plugins/lisa-expo/hooks/ticket-sync-reminder.sh +23 -0
- package/plugins/lisa-expo/hooks/track-plan-sessions.sh +164 -0
- package/plugins/lisa-expo/hooks/verify-completion.sh +77 -0
- package/plugins/lisa-expo/rules/README.md +240 -0
- package/plugins/lisa-expo/rules/coding-philosophy.md +428 -0
- package/plugins/lisa-expo/rules/expo-verification.md +261 -0
- package/plugins/lisa-expo/rules/lisa.md +37 -0
- package/plugins/lisa-expo/rules/verfication.md +596 -0
- package/plugins/lisa-expo/skills/agent-design-best-practices/SKILL.md +219 -0
- package/plugins/lisa-expo/skills/apollo-client/SKILL.md +238 -0
- package/plugins/lisa-expo/skills/apollo-client/references/mutation-patterns.md +360 -0
- package/plugins/lisa-expo/skills/atomic-design-gluestack/SKILL.md +360 -0
- package/plugins/lisa-expo/skills/atomic-design-gluestack/references/atomic-levels.md +417 -0
- package/plugins/lisa-expo/skills/atomic-design-gluestack/references/folder-structure.md +257 -0
- package/plugins/lisa-expo/skills/atomic-design-gluestack/references/gluestack-mapping.md +233 -0
- package/plugins/lisa-expo/skills/atomic-design-gluestack/scripts/validate_atomic_structure.py +329 -0
- package/plugins/lisa-expo/skills/container-view-pattern/SKILL.md +299 -0
- package/plugins/lisa-expo/skills/container-view-pattern/references/examples.md +749 -0
- package/plugins/lisa-expo/skills/container-view-pattern/references/patterns.md +318 -0
- package/plugins/lisa-expo/skills/container-view-pattern/scripts/create_component.py +200 -0
- package/plugins/lisa-expo/skills/container-view-pattern/scripts/validate_component.py +209 -0
- package/plugins/lisa-expo/skills/cross-platform-compatibility/SKILL.md +268 -0
- package/plugins/lisa-expo/skills/cross-platform-compatibility/references/common-issues.md +619 -0
- package/plugins/lisa-expo/skills/cross-platform-compatibility/references/file-extensions.md +340 -0
- package/plugins/lisa-expo/skills/cross-platform-compatibility/references/platform-api.md +276 -0
- package/plugins/lisa-expo/skills/cross-platform-compatibility/scripts/validate_cross_platform.py +416 -0
- package/plugins/lisa-expo/skills/directory-structure/SKILL.md +202 -0
- package/plugins/lisa-expo/skills/directory-structure/scripts/validate_structure.py +445 -0
- package/plugins/lisa-expo/skills/expo-env-config/SKILL.md +309 -0
- package/plugins/lisa-expo/skills/expo-env-config/references/validation-patterns.md +417 -0
- package/plugins/lisa-expo/skills/expo-router-best-practices/SKILL.md +431 -0
- package/plugins/lisa-expo/skills/expo-router-best-practices/references/official-docs.md +290 -0
- package/plugins/lisa-expo/skills/expo-router-best-practices/scripts/generate-route.py +171 -0
- package/plugins/lisa-expo/skills/git-commit/SKILL.md +48 -0
- package/plugins/lisa-expo/skills/git-commit-and-submit-pr/SKILL.md +8 -0
- package/plugins/lisa-expo/skills/git-commit-submit-pr-and-verify/SKILL.md +7 -0
- package/plugins/lisa-expo/skills/git-commit-submit-pr-deploy-and-verify/SKILL.md +7 -0
- package/plugins/lisa-expo/skills/git-prune/SKILL.md +35 -0
- package/plugins/lisa-expo/skills/git-submit-pr/SKILL.md +44 -0
- package/plugins/lisa-expo/skills/gluestack-nativewind/SKILL.md +411 -0
- package/plugins/lisa-expo/skills/gluestack-nativewind/references/color-tokens.md +343 -0
- package/plugins/lisa-expo/skills/gluestack-nativewind/references/component-mapping.md +307 -0
- package/plugins/lisa-expo/skills/gluestack-nativewind/references/spacing-scale.md +300 -0
- package/plugins/lisa-expo/skills/gluestack-nativewind/scripts/validate_styling.py +315 -0
- package/plugins/lisa-expo/skills/jira-add-journey/SKILL.md +126 -0
- package/plugins/lisa-expo/skills/jira-create/SKILL.md +101 -0
- package/plugins/lisa-expo/skills/jira-evidence/SKILL.md +78 -0
- package/plugins/lisa-expo/skills/jira-evidence/scripts/post-evidence.sh +163 -0
- package/plugins/lisa-expo/skills/jira-fix/SKILL.md +16 -0
- package/plugins/lisa-expo/skills/jira-implement/SKILL.md +18 -0
- package/plugins/lisa-expo/skills/jira-journey/SKILL.md +190 -0
- package/plugins/lisa-expo/skills/jira-journey/scripts/generate-templates.py +281 -0
- package/plugins/lisa-expo/skills/jira-journey/scripts/parse-plan.py +368 -0
- package/plugins/lisa-expo/skills/jira-sync/SKILL.md +63 -0
- package/plugins/lisa-expo/skills/jira-verify/SKILL.md +47 -0
- package/plugins/lisa-expo/skills/jsdoc-best-practices/SKILL.md +432 -0
- package/plugins/lisa-expo/skills/lisa-review-implementation/SKILL.md +209 -0
- package/plugins/lisa-expo/skills/local-state/SKILL.md +362 -0
- package/plugins/lisa-expo/skills/local-state/references/async-storage.md +505 -0
- package/plugins/lisa-expo/skills/local-state/references/persistence-patterns.md +711 -0
- package/plugins/lisa-expo/skills/local-state/references/reactive-variables.md +446 -0
- package/plugins/lisa-expo/skills/ops-browser-uat/SKILL.md +124 -0
- package/plugins/lisa-expo/skills/ops-check-logs/SKILL.md +211 -0
- package/plugins/lisa-expo/skills/ops-db-ops/SKILL.md +119 -0
- package/plugins/lisa-expo/skills/ops-deploy/SKILL.md +119 -0
- package/plugins/lisa-expo/skills/ops-monitor-errors/SKILL.md +99 -0
- package/plugins/lisa-expo/skills/ops-performance/SKILL.md +165 -0
- package/plugins/lisa-expo/skills/ops-run-local/SKILL.md +166 -0
- package/plugins/lisa-expo/skills/ops-verify-health/SKILL.md +101 -0
- package/plugins/lisa-expo/skills/owasp-zap/SKILL.md +56 -0
- package/plugins/lisa-expo/skills/plan-add-test-coverage/SKILL.md +44 -0
- package/plugins/lisa-expo/skills/plan-execute/SKILL.md +89 -0
- package/plugins/lisa-expo/skills/plan-fix-linter-error/SKILL.md +45 -0
- package/plugins/lisa-expo/skills/plan-local-code-review/SKILL.md +88 -0
- package/plugins/lisa-expo/skills/plan-lower-code-complexity/SKILL.md +44 -0
- package/plugins/lisa-expo/skills/plan-reduce-max-lines/SKILL.md +45 -0
- package/plugins/lisa-expo/skills/plan-reduce-max-lines-per-function/SKILL.md +46 -0
- package/plugins/lisa-expo/skills/playwright-selectors/SKILL.md +223 -0
- package/plugins/lisa-expo/skills/pull-request-review/SKILL.md +68 -0
- package/plugins/lisa-expo/skills/security-zap-scan/SKILL.md +33 -0
- package/plugins/lisa-expo/skills/skill-creator/LICENSE.txt +202 -0
- package/plugins/lisa-expo/skills/skill-creator/SKILL.md +210 -0
- package/plugins/lisa-expo/skills/skill-creator/scripts/init_skill.py +305 -0
- package/plugins/lisa-expo/skills/skill-creator/scripts/package_skill.py +112 -0
- package/plugins/lisa-expo/skills/skill-creator/scripts/quick_validate.py +67 -0
- package/plugins/lisa-expo/skills/sonarqube-check/SKILL.md +11 -0
- package/plugins/lisa-expo/skills/sonarqube-fix/SKILL.md +8 -0
- package/plugins/lisa-expo/skills/tasks-load/SKILL.md +88 -0
- package/plugins/lisa-expo/skills/tasks-sync/SKILL.md +108 -0
- package/plugins/lisa-expo/skills/testing-library/SKILL.md +314 -0
- package/plugins/lisa-expo/skills/testing-library/references/async-patterns.md +420 -0
- package/plugins/lisa-expo/skills/testing-library/references/expo-router-testing.md +556 -0
- package/plugins/lisa-expo/skills/testing-library/references/mocking-patterns.md +590 -0
- package/plugins/lisa-expo/skills/testing-library/references/query-priority.md +291 -0
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +86 -0
- package/plugins/lisa-nestjs/agents/agent-architect.md +310 -0
- package/plugins/lisa-nestjs/agents/architecture-specialist.md +53 -0
- package/plugins/lisa-nestjs/agents/debug-specialist.md +204 -0
- package/plugins/lisa-nestjs/agents/git-history-analyzer.md +183 -0
- package/plugins/lisa-nestjs/agents/hooks-expert.md +74 -0
- package/plugins/lisa-nestjs/agents/implementer.md +54 -0
- package/plugins/lisa-nestjs/agents/learner.md +44 -0
- package/plugins/lisa-nestjs/agents/performance-specialist.md +95 -0
- package/plugins/lisa-nestjs/agents/product-specialist.md +72 -0
- package/plugins/lisa-nestjs/agents/quality-specialist.md +55 -0
- package/plugins/lisa-nestjs/agents/security-specialist.md +58 -0
- package/plugins/lisa-nestjs/agents/skill-evaluator.md +246 -0
- package/plugins/lisa-nestjs/agents/slash-command-architect.md +87 -0
- package/plugins/lisa-nestjs/agents/test-specialist.md +64 -0
- package/plugins/lisa-nestjs/agents/verification-specialist.md +189 -0
- package/plugins/lisa-nestjs/agents/web-search-researcher.md +112 -0
- package/plugins/lisa-nestjs/commands/git-commit-and-submit-pr.md +7 -0
- package/plugins/lisa-nestjs/commands/git-commit-submit-pr-and-verify.md +7 -0
- package/plugins/lisa-nestjs/commands/git-commit-submit-pr-deploy-and-verify.md +7 -0
- package/plugins/lisa-nestjs/commands/git-commit.md +7 -0
- package/plugins/lisa-nestjs/commands/git-prune.md +6 -0
- package/plugins/lisa-nestjs/commands/git-submit-pr.md +7 -0
- package/plugins/lisa-nestjs/commands/jira-add-journey.md +7 -0
- package/plugins/lisa-nestjs/commands/jira-create.md +7 -0
- package/plugins/lisa-nestjs/commands/jira-evidence.md +7 -0
- package/plugins/lisa-nestjs/commands/jira-fix.md +7 -0
- package/plugins/lisa-nestjs/commands/jira-implement.md +7 -0
- package/plugins/lisa-nestjs/commands/jira-journey.md +7 -0
- package/plugins/lisa-nestjs/commands/jira-sync.md +7 -0
- package/plugins/lisa-nestjs/commands/jira-verify.md +7 -0
- package/plugins/lisa-nestjs/commands/lisa-review-implementation.md +7 -0
- package/plugins/lisa-nestjs/commands/plan-add-test-coverage.md +7 -0
- package/plugins/lisa-nestjs/commands/plan-create.md +6 -0
- package/plugins/lisa-nestjs/commands/plan-execute.md +7 -0
- package/plugins/lisa-nestjs/commands/plan-fix-linter-error.md +7 -0
- package/plugins/lisa-nestjs/commands/plan-local-code-review.md +6 -0
- package/plugins/lisa-nestjs/commands/plan-lower-code-complexity.md +6 -0
- package/plugins/lisa-nestjs/commands/plan-reduce-max-lines-per-function.md +7 -0
- package/plugins/lisa-nestjs/commands/plan-reduce-max-lines.md +7 -0
- package/plugins/lisa-nestjs/commands/pull-request-review.md +7 -0
- package/plugins/lisa-nestjs/commands/security-zap-scan.md +6 -0
- package/plugins/lisa-nestjs/commands/sonarqube-check.md +6 -0
- package/plugins/lisa-nestjs/commands/sonarqube-fix.md +6 -0
- package/plugins/lisa-nestjs/commands/tasks-load.md +7 -0
- package/plugins/lisa-nestjs/commands/tasks-sync.md +7 -0
- package/plugins/lisa-nestjs/hooks/debug-hook.sh +47 -0
- package/plugins/lisa-nestjs/hooks/enforce-plan-rules.sh +15 -0
- package/plugins/lisa-nestjs/hooks/format-on-edit.sh +76 -0
- package/plugins/lisa-nestjs/hooks/install-pkgs.sh +64 -0
- package/plugins/lisa-nestjs/hooks/lint-on-edit.sh +81 -0
- package/plugins/lisa-nestjs/hooks/notify-ntfy.sh +183 -0
- package/plugins/lisa-nestjs/hooks/setup-jira-cli.sh +52 -0
- package/plugins/lisa-nestjs/hooks/sg-scan-on-edit.sh +68 -0
- package/plugins/lisa-nestjs/hooks/sync-tasks.sh +107 -0
- package/plugins/lisa-nestjs/hooks/ticket-sync-reminder.sh +23 -0
- package/plugins/lisa-nestjs/hooks/track-plan-sessions.sh +164 -0
- package/plugins/lisa-nestjs/hooks/verify-completion.sh +77 -0
- package/plugins/lisa-nestjs/rules/README.md +240 -0
- package/plugins/lisa-nestjs/rules/coding-philosophy.md +428 -0
- package/plugins/lisa-nestjs/rules/lisa.md +37 -0
- package/plugins/lisa-nestjs/rules/verfication.md +596 -0
- package/plugins/lisa-nestjs/skills/agent-design-best-practices/SKILL.md +219 -0
- package/plugins/lisa-nestjs/skills/git-commit/SKILL.md +48 -0
- package/plugins/lisa-nestjs/skills/git-commit-and-submit-pr/SKILL.md +8 -0
- package/plugins/lisa-nestjs/skills/git-commit-submit-pr-and-verify/SKILL.md +7 -0
- package/plugins/lisa-nestjs/skills/git-commit-submit-pr-deploy-and-verify/SKILL.md +7 -0
- package/plugins/lisa-nestjs/skills/git-prune/SKILL.md +35 -0
- package/plugins/lisa-nestjs/skills/git-submit-pr/SKILL.md +44 -0
- package/plugins/lisa-nestjs/skills/jira-add-journey/SKILL.md +120 -0
- package/plugins/lisa-nestjs/skills/jira-create/SKILL.md +95 -0
- package/plugins/lisa-nestjs/skills/jira-evidence/SKILL.md +73 -0
- package/plugins/lisa-nestjs/skills/jira-evidence/scripts/post-evidence.sh +163 -0
- package/plugins/lisa-nestjs/skills/jira-fix/SKILL.md +16 -0
- package/plugins/lisa-nestjs/skills/jira-implement/SKILL.md +18 -0
- package/plugins/lisa-nestjs/skills/jira-journey/SKILL.md +125 -0
- package/plugins/lisa-nestjs/skills/jira-journey/scripts/generate-templates.py +233 -0
- package/plugins/lisa-nestjs/skills/jira-journey/scripts/parse-plan.py +368 -0
- package/plugins/lisa-nestjs/skills/jira-sync/SKILL.md +63 -0
- package/plugins/lisa-nestjs/skills/jira-verify/SKILL.md +48 -0
- package/plugins/lisa-nestjs/skills/jsdoc-best-practices/SKILL.md +432 -0
- package/plugins/lisa-nestjs/skills/lisa-review-implementation/SKILL.md +209 -0
- package/plugins/lisa-nestjs/skills/nestjs-graphql/SKILL.md +176 -0
- package/plugins/lisa-nestjs/skills/nestjs-graphql/references/advanced-features.md +527 -0
- package/plugins/lisa-nestjs/skills/nestjs-graphql/references/project-patterns.md +483 -0
- package/plugins/lisa-nestjs/skills/nestjs-graphql/references/quick-start.md +257 -0
- package/plugins/lisa-nestjs/skills/nestjs-graphql/references/resolvers-mutations.md +413 -0
- package/plugins/lisa-nestjs/skills/nestjs-graphql/references/types-scalars.md +513 -0
- package/plugins/lisa-nestjs/skills/nestjs-rules/SKILL.md +536 -0
- package/plugins/lisa-nestjs/skills/plan-add-test-coverage/SKILL.md +44 -0
- package/plugins/lisa-nestjs/skills/plan-execute/SKILL.md +89 -0
- package/plugins/lisa-nestjs/skills/plan-fix-linter-error/SKILL.md +45 -0
- package/plugins/lisa-nestjs/skills/plan-local-code-review/SKILL.md +88 -0
- package/plugins/lisa-nestjs/skills/plan-lower-code-complexity/SKILL.md +44 -0
- package/plugins/lisa-nestjs/skills/plan-reduce-max-lines/SKILL.md +45 -0
- package/plugins/lisa-nestjs/skills/plan-reduce-max-lines-per-function/SKILL.md +46 -0
- package/plugins/lisa-nestjs/skills/pull-request-review/SKILL.md +68 -0
- package/plugins/lisa-nestjs/skills/security-zap-scan/SKILL.md +33 -0
- package/plugins/lisa-nestjs/skills/skill-creator/LICENSE.txt +202 -0
- package/plugins/lisa-nestjs/skills/skill-creator/SKILL.md +210 -0
- package/plugins/lisa-nestjs/skills/skill-creator/scripts/init_skill.py +305 -0
- package/plugins/lisa-nestjs/skills/skill-creator/scripts/package_skill.py +112 -0
- package/plugins/lisa-nestjs/skills/skill-creator/scripts/quick_validate.py +67 -0
- package/plugins/lisa-nestjs/skills/sonarqube-check/SKILL.md +11 -0
- package/plugins/lisa-nestjs/skills/sonarqube-fix/SKILL.md +8 -0
- package/plugins/lisa-nestjs/skills/tasks-load/SKILL.md +88 -0
- package/plugins/lisa-nestjs/skills/tasks-sync/SKILL.md +108 -0
- package/plugins/lisa-nestjs/skills/typeorm-patterns/SKILL.md +275 -0
- package/plugins/lisa-nestjs/skills/typeorm-patterns/references/configuration-patterns.md +487 -0
- package/plugins/lisa-nestjs/skills/typeorm-patterns/references/entity-patterns.md +450 -0
- package/plugins/lisa-nestjs/skills/typeorm-patterns/references/observability-patterns.md +536 -0
- package/plugins/lisa-rails/.claude-plugin/plugin.json +77 -0
- package/plugins/lisa-rails/agents/agent-architect.md +310 -0
- package/plugins/lisa-rails/agents/architecture-specialist.md +53 -0
- package/plugins/lisa-rails/agents/debug-specialist.md +204 -0
- package/plugins/lisa-rails/agents/git-history-analyzer.md +183 -0
- package/plugins/lisa-rails/agents/hooks-expert.md +74 -0
- package/plugins/lisa-rails/agents/implementer.md +54 -0
- package/plugins/lisa-rails/agents/learner.md +44 -0
- package/plugins/lisa-rails/agents/performance-specialist.md +95 -0
- package/plugins/lisa-rails/agents/product-specialist.md +72 -0
- package/plugins/lisa-rails/agents/quality-specialist.md +55 -0
- package/plugins/lisa-rails/agents/security-specialist.md +58 -0
- package/plugins/lisa-rails/agents/skill-evaluator.md +246 -0
- package/plugins/lisa-rails/agents/slash-command-architect.md +87 -0
- package/plugins/lisa-rails/agents/test-specialist.md +64 -0
- package/plugins/lisa-rails/agents/verification-specialist.md +189 -0
- package/plugins/lisa-rails/agents/web-search-researcher.md +112 -0
- package/plugins/lisa-rails/commands/git-commit-and-submit-pr.md +7 -0
- package/plugins/lisa-rails/commands/git-commit-submit-pr-and-verify.md +7 -0
- package/plugins/lisa-rails/commands/git-commit-submit-pr-deploy-and-verify.md +7 -0
- package/plugins/lisa-rails/commands/git-commit.md +7 -0
- package/plugins/lisa-rails/commands/git-prune.md +6 -0
- package/plugins/lisa-rails/commands/git-submit-pr.md +7 -0
- package/plugins/lisa-rails/commands/jira-add-journey.md +7 -0
- package/plugins/lisa-rails/commands/jira-create.md +7 -0
- package/plugins/lisa-rails/commands/jira-evidence.md +7 -0
- package/plugins/lisa-rails/commands/jira-fix.md +7 -0
- package/plugins/lisa-rails/commands/jira-implement.md +7 -0
- package/plugins/lisa-rails/commands/jira-journey.md +7 -0
- package/plugins/lisa-rails/commands/jira-sync.md +7 -0
- package/plugins/lisa-rails/commands/jira-verify.md +7 -0
- package/plugins/lisa-rails/commands/lisa-review-implementation.md +7 -0
- package/plugins/lisa-rails/commands/plan-add-test-coverage.md +7 -0
- package/plugins/lisa-rails/commands/plan-create.md +6 -0
- package/plugins/lisa-rails/commands/plan-execute.md +7 -0
- package/plugins/lisa-rails/commands/plan-fix-linter-error.md +7 -0
- package/plugins/lisa-rails/commands/plan-local-code-review.md +6 -0
- package/plugins/lisa-rails/commands/plan-lower-code-complexity.md +6 -0
- package/plugins/lisa-rails/commands/plan-reduce-max-lines-per-function.md +7 -0
- package/plugins/lisa-rails/commands/plan-reduce-max-lines.md +7 -0
- package/plugins/lisa-rails/commands/pull-request-review.md +7 -0
- package/plugins/lisa-rails/commands/security-zap-scan.md +6 -0
- package/plugins/lisa-rails/commands/sonarqube-check.md +6 -0
- package/plugins/lisa-rails/commands/sonarqube-fix.md +6 -0
- package/plugins/lisa-rails/commands/tasks-load.md +7 -0
- package/plugins/lisa-rails/commands/tasks-sync.md +7 -0
- package/plugins/lisa-rails/hooks/debug-hook.sh +47 -0
- package/plugins/lisa-rails/hooks/enforce-plan-rules.sh +15 -0
- package/plugins/lisa-rails/hooks/format-on-edit.sh +76 -0
- package/plugins/lisa-rails/hooks/install-pkgs.sh +64 -0
- package/plugins/lisa-rails/hooks/lint-on-edit.sh +81 -0
- package/plugins/lisa-rails/hooks/notify-ntfy.sh +183 -0
- package/plugins/lisa-rails/hooks/setup-jira-cli.sh +52 -0
- package/plugins/lisa-rails/hooks/sg-scan-on-edit.sh +68 -0
- package/plugins/lisa-rails/hooks/sync-tasks.sh +107 -0
- package/plugins/lisa-rails/hooks/ticket-sync-reminder.sh +23 -0
- package/plugins/lisa-rails/hooks/track-plan-sessions.sh +164 -0
- package/plugins/lisa-rails/hooks/verify-completion.sh +77 -0
- package/plugins/lisa-rails/rules/README.md +240 -0
- package/plugins/lisa-rails/rules/coding-philosophy.md +428 -0
- package/plugins/lisa-rails/rules/lisa.md +37 -0
- package/plugins/lisa-rails/rules/rails-conventions.md +176 -0
- package/plugins/lisa-rails/rules/verfication.md +596 -0
- package/plugins/lisa-rails/skills/action-controller-best-practices/SKILL.md +374 -0
- package/plugins/lisa-rails/skills/action-view-best-practices/SKILL.md +335 -0
- package/plugins/lisa-rails/skills/active-record-model-best-practices/SKILL.md +166 -0
- package/plugins/lisa-rails/skills/agent-design-best-practices/SKILL.md +219 -0
- package/plugins/lisa-rails/skills/git-commit/SKILL.md +48 -0
- package/plugins/lisa-rails/skills/git-commit-and-submit-pr/SKILL.md +8 -0
- package/plugins/lisa-rails/skills/git-commit-submit-pr-and-verify/SKILL.md +7 -0
- package/plugins/lisa-rails/skills/git-commit-submit-pr-deploy-and-verify/SKILL.md +7 -0
- package/plugins/lisa-rails/skills/git-prune/SKILL.md +35 -0
- package/plugins/lisa-rails/skills/git-submit-pr/SKILL.md +44 -0
- package/plugins/lisa-rails/skills/jira-add-journey/SKILL.md +65 -0
- package/plugins/lisa-rails/skills/jira-create/SKILL.md +41 -0
- package/plugins/lisa-rails/skills/jira-evidence/SKILL.md +70 -0
- package/plugins/lisa-rails/skills/jira-evidence/scripts/post-evidence.sh +163 -0
- package/plugins/lisa-rails/skills/jira-fix/SKILL.md +16 -0
- package/plugins/lisa-rails/skills/jira-implement/SKILL.md +18 -0
- package/plugins/lisa-rails/skills/jira-journey/SKILL.md +64 -0
- package/plugins/lisa-rails/skills/jira-journey/scripts/generate-templates.py +233 -0
- package/plugins/lisa-rails/skills/jira-journey/scripts/parse-plan.py +368 -0
- package/plugins/lisa-rails/skills/jira-sync/SKILL.md +63 -0
- package/plugins/lisa-rails/skills/jira-verify/SKILL.md +29 -0
- package/plugins/lisa-rails/skills/jsdoc-best-practices/SKILL.md +432 -0
- package/plugins/lisa-rails/skills/lisa-review-implementation/SKILL.md +209 -0
- package/plugins/lisa-rails/skills/plan-add-test-coverage/SKILL.md +45 -0
- package/plugins/lisa-rails/skills/plan-execute/SKILL.md +89 -0
- package/plugins/lisa-rails/skills/plan-fix-linter-error/SKILL.md +45 -0
- package/plugins/lisa-rails/skills/plan-local-code-review/SKILL.md +88 -0
- package/plugins/lisa-rails/skills/plan-lower-code-complexity/SKILL.md +48 -0
- package/plugins/lisa-rails/skills/plan-reduce-max-lines/SKILL.md +46 -0
- package/plugins/lisa-rails/skills/plan-reduce-max-lines-per-function/SKILL.md +46 -0
- package/plugins/lisa-rails/skills/pull-request-review/SKILL.md +68 -0
- package/plugins/lisa-rails/skills/security-zap-scan/SKILL.md +33 -0
- package/plugins/lisa-rails/skills/skill-creator/LICENSE.txt +202 -0
- package/plugins/lisa-rails/skills/skill-creator/SKILL.md +210 -0
- package/plugins/lisa-rails/skills/skill-creator/scripts/init_skill.py +305 -0
- package/plugins/lisa-rails/skills/skill-creator/scripts/package_skill.py +112 -0
- package/plugins/lisa-rails/skills/skill-creator/scripts/quick_validate.py +67 -0
- package/plugins/lisa-rails/skills/sonarqube-check/SKILL.md +11 -0
- package/plugins/lisa-rails/skills/sonarqube-fix/SKILL.md +8 -0
- package/plugins/lisa-rails/skills/tasks-load/SKILL.md +88 -0
- package/plugins/lisa-rails/skills/tasks-sync/SKILL.md +108 -0
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +86 -0
- package/plugins/lisa-typescript/agents/agent-architect.md +310 -0
- package/plugins/lisa-typescript/agents/architecture-specialist.md +53 -0
- package/plugins/lisa-typescript/agents/debug-specialist.md +204 -0
- package/plugins/lisa-typescript/agents/git-history-analyzer.md +183 -0
- package/plugins/lisa-typescript/agents/hooks-expert.md +74 -0
- package/plugins/lisa-typescript/agents/implementer.md +54 -0
- package/plugins/lisa-typescript/agents/learner.md +44 -0
- package/plugins/lisa-typescript/agents/performance-specialist.md +95 -0
- package/plugins/lisa-typescript/agents/product-specialist.md +72 -0
- package/plugins/lisa-typescript/agents/quality-specialist.md +55 -0
- package/plugins/lisa-typescript/agents/security-specialist.md +58 -0
- package/plugins/lisa-typescript/agents/skill-evaluator.md +246 -0
- package/plugins/lisa-typescript/agents/slash-command-architect.md +87 -0
- package/plugins/lisa-typescript/agents/test-specialist.md +64 -0
- package/plugins/lisa-typescript/agents/verification-specialist.md +189 -0
- package/plugins/lisa-typescript/agents/web-search-researcher.md +112 -0
- package/plugins/lisa-typescript/commands/git-commit-and-submit-pr.md +7 -0
- package/plugins/lisa-typescript/commands/git-commit-submit-pr-and-verify.md +7 -0
- package/plugins/lisa-typescript/commands/git-commit-submit-pr-deploy-and-verify.md +7 -0
- package/plugins/lisa-typescript/commands/git-commit.md +7 -0
- package/plugins/lisa-typescript/commands/git-prune.md +6 -0
- package/plugins/lisa-typescript/commands/git-submit-pr.md +7 -0
- package/plugins/lisa-typescript/commands/jira-add-journey.md +7 -0
- package/plugins/lisa-typescript/commands/jira-create.md +7 -0
- package/plugins/lisa-typescript/commands/jira-evidence.md +7 -0
- package/plugins/lisa-typescript/commands/jira-fix.md +7 -0
- package/plugins/lisa-typescript/commands/jira-implement.md +7 -0
- package/plugins/lisa-typescript/commands/jira-journey.md +7 -0
- package/plugins/lisa-typescript/commands/jira-sync.md +7 -0
- package/plugins/lisa-typescript/commands/jira-verify.md +7 -0
- package/plugins/lisa-typescript/commands/lisa-review-implementation.md +7 -0
- package/plugins/lisa-typescript/commands/plan-add-test-coverage.md +7 -0
- package/plugins/lisa-typescript/commands/plan-create.md +6 -0
- package/plugins/lisa-typescript/commands/plan-execute.md +7 -0
- package/plugins/lisa-typescript/commands/plan-fix-linter-error.md +7 -0
- package/plugins/lisa-typescript/commands/plan-local-code-review.md +6 -0
- package/plugins/lisa-typescript/commands/plan-lower-code-complexity.md +6 -0
- package/plugins/lisa-typescript/commands/plan-reduce-max-lines-per-function.md +7 -0
- package/plugins/lisa-typescript/commands/plan-reduce-max-lines.md +7 -0
- package/plugins/lisa-typescript/commands/pull-request-review.md +7 -0
- package/plugins/lisa-typescript/commands/security-zap-scan.md +6 -0
- package/plugins/lisa-typescript/commands/sonarqube-check.md +6 -0
- package/plugins/lisa-typescript/commands/sonarqube-fix.md +6 -0
- package/plugins/lisa-typescript/commands/tasks-load.md +7 -0
- package/plugins/lisa-typescript/commands/tasks-sync.md +7 -0
- package/plugins/lisa-typescript/hooks/debug-hook.sh +47 -0
- package/plugins/lisa-typescript/hooks/enforce-plan-rules.sh +15 -0
- package/plugins/lisa-typescript/hooks/format-on-edit.sh +76 -0
- package/plugins/lisa-typescript/hooks/install-pkgs.sh +64 -0
- package/plugins/lisa-typescript/hooks/lint-on-edit.sh +81 -0
- package/plugins/lisa-typescript/hooks/notify-ntfy.sh +183 -0
- package/plugins/lisa-typescript/hooks/setup-jira-cli.sh +52 -0
- package/plugins/lisa-typescript/hooks/sg-scan-on-edit.sh +68 -0
- package/plugins/lisa-typescript/hooks/sync-tasks.sh +107 -0
- package/plugins/lisa-typescript/hooks/ticket-sync-reminder.sh +23 -0
- package/plugins/lisa-typescript/hooks/track-plan-sessions.sh +164 -0
- package/plugins/lisa-typescript/hooks/verify-completion.sh +77 -0
- package/plugins/lisa-typescript/rules/README.md +240 -0
- package/plugins/lisa-typescript/rules/coding-philosophy.md +428 -0
- package/plugins/lisa-typescript/rules/lisa.md +37 -0
- package/plugins/lisa-typescript/rules/verfication.md +596 -0
- package/plugins/lisa-typescript/skills/agent-design-best-practices/SKILL.md +219 -0
- package/plugins/lisa-typescript/skills/git-commit/SKILL.md +48 -0
- package/plugins/lisa-typescript/skills/git-commit-and-submit-pr/SKILL.md +8 -0
- package/plugins/lisa-typescript/skills/git-commit-submit-pr-and-verify/SKILL.md +7 -0
- package/plugins/lisa-typescript/skills/git-commit-submit-pr-deploy-and-verify/SKILL.md +7 -0
- package/plugins/lisa-typescript/skills/git-prune/SKILL.md +35 -0
- package/plugins/lisa-typescript/skills/git-submit-pr/SKILL.md +44 -0
- package/plugins/lisa-typescript/skills/jira-add-journey/SKILL.md +120 -0
- package/plugins/lisa-typescript/skills/jira-create/SKILL.md +95 -0
- package/plugins/lisa-typescript/skills/jira-evidence/SKILL.md +73 -0
- package/plugins/lisa-typescript/skills/jira-evidence/scripts/post-evidence.sh +163 -0
- package/plugins/lisa-typescript/skills/jira-fix/SKILL.md +16 -0
- package/plugins/lisa-typescript/skills/jira-implement/SKILL.md +18 -0
- package/plugins/lisa-typescript/skills/jira-journey/SKILL.md +125 -0
- package/plugins/lisa-typescript/skills/jira-journey/scripts/generate-templates.py +233 -0
- package/plugins/lisa-typescript/skills/jira-journey/scripts/parse-plan.py +368 -0
- package/plugins/lisa-typescript/skills/jira-sync/SKILL.md +63 -0
- package/plugins/lisa-typescript/skills/jira-verify/SKILL.md +48 -0
- package/plugins/lisa-typescript/skills/jsdoc-best-practices/SKILL.md +432 -0
- package/plugins/lisa-typescript/skills/lisa-review-implementation/SKILL.md +209 -0
- package/plugins/lisa-typescript/skills/plan-add-test-coverage/SKILL.md +44 -0
- package/plugins/lisa-typescript/skills/plan-execute/SKILL.md +89 -0
- package/plugins/lisa-typescript/skills/plan-fix-linter-error/SKILL.md +45 -0
- package/plugins/lisa-typescript/skills/plan-local-code-review/SKILL.md +88 -0
- package/plugins/lisa-typescript/skills/plan-lower-code-complexity/SKILL.md +44 -0
- package/plugins/lisa-typescript/skills/plan-reduce-max-lines/SKILL.md +45 -0
- package/plugins/lisa-typescript/skills/plan-reduce-max-lines-per-function/SKILL.md +46 -0
- package/plugins/lisa-typescript/skills/pull-request-review/SKILL.md +68 -0
- package/plugins/lisa-typescript/skills/security-zap-scan/SKILL.md +33 -0
- package/plugins/lisa-typescript/skills/skill-creator/LICENSE.txt +202 -0
- package/plugins/lisa-typescript/skills/skill-creator/SKILL.md +210 -0
- package/plugins/lisa-typescript/skills/skill-creator/scripts/init_skill.py +305 -0
- package/plugins/lisa-typescript/skills/skill-creator/scripts/package_skill.py +112 -0
- package/plugins/lisa-typescript/skills/skill-creator/scripts/quick_validate.py +67 -0
- package/plugins/lisa-typescript/skills/sonarqube-check/SKILL.md +11 -0
- package/plugins/lisa-typescript/skills/sonarqube-fix/SKILL.md +8 -0
- package/plugins/lisa-typescript/skills/tasks-load/SKILL.md +88 -0
- package/plugins/lisa-typescript/skills/tasks-sync/SKILL.md +108 -0
- package/plugins/src/base/agents/agent-architect.md +310 -0
- package/plugins/src/base/agents/architecture-specialist.md +53 -0
- package/plugins/src/base/agents/debug-specialist.md +204 -0
- package/plugins/src/base/agents/git-history-analyzer.md +183 -0
- package/plugins/src/base/agents/hooks-expert.md +74 -0
- package/plugins/src/base/agents/implementer.md +54 -0
- package/plugins/src/base/agents/learner.md +44 -0
- package/plugins/src/base/agents/performance-specialist.md +95 -0
- package/plugins/src/base/agents/product-specialist.md +72 -0
- package/plugins/src/base/agents/quality-specialist.md +55 -0
- package/plugins/src/base/agents/security-specialist.md +58 -0
- package/plugins/src/base/agents/skill-evaluator.md +246 -0
- package/plugins/src/base/agents/slash-command-architect.md +87 -0
- package/plugins/src/base/agents/test-specialist.md +64 -0
- package/plugins/src/base/agents/verification-specialist.md +189 -0
- package/plugins/src/base/agents/web-search-researcher.md +112 -0
- package/plugins/src/base/commands/git-commit-and-submit-pr.md +7 -0
- package/plugins/src/base/commands/git-commit-submit-pr-and-verify.md +7 -0
- package/plugins/src/base/commands/git-commit-submit-pr-deploy-and-verify.md +7 -0
- package/plugins/src/base/commands/git-commit.md +7 -0
- package/plugins/src/base/commands/git-prune.md +6 -0
- package/plugins/src/base/commands/git-submit-pr.md +7 -0
- package/plugins/src/base/commands/jira-add-journey.md +7 -0
- package/plugins/src/base/commands/jira-create.md +7 -0
- package/plugins/src/base/commands/jira-evidence.md +7 -0
- package/plugins/src/base/commands/jira-fix.md +7 -0
- package/plugins/src/base/commands/jira-implement.md +7 -0
- package/plugins/src/base/commands/jira-journey.md +7 -0
- package/plugins/src/base/commands/jira-sync.md +7 -0
- package/plugins/src/base/commands/jira-verify.md +7 -0
- package/plugins/src/base/commands/lisa-review-implementation.md +7 -0
- package/plugins/src/base/commands/plan-add-test-coverage.md +7 -0
- package/plugins/src/base/commands/plan-create.md +6 -0
- package/plugins/src/base/commands/plan-execute.md +7 -0
- package/plugins/src/base/commands/plan-fix-linter-error.md +7 -0
- package/plugins/src/base/commands/plan-local-code-review.md +6 -0
- package/plugins/src/base/commands/plan-lower-code-complexity.md +6 -0
- package/plugins/src/base/commands/plan-reduce-max-lines-per-function.md +7 -0
- package/plugins/src/base/commands/plan-reduce-max-lines.md +7 -0
- package/plugins/src/base/commands/pull-request-review.md +7 -0
- package/plugins/src/base/commands/security-zap-scan.md +6 -0
- package/plugins/src/base/commands/sonarqube-check.md +6 -0
- package/plugins/src/base/commands/sonarqube-fix.md +6 -0
- package/plugins/src/base/commands/tasks-load.md +7 -0
- package/plugins/src/base/commands/tasks-sync.md +7 -0
- package/plugins/src/base/hooks/debug-hook.sh +47 -0
- package/plugins/src/base/hooks/enforce-plan-rules.sh +15 -0
- package/plugins/src/base/hooks/format-on-edit.sh +76 -0
- package/plugins/src/base/hooks/install-pkgs.sh +64 -0
- package/plugins/src/base/hooks/lint-on-edit.sh +81 -0
- package/plugins/src/base/hooks/notify-ntfy.sh +183 -0
- package/plugins/src/base/hooks/setup-jira-cli.sh +52 -0
- package/plugins/src/base/hooks/sg-scan-on-edit.sh +68 -0
- package/plugins/src/base/hooks/sync-tasks.sh +107 -0
- package/plugins/src/base/hooks/ticket-sync-reminder.sh +23 -0
- package/plugins/src/base/hooks/track-plan-sessions.sh +164 -0
- package/plugins/src/base/hooks/verify-completion.sh +77 -0
- package/plugins/src/base/rules/README.md +240 -0
- package/plugins/src/base/rules/coding-philosophy.md +428 -0
- package/plugins/src/base/rules/lisa.md +37 -0
- package/plugins/src/base/rules/verfication.md +596 -0
- package/plugins/src/base/skills/agent-design-best-practices/SKILL.md +219 -0
- package/plugins/src/base/skills/git-commit/SKILL.md +48 -0
- package/plugins/src/base/skills/git-commit-and-submit-pr/SKILL.md +8 -0
- package/plugins/src/base/skills/git-commit-submit-pr-and-verify/SKILL.md +7 -0
- package/plugins/src/base/skills/git-commit-submit-pr-deploy-and-verify/SKILL.md +7 -0
- package/plugins/src/base/skills/git-prune/SKILL.md +35 -0
- package/plugins/src/base/skills/git-submit-pr/SKILL.md +44 -0
- package/plugins/src/base/skills/jira-add-journey/SKILL.md +120 -0
- package/plugins/src/base/skills/jira-create/SKILL.md +95 -0
- package/plugins/src/base/skills/jira-evidence/SKILL.md +73 -0
- package/plugins/src/base/skills/jira-evidence/scripts/post-evidence.sh +163 -0
- package/plugins/src/base/skills/jira-fix/SKILL.md +16 -0
- package/plugins/src/base/skills/jira-implement/SKILL.md +18 -0
- package/plugins/src/base/skills/jira-journey/SKILL.md +125 -0
- package/plugins/src/base/skills/jira-journey/scripts/generate-templates.py +233 -0
- package/plugins/src/base/skills/jira-journey/scripts/parse-plan.py +368 -0
- package/plugins/src/base/skills/jira-sync/SKILL.md +63 -0
- package/plugins/src/base/skills/jira-verify/SKILL.md +48 -0
- package/plugins/src/base/skills/jsdoc-best-practices/SKILL.md +432 -0
- package/plugins/src/base/skills/lisa-review-implementation/SKILL.md +209 -0
- package/plugins/src/base/skills/plan-add-test-coverage/SKILL.md +44 -0
- package/plugins/src/base/skills/plan-execute/SKILL.md +89 -0
- package/plugins/src/base/skills/plan-fix-linter-error/SKILL.md +45 -0
- package/plugins/src/base/skills/plan-local-code-review/SKILL.md +88 -0
- package/plugins/src/base/skills/plan-lower-code-complexity/SKILL.md +44 -0
- package/plugins/src/base/skills/plan-reduce-max-lines/SKILL.md +45 -0
- package/plugins/src/base/skills/plan-reduce-max-lines-per-function/SKILL.md +46 -0
- package/plugins/src/base/skills/pull-request-review/SKILL.md +68 -0
- package/plugins/src/base/skills/security-zap-scan/SKILL.md +33 -0
- package/plugins/src/base/skills/skill-creator/LICENSE.txt +202 -0
- package/plugins/src/base/skills/skill-creator/SKILL.md +210 -0
- package/plugins/src/base/skills/skill-creator/scripts/init_skill.py +305 -0
- package/plugins/src/base/skills/skill-creator/scripts/package_skill.py +112 -0
- package/plugins/src/base/skills/skill-creator/scripts/quick_validate.py +67 -0
- package/plugins/src/base/skills/sonarqube-check/SKILL.md +11 -0
- package/plugins/src/base/skills/sonarqube-fix/SKILL.md +8 -0
- package/plugins/src/base/skills/tasks-load/SKILL.md +88 -0
- package/plugins/src/base/skills/tasks-sync/SKILL.md +108 -0
- package/plugins/src/cdk/.claude-plugin/plugin.json +86 -0
- package/plugins/src/expo/.claude-plugin/plugin.json +86 -0
- package/plugins/src/expo/agents/ops-specialist.md +124 -0
- package/plugins/src/expo/rules/expo-verification.md +261 -0
- package/plugins/src/expo/skills/apollo-client/SKILL.md +238 -0
- package/plugins/src/expo/skills/apollo-client/references/mutation-patterns.md +360 -0
- package/plugins/src/expo/skills/atomic-design-gluestack/SKILL.md +360 -0
- package/plugins/src/expo/skills/atomic-design-gluestack/references/atomic-levels.md +417 -0
- package/plugins/src/expo/skills/atomic-design-gluestack/references/folder-structure.md +257 -0
- package/plugins/src/expo/skills/atomic-design-gluestack/references/gluestack-mapping.md +233 -0
- package/plugins/src/expo/skills/atomic-design-gluestack/scripts/validate_atomic_structure.py +329 -0
- package/plugins/src/expo/skills/container-view-pattern/SKILL.md +299 -0
- package/plugins/src/expo/skills/container-view-pattern/references/examples.md +749 -0
- package/plugins/src/expo/skills/container-view-pattern/references/patterns.md +318 -0
- package/plugins/src/expo/skills/container-view-pattern/scripts/create_component.py +200 -0
- package/plugins/src/expo/skills/container-view-pattern/scripts/validate_component.py +209 -0
- package/plugins/src/expo/skills/cross-platform-compatibility/SKILL.md +268 -0
- package/plugins/src/expo/skills/cross-platform-compatibility/references/common-issues.md +619 -0
- package/plugins/src/expo/skills/cross-platform-compatibility/references/file-extensions.md +340 -0
- package/plugins/src/expo/skills/cross-platform-compatibility/references/platform-api.md +276 -0
- package/plugins/src/expo/skills/cross-platform-compatibility/scripts/validate_cross_platform.py +416 -0
- package/plugins/src/expo/skills/directory-structure/SKILL.md +202 -0
- package/plugins/src/expo/skills/directory-structure/scripts/validate_structure.py +445 -0
- package/plugins/src/expo/skills/expo-env-config/SKILL.md +309 -0
- package/plugins/src/expo/skills/expo-env-config/references/validation-patterns.md +417 -0
- package/plugins/src/expo/skills/expo-router-best-practices/SKILL.md +431 -0
- package/plugins/src/expo/skills/expo-router-best-practices/references/official-docs.md +290 -0
- package/plugins/src/expo/skills/expo-router-best-practices/scripts/generate-route.py +171 -0
- package/plugins/src/expo/skills/gluestack-nativewind/SKILL.md +411 -0
- package/plugins/src/expo/skills/gluestack-nativewind/references/color-tokens.md +343 -0
- package/plugins/src/expo/skills/gluestack-nativewind/references/component-mapping.md +307 -0
- package/plugins/src/expo/skills/gluestack-nativewind/references/spacing-scale.md +300 -0
- package/plugins/src/expo/skills/gluestack-nativewind/scripts/validate_styling.py +315 -0
- package/plugins/src/expo/skills/jira-add-journey/SKILL.md +126 -0
- package/plugins/src/expo/skills/jira-create/SKILL.md +101 -0
- package/plugins/src/expo/skills/jira-evidence/SKILL.md +78 -0
- package/plugins/src/expo/skills/jira-evidence/scripts/post-evidence.sh +163 -0
- package/plugins/src/expo/skills/jira-journey/SKILL.md +190 -0
- package/plugins/src/expo/skills/jira-journey/scripts/generate-templates.py +281 -0
- package/plugins/src/expo/skills/jira-journey/scripts/parse-plan.py +368 -0
- package/plugins/src/expo/skills/jira-verify/SKILL.md +47 -0
- package/plugins/src/expo/skills/local-state/SKILL.md +362 -0
- package/plugins/src/expo/skills/local-state/references/async-storage.md +505 -0
- package/plugins/src/expo/skills/local-state/references/persistence-patterns.md +711 -0
- package/plugins/src/expo/skills/local-state/references/reactive-variables.md +446 -0
- package/plugins/src/expo/skills/ops-browser-uat/SKILL.md +124 -0
- package/plugins/src/expo/skills/ops-check-logs/SKILL.md +211 -0
- package/plugins/src/expo/skills/ops-db-ops/SKILL.md +119 -0
- package/plugins/src/expo/skills/ops-deploy/SKILL.md +119 -0
- package/plugins/src/expo/skills/ops-monitor-errors/SKILL.md +99 -0
- package/plugins/src/expo/skills/ops-performance/SKILL.md +165 -0
- package/plugins/src/expo/skills/ops-run-local/SKILL.md +166 -0
- package/plugins/src/expo/skills/ops-verify-health/SKILL.md +101 -0
- package/plugins/src/expo/skills/owasp-zap/SKILL.md +56 -0
- package/plugins/src/expo/skills/playwright-selectors/SKILL.md +223 -0
- package/plugins/src/expo/skills/testing-library/SKILL.md +314 -0
- package/plugins/src/expo/skills/testing-library/references/async-patterns.md +420 -0
- package/plugins/src/expo/skills/testing-library/references/expo-router-testing.md +556 -0
- package/plugins/src/expo/skills/testing-library/references/mocking-patterns.md +590 -0
- package/plugins/src/expo/skills/testing-library/references/query-priority.md +291 -0
- package/plugins/src/nestjs/.claude-plugin/plugin.json +86 -0
- package/plugins/src/nestjs/skills/nestjs-graphql/SKILL.md +176 -0
- package/plugins/src/nestjs/skills/nestjs-graphql/references/advanced-features.md +527 -0
- package/plugins/src/nestjs/skills/nestjs-graphql/references/project-patterns.md +483 -0
- package/plugins/src/nestjs/skills/nestjs-graphql/references/quick-start.md +257 -0
- package/plugins/src/nestjs/skills/nestjs-graphql/references/resolvers-mutations.md +413 -0
- package/plugins/src/nestjs/skills/nestjs-graphql/references/types-scalars.md +513 -0
- package/plugins/src/nestjs/skills/nestjs-rules/SKILL.md +536 -0
- package/plugins/src/nestjs/skills/typeorm-patterns/SKILL.md +275 -0
- package/plugins/src/nestjs/skills/typeorm-patterns/references/configuration-patterns.md +487 -0
- package/plugins/src/nestjs/skills/typeorm-patterns/references/entity-patterns.md +450 -0
- package/plugins/src/nestjs/skills/typeorm-patterns/references/observability-patterns.md +536 -0
- package/plugins/src/rails/.claude-plugin/plugin.json +77 -0
- package/plugins/src/rails/rules/rails-conventions.md +176 -0
- package/plugins/src/rails/skills/action-controller-best-practices/SKILL.md +374 -0
- package/plugins/src/rails/skills/action-view-best-practices/SKILL.md +335 -0
- package/plugins/src/rails/skills/active-record-model-best-practices/SKILL.md +166 -0
- package/plugins/src/rails/skills/jira-add-journey/SKILL.md +65 -0
- package/plugins/src/rails/skills/jira-create/SKILL.md +41 -0
- package/plugins/src/rails/skills/jira-evidence/SKILL.md +70 -0
- package/plugins/src/rails/skills/jira-evidence/scripts/post-evidence.sh +163 -0
- package/plugins/src/rails/skills/jira-journey/SKILL.md +64 -0
- package/plugins/src/rails/skills/jira-verify/SKILL.md +29 -0
- package/plugins/src/rails/skills/plan-add-test-coverage/SKILL.md +45 -0
- package/plugins/src/rails/skills/plan-fix-linter-error/SKILL.md +45 -0
- package/plugins/src/rails/skills/plan-lower-code-complexity/SKILL.md +48 -0
- package/plugins/src/rails/skills/plan-reduce-max-lines/SKILL.md +46 -0
- package/plugins/src/rails/skills/plan-reduce-max-lines-per-function/SKILL.md +46 -0
- package/plugins/src/typescript/.claude-plugin/plugin.json +86 -0
- package/scripts/build-plugins.sh +22 -0
- package/scripts/cleanup-amplify-branches.sh +150 -0
- package/scripts/cleanup-github-branches.sh +202 -0
- package/scripts/github-status-check.sh +301 -0
- package/scripts/install-claude-plugins.sh +45 -0
- package/scripts/lisa-commit-and-pr-local.sh +204 -0
- package/scripts/lisa-update-local.sh +158 -0
- package/scripts/update-node-version.ts +197 -0
- package/tsconfig/build.json +8 -0
- package/tsconfig/cdk.json +16 -0
- package/tsconfig/eslint.json +12 -0
- package/tsconfig/expo.json +18 -0
- package/tsconfig/nestjs.json +18 -0
- package/tsconfig/spec.json +7 -0
- package/{typescript/copy-overwrite/tsconfig.typescript.json → tsconfig/typescript.json} +1 -1
- package/typescript/copy-overwrite/eslint.config.ts +6 -20
- package/typescript/copy-overwrite/eslint.slow.config.ts +4 -73
- package/typescript/copy-overwrite/jest.config.ts +8 -12
- package/typescript/copy-overwrite/tsconfig.json +1 -1
- package/typescript/deletions.json +7 -1
- package/typescript/merge/.claude/settings.json +29 -0
- package/typescript/package-lisa/package.lisa.json +1 -35
- package/all/copy-overwrite/.claude/rules/lisa.md +0 -66
- package/all/copy-overwrite/.claude/settings.json +0 -79
- package/all/copy-overwrite/CLAUDE.md +0 -59
- package/all/copy-overwrite/HUMAN.md +0 -309
- package/cdk/copy-overwrite/.claude/settings.json +0 -80
- package/expo/copy-overwrite/.claude/settings.json +0 -80
- package/nestjs/copy-overwrite/.claude/settings.json +0 -80
- package/rails/copy-overwrite/CLAUDE.md +0 -56
- package/typescript/copy-overwrite/.claude/settings.json +0 -80
- package/typescript/copy-overwrite/eslint.base.ts +0 -429
- package/typescript/copy-overwrite/eslint.typescript.ts +0 -142
- package/typescript/copy-overwrite/jest.typescript.ts +0 -72
- /package/{all/copy-overwrite/.claude → plugins/lisa-cdk/rules}/README.md +0 -0
- /package/{all/create-only/scripts → scripts}/setup-deploy-key.sh +0 -0
- /package/{typescript/copy-overwrite/tsconfig.base.json → tsconfig/base.json} +0 -0
|
@@ -0,0 +1,711 @@
|
|
|
1
|
+
# Persistence Patterns Reference
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This reference covers patterns for persisting reactive variables to AsyncStorage, ensuring that local state survives app restarts while maintaining reactive UI updates.
|
|
6
|
+
|
|
7
|
+
## Why Persistence is Needed
|
|
8
|
+
|
|
9
|
+
Reactive variables are in-memory only. When the app restarts:
|
|
10
|
+
|
|
11
|
+
- All reactive variable values reset to their defaults
|
|
12
|
+
- User preferences are lost
|
|
13
|
+
- Feature flag states reset
|
|
14
|
+
- Filter selections disappear
|
|
15
|
+
|
|
16
|
+
Persistence bridges this gap by saving state to AsyncStorage and restoring it on app launch.
|
|
17
|
+
|
|
18
|
+
## Pattern 1: Immediate Persistence
|
|
19
|
+
|
|
20
|
+
Update storage immediately on every change. Best for critical user preferences that must never be lost.
|
|
21
|
+
|
|
22
|
+
### Implementation
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
26
|
+
import { makeVar, useReactiveVar } from "@apollo/client";
|
|
27
|
+
import { useCallback, useEffect } from "react";
|
|
28
|
+
|
|
29
|
+
// Types
|
|
30
|
+
interface IUserPreferences {
|
|
31
|
+
readonly theme: "light" | "dark";
|
|
32
|
+
readonly language: string;
|
|
33
|
+
readonly notifications: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Constants
|
|
37
|
+
const STORAGE_KEY = "@whatever:user-preferences";
|
|
38
|
+
const DEFAULT_PREFERENCES: IUserPreferences = {
|
|
39
|
+
theme: "light",
|
|
40
|
+
language: "en",
|
|
41
|
+
notifications: true,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Reactive Variable
|
|
45
|
+
export const userPreferencesVar =
|
|
46
|
+
makeVar<IUserPreferences>(DEFAULT_PREFERENCES);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Update preferences and immediately persist to storage
|
|
50
|
+
* @param updates - Partial preferences to merge
|
|
51
|
+
*/
|
|
52
|
+
const updatePreferences = async (
|
|
53
|
+
updates: Partial<IUserPreferences>
|
|
54
|
+
): Promise<void> => {
|
|
55
|
+
const current = userPreferencesVar();
|
|
56
|
+
const newPrefs: IUserPreferences = { ...current, ...updates };
|
|
57
|
+
|
|
58
|
+
// Update reactive variable first (immediate UI update)
|
|
59
|
+
userPreferencesVar(newPrefs);
|
|
60
|
+
|
|
61
|
+
// Persist to storage (async, but starts immediately)
|
|
62
|
+
try {
|
|
63
|
+
await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(newPrefs));
|
|
64
|
+
} catch (error) {
|
|
65
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
66
|
+
console.error("Failed to persist preferences:", message);
|
|
67
|
+
// Note: UI already updated, storage just failed to persist
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Load persisted preferences on app start
|
|
73
|
+
*/
|
|
74
|
+
export const loadUserPreferences = async (): Promise<void> => {
|
|
75
|
+
try {
|
|
76
|
+
const stored = await AsyncStorage.getItem(STORAGE_KEY);
|
|
77
|
+
if (stored) {
|
|
78
|
+
const parsed = JSON.parse(stored) as Partial<IUserPreferences>;
|
|
79
|
+
// Merge with defaults to handle missing fields from older versions
|
|
80
|
+
userPreferencesVar({ ...DEFAULT_PREFERENCES, ...parsed });
|
|
81
|
+
}
|
|
82
|
+
} catch (error) {
|
|
83
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
84
|
+
console.error("Failed to load preferences:", message);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Custom hook for consuming and updating preferences
|
|
90
|
+
*/
|
|
91
|
+
export const useUserPreferences = () => {
|
|
92
|
+
const preferences = useReactiveVar(userPreferencesVar);
|
|
93
|
+
|
|
94
|
+
const setTheme = useCallback((theme: "light" | "dark") => {
|
|
95
|
+
updatePreferences({ theme });
|
|
96
|
+
}, []);
|
|
97
|
+
|
|
98
|
+
const setLanguage = useCallback((language: string) => {
|
|
99
|
+
updatePreferences({ language });
|
|
100
|
+
}, []);
|
|
101
|
+
|
|
102
|
+
const setNotifications = useCallback((notifications: boolean) => {
|
|
103
|
+
updatePreferences({ notifications });
|
|
104
|
+
}, []);
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
preferences,
|
|
108
|
+
setTheme,
|
|
109
|
+
setLanguage,
|
|
110
|
+
setNotifications,
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### App Initialization
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
// In root layout or app entry
|
|
119
|
+
import { useEffect } from "react";
|
|
120
|
+
import { loadUserPreferences } from "@/features/settings/stores/userPreferences";
|
|
121
|
+
|
|
122
|
+
export default function RootLayout() {
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
loadUserPreferences();
|
|
125
|
+
}, []);
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
// ... app content
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### When to Use
|
|
134
|
+
|
|
135
|
+
- User preferences that are critical
|
|
136
|
+
- Settings that affect app behavior immediately
|
|
137
|
+
- Data that users expect to persist always
|
|
138
|
+
|
|
139
|
+
### Trade-offs
|
|
140
|
+
|
|
141
|
+
- **Pro**: Data is always persisted, minimal data loss risk
|
|
142
|
+
- **Con**: More storage operations, potential performance impact with frequent changes
|
|
143
|
+
|
|
144
|
+
## Pattern 2: AppState-Based Persistence
|
|
145
|
+
|
|
146
|
+
Save to storage when app goes to background. Better for non-critical state that changes frequently.
|
|
147
|
+
|
|
148
|
+
### Implementation
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
152
|
+
import { makeVar, useReactiveVar } from "@apollo/client";
|
|
153
|
+
import { useEffect, useCallback } from "react";
|
|
154
|
+
import { AppState, AppStateStatus } from "react-native";
|
|
155
|
+
|
|
156
|
+
// Types
|
|
157
|
+
interface IFilterState {
|
|
158
|
+
readonly minAge: number;
|
|
159
|
+
readonly maxAge: number;
|
|
160
|
+
readonly positions: readonly string[];
|
|
161
|
+
readonly teams: readonly string[];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Constants
|
|
165
|
+
const STORAGE_KEY = "@whatever:filter-state";
|
|
166
|
+
const DEFAULT_FILTERS: IFilterState = {
|
|
167
|
+
minAge: 18,
|
|
168
|
+
maxAge: 40,
|
|
169
|
+
positions: [],
|
|
170
|
+
teams: [],
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// Reactive Variable
|
|
174
|
+
export const filterStateVar = makeVar<IFilterState>(DEFAULT_FILTERS);
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Load persisted filter state on app start
|
|
178
|
+
*/
|
|
179
|
+
const loadFilterState = async (): Promise<void> => {
|
|
180
|
+
try {
|
|
181
|
+
const stored = await AsyncStorage.getItem(STORAGE_KEY);
|
|
182
|
+
if (stored) {
|
|
183
|
+
const parsed = JSON.parse(stored) as Partial<IFilterState>;
|
|
184
|
+
filterStateVar({ ...DEFAULT_FILTERS, ...parsed });
|
|
185
|
+
}
|
|
186
|
+
} catch (error) {
|
|
187
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
188
|
+
console.error("Failed to load filter state:", message);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Save filter state to storage
|
|
194
|
+
*/
|
|
195
|
+
const saveFilterState = async (): Promise<void> => {
|
|
196
|
+
try {
|
|
197
|
+
const current = filterStateVar();
|
|
198
|
+
await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(current));
|
|
199
|
+
} catch (error) {
|
|
200
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
201
|
+
console.error("Failed to save filter state:", message);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Hook to set up persistence lifecycle
|
|
207
|
+
* Call once in a top-level component
|
|
208
|
+
*/
|
|
209
|
+
export const useFilterStatePersistence = (): void => {
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
// Load on mount
|
|
212
|
+
loadFilterState();
|
|
213
|
+
|
|
214
|
+
// Save on background/inactive
|
|
215
|
+
const handleAppStateChange = (nextAppState: AppStateStatus): void => {
|
|
216
|
+
if (nextAppState === "background" || nextAppState === "inactive") {
|
|
217
|
+
saveFilterState();
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const subscription = AppState.addEventListener(
|
|
222
|
+
"change",
|
|
223
|
+
handleAppStateChange
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
return () => {
|
|
227
|
+
// Save on unmount as well
|
|
228
|
+
saveFilterState();
|
|
229
|
+
subscription.remove();
|
|
230
|
+
};
|
|
231
|
+
}, []);
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Custom hook for consuming and updating filters
|
|
236
|
+
*/
|
|
237
|
+
export const useFilterState = () => {
|
|
238
|
+
const filters = useReactiveVar(filterStateVar);
|
|
239
|
+
|
|
240
|
+
const setMinAge = useCallback((minAge: number) => {
|
|
241
|
+
filterStateVar({ ...filterStateVar(), minAge });
|
|
242
|
+
}, []);
|
|
243
|
+
|
|
244
|
+
const setMaxAge = useCallback((maxAge: number) => {
|
|
245
|
+
filterStateVar({ ...filterStateVar(), maxAge });
|
|
246
|
+
}, []);
|
|
247
|
+
|
|
248
|
+
const togglePosition = useCallback((position: string) => {
|
|
249
|
+
const current = filterStateVar();
|
|
250
|
+
const positions = current.positions.includes(position)
|
|
251
|
+
? current.positions.filter(p => p !== position)
|
|
252
|
+
: [...current.positions, position];
|
|
253
|
+
filterStateVar({ ...current, positions });
|
|
254
|
+
}, []);
|
|
255
|
+
|
|
256
|
+
const resetFilters = useCallback(() => {
|
|
257
|
+
filterStateVar(DEFAULT_FILTERS);
|
|
258
|
+
}, []);
|
|
259
|
+
|
|
260
|
+
return {
|
|
261
|
+
filters,
|
|
262
|
+
setMinAge,
|
|
263
|
+
setMaxAge,
|
|
264
|
+
togglePosition,
|
|
265
|
+
resetFilters,
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### When to Use
|
|
271
|
+
|
|
272
|
+
- Filter states and UI preferences
|
|
273
|
+
- Data that changes frequently during a session
|
|
274
|
+
- Non-critical state where occasional loss is acceptable
|
|
275
|
+
|
|
276
|
+
### Trade-offs
|
|
277
|
+
|
|
278
|
+
- **Pro**: Fewer storage operations, better performance for frequently changing data
|
|
279
|
+
- **Con**: Risk of data loss if app crashes before backgrounding
|
|
280
|
+
|
|
281
|
+
## Pattern 3: Debounced Persistence
|
|
282
|
+
|
|
283
|
+
Persist after a delay following the last change. Good for data that changes in bursts.
|
|
284
|
+
|
|
285
|
+
### Implementation
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
289
|
+
import { makeVar, useReactiveVar } from "@apollo/client";
|
|
290
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
291
|
+
|
|
292
|
+
// Types
|
|
293
|
+
interface ISearchHistory {
|
|
294
|
+
readonly queries: readonly string[];
|
|
295
|
+
readonly lastUpdated: string;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Constants
|
|
299
|
+
const STORAGE_KEY = "@whatever:search-history";
|
|
300
|
+
const DEBOUNCE_MS = 1000;
|
|
301
|
+
const MAX_HISTORY_ITEMS = 20;
|
|
302
|
+
const DEFAULT_HISTORY: ISearchHistory = {
|
|
303
|
+
queries: [],
|
|
304
|
+
lastUpdated: new Date().toISOString(),
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
// Reactive Variable
|
|
308
|
+
export const searchHistoryVar = makeVar<ISearchHistory>(DEFAULT_HISTORY);
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Custom hook with debounced persistence
|
|
312
|
+
*/
|
|
313
|
+
export const useSearchHistory = () => {
|
|
314
|
+
const history = useReactiveVar(searchHistoryVar);
|
|
315
|
+
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
|
|
316
|
+
|
|
317
|
+
// Load on mount
|
|
318
|
+
useEffect(() => {
|
|
319
|
+
const loadHistory = async () => {
|
|
320
|
+
try {
|
|
321
|
+
const stored = await AsyncStorage.getItem(STORAGE_KEY);
|
|
322
|
+
if (stored) {
|
|
323
|
+
const parsed = JSON.parse(stored) as ISearchHistory;
|
|
324
|
+
searchHistoryVar(parsed);
|
|
325
|
+
}
|
|
326
|
+
} catch (error) {
|
|
327
|
+
console.error("Failed to load search history:", error);
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
loadHistory();
|
|
331
|
+
}, []);
|
|
332
|
+
|
|
333
|
+
// Debounced save function
|
|
334
|
+
const scheduleSave = useCallback(() => {
|
|
335
|
+
if (timeoutRef.current) {
|
|
336
|
+
clearTimeout(timeoutRef.current);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
timeoutRef.current = setTimeout(async () => {
|
|
340
|
+
try {
|
|
341
|
+
const current = searchHistoryVar();
|
|
342
|
+
await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(current));
|
|
343
|
+
} catch (error) {
|
|
344
|
+
console.error("Failed to save search history:", error);
|
|
345
|
+
}
|
|
346
|
+
}, DEBOUNCE_MS);
|
|
347
|
+
}, []);
|
|
348
|
+
|
|
349
|
+
// Cleanup on unmount
|
|
350
|
+
useEffect(() => {
|
|
351
|
+
return () => {
|
|
352
|
+
if (timeoutRef.current) {
|
|
353
|
+
clearTimeout(timeoutRef.current);
|
|
354
|
+
// Final save on unmount
|
|
355
|
+
AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(searchHistoryVar()));
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
}, []);
|
|
359
|
+
|
|
360
|
+
const addQuery = useCallback(
|
|
361
|
+
(query: string) => {
|
|
362
|
+
const current = searchHistoryVar();
|
|
363
|
+
const trimmedQuery = query.trim();
|
|
364
|
+
|
|
365
|
+
if (!trimmedQuery) return;
|
|
366
|
+
|
|
367
|
+
// Remove duplicate if exists, add to front
|
|
368
|
+
const filtered = current.queries.filter(q => q !== trimmedQuery);
|
|
369
|
+
const queries = [trimmedQuery, ...filtered].slice(0, MAX_HISTORY_ITEMS);
|
|
370
|
+
|
|
371
|
+
searchHistoryVar({
|
|
372
|
+
queries,
|
|
373
|
+
lastUpdated: new Date().toISOString(),
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
scheduleSave();
|
|
377
|
+
},
|
|
378
|
+
[scheduleSave]
|
|
379
|
+
);
|
|
380
|
+
|
|
381
|
+
const clearHistory = useCallback(() => {
|
|
382
|
+
searchHistoryVar(DEFAULT_HISTORY);
|
|
383
|
+
scheduleSave();
|
|
384
|
+
}, [scheduleSave]);
|
|
385
|
+
|
|
386
|
+
return {
|
|
387
|
+
queries: history.queries,
|
|
388
|
+
addQuery,
|
|
389
|
+
clearHistory,
|
|
390
|
+
};
|
|
391
|
+
};
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### When to Use
|
|
395
|
+
|
|
396
|
+
- Search history or recent items
|
|
397
|
+
- Form draft auto-save
|
|
398
|
+
- Any data with burst updates
|
|
399
|
+
|
|
400
|
+
### Trade-offs
|
|
401
|
+
|
|
402
|
+
- **Pro**: Optimal balance between persistence and performance
|
|
403
|
+
- **Con**: More complex implementation, potential for lost updates during debounce window
|
|
404
|
+
|
|
405
|
+
## Pattern 4: Context Provider with Persistence
|
|
406
|
+
|
|
407
|
+
For state that needs to be available throughout the app with persistence.
|
|
408
|
+
|
|
409
|
+
### Implementation
|
|
410
|
+
|
|
411
|
+
```typescript
|
|
412
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
413
|
+
import React, {
|
|
414
|
+
createContext,
|
|
415
|
+
useContext,
|
|
416
|
+
useState,
|
|
417
|
+
useEffect,
|
|
418
|
+
useCallback,
|
|
419
|
+
useMemo,
|
|
420
|
+
ReactNode,
|
|
421
|
+
} from "react";
|
|
422
|
+
|
|
423
|
+
// Types
|
|
424
|
+
interface IFeatureFlags {
|
|
425
|
+
readonly darkModeEnabled: boolean;
|
|
426
|
+
readonly betaFeaturesEnabled: boolean;
|
|
427
|
+
readonly debugModeEnabled: boolean;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
interface IFeatureFlagsContext extends IFeatureFlags {
|
|
431
|
+
readonly isLoaded: boolean;
|
|
432
|
+
readonly setDarkModeEnabled: (enabled: boolean) => void;
|
|
433
|
+
readonly setBetaFeaturesEnabled: (enabled: boolean) => void;
|
|
434
|
+
readonly setDebugModeEnabled: (enabled: boolean) => void;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// Constants
|
|
438
|
+
const STORAGE_KEY = "@whatever:feature-flags";
|
|
439
|
+
const DEFAULT_FLAGS: IFeatureFlags = {
|
|
440
|
+
darkModeEnabled: false,
|
|
441
|
+
betaFeaturesEnabled: false,
|
|
442
|
+
debugModeEnabled: false,
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
// Context
|
|
446
|
+
const FeatureFlagsContext = createContext<IFeatureFlagsContext | null>(null);
|
|
447
|
+
|
|
448
|
+
interface ProviderProps {
|
|
449
|
+
readonly children: ReactNode;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Feature flags provider with AsyncStorage persistence
|
|
454
|
+
*/
|
|
455
|
+
export const FeatureFlagsProvider = ({ children }: ProviderProps) => {
|
|
456
|
+
const [flags, setFlags] = useState<IFeatureFlags>(DEFAULT_FLAGS);
|
|
457
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
458
|
+
|
|
459
|
+
// Load from storage on mount
|
|
460
|
+
useEffect(() => {
|
|
461
|
+
const loadFlags = async () => {
|
|
462
|
+
try {
|
|
463
|
+
const stored = await AsyncStorage.getItem(STORAGE_KEY);
|
|
464
|
+
if (stored) {
|
|
465
|
+
const parsed = JSON.parse(stored) as Partial<IFeatureFlags>;
|
|
466
|
+
setFlags(prev => ({ ...prev, ...parsed }));
|
|
467
|
+
}
|
|
468
|
+
} catch (error) {
|
|
469
|
+
console.error("Failed to load feature flags:", error);
|
|
470
|
+
} finally {
|
|
471
|
+
setIsLoaded(true);
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
loadFlags();
|
|
475
|
+
}, []);
|
|
476
|
+
|
|
477
|
+
// Save helper
|
|
478
|
+
const saveFlags = useCallback(async (newFlags: IFeatureFlags) => {
|
|
479
|
+
try {
|
|
480
|
+
await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(newFlags));
|
|
481
|
+
} catch (error) {
|
|
482
|
+
console.error("Failed to save feature flags:", error);
|
|
483
|
+
}
|
|
484
|
+
}, []);
|
|
485
|
+
|
|
486
|
+
// Individual setters
|
|
487
|
+
const setDarkModeEnabled = useCallback(
|
|
488
|
+
(enabled: boolean) => {
|
|
489
|
+
setFlags(prev => {
|
|
490
|
+
const newFlags = { ...prev, darkModeEnabled: enabled };
|
|
491
|
+
saveFlags(newFlags);
|
|
492
|
+
return newFlags;
|
|
493
|
+
});
|
|
494
|
+
},
|
|
495
|
+
[saveFlags]
|
|
496
|
+
);
|
|
497
|
+
|
|
498
|
+
const setBetaFeaturesEnabled = useCallback(
|
|
499
|
+
(enabled: boolean) => {
|
|
500
|
+
setFlags(prev => {
|
|
501
|
+
const newFlags = { ...prev, betaFeaturesEnabled: enabled };
|
|
502
|
+
saveFlags(newFlags);
|
|
503
|
+
return newFlags;
|
|
504
|
+
});
|
|
505
|
+
},
|
|
506
|
+
[saveFlags]
|
|
507
|
+
);
|
|
508
|
+
|
|
509
|
+
const setDebugModeEnabled = useCallback(
|
|
510
|
+
(enabled: boolean) => {
|
|
511
|
+
setFlags(prev => {
|
|
512
|
+
const newFlags = { ...prev, debugModeEnabled: enabled };
|
|
513
|
+
saveFlags(newFlags);
|
|
514
|
+
return newFlags;
|
|
515
|
+
});
|
|
516
|
+
},
|
|
517
|
+
[saveFlags]
|
|
518
|
+
);
|
|
519
|
+
|
|
520
|
+
const contextValue = useMemo(
|
|
521
|
+
(): IFeatureFlagsContext => ({
|
|
522
|
+
...flags,
|
|
523
|
+
isLoaded,
|
|
524
|
+
setDarkModeEnabled,
|
|
525
|
+
setBetaFeaturesEnabled,
|
|
526
|
+
setDebugModeEnabled,
|
|
527
|
+
}),
|
|
528
|
+
[flags, isLoaded, setDarkModeEnabled, setBetaFeaturesEnabled, setDebugModeEnabled]
|
|
529
|
+
);
|
|
530
|
+
|
|
531
|
+
return (
|
|
532
|
+
<FeatureFlagsContext.Provider value={contextValue}>
|
|
533
|
+
{children}
|
|
534
|
+
</FeatureFlagsContext.Provider>
|
|
535
|
+
);
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Hook to consume feature flags
|
|
540
|
+
* @throws Error if used outside provider
|
|
541
|
+
*/
|
|
542
|
+
export const useFeatureFlags = (): IFeatureFlagsContext => {
|
|
543
|
+
const context = useContext(FeatureFlagsContext);
|
|
544
|
+
if (!context) {
|
|
545
|
+
throw new Error("useFeatureFlags must be used within FeatureFlagsProvider");
|
|
546
|
+
}
|
|
547
|
+
return context;
|
|
548
|
+
};
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### Usage
|
|
552
|
+
|
|
553
|
+
```typescript
|
|
554
|
+
// In app root
|
|
555
|
+
export default function RootLayout() {
|
|
556
|
+
return (
|
|
557
|
+
<FeatureFlagsProvider>
|
|
558
|
+
<App />
|
|
559
|
+
</FeatureFlagsProvider>
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// In any component
|
|
564
|
+
const SettingsScreen = () => {
|
|
565
|
+
const { darkModeEnabled, setDarkModeEnabled, isLoaded } = useFeatureFlags();
|
|
566
|
+
|
|
567
|
+
if (!isLoaded) {
|
|
568
|
+
return <LoadingSpinner />;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
return (
|
|
572
|
+
<Switch
|
|
573
|
+
value={darkModeEnabled}
|
|
574
|
+
onValueChange={setDarkModeEnabled}
|
|
575
|
+
/>
|
|
576
|
+
);
|
|
577
|
+
};
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
### When to Use
|
|
581
|
+
|
|
582
|
+
- Feature flags
|
|
583
|
+
- App-wide settings
|
|
584
|
+
- State that needs to be accessed before Apollo Client initializes
|
|
585
|
+
|
|
586
|
+
### Trade-offs
|
|
587
|
+
|
|
588
|
+
- **Pro**: Works without Apollo Client, clear loading state
|
|
589
|
+
- **Con**: More boilerplate, separate from Apollo ecosystem
|
|
590
|
+
|
|
591
|
+
## Choosing the Right Pattern
|
|
592
|
+
|
|
593
|
+
| Pattern | Best For | Performance | Reliability |
|
|
594
|
+
| ---------------- | ------------------ | ------------------- | ----------- |
|
|
595
|
+
| Immediate | Critical user data | Lower (more writes) | Highest |
|
|
596
|
+
| AppState-based | Frequent changes | Higher | Medium |
|
|
597
|
+
| Debounced | Burst updates | Highest | Medium |
|
|
598
|
+
| Context Provider | Non-Apollo state | Medium | High |
|
|
599
|
+
|
|
600
|
+
## Combined Pattern Example
|
|
601
|
+
|
|
602
|
+
For complex features, combine patterns:
|
|
603
|
+
|
|
604
|
+
```typescript
|
|
605
|
+
// stores/playerFilters.ts
|
|
606
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
607
|
+
import { makeVar, useReactiveVar } from "@apollo/client";
|
|
608
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
609
|
+
import { AppState, AppStateStatus } from "react-native";
|
|
610
|
+
|
|
611
|
+
interface IPlayerFilters {
|
|
612
|
+
readonly minAge: number;
|
|
613
|
+
readonly maxAge: number;
|
|
614
|
+
readonly positions: readonly string[];
|
|
615
|
+
readonly searchQuery: string;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
const STORAGE_KEY = "@whatever:player-filters";
|
|
619
|
+
const SEARCH_DEBOUNCE_MS = 300;
|
|
620
|
+
const DEFAULT_FILTERS: IPlayerFilters = {
|
|
621
|
+
minAge: 18,
|
|
622
|
+
maxAge: 45,
|
|
623
|
+
positions: [],
|
|
624
|
+
searchQuery: "",
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
export const playerFiltersVar = makeVar<IPlayerFilters>(DEFAULT_FILTERS);
|
|
628
|
+
|
|
629
|
+
export const usePlayerFilters = () => {
|
|
630
|
+
const filters = useReactiveVar(playerFiltersVar);
|
|
631
|
+
const searchTimeoutRef = useRef<NodeJS.Timeout | null>(null);
|
|
632
|
+
|
|
633
|
+
// Load on mount
|
|
634
|
+
useEffect(() => {
|
|
635
|
+
const load = async () => {
|
|
636
|
+
try {
|
|
637
|
+
const stored = await AsyncStorage.getItem(STORAGE_KEY);
|
|
638
|
+
if (stored) {
|
|
639
|
+
const parsed = JSON.parse(stored) as Partial<IPlayerFilters>;
|
|
640
|
+
playerFiltersVar({ ...DEFAULT_FILTERS, ...parsed });
|
|
641
|
+
}
|
|
642
|
+
} catch (error) {
|
|
643
|
+
console.error("Failed to load filters:", error);
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
load();
|
|
647
|
+
}, []);
|
|
648
|
+
|
|
649
|
+
// Save on background (for non-search fields)
|
|
650
|
+
useEffect(() => {
|
|
651
|
+
const handleAppState = (state: AppStateStatus) => {
|
|
652
|
+
if (state === "background") {
|
|
653
|
+
AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(playerFiltersVar()));
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
const sub = AppState.addEventListener("change", handleAppState);
|
|
658
|
+
return () => sub.remove();
|
|
659
|
+
}, []);
|
|
660
|
+
|
|
661
|
+
// Immediate save for critical changes (positions)
|
|
662
|
+
const togglePosition = useCallback((position: string) => {
|
|
663
|
+
const current = playerFiltersVar();
|
|
664
|
+
const positions = current.positions.includes(position)
|
|
665
|
+
? current.positions.filter(p => p !== position)
|
|
666
|
+
: [...current.positions, position];
|
|
667
|
+
|
|
668
|
+
const newFilters = { ...current, positions };
|
|
669
|
+
playerFiltersVar(newFilters);
|
|
670
|
+
|
|
671
|
+
// Immediate persist for position changes
|
|
672
|
+
AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(newFilters));
|
|
673
|
+
}, []);
|
|
674
|
+
|
|
675
|
+
// Debounced for search query
|
|
676
|
+
const setSearchQuery = useCallback((searchQuery: string) => {
|
|
677
|
+
playerFiltersVar({ ...playerFiltersVar(), searchQuery });
|
|
678
|
+
|
|
679
|
+
if (searchTimeoutRef.current) {
|
|
680
|
+
clearTimeout(searchTimeoutRef.current);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
searchTimeoutRef.current = setTimeout(() => {
|
|
684
|
+
AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(playerFiltersVar()));
|
|
685
|
+
}, SEARCH_DEBOUNCE_MS);
|
|
686
|
+
}, []);
|
|
687
|
+
|
|
688
|
+
// Standard setters (saved on background)
|
|
689
|
+
const setMinAge = useCallback((minAge: number) => {
|
|
690
|
+
playerFiltersVar({ ...playerFiltersVar(), minAge });
|
|
691
|
+
}, []);
|
|
692
|
+
|
|
693
|
+
const setMaxAge = useCallback((maxAge: number) => {
|
|
694
|
+
playerFiltersVar({ ...playerFiltersVar(), maxAge });
|
|
695
|
+
}, []);
|
|
696
|
+
|
|
697
|
+
return {
|
|
698
|
+
filters,
|
|
699
|
+
setMinAge,
|
|
700
|
+
setMaxAge,
|
|
701
|
+
togglePosition,
|
|
702
|
+
setSearchQuery,
|
|
703
|
+
};
|
|
704
|
+
};
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
This combined approach uses:
|
|
708
|
+
|
|
709
|
+
- **AppState persistence** for age filters (saved on background)
|
|
710
|
+
- **Immediate persistence** for position toggles (critical user selections)
|
|
711
|
+
- **Debounced persistence** for search query (changes with every keystroke)
|