Command reference¶
pakad [--version] COMMAND [options]
Command |
What it does |
|---|---|
|
Compare two files and write reports. |
|
Validate a profile without reading any data. |
|
Write a synthetic example: a profile and two CSV files. |
|
Print a commented example profile. |
|
Print the JSON Schema for the JSON report, or with |
Run pakad COMMAND --help for the options of any command.
reconcile¶
pakad reconcile -p PROFILE -e EXPECTED -c COLLECTED -o OUT_DIR [options]
Option |
Meaning |
|---|---|
|
Profile TOML file. See the profile reference. |
|
The population that should exist. CSV or JSON. |
|
The export that was collected. CSV or JSON. |
|
Directory for the reports. Created if needed. |
|
Comma-separated list of |
|
Reference time for freshness checks, in ISO 8601 with a time zone, for example |
|
When to exit with code 1: |
|
Refuse input files larger than this many bytes. Default: 268435456 (256 MiB). |
|
Overwrite report files that already exist. Without it, pakad refuses. Even with it, pakad refuses to overwrite one of its own inputs (see below). |
File formats¶
pakad picks the format from the file extension: .csv, .tsv, and .txt are read as delimited text, and .json as JSON. Set format in the profile to override.
CSV: the first row is the header. Values are never converted, so
000123stays000123. A row with fewer fields than the header has the missing values recorded as absent, which differs from empty. A row with more fields than the header stops the run with an input error that names the line, because pakad cannot tell which value belongs to which column.JSON: an array of objects, or an object with a
valueorrecordsarray, which covers Microsoft Graph and many PowerShell exports. If such an object carries a non-empty@odata.nextLink, pakad reports anincomplete-exporterror, because the file is one page of a larger result. An@odata.countorcountthat differs from the number of records gives apossible-truncationwarning. Numbers keep the exact text from the file, so1.0stays1.0. Booleans becometrueorfalse,nullis absent, and nested arrays and objects become compact JSON text, up to 64 levels of arrays and objects inside one value. Repeated property names and unpaired surrogate escapes such as\ud800are input errors, because pakad will not alter an identifier to make it readable. The same holds for CSV: if the configuredencoding(for exampleutf-7orunicode_escape) decodes to an unpaired surrogate, the error names the file, line, and column.
Report files¶
pakad writes the reports you choose with --format, then pakad-manifest.json, into the output directory. Files are readable only by your user account on Linux and macOS. Without --force, pakad never replaces an existing file, even one created while it runs. With --force, it moves the old reports aside first and puts them back if anything fails, so the directory holds either the old set or the new set. Before it reads anything, pakad checks that none of the report or manifest names it is about to write is the profile, the expected input, or the collected input, whether by the same path, a symbolic link, or a hard link. If one is, it exits with an input error (3) and changes nothing, even with --force, because a source file must never be replaced by a generated report. An input that shares a name with a report you did not select with --format is not affected.
Each file is complete before it appears, on file systems with hard links. On file systems without them, such as FAT and exFAT on many USB drives, each file is visible while pakad writes it, and pakad removes it again if writing fails. In both cases the manifest is written last, so its presence means every other file is in place.
Run one pakad at a time per output directory. Two runs writing to the same directory at once can remove or restore each other’s files.
Only a crash or power loss while writing can leave a partial file or a mix of old and new files. The manifest lists the size and SHA-256 of every file from its run, so either case is detectable: see Reports and findings.
File |
Format |
|---|---|
|
Self-contained web page. Open it in any browser. |
|
Machine-readable report. See Reports and findings. |
|
One row per finding. |
|
Markdown report for pull requests and tickets. |
Exit codes¶
Code |
Meaning |
|---|---|
|
Success, and nothing reached the |
|
Findings reached the |
|
The command was used incorrectly, for example an unknown option. |
|
An input or output problem: a missing or malformed file, an invalid profile, or a report file that already exists. |
|
An internal error in pakad. This is a bug; please report it. The message shows only the error type and the first 200 characters of its text. |
Use in a pipeline¶
pakad needs no network access and no secrets, so it runs anywhere Python does.
GitHub Actions:
- name: Reconcile evidence
run: |
pipx install faithful-pakad==0.1.2
pakad reconcile -p evidence/profile.toml -e evidence/roster.csv \
-c evidence/export.csv -o reports --fail-on error
- name: Keep the reports
if: always()
uses: actions/upload-artifact@v4 # pin to a full commit SHA in real workflows
with:
name: pakad-reports
path: reports/
PowerShell:
pakad reconcile -p .\profile.toml -e .\roster.csv -c .\export.csv -o .\reports --fail-on error
if ($LASTEXITCODE -eq 1) { Write-Warning "pakad found errors; see .\reports\pakad-report.html" }
check-profile¶
pakad check-profile PROFILE
Validates the profile and exits with code 0, or prints what is wrong and exits with code 3. Unknown settings are errors, so a misspelled setting can never switch a check off silently.
example¶
pakad example DIRECTORY [--force]
Writes profile.toml, expected.csv, and collected.csv into the directory and prints the command that runs them. The data is synthetic and produces every kind of finding.