-
Notifications
You must be signed in to change notification settings - Fork 40
fix: remove empty tagged messages after tool drop (Issue #97) #98
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
Zireael
wants to merge
2
commits into
cortexkit:master
Choose a base branch
from
Zireael:fix/issue-97-multiplying-numbers
base: master
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.
+235
−1
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: Windows Build | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - fix/issue-97-multiplying-numbers | ||
| pull_request: | ||
| branches: | ||
| - fix/issue-97-multiplying-numbers | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| build-windows: | ||
| name: Build on Windows | ||
| runs-on: windows-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: fix/issue-97-multiplying-numbers | ||
|
|
||
| - name: Setup Bun | ||
| uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: latest | ||
|
|
||
| # better-sqlite3 uses node-gyp during install; Node on PATH helps native builds. | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "22" | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install --frozen-lockfile | ||
|
|
||
| - name: Compile packages | ||
| run: bun run build | ||
|
|
||
| - name: Package OpenCode + CLI artifact | ||
| shell: pwsh | ||
| run: ./scripts/package-windows-artifact.ps1 | ||
|
|
||
| - name: Verify artifact layout | ||
| shell: pwsh | ||
| run: | | ||
| $root = "artifact/magic-context-compiled" | ||
| $required = @( | ||
| "$root/plugin/package.json", | ||
| "$root/plugin/dist/index.js", | ||
| "$root/plugin/src/tui/index.tsx", | ||
| "$root/plugin/src/shared", | ||
| "$root/plugin/node_modules/@opencode-ai/plugin", | ||
| "$root/cli/package.json", | ||
| "$root/cli/dist/index.js", | ||
| "$root/INSTALL.md" | ||
| ) | ||
| foreach ($path in $required) { | ||
| if (-not (Test-Path $path)) { | ||
| throw "Missing required artifact path: $path" | ||
| } | ||
| } | ||
| Write-Host "Artifact verification passed." | ||
|
|
||
| - name: Upload compiled build | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: magic-context-windows-build | ||
| path: artifact/magic-context-compiled/ | ||
| retention-days: 14 | ||
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
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 |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| # Packages a portable Windows install tree for local OpenCode use. | ||
| # Output layout: | ||
| # artifact/magic-context-compiled/ | ||
| # plugin/ - OpenCode server + TUI plugin (@cortexkit/opencode-magic-context) | ||
| # cli/ - magic-context CLI | ||
| # INSTALL.md | ||
|
|
||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| $repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..") | ||
| $outRoot = Join-Path $repoRoot "artifact/magic-context-compiled" | ||
| $pluginSrc = Join-Path $repoRoot "packages/plugin" | ||
| $cliSrc = Join-Path $repoRoot "packages/cli" | ||
|
|
||
| if (-not (Test-Path (Join-Path $pluginSrc "dist/index.js"))) { | ||
| throw "packages/plugin/dist/index.js is missing. Run 'bun run build' first." | ||
| } | ||
|
|
||
| if (-not (Test-Path (Join-Path $cliSrc "dist/index.js"))) { | ||
| throw "packages/cli/dist/index.js is missing. Run 'bun run build' first." | ||
| } | ||
|
|
||
| if (Test-Path $outRoot) { | ||
| Remove-Item $outRoot -Recurse -Force | ||
| } | ||
|
|
||
| $pluginOut = Join-Path $outRoot "plugin" | ||
| $cliOut = Join-Path $outRoot "cli" | ||
| New-Item -ItemType Directory -Force -Path $pluginOut, $cliOut | Out-Null | ||
|
|
||
| function Copy-Tree { | ||
| param( | ||
| [Parameter(Mandatory = $true)][string]$Source, | ||
| [Parameter(Mandatory = $true)][string]$Destination | ||
| ) | ||
| if (-not (Test-Path $Source)) { | ||
| throw "Source path not found: $Source" | ||
| } | ||
| New-Item -ItemType Directory -Force -Path $Destination | Out-Null | ||
| Copy-Item -Path (Join-Path $Source "*") -Destination $Destination -Recurse -Force | ||
| } | ||
|
|
||
| # OpenCode plugin: dist (server) + src/tui + src/shared (TUI export) + package.json | ||
| Copy-Item (Join-Path $pluginSrc "package.json") $pluginOut -Force | ||
| Copy-Tree -Source (Join-Path $pluginSrc "dist") -Destination (Join-Path $pluginOut "dist") | ||
| Copy-Tree -Source (Join-Path $pluginSrc "src/tui") -Destination (Join-Path $pluginOut "src/tui") | ||
| Copy-Tree -Source (Join-Path $pluginSrc "src/shared") -Destination (Join-Path $pluginOut "src/shared") | ||
|
|
||
| if (Test-Path (Join-Path $pluginSrc "README.md")) { | ||
| Copy-Item (Join-Path $pluginSrc "README.md") $pluginOut -Force | ||
| } | ||
|
|
||
| # Runtime deps for dist/index.js externals and TUI TSX imports. | ||
| Push-Location $pluginOut | ||
| bun install --production | ||
| Pop-Location | ||
|
|
||
| # CLI | ||
| Copy-Item (Join-Path $cliSrc "package.json") $cliOut -Force | ||
| Copy-Tree -Source (Join-Path $cliSrc "dist") -Destination (Join-Path $cliOut "dist") | ||
| if (Test-Path (Join-Path $cliSrc "README.md")) { | ||
| Copy-Item (Join-Path $cliSrc "README.md") $cliOut -Force | ||
| } | ||
|
|
||
| Push-Location $cliOut | ||
| bun install --production | ||
| Pop-Location | ||
|
|
||
| $installDoc = @" | ||
| # Magic Context — Windows compiled install | ||
|
|
||
| Extract this folder to e.g. ``D:\Coding\_tools\magic-context-compiled``. | ||
|
|
||
| ## OpenCode config | ||
|
|
||
| **``%USERPROFILE%\.config\opencode\opencode.jsonc``** (server plugin): | ||
|
|
||
| ```jsonc | ||
| "plugin": [ | ||
| "file:///D:/Coding/_tools/magic-context-compiled/plugin/dist/index.js" | ||
| ] | ||
| ``` | ||
|
|
||
| **``%USERPROFILE%\.config\opencode\tui.jsonc``** (TUI side panel — use package directory, not dist/index.js): | ||
|
|
||
| ```jsonc | ||
| "plugin": [ | ||
| "file:///D:/Coding/_tools/magic-context-compiled/plugin" | ||
| ] | ||
| ``` | ||
|
|
||
| Do **not** point ``tui.jsonc`` at ``dist/index.js`` (that is the server export only). | ||
| Do **not** use ``dist/tui/index.js`` — the upstream build does not emit it; TUI loads ``exports["./tui"]`` → ``src/tui/index.tsx``. | ||
|
|
||
| Restart OpenCode after changing config. | ||
|
|
||
| ## CLI | ||
|
|
||
| ```powershell | ||
| bun "D:\Coding\_tools\magic-context-compiled\cli\dist\index.js" doctor | ||
| ``` | ||
|
|
||
| Or add ``cli`` to PATH and run ``magic-context doctor``. | ||
|
|
||
| ## Verify | ||
|
|
||
| - ``plugin/dist/index.js`` exists | ||
| - ``plugin/src/tui/index.tsx`` exists | ||
| - ``plugin/package.json`` exports ``./tui`` → ``./src/tui/index.tsx`` | ||
| "@ | ||
|
|
||
| Set-Content -Path (Join-Path $outRoot "INSTALL.md") -Value $installDoc -Encoding utf8 | ||
|
|
||
| Write-Host "Packaged artifact at $outRoot" |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Workflow events and checkout ref are pinned to a single feature branch, causing PR CI to test the wrong commit and becoming dead after the branch is merged.
Prompt for AI agents