Final summary
Add a small, safe CLI write path so wl update <id> --audit-text "..." records a structured per-item audit object ({time, author, text}). The command auto-generates time (UTC ISO8601) and author (actor display name) and overwrites the latest audit entry.
Problem statement
Add a safe, structured CLI write path for per-item audits so maintainers and automation can record a concise, machine-readable audit entry from the CLI. The goal is a small vertical slice that lets wl update <id> --audit-text "..." write (or overwrite) an audit object on a work item containing { time, author, text } where time and author are generated by the system.
Users
- Operators and maintainers who need to record a short audit note from the terminal (example: record a migration, a manual fix, or an important handoff).
- Automation authors and scripts that must record a single, recent audit from CI or tooling.
Example user stories
- As a maintainer, I want to run
wl update WL-... --audit-text "Applied DB migration" so the work item shows a concise, timestamped audit I and my colleagues can read and scripts can parse.
- As an automation, I want
wl update to set audit.time to the current UTC ISO8601 and audit.author to the actor display name so downstream tools can rely on standardized metadata.
Success criteria
- CLI:
wl update --help documents --audit-text and wl update <id> --audit-text "..." stores or overwrites audit.text on the work item.
- Metadata:
audit.time is generated as the current UTC ISO8601 when writing and audit.author stores the actor display name; wl show <id> (human and --json) includes the audit object.
- Tests: unit and integration tests cover write and overwrite behavior and CLI help rendering.
- Scope: This change overwrites the single latest
audit object (no audit-history array) and does not implement PII redaction; redaction is handled by the separate item WL-0MMNCOIYS15A1YSI.
Constraints
- Only support
--audit-text for this change; the system generates audit.time and audit.author automatically (no --audit-time flag in this item).
- Overwrite behaviour: the command replaces the work item's
audit object (no history kept).
- Defer email redaction and advanced safety rules to WL-0MMNCOIYS15A1YSI.
- Reuse existing update permission model: the same permission check that gates
wl update continues to apply to audit writes.
Existing state
- Data model planning exists in:
WL-0MMNCNT1M16ESD04 (Audit Data Model and Migration).
- Work item:
WL-0MMNCOIYF18YPLFB (Audit Write Path via CLI Update) already exists and is staged idea (assigned to Map).
- Several dependent/related items exist for read-paths, migration, redaction and end-to-end validation (see Related work).
- Implementation pointers: CLI handler at
src/commands/update.ts, runtime types in src/types.ts, and persistence in src/persistent-store.ts were identified as touch points.
Desired change
- Add parsing and handler in the
update command to accept --audit-text and produce a well-formed audit object: { time: <UTC ISO8601>, author: <actor-display-name>, text: <redacted-or-raw-text?> } (redaction deferred).
- Store/overwrite the work item's
audit field via existing persistence helpers and surface the audit in wl show output.
- Add unit tests for parsing/validation and an integration test for CLI flow.
- Update CLI help and short docs describing the overwrite semantics and that redaction is handled by a separate work item.
Related work
Notes and open questions
- Per decision: support
--audit-text only and auto-generate audit.time and audit.author (no --audit-time for this slice).
- Per decision: overwrite the existing
audit object rather than append to history.
- Per decision: defer redaction to WL-0MMNCOIYS15A1YSI so we don't duplicate safety rules; this intake will reference that item as a blocking/adjacent dependency for PII handling.
Acceptance criteria (draft)
wl update --help lists --audit-text and shows short usage.
wl update <id> --audit-text "..." writes audit on the item with time = now (UTC ISO8601), author = actor display name, text = provided string.
wl show <id> (human) and wl show <id> --json include the audit object when present.
- Unit tests cover parsing, overwrite behavior, and permission checks; an integration test covers the end-to-end CLI path.
- Documentation note added to the CLI reference noting overwrite semantics and reference to WL-0MMNCOIYS15A1YSI for redaction rules.
Risks & assumptions
- Risk: PII leakage if audit text contains email addresses or other sensitive tokens. Mitigation: redaction is out of scope for this change and is captured in WL-0MMNCOIYS15A1YSI; tests should assert that redaction work item is referenced and that redaction is applied once that item is merged.
- Risk: Schema mismatch / migration failure. Mitigation: rely on
WL-0MMNCNT1M16ESD04 for migration strategy and add a migration dry-run test.
- Risk: Scope creep (adding history, time override, complicated redaction) — Mitigation: record additional feature requests as separate work items and avoid expanding this item beyond the single write/overwrite slice.
- Assumption:
wl update permission checks cover audit writes; no additional permission model changes are required.
Related work (automated report)
- Replace comment-based audits with structured audit field (WL-0MLDJ34RQ1ODWRY0): parent specification defining the audit shape, migration strategy and UX; primary reference for permissions and migration policy.
- Audit Data Model and Migration (WL-0MMNCNT1M16ESD04): migration and schema notes that define
{time, author, text, status} and wl doctor upgrade behaviour — consult when adding migrations/tests.
- Redaction and Safety Rules for Audit Text (WL-0MMNCOIYS15A1YSI): PII redaction rules (email masking, safety notes); this intake defers implementation to that item.
- Audit Read Path in Show Outputs (WL-0MMNCOJ0V0IFM2SN): specifies how
wl show should include the audit object in human and JSON outputs; update src/commands/show.ts accordingly.
- End-to-End Validation, Docs and Reuse Alignment (WL-0MMNCOQY30S8312J): final tests and docs covering write+show+redaction flows — reference when creating integration tests and operator docs.
Final summary
Add a small, safe CLI write path so
wl update <id> --audit-text "..."records a structured per-itemauditobject ({time, author, text}). The command auto-generatestime(UTC ISO8601) andauthor(actor display name) and overwrites the latest audit entry.Problem statement
Add a safe, structured CLI write path for per-item audits so maintainers and automation can record a concise, machine-readable audit entry from the CLI. The goal is a small vertical slice that lets
wl update <id> --audit-text "..."write (or overwrite) anauditobject on a work item containing { time, author, text } where time and author are generated by the system.Users
Example user stories
wl update WL-... --audit-text "Applied DB migration"so the work item shows a concise, timestamped audit I and my colleagues can read and scripts can parse.wl updateto setaudit.timeto the current UTC ISO8601 andaudit.authorto the actor display name so downstream tools can rely on standardized metadata.Success criteria
wl update --helpdocuments--audit-textandwl update <id> --audit-text "..."stores or overwritesaudit.texton the work item.audit.timeis generated as the current UTC ISO8601 when writing andaudit.authorstores the actor display name;wl show <id>(human and--json) includes theauditobject.auditobject (no audit-history array) and does not implement PII redaction; redaction is handled by the separate item WL-0MMNCOIYS15A1YSI.Constraints
--audit-textfor this change; the system generatesaudit.timeandaudit.authorautomatically (no--audit-timeflag in this item).auditobject (no history kept).wl updatecontinues to apply to audit writes.Existing state
WL-0MMNCNT1M16ESD04(Audit Data Model and Migration).WL-0MMNCOIYF18YPLFB(Audit Write Path via CLI Update) already exists and is stagedidea(assigned to Map).src/commands/update.ts, runtime types insrc/types.ts, and persistence insrc/persistent-store.tswere identified as touch points.Desired change
updatecommand to accept--audit-textand produce a well-formedauditobject:{ time: <UTC ISO8601>, author: <actor-display-name>, text: <redacted-or-raw-text?> }(redaction deferred).auditfield via existing persistence helpers and surface the audit inwl showoutput.Related work
Potentially related docs
skill/audit/SKILL.md— new structured audit report format (triage output) used by AMPA (repo-local skill).docs/triage-audit.md— guidance for audit report formatting used by triage tooling.src/commands/update.ts— CLI handler to be updated.src/persistent-store.ts— persistence layer where the audit object will be stored.Potentially related work items
Replace comment-based audits with structured audit field (WL-0MLDJ34RQ1ODWRY0)— parent/epic for structured audit efforts.Audit Data Model and Migration (WL-0MMNCNT1M16ESD04)— schema and migration planning for theauditfield (important for DB changes).Audit Read Path in Show Outputs (WL-0MMNCOJ0V0IFM2SN)— surface audit inwl showhuman and JSON output.Redaction and Safety Rules for Audit Text (WL-0MMNCOIYS15A1YSI)— separate item covering email/PII redaction (this intake defers to that item).End-to-End Validation, Docs and Reuse Alignment (WL-0MMNCOQY30S8312J)— finalization and integrated tests across write/read/redaction paths.Notes and open questions
--audit-textonly and auto-generateaudit.timeandaudit.author(no--audit-timefor this slice).auditobject rather than append to history.Acceptance criteria (draft)
wl update --helplists--audit-textand shows short usage.wl update <id> --audit-text "..."writesauditon the item withtime= now (UTC ISO8601),author= actor display name,text= provided string.wl show <id>(human) andwl show <id> --jsoninclude theauditobject when present.Risks & assumptions
WL-0MMNCNT1M16ESD04for migration strategy and add a migration dry-run test.wl updatepermission checks cover audit writes; no additional permission model changes are required.Related work (automated report)
{time, author, text, status}andwl doctorupgrade behaviour — consult when adding migrations/tests.wl showshould include the audit object in human and JSON outputs; updatesrc/commands/show.tsaccordingly.