form-tester 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/form-tester/SKILL.md +1 -1
- package/form-tester.js +51 -18
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: form-tester
|
|
3
3
|
description: Runs the form-tester CLI to test /skjemautfyller forms via Playwright CLI and exposes playwright-cli commands.
|
|
4
|
-
allowed-tools: Bash(powershell:*), Bash(playwright-cli:*)
|
|
4
|
+
allowed-tools: Bash(powershell:*), Bash(playwright-cli:*), Bash(npx form-tester:*)
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Form Tester CLI
|
package/form-tester.js
CHANGED
|
@@ -6,7 +6,7 @@ const { spawn, execSync } = require("child_process");
|
|
|
6
6
|
|
|
7
7
|
const CONFIG_PATH = path.join(__dirname, "form-tester.config.json");
|
|
8
8
|
const OUTPUT_BASE = path.resolve(__dirname, "output");
|
|
9
|
-
const LOCAL_VERSION = "0.3.
|
|
9
|
+
const LOCAL_VERSION = "0.3.4";
|
|
10
10
|
const RECOMMENDED_PERSON = "Uromantisk Direktør";
|
|
11
11
|
|
|
12
12
|
const PERSONAS = [
|
|
@@ -947,36 +947,59 @@ function copyDirSync(src, dest) {
|
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
949
|
|
|
950
|
-
function install(targetDir) {
|
|
950
|
+
function install(targetDir, isGlobal) {
|
|
951
951
|
const pkgDir = __dirname;
|
|
952
952
|
const skillsSrc = path.join(pkgDir, ".claude", "skills");
|
|
953
953
|
const copilotSrc = path.join(pkgDir, ".github", "copilot-instructions.md");
|
|
954
954
|
const configSrc = path.join(pkgDir, "form-tester.config.example.json");
|
|
955
955
|
|
|
956
956
|
// Copy Claude Code skills
|
|
957
|
-
const skillsDest =
|
|
957
|
+
const skillsDest = isGlobal
|
|
958
|
+
? path.join(targetDir, "skills")
|
|
959
|
+
: path.join(targetDir, ".claude", "skills");
|
|
958
960
|
for (const skill of ["form-tester", "playwright-cli"]) {
|
|
959
961
|
const src = path.join(skillsSrc, skill);
|
|
960
962
|
if (fs.existsSync(src)) {
|
|
961
963
|
const dest = path.join(skillsDest, skill);
|
|
962
964
|
copyDirSync(src, dest);
|
|
963
|
-
console.log(` Installed .claude/skills/${skill}/`);
|
|
965
|
+
console.log(` Installed ${isGlobal ? "~/.claude" : ".claude"}/skills/${skill}/`);
|
|
964
966
|
}
|
|
965
967
|
}
|
|
966
968
|
|
|
967
|
-
//
|
|
968
|
-
if (
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
969
|
+
// Project-only files (skip for global install)
|
|
970
|
+
if (!isGlobal) {
|
|
971
|
+
if (fs.existsSync(copilotSrc)) {
|
|
972
|
+
const copilotDest = path.join(targetDir, ".github", "copilot-instructions.md");
|
|
973
|
+
fs.mkdirSync(path.dirname(copilotDest), { recursive: true });
|
|
974
|
+
fs.copyFileSync(copilotSrc, copilotDest);
|
|
975
|
+
console.log(" Installed .github/copilot-instructions.md");
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
if (fs.existsSync(configSrc)) {
|
|
979
|
+
const configDest = path.join(targetDir, "form-tester.config.example.json");
|
|
980
|
+
fs.copyFileSync(configSrc, configDest);
|
|
981
|
+
console.log(" Installed form-tester.config.example.json");
|
|
982
|
+
}
|
|
973
983
|
}
|
|
974
984
|
|
|
975
|
-
//
|
|
976
|
-
if (
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
console.log("
|
|
985
|
+
// Install playwright-cli globally if not already available
|
|
986
|
+
if (isPlaywrightCliAvailable()) {
|
|
987
|
+
console.log(" playwright-cli already in PATH");
|
|
988
|
+
} else {
|
|
989
|
+
console.log(" Installing playwright-cli globally...");
|
|
990
|
+
try {
|
|
991
|
+
execSync("npm install -g @playwright/cli@latest", {
|
|
992
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
993
|
+
});
|
|
994
|
+
console.log(" Installed playwright-cli globally");
|
|
995
|
+
} catch (err) {
|
|
996
|
+
console.log(
|
|
997
|
+
" WARNING: Failed to install playwright-cli globally.",
|
|
998
|
+
);
|
|
999
|
+
console.log(
|
|
1000
|
+
" Run manually: npm install -g @playwright/cli@latest",
|
|
1001
|
+
);
|
|
1002
|
+
}
|
|
980
1003
|
}
|
|
981
1004
|
|
|
982
1005
|
console.log("\nDone! Next steps:");
|
|
@@ -989,9 +1012,19 @@ async function main() {
|
|
|
989
1012
|
const args = process.argv.slice(2);
|
|
990
1013
|
|
|
991
1014
|
if (args[0] === "install") {
|
|
992
|
-
const
|
|
993
|
-
|
|
994
|
-
|
|
1015
|
+
const isGlobal = args.includes("--global") || args.includes("-g");
|
|
1016
|
+
const remaining = args.slice(1).filter((a) => a !== "--global" && a !== "-g");
|
|
1017
|
+
let targetDir;
|
|
1018
|
+
if (isGlobal) {
|
|
1019
|
+
const home = process.env.HOME || process.env.USERPROFILE;
|
|
1020
|
+
targetDir = path.join(home, ".claude");
|
|
1021
|
+
// Global installs skills directly into ~/.claude/skills/
|
|
1022
|
+
console.log(`Installing form-tester skills globally to ${targetDir} ...\n`);
|
|
1023
|
+
} else {
|
|
1024
|
+
targetDir = remaining[0] ? path.resolve(remaining[0]) : process.cwd();
|
|
1025
|
+
console.log(`Installing form-tester skills to ${targetDir} ...\n`);
|
|
1026
|
+
}
|
|
1027
|
+
install(targetDir, isGlobal);
|
|
995
1028
|
process.exit(0);
|
|
996
1029
|
}
|
|
997
1030
|
|
package/package.json
CHANGED