Module: AgentsSkillVault::Vault::ManifestOperations
- Included in:
- AgentsSkillVault::Vault
- Defined in:
- lib/agents_skill_vault/vault/manifest_operations.rb
Overview
Module for manifest operations in vault.
Instance Method Summary collapse
-
#export_manifest(export_path) ⇒ void
Exports manifest to a file for backup or sharing.
-
#import_manifest(import_path) ⇒ void
Imports and merges a manifest from another vault.
-
#redownload_all ⇒ void
Re-downloads all resources from scratch.
Instance Method Details
#export_manifest(export_path) ⇒ void
This method returns an undefined value.
Exports manifest to a file for backup or sharing.
16 17 18 |
# File 'lib/agents_skill_vault/vault/manifest_operations.rb', line 16 def export_manifest(export_path) FileUtils.cp(@manifest_path, export_path) end |
#import_manifest(import_path) ⇒ void
This method returns an undefined value.
Imports and merges a manifest from another vault.
Resources from imported manifest are merged with existing resources. If a label exists in both, imported resource overwrites existing one. Note: This only updates manifest; files are not downloaded automatically.
33 34 35 36 37 38 39 40 |
# File 'lib/agents_skill_vault/vault/manifest_operations.rb', line 33 def import_manifest(import_path) imported_data = JSON.parse(File.read(import_path), symbolize_names: true) current_data = manifest.load merged_resources = merge_resources(current_data[:resources] || [], imported_data[:resources] || []) manifest.save(version: Manifest::VERSION, resources: merged_resources) end |
#redownload_all ⇒ void
This method returns an undefined value.
Re-downloads all resources from scratch.
Deletes local files and performs a fresh clone/checkout for each resource. Useful for recovering from corruption or ensuring a clean state.
49 50 51 52 53 54 55 56 |
# File 'lib/agents_skill_vault/vault/manifest_operations.rb', line 49 def redownload_all list.each do |resource| FileUtils.rm_rf(resource.local_path) if resource.local_path download_resource(resource) updated_resource = Resource.from_h(resource.to_h.merge(synced_at: Time.now), storage_path: storage_path) manifest.update_resource(updated_resource) end end |