Commit cb5a9e4
committed
feat(audit): structured JSONL audit log for mutating verbs (Phase G)
Every mutating action now appends a JSONL record to
`<content_dir>.parent/audit.log` (defaults to
`~/.config/claude-config/audit.log`). Each line is a self-contained
JSON object with `ts` (RFC3339 UTC), `event`, `content_dir`,
`target`, and per-event fields.
Events emitted:
- `install`: {links_created, dir_links_created, already_correct,
real_files_backed_up, global_writes}
- `uninstall`: {removed, backups_restored}
- `track`: {path, kind}
- `decisions_apply`: {pack, force, written, overwritten, skipped}
Dry-run calls do NOT write to the audit log (the log is for actual
mutations only). The writer is best-effort: OSError on the log path
never blocks the operation that triggered it.
`ClaudeConfig.audit_log_path` is a public property so users can
script over it (jq, grep, log-shipping).
Four tests:
- install writes one event
- install --dry-run writes nothing
- decisions_apply writes an event with pack name
- audit_log_path lives next to content_dir
Full suite: 252 passing. Closes SPEC §4 Phase G.1 parent 97761cb commit cb5a9e4
2 files changed
Lines changed: 109 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1119 | 1119 | | |
1120 | 1120 | | |
1121 | 1121 | | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
1122 | 1161 | | |
1123 | 1162 | | |
1124 | 1163 | | |
| |||
1543 | 1582 | | |
1544 | 1583 | | |
1545 | 1584 | | |
1546 | | - | |
| 1585 | + | |
1547 | 1586 | | |
1548 | 1587 | | |
1549 | 1588 | | |
| |||
1553 | 1592 | | |
1554 | 1593 | | |
1555 | 1594 | | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
1556 | 1605 | | |
1557 | 1606 | | |
1558 | 1607 | | |
| |||
1841 | 1890 | | |
1842 | 1891 | | |
1843 | 1892 | | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
1844 | 1898 | | |
1845 | 1899 | | |
1846 | 1900 | | |
| |||
1889 | 1943 | | |
1890 | 1944 | | |
1891 | 1945 | | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
1892 | 1951 | | |
1893 | 1952 | | |
1894 | 1953 | | |
| |||
2859 | 2918 | | |
2860 | 2919 | | |
2861 | 2920 | | |
2862 | | - | |
| 2921 | + | |
2863 | 2922 | | |
2864 | 2923 | | |
2865 | 2924 | | |
2866 | 2925 | | |
2867 | 2926 | | |
2868 | 2927 | | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
2869 | 2938 | | |
2870 | 2939 | | |
2871 | 2940 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
934 | 934 | | |
935 | 935 | | |
936 | 936 | | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
937 | 975 | | |
938 | 976 | | |
939 | 977 | | |
| |||
0 commit comments