API Reference

Functions

Utility functions

add_highlight_keyword()

Persist a custom keyword/phrase to highlight class mapping.

add_user()

Add or replace a user’s salted password hash and role.

attempt_login()

Verify credentials subject to failed-attempt lockout.

build_client()

Return a chatlas client seeded with the admin-task notes for services.

chat_available()

Return True when the optional chat extra is installed.

doc_columns()

Return the man page width in columns that fills width_px of screen.

doc_references()

Return the URIs listed in the unit’s Documentation= property.

get_all_service_info()

Return built-in SERVICE_INFO merged with user-saved overrides (overrides win).

get_documentation()

Return systemctl help <service>: the man pages named by Documentation=.

get_logs()

Return the last lines journalctl entries for service, newest first.

get_role()

Return a user’s role, or DEFAULT_ROLE for records saved before roles existed.

get_service_info()

Return admin-task notes for a service, falling back to generic guidance.

get_status()

Return combined stdout/stderr of systemctl status <service>.

highlight()

Escape text and wrap known (and user-added) keywords in colored spans.

highlight_term()

Escape text and wrap case-insensitive matches of term in .

list_services()

Return sorted service names known to systemd that have admin-task notes.

load_users()

Load the credentials file, or an empty dict if it doesn’t exist yet.

lockout_remaining()

Return whole seconds left on username’s lockout, or 0 if it isn’t locked.

record_action()

Append a timestamped audit entry for a service control action.

record_auth()

Append a timestamped audit entry for a login or logout attempt.

read_audit_log()

Return the most recent audit entries, newest first, optionally filtered by service.

read_only_tools()

Return the read-only functions a chat client may call.

redact()

Replace anything secret-shaped in a shell command line with [REDACTED].

save_service_info()

Persist a user-edited admin-task entry for service, overriding any built-in entry.

system_prompt()

Build a system prompt covering every service discussed so far.

systemctl_action()

Run systemctl <action> <service> and return the completed process.

verify_user()

Check a username/password pair against the stored hash.