This commit is contained in:
Jayesh Betala 2026-05-31 12:41:02 +05:30 committed by GitHub
commit 8688b369dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -75,7 +75,7 @@ while IFS= read -r f; do
# Backend: everything else that's code (excluding views/components already matched)
*.rb|*.py|*.go|*.rs|*.java|*.php|*.ex|*.exs) BACKEND=true ;;
*.ts|*.js) BACKEND=true ;; # Non-component TS/JS is backend
*.ts|*.mts|*.cts|*.js|*.mjs|*.cjs) BACKEND=true ;; # Non-component TS/JS is backend (incl. ESM .mjs/.mts + CJS .cjs/.cts)
esac
done <<< "$FILES"

View File

@ -84,6 +84,17 @@ describe('gstack-diff-scope', () => {
expect(scope.SCOPE_TESTS).toBe('true');
});
test('detects backend via ESM/CJS extensions (.mjs/.cjs/.mts/.cts)', () => {
// Pure-ESM Node projects ship backend code as .mjs/.cjs (and explicit-module
// TypeScript as .mts/.cts). These must register as backend so the review
// army's backend/security reviewers fire on such changes.
for (const f of ['server.mjs', 'helper.cjs', 'mod.mts', 'legacy.cts']) {
const dir = createRepo([f]);
const scope = runScope(dir);
expect(scope.SCOPE_BACKEND).toBe('true');
}
});
// --- New scope signals (Review Army) ---
test('detects migrations via db/migrate/', () => {