rulebookguard 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -80,7 +80,7 @@ function render(path, rules, text) {
80
80
  return parts.join("\n\n");
81
81
  }
82
82
  // package.json
83
- var version = "0.3.0";
83
+ var version = "0.3.2";
84
84
  // src/mcp/server.ts
85
85
  function createRulesServer(projectDir) {
86
86
  const server = new McpServer({
@@ -425,7 +425,7 @@ async function dispatch(argv, io) {
425
425
  return 0;
426
426
  }
427
427
  if (name === "site") {
428
- const { siteCommand } = await import("./site-DYOm-dEC.mjs");
428
+ const { siteCommand } = await import("./site-C2qLRXNK.mjs");
429
429
  await siteCommand(io, {
430
430
  out: values.out,
431
431
  base: values.base
@@ -65,6 +65,12 @@ const STATUSES = [
65
65
  "proposed",
66
66
  "deprecated"
67
67
  ];
68
+ const FAVICON = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
69
+ <rect width="32" height="32" rx="7" fill="#3c51e8"/>
70
+ <path d="M9 8h10a4 4 0 0 1 4 4v12H13a4 4 0 0 1-4-4z" fill="#fff"/>
71
+ <path d="m13 16 2.5 2.5L20 14" fill="none" stroke="#3c51e8" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/>
72
+ </svg>
73
+ `;
68
74
  const TEXT = {
69
75
  en: {
70
76
  title: "Business rules",
@@ -162,6 +168,7 @@ function sitePages(data, options) {
162
168
  return path === void 0 ? id : `[${id}](${path})`;
163
169
  };
164
170
  const files = /* @__PURE__ */ new Map();
171
+ files.set("public/favicon.svg", FAVICON);
165
172
  files.set("src/content.config.ts", `import { defineCollection } from 'astro:content';
166
173
  import { docsLoader } from '@astrojs/starlight/loaders';
167
174
  import { docsSchema } from '@astrojs/starlight/schema';
@@ -267,7 +274,7 @@ function rulesPage(data, text, rulePath) {
267
274
  rule.summary
268
275
  ].join(" ").toLowerCase();
269
276
  return ` <tr data-context="${html(rule.context)}" data-status="${rule.status}" data-search="${html(search)}">
270
- <td><a href="${rulePath.get(rule.id) ?? ""}">${rule.id}</a></td>
277
+ <td class="rbg-id"><a href="${rulePath.get(rule.id) ?? ""}">${rule.id}</a></td>
271
278
  <td>${html(rule.context)}</td>
272
279
  <td>${rule.status}</td>
273
280
  <td>${html(rule.summary)}</td>
@@ -289,6 +296,7 @@ ${contexts.map((context) => ` <option value="${html(context)}">${html(conte
289
296
  ${STATUSES.map((status) => ` <option value="${status}">${status}</option>`).join("\n")}
290
297
  </select>
291
298
  </div>
299
+ <div class="rbg-table">
292
300
  <table class="rbg-rules">
293
301
  <thead>
294
302
  <tr><th>${html(text.rule)}</th><th>${html(text.context)}</th><th>${html(text.status)}</th><th>${html(text.summary)}</th></tr>
@@ -297,12 +305,32 @@ ${STATUSES.map((status) => ` <option value="${status}">${status}</option>`)
297
305
  ${rows.join("\n")}
298
306
  </tbody>
299
307
  </table>
308
+ </div>
300
309
  <p class="rbg-empty" hidden>${html(text.noMatch)}</p>
301
310
  </StarlightPage>
302
311
 
303
312
  <style>
304
- .rbg-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
313
+ .rbg-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
314
+ /* Starlight spaces sibling content blocks with margin-top; inside the filter row it misaligns the controls. */
315
+ .rbg-filters > * { margin: 0; }
316
+ .rbg-filters :is(input, select) {
317
+ border: 1px solid var(--sl-color-gray-5);
318
+ border-radius: 0.5rem;
319
+ background-color: var(--sl-color-bg);
320
+ color: var(--sl-color-white);
321
+ font: inherit;
322
+ font-size: var(--sl-text-sm);
323
+ padding: 0.5rem 0.75rem;
324
+ height: 2.5rem;
325
+ box-sizing: border-box;
326
+ }
305
327
  .rbg-filters input { flex: 1 1 16rem; }
328
+ .rbg-filters select { flex: 1 1 12rem; cursor: pointer; }
329
+ .rbg-filters :is(input, select):focus-visible { outline: 2px solid var(--sl-color-accent); outline-offset: 1px; }
330
+ .rbg-id { white-space: nowrap; }
331
+ .rbg-table { overflow-x: auto; }
332
+ .rbg-table table { margin: 0; }
333
+ .rbg-rules td:last-child { min-width: 16rem; }
306
334
  </style>
307
335
 
308
336
  <script>
@@ -466,10 +494,13 @@ async function buildWithAstro(work) {
466
494
  });
467
495
  } catch (error) {
468
496
  const { stderr, stdout } = error;
469
- const detail = `${stderr ?? ""}${stdout ?? ""}`.trim().split("\n").slice(-5).join("\n");
470
- throw new CliError(`The site build failed:\n${detail}`);
497
+ throw new CliError(`The site build failed:\n${astroFailureDetail(`${stderr ?? ""}${stdout ?? ""}`)}`);
471
498
  }
472
499
  }
500
+ /** The first lines of Astro's error output, without its stack trace. */
501
+ function astroFailureDetail(output) {
502
+ return output.split("\n").filter((line) => !/^\s*at /.test(line) && !/^\s*Stack trace:/.test(line)).filter((line) => line.trim() !== "").slice(0, 12).join("\n");
503
+ }
473
504
  function astroConfig(title, language, base, sidebar) {
474
505
  return `import starlight from '@astrojs/starlight';
475
506
  import { defineConfig } from 'astro/config';
@@ -478,6 +509,9 @@ export default defineConfig({
478
509
  base: ${JSON.stringify(base)},
479
510
  outDir: './dist',
480
511
  cacheDir: './.astro-cache',
512
+ // Bundle the prerender dependencies: left external, Node resolves them from this project, where a package manager
513
+ // may have hoisted other versions (pnpm's node_modules/.pnpm/node_modules) ahead of the ones Astro depends on.
514
+ vite: { environments: { prerender: { resolve: { noExternal: true } } } },
481
515
  integrations: [
482
516
  starlight({
483
517
  title: ${JSON.stringify(title)},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rulebookguard",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Keep business rules as the single source of truth, bound to code and tests.",
5
5
  "homepage": "https://github.com/JuanCJR/rulebookguard#readme",
6
6
  "bugs": {