Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Keep line endings deterministic across Linux and Windows checkouts (CI parity).
* text=auto eol=lf

# Binaries must never be normalised.
*.ico binary
*.jpg binary
*.jpeg binary
*.png binary
*.gif binary
*.webp binary
*.zip binary

# Windows tooling that expects CRLF.
*.bat text eol=crlf
*.cmd text eol=crlf
*.ps1 text eol=crlf
10 changes: 8 additions & 2 deletions scripts/ai-safety.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ import path from 'node:path'
import { fileURLToPath } from 'node:url'

const projectRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
const read = async (relative) => fs.readFile(path.join(projectRoot, relative), 'utf8')

// Checkouts on Windows (core.autocrlf=true) deliver CRLF. Normalising here keeps
// the source-text guards below independent of the platform and of git settings.
const read = async (relative) =>
(await fs.readFile(path.join(projectRoot, relative), 'utf8')).replace(/\r\n/g, '\n')

// The aliases are registered by --import (scripts/lib/ts-alias-register.mjs),
// so the production modules below load with their real '@shared/*' imports.
Expand Down Expand Up @@ -599,7 +603,9 @@ check('AI SQL runs only from one click handler in the panel (no effect/shortcut)
// Keyboard input sends messages only — it never runs SQL.
const keyStart = panel.indexOf('function onKeyDown(')
assert.ok(keyStart > 0, 'the panel still has a keydown handler')
const keyHandler = panel.slice(keyStart, panel.indexOf('\n }\n', keyStart))
const keyEnd = panel.indexOf('\n }\n', keyStart)
assert.ok(keyEnd > keyStart, 'the keydown handler body is delimited')
const keyHandler = panel.slice(keyStart, keyEnd)
assert.ok(keyHandler.length > 0, 'keydown handler body is readable')
assert.ok(!/runApproved\(|onRun\(/.test(keyHandler), 'no keyboard shortcut runs AI SQL')

Expand Down
Loading