Releases: aipartnerup/apcore-cli-python
Releases · aipartnerup/apcore-cli-python
Release 0.2.1
Changed
- Help text truncation limit increased from 200 to 1000 characters (configurable via
cli.help_text_max_lengthconfig key) _extract_help: addedmax_length: int = 1000parameter (schema_parser.py)schema_to_click_options: addedmax_help_length: int = 1000parameter (schema_parser.py)build_module_command: addedhelp_text_max_length: int = 1000parameter, threaded through to schema parser (cli.py)LazyModuleGroup: constructor acceptshelp_text_max_length: int = 1000, passes tobuild_module_command(cli.py)create_cli: resolvescli.help_text_max_lengthfromConfigResolverand passes toLazyModuleGroup(__main__.py)format_exec_result: nested dict/list values in table mode now rendered withjson.dumpsinstead ofstr()(output.py)
Added
cli.help_text_max_lengthconfig key (default: 1000) inConfigResolver.DEFAULTS(config.py)APCORE_CLI_HELP_TEXT_MAX_LENGTHenvironment variable support for configuring help text max lengthtest_help_truncation_default: tests default 1000-char truncationtest_help_no_truncation_within_limit: tests no truncation at 999 charstest_help_truncation_custom_max: tests custom max_length parameter- 263 tests (up from 261)
Release 0.2.0
Added
APCORE_CLI_LOGGING_LEVELenv var — CLI-specific log level that takes priority overAPCORE_LOGGING_LEVEL; 3-tier precedence:--log-levelflag >APCORE_CLI_LOGGING_LEVEL>APCORE_LOGGING_LEVEL>WARNING(__main__.py)test_cli_logging_level_takes_priority_over_global— verifiesAPCORE_CLI_LOGGING_LEVEL=DEBUGwins overAPCORE_LOGGING_LEVEL=ERRORtest_cli_logging_level_fallback_to_global— verifies fallback when CLI-specific var is unsettest_builtin_name_collision_exits_2— schema property namedformat(or other reserved names) causesbuild_module_commandto exit 2test_exec_result_table_format—--format tablerenders Rich Key/Value table to stdouttest_bash_completion_quotes_prog_name_in_directive— verifiesshlex.quote()applied tocomplete -Fdirective, not just embedded subshelltest_zsh_completion_quotes_prog_name_in_directives— verifiescompdefline uses quoted prog_nametest_fish_completion_quotes_prog_name_in_directives— verifiescomplete -clines use quoted prog_name- 17 new tests (244 → 261 total)
Changed
--log-levelaccepted choices:WARN→WARNING(__main__.py)schema_to_click_options: schema-derived options now always haverequired=False; required fields marked[required]in help text instead of Click enforcement — allows--input -STDIN to supply required values without Click rejecting first (schema_parser.py)format_exec_result: now routes throughresolve_format()and renders Rich table when--format tableis specified; previously ignored itsformatparameter (output.py)_generate_bash_completion,_generate_zsh_completion,_generate_fish_completion:shlex.quote()applied to ALL prog_name positions in generated scripts (complete directives, compdef, complete -c), not only embedded subshell commands (shell.py)check_approval: removed unusedctx: click.Contextparameter (approval.py)set_audit_logger: broadened type annotation fromAuditLoggertoAuditLogger | None(cli.py)collect_input: simplified redundant conditionif not raw or raw_size == 0:→if not raw:(cli.py)- Example
Inputmodels: all 7 modules updated withField(description=...)on every field so CLI--helpshows descriptive text for each flag
Fixed
--input -STDIN blocked by Click required enforcement:schema_to_click_optionswas generatingrequired=TrueClick options; Click validated before the callback ran, rejecting STDIN-only invocations. Resolved by always usingrequired=Falseand delegating required validation tojsonschema.validate()after input collection. Fixes all 6TestRealStdinPipingfailures.--log-levelhad no effect:logging.basicConfig()is a no-op after the first call; subsequentcreate_cli()calls in tests retained the prior handler's level. Fixed by callinglogging.getLogger().setLevel()explicitly afterbasicConfig().test_log_level_flag_takes_effectfalse pass:--helpis an eager flag that exits before the group callback, so--log-level DEBUG --helpnever applied the log level. Test updated to usecompletion bashsubcommand instead.- Shell completion directives not shell-safe: prog names with spaces or special characters were unquoted in
complete -F,compdef, andcomplete -clines. Fixed by assigningquoted = shlex.quote(prog_name)and using it in all directive positions. - Audit
set_audit_logger(None)type error: type annotation rejectedNone; broadened toAuditLogger | None. - Test logger level leakage: tests modifying root logger level affected subsequent tests; fixed with
try/finallythat restores the original level.
Security
AuditLogger._hash_input: now usessecrets.token_bytes(16)per-invocation salt before hashing, preventing cross-invocation input correlation via SHA-256 rainbow tablesbuild_module_command: added reserved-name collision guard — exits 2 if a schema property (input,yes,large_input,format,sandbox) conflicts with a built-in CLI option name_prompt_with_timeout(SIGALRM path): wrapped intry/finallyto guarantee signal handler restoration regardless of exit path
Release 0.1.0
Added
--sandboxflag for subprocess-isolated module execution (FE-05)ModuleExecutionErrorexception class for sandbox failures- Windows approval timeout support via
threading.Timer+ctypes(FE-03) - Approval timeout clamping to 1..3600 seconds range (FE-03)
- Tag format validation (
^[a-z][a-z0-9_-]*$) inlist --tag(FE-04) cli.auto_approveconfig key withFalsedefault (FE-07)- Extensions directory readability check with exit code 47 (FE-01)
- Missing required property warning in schema parser (FE-02)
- DEBUG log
"Loading extensions from {path}"before registry discovery (FE-01) TYPE_CHECKINGimports for proper type annotations (Registry,Executor,ModuleDescriptor,ConfigResolver,AuditLogger)_get_module_id()helper forcanonical_id/module_idresolutionAPCORE_AUTH_API_KEYandAPCORE_CLI_SANDBOXto README environment variables table--sandboxto README module execution options table- CHANGELOG.md
- Core Dispatcher (FE-01):
LazyModuleGroup,build_module_command,collect_input,validate_module_id - Schema Parser (FE-02):
schema_to_click_options,_map_type,_extract_help,reconvert_enum_values - Ref Resolver (FE-02):
resolve_refs,_resolve_nodewith$ref,allOf,anyOf,oneOfsupport - Config Resolver (FE-07):
ConfigResolverwith 4-tier precedence (CLI > Env > File > Default) - Approval Gate (FE-03):
check_approval,_prompt_with_timeoutwith TTY detection and Unix SIGALRM - Discovery (FE-04):
listanddescribecommands with tag filtering and TTY-adaptive output - Output Formatter (FE-08):
format_module_list,format_module_detail,format_exec_resultwith Rich rendering - Security Manager (FE-05):
AuthProvider,ConfigEncryptor(keyring + AES-256-GCM),AuditLogger(JSON Lines),Sandbox(subprocess isolation) - Shell Integration (FE-06): bash/zsh/fish completion generators, roff man page generator
- 8 example modules:
math.add,math.multiply,text.upper,text.reverse,text.wordcount,sysutil.info,sysutil.env,sysutil.disk - 244 tests (unit, integration, end-to-end)
- CI workflow with pytest and coverage
- Pre-commit hooks configuration