Files
smartdeno/.serena/memories/codebase_structure.md

64 lines
2.6 KiB
Markdown
Raw Normal View History

# Codebase Structure
## Directory Layout
```
smartdeno/
├── ts/ # Source code
│ ├── index.ts # Main entry point (exports SmartDeno)
│ ├── plugins.ts # Dependency imports
│ ├── paths.ts # Path configurations
│ ├── classes.smartdeno.ts # Main SmartDeno class
│ ├── classes.denodownloader.ts # Deno download logic
│ ├── classes.scriptserver.ts # Script execution server
│ ├── classes.denoexecution.ts # Script execution wrapper
│ └── 00_commitinfo_data.ts # Commit metadata
├── test/ # Test files
│ └── test.ts # Main test suite
├── dist_ts/ # Compiled output (gitignored)
├── .nogit/ # Temporary/debug files (gitignored)
├── assets/ # Static assets
├── .gitea/ # Gitea-specific configs
├── .vscode/ # VS Code settings
├── .claude/ # Claude Code settings
├── .serena/ # Serena agent settings
├── package.json # Package manifest
├── tsconfig.json # TypeScript config
├── npmextra.json # Extended npm metadata
├── readme.md # Main documentation
└── readme.hints.md # Development hints (currently empty)
```
## Core Classes
### SmartDeno (ts/classes.smartdeno.ts)
Main orchestrator class with methods:
- `start(options)` - Initialize and download Deno if needed
- `stop()` - Cleanup resources
- `executeScript(scriptArg)` - Execute a Deno script
### DenoDownloader (ts/classes.denodownloader.ts)
Handles Deno binary download:
- Fetches latest Deno release from GitHub
- Platform detection (Linux, macOS, Windows)
- Architecture detection (x64, arm64)
- Downloads and extracts Deno binary
### ScriptServer (ts/classes.scriptserver.ts)
Internal server for script execution
### DenoExecution (ts/classes.denoexecution.ts)
Wraps individual script execution
## Entry Point Flow
1. User imports from `@push.rocks/smartdeno`
2. `index.ts` exports `SmartDeno` class
3. User creates instance: `new SmartDeno()`
4. User calls `await smartDeno.start()` to initialize
5. User calls `await smartDeno.executeScript(code)` to run Deno code
## Dependencies Pattern
All external dependencies are:
1. Imported in `plugins.ts`
2. Exported as namespace
3. Used with full path (e.g., `plugins.smartfile.fs.readFile()`)