Skip to content

Commit 4ed9b8b

Browse files
Jonathan D.A. Jewellclaude
andcommitted
v1.0.0: ReScript adapters, 16 databases, language policy
Major release with: - 16 database adapters (up from 11) - 5 core adapters converted to ReScript (PostgreSQL, MongoDB, SQLite, Dragonfly, Elasticsearch) - New adapters: PostgreSQL, MongoDB, Neo4j, Elasticsearch, InfluxDB - Pre-commit hook for local language enforcement - Updated .gitattributes for linguist (ReScript primary) - Comprehensive README with database descriptions and FOSS status Language Policy: - Primary: ReScript - Prohibited: TypeScript - Legacy: JavaScript (for exotic adapters until v2.0.0) Note: CI/CD workflow in .github/workflows/ci.yml - add manually (requires workflow scope) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent dce2092 commit 4ed9b8b

27 files changed

+4082
-107
lines changed

.gitattributes

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,61 @@
44
# Auto detect text files and perform LF normalization
55
* text=auto
66

7-
# JavaScript/Deno
7+
# ============================================================
8+
# ReScript - PRIMARY LANGUAGE
9+
# ============================================================
10+
*.res text eol=lf linguist-language=ReScript
11+
*.resi text eol=lf linguist-language=ReScript
12+
13+
# Compiled ReScript output - mark as generated (excluded from stats)
14+
lib/** linguist-generated=true
15+
*.res.js linguist-generated=true
16+
17+
# ============================================================
18+
# JavaScript - LEGACY (being phased out in v2.0.0)
19+
# ============================================================
820
*.js text eol=lf
921
*.mjs text eol=lf
1022
*.json text eol=lf
1123

12-
# Documentation
13-
*.md text eol=lf
14-
*.adoc text eol=lf
15-
*.txt text eol=lf
24+
# Mark legacy JS adapters as vendored (reduced weight in stats)
25+
adapters/*.js linguist-vendored=true
26+
27+
# ============================================================
28+
# Documentation (excluded from language stats)
29+
# ============================================================
30+
*.md text eol=lf linguist-documentation=true
31+
*.adoc text eol=lf linguist-documentation=true
32+
*.txt text eol=lf linguist-documentation=true
1633

34+
# Scheme state files are documentation, not executable code
35+
*.scm text eol=lf linguist-documentation=true
36+
37+
# ============================================================
1738
# Configuration
18-
*.yml text eol=lf
19-
*.yaml text eol=lf
20-
*.toml text eol=lf
39+
# ============================================================
40+
*.yml text eol=lf linguist-detectable=false
41+
*.yaml text eol=lf linguist-detectable=false
42+
*.toml text eol=lf linguist-detectable=false
2143
.gitignore text eol=lf
2244
.gitattributes text eol=lf
45+
justfile text eol=lf linguist-detectable=false
46+
rescript.json text eol=lf linguist-detectable=false
47+
package.json text eol=lf linguist-detectable=false
48+
deno.json text eol=lf linguist-detectable=false
2349

2450
# Shell scripts
2551
*.sh text eol=lf
2652

27-
# Justfile
28-
justfile text eol=lf
53+
# ============================================================
54+
# Generated/Artifacts (excluded from stats)
55+
# ============================================================
56+
node_modules/** linguist-generated=true
57+
package-lock.json linguist-generated=true
58+
deno.lock linguist-generated=true
2959

60+
# ============================================================
3061
# Binary files
62+
# ============================================================
3163
*.db binary
3264
*.sqlite binary
33-
34-
# Linguist overrides
35-
*.adoc linguist-documentation
36-
*.md linguist-documentation

.githooks/pre-commit

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: MIT
3+
# SPDX-FileCopyrightText: 2025 Jonathan D.A. Jewell
4+
5+
# polyglot-db-mcp Pre-commit Hook
6+
# Enforces language policy: ReScript YES, TypeScript NO
7+
8+
set -e
9+
10+
echo "=== polyglot-db-mcp Pre-commit Hook ==="
11+
12+
# Color codes for output
13+
RED='\033[0;31m'
14+
GREEN='\033[0;32m'
15+
YELLOW='\033[1;33m'
16+
NC='\033[0m' # No Color
17+
18+
ERRORS=0
19+
20+
# =============================================================================
21+
# CHECK 1: No TypeScript files allowed
22+
# =============================================================================
23+
echo -n "Checking for prohibited TypeScript files... "
24+
25+
# Get staged .ts and .tsx files
26+
TS_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(ts|tsx)$' || true)
27+
28+
if [ -n "$TS_FILES" ]; then
29+
echo -e "${RED}FAILED${NC}"
30+
echo ""
31+
echo -e "${RED}ERROR: TypeScript files are PROHIBITED in this project!${NC}"
32+
echo ""
33+
echo "This project uses ReScript for type safety. TypeScript is not allowed."
34+
echo ""
35+
echo "Prohibited files staged for commit:"
36+
echo "$TS_FILES" | while read f; do echo " - $f"; done
37+
echo ""
38+
echo "Resolution options:"
39+
echo " 1. Convert to ReScript (.res) - PREFERRED"
40+
echo " 2. Convert to plain JavaScript (.js) - acceptable for v1.x"
41+
echo " 3. Remove the file if not needed"
42+
echo ""
43+
ERRORS=1
44+
else
45+
echo -e "${GREEN}OK${NC}"
46+
fi
47+
48+
# =============================================================================
49+
# CHECK 2: ReScript files should compile
50+
# =============================================================================
51+
echo -n "Checking ReScript compilation... "
52+
53+
# Get staged .res files
54+
RES_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.resi?$' || true)
55+
56+
if [ -n "$RES_FILES" ]; then
57+
if command -v npx &> /dev/null && [ -f "package.json" ]; then
58+
if ! npm run res:build > /dev/null 2>&1; then
59+
echo -e "${RED}FAILED${NC}"
60+
echo ""
61+
echo -e "${RED}ERROR: ReScript compilation failed!${NC}"
62+
echo "Run 'npm run res:build' to see detailed errors."
63+
ERRORS=1
64+
else
65+
echo -e "${GREEN}OK${NC}"
66+
fi
67+
else
68+
echo -e "${YELLOW}SKIPPED${NC} (npm not available)"
69+
fi
70+
else
71+
echo -e "${GREEN}OK${NC} (no ReScript files changed)"
72+
fi
73+
74+
# =============================================================================
75+
# CHECK 3: New adapters should be in ReScript (warning only for v1.x)
76+
# =============================================================================
77+
echo -n "Checking new adapter language... "
78+
79+
NEW_JS_ADAPTERS=$(git diff --cached --name-only --diff-filter=A | grep -E '^adapters/.*\.js$' || true)
80+
81+
if [ -n "$NEW_JS_ADAPTERS" ]; then
82+
echo -e "${YELLOW}WARNING${NC}"
83+
echo ""
84+
echo -e "${YELLOW}WARNING: New JavaScript adapter(s) detected:${NC}"
85+
echo "$NEW_JS_ADAPTERS" | while read f; do echo " - $f"; done
86+
echo ""
87+
echo "For v1.x this is acceptable, but please consider:"
88+
echo " - Writing new adapters in ReScript (src/adapters/*.res)"
89+
echo " - Converting this adapter to ReScript before v2.0.0"
90+
echo ""
91+
# Not an error for v1.x, just a warning
92+
else
93+
echo -e "${GREEN}OK${NC}"
94+
fi
95+
96+
# =============================================================================
97+
# RESULT
98+
# =============================================================================
99+
echo ""
100+
if [ $ERRORS -ne 0 ]; then
101+
echo -e "${RED}Pre-commit checks FAILED. Please fix the errors above.${NC}"
102+
echo ""
103+
echo "To bypass this hook (NOT RECOMMENDED):"
104+
echo " git commit --no-verify"
105+
exit 1
106+
else
107+
echo -e "${GREEN}All pre-commit checks passed!${NC}"
108+
fi

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
.deno/
33
deno.lock
44

5+
# ReScript compiled output (generated)
6+
lib/
7+
.bsb.lock
8+
59
# Data files
610
*.db
711
*.sqlite

0 commit comments

Comments
 (0)