Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: standardize config paths and align e2e task states

Luigi Agosticf0323f21a47
diff --git a/docs/guides/data-storage.md b/docs/guides/data-storage.md
index e342186f..c6a49c5c 100644
--- a/docs/guides/data-storage.md
+++ b/docs/guides/data-storage.md
@@ -19,7 +19,7 @@ PinchTab uses the OS config directory:
| OS | Default Base Directory |
| --- | --- |
-| Linux | `~/.config/pinchtab/` or `$XDG_CONFIG_HOME/pinchtab/` |
+| Linux | `~/.pinchtab/` |
| macOS | `~/.pinchtab/` |
| Windows | `%APPDATA%\\pinchtab\\` |
@@ -35,11 +35,11 @@ pinchtab/
└── default/
```
-## Legacy Fallback
+## Platform Defaults
-On macOS, `~/.pinchtab/` is the default base directory.
+On macOS and Linux, `~/.pinchtab/` is the default base directory.
-On Linux and Windows, PinchTab still falls back to `~/.pinchtab/` when that legacy directory already exists and the newer OS-native location does not.
+On Windows, PinchTab uses the OS-native config directory under `%APPDATA%\\pinchtab\\`.
## Profiles
diff --git a/docs/guides/mcp-agents.md b/docs/guides/mcp-agents.md
index eeeccc6a..52d7fec0 100644
--- a/docs/guides/mcp-agents.md
+++ b/docs/guides/mcp-agents.md
@@ -153,11 +153,14 @@ Tool calls:
pinchtab config set security.allowEvaluate true
```
-Or in `~/.config/pinchtab/config.yaml`:
+Or in `~/.pinchtab/config.json`:
-```yaml
-security:
- allowEvaluate: true
+```json
+{
+ "security": {
+ "allowEvaluate": true
+ }
+}
```
Restart PinchTab after changing this setting.
diff --git a/docs/guides/raspberry-pi.md b/docs/guides/raspberry-pi.md
index 65161816..add58443 100644
--- a/docs/guides/raspberry-pi.md
+++ b/docs/guides/raspberry-pi.md
@@ -66,7 +66,7 @@ Example:
"blockAds": true
},
"profiles": {
- "baseDir": "/home/pi/.config/pinchtab/profiles",
+ "baseDir": "/home/pi/.pinchtab/profiles",
"defaultProfile": "default"
}
}
@@ -75,7 +75,7 @@ Example:
Run with it:
```bash
-PINCHTAB_CONFIG=/home/pi/.config/pinchtab/config.json ./pinchtab
+PINCHTAB_CONFIG=/home/pi/.pinchtab/config.json ./pinchtab
```
## Headless Vs Headed
@@ -134,7 +134,7 @@ Type=simple
User=pi
WorkingDirectory=/home/pi
ExecStart=/home/pi/pinchtab
-Environment=PINCHTAB_CONFIG=/home/pi/.config/pinchtab/config.json
+Environment=PINCHTAB_CONFIG=/home/pi/.pinchtab/config.json
Restart=always
RestartSec=10
diff --git a/docs/implementations/chrome-files.md b/docs/implementations/chrome-files.md
index 4df09ba0..f98c1be7 100644
--- a/docs/implementations/chrome-files.md
+++ b/docs/implementations/chrome-files.md
@@ -8,7 +8,7 @@ PinchTab determines the Chrome `--user-data-dir` (profile) using the following p
1. **Explicit `ProfileDir`**: If a specific path is provided in the configuration or as a flag, PinchTab uses that exact directory.
2. **Named Profile**: If a profile name is provided (e.g., via the dashboard or CLI), PinchTab resolves it to a subdirectory within the `ProfilesBaseDir`.
-3. **Default Profile**: If no profile is specified, it defaults to `~/.config/pinchtab/profiles/default` (on Linux/macOS).
+3. **Default Profile**: If no profile is specified, it defaults to `~/.pinchtab/profiles/default` (on Linux/macOS).
## The Singleton Model
diff --git a/docs/reference/config.md b/docs/reference/config.md
index ec0f5a24..b1779e78 100644
--- a/docs/reference/config.md
+++ b/docs/reference/config.md
@@ -126,10 +126,10 @@ For remote CLI targeting, use the root `--server` flag instead of config.
Default location by OS:
- macOS: `~/.pinchtab/config.json`
-- Linux: `~/.config/pinchtab/config.json` or `$XDG_CONFIG_HOME/pinchtab/config.json`
+- Linux: `~/.pinchtab/config.json`
- Windows: `%APPDATA%\pinchtab\config.json`
-On macOS, PinchTab defaults to `~/.pinchtab` so the CLI, npm-managed binary, and config file all use the same base directory.
+On macOS and Linux, PinchTab defaults to `~/.pinchtab` so the CLI, npm-managed binary, and config file all use the same base directory.
Override the config path with:
@@ -300,7 +300,7 @@ For Linux container compatibility, use the runtime-managed path instead of `brow
By default, PinchTab looks for unpacked Chrome extensions in `<server.stateDir>/extensions`. On a normal local install that means the OS-specific PinchTab config directory plus `extensions/`, for example:
- macOS: `~/.pinchtab/extensions`
-- Linux: `~/.config/pinchtab/extensions`
+- Linux: `~/.pinchtab/extensions`
- Windows: `%APPDATA%\\pinchtab\\extensions`
You can change or clear that default with `browser.extensionPaths`.
diff --git a/internal/config/config_utils.go b/internal/config/config_utils.go
index 8d81dea4..c6abb6c7 100644
--- a/internal/config/config_utils.go
+++ b/internal/config/config_utils.go
@@ -24,9 +24,9 @@ func userConfigDir() string {
home := homeDir()
legacyPath := filepath.Join(home, ".pinchtab")
- // On macOS, keep config and state rooted in ~/.pinchtab so the CLI,
- // npm-managed binary, and config path all resolve to the same location.
- if runtime.GOOS == "darwin" {
+ // On macOS and Linux, keep config and state rooted in ~/.pinchtab so the
+ // CLI, npm-managed binary, and config path all resolve to the same location.
+ if runtime.GOOS == "darwin" || runtime.GOOS == "linux" {
return legacyPath
}
@@ -35,29 +35,7 @@ func userConfigDir() string {
return legacyPath
}
- newPath := filepath.Join(configDir, "pinchtab")
-
- // Priority 1: Check for config FILE (handles case where both dirs exist
- // but only legacy has config.json — the issue #224 scenario)
- legacyConfig := filepath.Join(legacyPath, "config.json")
- newConfig := filepath.Join(newPath, "config.json")
-
- if fileExists(legacyConfig) && !fileExists(newConfig) {
- return legacyPath
- }
-
- // Priority 2: Check for DIRECTORY (handles init scenario where
- // legacy dir exists from npm install but no config yet)
- if dirExists(legacyPath) && !dirExists(newPath) {
- return legacyPath
- }
-
- return newPath
-}
-
-func fileExists(path string) bool {
- info, err := os.Stat(path)
- return err == nil && !info.IsDir()
+ return filepath.Join(configDir, "pinchtab")
}
// DefaultConfigPath returns the default config file location used when
@@ -73,14 +51,6 @@ func defaultExtensionsDir(baseDir string) string {
return filepath.Join(baseDir, "extensions")
}
-func dirExists(path string) bool {
- info, err := os.Stat(path)
- if err != nil {
- return false
- }
- return info.IsDir()
-}
-
func (c *RuntimeConfig) ListenAddr() string {
return c.Bind + ":" + c.Port
}
diff --git a/internal/config/config_utils_test.go b/internal/config/config_utils_test.go
index c90e2a74..fde78805 100644
--- a/internal/config/config_utils_test.go
+++ b/internal/config/config_utils_test.go
@@ -60,12 +60,9 @@ func TestIsFirstRun(t *testing.T) {
}
}
-// TestUserConfigDirLegacyConfigFilePriority tests that when legacy config FILE exists
-// but the XDG config directory already exists (without config.json), the legacy path
-// is still used. This exercises the full userConfigDir path resolution for issue #224.
-func TestUserConfigDirLegacyConfigFilePriority(t *testing.T) {
+func TestUserConfigDirLinuxAlwaysUsesLegacyPath(t *testing.T) {
if runtime.GOOS != "linux" {
- t.Skip("Linux-specific XDG path test")
+ t.Skip("Linux-specific path test")
}
tmpHome, err := os.MkdirTemp("", "pinchtab-home-*")
@@ -75,31 +72,17 @@ func TestUserConfigDirLegacyConfigFilePriority(t *testing.T) {
defer func() { _ = os.RemoveAll(tmpHome) }()
t.Setenv("HOME", tmpHome)
- t.Setenv("XDG_CONFIG_HOME", filepath.Join(tmpHome, ".config"))
-
- legacyDir := filepath.Join(tmpHome, ".pinchtab")
- newDir := filepath.Join(tmpHome, ".config", "pinchtab")
- if err := os.MkdirAll(legacyDir, 0755); err != nil {
- t.Fatalf("Failed to create legacy dir: %v", err)
- }
- if err := os.MkdirAll(newDir, 0755); err != nil {
- t.Fatalf("Failed to create new dir: %v", err)
- }
-
- legacyConfig := filepath.Join(legacyDir, "config.json")
- if err := os.WriteFile(legacyConfig, []byte(`{"server":{"port":"9876"}}`), 0644); err != nil {
- t.Fatalf("Failed to create legacy config: %v", err)
- }
got := userConfigDir()
- if got != legacyDir {
- t.Fatalf("userConfigDir() = %q, want legacy path %q", got, legacyDir)
+ want := filepath.Join(tmpHome, ".pinchtab")
+ if got != want {
+ t.Fatalf("userConfigDir() = %q, want Linux default path %q", got, want)
}
}
-func TestUserConfigDirPrefersNewConfigFileWhenPresent(t *testing.T) {
- if runtime.GOOS != "linux" {
- t.Skip("Linux-specific XDG path test")
+func TestUserConfigDirDarwinAlwaysUsesLegacyPath(t *testing.T) {
+ if runtime.GOOS != "darwin" {
+ t.Skip("macOS-specific path test")
}
tmpHome, err := os.MkdirTemp("", "pinchtab-home-*")
@@ -109,35 +92,17 @@ func TestUserConfigDirPrefersNewConfigFileWhenPresent(t *testing.T) {
defer func() { _ = os.RemoveAll(tmpHome) }()
t.Setenv("HOME", tmpHome)
- t.Setenv("XDG_CONFIG_HOME", filepath.Join(tmpHome, ".config"))
-
- legacyDir := filepath.Join(tmpHome, ".pinchtab")
- newDir := filepath.Join(tmpHome, ".config", "pinchtab")
- if err := os.MkdirAll(legacyDir, 0755); err != nil {
- t.Fatalf("Failed to create legacy dir: %v", err)
- }
- if err := os.MkdirAll(newDir, 0755); err != nil {
- t.Fatalf("Failed to create new dir: %v", err)
- }
-
- for _, path := range []string{
- filepath.Join(legacyDir, "config.json"),
- filepath.Join(newDir, "config.json"),
- } {
- if err := os.WriteFile(path, []byte(`{"server":{"port":"9876"}}`), 0644); err != nil {
- t.Fatalf("Failed to create config %s: %v", path, err)
- }
- }
got := userConfigDir()
- if got != newDir {
- t.Fatalf("userConfigDir() = %q, want new XDG path %q", got, newDir)
+ want := filepath.Join(tmpHome, ".pinchtab")
+ if got != want {
+ t.Fatalf("userConfigDir() = %q, want macOS default path %q", got, want)
}
}
-func TestUserConfigDirDarwinAlwaysUsesLegacyPath(t *testing.T) {
- if runtime.GOOS != "darwin" {
- t.Skip("macOS-specific path test")
+func TestUserConfigDirWindowsUsesUserConfigDir(t *testing.T) {
+ if runtime.GOOS != "windows" {
+ t.Skip("Windows-specific path test")
}
tmpHome, err := os.MkdirTemp("", "pinchtab-home-*")
@@ -146,11 +111,14 @@ func TestUserConfigDirDarwinAlwaysUsesLegacyPath(t *testing.T) {
}
defer func() { _ = os.RemoveAll(tmpHome) }()
+ configHome := filepath.Join(tmpHome, "AppData", "Roaming")
t.Setenv("HOME", tmpHome)
+ t.Setenv("AppData", configHome)
+ t.Setenv("APPDATA", configHome)
got := userConfigDir()
- want := filepath.Join(tmpHome, ".pinchtab")
+ want := filepath.Join(configHome, "pinchtab")
if got != want {
- t.Fatalf("userConfigDir() = %q, want macOS default path %q", got, want)
+ t.Fatalf("userConfigDir() = %q, want Windows default path %q", got, want)
}
}
diff --git a/skills/pinchtab/references/mcp.md b/skills/pinchtab/references/mcp.md
index 9fba02f2..73aeaeb8 100644
--- a/skills/pinchtab/references/mcp.md
+++ b/skills/pinchtab/references/mcp.md
@@ -137,7 +137,7 @@ The MCP surface is intentionally scoped to browser automation. The following are
| Modify stealth / fingerprint settings | ❌ Not available | Edit config file directly |
| Start or stop the PinchTab server | ❌ Not available | Use `pinchtab start` / `pinchtab stop` CLI |
| Manage fleet instances | ❌ Not available | Use `pinchtab instances` CLI |
-| Read/write PinchTab config | ❌ Not available | Edit `~/.pinchtab/config.yaml` directly |
+| Read/write PinchTab config | ❌ Not available | Edit `~/.pinchtab/config.json` directly |
If you need these capabilities in an agent workflow, use the CLI commands alongside the MCP tools, or call the PinchTab HTTP API directly.
diff --git a/tests/e2e/scenarios/infra/system-extended.sh b/tests/e2e/scenarios/infra/system-extended.sh
index a4276137..b47252af 100644
--- a/tests/e2e/scenarios/infra/system-extended.sh
+++ b/tests/e2e/scenarios/infra/system-extended.sh
@@ -386,7 +386,14 @@ start_test "POST /tasks — submit task"
pt_post /tasks -d "{\"agentId\":\"${AGENT}\",\"action\":\"snapshot\",\"tabId\":\"${TAB_ID}\"}"
assert_http_status "202" "task accepted"
TASK_ID=$(echo "$RESULT" | jq -r '.taskId')
-assert_json_eq "$RESULT" ".state" "queued" "initial state is queued"
+STATE=$(echo "$RESULT" | jq -r '.state')
+if [ "$STATE" = "queued" ] || [ "$STATE" = "assigned" ] || [ "$STATE" = "running" ]; then
+ echo -e " ${GREEN}✓${NC} initial task state is active/queued: $STATE"
+ ((ASSERTIONS_PASSED++)) || true
+else
+ echo -e " ${RED}✗${NC} unexpected initial task state: $STATE"
+ ((ASSERTIONS_FAILED++)) || true
+fi
end_test
@@ -400,7 +407,7 @@ assert_json_eq "$RESULT" ".taskId" "$TASK_ID" "correct task id"
assert_json_eq "$RESULT" ".agentId" "$AGENT" "correct agent id"
assert_json_eq "$RESULT" ".action" "snapshot" "correct action"
STATE=$(echo "$RESULT" | jq -r '.state')
-if [ "$STATE" = "completed" ] || [ "$STATE" = "running" ] || [ "$STATE" = "failed" ]; then
+if [ "$STATE" = "done" ] || [ "$STATE" = "assigned" ] || [ "$STATE" = "running" ] || [ "$STATE" = "failed" ]; then
echo -e " ${GREEN}✓${NC} task reached terminal/active state: $STATE"
((ASSERTIONS_PASSED++)) || true
else
@@ -429,7 +436,7 @@ end_test
# ─────────────────────────────────────────────────────────────────
start_test "GET /tasks — filter by state"
-pt_get "/tasks?state=completed,failed"
+pt_get "/tasks?state=done,failed"
assert_ok "list terminal tasks"
assert_json_exists "$RESULT" '.tasks' "tasks array present in response"