Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions .devcontainer/devcontainer-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"features": {
"ghcr.io/michidk/devcontainers-features/bun:1": {
"version": "1.0.1",
"resolved": "ghcr.io/michidk/devcontainers-features/bun@sha256:568cc553062d184932ba993db954d4ace2bda3907d129477ce174777ac686dbd",
"integrity": "sha256:568cc553062d184932ba993db954d4ace2bda3907d129477ce174777ac686dbd"
}
}
}
25 changes: 25 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
"name": "Node.js & TypeScript",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/typescript-node:5-24-trixie",
"features": {
"ghcr.io/michidk/devcontainers-features/bun:1": {}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
12 changes: 12 additions & 0 deletions packages/opencode/src/command/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { MCP } from "../mcp"
import { Skill } from "../skill"
import PROMPT_INITIALIZE from "./template/initialize.txt"
import PROMPT_REVIEW from "./template/review.txt"
import PROMPT_SCOTTY from "./template/scotty.txt"
import { LegacyEvent } from "@opencode-ai/schema/legacy-event"

type State = {
Expand Down Expand Up @@ -46,6 +47,7 @@ export function hints(template: string) {
export const Default = {
INIT: "init",
REVIEW: "review",
SCOTTY: "scotty",
} as const

export interface Interface {
Expand Down Expand Up @@ -87,6 +89,16 @@ const layer = Layer.effect(
hints: hints(PROMPT_REVIEW),
}

commands[Default.SCOTTY] = {
name: Default.SCOTTY,
description: "display ASCII art of Scotty the Scottish Terrier",
source: "command",
get template() {
return PROMPT_SCOTTY
},
hints: hints(PROMPT_SCOTTY),
}

for (const [name, command] of Object.entries(cfg.command ?? {})) {
commands[name] = {
name,
Expand Down
9 changes: 9 additions & 0 deletions packages/opencode/src/command/template/scotty.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Respond with exactly this ASCII art of Scotty the Scottish Terrier and nothing else:

/\_/\
( o.o )
> ^ <
/| |\
/_|___|_\
/ \
/_____\
41 changes: 41 additions & 0 deletions packages/ui/src/theme/context.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { describe, expect, test } from "bun:test"
import { makeSetColorScheme, type ThemeStore } from "./context"

function makeFakeStore() {
const state: Partial<ThemeStore> = {
colorScheme: "system",
mode: "light",
}
const calls: Array<[string, unknown]> = []
const setStore = ((key: string, value: unknown) => {
calls.push([key, value])
;(state as Record<string, unknown>)[key] = value }) as never
return { state, calls, setStore }
}

describe("makeSetColorScheme", () => {
test("updates the colorScheme in the store", () => {
const { state, setStore } = makeFakeStore()
const setColorScheme = makeSetColorScheme(setStore)
setColorScheme("dark")
expect(state.colorScheme).toBe("dark")
})

test("sets mode to the explicit scheme when scheme is not 'system'", () => {
const { state, setStore } = makeFakeStore()
const setColorScheme = makeSetColorScheme(setStore)
setColorScheme("dark")
expect(state.mode).toBe("dark")
setColorScheme("light")
expect(state.mode).toBe("light")
})

test("calls setStore exactly twice (colorScheme, then mode)", () => {
const { calls, setStore } = makeFakeStore()
const setColorScheme = makeSetColorScheme(setStore)
setColorScheme("dark")
expect(calls.length).toBe(2)
expect(calls[0][0]).toBe("colorScheme")
expect(calls[1][0]).toBe("mode")
})
})
Loading
Loading