@owlmeans/create-app 0.1.18-rc.2 → 0.1.18-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -1
- package/build/args.d.ts +8 -0
- package/build/args.d.ts.map +1 -1
- package/build/args.js +60 -6
- package/build/args.js.map +1 -1
- package/build/index.d.ts +4 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/naming.d.ts +11 -0
- package/build/naming.d.ts.map +1 -0
- package/build/naming.js +18 -0
- package/build/naming.js.map +1 -0
- package/build/run.d.ts.map +1 -1
- package/build/run.js +19 -13
- package/build/run.js.map +1 -1
- package/build/scaffold.d.ts +21 -0
- package/build/scaffold.d.ts.map +1 -0
- package/build/scaffold.js +18 -0
- package/build/scaffold.js.map +1 -0
- package/build/template.d.ts +19 -3
- package/build/template.d.ts.map +1 -1
- package/build/template.js +52 -12
- package/build/template.js.map +1 -1
- package/package.json +4 -3
- package/template/AGENTS.md +28 -1
- package/template/README.bare.md +57 -0
- package/template/README.md +5 -61
- package/template/_agents/scripts/link-skills.sh +310 -15
- package/template/_agents/skills/agent-memory/SKILL.md +12 -11
- package/template/_agents/skills/getting-started/SKILL.md +26 -86
- package/template/_agents/skills/memory-promotion/SKILL.md +10 -4
- package/template/_agents/skills/memory-recompact/SKILL.md +15 -14
- package/template/_agents/skills/reuse-code/SKILL.md +36 -8
- package/template/_agents/skills/self-education/SKILL.md +19 -5
- package/template/_agents/skills/skill-authoring/SKILL.md +53 -11
- package/template/_bare.json +23 -0
- package/template/_gitignore +3 -0
- package/template/bunfig.toml +2 -0
- package/template/package.json +3 -2
- package/template/sources/api/package.json +3 -3
- package/template/sources/api/src/app/session/add.ts +7 -6
- package/template/sources/api/src/app/session/list.ts +12 -9
- package/template/sources/api/src/app/session/remove.ts +7 -6
- package/template/sources/api/src/context.bare.ts +11 -0
- package/template/sources/api/src/entrypoints.bare.ts +4 -0
- package/template/sources/api/src/entrypoints.ts +13 -0
- package/template/sources/api/src/index.ts +2 -2
- package/template/sources/api/src/types.bare.ts +5 -0
- package/template/sources/common/package.json +6 -6
- package/template/sources/common/src/consts.bare.ts +8 -0
- package/template/sources/common/src/consts.ts +0 -13
- package/template/sources/common/src/entrypoints.bare.ts +14 -0
- package/template/sources/common/src/entrypoints.ts +60 -0
- package/template/sources/common/src/index.bare.ts +3 -0
- package/template/sources/common/src/index.ts +1 -1
- package/template/sources/common/src/schemas.ts +7 -7
- package/template/sources/web/index.html +3 -1
- package/template/sources/web/package.json +13 -11
- package/template/sources/web/src/components/ui/navigation-menu.tsx +169 -0
- package/template/sources/web/src/context.bare.ts +13 -0
- package/template/sources/web/src/context.ts +14 -2
- package/template/sources/web/src/entrypoints.bare.ts +13 -0
- package/template/sources/web/src/entrypoints.ts +16 -0
- package/template/sources/web/src/index.css +7 -0
- package/template/sources/web/src/index.tsx +2 -2
- package/template/sources/web/src/layout/main.tsx +16 -19
- package/template/sources/web/src/nav.bare.ts +21 -0
- package/template/sources/web/src/nav.ts +28 -0
- package/template/sources/web/src/screens/about.tsx +19 -0
- package/template/sources/web/src/screens/home.bare.tsx +17 -0
- package/template/sources/web/src/screens/session.tsx +28 -14
- package/template/sources/web/src/vite-env.d.ts +1 -0
- package/template/sources/api/src/modules.ts +0 -11
- package/template/sources/common/src/modules.ts +0 -26
- package/template/sources/web/src/components/nav/main.tsx +0 -15
- package/template/sources/web/src/modules.ts +0 -20
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState, type FC } from 'react'
|
|
2
|
-
import
|
|
2
|
+
import { useStoreList } from '@owlmeans/client'
|
|
3
3
|
import { session, type SessionItem } from '__APP_SLUG__-common'
|
|
4
|
-
import { useContext } from '../context.js'
|
|
4
|
+
import { SESSION_STATE, useContext } from '../context.js'
|
|
5
5
|
import { Button } from '@/components/ui/button'
|
|
6
6
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
|
|
7
7
|
import { Input } from '@/components/ui/input'
|
|
@@ -20,15 +20,27 @@ const sessionId = (): string => {
|
|
|
20
20
|
export const SessionScreen: FC = () => {
|
|
21
21
|
const ctx = useContext()
|
|
22
22
|
const sid = sessionId()
|
|
23
|
-
const [items, setItems] = useState<SessionItem[]>([])
|
|
24
23
|
const [text, setText] = useState('')
|
|
25
24
|
const [busy, setBusy] = useState(false)
|
|
26
25
|
|
|
26
|
+
const store = ctx.getStateResource<SessionItem>(SESSION_STATE)
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The list is a live subscription to the state resource, not a piece of component state.
|
|
30
|
+
* Anything that writes a record — this screen or another one — re-renders it, so adding and
|
|
31
|
+
* removing never re-fetch to stay in step. `{}` matches every record; a real filter goes here.
|
|
32
|
+
*/
|
|
33
|
+
const items = useStoreList<SessionItem>({ query: {}, resource: SESSION_STATE })
|
|
34
|
+
|
|
35
|
+
// The server is the source of truth; the store is what the screen reads. Fetch once, install
|
|
36
|
+
// what came back, and let the subscription render it. `replace` rather than a save per item:
|
|
37
|
+
// the endpoint answers with the session's whole set, so an item removed on another tab has to
|
|
38
|
+
// leave the store too, and one write wakes the subscribers once instead of once per record.
|
|
27
39
|
const load = async () => {
|
|
28
|
-
const
|
|
29
|
-
.entrypoint
|
|
40
|
+
const data = await ctx
|
|
41
|
+
.entrypoint(session.list)
|
|
30
42
|
.call({ params: { sid } })
|
|
31
|
-
|
|
43
|
+
await store.replace(data ?? [])
|
|
32
44
|
}
|
|
33
45
|
|
|
34
46
|
useEffect(() => { void load() }, [])
|
|
@@ -37,11 +49,13 @@ export const SessionScreen: FC = () => {
|
|
|
37
49
|
if (text.trim() === '') return
|
|
38
50
|
setBusy(true)
|
|
39
51
|
try {
|
|
40
|
-
await ctx
|
|
41
|
-
.entrypoint
|
|
52
|
+
const item = await ctx
|
|
53
|
+
.entrypoint(session.add)
|
|
42
54
|
.call({ params: { sid }, body: { text } })
|
|
43
55
|
setText('')
|
|
44
|
-
|
|
56
|
+
if (item != null) {
|
|
57
|
+
await store.save(item)
|
|
58
|
+
}
|
|
45
59
|
} finally {
|
|
46
60
|
setBusy(false)
|
|
47
61
|
}
|
|
@@ -49,9 +63,9 @@ export const SessionScreen: FC = () => {
|
|
|
49
63
|
|
|
50
64
|
const remove = async (id: string) => {
|
|
51
65
|
await ctx
|
|
52
|
-
.entrypoint
|
|
66
|
+
.entrypoint(session.remove)
|
|
53
67
|
.call({ params: { sid, id } })
|
|
54
|
-
await
|
|
68
|
+
await store.delete(id)
|
|
55
69
|
}
|
|
56
70
|
|
|
57
71
|
return (
|
|
@@ -75,11 +89,11 @@ export const SessionScreen: FC = () => {
|
|
|
75
89
|
<ul className="flex flex-col gap-2">
|
|
76
90
|
{items.map(item => (
|
|
77
91
|
<li
|
|
78
|
-
key={item.id}
|
|
92
|
+
key={item.record.id}
|
|
79
93
|
className="flex items-center justify-between rounded-md border px-3 py-2"
|
|
80
94
|
>
|
|
81
|
-
<span>{item.text}</span>
|
|
82
|
-
<Button variant="ghost" size="sm" onClick={() => void remove(item.id)}>
|
|
95
|
+
<span>{item.record.text}</span>
|
|
96
|
+
<Button variant="ghost" size="sm" onClick={() => void remove(item.record.id)}>
|
|
83
97
|
Remove
|
|
84
98
|
</Button>
|
|
85
99
|
</li>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { elevate, modules } from '@owlmeans/server-app'
|
|
2
|
-
import { session, sessionModules } from '__APP_SLUG__-common'
|
|
3
|
-
import * as handlers from './app/session/index.js'
|
|
4
|
-
|
|
5
|
-
// Attach handler implementations to the shared entrypoint declarations.
|
|
6
|
-
elevate(sessionModules, session.base)
|
|
7
|
-
elevate(sessionModules, session.list, handlers.list)
|
|
8
|
-
elevate(sessionModules, session.add, handlers.add)
|
|
9
|
-
elevate(sessionModules, session.remove, handlers.remove)
|
|
10
|
-
|
|
11
|
-
export const appModules = [...modules, ...sessionModules]
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { body, entrypoint, filter, params } from '@owlmeans/entrypoint'
|
|
2
|
-
import { route, RouteMethod } from '@owlmeans/route'
|
|
3
|
-
import { session } from './consts.js'
|
|
4
|
-
import { AddItemSchema, ItemParamsSchema, SessionParamsSchema } from './schemas.js'
|
|
5
|
-
import type { AddItemPayload, ItemParams, SessionParams } from './types.js'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Shared entrypoint declarations. The api elevates these with handlers; the web
|
|
9
|
-
* elevates them with screen components and calls them. Routes resolve under the
|
|
10
|
-
* api service `base` (`/api`), so e.g. `session.list` → `GET /api/session/:sid/items`.
|
|
11
|
-
*/
|
|
12
|
-
export const sessionModules = [
|
|
13
|
-
entrypoint(route(session.base, '/session')),
|
|
14
|
-
entrypoint(
|
|
15
|
-
route(session.list, '/:sid/items', { parent: session.base, method: RouteMethod.GET }),
|
|
16
|
-
filter(params<SessionParams>(SessionParamsSchema)),
|
|
17
|
-
),
|
|
18
|
-
entrypoint(
|
|
19
|
-
route(session.add, '/:sid/items', { parent: session.base, method: RouteMethod.POST }),
|
|
20
|
-
filter(params<SessionParams>(SessionParamsSchema, body<AddItemPayload>(AddItemSchema))),
|
|
21
|
-
),
|
|
22
|
-
entrypoint(
|
|
23
|
-
route(session.remove, '/:sid/items/:id', { parent: session.base, method: RouteMethod.DELETE }),
|
|
24
|
-
filter(params<ItemParams>(ItemParamsSchema)),
|
|
25
|
-
),
|
|
26
|
-
]
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'react'
|
|
2
|
-
import { HOME, useNavigate } from '@owlmeans/web-panel'
|
|
3
|
-
import { web } from '__APP_SLUG__-common'
|
|
4
|
-
import { Button } from '@/components/ui/button'
|
|
5
|
-
|
|
6
|
-
export const MainNavigation: FC = () => {
|
|
7
|
-
const nav = useNavigate()
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<nav className="flex items-center gap-1">
|
|
11
|
-
<Button variant="ghost" size="sm" onClick={nav.press(HOME)}>Home</Button>
|
|
12
|
-
<Button variant="ghost" size="sm" onClick={nav.press(web.session)}>Session</Button>
|
|
13
|
-
</nav>
|
|
14
|
-
)
|
|
15
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { BASE, elevate, entrypoint, frontend, handler, HOME, modules as baseModules, route } from '@owlmeans/web-panel'
|
|
2
|
-
import { session, sessionModules, web } from '__APP_SLUG__-common'
|
|
3
|
-
import { MainLayout } from './layout/main.js'
|
|
4
|
-
import { HomeScreen } from './screens/home.js'
|
|
5
|
-
import { SessionScreen } from './screens/session.js'
|
|
6
|
-
|
|
7
|
-
const modules = [...baseModules, ...sessionModules]
|
|
8
|
-
|
|
9
|
-
// Backend entrypoints — elevated without a component so the client can call them.
|
|
10
|
-
elevate(modules, session.base)
|
|
11
|
-
elevate(modules, session.list)
|
|
12
|
-
elevate(modules, session.add)
|
|
13
|
-
elevate(modules, session.remove)
|
|
14
|
-
|
|
15
|
-
// Frontend layout + screens. BASE renders the shared layout; HOME is its default child.
|
|
16
|
-
modules.push(entrypoint(route(BASE, '/', frontend()), handler(MainLayout)))
|
|
17
|
-
modules.push(entrypoint(route(HOME, '/', frontend({ default: true, parent: BASE })), handler(HomeScreen)))
|
|
18
|
-
modules.push(entrypoint(route(web.session, '/session', frontend({ parent: BASE })), handler(SessionScreen)))
|
|
19
|
-
|
|
20
|
-
export const appModules = modules
|