Skip to content

feat(plugin): v0.7.0 Plugin Adapter - All Tests Passing#3

Merged
Steffen025 merged 2 commits intomainfrom
feature/v0.7-plugin-adapter
Jan 18, 2026
Merged

feat(plugin): v0.7.0 Plugin Adapter - All Tests Passing#3
Steffen025 merged 2 commits intomainfrom
feature/v0.7-plugin-adapter

Conversation

@Steffen025
Copy link
Owner

@Steffen025 Steffen025 commented Jan 18, 2026

Summary

This PR completes the v0.7.0 Plugin Adapter milestone with all 4 tests passing:

Test Status
Plugin Load ✅ PASS
Context Injection ✅ PASS
Security Blocking ✅ PASS
Logging ✅ PASS

What's New

  • Security Blocking: Dangerous commands like rm -rf ../ are now blocked
  • Context Injection: CORE skill automatically injected at session start
  • TUI-Safe Logging: All logs go to /tmp/pai-opencode-debug.log
  • OpenCode API Documentation: Key discoveries documented for future reference

Key Technical Discoveries

// OpenCode API quirk: Args are in OUTPUT, not input!
"tool.execute.before": async (input, output) => {
  const command = output.args.command; // ← NOT input.args!
  if (dangerous(command)) {
    throw new Error("Blocked!"); // ← This stops execution
  }
}

Files Changed

  • pai-unified.ts - Use output.args for tool arguments
  • security-validator.ts - Case-insensitive matching, defensive null checks
  • types.ts - Fixed regex patterns for parent traversal
  • TEST-RESULTS-v0.7.md - Comprehensive test documentation
  • README.md - Updated to v0.7.0
  • CHANGELOG.md - Full v0.7.0 release notes
  • v0.7-plugin-adapter.png - Celebration graphic

Next Steps

v0.8 Converter Tool is next - enabling automatic PAI→OpenCode translation.


🤖 Generated with Claude Code

Steffen Zellmer and others added 2 commits January 18, 2026 12:39
…lation

## Summary

Implements unified plugin architecture that translates PAI hooks to OpenCode
plugin API, enabling automatic PAI pack installation in OpenCode.

## Key Changes

- pai-unified.ts: Single unified plugin combining all PAI hook functionality
- file-logger.ts: TUI-safe file-only logging (fixes TUI corruption)
- context-loader.ts: Loads CORE skill context for chat injection
- security-validator.ts: Security validation with block/confirm/allow
- types.ts: Shared TypeScript interfaces for plugin handlers
- tsconfig.json: TypeScript configuration for plugin development

## Hook Mappings

| PAI Hook | OpenCode Plugin Hook |
|----------|---------------------|
| SessionStart | experimental.chat.system.transform |
| PreToolUse exit(2) | permission.ask |
| PreToolUse | tool.execute.before |
| PostToolUse | tool.execute.after |
| Stop | event |

## Deprecated

- Moved old plugins to plugin/_deprecated/

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
## What's New
- Security blocking via tool.execute.before + throw Error
- Context injection via experimental.chat.system.transform
- TUI-safe file-only logging to /tmp/pai-opencode-debug.log
- All 4 tests passing (Plugin Load, Context Injection, Security Blocking, Logging)

## Key Discoveries (OpenCode API)
- Args are in output.args, NOT input.args
- Throw Error to block commands (not permission.ask)
- Tool names are lowercase (bash, not Bash)

## Files Changed
- pai-unified.ts: Use output.args for tool arguments
- security-validator.ts: Case-insensitive matching, defensive null checks
- types.ts: Fixed regex patterns for parent traversal
- TEST-RESULTS-v0.7.md: Comprehensive test documentation
- README.md: Updated to v0.7.0
- CHANGELOG.md: Full v0.7.0 release notes
- v0.7-plugin-adapter.png: Celebration graphic

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Steffen025 Steffen025 changed the title feat(plugin): v0.7.0 Plugin Adapter Foundation feat(plugin): v0.7.0 Plugin Adapter - All Tests Passing Jan 18, 2026
@Steffen025 Steffen025 merged commit 7dd5028 into main Jan 18, 2026
@Steffen025 Steffen025 deleted the feature/v0.7-plugin-adapter branch January 18, 2026 21:54
Steffen025 pushed a commit that referenced this pull request Jan 23, 2026
CRITICAL ISSUES FIXED:
- #1: Created Art/EXTEND.yaml manifest for skill customizations
- #2: Fixed settings.json → opencode.json refs in CORE/SKILL.md (3x)
- #3: Disabled PaiArchitecture.ts refs in UpdateDocumentation.md
- #3b: Marked Headshot.ts as NOT IMPLEMENTED in YouTube workflow
- #4: Created PAISECURITYSYSTEM/ with patterns.example.yaml
- #5: Marked SkillSearch() as FUTURE FEATURE in SkillSystem.md
- #6: Fixed BACKUPS location refs (MEMORY/Backups → ~/.opencode/BACKUPS/)

MEDIUM WARNINGS FIXED:
- W3: Clarified Notification System docs (Voice only, ntfy/Discord planned)
- W11: Fixed context-loader.ts TELOS paths (removed non-existent files)
- W14: Removed DocumentChanges.md refs (GitPush, WorkContextRecall)

Files changed: 12 (10 modified, 2 new)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Steffen025 added a commit that referenced this pull request Mar 5, 2026
Consolidates remaining work into 2 substantive PRs:
- PR #3 (WP5): Algorithm v3.7.0 & Core System (~2000 lines, 25 files)
- PR #4 (WP6): Installer, Migration & Release (~800 lines, 20 files)

Recommend merging PR #40 as 'WP4 Complete' containing all
integration work (Phases 1-3 combined).

Total: 4 PRs for entire v3.0 (not 8+)

Related: WP4 consolidation, PR strategy
Steffen025 added a commit that referenced this pull request Mar 5, 2026
ValidateSkillStructure.ts:
- Fix body length check: measure only body (excluding frontmatter), not entire file
- Fix YAML regex: allow hyphens in field names ([0-9A-Za-z_-]+)
- Preserve indentation for literal blocks (|): use rawDesc.replace(/\n$/, '')

GenerateSkillIndex.ts:
- Add warning for deep nesting (>3 parts)
- Fix YAML regex: allow hyphens in field names
- Preserve indentation for literal blocks

OPTIMIZED-PR-PLAN.md:
- Fix grammar: 'statt 1 substantiellem' → 'statt einem substanziellen PR'
- Add collapsible Mermaid diagram showing PR #3 → PR #4 dependencies
leppikallio pushed a commit to leppikallio/pai-opencode that referenced this pull request Mar 6, 2026
* feat(plugin): Add Plugin Adapter Foundation for PAI-to-OpenCode translation

## Summary

Implements unified plugin architecture that translates PAI hooks to OpenCode
plugin API, enabling automatic PAI pack installation in OpenCode.

## Key Changes

- pai-unified.ts: Single unified plugin combining all PAI hook functionality
- file-logger.ts: TUI-safe file-only logging (fixes TUI corruption)
- context-loader.ts: Loads CORE skill context for chat injection
- security-validator.ts: Security validation with block/confirm/allow
- types.ts: Shared TypeScript interfaces for plugin handlers
- tsconfig.json: TypeScript configuration for plugin development

## Hook Mappings

| PAI Hook | OpenCode Plugin Hook |
|----------|---------------------|
| SessionStart | experimental.chat.system.transform |
| PreToolUse exit(2) | permission.ask |
| PreToolUse | tool.execute.before |
| PostToolUse | tool.execute.after |
| Stop | event |

## Deprecated

- Moved old plugins to plugin/_deprecated/

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(plugin): Complete v0.7.0 Plugin Adapter with all tests passing

## What's New
- Security blocking via tool.execute.before + throw Error
- Context injection via experimental.chat.system.transform
- TUI-safe file-only logging to /tmp/pai-opencode-debug.log
- All 4 tests passing (Plugin Load, Context Injection, Security Blocking, Logging)

## Key Discoveries (OpenCode API)
- Args are in output.args, NOT input.args
- Throw Error to block commands (not permission.ask)
- Tool names are lowercase (bash, not Bash)

## Files Changed
- pai-unified.ts: Use output.args for tool arguments
- security-validator.ts: Case-insensitive matching, defensive null checks
- types.ts: Fixed regex patterns for parent traversal
- TEST-RESULTS-v0.7.md: Comprehensive test documentation
- README.md: Updated to v0.7.0
- CHANGELOG.md: Full v0.7.0 release notes
- v0.7-plugin-adapter.png: Celebration graphic

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Steffen Zellmer <steffen@MacBook-Pro-von-Steffen.fritz.box>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Steffen Zellmer <steffen@MacBookPro.fritz.box>
leppikallio pushed a commit to leppikallio/pai-opencode that referenced this pull request Mar 6, 2026
CRITICAL ISSUES FIXED:
- Steffen025#1: Created Art/EXTEND.yaml manifest for skill customizations
- Steffen025#2: Fixed settings.json → opencode.json refs in CORE/SKILL.md (3x)
- Steffen025#3: Disabled PaiArchitecture.ts refs in UpdateDocumentation.md
- #3b: Marked Headshot.ts as NOT IMPLEMENTED in YouTube workflow
- Steffen025#4: Created PAISECURITYSYSTEM/ with patterns.example.yaml
- Steffen025#5: Marked SkillSearch() as FUTURE FEATURE in SkillSystem.md
- Steffen025#6: Fixed BACKUPS location refs (MEMORY/Backups → ~/.opencode/BACKUPS/)

MEDIUM WARNINGS FIXED:
- W3: Clarified Notification System docs (Voice only, ntfy/Discord planned)
- W11: Fixed context-loader.ts TELOS paths (removed non-existent files)
- W14: Removed DocumentChanges.md refs (GitPush, WorkContextRecall)

Files changed: 12 (10 modified, 2 new)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant