Skip to content

ByteYue/opencli-plugin-audit-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

opencli-plugin-audit-log

OpenCLI plugin that automatically records every command execution to a local audit log using the lifecycle hooks API.

What it does

Once installed, this plugin silently logs every opencli command you run to ~/.opencli/audit.jsonl. Each entry records:

  • command — the site/name that was executed
  • args — the arguments passed
  • timestamp — ISO 8601 execution time
  • durationMs — how long the command took
  • rowCount — number of result rows (if applicable)

Install

opencli plugin install github:ByteYue/opencli-plugin-audit-log

Usage

After installation, all commands are automatically logged. No configuration needed.

To view recent audit entries:

opencli audit-log show              # last 20 entries
opencli audit-log show --limit 50   # last 50 entries

How it works

This plugin uses opencli's lifecycle hooks API:

  • onBeforeExecute — records the start timestamp before each command
  • onAfterExecute — writes the audit entry after the command completes

The hooks are registered in audit-hooks.ts and fire automatically for every command across the entire opencli runtime.

Requirements

  • opencli >= 1.3.0 (lifecycle hooks support)

Log format

One JSON object per line (JSONL):

{"command":"hackernews/top","args":{"limit":5},"timestamp":"2026-03-24T13:30:00.000Z","durationMs":2340,"rowCount":5}
{"command":"twitter/timeline","args":{"type":"following","limit":10},"timestamp":"2026-03-24T13:31:05.000Z","durationMs":5120,"rowCount":10}

About

OpenCLI plugin: Automatic command audit logging via lifecycle hooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors