Update startup scripts to use safe-chain instead of aikido-*

This commit is contained in:
Sander Declerck 2025-11-28 14:01:11 +01:00
parent f1ee6567df
commit a3bff105cc
No known key found for this signature in database
3 changed files with 28 additions and 31 deletions

View file

@ -45,7 +45,6 @@ const pkgManagerCommands = [
];
if (pkgManagerCommands.includes(command)) {
ui.writeInformation(process.argv.join(", "));
setEcoSystem(ECOSYSTEM_JS);
initializePackageManager(command);
(async () => {

View file

@ -39,12 +39,11 @@ function Invoke-RealCommand {
function Invoke-WrappedCommand {
param(
[string]$OriginalCmd,
[string]$AikidoCmd,
[string[]]$Arguments
)
if (Test-CommandAvailable $AikidoCmd) {
& $AikidoCmd @Arguments
if (Test-CommandAvailable "safe-chain") {
& safe-chain $OriginalCmd @Arguments
}
else {
Write-SafeChainWarning $OriginalCmd
@ -53,27 +52,27 @@ function Invoke-WrappedCommand {
}
function npx {
Invoke-WrappedCommand "npx" "aikido-npx" $args
Invoke-WrappedCommand "npx" $args
}
function yarn {
Invoke-WrappedCommand "yarn" "aikido-yarn" $args
Invoke-WrappedCommand "yarn" $args
}
function pnpm {
Invoke-WrappedCommand "pnpm" "aikido-pnpm" $args
Invoke-WrappedCommand "pnpm" $args
}
function pnpx {
Invoke-WrappedCommand "pnpx" "aikido-pnpx" $args
Invoke-WrappedCommand "pnpx" $args
}
function bun {
Invoke-WrappedCommand "bun" "aikido-bun" $args
Invoke-WrappedCommand "bun" $args
}
function bunx {
Invoke-WrappedCommand "bunx" "aikido-bunx" $args
Invoke-WrappedCommand "bunx" $args
}
function npm {
@ -83,29 +82,29 @@ function npm {
Invoke-RealCommand "npm" $args
return
}
Invoke-WrappedCommand "npm" "aikido-npm" $args
Invoke-WrappedCommand "npm" $args
}
function pip {
Invoke-WrappedCommand "pip" "aikido-pip" $args
Invoke-WrappedCommand "pip" $args
}
function pip3 {
Invoke-WrappedCommand "pip3" "aikido-pip3" $args
Invoke-WrappedCommand "pip3" $args
}
function uv {
Invoke-WrappedCommand "uv" "aikido-uv" $args
Invoke-WrappedCommand "uv" $args
}
# `python -m pip`, `python -m pip3`.
function python {
Invoke-WrappedCommand 'python' 'aikido-python' $args
Invoke-WrappedCommand 'python' $args
}
# `python3 -m pip`, `python3 -m pip3'.
function python3 {
Invoke-WrappedCommand 'python3' 'aikido-python3' $args
Invoke-WrappedCommand 'python3' $args
}

View file

@ -17,41 +17,40 @@ end
function wrapSafeChainCommand
set original_cmd $argv[1]
set aikido_cmd $argv[2]
set cmd_args $argv[3..-1]
if type -q $aikido_cmd
# If the aikido command is available, just run it with the provided arguments
$aikido_cmd $cmd_args
set cmd_args $argv[2..-1]
if type -q safe-chain
# If the safe-chain command is available, just run it with the provided arguments
safe-chain $original_cmd $cmd_args
else
# If the aikido command is not available, print a warning and run the original command
# If the safe-chain command is not available, print a warning and run the original command
printSafeChainWarning $original_cmd
command $original_cmd $cmd_args
end
end
function npx
wrapSafeChainCommand "npx" "aikido-npx" $argv
wrapSafeChainCommand "npx" $argv
end
function yarn
wrapSafeChainCommand "yarn" "aikido-yarn" $argv
wrapSafeChainCommand "yarn" $argv
end
function pnpm
wrapSafeChainCommand "pnpm" "aikido-pnpm" $argv
wrapSafeChainCommand "pnpm" $argv
end
function pnpx
wrapSafeChainCommand "pnpx" "aikido-pnpx" $argv
wrapSafeChainCommand "pnpx" $argv
end
function bun
wrapSafeChainCommand "bun" "aikido-bun" $argv
wrapSafeChainCommand "bun" $argv
end
function bunx
wrapSafeChainCommand "bunx" "aikido-bunx" $argv
wrapSafeChainCommand "bunx" $argv
end
function npm
@ -66,5 +65,5 @@ function npm
end
end
wrapSafeChainCommand "npm" "aikido-npm" $argv
wrapSafeChainCommand "npm" $argv
end