# `zig_dependency_update`

Proposes dependency edits in native `build.zig.zon` format. Struo selects the aliases, schedules one acquisition per selected URL, reads Zig's verified native hash and emits `proposed.zon` with `transaction.json`. Building this target does not modify source files or compile unrelated consumers.

## Attributes

| Attribute | Type | Default | Meaning |
| --- | --- | --- | --- |
| `manifest` | string | `build.zig.zon` | Package-relative manifest, supplied in `srcs` |
| `updates` | map | `{}` | Alias to native `url`, `hash`, `path` and `lazy` field patches |
| `remove` | string list | `[]` | Aliases to delete |
| `packages` | string list | `[]` | Aliases to refresh, including lazy dependencies |
| `zig` | string | `zig` on `PATH` | Native compiler for one-source acquisition and verification |

Without explicit edits or selections, the target refreshes all eager URL dependencies. Lazy dependencies stay untouched unless selected. Setting `path` removes the old URL and hash; setting `url` removes the old path. Omitted `lazy` flags keep their existing values. Supplying `hash` requires an exact match with Zig's receipt. New URL dependencies need a URL, but Struo obtains their hash.

A lazy-only field patch keeps the existing pin without acquiring the source. Use `packages` to request a refresh. URL fields must use a URI scheme; use `file:relative/archive.tar.gz` or `file:///absolute/archive.tar.gz` for a local archive, or `path` for a directory dependency. Raw drive paths such as `C:/archive.tar.gz` are not manifest URLs; use an explicit slash-separated `file:` URI. File URI paths are percent-decoded, so `%20` names a space. For Git URLs, Zig resolves the chosen reference for this one source and Struo records its immutable commit URL with the verified native tree hash.

```toml
[[target]]
name = "update_dependencies"
kind = "zig_dependency_update"
srcs = ["build.zig.zon"]

[target.attrs.updates.math]
url = "https://example.com/math-1.2.0.tar.gz"

[target.attrs.updates.local]
path = "../local"
```

Run `struo build update_dependencies` and inspect the proposal outputs. Struo preserves unrelated manifest text, comments and line endings. The transaction records the exact original bytes' SHA-256 and the proposed bytes' BLAKE3. Its semantic read set also records the native manifest and workspace, ancestor and package `struo.toml` contents or absences. A separate source-publication operation must recheck these inputs before applying a proposal. Builds and cache restoration do not apply proposals; transaction read-set integration remains under verification.

Workspace-local archives are copied to declared outputs before acquisition. The transaction binds each original archive path to the exact snapshot consumed by Zig, so a source change during acquisition cannot be mistaken for the bytes that produced the proposed hash. Remote and outside-workspace sources have no workspace read precondition: the native pin authenticates the selected bytes, not the origin's future contents or availability.

Archive update URLs cannot contain decoded `..` components or backslashes. Use an unambiguous slash-separated relative or absolute file URL instead. Collapsing a parent component across a symbolic link, or treating a literal backslash as a directory separator, can select different archive bytes. The transaction format does not yet bind that traversal. This restriction applies to update acquisition, not ordinary path dependency declarations.

Unpinned URL probes bypass action caching and clear their private native caches on each execution. Rebuilding an update target can therefore observe a changed source at the same URL. This requires network access when the URL is remote; managed offline update replay is not available.

## Provider

`artifact`, rooted at the target's output directory. The default output is `transaction.json`; the proposed native manifest is `proposed.zon` in the same directory.
