Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c94d4aad3c | ||
|
|
f75b416aa8 | ||
|
|
d35e62857f | ||
|
|
cf029fc88f | ||
|
|
57a2dc74d6 | ||
|
|
b06c330d02 |
No files matched your search
@@ -2,10 +2,8 @@
|
||||
description: Cloud edition implementation details, PostgreSQL Row-Level Security (RLS) isolation, cross-subdomain auth, and cryptographic license keys.
|
||||
paths:
|
||||
- "src/lib/auth*"
|
||||
- "src/lib/auth/**/*"
|
||||
- "src/app/api/auth/**/*"
|
||||
- "src/core/auth.ts"
|
||||
- "src/core/storage.ts"
|
||||
- "src/core/tenant.ts"
|
||||
---
|
||||
|
||||
> **SUPERSEDED by ADR-003** (`docs/architecture/decisions/adr-0003-shared-identity-and-ecosystem-auth-host.md`).
|
||||
@@ -177,13 +175,15 @@ DATABASE_URL=postgresql://...
|
||||
|
||||
## Edition Adapters
|
||||
|
||||
Three thin files are all that differs between editions — everything else is edition-unaware:
|
||||
Three thin adapter modules provide all edition-specific behaviour -- everything else is edition-unaware:
|
||||
|
||||
| Adapter | Local | Cloud | Demo |
|
||||
|---|---|---|---|
|
||||
| `src/core/auth.ts` | Auth.js `Credentials` (bcrypt + PostgreSQL) | Auth.js `@auth/supabase-adapter` | Disabled |
|
||||
| `src/core/storage.ts` | `fs.writeFile()` to `data/` | Supabase Storage SDK | Read-only |
|
||||
| `src/core/tenant.ts` | No-op (single tenant) | Sets `app.tenant_id` for RLS | No-op |
|
||||
| `src/lib/auth.ts` | Auth.js `Credentials` (bcrypt + PostgreSQL) | Auth.js `@auth/supabase-adapter` | Disabled |
|
||||
| Storage adapter (planned) | `fs.writeFile()` to `data/` | Supabase Storage SDK | Read-only |
|
||||
| Tenant adapter (planned) | No-op (single tenant) | Sets `app.tenant_id` for RLS | No-op |
|
||||
|
||||
> The storage and tenant adapters listed above are planned for the Cloud edition build-out and are not yet implemented as separate files. Auth is fully implemented in `src/lib/auth.ts` and `src/lib/auth.config.ts`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -206,18 +206,10 @@ Hard refresh: `Ctrl+Shift+R`
|
||||
|
||||
## Creating Static OSM Plugins
|
||||
|
||||
See full guide: `.agents/skills/osm-static-plugin-creation.md`
|
||||
Use the `plugin-new` skill (`.agents/skills/plugin-new/SKILL.md`) to scaffold new plugins, including OSM-based static data plugins. The old `scaffold-osm-plugin.mjs` script and `osm-static-plugin-creation.md` skill were removed; static OSM plugins are now built as standard `bundle` format plugins via the wwv-cli:
|
||||
|
||||
**Quick start:**
|
||||
```bash
|
||||
node scripts/scaffold-osm-plugin.mjs '{
|
||||
"name": "volcanoes",
|
||||
"displayName": "Volcanoes",
|
||||
"osmTag": "natural=volcano",
|
||||
"icon": "Mountain",
|
||||
"color": "#ef4444",
|
||||
"category": "Natural Disaster"
|
||||
}'
|
||||
node packages/wwv-cli/dist/index.js create <name> --local
|
||||
```
|
||||
|
||||
**Manual Overpass API query (PowerShell):**
|
||||
@@ -227,26 +219,29 @@ $body = "data=[out:json][timeout:300];(node[$tag];way[$tag];relation[$tag];);out
|
||||
Invoke-RestMethod -Uri 'https://overpass-api.de/api/interpreter' -Method Post -Body $body -OutFile 'tmp/raw_data.json'
|
||||
```
|
||||
|
||||
**Note:** OSM data is licensed under **ODbL** — include attribution in plugin READMEs.
|
||||
**Note:** OSM data is licensed under **ODbL** - include attribution in plugin READMEs.
|
||||
|
||||
---
|
||||
|
||||
## npm Plugin Publishing
|
||||
|
||||
See full guide: `.agents/skills/version-control/npm-plugin-publishing.md`
|
||||
The `npm-plugin-publishing.md` skill was removed. Use the wwv-cli publish command:
|
||||
|
||||
```bash
|
||||
# First-time publish
|
||||
# Publish a local plugin
|
||||
node packages/wwv-cli/dist/index.js publish <name> [--org <your-org>]
|
||||
|
||||
# Or publish directly via pnpm (for packages/ workspace members)
|
||||
pnpm publish --workspace=packages/wwv-plugin-<name> --access public
|
||||
|
||||
# Future versions — via Trusted Publishing (GitHub Actions CI/CD)
|
||||
# Future versions via Trusted Publishing (GitHub Actions CI/CD)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Git / Version Control
|
||||
|
||||
See full guide: `.agents/skills/version-control/git-version-control.md`
|
||||
The `git-version-control.md` skill was removed. See `.agents/skills/using-git-worktrees/SKILL.md` for worktree workflows and `.agents/skills/branch-cleanup/SKILL.md` for the post-merge teardown flow.
|
||||
|
||||
**Commit convention:** `feat:`, `fix:`, `chore:`, `docs:` prefixes.
|
||||
**Commit when:** A new feature is completed (per project rules).
|
||||
@@ -255,7 +250,7 @@ See full guide: `.agents/skills/version-control/git-version-control.md`
|
||||
|
||||
## Security Checks
|
||||
|
||||
See full guide: `.agents/skills/security/security-check.md`
|
||||
The `security-check.md` skill was removed. Security reviews are handled by the `security-reviewer` agent (`.agents/agents/security-reviewer.md`). Trigger it after any change touching auth routes, API routes, plugin loading, or marketplace flows.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ GET marketplace.worldwideview.dev/api/registry
|
||||
- Trust is **always stamped server-side** — no client-side trust claims accepted
|
||||
- Registry response cached for **5 minutes** (in-memory on each WWV instance)
|
||||
- If registry unreachable, last cached result used; new unknowns default to `unverified`
|
||||
- **Managing:** Edit `src/data/verifiedPlugins.ts` in marketplace repo and redeploy
|
||||
- **Managing:** Use the marketplace admin API (`/api/admin/registry`) to manage the signed plugin registry. The old `src/data/verifiedPlugins.ts` static file was replaced by database-driven registry management.
|
||||
- **Revoking:** Remove plugin ID and redeploy — WWV instances drop trust on next cache refresh
|
||||
|
||||
### Unverified Plugin Warning
|
||||
@@ -437,7 +437,7 @@ This queries Overpass API, converts to GeoJSON, scaffolds the package, and print
|
||||
| Power plants | `power=plant` | 15k |
|
||||
| Wind farms | `generator:source=wind` | 50k |
|
||||
|
||||
See skill: `.agents/skills/osm-static-plugin-creation.md`
|
||||
The `osm-static-plugin-creation.md` skill was removed. Use `node packages/wwv-cli/dist/index.js create <name> --local` to scaffold a new plugin, then populate it with OSM data fetched via the Overpass API.
|
||||
|
||||
---
|
||||
|
||||
@@ -462,7 +462,7 @@ To solve this friction and make third-party plugin hosting highly intuitive, the
|
||||
2. **Backend SDK:** They write simple `.ts` fetch scripts returning `GeoEntity[]` and drop them into a mounted `/seeders` volume.
|
||||
3. **Zero Configuration:** The Docker engine hot-reloads these seeders, handles the Redis caching, and exposes standardized REST or WebSocket endpoints automatically. The developer focuses only on fetching data, avoiding all backend infrastructure setup.
|
||||
|
||||
See skill: `.agents/skills/data-engine-seeder-creation.md`
|
||||
The `data-engine-seeder-creation.md` skill was removed. Seeder implementation rules are documented inline in `.agents/rules/data-engine-architecture.md`. Seeders live in `local-seeders/community/` or `local-seeders/private/` (separate git clones).
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
# /triage-issue
|
||||
|
||||
Triage a single GitHub issue in `silvertakana/worldwideview` per the project's [TRIAGE.md](../../TRIAGE.md) intake rules. Classifies the issue, recommends a disposition, and executes it after explicit user confirmation.
|
||||
|
||||
**Usage:** `/triage-issue <issue-number>`
|
||||
|
||||
`$ARGUMENTS` = the issue number to triage.
|
||||
|
||||
## Procedure
|
||||
|
||||
### 1. Fetch the issue
|
||||
|
||||
```bash
|
||||
gh issue view $ARGUMENTS --repo silvertakana/worldwideview --json number,title,body,labels,comments,author
|
||||
```
|
||||
|
||||
### 2. Classify
|
||||
|
||||
Determine the type from the title prefix and body:
|
||||
|
||||
| Signal | Type |
|
||||
|---|---|
|
||||
| `[PLUGIN]`, "data source", "show X on the globe" | **plugin-request** |
|
||||
| `[FEATURE]`, "feature request", capability not tied to a data source | **enhancement** |
|
||||
| `[BUG]`, error, stack trace, "doesn't work" | **bug** |
|
||||
| Open-ended question, no actionable ask | **question** |
|
||||
|
||||
### 3. Apply the TRIAGE.md rule
|
||||
|
||||
- **plugin-request:** vet the API first (dispatch the `plugin-researcher` agent if the source is unknown). Then apply the build/do-not-build rule (free API + renders something meaningful + fits the demo).
|
||||
- Viable -> propose: add a checklist line to #4, label `plugin-request` + `good first issue` + `help wanted`, close standalone with "Tracked in #4."
|
||||
- Not viable -> propose: close with the specific reason.
|
||||
- **enhancement:** propose: label `enhancement`, add a one-line ROADMAP backlog entry, keep open.
|
||||
- **bug:** propose: label `bug`, reproduce, then fix inline or route to the `debugger` agent.
|
||||
- **question:** draft a reply; propose answer-then-close.
|
||||
|
||||
### 4. Confirm before any state change
|
||||
|
||||
Present the classification and proposed actions as a short summary. **Do not** comment, label, pin, close, or edit anything until the user explicitly approves (per the project's "explicit user authorization before any state-changing action" rule). Comments are posted from the owner account, so they read as owner triage notes - keep them accurate and neutral.
|
||||
|
||||
### 5. Execute
|
||||
|
||||
On approval, run the `gh` commands for the approved actions only. Report each result with its URL.
|
||||
|
||||
## Notes
|
||||
|
||||
- Issue #4 (Plugin Wishlist) is the canonical pinned funnel for plugin ideas - never create a competing wishlist.
|
||||
- Never promise dates on `enhancement` issues.
|
||||
- See [TRIAGE.md](../../TRIAGE.md) for the full rationale and the build/do-not-build test.
|
||||
@@ -0,0 +1,122 @@
|
||||
---
|
||||
phase: 17-instance-picker-ui-overhaul
|
||||
plan: "01"
|
||||
subsystem: marketplace-instance-data-layer
|
||||
tags: [api, tdd, validation, prisma, auth]
|
||||
dependency_graph:
|
||||
requires: []
|
||||
provides: [SavedInstance-lastUsedAt, GET-me-instances-fixed, validateInstanceUrl, POST-instances-link, DELETE-PATCH-instances-id]
|
||||
affects: [InstancePicker, InstanceHydrator, InstanceCapture, InstanceConfig]
|
||||
tech_stack:
|
||||
added: []
|
||||
patterns: [discriminated-union, idempotent-upsert, ownership-check-404, tdd-red-green]
|
||||
key_files:
|
||||
created:
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/lib/instanceValidation.ts
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/lib/instanceValidation.spec.ts
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/app/api/instances/link/route.ts
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/app/api/instances/[id]/route.ts
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/app/api/instances/link/route.test.ts
|
||||
modified:
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/lib/instanceStore.ts
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/app/api/me/instances/route.ts
|
||||
- C:/dev/wwv/worldwideview-marketplace/src/app/api/me/instances/route.test.ts
|
||||
decisions:
|
||||
- "GET /api/me/instances kept at current URL - not renamed to /api/instances"
|
||||
- "Anon callers still receive 200 + empty array - no 401 switch"
|
||||
- "SavedInstance gets lastUsedAt only - createdAt deliberately excluded per plan"
|
||||
- "Route test mocks updated to reflect getOrCreateMarketplaceUser addition (Rule 1 fix)"
|
||||
metrics:
|
||||
duration: "~25 minutes"
|
||||
completed: "2026-05-30"
|
||||
tasks_completed: 3
|
||||
files_changed: 8
|
||||
---
|
||||
|
||||
# Phase 17 Plan 01: Instance Data Layer Summary
|
||||
|
||||
**One-liner:** Server-side instance sync data layer with idempotent upsert, URL validation discriminated union, and ownership-checked CRUD routes.
|
||||
|
||||
## Tasks Completed
|
||||
|
||||
| Task | Name | Commit | Files |
|
||||
|------|------|--------|-------|
|
||||
| 1 | Add lastUsedAt to SavedInstance + fix GET | 421a5b8 | instanceStore.ts, me/instances/route.ts |
|
||||
| 2 (RED) | validateInstanceUrl failing tests | 269cad1 | instanceValidation.spec.ts |
|
||||
| 2 (GREEN) | validateInstanceUrl implementation | 9a3fcb7 | instanceValidation.ts |
|
||||
| 3 (RED) | link route failing tests | 20c7ea0 | instances/link/route.test.ts |
|
||||
| 3 (GREEN) | link + [id] routes implementation | e69ebca | instances/link/route.ts, instances/[id]/route.ts, route.test.ts fix |
|
||||
|
||||
## What Was Built
|
||||
|
||||
**Task 1** fixed two issues in the existing GET route:
|
||||
- `SavedInstance` interface now includes `lastUsedAt: string` (no `createdAt` per plan)
|
||||
- GET route now calls `getOrCreateMarketplaceUser` to resolve the marketplace cuid before querying `LinkedInstance.userId`. The previous bug queried with the raw Supabase user id, so rows written by `/api/install/start` (which use the marketplace cuid) were never returned.
|
||||
- `lastUsedAt` added to the SELECT
|
||||
- Anonymous callers still receive `200 + { instances: [] }` - no auth-contract regression
|
||||
|
||||
**Task 2** ported `instanceValidation.ts` with full TDD:
|
||||
- `InstanceValidationResult` discriminated union: `{ ok: true; url: string } | { ok: false; reason: string }`
|
||||
- `validateInstanceUrl(raw, marketplaceOrigin)` normalises to `parsed.origin`, rejects non-http(s), self-loops, unparseable, empty/null
|
||||
- 8 Vitest cases (split null/undefined case and empty-string into separate `it` blocks)
|
||||
- RED commit preceded GREEN commit
|
||||
|
||||
**Task 3** ported both write routes with TDD:
|
||||
- `POST /api/instances/link`: idempotent upsert via `userId_url` compound key, bumps `lastUsedAt` on repeat
|
||||
- `DELETE /api/instances/[id]`: ownership check via `findFirst { id, userId }`; returns 404 (never 403)
|
||||
- `PATCH /api/instances/[id]`: nickname trimmed to 80 chars, null clears field; 404 for non-owned
|
||||
- Link route unit tests: 401 for anon + upsert called with correct `userId_url`
|
||||
- RED commit preceded GREEN commit
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
### Auto-fixed Issues
|
||||
|
||||
**1. [Rule 1 - Bug] Existing route.test.ts for GET /api/me/instances broken by Task 1**
|
||||
- **Found during:** Task 3 full test run
|
||||
- **Issue:** The existing `src/app/api/me/instances/route.test.ts` mocked `prisma` without `user.findUnique` and did not mock `getOrCreateMarketplaceUser`. After Task 1 added `getOrCreateMarketplaceUser` to the route, the test threw `TypeError: Cannot read properties of undefined (reading 'findUnique')`.
|
||||
- **Fix:** Updated the test to mock `getOrCreateMarketplaceUser`, updated prisma mock (no longer needs `user` table), and adjusted assertions to use marketplace user id (`mkt-456`) instead of raw supabase id.
|
||||
- **Files modified:** `src/app/api/me/instances/route.test.ts`
|
||||
- **Commit:** e69ebca (bundled with Task 3 GREEN)
|
||||
|
||||
### Pre-existing Failures (Out of Scope)
|
||||
|
||||
- `src/app/oauth/authorize/actions.spec.ts` has 1 failing test that existed before this plan. Verified by stash-and-test. Not caused by any change in this plan. Logged for deferred attention.
|
||||
|
||||
## TDD Gate Compliance
|
||||
|
||||
| Gate | Commit | Status |
|
||||
|------|--------|--------|
|
||||
| Task 2 RED | 269cad1 | test(17-01): add failing tests for validateInstanceUrl (RED) |
|
||||
| Task 2 GREEN | 9a3fcb7 | feat(17-01): implement validateInstanceUrl (GREEN) |
|
||||
| Task 3 RED | 20c7ea0 | test(17-01): add failing tests for POST /api/instances/link (RED) |
|
||||
| Task 3 GREEN | e69ebca | feat(17-01): create POST /api/instances/link + DELETE/PATCH /api/instances/[id] (GREEN) |
|
||||
|
||||
Both TDD cycles satisfied: RED commit preceded GREEN commit for Tasks 2 and 3.
|
||||
|
||||
## Known Stubs
|
||||
|
||||
None. All routes are fully implemented and wired to live Prisma queries.
|
||||
|
||||
## Threat Surface Scan
|
||||
|
||||
All mitigations from the plan's threat model are present:
|
||||
- T-17-01: `validateInstanceUrl` rejects non-http(s), unparseable, marketplace self-origin; only `parsed.origin` stored
|
||||
- T-17-02: DELETE/PATCH use `findFirst { id, userId }` ownership check; return 404 (not 403)
|
||||
- T-17-03: GET uses `getOrCreateMarketplaceUser` scoped to caller's marketplace cuid
|
||||
- T-17-04: PATCH trims nickname to 80 chars before persist
|
||||
|
||||
No new security surface introduced beyond what the threat model covers.
|
||||
|
||||
## Self-Check: PASSED
|
||||
|
||||
- `src/lib/instanceStore.ts` - FOUND, contains `lastUsedAt: string`
|
||||
- `src/app/api/me/instances/route.ts` - FOUND, uses `getOrCreateMarketplaceUser`
|
||||
- `src/lib/instanceValidation.ts` - FOUND, exports `validateInstanceUrl`
|
||||
- `src/lib/instanceValidation.spec.ts` - FOUND, 8 `it(` blocks
|
||||
- `src/app/api/instances/link/route.ts` - FOUND, exports `POST`
|
||||
- `src/app/api/instances/[id]/route.ts` - FOUND, exports `DELETE` and `PATCH`
|
||||
- `src/app/api/instances/link/route.test.ts` - FOUND, 2 tests pass
|
||||
- Commits 421a5b8, 269cad1, 9a3fcb7, 20c7ea0, e69ebca - all present in git log
|
||||
- `npx tsc --noEmit` - no errors
|
||||
- `pnpm test` - 75 passed, 1 pre-existing failure (oauth, out of scope)
|
||||
@@ -132,6 +132,7 @@ See `.agents/context/INDEX.md` for the full navigation table. Key files:
|
||||
| `/five` | Five Whys root cause analysis | `.agents/workflows/five.md` |
|
||||
| `/stitch-to-nextjs` | Generate UI with Stitch MCP, port into Next.js | `.agents/workflows/stitch-to-nextjs.md` |
|
||||
| `/branch-cleanup` | **Post-merge teardown** — commit leftovers, delete plan file, remove worktree via worktree-manager | `.agents/skills/branch-cleanup/SKILL.md` |
|
||||
| `/triage-issue` | Triage a single issue (plugin/feature/bug/question) per `TRIAGE.md`; confirm before any state change | `.agents/workflows/triage-issue.md` |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
# Issue Triage Guide
|
||||
|
||||
How incoming **plugin requests** and **feature requests** are handled in `silvertakana/worldwideview`. The goal is a consistent, low-effort intake so nothing rots and contributors always know where their idea stands.
|
||||
|
||||
Run `/triage-issue <number>` to apply this guide to a specific issue.
|
||||
|
||||
## 1. Intake types and labels
|
||||
|
||||
Every non-bug request is one of two types:
|
||||
|
||||
| Type | What it is | Label | Examples |
|
||||
|---|---|---|---|
|
||||
| **Plugin request** | A new data source to render on the globe | `plugin-request` | BirdNET (#148), ISS tracker, AIS ships |
|
||||
| **Feature request** | A platform capability, not a data source | `enhancement` | GeoJSON editor (#84), ontology layer (#138) |
|
||||
|
||||
Community-buildable plugin requests also get `good first issue` + `help wanted`.
|
||||
|
||||
## 2. Plugin requests funnel into #4
|
||||
|
||||
[Issue #4 - Plugin Wishlist](https://github.com/silvertakana/worldwideview/issues/4) is the **single pinned funnel** for plugin ideas. When a `[PLUGIN]` issue arrives:
|
||||
|
||||
1. **Vet the data source.** Is there a free, public API? Check rate limits and CORS. The `plugin-researcher` agent does this in about a minute.
|
||||
2. **If viable:** add it as a checklist line in #4, label the standalone `plugin-request` + `good first issue` + `help wanted`, then close the standalone with a note: "Tracked in the Plugin Wishlist #4." This keeps one canonical list instead of scattered duplicates.
|
||||
3. **If not viable** (no free API, paywalled, or geofenced - e.g. aviation/OpenSky in #149): close with the reason stated, so nobody re-opens the same dead end.
|
||||
|
||||
## 3. Feature requests stay open as tracking threads
|
||||
|
||||
1. Label `enhancement`.
|
||||
2. Add a one-line entry to the `.planning` ROADMAP backlog (shared root, see `WWV_SHARED_PLANNING`).
|
||||
3. Leave the issue **open** as the canonical tracking thread. Reply with status, but **promise no dates**.
|
||||
|
||||
## 4. The build / do-not-build rule
|
||||
|
||||
Only build a plugin yourself (or kick off the `/plugin-new` pipeline) when **all three** hold:
|
||||
|
||||
1. **Free API exists** - no paywall, usable rate limits.
|
||||
2. **Renders something meaningful** - points, paths, or regions on the globe, not just a number.
|
||||
3. **Fits the demo** - relevant to the live `demo` edition, not a niche one-off.
|
||||
|
||||
If any one fails, it lives in the wishlist (#4) for community contributors. The same three-part test is why aviation was pulled from the demo (#149): the only free API was unreliable.
|
||||
|
||||
## 5. Quick reference
|
||||
|
||||
```
|
||||
[PLUGIN] issue -> vet API -> viable? yes: add to #4, label, close standalone
|
||||
no: close with reason
|
||||
[FEATURE] issue -> label enhancement -> add to ROADMAP backlog -> keep open
|
||||
bug -> reproduce -> label bug -> fix or route to debugger agent
|
||||
question -> answer -> close
|
||||
```
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "worldwideview",
|
||||
"version": "2.48.14",
|
||||
"version": "2.48.17",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"packageManager": "[email protected]",
|
||||
|
||||
+40
-7
@@ -148,6 +148,9 @@ const ANTI_PATTERNS = [
|
||||
tier: 'A',
|
||||
globs: ['*.ts', '*.tsx'],
|
||||
pattern: '@ts-ignore',
|
||||
// Only flag the actual suppression directive form (// @ts-ignore or /* @ts-ignore),
|
||||
// not the token appearing in JSDoc prose (e.g. "No @ts-ignore used here").
|
||||
directiveOnly: true,
|
||||
desc: '@ts-ignore suppresses real type errors — remove and fix the underlying type',
|
||||
},
|
||||
{
|
||||
@@ -155,6 +158,7 @@ const ANTI_PATTERNS = [
|
||||
tier: 'A',
|
||||
globs: ['*.ts', '*.tsx'],
|
||||
pattern: '@ts-nocheck',
|
||||
directiveOnly: true,
|
||||
desc: '@ts-nocheck disables all type checking for the file — remove and fix types',
|
||||
},
|
||||
{
|
||||
@@ -175,7 +179,7 @@ const ANTI_PATTERNS = [
|
||||
];
|
||||
|
||||
function detectAntiPatterns() {
|
||||
for (const { id, tier, globs, pattern, desc, excludePrefix } of ANTI_PATTERNS) {
|
||||
for (const { id, tier, globs, pattern, desc, excludePrefix, directiveOnly } of ANTI_PATTERNS) {
|
||||
const globArgs = globs.map(g => `"${g}"`).join(' ');
|
||||
const raw = run(`git grep -En "${pattern}" -- ${globArgs}`);
|
||||
if (!raw) continue;
|
||||
@@ -189,13 +193,19 @@ function detectAntiPatterns() {
|
||||
const m = line.match(/^([^:]+):(\d+):(.*)/);
|
||||
if (!m) continue;
|
||||
if (m[1].startsWith('node_modules/') || m[1].includes('public/cesium')) continue;
|
||||
const content = m[3].trim();
|
||||
// For directive-only patterns (e.g. @ts-ignore), skip lines where the token
|
||||
// appears in prose rather than as a comment suppression directive.
|
||||
// A real directive has @ts-ignore/@ts-nocheck immediately after the // or /*
|
||||
// comment opener — not buried mid-sentence in a comment that mentions it.
|
||||
if (directiveOnly && !/^\s*\/[/*]\s*@ts-(ignore|nocheck)/.test(m[3])) continue;
|
||||
add({
|
||||
type: 'anti-pattern',
|
||||
patternId: id,
|
||||
tier,
|
||||
file: m[1],
|
||||
line: parseInt(m[2], 10),
|
||||
content: m[3].trim().slice(0, 200),
|
||||
content: content.slice(0, 200),
|
||||
description: desc,
|
||||
});
|
||||
}
|
||||
@@ -306,13 +316,36 @@ function detectOutdatedDeps() {
|
||||
if (!existsSync(join(ROOT, 'package.json'))) return;
|
||||
const raw = run('pnpm outdated --no-color 2>/dev/null || true');
|
||||
if (!raw) return;
|
||||
const dataLines = raw
|
||||
// pnpm outdated renders a Unicode box-drawing table. Data rows start with │ and
|
||||
// contain pipe-separated columns; separator/border rows contain ─ or ┼ characters.
|
||||
// We extract data rows by splitting on │ and discarding header/separator lines.
|
||||
const SEPARATOR_CHARS = /[┌┐└┘├┤─]/;
|
||||
const tableDataRows = raw
|
||||
.split('\n')
|
||||
.filter(l => l.trim() && !l.startsWith('Package') && !l.startsWith('Legend') && !l.startsWith(' '));
|
||||
.filter(l => l.startsWith('│') && !SEPARATOR_CHARS.test(l));
|
||||
// Fall back to plain whitespace-separated output (older pnpm / --no-color plain format)
|
||||
const plainDataLines = !tableDataRows.length
|
||||
? raw.split('\n').filter(l => l.trim() && !l.startsWith('Package') && !l.startsWith('Legend') && !l.startsWith(' '))
|
||||
: [];
|
||||
|
||||
const dataLines = tableDataRows.length ? tableDataRows : plainDataLines;
|
||||
|
||||
for (const line of dataLines.slice(0, 12)) {
|
||||
const cols = line.trim().split(/\s+/);
|
||||
if (cols.length < 3) continue;
|
||||
const [pkg, current, latest] = cols;
|
||||
let pkg, current, latest;
|
||||
if (tableDataRows.length) {
|
||||
// Parse │ col1 │ col2 │ col3 │ format
|
||||
const cols = line.split('│').map(c => c.trim()).filter(Boolean);
|
||||
if (cols.length < 3) continue;
|
||||
// Header row: first column is literally "Package"
|
||||
if (cols[0] === 'Package') continue;
|
||||
[pkg, current, latest] = cols;
|
||||
// current may be "1.2.3 (wanted 1.2.4)" — extract just the installed version
|
||||
current = current.split(' ')[0];
|
||||
} else {
|
||||
const cols = line.trim().split(/\s+/);
|
||||
if (cols.length < 3) continue;
|
||||
[pkg, current, latest] = cols;
|
||||
}
|
||||
if (!pkg || !current || !latest || current === latest) continue;
|
||||
const isMajor = current.replace(/^[^0-9]*/, '').split('.')[0] !== latest.replace(/^[^0-9]*/, '').split('.')[0];
|
||||
add({
|
||||
|
||||
@@ -24,6 +24,7 @@ export function BottomPanelManager() {
|
||||
);
|
||||
|
||||
const isCoveredRef = useRef(false);
|
||||
const isDraggingRef = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (activeBottomPanel) {
|
||||
@@ -39,17 +40,18 @@ export function BottomPanelManager() {
|
||||
}, [activeBottomPanel]);
|
||||
|
||||
// Pointer-capture drag handlers — attached directly to the resize handle element.
|
||||
// Using setPointerCapture ensures pointermove/pointerup are delivered to the
|
||||
// element even when the pointer leaves it, which is required for webkit
|
||||
// (without capture, webkit drops synthetic pointermove events from Playwright
|
||||
// and from fast real-user drags that leave the element bounds).
|
||||
// setPointerCapture ensures pointermove/pointerup are delivered to the element even
|
||||
// when the pointer leaves its bounds (required for fast real-user drags and Playwright).
|
||||
// isDraggingRef guards the move handler instead of hasPointerCapture, which has
|
||||
// inconsistent behaviour across webkit versions in CI for repeated drag sequences.
|
||||
const handleResizePointerDown = (e: React.PointerEvent<HTMLDivElement>) => {
|
||||
e.currentTarget.setPointerCapture(e.pointerId);
|
||||
isDraggingRef.current = true;
|
||||
document.body.classList.add("is-dragging-bottom-panel");
|
||||
};
|
||||
|
||||
const handleResizePointerMove = (e: React.PointerEvent<HTMLDivElement>) => {
|
||||
if (!e.currentTarget.hasPointerCapture(e.pointerId)) return;
|
||||
if (!isDraggingRef.current) return;
|
||||
const newHeight = window.innerHeight - e.clientY;
|
||||
const clampedHeight = Math.max(120, Math.min(newHeight, window.innerHeight - 100));
|
||||
setBottomPanelHeight(clampedHeight);
|
||||
@@ -57,6 +59,7 @@ export function BottomPanelManager() {
|
||||
|
||||
const handleResizePointerUp = (e: React.PointerEvent<HTMLDivElement>) => {
|
||||
e.currentTarget.releasePointerCapture(e.pointerId);
|
||||
isDraggingRef.current = false;
|
||||
document.body.classList.remove("is-dragging-bottom-panel");
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user