Skip to content

Overhaul AsmX-G3 File Structure: Go Linux-Style for Epic Scale #3

@TaiHusk

Description

@TaiHusk

The Problem

Our current setup is a spaghetti junction—root cluttered with changelogs, a fat src/ dir stuffed with everything from AST parsers to backend targets, and examples floating loose. No .gitignore? tsconfig.json bloating the root? It's fine for a prototype, but as we push boundaries (think multi-target firmwares, kernel-level ops), this chaos kills velocity. Devs trip over paths, onboarding sucks, and scaling to drivers/sockets/firmwares feels like herding cats. Inspired by LFS (Linux From Scratch), let's impose order—modular, hierarchical, battle-tested.

Quick audit of now:

  • Root: README.md, package.json, tsconfig.json, changelogs/ (with v28/v29 dirs), examples/ (asmx samples like factorial.asmx, sse.asmx).
  • src/: Core files (kernel.js, tapi.js, core.js), plus dirs like ast/, backend/, bin/, execution/, installer/, parsing/, server/, svc/, types/, utils/.

This works, but it's not future-proof. Time to refactor like we're building the next x64 kernel.

Proposed Structure

Channel LFS vibes: Separate kernel core, drivers/sockets for extensions, firmwares for targets, terminal for CLI/tools, and keep src/ for app-layer (frontend/backend split). Move examples to docs/examples/. Add .gitignore, normalize naming (kebab-case where sane).

AsmX-G3/
├── .gitignore                  # Standard ignores: node_modules, dist, etc.
├── README.md                   # Beefed-up docs, install/usage
├── package.json                # Root-level deps/scripts
├── tsconfig.json               # TS config stays root
├── changelogs/                 # Versioned logs (keep as-is, but add index.md)
├── docs/                       # All non-code docs
│   └── examples/               # Move asmx samples here
├── drivers/                    # Low-level hardware/sim extensions
├── sockets/                    # Inter-process comms (e.g., serverctl, network stubs)
├── firmwares/                  # Target-specific builds (e.g., amd64/; pull from backend/targets)
├── kernel/                     # Core engine
│   ├── kernel.js               # Main kernel (move from src)
│   ├── journalctl.js           # Logging/journaling
│   ├── exceptionctl.js         # Error handling
│   └── utils/                  # Kernel utils (move src/utils subset)
├── terminal/                   # CLI/TUI layer
│   ├── tapi.js                 # Terminal API (move from src)
│   ├── contract.js             # Pipeline contracts
│   ├── pipelinectl.js          # Pipeline controller
│   └── aliases.js              # CLI aliases (move from src)
└── src/                        # App/compiler layers
    ├── package.json            # Sub-package if needed (e.g., for npm workspaces)
    ├── bin/                    # Executables (move src/bin)
    ├── svc/                    # Services (move src/svc)
    ├── installer/              # Install scripts (move src/installer)
    ├── frontend/               # Parser/transformer front-end
    │   ├── parsers/            # Lexers/parsers (from src/parsing)
    │   ├── transformers/       # AST transforms (from src/ast)
    │   ├── token.js
    │   ├── token.type.js       # Types (from src/types)
    │   └── main.js             # Entry (from src/core?)
    └── backend/                # Code gen/output
        ├── packages/           # Package managers (deb, etc.)
        ├── libman/             # Library management
        ├── targets/            # Arch-specific (amd64; move from src/backend)
        └── output/             # Bin gen (.elf; from src/backend/output)

Key Moves:

  • Kernel/terminal/: Isolate core from app code—kernel for execution engine, terminal for user-facing.
  • Drivers/sockets/firmwares/: New for extensibility. Drivers for SIMD/GPU (e.g., sse.asmx logic), sockets for IPC, firmwares for cross-target (start empty, seed from examples/backend).
  • Src split: Frontend for parsing/AST, backend for gen—mirrors compiler pipelines.
  • Docs/: Centralize examples, add API.md.
  • Automation: Root scripts/ for build/test (e.g., npm run restructure).

This isn't just cleanup — it's architecture for 10x growth. Think Tesla-scale modularity.

Implementation Plan

  1. Prep: Branch off main (git checkout -b fs-overhaul). Add .gitignore. Backup current src/ to temp/.
  2. Migrate:
    • Move kernel.js → kernel/, tapi.js → terminal/.
    • Recreate subdirs in src/frontend/backend, shuffle parsing/ast → frontend/parsers/transformers; backend/targets → backend/targets.
    • Examples/ → docs/examples/.
  3. Update paths: Fix imports in kernel.js, package.json scripts, tsconfig paths. Test with npm install && npm test (add tests if missing).
  4. Validate: Run samples. Lint with ESLint/Prettier.
  5. PR & Merge: Review, squash commits, deploy to test env.

Who's in? Let's make AsmX-G3 scream like a Cybertruck on Ludicrous. Ping if tweaks needed — aiming for merge by EOW. 🚀

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions