Repository navigation
feat: add scope-aware framework bootstrap #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
papastanb
wants to merge
20
commits into
main
Choose a base branch
from
feat/framework-bootstrap
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
335ecdc
feat: add scope-aware framework bootstrap
papastanb bd8ca07
fix: address review findings
papastanb 59f76bd
docs: add API docstrings
papastanb df3c97e
fix: address requested review changes
papastanb 65cac00
fix: prevent uninstall from deleting pre-existing adopted files
papastanb 70ec485
fix: address all CodeRabbit and Devin review findings
papastanb 1506280
fix: harden framework bootstrap config handling
papastanb f4717a9
docs: add framework bootstrap docstrings
papastanb 56af76c
fix: address remaining PR review findings
papastanb 99ece10
fix: align remaining PR review feedback
papastanb 3e9c6a3
fix: address remaining devin review findings
papastanb 0ba3354
fix: tighten final framework edge cases
papastanb 86340b1
fix: preserve config entries during bootstrap updates
papastanb a1bfe5f
fix: address remaining review edge cases
papastanb ccd5107
docs: add project index and roadmap ignores
papastanb e2bdd6f
fix: validate config drift and malformed bootstrap configs
papastanb 3c3ba2d
refactor: harden framework config utilities
papastanb 3298d43
fix: preserve ownership boundaries during uninstall
papastanb 44cd7c4
chore: ignore local backlog and reflection notes
papastanb cd583d7
refactor: remove dead code and unused imports
papastanb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1 @@ | ||
| import type { Plugin } from "@opencode-ai/plugin" | ||
| import { createCommandHooks } from "./super-opencode/commands.js" | ||
| import { createCompactionHooks } from "./super-opencode/compaction.js" | ||
| import { createSystemHooks } from "./super-opencode/system.js" | ||
|
|
||
| export const SuperOpenCodePlugin: Plugin = async ({ client, worktree }) => { | ||
| await client.app.log({ | ||
| body: { | ||
| service: "super-opencode", | ||
| level: "info", | ||
| message: "Super OpenCode plugin initialized", | ||
| }, | ||
| }) | ||
|
|
||
| return { | ||
| ...createSystemHooks(), | ||
| ...createCommandHooks(), | ||
| ...createCompactionHooks(worktree), | ||
| } | ||
| } | ||
| export { SuperOpenCodePlugin } from "../../src/runtime/plugin.js" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1 @@ | ||
| import { commandPersistenceHint } from './memory.js' | ||
|
|
||
| const persistenceCommands = new Set(['sc-pm', 'sc-save', 'sc-load', 'sc-reflect']) | ||
| const checkpointCommands = new Set(['sc-save', 'sc-spawn', 'sc-workflow']) | ||
|
|
||
| export const createCommandHooks = () => ({ | ||
| 'command.execute.before': async (input: { command: string; sessionID: string }, output: { parts: unknown[] }) => { | ||
| const normalized = input.command.replace(/^\//, '') | ||
|
|
||
| if (persistenceCommands.has(normalized)) { | ||
| output.parts.push({ | ||
| id: 'super-opencode-persistence-hint', | ||
| sessionID: input.sessionID, | ||
| messageID: '', | ||
| type: 'text', | ||
| text: commandPersistenceHint, | ||
| }) | ||
| } | ||
|
|
||
| if (checkpointCommands.has(normalized) && normalized !== 'sc-save') { | ||
| output.parts.push({ | ||
| id: 'super-opencode-checkpoint-hint', | ||
| sessionID: input.sessionID, | ||
| messageID: '', | ||
| type: 'text', | ||
| text: 'Consider using `/sc-save` to create a checkpoint before proceeding with long operations.', | ||
| }) | ||
| } | ||
| }, | ||
| }) | ||
| export { createCommandHooks } from "../../../src/runtime/hooks.js" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1 @@ | ||
| import { persistenceContract, autoCheckpointHint } from './memory.js' | ||
|
|
||
| export const createCompactionHooks = (worktree: string) => ({ | ||
| 'experimental.session.compacting': async (_input: unknown, output: { context: string[] }) => { | ||
| output.context.push( | ||
| [ | ||
| '## Super OpenCode Memory', | ||
| `Worktree: ${worktree}`, | ||
| autoCheckpointHint, | ||
| persistenceContract, | ||
| ].join('\n'), | ||
| ) | ||
| }, | ||
| }) | ||
| export { createCompactionHooks } from "../../../src/runtime/hooks.js" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1 @@ | ||
| export const persistenceContract = [ | ||
| 'Serena is the persistence source of truth for this project.', | ||
| 'Use Serena memory keys `pm_context`, `current_plan`, `last_session`, `next_actions`, `checkpoint`, `decision`, and `summary` when relevant.', | ||
| 'For hierarchical task tracking: plan_[timestamp], phase_[1-5], task_[phase].[number], todo_[task].[number], checkpoint_[timestamp].', | ||
| 'When Serena is unavailable, state clearly that the session is operating in degraded persistence mode.', | ||
| ].join(' ') | ||
|
|
||
| export const commandPersistenceHint = [ | ||
| 'For `/sc-pm`, `/sc-save`, `/sc-load`, and `/sc-reflect`, prefer Serena memory tools first.', | ||
| 'For complex tasks: write_memory("plan_[timestamp]", goal_statement) → write_memory("phase_X", milestone) → write_memory("task_X.Y", deliverable).', | ||
| 'Use repo files only for public, durable documentation; keep session continuity in Serena rather than committed scratch files.', | ||
| ].join(' ') | ||
|
|
||
| export const autoCheckpointHint = [ | ||
| 'Consider creating a checkpoint with `/sc-save` every 30 minutes for long operations.', | ||
| 'Use `/sc-pm` to summarize current progress before pausing.', | ||
| ].join(' ') | ||
| export { autoCheckpointHint, commandPersistenceHint, persistenceContract } from "../../../src/runtime/memory.js" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1 @@ | ||
| import { persistenceContract } from './memory.js' | ||
|
|
||
| export const createSystemHooks = () => ({ | ||
| 'experimental.chat.system.transform': async (_input: unknown, output: { system: string[] }) => { | ||
| output.system.push(persistenceContract) | ||
| }, | ||
| }) | ||
| export { createSystemHooks } from "../../../src/runtime/hooks.js" |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.