@snap/valdi 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.metadata/.bazelrc.template +1 -1
- package/.metadata/MODULE.bazel.template +92 -0
- package/bundled-skills/skills/valdi-compiler/skill.md +4 -4
- package/dist/commands/bootstrap.js +2 -2
- package/dist/commands/build.js +6 -0
- package/dist/commands/doctor.js +2 -63
- package/dist/commands/install.js +6 -0
- package/dist/core/constants.js +5 -2
- package/dist/setup/DevSetupHelper.js +0 -3
- package/dist/setup/linuxSetup.js +0 -14
- package/dist/setup/macOSSetup.js +1 -2
- package/dist/utils/applicationUtils.js +15 -0
- package/dist/utils/linuxDistro.js +0 -21
- package/dist/utils/linuxDistro.spec.js +0 -48
- package/dist/utils/skillsAdapters.js +40 -14
- package/dist/utils/skillsAdapters.spec.js +81 -0
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ common --incompatible_java_common_parameters=false
|
|
|
17
17
|
# Flags for compilation
|
|
18
18
|
common --define enable_web=true
|
|
19
19
|
|
|
20
|
-
build --tool_java_language_version=
|
|
20
|
+
build --tool_java_language_version=17
|
|
21
21
|
build --java_language_version=11
|
|
22
22
|
|
|
23
23
|
## Disable sandboxing for macs, both laptops and in CI; the performance hit is much too high.
|
|
@@ -55,6 +55,98 @@ use_repo(valdi_toolchains, "local_config_apple_cc_toolchains", "local_config_app
|
|
|
55
55
|
register_toolchains("@local_config_apple_cc_toolchains//:all")
|
|
56
56
|
register_toolchains("@llvm_toolchain//:all")
|
|
57
57
|
|
|
58
|
+
# -- Android dependencies ----------------------------------------------------
|
|
59
|
+
bazel_dep(name = "rules_java", version = "7.4.0")
|
|
60
|
+
bazel_dep(name = "rules_android", version = "0.6.5")
|
|
61
|
+
bazel_dep(name = "rules_android_ndk", version = "0.1.3")
|
|
62
|
+
|
|
63
|
+
remote_android_extensions = use_extension(
|
|
64
|
+
"@rules_android//bzlmod_extensions:android_extensions.bzl",
|
|
65
|
+
"remote_android_tools_extensions",
|
|
66
|
+
)
|
|
67
|
+
use_repo(remote_android_extensions, "android_gmaven_r8", "android_tools")
|
|
68
|
+
|
|
69
|
+
hermetic_android_sdk_extension = use_extension("@valdi//bzl:hermetic_android_sdk.bzl", "hermetic_android_sdk_extension")
|
|
70
|
+
hermetic_android_sdk_extension.configure(
|
|
71
|
+
api_level = 36,
|
|
72
|
+
build_tools_version = "34.0.0",
|
|
73
|
+
)
|
|
74
|
+
use_repo(hermetic_android_sdk_extension, "androidsdk")
|
|
75
|
+
|
|
76
|
+
register_toolchains(
|
|
77
|
+
"@rules_android//toolchains/android:all",
|
|
78
|
+
"@rules_android//toolchains/android_sdk:all",
|
|
79
|
+
)
|
|
80
|
+
register_toolchains("@androidsdk//:sdk-toolchain", "@androidsdk//:all")
|
|
81
|
+
|
|
82
|
+
hermetic_ndk_extension = use_extension("@valdi//bzl:hermetic_ndk.bzl", "hermetic_ndk_extension")
|
|
83
|
+
use_repo(hermetic_ndk_extension, "androidndk")
|
|
84
|
+
|
|
85
|
+
register_toolchains("@androidndk//:all")
|
|
86
|
+
|
|
87
|
+
bazel_dep(name = "rules_kotlin", version = "1.9.0")
|
|
88
|
+
single_version_override(module_name = "rules_kotlin", version = "1.9.0")
|
|
89
|
+
bazel_dep(name = "rules_jvm_external", version = "6.2")
|
|
90
|
+
|
|
91
|
+
# -- Maven (Android) ---------------------------------------------------------
|
|
92
|
+
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
|
|
93
|
+
|
|
94
|
+
maven.install(
|
|
95
|
+
name = "android_mvn",
|
|
96
|
+
artifacts = [
|
|
97
|
+
"androidx.annotation:annotation:1.1.0",
|
|
98
|
+
"androidx.appcompat:appcompat:1.2.0",
|
|
99
|
+
"androidx.appcompat:appcompat-resources:1.2.0",
|
|
100
|
+
"androidx.collection:collection:1.1.0",
|
|
101
|
+
"androidx.constraintlayout:constraintlayout:2.1.4",
|
|
102
|
+
"androidx.core:core:1.6.0",
|
|
103
|
+
"androidx.customview:customview:1.1.0",
|
|
104
|
+
"androidx.dynamicanimation:dynamicanimation:1.0.0",
|
|
105
|
+
"androidx.fragment:fragment:1.1.0",
|
|
106
|
+
"androidx.interpolator:interpolator:1.0.0",
|
|
107
|
+
"androidx.lifecycle:lifecycle-common:2.2.0",
|
|
108
|
+
"androidx.lifecycle:lifecycle-process:2.2.0",
|
|
109
|
+
"androidx.lifecycle:lifecycle-viewmodel:2.2.0",
|
|
110
|
+
"androidx.recyclerview:recyclerview:1.2.1",
|
|
111
|
+
"androidx.test:core:1.5.0",
|
|
112
|
+
"androidx.test.ext:junit:1.1.3",
|
|
113
|
+
"androidx.test:monitor:1.5.0",
|
|
114
|
+
"androidx.test:runner:1.5.0",
|
|
115
|
+
"com.google.android.material:material:1.2.0",
|
|
116
|
+
"com.google.code.findbugs:jsr305:3.0.2",
|
|
117
|
+
"com.google.code.gson:gson:2.8.6",
|
|
118
|
+
"com.google.protobuf.nano:protobuf-javanano:3.1.0",
|
|
119
|
+
"com.jakewharton.timber:timber:4.7.1",
|
|
120
|
+
"com.squareup.leakcanary:leakcanary-android:2.10",
|
|
121
|
+
"com.squareup.okhttp3:okhttp:4.9.0",
|
|
122
|
+
"com.squareup.okio:okio:2.10.0",
|
|
123
|
+
"io.reactivex.rxjava3:rxandroid:3.0.0",
|
|
124
|
+
"io.reactivex.rxjava3:rxjava:3.1.0",
|
|
125
|
+
"io.reactivex.rxjava3:rxkotlin:3.0.0",
|
|
126
|
+
"javax.inject:javax.inject:1",
|
|
127
|
+
"junit:junit:4.13.2",
|
|
128
|
+
"org.junit.jupiter:junit-jupiter-api:5.9.3",
|
|
129
|
+
"org.junit.jupiter:junit-jupiter-engine:5.9.3",
|
|
130
|
+
"org.junit.jupiter:junit-jupiter-params:5.9.3",
|
|
131
|
+
"org.junit.platform:junit-platform-console:1.9.2",
|
|
132
|
+
"org.junit.platform:junit-platform-launcher:1.9.2",
|
|
133
|
+
"org.junit.platform:junit-platform-reporting:1.9.2",
|
|
134
|
+
"org.junit.vintage:junit-vintage-engine:5.9.3",
|
|
135
|
+
"org.robolectric:android-all:10-robolectric-5803371",
|
|
136
|
+
"org.robolectric:annotations:4.10.3",
|
|
137
|
+
"org.robolectric:robolectric:4.10.3",
|
|
138
|
+
],
|
|
139
|
+
repositories = [
|
|
140
|
+
"https://repo1.maven.org/maven2",
|
|
141
|
+
"https://maven.google.com",
|
|
142
|
+
],
|
|
143
|
+
aar_import_bzl_label = "@rules_android//rules:rules.bzl",
|
|
144
|
+
use_starlark_android_rules = True,
|
|
145
|
+
version_conflict_policy = "pinned",
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
use_repo(maven, "android_mvn")
|
|
149
|
+
|
|
58
150
|
# -- Version pins (must match Valdi's MODULE.bazel) ---------------------------
|
|
59
151
|
single_version_override(module_name = "protobuf", version = "27.0")
|
|
60
152
|
single_version_override(module_name = "rules_apple", version = "4.0.0")
|
|
@@ -55,7 +55,7 @@ enum CompilerError: Error {
|
|
|
55
55
|
|
|
56
56
|
## Testing
|
|
57
57
|
|
|
58
|
-
Tests are critical - add tests for new features and error cases.
|
|
58
|
+
Tests are critical - add tests for new features and error cases. Run the test suite with `bzl test //compiler/compiler/...` (the build script below does not run tests).
|
|
59
59
|
|
|
60
60
|
## Build
|
|
61
61
|
|
|
@@ -63,12 +63,12 @@ Tests are critical - add tests for new features and error cases. The `update_com
|
|
|
63
63
|
|
|
64
64
|
```bash
|
|
65
65
|
cd compiler/compiler
|
|
66
|
-
./scripts/
|
|
66
|
+
./scripts/update_compiler_bazel.sh -o bin/compiler
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
This script:
|
|
70
|
-
-
|
|
71
|
-
- Builds the compiler for the correct architecture
|
|
70
|
+
- Builds the compiler with Bazel (`//compiler/compiler:local_valdi_compiler`); no Swift toolchain install is required
|
|
71
|
+
- Builds the compiler for the correct architecture (on macOS, lipos arm64 + x86_64 into a universal binary and codesigns it)
|
|
72
72
|
- Copies the binary to `bin/compiler/macos/valdi_compiler` (or `linux/valdi_compiler`)
|
|
73
73
|
- Handles platform differences (macOS vs Linux)
|
|
74
74
|
|
|
@@ -30,8 +30,8 @@ const ALL_APPLICATION_TEMPLATES = [
|
|
|
30
30
|
];
|
|
31
31
|
const VALDI_GIT_URL = 'https://github.com/Snapchat/Valdi';
|
|
32
32
|
const VALDI_WIDGETS_GIT_URL = 'https://github.com/Snapchat/Valdi_Widgets';
|
|
33
|
-
const DEFAULT_VALDI_RELEASE_TAG = 'beta-0.1.
|
|
34
|
-
const DEFAULT_VALDI_WIDGETS_RELEASE_TAG = 'beta-0.1.
|
|
33
|
+
const DEFAULT_VALDI_RELEASE_TAG = 'beta-0.1.1';
|
|
34
|
+
const DEFAULT_VALDI_WIDGETS_RELEASE_TAG = 'beta-0.1.1';
|
|
35
35
|
function isAlreadyInitialized() {
|
|
36
36
|
return (0, fileUtils_1.fileExists)(path_1.default.join(process.cwd(), 'MODULE.bazel')) || (0, fileUtils_1.fileExists)(path_1.default.join(process.cwd(), 'WORKSPACE'));
|
|
37
37
|
}
|
package/dist/commands/build.js
CHANGED
|
@@ -32,6 +32,12 @@ async function valdiBuild(argv) {
|
|
|
32
32
|
await bazel.buildTarget(buildInfo.application, buildInfo.bazelArgs);
|
|
33
33
|
break;
|
|
34
34
|
}
|
|
35
|
+
case constants_1.PLATFORM.LINUX: {
|
|
36
|
+
(0, errorUtils_1.logReproduceThisCommandIfNeeded)(argv);
|
|
37
|
+
console.log('Building Linux application...');
|
|
38
|
+
await bazel.buildTarget(buildInfo.application, buildInfo.bazelArgs);
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
35
41
|
case constants_1.PLATFORM.CLI: {
|
|
36
42
|
(0, errorUtils_1.logReproduceThisCommandIfNeeded)(argv);
|
|
37
43
|
console.log('Build CLI application...');
|
package/dist/commands/doctor.js
CHANGED
|
@@ -48,7 +48,6 @@ class ValdiDoctor {
|
|
|
48
48
|
await this.checkEssentialPlatformTools();
|
|
49
49
|
await this.checkJavaInstallation();
|
|
50
50
|
await this.checkCoreDependencies();
|
|
51
|
-
await this.checkGitLfsInitialization();
|
|
52
51
|
this.checkShellAutoComplete();
|
|
53
52
|
await this.checkEditorExtensions();
|
|
54
53
|
if (this.frameworkMode) {
|
|
@@ -541,60 +540,6 @@ class ValdiDoctor {
|
|
|
541
540
|
await this.checkSingleDependency('ios_webkit_debug_proxy', 'fail');
|
|
542
541
|
}
|
|
543
542
|
}
|
|
544
|
-
async checkGitLfsInitialization() {
|
|
545
|
-
if (!(0, cliUtils_1.checkCommandExists)('git-lfs')) {
|
|
546
|
-
const fixCommand = this.getFixCommandForDependency('git-lfs');
|
|
547
|
-
this.addResult({
|
|
548
|
-
name: 'Git LFS',
|
|
549
|
-
status: 'warn',
|
|
550
|
-
message: 'git-lfs not installed',
|
|
551
|
-
details: 'Required for working with large files in the repository',
|
|
552
|
-
fixable: true,
|
|
553
|
-
fixCommand,
|
|
554
|
-
category: 'Development tools',
|
|
555
|
-
});
|
|
556
|
-
return;
|
|
557
|
-
}
|
|
558
|
-
try {
|
|
559
|
-
const { stdout, returnCode } = await (0, cliUtils_1.runCliCommand)('git config --global --get filter.lfs.process');
|
|
560
|
-
if (returnCode === 0 && stdout.trim()) {
|
|
561
|
-
this.addResult({
|
|
562
|
-
name: 'Git LFS initialization',
|
|
563
|
-
status: 'pass',
|
|
564
|
-
message: 'git-lfs is initialized',
|
|
565
|
-
category: 'Development tools',
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
else {
|
|
569
|
-
this.addResult({
|
|
570
|
-
name: 'Git LFS initialization',
|
|
571
|
-
status: 'warn',
|
|
572
|
-
message: 'git-lfs is installed but not initialized',
|
|
573
|
-
details: 'Run git lfs install to configure Git LFS hooks',
|
|
574
|
-
fixable: true,
|
|
575
|
-
fixCommand: 'git lfs install',
|
|
576
|
-
category: 'Development tools',
|
|
577
|
-
});
|
|
578
|
-
if (this.autoFix) {
|
|
579
|
-
await this.attemptAutoFix('git-lfs', 'git lfs install');
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
catch {
|
|
584
|
-
this.addResult({
|
|
585
|
-
name: 'Git LFS initialization',
|
|
586
|
-
status: 'warn',
|
|
587
|
-
message: 'git-lfs is installed but not initialized',
|
|
588
|
-
details: 'Run git lfs install to configure Git LFS hooks',
|
|
589
|
-
fixable: true,
|
|
590
|
-
fixCommand: 'git lfs install',
|
|
591
|
-
category: 'Development tools',
|
|
592
|
-
});
|
|
593
|
-
if (this.autoFix) {
|
|
594
|
-
await this.attemptAutoFix('git-lfs', 'git lfs install');
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
543
|
checkShellAutoComplete() {
|
|
599
544
|
const homeDir = process.env['HOME'] ?? '';
|
|
600
545
|
const shell = process.env['SHELL'] ?? '';
|
|
@@ -764,7 +709,7 @@ class ValdiDoctor {
|
|
|
764
709
|
if (['git', 'npm', 'watchman', 'ios_webkit_debug_proxy'].includes(dep)) {
|
|
765
710
|
category = 'Development tools';
|
|
766
711
|
}
|
|
767
|
-
else if (['
|
|
712
|
+
else if (['temurin'].includes(dep)) {
|
|
768
713
|
category = 'Framework tools';
|
|
769
714
|
}
|
|
770
715
|
else {
|
|
@@ -854,9 +799,6 @@ class ValdiDoctor {
|
|
|
854
799
|
case 'watchman': {
|
|
855
800
|
return 'brew install watchman';
|
|
856
801
|
}
|
|
857
|
-
case 'git-lfs': {
|
|
858
|
-
return 'brew install git-lfs';
|
|
859
|
-
}
|
|
860
802
|
case 'bazelisk': {
|
|
861
803
|
return 'brew install bazelisk';
|
|
862
804
|
}
|
|
@@ -888,9 +830,6 @@ class ValdiDoctor {
|
|
|
888
830
|
}
|
|
889
831
|
return cmd;
|
|
890
832
|
}
|
|
891
|
-
case 'git-lfs': {
|
|
892
|
-
return (0, linuxDistro_1.buildInstallCommand)([(0, linuxDistro_1.getPackageName)(packageMappings['git-lfs'], this.linuxDistro)], this.linuxDistro);
|
|
893
|
-
}
|
|
894
833
|
case 'bazelisk': {
|
|
895
834
|
return 'valdi dev_setup';
|
|
896
835
|
}
|
|
@@ -1020,7 +959,7 @@ const builder = (yargs) => {
|
|
|
1020
959
|
alias: 'j',
|
|
1021
960
|
})
|
|
1022
961
|
.option('framework', {
|
|
1023
|
-
describe: 'Include framework development checks (
|
|
962
|
+
describe: 'Include framework development checks (temurin, etc.)',
|
|
1024
963
|
type: 'boolean',
|
|
1025
964
|
default: false,
|
|
1026
965
|
alias: 'F',
|
package/dist/commands/install.js
CHANGED
|
@@ -36,6 +36,12 @@ async function valdiInstall(argv) {
|
|
|
36
36
|
await bazel.runTarget(buildInfo.application, buildInfo.bazelArgs);
|
|
37
37
|
break;
|
|
38
38
|
}
|
|
39
|
+
case constants_1.PLATFORM.LINUX: {
|
|
40
|
+
(0, errorUtils_1.logReproduceThisCommandIfNeeded)(argv);
|
|
41
|
+
console.log('Running Linux application...');
|
|
42
|
+
await bazel.runTarget(buildInfo.application, buildInfo.bazelArgs);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
39
45
|
case constants_1.PLATFORM.CLI: {
|
|
40
46
|
(0, errorUtils_1.logReproduceThisCommandIfNeeded)(argv);
|
|
41
47
|
console.log('Running CLI application...');
|
package/dist/core/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TEST_BUILD_FLAGS = exports.CLI_BUILD_FLAGS = exports.MACOS_BUILD_FLAGS = exports.IOS_BUILD_FLAGS = exports.IOS_DEVICE_BUILD_FLAGS = exports.RELEASE_BUILD_FLAGS = exports.DEBUG_BUILD_FLAGS = exports.ENABLE_RUNTIME_TRACES_BUILD_FLAGS = exports.ENABLE_RUNTIME_LOGS_BUILD_FLAGS = exports.ANDROID_X86_64_BUILD_FLAGS = exports.ANDROID_ARMV7_BUILD_FLAGS = exports.ANDROID_ARM64_BUILD_FLAGS = exports.ANDROID_BUILD_FLAGS = exports.COPY_CONFIG_PATH = exports.LINUX_SETUP_SCRIPT_DIR_PATH = exports.MACOS_SETUP_SCRIPT_DIR_PATH = exports.SETUP_SCRIPT_DIR_PATH = exports.BOOTSTRAP_DIR_PATH = exports.META_DIR_PATH = exports.CONFIG_DIR_PATH = exports.CLI_ROOT = exports.ANDROID_EXPORTED_LIBRARY_TAG = exports.IOS_EXPORTED_LIBRARY_TAG = exports.CLI_BAZEL_APPLICATION_TAG = exports.MACOS_BAZEL_APPLICATION_TAG = exports.ANDROID_BAZEL_APPLICATION_TAG = exports.IOS_BAZEL_APPLICATION_TAG = exports.VALID_PLATFORMS = exports.TEMPLATE_BASE_PATHS = exports.ALL_ARCHITECTURES = exports.Architecture = exports.PLATFORM = exports.ANSI_COLORS = exports.BAZEL_EXECUTABLES = exports.BAZEL_BIN_ENV = exports.VALDI_CONFIG_PATHS = void 0;
|
|
3
|
+
exports.TEST_BUILD_FLAGS = exports.CLI_BUILD_FLAGS = exports.LINUX_BUILD_FLAGS = exports.MACOS_BUILD_FLAGS = exports.IOS_BUILD_FLAGS = exports.IOS_DEVICE_BUILD_FLAGS = exports.RELEASE_BUILD_FLAGS = exports.DEBUG_BUILD_FLAGS = exports.ENABLE_RUNTIME_TRACES_BUILD_FLAGS = exports.ENABLE_RUNTIME_LOGS_BUILD_FLAGS = exports.ANDROID_X86_64_BUILD_FLAGS = exports.ANDROID_ARMV7_BUILD_FLAGS = exports.ANDROID_ARM64_BUILD_FLAGS = exports.ANDROID_BUILD_FLAGS = exports.COPY_CONFIG_PATH = exports.LINUX_SETUP_SCRIPT_DIR_PATH = exports.MACOS_SETUP_SCRIPT_DIR_PATH = exports.SETUP_SCRIPT_DIR_PATH = exports.BOOTSTRAP_DIR_PATH = exports.META_DIR_PATH = exports.CONFIG_DIR_PATH = exports.CLI_ROOT = exports.ANDROID_EXPORTED_LIBRARY_TAG = exports.IOS_EXPORTED_LIBRARY_TAG = exports.CLI_BAZEL_APPLICATION_TAG = exports.LINUX_BAZEL_APPLICATION_TAG = exports.MACOS_BAZEL_APPLICATION_TAG = exports.ANDROID_BAZEL_APPLICATION_TAG = exports.IOS_BAZEL_APPLICATION_TAG = exports.VALID_PLATFORMS = exports.TEMPLATE_BASE_PATHS = exports.ALL_ARCHITECTURES = exports.Architecture = exports.PLATFORM = exports.ANSI_COLORS = exports.BAZEL_EXECUTABLES = exports.BAZEL_BIN_ENV = exports.VALDI_CONFIG_PATHS = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
6
|
exports.VALDI_CONFIG_PATHS = ['~/.valdi/config.yaml', '~/.valdi/config.yml'];
|
|
@@ -20,6 +20,7 @@ var PLATFORM;
|
|
|
20
20
|
PLATFORM["IOS"] = "ios";
|
|
21
21
|
PLATFORM["ANDROID"] = "android";
|
|
22
22
|
PLATFORM["MACOS"] = "macos";
|
|
23
|
+
PLATFORM["LINUX"] = "linux";
|
|
23
24
|
PLATFORM["CLI"] = "cli";
|
|
24
25
|
})(PLATFORM || (exports.PLATFORM = PLATFORM = {}));
|
|
25
26
|
var Architecture;
|
|
@@ -44,10 +45,11 @@ var TEMPLATE_BASE_PATHS;
|
|
|
44
45
|
TEMPLATE_BASE_PATHS["EDITOR_CONFIG"] = ".editorconfig.template";
|
|
45
46
|
TEMPLATE_BASE_PATHS["AGENTS"] = "AGENTS.md.template";
|
|
46
47
|
})(TEMPLATE_BASE_PATHS || (exports.TEMPLATE_BASE_PATHS = TEMPLATE_BASE_PATHS = {}));
|
|
47
|
-
exports.VALID_PLATFORMS = [PLATFORM.ANDROID, PLATFORM.IOS, PLATFORM.MACOS, PLATFORM.CLI];
|
|
48
|
+
exports.VALID_PLATFORMS = [PLATFORM.ANDROID, PLATFORM.IOS, PLATFORM.MACOS, PLATFORM.LINUX, PLATFORM.CLI];
|
|
48
49
|
exports.IOS_BAZEL_APPLICATION_TAG = 'valdi_ios_application';
|
|
49
50
|
exports.ANDROID_BAZEL_APPLICATION_TAG = 'valdi_android_application';
|
|
50
51
|
exports.MACOS_BAZEL_APPLICATION_TAG = 'valdi_macos_application';
|
|
52
|
+
exports.LINUX_BAZEL_APPLICATION_TAG = 'valdi_linux_application';
|
|
51
53
|
exports.CLI_BAZEL_APPLICATION_TAG = 'valdi_cli_application';
|
|
52
54
|
exports.IOS_EXPORTED_LIBRARY_TAG = 'valdi_ios_exported_library';
|
|
53
55
|
exports.ANDROID_EXPORTED_LIBRARY_TAG = 'valdi_android_exported_library';
|
|
@@ -74,5 +76,6 @@ exports.IOS_DEVICE_BUILD_FLAGS = '--ios_multi_cpus=arm64';
|
|
|
74
76
|
exports.IOS_BUILD_FLAGS = '--repo_env=VALDI_PLATFORM_DEPENDENCIES=ios';
|
|
75
77
|
const INLINE_ASSETS_BUILD_FLAGS = ['--@valdi//bzl/valdi:assets_mode=inline'];
|
|
76
78
|
exports.MACOS_BUILD_FLAGS = [...INLINE_ASSETS_BUILD_FLAGS, '--repo_env=VALDI_PLATFORM_DEPENDENCIES=macos'];
|
|
79
|
+
exports.LINUX_BUILD_FLAGS = [...INLINE_ASSETS_BUILD_FLAGS, '--repo_env=VALDI_PLATFORM_DEPENDENCIES=linux'];
|
|
77
80
|
exports.CLI_BUILD_FLAGS = [...INLINE_ASSETS_BUILD_FLAGS, '--repo_env=VALDI_PLATFORM_DEPENDENCIES=cli'];
|
|
78
81
|
exports.TEST_BUILD_FLAGS = INLINE_ASSETS_BUILD_FLAGS;
|
|
@@ -93,9 +93,6 @@ class DevSetupHelper {
|
|
|
93
93
|
console.log(' 3. Run `valdi doctor` to verify your setup');
|
|
94
94
|
console.log(' 4. Create your first project with `valdi bootstrap`');
|
|
95
95
|
}
|
|
96
|
-
async setupGitLfs() {
|
|
97
|
-
await this.runShell('Initializing git-lfs', ['git lfs install']);
|
|
98
|
-
}
|
|
99
96
|
async setupShellAutoComplete() {
|
|
100
97
|
const rcFile = this.getRcFile();
|
|
101
98
|
if (!rcFile) {
|
package/dist/setup/linuxSetup.js
CHANGED
|
@@ -42,7 +42,6 @@ async function linuxSetup() {
|
|
|
42
42
|
console.log((0, logUtils_1.wrapInColor)('Unable to detect Linux distribution.', constants_1.ANSI_COLORS.YELLOW_COLOR));
|
|
43
43
|
console.log((0, logUtils_1.wrapInColor)('Please manually install the following dependencies and re-run this command:', constants_1.ANSI_COLORS.YELLOW_COLOR));
|
|
44
44
|
console.log(' - git');
|
|
45
|
-
console.log(' - git-lfs');
|
|
46
45
|
console.log(' - npm (Node.js)');
|
|
47
46
|
console.log(' - openjdk-17-jdk (or equivalent Java 17 JDK)');
|
|
48
47
|
console.log(' - watchman');
|
|
@@ -54,15 +53,6 @@ async function linuxSetup() {
|
|
|
54
53
|
throw new Error('Unable to proceed with automatic setup on unknown Linux distribution');
|
|
55
54
|
}
|
|
56
55
|
const packageMappings = (0, linuxDistro_1.getCommonPackageMappings)();
|
|
57
|
-
const repoSetupCommand = (0, linuxDistro_1.getGitLfsRepoSetupCommand)(distro);
|
|
58
|
-
if (repoSetupCommand && (0, linuxDistro_1.needsGitLfsRepoSetup)(distro)) {
|
|
59
|
-
try {
|
|
60
|
-
await devSetup.runShell('Setting up git-lfs repository', [repoSetupCommand]);
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
console.log((0, logUtils_1.wrapInColor)(`Warning: git-lfs repository setup failed. Will try to install git-lfs from standard repositories.`, constants_1.ANSI_COLORS.YELLOW_COLOR));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
56
|
const packagesToInstall = [];
|
|
67
57
|
if (!(0, cliUtils_1.checkCommandExists)('npm')) {
|
|
68
58
|
packagesToInstall.push((0, linuxDistro_1.getPackageName)(packageMappings['npm'], distro));
|
|
@@ -70,9 +60,6 @@ async function linuxSetup() {
|
|
|
70
60
|
if (!(0, cliUtils_1.checkCommandExists)('java')) {
|
|
71
61
|
packagesToInstall.push((0, linuxDistro_1.getPackageName)(packageMappings['openjdk-17'], distro));
|
|
72
62
|
}
|
|
73
|
-
if (!(0, cliUtils_1.checkCommandExists)('git-lfs')) {
|
|
74
|
-
packagesToInstall.push((0, linuxDistro_1.getPackageName)(packageMappings['git-lfs'], distro));
|
|
75
|
-
}
|
|
76
63
|
if (!(0, cliUtils_1.checkCommandExists)('watchman')) {
|
|
77
64
|
packagesToInstall.push((0, linuxDistro_1.getPackageName)(packageMappings['watchman'], distro));
|
|
78
65
|
}
|
|
@@ -104,7 +91,6 @@ async function linuxSetup() {
|
|
|
104
91
|
else {
|
|
105
92
|
console.log((0, logUtils_1.wrapInColor)('All required packages are already installed.', constants_1.ANSI_COLORS.GREEN_COLOR));
|
|
106
93
|
}
|
|
107
|
-
await devSetup.setupGitLfs();
|
|
108
94
|
await devSetup.setupShellAutoComplete();
|
|
109
95
|
if (distro.type === linuxDistro_1.LinuxDistroType.DEBIAN) {
|
|
110
96
|
const libtinfoInstalled = (0, cliUtils_1.checkCommandExists)('dpkg') &&
|
package/dist/setup/macOSSetup.js
CHANGED
|
@@ -68,7 +68,7 @@ async function macOSSetup() {
|
|
|
68
68
|
console.log('Note: Could not automatically configure Homebrew PATH in .zprofile');
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
const packages = ['npm', 'bazelisk', 'openjdk@17', 'temurin', '
|
|
71
|
+
const packages = ['npm', 'bazelisk', 'openjdk@17', 'temurin', 'watchman', 'ios-webkit-debug-proxy', 'android-platform-tools'];
|
|
72
72
|
const packagesToInstall = [];
|
|
73
73
|
for (const pkg of packages) {
|
|
74
74
|
try {
|
|
@@ -87,7 +87,6 @@ async function macOSSetup() {
|
|
|
87
87
|
else {
|
|
88
88
|
console.log('All Homebrew dependencies are already installed');
|
|
89
89
|
}
|
|
90
|
-
await devSetup.setupGitLfs();
|
|
91
90
|
await devSetup.setupShellAutoComplete();
|
|
92
91
|
const jdkSymlinkPath = '/Library/Java/JavaVirtualMachines/openjdk-17.jdk';
|
|
93
92
|
const jdkSourcePath = '/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk';
|
|
@@ -77,6 +77,9 @@ function getApplicationTargetTagForPlatform(platform) {
|
|
|
77
77
|
case constants_1.PLATFORM.MACOS: {
|
|
78
78
|
return constants_1.MACOS_BAZEL_APPLICATION_TAG;
|
|
79
79
|
}
|
|
80
|
+
case constants_1.PLATFORM.LINUX: {
|
|
81
|
+
return constants_1.LINUX_BAZEL_APPLICATION_TAG;
|
|
82
|
+
}
|
|
80
83
|
case constants_1.PLATFORM.CLI: {
|
|
81
84
|
return constants_1.CLI_BAZEL_APPLICATION_TAG;
|
|
82
85
|
}
|
|
@@ -93,6 +96,9 @@ function getExportedLibraryTargetTagForPlatform(platform) {
|
|
|
93
96
|
case constants_1.PLATFORM.MACOS: {
|
|
94
97
|
throw new errors_1.CliError('Exported library is not yet supported for macOS platform');
|
|
95
98
|
}
|
|
99
|
+
case constants_1.PLATFORM.LINUX: {
|
|
100
|
+
throw new errors_1.CliError('Exported library is not yet supported for Linux platform');
|
|
101
|
+
}
|
|
96
102
|
case constants_1.PLATFORM.CLI: {
|
|
97
103
|
throw new errors_1.CliError('Exported library is not supported for CLI platform');
|
|
98
104
|
}
|
|
@@ -109,6 +115,9 @@ function applicationExtensionForPlatform(platform) {
|
|
|
109
115
|
case constants_1.PLATFORM.MACOS: {
|
|
110
116
|
return '.zip';
|
|
111
117
|
}
|
|
118
|
+
case constants_1.PLATFORM.LINUX: {
|
|
119
|
+
return '';
|
|
120
|
+
}
|
|
112
121
|
case constants_1.PLATFORM.CLI: {
|
|
113
122
|
return '';
|
|
114
123
|
}
|
|
@@ -125,6 +134,9 @@ function exportedLibraryExtensionForPlatform(platform) {
|
|
|
125
134
|
case constants_1.PLATFORM.MACOS: {
|
|
126
135
|
return '.zip';
|
|
127
136
|
}
|
|
137
|
+
case constants_1.PLATFORM.LINUX: {
|
|
138
|
+
return '.zip';
|
|
139
|
+
}
|
|
128
140
|
case constants_1.PLATFORM.CLI: {
|
|
129
141
|
return '.zip';
|
|
130
142
|
}
|
|
@@ -188,6 +200,9 @@ function resolveBazelBuildArgs(platform, buildConfig, architectures, forDevice,
|
|
|
188
200
|
else if (platform === constants_1.PLATFORM.MACOS) {
|
|
189
201
|
allArgs.push(...constants_1.MACOS_BUILD_FLAGS);
|
|
190
202
|
}
|
|
203
|
+
else if (platform === constants_1.PLATFORM.LINUX) {
|
|
204
|
+
allArgs.push(...constants_1.LINUX_BUILD_FLAGS);
|
|
205
|
+
}
|
|
191
206
|
if (platform === constants_1.PLATFORM.ANDROID) {
|
|
192
207
|
allArgs.push(...constants_1.ANDROID_BUILD_FLAGS);
|
|
193
208
|
for (const architecture of architectures) {
|
|
@@ -5,8 +5,6 @@ exports.detectLinuxDistro = detectLinuxDistro;
|
|
|
5
5
|
exports.getPackageName = getPackageName;
|
|
6
6
|
exports.buildInstallCommand = buildInstallCommand;
|
|
7
7
|
exports.getCommonPackageMappings = getCommonPackageMappings;
|
|
8
|
-
exports.needsGitLfsRepoSetup = needsGitLfsRepoSetup;
|
|
9
|
-
exports.getGitLfsRepoSetupCommand = getGitLfsRepoSetupCommand;
|
|
10
8
|
const tslib_1 = require("tslib");
|
|
11
9
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
12
10
|
const cliUtils_1 = require("./cliUtils");
|
|
@@ -194,9 +192,6 @@ function getCommonPackageMappings() {
|
|
|
194
192
|
git: {
|
|
195
193
|
unknown: 'git',
|
|
196
194
|
},
|
|
197
|
-
'git-lfs': {
|
|
198
|
-
unknown: 'git-lfs',
|
|
199
|
-
},
|
|
200
195
|
npm: {
|
|
201
196
|
unknown: 'npm',
|
|
202
197
|
},
|
|
@@ -237,19 +232,3 @@ function getCommonPackageMappings() {
|
|
|
237
232
|
},
|
|
238
233
|
};
|
|
239
234
|
}
|
|
240
|
-
function needsGitLfsRepoSetup(distro = detectLinuxDistro()) {
|
|
241
|
-
return distro.type === LinuxDistroType.DEBIAN;
|
|
242
|
-
}
|
|
243
|
-
function getGitLfsRepoSetupCommand(distro = detectLinuxDistro()) {
|
|
244
|
-
switch (distro.type) {
|
|
245
|
-
case LinuxDistroType.DEBIAN: {
|
|
246
|
-
return 'curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash';
|
|
247
|
-
}
|
|
248
|
-
case LinuxDistroType.REDHAT: {
|
|
249
|
-
return 'curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.rpm.sh | sudo bash';
|
|
250
|
-
}
|
|
251
|
-
default: {
|
|
252
|
-
return null;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
@@ -85,58 +85,10 @@ describe('linuxDistro', () => {
|
|
|
85
85
|
expect(result).toContain('git, npm');
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
|
-
describe('needsGitLfsRepoSetup', () => {
|
|
89
|
-
it('returns true for Debian distributions', () => {
|
|
90
|
-
const distro = {
|
|
91
|
-
type: linuxDistro_1.LinuxDistroType.DEBIAN,
|
|
92
|
-
name: 'Ubuntu',
|
|
93
|
-
packageManager: { name: 'apt', installCommand: 'apt-get install', requiresSudo: true },
|
|
94
|
-
};
|
|
95
|
-
expect((0, linuxDistro_1.needsGitLfsRepoSetup)(distro)).toBe(true);
|
|
96
|
-
});
|
|
97
|
-
it('returns false for Arch distributions', () => {
|
|
98
|
-
const distro = {
|
|
99
|
-
type: linuxDistro_1.LinuxDistroType.ARCH,
|
|
100
|
-
name: 'Arch Linux',
|
|
101
|
-
packageManager: { name: 'pacman', installCommand: 'pacman -S', requiresSudo: true },
|
|
102
|
-
};
|
|
103
|
-
expect((0, linuxDistro_1.needsGitLfsRepoSetup)(distro)).toBe(false);
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
describe('getGitLfsRepoSetupCommand', () => {
|
|
107
|
-
it('returns Debian script for Debian distributions', () => {
|
|
108
|
-
const distro = {
|
|
109
|
-
type: linuxDistro_1.LinuxDistroType.DEBIAN,
|
|
110
|
-
name: 'Ubuntu',
|
|
111
|
-
packageManager: { name: 'apt', installCommand: 'apt-get install', requiresSudo: true },
|
|
112
|
-
};
|
|
113
|
-
const result = (0, linuxDistro_1.getGitLfsRepoSetupCommand)(distro);
|
|
114
|
-
expect(result).toContain('script.deb.sh');
|
|
115
|
-
});
|
|
116
|
-
it('returns RPM script for RedHat distributions', () => {
|
|
117
|
-
const distro = {
|
|
118
|
-
type: linuxDistro_1.LinuxDistroType.REDHAT,
|
|
119
|
-
name: 'Fedora',
|
|
120
|
-
packageManager: { name: 'dnf', installCommand: 'dnf install', requiresSudo: true },
|
|
121
|
-
};
|
|
122
|
-
const result = (0, linuxDistro_1.getGitLfsRepoSetupCommand)(distro);
|
|
123
|
-
expect(result).toContain('script.rpm.sh');
|
|
124
|
-
});
|
|
125
|
-
it('returns null for distributions with git-lfs in standard repos', () => {
|
|
126
|
-
const distro = {
|
|
127
|
-
type: linuxDistro_1.LinuxDistroType.ARCH,
|
|
128
|
-
name: 'Arch Linux',
|
|
129
|
-
packageManager: { name: 'pacman', installCommand: 'pacman -S', requiresSudo: true },
|
|
130
|
-
};
|
|
131
|
-
const result = (0, linuxDistro_1.getGitLfsRepoSetupCommand)(distro);
|
|
132
|
-
expect(result).toBeNull();
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
88
|
describe('getCommonPackageMappings', () => {
|
|
136
89
|
it('returns package mappings for common dependencies', () => {
|
|
137
90
|
const mappings = (0, linuxDistro_1.getCommonPackageMappings)();
|
|
138
91
|
expect(mappings['git']).toBeDefined();
|
|
139
|
-
expect(mappings['git-lfs']).toBeDefined();
|
|
140
92
|
expect(mappings['npm']).toBeDefined();
|
|
141
93
|
expect(mappings['openjdk-17']).toBeDefined();
|
|
142
94
|
expect(mappings['watchman']).toBeDefined();
|
|
@@ -121,26 +121,52 @@ const CursorAdapter = {
|
|
|
121
121
|
const cursorDir = path.join(os.homedir(), '.cursor');
|
|
122
122
|
return fs.existsSync(cursorDir);
|
|
123
123
|
},
|
|
124
|
-
install(skillName, content, meta) {
|
|
125
|
-
const
|
|
126
|
-
fs.mkdirSync(
|
|
127
|
-
const frontmatter = `---\
|
|
128
|
-
fs.writeFileSync(path.join(
|
|
124
|
+
install(skillName, content, meta, resourceDir) {
|
|
125
|
+
const skillDir = path.join(os.homedir(), '.cursor', 'skills', skillName);
|
|
126
|
+
fs.mkdirSync(skillDir, { recursive: true });
|
|
127
|
+
const frontmatter = `---\nname: ${meta.name}\ndescription: ${meta.description}\n---\n\n`;
|
|
128
|
+
fs.writeFileSync(path.join(skillDir, 'SKILL.md'), frontmatter + content, 'utf8');
|
|
129
|
+
if (resourceDir) {
|
|
130
|
+
for (const entry of fs.readdirSync(resourceDir, { withFileTypes: true })) {
|
|
131
|
+
if (entry.isDirectory()) {
|
|
132
|
+
copyDirSync(path.join(resourceDir, entry.name), path.join(skillDir, entry.name));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const legacyFile = path.join(os.homedir(), '.cursor', 'rules', `valdi-${skillName}.mdc`);
|
|
137
|
+
if (fs.existsSync(legacyFile)) {
|
|
138
|
+
fs.unlinkSync(legacyFile);
|
|
139
|
+
}
|
|
129
140
|
},
|
|
130
141
|
remove(skillName) {
|
|
131
|
-
const
|
|
132
|
-
if (fs.existsSync(
|
|
133
|
-
fs.
|
|
142
|
+
const skillDir = path.join(os.homedir(), '.cursor', 'skills', skillName);
|
|
143
|
+
if (fs.existsSync(skillDir)) {
|
|
144
|
+
fs.rmSync(skillDir, { recursive: true, force: true });
|
|
145
|
+
}
|
|
146
|
+
const legacyFile = path.join(os.homedir(), '.cursor', 'rules', `valdi-${skillName}.mdc`);
|
|
147
|
+
if (fs.existsSync(legacyFile)) {
|
|
148
|
+
fs.unlinkSync(legacyFile);
|
|
134
149
|
}
|
|
135
150
|
},
|
|
136
151
|
listInstalled() {
|
|
152
|
+
const installed = new Set();
|
|
153
|
+
const skillsDir = path.join(os.homedir(), '.cursor', 'skills');
|
|
154
|
+
if (fs.existsSync(skillsDir)) {
|
|
155
|
+
for (const entry of fs.readdirSync(skillsDir)) {
|
|
156
|
+
if (fs.existsSync(path.join(skillsDir, entry, 'SKILL.md'))) {
|
|
157
|
+
installed.add(entry);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
137
161
|
const rulesDir = path.join(os.homedir(), '.cursor', 'rules');
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
162
|
+
if (fs.existsSync(rulesDir)) {
|
|
163
|
+
for (const f of fs.readdirSync(rulesDir)) {
|
|
164
|
+
if (f.startsWith('valdi-') && f.endsWith('.mdc')) {
|
|
165
|
+
installed.add(f.replace(/^valdi-/u, '').replace(/\.mdc$/u, ''));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return Array.from(installed);
|
|
144
170
|
},
|
|
145
171
|
};
|
|
146
172
|
const CopilotAdapter = {
|
|
@@ -58,3 +58,84 @@ describe('ClaudeCodeAdapter', () => {
|
|
|
58
58
|
expect(adapter.listInstalled()).not.toContain('to-remove');
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
+
describe('CursorAdapter', () => {
|
|
62
|
+
let tmpHome;
|
|
63
|
+
let origHome;
|
|
64
|
+
beforeEach(() => {
|
|
65
|
+
tmpHome = fs.mkdtempSync(path.join(os.tmpdir(), 'valdi-test-'));
|
|
66
|
+
origHome = process.env['HOME'];
|
|
67
|
+
process.env['HOME'] = tmpHome;
|
|
68
|
+
fs.mkdirSync(path.join(tmpHome, '.cursor'), { recursive: true });
|
|
69
|
+
});
|
|
70
|
+
afterEach(() => {
|
|
71
|
+
process.env['HOME'] = origHome;
|
|
72
|
+
fs.rmSync(tmpHome, { recursive: true, force: true });
|
|
73
|
+
});
|
|
74
|
+
function getAdapter() {
|
|
75
|
+
const adapter = (0, skillsAdapters_1.getAdapterByName)('cursor');
|
|
76
|
+
expect(adapter).toBeDefined();
|
|
77
|
+
return adapter;
|
|
78
|
+
}
|
|
79
|
+
it('installs SKILL.md to ~/.cursor/skills/ without double-prefixing', () => {
|
|
80
|
+
const adapter = getAdapter();
|
|
81
|
+
adapter.install('valdi-bazel', '# Content', { name: 'valdi-bazel', description: 'A skill', tags: [], path: '', category: [] });
|
|
82
|
+
const skillPath = path.join(tmpHome, '.cursor', 'skills', 'valdi-bazel', 'SKILL.md');
|
|
83
|
+
expect(fs.existsSync(skillPath)).toBe(true);
|
|
84
|
+
const content = fs.readFileSync(skillPath, 'utf8');
|
|
85
|
+
expect(content).toContain('name: valdi-bazel');
|
|
86
|
+
expect(content).toContain('description: A skill');
|
|
87
|
+
expect(content).toContain('# Content');
|
|
88
|
+
const badPath = path.join(tmpHome, '.cursor', 'skills', 'valdi-valdi-bazel', 'SKILL.md');
|
|
89
|
+
expect(fs.existsSync(badPath)).toBe(false);
|
|
90
|
+
});
|
|
91
|
+
it('does not install to deprecated ~/.cursor/rules/', () => {
|
|
92
|
+
const adapter = getAdapter();
|
|
93
|
+
adapter.install('valdi-bazel', '# Content', { name: 'valdi-bazel', description: 'A skill', tags: [], path: '', category: [] });
|
|
94
|
+
const legacyPath = path.join(tmpHome, '.cursor', 'rules', 'valdi-valdi-bazel.mdc');
|
|
95
|
+
expect(fs.existsSync(legacyPath)).toBe(false);
|
|
96
|
+
});
|
|
97
|
+
it('cleans up double-prefixed legacy .mdc file on install', () => {
|
|
98
|
+
const legacyDir = path.join(tmpHome, '.cursor', 'rules');
|
|
99
|
+
fs.mkdirSync(legacyDir, { recursive: true });
|
|
100
|
+
fs.writeFileSync(path.join(legacyDir, 'valdi-valdi-bazel.mdc'), 'old content', 'utf8');
|
|
101
|
+
const adapter = getAdapter();
|
|
102
|
+
adapter.install('valdi-bazel', '# New content', { name: 'valdi-bazel', description: 'A skill', tags: [], path: '', category: [] });
|
|
103
|
+
expect(fs.existsSync(path.join(legacyDir, 'valdi-valdi-bazel.mdc'))).toBe(false);
|
|
104
|
+
expect(fs.existsSync(path.join(tmpHome, '.cursor', 'skills', 'valdi-bazel', 'SKILL.md'))).toBe(true);
|
|
105
|
+
});
|
|
106
|
+
it('lists installed skills', () => {
|
|
107
|
+
const adapter = getAdapter();
|
|
108
|
+
adapter.install('valdi-tsx', '# A', { name: 'valdi-tsx', description: 'A', tags: [], path: '', category: [] });
|
|
109
|
+
adapter.install('valdi-bazel', '# B', { name: 'valdi-bazel', description: 'B', tags: [], path: '', category: [] });
|
|
110
|
+
const installed = adapter.listInstalled();
|
|
111
|
+
expect(installed).toContain('valdi-tsx');
|
|
112
|
+
expect(installed).toContain('valdi-bazel');
|
|
113
|
+
});
|
|
114
|
+
it('lists legacy .mdc skills from ~/.cursor/rules/', () => {
|
|
115
|
+
const rulesDir = path.join(tmpHome, '.cursor', 'rules');
|
|
116
|
+
fs.mkdirSync(rulesDir, { recursive: true });
|
|
117
|
+
fs.writeFileSync(path.join(rulesDir, 'valdi-valdi-legacy.mdc'), 'old content', 'utf8');
|
|
118
|
+
const adapter = getAdapter();
|
|
119
|
+
expect(adapter.listInstalled()).toContain('valdi-legacy');
|
|
120
|
+
});
|
|
121
|
+
it('deduplicates skills present in both locations', () => {
|
|
122
|
+
const adapter = getAdapter();
|
|
123
|
+
adapter.install('valdi-both', '# New', { name: 'valdi-both', description: 'B', tags: [], path: '', category: [] });
|
|
124
|
+
const rulesDir = path.join(tmpHome, '.cursor', 'rules');
|
|
125
|
+
fs.mkdirSync(rulesDir, { recursive: true });
|
|
126
|
+
fs.writeFileSync(path.join(rulesDir, 'valdi-valdi-both.mdc'), 'old', 'utf8');
|
|
127
|
+
const installed = adapter.listInstalled();
|
|
128
|
+
const count = installed.filter((s) => s === 'valdi-both').length;
|
|
129
|
+
expect(count).toBe(1);
|
|
130
|
+
});
|
|
131
|
+
it('removes a skill and cleans up legacy file', () => {
|
|
132
|
+
const adapter = getAdapter();
|
|
133
|
+
adapter.install('valdi-to-remove', '# Remove', { name: 'valdi-to-remove', description: 'R', tags: [], path: '', category: [] });
|
|
134
|
+
const legacyDir = path.join(tmpHome, '.cursor', 'rules');
|
|
135
|
+
fs.mkdirSync(legacyDir, { recursive: true });
|
|
136
|
+
fs.writeFileSync(path.join(legacyDir, 'valdi-valdi-to-remove.mdc'), 'old', 'utf8');
|
|
137
|
+
adapter.remove('valdi-to-remove');
|
|
138
|
+
expect(adapter.listInstalled()).not.toContain('valdi-to-remove');
|
|
139
|
+
expect(fs.existsSync(path.join(legacyDir, 'valdi-valdi-to-remove.mdc'))).toBe(false);
|
|
140
|
+
});
|
|
141
|
+
});
|