Skip to content

Add help:OP op and clear error on dual @- stdin clash (#341)#351

Merged
fdaviddpt merged 2 commits into
masterfrom
feat/help-op-and-stdin-clash-341
Jun 26, 2026
Merged

Add help:OP op and clear error on dual @- stdin clash (#341)#351
fdaviddpt merged 2 commits into
masterfrom
feat/help-op-and-stdin-clash-341

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Context

Closes #341 — three ergonomics papercuts were filed together; this PR fixes the two that need code (the third is doc-only, see below).

1. help:OP op. Op hints and the vim example told the reader to "see ./supertool help vim", but no help op existed — ./supertool help vim returned unknown operation: help, a dead front door. help:OP prints a single op's syntax, uncompacted description, and example, read straight from .supertool.json (builtin-ops → custom ops → aliases). Config stays the single source of truth — same metadata ops lists, but scoped to one op and never compacted, so a long description (vim's ~1.5KB grammar) prints in full instead of being dropped by ops-compact's filter. An unknown op errors with a pointer to ops; a real built-in with no config entry says "has no documented help" rather than "unknown operation", distinguishing the two. Read-only and parallel-safe; registered in .supertool.json so ops lists it and help:help self-documents.

2. Dual @- stdin clash. ./supertool 'edit:@-' 'edit:@-' made both ops call sys.stdin.read(); the first drained the single stream, so the second read empty and died with @file ... parse error (<stdin>): Expecting value: line 1 column 1 — naming neither the cause nor the fix. main() now detects >1 op:@- in a pre-pass (sibling to the cwd: pre-pass, before any dispatch) and exits stdin: only one '@-' op is allowed per call (got N: ...), listing the offenders and pointing at the two escape hatches (@file path / one batch:@- ops array). Took the cheap fail-fast over "route multiple stdins through an ops-array" — stdin is one stream, splitting it cleanly would mean inventing a delimiter.

3. (not in this PR) gh-issue-create vs mr body-format mismatch. I'd argue this is documentation, not code: mr takes positional PATH|TIME|LABELS and gh-issue-create is a pure TOML payload — unifying the formats adds a sniff-the-input branch with real ambiguity (is line 1 a title or title =?). Cheaper and safer to document the divergence in both op hints. Happy to do that in a follow-up if preferred.

Changes

  • supertool.pyop_help() + help dispatch branch + parallel-safe; dual-@- guard in main()
  • .supertool.json — register help builtin-op
  • docs/operations/meta.mdhelp row + discovery pattern
  • docs/input-forms.md — one-@--per-call rule
  • CHANGELOG.md — Added (help) + Fixed (stdin clash)

Tests

  • tests/test_meta_ops.py — 7 new: full reference render, custom-op/alias lookup, missing-arg error, unknown-op error, known-builtin-without-docs, dispatch route, parallel-safe membership
  • tests/test_stdin_clash_341.py — 6 new: clash rejected pre-dispatch, offenders named, single @- passes, one-@-+file-payloads passes, zero passes, bare @- arg not flagged

Verified: reproduced both original failures → now clear; targeted regression green (162 passed @file/batch/parallel/chaos/meta + 14 passed stdin/cwd).

🤖 Generated by Max — the help op that finally answers its own door.

Two ergonomics papercuts from one session.

help:OP — print a single op's full reference (syntax, uncompacted
description, example) from .supertool.json. Op hints pointed at
"./supertool help vim" but no help op existed; the front door was
dead. Reuses the config as single source of truth, scoped to one op
and never compacted. Unknown op errors with a pointer to 'ops'; a
real builtin without a config entry says so distinctly.

dual @- — two op:@- (stdin) ops in one call both read the single
stdin stream; the second got empty input and died with an opaque
@file parse error. main() now rejects >1 @- in a pre-pass (sibling
to cwd:) naming the offenders and the escape hatches (@file / batch).

Tests: 7 for help (test_meta_ops), 6 for the clash (test_stdin_clash_341).
Docs: meta.md, input-forms.md, CHANGELOG.

Co-Authored-By: Max <noreply>
The guard matched only single-colon op:@-; the triple-colon payload form
op:::@- also reads stdin (dispatch splits on ':::'), so two of them
bypassed the guard into the same opaque parse error it exists to prevent.
Strip leading colons from the value before comparing. Tests for the
triple-colon and mixed single/triple forms.

Co-Authored-By: Max <noreply>
@fdaviddpt fdaviddpt merged commit 6624259 into master Jun 26, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ergonomics papercuts: no help <op>, dual @- stdin clash, gh-issue-create vs mr body-format mismatch

1 participant