@owlmeans/create-app 0.1.18-rc.6 → 0.1.18-rc.61

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 (115) hide show
  1. package/README.md +49 -5
  2. package/build/args/types.d.ts +9 -0
  3. package/build/args/types.d.ts.map +1 -0
  4. package/build/args/types.js +2 -0
  5. package/build/args/types.js.map +1 -0
  6. package/build/args.d.ts +3 -20
  7. package/build/args.d.ts.map +1 -1
  8. package/build/args.js +121 -88
  9. package/build/args.js.map +1 -1
  10. package/build/bin.js +3 -3
  11. package/build/bin.js.map +1 -1
  12. package/build/consts.d.ts +6 -0
  13. package/build/consts.d.ts.map +1 -0
  14. package/build/consts.js +6 -0
  15. package/build/consts.js.map +1 -0
  16. package/build/consts.local.d.ts +12 -0
  17. package/build/consts.local.d.ts.map +1 -0
  18. package/build/consts.local.js +49 -0
  19. package/build/consts.local.js.map +1 -0
  20. package/build/index.d.ts +11 -4
  21. package/build/index.d.ts.map +1 -1
  22. package/build/index.js +5 -2
  23. package/build/index.js.map +1 -1
  24. package/build/naming/types.d.ts +14 -0
  25. package/build/naming/types.d.ts.map +1 -0
  26. package/build/naming/types.js +2 -0
  27. package/build/naming/types.js.map +1 -0
  28. package/build/naming.d.ts +4 -0
  29. package/build/naming.d.ts.map +1 -0
  30. package/build/naming.js +18 -0
  31. package/build/naming.js.map +1 -0
  32. package/build/run.d.ts +1 -1
  33. package/build/run.d.ts.map +1 -1
  34. package/build/run.js +23 -17
  35. package/build/run.js.map +1 -1
  36. package/build/scaffold.d.ts +8 -0
  37. package/build/scaffold.d.ts.map +1 -0
  38. package/build/scaffold.js +19 -0
  39. package/build/scaffold.js.map +1 -0
  40. package/build/template/types.d.ts +16 -0
  41. package/build/template/types.d.ts.map +1 -0
  42. package/build/template/types.js +2 -0
  43. package/build/template/types.js.map +1 -0
  44. package/build/template.d.ts +3 -16
  45. package/build/template.d.ts.map +1 -1
  46. package/build/template.js +69 -52
  47. package/build/template.js.map +1 -1
  48. package/build/types.d.ts +61 -0
  49. package/build/types.d.ts.map +1 -0
  50. package/build/types.js +2 -0
  51. package/build/types.js.map +1 -0
  52. package/package.json +5 -4
  53. package/template/AGENTS.md +61 -2
  54. package/template/README.bare.md +70 -0
  55. package/template/README.md +9 -60
  56. package/template/_agents/scripts/link-skills.sh +327 -15
  57. package/template/_agents/skills/agent-memory/SKILL.md +12 -11
  58. package/template/_agents/skills/getting-started/SKILL.md +38 -79
  59. package/template/_agents/skills/logging/SKILL.md +41 -0
  60. package/template/_agents/skills/memory-promotion/SKILL.md +10 -4
  61. package/template/_agents/skills/memory-recompact/SKILL.md +15 -14
  62. package/template/_agents/skills/owlmeans-code-structure/SKILL.md +182 -0
  63. package/template/_agents/skills/reuse-code/SKILL.md +56 -10
  64. package/template/_agents/skills/self-education/SKILL.md +25 -5
  65. package/template/_agents/skills/skill-authoring/SKILL.md +78 -12
  66. package/template/_bare.json +24 -0
  67. package/template/_gitignore +8 -0
  68. package/template/bunfig.toml +2 -0
  69. package/template/package.json +3 -2
  70. package/template/sources/api/package.json +5 -4
  71. package/template/sources/api/src/app/session/add.ts +6 -17
  72. package/template/sources/api/src/app/session/list.ts +6 -12
  73. package/template/sources/api/src/app/session/remove.ts +6 -15
  74. package/template/sources/api/src/config.ts +7 -0
  75. package/template/sources/api/src/context.bare.ts +11 -0
  76. package/template/sources/api/src/entrypoints.bare.ts +4 -0
  77. package/template/sources/api/src/entrypoints.ts +13 -0
  78. package/template/sources/api/src/index.ts +8 -2
  79. package/template/sources/api/src/models/session/types.ts +14 -0
  80. package/template/sources/api/src/models/session.ts +43 -0
  81. package/template/sources/api/src/types.bare.ts +5 -0
  82. package/template/sources/common/package.json +8 -8
  83. package/template/sources/common/src/config.ts +2 -1
  84. package/template/sources/common/src/consts.bare.ts +8 -0
  85. package/template/sources/common/src/consts.ts +0 -13
  86. package/template/sources/common/src/entrypoints.bare.ts +14 -0
  87. package/template/sources/common/src/entrypoints.ts +60 -0
  88. package/template/sources/common/src/index.bare.ts +3 -0
  89. package/template/sources/common/src/index.ts +1 -1
  90. package/template/sources/common/src/schemas.ts +7 -7
  91. package/template/sources/web/index.html +3 -1
  92. package/template/sources/web/package.json +33 -30
  93. package/template/sources/web/src/components/ui/dropdown-menu.tsx +257 -0
  94. package/template/sources/web/src/components/ui/navigation-menu.tsx +169 -0
  95. package/template/sources/web/src/config.ts +8 -0
  96. package/template/sources/web/src/consts.ts +14 -0
  97. package/template/sources/web/src/context.bare.ts +13 -0
  98. package/template/sources/web/src/context.ts +12 -2
  99. package/template/sources/web/src/entrypoints.bare.ts +13 -0
  100. package/template/sources/web/src/entrypoints.ts +16 -0
  101. package/template/sources/web/src/index.css +7 -0
  102. package/template/sources/web/src/index.tsx +2 -2
  103. package/template/sources/web/src/layout/main.tsx +17 -19
  104. package/template/sources/web/src/nav.bare.ts +23 -0
  105. package/template/sources/web/src/nav.ts +23 -0
  106. package/template/sources/web/src/screens/about.tsx +19 -0
  107. package/template/sources/web/src/screens/home.bare.tsx +17 -0
  108. package/template/sources/web/src/screens/session.tsx +30 -17
  109. package/template/sources/web/src/vite-env.d.ts +8 -0
  110. package/template/sources/web/vite.config.ts +3 -2
  111. package/template/CLAUDE.md +0 -13
  112. package/template/sources/api/src/modules.ts +0 -11
  113. package/template/sources/common/src/modules.ts +0 -26
  114. package/template/sources/web/src/components/nav/main.tsx +0 -15
  115. package/template/sources/web/src/modules.ts +0 -20
@@ -0,0 +1,23 @@
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
+ // The platform/owner credit — "Powered by OwlMeans" and the copyright the platform delivers — is
19
+ // rendered by the shell itself (`NavLayout`'s `Footer`) and is never a footer link: an app link
20
+ // list is places IN the app, and the credit is not one of those.
21
+ export const footerLinks: PanelNavLink[] = [
22
+ { alias: HOME, label: '__APP_NAME__' },
23
+ ]
@@ -0,0 +1,23 @@
1
+ import { HOME, type PanelNavConfig } from '@owlmeans/web-panel'
2
+ import { web } from '__APP_SLUG__-common'
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 — `home` below shows that, `demo`
9
+ * shows the two-level case. Labels here are literal; drop them to fall back on the panel
10
+ * i18n 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
+ name: 'demo', label: 'Demo', items: [
17
+ { alias: web.session.alias, label: 'Session' },
18
+ { alias: web.about.alias, label: 'About' },
19
+ ]
20
+ },
21
+ ],
22
+ }
23
+
@@ -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,18 +1,17 @@
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
4
  import { useContext } from '../context.js'
5
+ import { SESSION_ID_KEY, SESSION_STATE } from '../consts.js'
5
6
  import { Button } from '@/components/ui/button'
6
7
  import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
7
8
  import { Input } from '@/components/ui/input'
8
9
 
9
- const SID_KEY = '__APP_SLUG__-sid'
10
-
11
10
  const sessionId = (): string => {
12
- let sid = localStorage.getItem(SID_KEY)
11
+ let sid = localStorage.getItem(SESSION_ID_KEY)
13
12
  if (sid == null) {
14
13
  sid = crypto.randomUUID()
15
- localStorage.setItem(SID_KEY, sid)
14
+ localStorage.setItem(SESSION_ID_KEY, sid)
16
15
  }
17
16
  return sid
18
17
  }
@@ -20,15 +19,27 @@ const sessionId = (): string => {
20
19
  export const SessionScreen: FC = () => {
21
20
  const ctx = useContext()
22
21
  const sid = sessionId()
23
- const [items, setItems] = useState<SessionItem[]>([])
24
22
  const [text, setText] = useState('')
25
23
  const [busy, setBusy] = useState(false)
26
24
 
25
+ const store = ctx.getStateResource<SessionItem>(SESSION_STATE)
26
+
27
+ /**
28
+ * The list is a live subscription to the state resource, not a piece of component state.
29
+ * Anything that writes a record — this screen or another one — re-renders it, so adding and
30
+ * removing never re-fetch to stay in step. `{}` matches every record; a real filter goes here.
31
+ */
32
+ const items = useStoreList<SessionItem>({ query: {}, resource: SESSION_STATE })
33
+
34
+ // The server is the source of truth; the store is what the screen reads. Fetch once, install
35
+ // what came back, and let the subscription render it. `replace` rather than a save per item:
36
+ // the endpoint answers with the session's whole set, so an item removed on another tab has to
37
+ // leave the store too, and one write wakes the subscribers once instead of once per record.
27
38
  const load = async () => {
28
- const [data] = await ctx
29
- .entrypoint<ClientEntrypoint<SessionItem[]>>(session.list)
39
+ const data = await ctx
40
+ .entrypoint(session.list)
30
41
  .call({ params: { sid } })
31
- setItems(data ?? [])
42
+ await store.replace(data ?? [])
32
43
  }
33
44
 
34
45
  useEffect(() => { void load() }, [])
@@ -37,11 +48,13 @@ export const SessionScreen: FC = () => {
37
48
  if (text.trim() === '') return
38
49
  setBusy(true)
39
50
  try {
40
- await ctx
41
- .entrypoint<ClientEntrypoint<SessionItem>>(session.add)
51
+ const item = await ctx
52
+ .entrypoint(session.add)
42
53
  .call({ params: { sid }, body: { text } })
43
54
  setText('')
44
- await load()
55
+ if (item != null) {
56
+ await store.save(item)
57
+ }
45
58
  } finally {
46
59
  setBusy(false)
47
60
  }
@@ -49,9 +62,9 @@ export const SessionScreen: FC = () => {
49
62
 
50
63
  const remove = async (id: string) => {
51
64
  await ctx
52
- .entrypoint<ClientEntrypoint<{ removed: boolean }>>(session.remove)
65
+ .entrypoint(session.remove)
53
66
  .call({ params: { sid, id } })
54
- await load()
67
+ await store.delete(id)
55
68
  }
56
69
 
57
70
  return (
@@ -75,11 +88,11 @@ export const SessionScreen: FC = () => {
75
88
  <ul className="flex flex-col gap-2">
76
89
  {items.map(item => (
77
90
  <li
78
- key={item.id}
91
+ key={item.record.id}
79
92
  className="flex items-center justify-between rounded-md border px-3 py-2"
80
93
  >
81
- <span>{item.text}</span>
82
- <Button variant="ghost" size="sm" onClick={() => void remove(item.id)}>
94
+ <span>{item.record.text}</span>
95
+ <Button variant="ghost" size="sm" onClick={() => void remove(item.record.id)}>
83
96
  Remove
84
97
  </Button>
85
98
  </li>
@@ -0,0 +1,8 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ /** `debug` | `info` | `warn` | `error` | `silent`. Default: `debug` under `vite`, `info` in a build. */
5
+ readonly VITE_LOG_LEVEL?: string
6
+ /** Scopes forced to debug whatever the level is, e.g. `session,i18n` or `*`. */
7
+ readonly VITE_LOG_DEBUG?: string
8
+ }
@@ -1,6 +1,5 @@
1
1
  import { defineConfig } from 'vite'
2
2
  import react from '@vitejs/plugin-react'
3
- import tsconfigPaths from 'vite-tsconfig-paths'
4
3
  import tailwindcss from '@tailwindcss/vite'
5
4
  import path from 'path'
6
5
 
@@ -14,13 +13,15 @@ const owlMeansSingletons = [
14
13
  ]
15
14
 
16
15
  export default defineConfig({
17
- plugins: [react(), tsconfigPaths(), tailwindcss()],
16
+ plugins: [react(), tailwindcss()],
18
17
  server: {
19
18
  port: 3001,
20
19
  host: '0.0.0.0',
21
20
  strictPort: true,
22
21
  },
23
22
  resolve: {
23
+ // Vite resolves the `paths` of tsconfig.json itself since 8.
24
+ tsconfigPaths: true,
24
25
  alias: [
25
26
  { find: '@', replacement: path.resolve(__dirname, 'src') },
26
27
  ],
@@ -1,13 +0,0 @@
1
- @AGENTS.md
2
-
3
- ## Claude Code bridge
4
-
5
- All guidance lives in `AGENTS.md` (imported above) and in skills under
6
- `.agents/skills/<name>/SKILL.md` — the single canonical location shared with Copilot
7
- and Codex. `.claude/skills/` holds only generated per-skill symlinks (gitignored
8
- except `.gitkeep`); the committed `SessionStart` hook runs
9
- `sh .agents/scripts/link-skills.sh` to (re)create them each session.
10
-
11
- - Never author files under `.claude/skills/` — write skills in `.agents/skills/`.
12
- - After creating, renaming, or deleting a skill, re-run
13
- `sh .agents/scripts/link-skills.sh` so this session picks it up.
@@ -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