Skip to content

feat(autocomplete): localize batch-4 descriptions and select Fig specs per target OS - #4180

Open
ranrany123 wants to merge 7 commits into
binaricat:mainfrom
ranrany123:feat/autocomplete-zh-batch4
Open

ranrany123 wants to merge 7 commits into
binaricat:mainfrom
ranrany123:feat/autocomplete-zh-batch4

Conversation

@ranrany123

@ranrany123 ranrany123 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This branch finishes the batch-4 localization of small-gap utility commands and
fixes the completion data they rely on. While doing that it surfaced a real
cross-platform defect: the completion engine resolved every Fig spec as if the
session were Linux, so macOS sessions were offered GNU flags that their date
and base64 do not accept. Specs are now selected per target OS, and the
option semantics of readlink, date, base64 and su match what each
platform actually ships.

Type of Change

  • Bug fix
  • New feature
  • Refactor / code cleanup
  • Documentation update
  • Build / CI change
  • Other (please describe):

Related Issue (optional)

N/A

Changes Made

  • Add zh-CN descriptions for the 22 batch-4 utilities (echo, which,
    paste, pwd, clear, su, crontab, env, uname, base64, date,
    id, split, seq, join, dig, dd, htop, basename, dirname,
    readlink, more) and regenerate zh-TW with the committed OpenCC script.
  • Add local specs where the bundled Fig data does not match the tool: GNU
    date and base64, corrected readlink, dig record types, and the
    htop -H delay unit.
  • Select specs by the target session's OS. The renderer passes hostOs over
    the Fig IPC bridge, and spec contents, in-flight loads, the available-name
    list and the loaded-name index are all scoped by command and OS, so one
    renderer can serve Linux and macOS sessions without mixing them. The bridge
    merges electron/specs/macos/ into the spec list only for macOS sessions.
  • Add native macOS date and readlink specs (date gains -z; readlink
    exposes only -f/-n) and keep the bundled BSD specs as the macOS fallback.
  • Fix GNU readlink option data: -q/--quiet/-s/--silent suppress error
    messages, -v/--verbose reports them, and the nonexistent --strip is gone.
  • Restore filepath completion for base64 operands and date -f/-r, keeping
    numeric-prefix paths for date -r because filenames may start with digits.
  • Complete values attached to optional option arguments (date -Is ->
    -Iseconds, date --iso-8601=s -> --iso-8601=seconds). This is opt-in per
    option through netcattyOptionalArgAttached, so optional arguments of other
    commands and required-argument completion are unchanged.
  • Describe su -m as BSD's caller login shell versus util-linux's -s then
    SHELL order, keep the getusershell(3) caveat, and correct the
    bundled-date fallback translations for -d/-t/-n/-r.

Screenshots / Demo

No layout changes; only completion items and their descriptions. Example
behaviour after this branch:

  • Linux session: date - offers --date, --reference, --iso-8601 and not
    -j/-v; readlink --s offers --silent and not --strip.
  • macOS session: date - offers -j, -r, -u, -v, -z and not
    --date; base64 -i <Tab> completes file paths.

Testing

  • Linting passes (npm run lint)
  • Tests pass (npm test)
  • Generated capability tool specs are updated when applicable (npm run generate:capability-tools)
  • No new console errors or warnings, if this affects app behavior

Notes: the focused suites for this area pass (103 tests across
autocompleteDescriptionI18n*, autocompleteOptionalArgs,
completionEngine*, snippetCompleter, figSpecLoader,
terminalCompletionProviders, registerBridgesFigSpec and
reviewFigSpecs). The full npm test run on macOS reports 16016 passing and
three failures in environment-sensitive live tests only (transferBridge,
real-Bash shellReadiness.osc133), none in the touched area. A packaged build
(npm run pack:dir) was produced and the app's ASAR was checked directly: the
bridge lists specs with the OS-scoped rule, loads macOS date with -z, keeps
Linux/macOS lookups isolated, and returns null for unknown commands.

The current head also carries an empty commit that re-triggers CI: the previous
lint-and-test job ended with a GitHub runner shutdown during the plugin
boundary step, not with a test failure, and contributors cannot re-run it.

Checklist

  • My code follows the existing project style
  • I have added or updated relevant documentation
  • I have not introduced any breaking changes (or I have described them above)

Localize the remaining Fig descriptions of 22 general-purpose commands that
had 15 or fewer untranslated keys: echo, which, paste, pwd, clear, su,
crontab, env, uname, base64, date, id, split, seq, join, dig, dd, htop,
basename, dirname, readlink, and more.

- Add 159 unique zh-CN entries (160 per-command entries; basename and
  dirname share one key) and regenerate zh-TW from them.
- Preload the new specs and extend the untranslated-description audit and
  its preload assertions.
- Add batch 4 coverage, semantics, insertion-text and zh-TW terminology
  tests plus the batch research note.
- Keep upstream wording quirks documented instead of hidden: dig labels NS
  as "Query MX Record", readlink reuses stat wording, and date/su/env follow
  the BSD/macOS flags their specs actually expose.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T15:03:39.462854Z ed12590 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed12590725

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2932 to +2933
"Print the machine hardware name": "印表機器硬體名稱",
"Print the machine processor architecture name": "印表機器處理器架構名稱",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid converting uname hints into printer descriptions

For zh-TW autocomplete, both new uname hints begin with 印表機器, incorrectly referring to a printer rather than instructing the user to print machine information. The conversion has matched 打印机 across the 打印 + 机器 word boundary; the checked GNU uname --help describes -m as “print the machine hardware name”. Reword the zh-CN inputs (for example, use 输出机器…) or protect that boundary in the generator, then regenerate zh-TW so the machine-information hints retain their intended meaning.

Useful? React with 👍 / 👎.

Review the batch 4 commands against jaywcjlove/linux-command (MIT), which
Netcatty's Linux-centric sessions match better than the bundled Fig wording.

- uname -s/-r/-v now say kernel name/release/version: GNU uname prints the
  kernel, not the distribution, and macOS reports Darwin through the same
  options.
- dd cbs states the conversion record is counted in bytes.
- Document which specs in this batch expose BSD/macOS-only options (date, su,
  id, base64, split, seq, env, more, which) so their descriptions are not
  rewritten into GNU wording that the inserted option does not have, and note
  dd's upstream `files` operand artifact.

No key was added or removed; zh-TW is regenerated from zh-CN.
The bundled Fig date spec follows BSD/macOS flags (-j, -n, -t, -v, epoch
seconds for -r), so Linux hosts were offered options that do not exist there.
Local specs already override the bundled package, so add electron/specs/date.js
with the GNU option set: -d/--date, --debug, -f/--file, -I/--iso-8601,
-R/--rfc-email, --rfc-3339, -r/--reference, -s/--set, -u/--utc, plus the
+FORMAT operand.

- Translate the 13 new descriptions; zh-TW is regenerated from them.
- Remove the 13 BSD-only date entries after a repository-wide scan showed no
  other spec references them.
- Resolve local specs first in the batch 4 test, matching runtime and the
  untranslated-description audit, and spot-check the new GNU wording.
Follow-up review of batch 4 found wording that would show up in the popup and
two upstream spec defects. Local specs already override @withfig/autocomplete,
so the wrong option sets are replaced rather than translated around.

- Add electron/specs/{dig,readlink,base64,htop}.js:
  dig fixes the NS label and drops the bogus TTL type; readlink replaces the
  stat wording with the real GNU options; base64 moves from BSD -b/-i/-o to
  GNU -w and --ignore-garbage; htop documents the -H delay in seconds.
- Correct awk -c (traditional mode) and -t (--lint-old) to match gawk, with
  the dictionary keys migrated alongside -n.
- Reword review findings: htop -H highlights exited processes, split -a uses
  characters and -b uses KiB/MiB/GiB, dd cbs is a conversion record length,
  join -a/-v name the file index and -o covers unpaired lines, basename -a
  accepts multiple paths, env -0 ends records with NUL, dig ANY notes RFC 8482,
  su -f/-m keep the BSD behavior without hardcoded environment claims, and
  uname uses one verb for the kernel fields.
- Extend the zh-TW generator with documented post-conversion fixes (number
  bases, extended, instance, header, TLS extension, data) and regenerate.
- Update the batch 2 and batch 4 research notes, and resolve local specs first
  in the batch 4 test so it exercises what the app loads.
@ranrany123

Copy link
Copy Markdown
Contributor Author

P2 已修复:zh-CN 改为「显示机器硬件名称 / 显示机器处理器架构名称」,同时生成器增加了有注释的转换后修正表(進位制→進位、擴充套件→擴充、例項→執行個體、擴充頭→擴充標頭、TLS 擴充→TLS 擴充功能、數據→資料)。全量扫描后 zh-TW 中 印表機、擴充套件、進位制、例項 均为 0。另外本轮把 dig/readlink/base64/htop 的 bundled spec 缺陷改为本地 spec 覆盖,并修正了 awk 的 -c/-n/-t 英文描述。

- Assert every one of the 22 batch-4 commands in COMMON_FIG_SPECS; the old
  loop only covered 7, so dropping a preload entry could pass unnoticed.
- Keep the noun “extension” as 擴充功能: the generic 擴充套件→擴充 rule is
  right for “extended” compounds (擴充屬性, 擴充標頭, 擴充正規表示式), but
  Apple's option descriptions need the noun form.
…ntics

- Resolve date, base64 and readlink against the target session's OS: macOS
  keeps its BSD specs while Linux keeps the local GNU ones. The renderer now
  passes the OS over the Fig bridge, and spec contents, in-flight loads, the
  available-name list and the loaded-name index are all scoped by command and
  OS, so one renderer can serve Linux and macOS sessions without mixing them.
- Add native macOS date and readlink specs (date gains -z, readlink exposes
  only -f/-n) and keep the bundled date/base64 specs as the macOS fallback.
  The bridge spec list merges specs/macos only for macOS sessions, so a
  platform-only command is never suggested where it cannot load.
- Fix GNU readlink: -q/--quiet/-s/--silent suppress error messages, -v/--verbose
  reports them, and the nonexistent --strip is gone. Restore filepath
  completion for base64 operands and date -f/-r, and cover date -r with numeric
  prefixes so digit-leading filenames stay discoverable.
- Complete values attached to optional option arguments (-Is -> -Iseconds,
  --iso-8601=s -> --iso-8601=seconds) only for specs that opt in through
  netcattyOptionalArgAttached, leaving other commands' optional arguments and
  required-argument completion unchanged.
- Describe su -m as BSD's caller login shell versus util-linux's -s/SHELL
  order, refresh the affected zh-CN/zh-TW entries and the bundled-date fallback
  translations, and regenerate zh-TW with the repository script.
- Add focused tests for per-OS loader caching, spec listing and scoping,
  attached-argument completion, path completion, and localized descriptions;
  update the batch-4 research notes to match.
The lint-and-test job on f09b3ee ended with "The runner has received a
shutdown signal" during the plugin boundary step, not with a test failure.
Contributors cannot re-run that job, so this empty commit triggers a fresh
PR synchronize check.
@ranrany123 ranrany123 changed the title feat(autocomplete): add zh-CN descriptions for small-gap utilities feat(autocomplete): localize batch-4 descriptions and select Fig specs per target OS Nov 8, 2026
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.

1 participant