Go CLI Framework
Go to file
2026-08-28 11:31:11 +08:00
data ini: project initialized 2026-08-26 19:08:51 +08:00
essential ini: project initialized 2026-08-26 19:08:51 +08:00
operational ini: project initialized 2026-08-26 19:08:51 +08:00
run ini: project initialized 2026-08-26 19:08:51 +08:00
.gitignore upd: root/file updated 2026-08-28 11:13:29 +08:00
CHANGELOG.md upd: root/file updated 2026-08-28 11:16:46 +08:00
go.mod upd: root/file updated 2026-08-28 11:31:11 +08:00
LICENSE.md upd: root/file updated 2026-08-28 11:15:41 +08:00
Makefile upd: root/file updated 2026-08-28 11:14:41 +08:00
README.md upd: root/file updated 2026-08-28 11:17:30 +08:00

Go CLI Framework

Overview

This document describes the CLI source tree represented by the project-root placeholder source. The structure separates shared data resources, framework-owned foundations, software-specific extensions, runtime composition, and project-level files.

Architecture

Data

The data directory provides the common resource system for framework-owned and software-owned embedded data, using a central cabinet, data-specific ledgers, and resource handlers to register and resolve resources through a controlled and lightweight access path.

  • data — provides the common resource system for framework-owned and software-owned embedded data, using a central cabinet, data-specific ledgers, and resource handlers to register and resolve resources through a controlled and lightweight access path.
    • cabinet — serves as the common coordination point for framework-owned and software-owned data ledgers, determining which ledger is responsible for a requested resource.
      • cabinet.go — implements the cabinet that coordinates registration and access across the framework and software data ledgers.
    • framework — contains the data resources owned and maintained by the framework developer.
      • ledger — acts as the registrar for framework-owned resources and identifies the handler responsible for each resource.
        • ledger.go — implements the framework-owned resource ledger and its resource registration and resolution.
      • metadata — contains framework-owned metadata resources.
        • handler.go — provides the resource-specific logic for accessing and parsing the embedded framework metadata when requested.
        • resource.json — contains the embedded framework metadata resource.
    • software — contains the data resources owned and maintained by the software developer.
      • ledger — acts as the registrar for software-owned resources and identifies the handler responsible for each resource.
        • ledger.go — implements the software-owned resource ledger and its resource registration and resolution.
      • metadata — contains software-owned metadata resources.
        • handler.go — provides the resource-specific logic for accessing and parsing the embedded software metadata when requested.
        • resource.json — contains the embedded software metadata resource.

Essential

The essential directory provides the framework-owned foundation used by software built on the framework, including framework interactions, internal services, and reusable services exposed to the software layer.

  • essential — provides the framework-owned foundation used by software built on the framework, including framework interactions, internal services, and reusable services exposed to the software layer.
    • exchange — serves as the registrar for framework-owned interactions, allowing framework services to register their interactive, imperative, and directive logic for later composition by the runtime.
      • directive — contains the framework-owned directive interaction path.
        • directive.go — implements framework-owned directive interaction handling.
      • imperative — contains the framework-owned imperative interaction path.
        • imperative.go — implements framework-owned imperative interaction handling.
      • interactive — contains the framework-owned interactive interaction path.
        • interactive.go — implements framework-owned interactive interaction handling.
      • router — organizes the routing of framework-owned interactions to their appropriate interaction handling path.
        • router.go — implements the framework-owned interaction routing.
    • hidden — contains internal framework services that may be used within the essential layer but are not permitted to be called from the software layer, regardless of whether their functions are exported.
      • service — contains internal framework services available to the framework.
        • management — provides services for managing the lifecycle of the compiled binary.
          • clean — provides the compiled binary cleanup service.
            • clean.go — implements the compiled binary cleanup service.
          • install — provides the compiled binary installation service.
            • install.go — implements the compiled binary installation service.
          • uninstall — provides the compiled binary uninstallation service.
            • uninstall.go — implements the compiled binary uninstallation service.
          • update — provides the compiled binary update service.
            • update.go — implements the compiled binary update service.
        • worker — provides the automation layer for the compiled binary while keeping its automation configuration outside the binary.
          • clock — provides the clock syncronization service.
            • clock.go — implements the clock syncronization service.
          • manager — manages the workers responsible for executing automation.
            • manager.go — implements worker management.
    • visible — contains framework services that the software layer is permitted to call, providing reusable abstractions over framework capabilities.
      • service — contains reusable framework services available to the software layer.
        • helper — contains reusable helper services for common software needs.
          • cipher — provides reusable encryption and decryption functionality.
            • cipher.go — implements cipher functionality.
          • codec — provides reusable encoding and decoding functionality.
            • codec.go — implements codec functionality.
          • datetime — provides reusable date and time utilities.
            • datetime.go — implements date and time utilities.
          • filesystem — provides reusable filesystem utilities.
            • filesystem.go — implements filesystem utilities.
          • hash — provides reusable hashing functionality.
            • hash.go — implements hashing functionality.
          • key — provides reusable key-generation functionality.
            • key.go — implements key generation functionality.
          • log — provides reusable logging utilities.
            • log.go — implements logging utilities.
          • marker — provides generalized identifier-generation functionality for uses that require generated markers or identifiers.
            • marker.go — implements marker generation functionality.
          • progress — provides reusable progress tracking utilities.
            • progress.go — implements progress utilities.
          • retriever — provides a unified interface for accessing both framework-owned and software-owned data.
            • retriever.go — implements the unified data retrieval interface.
          • status — provides reusable status utilities.
            • status.go — implements status utilities.

Operational

The operational directory contains the software-specific implementation and interaction components maintained by the software developer within the architecture provided by the framework.

  • operational — contains the software-specific implementation and interaction components maintained by the software developer within the architecture provided by the framework.
    • exchange — serves as the registrar for software-specific interactions, allowing software services to register their interactive, imperative, and directive logic for composition by the runtime.
      • directive — contains the software-specific directive interaction path.
        • directive.go — implements software-specific directive interaction handling.
      • imperative — contains the software-specific imperative interaction path.
        • imperative.go — implements software-specific imperative interaction handling.
      • interactive — contains the software-specific interactive interaction path.
        • interactive.go — implements software-specific interactive interaction handling.
      • router — organizes the routing of software-specific interactions to their appropriate interaction handling path.
        • router.go — implements the software-specific interaction routing.
    • mechanism — contains the software-specific mechanisms through which application services and their features are implemented.
      • service — serves as the container for software-specific services.
        • service — placeholder for a software-specific service that is replaced with the actual service name.
          • feature — contains the features provided by the software-specific service.
            • function.go — implements a feature of the software-specific service.

Run

The run directory provides the stable runtime entry and interaction composition layer for the compiled application.

  • run — provides the stable runtime entry and interaction composition layer for the compiled application.
    • exchange — combines the registered framework-owned and software-owned interactions into the unified interaction structure used by the running application.
      • directive — receives and processes runtime directive interactions.
        • directive.go — implements runtime directive interaction handling.
      • imperative — receives and processes runtime imperative interactions.
        • imperative.go — implements runtime imperative interaction handling.
      • interactive — receives and processes runtime interactive interactions.
        • interactive.go — implements runtime interactive interaction handling.
      • router — routes incoming runtime interactions to the appropriate framework or software interaction path.
        • router.go — implements runtime interaction routing.
    • main — provides the executable entry point that initializes the required packages and starts the application without directly defining its menus, commands, flags, or arguments.
      • main.go — bootstraps the runtime and starts the compiled application.

Project Files

The project root contains the following project-level files:

  • .gitignore — defines files and directories that should be excluded from version control.
  • CHANGELOG.md — records changes made to the framework across versions.
  • go.mod — defines the Go module configuration and dependency context for the project.
  • LICENSE.md — defines the licensing terms governing the framework.
  • Makefile — provides build, update, and automation tasks for maintaining and operating the framework.
  • README.md — provides documentation describing the framework and its usage.

Source Tree

The following structure represents the CLI source tree:

source ├── data │ ├── cabinet │ │ └── cabinet.go │ ├── framework │ │ ├── ledger │ │ │ └── ledger.go │ │ └── metadata │ │ ├── handler.go │ │ └── resource.json │ └── software │ ├── ledger │ │ └── ledger.go │ └── metadata │ ├── handler.go │ └── resource.json ├── essential │ ├── exchange │ │ ├── directive │ │ │ └── directive.go │ │ ├── imperative │ │ │ └── imperative.go │ │ ├── interactive │ │ │ └── interactive.go │ │ └── router │ │ └── router.go │ ├── hidden │ │ └── service │ │ ├── management │ │ │ ├── clean │ │ │ │ └── clean.go │ │ │ ├── install │ │ │ │ └── install.go │ │ │ ├── uninstall │ │ │ │ └── uninstall.go │ │ │ └── update │ │ │ └── update.go │ │ └── worker │ │ ├── clock │ │ │ └── clock.go │ │ └── manager │ │ └── manager.go │ └── visible │ └── service │ └── helper │ ├── cipher │ │ └── cipher.go │ ├── codec │ │ └── codec.go │ ├── datetime │ │ └── datetime.go │ ├── filesystem │ │ └── filesystem.go │ ├── hash │ │ └── hash.go │ ├── key │ │ └── key.go │ ├── log │ │ └── log.go │ ├── marker │ │ └── marker.go │ ├── progress │ │ └── progress.go │ ├── retriever │ │ └── retriever.go │ └── status │ └── status.go ├── operational │ ├── exchange │ │ ├── directive │ │ │ └── directive.go │ │ ├── imperative │ │ │ └── imperative.go │ │ ├── interactive │ │ │ └── interactive.go │ │ └── router │ │ └── router.go │ └── mechanism │ └── service │ └── service │ └── feature │ └── function.go ├── run │ ├── exchange │ │ ├── directive │ │ │ └── directive.go │ │ ├── imperative │ │ │ └── imperative.go │ │ ├── interactive │ │ │ └── interactive.go │ │ └── router │ │ └── router.go │ └── main │ └── main.go ├── .gitignore ├── CHANGELOG.md ├── go.mod ├── LICENSE.md ├── Makefile └── README.md