@podosoft/podokit 0.11.1 → 0.12.0

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 (94) hide show
  1. package/README.md +7 -3
  2. package/dist/add.d.ts +16 -0
  3. package/dist/add.js +63 -20
  4. package/dist/assemble.js +9 -9
  5. package/dist/dev.d.ts +26 -0
  6. package/dist/dev.js +297 -0
  7. package/dist/index.d.ts +4 -0
  8. package/dist/index.js +82 -2
  9. package/dist/lib.d.ts +2 -0
  10. package/dist/lib.js +7 -1
  11. package/dist/locale.d.ts +22 -0
  12. package/dist/locale.js +184 -0
  13. package/dist/lockfile.d.ts +5 -3
  14. package/dist/lockfile.js +21 -5
  15. package/dist/remove.js +26 -23
  16. package/dist/templates/fullstack-nest-svelte/README.md +42 -0
  17. package/dist/templates/fullstack-nest-svelte/apps/api/Dockerfile +1 -0
  18. package/dist/templates/fullstack-nest-svelte/apps/api/scripts/.keep +1 -0
  19. package/dist/templates/fullstack-nest-svelte/apps/web/src/lib/i18n/README.md +7 -5
  20. package/dist/templates/fullstack-nest-svelte/apps/web/src/lib/i18n/catalogs/app/en.json +1 -0
  21. package/dist/templates/fullstack-nest-svelte/apps/web/src/lib/i18n/catalogs/app/ko.json +1 -0
  22. package/dist/templates/fullstack-nest-svelte/apps/web/src/lib/i18n/locales/en.json +6 -0
  23. package/dist/templates/fullstack-nest-svelte/apps/web/src/lib/i18n/locales/ko.json +6 -0
  24. package/dist/templates/fullstack-nest-svelte/apps/web/vite.config.ts +3 -9
  25. package/dist/templates/fullstack-nest-svelte/compose.dev.yaml +8 -11
  26. package/dist/templates/fullstack-nest-svelte/dot-claude/skills/podokit-add-locale/SKILL.md +63 -0
  27. package/dist/templates/fullstack-nest-svelte/dot-claude/skills/podokit-add-locale/agents/openai.yaml +4 -0
  28. package/dist/templates/fullstack-nest-svelte/dot-claude/skills/podokit-add-locale/references/catalog-format.md +49 -0
  29. package/dist/templates/fullstack-nest-svelte/dot-env.docker +2 -2
  30. package/dist/templates/fullstack-nest-svelte/dot-gitignore +3 -0
  31. package/dist/templates/fullstack-nest-svelte/dot-podokit/dev.json +4 -0
  32. package/dist/templates/fullstack-nest-svelte/tests/README.md +10 -4
  33. package/dist/templates/modules/admin-dashboard/files/apps/api/scripts/bootstrap-admin.mjs +187 -0
  34. package/dist/templates/modules/admin-dashboard/files/apps/api/src/site-settings/site-settings.controller.ts +9 -0
  35. package/dist/templates/modules/admin-dashboard/files/apps/web/src/hooks.server.ts +5 -1
  36. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/auth-errors.ts +3 -0
  37. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/auth-redirect.ts +27 -0
  38. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/components/account-menu.svelte +8 -3
  39. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/components/sidebar-user-menu.svelte +1 -1
  40. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/i18n/catalogs/admin-dashboard/en.json +564 -0
  41. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/i18n/catalogs/admin-dashboard/ko.json +564 -0
  42. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/i18n/index.ts +13 -12
  43. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/i18n/messages.ts +90 -722
  44. package/dist/templates/modules/admin-dashboard/files/apps/web/src/lib/site.svelte.ts +8 -1
  45. package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/(app)/admin/audit/+page.svelte +4 -4
  46. package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/(app)/admin/organizations/+page.svelte +2 -2
  47. package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/(app)/admin/sessions/+page.svelte +4 -4
  48. package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/(app)/admin/settings/+page.svelte +8 -2
  49. package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/(app)/admin/settings/general-settings.svelte +15 -4
  50. package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/(app)/admin/users/+page.svelte +4 -4
  51. package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/(auth)/login/+page.svelte +32 -35
  52. package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/(auth)/signup/+page.svelte +10 -3
  53. package/dist/templates/modules/admin-dashboard/files/apps/web/src/routes/+layout.server.ts +11 -7
  54. package/dist/templates/modules/admin-dashboard/files/tests/api/auth-config.api.spec.ts +78 -0
  55. package/dist/templates/modules/admin-dashboard/files/tests/ui/auth.ui.spec.ts +28 -1
  56. package/dist/templates/modules/admin-dashboard/files/tests/ui/email.ui.spec.ts +1 -1
  57. package/dist/templates/modules/admin-dashboard/files/tests/ui/general-effects.ui.spec.ts +15 -0
  58. package/dist/templates/modules/admin-dashboard/files/tests/ui/i18n.ui.spec.ts +59 -6
  59. package/dist/templates/modules/admin-dashboard/files/tests/ui/login-methods.ui.spec.ts +1 -1
  60. package/dist/templates/modules/admin-dashboard/files/tests/ui/passkey.ui.spec.ts +1 -1
  61. package/dist/templates/modules/admin-dashboard/files/tests/ui/settings-dialogs.ui.spec.ts +5 -0
  62. package/dist/templates/modules/admin-dashboard/files/tests/ui/two-factor.ui.spec.ts +2 -2
  63. package/dist/templates/modules/admin-dashboard/module.manifest.json +14 -3
  64. package/dist/templates/modules/auth/files/apps/api/scripts/configure-auth.mjs +22 -11
  65. package/dist/templates/modules/auth/files/apps/api/src/auth/auth.ts +6 -2
  66. package/dist/templates/modules/auth/files/apps/api/src/auth/feature-gate.ts +50 -25
  67. package/dist/templates/modules/auth/files/dot-claude/skills/podokit-configure-auth/SKILL.md +15 -2
  68. package/dist/templates/modules/auth/files/dot-claude/skills/podokit-configure-auth/agents/openai.yaml +2 -2
  69. package/dist/templates/modules/auth/files/dot-claude/skills/podokit-configure-auth/references/bootstrap-admin.md +51 -0
  70. package/dist/templates/modules/auth/files/dot-claude/skills/podokit-configure-auth/references/google.md +44 -0
  71. package/dist/templates/modules/auth/module.manifest.json +3 -0
  72. package/dist/templates/todo/README.md +42 -0
  73. package/dist/templates/todo/apps/api/Dockerfile +1 -0
  74. package/dist/templates/todo/apps/api/scripts/.keep +1 -0
  75. package/dist/templates/todo/apps/web/src/lib/i18n/README.md +7 -5
  76. package/dist/templates/todo/apps/web/src/lib/i18n/catalogs/app/en.json +1 -0
  77. package/dist/templates/todo/apps/web/src/lib/i18n/catalogs/app/ko.json +1 -0
  78. package/dist/templates/todo/apps/web/src/lib/i18n/locales/en.json +6 -0
  79. package/dist/templates/todo/apps/web/src/lib/i18n/locales/ko.json +6 -0
  80. package/dist/templates/todo/apps/web/vite.config.ts +3 -9
  81. package/dist/templates/todo/compose.dev.yaml +8 -11
  82. package/dist/templates/todo/dot-claude/skills/podokit-add-locale/SKILL.md +63 -0
  83. package/dist/templates/todo/dot-claude/skills/podokit-add-locale/agents/openai.yaml +4 -0
  84. package/dist/templates/todo/dot-claude/skills/podokit-add-locale/references/catalog-format.md +49 -0
  85. package/dist/templates/todo/dot-env.docker +2 -2
  86. package/dist/templates/todo/dot-gitignore +3 -0
  87. package/dist/templates/todo/dot-podokit/dev.json +4 -0
  88. package/dist/templates/todo/tests/README.md +10 -4
  89. package/dist/update.js +48 -7
  90. package/package.json +1 -1
  91. package/dist/templates/fullstack-nest-svelte/apps/web/src/lib/i18n/en.ts +0 -10
  92. package/dist/templates/fullstack-nest-svelte/apps/web/src/lib/i18n/ko.ts +0 -11
  93. package/dist/templates/todo/apps/web/src/lib/i18n/en.ts +0 -10
  94. package/dist/templates/todo/apps/web/src/lib/i18n/ko.ts +0 -11
@@ -0,0 +1,6 @@
1
+ {
2
+ "code": "en",
3
+ "name": "English",
4
+ "direction": "ltr",
5
+ "enabled": true
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "code": "ko",
3
+ "name": "한국어",
4
+ "direction": "ltr",
5
+ "enabled": true
6
+ }
@@ -2,15 +2,10 @@ import { sveltekit } from "@sveltejs/kit/vite";
2
2
  import tailwindcss from "@tailwindcss/vite";
3
3
  import { defineConfig } from "vite";
4
4
 
5
- // Inside the dev container (compose.dev.yaml sets VITE_DOCKER=1): bind to all
6
- // interfaces, allow the Traefik hostname, and route HMR's WebSocket back through
7
- // Traefik. The browser reaches the app at Traefik's published host port, so the
8
- // HMR client must target that same port — otherwise the ws connects to :80,
9
- // fails, and Vite silently falls back to a full page reload on every change
10
- // (which wipes in-progress form input). compose.dev.yaml injects
11
- // VITE_HMR_CLIENT_PORT to match the published Traefik port (default 80).
5
+ // Inside the dev container, bind to all interfaces and accept local gateway or
6
+ // HTTPS tunnel hostnames. Vite derives HMR's protocol, host, and port from the
7
+ // browser origin so the same configuration works for both entry points.
12
8
  const inDocker = process.env.VITE_DOCKER === "1";
13
- const hmrClientPort = Number(process.env.VITE_HMR_CLIENT_PORT) || 80;
14
9
 
15
10
  export default defineConfig({
16
11
  plugins: [tailwindcss(), sveltekit()],
@@ -19,7 +14,6 @@ export default defineConfig({
19
14
  host: true,
20
15
  port: 5001,
21
16
  allowedHosts: true,
22
- hmr: { clientPort: hmrClientPort },
23
17
  }
24
18
  : undefined,
25
19
  });
@@ -1,13 +1,11 @@
1
1
  # Containerized development environment.
2
2
  #
3
- # docker compose -f compose.dev.yaml watch # core stack
4
- # docker compose -f compose.dev.yaml --profile cache \
5
- # --profile storage --profile queue watch # with modules
3
+ # podo dev watch # core stack
4
+ # podo dev watch --profile cache --profile storage \
5
+ # --profile queue # with modules
6
6
  #
7
- # Only Traefik binds a host port (default 80). The app is at http://app.localhost.
8
- # Set TRAEFIK_PORT to publish on another port (e.g. TRAEFIK_PORT=8001) so several
9
- # containerized stacks can run at once without colliding — the web container reads
10
- # the same value as VITE_HMR_CLIENT_PORT so Vite HMR follows automatically.
7
+ # A user-level PodoKit gateway owns loopback :80 and routes each *.localhost host
8
+ # to this stack. The legacy per-project Traefik service is opt-in only.
11
9
  # api/postgres/redis/minio have NO published ports — they talk by service name
12
10
  # on the internal network, so this stack never collides with other projects.
13
11
  #
@@ -24,6 +22,7 @@ name: {{projectName}}-dev
24
22
 
25
23
  services:
26
24
  traefik:
25
+ profiles: [podokit-legacy-proxy]
27
26
  image: traefik:v3.5
28
27
  command:
29
28
  - --providers.file.filename=/etc/traefik/dynamic.yml
@@ -52,10 +51,6 @@ services:
52
51
  # getClientAddress() tied to the visitor instead of the proxy container.
53
52
  - ADDRESS_HEADER=x-forwarded-for
54
53
  - XFF_DEPTH=1
55
- # Match Traefik's published port so HMR's WebSocket targets the right port
56
- # (default 80). Without this, HMR connects to :80 and a non-80 stack falls
57
- # back to a full page reload on every edit.
58
- - VITE_HMR_CLIENT_PORT=${TRAEFIK_PORT:-80}
59
54
  depends_on: [api]
60
55
  networks: [podokit]
61
56
  develop:
@@ -83,6 +78,7 @@ services:
83
78
  # sync+restart is the stable, recommended approach; the web keeps instant
84
79
  # HMR via plain sync.
85
80
  - { action: sync+restart, path: ./apps/api/src, target: /app/apps/api/src }
81
+ - { action: sync, path: ./apps/api/scripts, target: /app/apps/api/scripts }
86
82
  - { action: rebuild, path: ./apps/api/package.json }
87
83
 
88
84
  worker:
@@ -105,6 +101,7 @@ services:
105
101
  # sync+restart is the stable, recommended approach; the web keeps instant
106
102
  # HMR via plain sync.
107
103
  - { action: sync+restart, path: ./apps/api/src, target: /app/apps/api/src }
104
+ - { action: sync, path: ./apps/api/scripts, target: /app/apps/api/scripts }
108
105
  - { action: rebuild, path: ./apps/api/package.json }
109
106
 
110
107
  postgres:
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: podokit-add-locale
3
+ description: Add, translate, validate, activate, or troubleshoot a JSON locale in a PodoKit-generated SvelteKit app. Use when a user asks to add a language, split or edit locale JSON, check translation coverage or placeholders, configure fallback behavior, or verify locale changes through Vite HMR.
4
+ ---
5
+
6
+ # PodoKit Add Locale
7
+
8
+ Add languages through the PodoKit locale commands and the app-owned JSON catalog. Keep module catalogs managed so `podo update` can continue to update them.
9
+
10
+ ## Workflow
11
+
12
+ 1. Inspect the existing locale state.
13
+
14
+ ```sh
15
+ podo locale list
16
+ ```
17
+
18
+ 2. Add a canonical BCP 47 language tag. Set `--direction rtl` only for right-to-left languages.
19
+
20
+ ```sh
21
+ podo locale add pt-BR --name "Português (Brasil)"
22
+ ```
23
+
24
+ 3. Read [references/catalog-format.md](references/catalog-format.md), then translate the new app-owned file at `apps/web/src/lib/i18n/catalogs/app/<locale>.json`.
25
+
26
+ 4. Validate key coverage, JSON value types, and interpolation placeholders.
27
+
28
+ ```sh
29
+ podo locale validate pt-BR
30
+ ```
31
+
32
+ 5. Activate the locale. Partial catalogs are permitted because runtime fallback fills missing keys, but report the coverage percentage to the user.
33
+
34
+ ```sh
35
+ podo locale activate pt-BR
36
+ ```
37
+
38
+ 6. Run the app with its documented container-based development command. Verify the language switch, one complete key, one fallback key, and locale persistence. Editing an existing JSON file must update through Vite HMR without restarting the container. Adding a new locale file may trigger an automatic full-page reload.
39
+
40
+ ## Rules
41
+
42
+ - Treat `en` as the stable final fallback and never deactivate it.
43
+ - Preserve placeholders exactly. For example, translate `Hello {name}` without renaming or removing `{name}`.
44
+ - Put product-specific copy only in `catalogs/app/`. Do not edit `catalogs/admin-dashboard/` or other module catalogs directly.
45
+ - Keep locale definition filenames identical to their canonical codes, including case such as `pt-BR.json`.
46
+ - Do not activate a locale definition before its JSON parses and `podo locale validate` succeeds.
47
+ - Do not use the UI message catalogs for user-authored records. Dynamic content needs locale-aware records and a separate publication/fallback policy.
48
+ - When deactivating a locale, preserve its files so it can be reactivated without losing translations.
49
+
50
+ ## Fallback And Site Default
51
+
52
+ The message runtime resolves missing keys in this order: selected locale, configured site default, then English. The site default is an administrator choice, not a build-time constant. Changing it must not delete or rewrite catalogs.
53
+
54
+ If a requested language is unsupported or inactive, resolve it to the configured site default. Keep localized URL and SEO behavior in the consuming app; the catalogs provide translated strings but do not define routing policy.
55
+
56
+ ## Completion Checklist
57
+
58
+ - `podo locale validate` succeeds for every active locale.
59
+ - The new locale definition is active and has the intended display name and direction.
60
+ - App-owned JSON contains the new product copy; managed module catalogs remain untouched.
61
+ - Development edits update without a container restart.
62
+ - Automated tests cover selection, fallback, placeholders, and at least one incomplete catalog.
63
+ - User-facing locale setup or routing documentation is updated when behavior changes.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "PodoKit Locale Setup"
3
+ short_description: "Add and validate JSON locale catalogs safely"
4
+ default_prompt: "Use $podokit-add-locale to add, validate, activate, and test a new JSON locale in this PodoKit app."
@@ -0,0 +1,49 @@
1
+ # JSON Catalog Format
2
+
3
+ ## Directory Layout
4
+
5
+ ```text
6
+ apps/web/src/lib/i18n/
7
+ ├── locales/
8
+ │ ├── en.json
9
+ │ ├── ko.json
10
+ │ └── pt-BR.json
11
+ └── catalogs/
12
+ ├── admin-dashboard/ # PodoKit-managed module messages
13
+ ├── blog/ # module-managed messages when installed
14
+ └── app/ # app-owned product messages and overrides
15
+ ```
16
+
17
+ Each locale definition has this shape:
18
+
19
+ ```json
20
+ {
21
+ "code": "pt-BR",
22
+ "name": "Português (Brasil)",
23
+ "direction": "ltr",
24
+ "enabled": false
25
+ }
26
+ ```
27
+
28
+ `code` must be a canonical BCP 47 tag and must match the filename. `direction` is `ltr` or `rtl`. Newly added locales stay inactive until explicitly activated.
29
+
30
+ ## Catalog Composition
31
+
32
+ Catalogs are nested JSON objects with strings at their leaves:
33
+
34
+ ```json
35
+ {
36
+ "common": {
37
+ "save": "Save",
38
+ "welcome": "Welcome, {name}"
39
+ }
40
+ }
41
+ ```
42
+
43
+ The runtime lazily loads every `catalogs/*/<locale>.json` file. Module catalogs are merged first in stable name order; the `app` catalog is merged last, so the consuming app may intentionally override module copy without modifying managed files.
44
+
45
+ English defines the complete key and value-type contract. Other locales may omit keys, but translated values must retain the English type and all `{placeholder}` names. JSON objects and arrays are supported; executable expressions are not.
46
+
47
+ ## Development Reloading
48
+
49
+ Catalog imports use Vite's `import.meta.glob`. Changes to an existing JSON dependency participate in Vite HMR and must appear without restarting the development container. A new file changes the glob membership and may cause Vite to reload the page automatically. If neither occurs, confirm that the app source directory, including `apps/web/src`, is mounted or synced by the development compose configuration.
@@ -6,11 +6,11 @@ POSTGRES_USER=podokit
6
6
  POSTGRES_PASSWORD=podokit
7
7
  POSTGRES_DB=podokit
8
8
  BACKEND_INTERNAL_URL=http://api:5002
9
- CORS_ORIGIN=http://app.localhost
9
+ CORS_ORIGIN=http://{{projectName}}.localhost,http://localhost
10
10
  REDIS_HOST=redis
11
11
  REDIS_PORT=6379
12
12
  BETTER_AUTH_SECRET=change-me-in-container-min-32-characters
13
- BETTER_AUTH_URL=http://app.localhost
13
+ BETTER_AUTH_URL=http://{{projectName}}.localhost
14
14
  ADMIN_EMAILS=admin@example.com
15
15
  AUDIT_LOG_ENABLED=true
16
16
  RATE_LIMIT_TTL=60
@@ -18,3 +18,6 @@ test-results/
18
18
 
19
19
  # local performance reports
20
20
  output/lighthouse/
21
+
22
+ # podo dev generated compose overlay
23
+ .podokit/runtime/
@@ -0,0 +1,4 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "hostname": "{{projectName}}.localhost"
4
+ }
@@ -9,7 +9,13 @@ npm run test:e2e:ui # pages (chromium)
9
9
  npm run test:e2e:report # open the HTML report
10
10
  ```
11
11
 
12
- The suite runs against a live stack (web on `E2E_BASE_URL`, default
13
- `http://localhost:5001`, proxying `/api/*` to the API). Start PostgreSQL, run the
14
- auth migration, and start the API + web first. Files ending in `*.api.spec.ts` run
15
- in the request-only `api` project; `*.ui.spec.ts` run in the chromium `ui` project.
12
+ The suite runs against a live stack (web on `E2E_BASE_URL`, proxying `/api/*` to
13
+ the API). With the recommended containerized loop, start `podo dev watch` and run:
14
+
15
+ ```bash
16
+ E2E_BASE_URL=http://{{projectName}}.localhost npm run test:e2e
17
+ ```
18
+
19
+ The default `http://localhost:5001` is for the alternative `npm run dev`
20
+ host-process loop. Files ending in `*.api.spec.ts` run in the request-only `api`
21
+ project; `*.ui.spec.ts` run in the chromium `ui` project.
package/dist/update.js CHANGED
@@ -20,6 +20,30 @@ function diskContent(projectRoot, path) {
20
20
  const abs = (0, node_path_1.join)(projectRoot, path);
21
21
  return (0, node_fs_1.existsSync)(abs) ? (0, node_fs_1.readFileSync)(abs) : null;
22
22
  }
23
+ function targetManagedOverrides(projectRoot, templatesDir, modules, current = []) {
24
+ const overrides = new Set(current);
25
+ const modulesDir = (0, node_path_1.join)(templatesDir, "modules");
26
+ for (const module of modules) {
27
+ const resolved = (0, add_1.resolveModule)(module.packageName ?? module.name, modulesDir, projectRoot);
28
+ if (!resolved)
29
+ continue;
30
+ for (const glob of (0, add_1.readModuleManifest)(resolved.dir).managedOverrides ?? [])
31
+ overrides.add(glob);
32
+ }
33
+ return [...overrides];
34
+ }
35
+ function targetOwnedGlobs(projectRoot, templatesDir, modules, current) {
36
+ const owned = new Set([...lockfile_1.DEFAULT_OWNED_GLOBS, ...current]);
37
+ const modulesDir = (0, node_path_1.join)(templatesDir, "modules");
38
+ for (const module of modules) {
39
+ const resolved = (0, add_1.resolveModule)(module.packageName ?? module.name, modulesDir, projectRoot);
40
+ if (!resolved)
41
+ continue;
42
+ for (const glob of (0, add_1.readModuleManifest)(resolved.dir).ownedGlobs ?? [])
43
+ owned.add(glob);
44
+ }
45
+ return [...owned];
46
+ }
23
47
  /**
24
48
  * Build the update plan. `templatesDir` is the installed CLI's template set (the
25
49
  * new version); the lock records what PodoKit last wrote (to detect user edits).
@@ -36,15 +60,26 @@ function planUpdate(projectRoot, templatesDir) {
36
60
  modules: manifest.modules,
37
61
  projectRoot,
38
62
  });
63
+ const managedOverrides = targetManagedOverrides(projectRoot, templatesDir, manifest.modules, manifest.managedOverrides);
64
+ const ownedGlobs = targetOwnedGlobs(projectRoot, templatesDir, manifest.modules, manifest.ownedGlobs);
39
65
  const changes = [];
40
66
  const paths = new Set([...newTree.keys(), ...Object.keys(lock.files)]);
41
67
  for (const path of [...paths].sort()) {
42
68
  const locked = lock.files[path];
43
69
  const newText = treeText(newTree, path);
44
70
  const disk = diskContent(projectRoot, path);
45
- // tier: prefer the lock; else classify the new file.
46
- const tier = locked?.tier ??
47
- (newText !== null ? (0, lockfile_1.classifyTier)(path, newText, manifest.ownedGlobs) : "managed");
71
+ // A newer module can explicitly take responsibility for a path that older
72
+ // projects classified under a broad owned glob (notably generated skills).
73
+ const managedByTarget = managedOverrides.some((glob) => (0, lockfile_1.matchGlob)(path, glob));
74
+ const ownedByTarget = ownedGlobs.some((glob) => (0, lockfile_1.matchGlob)(path, glob));
75
+ const tier = managedByTarget
76
+ ? "managed"
77
+ : ownedByTarget
78
+ ? "owned"
79
+ : locked?.tier ??
80
+ (newText !== null
81
+ ? (0, lockfile_1.classifyTier)(path, newText, ownedGlobs, managedOverrides)
82
+ : "managed");
48
83
  if (tier === "owned") {
49
84
  changes.push({ path, tier, action: "skip", note: "owned — never modified" });
50
85
  continue;
@@ -101,13 +136,15 @@ function writeFile(projectRoot, path, content) {
101
136
  * Files that are neither in the assembled tree nor explicitly owned stay out of
102
137
  * the lock instead of being accidentally adopted as managed files.
103
138
  */
104
- function updatedFilesLock(projectRoot, newTree, previous, ownedGlobs) {
105
- const next = (0, lockfile_1.computeFilesLock)(projectRoot, ownedGlobs);
139
+ function updatedFilesLock(projectRoot, newTree, previous, ownedGlobs, managedOverrides) {
140
+ const next = (0, lockfile_1.computeFilesLock)(projectRoot, ownedGlobs, managedOverrides);
106
141
  for (const [path, entry] of Object.entries(next.files)) {
107
142
  const newText = treeText(newTree, path);
108
143
  if (newText !== null) {
109
144
  if (entry.tier !== "owned") {
110
- entry.tier = previous.files[path]?.tier ?? entry.tier;
145
+ if (!managedOverrides.some((glob) => (0, lockfile_1.matchGlob)(path, glob))) {
146
+ entry.tier = previous.files[path]?.tier ?? entry.tier;
147
+ }
111
148
  entry.outHash = (0, podokit_template_engine_1.hashContent)(newText);
112
149
  }
113
150
  continue;
@@ -149,6 +186,8 @@ function applyUpdate(projectRoot, templatesDir, options = {}) {
149
186
  modules,
150
187
  projectRoot,
151
188
  });
189
+ const managedOverrides = targetManagedOverrides(projectRoot, templatesDir, modules, manifest.managedOverrides);
190
+ const ownedGlobs = targetOwnedGlobs(projectRoot, templatesDir, modules, manifest.ownedGlobs);
152
191
  const oldTree = options.oldTemplatesDir
153
192
  ? (0, assemble_1.assembleProject)({
154
193
  templatesDir: options.oldTemplatesDir,
@@ -188,7 +227,7 @@ function applyUpdate(projectRoot, templatesDir, options = {}) {
188
227
  // Keep the assembled target as the managed baseline. A merged working file
189
228
  // intentionally remains drifted so a future update performs another 3-way
190
229
  // merge instead of treating the user's lines as clean generated output.
191
- (0, lockfile_1.writeFilesLock)(projectRoot, updatedFilesLock(projectRoot, newTree, previousLock, manifest.ownedGlobs));
230
+ (0, lockfile_1.writeFilesLock)(projectRoot, updatedFilesLock(projectRoot, newTree, previousLock, ownedGlobs, managedOverrides));
192
231
  const modulesDir = (0, node_path_1.join)(templatesDir, "modules");
193
232
  const refreshedModules = manifest.modules.map((module) => {
194
233
  const resolved = (0, add_1.resolveModule)(module.packageName ?? module.name, modulesDir, projectRoot);
@@ -202,6 +241,8 @@ function applyUpdate(projectRoot, templatesDir, options = {}) {
202
241
  });
203
242
  (0, lockfile_1.writeManifest)(projectRoot, {
204
243
  ...manifest,
244
+ ownedGlobs,
245
+ managedOverrides,
205
246
  modules: refreshedModules,
206
247
  podokitVersion: (0, lockfile_1.podokitVersion)(),
207
248
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@podosoft/podokit",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "description": "An opinionated but extensible starter toolkit and CLI for full-stack TypeScript apps with NestJS, SvelteKit, TailwindCSS, shadcn-svelte, Docker, and k3s.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,10 +0,0 @@
1
- import type { BaseTranslation } from "typesafe-i18n";
2
-
3
- // Base locale. Run `npx typesafe-i18n` to generate the typed runtime,
4
- // then access strings as `$LL.appTitle()` in components.
5
- const en = {
6
- appTitle: "{{projectName}}",
7
- checkHealth: "Check API health",
8
- } satisfies BaseTranslation;
9
-
10
- export default en;
@@ -1,11 +0,0 @@
1
- import type { BaseTranslation } from "typesafe-i18n";
2
-
3
- // Uses BaseTranslation until you generate typed runtimes with `npx typesafe-i18n`.
4
- // After generating, switch to `import type { Translation } from "../i18n-types"`
5
- // so this locale is checked against the base locale's keys.
6
- const ko = {
7
- appTitle: "{{projectName}}",
8
- checkHealth: "API 상태 확인",
9
- } satisfies BaseTranslation;
10
-
11
- export default ko;
@@ -1,10 +0,0 @@
1
- import type { BaseTranslation } from "typesafe-i18n";
2
-
3
- // Base locale. Run `npx typesafe-i18n` to generate the typed runtime,
4
- // then access strings as `$LL.appTitle()` in components.
5
- const en = {
6
- appTitle: "{{projectName}}",
7
- checkHealth: "Check API health",
8
- } satisfies BaseTranslation;
9
-
10
- export default en;
@@ -1,11 +0,0 @@
1
- import type { BaseTranslation } from "typesafe-i18n";
2
-
3
- // Uses BaseTranslation until you generate typed runtimes with `npx typesafe-i18n`.
4
- // After generating, switch to `import type { Translation } from "../i18n-types"`
5
- // so this locale is checked against the base locale's keys.
6
- const ko = {
7
- appTitle: "{{projectName}}",
8
- checkHealth: "API 상태 확인",
9
- } satisfies BaseTranslation;
10
-
11
- export default ko;