Skip to main content

Module bundle_export

Module bundle_export 

Source
Expand description

Armory Bundle Format (ABF) exporter — Phase 1 of docs/specs/REPORT_ARMORY_BUNDLE_STANDARD_RESEARCH_2026_07_16.md / https://docs.agentmux.ai/abf/. Serializes a db_bundles row (the Bundle struct — table/UI say “Bundles”, the type name predates the rename) plus its referenced skills into the ABF on-disk layout:

<bundle-slug>/
├── bundle.json
├── instructions/
│   ├── AGENTS.md
│   └── context/…
└── skills/
    └── <skill-slug>/
        └── SKILL.md

Pure functions only — no I/O, no Store access. Callers (the bundle.export RPC handler) own fetching the Bundle row and resolving its skills id-array into Skill rows before calling export_bundle.

No mcp/ or accounts/. A bundle carries no MCP servers; they belong to Connectors (SPEC_BUNDLE_CONTENTS_MEMORY_NOT_MCP_2026_10_07.md §3.1). accounts/requirements.json was inferred from those servers’ env keys, so it went with them, as did the redaction of secrets out of their configs. An importer still reads both from older archives.

Structs§

BundleExport
Result of exporting one bundle: every file to write, plus bookkeeping about anything that couldn’t be represented in ABF and was left out (surfaced to the caller/UI rather than silently dropped).
BundleExportFile
One file within an exported bundle, path relative to the bundle root (e.g. "bundle.json", "instructions/AGENTS.md").
ContextFileEntry 🔒

Functions§

export_bundle
Export a bundle + its already-resolved components into the ABF layout.
parse_json_field_or_warn 🔒
Parse a db_bundles JSON column (context_files, instructions_by_provider), treating a blank/whitespace-only value as “genuinely no data” (not an error) but pushing a warning to warnings for anything non-blank that fails to parse, rather than silently discarding it via unwrap_or_default() — an export that quietly loses data defeats its own backup/portability purpose (#2333).
sanitize_context_relative_path 🔒
Validate a relative path is safe to place under a bundle export/import root: non-empty, not absolute, no drive letter, no .. traversal component. Pure string validation (no filesystem access) so export_bundle can stay a pure function. Returns None for anything that fails; callers skip that entry.
zip_bundle_export
Pack an export’s files into a zip archive in memory. First ZipWriter usage in this workspace — tool_store.rs only ever reads zips. No filesystem access: writes into an in-memory buffer, so this stays as side-effect-free as the exporter itself (the RPC handler decides what to do with the resulting bytes).