{"record":{"id":"fd0596a8f8c77ef3","repo":"jackwener/OpenCLI","slug":"direction","errorCode":null,"errorMessage":"direction","messagePattern":"direction","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"warning","filePath":"clis/antigravity/audit-extras.js","lineNumber":230,"sourceCode":"    },\n});\n\n// -------- nav --------\ncli({\n    site: 'antigravity',\n    name: 'nav',\n    access: 'write',\n    description: 'Click Go Back or Go Forward (Antigravity in-app history).',\n    domain: '127.0.0.1',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [\n        { name: 'direction', positional: true, required: true, help: 'back or forward' },\n    ],\n    columns: ['Status'],\n    func: async (page, kwargs) => {\n        const dir = String(kwargs?.direction || '').trim().toLowerCase();\n        if (dir !== 'back' && dir !== 'forward') throw new ArgumentError('direction', 'must be \"back\" or \"forward\"');\n        const label = dir === 'back' ? 'Go Back' : 'Go Forward';\n        const res = unwrapEvaluateResult(await page.evaluate(clickFirstScript([`button[aria-label=\"${label}\"]`])));\n        if (!res?.ok) throw new CommandExecutionError(res?.reason || `${label} click failed`, '');\n        return [{ Status: `${dir} clicked` }];\n    },\n});\n\n// -------- toggle-aux --------\ncli({\n    site: 'antigravity',\n    name: 'toggle-aux',\n    access: 'write',\n    description: 'Toggle the Auxiliary Pane (Antigravity\\'s secondary panel for code/preview).',\n    domain: '127.0.0.1',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [],\n    columns: ['Status'],","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/antigravity/audit-extras.js#L212-L248","documentation":"ArgumentError (code 'ARGUMENT', exit USAGE_ERROR) from the 'nav' command: the required positional 'direction' argument must be exactly 'back' or 'forward' after trim/lowercase. The library validates this before touching the page so invalid input fails immediately with a usage hint. Like error 210, this is purely an input problem.","triggerScenarios":"Invoking nav with direction values like 'backward', 'b', 'fwd', 'previous', '', or a misspelled token; `dir !== 'back' && dir !== 'forward'` triggers the throw. Case and whitespace are tolerated, other synonyms are not.","commonSituations":"Scripts mapping browser-history concepts to wrong tokens ('prev'/'next'); empty variable interpolation in shell automation; users assuming full words like 'backward' work; aliases not being supported.","solutions":["Re-run with exactly 'back' or 'forward' as the positional argument.","Normalize/whitelist your script's direction value before calling the command.","Quote the argument in the shell to prevent splitting or empty interpolation.","Check the command's help text ('back or forward') for the accepted vocabulary."],"exampleFix":"// before\nantigravity nav previous\n\n// after\nantigravity nav back","handlingStrategy":"validation","validationCode":"const dir = String(process.argv[3] || '').trim().toLowerCase();\nif (dir !== 'back' && dir !== 'forward') {\n  throw new Error(`direction must be \"back\" or \"forward\", got: ${JSON.stringify(dir)}`);\n}","typeGuard":"function isNavDirection(v) {\n  return typeof v === 'string' && ['back', 'forward'].includes(v.trim().toLowerCase());\n}","tryCatchPattern":"try {\n  await runCmd('antigravity nav', dir);\n} catch (e) {\n  if (e.code === 'ARGUMENT') {\n    console.error(`Invalid direction \"${dir}\" — use \"back\" or \"forward\".`);\n    process.exitCode = 2;\n  } else throw e;\n}","preventionTips":["Map synonyms ('previous'/'next', 'b'/'f') to 'back'/'forward' in wrappers before invoking.","Guard against empty interpolated variables in shell scripts.","Lowercase/trim user input before passing it through.","Reject invalid directions early with your own validation."],"tags":["argument-validation","cli-usage","input-error"],"backgroundTag":"invalid-cli-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}