diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bade38..93b8555 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -286,12 +286,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.1.0] - 2025-01-25 -Initial release implementing Codex Document Format Specification v0.1. +Initial release implementing CDX Document Format Specification v0.1. ### Added #### Core Infrastructure -- `Document` type with high-level API for working with Codex documents +- `Document` type with high-level API for working with CDX documents - `DocumentBuilder` for fluent document creation - `DocumentState` enum with state machine (Draft, Review, Frozen, Published) - `DocumentId` for content-addressable document identification @@ -326,7 +326,7 @@ Initial release implementing Codex Document Format Specification v0.1. - `Signer` and `Verifier` traits for extensibility - `EcdsaSigner` and `EcdsaVerifier` implementations - `SignerInfo` with name, email, organization, certificate support -- Signature file structure per Codex security extension +- Signature file structure per CDX security extension #### Asset Management - `ImageAsset` with format support (AVIF, WebP, PNG, JPEG, SVG) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e00a113..9f9dacd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -135,14 +135,14 @@ src/ ## Adding New Features 1. **Discuss first**: Open an issue to discuss significant changes -2. **Spec compliance**: Ensure changes align with the Codex specification +2. **Spec compliance**: Ensure changes align with the CDX specification 3. **Backward compatibility**: Avoid breaking changes unless necessary 4. **Testing**: Add tests for new functionality 5. **Documentation**: Update rustdoc and README as needed ## Specification Reference -This library implements the [Codex Document Format Specification](https://github.com/Entrolution/codex-file-format-spec). When implementing new features: +This library implements the [CDX Document Format Specification](https://github.com/Entrolution/codex-file-format-spec). When implementing new features: - Reference the relevant spec section - Note any deviations or extensions diff --git a/LICENSE-APACHE b/LICENSE-APACHE index a53cea9..0483f1c 100644 --- a/LICENSE-APACHE +++ b/LICENSE-APACHE @@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work. same "printed page" as the copyright notice for easier identification within third-party archives. -Copyright 2025 Codex Document Format Contributors +Copyright 2025 CDX Document Format Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/LICENSE-MIT b/LICENSE-MIT index 122d7f4..f3ef7fb 100644 --- a/LICENSE-MIT +++ b/LICENSE-MIT @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 Codex Document Format Contributors +Copyright (c) 2025 CDX Document Format Contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 431e381..5979b4a 100644 --- a/README.md +++ b/README.md @@ -7,18 +7,18 @@ # cdx-core -Core Rust library for reading, writing, and validating [Codex Document Format](https://github.com/Entrolution/codex-file-format-spec) (`.cdx`) files. +Core Rust library for reading, writing, and validating [CDX Document Format](https://github.com/Entrolution/codex-file-format-spec) (`.cdx`) files. ## Overview -Codex is an open document format designed for: +CDX is an open document format designed for: - **Semantic content** - Structured content blocks, not just rendered output - **Verifiable integrity** - Content-addressable hashing and digital signatures - **Machine readability** - JSON-based format with well-defined schemas - **Modern security** - Built-in support for signatures and encryption -This library provides the foundational capabilities for working with Codex documents in Rust, with support for WASM compilation. +This library provides the foundational capabilities for working with CDX documents in Rust, with support for WASM compilation. ## Features @@ -79,9 +79,9 @@ fn main() -> Result<()> { .title("My Document") .creator("Jane Doe") .add_heading(1, "Introduction") - .add_paragraph("This is my first Codex document.") + .add_paragraph("This is my first CDX document.") .add_heading(2, "Features") - .add_paragraph("Codex provides semantic structure and verifiable integrity.") + .add_paragraph("CDX provides semantic structure and verifiable integrity.") .build()?; // Compute the document ID @@ -161,7 +161,7 @@ cargo run --example open_and_verify path/to/document.cdx ## Specification Compliance -This library implements the [Codex Document Format Specification v0.1](https://github.com/Entrolution/codex-file-format-spec). +This library implements the [CDX Document Format Specification v0.1](https://github.com/Entrolution/codex-file-format-spec). ### Module Status diff --git a/cdx-cli/Cargo.toml b/cdx-cli/Cargo.toml index dc505cb..8cd3c18 100644 --- a/cdx-cli/Cargo.toml +++ b/cdx-cli/Cargo.toml @@ -5,9 +5,9 @@ edition.workspace = true rust-version.workspace = true license.workspace = true repository.workspace = true -description = "Command-line interface for working with Codex Document Format (.cdx) files" +description = "Command-line interface for working with CDX Document Format (.cdx) files" readme = "README.md" -keywords = ["codex", "document", "cli", "format"] +keywords = ["cdx", "document", "cli", "format"] categories = ["command-line-utilities"] documentation = "https://docs.rs/cdx-cli" diff --git a/cdx-cli/README.md b/cdx-cli/README.md index f015c72..19666b8 100644 --- a/cdx-cli/README.md +++ b/cdx-cli/README.md @@ -1,6 +1,6 @@ # cdx-cli -Command-line interface for working with Codex Document Format (.cdx) files. +Command-line interface for working with CDX Document Format (.cdx) files. ## Installation @@ -20,7 +20,7 @@ cargo build -p cdx-cli --release cdx [options] Commands: - create Create a new Codex document + create Create a new CDX document validate Validate document structure and hashes inspect Display document information status Show comprehensive document status @@ -38,7 +38,7 @@ Commands: get-metadata Display document metadata set-metadata Set document metadata fields pack Pack a directory or JSON into a .cdx archive - diff Compare two Codex documents + diff Compare two CDX documents show-timestamps Show timestamps in a document verify-timestamps Verify timestamps in a document add-timestamp Add a timestamp record to a document diff --git a/cdx-cli/src/cli.rs b/cdx-cli/src/cli.rs index 28b1a68..4540926 100644 --- a/cdx-cli/src/cli.rs +++ b/cdx-cli/src/cli.rs @@ -6,7 +6,7 @@ use std::path::PathBuf; #[derive(Parser)] #[command(name = "cdx")] -#[command(author, version, about = "Codex Document Format CLI", long_about = None)] +#[command(author, version, about = "CDX Document Format CLI", long_about = None)] #[command(propagate_version = true)] pub struct Cli { #[command(subcommand)] @@ -38,7 +38,7 @@ pub enum ColorChoice { #[derive(Subcommand)] pub enum Commands { - /// Create a new Codex document + /// Create a new CDX document Create { /// Document title (required) #[arg(short, long)] @@ -62,13 +62,13 @@ pub enum Commands { /// Validate document structure and hashes Validate { - /// Codex document to validate + /// CDX document to validate file: PathBuf, }, /// Display document information Inspect { - /// Codex document to inspect + /// CDX document to inspect file: PathBuf, /// Show detailed block information @@ -86,13 +86,13 @@ pub enum Commands { /// Show comprehensive document status Status { - /// Codex document to check + /// CDX document to check file: PathBuf, }, /// Add a digital signature Sign { - /// Codex document to sign + /// CDX document to sign file: PathBuf, /// Private key file (PEM format) @@ -118,7 +118,7 @@ pub enum Commands { /// Verify signatures and integrity Verify { - /// Codex document to verify + /// CDX document to verify file: PathBuf, /// Public key file(s) for signature verification @@ -128,7 +128,7 @@ pub enum Commands { /// Extract content or assets Extract { - /// Codex document to extract from + /// CDX document to extract from file: PathBuf, /// Output directory for extraction @@ -161,7 +161,7 @@ pub enum Commands { /// Submit document for review (draft → review) #[command(name = "submit-review")] SubmitReview { - /// Codex document to submit + /// CDX document to submit file: PathBuf, /// Output file (default: overwrite input) @@ -171,7 +171,7 @@ pub enum Commands { /// Freeze document (review → frozen) Freeze { - /// Codex document to freeze + /// CDX document to freeze file: PathBuf, /// Output file (default: overwrite input) @@ -181,7 +181,7 @@ pub enum Commands { /// Publish document (frozen → published) Publish { - /// Codex document to publish + /// CDX document to publish file: PathBuf, /// Output file (default: overwrite input) @@ -191,7 +191,7 @@ pub enum Commands { /// Revert document to draft (review → draft) Revert { - /// Codex document to revert + /// CDX document to revert file: PathBuf, /// Output file (default: overwrite input) @@ -201,7 +201,7 @@ pub enum Commands { /// Fork document to create new version with lineage Fork { - /// Codex document to fork + /// CDX document to fork file: PathBuf, /// Output file for the forked document @@ -215,7 +215,7 @@ pub enum Commands { /// Generate a Merkle proof for a block Prove { - /// Codex document + /// CDX document file: PathBuf, /// Block ID to prove @@ -234,7 +234,7 @@ pub enum Commands { /// Verify a Merkle proof against a document #[command(name = "verify-proof")] VerifyProof { - /// Codex document + /// CDX document file: PathBuf, /// Proof JSON file @@ -244,21 +244,21 @@ pub enum Commands { /// Show document lineage (ancestor chain) #[command(name = "show-lineage")] ShowLineage { - /// Codex document + /// CDX document file: PathBuf, }, /// Display document metadata #[command(name = "get-metadata")] GetMetadata { - /// Codex document + /// CDX document file: PathBuf, }, /// Set document metadata fields #[command(name = "set-metadata")] SetMetadata { - /// Codex document + /// CDX document file: PathBuf, /// Set title @@ -308,7 +308,7 @@ pub enum Commands { from_json: bool, }, - /// Compare two Codex documents + /// Compare two CDX documents Diff { /// First document file1: PathBuf, @@ -320,21 +320,21 @@ pub enum Commands { /// Show timestamps in a document #[command(name = "show-timestamps")] ShowTimestamps { - /// Codex document + /// CDX document file: PathBuf, }, /// Verify timestamps in a document #[command(name = "verify-timestamps")] VerifyTimestamps { - /// Codex document + /// CDX document file: PathBuf, }, /// Add a timestamp record to a document #[command(name = "add-timestamp")] AddTimestamp { - /// Codex document + /// CDX document file: PathBuf, /// Timestamp method (rfc3161, bitcoin, ethereum, opentimestamps) @@ -365,7 +365,7 @@ pub enum Commands { /// Acquire a timestamp from a timestamp authority #[command(name = "timestamp-acquire")] TimestampAcquire { - /// Codex document to timestamp + /// CDX document to timestamp file: PathBuf, /// Timestamp method (rfc3161, ots, auto) @@ -383,7 +383,7 @@ pub enum Commands { /// Encrypt a document with password-based encryption Encrypt { - /// Codex document to encrypt + /// CDX document to encrypt file: PathBuf, /// Password (will prompt if not provided) @@ -397,7 +397,7 @@ pub enum Commands { /// Decrypt a password-encrypted document Decrypt { - /// Codex document to decrypt + /// CDX document to decrypt file: PathBuf, /// Password (will prompt if not provided) diff --git a/cdx-cli/src/commands/decrypt.rs b/cdx-cli/src/commands/decrypt.rs index 67a6878..fee4e01 100644 --- a/cdx-cli/src/commands/decrypt.rs +++ b/cdx-cli/src/commands/decrypt.rs @@ -1,6 +1,6 @@ //! Decrypt command implementation. //! -//! Decrypts a Codex document that was encrypted with password-based encryption. +//! Decrypts a CDX document that was encrypted with password-based encryption. #[cfg(feature = "encryption")] use anyhow::Context; diff --git a/cdx-cli/src/commands/diff.rs b/cdx-cli/src/commands/diff.rs index 7a7ba4a..2fd0d51 100644 --- a/cdx-cli/src/commands/diff.rs +++ b/cdx-cli/src/commands/diff.rs @@ -7,7 +7,7 @@ use std::path::Path; use crate::output::OutputConfig; -/// Compare two Codex documents. +/// Compare two CDX documents. pub fn run(file1: &Path, file2: &Path, config: &OutputConfig) -> Result<()> { config.verbose(&format!( "Comparing: {} vs {}", diff --git a/cdx-cli/src/commands/encrypt.rs b/cdx-cli/src/commands/encrypt.rs index 41c0420..13c6aab 100644 --- a/cdx-cli/src/commands/encrypt.rs +++ b/cdx-cli/src/commands/encrypt.rs @@ -1,6 +1,6 @@ //! Encrypt command implementation. //! -//! Encrypts a Codex document using AES-256-GCM with password-based key derivation. +//! Encrypts a CDX document using AES-256-GCM with password-based key derivation. #[cfg(feature = "encryption")] use anyhow::Context; diff --git a/cdx-cli/src/commands/extract.rs b/cdx-cli/src/commands/extract.rs index 0a85090..f53f0c4 100644 --- a/cdx-cli/src/commands/extract.rs +++ b/cdx-cli/src/commands/extract.rs @@ -105,7 +105,7 @@ pub fn run( Ok(()) } -/// Extract assets from a Codex document. +/// Extract assets from a CDX document. fn extract_assets( file: &Path, output_dir: &Path, diff --git a/cdx-cli/src/commands/inspect.rs b/cdx-cli/src/commands/inspect.rs index 87d23b7..168c2ef 100644 --- a/cdx-cli/src/commands/inspect.rs +++ b/cdx-cli/src/commands/inspect.rs @@ -48,7 +48,7 @@ fn display_json( let mut result = serde_json::json!({ "file": file.display().to_string(), "document_id": doc.id().to_string(), - "spec_version": manifest.codex, + "spec_version": manifest.cdx, "state": doc.state().to_string(), "metadata": { "title": dublin_core.title(), @@ -96,12 +96,12 @@ fn display_text( let content = doc.content(); let dublin_core = doc.dublin_core(); - println!("\n{}", "Codex Document".blue().bold()); + println!("\n{}", "CDX Document".blue().bold()); println!("{}", "═".repeat(60).blue()); config.field("File", &file.display().to_string()); config.field("Document ID", &doc.id().to_string()); - config.field("Spec Version", &manifest.codex); + config.field("Spec Version", &manifest.cdx); config.field("State", &doc.state().to_string()); config.section("Metadata"); diff --git a/cdx-cli/src/commands/metadata.rs b/cdx-cli/src/commands/metadata.rs index aa33698..cb101ab 100644 --- a/cdx-cli/src/commands/metadata.rs +++ b/cdx-cli/src/commands/metadata.rs @@ -38,7 +38,7 @@ pub fn run_get_metadata(file: &Path, config: &OutputConfig) -> Result<()> { }, "manifest": { "id": doc.id().to_string(), - "spec_version": manifest.codex, + "spec_version": manifest.cdx, "state": doc.state().to_string(), "hash_algorithm": format!("{:?}", manifest.hash_algorithm), "created": manifest.created.to_rfc3339(), @@ -118,7 +118,7 @@ pub fn run_get_metadata(file: &Path, config: &OutputConfig) -> Result<()> { // Manifest info config.section("Document Info"); config.field("Document ID", &doc.id().to_string()); - config.field("Spec Version", &manifest.codex); + config.field("Spec Version", &manifest.cdx); config.field("State", &doc.state().to_string()); config.field("Hash Algorithm", &format!("{:?}", manifest.hash_algorithm)); config.field("Created", &manifest.created.to_rfc3339()); diff --git a/cdx-cli/src/commands/status.rs b/cdx-cli/src/commands/status.rs index 28bf2a1..3804cdd 100644 --- a/cdx-cli/src/commands/status.rs +++ b/cdx-cli/src/commands/status.rs @@ -42,7 +42,7 @@ fn display_json_status(doc: &Document, file: &Path) -> Result<()> { "id": doc.id().to_string(), "state": doc.state().to_string(), "title": dc.title(), - "spec_version": manifest.codex, + "spec_version": manifest.cdx, }, "integrity": { "valid": integrity_ok, diff --git a/cdx-cli/src/commands/timestamp.rs b/cdx-cli/src/commands/timestamp.rs index e471831..b7be6df 100644 --- a/cdx-cli/src/commands/timestamp.rs +++ b/cdx-cli/src/commands/timestamp.rs @@ -1,6 +1,6 @@ //! Timestamp command implementations. //! -//! Commands for managing timestamp records in Codex documents. +//! Commands for managing timestamp records in CDX documents. use anyhow::{Context, Result}; use cdx_core::provenance::{TimestampMethod, TimestampRecord}; diff --git a/cdx-cli/src/main.rs b/cdx-cli/src/main.rs index bc049d9..97a377a 100644 --- a/cdx-cli/src/main.rs +++ b/cdx-cli/src/main.rs @@ -1,6 +1,6 @@ -//! Codex Document Format CLI +//! CDX Document Format CLI //! -//! A command-line tool for working with Codex Document Format (.cdx) files. +//! A command-line tool for working with CDX Document Format (.cdx) files. #![warn(clippy::pedantic)] #![allow(clippy::module_name_repetitions)] diff --git a/cdx-cli/tests/integration.rs b/cdx-cli/tests/integration.rs index 2d94532..a6c0501 100644 --- a/cdx-cli/tests/integration.rs +++ b/cdx-cli/tests/integration.rs @@ -647,7 +647,7 @@ fn test_help() { .arg("--help") .assert() .success() - .stdout(predicate::str::contains("Codex Document Format CLI")); + .stdout(predicate::str::contains("CDX Document Format CLI")); } #[test] @@ -662,7 +662,7 @@ fn test_create_help() { .arg("--help") .assert() .success() - .stdout(predicate::str::contains("Create a new Codex document")); + .stdout(predicate::str::contains("Create a new CDX document")); } // ============================================================================= diff --git a/cdx-core/Cargo.toml b/cdx-core/Cargo.toml index 2a4871b..3c1754a 100644 --- a/cdx-core/Cargo.toml +++ b/cdx-core/Cargo.toml @@ -5,10 +5,10 @@ edition.workspace = true rust-version.workspace = true license.workspace = true repository.workspace = true -description = "Core library for reading, writing, and validating Codex Document Format (.cdx) files" +description = "Core library for reading, writing, and validating CDX Document Format (.cdx) files" documentation = "https://docs.rs/cdx-core" readme = "../README.md" -keywords = ["codex", "document", "format", "semantic", "signatures"] +keywords = ["cdx", "document", "format", "semantic", "signatures"] categories = ["encoding", "parser-implementations", "data-structures"] [lib] diff --git a/cdx-core/examples/create_document.rs b/cdx-core/examples/create_document.rs index b309aa7..eafe90e 100644 --- a/cdx-core/examples/create_document.rs +++ b/cdx-core/examples/create_document.rs @@ -1,4 +1,4 @@ -//! Example: Create a Codex document from scratch. +//! Example: Create a CDX document from scratch. //! //! This example demonstrates how to use the DocumentBuilder API //! to create a new document with content, metadata, and save it. @@ -8,17 +8,17 @@ use cdx_core::{Document, Result}; fn main() -> Result<()> { // Create a new document using the builder API let document = Document::builder() - .title("My First Codex Document") + .title("My First CDX Document") .creator("Example Author") .add_heading(1, "Introduction") - .add_paragraph("This is an example Codex document created with cdx-core.") + .add_paragraph("This is an example CDX document created with cdx-core.") .add_heading(2, "Features") - .add_paragraph("Codex documents provide:") + .add_paragraph("CDX documents provide:") .add_paragraph("- Semantic content structure") .add_paragraph("- Verifiable integrity via content-addressable IDs") .add_paragraph("- Digital signatures for authenticity") .add_heading(2, "Conclusion") - .add_paragraph("The Codex format is designed for the future of digital documents.") + .add_paragraph("The CDX format is designed for the future of digital documents.") .build()?; // Get document information diff --git a/cdx-core/examples/extract_content.rs b/cdx-core/examples/extract_content.rs index 93def79..85dd865 100644 --- a/cdx-core/examples/extract_content.rs +++ b/cdx-core/examples/extract_content.rs @@ -1,4 +1,4 @@ -//! Example: Extract text content from a Codex document. +//! Example: Extract text content from a CDX document. //! //! This example demonstrates how to iterate over the content blocks //! in a document and extract text. diff --git a/cdx-core/examples/open_and_verify.rs b/cdx-core/examples/open_and_verify.rs index 7255a69..c467b4d 100644 --- a/cdx-core/examples/open_and_verify.rs +++ b/cdx-core/examples/open_and_verify.rs @@ -1,4 +1,4 @@ -//! Example: Open an existing Codex document and verify its integrity. +//! Example: Open an existing CDX document and verify its integrity. //! //! This example demonstrates how to open a .cdx file and perform //! integrity verification. diff --git a/cdx-core/examples/sign_document.rs b/cdx-core/examples/sign_document.rs index ebbd8b3..25203cb 100644 --- a/cdx-core/examples/sign_document.rs +++ b/cdx-core/examples/sign_document.rs @@ -1,4 +1,4 @@ -//! Example: Sign a Codex document with ECDSA (ES256). +//! Example: Sign a CDX document with ECDSA (ES256). //! //! This example demonstrates how to sign a document using //! the security module's ECDSA signer. diff --git a/cdx-core/src/archive/mod.rs b/cdx-core/src/archive/mod.rs index 5995517..d0e8aa2 100644 --- a/cdx-core/src/archive/mod.rs +++ b/cdx-core/src/archive/mod.rs @@ -1,6 +1,6 @@ -//! Archive reading and writing for Codex documents. +//! Archive reading and writing for CDX documents. //! -//! Codex documents are packaged as ZIP archives with the `.cdx` extension. +//! CDX documents are packaged as ZIP archives with the `.cdx` extension. //! This module provides [`CdxReader`] and [`CdxWriter`] for working with these archives. //! //! # Reading Documents @@ -65,12 +65,12 @@ pub const BIBLIOGRAPHY_PATH: &str = "semantic/bibliography.json"; /// Path to the JSON-LD metadata file within the archive. pub const JSONLD_PATH: &str = "metadata/jsonld.json"; -/// ZIP comment for Codex documents. -pub const ZIP_COMMENT: &str = "Codex Document Format v0.1"; +/// ZIP comment for CDX documents. +pub const ZIP_COMMENT: &str = "CDX Document Format v0.1"; /// Check whether an asset path contains only URL-safe characters. /// -/// Per the Codex spec, asset paths SHOULD use only URL-safe characters: +/// Per the CDX spec, asset paths SHOULD use only URL-safe characters: /// alphanumerics, `.`, `-`, `_`, and `/`. This function returns `true` if /// the path is compliant. /// diff --git a/cdx-core/src/archive/reader.rs b/cdx-core/src/archive/reader.rs index a8f4f39..79e9ed4 100644 --- a/cdx-core/src/archive/reader.rs +++ b/cdx-core/src/archive/reader.rs @@ -1,4 +1,4 @@ -//! Archive reader for Codex documents. +//! Archive reader for CDX documents. use std::fs::File; use std::io::{BufReader, Cursor, Read, Seek}; @@ -10,7 +10,7 @@ use crate::{Error, HashAlgorithm, Hasher, Manifest, Result}; use super::{validate_path, CONTENT_PATH, DUBLIN_CORE_PATH, MANIFEST_PATH, PHANTOMS_PATH}; -/// Reader for Codex document archives. +/// Reader for CDX document archives. /// /// `CdxReader` opens and validates `.cdx` files, providing access to their contents. /// The reader validates the archive structure on creation and provides lazy access @@ -36,7 +36,7 @@ pub struct CdxReader { } impl CdxReader> { - /// Open a Codex document from a file path. + /// Open a CDX document from a file path. /// /// # Errors /// @@ -61,7 +61,7 @@ impl CdxReader> { } impl CdxReader>> { - /// Open a Codex document from bytes in memory. + /// Open a CDX document from bytes in memory. /// /// # Errors /// @@ -396,7 +396,7 @@ mod tests { fn test_reader_from_bytes() { let data = create_test_archive(); let reader = CdxReader::from_bytes(data).unwrap(); - assert_eq!(reader.manifest().codex, "0.1"); + assert_eq!(reader.manifest().cdx, "0.1"); } #[test] @@ -498,7 +498,7 @@ mod tests { writer .start_file::<&str, ()>(MANIFEST_PATH, Default::default()) .unwrap(); - writer.write_all(br#"{"codex":"0.1"}"#).unwrap(); + writer.write_all(br#"{"cdx":"0.1"}"#).unwrap(); // Add Dublin Core but no content writer @@ -748,7 +748,7 @@ mod tests { // Now write manifest (not first) let manifest_json = r#"{ - "codex": "0.1", + "cdx": "0.1", "id": "pending", "state": "draft", "created": "2024-01-01T00:00:00Z", @@ -789,7 +789,7 @@ mod tests { // Manifest with UTF-8 BOM prefix let manifest_json = r#"{ - "codex": "0.1", + "cdx": "0.1", "id": "pending", "state": "draft", "created": "2024-01-01T00:00:00Z", @@ -824,7 +824,7 @@ mod tests { reader.is_ok(), "BOM-prefixed manifest should parse correctly" ); - assert_eq!(reader.unwrap().manifest().codex, "0.1"); + assert_eq!(reader.unwrap().manifest().cdx, "0.1"); } #[test] diff --git a/cdx-core/src/archive/writer.rs b/cdx-core/src/archive/writer.rs index b7705c9..64b3724 100644 --- a/cdx-core/src/archive/writer.rs +++ b/cdx-core/src/archive/writer.rs @@ -1,4 +1,4 @@ -//! Archive writer for Codex documents. +//! Archive writer for CDX documents. use std::fs::File; use std::io::{BufWriter, Cursor, Seek, Write}; @@ -35,7 +35,7 @@ impl CompressionMethod { } } -/// Writer for creating Codex document archives. +/// Writer for creating CDX document archives. /// /// `CdxWriter` creates properly formatted `.cdx` files, ensuring the manifest /// is written first and all required structure is maintained. @@ -60,7 +60,7 @@ pub struct CdxWriter { } impl CdxWriter> { - /// Create a new Codex document at the given file path. + /// Create a new CDX document at the given file path. /// /// # Errors /// @@ -81,7 +81,7 @@ impl CdxWriter> { } impl CdxWriter>> { - /// Create a new Codex document in memory. + /// Create a new CDX document in memory. /// /// # Panics /// @@ -115,7 +115,7 @@ impl CdxWriter { /// Write the manifest to the archive. /// /// This must be called before writing any other files, as the manifest - /// must be the first file in the archive per the Codex specification. + /// must be the first file in the archive per the CDX specification. /// /// # Errors /// diff --git a/cdx-core/src/asset/font.rs b/cdx-core/src/asset/font.rs index c495ac4..48a4740 100644 --- a/cdx-core/src/asset/font.rs +++ b/cdx-core/src/asset/font.rs @@ -108,7 +108,7 @@ pub enum FontStyle { Oblique, } -/// A font asset embedded in a Codex document. +/// A font asset embedded in a CDX document. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct FontAsset { diff --git a/cdx-core/src/asset/image.rs b/cdx-core/src/asset/image.rs index 5311580..6f728b9 100644 --- a/cdx-core/src/asset/image.rs +++ b/cdx-core/src/asset/image.rs @@ -134,7 +134,7 @@ impl ImageVariant { } } -/// An image asset embedded in a Codex document. +/// An image asset embedded in a CDX document. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct ImageAsset { diff --git a/cdx-core/src/asset/mod.rs b/cdx-core/src/asset/mod.rs index 83bd2e3..c3ddc82 100644 --- a/cdx-core/src/asset/mod.rs +++ b/cdx-core/src/asset/mod.rs @@ -1,7 +1,7 @@ //! Asset management for embedded images, fonts, and files. //! //! This module provides types and utilities for managing assets embedded -//! within Codex documents. +//! within CDX documents. //! //! # Asset Types //! diff --git a/cdx-core/src/content/block.rs b/cdx-core/src/content/block.rs index d00b02b..a954f76 100644 --- a/cdx-core/src/content/block.rs +++ b/cdx-core/src/content/block.rs @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize}; use super::Text; use crate::extensions::ExtensionBlock; -/// Root content structure for a Codex document. +/// Root content structure for a CDX document. /// /// The content file contains a version identifier and an array of blocks /// that make up the document content. diff --git a/cdx-core/src/content/mod.rs b/cdx-core/src/content/mod.rs index c8a5239..8bf5704 100644 --- a/cdx-core/src/content/mod.rs +++ b/cdx-core/src/content/mod.rs @@ -1,7 +1,7 @@ //! Content blocks and text representation. //! //! The content layer represents document content as a tree of semantic blocks. -//! This module provides types for all content blocks defined in the Codex specification. +//! This module provides types for all content blocks defined in the CDX specification. //! //! # Content Structure //! diff --git a/cdx-core/src/document/builder.rs b/cdx-core/src/document/builder.rs index 10b85e2..5d27705 100644 --- a/cdx-core/src/document/builder.rs +++ b/cdx-core/src/document/builder.rs @@ -5,7 +5,7 @@ use crate::{DocumentId, DocumentState, HashAlgorithm, Manifest, Result}; use super::Document; -/// Builder for creating Codex documents. +/// Builder for creating CDX documents. #[derive(Debug, Clone)] pub struct DocumentBuilder { title: String, diff --git a/cdx-core/src/document/io.rs b/cdx-core/src/document/io.rs index 328cfdb..ba83585 100644 --- a/cdx-core/src/document/io.rs +++ b/cdx-core/src/document/io.rs @@ -38,7 +38,7 @@ impl Document { /// # Errors /// /// Returns an error if: - /// - The source is not a valid Codex archive + /// - The source is not a valid CDX archive /// - Required files are missing or malformed pub fn open_from_reader(reader: R) -> Result { let mut cdx_reader = CdxReader::new(reader)?; @@ -49,7 +49,7 @@ impl Document { /// /// # Errors /// - /// Returns an error if the data is not a valid Codex document. + /// Returns an error if the data is not a valid CDX document. pub fn from_bytes(data: Vec) -> Result { let mut reader = CdxReader::from_bytes(data)?; Self::from_reader(&mut reader) diff --git a/cdx-core/src/document/mod.rs b/cdx-core/src/document/mod.rs index 850eac3..39ca096 100644 --- a/cdx-core/src/document/mod.rs +++ b/cdx-core/src/document/mod.rs @@ -1,7 +1,7 @@ //! High-level Document API. //! //! This module provides the main [`Document`] type and [`DocumentBuilder`] -//! for working with Codex documents. +//! for working with CDX documents. //! //! # Opening Documents //! @@ -134,9 +134,9 @@ impl MutableResource for Document { } } -/// A Codex document. +/// A CDX document. /// -/// `Document` provides a high-level interface for working with Codex documents, +/// `Document` provides a high-level interface for working with CDX documents, /// abstracting away the underlying archive structure. #[derive(Debug, Clone)] pub struct Document { diff --git a/cdx-core/src/document/tests.rs b/cdx-core/src/document/tests.rs index 13a568b..2c0d6ba 100644 --- a/cdx-core/src/document/tests.rs +++ b/cdx-core/src/document/tests.rs @@ -154,7 +154,7 @@ mod tests { // Declare the extension doc.manifest_mut() .extensions - .push(Extension::required("codex.semantic", "0.1")); + .push(Extension::required("cdx.semantic", "0.1")); let report = doc.validate_extensions(); assert!(report.is_valid()); @@ -220,7 +220,7 @@ mod tests { // Only declare semantic, not forms doc.manifest_mut() .extensions - .push(Extension::required("codex.semantic", "0.1")); + .push(Extension::required("cdx.semantic", "0.1")); let report = doc.validate_extensions(); assert!(!report.is_valid()); // forms not declared diff --git a/cdx-core/src/error.rs b/cdx-core/src/error.rs index b96069e..9d8b365 100644 --- a/cdx-core/src/error.rs +++ b/cdx-core/src/error.rs @@ -6,7 +6,7 @@ use thiserror::Error; /// Result type alias using [`enum@Error`]. pub type Result = std::result::Result; -/// Errors that can occur when working with Codex documents. +/// Errors that can occur when working with CDX documents. #[derive(Debug, Error)] pub enum Error { /// The file is not a valid ZIP archive. @@ -35,8 +35,8 @@ pub enum Error { reason: String, }, - /// The document's Codex version is not supported. - #[error("unsupported Codex version: {version}")] + /// The document's CDX version is not supported. + #[error("unsupported CDX version: {version}")] UnsupportedVersion { /// The unsupported version string. version: String, @@ -266,7 +266,7 @@ mod tests { let err = Error::UnsupportedVersion { version: "99.0".to_string(), }; - assert_eq!(err.to_string(), "unsupported Codex version: 99.0"); + assert_eq!(err.to_string(), "unsupported CDX version: 99.0"); } #[test] diff --git a/cdx-core/src/extensions/academic.rs b/cdx-core/src/extensions/academic.rs index 31ad571..6f69221 100644 --- a/cdx-core/src/extensions/academic.rs +++ b/cdx-core/src/extensions/academic.rs @@ -1,4 +1,4 @@ -//! Academic extension for Codex documents. +//! Academic extension for CDX documents. //! //! This extension provides specialized content types for academic and //! scientific documents including theorems, proofs, exercises, and algorithms. diff --git a/cdx-core/src/extensions/collaboration/change_tracking.rs b/cdx-core/src/extensions/collaboration/change_tracking.rs index c99988e..d8daa9f 100644 --- a/cdx-core/src/extensions/collaboration/change_tracking.rs +++ b/cdx-core/src/extensions/collaboration/change_tracking.rs @@ -1,4 +1,4 @@ -//! Change tracking for Codex documents. +//! Change tracking for CDX documents. use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; diff --git a/cdx-core/src/extensions/collaboration/comment.rs b/cdx-core/src/extensions/collaboration/comment.rs index 7b2df63..dfc37d7 100644 --- a/cdx-core/src/extensions/collaboration/comment.rs +++ b/cdx-core/src/extensions/collaboration/comment.rs @@ -1,4 +1,4 @@ -//! Comments and annotations for Codex documents. +//! Comments and annotations for CDX documents. use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; diff --git a/cdx-core/src/extensions/collaboration/mod.rs b/cdx-core/src/extensions/collaboration/mod.rs index 278388a..7ab146a 100644 --- a/cdx-core/src/extensions/collaboration/mod.rs +++ b/cdx-core/src/extensions/collaboration/mod.rs @@ -1,6 +1,6 @@ //! Collaboration extension for comments, annotations, and change tracking. //! -//! This extension provides collaborative editing features for Codex documents. +//! This extension provides collaborative editing features for CDX documents. //! //! # Features //! diff --git a/cdx-core/src/extensions/collaboration/session.rs b/cdx-core/src/extensions/collaboration/session.rs index 2776ce4..e2410f2 100644 --- a/cdx-core/src/extensions/collaboration/session.rs +++ b/cdx-core/src/extensions/collaboration/session.rs @@ -1,4 +1,4 @@ -//! Collaboration session management for Codex documents. +//! Collaboration session management for CDX documents. use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; diff --git a/cdx-core/src/extensions/collaboration/thread.rs b/cdx-core/src/extensions/collaboration/thread.rs index 84716a7..16a0c06 100644 --- a/cdx-core/src/extensions/collaboration/thread.rs +++ b/cdx-core/src/extensions/collaboration/thread.rs @@ -1,4 +1,4 @@ -//! Comment thread management for Codex documents. +//! Comment thread management for CDX documents. use serde::{Deserialize, Serialize}; diff --git a/cdx-core/src/extensions/forms.rs b/cdx-core/src/extensions/forms.rs index 8f876a6..b1d44a9 100644 --- a/cdx-core/src/extensions/forms.rs +++ b/cdx-core/src/extensions/forms.rs @@ -36,7 +36,7 @@ use serde_json::Value; use super::ExtensionBlock; -/// A form field that can appear in a Codex document. +/// A form field that can appear in a CDX document. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(tag = "fieldType", rename_all = "camelCase")] pub enum FormField { diff --git a/cdx-core/src/extensions/legal.rs b/cdx-core/src/extensions/legal.rs index 5b1d56f..b6e1d58 100644 --- a/cdx-core/src/extensions/legal.rs +++ b/cdx-core/src/extensions/legal.rs @@ -1,4 +1,4 @@ -//! Legal extension for Codex documents. +//! Legal extension for CDX documents. //! //! This extension provides specialized content types for legal documents //! including citations, tables of authorities, and court captions. diff --git a/cdx-core/src/extensions/mod.rs b/cdx-core/src/extensions/mod.rs index 7bd18e0..5eecb60 100644 --- a/cdx-core/src/extensions/mod.rs +++ b/cdx-core/src/extensions/mod.rs @@ -1,6 +1,6 @@ -//! Extension framework for Codex documents. +//! Extension framework for CDX documents. //! -//! Extensions allow Codex documents to include specialized content types +//! Extensions allow CDX documents to include specialized content types //! beyond the core block types. Each extension is namespaced (e.g., "forms", //! "semantic", "collaboration") and provides custom block types. //! diff --git a/cdx-core/src/hash.rs b/cdx-core/src/hash.rs index 50bbef5..da44e72 100644 --- a/cdx-core/src/hash.rs +++ b/cdx-core/src/hash.rs @@ -1,6 +1,6 @@ //! Document hashing and content-addressable identity. //! -//! Codex documents use content-addressable hashing as a core identity mechanism. +//! CDX documents use content-addressable hashing as a core identity mechanism. //! The document's hash serves as its canonical identifier. use serde::{Deserialize, Serialize}; diff --git a/cdx-core/src/lib.rs b/cdx-core/src/lib.rs index 4e8fdd7..2438525 100644 --- a/cdx-core/src/lib.rs +++ b/cdx-core/src/lib.rs @@ -1,12 +1,12 @@ //! # cdx-core //! -//! Core library for reading, writing, and validating Codex Document Format (`.cdx`) files. +//! Core library for reading, writing, and validating CDX Document Format (`.cdx`) files. //! //! ## Overview //! -//! Codex is an open document format designed for semantic content, verifiable integrity, +//! CDX is an open document format designed for semantic content, verifiable integrity, //! and machine readability. This library provides the foundational capabilities for working -//! with Codex documents in Rust. +//! with CDX documents in Rust. //! //! ## Quick Start //! @@ -60,14 +60,14 @@ pub use manifest::{ }; pub use state::DocumentState; -/// Codex specification version implemented by this library. +/// CDX specification version implemented by this library. pub const SPEC_VERSION: &str = "0.1"; -/// Default file extension for Codex documents. +/// Default file extension for CDX documents. pub const FILE_EXTENSION: &str = "cdx"; -/// MIME type for Codex documents (JSON format). -pub const MIME_TYPE: &str = "application/vnd.codex+json"; +/// MIME type for CDX documents (JSON format). +pub const MIME_TYPE: &str = "application/vnd.cdx+json"; #[cfg(test)] mod tests { @@ -77,6 +77,6 @@ mod tests { fn test_constants() { assert_eq!(SPEC_VERSION, "0.1"); assert_eq!(FILE_EXTENSION, "cdx"); - assert_eq!(MIME_TYPE, "application/vnd.codex+json"); + assert_eq!(MIME_TYPE, "application/vnd.cdx+json"); } } diff --git a/cdx-core/src/manifest.rs b/cdx-core/src/manifest.rs index 25b476d..9750572 100644 --- a/cdx-core/src/manifest.rs +++ b/cdx-core/src/manifest.rs @@ -1,6 +1,6 @@ //! Manifest structure and types. //! -//! The manifest (`manifest.json`) is the root metadata structure of a Codex document. +//! The manifest (`manifest.json`) is the root metadata structure of a CDX document. use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; @@ -11,7 +11,7 @@ use crate::{DocumentId, DocumentState, HashAlgorithm}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Manifest { /// Specification version (e.g., "0.1"). - pub codex: String, + pub cdx: String, /// Content-addressable document identifier. pub id: DocumentId, @@ -75,7 +75,7 @@ impl Manifest { pub fn new(content: ContentRef, metadata: Metadata) -> Self { let now = Utc::now(); Self { - codex: crate::SPEC_VERSION.to_string(), + cdx: crate::SPEC_VERSION.to_string(), id: DocumentId::pending(), state: DocumentState::Draft, created: now, @@ -94,15 +94,15 @@ impl Manifest { /// Check if an extension is declared in the manifest. /// - /// Extension IDs use dot notation like "codex.semantic" or "codex.legal". + /// Extension IDs use dot notation like "cdx.semantic" or "cdx.legal". /// This method checks if the given namespace (e.g., "semantic", "legal") /// matches any declared extension. #[must_use] pub fn has_extension(&self, namespace: &str) -> bool { - // Check for exact match or codex.{namespace} format + // Check for exact match or cdx.{namespace} format self.extensions.iter().any(|ext| { ext.id == namespace - || ext.id == format!("codex.{namespace}") + || ext.id == format!("cdx.{namespace}") || ext.id.ends_with(&format!(".{namespace}")) }) } @@ -114,7 +114,7 @@ impl Manifest { pub fn get_extension(&self, namespace: &str) -> Option<&Extension> { self.extensions.iter().find(|ext| { ext.id == namespace - || ext.id == format!("codex.{namespace}") + || ext.id == format!("cdx.{namespace}") || ext.id.ends_with(&format!(".{namespace}")) }) } @@ -130,13 +130,13 @@ impl Manifest { /// # Errors /// /// Returns an error if: - /// - The Codex version is unsupported + /// - The CDX version is unsupported /// - State requirements are not met (e.g., frozen documents without signatures) pub fn validate(&self) -> crate::Result<()> { // Check version - if !self.codex.starts_with("0.") { + if !self.cdx.starts_with("0.") { return Err(crate::Error::UnsupportedVersion { - version: self.codex.clone(), + version: self.cdx.clone(), }); } @@ -319,7 +319,7 @@ pub struct SecurityRef { /// Extension declaration. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct Extension { - /// Extension identifier (e.g., "codex.semantic", "codex.legal"). + /// Extension identifier (e.g., "cdx.semantic", "cdx.legal"). pub id: String, /// Extension version. @@ -357,7 +357,7 @@ impl Extension { /// Extract the namespace from the extension ID. /// - /// For "codex.semantic", returns "semantic". + /// For "cdx.semantic", returns "semantic". /// For "semantic", returns "semantic". #[must_use] pub fn namespace(&self) -> &str { @@ -494,7 +494,7 @@ mod tests { }; let manifest = Manifest::new(content, metadata); - assert_eq!(manifest.codex, "0.1"); + assert_eq!(manifest.cdx, "0.1"); assert_eq!(manifest.state, DocumentState::Draft); assert!(manifest.id.is_pending()); } @@ -533,7 +533,7 @@ mod tests { let manifest = Manifest::new(content, metadata); let json = serde_json::to_string_pretty(&manifest).unwrap(); - assert!(json.contains("\"codex\": \"0.1\"")); + assert!(json.contains("\"cdx\": \"0.1\"")); assert!(json.contains("\"state\": \"draft\"")); } @@ -694,28 +694,28 @@ mod tests { #[test] fn test_extension_new() { - let ext = Extension::new("codex.semantic", "0.1", true); - assert_eq!(ext.id, "codex.semantic"); + let ext = Extension::new("cdx.semantic", "0.1", true); + assert_eq!(ext.id, "cdx.semantic"); assert_eq!(ext.version, "0.1"); assert!(ext.required); } #[test] fn test_extension_required() { - let ext = Extension::required("codex.legal", "0.1"); + let ext = Extension::required("cdx.legal", "0.1"); assert!(ext.required); } #[test] fn test_extension_optional() { - let ext = Extension::optional("codex.forms", "0.1"); + let ext = Extension::optional("cdx.forms", "0.1"); assert!(!ext.required); } #[test] fn test_extension_namespace() { assert_eq!( - Extension::new("codex.semantic", "0.1", true).namespace(), + Extension::new("cdx.semantic", "0.1", true).namespace(), "semantic" ); assert_eq!( @@ -745,10 +745,10 @@ mod tests { let mut manifest = Manifest::new(content, metadata); manifest .extensions - .push(Extension::required("codex.semantic", "0.1")); + .push(Extension::required("cdx.semantic", "0.1")); manifest .extensions - .push(Extension::optional("codex.legal", "0.1")); + .push(Extension::optional("cdx.legal", "0.1")); // Check by namespace assert!(manifest.has_extension("semantic")); @@ -756,8 +756,8 @@ mod tests { assert!(!manifest.has_extension("forms")); // Check by full ID - assert!(manifest.has_extension("codex.semantic")); - assert!(manifest.has_extension("codex.legal")); + assert!(manifest.has_extension("cdx.semantic")); + assert!(manifest.has_extension("cdx.legal")); } #[test] @@ -777,11 +777,11 @@ mod tests { let mut manifest = Manifest::new(content, metadata); manifest .extensions - .push(Extension::required("codex.semantic", "0.1")); + .push(Extension::required("cdx.semantic", "0.1")); let ext = manifest.get_extension("semantic"); assert!(ext.is_some()); - assert_eq!(ext.unwrap().id, "codex.semantic"); + assert_eq!(ext.unwrap().id, "cdx.semantic"); assert!(ext.unwrap().required); assert!(manifest.get_extension("forms").is_none()); @@ -804,31 +804,31 @@ mod tests { let mut manifest = Manifest::new(content, metadata); manifest .extensions - .push(Extension::required("codex.semantic", "0.1")); + .push(Extension::required("cdx.semantic", "0.1")); manifest .extensions - .push(Extension::optional("codex.forms", "0.1")); + .push(Extension::optional("cdx.forms", "0.1")); let ids = manifest.declared_extension_ids(); assert_eq!(ids.len(), 2); - assert!(ids.contains(&"codex.semantic")); - assert!(ids.contains(&"codex.forms")); + assert!(ids.contains(&"cdx.semantic")); + assert!(ids.contains(&"cdx.forms")); } #[test] fn test_extension_serialization() { - let ext = Extension::required("codex.semantic", "0.1"); + let ext = Extension::required("cdx.semantic", "0.1"); let json = serde_json::to_string(&ext).unwrap(); - assert!(json.contains("\"id\":\"codex.semantic\"")); + assert!(json.contains("\"id\":\"cdx.semantic\"")); assert!(json.contains("\"version\":\"0.1\"")); assert!(json.contains("\"required\":true")); } #[test] fn test_extension_deserialization() { - let json = r#"{"id":"codex.legal","version":"0.1","required":false}"#; + let json = r#"{"id":"cdx.legal","version":"0.1","required":false}"#; let ext: Extension = serde_json::from_str(json).unwrap(); - assert_eq!(ext.id, "codex.legal"); + assert_eq!(ext.id, "cdx.legal"); assert_eq!(ext.version, "0.1"); assert!(!ext.required); } @@ -978,7 +978,7 @@ mod tests { fn test_manifest_backward_compat_no_phantoms() { // Deserializing a manifest without the phantoms field should default to None let json = r#"{ - "codex": "0.1", + "cdx": "0.1", "id": "pending", "state": "draft", "created": "2024-01-01T00:00:00Z", diff --git a/cdx-core/src/metadata/dublin_core.rs b/cdx-core/src/metadata/dublin_core.rs index ec2ef86..1bfdb6b 100644 --- a/cdx-core/src/metadata/dublin_core.rs +++ b/cdx-core/src/metadata/dublin_core.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; /// Dublin Core metadata file structure. /// -/// This represents the `metadata/dublin-core.json` file in a Codex document. +/// This represents the `metadata/dublin-core.json` file in a CDX document. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct DublinCore { /// Dublin Core version (e.g., "1.1"). @@ -380,7 +380,7 @@ mod tests { "contributor": "Finance Team", "date": "2025-01-15", "type": "Text", - "format": "application/vnd.codex+json", + "format": "application/vnd.cdx+json", "identifier": "sha256:3a7bd3e2", "language": "en", "coverage": "2024 fiscal year", diff --git a/cdx-core/src/metadata/mod.rs b/cdx-core/src/metadata/mod.rs index a15141a..eef4444 100644 --- a/cdx-core/src/metadata/mod.rs +++ b/cdx-core/src/metadata/mod.rs @@ -1,11 +1,11 @@ -//! Metadata types for Codex documents. +//! Metadata types for CDX documents. //! //! This module provides types for Dublin Core metadata and extended metadata -//! as defined in the Codex specification. +//! as defined in the CDX specification. //! //! # Dublin Core //! -//! Dublin Core is the required metadata standard for Codex documents: +//! Dublin Core is the required metadata standard for CDX documents: //! //! ```rust //! use cdx_core::metadata::DublinCore; diff --git a/cdx-core/src/presentation/mod.rs b/cdx-core/src/presentation/mod.rs index 98e5af2..d2c30d1 100644 --- a/cdx-core/src/presentation/mod.rs +++ b/cdx-core/src/presentation/mod.rs @@ -1,7 +1,7 @@ //! Presentation layer types. //! //! Presentation layers define how semantic content is rendered visually. -//! Codex supports three presentation types: +//! CDX supports three presentation types: //! //! - [`Paginated`] - Fixed pages for print/PDF //! - [`Continuous`] - Vertical scroll for screens diff --git a/cdx-core/src/security/access_control.rs b/cdx-core/src/security/access_control.rs index 9dc00e2..a588e10 100644 --- a/cdx-core/src/security/access_control.rs +++ b/cdx-core/src/security/access_control.rs @@ -1,4 +1,4 @@ -//! Access control and permissions for Codex documents. +//! Access control and permissions for CDX documents. //! //! This module provides a permission system for controlling access to document //! operations like viewing, printing, copying, editing, and annotating. @@ -101,7 +101,7 @@ impl Default for AccessControl { /// Permission settings. /// /// This struct uses boolean flags for each permission type as specified by the -/// Codex Document Format specification. Each flag represents an independent +/// CDX Document Format specification. Each flag represents an independent /// permission that can be granted or denied. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] diff --git a/cdx-core/src/security/encryption.rs b/cdx-core/src/security/encryption.rs index 093645e..0dced57 100644 --- a/cdx-core/src/security/encryption.rs +++ b/cdx-core/src/security/encryption.rs @@ -1,6 +1,6 @@ //! Encryption support using AES-256-GCM and ChaCha20-Poly1305. //! -//! This module provides encryption and decryption capabilities for Codex documents +//! This module provides encryption and decryption capabilities for CDX documents //! using authenticated encryption algorithms (AEAD). use serde::{Deserialize, Serialize}; @@ -1131,7 +1131,7 @@ mod key_wrapping_tests { // 1. Generate content encryption key and encrypt content let content_key = Aes256GcmEncryptor::generate_key(); let encryptor = Aes256GcmEncryptor::new(&content_key).unwrap(); - let plaintext = b"Codex document content for encryption"; + let plaintext = b"CDX document content for encryption"; let encrypted = encryptor.encrypt(plaintext).unwrap(); // 2. Wrap the content key for the recipient @@ -1282,7 +1282,7 @@ mod rsa_oaep_tests { // Encrypt content let content_key = Aes256GcmEncryptor::generate_key(); let encryptor = Aes256GcmEncryptor::new(&content_key).unwrap(); - let plaintext = b"Codex document encrypted with RSA-OAEP key wrapping"; + let plaintext = b"CDX document encrypted with RSA-OAEP key wrapping"; let encrypted = encryptor.encrypt(plaintext).unwrap(); // Wrap the content key @@ -1435,7 +1435,7 @@ mod pbes2_tests { // Encrypt content let content_key = Aes256GcmEncryptor::generate_key(); let encryptor = Aes256GcmEncryptor::new(&content_key).unwrap(); - let plaintext = b"Codex document with password-based key wrapping"; + let plaintext = b"CDX document with password-based key wrapping"; let encrypted = encryptor.encrypt(plaintext).unwrap(); // Wrap the content key with password diff --git a/cdx-core/src/security/mod.rs b/cdx-core/src/security/mod.rs index e65568e..3b98369 100644 --- a/cdx-core/src/security/mod.rs +++ b/cdx-core/src/security/mod.rs @@ -2,7 +2,7 @@ //! Digital signatures, encryption, and security features. //! -//! This module provides cryptographic capabilities for Codex documents: +//! This module provides cryptographic capabilities for CDX documents: //! //! - **Signatures**: ECDSA (ES256, ES384), EdDSA (Ed25519), RSA-PSS (PS256), ML-DSA-65 (post-quantum), and WebAuthn/FIDO2 digital signatures //! - **Encryption**: AES-256-GCM and ChaCha20-Poly1305 authenticated encryption diff --git a/cdx-core/src/security/signature.rs b/cdx-core/src/security/signature.rs index 3989266..baa9f15 100644 --- a/cdx-core/src/security/signature.rs +++ b/cdx-core/src/security/signature.rs @@ -9,7 +9,7 @@ use crate::DocumentId; /// Signature file structure. /// -/// This represents the `security/signatures.json` file in a Codex document. +/// This represents the `security/signatures.json` file in a CDX document. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SignatureFile { @@ -127,7 +127,7 @@ pub struct Signature { /// WebAuthn/FIDO2 signature data. /// /// Contains the assertion response from a WebAuthn authenticator. -/// All fields are base64-encoded as per the Codex specification. +/// All fields are base64-encoded as per the CDX specification. /// /// # Verification /// diff --git a/cdx-core/src/state.rs b/cdx-core/src/state.rs index e858d66..a2642bd 100644 --- a/cdx-core/src/state.rs +++ b/cdx-core/src/state.rs @@ -1,6 +1,6 @@ //! Document state machine. //! -//! Codex documents progress through a defined lifecycle: +//! CDX documents progress through a defined lifecycle: //! //! ```text //! draft → review → frozen → published diff --git a/cdx-core/src/validation/mod.rs b/cdx-core/src/validation/mod.rs index 0a733ed..5748d01 100644 --- a/cdx-core/src/validation/mod.rs +++ b/cdx-core/src/validation/mod.rs @@ -1,4 +1,4 @@ -//! JSON Schema validation for Codex Document Format files. +//! JSON Schema validation for CDX Document Format files. //! //! This module provides validation functions for the core CDX file types: //! - Manifest (`manifest.json`) diff --git a/cdx-core/tests/conformance.rs b/cdx-core/tests/conformance.rs index 8ec6f6f..6098992 100644 --- a/cdx-core/tests/conformance.rs +++ b/cdx-core/tests/conformance.rs @@ -1,6 +1,6 @@ //! Spec conformance tests. //! -//! These tests verify that cdx-core's behavior matches the Codex file format +//! These tests verify that cdx-core's behavior matches the CDX file format //! specification. This includes: //! //! - **Wire format**: JSON serialization matches spec examples @@ -1019,7 +1019,7 @@ fn test_manifest_id_pending_for_draft() { /// Per spec §02 §4.10 — Extension ID follows `namespace.name` format. #[test] fn test_extension_id_format() { - let ext = cdx_core::Extension::required("codex.semantic", "0.1"); + let ext = cdx_core::Extension::required("cdx.semantic", "0.1"); assert!( ext.id.contains('.'), "Extension ID should use dot notation: {}", @@ -1034,7 +1034,7 @@ fn test_extension_id_format() { /// Per spec §02 §4.10 — Extension has version field. #[test] fn test_extension_version_present() { - let ext = cdx_core::Extension::new("codex.semantic", "0.1", true); + let ext = cdx_core::Extension::new("cdx.semantic", "0.1", true); assert!(!ext.version.is_empty(), "Extension must have a version"); // Verify it serializes with the version field @@ -1533,7 +1533,7 @@ fn test_undeclared_extension_produces_warning() { /// Per spec §extensions — Extension ID format and version presence in serialization. #[test] fn test_extension_declaration_serialization() { - let ext = cdx_core::Extension::required("codex.semantic", "0.1"); + let ext = cdx_core::Extension::required("cdx.semantic", "0.1"); let json = serde_json::to_value(&ext).unwrap(); // Must have id, version, required fields diff --git a/cdx-core/tests/integration.rs b/cdx-core/tests/integration.rs index 2664e55..be2f7ad 100644 --- a/cdx-core/tests/integration.rs +++ b/cdx-core/tests/integration.rs @@ -1689,7 +1689,7 @@ mod ots_tests { // Specification Conformance Tests // ============================================================================= // -// These tests verify conformance with the Codex File Format Specification. +// These tests verify conformance with the CDX File Format Specification. // Each test includes a spec reference comment. /// Hash boundary tests - Per spec §06-document-hashing.md §4.1 @@ -2412,7 +2412,7 @@ mod manifest_validation_tests { // Serialize and check required fields let json = serde_json::to_string(&manifest).unwrap(); - assert!(json.contains("\"codex\""), "codex field required"); + assert!(json.contains("\"cdx\""), "cdx field required"); assert!(json.contains("\"id\""), "id field required"); assert!(json.contains("\"state\""), "state field required"); assert!(json.contains("\"created\""), "created field required"); @@ -2429,11 +2429,11 @@ mod extension_declaration_tests { /// Per spec extensions/README.md - Extension ID format: namespace.name #[test] fn test_extension_id_format_valid() { - // Standard codex extensions - let ext = Extension::required("codex.semantic", "0.1"); + // Standard cdx extensions + let ext = Extension::required("cdx.semantic", "0.1"); assert_eq!(ext.namespace(), "semantic"); - let ext = Extension::required("codex.legal", "0.1"); + let ext = Extension::required("cdx.legal", "0.1"); assert_eq!(ext.namespace(), "legal"); // Third-party extensions @@ -2444,23 +2444,23 @@ mod extension_declaration_tests { /// Per spec extensions/README.md - Extension version present #[test] fn test_extension_version_present() { - let ext = Extension::required("codex.semantic", "0.1"); + let ext = Extension::required("cdx.semantic", "0.1"); assert!(!ext.version.is_empty(), "Version must be present"); - let ext = Extension::optional("codex.forms", "1.2.3"); + let ext = Extension::optional("cdx.forms", "1.2.3"); assert!(!ext.version.is_empty(), "Version must be present"); } /// Per spec extensions/README.md - Required extension determines rejection #[test] fn test_required_extension_flag() { - let required = Extension::required("codex.security", "0.1"); + let required = Extension::required("cdx.security", "0.1"); assert!( required.required, "required=true should reject if unsupported" ); - let optional = Extension::optional("codex.phantoms", "0.1"); + let optional = Extension::optional("cdx.phantoms", "0.1"); assert!( !optional.required, "required=false should allow graceful degradation" diff --git a/cdx-core/tests/spec_compliance.rs b/cdx-core/tests/spec_compliance.rs index 995c832..980e999 100644 --- a/cdx-core/tests/spec_compliance.rs +++ b/cdx-core/tests/spec_compliance.rs @@ -1,6 +1,6 @@ //! Spec compliance tests. //! -//! These tests validate cdx-core against the external Codex file format +//! These tests validate cdx-core against the external CDX file format //! specification (pinned as a git submodule at `spec/`). Three modules: //! //! - **`mark_schema_validation`**: Serialized mark output validated against spec JSON schemas diff --git a/cdx-swift-bridge/Cargo.toml b/cdx-swift-bridge/Cargo.toml index f00effa..4819445 100644 --- a/cdx-swift-bridge/Cargo.toml +++ b/cdx-swift-bridge/Cargo.toml @@ -3,7 +3,7 @@ name = "cdx-swift-bridge" version = "0.1.0" edition = "2021" rust-version = "1.88" -description = "UniFFI bindings for cdx-core, exposing the Codex document format to Swift" +description = "UniFFI bindings for cdx-core, exposing the CDX document format to Swift" license = "MIT OR Apache-2.0" [lib] diff --git a/cdx-swift-bridge/src/content.rs b/cdx-swift-bridge/src/content.rs index 9881b87..9f67045 100644 --- a/cdx-swift-bridge/src/content.rs +++ b/cdx-swift-bridge/src/content.rs @@ -309,7 +309,7 @@ pub struct CdxManifestInfo { pub state: CdxDocumentState, pub created: String, pub modified: String, - pub codex_version: String, + pub cdx_version: String, pub hash_algorithm: String, } diff --git a/cdx-swift-bridge/src/document.rs b/cdx-swift-bridge/src/document.rs index 0c989a4..4fc82db 100644 --- a/cdx-swift-bridge/src/document.rs +++ b/cdx-swift-bridge/src/document.rs @@ -121,7 +121,7 @@ impl CdxDocument { state: CdxDocumentState::from(manifest.state), created: manifest.created.to_rfc3339(), modified: manifest.modified.to_rfc3339(), - codex_version: manifest.codex.clone(), + cdx_version: manifest.cdx.clone(), hash_algorithm: format!("{:?}", manifest.hash_algorithm), } } diff --git a/cdx-swift-bridge/src/lib.rs b/cdx-swift-bridge/src/lib.rs index 782ba68..4468f42 100644 --- a/cdx-swift-bridge/src/lib.rs +++ b/cdx-swift-bridge/src/lib.rs @@ -1,7 +1,7 @@ //! cdx-swift-bridge: UniFFI bindings for cdx-core //! //! This crate provides Swift-friendly wrappers around the cdx-core library, -//! exposing the Codex document format to macOS and iOS applications. +//! exposing the CDX document format to macOS and iOS applications. mod content; mod document; diff --git a/cdx-swift-bridge/src/tests.rs b/cdx-swift-bridge/src/tests.rs index 23b60e9..2168b3b 100644 --- a/cdx-swift-bridge/src/tests.rs +++ b/cdx-swift-bridge/src/tests.rs @@ -34,7 +34,7 @@ fn test_bytes_roundtrip() { let doc2 = open_document_from_bytes(bytes).unwrap(); let info1 = doc.get_manifest_info(); let info2 = doc2.get_manifest_info(); - assert_eq!(info1.codex_version, info2.codex_version); + assert_eq!(info1.cdx_version, info2.cdx_version); assert_eq!(info1.state, info2.state); } diff --git a/docs/architecture.md b/docs/architecture.md index aa398c7..d835dfe 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -4,7 +4,7 @@ This document describes the architecture of the cdx-core library. ## Overview -cdx-core is organized into layered modules that mirror the Codex Document Format specification. Each layer can be used independently or composed together through the high-level `Document` API. +cdx-core is organized into layered modules that mirror the CDX Document Format specification. Each layer can be used independently or composed together through the high-level `Document` API. ## Module Diagram @@ -66,9 +66,9 @@ cdx-core is organized into layered modules that mirror the Codex Document Format ### Document API (`document.rs`) -The high-level entry point for working with Codex documents. +The high-level entry point for working with CDX documents. -- **Document**: Main type representing a complete Codex document +- **Document**: Main type representing a complete CDX document - **DocumentBuilder**: Fluent builder for creating documents - **VerificationReport**: Results of document integrity verification @@ -88,7 +88,7 @@ Semantic content model with 20+ block types and 15+ mark types. - **Text**: Text nodes with optional marks (bold, italic, link, code, highlight, etc.) - **Content**: Root structure containing version and blocks array - **Validation**: Structural validation (lists contain list items, etc.) -- **Custom serde**: Hand-written `Serialize`/`Deserialize` impls for `Block` and `Mark` that produce flat `{"type": "...", ...}` JSON matching the Codex spec wire format, replacing derived serde which produced nested `{"Paragraph": {...}}` Rust-style enums +- **Custom serde**: Hand-written `Serialize`/`Deserialize` impls for `Block` and `Mark` that produce flat `{"type": "...", ...}` JSON matching the CDX spec wire format, replacing derived serde which produced nested `{"Paragraph": {...}}` Rust-style enums ### Metadata (`metadata/`) diff --git a/docs/conformance-matrix.md b/docs/conformance-matrix.md index 3c8ed9e..7a40d5b 100644 --- a/docs/conformance-matrix.md +++ b/docs/conformance-matrix.md @@ -1,6 +1,6 @@ -# Codex Specification Conformance Matrix +# CDX Specification Conformance Matrix -This document maps requirements from the [Codex File Format Specification](../codex-file-format-spec/) to test coverage in cdx-core. +This document maps requirements from the [CDX File Format Specification](../codex-file-format-spec/) to test coverage in cdx-core. ## Legend @@ -23,7 +23,7 @@ This document maps requirements from the [Codex File Format Specification](../co | Spec Section | Requirement | Test File | Test Name | Status | |--------------|-------------|-----------|-----------|--------| -| §3.2 | `codex` version required | manifest.rs | test_manifest_creation | PASS | +| §3.2 | `cdx` version required | manifest.rs | test_manifest_creation | PASS | | §3.2 | `id` required (format: `algorithm:hexdigest` or `pending`) | tests/conformance.rs | test_manifest_id_valid_hash_pattern | PASS | | §3.2 | `state` required (draft/review/frozen/published) | manifest.rs | test_manifest_validation | PASS | | §3.2 | `created` timestamp required (ISO 8601) | tests/conformance.rs | test_manifest_timestamps_iso8601 | PASS | diff --git a/docs/extension-guide.md b/docs/extension-guide.md index 4d840d2..7b054f6 100644 --- a/docs/extension-guide.md +++ b/docs/extension-guide.md @@ -4,7 +4,7 @@ This guide covers how extensions work in cdx-core: the built-in extension types, ## Extension Architecture -Extensions add domain-specific functionality to Codex documents without modifying the core content model. Each extension: +Extensions add domain-specific functionality to CDX documents without modifying the core content model. Each extension: - Lives in its own namespace (e.g., `forms`, `semantic`, `collaboration`) - Stores data in a dedicated archive path (e.g., `forms/data.json`) @@ -86,13 +86,13 @@ Extensions must be declared in the manifest to be recognized: use cdx_core::manifest::Extension; // Required extension - readers that don't support it must reject the document -let ext = Extension::required("codex.semantic", "0.1"); +let ext = Extension::required("cdx.semantic", "0.1"); // Optional extension - readers can safely ignore it -let ext = Extension::optional("codex.forms", "0.1"); +let ext = Extension::optional("cdx.forms", "0.1"); ``` -The ID format is `"codex.{namespace}"` for built-in extensions. Custom extensions use `"org.example.custom"`. +The ID format is `"cdx.{namespace}"` for built-in extensions. Custom extensions use `"org.example.custom"`. Query extensions on a manifest: