Skip to content

Latest commit

Β 

History

History
367 lines (269 loc) Β· 9.78 KB

File metadata and controls

367 lines (269 loc) Β· 9.78 KB

Contributing to PCL (Persona Control Language)

Thank you for your interest in contributing to the Persona Control Language!

πŸ“‹ Quick Links

πŸš€ Quick Start

  1. Fork the repository
  2. Clone your fork locally
  3. Install dependencies: npm install
  4. Create a branch from main
  5. Make your changes following our standards
  6. Test your changes (npm test, coverage β‰₯90%)
  7. Commit with conventional commit messages
  8. Push to your fork
  9. Open a Pull Request

πŸ—οΈ Development Setup

# Clone the repository
git clone https://github.com/personamanagementlayer/pcl.git
cd pcl

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm test

# Run linter
npm run lint

# Type check
npx tsc --noEmit

πŸ“ Conventional Commits

We use Conventional Commits:

feat: add workflow orchestration support
fix: correct parser validation logic
docs: update getting started guide
chore: update dependencies
test: add integration tests for Phase 1.2
refactor: improve state machine performance
perf: optimize snapshot serialization

Types:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation only
  • style: Code style (formatting, missing semicolons, etc.)
  • refactor: Code refactoring
  • perf: Performance improvement
  • test: Adding or updating tests
  • chore: Build process or auxiliary tool changes
  • ci: CI/CD configuration changes

πŸ§ͺ Running Tests

# Run all tests
npm test

# Run with coverage (target: β‰₯90%)
npm run test:coverage

# Run specific test file
npm test -- tests/runtime.test.ts

# Run tests in watch mode
npm run test:watch

# Run linting
npm run lint

# Fix linting issues automatically
npm run lint:fix

# Type checking
npx tsc --noEmit

# Full quality gate (before PR)
npm run lint && npm test && npm run build

πŸ›οΈ Project Structure

pcl/
β”œβ”€β”€ src/              # Source code
β”‚   β”œβ”€β”€ ast/          # Abstract Syntax Tree
β”‚   β”œβ”€β”€ lexer/        # Lexical analyzer
β”‚   β”œβ”€β”€ parser/       # Parser
β”‚   β”œβ”€β”€ semantic/     # Semantic analyzer
β”‚   β”œβ”€β”€ runtime/      # Runtime engine
β”‚   β”œβ”€β”€ codegen/      # Code generators
β”‚   └── cli/          # CLI interface
β”œβ”€β”€ tests/            # Test suites
β”‚   β”œβ”€β”€ integration/  # Integration tests
β”‚   └── benchmarks/   # Performance benchmarks
β”œβ”€β”€ docs/             # User-facing documentation
β”œβ”€β”€ examples/         # Example projects
β”œβ”€β”€ stdlib/           # Standard library (personas & skills)
└── scripts/          # Build and utility scripts

🎯 Contribution Types

πŸ› Bug Fixes

  • Include test case reproducing the bug
  • Reference issue number in commit message: fix: resolve parser issue (#123)
  • Update relevant documentation if behavior changes
  • Ensure all existing tests still pass

✨ New Features

  • Discuss first: Open an issue to discuss significant features
  • Design review: For language changes, document the design approach
  • Tests required: Include comprehensive unit and integration tests
  • Documentation: Update user guides and API documentation
  • Examples: Provide usage examples

πŸ“š Documentation

  • Documentation is licensed under CC BY 4.0 (see LICENSE-DOCS)
  • Update both user-facing docs and inline code comments
  • Include practical examples
  • Check for broken links
  • Ensure consistent formatting

πŸ§ͺ Tests

  • All new code must have tests
  • Target coverage: β‰₯90%
  • Write meaningful test descriptions
  • Include edge cases and error scenarios
  • Use descriptive test names

πŸ”’ Security

  • DO NOT open public issues for security vulnerabilities
  • Report security issues via GitHub Security Advisories
  • See SECURITY.md for reporting process
  • Include proof of concept if applicable
  • Allow time for fixes before disclosure

πŸ”’ Security & Quality Standards

All contributions MUST maintain:

  • βœ… TypeScript strict mode compliance
  • βœ… Test coverage β‰₯90%
  • βœ… No ESLint errors
  • βœ… Proper error handling
  • βœ… Input validation where applicable
  • βœ… Audit logging for security-relevant operations

πŸ“– Documentation Guidelines

Code Documentation

  • Use JSDoc for all public APIs
  • Include examples in JSDoc comments
  • Document parameters, return values, and exceptions
  • Explain the "why" not just the "what"

User Documentation

  • Write for beginners and experts
  • Include code examples
  • Use clear, concise language
  • Follow markdown best practices
  • Test all code examples

Examples

/**
 * Creates a state machine with typed states and transitions.
 *
 * @example
 * ```typescript
 * const machine = createStateMachine<{ count: number }, string>()
 *   .withInitialState('idle')
 *   .addStates('processing', 'completed')
 *   .build();
 * ```
 *
 * @returns A new state machine builder
 */
export function createStateMachine<TContext, TEvent>() {
  return new StateMachineBuilder<TContext, TEvent>();
}

🀝 Community Guidelines

Be Respectful

  • Use welcoming and inclusive language
  • Respect differing viewpoints and experiences
  • Accept constructive criticism gracefully
  • Focus on what's best for the community

Be Professional

  • Keep discussions on-topic
  • Avoid personal attacks
  • Provide constructive feedback
  • Help newcomers

Give Credit

  • Acknowledge contributions from others
  • Reference prior work
  • Cite sources

βš–οΈ Licenses

PCL uses dual licensing:

By contributing, you agree that:

  • Your code contributions will be licensed under MIT
  • Your documentation contributions will be licensed under CC BY 4.0
  • You have the right to submit the work under these licenses
  • You understand the contribution is public and preserved in version control

πŸ“‹ Pull Request Checklist

Before submitting your PR, ensure:

  • Code follows TypeScript best practices
  • Tests pass locally (npm test)
  • Test coverage β‰₯90% (npm run test:coverage)
  • Linting passes (npm run lint)
  • Type checking passes (npx tsc --noEmit)
  • Build succeeds (npm run build)
  • Documentation updated (if applicable)
  • CHANGELOG.md updated (for user-facing changes)
  • Conventional commit message format used
  • PR description clearly explains the change
  • Related issues linked

πŸ“ Pull Request Template

## Description

Brief description of the changes

## Type of Change

- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update

## Testing

Describe the tests you ran and how to reproduce them

## Checklist

- [ ] Tests pass
- [ ] Documentation updated
- [ ] CHANGELOG updated

πŸŽ“ Learning Resources

New to PCL?

Contributing to Core?

Phase 1.2 Implementation:

πŸ” Code Review Process

  1. Automated Checks: CI runs tests, linting, type checking
  2. Initial Review: Maintainer reviews for general approach
  3. Detailed Review: Line-by-line code review
  4. Revisions: Address feedback and update PR
  5. Approval: At least one maintainer approval required
  6. Merge: Squash merge to main branch

πŸ› Bug Report Guidelines

When reporting bugs, include:

  1. Environment: OS, Node version, PCL version
  2. Steps to Reproduce: Minimal reproduction steps
  3. Expected Behavior: What should happen
  4. Actual Behavior: What actually happens
  5. Code Sample: Minimal code that demonstrates the issue
  6. Logs: Relevant error messages or stack traces

πŸ’‘ Feature Request Guidelines

When requesting features:

  1. Use Case: Describe the problem you're trying to solve
  2. Proposed Solution: Suggest how it might work
  3. Alternatives: What alternatives have you considered?
  4. Context: Why is this important?
  5. Examples: Provide usage examples if possible

πŸ“ž Getting Help

🌟 Recognition

Contributors are recognized in:

  • CHANGELOG.md for their contributions
  • GitHub insights and contribution graphs
  • Project documentation (where appropriate)

πŸ“š Additional Resources


Thank you for making PCL better! πŸš€

We appreciate your contributions and look forward to reviewing your pull requests.