ignore: run prettier

This commit is contained in:
Dax Raad 2025-06-26 22:30:44 -04:00
parent f8b78f08b4
commit 51bf193889
31 changed files with 179 additions and 411 deletions

View file

@ -3,7 +3,11 @@
"experimental": {
"hook": {
"file_edited": {
".json": []
".json": [
{
"command": ["bun", "run", "prettier", "$FILE"]
}
]
},
"session_completed": [
{

View file

@ -6,18 +6,18 @@
import "sst"
declare module "sst" {
export interface Resource {
"Web": {
"type": "sst.cloudflare.Astro"
"url": string
Web: {
type: "sst.cloudflare.Astro"
url: string
}
}
}
// cloudflare
import * as cloudflare from "@cloudflare/workers-types";
import * as cloudflare from "@cloudflare/workers-types"
declare module "sst" {
export interface Resource {
"Api": cloudflare.Service
"Bucket": cloudflare.R2Bucket
Api: cloudflare.Service
Bucket: cloudflare.R2Bucket
}
}

View file

@ -202,10 +202,7 @@
"type": "number"
}
},
"required": [
"input",
"output"
],
"required": ["input", "output"],
"additionalProperties": false
},
"limit": {
@ -218,10 +215,7 @@
"type": "number"
}
},
"required": [
"context",
"output"
],
"required": ["context", "output"],
"additionalProperties": false
},
"id": {
@ -240,9 +234,7 @@
"additionalProperties": {}
}
},
"required": [
"models"
],
"required": ["models"],
"additionalProperties": false
},
"description": "Custom provider configurations and model overrides"
@ -274,10 +266,7 @@
"description": "Environment variables to set when running the MCP server"
}
},
"required": [
"type",
"command"
],
"required": ["type", "command"],
"additionalProperties": false
},
{
@ -293,10 +282,7 @@
"description": "URL of the remote MCP server"
}
},
"required": [
"type",
"url"
],
"required": ["type", "url"],
"additionalProperties": false
}
]
@ -329,9 +315,7 @@
}
}
},
"required": [
"command"
],
"required": ["command"],
"additionalProperties": false
}
}
@ -354,9 +338,7 @@
}
}
},
"required": [
"command"
],
"required": ["command"],
"additionalProperties": false
}
}

View file

@ -142,4 +142,3 @@ export namespace App {
.replace(/[^A-Za-z0-9_]/g, "-")
}
}

View file

@ -46,14 +46,14 @@ export const AuthListCommand = cmd({
prompts.outro(`${results.length} credentials`)
// Environment variables section
const activeEnvVars: Array<{ provider: string, envVar: string }> = []
const activeEnvVars: Array<{ provider: string; envVar: string }> = []
for (const [providerID, provider] of Object.entries(database)) {
for (const envVar of provider.env) {
if (process.env[envVar]) {
activeEnvVars.push({
provider: provider.name || providerID,
envVar
envVar,
})
}
}

View file

@ -7,12 +7,9 @@ export const ScrapCommand = cmd({
builder: (yargs) =>
yargs.positional("file", { type: "string", demandOption: true }),
async handler(args) {
await App.provide(
{ cwd: process.cwd() },
async () => {
await App.provide({ cwd: process.cwd() }, async () => {
await LSP.touchFile(args.file, true)
console.log(await LSP.diagnostics())
},
)
})
},
})

View file

@ -1,13 +1,13 @@
import { App } from '../app/app'
import { BunProc } from '../bun'
import { Config } from '../config/config'
import { Log } from '../util/log'
import path from 'path'
import { App } from "../app/app"
import { BunProc } from "../bun"
import { Config } from "../config/config"
import { Log } from "../util/log"
import path from "path"
export namespace Format {
const log = Log.create({ service: 'format' })
const log = Log.create({ service: "format" })
const state = App.state('format', async () => {
const state = App.state("format", async () => {
const hooks: Record<string, Hook[]> = {}
for (const item of FORMATTERS) {
if (await item.enabled()) {
@ -42,22 +42,22 @@ export namespace Format {
})
export async function run(file: string) {
log.info('formatting', { file })
log.info("formatting", { file })
const { hooks } = await state()
const ext = path.extname(file)
const match = hooks[ext]
if (!match) return
for (const item of match) {
log.info('running', { command: item.command })
log.info("running", { command: item.command })
const proc = Bun.spawn({
cmd: item.command.map((x) => x.replace('$FILE', file)),
cmd: item.command.map((x) => x.replace("$FILE", file)),
cwd: App.info().path.cwd,
env: item.environment,
})
const exit = await proc.exited
if (exit !== 0)
log.error('failed', {
log.error("failed", {
command: item.command,
...item.environment,
})
@ -79,58 +79,58 @@ export namespace Format {
const FORMATTERS: Native[] = [
{
name: 'prettier',
extensions: [
'.js',
'.jsx',
'.mjs',
'.cjs',
'.ts',
'.tsx',
'.mts',
'.cts',
'.html',
'.htm',
'.css',
'.scss',
'.sass',
'.less',
'.vue',
'.svelte',
'.json',
'.jsonc',
'.yaml',
'.yml',
'.toml',
'.xml',
'.md',
'.mdx',
'.php',
'.rb',
'.java',
'.go',
'.rs',
'.swift',
'.kt',
'.kts',
'.sol',
'.graphql',
'.gql',
],
command: [BunProc.which(), 'run', 'prettier', '--write', '$FILE'],
name: "prettier",
command: [BunProc.which(), "run", "prettier", "--write", "$FILE"],
environment: {
BUN_BE_BUN: '1',
BUN_BE_BUN: "1",
},
extensions: [
".js",
".jsx",
".mjs",
".cjs",
".ts",
".tsx",
".mts",
".cts",
".html",
".htm",
".css",
".scss",
".sass",
".less",
".vue",
".svelte",
".json",
".jsonc",
".yaml",
".yml",
".toml",
".xml",
".md",
".mdx",
".php",
".rb",
".java",
".go",
".rs",
".swift",
".kt",
".kts",
".sol",
".graphql",
".gql",
],
async enabled() {
try {
const proc = Bun.spawn({
cmd: [BunProc.which(), 'run', 'prettier', '--version'],
cmd: [BunProc.which(), "run", "prettier", "--version"],
cwd: App.info().path.cwd,
env: {
BUN_BE_BUN: '1',
BUN_BE_BUN: "1",
},
stdout: 'ignore',
stderr: 'ignore',
stdout: "ignore",
stderr: "ignore",
})
const exit = await proc.exited
return exit === 0

View file

@ -80,6 +80,7 @@ export const EditTool = Tool.define({
)
await file.write(contentNew)
await Format.run(filepath)
contentNew = await file.text()
})()
const diff = trimDiff(

View file

@ -8,4 +8,3 @@ export function lazy<T>(fn: () => T) {
return value as T
}
}

View file

@ -19,7 +19,10 @@ export namespace Log {
await fs.mkdir(dir, { recursive: true })
cleanup(dir)
if (options.print) return
logpath = path.join(dir, new Date().toISOString().split(".")[0].replace(/:/g, "") + ".log")
logpath = path.join(
dir,
new Date().toISOString().split(".")[0].replace(/:/g, "") + ".log",
)
const logfile = Bun.file(logpath)
await fs.truncate(logpath).catch(() => {})
const writer = logfile.writer()

View file

@ -316,13 +316,13 @@ const testCases: TestCase[] = [
// WhitespaceNormalizedReplacer - test regex special characters that could cause errors
{
content: 'const pattern = "test[123]";',
find: 'test[123]',
replace: 'test[456]',
find: "test[123]",
replace: "test[456]",
},
{
content: 'const regex = "^start.*end$";',
find: '^start.*end$',
replace: '^begin.*finish$',
find: "^start.*end$",
replace: "^begin.*finish$",
},
// EscapeNormalizedReplacer - test single backslash vs double backslash

View file

@ -78,4 +78,3 @@
"syntaxPunctuation": "darkFg"
}
}

View file

@ -110,4 +110,3 @@
"syntaxPunctuation": { "dark": "darkText", "light": "lightText" }
}
}

View file

@ -239,4 +239,3 @@
}
}
}

View file

@ -243,4 +243,3 @@
}
}
}

View file

@ -241,4 +241,3 @@
}
}
}

View file

@ -115,11 +115,7 @@
"type": "string"
}
},
"required": [
"sessionID",
"providerID",
"modelID"
]
"required": ["sessionID", "providerID", "modelID"]
}
}
}
@ -149,12 +145,7 @@
"type": "string"
}
},
"required": [
"root",
"data",
"cwd",
"config"
]
"required": ["root", "data", "cwd", "config"]
}
}
}
@ -221,9 +212,7 @@
"type": "string"
}
},
"required": [
"sessionID"
]
"required": ["sessionID"]
}
}
}
@ -257,9 +246,7 @@
"type": "string"
}
},
"required": [
"sessionID"
]
"required": ["sessionID"]
}
}
}
@ -296,9 +283,7 @@
"type": "string"
}
},
"required": [
"sessionID"
]
"required": ["sessionID"]
}
}
}
@ -354,9 +339,7 @@
"type": "string"
}
},
"required": [
"sessionID"
]
"required": ["sessionID"]
}
}
}
@ -390,9 +373,7 @@
"type": "string"
}
},
"required": [
"sessionID"
]
"required": ["sessionID"]
}
}
}
@ -432,11 +413,7 @@
"type": "string"
}
},
"required": [
"sessionID",
"providerID",
"modelID"
]
"required": ["sessionID", "providerID", "modelID"]
}
}
}
@ -482,12 +459,7 @@
}
}
},
"required": [
"sessionID",
"providerID",
"modelID",
"parts"
]
"required": ["sessionID", "providerID", "modelID", "parts"]
}
}
}
@ -517,10 +489,7 @@
}
}
},
"required": [
"providers",
"default"
]
"required": ["providers", "default"]
}
}
}
@ -561,9 +530,7 @@
"type": "string"
}
},
"required": [
"query"
]
"required": ["query"]
}
}
}
@ -652,15 +619,10 @@
},
"content": {}
},
"required": [
"key"
]
"required": ["key"]
}
},
"required": [
"type",
"properties"
]
"required": ["type", "properties"]
},
"Event.installation.updated": {
"type": "object",
@ -676,15 +638,10 @@
"type": "string"
}
},
"required": [
"version"
]
"required": ["version"]
}
},
"required": [
"type",
"properties"
]
"required": ["type", "properties"]
},
"Event.lsp.client.diagnostics": {
"type": "object",
@ -703,16 +660,10 @@
"type": "string"
}
},
"required": [
"serverID",
"path"
]
"required": ["serverID", "path"]
}
},
"required": [
"type",
"properties"
]
"required": ["type", "properties"]
},
"Event.permission.updated": {
"type": "object",
@ -725,10 +676,7 @@
"$ref": "#/components/schemas/permission.info"
}
},
"required": [
"type",
"properties"
]
"required": ["type", "properties"]
},
"permission.info": {
"type": "object",
@ -753,18 +701,10 @@
"type": "number"
}
},
"required": [
"created"
]
"required": ["created"]
}
},
"required": [
"id",
"sessionID",
"title",
"metadata",
"time"
]
"required": ["id", "sessionID", "title", "metadata", "time"]
},
"Event.message.updated": {
"type": "object",
@ -780,15 +720,10 @@
"$ref": "#/components/schemas/Message.Info"
}
},
"required": [
"info"
]
"required": ["info"]
}
},
"required": [
"type",
"properties"
]
"required": ["type", "properties"]
},
"Message.Info": {
"type": "object",
@ -798,10 +733,7 @@
},
"role": {
"type": "string",
"enum": [
"user",
"assistant"
]
"enum": ["user", "assistant"]
},
"parts": {
"type": "array",
@ -813,12 +745,7 @@
"$ref": "#/components/schemas/Message.Metadata"
}
},
"required": [
"id",
"role",
"parts",
"metadata"
]
"required": ["id", "role", "parts", "metadata"]
},
"Message.Part": {
"oneOf": [
@ -864,10 +791,7 @@
"type": "string"
}
},
"required": [
"type",
"text"
]
"required": ["type", "text"]
},
"Message.Part.Reasoning": {
"type": "object",
@ -884,10 +808,7 @@
"additionalProperties": {}
}
},
"required": [
"type",
"text"
]
"required": ["type", "text"]
},
"Message.Part.ToolInvocation": {
"type": "object",
@ -900,10 +821,7 @@
"$ref": "#/components/schemas/Message.ToolInvocation"
}
},
"required": [
"type",
"toolInvocation"
]
"required": ["type", "toolInvocation"]
},
"Message.ToolInvocation": {
"oneOf": [
@ -944,11 +862,7 @@
},
"args": {}
},
"required": [
"state",
"toolCallId",
"toolName"
]
"required": ["state", "toolCallId", "toolName"]
},
"Message.ToolInvocation.ToolPartialCall": {
"type": "object",
@ -968,11 +882,7 @@
},
"args": {}
},
"required": [
"state",
"toolCallId",
"toolName"
]
"required": ["state", "toolCallId", "toolName"]
},
"Message.ToolInvocation.ToolResult": {
"type": "object",
@ -995,12 +905,7 @@
"type": "string"
}
},
"required": [
"state",
"toolCallId",
"toolName",
"result"
]
"required": ["state", "toolCallId", "toolName", "result"]
},
"Message.Part.SourceUrl": {
"type": "object",
@ -1023,11 +928,7 @@
"additionalProperties": {}
}
},
"required": [
"type",
"sourceId",
"url"
]
"required": ["type", "sourceId", "url"]
},
"Message.Part.File": {
"type": "object",
@ -1046,11 +947,7 @@
"type": "string"
}
},
"required": [
"type",
"mediaType",
"url"
]
"required": ["type", "mediaType", "url"]
},
"Message.Part.StepStart": {
"type": "object",
@ -1060,9 +957,7 @@
"const": "step-start"
}
},
"required": [
"type"
]
"required": ["type"]
},
"Message.Metadata": {
"type": "object",
@ -1077,9 +972,7 @@
"type": "number"
}
},
"required": [
"created"
]
"required": ["created"]
},
"error": {
"oneOf": [
@ -1119,16 +1012,10 @@
"type": "number"
}
},
"required": [
"start",
"end"
]
"required": ["start", "end"]
}
},
"required": [
"title",
"time"
],
"required": ["title", "time"],
"additionalProperties": {}
}
},
@ -1157,10 +1044,7 @@
"type": "string"
}
},
"required": [
"cwd",
"root"
]
"required": ["cwd", "root"]
},
"cost": {
"type": "number"
@ -1190,18 +1074,10 @@
"type": "number"
}
},
"required": [
"read",
"write"
]
"required": ["read", "write"]
}
},
"required": [
"input",
"output",
"reasoning",
"cache"
]
"required": ["input", "output", "reasoning", "cache"]
}
},
"required": [
@ -1214,11 +1090,7 @@
]
}
},
"required": [
"time",
"sessionID",
"tool"
]
"required": ["time", "sessionID", "tool"]
},
"ProviderAuthError": {
"type": "object",
@ -1237,16 +1109,10 @@
"type": "string"
}
},
"required": [
"providerID",
"message"
]
"required": ["providerID", "message"]
}
},
"required": [
"name",
"data"
]
"required": ["name", "data"]
},
"UnknownError": {
"type": "object",
@ -1262,15 +1128,10 @@
"type": "string"
}
},
"required": [
"message"
]
"required": ["message"]
}
},
"required": [
"name",
"data"
]
"required": ["name", "data"]
},
"Event.message.part.updated": {
"type": "object",
@ -1292,17 +1153,10 @@
"type": "string"
}
},
"required": [
"part",
"sessionID",
"messageID"
]
"required": ["part", "sessionID", "messageID"]
}
},
"required": [
"type",
"properties"
]
"required": ["type", "properties"]
},
"Event.session.updated": {
"type": "object",
@ -1318,15 +1172,10 @@
"$ref": "#/components/schemas/session.info"
}
},
"required": [
"info"
]
"required": ["info"]
}
},
"required": [
"type",
"properties"
]
"required": ["type", "properties"]
},
"session.info": {
"type": "object",
@ -1346,9 +1195,7 @@
"type": "string"
}
},
"required": [
"url"
]
"required": ["url"]
},
"title": {
"type": "string"
@ -1366,18 +1213,10 @@
"type": "number"
}
},
"required": [
"created",
"updated"
]
"required": ["created", "updated"]
}
},
"required": [
"id",
"title",
"version",
"time"
]
"required": ["id", "title", "version", "time"]
},
"Event.session.deleted": {
"type": "object",
@ -1393,15 +1232,10 @@
"$ref": "#/components/schemas/session.info"
}
},
"required": [
"info"
]
"required": ["info"]
}
},
"required": [
"type",
"properties"
]
"required": ["type", "properties"]
},
"Event.session.error": {
"type": "object",
@ -1433,10 +1267,7 @@
}
}
},
"required": [
"type",
"properties"
]
"required": ["type", "properties"]
},
"App.Info": {
"type": "object",
@ -1466,13 +1297,7 @@
"type": "string"
}
},
"required": [
"config",
"data",
"root",
"cwd",
"state"
]
"required": ["config", "data", "root", "cwd", "state"]
},
"time": {
"type": "object",
@ -1483,12 +1308,7 @@
}
}
},
"required": [
"user",
"git",
"path",
"time"
]
"required": ["user", "git", "path", "time"]
},
"Config.Info": {
"type": "object",
@ -1583,10 +1403,7 @@
"type": "number"
}
},
"required": [
"input",
"output"
]
"required": ["input", "output"]
},
"limit": {
"type": "object",
@ -1598,10 +1415,7 @@
"type": "number"
}
},
"required": [
"context",
"output"
]
"required": ["context", "output"]
},
"id": {
"type": "string"
@ -1618,9 +1432,7 @@
"additionalProperties": {}
}
},
"required": [
"models"
]
"required": ["models"]
},
"description": "Custom provider configurations and model overrides"
},
@ -1790,12 +1602,7 @@
}
}
},
"required": [
"name",
"env",
"id",
"models"
]
"required": ["name", "env", "id", "models"]
},
"Model.Info": {
"type": "object",
@ -1831,10 +1638,7 @@
"type": "number"
}
},
"required": [
"input",
"output"
]
"required": ["input", "output"]
},
"limit": {
"type": "object",
@ -1846,10 +1650,7 @@
"type": "number"
}
},
"required": [
"context",
"output"
]
"required": ["context", "output"]
},
"id": {
"type": "string"
@ -1894,10 +1695,7 @@
"description": "Environment variables to set when running the MCP server"
}
},
"required": [
"type",
"command"
],
"required": ["type", "command"],
"additionalProperties": false
},
"Config.McpRemote": {
@ -1913,10 +1711,7 @@
"description": "URL of the remote MCP server"
}
},
"required": [
"type",
"url"
],
"required": ["type", "url"],
"additionalProperties": false
},
"Error": {
@ -1927,9 +1722,7 @@
"additionalProperties": {}
}
},
"required": [
"data"
]
"required": ["data"]
},
"InstallationInfo": {
"type": "object",
@ -1941,10 +1734,7 @@
"type": "string"
}
},
"required": [
"version",
"latest"
]
"required": ["version", "latest"]
}
}
}

View file

@ -32,9 +32,7 @@ export default defineConfig({
starlight({
title: "opencode",
expressiveCode: { themes: ["github-light", "github-dark"] },
social: [
{ icon: "github", label: "GitHub", href: config.github },
],
social: [{ icon: "github", label: "GitHub", href: config.github }],
head: [
{
tag: "link",