See how your app actually fits together. An interactive, plain-English map of your codebase, drawn by Claude or Codex.
JavaScript ai-codingarchitecture-diagramclaudeclaude-codeclaude-code-plugincodebase-visualizationcodexcodex-plugindeveloper-toolsonboardingopenaivibe-coding
fix(scan): don't treat a /* inside a string as a comment
Rudy Celeklie0c312eea725
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1ae1f14..274d35b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -15,6 +15,9 @@- Endpoints that change data are still always checked, and "Not a problem" is still there for anything Health can't work out.- **FastAPI checks Health missed** (#7), fixed by @Bl0ck154: dependencies named like `metrics_guard`, a token in a `Header` parameter when the handler rejects a bad one, a Twilio-style signature check inside a helper, and `/readyz` and `/livez` as public health checks.- **Health reads each Express route's own checks:** a sign-in check in front of a handler defined elsewhere (`router.post('/books', requireAuth, createBook)`) was missed, so the endpoint was reported as open to anyone. The other way round, a route could borrow the check of the route below it, and a handler whose name sounds like a check (`updateUser`) was taken for one, so some open endpoints weren't reported. Fixed by @rudycelekli.+## Unreleased++- **Code after a `/*` inside a string is read again:** a string such as `'/api/*'` (as in Hono's `app.use('/api/*', cors())`) was taken for the start of a comment, so every endpoint, import and web request from there to the next comment's end was missing from the map. Fixed by @rudycelekli.## 0.6.1 (2026-11-01)diff --git a/skills/floorplan/scripts/lib/extract.mjs b/skills/floorplan/scripts/lib/extract.mjsindex 4b14efc..a7e4662 100644--- a/skills/floorplan/scripts/lib/extract.mjs+++ b/skills/floorplan/scripts/lib/extract.mjs@@ -12,10 +12,29 @@ const lineIndex = (src) => {};const blank = (s) => s.replace(/[^\n]/g, ' ');-// Strip comments while keeping offsets (so line numbers stay right).-const stripCStyle = (src) => src- .replace(/\/\*[\s\S]*?\*\//g, blank)- .replace(/(^|[^:"'`\\])\/\/[^\n]*/g, (m, pre) => pre + blank(m.slice(pre.length)));+// Strip comments while keeping offsets (so line numbers stay right). Strings are stepped over, so a+// '/*' inside one (app.use('/api/*', cors())) doesn't start a comment that swallows the code after it.+const stripCStyle = (src) => {+ let out = '';+ for (let i = 0; i < src.length;) {+ const c = src[i];+ if (c === '"' || c === "'" || c === '`') {+ // quotes end at the line's end, backticks can span lines+ let j = i + 1;+ while (j < src.length && src[j] !== c && (c === '`' || src[j] !== '\n')) j += src[j] === '\\' ? 2 : 1;+ out += src.slice(i, j + 1);+ i = j + 1;+ continue;+ }+ let end = -1;+ if (c === '/' && src[i + 1] === '*') { end = src.indexOf('*/', i + 2); if (end >= 0) end += 2; }+ else if (c === '/' && src[i + 1] === '/' && !/[:\\]/.test(src[i - 1] || '')) { end = src.indexOf('\n', i); if (end < 0) end = src.length; }+ if (end >= 0) { out += blank(src.slice(i, end)); i = end; continue; }+ out += c;+ i++;+ }+ return out;+};const stripHash = (src) => src.replace(/(^|\s)#[^\n]*/g, (m, pre) => pre + blank(m.slice(pre.length)));const all = (re, s) => [...s.matchAll(re)];diff --git a/tests/parsing.test.mjs b/tests/parsing.test.mjsindex 0b60a90..328d589 100644--- a/tests/parsing.test.mjs+++ b/tests/parsing.test.mjs@@ -74,6 +74,19 @@ test('web requests: fetch with template strings and axios with a method', () =>assert.ok(calls.includes('POST /api/orders/'), calls.join(', '));});+test('comments: a /* inside a string is not a comment, so the code after it is still read', () => {+ const r = extract([+ `import { Hono } from 'hono';`,+ `const app = new Hono();`,+ `app.use('/api/*', cors());`,+ `app.get('/api/items', list);`,+ `app.post('/api/items', create);`,+ `/** Health check. */`,+ `app.get('/health', ok); // for the load balancer`,+ ].join('\n'), 'typescript', 'server/src/index.ts');+ assert.deepEqual(r.routes.map((x) => `${x.method} ${x.path} :${x.line}`), ['GET /api/items :4', 'POST /api/items :5', 'GET /health :7']);+});+test('flattenTemplates replaces every ${…} with a placeholder, nested or not', () => {assert.equal(flattenTemplates('fetch(`${API}/users/${id}`)'), 'fetch(`${x}/users/${x}`)');});