|
| 1 | +# Plan: Document CLI String[] Entry-Point Parameters |
| 2 | + |
| 3 | +## Goal |
| 4 | + |
| 5 | +Update `@param` Javadoc on every legitimate CLI `String[] args` parameter at the boundary between |
| 6 | +the JVM and internal Java code, following the new convention in `.claude/rules/java.md`: |
| 7 | + |
| 8 | +> Every positional element must be listed in order with an individual description. Every recognized |
| 9 | +> flag must be described separately. No element may be left undescribed or deferred to another method. |
| 10 | +
|
| 11 | +The `refactor-instruction-test-runner-string-args` issue converts internal dispatch methods away |
| 12 | +from `String[]`. This issue is complementary: it improves the Javadoc on the methods that legitimately |
| 13 | +keep `String[]` because they sit at a shell-to-Java CLI boundary. |
| 14 | + |
| 15 | +## Parent Requirements |
| 16 | + |
| 17 | +None — code quality and maintainability. |
| 18 | + |
| 19 | +## Affected Methods |
| 20 | + |
| 21 | +### Hook entry points (`client/src/main/java/io/github/cowwoc/cat/claude/hook/`) |
| 22 | + |
| 23 | +Each hook class follows the pattern `main(String[] args)` → `run(scope, args, in, out)`. |
| 24 | +The `run()` method is the real CLI boundary; `main()` just delegates. Javadoc is needed on |
| 25 | +both if they carry any `@param args` description. |
| 26 | + |
| 27 | +| Class | Method | |
| 28 | +|-------|--------| |
| 29 | +| `HookRunner` | `execute(HookHandlerFactory, String[])` | |
| 30 | +| `PreToolUseHook` | `main(String[])`, `run(ClaudeHook, String[], InputStream, PrintStream)` | |
| 31 | +| `PreAskHook` | `main(String[])`, `run(ClaudeHook, String[], InputStream, PrintStream)` | |
| 32 | +| `PreReadHook` | `main(String[])`, `run(ClaudeHook, String[], InputStream, PrintStream)` | |
| 33 | +| `PreWriteHook` | `main(String[])`, `run(ClaudeHook, String[], InputStream, PrintStream)` | |
| 34 | +| `PreIssueHook` | `main(String[])`, `run(ClaudeHook, String[], InputStream, PrintStream)` | |
| 35 | +| `PostToolUseHook` | `main(String[])`, `run(ClaudeHook, String[], InputStream, PrintStream)` | |
| 36 | +| `PostToolUseFailureHook` | `main(String[])`, `run(ClaudeHook, String[], InputStream, PrintStream)` | |
| 37 | +| `PostReadHook` | `main(String[])`, `run(ClaudeHook, String[], InputStream, PrintStream)` | |
| 38 | +| `SessionStartHook` | `main(String[])`, `run(ClaudeHook, Path, String[], InputStream, PrintStream)` | |
| 39 | +| `SessionEndHook` | `main(String[])`, `run(ClaudeHook, String[], InputStream, PrintStream)` | |
| 40 | +| `UserPromptSubmitHook` | `main(String[])`, `run(ClaudeHook, String[], InputStream, PrintStream)` | |
| 41 | +| `EnforceStatusOutput` | `main(String[])`, `run(ClaudeHook, String[], InputStream, PrintStream)` | |
| 42 | +| `TokenCounter` | `main(String[])`, `run(JvmScope, String[], PrintStream)` | |
| 43 | +| `SubagentStartHook` | `main(String[])` | |
| 44 | + |
| 45 | +### Skill CLI entry points (`client/src/main/java/io/github/cowwoc/cat/claude/hook/skills/`) |
| 46 | + |
| 47 | +| Class | Method | |
| 48 | +|-------|--------| |
| 49 | +| `ClaudeRunner` | `run(ClaudeTool, String[], PrintStream)` | |
| 50 | +| `GetConfigOutput` | `getOutput(String[])`, `run(ClaudeTool, String[], PrintStream)` | |
| 51 | +| `GetStatuslineOutput` | `getOutput(String[])`, `run(ClaudeTool, String[], PrintStream)` | |
| 52 | +| `GetIssueCompleteOutput` | `getOutput(String[])`, `run(ClaudeTool, String[], PrintStream)` | |
| 53 | +| `GetAddOutput` | `getOutput(String[])`, `run(ClaudeTool, String[], PrintStream)` | |
| 54 | +| `SkillComparison` | `getOutput(String[])` | |
| 55 | +| `ExtractTurnsContent` | `main(String[])` | |
| 56 | +| `InstructionTestRunner` | `main(String[])` (top-level CLI; subcommands are covered by `refactor-instruction-test-runner-string-args`) | |
| 57 | + |
| 58 | +## Approach |
| 59 | + |
| 60 | +For each `String[] args` parameter, read the method body to discover: |
| 61 | +1. How many positional arguments it consumes (and from which indices) |
| 62 | +2. What each positional argument represents (name, type, valid values, sentinels) |
| 63 | +3. Which optional flags it recognizes and what they do |
| 64 | + |
| 65 | +Then write a `@param args` block with: |
| 66 | +- An `<ol>` listing positional elements **in order** (item 1 = `args[0]`, item 2 = `args[1]`, ...) |
| 67 | +- A `<ul>` for optional flags (if any), each individually described |
| 68 | +- Sentinel values called out explicitly (e.g., `{@code "none"}` when no value is available) |
| 69 | + |
| 70 | +`main(String[] args)` methods that simply delegate to `run()` with no additional parsing may |
| 71 | +carry a brief `@param args` that refers to the `run()` signature, rather than duplicating it. |
| 72 | + |
| 73 | +## Exclusions |
| 74 | + |
| 75 | +- Methods already covered by `refactor-instruction-test-runner-string-args`: the internal |
| 76 | + `String[]` dispatch methods in `InstructionTestRunner`, `SprtStateManager`, and |
| 77 | + `SprtIsolationManager` — those will be converted to named parameters, eliminating the `String[]`. |
| 78 | +- `AotTraining.main(String[])`: training harness, not a production CLI boundary. |
| 79 | +- Test classes. |
| 80 | + |
| 81 | +## Verification |
| 82 | + |
| 83 | +- Every `String[] args` parameter at a CLI boundary has a `@param` block that individually describes |
| 84 | + each positional element and each recognized flag. |
| 85 | +- No element description defers to another method ("see handler for details"). |
| 86 | +- `mvn -f client/pom.xml verify -e` passes with no Checkstyle or Javadoc errors. |
0 commit comments