or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

build-system.mdcli-engine.mdconfiguration-management.mdindex.mdpackage-management.mdproject-management.mduser-interface.md
tile.json

project-management.mddocs/

Project Management

Project detection, configuration management, and scaffolding operations for Aurelia applications including project structure analysis and file generation.

Capabilities

Project Class

Core project management functionality for handling Aurelia project configuration and structure.

/**
 * Aurelia project representation and management
 */
class Project {
  /**
   * Establish a project from a directory by reading aurelia.json and package.json
   * @param directory - Directory path to establish project from
   * @returns Promise resolving to Project instance
   * @throws Error if aurelia.json or package.json not found
   */
  static establish(directory: string): Promise<Project>;
  
  /**
   * Initialize project with configuration
   * @param directory - Project root directory
   * @param model - Parsed aurelia.json configuration
   * @param pack - Parsed package.json configuration
   */
  constructor(directory: string, model: object, pack: object);
  
  /**
   * Commit all pending changes to the filesystem (legacy code for generators)
   * @returns Promise resolving when all changes are written
   */
  commitChanges(): Promise<void>;
  
  /**
   * Generate kebab-case filename from input name
   * @param name - Input name to convert
   * @returns Kebab-case filename
   */
  makeFileName(name: string): string;
  
  /**
   * Generate PascalCase class name from input name
   * @param name - Input name to convert
   * @returns PascalCase class name
   */
  makeClassName(name: string): string;
  
  /**
   * Generate camelCase function name from input name
   * @param name - Input name to convert
   * @returns camelCase function name
   */
  makeFunctionName(name: string): string;
  
  /**
   * Get export from module with optional named export
   * @param module - Module object
   * @param name - Optional export name
   * @returns Export value
   */
  getExport(module: object, name?: string): any;
  
  /**
   * Get generator metadata from generators directory
   * @returns Promise resolving to array of generator metadata
   */
  getGeneratorMetadata(): Promise<object[]>;
  
  /**
   * Get task metadata from tasks directory
   * @returns Promise resolving to array of task metadata
   */
  getTaskMetadata(): Promise<object[]>;
  
  /**
   * Resolve generator path by name
   * @param name - Generator name to resolve
   * @returns Promise resolving to generator file path
   * @throws Error if generator not found
   */
  resolveGenerator(name: string): Promise<string>;
  
  /**
   * Install TypeScript transpiler if project uses TypeScript
   * @returns Promise resolving when transpiler is ready
   */
  installTranspiler(): Promise<void>;
  
  /**
   * Resolve task path by name
   * @param name - Task name to resolve
   * @returns Promise resolving to task file path
   * @throws Error if task not found
   */
  resolveTask(name: string): Promise<string>;
  
  // Properties
  directory: string;
  model: object;
  package: object;
  taskDirectory: string;
  generatorDirectory: string;
  aureliaJSONPath: string;
  locations: ProjectItem[];
  root: ProjectItem;
  generators: ProjectItem;
  tasks: ProjectItem;
}

Usage Examples:

const { Project } = require("aurelia-cli");

// Establish project from current directory
try {
  const project = await Project.establish(process.cwd());
  console.log(`Project: ${project.package.name}`);
  console.log(`Directory: ${project.directory}`);
} catch (error) {
  console.log("Not an Aurelia project");
}

// Use project utilities
const project = await Project.establish("./my-aurelia-app");

// Generate names
const fileName = project.makeFileName("MyComponent"); // "my-component"
const className = project.makeClassName("my-component"); // "MyComponent"
const functionName = project.makeFunctionName("my-function"); // "myFunction"

// Get metadata
const generators = await project.getGeneratorMetadata();
const tasks = await project.getTaskMetadata();
console.log("Available generators:", generators.map(g => g.name));
console.log("Available tasks:", tasks.map(t => t.name));

// Resolve generators and tasks
const componentGenerator = await project.resolveGenerator("component");
const buildTask = await project.resolveTask("build");

ProjectItem Class

Legacy project item abstraction for handling file and directory creation during scaffolding operations.

/**
 * Project item abstraction for file/directory operations
 * Legacy code maintained for generator compatibility
 */
class ProjectItem {
  /**
   * Initialize project item
   * @param name - Item name (file or directory)
   * @param isDirectory - Whether item is a directory
   */
  constructor(name: string, isDirectory?: boolean);
  
  /**
   * Add child items to this directory
   * @param items - Child items to add
   * @returns This item for chaining
   * @throws Error if item is not a directory
   */
  add(...items: ProjectItem[]): ProjectItem;
  
  /**
   * Calculate relative path from a given location
   * @param fromLocation - Starting location
   * @returns Relative path string
   */
  calculateRelativePath(fromLocation: ProjectItem): string;
  
  /**
   * Create item on filesystem
   * @param relativeTo - Base directory for creation
   * @returns Promise resolving when item is created
   */
  create(relativeTo?: string): Promise<void>;
  
  /**
   * Set text content for file items
   * @param text - Text content to set
   * @returns This item for chaining
   */
  setText(text: string): ProjectItem;
  
  /**
   * Get text content of file item
   * @returns Text content
   */
  getText(): string;
  
  /**
   * Create a text file item
   * @param name - File name
   * @param text - File content
   * @returns New ProjectItem instance
   */
  static text(name: string, text: string): ProjectItem;
  
  /**
   * Create a directory item
   * @param path - Directory path
   * @returns New ProjectItem instance
   */
  static directory(path: string): ProjectItem;
  
  // Properties
  name: string;
  isDirectory: boolean;
  children: ProjectItem[];
  parent?: ProjectItem;
  text?: string;
}

Usage Examples:

const { ProjectItem } = require("aurelia-cli");

// Create directory structure
const srcDir = ProjectItem.directory("src");
const componentsDir = ProjectItem.directory("components");
const componentFile = ProjectItem.text("my-component.js", `
export class MyComponent {
  message = "Hello World";
}
`);

// Build structure
srcDir.add(componentsDir);
componentsDir.add(componentFile);

// Create on filesystem
await srcDir.create(process.cwd());

// Create individual files
const configFile = ProjectItem.text("config.json", JSON.stringify({
  name: "my-app",
  version: "1.0.0"
}, null, 2));

await configFile.create("./config");

Project Configuration

Project configuration is managed through aurelia.json and package.json files.

/**
 * Aurelia project configuration structure
 */
interface AureliaConfig {
  paths: {
    root: string;
    src: string;
    resources: string;
    elements: string;
    attributes: string;
    valueConverters: string;
    bindingBehaviors: string;
  };
  build: {
    targets: BuildTarget[];
    options: BuildOptions;
  };
  transpiler?: TranspilerConfig;
  markupProcessor?: MarkupProcessorConfig;
  cssProcessor?: CssProcessorConfig;
}

interface BuildTarget {
  id: string;
  displayName: string;
  output: string;
  index: string;
}

Usage Examples:

// Access project configuration
const project = await Project.establish("./my-app");

// Access aurelia.json model
console.log(project.model.paths.src); // Source directory
console.log(project.model.build.targets); // Build targets

// Access package.json
console.log(project.package.name); // Package name
console.log(project.package.version); // Package version
console.log(project.package.dependencies); // Dependencies

// Modify and save configuration
project.model.build.options.minify = true;
await project.commitChanges();

Generator System

The generator system enables code scaffolding for Aurelia components and features.

/**
 * Generator resolution and execution
 * Generators are located in aurelia_project/generators/
 */
interface Generator {
  execute(args: string[]): Promise<void>;
  // Generators can implement custom logic for file creation
}

/**
 * Available generators (typically):
 * - component: Create new component
 * - element: Create custom element
 * - attribute: Create custom attribute
 * - value-converter: Create value converter
 * - binding-behavior: Create binding behavior
 * - task: Create gulp task
 */

Usage Examples:

const project = await Project.establish("./my-app");

// Resolve and execute generator programmatically
try {
  const generatorPath = await project.resolveGenerator("component");
  const Generator = require(generatorPath);
  const generator = new Generator();
  await generator.execute(["my-new-component"]);
} catch (error) {
  console.log("Generator not found or failed");
}

// Check available generators directory
console.log(project.generatorDirectory); // "aurelia_project/generators"

Task System

Project tasks for build automation and development workflows.

/**
 * Task resolution and execution
 * Tasks are typically gulp-based and located in aurelia_project/tasks/
 */
interface Task {
  // Tasks are usually gulp task functions
  (done?: Function): void | Promise<void>;
}

/**
 * Common tasks:
 * - build: Build the application
 * - run: Start development server
 * - test: Run test suite
 * - e2e: Run end-to-end tests
 */

Usage Examples:

const project = await Project.establish("./my-app");

// Resolve task
try {
  const buildTaskPath = await project.resolveTask("build");
  const buildTask = require(buildTaskPath);
  // Task execution typically handled by CLI commands
} catch (error) {
  console.log("Task not found");
}

// Access task directory
console.log(project.taskDirectory); // "aurelia_project/tasks"