Skip to content

Commit 93bce8a

Browse files
ajitpratap0Ajit Pratap Singhclaude
authored
fix(website): broken doc links, WASM service worker cache versioning, 404 status (#415)
- Issue #397: not-found.tsx is already correct Next.js App Router structure (no changes needed — returns HTTP 404 automatically for unmatched routes) - Issue #398: Replace relative .md file links with website doc routes in GETTING_STARTED.md, CLI_GUIDE.md, USAGE_GUIDE.md, LINTING_RULES.md, CONFIGURATION.md, API_REFERENCE.md, SQL_COMPATIBILITY.md - Issue #403: Version WASM service worker cache key (gosqlx-wasm-v2), add self.clients.claim() on activate, scope cache deletion to gosqlx-wasm-* prefix only, guard fetch with response.ok check Closes #397, #398, #403 Co-authored-by: Ajit Pratap Singh <ajitpratapsingh@Ajits-Mac-mini-2655.local> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 612cae4 commit 93bce8a

File tree

8 files changed

+50
-44
lines changed

8 files changed

+50
-44
lines changed

docs/API_REFERENCE.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,7 @@ Returns `next` unchanged when `cfg.AuthEnabled()` is false. When enabled, enforc
18911891
| `lint_sql` | Style rule enforcement (L001–L010) |
18921892
| `analyze_sql` | Concurrent composite of all 6 above |
18931893

1894-
See [MCP Server Guide](MCP_GUIDE.md) for complete tool schemas and JSON response formats.
1894+
See [MCP Server Guide](/docs/mcp-guide) for complete tool schemas and JSON response formats.
18951895

18961896
---
18971897

@@ -2317,14 +2317,14 @@ GoSQLX achieves **~80-85% SQL-99 compliance** with comprehensive support for:
23172317
23182318
- **GitHub Repository**: https://github.com/ajitpratap0/GoSQLX
23192319
- **Documentation**: See `/docs` directory
2320-
- `GETTING_STARTED.md` - Quick start guide
2321-
- `MCP_GUIDE.md` - MCP server and AI assistant integration
2322-
- `USAGE_GUIDE.md` - Comprehensive usage guide
2323-
- `LSP_GUIDE.md` - LSP server and IDE integration
2324-
- `LINTING_RULES.md` - All 10 linting rules reference
2325-
- `CONFIGURATION.md` - Configuration file guide
2326-
- `SQL_COMPATIBILITY.md` - SQL dialect compatibility matrix
2327-
- `ERROR_CODES.md` - Complete error code reference
2320+
- [Getting Started](/docs/getting-started) - Quick start guide
2321+
- [MCP Server Guide](/docs/mcp-guide) - MCP server and AI assistant integration
2322+
- [Usage Guide](/docs/usage-guide) - Comprehensive usage guide
2323+
- [LSP Guide](/docs/lsp-guide) - LSP server and IDE integration
2324+
- [Linting Rules](/docs/linting-rules) - All 10 linting rules reference
2325+
- [Configuration](/docs/configuration) - Configuration file guide
2326+
- [SQL Compatibility](/docs/sql-compatibility) - SQL dialect compatibility matrix
2327+
- [Error Codes](/docs/error-codes) - Complete error code reference
23282328
- **Examples**: See `/examples` directory
23292329
- **Issue Tracker**: GitHub Issues
23302330
- **License**: Apache-2.0

docs/CLI_GUIDE.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ gosqlx lint [file...] [flags]
480480
| L009 | Aliasing Consistency | No | Detects mixed table aliasing |
481481
| L010 | Redundant Whitespace | Yes | Finds multiple consecutive spaces |
482482

483-
See [LINTING_RULES.md](LINTING_RULES.md) for complete rule documentation.
483+
See [Linting Rules](/docs/linting-rules) for complete rule documentation.
484484

485485
#### Examples
486486

@@ -617,7 +617,7 @@ require('lspconfig').gosqlx.setup{}
617617
:server-id 'gosqlx))
618618
```
619619

620-
See [LSP_GUIDE.md](LSP_GUIDE.md) for complete LSP documentation.
620+
See [LSP Guide](/docs/lsp-guide) for complete LSP documentation.
621621

622622
---
623623

@@ -715,7 +715,7 @@ linter:
715715
L010: enabled # Redundant whitespace
716716
```
717717
718-
See [CONFIGURATION.md](CONFIGURATION.md) for complete configuration guide.
718+
See [Configuration](/docs/configuration) for complete configuration guide.
719719
720720
---
721721
@@ -1005,7 +1005,7 @@ $ gosqlx validate /dev/null
10051005
Error: not a regular file: /dev/null
10061006
```
10071007

1008-
For more details, see the [Security Validation Package](../cmd/gosqlx/internal/validate/README.md).
1008+
For more details, see the [Security Validation Package](https://github.com/ajitpratap0/GoSQLX/tree/main/cmd/gosqlx/internal/validate).
10091009

10101010
---
10111011

@@ -1388,18 +1388,18 @@ To contribute to the GoSQLX CLI:
13881388
3. Add tests for new CLI features
13891389
4. Submit a pull request
13901390

1391-
See [CONTRIBUTING.md](../CONTRIBUTING.md) for detailed guidelines.
1391+
See [CONTRIBUTING.md](https://github.com/ajitpratap0/GoSQLX/blob/main/CONTRIBUTING.md) for detailed guidelines.
13921392

13931393
---
13941394

13951395
## Related Documentation
13961396

1397-
- [LSP Guide](LSP_GUIDE.md) - Complete LSP server documentation and IDE integration
1398-
- [Linting Rules](LINTING_RULES.md) - All 10 linting rules (L001-L010) reference
1399-
- [Configuration Guide](CONFIGURATION.md) - Configuration file (.gosqlx.yml) guide
1400-
- [Getting Started](GETTING_STARTED.md) - Quick start guide for new users
1401-
- [Usage Guide](USAGE_GUIDE.md) - Comprehensive usage guide
1402-
- [SQL Compatibility](SQL_COMPATIBILITY.md) - SQL dialect compatibility matrix
1397+
- [LSP Guide](/docs/lsp-guide) - Complete LSP server documentation and IDE integration
1398+
- [Linting Rules](/docs/linting-rules) - All 10 linting rules (L001-L010) reference
1399+
- [Configuration Guide](/docs/configuration) - Configuration file (.gosqlx.yml) guide
1400+
- [Getting Started](/docs/getting-started) - Quick start guide for new users
1401+
- [Usage Guide](/docs/usage-guide) - Comprehensive usage guide
1402+
- [SQL Compatibility](/docs/sql-compatibility) - SQL dialect compatibility matrix
14031403

14041404
---
14051405

docs/CONFIGURATION.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,9 @@ git commit -m "config: update GoSQLX settings"
489489

490490
## Related Documentation
491491

492-
- [CLI Guide](CLI_GUIDE.md) - Complete CLI reference
493-
- [Linting Rules](LINTING_RULES.md) - Linting rules reference
494-
- [API Reference](API_REFERENCE.md) - Full API documentation
492+
- [CLI Guide](/docs/cli-guide) - Complete CLI reference
493+
- [Linting Rules](/docs/linting-rules) - Linting rules reference
494+
- [API Reference](/docs/api-reference) - Full API documentation
495495

496496
---
497497

@@ -524,7 +524,7 @@ GOSQLX_MCP_HOST=0.0.0.0 GOSQLX_MCP_PORT=8080 GOSQLX_MCP_AUTH_TOKEN=my-secret gos
524524
- `GOSQLX_MCP_PORT` rejects out-of-range or non-integer values at startup with a descriptive error.
525525
- MCP server configuration is independent of `.gosqlx.yml` - the YAML config file is not read by `gosqlx-mcp`.
526526

527-
See [MCP Server Guide](MCP_GUIDE.md) for the full startup and auth reference.
527+
See [MCP Server Guide](/docs/mcp-guide) for the full startup and auth reference.
528528

529529
---
530530

docs/GETTING_STARTED.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ gosqlx lsp --log /tmp/lsp.log
421421
- **[Linting Rules](/docs/linting-rules)** - All 10 linting rules (L001-L010) reference
422422
- **[Configuration](/docs/configuration)** - Configuration file (.gosqlx.yml) guide
423423
- **[API Reference](/docs/api-reference)** - Complete API documentation
424-
- **[Examples](../examples/)** - Real-world code examples
424+
- **[Examples](https://github.com/ajitpratap0/GoSQLX/tree/main/examples)** - Real-world code examples
425425

426426
### v1.12.0 Feature Guides:
427427
- **PostgreSQL Extensions:**

docs/LINTING_RULES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,9 @@ jobs:
458458
459459
## Related Documentation
460460
461-
- [CLI Guide](CLI_GUIDE.md) - Complete CLI reference
462-
- [Configuration Guide](CONFIGURATION.md) - Configuration options
463-
- [API Reference](API_REFERENCE.md) - Full API documentation
461+
- [CLI Guide](/docs/cli-guide) - Complete CLI reference
462+
- [Configuration Guide](/docs/configuration) - Configuration options
463+
- [API Reference](/docs/api-reference) - Full API documentation
464464
465465
---
466466

docs/SQL_COMPATIBILITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,6 @@ gosqlx format --dialect mysql query.sql
852852

853853
### Migration Notes
854854
- **From v1.7.0**: High-level API (`gosqlx.Parse()`, `gosqlx.Validate()`) is fully backward compatible
855-
- **Breaking**: `token.Token.ModelType` renamed to `Type`; string-based `token.Type` removed. See [MIGRATION.md](MIGRATION.md)
855+
- **Breaking**: `token.Token.ModelType` renamed to `Type`; string-based `token.Type` removed. See [MIGRATION.md](https://github.com/ajitpratap0/GoSQLX/blob/main/docs/MIGRATION.md)
856856
- **MySQL Users**: Use `parser.ParseWithDialect(sql, "mysql")` for MySQL-specific syntax
857857
- **Performance**: ~50% faster parsing from token type overhaul

docs/USAGE_GUIDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ The LSP server provides:
13251325
- Helpful error messages
13261326
- Suggested fixes
13271327

1328-
For complete LSP documentation, see [LSP_GUIDE.md](./LSP_GUIDE.md).
1328+
For complete LSP documentation, see [LSP Guide](/docs/lsp-guide).
13291329

13301330
## CLI Tool Usage (v1.6.0)
13311331

@@ -1519,7 +1519,7 @@ lsp:
15191519
hover_enabled: true
15201520
```
15211521
1522-
For complete configuration documentation, see [CONFIGURATION.md](./CONFIGURATION.md).
1522+
For complete configuration documentation, see [Configuration](/docs/configuration).
15231523
15241524
### CLI Examples
15251525

website/public/wasm-sw.js

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,38 @@
1-
const WASM_CACHE = 'gosqlx-wasm-7fe84bbe';
1+
const CACHE_VERSION = 'v2'; // Bump this when deploying new WASM binary
2+
const CACHE_NAME = `gosqlx-wasm-${CACHE_VERSION}`;
23
const WASM_URL = '/wasm/gosqlx.wasm';
34

45
self.addEventListener('install', (event) => {
56
event.waitUntil(
6-
caches.open(WASM_CACHE).then((cache) => cache.add(WASM_URL))
7+
caches.open(CACHE_NAME).then((cache) => cache.add(WASM_URL))
78
);
89
self.skipWaiting();
910
});
1011

1112
self.addEventListener('activate', (event) => {
1213
event.waitUntil(
13-
caches.keys().then((keys) =>
14-
Promise.all(keys.filter((k) => k !== WASM_CACHE).map((k) => caches.delete(k)))
14+
caches.keys().then((cacheNames) =>
15+
Promise.all(
16+
cacheNames
17+
.filter((name) => name.startsWith('gosqlx-wasm-') && name !== CACHE_NAME)
18+
.map((name) => caches.delete(name))
19+
)
1520
)
1621
);
22+
self.clients.claim();
1723
});
1824

1925
self.addEventListener('fetch', (event) => {
20-
if (event.request.url.endsWith('gosqlx.wasm')) {
26+
if (event.request.url.includes('/wasm/gosqlx.wasm')) {
2127
event.respondWith(
22-
caches.match(event.request).then((cached) => {
23-
if (cached) return cached;
24-
return fetch(event.request).then((response) => {
25-
const clone = response.clone();
26-
caches.open(WASM_CACHE).then((cache) => cache.put(event.request, clone));
27-
return response;
28-
});
29-
})
28+
caches.open(CACHE_NAME).then((cache) =>
29+
cache.match(event.request).then(
30+
(cached) => cached || fetch(event.request).then((response) => {
31+
if (response.ok) cache.put(event.request, response.clone());
32+
return response;
33+
})
34+
)
35+
)
3036
);
3137
}
3238
});

0 commit comments

Comments
 (0)