apexe 0.6.1

Outside-In CLI-to-Agent Bridge
{
  "schema_version": "1.0",
  "command": "sort",
  "variant": "gnu",
  "match": {
    "probe": {
      "args": ["--version"],
      "expect": "success",
      "output_contains": "GNU coreutils"
    }
  },
  "mode": "authoritative",
  "confidence": "verified",
  "provenance": {
    "platform": "linux",
    "tool_version": "9.7",
    "package": "coreutils",
    "source": "help",
    "checked_on": "2026-07-27",
    "command": "docker run --rm debian@sha256:328d16499860ae6cb9b345e2e4cebca08c2a36e4f7278482c7bd1f39d71e5bfd sort --help",
    "environment": "debian@sha256:328d16499860ae6cb9b345e2e4cebca08c2a36e4f7278482c7bd1f39d71e5bfd",
    "notes": "Debian slim images ship no man pages, so the flag list was read from GNU --help, which is complete by GNU convention. A naive extraction over this --help reports a '-fi' option; it is an artifact of the line '-c, --check, --check=diagnose-first' being truncated mid-word and is not a flag. '-c, --check, --check=diagnose-first' and '-C, --check=quiet, --check=silent' are two --help entries naming one long option with an optional value; they are split into three flags here, because the overlay format carries at most one long form per flag and because -c and -C differ in behaviour. --check was verified to accept no value as well as diagnose-first, quiet and silent, and to reject anything else ('invalid argument bogus'). conflicts_with was read off the running binary, which diagnoses each pairing as \"options '-xy' are incompatible\", and NOT from the shape of the ordering-options block: the incompatible pairs are not the whole cross product. Declared: -g, -h, -M and -n are mutually incompatible and each is also incompatible with -d, -i, -R and -V; -c with -C and with -o; -C with -o; --check with -o. Six candidates were tested and rejected: -R with -V is accepted, as are -d with -i, -d with -R, -d with -V, -i with -R and -i with -V, so those are absent even though every one of them is an ordering option. Two more were rejected after a false positive: 'sort -c -m' and 'sort -c -u' exit non-zero on unsorted input because -c reports disorder, not because the options clash -- rerun on sorted input both exit 0. --sort=WORD carries no conflicts_with because its exclusivity is value-dependent: 'sort --sort=numeric -n' is accepted while 'sort --sort=numeric -g' is not. As with wc, --files0-from=F replaces the FILE operands and 'sort --files0-from=F FILE' fails with \"extra operand\"; that is recorded on the operand because conflicts_with can only name flags. annotations: readonly is false because -o FILE truncates and rewrites the named file, verified against a pre-existing file. conflicts_with was extended in a later pass, after the field's definition widened to cover override groups as well as diagnosed errors: apexe's input is a JSON object, which carries no ordering, so for a last-one-wins group which flag actually wins is decided by the order the caller happened to write the keys in. Every pair added then was run in BOTH orders against the reference build recorded above, and only pairs whose outcome depends on that order, or where one side is silently discarded, were added."
  },
  "description": "Write sorted concatenation of all FILE(s) to standard output. With no FILE, or when FILE is -, read standard input. KEYDEF is F[.C][OPTS][,F[.C][OPTS]] for start and stop position, where F is a field number and C a character position in the field; both are origin 1, and the stop position defaults to the line's end. If neither -t nor -b is in effect, characters in a field are counted from the beginning of the preceding whitespace. OPTS is one or more single-letter ordering options [bdfgiMhnRrV], which override global ordering options for that key. If no key is given, use the entire line as the key. The locale specified by the environment affects sort order; set LC_ALL=C to get the traditional sort order that uses native byte values.",
  "flags": [
    { "short": "-b", "long": "--ignore-leading-blanks", "type": "boolean", "description": "Ignore leading blanks." },
    { "short": "-d", "long": "--dictionary-order", "type": "boolean", "conflicts_with": ["-g", "-h", "-M", "-n"], "description": "Consider only blanks and alphanumeric characters." },
    { "short": "-f", "long": "--ignore-case", "type": "boolean", "description": "Fold lower case to upper case characters." },
    { "short": "-g", "long": "--general-numeric-sort", "type": "boolean", "conflicts_with": ["-d", "-i", "-h", "-M", "-n", "-R", "-V", "--sort"], "description": "Compare according to general numerical value." },
    { "short": "-i", "long": "--ignore-nonprinting", "type": "boolean", "conflicts_with": ["-g", "-h", "-M", "-n"], "description": "Consider only printable characters." },
    { "short": "-M", "long": "--month-sort", "type": "boolean", "conflicts_with": ["-d", "-i", "-g", "-h", "-n", "-R", "-V", "--sort"], "description": "Compare (unknown) < 'JAN' < ... < 'DEC'." },
    { "short": "-h", "long": "--human-numeric-sort", "type": "boolean", "conflicts_with": ["-d", "-i", "-g", "-M", "-n", "-R", "-V", "--sort"], "description": "Compare human readable numbers (e.g., 2K 1G)." },
    { "short": "-n", "long": "--numeric-sort", "type": "boolean", "conflicts_with": ["-d", "-i", "-g", "-h", "-M", "-R", "-V", "--sort"], "description": "Compare according to string numerical value; see full documentation for supported strings." },
    { "short": "-R", "long": "--random-sort", "type": "boolean", "conflicts_with": ["-g", "-h", "-M", "-n", "--sort"], "description": "Shuffle, but group identical keys. See shuf(1)." },
    { "long": "--random-source", "type": "path", "value_name": "FILE", "description": "Get random bytes from FILE." },
    { "short": "-r", "long": "--reverse", "type": "boolean", "description": "Reverse the result of comparisons." },
    { "long": "--sort", "type": "enum", "value_name": "WORD", "enum_values": ["general-numeric", "human-numeric", "month", "numeric", "random", "version"], "conflicts_with": ["-g", "-h", "-M", "-n", "-R", "-V"], "description": "Sort according to WORD: general-numeric is -g, human-numeric is -h, month is -M, numeric is -n, random is -R, version is -V. It clashes with whichever single-letter ordering options the chosen WORD is incompatible with." },
    { "short": "-V", "long": "--version-sort", "type": "boolean", "conflicts_with": ["-g", "-h", "-M", "-n", "--sort"], "description": "Natural sort of (version) numbers within text." },
    { "long": "--batch-size", "type": "integer", "value_name": "NMERGE", "description": "Merge at most NMERGE inputs at once; for more use temp files." },
    { "short": "-c", "type": "boolean", "conflicts_with": ["-C", "-o", "--debug"], "description": "Check for sorted input; do not sort. Equivalent to --check=diagnose-first." },
    { "long": "--check", "type": "enum", "value_name": "WORD", "enum_values": ["diagnose-first", "quiet", "silent"], "conflicts_with": ["-o"], "description": "Check for sorted input; do not sort. The value may be omitted, which means diagnose-first (the same as -c); quiet and silent do not report the first bad line (the same as -C)." },
    { "short": "-C", "type": "boolean", "conflicts_with": ["-c", "-o", "--debug"], "description": "Like -c, but do not report first bad line. Equivalent to --check=quiet or --check=silent." },
    { "long": "--compress-program", "type": "string", "value_name": "PROG", "description": "Compress temporaries with PROG; decompress them with PROG -d." },
    { "long": "--debug", "type": "boolean", "conflicts_with": ["-c", "-C"], "description": "Annotate the part of the line used to sort, and warn about questionable usage to stderr." },
    { "long": "--files0-from", "type": "path", "value_name": "F", "description": "Read input from the files specified by NUL-terminated names in file F. If F is - then read names from standard input. This replaces the FILE operands rather than adding to them." },
    { "short": "-k", "long": "--key", "type": "string", "value_name": "KEYDEF", "repeatable": true, "description": "Sort via a key; KEYDEF gives location and type." },
    { "short": "-m", "long": "--merge", "type": "boolean", "description": "Merge already sorted files; do not sort." },
    { "short": "-o", "long": "--output", "type": "path", "value_name": "FILE", "conflicts_with": ["-c", "-C", "--check"], "description": "Write result to FILE instead of standard output. sort reads all input before opening FILE, so sorting a file in place with 'sort -o F F' works." },
    { "short": "-s", "long": "--stable", "type": "boolean", "description": "Stabilize sort by disabling last-resort comparison." },
    { "short": "-S", "long": "--buffer-size", "type": "string", "value_name": "SIZE", "description": "Use SIZE for main memory buffer. SIZE may be followed by the multiplicative suffixes % (1% of memory), b (1), K (1024, the default), and so on for M, G, T, P, E, Z, Y, R, Q." },
    { "short": "-t", "long": "--field-separator", "type": "string", "value_name": "SEP", "description": "Use SEP instead of non-blank to blank transition." },
    { "short": "-T", "long": "--temporary-directory", "type": "path", "value_name": "DIR", "repeatable": true, "description": "Use DIR for temporaries, not $TMPDIR or /tmp; multiple options specify multiple directories." },
    { "long": "--parallel", "type": "integer", "value_name": "N", "description": "Change the number of sorts run concurrently to N." },
    { "short": "-u", "long": "--unique", "type": "boolean", "description": "Output only the first of lines with equal keys; with -c, check for strict ordering." },
    { "short": "-z", "long": "--zero-terminated", "type": "boolean", "description": "Line delimiter is NUL, not newline." },
    { "long": "--help", "type": "boolean", "description": "Display this help and exit." },
    { "long": "--version", "type": "boolean", "description": "Output version information and exit." }
  ],
  "positional_args": [
    { "name": "file", "type": "path", "variadic": true, "required": false, "description": "Files to sort. With no FILE, or when FILE is -, read standard input. Not given when --files0-from is used, which rejects any FILE operand as an extra operand." }
  ],
  "annotations": {
    "readonly": false,
    "destructive": true,
    "idempotent": true,
    "requires_approval": true
  }
}