Skip to content

๐Ÿค Contributing to LookAtni File Markers

Welcome to the LookAtni File Markers project! We're excited that you're interested in contributing. This guide will help you get started with contributing to our VS Code extension and documentation.

๐ŸŽฏ Ways to Contribute

๐Ÿ› Report Bugs

Help us improve by reporting bugs you encounter:

  1. Check existing issues first to avoid duplicates
  2. Use the bug report template when creating new issues
  3. Include reproduction steps and environment details
  4. Provide sample files when relevant

Bug Report Template

**Description**
A clear description of the bug.

**Steps to Reproduce**
1. Go to '...'
2. Click on '...'
3. See error

**Expected Behavior**
What you expected to happen.

**Actual Behavior**
What actually happened.

**Environment**
- OS: [e.g. Windows 10, macOS 12, Ubuntu 20.04]
- VS Code Version: [e.g. 1.80.0]
- Extension Version: [e.g. 1.0.6]

**Additional Context**
Any other relevant information.

๐Ÿ’ก Suggest Features

We welcome feature suggestions:

  1. Search existing feature requests to avoid duplicates
  2. Use the feature request template
  3. Explain the use case and business value
  4. Provide implementation ideas if you have them

Feature Request Template

**Is your feature request related to a problem?**
A clear description of the problem.

**Describe the solution you'd like**
A clear description of what you want to happen.

**Describe alternatives you've considered**
Other solutions you've considered.

**Additional context**
Any other context about the feature request.

๐Ÿ”ง Contribute Code

Getting Started

  1. Fork the repository on GitHub
  2. Clone your fork locally:

    git clone https://github.com/kubex-ecosystem/lookatni-file-markers.git
    cd lookatni-file-markers
    

  3. Install dependencies:

    npm install
    

  4. Set up development environment:

    # Start TypeScript compilation in watch mode
    npm run watch:tsc
    
    # Start esbuild bundling in watch mode
    npm run watch:esbuild
    

  5. Open in VS Code:

    code .
    

  6. Press F5 to launch Extension Development Host

Development Workflow

  1. Create a feature branch:

    git checkout -b feature/your-feature-name
    

  2. Make your changes following our coding standards

  3. Test your changes:

    # Run tests
    npm test
    
    # Test in Extension Development Host
    # Press F5 in VS Code
    

  4. Commit your changes:

    git add .
    git commit -m "feat: add your feature description"
    

  5. Push to your fork:

    git push origin feature/your-feature-name
    

  6. Create a Pull Request on GitHub

๐Ÿ“š Improve Documentation

Documentation improvements are always welcome:

  1. Fix typos and grammar errors
  2. Add missing examples and clarifications
  3. Improve existing tutorials and guides
  4. Create new tutorials for advanced features
  5. Update screenshots and visual content

Documentation Structure

docs-site/docs/
โ”œโ”€โ”€ index.md                 # Homepage
โ”œโ”€โ”€ features/               # Feature documentation
โ”œโ”€โ”€ guide/                  # User guides and tutorials
โ”œโ”€โ”€ advanced/               # Advanced topics
โ”œโ”€โ”€ about/                  # Project information
โ””โ”€โ”€ examples/               # Real-world examples

Running Documentation Locally

cd docs-site
uv run mkdocs serve

๐ŸŽจ Code Style Guide

TypeScript Guidelines

File Organization

// 1. Imports - grouped and sorted
import * as vscode from 'vscode';
import * as fs from 'fs';
import * as path from 'path';

import { ConfigManager } from '../utils/configManager';
import { Logger } from '../utils/logger';

// 2. Types and interfaces
interface MarkerOptions {
    includeMetadata: boolean;
    compressionLevel: number;
}

// 3. Constants
const DEFAULT_OPTIONS: MarkerOptions = {
    includeMetadata: true,
    compressionLevel: 1
};

// 4. Main implementation
export class MarkerGenerator {
    // Implementation
}

Naming Conventions

// Classes: PascalCase
class MarkerGenerator {}

// Functions and variables: camelCase
function generateMarkers() {}
const fileCount = 10;

// Constants: UPPER_SNAKE_CASE
const MAX_FILE_SIZE = 1024 * 1024;

// Interfaces: PascalCase with 'I' prefix (optional)
interface IMarkerConfig {}
// or simply
interface MarkerConfig {}

// Enums: PascalCase
enum FileType {
    Text,
    Binary,
    Archive
}

Function Documentation

/**
 * Generates marker files for the specified directory.
 * 
 * @param sourcePath - The path to the source directory
 * @param options - Configuration options for marker generation
 * @returns Promise that resolves to the generated marker file path
 * 
 * @example
 * ```typescript
 * const markerPath = await generateMarkers('/path/to/project', {
 *     includeMetadata: true,
 *     compressionLevel: 2
 * });
 * ```
 */
async function generateMarkers(
    sourcePath: string, 
    options: MarkerOptions
): Promise<string> {
    // Implementation
}

Error Handling

// Use specific error types
class MarkerGenerationError extends Error {
    constructor(
        message: string,
        public readonly sourcePath: string,
        public readonly originalError?: Error
    ) {
        super(message);
        this.name = 'MarkerGenerationError';
    }
}

// Handle errors gracefully
try {
    const result = await generateMarkers(sourcePath, options);
    return result;
} catch (error) {
    if (error instanceof MarkerGenerationError) {
        Logger.error(`Failed to generate markers: ${error.message}`);
        throw error;
    } else {
        Logger.error(`Unexpected error: ${error}`);
        throw new MarkerGenerationError(
            'Unexpected error during marker generation',
            sourcePath,
            error
        );
    }
}

VS Code Extension Guidelines

Command Implementation

// Command registration
export function activate(context: vscode.ExtensionContext) {
    const disposable = vscode.commands.registerCommand(
        'lookatni.generateMarkers',
        async (uri?: vscode.Uri) => {
            try {
                await generateMarkersCommand(uri);
            } catch (error) {
                vscode.window.showErrorMessage(
                    `Failed to generate markers: ${error.message}`
                );
            }
        }
    );

    context.subscriptions.push(disposable);
}

// Command implementation
async function generateMarkersCommand(uri?: vscode.Uri): Promise<void> {
    const sourcePath = uri?.fsPath || vscode.workspace.rootPath;

    if (!sourcePath) {
        throw new Error('No workspace folder selected');
    }

    // Show progress
    await vscode.window.withProgress({
        location: vscode.ProgressLocation.Notification,
        title: 'Generating markers...',
        cancellable: true
    }, async (progress, token) => {
        // Implementation with progress updates
        progress.report({ increment: 0, message: 'Scanning files...' });

        // Check for cancellation
        if (token.isCancellationRequested) {
            return;
        }

        // Continue implementation...
    });
}

Configuration Management

// Type-safe configuration access
interface ExtensionConfig {
    includeMetadata: boolean;
    compressionLevel: number;
    excludePatterns: string[];
}

function getConfiguration(): ExtensionConfig {
    const config = vscode.workspace.getConfiguration('lookatni');

    return {
        includeMetadata: config.get<boolean>('includeMetadata', true),
        compressionLevel: config.get<number>('compressionLevel', 1),
        excludePatterns: config.get<string[]>('excludePatterns', [])
    };
}

๐Ÿงช Testing Guidelines

Unit Tests

// test/unit/markerGenerator.test.ts
import * as assert from 'assert';
import { MarkerGenerator } from '../../src/utils/markerGenerator';

describe('MarkerGenerator', () => {
    let generator: MarkerGenerator;

    beforeEach(() => {
        generator = new MarkerGenerator();
    });

    it('should generate markers for simple project', async () => {
        const result = await generator.generate('/test/project');

        assert.ok(result);
        assert.ok(result.includes('// === File:'));
    });

    it('should handle binary files correctly', async () => {
        // Test implementation
    });
});

Integration Tests

// test/integration/extension.test.ts
import * as vscode from 'vscode';
import * as assert from 'assert';

describe('Extension Integration Tests', () => {
    it('should activate extension successfully', async () => {
        const extension = vscode.extensions.getExtension('rafa-mori.lookatni-file-markers');

        assert.ok(extension);
        await extension.activate();
        assert.ok(extension.isActive);
    });

    it('should register all commands', async () => {
        const commands = await vscode.commands.getCommands();

        assert.ok(commands.includes('lookatni.generateMarkers'));
        assert.ok(commands.includes('lookatni.extractFiles'));
        // ... test other commands
    });
});

Running Tests

# Run all tests
npm test

# Run specific test file
npm test -- --grep "MarkerGenerator"

# Run tests with coverage
npm run test:coverage

# Run tests in watch mode
npm run test:watch

๐Ÿ“‹ Pull Request Guidelines

Before Submitting

  1. Ensure all tests pass:

    npm test
    

  2. Check code formatting:

    npm run lint
    npm run format
    

  3. Update documentation if needed

  4. Add tests for new functionality

  5. Update changelog for significant changes

Pull Request Template

## Description
Brief description of changes made.

## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update

## Testing
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes

## Checklist
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings

Review Process

  1. Automated checks must pass (CI/CD pipeline)
  2. Code review by maintainers
  3. Testing in development environment
  4. Documentation review if applicable
  5. Final approval and merge

๐Ÿ—๏ธ Project Structure

Core Extension

src/
โ”œโ”€โ”€ extension.ts           # Main extension entry point
โ”œโ”€โ”€ commands/             # VS Code commands
โ”‚   โ”œโ”€โ”€ generateMarkers.ts
โ”‚   โ”œโ”€โ”€ extractFiles.ts
โ”‚   โ”œโ”€โ”€ validateMarkers.ts
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ utils/               # Utility modules
โ”‚   โ”œโ”€โ”€ configManager.ts
โ”‚   โ”œโ”€โ”€ logger.ts
โ”‚   โ”œโ”€โ”€ markerGenerator.ts
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ views/               # VS Code views and providers
โ”‚   โ””โ”€โ”€ explorerProvider.ts
โ””โ”€โ”€ test/                # Test files
    โ”œโ”€โ”€ unit/
    โ”œโ”€โ”€ integration/
    โ””โ”€โ”€ fixtures/

Documentation

docs-site/
โ”œโ”€โ”€ docs/                # Documentation content
โ”œโ”€โ”€ mkdocs.yml          # MkDocs configuration
โ”œโ”€โ”€ pyproject.toml      # Python dependencies
โ””โ”€โ”€ overrides/          # Custom templates and assets

Configuration Files

โ”œโ”€โ”€ package.json         # Extension manifest and dependencies
โ”œโ”€โ”€ tsconfig.json       # TypeScript configuration
โ”œโ”€โ”€ eslint.config.mjs   # ESLint configuration
โ”œโ”€โ”€ esbuild.js          # Build configuration
โ””โ”€โ”€ .github/            # GitHub workflows and templates

๐Ÿš€ Release Process

Version Numbering

We follow Semantic Versioning:

  • MAJOR.MINOR.PATCH (e.g., 1.0.6)
  • MAJOR: Breaking changes
  • MINOR: New features (backward compatible)
  • PATCH: Bug fixes (backward compatible)

Release Steps

  1. Update version in package.json
  2. Update changelog with new features and fixes
  3. Create release branch:

    git checkout -b release/v1.0.7
    

  4. Final testing and validation

  5. Create GitHub release with release notes
  6. Publish to VS Code Marketplace:
    vsce publish
    

๐Ÿค Community Guidelines

Code of Conduct

  • Be respectful and inclusive
  • Be constructive in feedback and discussions
  • Be patient with new contributors
  • Be helpful and supportive

Communication Channels

  • GitHub Issues: Bug reports and feature requests
  • GitHub Discussions: General questions and community discussion
  • Pull Request Reviews: Code-related discussions

Recognition

Contributors are recognized in:

  • Changelog: Credit for significant contributions
  • README: Contributors section
  • Release Notes: Special mentions for major contributions

๐ŸŽ“ Learning Resources

Getting Started with VS Code Extensions

TypeScript Resources

Testing Resources


Thank you for contributing to LookAtni File Markers! Your contributions help make this tool better for everyone. ๐Ÿ™