@owlmeans/create-app 0.1.18-rc.3 → 0.1.18-rc.30

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.
Files changed (78) hide show
  1. package/README.md +39 -2
  2. package/build/args.d.ts +8 -0
  3. package/build/args.d.ts.map +1 -1
  4. package/build/args.js +60 -6
  5. package/build/args.js.map +1 -1
  6. package/build/index.d.ts +4 -1
  7. package/build/index.d.ts.map +1 -1
  8. package/build/index.js +2 -0
  9. package/build/index.js.map +1 -1
  10. package/build/naming.d.ts +11 -0
  11. package/build/naming.d.ts.map +1 -0
  12. package/build/naming.js +18 -0
  13. package/build/naming.js.map +1 -0
  14. package/build/run.d.ts.map +1 -1
  15. package/build/run.js +19 -13
  16. package/build/run.js.map +1 -1
  17. package/build/scaffold.d.ts +21 -0
  18. package/build/scaffold.d.ts.map +1 -0
  19. package/build/scaffold.js +18 -0
  20. package/build/scaffold.js.map +1 -0
  21. package/build/template.d.ts +19 -3
  22. package/build/template.d.ts.map +1 -1
  23. package/build/template.js +52 -12
  24. package/build/template.js.map +1 -1
  25. package/package.json +4 -3
  26. package/template/AGENTS.md +28 -1
  27. package/template/README.bare.md +57 -0
  28. package/template/README.md +5 -61
  29. package/template/_agents/scripts/link-skills.sh +310 -15
  30. package/template/_agents/skills/agent-memory/SKILL.md +12 -11
  31. package/template/_agents/skills/getting-started/SKILL.md +26 -86
  32. package/template/_agents/skills/memory-promotion/SKILL.md +10 -4
  33. package/template/_agents/skills/memory-recompact/SKILL.md +15 -14
  34. package/template/_agents/skills/reuse-code/SKILL.md +36 -8
  35. package/template/_agents/skills/self-education/SKILL.md +19 -5
  36. package/template/_agents/skills/skill-authoring/SKILL.md +53 -11
  37. package/template/_bare.json +23 -0
  38. package/template/_gitignore +3 -0
  39. package/template/bunfig.toml +2 -0
  40. package/template/package.json +3 -2
  41. package/template/sources/api/package.json +3 -3
  42. package/template/sources/api/src/app/session/add.ts +7 -6
  43. package/template/sources/api/src/app/session/list.ts +12 -9
  44. package/template/sources/api/src/app/session/remove.ts +7 -6
  45. package/template/sources/api/src/context.bare.ts +11 -0
  46. package/template/sources/api/src/entrypoints.bare.ts +4 -0
  47. package/template/sources/api/src/entrypoints.ts +13 -0
  48. package/template/sources/api/src/index.ts +2 -2
  49. package/template/sources/api/src/types.bare.ts +5 -0
  50. package/template/sources/common/package.json +6 -6
  51. package/template/sources/common/src/consts.bare.ts +8 -0
  52. package/template/sources/common/src/consts.ts +0 -13
  53. package/template/sources/common/src/entrypoints.bare.ts +14 -0
  54. package/template/sources/common/src/entrypoints.ts +60 -0
  55. package/template/sources/common/src/index.bare.ts +3 -0
  56. package/template/sources/common/src/index.ts +1 -1
  57. package/template/sources/common/src/schemas.ts +7 -7
  58. package/template/sources/web/index.html +3 -1
  59. package/template/sources/web/package.json +13 -11
  60. package/template/sources/web/src/components/ui/dropdown-menu.tsx +257 -0
  61. package/template/sources/web/src/components/ui/navigation-menu.tsx +169 -0
  62. package/template/sources/web/src/context.bare.ts +13 -0
  63. package/template/sources/web/src/context.ts +14 -2
  64. package/template/sources/web/src/entrypoints.bare.ts +13 -0
  65. package/template/sources/web/src/entrypoints.ts +16 -0
  66. package/template/sources/web/src/index.css +7 -0
  67. package/template/sources/web/src/index.tsx +2 -2
  68. package/template/sources/web/src/layout/main.tsx +16 -19
  69. package/template/sources/web/src/nav.bare.ts +21 -0
  70. package/template/sources/web/src/nav.ts +28 -0
  71. package/template/sources/web/src/screens/about.tsx +19 -0
  72. package/template/sources/web/src/screens/home.bare.tsx +17 -0
  73. package/template/sources/web/src/screens/session.tsx +28 -14
  74. package/template/sources/web/src/vite-env.d.ts +1 -0
  75. package/template/sources/api/src/modules.ts +0 -11
  76. package/template/sources/common/src/modules.ts +0 -26
  77. package/template/sources/web/src/components/nav/main.tsx +0 -15
  78. package/template/sources/web/src/modules.ts +0 -20
@@ -0,0 +1,13 @@
1
+ import { makeContext as makeBasicContext, useContext as useBasicContext } from '@owlmeans/web-panel'
2
+ import type { Config, Context } from './types.js'
3
+
4
+ export const useContext = (): Context => useBasicContext<Config, Context>()
5
+
6
+ /**
7
+ * The framework's client store lives ON the context, so a screen, a guard and a service all
8
+ * reach the same records — which is what separates it from a store held beside the app in a
9
+ * module of its own. `appendStateResource<C, T>(context, ALIAS)` from '@owlmeans/state'
10
+ * (already a dependency) registers one; screens then address it by that alias, never by path.
11
+ */
12
+ export const makeContext = <C extends Config, T extends Context<C>>(cfg: C): T =>
13
+ makeBasicContext<C, T>(cfg)
@@ -1,7 +1,19 @@
1
1
  import { makeContext as makeBasicContext, useContext as useBasicContext } from '@owlmeans/web-panel'
2
+ import { appendStateResource } from '@owlmeans/state'
2
3
  import type { Config, Context } from './types.js'
3
4
 
5
+ /** The alias the session items are stored under. Screens address the store by it, never by path. */
6
+ export const SESSION_STATE = 'session-items'
7
+
4
8
  export const useContext = (): Context => useBasicContext<Config, Context>()
5
9
 
6
- export const makeContext = <C extends Config, T extends Context<C>>(cfg: C): T =>
7
- makeBasicContext<C, T>(cfg)
10
+ export const makeContext = <C extends Config, T extends Context<C>>(cfg: C): T => {
11
+ const context = makeBasicContext<C, T>(cfg)
12
+
13
+ // The framework's client store. A state resource lives ON the context, so a screen, a guard and
14
+ // a service all reach the same records — which is what separates it from a store held beside
15
+ // the app in a module of its own.
16
+ appendStateResource<C, T>(context, SESSION_STATE)
17
+
18
+ return context
19
+ }
@@ -0,0 +1,13 @@
1
+ import { bindAll, bindScreen, entrypoints as baseEntrypoints, handler } from '@owlmeans/web-panel'
2
+ import { appProtocols } from '__APP_SLUG__-common'
3
+ import { MainLayout } from './layout/main.js'
4
+ import { HomeScreen } from './screens/home.js'
5
+
6
+ /** Local browser bindings for shared API and screen protocols. */
7
+ export const appBindings = [
8
+ ...baseEntrypoints,
9
+ ...bindAll(appProtocols.api),
10
+ // BASE renders the shared layout; HOME is its default child.
11
+ bindScreen(appProtocols.web.base, handler(MainLayout)),
12
+ bindScreen(appProtocols.web.home, handler(HomeScreen)),
13
+ ]
@@ -0,0 +1,16 @@
1
+ import { bindAll, bindScreen, entrypoints as baseEntrypoints, handler } from '@owlmeans/web-panel'
2
+ import { appProtocols } from '__APP_SLUG__-common'
3
+ import { MainLayout } from './layout/main.js'
4
+ import { AboutScreen } from './screens/about.js'
5
+ import { HomeScreen } from './screens/home.js'
6
+ import { SessionScreen } from './screens/session.js'
7
+
8
+ /** Local browser bindings for shared API and screen protocols. */
9
+ export const appBindings = [
10
+ ...baseEntrypoints,
11
+ ...bindAll(appProtocols.api),
12
+ bindScreen(appProtocols.web.base, handler(MainLayout)),
13
+ bindScreen(appProtocols.web.home, handler(HomeScreen)),
14
+ bindScreen(appProtocols.web.session, handler(SessionScreen)),
15
+ bindScreen(appProtocols.web.about, handler(AboutScreen)),
16
+ ]
@@ -1,5 +1,12 @@
1
1
  @import "tailwindcss";
2
2
 
3
+ /*
4
+ * Tailwind scans this app's sources for class names, and node_modules is excluded from that
5
+ * scan by default — so the classes that exist ONLY inside @owlmeans/web-panel components
6
+ * (the navigation shell, the footer) would never reach the stylesheet. This line adds them.
7
+ */
8
+ @source "../../../node_modules/@owlmeans/web-panel/src";
9
+
3
10
  /*
4
11
  * shadcn / Tailwind v4 design tokens (new-york, neutral). The app owns these — they
5
12
  * replace what @owlmeans/owl-theme would otherwise provide. The shadcn primitives in
@@ -2,12 +2,12 @@ import './index.css'
2
2
  import { APP_API, APP_WEB } from '__APP_SLUG__-common'
3
3
  import config from './config.js'
4
4
  import { makeContext } from './context.js'
5
- import { appModules } from './modules.js'
5
+ import { appBindings } from './entrypoints.js'
6
6
  import { render } from './render.js'
7
7
  import type { Config, Context } from './types.js'
8
8
 
9
9
  const context = makeContext<Config, Context>(config)
10
- context.registerEntrypoints(appModules)
10
+ context.registerEntrypoints(appBindings)
11
11
 
12
12
  context.serviceRoute(APP_WEB, true)
13
13
  context.serviceRoute(APP_API, true)
@@ -1,21 +1,18 @@
1
1
  import type { FC, PropsWithChildren } from 'react'
2
- import { HOME, useNavigate } from '@owlmeans/web-panel'
3
- import { MainNavigation } from '@/components/nav/main'
2
+ import { NavLayout } from '@owlmeans/web-panel'
3
+ import { footerLinks, navConfig } from '@/nav'
4
4
 
5
- export const MainLayout: FC<PropsWithChildren> = ({ children }) => {
6
- const nav = useNavigate()
7
-
8
- return (
9
- <div className="min-h-screen bg-background text-foreground">
10
- <header className="border-b">
11
- <div className="mx-auto flex h-16 max-w-4xl items-center justify-between px-4">
12
- <a onClick={nav.press(HOME)} className="cursor-pointer text-lg font-semibold">
13
- __APP_NAME__
14
- </a>
15
- <MainNavigation />
16
- </div>
17
- </header>
18
- <main className="mx-auto max-w-4xl px-4 py-8">{children}</main>
19
- </div>
20
- )
21
- }
5
+ /**
6
+ * The application shell. `NavLayout` renders the header with the section menu, the side menu
7
+ * of the active section (hidden when that section has a single screen), the content, and the
8
+ * footer — the screen arrives as `children`.
9
+ *
10
+ * The page width comes from the shell, which applies it to the header, the content and the
11
+ * footer alike; set `containerClassName` to change it for all three at once, never a width on
12
+ * the content alone.
13
+ */
14
+ export const MainLayout: FC<PropsWithChildren> = ({ children }) => (
15
+ <NavLayout nav={navConfig} title="__APP_NAME__" footer={footerLinks}>
16
+ {children}
17
+ </NavLayout>
18
+ )
@@ -0,0 +1,21 @@
1
+ import { HOME } from '@owlmeans/web-panel'
2
+ import type { PanelNavConfig, PanelNavLink } from '@owlmeans/web-panel'
3
+
4
+ /**
5
+ * The application's navigation, as data.
6
+ *
7
+ * Sections are the top menu; their items are the side menu of whichever section is active.
8
+ * A section holding ONE item renders no side menu at all — which is why the single-screen
9
+ * shell below shows none. Labels here are literal; drop them to fall back on the panel i18n
10
+ * keys (`nav.<section>` / `modules.<alias>`) instead.
11
+ */
12
+ export const navConfig: PanelNavConfig = {
13
+ sections: [
14
+ { name: 'home', label: 'Home', items: [{ alias: HOME, label: 'Overview' }] },
15
+ ],
16
+ }
17
+
18
+ export const footerLinks: PanelNavLink[] = [
19
+ { alias: HOME, label: '__APP_NAME__' },
20
+ { href: 'https://owlmeans.com', label: 'OwlMeans', open: true },
21
+ ]
@@ -0,0 +1,28 @@
1
+ import { HOME } from '@owlmeans/web-panel'
2
+ import type { PanelNavConfig, PanelNavLink } from '@owlmeans/web-panel'
3
+ import { web } from '__APP_SLUG__-common'
4
+
5
+ /**
6
+ * The application's navigation, as data.
7
+ *
8
+ * Sections are the top menu; their items are the side menu of whichever section is active.
9
+ * A section holding ONE item renders no side menu at all — `home` below shows that, `demo`
10
+ * shows the two-level case. Labels here are literal; drop them to fall back on the panel
11
+ * i18n keys (`nav.<section>` / `modules.<alias>`) instead.
12
+ */
13
+ export const navConfig: PanelNavConfig = {
14
+ sections: [
15
+ { name: 'home', label: 'Home', items: [{ alias: HOME, label: 'Overview' }] },
16
+ {
17
+ name: 'demo', label: 'Demo', items: [
18
+ { alias: web.session.alias, label: 'Session' },
19
+ { alias: web.about.alias, label: 'About' },
20
+ ]
21
+ },
22
+ ],
23
+ }
24
+
25
+ export const footerLinks: PanelNavLink[] = [
26
+ { alias: HOME, label: '__APP_NAME__' },
27
+ { href: 'https://owlmeans.com', label: 'OwlMeans', open: true },
28
+ ]
@@ -0,0 +1,19 @@
1
+ import type { FC } from 'react'
2
+ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
3
+
4
+ export const AboutScreen: FC = () => (
5
+ <Card>
6
+ <CardHeader>
7
+ <CardTitle>About __APP_NAME__</CardTitle>
8
+ <CardDescription>
9
+ The second screen of the Demo section — which is why that section shows a side menu
10
+ and the single-screen Home section does not.
11
+ </CardDescription>
12
+ </CardHeader>
13
+ <CardContent>
14
+ <p className="text-sm text-muted-foreground">
15
+ Built with OwlMeans Common. Navigation lives in <code>src/nav.ts</code>.
16
+ </p>
17
+ </CardContent>
18
+ </Card>
19
+ )
@@ -0,0 +1,17 @@
1
+ import type { FC } from 'react'
2
+ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
3
+
4
+ export const HomeScreen: FC = () => (
5
+ <Card>
6
+ <CardHeader>
7
+ <CardTitle>__APP_NAME__</CardTitle>
8
+ <CardDescription>__APP_DESCRIPTION__</CardDescription>
9
+ </CardHeader>
10
+ <CardContent>
11
+ <p className="text-sm text-muted-foreground">
12
+ Screens live in <code>src/screens</code>, the menu that reaches them in
13
+ {' '}<code>src/nav.ts</code>, and the routes they hang off in <code>src/entrypoints.ts</code>.
14
+ </p>
15
+ </CardContent>
16
+ </Card>
17
+ )
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useState, type FC } from 'react'
2
- import type { ClientEntrypoint } from '@owlmeans/client-entrypoint'
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 [data] = await ctx
29
- .entrypoint<ClientEntrypoint<SessionItem[]>>(session.list)
40
+ const data = await ctx
41
+ .entrypoint(session.list)
30
42
  .call({ params: { sid } })
31
- setItems(data ?? [])
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<ClientEntrypoint<SessionItem>>(session.add)
52
+ const item = await ctx
53
+ .entrypoint(session.add)
42
54
  .call({ params: { sid }, body: { text } })
43
55
  setText('')
44
- await load()
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<ClientEntrypoint<{ removed: boolean }>>(session.remove)
66
+ .entrypoint(session.remove)
53
67
  .call({ params: { sid, id } })
54
- await load()
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