feat: ESLint, shell completions, Docker, nfpm packaging, CI/CD
- ESLint with typescript-eslint + prettier (eslint.config.js) - Shell completions for bash and fish (scripts/generate-completions.ts) - Multi-stage Dockerfile for bastion (fedora:43 + dnsmasq + node) - nfpm.yaml for RPM/DEB packaging with bun-compiled binary - Build scripts: build-rpm.sh, build-bastion.sh, publish-rpm/deb.sh - Gitea Actions CI/CD: lint, typecheck, test, build, publish Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
67
bastion/completions/lab.bash
Normal file
67
bastion/completions/lab.bash
Normal file
@@ -0,0 +1,67 @@
|
||||
# lab bash completions -- auto-generated by scripts/generate-completions.ts
|
||||
# DO NOT EDIT MANUALLY -- run: pnpm completions:generate
|
||||
|
||||
_lab() {
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
local top_commands="init provision"
|
||||
|
||||
# Extract the subcommand chain (skip options and their values)
|
||||
local -a subcmd_chain=()
|
||||
local i skip_next=false
|
||||
for ((i=1; i < cword; i++)); do
|
||||
if $skip_next; then skip_next=false; continue; fi
|
||||
case "${words[i]}" in
|
||||
-*) ;; # skip options
|
||||
*) subcmd_chain+=("${words[i]}") ;;
|
||||
esac
|
||||
done
|
||||
|
||||
local chain_len=${#subcmd_chain[@]}
|
||||
local chain_str="${subcmd_chain[*]}"
|
||||
|
||||
case "$chain_str" in
|
||||
"init bastion standalone start")
|
||||
COMPREPLY=($(compgen -W "--port --dir --domain --dhcp-mode --fedora --arch --timezone --locale --skip-dnsmasq --skip-artifacts -h --help" -- "$cur"))
|
||||
return ;;
|
||||
"init bastion standalone stop")
|
||||
COMPREPLY=($(compgen -W "--dir -h --help" -- "$cur"))
|
||||
return ;;
|
||||
"init bastion standalone status")
|
||||
COMPREPLY=($(compgen -W "--dir --port -h --help" -- "$cur"))
|
||||
return ;;
|
||||
"init bastion standalone")
|
||||
COMPREPLY=($(compgen -W "start stop status -h --help" -- "$cur"))
|
||||
return ;;
|
||||
"init bastion")
|
||||
COMPREPLY=($(compgen -W "standalone -h --help" -- "$cur"))
|
||||
return ;;
|
||||
"provision list")
|
||||
COMPREPLY=($(compgen -W "--port -h --help" -- "$cur"))
|
||||
return ;;
|
||||
"provision install")
|
||||
COMPREPLY=($(compgen -W "--role --disk --port -h --help" -- "$cur"))
|
||||
return ;;
|
||||
"provision reprovision")
|
||||
COMPREPLY=($(compgen -W "--role --disk --port -h --help" -- "$cur"))
|
||||
return ;;
|
||||
"provision forget")
|
||||
COMPREPLY=($(compgen -W "--port -h --help" -- "$cur"))
|
||||
return ;;
|
||||
"init")
|
||||
COMPREPLY=($(compgen -W "bastion -h --help" -- "$cur"))
|
||||
return ;;
|
||||
"provision")
|
||||
COMPREPLY=($(compgen -W "list install reprovision forget -h --help" -- "$cur"))
|
||||
return ;;
|
||||
"")
|
||||
COMPREPLY=($(compgen -W "$top_commands -h --help -v --version" -- "$cur"))
|
||||
return ;;
|
||||
*)
|
||||
COMPREPLY=($(compgen -W "-h --help" -- "$cur"))
|
||||
return ;;
|
||||
esac
|
||||
}
|
||||
|
||||
complete -F _lab lab
|
||||
91
bastion/completions/lab.fish
Normal file
91
bastion/completions/lab.fish
Normal file
@@ -0,0 +1,91 @@
|
||||
# lab fish completions -- auto-generated by scripts/generate-completions.ts
|
||||
# DO NOT EDIT MANUALLY -- run: pnpm completions:generate
|
||||
|
||||
complete -c lab -e
|
||||
complete -c lab -f
|
||||
|
||||
# Global options
|
||||
complete -c lab -s v -l version -d 'Show version'
|
||||
complete -c lab -s h -l help -d 'Show help'
|
||||
|
||||
# Helper: test if a subcommand chain is active
|
||||
function __lab_using_cmd
|
||||
set -l tokens (commandline -opc)
|
||||
set -l expected $argv
|
||||
set -l depth (count $expected)
|
||||
set -l found 0
|
||||
set -l i 1
|
||||
for tok in $tokens[2..]
|
||||
if string match -q -- "-*" $tok
|
||||
continue
|
||||
end
|
||||
set i (math $i + 1)
|
||||
set -l idx (math $i - 1)
|
||||
if test $idx -le $depth
|
||||
if test "$tok" != "$expected[$idx]"
|
||||
return 1
|
||||
end
|
||||
set found (math $found + 1)
|
||||
else
|
||||
return 1
|
||||
end
|
||||
end
|
||||
test $found -eq $depth
|
||||
end
|
||||
|
||||
# Top-level commands
|
||||
complete -c lab -n "not __fish_seen_subcommand_from init provision" -a init -d 'Initialise infrastructure components'
|
||||
complete -c lab -n "not __fish_seen_subcommand_from init provision" -a provision -d 'Machine provisioning operations'
|
||||
|
||||
# init subcommands
|
||||
complete -c lab -n "__lab_using_cmd init" -a bastion -d 'Bastion PXE server management'
|
||||
|
||||
# init bastion subcommands
|
||||
complete -c lab -n "__lab_using_cmd init bastion" -a standalone -d 'Standalone bastion server lifecycle'
|
||||
|
||||
# init bastion standalone subcommands
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone" -a start -d 'Start the bastion server (HTTP + dnsmasq PXE)'
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone" -a stop -d 'Stop a running bastion server'
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone" -a status -d 'Show bastion server status'
|
||||
|
||||
# init bastion standalone start options
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone start" -l port -d 'HTTP port' -x
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone start" -l dir -d 'Bastion data directory' -x
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone start" -l domain -d 'Internal domain for hostnames' -x
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone start" -l dhcp-mode -d 'DHCP mode: proxy or full' -x
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone start" -l fedora -d 'Fedora version' -x
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone start" -l arch -d 'Architecture' -x
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone start" -l timezone -d 'Timezone' -x
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone start" -l locale -d 'Locale' -x
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone start" -l skip-dnsmasq -d 'Skip starting dnsmasq (for testing)'
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone start" -l skip-artifacts -d 'Skip downloading boot artifacts (for testing)'
|
||||
|
||||
# init bastion standalone stop options
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone stop" -l dir -d 'Bastion data directory' -x
|
||||
|
||||
# init bastion standalone status options
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone status" -l dir -d 'Bastion data directory' -x
|
||||
complete -c lab -n "__lab_using_cmd init bastion standalone status" -l port -d 'Bastion HTTP port' -x
|
||||
|
||||
# provision subcommands
|
||||
complete -c lab -n "__lab_using_cmd provision" -a list -d 'List all known machines'
|
||||
complete -c lab -n "__lab_using_cmd provision" -a install -d 'Queue a discovered machine for Fedora installation'
|
||||
complete -c lab -n "__lab_using_cmd provision" -a reprovision -d 'Queue install + SSH reboot into PXE for reprovision'
|
||||
complete -c lab -n "__lab_using_cmd provision" -a forget -d 'Remove a machine from bastion state'
|
||||
|
||||
# provision list options
|
||||
complete -c lab -n "__lab_using_cmd provision list" -l port -d 'Bastion HTTP port' -x
|
||||
|
||||
# provision install options
|
||||
complete -c lab -n "__lab_using_cmd provision install" -l role -d 'Machine role: worker or infra' -x
|
||||
complete -c lab -n "__lab_using_cmd provision install" -l disk -d 'Target disk device (auto-detect if omitted)' -x
|
||||
complete -c lab -n "__lab_using_cmd provision install" -l port -d 'Bastion HTTP port' -x
|
||||
|
||||
# provision reprovision options
|
||||
complete -c lab -n "__lab_using_cmd provision reprovision" -l role -d 'Machine role: worker or infra' -x
|
||||
complete -c lab -n "__lab_using_cmd provision reprovision" -l disk -d 'Target disk device (auto-detect if omitted)' -x
|
||||
complete -c lab -n "__lab_using_cmd provision reprovision" -l port -d 'Bastion HTTP port' -x
|
||||
|
||||
# provision forget options
|
||||
complete -c lab -n "__lab_using_cmd provision forget" -l port -d 'Bastion HTTP port' -x
|
||||
|
||||
Reference in New Issue
Block a user