How andrewhopper/dotai works
Project type and purpose
• This is an open-source, tool-agnostic CLI application (“dotai”) built in Node.js.
• It scaffolds and enforces a standardized “.ai” directory structure and documentation workflow to accelerate AI-assisted projects.
File structure
• Top-level CLI:
• dotai/bin/dotai.js – the entry point installed globally
• src/commands – command modules (init.js, add.js, validate.js)
• src/utils – helper functions (createDirectoryStructure.js, copyTemplateFiles.js)
• Templates:
• src/templates – source templates mirror the “.ai” folder layout (0-ai-config, 1-context, 2-technical-design, 3-development, 4-acceptance-reports).
• Project docs and research:
• .ai – generated project documentation structure
• research – markdown research documents
• Config & packaging:
• package.json / manifest.json – dependency and CLI metadata
• .gitignore, LICENSE, readme.md
Key insights from README
• Purpose: standardized context management, automated docs & validation
• Workflow: bootstrapping → context definition → feature docs → implementation → validation cycles
• Features: interactive init, add new context sections, validate existing docs against rules
Main components and interactions
a. Components
• CLI Interface
• Command Loader (commander.js or similar)
• Command Handlers (init, add, validate)
• Template Engine & File System Layer (utils)
• Template Repository (src/templates)
• Generated Project Workspace (user’s .ai folder)
• Validation Rules (.cursorrules, .clinerules)
• External systems: NPM registry, Git
b. Relationships / Data Flow
1. User invokes dotai <command> via CLI.
2. CLI Interface parses args and dispatches to Command Loader.
3. Command Handler loads appropriate templates or rule sets.
4. Utils module reads/writes file system to scaffold or validate the target project.
5. Validation reads the .ai folder, applies rules defined in cursorrules/clinerules, emits reports.
6. Results are printed back to user.
c. Architectural patterns / design principles
• Command Pattern: each command is a discrete module that conforms to a shared interface.
• Template-Driven scaffolding: static templates + dynamic rendering.
• Separation of concerns: CLI parsing, template management, file I/O, validation logic are distinct layers.
• Config-over-code: rules and workflow steps are defined in markdown and config files, not hard-coded.
d. Key technologies
• Node.js, npm
• Commander.js or yargs (inferred CLI parser)
• Filesystem API (fs)
• JSON manifests (package.json, manifest.json)
• Markdown templates
Detailed elements
• Clear component names: “dotai CLI,” “init command,” “validate command,” “template store,” “.ai workspace.”