@snap/valdi 1.0.7 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/.bootstrap/modules/{ios_android_bridge_module → polyglot_bridge_module}/BUILD.bazel.template +16 -1
  2. package/.bootstrap/modules/polyglot_bridge_module/web/Calculator.ts +11 -0
  3. package/.bootstrap/modules/polyglot_bridge_module/web/tsconfig.json +16 -0
  4. package/.bootstrap/modules/polyglot_view_module/BUILD.bazel.template +75 -0
  5. package/.bootstrap/modules/polyglot_view_module/android/PolyglotNativeView.kt.template +41 -0
  6. package/.bootstrap/modules/polyglot_view_module/android/PolyglotNativeViewAttributesBinder.kt.template +17 -0
  7. package/.bootstrap/modules/polyglot_view_module/ios/SCPolyglotView.h +8 -0
  8. package/.bootstrap/modules/polyglot_view_module/ios/SCPolyglotView.m +23 -0
  9. package/.bootstrap/modules/polyglot_view_module/macos/SCPolyglotView.h +8 -0
  10. package/.bootstrap/modules/polyglot_view_module/macos/SCPolyglotView.m +23 -0
  11. package/.bootstrap/modules/polyglot_view_module/src/PolyglotCustomView.tsx.template +23 -0
  12. package/.bootstrap/modules/polyglot_view_module/web/PolyglotWeb.ts.template +30 -0
  13. package/.bootstrap/modules/polyglot_view_module/web/tsconfig.json +16 -0
  14. package/.metadata/AGENTS.md.template +8 -274
  15. package/.metadata/skill-reference.tsx.template +8 -0
  16. package/.metadata/skill-tests-BUILD.bazel.template +21 -0
  17. package/.metadata/skill-tests-README.md.template +17 -0
  18. package/.metadata/skill.md.template +27 -0
  19. package/README.md +12 -3
  20. package/bundled-skills/CONTRIBUTING_SKILLS.md +74 -0
  21. package/bundled-skills/registry.json +21 -0
  22. package/bundled-skills/skills/valdi-android/skill.md +89 -0
  23. package/bundled-skills/skills/valdi-async/skill.md +246 -0
  24. package/bundled-skills/skills/valdi-async/tests/BUILD.bazel +19 -0
  25. package/bundled-skills/skills/valdi-async/tests/README.md +25 -0
  26. package/bundled-skills/skills/valdi-async/tests/src/reference.tsx +210 -0
  27. package/bundled-skills/skills/valdi-async/tests/tsconfig.json +1 -0
  28. package/bundled-skills/skills/valdi-bazel/skill.md +141 -0
  29. package/bundled-skills/skills/valdi-compiler/skill.md +108 -0
  30. package/bundled-skills/skills/valdi-component-tests/skill.md +430 -0
  31. package/bundled-skills/skills/valdi-component-tests/tests/BUILD.bazel +24 -0
  32. package/bundled-skills/skills/valdi-component-tests/tests/README.md +35 -0
  33. package/bundled-skills/skills/valdi-component-tests/tests/src/ProfileCard.tsx +38 -0
  34. package/bundled-skills/skills/valdi-component-tests/tests/test/ProfileCardTest.spec.tsx +107 -0
  35. package/bundled-skills/skills/valdi-component-tests/tests/tsconfig.json +1 -0
  36. package/bundled-skills/skills/valdi-cpp-runtime/skill.md +103 -0
  37. package/bundled-skills/skills/valdi-custom-view/skill.md +64 -0
  38. package/bundled-skills/skills/valdi-inspect/skill.md +199 -0
  39. package/bundled-skills/skills/valdi-ios/skill.md +93 -0
  40. package/bundled-skills/skills/valdi-migrate/skill.md +175 -0
  41. package/bundled-skills/skills/valdi-migrate/tests/BUILD.bazel +23 -0
  42. package/bundled-skills/skills/valdi-migrate/tests/README.md +70 -0
  43. package/bundled-skills/skills/valdi-migrate/tests/check_antipatterns.py +89 -0
  44. package/bundled-skills/skills/valdi-migrate/tests/compose_example.kt +94 -0
  45. package/bundled-skills/skills/valdi-migrate/tests/flutter_example.dart +129 -0
  46. package/bundled-skills/skills/valdi-migrate/tests/react_example.tsx +98 -0
  47. package/bundled-skills/skills/valdi-migrate/tests/src/expected_valdi.tsx +267 -0
  48. package/bundled-skills/skills/valdi-migrate/tests/tsconfig.json +3 -0
  49. package/bundled-skills/skills/valdi-overview/skill.md +63 -0
  50. package/bundled-skills/skills/valdi-perf/skill.md +197 -0
  51. package/bundled-skills/skills/valdi-perf/tests/BUILD.bazel +19 -0
  52. package/bundled-skills/skills/valdi-perf/tests/README.md +26 -0
  53. package/bundled-skills/skills/valdi-perf/tests/src/reference.tsx +202 -0
  54. package/bundled-skills/skills/valdi-perf/tests/tsconfig.json +1 -0
  55. package/bundled-skills/skills/valdi-polyglot-module/skill.md +124 -0
  56. package/bundled-skills/skills/valdi-profile/skill.md +126 -0
  57. package/bundled-skills/skills/valdi-setup/skill.md +129 -0
  58. package/bundled-skills/skills/valdi-testing/skill.md +65 -0
  59. package/bundled-skills/skills/valdi-tsx/skill.md +385 -0
  60. package/bundled-skills/skills/valdi-tsx/tests/BUILD.bazel +19 -0
  61. package/bundled-skills/skills/valdi-tsx/tests/README.md +29 -0
  62. package/bundled-skills/skills/valdi-tsx/tests/src/reference.tsx +173 -0
  63. package/bundled-skills/skills/valdi-tsx/tests/tsconfig.json +1 -0
  64. package/dist/commands/bootstrap.js +0 -7
  65. package/dist/commands/inspect.js +16 -0
  66. package/dist/commands/inspect_commands/contexts.js +55 -0
  67. package/dist/commands/inspect_commands/devices.js +53 -0
  68. package/dist/commands/inspect_commands/heap.js +59 -0
  69. package/dist/commands/inspect_commands/select.js +43 -0
  70. package/dist/commands/inspect_commands/snapshot.js +64 -0
  71. package/dist/commands/inspect_commands/status.js +68 -0
  72. package/dist/commands/inspect_commands/tree.js +86 -0
  73. package/dist/commands/newModule.js +10 -14
  74. package/dist/commands/profile.js +16 -0
  75. package/dist/commands/profile_commands/capture.js +106 -0
  76. package/dist/commands/skills.js +16 -0
  77. package/dist/commands/skills_commands/create.js +125 -0
  78. package/dist/commands/skills_commands/install.js +96 -0
  79. package/dist/commands/skills_commands/list.js +83 -0
  80. package/dist/commands/skills_commands/remove.js +41 -0
  81. package/dist/commands/skills_commands/update.js +59 -0
  82. package/dist/core/constants.js +0 -1
  83. package/dist/core/packageFiles.spec.js +29 -0
  84. package/dist/setup/versions.js +1 -1
  85. package/dist/utils/daemonClient.js +342 -0
  86. package/dist/utils/hermesClient.js +252 -0
  87. package/dist/utils/skillsAdapters.js +140 -0
  88. package/dist/utils/skillsRegistry.js +40 -0
  89. package/dist/utils/stringUtils.spec.js +1 -1
  90. package/package.json +20 -5
  91. package/.bazelignore +0 -2
  92. package/.bootstrap/modules/cpp_bridge_module/BUILD.bazel.template +0 -21
  93. package/.bootstrap/modules/cpp_bridge_module/cpp/CalculatorModuleFactory.cpp.template +0 -28
  94. package/.bootstrap/modules/ios_android_bridge_module/src/Calculator.d.ts +0 -4
  95. package/.bootstrap/modules/ios_android_view_module/BUILD.bazel.template +0 -41
  96. package/.bootstrap/modules/ios_android_view_module/android/CircleView.kt.template +0 -42
  97. package/.bootstrap/modules/ios_android_view_module/android/CircleViewAttributesBinder.kt.template +0 -60
  98. package/.bootstrap/modules/ios_android_view_module/ios/SCCCircleView.h +0 -6
  99. package/.bootstrap/modules/ios_android_view_module/ios/SCCCircleView.m +0 -82
  100. package/.bootstrap/modules/ios_android_view_module/src/Circle.tsx.template +0 -15
  101. package/.config/copyconfig.json +0 -10
  102. package/.editorconfig +0 -21
  103. package/.eslintignore +0 -1
  104. package/.eslintrc.js +0 -72
  105. package/.github/README.md +0 -164
  106. package/.metadata/.cursorrules.template +0 -60
  107. package/.prettierignore +0 -2
  108. package/.prettierrc.json +0 -7
  109. package/LINUX_COMPATIBILITY.md +0 -248
  110. package/prettier.config.js +0 -4
  111. package/scripts/sync-agents-md.sh +0 -44
  112. package/scripts/update-agents-templates.ts +0 -170
  113. package/spec/support/jasmine.json +0 -6
  114. package/src/commands/bootstrap.ts +0 -410
  115. package/src/commands/build.ts +0 -89
  116. package/src/commands/devSetup.ts +0 -17
  117. package/src/commands/doctor.ts +0 -1832
  118. package/src/commands/export.ts +0 -131
  119. package/src/commands/hotreload.ts +0 -108
  120. package/src/commands/install.ts +0 -93
  121. package/src/commands/lint.ts +0 -15
  122. package/src/commands/lint_commands/lintCheck.ts +0 -53
  123. package/src/commands/lint_commands/lintFormat.ts +0 -49
  124. package/src/commands/log.ts +0 -108
  125. package/src/commands/newModule.ts +0 -286
  126. package/src/commands/package.ts +0 -102
  127. package/src/commands/projectsync.ts +0 -488
  128. package/src/commands/test.ts +0 -68
  129. package/src/core/constants.ts +0 -98
  130. package/src/core/errors.ts +0 -10
  131. package/src/index.ts +0 -27
  132. package/src/setup/DevSetupHelper.ts +0 -290
  133. package/src/setup/linuxSetup.ts +0 -261
  134. package/src/setup/macOSSetup.ts +0 -156
  135. package/src/setup/setupEntryPoint.ts +0 -64
  136. package/src/setup/versions.ts +0 -8
  137. package/src/utils/ArgumentsResolver.ts +0 -23
  138. package/src/utils/BazelClient.ts +0 -285
  139. package/src/utils/Digraph.ts +0 -81
  140. package/src/utils/LoadingIndicator.ts +0 -43
  141. package/src/utils/applicationUtils.ts +0 -276
  142. package/src/utils/buildInfo.ts +0 -99
  143. package/src/utils/byString.ts +0 -3
  144. package/src/utils/cliUtils.ts +0 -112
  145. package/src/utils/copyBootstrapFiles.ts +0 -30
  146. package/src/utils/deviceUtils.ts +0 -76
  147. package/src/utils/errorUtils.ts +0 -63
  148. package/src/utils/fileUtils.ts +0 -257
  149. package/src/utils/githubUtils.ts +0 -102
  150. package/src/utils/jsonUtils.ts +0 -30
  151. package/src/utils/lintUtils.ts +0 -190
  152. package/src/utils/linuxDistro.spec.ts +0 -219
  153. package/src/utils/linuxDistro.ts +0 -326
  154. package/src/utils/logUtils.ts +0 -9
  155. package/src/utils/pathUtils.ts +0 -12
  156. package/src/utils/stringUtils.spec.ts +0 -95
  157. package/src/utils/stringUtils.ts +0 -103
  158. package/src/utils/tempDir.ts +0 -24
  159. package/src/utils/zipUtils.ts +0 -14
  160. package/test/ValdiSmokeTest.ts +0 -279
  161. package/test/helpers/AsyncHelpers.ts +0 -113
  162. package/test/helpers/CommandHelpers.ts +0 -37
  163. package/test/helpers/ProjectHelpers.ts +0 -153
  164. package/test/helpers/StreamHelpers.ts +0 -37
  165. package/test/helpers/TypeScriptClient.ts +0 -217
  166. package/tsconfig.dist.json +0 -8
  167. package/tsconfig.json +0 -42
  168. /package/.bootstrap/modules/{ios_android_bridge_module → polyglot_bridge_module}/android/CalculatorModuleFactory.kt.template +0 -0
  169. /package/.bootstrap/modules/{ios_android_bridge_module → polyglot_bridge_module}/ios/SCCCalculatorModuleFactory.m.template +0 -0
  170. /package/.bootstrap/modules/{cpp_bridge_module → polyglot_bridge_module}/src/Calculator.d.ts +0 -0
package/.github/README.md DELETED
@@ -1,164 +0,0 @@
1
- # GitHub Actions CI for Valdi CLI
2
-
3
- ## Workflows
4
-
5
- ### 1. `test-cli-linux.yml` - Linux Distribution Testing
6
-
7
- Tests the CLI on multiple Linux distributions to ensure proper distribution detection and package management.
8
-
9
- **Triggers:**
10
- - Pull requests touching CLI source files
11
- - Pushes to main branch
12
- - Manual workflow dispatch
13
-
14
- **Test Matrix:**
15
- - Ubuntu 22.04
16
- - Ubuntu 24.04
17
- - Fedora 39
18
- - Fedora 40
19
-
20
- **Tests:**
21
- 1. **Distribution Detection**
22
- - Verifies correct detection of distribution type (Debian, RedHat)
23
- - Validates package manager identification (apt, dnf)
24
- - Checks distribution name parsing
25
-
26
- 2. **Package Name Mappings**
27
- - Tests all common package mappings (git, npm, Java, etc.)
28
- - Ensures correct package names for each distribution
29
- - Validates fallback behavior
30
-
31
- 3. **Install Command Generation**
32
- - Tests single and multiple package installation commands
33
- - Verifies correct package manager usage
34
- - Validates sudo requirement handling
35
-
36
- 4. **Git-LFS Setup Detection**
37
- - Tests whether repository setup is needed
38
- - Validates setup command generation
39
- - Checks Debian vs RPM script selection
40
-
41
- 5. **`valdi doctor` Integration**
42
- - Runs the doctor command on each distribution
43
- - Verifies it executes without errors
44
- - Checks distribution-specific fix commands
45
-
46
- 6. **Unit Tests**
47
- - Runs Jasmine unit tests for `linuxDistro` utilities
48
- - Validates ESLint compliance
49
-
50
- **Example Run:**
51
-
52
- ```bash
53
- # Locally test distribution detection (requires Docker)
54
- docker run -it ubuntu:22.04 bash
55
- # Install Node.js, clone repo, run tests
56
-
57
- # Or use act to run GitHub Actions locally
58
- act -j test-distribution-detection -P ubuntu-22.04=ubuntu:22.04
59
- ```
60
-
61
- ### 2. `bzl-changes.yml` - Main CI Pipeline (Updated)
62
-
63
- **Changes:**
64
- - Added `test-cli-linux` job to test CLI on Linux containers
65
- - Updated path triggers to include `npm_modules/cli/src/**`
66
- - Tests run alongside existing Bazel validation
67
-
68
- **Linux Job:**
69
- - Tests CLI on Ubuntu and Fedora
70
- - Validates distribution detection
71
- - Ensures package mappings work correctly
72
-
73
- ### 3. `publish-npm.yml` - NPM Publishing
74
-
75
- **No changes needed** - builds and publishes on Ubuntu, which now benefits from the improved Linux support.
76
-
77
- ## Running Tests Locally
78
-
79
- ### Test Distribution Detection
80
-
81
- ```bash
82
- # On your Linux machine
83
- cd npm_modules/cli
84
- npm install
85
- npm run build
86
-
87
- # Test distribution detection
88
- node -e "
89
- const distro = require('./dist/utils/linuxDistro');
90
- const detected = distro.detectLinuxDistro();
91
- console.log('Detected:', detected);
92
- "
93
-
94
- # Run unit tests
95
- npx jasmine dist/utils/linuxDistro.spec.js
96
- ```
97
-
98
- ### Test on Multiple Distributions (Docker)
99
-
100
- ```bash
101
- # Ubuntu 22.04
102
- docker run --rm -v $(pwd):/workspace -w /workspace node:22-slim bash -c "
103
- apt-get update && apt-get install -y git
104
- cd npm_modules/cli
105
- npm install && npm run build
106
- node -e \"const d = require('./dist/utils/linuxDistro'); console.log(d.detectLinuxDistro())\"
107
- "
108
-
109
- # Fedora 39
110
- docker run --rm -v $(pwd):/workspace -w /workspace node:22-slim bash -c "
111
- dnf install -y git
112
- cd npm_modules/cli
113
- npm install && npm run build
114
- node -e \"const d = require('./dist/utils/linuxDistro'); console.log(d.detectLinuxDistro())\"
115
- "
116
- ```
117
-
118
- ## CI Badge
119
-
120
- Add this to your README to show CI status:
121
-
122
- ```markdown
123
- ![Test CLI on Linux](https://github.com/Snapchat/Valdi/actions/workflows/test-cli-linux.yml/badge.svg)
124
- ```
125
-
126
- ## Troubleshooting CI Failures
127
-
128
- ### Distribution detection fails
129
- - Check `/etc/os-release` file exists in container
130
- - Verify `ID` and `ID_LIKE` fields are present
131
- - Check package manager is in PATH
132
-
133
- ### Package mappings incorrect
134
- - Update `getCommonPackageMappings()` in `src/utils/linuxDistro.ts`
135
- - Add distribution-specific package names
136
- - Update unit tests to match
137
-
138
- ### `valdi doctor` fails
139
- - Check if missing dependencies are expected for CI
140
- - Verify error handling works correctly
141
- - Ensure fix commands use correct distribution detection
142
-
143
- ## Adding New Distributions to CI
144
-
145
- To add a new distribution to the test matrix:
146
-
147
- 1. Edit `.github/workflows/test-cli-linux.yml`
148
- 2. Add to the matrix:
149
- ```yaml
150
- - distro: new-distro-name
151
- container: distro:version
152
- expected_type: debian|redhat|arch|suse
153
- expected_pm: apt|dnf|pacman|zypper
154
- expected_name_pattern: "Distro Name"
155
- ```
156
- 3. Ensure the distribution has Node.js 22+ support
157
- 4. Test locally with Docker first
158
-
159
- ## Notes
160
-
161
- - **Arch Linux** and **openSUSE** are not in CI due to container availability/complexity
162
- - CI uses Docker containers for isolation
163
- - Tests are read-only - we don't actually install packages in CI
164
- - Manual testing on physical distributions is still recommended for full coverage
@@ -1,60 +0,0 @@
1
- # Valdi Open Source - Cursor Rules
2
-
3
- ## ⚠️ Open Source Project
4
-
5
- This is an open source project. Never commit secrets, API keys, or proprietary information.
6
-
7
- ## 🚨 CRITICAL: This is NOT React!
8
-
9
- Valdi uses TSX/JSX syntax but is **fundamentally different from React**.
10
-
11
- **Common AI mistakes:**
12
- - ❌ Suggesting `useState`, `useEffect`, `useContext` (don't exist!)
13
- - ❌ Functional components (don't exist!)
14
- - ❌ `this.props` (should be `this.viewModel`)
15
- - ❌ `markNeedsRender()`, `onMount()`, `onUpdate()` (wrong names/don't exist!)
16
-
17
- **Correct Valdi:**
18
- - ✅ `class MyComponent extends StatefulComponent`
19
- - ✅ `state = {}` + `this.setState()`
20
- - ✅ `this.viewModel` for props
21
- - ✅ `onCreate()`, `onViewModelUpdate()`, `onDestroy()` lifecycle
22
-
23
- ## 📁 Context-Specific Rules
24
-
25
- Cursor automatically loads additional rules based on where you're working:
26
-
27
- | Working In | See |
28
- |-----------|-----|
29
- | TypeScript/TSX components | `.cursor/rules/typescript-tsx.md` |
30
- | Swift compiler | `.cursor/rules/compiler.md` |
31
- | C++ runtime | `.cursor/rules/cpp-runtime.md` |
32
- | Android (Kotlin) | `.cursor/rules/android.md` |
33
- | iOS (Objective-C) | `.cursor/rules/ios.md` |
34
- | Bazel files | `.cursor/rules/bazel.md` |
35
- | Tests | `.cursor/rules/testing.md` |
36
-
37
- **→ Check `.cursor/rules/README.md` for the full list**
38
-
39
- ## Quick Commands
40
-
41
- ```bash
42
- bazel build //... # Build everything
43
- bazel test //... # Run all tests
44
- valdi install ios # Build & install iOS app
45
- valdi hotreload # Start hot reload
46
- ```
47
-
48
- ## Exported library / host apps
49
-
50
- When integrating an exported AAR or xcframework into a host app:
51
-
52
- - **Android:** Generated view classes use package **`com.snap.modules.<module_name>`** (e.g. `com.snap.modules.test_test.App`), not `com.snap.valdi.modules`. `System.loadLibrary(...)` must use the exact `valdi_exported_library()` target name (e.g. `test_test_export`).
53
- - **iOS:** Root view class is **`<module_name><RootComponentName>`** where `module_name` is the Valdi **module name** from `valdi_module()` (snake_case, e.g. `test_test` → `test_testApp`), not `ios_bundle_name`. For export use **`--library test_test_export_ios`** (platform-suffixed target). Embed the xcframework into the app's **Frameworks** folder (Embed Frameworks phase → destination **Frameworks**, not PlugIns), or the app crashes at launch with "Library not loaded: @rpath/...framework/...".
54
-
55
- ## More Information
56
-
57
- - **Comprehensive guide**: `/AGENTS.md` (621 lines)
58
- - **AI tooling**: `/docs/docs/ai-tooling.md`
59
- - **Support**: `/SUPPORT.md`
60
- - **Discord**: https://discord.gg/uJyNEeYX2U
package/.prettierignore DELETED
@@ -1,2 +0,0 @@
1
- node_modules
2
- .vscode
package/.prettierrc.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "printWidth": 120,
3
- "singleQuote": true,
4
- "trailingComma": "all",
5
- "arrowParens": "avoid",
6
- "tabWidth": 2
7
- }
@@ -1,248 +0,0 @@
1
- # Linux Distribution Compatibility
2
-
3
- This document describes how the Valdi CLI handles different Linux distributions.
4
-
5
- ## Overview
6
-
7
- The Valdi CLI (`valdi doctor` and `valdi dev_setup` commands) now supports multiple Linux distributions beyond just Debian/Ubuntu. The CLI automatically detects your distribution and uses the appropriate package manager and package names.
8
-
9
- ## Supported Distributions
10
-
11
- ### Tier 1 Support (Fully Tested)
12
- - **Debian-based**: Debian, Ubuntu, Linux Mint, Pop!_OS, etc.
13
- - Package manager: `apt`
14
- - Tested on: Ubuntu 22.04, Debian 12
15
-
16
- ### Tier 2 Support (Community Tested)
17
- - **Red Hat-based**: Fedora, RHEL, CentOS, Rocky Linux, AlmaLinux
18
- - Package manager: `dnf` or `yum`
19
- - Notes: Some packages (like watchman) may require EPEL repository
20
-
21
- - **Arch-based**: Arch Linux, Manjaro, EndeavourOS
22
- - Package manager: `pacman`
23
- - Notes: Some packages may be in AUR
24
-
25
- - **SUSE-based**: openSUSE, SLES
26
- - Package manager: `zypper`
27
-
28
- ## How Distribution Detection Works
29
-
30
- The CLI detects your distribution using the following methods (in order):
31
-
32
- 1. **`/etc/os-release`**: Reads the standard Linux distribution information file
33
- - Uses `ID` and `ID_LIKE` fields to determine distribution family
34
- - Extracts distribution name and version
35
-
36
- 2. **Package Manager Detection**: Falls back to detecting available package managers
37
- - Checks for `apt-get`, `dnf`, `yum`, `pacman`, or `zypper`
38
-
39
- 3. **Unknown Distributions**: If detection fails, provides manual installation instructions
40
-
41
- ## Package Mappings
42
-
43
- Different distributions use different package names for the same software. The CLI includes mappings for common dependencies:
44
-
45
- | Dependency | Debian/Ubuntu | Red Hat/Fedora | Arch Linux | openSUSE |
46
- |------------|---------------|----------------|------------|----------|
47
- | Java 17 JDK | `openjdk-17-jdk` | `java-17-openjdk-devel` | `jdk17-openjdk` | `java-17-openjdk-devel` |
48
- | Android Debug Bridge | `adb` | `android-tools` | `android-tools` | `android-tools` |
49
- | Fontconfig Dev | `libfontconfig1-dev` | `fontconfig-devel` | `fontconfig` | `fontconfig-devel` |
50
- | Zlib Dev | `zlib1g-dev` | `zlib-devel` | `zlib` | `zlib-devel` |
51
- | Git LFS | `git-lfs` | `git-lfs` | `git-lfs` | `git-lfs` |
52
- | Watchman | `watchman` | `watchman` | `watchman` | `watchman` |
53
-
54
- ## Commands
55
-
56
- ### `valdi dev_setup`
57
-
58
- The `dev_setup` command automatically installs required dependencies for your distribution:
59
-
60
- ```bash
61
- valdi dev_setup
62
- ```
63
-
64
- **What it does:**
65
- 1. Detects your Linux distribution
66
- 2. Installs the following dependencies:
67
- - Node.js/npm (if not installed)
68
- - Java 17 JDK
69
- - Git LFS
70
- - Watchman (for hot reload)
71
- - Android Debug Bridge (adb)
72
- - Development libraries (fontconfig, zlib)
73
- - Additional distribution-specific packages
74
- 3. Downloads and installs Bazelisk
75
- 4. Sets up Android SDK with command-line tools
76
- 5. Configures environment variables in your shell RC file
77
-
78
- **Distribution-specific behavior:**
79
-
80
- - **Debian/Ubuntu**:
81
- - Sets up packagecloud repository for git-lfs
82
- - Installs `libtinfo5` for Android command-line tools compatibility
83
-
84
- - **Red Hat/Fedora**:
85
- - Sets up packagecloud RPM repository for git-lfs
86
- - Installs `ncurses-compat-libs` for Android tools
87
- - Shows warning if EPEL repository is needed for watchman
88
-
89
- - **Arch Linux**:
90
- - Uses standard repositories (most packages available)
91
- - May require AUR helper for some packages
92
-
93
- - **openSUSE**:
94
- - Uses zypper to install packages
95
-
96
- ### `valdi doctor`
97
-
98
- The `doctor` command checks your development environment and provides distribution-specific fix commands:
99
-
100
- ```bash
101
- valdi doctor
102
- ```
103
-
104
- **Features:**
105
- - Detects your distribution automatically
106
- - Provides correct package manager commands for your distribution
107
- - Shows distribution-specific warnings (e.g., EPEL repository for RHEL)
108
- - Validates all required tools are installed
109
-
110
- **Example output on Fedora:**
111
-
112
- ```
113
- Running Valdi environment diagnostics...
114
- Detected distribution: Fedora Linux (dnf)
115
-
116
- ✓ Node.js installation
117
- ✗ Java installation
118
- • Java not found in PATH
119
- Fix: sudo dnf install java-17-openjdk-devel
120
- ```
121
-
122
- ## Troubleshooting
123
-
124
- ### Watchman on Red Hat/Fedora
125
-
126
- Watchman may not be available in the default repositories. Enable EPEL:
127
-
128
- ```bash
129
- # Fedora
130
- sudo dnf install epel-release
131
-
132
- # RHEL/CentOS
133
- sudo yum install epel-release
134
- ```
135
-
136
- Then install watchman:
137
-
138
- ```bash
139
- sudo dnf install watchman
140
- # or
141
- sudo yum install watchman
142
- ```
143
-
144
- ### Packages in AUR (Arch Linux)
145
-
146
- Some packages may only be available in the AUR. Use an AUR helper like `yay` or `paru`:
147
-
148
- ```bash
149
- yay -S watchman
150
- ```
151
-
152
- ### Unknown Distribution
153
-
154
- If your distribution is not automatically detected, you'll see:
155
-
156
- ```
157
- Unable to detect Linux distribution.
158
- Please manually install the following dependencies and re-run this command:
159
- - git
160
- - git-lfs
161
- - npm (Node.js)
162
- - openjdk-17-jdk (or equivalent Java 17 JDK)
163
- - watchman
164
- - adb (Android Debug Bridge)
165
- - fontconfig development libraries
166
- - zlib development libraries
167
- ```
168
-
169
- Consult your distribution's package manager documentation for the correct package names.
170
-
171
- ### Distribution Detection Issues
172
-
173
- If distribution detection fails or provides incorrect results:
174
-
175
- 1. Check that `/etc/os-release` exists and is readable:
176
- ```bash
177
- cat /etc/os-release
178
- ```
179
-
180
- 2. Verify your package manager is in PATH:
181
- ```bash
182
- which apt-get # or dnf, yum, pacman, zypper
183
- ```
184
-
185
- 3. Report the issue with your distribution details:
186
- - Distribution name and version
187
- - Output of `cat /etc/os-release`
188
- - Available package manager
189
-
190
- ## Contributing
191
-
192
- To add support for a new distribution:
193
-
194
- 1. Add package mappings in `src/utils/linuxDistro.ts`:
195
- ```typescript
196
- // In getCommonPackageMappings()
197
- 'your-package': {
198
- debian: 'debian-package-name',
199
- redhat: 'redhat-package-name',
200
- arch: 'arch-package-name',
201
- suse: 'suse-package-name',
202
- fallback: 'generic-package-name',
203
- }
204
- ```
205
-
206
- 2. Add distribution detection logic in `detectLinuxDistro()` if needed
207
-
208
- 3. Test on the target distribution:
209
- ```bash
210
- valdi dev_setup
211
- valdi doctor
212
- ```
213
-
214
- 4. Update this documentation with your findings
215
-
216
- ## Technical Details
217
-
218
- ### Files Modified
219
- - `src/utils/linuxDistro.ts` - Distribution detection and package mapping utilities
220
- - `src/setup/linuxSetup.ts` - Linux-specific dev_setup implementation
221
- - `src/commands/doctor.ts` - Environment diagnostics with distribution-aware fix commands
222
-
223
- ### Distribution Detection API
224
-
225
- ```typescript
226
- import { detectLinuxDistro, buildInstallCommand, getPackageName } from './utils/linuxDistro';
227
-
228
- // Detect distribution
229
- const distro = detectLinuxDistro();
230
- console.log(distro.name); // e.g., "Ubuntu"
231
- console.log(distro.type); // e.g., LinuxDistroType.DEBIAN
232
- console.log(distro.packageManager.name); // e.g., "apt"
233
-
234
- // Build install command
235
- const cmd = buildInstallCommand(['git', 'npm', 'watchman'], distro);
236
- console.log(cmd); // e.g., "sudo apt-get install git npm watchman"
237
-
238
- // Get package name for current distribution
239
- const packageMappings = getCommonPackageMappings();
240
- const javaPackage = getPackageName(packageMappings['openjdk-17'], distro);
241
- console.log(javaPackage); // e.g., "openjdk-17-jdk" on Ubuntu
242
- ```
243
-
244
- ## See Also
245
-
246
- - [Valdi Installation Guide](https://github.com/Snapchat/Valdi/blob/main/docs/INSTALL.md)
247
- - [Development Setup Guide](https://github.com/Snapchat/Valdi/blob/main/docs/DEV_SETUP.md)
248
- - [Contributing Guidelines](https://github.com/Snapchat/Valdi/blob/main/CONTRIBUTING.md)
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- trailingComma: 'all',
3
- arrowParens: 'avoid',
4
- };
@@ -1,44 +0,0 @@
1
- #!/bin/bash
2
- # Sync AGENTS.md content between root and bootstrap templates
3
- # This script extracts common sections from the root AGENTS.md and updates bootstrap templates
4
-
5
- set -e
6
-
7
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
- CLI_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
9
- OPEN_SOURCE_ROOT="$(cd "$CLI_ROOT/../.." && pwd)"
10
-
11
- ROOT_AGENTS="$OPEN_SOURCE_ROOT/AGENTS.md"
12
- UI_AGENTS_TEMPLATE="$CLI_ROOT/.bootstrap/apps/ui_application/AGENTS.md.template"
13
- CLI_AGENTS_TEMPLATE="$CLI_ROOT/.bootstrap/apps/cli_application/AGENTS.md.template"
14
-
15
- echo "Syncing AGENTS.md patterns from root to bootstrap templates..."
16
- echo "Root AGENTS.md: $ROOT_AGENTS"
17
- echo "UI Template: $UI_AGENTS_TEMPLATE"
18
- echo "CLI Template: $CLI_AGENTS_TEMPLATE"
19
-
20
- # Extract the Anti-Hallucination section from root AGENTS.md
21
- # This ensures patterns stay consistent
22
- ANTI_HALLUCINATION_START="## 🚨 AI Anti-Hallucination: This is NOT React!"
23
- ANTI_HALLUCINATION_END="## Directory Structure"
24
-
25
- # For now, just validate that the files exist
26
- if [ ! -f "$ROOT_AGENTS" ]; then
27
- echo "Error: Root AGENTS.md not found at $ROOT_AGENTS"
28
- exit 1
29
- fi
30
-
31
- if [ ! -f "$UI_AGENTS_TEMPLATE" ]; then
32
- echo "Error: UI AGENTS.md template not found at $UI_AGENTS_TEMPLATE"
33
- exit 1
34
- fi
35
-
36
- if [ ! -f "$CLI_AGENTS_TEMPLATE" ]; then
37
- echo "Error: CLI AGENTS.md template not found at $CLI_AGENTS_TEMPLATE"
38
- exit 1
39
- fi
40
-
41
- echo "✅ All AGENTS.md files found"
42
- echo ""
43
- echo "Note: This script currently validates file existence."
44
- echo "To fully implement sync, run: npm run update-agents-templates"