@oktis-works/cms 0.1.13 → 0.2.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 (65) hide show
  1. package/dist/assets.d.ts +94 -0
  2. package/dist/assets.d.ts.map +1 -0
  3. package/dist/assets.js +671 -0
  4. package/dist/assets.js.map +1 -0
  5. package/dist/bluegreen.d.ts +121 -0
  6. package/dist/bluegreen.d.ts.map +1 -0
  7. package/dist/bluegreen.js +393 -0
  8. package/dist/bluegreen.js.map +1 -0
  9. package/dist/commands.d.ts +6 -0
  10. package/dist/commands.d.ts.map +1 -1
  11. package/dist/commands.js +116 -61
  12. package/dist/commands.js.map +1 -1
  13. package/dist/config-wizard.d.ts +39 -0
  14. package/dist/config-wizard.d.ts.map +1 -0
  15. package/dist/config-wizard.js +308 -0
  16. package/dist/config-wizard.js.map +1 -0
  17. package/dist/docker.d.ts +148 -0
  18. package/dist/docker.d.ts.map +1 -0
  19. package/dist/docker.js +324 -0
  20. package/dist/docker.js.map +1 -0
  21. package/dist/doctor.d.ts +2 -0
  22. package/dist/doctor.d.ts.map +1 -1
  23. package/dist/doctor.js +51 -0
  24. package/dist/doctor.js.map +1 -1
  25. package/dist/env-file.d.ts +45 -0
  26. package/dist/env-file.d.ts.map +1 -0
  27. package/dist/env-file.js +200 -0
  28. package/dist/env-file.js.map +1 -0
  29. package/dist/env-schema.d.ts +28 -0
  30. package/dist/env-schema.d.ts.map +1 -0
  31. package/dist/env-schema.js +497 -0
  32. package/dist/env-schema.js.map +1 -0
  33. package/dist/guards.d.ts +40 -0
  34. package/dist/guards.d.ts.map +1 -0
  35. package/dist/guards.js +159 -0
  36. package/dist/guards.js.map +1 -0
  37. package/dist/parser.d.ts.map +1 -1
  38. package/dist/parser.js +12 -3
  39. package/dist/parser.js.map +1 -1
  40. package/dist/project-config.js +2 -2
  41. package/dist/prompt.d.ts +81 -0
  42. package/dist/prompt.d.ts.map +1 -0
  43. package/dist/prompt.js +379 -0
  44. package/dist/prompt.js.map +1 -0
  45. package/dist/redeploy.d.ts +109 -0
  46. package/dist/redeploy.d.ts.map +1 -0
  47. package/dist/redeploy.js +363 -0
  48. package/dist/redeploy.js.map +1 -0
  49. package/dist/scaffold-docs.d.ts +25 -6
  50. package/dist/scaffold-docs.d.ts.map +1 -1
  51. package/dist/scaffold-docs.js +711 -33
  52. package/dist/scaffold-docs.js.map +1 -1
  53. package/dist/scaffold.d.ts +17 -1
  54. package/dist/scaffold.d.ts.map +1 -1
  55. package/dist/scaffold.js +77 -14
  56. package/dist/scaffold.js.map +1 -1
  57. package/dist/theme-build.d.ts +35 -0
  58. package/dist/theme-build.d.ts.map +1 -0
  59. package/dist/theme-build.js +86 -0
  60. package/dist/theme-build.js.map +1 -0
  61. package/dist/update.d.ts +51 -0
  62. package/dist/update.d.ts.map +1 -0
  63. package/dist/update.js +210 -0
  64. package/dist/update.js.map +1 -0
  65. package/package.json +7 -7
@@ -0,0 +1,363 @@
1
+ // @oktis-works/cms - `okcms redeploy` (F4)
2
+ //
3
+ // Instalar plugin/tema no host ainda não muda o que está no ar:
4
+ //
5
+ // plugins e temas entram na imagem pelo `COPY . .` do Dockerfile (o
6
+ // `.dockerignore` os preserva de propósito) — sem rebuild, o container segue
7
+ // servindo a cópia antiga;
8
+ //
9
+ // `themes/<n>/dist/theme.css` só existe se o build de estilo rodou no host:
10
+ // o web linka esse arquivo pronto, ele não é compilado dentro do container;
11
+ //
12
+ // um plugin que mexe no banco traz SQL em `plugins/<n>/migrations/`, que
13
+ // precisa chegar em `migrations/` para o `db:migrate` aplicá-lo — o runner
14
+ // só lê UM diretório e classifica como PLUGIN todo owner que não é `core`
15
+ // (`V###__owner__nome.sql`, rastreado por `owner:version`).
16
+ //
17
+ // Redeploy = preparar no host (stage do SQL + build dos temas) e então
18
+ // delegar a troca ao mesmo blue/green do `okcms update --mode deploy`, só que
19
+ // sem `bun add`: o que mudou é conteúdo de extensão, não versão de pacote.
20
+ //
21
+ // Ordem e garantias são as do deploy normal: falha no preparo = nada foi
22
+ // buildado nem trocado; falha no deploy = rollback e a lane que estava
23
+ // servindo continua servindo.
24
+ import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync } from 'node:fs';
25
+ import { dirname, join } from 'node:path';
26
+ import { deployBlueGreen } from './bluegreen.js';
27
+ import { assertHostOnly } from './guards.js';
28
+ import { loadProjectConfig } from './project-config.js';
29
+ import { Prompt } from './prompt.js';
30
+ import { buildThemeStylesOnDisk, resolveThemeStyle, themeManifestPath, } from './theme-build.js';
31
+ import { resolveDeployChoices } from './update.js';
32
+ /**
33
+ * Mesmo padrão de `parseMigrationName` (packages/database): qualquer `.sql`
34
+ * fora dele derruba `loadMigrationsFromDir` para TODAS as migrations do
35
+ * diretório — por isso nada fora do padrão é copiado para `migrations/`.
36
+ */
37
+ export const MIGRATION_FILENAME = /^V\d+__\w+__.+\.sql$/;
38
+ function listDirs(dir) {
39
+ if (!existsSync(dir))
40
+ return [];
41
+ return readdirSync(dir, { withFileTypes: true })
42
+ .filter((entry) => entry.isDirectory())
43
+ .map((entry) => entry.name)
44
+ .sort();
45
+ }
46
+ function listSql(dir) {
47
+ if (!existsSync(dir))
48
+ return [];
49
+ return readdirSync(dir)
50
+ .filter((file) => file.endsWith('.sql'))
51
+ .sort();
52
+ }
53
+ function sameContent(a, b) {
54
+ try {
55
+ return readFileSync(a, 'utf-8') === readFileSync(b, 'utf-8');
56
+ }
57
+ catch {
58
+ return false;
59
+ }
60
+ }
61
+ /**
62
+ * Lê o estado de plugins/temas e devolve o que o redeploy faria. Só lê —
63
+ * nenhum byte é escrito aqui, o que torna `--dry-run` e os testes triviais.
64
+ */
65
+ export function planRedeploy(opts = {}) {
66
+ const cwd = opts.cwd ?? process.cwd();
67
+ const config = loadProjectConfig(cwd);
68
+ const pluginsDir = join(cwd, config.pluginsDir);
69
+ const themesDir = join(cwd, config.themesDir);
70
+ const migrationsDir = opts.migrationsDir ?? join(cwd, 'migrations');
71
+ const plugins = listDirs(pluginsDir);
72
+ const themes = listDirs(themesDir);
73
+ // ---- migrations de plugin ------------------------------------------------
74
+ const migrations = [];
75
+ const scopedPlugins = opts.plugin ? plugins.filter((name) => name === opts.plugin) : plugins;
76
+ for (const plugin of scopedPlugins) {
77
+ const dir = join(pluginsDir, plugin, 'migrations');
78
+ for (const file of listSql(dir)) {
79
+ const source = join(dir, file);
80
+ const target = join(migrationsDir, file);
81
+ let status;
82
+ if (!MIGRATION_FILENAME.test(file))
83
+ status = 'invalid';
84
+ else if (!existsSync(target))
85
+ status = 'new';
86
+ else if (sameContent(source, target))
87
+ status = 'staged';
88
+ else
89
+ status = 'conflict';
90
+ migrations.push({ plugin, file, source, target, status });
91
+ }
92
+ }
93
+ // ---- build de tema -------------------------------------------------------
94
+ const themeBuilds = [];
95
+ const scopedThemes = opts.theme ? themes.filter((name) => name === opts.theme) : themes;
96
+ for (const theme of scopedThemes) {
97
+ const manifestPath = themeManifestPath(themesDir, theme);
98
+ if (!manifestPath) {
99
+ themeBuilds.push({
100
+ theme,
101
+ manifestPath: null,
102
+ engine: '-',
103
+ output: 'dist/theme.css',
104
+ entry: null,
105
+ status: 'missing-manifest',
106
+ problems: [],
107
+ });
108
+ continue;
109
+ }
110
+ const resolved = resolveThemeStyle(themesDir, theme);
111
+ if (!resolved) {
112
+ themeBuilds.push({
113
+ theme,
114
+ manifestPath,
115
+ engine: '-',
116
+ output: 'dist/theme.css',
117
+ entry: null,
118
+ status: 'invalid-manifest',
119
+ problems: ['manifesto não é um JSON válido'],
120
+ });
121
+ continue;
122
+ }
123
+ // O ThemeLoader recusa manifesto sem name/version — buildar seria trabalho
124
+ // jogado fora.
125
+ const problems = [];
126
+ if (typeof resolved.manifest['name'] !== 'string' ||
127
+ typeof resolved.manifest['version'] !== 'string') {
128
+ problems.push('manifesto sem "name" e/ou "version"');
129
+ }
130
+ problems.push(...resolved.report.errors);
131
+ const { report } = resolved;
132
+ themeBuilds.push({
133
+ theme,
134
+ manifestPath,
135
+ engine: report.engine,
136
+ output: report.output,
137
+ entry: report.entry,
138
+ status: problems.length > 0 ? 'invalid-manifest' : report.entry ? 'build' : 'no-entry',
139
+ problems,
140
+ });
141
+ }
142
+ // ---- higiene do diretório canônico de migrations --------------------------
143
+ const invalidExisting = listSql(migrationsDir).filter((file) => !MIGRATION_FILENAME.test(file));
144
+ return { plugins, themes, migrations, themeBuilds, invalidExisting };
145
+ }
146
+ /**
147
+ * Copia o SQL de plugin para `migrations/` (o único diretório que o runner
148
+ * lê). Idempotente: arquivo idêntico não é tocado, arquivo divergente é
149
+ * PRESERVADO — `migrations/` pertence ao operador e a versão aplicada no
150
+ * banco já tem checksum registrado.
151
+ */
152
+ export function stagePluginMigrations(plan) {
153
+ const result = { copied: [], already: [], conflicts: [], invalid: [] };
154
+ for (const entry of plan.migrations) {
155
+ if (entry.status === 'invalid') {
156
+ result.invalid.push(`${entry.plugin}: ${entry.file}`);
157
+ continue;
158
+ }
159
+ if (entry.status === 'conflict') {
160
+ result.conflicts.push(`${entry.plugin}: ${entry.file}`);
161
+ continue;
162
+ }
163
+ if (entry.status === 'staged') {
164
+ result.already.push(`${entry.plugin}: ${entry.file}`);
165
+ continue;
166
+ }
167
+ mkdirSync(dirname(entry.target), { recursive: true });
168
+ copyFileSync(entry.source, entry.target);
169
+ result.copied.push(`${entry.plugin}: ${entry.file}`);
170
+ }
171
+ return result;
172
+ }
173
+ /** Linhas do resumo do redeploy — puras, para `--dry-run` e para os testes. */
174
+ export function renderPlan(plan, opts = {}) {
175
+ const lines = [];
176
+ lines.push(`plugins: ${plan.plugins.length > 0 ? plan.plugins.join(', ') : 'nenhum'}`);
177
+ lines.push(`temas: ${plan.themes.length > 0 ? plan.themes.join(', ') : 'nenhum'}`);
178
+ if (opts.skipMigrations) {
179
+ lines.push('migrations de plugin: puladas (--skip-migrations)');
180
+ }
181
+ else if (plan.migrations.length === 0) {
182
+ lines.push('migrations de plugin: nenhuma');
183
+ }
184
+ else {
185
+ lines.push('migrations de plugin (plugins/*/migrations → migrations/):');
186
+ for (const entry of plan.migrations) {
187
+ const who = `${entry.plugin}: ${entry.file}`;
188
+ if (entry.status === 'new')
189
+ lines.push(` + ${who} → migrations/ (novo)`);
190
+ else if (entry.status === 'staged')
191
+ lines.push(` = ${who} (já em migrations/)`);
192
+ else if (entry.status === 'conflict')
193
+ lines.push(` ! ${who} difere do que já está em migrations/ — mantido o do projeto`);
194
+ else
195
+ lines.push(` ! ${who} fora do padrão V###__owner__nome.sql — não copiado`);
196
+ }
197
+ }
198
+ if (opts.skipThemeBuild) {
199
+ lines.push('build de tema: pulado (--skip-theme-build)');
200
+ }
201
+ else if (plan.themeBuilds.length === 0) {
202
+ lines.push('build de tema: nenhum tema instalado');
203
+ }
204
+ else {
205
+ lines.push('build de tema:');
206
+ for (const entry of plan.themeBuilds) {
207
+ if (entry.status === 'build') {
208
+ lines.push(` ✓ ${entry.theme} — ${entry.engine} → ${entry.output}`);
209
+ }
210
+ else if (entry.status === 'no-entry') {
211
+ lines.push(` - ${entry.theme} — sem entrada de estilo (${entry.engine})`);
212
+ }
213
+ else if (entry.status === 'missing-manifest') {
214
+ lines.push(` ! ${entry.theme} — sem theme.json`);
215
+ }
216
+ else {
217
+ lines.push(` ! ${entry.theme} — manifest recusado: ${entry.problems.join('; ')}`);
218
+ }
219
+ }
220
+ }
221
+ for (const file of plan.invalidExisting) {
222
+ lines.push(` ! migrations/${file} fora do padrão V###__owner__nome.sql — quebra todo db:migrate`);
223
+ }
224
+ lines.push('ordem: stage no host → build da imagem → migrations → health → swap → worker → down');
225
+ return lines;
226
+ }
227
+ export async function runRedeploy(opts = {}) {
228
+ const prompt = opts.prompt ?? new Prompt();
229
+ const ownsPrompt = opts.prompt === undefined;
230
+ const cwd = opts.cwd ?? process.cwd();
231
+ const write = opts.log ?? ((message) => prompt.write(message));
232
+ // Mesmo motivo do `okcms update`: dentro de um container a CLI viraria um
233
+ // executor de `bun add` na rede do banco, com o .env na mão.
234
+ const guard = assertHostOnly('okcms redeploy', { force: opts.force, probe: opts.probe });
235
+ if (!guard.ok) {
236
+ console.error(guard.message);
237
+ if (ownsPrompt)
238
+ prompt.close();
239
+ return 1;
240
+ }
241
+ const onInterrupt = () => {
242
+ prompt.write(`\n interrompido — nenhuma troca de lane em andamento foi registrada.\n`);
243
+ process.exit(130);
244
+ };
245
+ process.once('SIGINT', onInterrupt);
246
+ try {
247
+ const plan = planRedeploy({ cwd, plugin: opts.plugin, theme: opts.theme });
248
+ const config = loadProjectConfig(cwd);
249
+ const themesDir = join(cwd, config.themesDir);
250
+ if (opts.plugin && !plan.plugins.includes(opts.plugin)) {
251
+ prompt.error(`plugin não encontrado: ${opts.plugin}`);
252
+ prompt.info(`instalados: ${plan.plugins.join(', ') || 'nenhum'}`);
253
+ return 1;
254
+ }
255
+ if (opts.theme && !plan.themes.includes(opts.theme)) {
256
+ prompt.error(`tema não encontrado: ${opts.theme}`);
257
+ prompt.info(`instalados: ${plan.themes.join(', ') || 'nenhum'}`);
258
+ return 1;
259
+ }
260
+ prompt.heading('OkCMS redeploy');
261
+ for (const line of renderPlan(plan, opts))
262
+ write(`${line}\n`);
263
+ // `.sql` inválido em migrations/ derruba o `db:migrate` do passo 5 do
264
+ // deploy. Falhar aqui é melhor que falhar no meio do blue/green.
265
+ if (plan.invalidExisting.length > 0) {
266
+ prompt.error(`${plan.invalidExisting.length} arquivo(s) em migrations/ fora do padrão ` +
267
+ `V###__owner__nome.sql — o db:migrate falharia. Renomeie ou remova.`);
268
+ return 1;
269
+ }
270
+ if (opts.dryRun) {
271
+ prompt.info('dry-run: nada foi executado.');
272
+ return 0;
273
+ }
274
+ const choices = await resolveDeployChoices(opts, prompt);
275
+ const interactive = prompt.interactive && opts.yes !== true;
276
+ if (interactive) {
277
+ prompt.heading('Resumo do redeploy');
278
+ prompt.info(`stage: ${plan.migrations.filter((m) => m.status === 'new').length} migration(s) de plugin`);
279
+ prompt.info(`build de estilo: ${plan.themeBuilds.filter((t) => t.status === 'build').length} tema(s)`);
280
+ prompt.info(`imagem: ${choices.noCache ? 'sem cache' : 'com cache de camadas'}`);
281
+ prompt.info(`órfãos da lane antiga: ${choices.removeOrphans ? 'remover' : 'manter'}`);
282
+ const confirmed = await prompt.confirm('Iniciar redeploy?', { defaultValue: true });
283
+ if (!confirmed) {
284
+ prompt.warn('cancelado — nada foi executado.');
285
+ return 0;
286
+ }
287
+ }
288
+ // ---- stage de migrations ----------------------------------------------
289
+ if (opts.skipMigrations) {
290
+ const pending = plan.migrations.filter((m) => m.status === 'new').length;
291
+ if (pending > 0) {
292
+ prompt.warn(`${pending} migration(s) de plugin não copiadas (--skip-migrations).`);
293
+ }
294
+ }
295
+ else {
296
+ const staged = stagePluginMigrations(plan);
297
+ for (const item of staged.copied)
298
+ write(` + migrations: ${item}\n`);
299
+ if (staged.copied.length > 0) {
300
+ prompt.success(`${staged.copied.length} migration(s) de plugin em migrations/`);
301
+ }
302
+ for (const item of staged.conflicts)
303
+ prompt.warn(`conflito (mantido o do projeto): ${item}`);
304
+ for (const item of staged.invalid)
305
+ prompt.warn(`fora do padrão, não copiada: ${item}`);
306
+ }
307
+ // ---- build de estilo ---------------------------------------------------
308
+ const toBuild = plan.themeBuilds.filter((entry) => entry.status === 'build');
309
+ if (opts.skipThemeBuild) {
310
+ if (toBuild.length > 0) {
311
+ prompt.warn(`${toBuild.length} tema(s) sem build de estilo (--skip-theme-build).`);
312
+ }
313
+ }
314
+ else {
315
+ for (const entry of toBuild) {
316
+ try {
317
+ const outcome = await buildThemeStylesOnDisk(themesDir, entry.theme);
318
+ for (const warning of outcome.warnings)
319
+ prompt.warn(`${entry.theme}: ${warning}`);
320
+ write(` ✓ tema ${outcome.theme}: ${outcome.engine} → ${outcome.output} ` +
321
+ `(${outcome.bytes} bytes, isolated=${outcome.isolated})\n`);
322
+ }
323
+ catch (error) {
324
+ prompt.error(`build do tema ${entry.theme} falhou: ${error instanceof Error ? error.message : String(error)}`);
325
+ prompt.warn('nada foi buildado nem trocado — a lane atual segue no ar.');
326
+ return 1;
327
+ }
328
+ }
329
+ for (const entry of plan.themeBuilds) {
330
+ if (entry.status === 'missing-manifest') {
331
+ prompt.warn(`${entry.theme}: sem theme.json — ignorado.`);
332
+ }
333
+ else if (entry.status === 'invalid-manifest') {
334
+ prompt.warn(`${entry.theme}: manifest recusado — ${entry.problems.join('; ')}`);
335
+ }
336
+ }
337
+ }
338
+ // ---- deploy blue/green -------------------------------------------------
339
+ const result = await deployBlueGreen({
340
+ cwd,
341
+ runner: opts.runner,
342
+ choices,
343
+ // Sem `bun add`: o que mudou é conteúdo de extensão, não versão de
344
+ // pacote. Só instala tudo quando o host nem tem node_modules — sem ele
345
+ // o `db:migrate` do passo 5 não tem como rodar.
346
+ packages: [],
347
+ installAll: !existsSync(join(cwd, 'node_modules', '@oktis-works')),
348
+ log: write,
349
+ warn: write,
350
+ });
351
+ if (result.ok) {
352
+ prompt.success(`redeploy concluído na lane ${result.lane}` +
353
+ (result.previousLane ? ` (lane anterior: ${result.previousLane})` : ''));
354
+ }
355
+ return result.ok ? 0 : 1;
356
+ }
357
+ finally {
358
+ process.removeListener('SIGINT', onInterrupt);
359
+ if (ownsPrompt)
360
+ prompt.close();
361
+ }
362
+ }
363
+ //# sourceMappingURL=redeploy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redeploy.js","sourceRoot":"","sources":["../src/redeploy.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,EAAE;AACF,gEAAgE;AAChE,EAAE;AACF,sEAAsE;AACtE,+EAA+E;AAC/E,6BAA6B;AAC7B,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,4EAA4E;AAC5E,8DAA8D;AAC9D,EAAE;AACF,uEAAuE;AACvE,8EAA8E;AAC9E,2EAA2E;AAC3E,EAAE;AACF,yEAAyE;AACzE,uEAAuE;AACvE,8BAA8B;AAE9B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,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AAO;YACP,mEAAmE;YACnE,uEAAuE;YACvE,gDAAgD;YAChD,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;YAClE,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;YACd,MAAM,CAAC,OAAO,CACZ,8BAA8B,MAAM,CAAC,IAAI,EAAE;gBACzC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,oBAAoB,MAAM,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAC1E,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC9C,IAAI,UAAU;YAAE,MAAM,CAAC,KAAK,EAAE,CAAC;IACjC,CAAC;AACH,CAAC"}
@@ -1,7 +1,26 @@
1
- /** README.md do projeto scaffoldado. */
2
- export declare function projectReadme(projectName: string): string;
3
- /** PLUGIN.md — guia de desenvolvimento de plugins. */
4
- export declare const PLUGIN_DOC = "# Desenvolvendo um Plugin\n\nPlugin \u00E9 a extens\u00E3o que se registra no runtime do CMS e participa do sistema\nde **hooks e filters** (transformar dados, reagir a eventos de conte\u00FAdo etc.).\nO cat\u00E1logo de hooks dispon\u00EDveis \u00E9 servido pela API em\n`GET /api/v1/hooks/catalog`.\n\n> Os comandos usam `npx` com a CLI local do projeto (sem instala\u00E7\u00E3o\n> global). Com a CLI global (`bun add -g @oktis-works/cms`), rode\n> `okcms ...` direto.\n\n## Estrutura gerada\n\n```bash\nnpx okcms plugin:create --name meu-plugin\n```\n\n```\nplugins/meu-plugin/\n\u251C\u2500\u2500 manifest.json # identidade + permiss\u00F5es + compatibilidade\n\u251C\u2500\u2500 index.js # entrypoint: module.exports.register(registry)\n\u2514\u2500\u2500 README.md\n```\n\n### manifest.json\n\n```json\n{\n \"name\": \"meu-plugin\",\n \"version\": \"0.1.0\",\n \"description\": \"Plugin meu-plugin para OkCMS\",\n \"type\": \"plugin\",\n \"main\": \"index.js\",\n \"scope\": \"tenant\",\n \"permissions\": [],\n \"compatibility\": { \"okcms\": \"^0.1.x\" }\n}\n```\n\n| Campo | Significado |\n|---|---|\n| `type` | `\"plugin\"` (fixo \u2014 temas usam `\"theme\"`) |\n| `main` | Arquivo de entrada com o registro |\n| `scope` | Escopo de atua\u00E7\u00E3o no multi-tenant (ex.: `tenant`) |\n| `permissions` | Permiss\u00F5es que o plugin pede (vazio = nenhuma) |\n| `compatibility.okcms` | Range semver exigido do CMS. **O scaffold preenche com a vers\u00E3o atual automaticamente** e o valor \u00E9 validado no scaffold e em cada instala\u00E7\u00E3o \u2014 manifesto incompat\u00EDvel \u00E9 rejeitado. |\n\n### index.js\n\n```js\n'use strict';\n\nmodule.exports.register = function register(registry) {\n registry.addFilter('theme:data:posts', (value) => value);\n};\n```\n\nO `register(registry)` \u00E9 chamado quando o plugin \u00E9 carregado. Use o registro\npara expor filters (transforma\u00E7\u00F5es) \u2014 veja o que existe em\n`GET /api/v1/hooks/catalog` para os nomes e contratos dispon\u00EDveis.\n\n## Fluxo de desenvolvimento\n\n```bash\n# 1. Crie (em ./plugins do projeto, ou num workspace externo com --dir)\nnpx okcms plugin:create --name meu-plugin\n\n# 2. Implemente plugins/meu-plugin/index.js\n\n# 3. Se criou FORA do projeto, instale (valida compatibilidade e copia para plugins/)\nnpx okcms plugin:install --name ../meu-plugin-fonte\n\n# 4. Gest\u00E3o\nnpx okcms plugin:list # instalados + status\nnpx okcms plugin:manage -n meu-plugin --info # informa\u00E7\u00F5es do manifesto\nnpx okcms plugin:manage -n meu-plugin --disable # desabilita (mant\u00E9m os arquivos)\nnpx okcms plugin:manage -n meu-plugin --enable # habilita de novo\nnpx okcms plugin:manage -n meu-plugin --uninstall # remove arquivos + registro\n\n# 5. Busca no npm (pacotes com a keyword okcms-plugin)\nnpx okcms plugin:search -q galeria\n```\n\n## Publicando\n\nEmpacote o diret\u00F3rio do plugin como pacote npm com a keyword\n`okcms-plugin` (\u00E9 o que o `okcms plugin:search` consulta) e mantenha\n`compatibility.okcms` atualizado para a linha do CMS que voc\u00EA suporta.\n";
5
- /** THEME.md — guia de desenvolvimento de temas. */
6
- export declare const THEME_DOC = "# Desenvolvendo um Tema\n\nTema \u00E9 o visual do site p\u00FAblico: **templates** (hierarquia de p\u00E1ginas) +\n**estilos**, com isolamento por `[data-theme]` para que um tema nunca vaze\nCSS para outro.\n\n> Os comandos usam `npx` com a CLI local do projeto (sem instala\u00E7\u00E3o\n> global). Com a CLI global (`bun add -g @oktis-works/cms`), rode\n> `okcms ...` direto.\n\n## Estrutura gerada\n\n```bash\nnpx okcms theme:create --name meu-tema --style css # css | scss | tailwind\n```\n\n```\nthemes/meu-tema/\n\u251C\u2500\u2500 theme.json # manifest (type: theme + compatibilidade)\n\u251C\u2500\u2500 templates/\n\u2502 \u251C\u2500\u2500 index.html # listagem (home)\n\u2502 \u2514\u2500\u2500 single.html # p\u00E1gina \u00FAnica (post/conte\u00FAdo)\n\u251C\u2500\u2500 style.css # engine css \u2014 ou styles/main.scss \u2014 ou src/input.css\n\u2514\u2500\u2500 README.md\n```\n\n### theme.json\n\n```json\n{\n \"name\": \"meu-tema\",\n \"version\": \"0.1.0\",\n \"description\": \"Tema meu-tema para OkCMS\",\n \"type\": \"theme\",\n \"compatibility\": { \"okcms\": \"^0.1.x\" }\n}\n```\n\nCom `--style scss` ou `--style tailwind`, o manifesto ganha tamb\u00E9m\n`stylesConfig` (`engine`, `entry`, `output`, `isolation`) apontando para a\nentrada de estilos. `compatibility.okcms` \u00E9 preenchido e validado\nautomaticamente, como nos plugins.\n\n### Templates\n\nSintaxe de template com vari\u00E1veis e la\u00E7os:\n\n```html\n<main class=\"site\">\n {{#each posts}}\n <article>\n <h2>{{this.title}}</h2>\n <p>{{this.excerpt}}</p>\n </article>\n {{/each}}\n</main>\n```\n\n- `templates/index.html` \u2014 listagem (ex.: `{{#each posts}}`)\n- `templates/single.html` \u2014 item individual (ex.: `{{title}}`, `{{content}}`)\n\n## Estilos por engine\n\n| `--style` | Arquivo gerado | Build |\n|---|---|---|\n| `css` (default) | `style.css` | nenhum \u2014 servido direto |\n| `scss` | `styles/main.scss` (+ `components.scss`) | `okcms theme:build -n meu-tema` |\n| `tailwind` | `src/input.css` + `tailwind.config.js` | `okcms theme:build -n meu-tema` |\n\nO build compila para `dist/theme.css` **com isolamento\n`[data-theme=\"meu-tema\"]`** (sem vazar estilos entre temas; o Tailwind j\u00E1\nsai com `preflight: false`).\n\n## Fluxo de desenvolvimento\n\n```bash\n# 1. Crie\nnpx okcms theme:create --name meu-tema --style scss\n\n# 2. Edite templates/ e estilos\n\n# 3. Compile os estilos (scss/tailwind)\nnpx okcms theme:build --name meu-tema\n\n# 4. Ative (grava activeTheme no okcms.config.json)\nnpx okcms theme:manage --name meu-tema --set-active\n# (equivalente: ACTIVE_THEME=meu-tema no .env)\n\n# 5. Gest\u00E3o\nnpx okcms theme:list # instalados + status\nnpx okcms theme:manage -n meu-tema --info # informa\u00E7\u00F5es do theme.json\nnpx okcms theme:manage -n meu-tema --disable|enable\nnpx okcms theme:manage -n meu-tema --uninstall\nnpx okcms theme:search -q blog # busca no npm (keyword okcms-theme)\n\n# Se criou FORA do projeto:\nnpx okcms theme:install --name ../meu-tema-fonte\n```\n\n## Publicando\n\nPublique como pacote npm com a keyword `okcms-theme` (alvo do\n`okcms theme:search`) e mantenha `compatibility.okcms` na linha suportada\ndo CMS. O `theme:build` deve ser executado no seu processo de release para\nque `dist/theme.css` v\u00E1 junto no pacote.\n";
1
+ /** Língua da documentação gerada no scaffold. */
2
+ export type DocsLang = 'en' | 'pt';
3
+ /** Línguas suportadas (ordem = ordem do menu do init). */
4
+ export declare const DOCS_LANGS: DocsLang[];
5
+ /**
6
+ * Default: inglês — é o que o Enter do prompt escolhe e o único valor em
7
+ * modo não-interativo (CI/scripts), onde o prompt nunca aparece.
8
+ */
9
+ export declare const DEFAULT_DOCS_LANG: DocsLang;
10
+ /**
11
+ * Normaliza o valor de `--lang`. Devolve `null` para valor desconhecido (ou
12
+ * vazio): o chamador decide entre erro (flag explícita) e default (flag ausente).
13
+ */
14
+ export declare function parseDocsLang(value: string | undefined | null): DocsLang | null;
15
+ /** Rótulo legível da língua (mensagens da CLI). */
16
+ export declare function docsLangLabel(lang: DocsLang): string;
17
+ /**
18
+ * README.md do projeto scaffoldado, na língua escolhida no \`okcms init\`.
19
+ * Default \`en\` (Enter do prompt e único valor em modo não-interativo).
20
+ */
21
+ export declare function projectReadme(projectName: string, lang?: DocsLang): string;
22
+ /** PLUGIN.md na língua pedida. */
23
+ export declare function pluginDoc(lang?: DocsLang): string;
24
+ /** THEME.md na língua pedida. */
25
+ export declare function themeDoc(lang?: DocsLang): string;
7
26
  //# sourceMappingURL=scaffold-docs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scaffold-docs.d.ts","sourceRoot":"","sources":["../src/scaffold-docs.ts"],"names":[],"mappings":"AAIA,wCAAwC;AACxC,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAsMzD;AAED,sDAAsD;AACtD,eAAO,MAAM,UAAU,4lGAwFtB,CAAC;AAEF,mDAAmD;AACnD,eAAO,MAAM,SAAS,w3GAyGrB,CAAC"}
1
+ {"version":3,"file":"scaffold-docs.d.ts","sourceRoot":"","sources":["../src/scaffold-docs.ts"],"names":[],"mappings":"AAeA,iDAAiD;AACjD,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnC,0DAA0D;AAC1D,eAAO,MAAM,UAAU,EAAE,QAAQ,EAAiB,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAe,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,QAAQ,GAAG,IAAI,CAW/E;AAED,mDAAmD;AACnD,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAEpD;AAsgCD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE,QAA4B,GACjC,MAAM,CAER;AAED,kCAAkC;AAClC,wBAAgB,SAAS,CAAC,IAAI,GAAE,QAA4B,GAAG,MAAM,CAEpE;AAED,iCAAiC;AACjC,wBAAgB,QAAQ,CAAC,IAAI,GAAE,QAA4B,GAAG,MAAM,CAEnE"}