Compare commits

..
Author SHA1 Message Date
Antigravity AI 11e7dce791 feat(cli): accept flags for non-interactive plugin scaffolding
The 'wwv create' command was fully interactive (prompts-only) and the
plugin-implementer agent's documented '--local' flag did not exist, so
agents fell back to slow manual scaffolding.

- Add a positional [pluginId] arg plus a flag for every prompt
  (--display-name, --description, --category, --architecture,
  --seeder-tier, --render-style) and a --yes guard that fails fast
  instead of hanging when a required value is missing. Any omitted
  flag still prompts, so interactive use is unchanged.
- Fix seeder output to the real community/private layout:
  local-seeders/<tier>/packages/<name>/{package.json,tsup.config.ts,
  src/index.ts}, exporting the canonical { name, cron, fn } shape with
  name === plugin id (kebab-case) per ADR-0002. Previously it wrote a
  bare seeder.mjs to the wrong path with an unusable context.emit stub.
- Update plugin-implementer.md: drop the bogus --local flag, document
  the flag-based invocation and the correct seeder location, and note
  the CLI build step for fresh worktrees.
- Bump CLI to 1.3.0 and fix the stale hardcoded --version string.
2026-05-29 19:17:08 +12:00
31 changed files with 127 additions and 2159 deletions

No files matched your search

+17 -42
View File
@@ -28,55 +28,32 @@ If any are missing, ask the user or tell them to run plugin-researcher first.
## Phase 2 — Scaffold
Always scaffold with the CLI, never by hand. From the project root (`C:\dev\wwv\worldwideview`).
**Step 1 — build the CLI if `dist/` is missing** (`dist` is gitignored, so fresh worktrees lack it):
From the project root (`C:\dev\wwv\worldwideview`):
```bash
pnpm --filter @worldwideview/wwv-cli build
```
**Step 2 — run `create` non-interactively.** The CLI accepts a flag for every prompt;
pass them all plus `--yes` so it never blocks on a prompt. Use the variant that matches
the architecture — `--seeder-tier` is **websocket-only** (passing it with `polling` does
nothing). Requires `@worldwideview/wwv-cli` **≥ 1.3.1** (earlier versions wrongly demanded
`--seeder-tier` for polling under `--yes`).
```bash
# Polling / static (frontend only — NO seeder, so NO --seeder-tier):
# Build the CLI first if dist/ is missing (dist is gitignored; fresh worktrees lack it):
# pnpm --filter @worldwideview/wwv-cli build
#
# The CLI accepts flags for every prompt. Pass them all + --yes for a fully
# non-interactive scaffold (omit any flag to be prompted for just that value):
node packages/wwv-cli/dist/index.js create <name> \
--display-name "<Display Name>" \
--description "<short description>" \
--category <aviation|maritime|space|weather|custom> \
--architecture polling \
--render-style <billboard|model|point> \
--yes
# Real-time / WebSocket (also scaffolds a backend seeder — REQUIRES --seeder-tier):
node packages/wwv-cli/dist/index.js create <name> \
--display-name "<Display Name>" \
--description "<short description>" \
--category <aviation|maritime|space|weather|custom> \
--architecture websocket \
--architecture <polling|websocket> \
--seeder-tier <community|private> \
--render-style <billboard|model|point> \
--yes
pnpm install
```
This creates `local-plugins/wwv-plugin-<name>/`. The `websocket` variant also creates the
seeder at `local-seeders/<tier>/packages/<name>/` in the correct community/private layout
(`package.json` + `tsup.config.ts` + `src/index.ts`, exporting `{ name, cron, fn }` with
`name` === the plugin id). Verify the expected directories exist before proceeding.
This creates `local-plugins/wwv-plugin-<name>/`. With `--architecture websocket` it also
creates the seeder at `local-seeders/<tier>/packages/<name>/` (correct community/private
layout: `package.json` + `tsup.config.ts` + `src/index.ts`). Verify both exist before proceeding.
> No post-CLI move is required — the CLI already targets `local-seeders/<tier>/packages/<name>/`.
> (Pre-1.3.0 CLI dropped a bare `seeder.mjs` at `local-seeders/<tier>/<name>/`; if you ever see
> that shape, the CLI is stale — rebuild it with the Step 1 command.)
>
> The CLI exits non-zero with a clear message on a bad `--category`/`--architecture`/etc., a
> missing required value under `--yes`, or an existing target directory. Treat a non-zero exit
> as a hard stop — fix the inputs and re-run; do not fall back to manual scaffolding.
> The CLI scaffolds the seeder into `local-seeders/<tier>/packages/<name>/` already —
> no post-CLI move is required. (Older CLI versions dropped a bare `seeder.mjs` at
> `local-seeders/<tier>/<name>/`; if you ever see that, the CLI is out of date — rebuild it.)
**NEVER:**
- Scaffold manually (always use the CLI)
@@ -157,15 +134,13 @@ export class MyPlugin implements WorldPlugin {
---
## Phase 4 — Implement the Seeder (skip for static / polling-only plugins)
## Phase 4 — Implement the Seeder (skip for static plugins)
Seeders live in `local-seeders/<tier>/` — **independent git repos** (`github.com/silvertakana/wwv-seeders` for community, `wwv-seeders-private` for private). Never commit seeder files to the worldwideview repo.
Seeders live in `local-seeders/community/` — **this is an independent git repo** (`github.com/silvertakana/wwv-seeders`). Never commit seeder files to the worldwideview repo.
If you scaffolded with `--architecture websocket`, **the CLI already created the seeder skeleton** at `local-seeders/<tier>/packages/<name>/` (`package.json` + `tsup.config.ts` + `src/index.ts` with a `{ name, cron, fn }` stub). Do **not** recreate those files — open the generated `src/index.ts` and replace the stub body with real fetch + map logic. The snippets below are the target shapes the CLI emits; use them to verify/adjust what was generated, not to create files from scratch.
### Create `local-seeders/community/packages/<name>/`
### Generated layout: `local-seeders/<tier>/packages/<name>/`
**`package.json`** (CLI-generated — only adjust `dependencies` for what your seeder imports):
**`package.json`:**
```json
{
"name": "@wwv-seeders/<name>",
-17
View File
@@ -72,23 +72,6 @@ mapWebsocketPayload(payload: any, existingEntities: GeoEntity[]): GeoEntity[]
- `existingEntities` — current entities in the store for this plugin (use for incremental updates)
- Must return a **complete replacement** `GeoEntity[]` (not a diff)
### Property Tag Helpers
Always wrap typed property values with the SDK helpers so the Intel panel renders them richly:
```ts
import { dtProp, urlProp, imageProp, videoProp } from "@worldwideview/wwv-plugin-sdk";
properties: {
updated: dtProp(item.updated_at ?? null), // renders as expandable datetime row
source: urlProp(item.source_url ?? null), // renders as clickable link
preview: imageProp(item.image ?? null), // renders as inline thumbnail
stream: videoProp(item.video_url ?? null), // renders as "Watch" link
}
```
All helpers are null-safe and return `null` for empty input. Plain string/number values that don't need rich rendering need no wrapper.
---
## Plugin Architectures (Manifest Formats)
+2 -155
View File
@@ -1,161 +1,8 @@
param([string]$worktreePath)
# git-wt (Worktrunk) pre-start hook.
# Per the per-worktree isolation model, each worktree gets its OWN real, isolated
# .planning directory -- NEVER a junction to the shared root. A shared junction caused
# GSD phase bleed across simultaneous worktree sessions. See worktree-bootstrap SKILL Step 5
# and C:\dev\wwv\.planning\WORKSPACE-OPTIMIZATION-BACKLOG.md.
#
# This hook is idempotent:
# - existing REAL .planning with a WORKSPACE.md -> left untouched (preserve phase history)
# - existing REAL .planning missing manifests -> manifests seeded, contents preserved
# - existing JUNCTION (old-model leftover) -> junction removed, real dir created
# - nothing there -> real isolated dir created
$ErrorActionPreference = 'Stop'
# Convert Unix-style path (/c/dev/...) to Windows path (C:\dev\...) if needed
if ($worktreePath -match '^/([a-zA-Z])/(.+)$') {
$worktreePath = $matches[1].ToUpper() + ':/' + $matches[2]
}
$sharedRoot = 'C:\dev\wwv\.planning'
$target = Join-Path $worktreePath '.planning'
# If a junction/symlink leftover from the old model exists, remove only the reparse
# point (never recurse into the shared root it points at).
if (Test-Path $target) {
$item = Get-Item -LiteralPath $target -Force
$isReparse = ($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -eq [IO.FileAttributes]::ReparsePoint
if ($isReparse) {
[System.IO.Directory]::Delete($target, $false)
} elseif (Test-Path (Join-Path $target 'WORKSPACE.md')) {
# Already a fully set-up real isolated dir -- preserve it, do nothing.
exit 0
}
}
# Resolve the branch name (fall back to the worktree folder leaf).
$branch = $null
try { $branch = (& git -C $worktreePath rev-parse --abbrev-ref HEAD 2>$null) } catch {}
if (-not $branch) { $branch = Split-Path $worktreePath -Leaf }
$branch = $branch.Trim()
$date = (Get-Date).ToString('yyyy-MM-dd')
$isoDate = (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ss.000Z')
# Create the isolated structure.
foreach ($d in @('phases', 'debug', 'surveys')) {
New-Item -ItemType Directory -Force -Path (Join-Path $target $d) | Out-Null
}
# Copy the GSD config from the shared root if present.
$sharedConfig = Join-Path $sharedRoot 'config.json'
$localConfig = Join-Path $target 'config.json'
if ((Test-Path $sharedConfig) -and -not (Test-Path $localConfig)) {
Copy-Item $sharedConfig $localConfig -Force
}
# Seed the three manifest files (only if missing -- never overwrite existing).
$workspaceFile = Join-Path $target 'WORKSPACE.md'
if (-not (Test-Path $workspaceFile)) {
$workspace = @"
# Workspace: $branch
Created: $date
Strategy: worktree (git-wt)
Branch: $branch
Repo: $worktreePath
## Isolation
This ``.planning`` is a REAL, isolated directory (not a junction to the shared root).
Phases and STATE.md here are private to this worktree. Changes do NOT bleed into
other worktrees or the shared root. Created automatically by the git-wt pre-start
hook (link-planning.ps1), per the per-worktree isolation model.
## Member Repos
| Repo | Source | Branch | Strategy |
|------|--------|--------|----------|
| worldwideview | C:\dev\wwv\worldwideview | $branch | worktree |
## Notes
Cross-feature docs are NOT duplicated here. See SHARED-DOCS.md.
"@
Set-Content -LiteralPath $workspaceFile -Value $workspace -Encoding UTF8
}
$stateFile = Join-Path $target 'STATE.md'
if (-not (Test-Path $stateFile)) {
$state = @"
---
gsd_state_version: 1.0
milestone: none
milestone_name: $branch
status: idle
last_updated: "$isoDate"
last_activity: $date -- isolated .planning created (git-wt pre-start hook)
progress:
total_phases: 0
completed_phases: 0
total_plans: 0
completed_plans: 0
percent: 0
---
# Project State
## Project Reference
This is an ISOLATED worktree workspace. Its planning state is private to the
``$branch`` worktree and intentionally distinct from the shared root
(C:\dev\wwv\.planning).
Cross-feature docs (ROADMAP, MILESTONES, research) are NOT duplicated here.
See SHARED-DOCS.md for how to reach them.
## Current Position
No active milestone. Workspace is idle.
"@
Set-Content -LiteralPath $stateFile -Value $state -Encoding UTF8
}
$sharedDocsFile = Join-Path $target 'SHARED-DOCS.md'
if (-not (Test-Path $sharedDocsFile)) {
$sharedDocs = @"
# Shared Cross-Feature Docs
This worktree's ``.planning`` is isolated (phases + STATE are private). But some
documents are cross-feature and must stay authoritative in ONE place rather than
being copied per worktree (copies drift out of sync).
## Where they live
Shared root: ``C:\dev\wwv\.planning``
| Doc | Purpose |
|-----|---------|
| ROADMAP.md | Cross-milestone roadmap |
| MILESTONES.md | Milestone definitions and ship status |
| research/ | ARCHITECTURE / FEATURES / PITFALLS / STACK |
| PROJECT.md | Project identity |
| REQUIREMENTS.md | Cross-cutting requirements |
## How to reach them
A ``WWV_SHARED_PLANNING`` env var in each worktree's ``.env.local`` points at the
shared root, and GSD skills that need a cross-feature doc read
``\$WWV_SHARED_PLANNING/<doc>`` instead of the local ``.planning/<doc>``.
Do NOT copy these docs into this worktree. Single source of truth lives at the
shared root.
"@
Set-Content -LiteralPath $sharedDocsFile -Value $sharedDocs -Encoding UTF8
}
# Always report success: the internal git probe above may set a non-zero $LASTEXITCODE,
# which would otherwise be propagated as this hook's exit code and read as a failure.
exit 0
if (Test-Path $target) { Remove-Item $target -Force }
New-Item -ItemType Junction -Path $target -Target 'C:\dev\wwv\.planning' | Out-Null
+1 -23
View File
@@ -1,29 +1,7 @@
param([string]$worktreePath)
# git-wt (Worktrunk) pre-remove hook.
# Per the per-worktree isolation model, a worktree's .planning is a REAL isolated
# directory (its phase history is archived by /branch-cleanup before removal, and the
# directory itself is deleted along with the worktree by `git-wt remove`).
#
# This hook therefore ONLY cleans up a leftover JUNCTION from the old shared-link model.
# It must NEVER recursively delete a real .planning directory -- doing so would destroy
# phase history that /branch-cleanup is responsible for archiving.
# Convert Unix-style path (/c/dev/...) to Windows path (C:\dev\...) if needed
if ($worktreePath -match '^/([a-zA-Z])/(.+)$') {
$worktreePath = $matches[1].ToUpper() + ':/' + $matches[2]
}
$target = Join-Path $worktreePath '.planning'
if (Test-Path $target) {
$item = Get-Item -LiteralPath $target -Force
$isReparse = ($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -eq [IO.FileAttributes]::ReparsePoint
if ($isReparse) {
# Old-model junction: remove only the reparse point (do not follow into the target).
[System.IO.Directory]::Delete($target, $false)
}
# Real directory: leave it. git-wt remove deletes the worktree (and this dir) anyway;
# /branch-cleanup is responsible for archiving its phase history first.
}
exit 0
if (Test-Path $target) { Remove-Item $target -Force }
@@ -202,40 +202,7 @@ import { Plane } from "lucide-react";
const iconUrl = createSvgIconUrl(Plane, { color: "#3b82f6" });
```
### 1.5 Property Tag Helpers
Use these SDK helpers to wrap property values so the Intel panel renders them richly. Without the tag prefix, the panel falls back to plain text.
```ts
import { dtProp, urlProp, imageProp, videoProp } from "@worldwideview/wwv-plugin-sdk";
```
| Helper | Tag format stored | Panel renders as |
|---|---|---|
| `dtProp(iso)` | `"datetime:2026-06-01T05:00:00Z"` | Expandable row: local time (collapsed), UTC + relative (expanded) |
| `urlProp(href)` | `"url:https://..."` | Clickable link with external icon |
| `imageProp(src)` | `"image:https://..."` | Inline thumbnail |
| `videoProp(href)` | `"video:https://..."` | "Watch" link with play icon |
All four helpers return `null` for empty, `null`, or `undefined` input — safe to call unconditionally.
**Usage pattern:**
```ts
properties: {
// dates — pass ISO 8601 strings
updated_at: dtProp(item.updated_at ?? null),
// URLs
source_url: urlProp(item.url ?? null),
// images and video
preview: imageProp(item.image_url ?? null),
stream: videoProp(item.video_url ?? null),
// plain values — no helper needed
name: item.name,
count: item.count,
}
```
### 1.6 Registration (3 Paths)
### 1.5 Registration (3 Paths)
**A. Built-in (monorepo package):**
@@ -257,7 +224,7 @@ await pluginManager.registerPlugin(plugin);
**C. Dynamic import (runtime):**
For user-imported GeoJSON layers, call `pluginManager.loadFromManifest(manifest)` directly.
### 1.7 Build Configuration (Core Monorepo Packages Only)
### 1.6 Build Configuration (Core Monorepo Packages Only)
If you decide to manually move a plugin from the local sandbox into the core `packages/` directory, you must manually add it to the build pipeline:
@@ -685,10 +652,6 @@ Categories are **lowercase**: `"aviation"` not `"Aviation"`, `"natural-disaster"
- [ ] **Frontend:** Added path alias in `tsconfig.json`
- [ ] **Frontend:** Registered via `pluginRegistry` + `pluginManager` in `AppShell.tsx`
- [ ] **Frontend:** `renderEntity()` doesn't mix point/billboard properties
- [ ] **Frontend:** Date/time fields wrapped with `dtProp()`
- [ ] **Frontend:** External links wrapped with `urlProp()`
- [ ] **Frontend:** Image URLs wrapped with `imageProp()`
- [ ] **Frontend:** Video/stream URLs wrapped with `videoProp()`
- [ ] **Engine:** Seeder file in `wwv-seeders/src/seeders/<name>.ts` (or private repo)
- [ ] **Engine:** `registerSeeder({ name })` matches frontend plugin `id`
- [ ] **Engine:** Calls `setLiveSnapshot()` with correct plugin ID key
-16
View File
@@ -1,26 +1,10 @@
name: CI
# CLI-only changes are covered by cli.yml; skip the full app suite for them.
# Docs/agent-rules/issue-template changes also skip the suite.
on:
push:
branches: [main]
paths-ignore:
- "packages/wwv-cli/**"
- ".agents/**"
- "**/*.md"
- ".github/ISSUE_TEMPLATE/**"
- ".github/PULL_REQUEST_TEMPLATE.md"
- ".github/gc/**"
pull_request:
branches: [main]
paths-ignore:
- "packages/wwv-cli/**"
- ".agents/**"
- "**/*.md"
- ".github/ISSUE_TEMPLATE/**"
- ".github/PULL_REQUEST_TEMPLATE.md"
- ".github/gc/**"
jobs:
# Non-blocking dependency audit. Surfaces high / critical vulnerabilities
-36
View File
@@ -1,36 +0,0 @@
name: CLI
# Scoped to the plugin CLI package only. Heavy app workflows (ci.yml,
# playwright.yml, docker-publish.yml, ...) exclude this path, so a CLI-only
# change runs just this fast build + test instead of the full suite.
on:
push:
branches: [main]
paths:
- "packages/wwv-cli/**"
- ".github/workflows/cli.yml"
pull_request:
branches: [main]
paths:
- "packages/wwv-cli/**"
- ".github/workflows/cli.yml"
permissions:
contents: read
jobs:
build-and-test:
name: Build & Test CLI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
# `build` runs tsc — this also type-checks the CLI source.
- run: pnpm --filter @worldwideview/wwv-cli build
# Integration tests spawn the built CLI and assert the scaffolded tree.
- run: pnpm --filter @worldwideview/wwv-cli test
-23
View File
@@ -1,33 +1,10 @@
name: Docker Image CI
# Only rebuild the image when files that affect the final container change.
# Doc/agent-rules/test-only changes skip the expensive multi-stage build.
# Skipped workflow runs satisfy GitHub required status checks (neutral pass).
on:
push:
branches: [ "main" ]
paths:
- "src/**"
- "prisma/**"
- "packages/**"
- "scripts/**"
- "Dockerfile"
- "package.json"
- "pnpm-lock.yaml"
- "next.config.ts"
- ".github/workflows/docker-publish.yml"
pull_request:
branches: [ "main" ]
paths:
- "src/**"
- "prisma/**"
- "packages/**"
- "scripts/**"
- "Dockerfile"
- "package.json"
- "pnpm-lock.yaml"
- "next.config.ts"
- ".github/workflows/docker-publish.yml"
env:
REGISTRY: ghcr.io
-23
View File
@@ -1,32 +1,9 @@
name: Playwright Tests
# Only run E2E tests when application code actually changes.
# Doc/agent-rules/config-only changes skip the full 3-browser matrix.
# Skipped workflow runs satisfy GitHub required status checks (neutral pass).
on:
push:
branches: [ main, master ]
paths:
- "src/**"
- "tests/**"
- "prisma/**"
- "public/**"
- "package.json"
- "pnpm-lock.yaml"
- "next.config.ts"
- "playwright.config.ts"
- ".github/workflows/playwright.yml"
pull_request:
branches: [ main, master ]
paths:
- "src/**"
- "tests/**"
- "prisma/**"
- "public/**"
- "package.json"
- "pnpm-lock.yaml"
- "next.config.ts"
- "playwright.config.ts"
- ".github/workflows/playwright.yml"
permissions:
contents: read
jobs:
-2
View File
@@ -3,8 +3,6 @@ name: Test Local Dev Environment
on:
push:
branches: [main]
paths-ignore:
- "packages/wwv-cli/**"
pull_request:
branches: [main]
paths:
-5
View File
@@ -1,15 +1,10 @@
name: Test Setup Scripts
# CLI-only changes are covered by cli.yml; skip setup-script tests for them.
on:
push:
branches: [ "main" ]
paths-ignore:
- "packages/wwv-cli/**"
pull_request:
branches: [ "main" ]
paths-ignore:
- "packages/wwv-cli/**"
permissions:
contents: read
+2 -1
View File
@@ -1,6 +1,6 @@
{
"name": "worldwideview",
"version": "2.25.3",
"version": "2.24.5",
"private": true,
"type": "module",
"packageManager": "[email protected]",
@@ -120,3 +120,4 @@
"pnpm": ">=9.0.0"
}
}
+2 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@worldwideview/wwv-cli",
"version": "1.3.1",
"version": "1.3.0",
"type": "module",
"description": "WorldWideView CLI",
"main": "dist/index.js",
@@ -10,8 +10,7 @@
"scripts": {
"build": "tsc",
"dev": "tsc --watch",
"clean": "rm -rf dist",
"test": "node --test \"test/**/*.test.mjs\""
"clean": "rm -rf dist"
},
"dependencies": {
"commander": "^14.0.3",
+3 -10
View File
@@ -124,16 +124,9 @@ export const createCommand = new Command('create')
}
if (options.yes && promptList.length > 0) {
// Only count prompts that would actually fire. seederTier is irrelevant
// unless the resolved architecture is websocket, so a polling plugin with
// --yes must not be forced to supply it.
const missing = promptList
.map(p => p.name as string)
.filter(name => (name === 'seederTier' ? options.architecture === 'websocket' : true));
if (missing.length > 0) {
console.error(`Error: --yes given but these required values are missing: ${missing.join(', ')}`);
process.exit(1);
}
const missing = promptList.map(p => p.name).join(', ');
console.error(`Error: --yes given but these required values are missing: ${missing}`);
process.exit(1);
}
const answers = promptList.length > 0 ? await prompts(promptList) : {};
+1 -1
View File
@@ -9,7 +9,7 @@ const program = new Command();
program
.name('wwv')
.description('WorldWideView Plugin CLI')
.version('1.3.1');
.version('1.3.0');
program.addCommand(createCommand);
program.addCommand(publishCommand);
-219
View File
@@ -1,219 +0,0 @@
// Integration tests for `wwv create`.
//
// These spawn the *built* CLI (dist/index.js) into a throwaway temp directory
// and assert the generated file tree. No mocking — this is the real scaffold
// path agents and humans use. Run with: `node --test test/` (the CLI must be
// built first; the cli.yml workflow runs `pnpm build` before this).
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { spawnSync } from 'node:child_process';
import { mkdtempSync, readFileSync, existsSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
const CLI = resolve(import.meta.dirname, '..', 'dist', 'index.js');
function freshDir() {
return mkdtempSync(join(tmpdir(), 'wwv-cli-test-'));
}
function runCreate(cwd, args) {
const res = spawnSync(process.execPath, [CLI, 'create', ...args], {
cwd,
encoding: 'utf8',
// Empty stdin so a stray prompt (a bug) fails fast instead of hanging CI.
input: '',
});
return { status: res.status, stdout: res.stdout ?? '', stderr: res.stderr ?? '' };
}
function readPkg(dir, ...segments) {
return JSON.parse(readFileSync(join(dir, ...segments), 'utf8'));
}
function readText(dir, ...segments) {
return readFileSync(join(dir, ...segments), 'utf8');
}
// --- Happy-path plugin types -------------------------------------------------
test('polling plugin: frontend only, no seeder, no streamUrl, has fetch()', () => {
const dir = freshDir();
try {
const r = runCreate(dir, [
'poll-test', '-n', 'Poll Test', '-d', 'A polling plugin',
'--category', 'custom', '--architecture', 'polling', '--render-style', 'point', '--yes',
]);
assert.equal(r.status, 0, r.stderr);
const pkg = readPkg(dir, 'local-plugins', 'wwv-plugin-poll-test', 'package.json');
assert.equal(pkg.name, '@worldwideview/wwv-plugin-poll-test');
assert.equal(pkg.worldwideview.pluginId, 'poll-test');
assert.equal(pkg.worldwideview.category, 'custom');
assert.equal(pkg.worldwideview.streamUrl, undefined, 'polling plugin must not declare streamUrl');
const idx = readText(dir, 'local-plugins', 'wwv-plugin-poll-test', 'src', 'index.ts');
assert.match(idx, /id = 'poll-test'/);
assert.match(idx, /getPollingInterval\(\): number \{\s*return 10000/);
assert.match(idx, /async fetch\(/);
assert.match(idx, /type: 'point'/);
assert.ok(!existsSync(join(dir, 'local-seeders')), 'polling plugin must not scaffold a seeder');
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
test('websocket + community + billboard: seeder under community/packages, streamUrl, Plane icon', () => {
const dir = freshDir();
try {
const r = runCreate(dir, [
'ws-comm', '-n', 'WS Comm', '-d', 'desc',
'--category', 'aviation', '--architecture', 'websocket', '--seeder-tier', 'community',
'--render-style', 'billboard', '--yes',
]);
assert.equal(r.status, 0, r.stderr);
const pkg = readPkg(dir, 'local-plugins', 'wwv-plugin-ws-comm', 'package.json');
assert.equal(pkg.worldwideview.icon, 'Plane');
assert.ok(pkg.worldwideview.streamUrl, 'websocket plugin must declare a streamUrl');
const seederBase = join(dir, 'local-seeders', 'community', 'packages', 'ws-comm');
assert.ok(existsSync(join(seederBase, 'package.json')), 'seeder package.json missing');
assert.ok(existsSync(join(seederBase, 'tsup.config.ts')), 'seeder tsup.config.ts missing');
const seederPkg = readPkg(dir, 'local-seeders', 'community', 'packages', 'ws-comm', 'package.json');
assert.equal(seederPkg.name, '@wwv-seeders/ws-comm');
assert.equal(seederPkg.main, 'dist/index.mjs');
const seederIdx = readText(dir, 'local-seeders', 'community', 'packages', 'ws-comm', 'src', 'index.ts');
assert.match(seederIdx, /name: 'ws-comm'/, "seeder name must equal the plugin id (ADR-0002)");
assert.match(seederIdx, /cron:/);
const idx = readText(dir, 'local-plugins', 'wwv-plugin-ws-comm', 'src', 'index.ts');
assert.match(idx, /getPollingInterval\(\): number \{\s*return 0;/);
assert.match(idx, /type: 'billboard'/);
assert.doesNotMatch(idx, /async fetch\(/, 'websocket plugin should not generate a fetch() stub');
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
test('websocket + private + model: seeder under private/packages, Satellite icon, model render', () => {
const dir = freshDir();
try {
const r = runCreate(dir, [
'ws-priv', '-n', 'WS Priv', '-d', 'desc',
'--category', 'space', '--architecture', 'websocket', '--seeder-tier', 'private',
'--render-style', 'model', '--yes',
]);
assert.equal(r.status, 0, r.stderr);
assert.ok(
existsSync(join(dir, 'local-seeders', 'private', 'packages', 'ws-priv', 'src', 'index.ts')),
'private seeder must land under local-seeders/private/packages/',
);
const pkg = readPkg(dir, 'local-plugins', 'wwv-plugin-ws-priv', 'package.json');
assert.equal(pkg.worldwideview.icon, 'Satellite');
const idx = readText(dir, 'local-plugins', 'wwv-plugin-ws-priv', 'src', 'index.ts');
assert.match(idx, /modelUrl/, 'model render style should reference modelUrl');
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
test('--core flag scaffolds into packages/ instead of local-plugins/', () => {
const dir = freshDir();
try {
const r = runCreate(dir, [
'core-test', '--core', '-n', 'Core', '-d', 'desc',
'--category', 'custom', '--architecture', 'polling', '--render-style', 'point', '--yes',
]);
assert.equal(r.status, 0, r.stderr);
assert.ok(existsSync(join(dir, 'packages', 'wwv-plugin-core-test', 'package.json')));
assert.ok(!existsSync(join(dir, 'local-plugins', 'wwv-plugin-core-test')));
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
test('multi-word id: kebab id preserved, class and seeder fn names strip dashes', () => {
const dir = freshDir();
try {
const r = runCreate(dir, [
'multi-word-plugin', '-n', 'Multi Word', '-d', 'desc',
'--category', 'custom', '--architecture', 'websocket', '--seeder-tier', 'community',
'--render-style', 'point', '--yes',
]);
assert.equal(r.status, 0, r.stderr);
const idx = readText(dir, 'local-plugins', 'wwv-plugin-multi-word-plugin', 'src', 'index.ts');
assert.match(idx, /class multiwordpluginPlugin/);
assert.match(idx, /id = 'multi-word-plugin'/);
const seederIdx = readText(dir, 'local-seeders', 'community', 'packages', 'multi-word-plugin', 'src', 'index.ts');
assert.match(seederIdx, /name: 'multi-word-plugin'/);
assert.match(seederIdx, /function seedmultiwordplugin\(/);
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
test('category icon mapping: maritime -> Ship, weather -> Cloud', () => {
const dir = freshDir();
try {
const base = ['-d', 'desc', '--architecture', 'polling', '--render-style', 'point', '--yes'];
assert.equal(runCreate(dir, ['sea', '-n', 'Sea', '--category', 'maritime', ...base]).status, 0);
assert.equal(runCreate(dir, ['sky', '-n', 'Sky', '--category', 'weather', ...base]).status, 0);
assert.equal(readPkg(dir, 'local-plugins', 'wwv-plugin-sea', 'package.json').worldwideview.icon, 'Ship');
assert.equal(readPkg(dir, 'local-plugins', 'wwv-plugin-sky', 'package.json').worldwideview.icon, 'Cloud');
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
// --- Failure / guard cases ---------------------------------------------------
test('--yes with a missing required value exits non-zero and creates nothing', () => {
const dir = freshDir();
try {
const r = runCreate(dir, ['fail-test', '--architecture', 'websocket', '--yes']);
assert.notEqual(r.status, 0, 'should fail when required values are missing');
assert.match(r.stderr, /missing/i);
assert.ok(!existsSync(join(dir, 'local-plugins', 'wwv-plugin-fail-test')), 'must not create a partial scaffold');
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
test('invalid --category exits non-zero with a clear message', () => {
const dir = freshDir();
try {
const r = runCreate(dir, [
'bad-cat', '-n', 'x', '-d', 'y', '--category', 'nonsense',
'--architecture', 'polling', '--render-style', 'point', '--yes',
]);
assert.notEqual(r.status, 0);
assert.match(r.stderr, /invalid --category/i);
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
test('creating into an existing plugin directory exits non-zero', () => {
const dir = freshDir();
try {
const args = [
'dup-test', '-n', 'x', '-d', 'y', '--category', 'custom',
'--architecture', 'polling', '--render-style', 'point', '--yes',
];
assert.equal(runCreate(dir, args).status, 0);
const second = runCreate(dir, args);
assert.notEqual(second.status, 0);
assert.match(second.stderr, /already exists/i);
} finally {
rmSync(dir, { recursive: true, force: true });
}
});
-32
View File
@@ -52,38 +52,6 @@ export class MyPlugin implements WorldPlugin {
}
```
## Property Tag Helpers
Wrap entity property values with these helpers so the WorldWideView Intel panel renders them as rich UI elements instead of plain text.
```ts
import { dtProp, urlProp, imageProp, videoProp } from "@worldwideview/wwv-plugin-sdk";
```
| Helper | Wraps | Panel renders as |
|---|---|---|
| `dtProp(iso: string \| null)` | ISO 8601 date string | Expandable datetime row — local time collapsed, UTC + relative time expanded |
| `urlProp(href: string \| null)` | Any URL | Clickable link with external-link icon |
| `imageProp(src: string \| null)` | Image URL | Inline thumbnail |
| `videoProp(href: string \| null)` | Video/stream URL | "Watch" link with play icon |
All helpers are **null-safe**: passing `null`, `undefined`, or `""` returns `null`, which the panel skips cleanly.
```ts
// In your entity mapper:
properties: {
last_seen: dtProp(item.timestamp ?? null),
source_url: urlProp(item.url ?? null),
preview: imageProp(item.image_url ?? null),
live_stream: videoProp(item.stream ?? null),
// Plain values need no wrapper
name: item.name,
severity: item.severity,
}
```
Values without a tag prefix fall back to plain-text rendering, so existing plugins continue to work unchanged.
## Changelog
- **v1.0.3** — Added README with core interfaces and usage docs.
-42
View File
@@ -313,45 +313,3 @@ export * from "./viteGlobals";
// ─── Auth Contracts ──────────────────────────────────────────
export * from "./auth-contracts";
// ─── Tagged Property Helpers ─────────────────────────────────
/**
* Wraps an ISO 8601 date string for rich rendering in the Intel panel.
* The panel displays local time (collapsed) and UTC + relative time (expanded).
* @param iso - ISO 8601 string (e.g. "2026-06-01T05:00:00Z"), or null/undefined
* @returns Tagged string `"datetime:{iso}"`, or `null` if input is empty
*/
export function dtProp(iso: string | undefined | null): string | null {
if (!iso) return null;
return `datetime:${iso}`;
}
/**
* Wraps a URL for rich rendering in the Intel panel as a clickable external link.
* @param href - Any URL string, or null/undefined
* @returns Tagged string `"url:{href}"`, or `null` if input is empty
*/
export function urlProp(href: string | undefined | null): string | null {
if (!href) return null;
return `url:${href}`;
}
/**
* Wraps an image URL for rich rendering in the Intel panel as an inline thumbnail.
* @param src - Image URL string, or null/undefined
* @returns Tagged string `"image:{src}"`, or `null` if input is empty
*/
export function imageProp(src: string | undefined | null): string | null {
if (!src) return null;
return `image:${src}`;
}
/**
* Wraps a video or stream URL for rich rendering in the Intel panel as a "Watch" link.
* @param href - Video or stream URL string, or null/undefined
* @returns Tagged string `"video:{href}"`, or `null` if input is empty
*/
export function videoProp(href: string | undefined | null): string | null {
if (!href) return null;
return `video:${href}`;
}
-1149
View File
File diff suppressed because it is too large. Load diff
+2 -3
View File
@@ -38,9 +38,8 @@ export function PluginIcon({ icon, size = 18, color }: PluginIconProps) {
if (typeof icon === "string") {
const Resolved = icons[icon as keyof typeof icons] as LucideIcon | undefined;
if (Resolved) return <Resolved size={size} color={color} />;
// Emoji: render as text. Unresolved ASCII icon name: render fallback so stale names don't leak as text.
if (/[^\x00-\x7F]/.test(icon)) return <span>{icon}</span>;
return <FallbackIcon size={size} />;
// Treat as emoji or text fallback
return <span>{icon}</span>;
}
const IconComponent = icon;
+11 -2
View File
@@ -36,7 +36,6 @@ import { FeedbackDialog } from "@/components/common/FeedbackDialog";
import { isDemo } from "@/core/edition";
import { injectHostGlobals } from "@/core/plugins/hostGlobals";
import { getDisabledPluginIds } from "@/core/plugins/pluginPreferences";
import { initLogCatcher } from "@/lib/logCatcher";
import { MobileCameraStats } from "./MobileCameraStats";
import { MobileHudBar } from "./MobileHudBar";
@@ -89,7 +88,17 @@ export function AppShell() {
await injectHostGlobals();
setHostReady(true);
const disabledIds = getDisabledPluginIds();
// Fetch disabled built-in plugins before registration
let disabledIds = new Set<string>();
try {
const res = await fetch("/api/marketplace/disabled-builtins");
if (res.ok) {
const data = await res.json();
disabledIds = new Set<string>(data.disabledIds ?? []);
}
} catch {
// Non-critical — load all built-ins if endpoint fails
}
// Setup demo defaults
const demoDefaultPlugins = new Set<string>();
-13
View File
@@ -74,19 +74,6 @@
margin-top: 3px;
}
/* ─── Local Icon ─────────────────────────────────── */
.layer-item__local-icon-wrapper {
position: relative;
display: inline-flex;
align-items: center;
}
.layer-item__local-icon {
color: var(--accent-cyan);
flex-shrink: 0;
cursor: help;
}
/* ─── Unverified Icon ────────────────────────────── */
.layer-item__unverified-icon-wrapper {
position: relative;
+22 -37
View File
@@ -7,7 +7,7 @@
* @module src/components/panels
*/
import { ShieldAlert, Wrench } from "lucide-react";
import { ShieldAlert } from "lucide-react";
import { PluginIcon } from "@/components/common/PluginIcon";
import { Tooltip } from "@/components/ui/Tooltip";
import { pluginManager } from "@/core/plugins/PluginManager";
@@ -27,46 +27,29 @@ const CATEGORY_LABELS: Record<string, string> = {
custom: "Custom",
};
// ─── Source / Trust Helpers ─────────────────────────────────
// ─── Trust Helpers ──────────────────────────────────────────
function isLocalPlugin(pluginId: string): boolean {
type TrustTier = "built-in" | "verified" | "unverified";
function getTrust(pluginId: string): TrustTier {
const manifest = pluginManager.getManifest(pluginId);
if (!manifest) return true;
const entry = manifest.entry ?? "";
return entry.startsWith("/plugins-local/") || entry.startsWith("http://localhost") || entry.startsWith("http://127.0.0.1");
return manifest?.trust ?? "unverified";
}
function TrustIcon({ pluginId, pluginName }: { pluginId: string; pluginName: string }) {
if (isLocalPlugin(pluginId)) {
return (
<Tooltip content={`Local plugin: ${pluginName}`}>
<span className="layer-item__local-icon-wrapper">
<Wrench
size={11}
className="layer-item__local-icon"
aria-label="Local plugin"
/>
</span>
</Tooltip>
);
}
function TrustIcon({ trust }: { trust: TrustTier }) {
if (trust !== "unverified") return null;
const manifest = pluginManager.getManifest(pluginId);
if (manifest?.trust === "unverified") {
return (
<Tooltip content="Unverified plugin, use at your own risk">
<span className="layer-item__unverified-icon-wrapper">
<ShieldAlert
size={12}
className="layer-item__unverified-icon"
aria-label="Unverified plugin"
/>
</span>
</Tooltip>
);
}
return null;
return (
<Tooltip content="Unverified plugin, use at your own risk">
<span className="layer-item__unverified-icon-wrapper">
<ShieldAlert
size={12}
className="layer-item__unverified-icon"
aria-label="Unverified plugin"
/>
</span>
</Tooltip>
);
}
// ─── LayerItem Component ────────────────────────────────────
@@ -105,6 +88,8 @@ export function LayerItem({
onToggle,
onSelect,
}: LayerItemProps) {
const trust = getTrust(plugin.id);
return (
<div
className={`layer-item ${isSelected ? "layer-item--selected" : ""}`}
@@ -117,7 +102,7 @@ export function LayerItem({
<div className="layer-item__info">
<div className="layer-item__header">
<span className="layer-item__name">{plugin.name}</span>
<TrustIcon pluginId={plugin.id} pluginName={plugin.name} />
<TrustIcon trust={trust} />
</div>
<div className="layer-item__desc">{plugin.description}</div>
<div className="layer-item__footer">
+3 -3
View File
@@ -69,7 +69,6 @@
.plugin-item__header {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 1px;
}
@@ -78,7 +77,9 @@
font-size: 13px;
font-weight: 500;
color: var(--text-primary);
word-break: break-word;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.plugin-item__version {
@@ -183,7 +184,6 @@
text-decoration: none;
font-size: 13px;
font-weight: 500;
text-align: center;
cursor: pointer;
transition: all var(--duration-normal) var(--ease-spring);
flex-shrink: 0%;
+34 -65
View File
@@ -11,16 +11,12 @@
import { useState, useEffect, useCallback } from "react";
import {
Trash2, ExternalLink, RefreshCw, Download, PowerOff, Power,
ShieldCheck, ShieldAlert, HardDrive
ShieldCheck, ShieldAlert, Shield
} from "lucide-react";
import { PluginIcon } from "@/components/common/PluginIcon";
import type { ComponentType } from "react";
import { pluginManager } from "@/core/plugins/PluginManager";
import { useStore } from "@/core/state/store";
import { getDisabledPluginIds, setPluginDisabled } from "@/core/plugins/pluginPreferences";
import { trackEvent } from "@/lib/analytics";
import { isPluginInstallEnabled } from "@/core/edition";
import type { PluginManifest } from "@/core/plugins/PluginManifest";
import "./PluginsTab.css";
// ─── Types ──────────────────────────────────────────────────
@@ -39,9 +35,9 @@ function TrustBadge({ trust }: { trust: string }) {
if (trust === "built-in") {
return (
<span className="trust-badge trust-badge--builtin">
<HardDrive size={9} />
<Shield size={9} />
{' '}
Local
Built-in
</span>
);
}
@@ -100,9 +96,13 @@ function getTrust(record: PluginRecord): string {
}
}
function getIcon(record: PluginRecord): string | ComponentType<{ size?: number; color?: string }> {
function getIcon(record: PluginRecord): string {
const managed = pluginManager.getPlugin(record.pluginId);
if (managed) return managed.plugin.icon ?? "📦";
if (managed) {
return typeof managed.plugin.icon === "string"
? managed.plugin.icon
: "📦";
}
try {
return JSON.parse(record.config).icon ?? "📦";
} catch {
@@ -120,11 +120,6 @@ function getName(record: PluginRecord): string {
}
}
function getVersion(record: PluginRecord): string {
if (record.version !== "built-in") return record.version;
return pluginManager.getManifest(record.pluginId)?.version ?? "";
}
// ─── PluginsTab ─────────────────────────────────────────────
/**
@@ -150,8 +145,7 @@ export function PluginsTab() {
const dbPlugins: PluginRecord[] = data.plugins ?? [];
const dbPluginMap = new Map(dbPlugins.map((p) => [p.pluginId, p]));
// Add built-in and local plugins that don't have a DB record yet
const disabledIds = getDisabledPluginIds();
// Add built-in and local plugins that don't have a DB record yet (enabled by default)
const allManaged = pluginManager.getAllPlugins();
for (const managed of allManaged) {
if (!dbPluginMap.has(managed.plugin.id)) {
@@ -160,16 +154,11 @@ export function PluginsTab() {
version: "built-in",
config: "{}",
installedAt: new Date().toISOString(),
enabled: !disabledIds.has(managed.plugin.id)
enabled: true
});
}
}
// Apply localStorage disabled state to all records
dbPlugins.forEach((p) => {
if (disabledIds.has(p.pluginId)) p.enabled = false;
});
setPlugins(dbPlugins);
if (typeof data.canManagePlugins === "boolean") {
setCanInstall(data.canManagePlugins);
@@ -203,48 +192,32 @@ export function PluginsTab() {
const handleDisable = async (pluginId: string) => {
setRemoving(pluginId);
setPluginDisabled(pluginId, true);
pluginManager.disablePlugin(pluginId);
const state = useStore.getState();
state.setLayerEnabled(pluginId, false);
state.clearEntities(pluginId);
state.setEntityCount(pluginId, 0);
if (state.hoveredEntity?.pluginId === pluginId) state.setHoveredEntity(null, null);
if (state.selectedEntity?.pluginId === pluginId) state.setSelectedEntity(null);
setNeedsReload(true);
trackEvent("plugin-disable", { plugin: pluginId });
await loadPlugins();
setRemoving(null);
try {
await fetch("/api/marketplace/disable", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ pluginId }),
});
trackEvent("plugin-disable", { plugin: pluginId });
setNeedsReload(true);
} catch {
setRemoving(null);
}
};
const handleEnable = async (pluginId: string) => {
setRemoving(pluginId);
setPluginDisabled(pluginId, false);
setNeedsReload(false);
const alreadyRegistered = pluginManager.getPlugin(pluginId);
if (!alreadyRegistered) {
// Plugin was disabled at startup — its script was never loaded.
// Hot-load the script so it's available; leave the layer toggle off.
try {
const res = await fetch("/api/marketplace/load");
if (res.ok) {
const { manifests } = await res.json() as { manifests: PluginManifest[] };
const manifest = manifests.find((m) => m.id === pluginId);
if (manifest) {
await pluginManager.loadFromManifest(manifest);
useStore.getState().initLayer(pluginId, false);
}
}
} catch (err) {
console.error("[PluginsTab] Failed to hot-load plugin:", pluginId, err);
}
try {
await fetch("/api/marketplace/enable", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ pluginId }),
});
trackEvent("plugin-enable", { plugin: pluginId });
setNeedsReload(true);
} catch {
setRemoving(null);
}
// Layer stays off — user controls it via the Data Layers toggle.
trackEvent("plugin-enable", { plugin: pluginId });
await loadPlugins();
setRemoving(null);
};
const handleCheckUpdates = async () => {
@@ -379,12 +352,10 @@ export function PluginsTab() {
<span className="plugin-item__name">
{getName(record)}
</span>
{getVersion(record) && (
<span className="plugin-item__version">
v
{getVersion(record)}
{record.version}
</span>
)}
</div>
<div className="plugin-item__meta">
<TrustBadge trust={getTrust(record)} />
@@ -444,12 +415,10 @@ export function PluginsTab() {
<span className="plugin-item__name">
{getName(record)}
</span>
{getVersion(record) && (
<span className="plugin-item__version">
v
{getVersion(record)}
{record.version}
</span>
)}
</div>
<div className="plugin-item__meta">
<TrustBadge trust={getTrust(record)} />
@@ -1,66 +0,0 @@
import { useState } from "react";
import { IntelPropertyRow } from "./IntelPropertyRow";
function formatLocal(iso: string): string {
return new Date(iso).toLocaleString(undefined, {
day: "numeric", month: "2-digit", year: "numeric",
hour: "numeric", minute: "2-digit", hour12: true, timeZoneName: "short",
});
}
function formatUtc(iso: string): string {
return new Date(iso).toISOString().slice(0, 16).replace("T", " ") + " UTC";
}
function formatRelative(iso: string): string {
const diff = new Date(iso).getTime() - Date.now();
const abs = Math.abs(diff);
const future = diff > 0;
if (abs < 60_000) return "just now";
if (abs < 3_600_000) {
const n = Math.round(abs / 60_000);
return future ? `in ${n}m` : `${n}m ago`;
}
if (abs < 86_400_000) {
const n = Math.round(abs / 3_600_000);
return future ? `in ${n}h` : `${n}h ago`;
}
const n = Math.round(abs / 86_400_000);
return future ? `in ${n}d` : `${n}d ago`;
}
interface DatetimePropertyRowProps {
label: string;
iso: string;
classNamePrefix?: string;
}
export function DatetimePropertyRow({ label, iso, classNamePrefix = "intel-panel" }: DatetimePropertyRowProps) {
const [expanded, setExpanded] = useState(false);
if (expanded) {
return (
<IntelPropertyRow label={label} isColumn classNamePrefix={classNamePrefix}>
<span
style={{ cursor: "pointer", fontWeight: 600 }}
onClick={() => setExpanded(false)}
>
{formatLocal(iso)}
</span>
<span style={{ opacity: 0.6, fontSize: "0.85em" }}>{formatUtc(iso)}</span>
<span style={{ opacity: 0.6, fontSize: "0.85em" }}>{formatRelative(iso)}</span>
</IntelPropertyRow>
);
}
return (
<IntelPropertyRow label={label} classNamePrefix={classNamePrefix}>
<span
style={{ cursor: "pointer", textDecoration: "underline dotted" }}
onClick={() => setExpanded(true)}
>
{formatLocal(iso)}
</span>
</IntelPropertyRow>
);
}
@@ -11,8 +11,6 @@ import { ImageProperty } from './ImageProperty';
import { UrlProperty } from './UrlProperty';
import { LongTextProperty } from './LongTextProperty';
import { IntelPropertyRow } from './IntelPropertyRow';
import { DatetimePropertyRow } from "./DatetimePropertyRow";
import { VideoProperty } from "./VideoProperty";
/**
* @interface DynamicPropertiesRenderProps
@@ -39,52 +37,6 @@ export function DynamicPropertiesRender({ entity, classNamePrefix = "intel-panel
const label = key.replace(/_/g, " ");
const stringValue = String(value);
// Tagged dispatch - explicit type prefix, checked before heuristics
if (typeof value === "string") {
if (value.startsWith("datetime:")) {
return (
<DatetimePropertyRow
key={key}
label={label}
iso={value.slice(9)}
classNamePrefix={classNamePrefix}
/>
);
}
if (value.startsWith("url:")) {
return (
<UrlProperty
key={key}
label={label}
url={value.slice(4)}
classNamePrefix={classNamePrefix}
/>
);
}
if (value.startsWith("image:")) {
return (
<ImageProperty
key={key}
label={label}
imageUrl={value.slice(6)}
entityId={entity.id}
entityLabel={entity.label ?? ""}
classNamePrefix={classNamePrefix}
/>
);
}
if (value.startsWith("video:")) {
return (
<VideoProperty
key={key}
label={label}
href={value.slice(6)}
classNamePrefix={classNamePrefix}
/>
);
}
}
// Identify property type
const isImage = typeof value === "string" && key.toLowerCase().includes("image") && /^https?:\/\//i.test(value);
const isUrl = !isImage && typeof value === "string" && /^https?:\/\//i.test(value);
@@ -1,24 +0,0 @@
import { PlayCircle } from "lucide-react";
import { IntelPropertyRow } from "./IntelPropertyRow";
interface VideoPropertyProps {
label: string;
href: string;
classNamePrefix?: string;
}
export function VideoProperty({ label, href, classNamePrefix = "intel-panel" }: VideoPropertyProps) {
return (
<IntelPropertyRow label={label} classNamePrefix={classNamePrefix}>
<a
href={href}
target="_blank"
rel="noopener noreferrer"
style={{ display: "flex", alignItems: "center", gap: 4, color: "var(--accent-cyan)" }}
>
<PlayCircle size={14} />
Watch
</a>
</IntelPropertyRow>
);
}
-2
View File
@@ -10,7 +10,6 @@ import {
getApprovedUnverifiedIds,
approveUnverifiedPlugin,
} from "@/lib/marketplace/trustedPlugins";
import { getDisabledPluginIds } from "@/core/plugins/pluginPreferences";
import { isDemo } from "@/core/edition";
/**
@@ -67,7 +66,6 @@ export function useMarketplaceSync(hostReady: boolean) {
async function loadManifest(manifest: PluginManifest) {
if (!manifest.id || loadedIds.current.has(manifest.id)) return;
if (getDisabledPluginIds().has(manifest.id)) return;
if (pluginManager.getPlugin(manifest.id)) {
loadedIds.current.add(manifest.id);
return;
-25
View File
@@ -1,25 +0,0 @@
const DISABLED_KEY = "wwv-disabled-plugins";
export function getDisabledPluginIds(): Set<string> {
try {
const raw = localStorage.getItem(DISABLED_KEY);
if (!raw) return new Set();
return new Set<string>(JSON.parse(raw));
} catch {
return new Set();
}
}
export function setPluginDisabled(pluginId: string, disabled: boolean): void {
try {
const ids = getDisabledPluginIds();
if (disabled) {
ids.add(pluginId);
} else {
ids.delete(pluginId);
}
localStorage.setItem(DISABLED_KEY, JSON.stringify([...ids]));
} catch {
// ignore storage errors
}
}
+25 -33
View File
@@ -24,36 +24,28 @@
}
.geojson-btn--primary {
background: var(--bg-glass);
color: var(--text-primary);
border: 1px solid rgba(var(--accent-rgb), 0.3);
background: linear-gradient(135deg, #00e5ff 0%, #00b0ff 100%);
color: #0a0e17;
}
.geojson-btn--primary:hover:not(:disabled) {
background: var(--bg-glass-hover);
box-shadow: var(--glass-shadow-inner);
box-shadow: 0 0 16px rgba(0, 229, 255, 0.4);
transform: translateY(-1px);
}
.geojson-btn--primary:active:not(:disabled) {
transform: scale(0.98);
}
.geojson-btn--primary:disabled {
opacity: 0.4;
cursor: not-allowed;
transform: none;
box-shadow: none;
}
.geojson-btn--secondary {
background: var(--bg-glass);
background: rgba(255, 255, 255, 0.08);
color: var(--text-primary);
border: 1px solid var(--glass-border-inner);
border: 1px solid rgba(255, 255, 255, 0.12);
}
.geojson-btn--secondary:hover:not(:disabled) {
background: var(--bg-glass-hover);
background: rgba(255, 255, 255, 0.14);
}
.geojson-btn--secondary:disabled {
@@ -95,7 +87,7 @@
align-items: center;
justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid var(--glass-border-inner);
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.geojson-modal__header h3 {
@@ -125,7 +117,7 @@
display: flex;
gap: 4px;
padding: 12px 20px;
border-bottom: 1px solid var(--glass-border-inner);
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.geojson-tab {
@@ -144,13 +136,13 @@
}
.geojson-tab:hover {
background: rgba(var(--accent-rgb), 0.06);
background: rgba(255, 255, 255, 0.06);
color: var(--text-primary);
}
.geojson-tab--active {
background: rgba(var(--accent-rgb), 0.12);
color: var(--accent-cyan);
background: rgba(0, 229, 255, 0.12);
color: #00e5ff;
}
/* ─── Body ────────────────────────────────────────────────── */
@@ -171,7 +163,7 @@
justify-content: center;
gap: 8px;
padding: 32px 20px;
border: 2px dashed rgba(var(--accent-rgb), 0.2);
border: 2px dashed rgba(255, 255, 255, 0.15);
border-radius: 10px;
color: var(--text-muted);
cursor: pointer;
@@ -181,9 +173,9 @@
.geojson-dropzone:hover,
.geojson-dropzone--active {
border-color: var(--accent-cyan);
background: rgba(var(--accent-rgb), 0.04);
color: var(--accent-cyan);
border-color: #00e5ff;
background: rgba(0, 229, 255, 0.04);
color: #00e5ff;
}
.geojson-dropzone p {
@@ -202,9 +194,9 @@
width: 100%;
min-height: 140px;
padding: 12px;
border: 1px solid var(--glass-border-inner);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
background: var(--bg-secondary);
background: rgba(0, 0, 0, 0.3);
color: var(--text-primary);
font-family: "JetBrains Mono", "Fira Code", monospace;
font-size: 12px;
@@ -214,7 +206,7 @@
.geojson-textarea:focus {
outline: none;
border-color: var(--accent-cyan);
border-color: #00e5ff;
}
/* ─── Inputs ──────────────────────────────────────────────── */
@@ -222,9 +214,9 @@
.geojson-input {
width: 100%;
padding: 8px 12px;
border: 1px solid var(--glass-border-inner);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 6px;
background: var(--bg-secondary);
background: rgba(0, 0, 0, 0.3);
color: var(--text-primary);
font-size: 13px;
transition: border-color 0.2s;
@@ -232,7 +224,7 @@
.geojson-input:focus {
outline: none;
border-color: var(--accent-cyan);
border-color: #00e5ff;
}
.geojson-input::placeholder {
@@ -253,7 +245,7 @@
width: 32px;
height: 32px;
padding: 0;
border: 2px solid var(--glass-border-inner);
border: 2px solid rgba(255, 255, 255, 0.15);
border-radius: 6px;
background: none;
cursor: pointer;
@@ -264,8 +256,8 @@
.geojson-preview {
padding: 10px 14px;
border-radius: 8px;
background: rgba(var(--accent-rgb), 0.06);
border: 1px solid rgba(var(--accent-rgb), 0.15);
background: rgba(0, 229, 255, 0.06);
border: 1px solid rgba(0, 229, 255, 0.15);
display: flex;
flex-direction: column;
gap: 4px;
@@ -307,7 +299,7 @@
justify-content: flex-end;
gap: 8px;
padding: 12px 20px;
border-top: 1px solid var(--glass-border-inner);
border-top: 1px solid rgba(255, 255, 255, 0.06);
}
/* ─── Layer List ──────────────────────────────────────────── */