MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / entry_subject

Function entry_subject

atomic-repository/src/repository/vault_triples.rs:748–797  ·  view source on GitHub ↗

Derive a subject URI from a vault path and entry type.

(path: &str, entry_type: VaultEntryType)

Source from the content-addressed store, hash-verified

746
747/// Derive a subject URI from a vault path and entry type.
748pub(super) fn entry_subject(path: &str, entry_type: VaultEntryType) -> String {
749 match entry_type {
750 VaultEntryType::Session => {
751 // goals/swift-meadow-a3f2/_goal.md -> goal:swift-meadow-a3f2
752 let name = path
753 .strip_prefix("goals/")
754 .and_then(|s| s.strip_suffix("/_goal.md"))
755 .unwrap_or(path);
756 format!("goal:{}", name)
757 }
758 VaultEntryType::Intent => {
759 // intents/pimo-1/intent.md -> intent:PIMO-1
760 let id = path
761 .strip_prefix("intents/")
762 .and_then(|s| s.strip_suffix("/intent.md"))
763 .unwrap_or(path)
764 .to_uppercase();
765 format!("intent:{}", id)
766 }
767 VaultEntryType::Memory => {
768 // memory/architecture.md -> memory:architecture
769 let name = path
770 .strip_prefix("memory/")
771 .and_then(|s| s.strip_suffix(".md"))
772 .unwrap_or(path);
773 format!("memory:{}", name)
774 }
775 VaultEntryType::Skill => {
776 let name = path
777 .strip_prefix("skills/")
778 .and_then(|s| s.strip_suffix(".md"))
779 .unwrap_or(path);
780 format!("skill:{}", name)
781 }
782 VaultEntryType::ToolResult => {
783 format!("tool:{}", path.replace('/', ":"))
784 }
785 VaultEntryType::Scratch => {
786 format!("scratch:{}", path.replace('/', ":"))
787 }
788 VaultEntryType::Attestation => {
789 // attestations/<sanitized-intent-id>/attested.md -> attestation:<sanitized-intent-id>
790 let name = path
791 .strip_prefix("attestations/")
792 .and_then(|s| s.strip_suffix("/attested.md"))
793 .unwrap_or(path);
794 format!("attestation:{}", name)
795 }
796 }
797}
798
799/// Convert a vault path to a subject URI (simplified).
800fn path_to_subject(path: &str) -> String {

Callers 7

vault_storeMethod · 0.85
vault_store_entryMethod · 0.85
vault_deleteMethod · 0.85
vault_extract_kgMethod · 0.85
path_to_subjectFunction · 0.85
rdf_target_to_kg_idFunction · 0.85

Calls

no outgoing calls