@snap/valdi 1.1.7 → 1.2.1

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 (96) hide show
  1. package/.metadata/.bazelrc.template +9 -7
  2. package/.metadata/AGENTS.md.template +7 -0
  3. package/.metadata/MODULE.bazel.template +47 -3
  4. package/.metadata/README.md.template +2 -2
  5. package/.metadata/bzl/patches/rules_python/1.9.0/BUILD.bazel.template +1 -0
  6. package/.metadata/bzl/patches/rules_python/1.9.0/remove_setuptools_spaces.patch.template +96 -0
  7. package/.metadata/skill-tests-README.md.template +1 -1
  8. package/README.md +47 -14
  9. package/bundled-skills/registry.json +2 -1
  10. package/bundled-skills/skills/valdi-animations/skill.md +49 -0
  11. package/bundled-skills/skills/valdi-async/skill.md +3 -2
  12. package/bundled-skills/skills/valdi-async/tests/README.md +1 -1
  13. package/bundled-skills/skills/valdi-bazel/skill.md +2 -6
  14. package/bundled-skills/skills/valdi-component-tests/tests/README.md +1 -1
  15. package/bundled-skills/skills/valdi-cpp-runtime/skill.md +18 -0
  16. package/bundled-skills/skills/valdi-custom-view/skill.md +1 -1
  17. package/bundled-skills/skills/valdi-error-handling/skill.md +1 -1
  18. package/bundled-skills/skills/valdi-gestures/skill.md +3 -3
  19. package/bundled-skills/skills/valdi-migrate/skill.md +2 -1
  20. package/bundled-skills/skills/valdi-migrate/tests/README.md +2 -2
  21. package/bundled-skills/skills/valdi-mock-breakdown/skill.md +4 -4
  22. package/bundled-skills/skills/valdi-mock-to-module/skill.md +9 -6
  23. package/bundled-skills/skills/valdi-overview/skill.md +2 -1
  24. package/bundled-skills/skills/valdi-perf/skill.md +121 -5
  25. package/bundled-skills/skills/valdi-perf/tests/README.md +1 -1
  26. package/bundled-skills/skills/valdi-pr-review/skill.md +189 -0
  27. package/bundled-skills/skills/valdi-profile/skill.md +5 -3
  28. package/bundled-skills/skills/valdi-setup/skill.md +3 -6
  29. package/bundled-skills/skills/valdi-testing/skill.md +1 -1
  30. package/bundled-skills/skills/valdi-tsx/skill.md +47 -11
  31. package/bundled-skills/skills/valdi-tsx/tests/README.md +1 -1
  32. package/debugger/README.md +356 -0
  33. package/debugger/debugger-actions.js +373 -0
  34. package/debugger/debugger-api.js +225 -0
  35. package/debugger/debugger-bootstrap.js +295 -0
  36. package/debugger/debugger-model.js +790 -0
  37. package/debugger/debugger-performance.js +573 -0
  38. package/debugger/debugger-preview-html.js +676 -0
  39. package/debugger/debugger-providers.js +389 -0
  40. package/debugger/debugger-render.js +529 -0
  41. package/debugger/debugger-runtime.js +387 -0
  42. package/debugger/debugger-session.js +188 -0
  43. package/debugger/debugger-settings.js +209 -0
  44. package/debugger/debugger-state.js +221 -0
  45. package/debugger/debugger-tree-model.js +539 -0
  46. package/debugger/debugger.css +1865 -0
  47. package/debugger/devtools-panel.css +1318 -0
  48. package/debugger/devtools-panel.html +273 -0
  49. package/debugger/devtools-panel.js +3329 -0
  50. package/debugger/index.html +279 -0
  51. package/dist/commands/bootstrap.js +7 -6
  52. package/dist/commands/build.js +7 -1
  53. package/dist/commands/debugger.js +163 -0
  54. package/dist/commands/doctor.js +3 -62
  55. package/dist/commands/export.js +47 -16
  56. package/dist/commands/hotreload.js +247 -27
  57. package/dist/commands/inspect.js +5 -2
  58. package/dist/commands/inspect_commands/input.js +176 -0
  59. package/dist/commands/inspect_commands/snapshot.js +1 -1
  60. package/dist/commands/inspect_commands/tree.js +1 -1
  61. package/dist/commands/install.js +79 -2
  62. package/dist/commands/projectsync.js +15 -0
  63. package/dist/commands/webHotreload.js +31 -0
  64. package/dist/core/constants.js +34 -7
  65. package/dist/debugger/chromiumConsole.js +279 -0
  66. package/dist/debugger/inputClient.js +473 -0
  67. package/dist/debugger/server.js +3801 -0
  68. package/dist/debugger/targetRegistry.js +436 -0
  69. package/dist/debugger/webPreviewPerformance.js +864 -0
  70. package/dist/index.js +0 -0
  71. package/dist/utils/BazelClient.js +34 -5
  72. package/dist/utils/applicationUtils.js +20 -2
  73. package/dist/utils/buildInfo.js +5 -1
  74. package/dist/utils/chromiumDevToolsClient.js +350 -0
  75. package/dist/utils/cliUtils.js +2 -2
  76. package/dist/utils/daemonClient.js +364 -44
  77. package/dist/utils/directorySync.js +153 -0
  78. package/dist/utils/githubUtils.js +1 -1
  79. package/dist/utils/hermesClient.js +82 -176
  80. package/dist/utils/loopbackHost.js +14 -0
  81. package/dist/utils/owlCdpClient.js +282 -0
  82. package/dist/utils/owlDevToolsExtension.js +142 -0
  83. package/dist/utils/processUtils.js +14 -0
  84. package/dist/utils/stringUtils.js +13 -1
  85. package/dist/utils/webApplicationSession.js +58 -0
  86. package/dist/utils/webHotReloadSession.js +212 -0
  87. package/dist/utils/webServerUtils.js +195 -0
  88. package/dist/utils/zipUtils.js +20 -2
  89. package/package.json +4 -2
  90. package/dist/commands/inspect_commands/snapshot.spec.js +0 -105
  91. package/dist/core/packageFiles.spec.js +0 -29
  92. package/dist/preview/previewGenerator.spec.js +0 -203
  93. package/dist/preview/viewModelParser.spec.js +0 -171
  94. package/dist/utils/linuxDistro.spec.js +0 -122
  95. package/dist/utils/skillsAdapters.spec.js +0 -141
  96. package/dist/utils/stringUtils.spec.js +0 -81
@@ -2,7 +2,6 @@
2
2
  common --registry=https://raw.githubusercontent.com/Snapchat/Valdi/{{VALDI_RELEASE_TAG}}/registry
3
3
  common --registry=https://bcr.bazel.build
4
4
 
5
- common --bes_instance_name=client
6
5
  common --enable_platform_specific_config
7
6
 
8
7
  # Disable workers for repo fetching to prevent OOM
@@ -35,13 +34,12 @@ build --host_cxxopt=-Wno-nullability-extension
35
34
  ## we need to disable this due to a bug in bazel
36
35
  ## see https://github.com/bazelbuild/bazel/issues/12381
37
36
  build --incompatible_use_specific_tool_files=false
38
- build --incompatible_enable_cc_toolchain_resolution
39
37
 
40
38
  # iOS and Apple cc changes and hacks
41
39
  ## For Objective-C source files
42
40
  build --per_file_copt=.*\.mm\$@-std=c++20
43
41
  build --host_per_file_copt=.*\.mm\$@-std=c++20
44
- build --ios_minimum_os=12.0
42
+ build --ios_minimum_os=15.0
45
43
 
46
44
  ## TODO: (dchapp) this is currently needed otherwise -O0 and -DDEBUG=1 get passed to compilations of .mm/.m for production flavor builds
47
45
  build --experimental_objc_fastbuild_options=""
@@ -75,13 +73,17 @@ build:macos --spawn_strategy=local
75
73
  build:linux --sandbox_writable_path=/var/tmp
76
74
 
77
75
  # Disable disk cache to save disk space
78
- # https://docs.google.com/document/d/1N8W_M83n9jhMi7pgUhXuEuxypb3dmlHBu_CG_eXipXI/edit?usp=sharing
79
76
  build --disk_cache=""
80
77
 
81
78
  # common build configuration
82
- build --experimental_generate_json_trace_profile
83
- # enable grpc log
84
- build --remote_grpc_log=/tmp/snap_client_grpc.log
79
+ build --generate_json_trace_profile
80
+
81
+ # Alternating a Valdi test target and a web/npm target trims test-only options
82
+ # differently, so their exec tool configs collide under one output path and
83
+ # recompile thousands of shared tool actions. Opt-in config that the `valdi`
84
+ # CLI passes to its build/test flows so they converge; raw `bazel` keeps the
85
+ # default. Changing test flags (e.g. --test_output) repopulates it once.
86
+ build:stable_exec --notrim_test_configuration
85
87
  build --experimental_reuse_sandbox_directories
86
88
 
87
89
  # Default JS engine
@@ -13,4 +13,11 @@ valdi skills install # installs skills for Claude Code, Cursor, or Copi
13
13
 
14
14
  Skills are bundled in the npm package and work offline. They cover component patterns, lifecycle, async handling, build rules, testing, and platform bridging.
15
15
 
16
+ ## Security: Handling Credentials
17
+
18
+ 1. **Never print credential files or secrets.** When diagnosing setup, install, or registry problems, do not `cat`, `head`, `grep`, or otherwise echo `~/.npmrc`, `~/.netrc`, `~/.gitconfig` credential sections, `~/.docker/config.json`, Bazel credential helpers, `.env` files, or environment variables that may hold tokens. Tool output ends up in transcripts and logs.
19
+ 2. **Read only the setting you need, by key.** For example `npm config get registry` (never `npm config list`, which can include auth values) or `git config --get remote.origin.url`.
20
+ 3. **If you must inspect such a file, redact first** and print key names only, e.g. `sed -E 's/(_authToken|_auth|_password|password|token)[[:space:]]*=.*/\1=<redacted>/' ~/.npmrc`.
21
+ 4. **If a secret is exposed anyway, say so plainly** so the user can rotate it.
22
+
16
23
  For documentation and support: https://github.com/Snapchat/Valdi
@@ -36,9 +36,6 @@ archive_override(module_name = "rules_hdrs", urls = [VALDI_URL], strip_prefix =
36
36
  bazel_dep(name = "valdi_toolchain")
37
37
  archive_override(module_name = "valdi_toolchain", urls = [VALDI_URL], strip_prefix = VALDI_PREFIX + "/bin")
38
38
 
39
- bazel_dep(name = "resvg_libs")
40
- archive_override(module_name = "resvg_libs", urls = [VALDI_URL], strip_prefix = VALDI_PREFIX + "/third-party/resvg/resvg_libs")
41
-
42
39
  # -- Valdi Widgets (https://github.com/Snapchat/Valdi_Widgets) ---------------
43
40
  WIDGETS_TAG = "{{VALDI_WIDGETS_RELEASE_TAG}}"
44
41
 
@@ -58,6 +55,10 @@ register_toolchains("@llvm_toolchain//:all")
58
55
  # -- Android dependencies ----------------------------------------------------
59
56
  bazel_dep(name = "rules_java", version = "7.4.0")
60
57
  bazel_dep(name = "rules_android", version = "0.6.5")
58
+ # Resolve rules_android from the Valdi registry, which carries the hermetic Android SDK
59
+ # patch (registry/modules/rules_android/0.6.5) so bootstrapped apps build Android targets
60
+ # with no local ANDROID_HOME.
61
+ single_version_override(module_name = "rules_android", version = "0.6.5")
61
62
  bazel_dep(name = "rules_android_ndk", version = "0.1.3")
62
63
 
63
64
  remote_android_extensions = use_extension(
@@ -152,3 +153,46 @@ single_version_override(module_name = "protobuf", version = "27.0")
152
153
  single_version_override(module_name = "rules_apple", version = "4.0.0")
153
154
  single_version_override(module_name = "rules_pkg", version = "0.9.1")
154
155
  single_version_override(module_name = "zlib", version = "1.3.2")
156
+
157
+ # rules_python 1.9.0's hermetic Python toolchain bundles setuptools files whose
158
+ # names contain spaces (e.g. "Lorem ipsum.txt"), which Bazel's build-runfiles
159
+ # cannot materialize on macOS. The patch renames them. It is vendored into this
160
+ # app (bzl/patches/...) and referenced with a root-local `//` label on purpose:
161
+ # bzlmod only applies this override from the ROOT module, and `@valdi` resolves
162
+ # to the pinned public release, which may not ship the patch. See the CLI
163
+ # README ("Bootstrap pins and patches").
164
+ bazel_dep(name = "rules_python", version = "1.9.0")
165
+ python = use_extension("@rules_python//python/extensions:python.bzl", "python")
166
+ python.single_version_platform_override(
167
+ patch_strip = 1,
168
+ patches = ["//bzl/patches/rules_python/1.9.0:remove_setuptools_spaces.patch"],
169
+ platform = "aarch64-apple-darwin",
170
+ python_version = "3.11.14",
171
+ )
172
+
173
+ # -- Rust toolchain ------------------------------------------------------------
174
+ # rules_rust only honors rust.toolchain() from the root module, so Valdi's own
175
+ # toolchain config does not reach bootstrapped apps. Mirror it here.
176
+ # -Cstrip=none for exec-config (host tool / proc-macro) builds: rustc's
177
+ # debuginfo strip leaves a misaligned LINKEDIT string table that macOS 27 dyld
178
+ # rejects when the dylib was linked against SDK 27 (rust-lang/rust#157750,
179
+ # fixed in Rust 1.98.0).
180
+ bazel_dep(name = "rules_rust", version = "0.64.0")
181
+
182
+ rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
183
+ rust.toolchain(
184
+ edition = "2024",
185
+ extra_exec_rustc_flags = ["-Cstrip=none"],
186
+ extra_target_triples = [
187
+ "aarch64-apple-ios",
188
+ "aarch64-apple-ios-sim",
189
+ "aarch64-linux-android",
190
+ "armv7-linux-androideabi",
191
+ "x86_64-apple-ios",
192
+ "x86_64-linux-android",
193
+ ],
194
+ versions = ["1.87.0"],
195
+ )
196
+ use_repo(rust, "rust_toolchains")
197
+
198
+ register_toolchains("@rust_toolchains//:all")
@@ -1,5 +1,5 @@
1
- # valdi_demo
2
- Demo of a hello world app using Valdi open source
1
+ # {{PROJECT_NAME}}
2
+ A [Valdi](https://github.com/Snapchat/Valdi) application.
3
3
 
4
4
  ## Usage
5
5
 
@@ -0,0 +1 @@
1
+ exports_files(glob(["*.patch"]))
@@ -0,0 +1,96 @@
1
+ diff --git a/lib/python3.11/site-packages/setuptools/_vendor/jaraco/text/__init__.py b/lib/python3.11/site-packages/setuptools/_vendor/jaraco/text/__init__.py
2
+ index 4e29031..8b5af7e 100644
3
+ --- a/lib/python3.11/site-packages/setuptools/_vendor/jaraco/text/__init__.py
4
+ +++ b/lib/python3.11/site-packages/setuptools/_vendor/jaraco/text/__init__.py
5
+ @@ -230 +230 @@ lorem_ipsum: str = (
6
+ - files(__name__).joinpath('Lorem ipsum.txt').read_text(encoding='utf-8')
7
+ + files(__name__).joinpath('Lorem_ipsum.txt').read_text(encoding='utf-8')
8
+ diff --git a/lib/python3.11/site-packages/setuptools/_vendor/jaraco/text/Lorem_ipsum.txt b/lib/python3.11/site-packages/setuptools/_vendor/jaraco/text/Lorem_ipsum.txt
9
+ new file mode 100644
10
+ index 0000000..7c2da63
11
+ --- /dev/null
12
+ +++ b/lib/python3.11/site-packages/setuptools/_vendor/jaraco/text/Lorem_ipsum.txt
13
+ @@ -0,0 +1,2 @@
14
+ +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
15
+ +Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst.
16
+ diff --git a/lib/python3.11/site-packages/setuptools/_vendor/jaraco/text/Lorem ipsum.txt b/lib/python3.11/site-packages/setuptools/_vendor/jaraco/text/Lorem ipsum.txt
17
+ deleted file mode 100644
18
+ index 7c2da63..0000000
19
+ --- a/lib/python3.11/site-packages/setuptools/_vendor/jaraco/text/Lorem ipsum.txt
20
+ +++ /dev/null
21
+ @@ -1,2 +0,0 @@
22
+ -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
23
+ -Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst.
24
+ diff --git a/lib/python3.11/site-packages/setuptools/_scripts.py b/lib/python3.11/site-packages/setuptools/_scripts.py
25
+ index 788a7a7..d479258 100644
26
+ --- a/lib/python3.11/site-packages/setuptools/_scripts.py
27
+ +++ b/lib/python3.11/site-packages/setuptools/_scripts.py
28
+ @@ -336 +336 @@ def load_launcher_manifest(name):
29
+ - res = resources.files(__name__).joinpath('launcher manifest.xml')
30
+ + res = resources.files('setuptools.command').joinpath('launcher_manifest.xml')
31
+ diff --git a/lib/python3.11/site-packages/setuptools/command/launcher_manifest.xml b/lib/python3.11/site-packages/setuptools/command/launcher_manifest.xml
32
+ new file mode 100644
33
+ index 0000000..7bf2e5d
34
+ --- /dev/null
35
+ +++ b/lib/python3.11/site-packages/setuptools/command/launcher_manifest.xml
36
+ @@ -0,0 +1,15 @@
37
+ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
38
+ +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
39
+ + <assemblyIdentity version="1.0.0.0"
40
+ + processorArchitecture="X86"
41
+ + name="%(name)s"
42
+ + type="win32"/>
43
+ + <!-- Identify the application security requirements. -->
44
+ + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
45
+ + <security>
46
+ + <requestedPrivileges>
47
+ + <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
48
+ + </requestedPrivileges>
49
+ + </security>
50
+ + </trustInfo>
51
+ +</assembly>
52
+ diff --git a/lib/python3.11/site-packages/setuptools/command/launcher manifest.xml b/lib/python3.11/site-packages/setuptools/command/launcher manifest.xml
53
+ deleted file mode 100644
54
+ index 7bf2e5d..0000000
55
+ --- a/lib/python3.11/site-packages/setuptools/command/launcher manifest.xml
56
+ +++ /dev/null
57
+ @@ -1,15 +0,0 @@
58
+ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
59
+ -<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
60
+ - <assemblyIdentity version="1.0.0.0"
61
+ - processorArchitecture="X86"
62
+ - name="%(name)s"
63
+ - type="win32"/>
64
+ - <!-- Identify the application security requirements. -->
65
+ - <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
66
+ - <security>
67
+ - <requestedPrivileges>
68
+ - <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
69
+ - </requestedPrivileges>
70
+ - </security>
71
+ - </trustInfo>
72
+ -</assembly>
73
+ diff --git a/lib/python3.11/site-packages/setuptools/script_dev.tmpl b/lib/python3.11/site-packages/setuptools/script_dev.tmpl
74
+ new file mode 100644
75
+ index 0000000..c10078f
76
+ --- /dev/null
77
+ +++ b/lib/python3.11/site-packages/setuptools/script_dev.tmpl
78
+ @@ -0,0 +1,6 @@
79
+ +# EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r
80
+ +__requires__ = %(spec)r
81
+ +__import__('pkg_resources').require(%(spec)r)
82
+ +__file__ = %(dev_path)r
83
+ +with open(__file__) as f:
84
+ + exec(compile(f.read(), __file__, 'exec'))
85
+ diff --git a/lib/python3.11/site-packages/setuptools/script (dev).tmpl b/lib/python3.11/site-packages/setuptools/script (dev).tmpl
86
+ deleted file mode 100644
87
+ index c10078f..0000000
88
+ --- a/lib/python3.11/site-packages/setuptools/script (dev).tmpl
89
+ +++ /dev/null
90
+ @@ -1,6 +0,0 @@
91
+ -# EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r
92
+ -__requires__ = %(spec)r
93
+ -__import__('pkg_resources').require(%(spec)r)
94
+ -__file__ = %(dev_path)r
95
+ -with open(__file__) as f:
96
+ - exec(compile(f.read(), __file__, 'exec'))
@@ -5,7 +5,7 @@ Compile check for the patterns taught in `../skill.md`.
5
5
  ## Compile check
6
6
 
7
7
  ```bash
8
- cd client/src/open_source
8
+ cd <valdi-repo-root>
9
9
  bazel build //ai-skills/skills/SKILL_NAME/tests:tests
10
10
  ```
11
11
 
package/README.md CHANGED
@@ -47,22 +47,20 @@ Now you can edit your TypeScript files and see changes instantly on your device!
47
47
  For complete documentation, see:
48
48
  - [Command Line Reference](https://github.com/Snapchat/Valdi/blob/main/docs/docs/command-line-references.md)
49
49
  - [Installation Guide](https://github.com/Snapchat/Valdi/blob/main/docs/INSTALL.md)
50
- - [Troubleshooting](https://github.com/Snapchat/Valdi/blob/main/docs/TROUBLESHOOTING.md) — run `valdi doctor` to diagnose issues, or ask on [Discord](https://discord.gg/uJyNEeYX2U)
50
+ - [Troubleshooting](https://github.com/Snapchat/Valdi/blob/main/docs/TROUBLESHOOTING.md) — run `valdi doctor` to diagnose issues, or ask in [GitHub Discussions](https://github.com/Snapchat/Valdi/discussions)
51
51
 
52
52
  ### Key Commands
53
53
 
54
54
  **`valdi dev_setup`** - Automated environment setup
55
- - Installs all required dependencies (Bazel, Node.js, Java JDK 17, Android SDK, etc.)
56
- - Configures environment variables and PATH
57
- - Initializes Git LFS
55
+ - Installs required dependencies: Bazelisk, Java JDK 17, Watchman and adb (Homebrew on macOS, your distro's package manager on Linux)
56
+ - Configures `PATH` and `JAVA_HOME` in your shell profile; asks for `sudo` for package installs and (macOS) the JDK symlink
58
57
  - Sets up shell autocomplete
59
- - Platform-specific: macOS (Homebrew, Xcode) or Linux (apt packages)
58
+ - The Android SDK/NDK aren't installed; Bazel downloads them during the build
59
+ - Requires Node.js 18+ and, on macOS, Xcode 26.5 or 27
60
60
 
61
61
  **`valdi doctor`** - Environment diagnostics
62
- - Validates Node.js, Bazel, Java, Android SDK installations
63
- - Checks Git LFS initialization
62
+ - Validates Node.js, Bazel, Java, Android SDK and adb installations
64
63
  - Verifies shell autocomplete configuration
65
- - Checks VSCode/Cursor extensions (warns if missing)
66
64
  - macOS: Validates Xcode installation
67
65
  - Supports `--framework` mode for additional checks
68
66
  - Supports `--fix` to auto-repair issues
@@ -70,18 +68,28 @@ For complete documentation, see:
70
68
 
71
69
  **`valdi bootstrap`** - Project initialization
72
70
  - Creates a new Valdi project in the current directory
73
- - Sets up BUILD.bazel, WORKSPACE, package.json, and source files
74
- - Supports multiple application templates (Hello World, Counter, etc.)
71
+ - Sets up `MODULE.bazel`, `.bazelrc`, `BUILD.bazel` and source files, pinned to the latest framework release (override with `--valdiVersion=<tag>`)
72
+ - Application templates: `ui_application` and `cli_application`
75
73
  - Options: `-y` (skip confirmation), `-n` (project name), `-t` (application type), `-l` (local Valdi path), `-c` (clean directory first). Run `valdi bootstrap --help` for all options.
76
74
 
77
75
  **`valdi install <platform>`** - Build and install
78
- - Builds and installs app to connected device/simulator
79
- - Platforms: `ios`, `android`, `macos`
76
+ - Builds and installs app to connected device/simulator, or serves web apps locally
77
+ - Platforms: `ios`, `android`, `macos`, `web`
78
+ - Web opens the default browser unless `--no-open` is passed
80
79
 
81
80
  **`valdi hotreload`** - Development server
82
81
  - Enables instant hot reload during development
83
82
  - Watches for file changes and updates app in milliseconds
84
83
 
84
+ **`valdi debugger`** - Local debugger web interface
85
+ - Starts the browser-based Valdi debugger at `127.0.0.1`
86
+ - Uses live daemon data from running Valdi targets for view hierarchy, preview, inspector state, snapshots, heap, and runtime logs
87
+ - Captures CPU profiles through a separate Hermes debugger connection
88
+ - Restricts the server to loopback addresses because debugger snapshots can contain application data
89
+ - Prefers port `8765` and automatically selects the next available port so multiple local sessions can run at once
90
+ - Supports `--json` for automation-friendly startup output
91
+ - Supports exact-page Owl/Chromium attachment with `--web-preview-url` and `--chromium-debugging-port`; this emits a temporary first-party DevTools extension directory and an explicitly opted-in preview URL
92
+
85
93
  **`valdi skills`** - AI assistant skills
86
94
  - Installs Valdi context files into Claude Code, Cursor, or GitHub Copilot so AI tools generate correct Valdi code instead of React patterns
87
95
  - `valdi skills install` — auto-detects installed AI tools and installs all skills
@@ -89,7 +97,7 @@ For complete documentation, see:
89
97
  - `valdi skills update` — re-install already-installed skills from the bundled package
90
98
  - `valdi skills create` — scaffold a new skill (run from within the Valdi repo)
91
99
 
92
- **Other commands:** `valdi build <platform>` (build without installing), `valdi package <platform>` (create distributable app), `valdi export <platform>` (export library for native apps), `valdi test` (run tests), `valdi lint check` / `valdi lint format` (lint and format code), `valdi log` (stream device logs), `valdi projectsync` (sync VS Code project and native bindings), `valdi completion` (shell autocomplete setup). Use `valdi <command> --help` for options.
100
+ **Other commands:** `valdi build <platform>` (build without installing), `valdi package <platform>` (create distributable app), `valdi export <platform>` (export a library artifact), `valdi test` (run tests), `valdi lint check` / `valdi lint format` (lint and format code), `valdi log` (stream device logs), `valdi projectsync` (sync VS Code project and native bindings), `valdi completion` (shell autocomplete setup). Use `valdi <command> --help` for options.
93
101
 
94
102
  For complete command documentation, see [Command Line Reference](https://github.com/Snapchat/Valdi/blob/main/docs/docs/command-line-references.md).
95
103
 
@@ -116,7 +124,7 @@ Requirements for Valdi module names:
116
124
 
117
125
  Recommended Directory Structure:
118
126
  my_application/ # Root directory of your application
119
- ├── WORKSPACE # Bazel Workspace
127
+ ├── MODULE.bazel # Bazel module (dependencies)
120
128
  ├── BUILD.bazel # Bazel build
121
129
  └── modules/
122
130
  ├── module_a/
@@ -217,3 +225,28 @@ Install the `valdi` command locally:
217
225
  ```sh
218
226
  npm run cli:install
219
227
  ```
228
+
229
+ ### Bootstrap pins and patches
230
+
231
+ The bootstrap template (`.metadata/MODULE.bazel.template`) is what `valdi
232
+ bootstrap` uses to wire up a user's app. The generated app is the **root**
233
+ bzlmod module, and it pins the Valdi framework to a *published* release
234
+ (`DEFAULT_VALDI_RELEASE_TAG`); it fetches `@valdi` from public GitHub, **not**
235
+ from this checkout.
236
+
237
+ Two rules follow from that:
238
+
239
+ 1. **A patch the generated app must apply belongs *in the app*, referenced with
240
+ a root-local `//` label — never `@valdi//`.** bzlmod only honors a
241
+ `single_version_*override`/patch from the **root** module, so the app (not
242
+ `@valdi`) has to carry it; and `@valdi` resolves to the pinned public
243
+ release, which may not contain internal-only files. Vendor the patch as a
244
+ `.metadata` template asset (see `RULES_PYTHON_PATCH*` and the
245
+ `bzl/patches/...` block in the template). A `@valdi//bzl/patches/...`
246
+ reference fails at bootstrap time with `BUILD file not found in @@valdi~` and
247
+ breaks the `release_test` CI gate.
248
+
249
+ 2. **Only bump the template's framework pins (`DEFAULT_VALDI_RELEASE_TAG` and
250
+ any `@valdi`-sourced overrides) when you are cutting the release that ships
251
+ the matching files.** Pointing the template at a release that doesn't exist
252
+ yet produces an app that can't build.
@@ -27,6 +27,7 @@
27
27
  { "name": "valdi-gestures", "description": "Touch and gesture handling: onTap, onDrag, onPinch, onRotate, onLongPress, TouchEvent, gesture predicates", "tags": ["gestures", "touch", "input"], "path": "skills/valdi-gestures/skill.md", "category": ["client"] },
28
28
  { "name": "valdi-localization", "description": "Internationalization: strings-en.json, Strings.d.ts generation, template variables, valdi projectsync", "tags": ["localization", "i18n", "strings"], "path": "skills/valdi-localization/skill.md", "category": ["client"] },
29
29
  { "name": "valdi-error-handling", "description": "Error handling patterns: CancelablePromise safety, HTTPClient errors, isDestroyed guards, error UI states", "tags": ["errors", "async", "lifecycle", "safety"], "path": "skills/valdi-error-handling/skill.md", "category": ["client"] },
30
- { "name": "valdi-component-dedup", "description": "Find and extract duplicated component patterns across Valdi modules into shared libraries", "tags": ["deduplication", "analysis", "refactoring", "ai"], "path": "skills/valdi-component-dedup/skill.md", "category": ["client"] }
30
+ { "name": "valdi-component-dedup", "description": "Find and extract duplicated component patterns across Valdi modules into shared libraries", "tags": ["deduplication", "analysis", "refactoring", "ai"], "path": "skills/valdi-component-dedup/skill.md", "category": ["client"] },
31
+ { "name": "valdi-pr-review", "description": "Review a Valdi PR for regression risk: gating audit, blast radius, and native C++/Android/iOS perf and thread-safety checks", "tags": ["review", "regression", "gating", "performance", "native"], "path": "skills/valdi-pr-review/skill.md", "category": ["framework", "client"] }
31
32
  ]
32
33
  }
@@ -125,6 +125,55 @@ this.animate({ stiffness: 500, damping: 40 }, () => {
125
125
  });
126
126
  ```
127
127
 
128
+ ## Animating text and attributed text
129
+
130
+ The imperative `animate()` / `setStateAnimated()` API above does not drive per-character or per-word text reveals. For those, use the **text-animation surface**: an `AttributedText` chunk carries an `animationTransform`, and a `<textanimationgroup>` container coordinates one shared timeline across all of its descendant `<label>` / `<textview>` elements.
131
+
132
+ `animationTransform` fields (`valdi_tsx/src/AttributedText.d.ts`, `AttributedTextAnimationTransform`):
133
+
134
+ | Field | Meaning |
135
+ |-------|---------|
136
+ | `translationY` | Initial vertical offset (logical px); animates back to the normal position |
137
+ | `scale` | Initial scale; animates back to 1 |
138
+ | `opacity` | Initial opacity; animates back to 1 |
139
+ | `duration` | Seconds for each part to reach its normal appearance |
140
+ | `timeOffsetBetweenParts` | Delay (seconds) staggered between consecutive parts (0 = all at once) |
141
+ | `partPattern` | Native regex; each non-overlapping match becomes a separately animated part (unmatched text stays static). Omit to animate the whole chunk as one part |
142
+ | `key` | Stable animation identity; preserves progress across view-pool recycling. Change it to restart the animation |
143
+
144
+ ```tsx
145
+ import { AttributedTextBuilder } from 'valdi_core/src/utils/AttributedTextBuilder';
146
+
147
+ // ✅ Build attributed text with a per-chunk animation transform
148
+ private animatedText(text: string) {
149
+ return new AttributedTextBuilder()
150
+ .append(text, {
151
+ animationTransform: {
152
+ duration: 0.45,
153
+ key: `run-${this.state.runId}`, // change key to replay
154
+ opacity: 0,
155
+ translationY: 8,
156
+ timeOffsetBetweenParts: 0.08, // stagger each part
157
+ },
158
+ })
159
+ .build();
160
+ }
161
+
162
+ // ✅ <textanimationgroup> runs ONE shared timeline across every descendant
163
+ // label/textview, even nested ones
164
+ onRender(): void {
165
+ <textanimationgroup>
166
+ <label value={this.animatedText('First line joins the timeline.')} />
167
+ <view>
168
+ <label value={this.animatedText('So does this nested one.')} />
169
+ </view>
170
+ <textview value={this.animatedText('And the textview animates last.')} />
171
+ </textanimationgroup>;
172
+ }
173
+ ```
174
+
175
+ `<textanimationgroup>` is a container (`CommonView` + `ContainerTemplateElement`) with no animation-specific attributes of its own — its only job is to group descendants onto a single coordinated timeline. Without it, each animated chunk runs on its own timeline.
176
+
128
177
  ## Common patterns
129
178
 
130
179
  ### Show/hide with fade
@@ -1,8 +1,9 @@
1
1
  # Valdi Async & Lifecycle Safety
2
2
 
3
3
  Async operations that complete after a component is destroyed will call `setState()`
4
- on a dead component — the framework throws an error. The fix is always to cancel or
5
- guard before the callback fires.
4
+ on a dead component — Valdi logs a `console.error` and drops the update (a silent
5
+ no-op, not a thrown error). The fix is always to cancel or guard before the callback
6
+ fires.
6
7
 
7
8
  ## HTTPClient: Store, Cancel, Repeat
8
9
 
@@ -14,7 +14,7 @@ Compile check for the async lifecycle safety patterns taught in `skill.md`.
14
14
  ## Compile check
15
15
 
16
16
  ```bash
17
- cd client/src/open_source
17
+ cd <valdi-repo-root>
18
18
  bazel build //ai-skills/skills/valdi-async/tests:tests
19
19
  ```
20
20
 
@@ -13,7 +13,7 @@ Valdi uses Bazel as its build system. Bazel provides reproducible, incremental b
13
13
  bazel build //...
14
14
 
15
15
  # Build specific target
16
- bazel build //apps/helloworld:helloworld
16
+ bazel build //apps/helloworld:hello_world
17
17
 
18
18
  # Run tests
19
19
  bazel test //...
@@ -103,10 +103,6 @@ valdi install ios
103
103
 
104
104
  # Build and install Android app
105
105
  valdi install android
106
-
107
- # Or use bazel directly with configs
108
- bazel build //apps/helloworld:hello_world --config=ios
109
- bazel build //apps/helloworld:hello_world --config=android
110
106
  ```
111
107
 
112
108
  ## Configuration
@@ -137,5 +133,5 @@ bazel coverage //...
137
133
  ## More Information
138
134
 
139
135
  - Bazel docs: https://bazel.build
140
- - Valdi build rules: `/bzl/valdi/README.md`
136
+ - Valdi build rules: `bzl/valdi/npm/README.md`
141
137
  - Framework docs: `/AGENTS.md`
@@ -24,7 +24,7 @@ Reference spec file demonstrating all test utility patterns from `skill.md`.
24
24
  ## Run tests
25
25
 
26
26
  ```bash
27
- cd client/src/open_source
27
+ cd <valdi-repo-root>
28
28
  bazel test //ai-skills/skills/valdi-component-tests/tests:tests
29
29
  ```
30
30
 
@@ -45,6 +45,24 @@ Valdi's runtime and layout engine are implemented in C++ for cross-platform perf
45
45
  - **Don't modify generated code** - change the .djinni file instead
46
46
  - Generated files typically in `generated-src/` directories
47
47
 
48
+ ### Native Bindings Exposed to JS
49
+
50
+ The runtime exposes selected native (C++) classes and functions to the JS engine so
51
+ TypeScript can call into performance-critical native code directly.
52
+
53
+ - **`Base64` namespace** (`coreutils/src/Base64.ts`) is a good example of a
54
+ native-backed binding: the TS surface (`fromByteArray(uint8, { urlSafe })`,
55
+ `toByteArray(b64)`, `byteLength(b64)`) delegates to native encode/decode
56
+ (`Base64Native`) rather than doing the work in JS. Use this shape when a hot codec
57
+ or transform belongs in native code but needs a clean JS entry point.
58
+ - **`WeakRef`** is supported by the runtime (recently added). JS-side weak references
59
+ hold their referent without preventing garbage collection — useful for caches and
60
+ back-references that must not keep objects alive.
61
+
62
+ **V8 caveat:** some native class bindings (e.g. `Base64` and `Unicode`) are wired for
63
+ QuickJS and may **throw on the V8 runtime**. Don't assume a native binding is present
64
+ on every JS engine — guard or feature-check when the same code can run under V8.
65
+
48
66
  ### Performance
49
67
 
50
68
  - This is performance-critical code
@@ -53,7 +53,7 @@ class MyComponent extends Component<MyViewModel> {
53
53
  }
54
54
  ```
55
55
 
56
- `viewFactory` and `*Class` attributes are mutually exclusive — use one or the other. `viewFactory` takes precedence when both are provided.
56
+ `viewFactory` and `*Class` attributes are mutually exclusive — use one or the other. Specifying both on the same `<custom-view>` is a compile error (the JSXProcessor rejects it). If a view needs a `viewFactory` on one platform and a registered class on another, branch into two sibling `<custom-view>` elements, each with a single mechanism. Prefer gating on whether a `viewFactory` is provided (`if (viewFactory) { … } else { …class… }`) over `Device.isWeb()`: the factory is often supplied by native too, so an `isWeb` branch that routes native to classes can break it. Only keep a platform class you've confirmed actually exists.
57
57
 
58
58
  ## macOS Attribute Binding
59
59
 
@@ -37,7 +37,7 @@ onCreate() {
37
37
  // ❌ WRONG — Raw promise with no lifecycle safety
38
38
  onCreate() {
39
39
  this.fetchData().then(data => {
40
- this.setState({ data }); // Crashes if component is destroyed
40
+ this.setState({ data }); // Logs a console.error and no-ops if destroyed
41
41
  });
42
42
  }
43
43
  ```
@@ -10,7 +10,7 @@ When handling user touch interactions beyond basic `onTap` — drag-to-reorder,
10
10
 
11
11
  Valdi gesture handling is **attribute-based on `<view>` elements**. Each gesture type has three attributes:
12
12
  - `on<Gesture>` — the callback
13
- - `<gesture>Enabled` — boolean to enable/disable (default: true when callback is set)
13
+ - `on<Gesture>Disabled` — boolean to disable the gesture (the gesture is enabled by default once a callback is set; there is no `<gesture>Enabled` attribute)
14
14
  - `on<Gesture>Predicate` — function returning boolean, controls whether the gesture should fire
15
15
 
16
16
  The topmost visible element with a matching gesture wins. Conflicting gestures on parent elements are suppressed.
@@ -60,7 +60,7 @@ private handleTap = (event: TouchEvent) => {
60
60
  // ✅ Long press with custom duration
61
61
  <view
62
62
  onLongPress={this.handleLongPress}
63
- longPressDuration={500} // milliseconds before trigger
63
+ longPressDuration={0.5} // seconds before trigger
64
64
  >
65
65
  <label value="Hold me" />
66
66
  </view>
@@ -143,7 +143,7 @@ Inside a `<scroll>`, touches are delayed to avoid conflicts with scrolling:
143
143
  // ✅ Delay touch recognition inside scrollable content
144
144
  <view
145
145
  onTouch={this.handleTouch}
146
- onTouchDelayDuration={150} // ms before onTouch fires during scroll
146
+ onTouchDelayDuration={0.15} // seconds before onTouch fires during scroll
147
147
  />
148
148
  ```
149
149
 
@@ -119,6 +119,7 @@ const cardStyle = new Style<View>({ backgroundColor: '#fff', borderRadius: 8 });
119
119
  | `Row` | `Row` | `flexDirection: 'row'` | `<view flexDirection="row">` |
120
120
  | `Stack` | `Box` with `align` | `position: absolute` | `<view>` + children with `position="absolute"` |
121
121
  | `Modifier.padding(16.dp)` | `Modifier.padding(16.dp)` | `style={{padding:16}}` | `padding={16}` on any element |
122
+ | `Wrap(spacing:)` / spacers | `Arrangement.spacedBy(8.dp)` | CSS `gap` | `gap` / `rowGap` / `columnGap` (newly available via Yoga; margins still common in practice) |
122
123
  | `Navigator.push` | `navController.navigate("route")` | `navigate()` / `router.push` | `navigationController.push(Page, vm, ctx)` |
123
124
  | `Navigator.pop` | `navController.popBackStack()` | `goBack()` / `router.back` | `navigationController.pop()` |
124
125
  | `showModalBottomSheet` | `ModalBottomSheet` / `Dialog` | `<Modal>` | `navigationController.present(Page, vm, ctx)` |
@@ -126,7 +127,7 @@ const cardStyle = new Style<View>({ backgroundColor: '#fff', borderRadius: 8 });
126
127
  | `SharedPreferences` | `SharedPreferences` / `DataStore` | `AsyncStorage` / `localStorage` | `PersistentStore` (valdi persistence) |
127
128
  | `http.get()` / `dio` | `viewModelScope.launch { api.get() }` | `fetch()` / `axios` | `HTTPClient.get()` (valdi_http) |
128
129
  | `Lottie` | `LottieAnimation` | `<Lottie>` | `<animatedimage>` |
129
- | `BackdropFilter` | `BlurMaskFilter` | CSS `backdrop-filter` | `<blur>` (iOS only) |
130
+ | `BackdropFilter` | `BlurMaskFilter` | CSS `backdrop-filter` | `<blur>` (iOS); `<glass>` for Liquid Glass (iOS 26+; falls back to a blur on older iOS, plain view on Android). Tint with `glassTintColor`, not `backgroundColor` |
130
131
 
131
132
  ## Key import paths
132
133
 
@@ -41,7 +41,7 @@ Save each output to the `output/` directory:
41
41
  Verify none of the outputs contain framework-specific patterns:
42
42
 
43
43
  ```bash
44
- cd client/src/open_source/ai-skills/skills/valdi-migrate/tests
44
+ cd <valdi-repo-root>/ai-skills/skills/valdi-migrate/tests
45
45
 
46
46
  python3 check_antipatterns.py output/flutter_migrated.tsx # must pass
47
47
  python3 check_antipatterns.py output/compose_migrated.tsx # must pass
@@ -57,7 +57,7 @@ python3 check_antipatterns.py compose_example.kt # expected: fail
57
57
  Verify all outputs (reference + migrations) build with the Valdi compiler:
58
58
 
59
59
  ```bash
60
- cd client/src/open_source
60
+ cd <valdi-repo-root>
61
61
  bazel build //ai-skills/skills/valdi-migrate/tests:tests
62
62
  ```
63
63
 
@@ -96,7 +96,7 @@ Common widgets in `widgets/`:
96
96
  | Tappable row | `onTap` on `<view>` |
97
97
  | Scrollable list | `<scroll>` wrapping children |
98
98
  | Fixed header + scrolling body | Outer `<view>` with header + `<scroll flexGrow={1}>` body |
99
- | Spacer between items | margin on children (no `gap` property) |
99
+ | Spacer between items | margin on children, or `gap` on the parent (newly available via Yoga) |
100
100
 
101
101
  ---
102
102
 
@@ -186,12 +186,12 @@ class MyComponent extends StatefulComponent<VM, State> {
186
186
  - Prefer `padding` and `margin` shorthand: `padding: '16 20'` (vertical horizontal)
187
187
  - Colors: use hex strings `'#RRGGBB'` or `'#RRGGBBAA'`
188
188
  - Layout: Yoga flexbox — `flexDirection`, `justifyContent`, `alignItems`, `flexGrow`
189
- - No `gap` property — use margin on children instead
189
+ - `gap`/`rowGap`/`columnGap` now exist (Yoga layout props on View/Layout); margin on children still works and remains the common convention in practice
190
190
  - No `fontSize` — use `font` string on labels
191
191
  - Overflow: only `'visible'` or `'scroll'` (NOT `'hidden'`)
192
192
  - **`opacity` must be a number**, not a string: `opacity: 0.3` (NOT `'0.3'`)
193
193
  - **`flexGrow` must be a number**, not a string: `flexGrow: 1` (NOT `'1'`)
194
- - **Only two font weights**: `system` (regular) and `system-bold` (bold). `system-semibold`, `system-medium`, etc. silently fall back to regular at runtime.
194
+ - **Font weights**: `system`, `system-medium`, `system-semibold`, `system-bold`, plus italic variants (`system-italic`, `system-medium-italic`, …). Prefer the `SystemFont` helpers (`systemSemiboldFont(16)`). Only `system-light` does not exist.
195
195
  - **ScrollView has no `flexDirection`** — `<scroll>` always scrolls vertically, do not set flexDirection on it
196
196
  - `boxShadow` format: `'xOffset yOffset blur color'` e.g. `'0 2 8 rgba(0,0,0,0.12)'`
197
197
 
@@ -204,7 +204,7 @@ class MyComponent extends StatefulComponent<VM, State> {
204
204
  - No `flex: 1` — use `flexGrow: 1` (number, not string).
205
205
  - `flexGrow` must be a number, not a string.
206
206
  - `Shape` is not exported — use `ShapeView` from NativeTemplateElements.
207
- - `font: 'system-semibold'` doesn't work — use `system-bold` or `system`.
207
+ - `font` weights `system` / `system-medium` / `system-semibold` / `system-bold` (+ italic variants) all work; only `system-light` is absent.
208
208
  - `overflow: 'hidden'` doesn't exist — only `'visible'` or `'scroll'`.
209
209
  - `flexDirection` on `<scroll>` doesn't exist — ScrollView always scrolls vertically.
210
210