form-tester 0.2.3 → 0.3.0

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 (3) hide show
  1. package/README.md +17 -18
  2. package/form-tester.js +61 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,30 +2,29 @@
2
2
 
3
3
  AI-powered testing skill for `/skjemautfyller` forms using [Playwright CLI](https://www.npmjs.com/package/@playwright/cli). Works with **Claude Code** and **GitHub Copilot**.
4
4
 
5
- ## Prerequisites
6
-
7
- - Node.js 18+
8
- - [Playwright CLI](https://www.npmjs.com/package/@playwright/cli)
9
-
10
- ## Installation
11
-
12
- ### 1. Clone the repo
5
+ ## Quick Install
13
6
 
14
7
  ```bash
15
- git clone https://github.com/YOUR_ORG/form-tester.git
16
- cd form-tester
8
+ npx form-tester install
17
9
  ```
18
10
 
19
- ### 2. Install Playwright CLI
11
+ This installs skill files into your project:
12
+ - `.claude/skills/form-tester/` — Claude Code skill
13
+ - `.claude/skills/playwright-cli/` — Playwright CLI skill
14
+ - `.github/copilot-instructions.md` — GitHub Copilot instructions
15
+ - `form-tester.config.example.json` — Config template
16
+
17
+ ## Prerequisites
18
+
19
+ - Node.js 18+
20
+ - [Playwright CLI](https://www.npmjs.com/package/@playwright/cli)
20
21
 
21
22
  ```bash
22
- npm run setup
23
- # or manually:
24
23
  npm install -g @playwright/cli@latest
25
24
  playwright-cli install --skills
26
25
  ```
27
26
 
28
- ### 3. Configure
27
+ ## Configuration
29
28
 
30
29
  ```bash
31
30
  cp form-tester.config.example.json form-tester.config.json
@@ -37,20 +36,20 @@ Edit `form-tester.config.json` and set your `pnr`.
37
36
 
38
37
  ### Claude Code
39
38
 
40
- The skill is automatically detected when you open this directory in Claude Code. Use the `/form-tester` skill or run:
39
+ The skill is automatically detected when you open the project in Claude Code. Use the `/form-tester` skill or run:
41
40
 
42
41
  ```bash
43
- node form-tester.js
42
+ npx form-tester
44
43
  ```
45
44
 
46
45
  ### GitHub Copilot
47
46
 
48
- Copilot reads instructions from `.github/copilot-instructions.md` automatically. Open this directory in VS Code with Copilot enabled — it will have context on the form-tester commands and workflow.
47
+ Copilot reads instructions from `.github/copilot-instructions.md` automatically. Open the project in VS Code with Copilot enabled.
49
48
 
50
49
  ### Standalone CLI
51
50
 
52
51
  ```bash
53
- node form-tester.js
52
+ npx form-tester
54
53
  ```
55
54
 
56
55
  Commands: `/setup`, `/update`, `/version`, `/people`, `/test {url}`, `/save {label}`, `/clear`, `/quit`
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.2.3";
9
+ const LOCAL_VERSION = "0.3.0";
10
10
  const RECOMMENDED_PERSON = "Uromantisk Direktør";
11
11
 
12
12
  const PERSONAS = [
@@ -934,11 +934,70 @@ async function handleCommand(line, config) {
934
934
  }
935
935
  }
936
936
 
937
+ function copyDirSync(src, dest) {
938
+ fs.mkdirSync(dest, { recursive: true });
939
+ for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
940
+ const srcPath = path.join(src, entry.name);
941
+ const destPath = path.join(dest, entry.name);
942
+ if (entry.isDirectory()) {
943
+ copyDirSync(srcPath, destPath);
944
+ } else {
945
+ fs.copyFileSync(srcPath, destPath);
946
+ }
947
+ }
948
+ }
949
+
950
+ function install(targetDir) {
951
+ const pkgDir = __dirname;
952
+ const skillsSrc = path.join(pkgDir, ".claude", "skills");
953
+ const copilotSrc = path.join(pkgDir, ".github", "copilot-instructions.md");
954
+ const configSrc = path.join(pkgDir, "form-tester.config.example.json");
955
+
956
+ // Copy Claude Code skills
957
+ const skillsDest = path.join(targetDir, ".claude", "skills");
958
+ for (const skill of ["form-tester", "playwright-cli"]) {
959
+ const src = path.join(skillsSrc, skill);
960
+ if (fs.existsSync(src)) {
961
+ const dest = path.join(skillsDest, skill);
962
+ copyDirSync(src, dest);
963
+ console.log(` Installed .claude/skills/${skill}/`);
964
+ }
965
+ }
966
+
967
+ // Copy Copilot instructions
968
+ if (fs.existsSync(copilotSrc)) {
969
+ const copilotDest = path.join(targetDir, ".github", "copilot-instructions.md");
970
+ fs.mkdirSync(path.dirname(copilotDest), { recursive: true });
971
+ fs.copyFileSync(copilotSrc, copilotDest);
972
+ console.log(" Installed .github/copilot-instructions.md");
973
+ }
974
+
975
+ // Copy config example
976
+ if (fs.existsSync(configSrc)) {
977
+ const configDest = path.join(targetDir, "form-tester.config.example.json");
978
+ fs.copyFileSync(configSrc, configDest);
979
+ console.log(" Installed form-tester.config.example.json");
980
+ }
981
+
982
+ console.log("\nDone! Next steps:");
983
+ console.log(" 1. cp form-tester.config.example.json form-tester.config.json");
984
+ console.log(' 2. Edit form-tester.config.json and set your "pnr"');
985
+ console.log(" 3. Run: npx form-tester");
986
+ }
987
+
937
988
  async function main() {
989
+ const args = process.argv.slice(2);
990
+
991
+ if (args[0] === "install") {
992
+ const targetDir = args[1] ? path.resolve(args[1]) : process.cwd();
993
+ console.log(`Installing form-tester skills to ${targetDir} ...\n`);
994
+ install(targetDir);
995
+ process.exit(0);
996
+ }
997
+
938
998
  const config = loadConfig();
939
999
  await handleVersionMismatch(config);
940
1000
 
941
- const args = process.argv.slice(2);
942
1001
  if (args.includes("--help") || args.includes("-h")) {
943
1002
  printHelp();
944
1003
  process.exit(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "form-tester",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "AI-powered form testing skill for /skjemautfyller forms using Playwright CLI. Works with Claude Code and GitHub Copilot.",
5
5
  "main": "form-tester.js",
6
6
  "bin": {