Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d0e9578
feat(plugin): add HTTP handler routing
internetisalie Sep 19, 2026
904d58f
fix(plugin): harden HTTP handler routing
internetisalie Sep 19, 2026
363d929
fix(opencode): recover remote workspace sync after proxy restart
internetisalie Sep 24, 2026
1d8ef99
fix(opencode): preserve remote sync retry backoff
internetisalie Sep 24, 2026
e00c029
fix(opencode): resume persisted workspace sync on project load
internetisalie Sep 24, 2026
53f8ffe
fix(opencode): avoid replacing concurrent workspace listeners
internetisalie Sep 24, 2026
ab06172
fix(opencode): preserve connected status after losing start
internetisalie Sep 24, 2026
359fe46
ci: use GitHub runners on personal fork
internetisalie Sep 24, 2026
f605541
ci: retry Windows Bun install and stabilize subprocess test
internetisalie Sep 24, 2026
82cad0a
ci: warm ripgrep and limit Windows browser workers
internetisalie Sep 24, 2026
abc8f7f
ci: run fork tests on Linux only
internetisalie Sep 25, 2026
be51a6b
Merge pull request #1 from internetisalie/workspace-sync-recovery
internetisalie Sep 25, 2026
f66ef2f
ci: skip upstream release jobs on fork
internetisalie Sep 25, 2026
3828cc3
ci: skip upstream issue automation on fork
internetisalie Sep 25, 2026
b014c89
ci: skip upstream PR duplicate check on fork
internetisalie Sep 25, 2026
2648652
Merge pull request #6 from internetisalie/fork-ci-upstream-guards
internetisalie Sep 25, 2026
aaf1f61
chore: limit pre-push typecheck concurrency
internetisalie Sep 24, 2026
3f3c911
test(opencode): isolate subprocess PWD from checkout
internetisalie Sep 25, 2026
f28f802
Merge pull request #4 from internetisalie/limit-push-typecheck
internetisalie Sep 25, 2026
7d9f6ca
fix(project): resolve an associated directory to its project instead …
internetisalie Sep 13, 2026
108f925
fix(project): preserve project identity for associated directories
internetisalie Sep 25, 2026
92e7af0
test(opencode): cover project directory routes in HTTP exerciser
internetisalie Sep 25, 2026
09291f4
fix: preserve explicit project associations across migrations
internetisalie Sep 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/duplicate-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
check-duplicates:
if: github.event.action == 'opened'
if: github.repository == 'anomalyco/opencode' && github.event.action == 'opened'
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: read
Expand Down Expand Up @@ -140,7 +140,7 @@ jobs:
Remember: post at most ONE comment combining all findings. If everything is fine, post nothing."

recheck-compliance:
if: github.event.action == 'edited' && contains(github.event.issue.labels.*.name, 'needs:compliance')
if: github.repository == 'anomalyco/opencode' && github.event.action == 'edited' && contains(github.event.issue.labels.*.name, 'needs:compliance')
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: read
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
generate:
if: github.repository == 'anomalyco/opencode'
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nix-eval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ permissions:

jobs:
nix-eval:
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ${{ github.repository == 'internetisalie/opencode' && 'ubuntu-24.04' || 'blacksmith-4vcpu-ubuntu-2404' }}
timeout-minutes: 15
steps:
- name: Checkout repository
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
check-duplicates:
if: github.repository == 'anomalyco/opencode'
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ jobs:
- build-cli
- sign-cli-windows
- build-electron
if: always() && !failure() && !cancelled()
if: always() && github.repository == 'anomalyco/opencode' && !failure() && !cancelled()
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-github-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ permissions:

jobs:
release:
if: github.repository == 'anomalyco/opencode'
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
Expand Down
20 changes: 6 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@ env:

jobs:
unit:
name: unit (${{ matrix.settings.name }})
name: unit (${{ matrix.platform }})
strategy:
fail-fast: false
matrix:
settings:
- name: linux
host: blacksmith-4vcpu-ubuntu-2404
- name: windows
host: blacksmith-4vcpu-windows-2025
runs-on: ${{ matrix.settings.host }}
platform: ${{ fromJSON(github.repository == 'internetisalie/opencode' && '["linux"]' || '["linux","windows"]') }}
runs-on: ${{ matrix.platform == 'linux' && (github.repository == 'internetisalie/opencode' && 'ubuntu-24.04' || 'blacksmith-4vcpu-ubuntu-2404') || 'blacksmith-4vcpu-windows-2025' }}
defaults:
run:
shell: bash
Expand Down Expand Up @@ -80,16 +76,12 @@ jobs:
run: bun run test:httpapi

e2e:
name: e2e (${{ matrix.settings.name }})
name: e2e (${{ matrix.platform }})
strategy:
fail-fast: false
matrix:
settings:
- name: linux
host: blacksmith-4vcpu-ubuntu-2404
- name: windows
host: blacksmith-4vcpu-windows-2025
runs-on: ${{ matrix.settings.host }}
platform: ${{ fromJSON(github.repository == 'internetisalie/opencode' && '["linux"]' || '["linux","windows"]') }}
runs-on: ${{ matrix.platform == 'linux' && (github.repository == 'internetisalie/opencode' && 'ubuntu-24.04' || 'blacksmith-4vcpu-ubuntu-2404') || 'blacksmith-4vcpu-windows-2025' }}
env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/.playwright-browsers
defaults:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
triage:
if: github.repository == 'anomalyco/opencode'
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
typecheck:
runs-on: blacksmith-4vcpu-ubuntu-2404
runs-on: ${{ github.repository == 'internetisalie/opencode' && 'ubuntu-24.04' || 'blacksmith-4vcpu-ubuntu-2404' }}
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ if (process.versions.bun !== expectedBunVersion) {
console.warn(`Warning: Bun version ${process.versions.bun} differs from expected ${expectedBunVersion}`);
}
'
bun typecheck
bun turbo typecheck --concurrency=2
82 changes: 79 additions & 3 deletions packages/core/schema.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"version": "7",
"dialect": "sqlite",
"id": "f14a9b18-8207-487e-a3d3-227e629ba9ad",
"prevIds": ["169a0f0f-d58f-479f-b024-fa1c7b9a09db"],
"id": "d834b448-3c91-409a-91e9-797db24fb4b1",
"prevIds": ["f14a9b18-8207-487e-a3d3-227e629ba9ad"],
"ddl": [
{
"name": "workspace",
Expand Down Expand Up @@ -40,6 +40,10 @@
"name": "permission",
"entityType": "tables"
},
{
"name": "project_association",
"entityType": "tables"
},
{
"name": "project_directory",
"entityType": "tables"
Expand Down Expand Up @@ -600,6 +604,46 @@
"entityType": "columns",
"table": "permission"
},
{
"type": "text",
"notNull": false,
"autoincrement": false,
"default": null,
"generated": null,
"name": "directory",
"entityType": "columns",
"table": "project_association"
},
{
"type": "text",
"notNull": true,
"autoincrement": false,
"default": null,
"generated": null,
"name": "project_id",
"entityType": "columns",
"table": "project_association"
},
{
"type": "text",
"notNull": false,
"autoincrement": false,
"default": null,
"generated": null,
"name": "strategy",
"entityType": "columns",
"table": "project_association"
},
{
"type": "integer",
"notNull": true,
"autoincrement": false,
"default": null,
"generated": null,
"name": "time_created",
"entityType": "columns",
"table": "project_association"
},
{
"type": "text",
"notNull": true,
Expand Down Expand Up @@ -1524,6 +1568,17 @@
"entityType": "fks",
"table": "permission"
},
{
"columns": ["project_id"],
"tableTo": "project",
"columnsTo": ["id"],
"onUpdate": "NO ACTION",
"onDelete": "CASCADE",
"nameExplicit": false,
"name": "fk_project_association_project_id_project_id_fk",
"entityType": "fks",
"table": "project_association"
},
{
"columns": ["project_id"],
"tableTo": "project",
Expand Down Expand Up @@ -1700,6 +1755,13 @@
"table": "permission",
"entityType": "pks"
},
{
"columns": ["directory"],
"nameExplicit": false,
"name": "project_association_pk",
"table": "project_association",
"entityType": "pks"
},
{
"columns": ["id"],
"nameExplicit": false,
Expand Down Expand Up @@ -1818,6 +1880,20 @@
"entityType": "indexes",
"table": "permission"
},
{
"columns": [
{
"value": "project_id",
"isExpression": false
}
],
"isUnique": false,
"where": null,
"origin": "manual",
"name": "project_association_project_id_idx",
"entityType": "indexes",
"table": "project_association"
},
{
"columns": [
{
Expand Down Expand Up @@ -2068,4 +2144,4 @@
}
],
"renames": []
}
}
1 change: 1 addition & 0 deletions packages/core/src/database/migration.gen.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Effect } from "effect"
import type { DatabaseMigration } from "../migration"

export default {
id: "20260925144545_project-association",
up(tx) {
return Effect.gen(function* () {
yield* tx.run(`
CREATE TABLE \`project_association\` (
\`directory\` text PRIMARY KEY,
\`project_id\` text NOT NULL,
\`strategy\` text,
\`time_created\` integer NOT NULL,
CONSTRAINT \`fk_project_association_project_id_project_id_fk\` FOREIGN KEY (\`project_id\`) REFERENCES \`project\`(\`id\`) ON DELETE CASCADE
);
`)
yield* tx.run(`CREATE INDEX \`project_association_project_id_idx\` ON \`project_association\` (\`project_id\`);`)
yield* tx.run(`
INSERT OR REPLACE INTO \`project_association\` (\`directory\`, \`project_id\`, \`strategy\`, \`time_created\`)
SELECT \`directory\`, \`project_id\`, \`strategy\`, \`time_created\`
FROM \`project_directory\`
WHERE \`type\` = 'association';
`)
yield* tx.run(`DELETE FROM \`project_directory\` WHERE \`type\` = 'association';`)
})
},
} satisfies DatabaseMigration.Migration
10 changes: 10 additions & 0 deletions packages/core/src/database/schema.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ export default {
CONSTRAINT \`fk_permission_project_id_project_id_fk\` FOREIGN KEY (\`project_id\`) REFERENCES \`project\`(\`id\`) ON DELETE CASCADE
);
`)
yield* tx.run(`
CREATE TABLE \`project_association\` (
\`directory\` text PRIMARY KEY,
\`project_id\` text NOT NULL,
\`strategy\` text,
\`time_created\` integer NOT NULL,
CONSTRAINT \`fk_project_association_project_id_project_id_fk\` FOREIGN KEY (\`project_id\`) REFERENCES \`project\`(\`id\`) ON DELETE CASCADE
);
`)
yield* tx.run(`
CREATE TABLE \`project_directory\` (
\`project_id\` text NOT NULL,
Expand Down Expand Up @@ -241,6 +250,7 @@ export default {
yield* tx.run(
`CREATE UNIQUE INDEX \`permission_project_action_resource_idx\` ON \`permission\` (\`project_id\`,\`action\`,\`resource\`);`,
)
yield* tx.run(`CREATE INDEX \`project_association_project_id_idx\` ON \`project_association\` (\`project_id\`);`)
yield* tx.run(
`CREATE INDEX \`message_session_time_created_id_idx\` ON \`message\` (\`session_id\`,\`time_created\`,\`id\`);`,
)
Expand Down
52 changes: 49 additions & 3 deletions packages/core/src/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,28 @@ export interface Resolved {
readonly id: ID
readonly directory: AbsolutePath
readonly vcs?: Vcs
readonly associated?: boolean
}

export const AssociateInput = Schema.Struct({
projectID: ID,
directory: AbsolutePath,
strategy: Schema.optional(Schema.String),
}).annotate({ identifier: "Project.AssociateInput" })
export type AssociateInput = typeof AssociateInput.Type

export const DissociateInput = Schema.Struct({
projectID: ID,
directory: AbsolutePath,
}).annotate({ identifier: "Project.DissociateInput" })
export type DissociateInput = typeof DissociateInput.Type

export interface Interface {
readonly directories: (input: DirectoriesInput) => Effect.Effect<Directories>
/** Associate a directory with a project, and return the project's directories. */
readonly associate: (input: AssociateInput) => Effect.Effect<Directories>
/** Remove a directory's association with a project, and return what remains. */
readonly dissociate: (input: DissociateInput) => Effect.Effect<Directories>
readonly resolve: (input: AbsolutePath) => Effect.Effect<Resolved>
/**
* Temporary bridge method for writing the resolved project ID to the repo-local cache.
Expand All @@ -59,7 +77,27 @@ const layer = Layer.effect(
const projectDirectories = yield* ProjectDirectories.Service

const directories = Effect.fn("Project.directories")(function* (input: DirectoriesInput) {
return yield* projectDirectories.list(input.projectID)
const recorded = yield* projectDirectories.list(input.projectID)
const associated = yield* projectDirectories.associations(input.projectID)
const known = new Set(recorded.map((item) => item.directory))
return [...recorded, ...associated.filter((item) => !known.has(item.directory))]
})

const associate = Effect.fn("Project.associate")(function* (input: AssociateInput) {
yield* projectDirectories.associate({
projectID: input.projectID,
directory: AbsolutePath.make(yield* fs.resolve(input.directory)),
strategy: input.strategy,
})
return yield* directories({ projectID: input.projectID })
})

const dissociate = Effect.fn("Project.dissociate")(function* (input: DissociateInput) {
yield* projectDirectories.dissociate({
projectID: input.projectID,
directory: AbsolutePath.make(yield* fs.resolve(input.directory)),
})
return yield* directories({ projectID: input.projectID })
})

const cached = Effect.fnUntraced(function* (dir: string) {
Expand Down Expand Up @@ -109,7 +147,15 @@ const layer = Layer.effect(

const resolve = Effect.fn("Project.resolve")(function* (input: AbsolutePath) {
const repo = yield* git.repo.discover(input)
if (!repo) return { id: ID.global, directory: AbsolutePath.make(path.parse(input).root), vcs: undefined }
if (!repo) {
// An exact, explicit association gives a non-repository directory a project.
//
// Deliberately a fallback: git discovery still wins where it succeeds, so an
// association can never silently re-home a directory that is a worktree.
const owner = yield* projectDirectories.ownerOf(input)
if (owner) return { id: owner, directory: input, vcs: undefined, associated: true }
return { id: ID.global, directory: AbsolutePath.make(path.parse(input).root), vcs: undefined }
}

const previous = yield* cached(repo.commonDirectory)
const id = (yield* remote(repo)) ?? previous ?? (yield* root(repo))
Expand All @@ -125,7 +171,7 @@ const layer = Layer.effect(
yield* fs.writeFileString(path.join(input.store, "opencode"), input.id).pipe(Effect.ignore)
})

return Service.of({ directories, resolve, commit })
return Service.of({ directories, associate, dissociate, resolve, commit })
}),
)

Expand Down
Loading
Loading