Install Command API Reference¶
This section documents the internals of the install
command in Bijux CLI.
bijux_cli.commands.plugins.install ¶
Implements the plugins install
subcommand for the Bijux CLI.
This module contains the logic for installing a new plugin by copying its source directory into the CLI's plugins folder. The process is designed to be atomic and safe, incorporating validation of the plugin's name and metadata, version compatibility checks against the current CLI version, and file locking to prevent race conditions during installation.
Output Contract
- Install Success:
{"status": "installed", "plugin": str, "dest": str}
- Dry Run Success:
{"status": "dry-run", "plugin": str, ...}
- Error:
{"error": "...", "code": int}
Exit Codes
0
: Success.1
: A fatal error occurred (e.g., source not found, invalid name, version incompatibility, filesystem error).2
: An invalid flag was provided (e.g., bad format).3
: An ASCII or encoding error was detected in the environment.
install_plugin ¶
install_plugin(
path: str = Argument(
..., help="Path to plugin directory"
),
dry_run: bool = Option(False, "--dry-run"),
force: bool = Option(False, "--force", "-F"),
quiet: bool = Option(
False, "-q", "--quiet", help=HELP_QUIET
),
verbose: bool = Option(
False, "-v", "--verbose", help=HELP_VERBOSE
),
fmt: str = Option(
"json", "-f", "--format", help=HELP_FORMAT
),
pretty: bool = Option(
False, "--pretty/--no-pretty", help=HELP_NO_PRETTY
),
debug: bool = Option(
False, "-d", "--debug", help=HELP_DEBUG
),
) -> None
Installs a plugin from a local source directory.
This function orchestrates the plugin installation process. It validates the source path and plugin name, checks for version compatibility, handles pre-existing plugins via the --force
flag, and performs an atomic copy into the plugins directory using a file lock and temporary directory.
Parameters:
-
path
(str
, default:Argument(..., help='Path to plugin directory')
) –The source path to the plugin directory to install.
-
dry_run
(bool
, default:Option(False, '--dry-run')
) –If True, simulates the installation without making changes.
-
force
(bool
, default:Option(False, '--force', '-F')
) –If True, overwrites an existing plugin of the same name.
-
quiet
(bool
, default:Option(False, '-q', '--quiet', help=HELP_QUIET)
) –If True, suppresses all output except for errors.
-
verbose
(bool
, default:Option(False, '-v', '--verbose', help=HELP_VERBOSE)
) –If True, includes runtime metadata in error payloads.
-
fmt
(str
, default:Option('json', '-f', '--format', help=HELP_FORMAT)
) –The output format for confirmation or error messages.
-
pretty
(bool
, default:Option(False, '--pretty/--no-pretty', help=HELP_NO_PRETTY)
) –If True, pretty-prints the output.
-
debug
(bool
, default:Option(False, '-d', '--debug', help=HELP_DEBUG)
) –If True, enables debug diagnostics.
Returns:
-
None
(None
) –
Raises:
-
SystemExit
–Always exits with a contract-compliant status code and payload, indicating success or detailing an error.
Source code in src/bijux_cli/commands/plugins/install.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
|