Skip to content

Commit 7478bd6

Browse files
committed
auto: format code
1 parent e01ff68 commit 7478bd6

38 files changed

Lines changed: 1632 additions & 771 deletions

CLAUDE.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
44

55
## Build and Development Commands
6+
67
- `bun dev` - Start development environment
78
- `bun build` - Build the project
89
- `bun format` - Format code with Prettier and Sherif
910
- Web app: `bun --cwd app/web dev` - Run web dev server
1011
- Database: `sst shell drizzle-kit` - Run Drizzle ORM commands
1112

1213
## Code Style Guidelines
14+
1315
- **TypeScript**: Use explicit typing, avoid `any`
1416
- **Formatting**: No semicolons, 2-space indentation
1517
- **Imports**: Use named imports, ES modules
@@ -19,10 +21,12 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
1921
- **Database**: Drizzle ORM with PostgreSQL
2022

2123
## Project Structure
24+
2225
- `/app` - Core application (core, function, web, zero)
2326
- `/infra` - Infrastructure as code (SST)
2427
- `/www` - Documentation website
2528

2629
## Environment Requirements
30+
2731
- Bun >=1.0.0
28-
- Node.js >=18.0.0
32+
- Node.js >=18.0.0

app/core/migrations/meta/0000_snapshot.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@
7676
"schemas": {},
7777
"tables": {}
7878
}
79-
}
79+
}

app/core/migrations/meta/0001_snapshot.json

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,23 +86,16 @@
8686
"name": "user_workspace_id_workspace_id_fk",
8787
"tableFrom": "user",
8888
"tableTo": "workspace",
89-
"columnsFrom": [
90-
"workspace_id"
91-
],
92-
"columnsTo": [
93-
"id"
94-
],
89+
"columnsFrom": ["workspace_id"],
90+
"columnsTo": ["id"],
9591
"onDelete": "no action",
9692
"onUpdate": "no action"
9793
}
9894
},
9995
"compositePrimaryKeys": {
10096
"user_workspace_id_id_pk": {
10197
"name": "user_workspace_id_id_pk",
102-
"columns": [
103-
"workspace_id",
104-
"id"
105-
]
98+
"columns": ["workspace_id", "id"]
10699
}
107100
},
108101
"uniqueConstraints": {},
@@ -182,4 +175,4 @@
182175
"schemas": {},
183176
"tables": {}
184177
}
185-
}
178+
}

app/core/migrations/meta/0002_snapshot.json

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,16 @@
7474
"name": "aws_account_workspace_id_workspace_id_fk",
7575
"tableFrom": "aws_account",
7676
"tableTo": "workspace",
77-
"columnsFrom": [
78-
"workspace_id"
79-
],
80-
"columnsTo": [
81-
"id"
82-
],
77+
"columnsFrom": ["workspace_id"],
78+
"columnsTo": ["id"],
8379
"onDelete": "no action",
8480
"onUpdate": "no action"
8581
}
8682
},
8783
"compositePrimaryKeys": {
8884
"aws_account_workspace_id_id_pk": {
8985
"name": "aws_account_workspace_id_id_pk",
90-
"columns": [
91-
"workspace_id",
92-
"id"
93-
]
86+
"columns": ["workspace_id", "id"]
9487
}
9588
},
9689
"uniqueConstraints": {},
@@ -180,23 +173,16 @@
180173
"name": "user_workspace_id_workspace_id_fk",
181174
"tableFrom": "user",
182175
"tableTo": "workspace",
183-
"columnsFrom": [
184-
"workspace_id"
185-
],
186-
"columnsTo": [
187-
"id"
188-
],
176+
"columnsFrom": ["workspace_id"],
177+
"columnsTo": ["id"],
189178
"onDelete": "no action",
190179
"onUpdate": "no action"
191180
}
192181
},
193182
"compositePrimaryKeys": {
194183
"user_workspace_id_id_pk": {
195184
"name": "user_workspace_id_id_pk",
196-
"columns": [
197-
"workspace_id",
198-
"id"
199-
]
185+
"columns": ["workspace_id", "id"]
200186
}
201187
},
202188
"uniqueConstraints": {},
@@ -276,4 +262,4 @@
276262
"schemas": {},
277263
"tables": {}
278264
}
279-
}
265+
}

app/core/migrations/meta/0003_snapshot.json

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -74,23 +74,16 @@
7474
"name": "aws_account_workspace_id_workspace_id_fk",
7575
"tableFrom": "aws_account",
7676
"tableTo": "workspace",
77-
"columnsFrom": [
78-
"workspace_id"
79-
],
80-
"columnsTo": [
81-
"id"
82-
],
77+
"columnsFrom": ["workspace_id"],
78+
"columnsTo": ["id"],
8379
"onDelete": "no action",
8480
"onUpdate": "no action"
8581
}
8682
},
8783
"compositePrimaryKeys": {
8884
"aws_account_workspace_id_id_pk": {
8985
"name": "aws_account_workspace_id_id_pk",
90-
"columns": [
91-
"workspace_id",
92-
"id"
93-
]
86+
"columns": ["workspace_id", "id"]
9487
}
9588
},
9689
"uniqueConstraints": {},
@@ -180,23 +173,16 @@
180173
"name": "user_workspace_id_workspace_id_fk",
181174
"tableFrom": "user",
182175
"tableTo": "workspace",
183-
"columnsFrom": [
184-
"workspace_id"
185-
],
186-
"columnsTo": [
187-
"id"
188-
],
176+
"columnsFrom": ["workspace_id"],
177+
"columnsTo": ["id"],
189178
"onDelete": "no action",
190179
"onUpdate": "no action"
191180
}
192181
},
193182
"compositePrimaryKeys": {
194183
"user_workspace_id_id_pk": {
195184
"name": "user_workspace_id_id_pk",
196-
"columns": [
197-
"workspace_id",
198-
"id"
199-
]
185+
"columns": ["workspace_id", "id"]
200186
}
201187
},
202188
"uniqueConstraints": {},
@@ -276,4 +262,4 @@
276262
"schemas": {},
277263
"tables": {}
278264
}
279-
}
265+
}

app/core/migrations/meta/_journal.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
"breakpoints": true
3232
}
3333
]
34-
}
34+
}

app/core/sst-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
/// <reference path="../../sst-env.d.ts" />
77

88
import "sst"
9-
export {}
9+
export {}

app/function/sst-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
/// <reference path="../../sst-env.d.ts" />
77

88
import "sst"
9-
export {}
9+
export {}

app/web/src/app.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
11
/// <reference types="vite-plugin-pages/client-solid" />
22

3-
import { Router } from '@solidjs/router';
4-
import routes from '~solid-pages';
3+
import { Router } from "@solidjs/router"
4+
import routes from "~solid-pages"
55
import "./ui/style/index.css"
6-
import { MetaProvider } from '@solidjs/meta';
6+
import { MetaProvider } from "@solidjs/meta"
77
import { OpenAuthProvider } from "@openauthjs/solid"
8-
import { AccountProvider } from './components/context-account';
9-
import { DialogProvider } from './ui/context-dialog';
10-
import { DialogString } from './ui/dialog-string';
11-
import { DialogSelect } from './ui/dialog-select';
12-
import { ThemeProvider } from './components/context-theme';
8+
import { AccountProvider } from "./components/context-account"
9+
import { DialogProvider } from "./ui/context-dialog"
10+
import { DialogString } from "./ui/dialog-string"
11+
import { DialogSelect } from "./ui/dialog-select"
12+
import { ThemeProvider } from "./components/context-theme"
1313

1414
export function App(props: { url?: string }) {
1515
return (
1616
<ThemeProvider>
1717
<DialogProvider>
1818
<DialogString />
1919
<DialogSelect />
20-
<OpenAuthProvider clientID="web" issuer={import.meta.env.VITE_AUTH_URL || "http://dummy"}>
20+
<OpenAuthProvider
21+
clientID="web"
22+
issuer={import.meta.env.VITE_AUTH_URL || "http://dummy"}
23+
>
2124
<AccountProvider>
2225
<MetaProvider>
2326
<Router
2427
children={routes}
2528
url={props.url}
26-
root={props => {
29+
root={(props) => {
2730
console.log(props)
28-
return <>
29-
{props.children}
30-
</>
31+
return <>{props.children}</>
3132
}}
3233
/>
3334
</MetaProvider>
3435
</AccountProvider>
3536
</OpenAuthProvider>
3637
</DialogProvider>
3738
</ThemeProvider>
38-
);
39+
)
3940
}
Lines changed: 58 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,70 @@
1-
import { createEffect } from "solid-js";
2-
import { createInitializedContext } from "../util/context";
3-
import { makePersisted } from "@solid-primitives/storage";
4-
import { createStore } from "solid-js/store";
1+
import { createEffect } from "solid-js"
2+
import { createInitializedContext } from "../util/context"
3+
import { makePersisted } from "@solid-primitives/storage"
4+
import { createStore } from "solid-js/store"
55
import { useOpenAuth } from "@openauthjs/solid"
66

77
type Storage = {
8-
accounts: Record<string, {
9-
id: string
10-
email: string
11-
workspaces: {
8+
accounts: Record<
9+
string,
10+
{
1211
id: string
13-
name: string
14-
slug: string
15-
}[]
16-
}>
12+
email: string
13+
workspaces: {
14+
id: string
15+
name: string
16+
slug: string
17+
}[]
18+
}
19+
>
1720
}
1821

19-
export const { use: useAccount, provider: AccountProvider } = createInitializedContext("AccountContext", () => {
20-
const auth = useOpenAuth()
21-
const [store, setStore] = makePersisted(
22-
createStore<Storage>({
23-
accounts: {},
24-
}),
25-
{
26-
name: "radiant.account",
27-
},
28-
);
29-
30-
async function refresh(id: string) {
31-
return fetch(import.meta.env.VITE_API_URL + "/rest/account", {
32-
headers: {
33-
authorization: `Bearer ${await auth.access(id)}`,
22+
export const { use: useAccount, provider: AccountProvider } =
23+
createInitializedContext("AccountContext", () => {
24+
const auth = useOpenAuth()
25+
const [store, setStore] = makePersisted(
26+
createStore<Storage>({
27+
accounts: {},
28+
}),
29+
{
30+
name: "radiant.account",
3431
},
35-
})
36-
.then(val => val.json())
37-
.then(val => setStore("accounts", id, val as any))
38-
}
32+
)
3933

40-
createEffect((previous: string[]) => {
41-
if (Object.keys(auth.all).length === 0) {
42-
return []
43-
}
44-
for (const item of Object.values(auth.all)) {
45-
if (previous.includes(item.id)) continue
46-
refresh(item.id)
34+
async function refresh(id: string) {
35+
return fetch(import.meta.env.VITE_API_URL + "/rest/account", {
36+
headers: {
37+
authorization: `Bearer ${await auth.access(id)}`,
38+
},
39+
})
40+
.then((val) => val.json())
41+
.then((val) => setStore("accounts", id, val as any))
4742
}
48-
return Object.keys(auth.all)
49-
}, [] as string[])
5043

44+
createEffect((previous: string[]) => {
45+
if (Object.keys(auth.all).length === 0) {
46+
return []
47+
}
48+
for (const item of Object.values(auth.all)) {
49+
if (previous.includes(item.id)) continue
50+
refresh(item.id)
51+
}
52+
return Object.keys(auth.all)
53+
}, [] as string[])
5154

52-
53-
return {
54-
get all() {
55-
return store.accounts
56-
},
57-
get current() {
58-
if (!auth.subject) return undefined
59-
return store.accounts[auth.subject.id]
60-
},
61-
refresh,
62-
get ready() {
63-
return Object.keys(auth.all).length === Object.keys(store.accounts).length
55+
return {
56+
get all() {
57+
return store.accounts
58+
},
59+
get current() {
60+
if (!auth.subject) return undefined
61+
return store.accounts[auth.subject.id]
62+
},
63+
refresh,
64+
get ready() {
65+
return (
66+
Object.keys(auth.all).length === Object.keys(store.accounts).length
67+
)
68+
},
6469
}
65-
}
66-
})
67-
70+
})

0 commit comments

Comments
 (0)