Skip to content

HermesSilva/DASE50

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

66 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

English English Β Β  PortuguΓͺs (Brasil)Brasil


TFX β€” Core Framework

CI Tests Lines Coverage

Node.js Version Vitest TypeScript AI Written

DASE β€” VS Code Extension

CI Tests Lines Coverage

Node.js Version Jest TypeScript AI Written


DASE50 β€” Design-Aided Software Engineering

πŸ§ͺ An Experiment in AI-Driven Software Development

This project is a deliberate experiment in writing a medium-sized software project entirely through AI prompts, without any direct human coding. Every line of code, test, configuration, and documentation has been generated by AI (GitHub Copilot) based on carefully crafted prompts and architectural instructions.

The goal is to explore:

  • Feasibility: Can AI write production-quality code from high-level descriptions?
  • Quality: Does AI-generated code meet professional standards for security, performance, and maintainability?
  • Coverage: Can AI achieve 100% test coverage while maintaining code elegance?
  • Iteration: How effectively can AI refactor, debug, and extend existing codebases?

"The best code is code that writes itself β€” guided by clear intent."


πŸ“‹ Table of Contents


🎯 Project Overview

DASE (Design-Aided Software Engineering) is a visual design environment for modeling and generating multi-layer, multi-platform, multi-database, and multi-paradigm web applications.

The project consists of two main components:

Component Description Status
TFX/ Core framework library providing the foundation for VS Code extensions βœ… Complete
DASE/ VS Code extension implementing visual designers 🚧 In Development

Core Technologies

  • TypeScript 5.3+ with .NET-inspired conventions
  • Node.js 20+ runtime
  • Vitest for unit testing with coverage
  • GitHub Actions for CI/CD automation

🧭 Philosophical Principles

These principles are the foundation behind every directive in this document.
They exist to keep decisions consistent when trade-offs appear.

  1. The best code is code that writes itself β€” guided by clear intent.
  2. Any line of code that cannot be exercised by automated tests should not exist.
  3. Truth over optics: we refuse β€œmetric theater” (coverage inflation, artificial branches, cosmetic tests).
  4. Coverage is evidence, not a goal: the goal is confidence in behavior under realistic conditions.
  5. If a branch is truly unreachable, the correct action is removal or an explicit invariant β€” not a fabricated test.
  6. Unreachable code is a design smell: either the model is wrong, or the branch is dead, or the contract is unclear.
  7. Prefer deletion to decoration: removing dead paths is higher quality than β€œcovering” them.
  8. Tests must represent plausible worlds: a test that cannot occur in production is documentation of fiction.
  9. Every test must answer a question: β€œWhat failure would this catch, and why would it matter?”
  10. Assertions are contracts: validate invariants where they belong, and test through public behavior.
  11. Strong contracts reduce defensive noise: less β€œjust in case”, more β€œcannot happen by construction”.
  12. Write code that is easy to prove: clarity beats cleverness; determinism beats surprises.
  13. Prefer domain truth over framework convenience: the model dictates the code, not the other way around.
  14. Code is a liability: every added line MUST pay rent (clear value, verified behavior).
  15. Make state explicit; implicit state becomes hidden bugs.
  16. Optimize for the next reader: the future maintainer is usually you.
  17. Complexity must be earned by measurable benefit; simple mechanisms scale best.
  18. Fail fast, fail loud: reject invalid input early with precise, actionable errors.
  19. Measure before optimizing; optimize only what profiling proves is hot.
  20. Security is an invariant, not a feature.
  21. Integrity is non-negotiable: we do not trade truth for appearance, even when it looks β€œbetter” on paper.
  22. A green pipeline is not a certificate: it is a signal that must remain honest to keep meaning.
  23. Just as 10 seconds of silence end a life of $3 \times 10^9$ beats, sequential errors are software's demise: continuity is life, statistics are an illusion.

πŸ“ Repository Structure

DASE50/
β”œβ”€β”€ .github/
β”‚   β”œβ”€β”€ copilot-instructions.md    # AI coding standards
β”‚   └── workflows/
β”‚       └── ci.yml                 # CI/CD pipeline
β”œβ”€β”€ TFX/                           # Core Framework
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ Core/                  # Foundation classes
β”‚   β”‚   β”œβ”€β”€ Data/                  # Serialization engine
β”‚   β”‚   β”œβ”€β”€ Design/                # Visual design elements
β”‚   β”‚   └── Designers/             # Domain-specific designers
β”‚   └── tests/                     # Unit tests
β”œβ”€β”€ DASE/                          # VS Code Extension
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ Commands/              # Extension commands
β”‚   β”‚   β”œβ”€β”€ Designers/ORM/         # ORM designer
β”‚   β”‚   β”œβ”€β”€ Models/                # Data models
β”‚   β”‚   β”œβ”€β”€ Services/              # Business services
β”‚   β”‚   └── Views/                 # Panel views
β”‚   β”œβ”€β”€ media/                     # Webview assets
β”‚   └── src/__tests__/             # Unit tests
└── README.md                      # This file

οΏ½ DASE β€” VS Code Extension

DASE (Design-Aided Software Engineering) is a VS Code extension that provides visual designers for software modeling. The initial focus is an ORM Designer for database schema modeling.

Vision

DASE aims to be a comprehensive visual design environment supporting:

  • πŸ“Š ORM Designer β€” Database schema modeling (current phase)
  • πŸ“ UI Designer β€” User interface layouts (planned)
  • πŸ”„ Flow Designer β€” Business process workflows (planned)
  • πŸ“‘ API Designer β€” REST/GraphQL endpoint modeling (planned)

Current Phase: ORM Designer

Features

Feature Description Status
Custom Editor Opens .dsorm files in visual designer βœ… Implemented
Tables Visual table representation with columns βœ… Implemented
Relations Visual relationship lines between tables βœ… Implemented
Properties Panel Edit selected element properties βœ… Implemented
Issues Panel Validation errors and warnings βœ… Implemented
Context Menus All actions via right-click menus βœ… Implemented
TFX Integration Bridge to TFX framework for model management βœ… Implemented

Architecture

DASE/src/
β”œβ”€β”€ ExtensionMain.ts                  # Extension entry point
β”œβ”€β”€ Commands/
β”‚   β”œβ”€β”€ DeleteSelectedCommand.ts      # Delete elements command
β”‚   β”œβ”€β”€ ReloadDataTypesCommand.ts     # Reload data types command
β”‚   └── RenameSelectedCommand.ts      # Rename element command
β”œβ”€β”€ Designers/ORM/
β”‚   β”œβ”€β”€ ORMDesignerEditorProvider.ts  # Custom editor provider
β”‚   β”œβ”€β”€ ORMDesignerMessages.ts        # Message protocol types
β”‚   β”œβ”€β”€ ORMDesignerState.ts           # In-memory state management
β”‚   └── Commands/                     # ORM-specific commands
β”œβ”€β”€ Models/
β”‚   β”œβ”€β”€ DesignerSelection.ts          # Selection data structures
β”‚   β”œβ”€β”€ IssueItem.ts                  # Issue representation
β”‚   └── PropertyItem.ts               # Property representation
β”œβ”€β”€ Services/
β”‚   β”œβ”€β”€ IssueService.ts               # Issue management
β”‚   β”œβ”€β”€ SelectionService.ts           # Selection state
β”‚   └── TFXBridge.ts                  # TFX framework integration
└── Views/
    β”œβ”€β”€ IssuesViewProvider.ts         # Issues panel
    └── PropertiesViewProvider.ts     # Properties panel

Message Protocol

The designer uses a typed message protocol for webview communication:

Message Type Direction Purpose
DesignerReady Webview β†’ Extension Webview initialization complete
LoadModel Extension β†’ Webview Send model data to render
ModelLoaded Webview β†’ Extension Confirm model loaded
SaveModel Webview β†’ Extension Request model persistence
SelectElement Webview β†’ Extension User selected an element
SelectionChanged Extension β†’ Webview Selection state updated
UpdateProperty Extension β†’ Webview Property value changed
PropertiesChanged Webview β†’ Extension Properties need refresh
ValidateModel Either Trigger validation
IssuesChanged Extension β†’ Webview Validation results updated

Context Menu Commands

Designer Canvas:

  • Dase.AddTable β€” Add a new table to the model
  • Dase.AddRelation β€” Add a relationship between tables
  • Dase.DeleteSelected β€” Delete selected elements
  • Dase.RenameSelected β€” Rename selected element

Explorer (.dsorm files):

  • Dase.OpenORMDesigner β€” Open file in visual designer
  • Dase.ValidateORMModel β€” Validate model and populate Issues

Validation Rules

The ORM validator (using XValidator<XORMDocument, XORMDesign>) enforces:

  • ❌ Error: Table name cannot be empty
  • ❌ Error: Duplicate table names not allowed
  • ❌ Error: Relation references non-existent table
  • ⚠️ Warning: Table has no columns defined

οΏ½πŸ“¦ TFX β€” Tootega Framework X

TFX is the core library that powers the DASE extension. It provides a robust, type-safe foundation for building VS Code extensions with complex visual designers.

Architecture Overview

TFX is organized into four main modules:

πŸ”Ή Core Module (@tootega/tfx/Core)

The foundation layer providing essential building blocks:

Class Purpose
XElement Base class for all hierarchical elements with parent-child relationships
XPersistableElement Extended element with serialization, selection, and change tracking
XProperty Reactive property system with metadata, validation, and binding support
XEvent Type-safe event dispatching system
XDispatcher Action executor with queuing capabilities
XChangeTracker Undo/redo tracking for element modifications
XValidation Validation framework with error severity levels
XGuid GUID generation and manipulation utilities
XConvert Type conversion utilities

Geometry Types:

  • XPoint, XSize, XRect, XThickness β€” Spatial primitives
  • XColor, XHSLColor, XBorderColor β€” Color management
  • XFont, XFontStyle β€” Typography support

πŸ”Ή Data Module (@tootega/tfx/Data)

Comprehensive XML serialization engine:

Class Purpose
XSerializationEngine Central orchestrator for serialize/deserialize operations
XSerializationContext Manages serialization state, references, and errors
XElementRegistry Type registration for polymorphic serialization
XmlWriter XML output generation with formatting options
XmlReader XML parsing with namespace and attribute handling
XTypeConverter Custom type conversion for serialization

πŸ”Ή Design Module (@tootega/tfx/Design)

Visual design element primitives:

Class Purpose
XDocument<T> Generic document container for designs
XDesign Base class for design surfaces
XDesignElement Base visual element with layout properties
XRectangle Rectangle shape with borders and styling
XLine Line element with cap and join styles
XField Text field element

πŸ”Ή Designers Module (@tootega/tfx/Designers)

Domain-specific designer implementations:

Class Purpose
XORMDocument ORM model document container
XORMDesign ORM design surface
XORMTable Database table representation
XORMField Table column/field definition
XORMPKField Primary key field definition
XORMReference Table relationship/foreign key
XORMController ORM operations controller
XORMValidator ORM model validation

Key Design Patterns

Reactive Property System

TFX uses a sophisticated property system inspired by WPF/XAML:

// Property registration with metadata
public static readonly NameProp = XProperty.Register<XORMTable, string>(
    (p: XORMTable) => p.Name,
    "guid-here",
    "Name",
    "Table Name",
    ""
);

// Property access via GetValue/SetValue
public get Name(): string {
    return this.GetValue(XORMTable.NameProp) as string;
}

public set Name(pValue: string) {
    this.SetValue(XORMTable.NameProp, pValue);
}

Hierarchical Element Model

All elements inherit from XElement, providing:

  • Parent-child navigation (ParentNode, ChildNodes)
  • Type-safe child queries (GetChild<T>, GetChildDeep<T>)
  • Tree traversal (GetTree())
  • Identity management (ID, Name)

Change Tracking

Built-in undo/redo support through XChangeTracker:

  • Automatic property change recording
  • Transaction grouping
  • State restoration

Validation Framework

Declarative validation with XDataValidateError:

  • Severity levels: Warning, Error
  • Property-specific error binding
  • Aggregated error collection via XConcurrentBag

Usage

import { XORMDocument, XORMTable, XORMField } from "@tootega/tfx/Designers";
import { XSerializationEngine } from "@tootega/tfx/Data";

// Create a new ORM document
const doc = new XORMDocument();
const table = new XORMTable();
table.Name = "Customers";
doc.Design?.AppendChild(table);

// Serialize to XML
const engine = XSerializationEngine.Instance;
const result = engine.Serialize(doc);

πŸ“œ Code Quality Standards

This project follows strict coding standards defined in .github/copilot-instructions.md.

Quality Pillars (Priority Order)

  1. πŸ”’ Secure β€” Protection against common attacks
  2. βœ… Correct β€” Bug-free, sound logic
  3. ⚑ Performant β€” Minimal memory allocation (zero-allocation mindset)
  4. πŸ“– Clear β€” Self-documenting code (no comments needed)
  5. 🎯 Consistent β€” Uniform style across the codebase
  6. ✨ Elegant β€” Aesthetically pleasing, easy to navigate
  7. πŸ”§ Maintainable β€” Easy to modify and extend
  8. πŸ§ͺ Testable β€” Designed for automated testing

Naming Conventions

Element Convention Example
Classes/Types PascalCase with X prefix XUserService, XORMTable
Interfaces XI prefix + PascalCase XIRepository, XISerializable
Methods/Properties PascalCase GetById, SaveChanges
Private Fields _ prefix + PascalCase _Cache, _Repository
Parameters p prefix + PascalCase pUserID, pOptions
Local Variables Lowercase mnemonics lstua, frsrt

Code Style Rules

  • βœ… One type per file
  • βœ… No braces for single-line blocks
  • βœ… Early returns (guard clauses)
  • βœ… No comments (self-documenting code)
  • βœ… Avoid lambdas in hot paths
  • βœ… Prefer explicit loops over LINQ
  • βœ… Use sealed classes when inheritance not needed

πŸ—οΈ Development Guide

Prerequisites

  • Node.js 20+
  • VS Code (latest)
  • TypeScript 5.3+

TFX Development

# Navigate to TFX directory
cd TFX

# Install dependencies
npm install

# Build the framework
npm run build

# Run tests
npm run test

# Run tests with coverage
npm run test:coverage

# Watch mode for development
npm run test:watch

TFX Scripts:

Script Description
npm run build Compile TypeScript to JavaScript (dist/)
npm run watch Watch mode compilation
npm run test Run all unit tests with Vitest
npm run test:coverage Generate coverage report (100% required)
npm run test:watch Interactive watch mode for tests
npm run clean Remove build artifacts (dist/)
npm run lint Run ESLint checks

DASE Extension Development

# Navigate to DASE directory
cd DASE

# Install dependencies (includes local TFX)
npm install

# Build the extension
npm run compile

# Run tests
npm run test

# Run tests with coverage
npm run test:coverage

# Launch extension in VS Code
# Press F5 in VS Code, or:
code --extensionDevelopmentPath=./DASE

DASE Scripts:

Script Description
npm run compile Compile TypeScript to JavaScript (out/)
npm run watch Watch mode compilation
npm run test Run all unit tests with Jest
npm run test:coverage Generate coverage report (100% required)
npm run lint Run ESLint checks
npm run package Create VSIX extension package

Running Both Projects

# From repository root, build everything
cd TFX
npm ci
npm run build

cd ../DASE
npm ci
npm run compile

# Run all tests
cd ../TFX && npm run test:coverage
cd ../DASE && npm run test:coverage

πŸš€ CI/CD Pipeline

The repository uses a single unified CI/CD workflow that builds and tests both components:

TFX Framework

Workflow: .github/workflows/ci.yml

Triggers:

  • Push to master branch (TFX/** changes)
  • Pull requests to master branch

Pipeline Stages:

  1. Checkout β€” Clone repository
  2. Setup Node.js 20 β€” Configure Node.js environment
  3. Install Dependencies β€” Run npm ci in TFX/
  4. Build β€” Compile TypeScript (npm run build)
  5. Test β€” Execute test suite with Vitest
  6. Coverage β€” Generate and validate 100% coverage
  7. Upload Reports β€” Publish coverage artifacts

Quality Gates:

  • βœ… All automated tests must pass
  • βœ… 100% code coverage required
  • βœ… No TypeScript compilation errors
  • βœ… Zero-allocation patterns enforced

DASE Extension

Workflow: .github/workflows/ci.yml

Triggers:

  • Push to master branch (DASE/** or TFX/** changes)
  • Pull requests to master branch

Pipeline Stages:

  1. Checkout β€” Clone repository
  2. Setup Node.js 20 β€” Configure Node.js environment
  3. Build TFX β€” Build framework dependency
  4. Test TFX β€” Validate framework integrity
  5. Install DASE Dependencies β€” Run npm ci in DASE/
  6. Build DASE β€” Compile extension (npm run compile)
  7. Lint β€” Run ESLint checks
  8. Test β€” Execute test suite with Jest
  9. Coverage β€” Generate and validate 100% coverage
  10. Upload Reports β€” Publish coverage artifacts
  11. Package (master only) β€” Create VSIX extension package

Quality Gates:

  • βœ… All automated tests must pass
  • βœ… 100% code coverage required
  • βœ… No TypeScript/ESLint violations
  • βœ… TFX dependency integrity validated
  • βœ… VSIX package builds successfully

Artifacts:

  • Coverage reports (both TFX and DASE)
  • VSIX extension package (master branch only)

πŸ“„ License

MIT License β€” See LICENSE for details.


Built entirely through AI-driven development with GitHub Copilot
πŸ€– No human wrote this code directly β€” only prompts πŸ€–

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •