What Is the Main CLI Entry Point for Archify? (Entry Script Explained)

The main CLI entry point for Archify is archify/bin/archify.mjs, registered as the binary target in package.json under the bin field.

When you install the tt-a1i/archify package globally or run it via npx, the archify command resolves to this module. The script parses incoming arguments, validates sub-commands such as render, compare, deliver, and validate, and dispatches execution to the appropriate renderer or utility modules.

Locating the Entry Point in the Repository

The Archify CLI follows standard Node.js conventions for exposing executable scripts. The entry point is defined in the package manifest and implemented as an ES module.

package.json Binary Declaration

In archify/package.json, the binary is declared under the bin key, mapping the command name to the relative script path:

{
  "bin": {
    "archify": "./bin/archify.mjs"
  }
}

This configuration ensures that when users run archify in their terminal, Node.js executes archify/bin/archify.mjs.

The Main Script File

The file archify/bin/archify.mjs serves as the primary dispatcher. It imports argument parsing logic, validates command-line flags, and routes requests to specialized handlers. According to the tt-a1i/archify source code, this module handles input validation before delegating to rendering engines or validation utilities.

How the Entry Point Processes Commands

Once invoked, archify.mjs inspects the first positional argument to determine which sub-command to execute. The entry point supports multiple architectural workflows:

  • render: Generates architecture diagrams from JSON definitions
  • compare: Diff two architecture snapshots and output deltas
  • deliver: Validate and output diagrams with receipt generation
  • validate: Check diagram syntax and schema compliance

The script validates required parameters—such as input file paths, output destinations, and quality flags—before passing sanitized arguments to the underlying implementation modules.

Common CLI Commands and Usage Examples

Below are practical examples demonstrating how the archify entry point handles various sub-commands:


# Display usage help and available commands

archify

# Render an architecture diagram to HTML

archify render architecture path/to/diagram.json output.html --quality showcase

# Compare two snapshots and output JSON delta

archify compare architecture base.json head.json delta.html --json

# Deliver a validated workflow diagram with receipt

archify deliver workflow examples/agent-tool-call.workflow.json \
  output.html --json --open

Each command ultimately invokes archify/bin/archify.mjs, which routes arguments to the corresponding rendering or validation logic.

While archify.mjs serves as the primary entry point, the CLI delegates specific tasks to specialized scripts in the same directory.

Preview Sub-command

The file archify/bin/preview.mjs implements the live-preview functionality. When users invoke the preview mode, the main entry point spawns this module to watch files and refresh outputs automatically.

Visual Check Sub-command

The file archify/bin/visual-check.mjs handles visual regression testing for generated diagrams. The main entry point routes visual-check invocations to this script to compare render outputs against baselines.

Summary

  • The main CLI entry point is archify/bin/archify.mjs, registered in package.json under "bin": { "archify": "./bin/archify.mjs" }.
  • This ES module parses sub-commands (render, compare, deliver, validate) and validates arguments before dispatching to helper modules.
  • Supporting scripts like preview.mjs and visual-check.mjs in the same directory handle specialized tasks invoked by the primary entry point.
  • The entry point is invoked via the archify command when installed globally or executed through npx.

Frequently Asked Questions

How do I run Archify without installing it globally?

You can execute the CLI entry point directly using npx without a global installation: npx archify render architecture input.json output.html. This command downloads the package temporarily and invokes archify/bin/archify.mjs with the provided arguments.

Where is the CLI command defined in the source code?

The command name archify is defined in archify/package.json within the bin field. The value ./bin/archify.mjs points to the executable script that Node.js runs when the command is invoked.

What sub-commands does the main entry point support?

According to the source analysis, archify/bin/archify.mjs supports sub-commands including render, compare, deliver, and validate. Each sub-command triggers specific logic for diagram generation, snapshot comparison, workflow delivery, or schema validation.

Can I use the entry point script directly for development?

Yes, developers can execute the script directly with Node.js for debugging: node archify/bin/archify.mjs render architecture diagram.json output.html. This bypasses the package binary mapping and runs the entry point module immediately.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →