{"record":{"id":"60d74f8a4770b592","repo":"pbakaus/impeccable","slug":"available-commands","errorCode":null,"errorMessage":"Available commands: {}\n","messagePattern":"Available commands: (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"crates/context/src/pin.rs","lineNumber":228,"sourceCode":"    }\n    serde_json::from_str(COMMAND_METADATA_JSON).unwrap_or(serde_json::Value::Object(Default::default()))\n}\n\npub fn run(args: &[String], io: &mut Io) -> i32 {\n    let action = args.first().cloned();\n    let command = args.get(1).cloned();\n    let (Some(action), Some(command)) = (action.filter(|a| !a.is_empty()), command.filter(|c| !c.is_empty())) else {\n        io.out(\"Usage: impeccable pin <pin|unpin> <command>\\n\");\n        io.out(&format!(\"\\nAvailable commands: {}\\n\", VALID_COMMANDS.join(\", \")));\n        return 1;\n    };\n    if action != \"pin\" && action != \"unpin\" {\n        io.err(&format!(\"Unknown action: {}. Use 'pin' or 'unpin'.\\n\", action));\n        return 1;\n    }\n    if !VALID_COMMANDS.contains(&command.as_str()) {\n        io.err(&format!(\"Unknown command: {}\\n\", command));\n        io.err(&format!(\"Available commands: {}\\n\", VALID_COMMANDS.join(\", \")));\n        return 1;\n    }\n    let cwd = io.cwd.to_string_lossy().into_owned();\n    let root = find_project_root(&cwd);\n    if action == \"pin\" {\n        let metadata = load_metadata(io);\n        let harness_dirs = find_harness_dirs(&root);\n        let opencode_commands_dirs = find_opencode_commands_dirs(&root, io, false);\n        if harness_dirs.is_empty() && opencode_commands_dirs.is_empty() {\n            io.out(\"No harness directories with impeccable installed found.\\n\");\n            return 0;\n        }\n        let mut created = 0;\n        // OpenCode is handled separately below because its shortcut format is\n        // a slash command, not a SKILL.md. Excluding it from the skill loop\n        // prevents a duplicate `.opencode/skills/<cmd>/SKILL.md` that OpenCode\n        // would never surface as `/<cmd>`.\n        for skills_dir in &harness_dirs {","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/context/src/pin.rs#L210-L246","documentation":"Companion message to the unknown-command rejection in `pin`: alongside 'Unknown command: {}', the run() function prints the authoritative list of valid command names from VALID_COMMANDS before returning exit code 1. It is informational output on the same failure path, not an independent failure.","triggerScenarios":"Emitted whenever the command argument fails the VALID_COMMANDS containment check during a pin/unpin action.","commonSituations":"Same as the unknown-command case: typos, renamed commands, or scripting with stale names; the developer sees this line to learn which commands are accepted.","solutions":["Copy a command name verbatim from this list and re-run the pin/unpin action.","List VALID_COMMANDS in this crate's source if you need to script against it programmatically."],"exampleFix":"// before\npin 'reindex'   // not in list\n// after\npin 'index'     // one of the commands printed by this message","handlingStrategy":"validation","validationCode":"// capture stderr, parse the available commands, and diff against the attempted one\nconst m = stderr.match(/Available commands: (.+)/);\nif (m && !m[1].split(', ').includes(cmd)) console.warn(`${cmd} not supported`);","typeGuard":"null","tryCatchPattern":"if (exitCode === 1 && stderr.includes('Available commands:')) {\n  const valid = stderr.match(/Available commands: (.+)/)[1].split(', ');\n  // pick from `valid` and retry\n}","preventionTips":["Treat this line as the source of truth for supported commands","Re-check the list after upgrading the tool","Never hardcode command names without verifying against this output"],"tags":["cli","validation","help-output"],"backgroundTag":"invalid-enum-value","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}