@snap/valdi 1.0.6 → 1.0.8

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 (161) hide show
  1. package/README.md +22 -10
  2. package/bundled-skills/CONTRIBUTING_SKILLS.md +74 -0
  3. package/bundled-skills/registry.json +20 -0
  4. package/bundled-skills/skills/valdi-android/skill.md +89 -0
  5. package/bundled-skills/skills/valdi-async/skill.md +246 -0
  6. package/bundled-skills/skills/valdi-async/tests/BUILD.bazel +19 -0
  7. package/bundled-skills/skills/valdi-async/tests/README.md +25 -0
  8. package/bundled-skills/skills/valdi-async/tests/src/reference.tsx +210 -0
  9. package/bundled-skills/skills/valdi-async/tests/tsconfig.json +1 -0
  10. package/bundled-skills/skills/valdi-bazel/skill.md +122 -0
  11. package/bundled-skills/skills/valdi-compiler/skill.md +108 -0
  12. package/bundled-skills/skills/valdi-component-tests/skill.md +430 -0
  13. package/bundled-skills/skills/valdi-component-tests/tests/BUILD.bazel +24 -0
  14. package/bundled-skills/skills/valdi-component-tests/tests/README.md +35 -0
  15. package/bundled-skills/skills/valdi-component-tests/tests/src/ProfileCard.tsx +38 -0
  16. package/bundled-skills/skills/valdi-component-tests/tests/test/ProfileCardTest.spec.tsx +107 -0
  17. package/bundled-skills/skills/valdi-component-tests/tests/tsconfig.json +1 -0
  18. package/bundled-skills/skills/valdi-cpp-runtime/skill.md +103 -0
  19. package/bundled-skills/skills/valdi-custom-view/skill.md +62 -0
  20. package/bundled-skills/skills/valdi-ios/skill.md +93 -0
  21. package/bundled-skills/skills/valdi-migrate/skill.md +175 -0
  22. package/bundled-skills/skills/valdi-migrate/tests/BUILD.bazel +23 -0
  23. package/bundled-skills/skills/valdi-migrate/tests/README.md +70 -0
  24. package/bundled-skills/skills/valdi-migrate/tests/check_antipatterns.py +89 -0
  25. package/bundled-skills/skills/valdi-migrate/tests/compose_example.kt +94 -0
  26. package/bundled-skills/skills/valdi-migrate/tests/flutter_example.dart +129 -0
  27. package/bundled-skills/skills/valdi-migrate/tests/react_example.tsx +98 -0
  28. package/bundled-skills/skills/valdi-migrate/tests/src/expected_valdi.tsx +267 -0
  29. package/bundled-skills/skills/valdi-migrate/tests/tsconfig.json +3 -0
  30. package/{.metadata/.cursorrules.template → bundled-skills/skills/valdi-overview/skill.md} +23 -13
  31. package/bundled-skills/skills/valdi-perf/skill.md +197 -0
  32. package/bundled-skills/skills/valdi-perf/tests/BUILD.bazel +19 -0
  33. package/bundled-skills/skills/valdi-perf/tests/README.md +26 -0
  34. package/bundled-skills/skills/valdi-perf/tests/src/reference.tsx +202 -0
  35. package/bundled-skills/skills/valdi-perf/tests/tsconfig.json +1 -0
  36. package/bundled-skills/skills/valdi-polyglot-module/skill.md +85 -0
  37. package/bundled-skills/skills/valdi-setup/skill.md +129 -0
  38. package/bundled-skills/skills/valdi-testing/skill.md +65 -0
  39. package/bundled-skills/skills/valdi-tsx/skill.md +385 -0
  40. package/bundled-skills/skills/valdi-tsx/tests/BUILD.bazel +19 -0
  41. package/bundled-skills/skills/valdi-tsx/tests/README.md +29 -0
  42. package/bundled-skills/skills/valdi-tsx/tests/src/reference.tsx +173 -0
  43. package/bundled-skills/skills/valdi-tsx/tests/tsconfig.json +1 -0
  44. package/dist/commands/bootstrap.js +3 -9
  45. package/dist/commands/newModule.js +10 -14
  46. package/dist/commands/skills.js +16 -0
  47. package/dist/commands/skills_commands/create.js +125 -0
  48. package/dist/commands/skills_commands/install.js +96 -0
  49. package/dist/commands/skills_commands/list.js +83 -0
  50. package/dist/commands/skills_commands/remove.js +41 -0
  51. package/dist/commands/skills_commands/update.js +59 -0
  52. package/dist/core/constants.js +1 -1
  53. package/dist/index.js +5 -0
  54. package/dist/setup/versions.js +1 -1
  55. package/dist/utils/skillsAdapters.js +140 -0
  56. package/dist/utils/skillsRegistry.js +40 -0
  57. package/package.json +6 -1
  58. package/.bazelignore +0 -2
  59. package/.bootstrap/apps/cli_application/AGENTS.md.template +0 -291
  60. package/.bootstrap/apps/cli_application/BUILD.bazel.template +0 -7
  61. package/.bootstrap/apps/cli_application/modules/{{MODULE_NAME}}/BUILD.bazel.template +0 -11
  62. package/.bootstrap/apps/cli_application/modules/{{MODULE_NAME}}/src/index.ts +0 -1
  63. package/.bootstrap/apps/ui_application/.eslint.rc +0 -27
  64. package/.bootstrap/apps/ui_application/AGENTS.md.template +0 -278
  65. package/.bootstrap/apps/ui_application/BUILD.bazel.template +0 -19
  66. package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/BUILD.bazel.template +0 -21
  67. package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/res/valdi@3x.png +0 -0
  68. package/.bootstrap/apps/ui_application/modules/{{MODULE_NAME}}/src/App.tsx +0 -133
  69. package/.bootstrap/apps/ui_application/package.json +0 -24
  70. package/.bootstrap/modules/cpp_bridge_module/BUILD.bazel.template +0 -21
  71. package/.bootstrap/modules/cpp_bridge_module/cpp/CalculatorModuleFactory.cpp.template +0 -28
  72. package/.bootstrap/modules/cpp_bridge_module/src/Calculator.d.ts +0 -4
  73. package/.bootstrap/modules/ios_android_bridge_module/BUILD.bazel.template +0 -39
  74. package/.bootstrap/modules/ios_android_bridge_module/android/CalculatorModuleFactory.kt.template +0 -18
  75. package/.bootstrap/modules/ios_android_bridge_module/ios/SCCCalculatorModuleFactory.m.template +0 -31
  76. package/.bootstrap/modules/ios_android_bridge_module/src/Calculator.d.ts +0 -4
  77. package/.bootstrap/modules/ios_android_view_module/BUILD.bazel.template +0 -41
  78. package/.bootstrap/modules/ios_android_view_module/android/CircleView.kt.template +0 -42
  79. package/.bootstrap/modules/ios_android_view_module/android/CircleViewAttributesBinder.kt.template +0 -60
  80. package/.bootstrap/modules/ios_android_view_module/ios/SCCCircleView.h +0 -6
  81. package/.bootstrap/modules/ios_android_view_module/ios/SCCCircleView.m +0 -82
  82. package/.bootstrap/modules/ios_android_view_module/src/Circle.tsx.template +0 -15
  83. package/.bootstrap/modules/ui_component/BUILD.bazel.template +0 -34
  84. package/.bootstrap/modules/ui_component/src/NewModuleComponent.tsx +0 -45
  85. package/.config/copyconfig.json +0 -10
  86. package/.editorconfig +0 -21
  87. package/.eslintignore +0 -1
  88. package/.eslintrc.js +0 -72
  89. package/.github/README.md +0 -164
  90. package/.metadata/.bazelrc.template +0 -91
  91. package/.metadata/.bazelversion.template +0 -1
  92. package/.metadata/.editorconfig.template +0 -37
  93. package/.metadata/.eslintrc.js.template +0 -27
  94. package/.metadata/.gitignore.template +0 -4
  95. package/.metadata/.prettierrc.json.template +0 -7
  96. package/.metadata/.watchmanconfig.template +0 -8
  97. package/.metadata/README.md.template +0 -31
  98. package/.metadata/WORKSPACE.template +0 -57
  99. package/.metadata/config.yaml.template +0 -1
  100. package/.metadata/package.json.template +0 -23
  101. package/.prettierignore +0 -2
  102. package/.prettierrc.json +0 -7
  103. package/LINUX_COMPATIBILITY.md +0 -248
  104. package/prettier.config.js +0 -4
  105. package/scripts/sync-agents-md.sh +0 -44
  106. package/scripts/update-agents-templates.ts +0 -170
  107. package/spec/support/jasmine.json +0 -6
  108. package/src/commands/bootstrap.ts +0 -409
  109. package/src/commands/build.ts +0 -89
  110. package/src/commands/devSetup.ts +0 -17
  111. package/src/commands/doctor.ts +0 -1832
  112. package/src/commands/export.ts +0 -131
  113. package/src/commands/hotreload.ts +0 -108
  114. package/src/commands/install.ts +0 -93
  115. package/src/commands/lint.ts +0 -15
  116. package/src/commands/lint_commands/lintCheck.ts +0 -53
  117. package/src/commands/lint_commands/lintFormat.ts +0 -49
  118. package/src/commands/log.ts +0 -108
  119. package/src/commands/newModule.ts +0 -286
  120. package/src/commands/package.ts +0 -102
  121. package/src/commands/projectsync.ts +0 -488
  122. package/src/commands/test.ts +0 -68
  123. package/src/core/constants.ts +0 -97
  124. package/src/core/errors.ts +0 -10
  125. package/src/index.ts +0 -22
  126. package/src/setup/DevSetupHelper.ts +0 -290
  127. package/src/setup/linuxSetup.ts +0 -261
  128. package/src/setup/macOSSetup.ts +0 -156
  129. package/src/setup/setupEntryPoint.ts +0 -64
  130. package/src/setup/versions.ts +0 -8
  131. package/src/utils/ArgumentsResolver.ts +0 -23
  132. package/src/utils/BazelClient.ts +0 -285
  133. package/src/utils/Digraph.ts +0 -81
  134. package/src/utils/LoadingIndicator.ts +0 -43
  135. package/src/utils/applicationUtils.ts +0 -276
  136. package/src/utils/buildInfo.ts +0 -99
  137. package/src/utils/byString.ts +0 -3
  138. package/src/utils/cliUtils.ts +0 -112
  139. package/src/utils/copyBootstrapFiles.ts +0 -30
  140. package/src/utils/deviceUtils.ts +0 -76
  141. package/src/utils/errorUtils.ts +0 -63
  142. package/src/utils/fileUtils.ts +0 -257
  143. package/src/utils/githubUtils.ts +0 -102
  144. package/src/utils/jsonUtils.ts +0 -30
  145. package/src/utils/lintUtils.ts +0 -190
  146. package/src/utils/linuxDistro.spec.ts +0 -219
  147. package/src/utils/linuxDistro.ts +0 -326
  148. package/src/utils/logUtils.ts +0 -9
  149. package/src/utils/pathUtils.ts +0 -12
  150. package/src/utils/stringUtils.spec.ts +0 -95
  151. package/src/utils/stringUtils.ts +0 -103
  152. package/src/utils/tempDir.ts +0 -24
  153. package/src/utils/zipUtils.ts +0 -14
  154. package/test/ValdiSmokeTest.ts +0 -279
  155. package/test/helpers/AsyncHelpers.ts +0 -113
  156. package/test/helpers/CommandHelpers.ts +0 -37
  157. package/test/helpers/ProjectHelpers.ts +0 -153
  158. package/test/helpers/StreamHelpers.ts +0 -37
  159. package/test/helpers/TypeScriptClient.ts +0 -217
  160. package/tsconfig.dist.json +0 -8
  161. package/tsconfig.json +0 -42
@@ -1,37 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- charset = utf-8
5
- end_of_line = lf
6
- insert_final_newline = true
7
- trim_trailing_whitespace = true
8
-
9
- [*.{ts,tsx,js,jsx}]
10
- indent_style = space
11
- indent_size = 2
12
-
13
- [*.{cpp,hpp,h,cc}]
14
- indent_style = space
15
- indent_size = 4
16
-
17
- [*.{swift,kt,java}]
18
- indent_style = space
19
- indent_size = 4
20
-
21
- [*.{yml,yaml,json}]
22
- indent_style = space
23
- indent_size = 2
24
-
25
- [*.{bzl,bazel,BUILD}]
26
- indent_style = space
27
- indent_size = 4
28
-
29
- [*.md]
30
- trim_trailing_whitespace = false
31
-
32
- [*.{mm,m}]
33
- indent_style = space
34
- indent_size = 4
35
-
36
- [Makefile]
37
- indent_style = tab
@@ -1,27 +0,0 @@
1
-
2
- module.exports = {
3
- root: true,
4
- parser: '@typescript-eslint/parser',
5
- parserOptions: {
6
- tsconfigRootDir: __dirname,
7
- project: ['./src/valdi/_configs/eslint.tsconfig.json'],
8
- },
9
- plugins: ['@typescript-eslint', 'unused-imports', 'rxjs', 'prettier', '@snapchat/eslint-plugin-valdi'],
10
- extends: [
11
- 'eslint:recommended',
12
- 'plugin:@typescript-eslint/recommended',
13
- 'plugin:import/recommended',
14
- 'plugin:import/typescript',
15
- 'prettier',
16
- ],
17
- rules: {
18
- '@snapchat/valdi/attributed-text-no-array-assignment': 'error',
19
- '@snapchat/valdi/jsx-no-lambda': 'error',
20
- '@snapchat/valdi/assign-timer-id': 'error',
21
- '@snapchat/valdi/only-const-enum': 'off',
22
- '@snapchat/valdi/no-implicit-index-import': 'error',
23
- '@snapchat/valdi/mutate-state-without-set-state': 'error',
24
- '@snapchat/valdi/no-import-from-test-outside-test-dir': 'error',
25
- '@snapchat/valdi/no-declare-test-without-describe': 'error',
26
- },
27
- };
@@ -1,4 +0,0 @@
1
- *.DS_Store
2
-
3
- bazel-*
4
- node_modules
@@ -1,7 +0,0 @@
1
- {
2
- "printWidth": 120,
3
- "singleQuote": true,
4
- "jsxSingleQuote": true,
5
- "arrowParens": "avoid",
6
- "trailingComma": "all"
7
- }
@@ -1,8 +0,0 @@
1
- {
2
- "root_files": [".watchmanconfig"],
3
- "ignore_dirs": [
4
- "bazel-out",
5
- "bazel-bin",
6
- "bazel-testlogs"
7
- ]
8
- }
@@ -1,31 +0,0 @@
1
- # valdi_demo
2
- Demo of a hello world app using Valdi open source
3
-
4
- ## Usage
5
-
6
- All commands requires `valdi` to be available on PATH.
7
-
8
- Get auto completion in VSCode
9
- ```sh
10
- valdi projectsync
11
- ```
12
-
13
- Build and install iOS:
14
- ```sh
15
- valdi install ios
16
- ```
17
-
18
- Build and install Android:
19
- ```sh
20
- valdi install android
21
- ```
22
-
23
- Build and install MacOS:
24
- ```sh
25
- valdi install macos
26
- ```
27
-
28
- Start hot reloader:
29
- ```sh
30
- valdi hotreload
31
- ```
@@ -1,57 +0,0 @@
1
- workspace(name = "{{WORKSPACE_NAME}}")
2
-
3
- load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
4
- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
5
-
6
- {{VALDI_IMPORT}}
7
-
8
- {{VALDI_WIDGETS_IMPORT}}
9
-
10
- load("@valdi//bzl:workspace_prepare.bzl", "valdi_prepare_workspace")
11
-
12
- valdi_prepare_workspace()
13
-
14
- load("@valdi//bzl:workspace_preinit.bzl", "valdi_preinitialize_workspace")
15
-
16
- valdi_preinitialize_workspace()
17
-
18
- load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies", "aspect_bazel_lib_register_toolchains", "register_yq_toolchains")
19
-
20
- register_yq_toolchains()
21
-
22
- # Required bazel-lib dependencies
23
-
24
- aspect_bazel_lib_dependencies()
25
-
26
- # Required rules_shell dependencies
27
- load("@rules_shell//shell:repositories.bzl", "rules_shell_dependencies", "rules_shell_toolchains")
28
-
29
- rules_shell_dependencies()
30
-
31
- rules_shell_toolchains()
32
-
33
- # Register bazel-lib toolchains
34
-
35
- aspect_bazel_lib_register_toolchains()
36
-
37
- # Create the host platform repository transitively required by bazel-lib
38
-
39
- load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
40
- load("@platforms//host:extension.bzl", "host_platform_repo")
41
-
42
- maybe(
43
- host_platform_repo,
44
- name = "host_platform",
45
- )
46
-
47
- load("@valdi//bzl:workspace_init.bzl", "valdi_initialize_workspace")
48
-
49
- valdi_initialize_workspace()
50
-
51
- load("@valdi_npm//:repositories.bzl", "npm_repositories")
52
-
53
- npm_repositories()
54
-
55
- load("@valdi//bzl:workspace_postinit.bzl", "valdi_post_initialize_workspace")
56
-
57
- valdi_post_initialize_workspace()
@@ -1 +0,0 @@
1
- logs_output_dir: ~/.valdi/logs
@@ -1,23 +0,0 @@
1
- {
2
- "name": "hello_world",
3
- "version": "1.0.0",
4
- "description": "Valdi Helloworld app",
5
- "license": "ISC",
6
- "devDependencies": {
7
- "@snap/eslint-plugin-valdi": "1.0.2",
8
- "@types/eslint": "^9.6.1",
9
- "@types/jasmine": "^5.1.7",
10
- "@typescript-eslint/eslint-plugin": "^6.21.0",
11
- "@typescript-eslint/parser": "^6.21.0",
12
- "@typescript-eslint/utils": "^6.21.0",
13
- "eslint": "^8.27.0",
14
- "eslint-config-prettier": "^8.5.0",
15
- "eslint-plugin-import": "^2.26.0",
16
- "eslint-plugin-prettier": "^4.2.1",
17
- "eslint-plugin-rxjs": "^5.0.2",
18
- "eslint-plugin-unused-imports": "^3.2.0",
19
- "jasmine": "^5.6.0",
20
- "ts-node": "^10.9.2",
21
- "typescript": "5.3.3"
22
- }
23
- }
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"
@@ -1,170 +0,0 @@
1
- #!/usr/bin/env ts-node
2
- /**
3
- * Updates AGENTS.md templates in bootstrap directory with correct Valdi patterns
4
- * Ensures consistency with root AGENTS.md anti-hallucination guidelines
5
- */
6
-
7
- import fs from 'fs';
8
- import path from 'path';
9
-
10
- const CLI_ROOT = path.join(__dirname, '..');
11
- const OPEN_SOURCE_ROOT = path.join(CLI_ROOT, '../..');
12
-
13
- // Common Valdi patterns section that should be consistent across all AGENTS.md files
14
- const VALDI_PATTERNS_SECTION = `
15
- ## 🚨 CRITICAL: Valdi is NOT React!
16
-
17
- **AI assistants often suggest React patterns that DON'T EXIST in Valdi.** This is because TSX/JSX syntax looks like React, but Valdi compiles to native code.
18
-
19
- ### ❌ FORBIDDEN Patterns (Don't exist in Valdi)
20
-
21
- \`\`\`typescript
22
- // ❌ WRONG - React hooks don't exist
23
- const [count, setCount] = useState(0);
24
- useEffect(() => { ... }, []);
25
-
26
- // ❌ WRONG - Functional components don't exist
27
- const MyComponent = () => <view />;
28
-
29
- // ❌ WRONG - Common AI mistakes
30
- this.markNeedsRender(); // Doesn't exist!
31
- this.props.title; // Should be: this.viewModel.title
32
- onMount() { } // Should be: onCreate()
33
- onUpdate() { } // Should be: onViewModelUpdate()
34
- onUnmount() { } // Should be: onDestroy()
35
- this.context.get(Service); // Wrong pattern, use withProviders()
36
- \`\`\`
37
-
38
- ### ✅ CORRECT Valdi Patterns
39
-
40
- \`\`\`typescript
41
- // ✅ Stateful component with state
42
- import { StatefulComponent } from 'valdi_core/src/Component';
43
-
44
- class MyComponent extends StatefulComponent<ViewModel, State> {
45
- state = { count: 0 };
46
-
47
- // Lifecycle methods
48
- onCreate() { } // Component created
49
- onViewModelUpdate(prev: ViewModel) { } // Props changed
50
- onDestroy() { } // Before removal
51
-
52
- // State updates
53
- handleClick() {
54
- this.setState({ count: this.state.count + 1 }); // Auto re-renders
55
- }
56
-
57
- // Render (returns void, JSX is statement)
58
- onRender() {
59
- <button
60
- title={\`Count: \${this.state.count}\`}
61
- onPress={this.handleClick}
62
- />;
63
- }
64
- }
65
-
66
- // ✅ Stateless component (props only)
67
- import { Component } from 'valdi_core/src/Component';
68
-
69
- class SimpleComponent extends Component<ViewModel> {
70
- onRender() {
71
- <label value={this.viewModel.title} />; // viewModel, not props!
72
- }
73
- }
74
- \`\`\`
75
-
76
- ### Key Differences from React
77
-
78
- | Concept | React | Valdi |
79
- |---------|-------|-------|
80
- | **Components** | Functions or classes | Classes only (Component or StatefulComponent) |
81
- | **State** | \`useState\` hook | \`state = { }\` + \`setState()\` |
82
- | **Props** | \`this.props\` | \`this.viewModel\` |
83
- | **Lifecycle** | \`useEffect\` | \`onCreate\`, \`onViewModelUpdate\`, \`onDestroy\` |
84
- | **Re-render** | \`setCount(...)\` | \`this.setState(...)\` |
85
- | **Return** | \`return <view />\` | \`<view />;\` (statement, returns void) |
86
-
87
- For complete framework documentation, see: https://github.com/Snapchat/Valdi
88
- `;
89
-
90
- function updateAgentsTemplate(templatePath: string, _isCliApp: boolean) {
91
- console.log(`\nUpdating: ${path.relative(CLI_ROOT, templatePath)}`);
92
-
93
- let content = fs.readFileSync(templatePath, 'utf-8');
94
-
95
- // Fix incorrect lifecycle method comments
96
- content = content.replace(
97
- /\/\/ onMount\(\) - Called when component is first mounted/g,
98
- '// onCreate() - Called when component is first created'
99
- );
100
- content = content.replace(
101
- /\/\/ onUnmount\(\) - Called before component is removed/g,
102
- '// onDestroy() - Called before component is removed'
103
- );
104
- content = content.replace(
105
- /\/\/ onUpdate\(prevProps\) - Called when component updates/g,
106
- '// onViewModelUpdate(previousViewModel) - Called when viewModel updates'
107
- );
108
-
109
- // Find where to insert the patterns section (after Overview, before Project Structure or Development Workflow)
110
- const insertAfter = '## Overview';
111
- const insertIndex = content.indexOf(insertAfter);
112
-
113
- if (insertIndex === -1) {
114
- console.warn(' ⚠️ Could not find Overview section, skipping pattern insertion');
115
- } else {
116
- // Find the end of the Overview section (next ## heading)
117
- const nextHeadingMatch = content.substring(insertIndex + insertAfter.length).match(/\n## /);
118
- if (nextHeadingMatch) {
119
- const insertPosition = insertIndex + insertAfter.length + nextHeadingMatch.index!;
120
-
121
- // Check if patterns section already exists
122
- if (!content.includes('🚨 CRITICAL: Valdi is NOT React!')) {
123
- content =
124
- content.substring(0, insertPosition) +
125
- '\n' +
126
- VALDI_PATTERNS_SECTION +
127
- '\n' +
128
- content.substring(insertPosition);
129
- console.log(' ✅ Added Valdi patterns section');
130
- } else {
131
- console.log(' ℹ️ Patterns section already exists, preserving custom content');
132
- }
133
- }
134
- }
135
-
136
- // Update Provider pattern example if it exists
137
- if (content.includes('import { Provider }')) {
138
- console.log(' ⚠️ Found old Provider pattern, consider updating to withProviders() HOC');
139
- }
140
-
141
- fs.writeFileSync(templatePath, content, 'utf-8');
142
- console.log(' ✅ Template updated');
143
- }
144
-
145
- function main() {
146
- console.log('Updating AGENTS.md bootstrap templates with correct Valdi patterns...\n');
147
-
148
- const uiTemplate = path.join(CLI_ROOT, '.bootstrap/apps/ui_application/AGENTS.md.template');
149
- const cliTemplate = path.join(CLI_ROOT, '.bootstrap/apps/cli_application/AGENTS.md.template');
150
-
151
- if (fs.existsSync(uiTemplate)) {
152
- updateAgentsTemplate(uiTemplate, false);
153
- } else {
154
- console.warn(`UI template not found: ${uiTemplate}`);
155
- }
156
-
157
- if (fs.existsSync(cliTemplate)) {
158
- updateAgentsTemplate(cliTemplate, true);
159
- } else {
160
- console.warn(`CLI template not found: ${cliTemplate}`);
161
- }
162
-
163
- console.log('\n✅ All templates updated!');
164
- console.log('\nNext steps:');
165
- console.log(' 1. Review the changes in the templates');
166
- console.log(' 2. Test with: valdi bootstrap (in a test directory)');
167
- console.log(' 3. Commit the updated templates');
168
- }
169
-
170
- main();