Commit Graph

7 Commits

Author SHA1 Message Date
ANGX 5860a45fe5 feat: Comprehensive PCL enhancements - Providers, LSP, Skills, and MCP (#20)
* feat: Add comprehensive skill system, MCP integration, and enhanced provider support

Core Features Added:
- Skill system with compiler, resolver, merger, and runtime integration
- MCP (Model Context Protocol) client/server implementation with stdio and HTTP-SSE transports
- Enhanced provider system with Azure, Bedrock, DeepSeek, Gemini, and Ollama support
- Cost tracking and rate limiting capabilities
- Health monitoring for providers
- Fallback provider chain support
- Shell completion support for CLI

New Files:
- src/skills/: Complete skill system implementation
  - skill-compiler.ts: Compiles PCL skills into executable format
  - skill-resolver.ts: Resolves skill dependencies and references
  - skill-merger.ts: Merges skills with conflict resolution
  - skill-context.ts: Manages skill execution context
  - prompt-integration.ts: Integrates skills into prompts
  - runtime-integration.ts: Runtime execution support

- src/mcp/: Full MCP protocol implementation
  - client/: MCP client with connection management
  - server/: PCL MCP server implementation
  - transports/: stdio and HTTP-SSE transport layers
  - types/: JSON-RPC and MCP type definitions

- src/runtime/providers/: Enhanced provider implementations
  - azure.ts: Azure OpenAI provider
  - bedrock.ts: AWS Bedrock provider
  - deepseek.ts: DeepSeek provider
  - gemini.ts: Google Gemini provider
  - ollama.ts: Ollama local models provider
  - cost-tracker.ts: Track API costs across providers
  - rate-limiter.ts: Rate limiting implementation
  - health.ts: Provider health monitoring
  - fallback.ts: Automatic fallback chain

- src/formatter/: Code formatting utilities
- src/cli/commands/completion.ts: Shell completion generation
- docs/SKILL_RUNTIME.md: Skill system documentation
- docs/mcp/: MCP integration guides
- docs/providers/: Provider setup and troubleshooting guides

Modified Files:
- README.md: Updated with new features and capabilities
- package.json: Added dependencies for MCP, new providers
- package-lock.json: Updated lockfile with new dependencies
- src/index.ts: Export new modules (skills, MCP, formatter)
- src/cli/index.ts: Add completion command and enhance CLI
- src/runtime/providers/index.ts: Refactor provider registry
- docs/README.md: Add links to new documentation

Removed Files:
- docs/api/PARSER-ENHANCEMENT-SUMMARY.md: Consolidated into other docs
- docs/api/PARSER-ENHANCEMENTS.md: Consolidated into other docs

Tests Added:
- tests/skills/: Comprehensive skill system tests
  - skill-compiler.test.ts
  - skill-integration.test.ts
  - skill-merger.test.ts
- tests/providers/registry-enhancements.test.ts

Configuration Updates:
- .claude/CLAUDE.md: Updated configuration
- .github/dependabot.yml: Enhanced dependency management

This is a major feature release that significantly expands PCL capabilities with:
1. Enterprise-grade skill management system
2. MCP protocol support for AI tool integration
3. Multi-provider support with intelligent fallback
4. Production-ready monitoring and cost tracking
5. Enhanced developer experience with shell completions

* feat: Add CLI skill management commands and registry integration

New CLI Commands (src/cli/commands/skills/):
- bundle.ts: Bundle skills for distribution
- compile.ts: Compile individual skills
- create.ts: Create new skill from template
- info.ts: Display detailed skill information
- install.ts: Install skills from registry
- list.ts: List installed and available skills
- optimize.ts: Optimize skill performance
- publish.ts: Publish skills to registry
- search.ts: Search skill marketplace
- test.ts: Test skill functionality
- trending.ts: Show trending skills
- validate.ts: Validate skill definitions

Registry Extensions (src/registry/):
- skill-metadata.ts: Skill metadata management and validation
- skill-registry.ts: Enhanced registry with skill-specific operations

These commands provide a complete skill lifecycle management experience:
- Discovery: search, trending, list
- Development: create, compile, validate, test, optimize
- Distribution: bundle, publish, install
- Information: info

Integration with existing registry system for seamless skill management.

* feat: Add comprehensive provider system, LSP enhancements, registry extensions, and tooling

Major Features:

1. Provider System Enhancements (src/providers/):
   - Base provider abstraction with common functionality
   - 10 AI provider integrations:
     * Anthropic (Claude)
     * OpenAI (GPT)
     * Google (Gemini)
     * DeepSeek
     * Ollama (local models)
     * Groq
     * Cohere
     * Mistral
     * Azure OpenAI (existing)
     * AWS Bedrock (existing)
   - Provider registry with auto-discovery
   - Unified provider interface
   - Provider adapter for runtime integration
   - Integrated providers configuration

2. LSP (Language Server Protocol) Enhancements (src/lsp/):
   - Skill-aware code completions
   - Skill-specific diagnostics
   - Hover information for skills
   - Skill navigation (go to definition)
   - Skill integration with existing LSP features
   - Code actions support
   - Rename refactoring support

3. Registry System Extensions (src/registry/):
   - Cache Layer:
     * Memory cache implementation
     * Redis cache adapter
     * Multi-layer cache with fallback
   - Search Integration:
     * Elasticsearch integration for skill search
   - Version Management:
     * Semantic versioning manager
     * Version constraint resolution

4. CLI Enhancements (src/cli/commands/skills/):
   - lint: Lint skill definitions
   - wizard: Interactive skill creation wizard

5. Documentation:
   - AI_PLATFORM_INTEGRATION.md: Platform integration guide
   - MCP_INTEGRATION_GUIDE.md: Complete MCP integration documentation
   - PROVIDERS.md: Provider system documentation
   - SKILL-AUTHORING-GUIDE.md: Comprehensive skill authoring guide
   - SKILL-COMPOSITION-PATTERNS.md: Patterns for skill composition
   - SKILL-MARKETPLACE-GUIDELINES.md: Guidelines for skill marketplace

6. Examples:
   - openapi-spec.yaml: OpenAPI specification example
   - rest-api-wrapper.ts: REST API wrapper pattern
   - runtime-providers.ts: Provider configuration examples
   - workflows/advanced-operators.pcl: Advanced workflow operators demo

7. Claude Code Integration:
   - 4 specialized AI agents (.claude/agents/):
     * documentation-specialist.md
     * qa-testing-expert.md
     * security-analyst.md
     * software-architect.md

8. Configuration:
   - .vscodeignore: VS Code extension packaging configuration

9. Core Module Updates:
   - src/ast/index.ts: Enhanced AST exports
   - src/index.ts: Export new modules (providers, LSP)
   - src/types/index.ts: Additional type definitions
   - src/registry/index.ts: Export cache and search modules
   - src/registry/interfaces.ts: Enhanced registry interfaces
   - src/mcp/*: MCP server refinements
   - src/parser/index.ts: Parser improvements
   - src/runtime/providers/index.ts: Runtime provider integration

10. Comprehensive Testing:
    - tests/lsp/: LSP feature tests (6 test files)
    - tests/mcp/: MCP server tests
    - tests/parser/: Advanced workflow operator tests
    - tests/providers/: Provider system tests
    - tests/registry/: Cache and version management tests

This release establishes PCL as a comprehensive AI persona management platform with:
- Multi-provider AI model support (10+ providers)
- Production-ready LSP with skill intelligence
- Scalable registry with caching and search
- Rich developer tooling and documentation
- Extensible architecture for future growth
2026-01-23 04:29:29 +01:00
ANGX a34989f81c feat: implement Phase 1.2 multi-backend registry system
Implements a production-ready, enterprise-grade registry system for
managing AI personas, teams, workflows, and skills across multiple
storage backends.

## Phase 1.2A: Core Interfaces & Memory Backend (Days 1-5)

### Core Architecture
- Add registry interfaces (IBackend, ICache, ISearchEngine, IRegistry)
- Implement comprehensive error hierarchy (11 specialized error classes)
- Create type system with Artifact, Query, Version, Transaction types
- Add Result<T> error handling pattern for type safety

### Memory Backend
- Implement in-memory HashMap backend for testing/development
- Add full CRUD operations with soft delete support
- Implement version history tracking and management
- Add transaction simulation with rollback support
- Include 70+ test cases with 100% coverage

### Registry Manager
- Create high-level RegistryManager API wrapping backends
- Implement automatic slug generation (URL-friendly identifiers)
- Add comprehensive validation (semver, email, slug, tags)
- Integrate optional caching layer with TTL support
- Include 70+ test cases for validation and operations

## Phase 1.2B: Database Backends (Days 6-10)

### PostgreSQL Backend
- Implement production-grade relational database backend
- Create complete schema with 9 tables and 20+ optimized indexes
- Add database triggers for updated_at and version snapshots
- Implement stored procedures for atomic counter updates
- Add connection pooling (max 20 connections, configurable)
- Include prepared statements and ACID transaction support
- Implement trigram-based full-text search (pg_trgm extension)
- Provide migration scripts (450+ lines SQL)

### SQLite Backend
- Implement lightweight file-based backend for local/embedded apps
- Create schema with FTS5 virtual table for full-text search
- Enable WAL mode for better concurrency
- Add automatic triggers for FTS synchronization
- Implement prepared statement caching for performance
- Support both file-based and in-memory (:memory:) modes
- Include transaction support (BEGIN IMMEDIATE)
- Provide migration scripts (350+ lines SQL)

## Documentation

### API Documentation
- Add REGISTRY-SYSTEM.md (500+ lines) covering architecture
- Document all backends with comparison and use cases
- Include type system reference and API examples
- Provide migration scripts and deployment guides

### Usage Guide
- Add REGISTRY-USAGE.md (600+ lines) with 8 complete examples
- Cover backend selection, CRUD operations, versioning
- Include error handling patterns and best practices
- Provide troubleshooting guide and performance tips

### Examples
- Create registry-demo.ts (200+ lines) working demonstration
- Show all major features: CRUD, search, versioning, stats
- Demonstrate slug generation and validation errors
- Include setup and teardown patterns

## Governance & Standards (Parallel Work)

- Add comprehensive governance documentation (GOVERNANCE/)
- Create Apache 2.0 compliance documents
- Add security model and trademark policy
- Implement PCL specification v1 (SPEC/)

## Statistics

- Files created: 35 (implementation, tests, docs, migrations)
- Code written: ~3,500 lines (implementation)
- Tests created: 140+ test cases across 2 test suites
- Documentation: 1,600+ lines across 3 comprehensive guides
- Migration scripts: 800+ lines SQL for PostgreSQL and SQLite
- Total output: 6,450+ lines of production-ready code

## Technical Highlights

- Multi-backend architecture with pluggable storage
- Result<T> error handling pattern from Rust
- ACID transactions across all backends
- Full-text search (FTS5, trigram matching)
- Semantic versioning with history tracking
- Soft delete pattern with recovery capability
- Connection pooling and prepared statements
- Automatic slug generation and validation
- Type-safe operations with TypeScript strict mode

## Testing

- Memory backend: 70+ test cases (100% coverage)
- Registry Manager: 70+ test cases (validation, CRUD, queries)
- All tests passing with zero errors
- Integration tests deferred to future release

## Next Steps

Phase 1.2C-D features deferred to future releases:
- MongoDB backend implementation
- Redis caching layer
- Elasticsearch integration
- RBAC security features
- PCLPack import/export format

Ready for Phase 1.3 (CLI) or Phase 2 (Ecosystem tooling).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-17 22:52:58 +01:00
ANGX b49437b64d docs: add comprehensive tutorials and reference documentation
Tutorials (Phase 1.1D):
- Tutorial 1: Your First Persona (525 lines)
- Tutorial 2: Teams (518 lines)
- Tutorial 3: Workflows (603 lines)

Examples:
- provider-integration-example.mjs
- workflow-enhancements-example.mjs

Reference:
- docs/reference/SYNTAX.md (695 lines)
- src/grammar/pcl.ebnf (1,058 lines)

Completes Phase 1.1D with 20+ working examples
2026-01-17 06:31:04 +01:00
ANGX fb8288d2e8 feat: implement Phase 1.0D workflow validation tests
Created comprehensive test suite for workflow validation features:

- 10/10 tests passing for implemented workflow validations
- Tests for unreachable code detection in conditionals
- Tests for parallel branch count limits
- Tests for complex workflow structures

Key additions:
- Fixed ParenthesizedExpression handling in evaluateConstantCondition()
- Created workflow-validation-core.test.mjs with 10 passing tests
- Tests verify rich error messages include suggestions

Test coverage:
✓ Unreachable else branch detection (condition always true)
✓ Unreachable then branch detection (condition always false)
✓ Dynamic conditions allowed without warnings
✓ Boolean expression constant evaluation
✓ Negation operator constant evaluation
✓ Parallel branch count warnings (>10 branches)
✓ No warnings for reasonable parallel branches (≤10)
✓ Nested grouped workflow validation
✓ Sequential then parallel workflow validation
✓ Choice workflow validation

Note: Loop validation tests deferred (awaiting parser implementation)

All workflow validation tests pass with proper error messages and suggestions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-17 05:35:38 +01:00
ANGX 07949936fa fix: resolve vitest test infrastructure and enable Phase 1.0 validation tests
This commit resolves the pre-existing vitest test collection issue and enables
execution of Phase 1.0 team validation tests.

Changes:
- Enhanced vitest.config.ts with proper path resolution and esbuild config
- Created tsconfig.test.json for test-specific TypeScript configuration
- Converted team-validation tests to .mjs format (more reliable than vitest+TS)
- Updated tests to use compile() instead of parse() for full semantic analysis
- Created VITEST-ISSUE-RESOLUTION.md documenting the fix

Test Results:
- 13/15 Phase 1.0A team validation tests passing (87% pass rate)
- All core validation features working:
  ✓ Duplicate member detection (3/3)
  ✓ Primary persona validation (2/2)
  ✓ Quorum consistency checks (4/4)
  ✓ Conflict order validation (3/3)
  ✓ Nested teams validation (1/1)

Known Issues:
- 2 circular reference detection tests fail (edge case, low priority)
- Vitest 1.6.1 incompatible with Node v25.2.1 + TypeScript ESM

Workaround: Use .mjs test format which is proven reliable.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-17 05:00:15 +01:00
ANGX c5ea2fbae2 docs: Add comprehensive parser enhancement architecture documentation
Add detailed architectural documentation for Phase 1.0 Parser Enhancements
planning and design.

Documentation Added:
- docs/api/PARSER-ENHANCEMENTS.md (32KB) - Complete architectural blueprint
- docs/api/PARSER-ENHANCEMENT-SUMMARY.md (20KB) - Executive summary
- docs/api/PARSER-QUICK-REFERENCE.md (15KB) - Quick reference guide

Content Coverage:
- System architecture and design patterns
- Team declaration enhancements (5 features)
- Workflow validation strategies (4 features)
- Skill declaration improvements (deferred)
- Error recovery mechanisms
- Performance optimization approaches
- Testing and validation strategies
- Implementation roadmap

Architecture Diagrams:
- System context diagrams
- Component architecture
- Data flow diagrams
- Error recovery flow
- Validation pipeline

Design Decisions:
- Three-pass semantic analysis
- Progressive validation approach
- Backward compatibility guarantees
- Performance vs accuracy tradeoffs

These documents guided the Phase 1.0 implementation and serve as
reference for future parser development.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-17 03:05:33 +01:00
ANGX 6794adf3dc feat: Complete Phase 2 Module Visibility implementation with comprehensive tests
🎯 Phase 2: Module Visibility - COMPLETE WITH TESTS

✅ Core Implementation:
- Implement module boundary tracking with ModuleInfo interface
- Add pub/private visibility modifiers for symbols
- Create cross-module access control and validation
- Add export validation with warnings for private symbols
- Implement import tracking for named, default, and wildcard imports

✅ Comprehensive Test Suite (26 tests):
- Module context tracking and backward compatibility
- Visibility modifier parsing (pub/priv/default private)
- Same-module access control for private symbols
- Export validation and private symbol warnings
- Import tracking across different import types
- Cross-module access control enforcement
- Complex scenarios with mixed visibility
- Error message validation
- Edge cases (empty modules, circular imports)
- Backward compatibility verification

✅ Bug Fixes:
- Fix parser crash on empty PCL files (span calculation)
- Add missing visibility fields to all symbol definitions
- Correct private export warning logic in validateExports
- Fix Result<T,E> pattern usage in tests

✅ Documentation & Infrastructure:
- Update progress tracking and status files
- Add comprehensive API documentation
- Create test utilities for constraint validation, mermaid generation
- Add runtime provider infrastructure
- Update README and getting started guides

✅ Testing Results:
- Phase 2 tests: 26/26 ✅ PASSING
- Runtime tests: 33/33 ✅ PASSING
- Build system: ✅ WORKING
- Backward compatibility: ✅ MAINTAINED

This completes Phase 2 (Module Visibility) with full test coverage and prepares for Phase 3 (Type Narrowing).
2026-01-16 22:56:06 +01:00