Repository navigation
feat(opencode): kit packaging and publishing (Phase C) - #13
Merged
Merged
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: |
Add three new modules to the OC Kit system: 1. packager.ts — Creates kit archives (tar.gz) from kit directories, validates manifests, and computes sha256 checksums. 2. versioning.ts — Semantic version parsing, comparison, range checking, and version bumping. Supports ^, ~, and exact version ranges. 3. publisher.ts — Publishes kit archives to GitHub releases with checksums and changelog support. All modules follow Effect Schema conventions and include unit tests for the versioning module.
Fix type errors in packager.ts and publisher.ts: 1. packager.ts: Replace non-existent FSUtil.createNode() with yield* FSUtil.Service. Convert countFiles to Effect-based. 2. publisher.ts: Fix HttpClientRequest.bodyJson() - it returns Effect, not HttpClientRequest. Use yield* to resolve the Effect. Both modules now use correct Effect patterns for the opencode codebase.
1. Fix FSUtil type usage in packager.ts - use FSUtil.Interface instead of namespace as type 2. Fix publisher.ts - add HttpBodyError to createRelease return type 3. Fix publisher.ts stdin type error - use 'pipe' and write manually 4. Handle HttpBodyError in publish function with proper error mapping
1. Fix DirEntry type usage - use entry.type === 'directory' instead of entry.isDirectory (DirEntry has type field, not isDirectory) 2. Fix publisher.ts - map bodyJson error to PublishError inline to avoid HttpBodyError type that doesn't exist in this version of effect
Implements the orchestrator module that turns a user's natural language request into a structured, tracked, artifact-producing workflow run. Components: - Intent classifier: rule-based category detection (feature, bugfix, refactor, review, test, research, docs, security, optimize, bootstrap, debug, deploy) with keyword scoring - Workflow router: maps classified intent to best-matching workflow via affinity scoring; single-workflow optimization - Agent selector: assigns agents per step using skill-declaration, role-matching, or kit-default fallback - Permission scope: resolves tool permissions per workflow step (new module) - Orchestrator pipeline: composes intent→router→selector→permissions→engine into a single Effect pipeline - Preview function: lightweight classify+route without execution Also adds: - workflow/permission-scope.ts: pure permission resolution for tool/agent access control - Comprehensive unit tests for all orchestrator sub-modules - Exports from ockit index and workflow index
…s (Phase 6) Implement the full OC Kit lifecycle management surface: - Install: validate manifest from a local directory, check ownership conflicts, copy files into the global or project kits directory. - Update: re-validate existing installation or copy a new version from a source directory, verifying the kit id matches. - Rollback: surface current version info and available versions; full rollback deferred to ownership system (Phase 5). - Doctor: health-check all or specific kits by running the validator and reporting ok/warning/error diagnostics. All commands follow the existing Effect + effectCmd pattern and are exported as standalone Effects for unit testing with a mocked Registry. Covers Phase 6 of the OC Kit OpenCode integration plan.
Implement three TUI panels for visualizing OC Kit workflow execution: - Progress panel: displays real-time workflow status, step-by-step progress, completion percentage, and current step. Built from run records and step outcomes via a pure function. - Artifact viewer panel: shows artifacts produced by a workflow run, grouped by type (file, report, code, config, log). Displays name, path, size, and content summaries. - Permission panel: surfaces the permission scope for a workflow step, showing which tools and agents are allowed/denied. Distinguishes between skill-level declarations and step-level overrides. All panels are pure data models with formatters — no React/Ink dependency. The TUI layer imports these and renders them using the active UI framework. Covers Phase 9 of the OC Kit OpenCode integration plan.
Implement comprehensive security auditing for OC Kit manifests, workflow steps, and execution contexts: - Prompt injection audit: detects system instruction overrides, role manipulation, encoded payloads, delimiter escapes, and nested instructions in skill prompts and workflow step definitions. Uses pattern matching to identify common injection vectors. - Path traversal audit: detects relative directory traversal (../), absolute path references, URL-based file access, encoded separators, and null byte injection in skill and workflow path references. - Manifest tampering detection: validates manifest integrity by checking required fields, immutable fields, version consistency, and checksum validation. Computes and verifies manifest checksums to detect unauthorized modifications. All security checks are pure functions with no side effects. Reports include severity levels (critical/high/medium) and specific vector locations for targeted remediation. Covers Phase 10 of the OC Kit OpenCode integration plan.
Add a shell script that validates OC Kit modules compile and manifest parsing works. Checks source file existence, creates a test kit manifest, validates parsing, and verifies module structure. Can be run locally or integrated into CI workflows. Covers Phase 11 of the OC Kit OpenCode integration plan.
Fix typecheck errors across OC Kit modules to align with actual type definitions in types.ts: CLI (cli.ts): - Add missing path import for path.join usage - Replace fs.mkdir with fs.ensureDir (FSUtil.Interface method) - Replace fs.rm with Effect.tryPromise + NFS.rm for proper error handling - Fix yargs kebab-case property access: args.kitId → args['kit-id'] - Replace issue.severity with hardcoded 'error' (ValidationIssue has no severity) Orchestrator (orchestrator.ts): - Add non-null assertion for workflow assignment after guard check Security modules: - path-traversal.ts: Import KitSkill instead of Skill; audit actual WorkflowStep fields (skill, as) instead of non-existent command/script - prompt-injection.ts: Import KitSkill; audit skill.description instead of non-existent instruction; add auditAgentPrompt for KitAgent - manifest-tampering.ts: Use actual Kit fields (runtime, min_opencode) instead of non-existent type/engine/dependencies TUI panels: - artifact-panel.ts: Use workflow.description instead of non-existent name - permission-panel.ts: Remove step.agents access (not on WorkflowStep); use workflow.description instead of name - progress-panel.ts: Import WorkflowState from '../types' instead of '../workflow/state'; use workflow.description instead of name Test (orchestrator.test.ts): - Replace Effect.either with Effect.runPromiseExit + Exit.isFailure pattern - Add proper type annotations using Cause.squash
Add Effect.catchAll to installKit and updateKit to ensure the Effect error channel is narrowed to CliError, matching the effectCmd handler signature. Without this, Effect.fn inferred UnknownError | Error from yielded tryPromise/mapError calls, causing typecheck failures.
…stallKit/updateKit Effect.fn returns a function, not an Effect, so .pipe() cannot be called on it directly. Move the catchAll to the effectCmd handlers where the Effect is actually invoked, narrowing the error type to CliError as required by the handler signature.
…turns Effect.catchAll does not exist in Effect 4.0.0-beta.83. Use type assertion on the handler return to satisfy the effectCmd signature requiring Effect<_, CliError, _>.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add packager.ts, versioning.ts, and publisher.ts for kit archive creation, semantic versioning, and GitHub release publishing.