High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix(config): include configVersion in custom MarshalJSON
Bosch9c848012f1c0
diff --git a/TESTING.md b/TESTING.mdindex 5c71ed69..ade41617 100644--- a/TESTING.md+++ b/TESTING.md@@ -30,7 +30,7 @@ Unit tests are standard Go tests that validate individual packages and functions## E2E Tests-End-to-end tests launch a real pinchtab server with Chrome and run integration-level tests against it.+End-to-end tests launch a real pinchtab server with Chrome and run e2e-level tests against it.### Curl Tests (HTTP API)@@ -46,7 +46,7 @@ Runs 183 HTTP-level tests using curl against the server. Tests the REST API, nav./dev e2e cli```-Runs 41 CLI integration tests. Tests the command-line interface directly.+Runs CLI e2e tests. Tests the command-line interface directly.### Both E2E Test Suites@@ -90,7 +90,7 @@ E2E tests are organized in two directories:- Test the REST API directly- Use Docker Compose: `tests/e2e/docker-compose.yml`-- **`tests/e2e/scenarios-cli/*.sh`** — CLI integration tests (41 tests)+- **`tests/e2e/scenarios-cli/*.sh`** — CLI e2e tests (41 tests)- Test the command-line interface- Use Docker Compose: `tests/e2e/docker-compose.cli.yml`diff --git a/cmd/pinchtab/cmd_cli.go b/cmd/pinchtab/cmd_cli.goindex ffe0cfda..b9358f1e 100644--- a/cmd/pinchtab/cmd_cli.go+++ b/cmd/pinchtab/cmd_cli.go@@ -371,8 +371,6 @@ func init() {textCmd.Flags().Bool("raw", false, "Raw extraction mode")textCmd.Flags().String("tab", "", "Tab ID")--navCmd.Flags().Bool("new-tab", false, "Open in new tab")navCmd.Flags().Bool("block-images", false, "Block image loading")navCmd.Flags().Bool("block-ads", false, "Block ads")diff --git a/cmd/pinchtab/cmd_config.go b/cmd/pinchtab/cmd_config.goindex cda54d23..2588432f 100644--- a/cmd/pinchtab/cmd_config.go+++ b/cmd/pinchtab/cmd_config.go@@ -309,12 +309,8 @@ func handleConfigInit() {os.Exit(1)}fc.Server.Token = token- data, _ := json.Marshal(fc)- var nested map[string]any- _ = json.Unmarshal(data, &nested)- pretty, _ := json.MarshalIndent(nested, "", " ")- if err := os.WriteFile(configPath, pretty, 0o644); err != nil {+ if err := config.SaveFileConfig(&fc, configPath); err != nil {fmt.Printf("Error writing config: %v\n", err)os.Exit(1)}diff --git a/cmd/pinchtab/cmd_daemon.go b/cmd/pinchtab/cmd_daemon.goindex c7a9b298..a9da4735 100644--- a/cmd/pinchtab/cmd_daemon.go+++ b/cmd/pinchtab/cmd_daemon.go@@ -72,6 +72,7 @@ func handleDaemonCommand(_ *config.RuntimeConfig, subcommand string) {os.Exit(1)}// Run wizard if needed (first install or version upgrade)+ fmt.Printf("[debug] configVersion=%q needsWizard=%v configPath=%s\n", fileCfg.ConfigVersion, config.NeedsWizard(fileCfg), configPath)if config.NeedsWizard(fileCfg) {isNew := config.IsFirstRun(fileCfg)runSecurityWizard(fileCfg, configPath, isNew)@@ -215,6 +216,7 @@ func ensureDaemonConfig(force bool) (string, *config.FileConfig, configBootstrapexists := fileExists(configPath)if !exists || force {defaults := config.DefaultFileConfig()+ defaults.ConfigVersion = "" // Leave empty so wizard triggers on first installtoken, err := config.GenerateAuthToken()if err != nil {return "", nil, "", errdiff --git a/cmd/pinchtab/cmd_wizard.go b/cmd/pinchtab/cmd_wizard.goindex 433d3dd5..d868979d 100644--- a/cmd/pinchtab/cmd_wizard.go+++ b/cmd/pinchtab/cmd_wizard.go@@ -119,7 +119,7 @@ func runFullWizard(cfg *config.FileConfig, configPath string) bool {switch picked {case "copy":- copyToClipboard(cfg.Server.Token)+ _ = copyToClipboard(cfg.Server.Token)case "new":token, err := config.GenerateAuthToken()if err == nil {diff --git a/dev b/devindex 47431749..f5923430 100755--- a/dev+++ b/dev@@ -109,11 +109,6 @@ run_command() {echo ""exec bash scripts/test.sh unit;;- "test integration"|"integration")- echo " ${ACCENT}${BOLD}🔬 Integration tests${NC}"- echo ""- exec bash scripts/test.sh integration- ;;"test system"|"system")echo " ${ACCENT}${BOLD}🔬 System tests${NC}"echo ""diff --git a/internal/cli/actions/actions_element.go b/internal/cli/actions/actions_element.goindex a4602d6f..a9084e28 100644--- a/internal/cli/actions/actions_element.go+++ b/internal/cli/actions/actions_element.go@@ -83,5 +83,3 @@ func ActionSimple(client *http.Client, base, token, kind string, args []string,}apiclient.DoPost(client, base, token, path, body)}--diff --git a/internal/cli/actions/actions_element_test.go b/internal/cli/actions/actions_element_test.goindex 822f1066..48a79bcc 100644--- a/internal/cli/actions/actions_element_test.go+++ b/internal/cli/actions/actions_element_test.go@@ -47,7 +47,7 @@ func TestClickWaitNav(t *testing.T) {client := m.server.Client()cmd := newActionCmd()- cmd.Flags().Set("wait-nav", "true")+ _ = cmd.Flags().Set("wait-nav", "true")Action(client, m.base(), "", "click", "e5", cmd)var body map[string]any_ = json.Unmarshal([]byte(m.lastBody), &body)@@ -96,7 +96,7 @@ func TestClickWithCSS(t *testing.T) {client := m.server.Client()cmd := newActionCmd()- cmd.Flags().Set("css", "button.submit")+ _ = cmd.Flags().Set("css", "button.submit")Action(client, m.base(), "", "click", "", cmd)var body map[string]any_ = json.Unmarshal([]byte(m.lastBody), &body)@@ -114,8 +114,8 @@ func TestClickWithCSS_AndWaitNav(t *testing.T) {client := m.server.Client()cmd := newActionCmd()- cmd.Flags().Set("wait-nav", "true")- cmd.Flags().Set("css", "#login-btn")+ _ = cmd.Flags().Set("wait-nav", "true")+ _ = cmd.Flags().Set("css", "#login-btn")Action(client, m.base(), "", "click", "", cmd)var body map[string]any_ = json.Unmarshal([]byte(m.lastBody), &body)@@ -133,7 +133,7 @@ func TestHoverWithCSS(t *testing.T) {client := m.server.Client()cmd := newActionCmd()- cmd.Flags().Set("css", ".nav-item")+ _ = cmd.Flags().Set("css", ".nav-item")Action(client, m.base(), "", "hover", "", cmd)var body map[string]any_ = json.Unmarshal([]byte(m.lastBody), &body)@@ -148,7 +148,7 @@ func TestFocusWithCSS(t *testing.T) {client := m.server.Client()cmd := newActionCmd()- cmd.Flags().Set("css", "input[name='email']")+ _ = cmd.Flags().Set("css", "input[name='email']")Action(client, m.base(), "", "focus", "", cmd)var body map[string]any_ = json.Unmarshal([]byte(m.lastBody), &body)diff --git a/internal/cli/actions/actions_navigate_test.go b/internal/cli/actions/actions_navigate_test.goindex a5d61058..9fe92692 100644--- a/internal/cli/actions/actions_navigate_test.go+++ b/internal/cli/actions/actions_navigate_test.go@@ -42,8 +42,8 @@ func TestNavigateWithAllFlags(t *testing.T) {client := m.server.Client()cmd := newNavigateCmd()- cmd.Flags().Set("new-tab", "true")- cmd.Flags().Set("block-images", "true")+ _ = cmd.Flags().Set("new-tab", "true")+ _ = cmd.Flags().Set("block-images", "true")Navigate(client, m.base(), "", "https://pinchtab.com", cmd)var body map[string]any_ = json.Unmarshal([]byte(m.lastBody), &body)@@ -61,7 +61,7 @@ func TestNavigateWithBlockAds(t *testing.T) {client := m.server.Client()cmd := newNavigateCmd()- cmd.Flags().Set("block-ads", "true")+ _ = cmd.Flags().Set("block-ads", "true")Navigate(client, m.base(), "", "https://pinchtab.com", cmd)var body map[string]any_ = json.Unmarshal([]byte(m.lastBody), &body)diff --git a/internal/cli/actions/actions_pdf_test.go b/internal/cli/actions/actions_pdf_test.goindex 2113515c..32b404d3 100644--- a/internal/cli/actions/actions_pdf_test.go+++ b/internal/cli/actions/actions_pdf_test.go@@ -41,10 +41,10 @@ func TestPDF(t *testing.T) {outFile := filepath.Join(t.TempDir(), "test.pdf")cmd := newPDFCmd()- cmd.Flags().Set("output", outFile)- cmd.Flags().Set("tab", "tab-abc")- cmd.Flags().Set("landscape", "true")- cmd.Flags().Set("scale", "0.8")+ _ = cmd.Flags().Set("output", outFile)+ _ = cmd.Flags().Set("tab", "tab-abc")+ _ = cmd.Flags().Set("landscape", "true")+ _ = cmd.Flags().Set("scale", "0.8")PDF(client, m.base(), "", cmd)if m.lastPath != "/tabs/tab-abc/pdf" {t.Errorf("expected /tabs/tab-abc/pdf, got %s", m.lastPath)@@ -72,23 +72,23 @@ func TestPDFAllOptions(t *testing.T) {outFile := filepath.Join(t.TempDir(), "test.pdf")cmd := newPDFCmd()- cmd.Flags().Set("output", outFile)- cmd.Flags().Set("tab", "tab-123")- cmd.Flags().Set("landscape", "true")- cmd.Flags().Set("scale", "1.5")- cmd.Flags().Set("paper-width", "11")- cmd.Flags().Set("paper-height", "8.5")- cmd.Flags().Set("margin-top", "1")- cmd.Flags().Set("margin-bottom", "1")- cmd.Flags().Set("margin-left", "0.5")- cmd.Flags().Set("margin-right", "0.5")- cmd.Flags().Set("page-ranges", "1-3,5")- cmd.Flags().Set("prefer-css-page-size", "true")- cmd.Flags().Set("display-header-footer", "true")- cmd.Flags().Set("header-template", "<span class='title'></span>")- cmd.Flags().Set("footer-template", "<span class='pageNumber'></span>")- cmd.Flags().Set("generate-tagged-pdf", "true")- cmd.Flags().Set("generate-document-outline", "true")+ _ = cmd.Flags().Set("output", outFile)+ _ = cmd.Flags().Set("tab", "tab-123")+ _ = cmd.Flags().Set("landscape", "true")+ _ = cmd.Flags().Set("scale", "1.5")+ _ = cmd.Flags().Set("paper-width", "11")+ _ = cmd.Flags().Set("paper-height", "8.5")+ _ = cmd.Flags().Set("margin-top", "1")+ _ = cmd.Flags().Set("margin-bottom", "1")+ _ = cmd.Flags().Set("margin-left", "0.5")+ _ = cmd.Flags().Set("margin-right", "0.5")+ _ = cmd.Flags().Set("page-ranges", "1-3,5")+ _ = cmd.Flags().Set("prefer-css-page-size", "true")+ _ = cmd.Flags().Set("display-header-footer", "true")+ _ = cmd.Flags().Set("header-template", "<span class='title'></span>")+ _ = cmd.Flags().Set("footer-template", "<span class='pageNumber'></span>")+ _ = cmd.Flags().Set("generate-tagged-pdf", "true")+ _ = cmd.Flags().Set("generate-document-outline", "true")PDF(client, m.base(), "", cmd)if m.lastPath != "/tabs/tab-123/pdf" {diff --git a/internal/cli/actions/actions_snapshot_test.go b/internal/cli/actions/actions_snapshot_test.goindex bebbe03b..adbca717 100644--- a/internal/cli/actions/actions_snapshot_test.go+++ b/internal/cli/actions/actions_snapshot_test.go@@ -27,8 +27,8 @@ func TestSnapshot(t *testing.T) {client := m.server.Client()cmd := newSnapshotCmd()- cmd.Flags().Set("interactive", "true")- cmd.Flags().Set("compact", "true")+ _ = cmd.Flags().Set("interactive", "true")+ _ = cmd.Flags().Set("compact", "true")Snapshot(client, m.base(), "", cmd)if m.lastMethod != "GET" {t.Errorf("expected GET, got %s", m.lastMethod)@@ -50,10 +50,10 @@ func TestSnapshotDiff(t *testing.T) {client := m.server.Client()cmd := newSnapshotCmd()- cmd.Flags().Set("diff", "true")- cmd.Flags().Set("selector", "main")- cmd.Flags().Set("max-tokens", "2000")- cmd.Flags().Set("depth", "5")+ _ = cmd.Flags().Set("diff", "true")+ _ = cmd.Flags().Set("selector", "main")+ _ = cmd.Flags().Set("max-tokens", "2000")+ _ = cmd.Flags().Set("depth", "5")Snapshot(client, m.base(), "", cmd)if !strings.Contains(m.lastQuery, "diff=true") {t.Errorf("expected diff=true, got %s", m.lastQuery)@@ -75,7 +75,7 @@ func TestSnapshotTabId(t *testing.T) {client := m.server.Client()cmd := newSnapshotCmd()- cmd.Flags().Set("tab", "ABC123")+ _ = cmd.Flags().Set("tab", "ABC123")Snapshot(client, m.base(), "", cmd)if !strings.Contains(m.lastQuery, "tabId=ABC123") {t.Errorf("expected tabId=ABC123, got %s", m.lastQuery)diff --git a/internal/cli/actions/actions_text_test.go b/internal/cli/actions/actions_text_test.goindex 0daa467c..dc847551 100644--- a/internal/cli/actions/actions_text_test.go+++ b/internal/cli/actions/actions_text_test.go@@ -33,7 +33,7 @@ func TestTextRaw(t *testing.T) {client := m.server.Client()cmd := newTextCmd()- cmd.Flags().Set("raw", "true")+ _ = cmd.Flags().Set("raw", "true")Text(client, m.base(), "", cmd)if !strings.Contains(m.lastQuery, "mode=raw") {t.Errorf("expected mode=raw, got %s", m.lastQuery)@@ -46,7 +46,7 @@ func TestTextTab(t *testing.T) {client := m.server.Client()cmd := newTextCmd()- cmd.Flags().Set("tab", "TAB1")+ _ = cmd.Flags().Set("tab", "TAB1")Text(client, m.base(), "", cmd)if !strings.Contains(m.lastQuery, "tabId=TAB1") {t.Errorf("expected tabId=TAB1, got %s", m.lastQuery)diff --git a/internal/config/config_file.go b/internal/config/config_file.goindex 02d905ae..f54b957b 100644--- a/internal/config/config_file.go+++ b/internal/config/config_file.go@@ -87,6 +87,7 @@ func DefaultFileConfig() FileConfig {}type fileConfigJSON struct {+ ConfigVersion string `json:"configVersion,omitempty"`Server serverConfigJSON `json:"server"`Browser browserConfigJSON `json:"browser"`InstanceDefaults instanceDefaultsConfigJSON `json:"instanceDefaults"`@@ -204,6 +205,7 @@ func copyStringSlice(items []string) []string {func (fc FileConfig) MarshalJSON() ([]byte, error) {return json.Marshal(fileConfigJSON{+ ConfigVersion: fc.ConfigVersion,Server: serverConfigJSON{Port: fc.Server.Port,Bind: fc.Server.Bind,diff --git a/internal/config/config_utils.go b/internal/config/config_utils.goindex 5d1f9a84..e20c8c31 100644--- a/internal/config/config_utils.go+++ b/internal/config/config_utils.go@@ -3,10 +3,10 @@ package configimport ("crypto/rand""encoding/hex"- "strings""fmt""os""path/filepath"+ "strings")var defaultLocalAllowedDomains = []string{"127.0.0.1", "localhost", "::1"}diff --git a/internal/config/editor.go b/internal/config/editor.goindex a7ee981d..e3d31eb7 100644--- a/internal/config/editor.go+++ b/internal/config/editor.go@@ -683,6 +683,7 @@ func LoadFileConfig() (*FileConfig, string, error) {}} else {defaults := DefaultFileConfig()+ defaults.ConfigVersion = "" // Don't assume version — let file content determine itfc = &defaultsif err := json.Unmarshal(data, fc); err != nil {return nil, configPath, fmt.Errorf("failed to parse config: %w", err)diff --git a/scripts/test.sh b/scripts/test.shindex e28b0b5a..f91f1b7a 100755--- a/scripts/test.sh+++ b/scripts/test.sh@@ -2,7 +2,7 @@set -e# test.sh — Run Go tests with optional scope-# Usage: test.sh [unit|integration|system|all]+# Usage: test.sh [unit|all]# Default: allcd "$(dirname "$0")/.."@@ -265,42 +265,6 @@ if [ "$SCOPE" = "all" ] || [ "$SCOPE" = "unit" ]; thentest_summary "$UNIT_JSON" "Unit Test Results"fi-# ── Integration tests ───────────────────────────────────────────────--if [ "$SCOPE" = "all" ] || [ "$SCOPE" = "integration" ]; then- section "Integration Tests"-- INTEGRATION_JSON="$TMPDIR_TEST/integration.json"-- if ! run_go_test_json "$INTEGRATION_JSON" "integration" \- -tags integration -timeout 10m -count=1 \- -run '^Test' -skip "$SYSTEM_REGEX" ./tests/integration/; then- fail "Integration tests"- test_summary "$INTEGRATION_JSON" "Integration Test Results"- exit 1- fi- printf "\r%*s\r" 60 ""- ok "Integration tests"- test_summary "$INTEGRATION_JSON" "Integration Test Results"-fi--if [ "$SCOPE" = "all" ] || [ "$SCOPE" = "system" ]; then- section "System Tests"-- SYSTEM_JSON="$TMPDIR_TEST/system.json"-- if ! run_go_test_json "$SYSTEM_JSON" "system" \- -tags integration -timeout 12m -count=1 \- -run "$SYSTEM_REGEX" ./tests/integration/; then- fail "System tests"- test_summary "$SYSTEM_JSON" "System Test Results"- exit 1- fi- printf "\r%*s\r" 60 ""- ok "System tests"- test_summary "$SYSTEM_JSON" "System Test Results"-fi-# ── Summary ──────────────────────────────────────────────────────────section "Summary"