Agent-oriented XLSX and DOCX tooling for MoonBit
Dependencies
///|
test "document format names" {
inspect(@office.DocumentFormat::Xlsx.name(), content="xlsx")
inspect(@office.DocumentFormat::Docx.name(), content="docx")
}moonx bobzhang/office help
moonx bobzhang/office help docx
moonx bobzhang/office help xlsx
moonx bobzhang/office help all --json
moonx bobzhang/office help all --jsonl
moonx bobzhang/office identify report.docx --json
moonx bobzhang/office create xlsx report.xlsx --sheet Data --json
moonx bobzhang/office batch report.xlsx changes.json --out revised.xlsx --json
moonx bobzhang/office raw list report.docx --json
moonx bobzhang/office raw read report.docx /document --jsonpub(all) suberror OfficeError {
UnsupportedFileExtension(String)
InvalidPackage(String)
FormatMismatch(expected~ : DocumentFormat, actual~ : DocumentFormat)
ResourceLimit(kind~ : String, limit~ : Int, actual~ : Int)
Cancelled
} derive(Eq, Debug)impl Show for OfficeError#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn OfficeError::equal(OfficeError, OfficeError) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn OfficeError::not_equal(x : OfficeError, y : OfficeError) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn OfficeError::output(self : OfficeError, logger : &Logger) -> Unit#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn OfficeError::to_repr(OfficeError) -> Repr#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn OfficeError::to_string(self : OfficeError) -> Stringpub(all) suberror SelectorError {
SelectorError(code~ : String, offset~ : Int, input~ : String, message~ : String)
}impl Show for SelectorError#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn SelectorError::output(self : SelectorError, logger : &Logger) -> Unit#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn SelectorError::to_string(self : SelectorError) -> Stringpub(all) struct CapabilityCommand {
name : String
summary : String
usage : String
formats : Array[String]
aliases : Array[String]
inputs : Array[CapabilityField]
outputs : Array[CapabilityField]
output_modes : Array[String]
variants : Array[CapabilityVariant]
}pub(all) struct CapabilityField {
name : String
type_name : String
required : Bool
description : String
}pub(all) struct CapabilityFormat {
name : String
aliases : Array[String]
description : String
selector : CapabilitySelector
}pub(all) struct CapabilitySelector {
schema : String
root : String
status : String
examples : Array[String]
description : String
}pub(all) struct CapabilityVariant {
name : String
usage : String
result_schema : String
registry : Json?
inputs : Array[CapabilityField]
outputs : Array[CapabilityField]
constraints : Array[String]
actions : Array[CapabilityAction]
output_modes : Array[String]
}pub struct CellAddress {
column : Int
row : Int
}impl Show for DocumentFormat#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn DocumentFormat::equal(DocumentFormat, DocumentFormat) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn DocumentFormat::not_equal(x : DocumentFormat, y : DocumentFormat) -> Bool#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn DocumentFormat::output(self : DocumentFormat, logger : &Logger) -> Unit#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn DocumentFormat::to_repr(DocumentFormat) -> Repr#deprecated("implicit trait-method promotion is being removed; call via the trait")
fn DocumentFormat::to_string(self : DocumentFormat) -> Stringpub struct OfficeSelector {
format : DocumentFormat
segments : ReadOnlyArray[SelectorSegment]
coordinate : SelectorCoordinate?
stability : SelectorStability
}pub(all) struct ProtocolWarning {
code : String
message : String
}pub enum SegmentSelection {
Position(Int)
Key(String, String)
}pub enum SelectorStability {
Stable
SnapshotRelative
}let SCHEMA_CAPABILITIES : Stringlet SCHEMA_DUMP_RESULT : Stringlet SCHEMA_FINDING_RECORD : Stringlet SCHEMA_ISSUES_RESULT : Stringlet SCHEMA_PREVIEW_RESULT : Stringlet SCHEMA_REPLAY_RESULT : Stringlet SCHEMA_VALIDATE_RESULT : Stringlet SELECTOR_MAX_DEPTH : Intlet SELECTOR_MAX_LENGTH : Intlet SELECTOR_MAX_NAME_LENGTH : Intlet SELECTOR_MAX_SELECTIONS : Intlet SELECTOR_MAX_VALUE_LENGTH : Intlet XLSX_TRANSACTION_MAX_CANDIDATE_ARCHIVE_BYTES : Intlet XLSX_TRANSACTION_MAX_CANDIDATE_ENTRY_BYTES : Intlet XLSX_TRANSACTION_MAX_DECODED_XML_BYTES : Intlet XLSX_TRANSACTION_MAX_MATERIALIZED_CELLS : Intlet XLSX_TRANSACTION_MAX_ROW_COLUMN_LINES : Intlet XLSX_TRANSACTION_MAX_XML_MARKUP_TOKENS : Intfn capability_fingerprint() -> Stringfn detect_archive_format(path : StringView, archive : Archive, max_xml_part_bytes? : Int, max_xml_total_units? : Int, cancelled? : () -> Bool) -> DocumentFormat raise OfficeErrorfn detect_format(path : StringView, data : BytesView, max_package_bytes? : Int, max_archive_entries? : Int, max_entry_uncompressed_bytes? : Int, max_total_uncompressed_bytes? : Int, max_xml_part_bytes? : Int, max_xml_total_units? : Int, cancelled? : () -> Bool) -> DocumentFormat raise OfficeErrorfn selector_for_xlsx_cell(sheet_name : String, address : String) -> OfficeSelector raise SelectorErrorfn selector_for_xlsx_range(sheet_name : String, range : String) -> OfficeSelector raise SelectorErrorfn sha256_hex(data : BytesView) -> Stringtest {
inspect(
@office.sha256_hex(b"abc"),
content="ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
)
}Agent-oriented XLSX and DOCX tooling for MoonBit
Dependencies