High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
docs: the storage table describes --key as a single item, but omitting it on delete clears the whole store — the same narrowing on a destructive verb the cookies section exists to prevent (PIN-259)
Luigi Agosti12c3deb05c93
diff --git a/cmd/pinchtab/cmd_cli_docs_test.go b/cmd/pinchtab/cmd_cli_docs_test.goindex 8fb3116c..7b60e88a 100644--- a/cmd/pinchtab/cmd_cli_docs_test.go+++ b/cmd/pinchtab/cmd_cli_docs_test.go@@ -22,10 +22,39 @@ func readSkillFile(t *testing.T, parts ...string) string {// the name is matched with either a closing backtick or a following space — a mention// inside another command's prose does not count.func documentsNamespace(reference, name string) bool {- return strings.Contains(reference, "### `pinchtab "+name+"`") ||+ return strings.Contains(reference, namespaceHeading(name)) ||strings.Contains(reference, "### `pinchtab "+name+" ")}+// namespaceHeading is what a reader has to add, so it is also what a failure message must+// print — spelled once here rather than escaped into the message.+func namespaceHeading(name string) string {+ return "### `pinchtab " + name + "`"+}++// namespaceSection returns one namespace's section alone, so an assertion about a command+// cannot be satisfied by an unrelated paragraph elsewhere in the file.+func namespaceSection(t *testing.T, reference, name string) string {+ t.Helper()++ start := strings.Index(reference, namespaceHeading(name))+ if start < 0 {+ start = strings.Index(reference, "### `pinchtab "+name+" ")+ }+ if start < 0 {+ t.Fatalf("the %s section is gone, so this guard is pinning nothing", name)+ }+ rest := reference[start+len("### "):]++ end := len(rest)+ for _, next := range []string{"\n### ", "\n## "} {+ if at := strings.Index(rest, next); at >= 0 && at < end {+ end = at+ }+ }+ return rest[:end]+}+// The defect this guard is derived from is a CROSS-SURFACE asymmetry, not incompleteness:// an agent reading the skill could discover cookie setting over MCP and over raw HTTP,// but not the CLI verb built for it — and for reading was sent to `state`, the command@@ -76,8 +105,8 @@ func TestNoNamespaceIsDocumentedOnAnotherSurfaceButMissingFromTheCLIReference(t}continue}- t.Errorf("`pinchtab %s` is documented on the MCP or HTTP surface but has no `### `+\"`\"+`pinchtab %s`+\"`\"+` section in skills/pinchtab/references/commands.md, so an agent can discover the operation everywhere except on the surface the skill steers it toward. Add the section in the file's house style, or record it in knownCrossSurfaceGaps with the reason",- name, name)+ t.Errorf("`pinchtab %s` is documented on the MCP or HTTP surface but has no %q section in skills/pinchtab/references/commands.md, so an agent can discover the operation everywhere except on the surface the skill steers it toward. Add the section in the file's house style, or record it in knownCrossSurfaceGaps with the reason",+ name, namespaceHeading(name))}if namespaces < 8 {t.Fatalf("only %d namespaces reached this guard; the command list is not being read and it would pass vacuously", namespaces)@@ -102,18 +131,28 @@ func TestTheSkillRoutesCookieReadsAtTheCookiesCommand(t *testing.T) {// every site. The reference must not contradict the help it mirrors.func TestTheCookiesReferenceStatesTheBrowserWideClearEffect(t *testing.T) {reference := readSkillFile(t, "references", "commands.md")+// storage is pinned DIRECTLY rather than by the cross-surface rule above, and the// reason is measured: it has no MCP tool and no /storage HTTP route, so nothing on// another surface documents it and the derived rule cannot reach it. Removing its- // section leaves that guard green — this assertion is what notices.- for _, name := range []string{"cookies", "storage"} {- if !documentsNamespace(reference, name) {- t.Fatalf("the %s section is gone, so this guard is pinning nothing", name)+ // section leaves that guard green — these assertions are what notice.+ cookies := namespaceSection(t, reference, "cookies")+ storage := namespaceSection(t, reference, "storage")++ for _, want := range []string{"all origins", "cannot be scoped"} {+ if !strings.Contains(cookies, want) {+ t.Errorf("the cookies section never says %q about `cookies clear`; its own --help does, and the doc must not read as narrower than the command is", want)}}- for _, want := range []string{"all origins", "cannot be scoped"} {- if !strings.Contains(reference, want) {- t.Errorf("the CLI reference never says %q about `cookies clear`; its own --help does, and the doc must not read as narrower than the command is", want)++ // The same failure one verb over: `storage delete` with no --key runs storageObj.clear()+ // through the identical handler `storage clear` reaches, so a doc describing --key as+ // "a single item" reads narrower than a destructive command actually is. The last phrase+ // pins the FLAG ROW as well as the prose: reverting only the row is the exact shape the+ // defect had, and the sentence below the table does not stop it coming back.+ for _, want := range []string{"no `--key`", "clears the whole store", "same call", "omit it and the whole store is cleared"} {+ if !strings.Contains(storage, want) {+ t.Errorf("the storage section never says %q; `storage delete` with no --key clears the whole store, and a reader told only about single-key removal will run it expecting one item to go", want)}}}diff --git a/skills/pinchtab/references/commands.md b/skills/pinchtab/references/commands.mdindex 512fc566..683e8ddf 100644--- a/skills/pinchtab/references/commands.md+++ b/skills/pinchtab/references/commands.md@@ -291,16 +291,19 @@ pinchtab storage get --key token # a single itempinchtab storage set token abc123 # writes to localStorage by defaultpinchtab storage set token abc123 --type sessionpinchtab storage delete --key token # remove one key+pinchtab storage delete # no --key: clears the whole storepinchtab storage clear --all # both stores in one call```| Flag | Command | Description ||------|---------|-------------|| `--type <local\|session>` | `get`, `set`, `delete`, `clear` | Which store. `get` defaults to both; the write verbs default to `local` |-| `--key <key>` | `get`, `delete` | A single item |+| `--key <key>` | `get`, `delete` | `get`: return only this item. `delete`: the key to remove — omit it and the whole store is cleared || `--all` | `clear` | Clear both stores in one call || `--tab <id>` | all | Target a specific tab |+`storage delete` with no `--key` clears the whole store `--type` selects — localStorage unless you pass `--type session` — for the tab's origin. It is the same call `storage clear` makes. `--all` is registered on `clear` only: `clear --all` empties both stores, while `delete --all` is refused as an unknown flag. `storage clear` without `--all` clears localStorage alone.+---## Audit Commands