-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration Caching
Two things in a PowerAutoDocs run are expensive: calling an AI provider, and launching a browser to render Mermaid diagrams into PNGs. Both are cached, in one folder.
cache:
dir: .powerautodocs-cache # default| Default | .powerautodocs-cache |
| Resolved relative to | the config file's directory — not your working directory |
| Contains |
.powerautodocs-ai-cache.json and diagrams/
|
Resolving against the config directory means both caches land in the same place regardless of where the command happens to run from. With the recommended layout, that's PowerAutoDocs/.powerautodocs-cache/.
| AI summary cache | Diagram cache | |
|---|---|---|
| Location | <cache.dir>/.powerautodocs-ai-cache.json |
<cache.dir>/diagrams/ |
| Keyed on | a hash of the component's meaningful content | a hash of the Mermaid source text |
| Invalidated by | the component changing, or a prompt-version bump shipped in a new release | the diagram's source changing |
| Force refresh | --regenerate-ai |
delete <cache.dir>/diagrams/
|
Both key on content, never on file timestamps or names. Renaming a file changes nothing; changing a flow's actions invalidates just that flow.
Orphaned AI entries (renamed or deleted components) are pruned automatically each run — but only within the component types enabled that run, so toggling a component off doesn't wipe its cached summaries.
A corrupt or unreadable cache file logs a warning and starts empty. It never fails a run.
This is the part that matters for cost. ADO pipeline agents are fresh VMs — nothing on disk survives between runs. Without intervention the cache starts empty every single execution, and every run pays full AI cost and re-renders every diagram, no matter how little changed.
The sample pipeline solves this by committing the cache folder back to the branch after each run (step 4):
git add -f PowerAutoDocs/.powerautodocs-cache/
git commit -m "chore: update powerautodocs cache [skip ci]"
git push origin HEAD:$(Build.SourceBranchName)This requires:
-
persistCredentials: trueon the checkout step (step 0 in the sample) - The ADO Build Service account having Contribute on the repo
Without the permission, the push fails with a permissions error. The documentation itself still generates fine — you just silently lose caching, and cost.
- AI summaries land in pull requests. That's a feature: AI-written text gets reviewed before it's published, and summaries don't change unexpectedly between runs.
-
Diagram PNGs are binary. Every run that changes a diagram adds a binary diff to the client repo's history. The two caches share one folder deliberately (one thing to commit, not two), so it's all-or-nothing: keep the commit-back step, or drop the
git add -fline and accept no cross-run caching at all.
The cache folder holds real solution component names, AI-written summaries and rendered ER diagrams. It belongs in the client's repo. Treat it as client data.
The diagram cache is keyed only on the Mermaid source text. Changes to render settings — resolution, background, viewport — invalidate nothing, because the source text didn't change. If a rendering change appears to have done nothing, delete <cache.dir>/diagrams/ and re-run.