From 32acae0f94d46e5ae07f5579bf04340f9212670b Mon Sep 17 00:00:00 2001 From: Jim Pudar Date: Wed, 20 May 2026 08:32:11 -0400 Subject: [PATCH] Remove checked-in shell completions --- .github/workflows/ci.yml | 11 -------- README.md | 9 +++---- completions/rootcell.bash | 29 --------------------- completions/rootcell.zsh | 27 ------------------- package.json | 1 - src/rootcell/integration/common/fixtures.ts | 2 +- src/rootcell/rootcell.test.ts | 10 +++---- src/rootcell/rootcell.ts | 2 +- 8 files changed, 10 insertions(+), 81 deletions(-) delete mode 100644 completions/rootcell.bash delete mode 100644 completions/rootcell.zsh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80d095f..6580519 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,17 +45,6 @@ jobs: - name: Run TypeScript unit tests run: bun run test - - name: Check remaining shell syntax - run: bash -n completions/rootcell.bash - - - name: Install ShellCheck - run: | - sudo apt-get update - sudo apt-get install -y shellcheck - - - name: Run ShellCheck - run: shellcheck --severity=warning completions/rootcell.bash - - name: Compile Python modules run: python3 -m compileall proxy diff --git a/README.md b/README.md index 62980fc..fea5dc5 100644 --- a/README.md +++ b/README.md @@ -339,7 +339,6 @@ proxy/ allowlists and mitmproxy/dnsmasq firewall code agent_spy.py Bedrock Runtime formatter for `./rootcell spy` agent_spy_tui.py Textual browser for `./rootcell spy --tui` pi/agent/ global pi instructions, skills, and extensions -completions/ bash and zsh completion for `rootcell` ``` ## VM Lifecycle @@ -423,11 +422,9 @@ Do not put provider keys in `home.nix`; the Nix store is world-readable. ### Shell Completions -`rootcell completion` prints the yargs-generated completion script. The checked-in -files under `completions/` are generated from that command; refresh them with -`bun run completions` after changing commands or options. The generated scripts -register `rootcell`, so put `rootcell` on `PATH` before sourcing or installing -them. +`rootcell completion` prints the yargs-generated completion script. Generate it +from the installed `rootcell` command so completions stay in sync with the +version on `PATH`. For zsh, after `compinit`: diff --git a/completions/rootcell.bash b/completions/rootcell.bash deleted file mode 100644 index 05727de..0000000 --- a/completions/rootcell.bash +++ /dev/null @@ -1,29 +0,0 @@ -###-begin-rootcell-completions-### -# -# yargs command completion script -# -# Installation: rootcell completion >> ~/.bashrc -# or rootcell completion >> ~/.bash_profile on OSX. -# -_rootcell_yargs_completions() -{ - local cur_word args type_list - - cur_word="${COMP_WORDS[COMP_CWORD]}" - args=("${COMP_WORDS[@]}") - - # ask yargs to generate completions. - # see https://stackoverflow.com/a/40944195/7080036 for the spaces-handling awk - mapfile -t type_list < <(rootcell --get-yargs-completions "${args[@]}") - mapfile -t COMPREPLY < <(compgen -W "$( printf '%q ' "${type_list[@]}" )" -- "${cur_word}" | - awk '/ / { print "\""$0"\"" } /^[^ ]+$/ { print $0 }') - - # if no match was found, fall back to filename completion - if [ ${#COMPREPLY[@]} -eq 0 ]; then - COMPREPLY=() - fi - - return 0 -} -complete -o bashdefault -o default -F _rootcell_yargs_completions rootcell -###-end-rootcell-completions-### diff --git a/completions/rootcell.zsh b/completions/rootcell.zsh deleted file mode 100644 index b004c55..0000000 --- a/completions/rootcell.zsh +++ /dev/null @@ -1,27 +0,0 @@ -#compdef rootcell -###-begin-rootcell-completions-### -# -# yargs command completion script -# -# Installation: rootcell completion >> ~/.zshrc -# or rootcell completion >> ~/.zprofile on OSX. -# -_rootcell_yargs_completions() -{ - local reply - local si=$IFS - IFS=$' -' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" rootcell --get-yargs-completions "${words[@]}")) - IFS=$si - if [[ ${#reply} -gt 0 ]]; then - _describe 'values' reply - else - _default - fi -} -if [[ "'${zsh_eval_context[-1]}" == "loadautofunc" ]]; then - _rootcell_yargs_completions "$@" -else - compdef _rootcell_yargs_completions rootcell -fi -###-end-rootcell-completions-### diff --git a/package.json b/package.json index 5c1bffe..7e83f27 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,6 @@ "private": true, "type": "module", "scripts": { - "completions": "SHELL=/bin/bash ./rootcell completion | sed '${/^$/d;}' > completions/rootcell.bash && SHELL=/bin/zsh ./rootcell completion | sed '${/^$/d;}' > completions/rootcell.zsh", "typecheck": "tsc --noEmit", "lint": "eslint \"src/**/*.{ts,js,mjs,cjs}\" eslint.config.ts vitest.config.ts", "test": "vitest --project unit --run", diff --git a/src/rootcell/integration/common/fixtures.ts b/src/rootcell/integration/common/fixtures.ts index d56b40e..337be15 100644 --- a/src/rootcell/integration/common/fixtures.ts +++ b/src/rootcell/integration/common/fixtures.ts @@ -20,7 +20,7 @@ export const defaultSpyOptions = { export function findRepoDir(importMetaUrl: string): string { let dir = dirname(resolve(fileURLToPath(importMetaUrl))); for (;;) { - if (existsSync(resolve(dir, "flake.nix")) && existsSync(resolve(dir, "completions"))) { + if (existsSync(resolve(dir, "flake.nix")) && existsSync(resolve(dir, "src/rootcell"))) { return dir; } const parent = dirname(dir); diff --git a/src/rootcell/rootcell.test.ts b/src/rootcell/rootcell.test.ts index e4d7083..7abf300 100644 --- a/src/rootcell/rootcell.test.ts +++ b/src/rootcell/rootcell.test.ts @@ -1131,14 +1131,14 @@ describe("reload helper", () => { }); }); -describe("completion files", () => { +describe("shell completions", () => { test("bash and zsh completions are generated by yargs", () => { - const bash = readFileSync("completions/rootcell.bash", "utf8"); - const zsh = readFileSync("completions/rootcell.zsh", "utf8"); - expect(bash).toBe(generatedCompletion("/bin/bash")); - expect(zsh).toBe(generatedCompletion("/bin/zsh")); + const bash = generatedCompletion("/bin/bash"); + const zsh = generatedCompletion("/bin/zsh"); expect(bash).toContain("yargs command completion script"); expect(zsh).toContain("yargs command completion script"); + expect(bash).toContain("complete -o bashdefault -o default -F _rootcell_yargs_completions rootcell"); + expect(zsh).toContain("compdef _rootcell_yargs_completions rootcell"); }); test("yargs completion API includes all typed subcommands", () => { diff --git a/src/rootcell/rootcell.ts b/src/rootcell/rootcell.ts index 40ac1ff..9ef7d56 100644 --- a/src/rootcell/rootcell.ts +++ b/src/rootcell/rootcell.ts @@ -84,7 +84,7 @@ function shellQuote(value: string): string { function repoDirFromImportMeta(importMetaPath: string): string { let dir = dirname(resolve(importMetaPath)); for (;;) { - if (existsSync(join(dir, "flake.nix")) && existsSync(join(dir, "completions"))) { + if (existsSync(join(dir, "flake.nix")) && existsSync(join(dir, "src/rootcell"))) { return dir; } const parent = dirname(dir);