How thieung/agentkit-helper works
Purpose and execution entry points
AgentKit Helper is a Node.js 20.12+ terminal UI and CLI wrapper for the external ak CLI. It guides Kit install/update choices, renders the resulting official command, and executes it. Package execution starts at bin/agentkit-helper.mjs; command-line parsing and dispatch are centered in lib/args.mjs and lib/commands.mjs.
CLI/TUI orchestration
The application supports interactive selection plus explicit commands such as install, update, update-all, and self-update. lib/commands.mjs maps validated user intent to command workflows, while lib/navigation.mjs and lib/prompts.mjs implement multi-step terminal interaction, selection, confirmation, and back-navigation. lib/i18n.mjs supplies localized UI text.
Input normalization and policy boundaries
Arguments, defaults, supported kits/runtimes, channels, project/global scope, and dry-run behavior are normalized before execution. lib/args.mjs, lib/config.mjs, and lib/pi-profiles.mjs define these boundaries. The helper owns command construction and consent UX; AgentKit’s ak process remains responsible for Kit verification, ownership, snapshots, and runtime-specific files.
Project and installation discovery
The helper determines whether the current location is a valid project target, avoids unsafe locations such as filesystem root or the user home directory, and discovers existing installs for update-oriented flows. This is handled by lib/project.mjs and lib/discovery.mjs. Project paths and global/runtime scopes feed the same later command-generation path.
External process execution
lib/runner.mjs is the system boundary for invoking ak, including platform-oriented command handling and output/status propagation. The application first detects the required binary, then runs generated commands. Node.js is the primary runtime; ak is the required external service/CLI dependency. Portable Node execution targets macOS and Linux, while native Windows PowerShell support is experimental.
Safety and update behavior
Global installation is intentionally two-phase: run without --force, surface collisions or drift, then retry with force only after explicit opt-in. Global update preserves user changes and never forces replacement. Command preview/dry-run behavior is routed through the command and runner layers: lib/commands.mjs and lib/runner.mjs.
Auxiliary integrations and distribution
Self-updating the signed ak binary is a distinct workflow in lib/self-update.mjs. GitHub issue integration is isolated in lib/github-issue.mjs, keeping remote issue/reporting concerns out of installation execution. The package is distributed through npm with executable wiring in bin/agentkit-helper.mjs; CI is defined in .github/workflows/ci.yml.
Main entry points: commands.mjs Command workflows · runner.mjs ak process runner · agentkit-helper.mjs Executable entry · args.mjs Argument parsing
Components 15
CLI Entry
- Executable entry · npm executable entry point.
bin/agentkit-helper.mjs - Argument parsing · Normalizes command-line intent and defaults.
lib/args.mjs
Interaction & Policy
- Command workflows · Maps validated intent to install and update flows.
lib/commands.mjs - Terminal navigation · Provides multi-step selection and back-navigation.
lib/navigation.mjs - Prompts & consent · Collects selections and explicit confirmations.
lib/prompts.mjs - Localized UI text
lib/i18n.mjs - Install policy config · Defines supported kits, runtimes, channels, and scopes.
lib/config.mjs - PI profiles
lib/pi-profiles.mjs
Target Discovery
- Project validation · Rejects unsafe locations and validates project targets.
lib/project.mjs - Installation discovery · Finds existing installs for update-oriented flows.
lib/discovery.mjs
Command Execution
- ak process runner · Detects and invokes ak with platform-aware status propagation.
lib/runner.mjs - External ak CLI · Verifies Kits and manages ownership, snapshots, and runtime files.
Auxiliary Workflows
- ak self-update · Updates the signed ak binary.
lib/self-update.mjs - GitHub issue integration · Keeps issue reporting separate from installation execution.
lib/github-issue.mjs - CI pipeline
.github/workflows/ci.yml
Connections 15
- Executable entry → Argument parsing: starts
- Argument parsing → Command workflows: validated intent
- Command workflows → Terminal navigation: interactive flow
- Terminal navigation → Prompts & consent: selection and confirmation
- Prompts & consent → Localized UI text: UI text
- Command workflows → Install policy config: normalizes policy
- Command workflows → PI profiles: applies profiles
- Command workflows → Project validation: validates project scope
- Command workflows → Installation discovery: finds existing installs
- Command workflows → ak process runner: previews or executes ak command
- ak process runner → External ak CLI: detects and invokes
- Command workflows → ak self-update: routes self-update
- ak self-update → ak process runner: runs update process
- Command workflows → GitHub issue integration: routes issue reporting
- CI pipeline → Executable entry: validates package entry