How imshakil/pacli works
Project Type and Purpose
• pacli is a command-line tool (CLI) for securely storing and managing secrets locally.
• It provides subcommands for secrets CRUD, SSH connection management, URL shortening, clipboard integration, and exporting data.
File Structure
Top-level directories & files:
• pacli/
– cli.py (entry point)
– commands/ (admin, secrets, ssh, utils)
– store.py (data persistence & encryption)
– linklyhq.py (LinklyHQ API integration)
– ssh_utils.py (SSH connection)
– helpers.py, decorators.py, log.py (utility modules)
• tests/ (unit tests)
• GitHub workflows (.github/workflows/*.yml)
• pyproject.toml, requirements.txt (build & dependencies)
Architectural patterns:
• CLI-driven command dispatcher (likely uses click or argparse)
• Modular commands implementing Single Responsibility
• Local encrypted storage (file-based database via store.py)
• External integrations: LinklyHQ API, system clipboard, SSH client
Key Insights from README
• Master password encryption for the local store
• Environment variables for master password and LinklyHQ credentials
• Commands to add/get/update/delete secrets, manage SSH, shorten URLs, copy to clipboard, and export data
Main Components & Interactions
a. User Shell & CLI Frontend
– Component: Terminal / shell
– Tech: Python CLI (click/argparse) in pacli/cli.py
b. Command Dispatcher
– Routes subcommands (init, add, get, ssh, short, cc, export)
– Located in pacli/commands/*.py
c. Core Logic Modules
– pacli/store.py
• Handles encrypted file storage, master password, CRUD operations
– pacli/ssh_utils.py
• Wraps SSH client calls
– pacli/linklyhq.py
• HTTP client for LinklyHQ API
– pacli/helpers.py, decorators.py, log.py
• Shared utilities, logging, CLI prompts
d. External Services & OS Integrations
– File System (encrypted data file in user’s home)
– System Clipboard (via pyperclip or similar)
– External API (LinklyHQ REST endpoint)
– SSH Daemon (remote servers)
e. Environment & Configuration
– Environment Variables (PACLI_MASTER_PASSWORD, PACLI_LINKLYHQ_KEY/WID)
– Configuration files (none; uses env + prompts)
Architectural Patterns & Design Principles
• Separation of Concerns: CLI entrypoint vs. command modules vs. helpers vs. store
• Single Responsibility: each command class handles one feature
• Inversion of Control: decorators manage cross-cutting concerns (e.g., error handling)
• Local-First Security: encrypted at rest, master password prompt/use of env var
• Notes on technologies (e.g., Python, file-based encryption, HTTP REST)
• Modules with file paths (e.g., pacli/store.py) for clarity