backend-skeleton 1.7.0 → 1.8.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.
@@ -47,6 +47,9 @@ export function renderScanMarkdown(report) {
47
47
  lines.push(`**Terms**: ${report.terms.join(', ') || '(none)'}`);
48
48
  lines.push(`**Adapter**: ${report.adapter} (confidence: ${report.confidence})`);
49
49
  lines.push(`**API surface source**: ${report.api_surface_source}`);
50
+ if (report.runtime_introspection) {
51
+ lines.push(`**Runtime routes**: ${report.runtime_introspection.command.join(' ')} (${report.runtime_introspection.rails_env}, project ${report.runtime_introspection.project_root})`);
52
+ }
50
53
  lines.push(`**Verdict**: \`${report.verdict}\``);
51
54
  lines.push('');
52
55
 
@@ -17,9 +17,12 @@ export function lineNumberAt(text, index) {
17
17
  import { execFileSync } from 'node:child_process';
18
18
  import path from 'node:path';
19
19
 
20
- export function listRgFiles(dir, globs, excludeGlobs = []) {
20
+ export function listRgFiles(dir, globs, excludeGlobs = [], execFn = execFileSync) {
21
21
  try {
22
- const out = execFileSync('rg', ['--files', ...globs.flatMap((g) => ['-g', g]), ...excludeGlobs.flatMap((g) => ['-g', g]), dir], { encoding: 'utf8' });
22
+ // A production Rails monorepo (Discourse) emits >1 MiB of paths for `-g '*.rb'`.
23
+ // Node's default execFileSync buffer then throws ENOBUFS, which the intentional "no files"
24
+ // catch below cannot distinguish and used to turn the entire scan into an empty result.
25
+ const out = execFn('rg', ['--files', ...globs.flatMap((g) => ['-g', g]), ...excludeGlobs.flatMap((g) => ['-g', g]), dir], { encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 });
23
26
  return out.split('\n').filter(Boolean).sort(); // O6: rg --files order isn't guaranteed.
24
27
  } catch {
25
28
  return []; // rg exits 1 on "no files matched" -- not an error, just nothing to report
@@ -11,7 +11,7 @@
11
11
  "adapters": {
12
12
  "type": "object",
13
13
  "propertyNames": {
14
- "enum": ["java-spring", "python-fastapi", "typescript-express", "javascript-express", "generic-grep"]
14
+ "enum": ["java-spring", "ruby-rails", "python-fastapi", "typescript-express", "javascript-express", "generic-grep"]
15
15
  },
16
16
  "additionalProperties": {
17
17
  "type": "array",
@@ -18,6 +18,18 @@
18
18
  "type": "boolean"
19
19
  },
20
20
  "path_prefix_signals": { "type": "array" },
21
+ "runtime_introspection": {
22
+ "type": "object",
23
+ "additionalProperties": false,
24
+ "required": ["kind", "command", "project_root", "rails_env", "status"],
25
+ "properties": {
26
+ "kind": { "const": "rails-routes" },
27
+ "command": { "type": "array", "items": { "type": "string" } },
28
+ "project_root": { "type": "string" },
29
+ "rails_env": { "type": "string" },
30
+ "status": { "const": "used" }
31
+ }
32
+ },
21
33
  "related_modules": {
22
34
  "type": "array",
23
35
  "items": {