terraproof 0.0.0-stage → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +356 -2
- package/bin/terraproof.js +4 -0
- package/dist/router/apply.js +147 -0
- package/dist/router/classify.js +111 -0
- package/dist/router/explain.js +9 -0
- package/dist/router/index.js +272 -0
- package/dist/router/resolve.js +239 -0
- package/dist/router/score.js +60 -0
- package/dist/router/types.js +1 -0
- package/dist/router/validate.js +81 -0
- package/instructions/engineering.md +14 -0
- package/instructions/security.md +14 -0
- package/instructions/simplicity.md +13 -0
- package/package.json +65 -4
- package/routing/DOMAIN_ROUTING.md +161 -0
- package/routing/ROUTER_DESIGN.md +173 -0
- package/routing/SKILL_MANIFEST.md +86 -0
- package/routing/checks.json +121 -0
- package/routing/collections.json +47 -0
- package/routing/registry.json +2211 -0
- package/routing/rules.json +64 -0
- package/skills/accuracy-assessment/SKILL.md +213 -0
- package/skills/accuracy-assessment/UPSTREAM.md +7 -0
- package/skills/accuracy-assessment/references/stratified-estimator.md +127 -0
- package/skills/accuracy-assessment/skill.json +103 -0
- package/skills/brainstorming/SKILL.md +250 -0
- package/skills/brainstorming/UPSTREAM.md +29 -0
- package/skills/brainstorming/scripts/frame-template.html +213 -0
- package/skills/brainstorming/scripts/helper.js +167 -0
- package/skills/brainstorming/scripts/server.cjs +723 -0
- package/skills/brainstorming/scripts/start-server.sh +209 -0
- package/skills/brainstorming/scripts/stop-server.sh +120 -0
- package/skills/brainstorming/skill.json +73 -0
- package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/skills/brainstorming/visual-companion.md +299 -0
- package/skills/crs-and-units/SKILL.md +200 -0
- package/skills/crs-and-units/UPSTREAM.md +7 -0
- package/skills/crs-and-units/skill.json +74 -0
- package/skills/design-postgis-tables/SKILL.md +494 -0
- package/skills/design-postgis-tables/UPSTREAM.md +21 -0
- package/skills/design-postgis-tables/skill.json +90 -0
- package/skills/gdal/SKILL.md +125 -0
- package/skills/gdal/UPSTREAM.md +22 -0
- package/skills/gdal/references/gdal-recipes.md +103 -0
- package/skills/gdal/skill.json +66 -0
- package/skills/geomaster/README.md +105 -0
- package/skills/geomaster/SKILL.md +366 -0
- package/skills/geomaster/UPSTREAM.md +21 -0
- package/skills/geomaster/references/advanced-gis.md +376 -0
- package/skills/geomaster/references/big-data.md +363 -0
- package/skills/geomaster/references/code-examples.md +531 -0
- package/skills/geomaster/references/coordinate-systems.md +364 -0
- package/skills/geomaster/references/core-libraries.md +273 -0
- package/skills/geomaster/references/data-sources.md +330 -0
- package/skills/geomaster/references/gis-software.md +369 -0
- package/skills/geomaster/references/industry-applications.md +420 -0
- package/skills/geomaster/references/machine-learning.md +462 -0
- package/skills/geomaster/references/programming-languages.md +456 -0
- package/skills/geomaster/references/remote-sensing.md +370 -0
- package/skills/geomaster/references/scientific-domains.md +416 -0
- package/skills/geomaster/references/specialized-topics.md +428 -0
- package/skills/geomaster/references/troubleshooting.md +439 -0
- package/skills/geomaster/skill.json +157 -0
- package/skills/geopandas/SKILL.md +250 -0
- package/skills/geopandas/UPSTREAM.md +22 -0
- package/skills/geopandas/references/crs-management.md +231 -0
- package/skills/geopandas/references/data-io.md +323 -0
- package/skills/geopandas/references/data-structures.md +207 -0
- package/skills/geopandas/references/geometric-operations.md +262 -0
- package/skills/geopandas/references/spatial-analysis.md +294 -0
- package/skills/geopandas/references/visualization.md +230 -0
- package/skills/geopandas/scripts/_common.py +605 -0
- package/skills/geopandas/scripts/crs_reprojection_plan.py +210 -0
- package/skills/geopandas/scripts/export_plan.py +305 -0
- package/skills/geopandas/scripts/geometry_validity_report.py +227 -0
- package/skills/geopandas/scripts/sensitive_coordinates_checklist.py +230 -0
- package/skills/geopandas/scripts/spatial_join_audit.py +368 -0
- package/skills/geopandas/scripts/vector_inventory.py +140 -0
- package/skills/geopandas/skill.json +116 -0
- package/skills/geoparquet-validation/SKILL.md +125 -0
- package/skills/geoparquet-validation/UPSTREAM.md +24 -0
- package/skills/geoparquet-validation/references/distribution-best-practices.md +118 -0
- package/skills/geoparquet-validation/references/gpio-commands.md +264 -0
- package/skills/geoparquet-validation/references/tool-comparison.md +155 -0
- package/skills/geoparquet-validation/skill.json +71 -0
- package/skills/geospatial-data-discovery/SKILL.md +49 -0
- package/skills/geospatial-data-discovery/UPSTREAM.md +15 -0
- package/skills/geospatial-data-discovery/skill.json +51 -0
- package/skills/geospatial-frontend/SKILL.md +86 -0
- package/skills/geospatial-frontend/UPSTREAM.md +23 -0
- package/skills/geospatial-frontend/references/design-system.md +283 -0
- package/skills/geospatial-frontend/references/user-preferences.md +96 -0
- package/skills/geospatial-frontend/skill.json +87 -0
- package/skills/geozarr/SKILL.md +244 -0
- package/skills/geozarr/UPSTREAM.md +21 -0
- package/skills/geozarr/skill.json +97 -0
- package/skills/networkx/SKILL.md +440 -0
- package/skills/networkx/UPSTREAM.md +22 -0
- package/skills/networkx/references/algorithms.md +384 -0
- package/skills/networkx/references/generators.md +385 -0
- package/skills/networkx/references/graph-basics.md +284 -0
- package/skills/networkx/references/io.md +457 -0
- package/skills/networkx/references/visualization.md +531 -0
- package/skills/networkx/skill.json +93 -0
- package/skills/raster-processing/SKILL.md +222 -0
- package/skills/raster-processing/UPSTREAM.md +7 -0
- package/skills/raster-processing/skill.json +81 -0
- package/skills/sar-basics/SKILL.md +202 -0
- package/skills/sar-basics/UPSTREAM.md +7 -0
- package/skills/sar-basics/references/calibration-lut.md +98 -0
- package/skills/sar-basics/skill.json +97 -0
- package/skills/satellite-preprocessing/SKILL.md +241 -0
- package/skills/satellite-preprocessing/UPSTREAM.md +7 -0
- package/skills/satellite-preprocessing/skill.json +84 -0
- package/skills/scientific-visualization/SKILL.md +285 -0
- package/skills/scientific-visualization/UPSTREAM.md +25 -0
- package/skills/scientific-visualization/assets/color_palettes.py +263 -0
- package/skills/scientific-visualization/assets/nature.mplstyle +68 -0
- package/skills/scientific-visualization/assets/presentation.mplstyle +68 -0
- package/skills/scientific-visualization/assets/publication.mplstyle +77 -0
- package/skills/scientific-visualization/assets/publisher_profiles.json +269 -0
- package/skills/scientific-visualization/references/color_palettes.md +227 -0
- package/skills/scientific-visualization/references/journal_requirements.md +169 -0
- package/skills/scientific-visualization/references/matplotlib_examples.md +336 -0
- package/skills/scientific-visualization/references/publication_guidelines.md +196 -0
- package/skills/scientific-visualization/references/sources.md +76 -0
- package/skills/scientific-visualization/scripts/_common.py +136 -0
- package/skills/scientific-visualization/scripts/export_plan.py +493 -0
- package/skills/scientific-visualization/scripts/figure_export.py +642 -0
- package/skills/scientific-visualization/scripts/image_metadata.py +731 -0
- package/skills/scientific-visualization/scripts/palette_audit.py +327 -0
- package/skills/scientific-visualization/scripts/style_presets.py +501 -0
- package/skills/scientific-visualization/scripts/style_preview.py +232 -0
- package/skills/scientific-visualization/skill.json +95 -0
- package/skills/spectral-indices/SKILL.md +235 -0
- package/skills/spectral-indices/UPSTREAM.md +7 -0
- package/skills/spectral-indices/skill.json +88 -0
- package/skills/stac-and-cloud-access/SKILL.md +209 -0
- package/skills/stac-and-cloud-access/UPSTREAM.md +7 -0
- package/skills/stac-and-cloud-access/references/run-manifest.md +94 -0
- package/skills/stac-and-cloud-access/skill.json +98 -0
- package/skills/statistical-analysis/SKILL.md +446 -0
- package/skills/statistical-analysis/UPSTREAM.md +24 -0
- package/skills/statistical-analysis/references/assumptions_and_diagnostics.md +379 -0
- package/skills/statistical-analysis/references/bayesian_statistics.md +686 -0
- package/skills/statistical-analysis/references/effect_sizes_and_power.md +649 -0
- package/skills/statistical-analysis/references/reporting_standards.md +482 -0
- package/skills/statistical-analysis/references/test_selection_guide.md +129 -0
- package/skills/statistical-analysis/scripts/assumption_checks.py +652 -0
- package/skills/statistical-analysis/skill.json +127 -0
- package/skills/systematic-debugging/SKILL.md +283 -0
- package/skills/systematic-debugging/UPSTREAM.md +28 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +72 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/skill.json +88 -0
- package/skills/time-series-and-change/SKILL.md +217 -0
- package/skills/time-series-and-change/UPSTREAM.md +7 -0
- package/skills/time-series-and-change/references/change-methods.md +42 -0
- package/skills/time-series-and-change/skill.json +116 -0
- package/skills/vector-quality/SKILL.md +204 -0
- package/skills/vector-quality/UPSTREAM.md +7 -0
- package/skills/vector-quality/skill.json +82 -0
- package/skills/verification/SKILL.md +120 -0
- package/skills/verification/UPSTREAM.md +31 -0
- package/skills/verification/skill.json +67 -0
- package/skills/writing-plans/SKILL.md +171 -0
- package/skills/writing-plans/UPSTREAM.md +23 -0
- package/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/skills/writing-plans/skill.json +80 -0
- package/sources/SOURCES.md +374 -0
- package/third_party/isaaccorley-geospatial-skills/LICENSE +176 -0
- package/third_party/isaaccorley-geospatial-skills/NOTICE.md +17 -0
- package/third_party/kdense-scientific-agent-skills/LICENSE +21 -0
- package/third_party/kdense-scientific-agent-skills/NOTICE.md +19 -0
- package/third_party/superpowers/LICENSE +21 -0
- package/third_party/superpowers/NOTICE.md +17 -0
- package/third_party/timescale-pg-aiguide/LICENSE +176 -0
- package/third_party/timescale-pg-aiguide/NOTICE.md +14 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
# Visual Companion Guide
|
|
2
|
+
|
|
3
|
+
Browser-based visual brainstorming companion for showing mockups, diagrams, and options.
|
|
4
|
+
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
Decide per-question, not per-session. The test: **would the user understand this better by seeing it than reading it?**
|
|
8
|
+
|
|
9
|
+
**Use the browser** when the content itself is visual:
|
|
10
|
+
|
|
11
|
+
- **UI mockups** — wireframes, layouts, navigation structures, component designs
|
|
12
|
+
- **Architecture diagrams** — system components, data flow, relationship maps
|
|
13
|
+
- **Side-by-side visual comparisons** — comparing two layouts, two color schemes, two design directions
|
|
14
|
+
- **Design polish** — when the question is about look and feel, spacing, visual hierarchy
|
|
15
|
+
- **Spatial relationships** — state machines, flowcharts, entity relationships rendered as diagrams
|
|
16
|
+
|
|
17
|
+
**Use the terminal** when the content is text or tabular:
|
|
18
|
+
|
|
19
|
+
- **Requirements and scope questions** — "what does X mean?", "which features are in scope?"
|
|
20
|
+
- **Conceptual A/B/C choices** — picking between approaches described in words
|
|
21
|
+
- **Tradeoff lists** — pros/cons, comparison tables
|
|
22
|
+
- **Technical decisions** — API design, data modeling, architectural approach selection
|
|
23
|
+
- **Clarifying questions** — anything where the answer is words, not a visual preference
|
|
24
|
+
|
|
25
|
+
A question *about* a UI topic is not automatically a visual question. "What kind of wizard do you want?" is conceptual — use the terminal. "Which of these wizard layouts feels right?" is visual — use the browser.
|
|
26
|
+
|
|
27
|
+
## How It Works
|
|
28
|
+
|
|
29
|
+
The server watches a directory for HTML files and serves the newest one to the browser. You write HTML content to `screen_dir`, the user sees it in their browser and can click to select options. Selections are recorded to `state_dir/events` that you read on your next turn.
|
|
30
|
+
|
|
31
|
+
**Content fragments vs full documents:** If your HTML file starts with `<!DOCTYPE` or `<html`, the server serves it as-is (just injects the helper script). Otherwise, the server automatically wraps your content in the frame template — adding the header, CSS theme, connection status, and all interactive infrastructure. **Write content fragments by default.** Only write full documents when you need complete control over the page.
|
|
32
|
+
|
|
33
|
+
## Starting a Session
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Start AFTER the user approves the companion. --open auto-opens their browser on
|
|
37
|
+
# the first screen; --project-dir persists mockups and enables same-port restart.
|
|
38
|
+
scripts/start-server.sh --project-dir /path/to/project --open
|
|
39
|
+
|
|
40
|
+
# Returns: {"type":"server-started","port":52341,
|
|
41
|
+
# "url":"http://localhost:52341/?key=ab12…",
|
|
42
|
+
# "screen_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/content",
|
|
43
|
+
# "state_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/state"}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Save `screen_dir` and `state_dir` from the response. With `--open`, the browser opens itself when you push the first screen — you don't need to ask the user to open it, but still share the URL as a fallback (headless/remote setups won't auto-open).
|
|
47
|
+
|
|
48
|
+
**The URL contains a session key (`?key=…`).** The server rejects any request
|
|
49
|
+
without it, so always give the user the **complete** URL from the `url` field —
|
|
50
|
+
never strip the query string, and never hand out a bare `http://host:port`. The
|
|
51
|
+
key gates HTTP and WebSocket access so a stray browser tab or another machine on
|
|
52
|
+
the network can't read the screens or inject events. After the first load the
|
|
53
|
+
browser remembers the key via a cookie, so reloads and `/files/*` assets work
|
|
54
|
+
without repeating it.
|
|
55
|
+
|
|
56
|
+
**Finding connection info:** The server writes its startup JSON to `$STATE_DIR/server-info`. If you launched the server in the background and didn't capture stdout, read that file to get the URL and port. When using `--project-dir`, check `<project>/.superpowers/brainstorm/` for the session directory.
|
|
57
|
+
|
|
58
|
+
**Note:** Pass the project root as `--project-dir` so mockups persist in `.superpowers/brainstorm/` and survive server restarts. Without it, files go to `/tmp` and get cleaned up. Remind the user to add `.superpowers/` to `.gitignore` if it's not already there.
|
|
59
|
+
|
|
60
|
+
**Launching the server by platform:**
|
|
61
|
+
|
|
62
|
+
**Claude Code:**
|
|
63
|
+
```bash
|
|
64
|
+
# Default mode works — the script backgrounds the server itself.
|
|
65
|
+
scripts/start-server.sh --project-dir /path/to/project --open
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
On Windows, the script auto-detects and switches to foreground mode (which blocks the tool call). Use `run_in_background: true` on the Bash tool call so the server survives across conversation turns, then read `$STATE_DIR/server-info` on the next turn to get the URL and port.
|
|
69
|
+
|
|
70
|
+
**Codex:**
|
|
71
|
+
```bash
|
|
72
|
+
# Codex reaps background processes. The script auto-detects CODEX_CI and
|
|
73
|
+
# switches to foreground mode. Run it normally — no extra flags needed.
|
|
74
|
+
scripts/start-server.sh --project-dir /path/to/project --open
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Gemini CLI:**
|
|
78
|
+
```bash
|
|
79
|
+
# Use --foreground and set is_background: true on your shell tool call
|
|
80
|
+
# so the process survives across turns
|
|
81
|
+
scripts/start-server.sh --project-dir /path/to/project --open --foreground
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Copilot CLI:**
|
|
85
|
+
```bash
|
|
86
|
+
# Start it with Copilot CLI's non-blocking/background shell mechanism so the
|
|
87
|
+
# server survives across turns. Keep --foreground so the harness, not the
|
|
88
|
+
# script, owns backgrounding. The launcher is a .sh, so invoke it via bash
|
|
89
|
+
# (on Windows, call Git Bash's bash.exe from the PowerShell tool).
|
|
90
|
+
bash scripts/start-server.sh --project-dir /path/to/project --open --foreground
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Other environments:** The server must keep running in the background across conversation turns. If your environment reaps detached processes, use `--foreground` and launch the command with your platform's background execution mechanism.
|
|
94
|
+
|
|
95
|
+
If the URL is unreachable from your browser (common in remote/containerized setups), bind a non-loopback host:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
scripts/start-server.sh \
|
|
99
|
+
--project-dir /path/to/project \
|
|
100
|
+
--host 0.0.0.0 \
|
|
101
|
+
--url-host localhost
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Use `--url-host` to control what hostname is printed in the returned URL JSON.
|
|
105
|
+
|
|
106
|
+
## The Loop
|
|
107
|
+
|
|
108
|
+
1. **Check server is alive**, then **write HTML** to a new file in `screen_dir`:
|
|
109
|
+
- **Required: confirm the server is alive before referring to the URL or pushing a screen.** Check that `$STATE_DIR/server-info` exists and `$STATE_DIR/server-stopped` does not. If it has shut down, restart it with `start-server.sh` using the **same `--project-dir`** — it reuses the same port, so the user's open tab reconnects on its own (it shows a "paused" overlay while the server is down) and you don't need to send a new URL. The server auto-exits after 4 hours idle (configurable with `--idle-timeout-minutes`).
|
|
110
|
+
- Use semantic filenames: `platform.html`, `visual-style.html`, `layout.html`
|
|
111
|
+
- **Never reuse filenames** — each screen gets a fresh file
|
|
112
|
+
- Use your file-creation tool — **never use cat/heredoc** (dumps noise into terminal)
|
|
113
|
+
- Server automatically serves the newest file
|
|
114
|
+
|
|
115
|
+
2. **Tell user what to expect and end your turn:**
|
|
116
|
+
- Remind them of the URL (every step, not just first)
|
|
117
|
+
- Give a brief text summary of what's on screen (e.g., "Showing 3 layout options for the homepage")
|
|
118
|
+
- Ask them to respond in the terminal: "Take a look and let me know what you think. Click to select an option if you'd like."
|
|
119
|
+
|
|
120
|
+
3. **On your next turn** — after the user responds in the terminal:
|
|
121
|
+
- Read `$STATE_DIR/events` if it exists — this contains the user's browser interactions (clicks, selections) as JSON lines
|
|
122
|
+
- Merge with the user's terminal text to get the full picture
|
|
123
|
+
- The terminal message is the primary feedback; `state_dir/events` provides structured interaction data
|
|
124
|
+
|
|
125
|
+
4. **Iterate or advance** — if feedback changes current screen, write a new file (e.g., `layout-v2.html`). Only move to the next question when the current step is validated.
|
|
126
|
+
|
|
127
|
+
5. **Unload when returning to terminal** — when the next step doesn't need the browser (e.g., a clarifying question, a tradeoff discussion), push a waiting screen to clear the stale content:
|
|
128
|
+
|
|
129
|
+
```html
|
|
130
|
+
<!-- filename: waiting.html (or waiting-2.html, etc.) -->
|
|
131
|
+
<div style="display:flex;align-items:center;justify-content:center;min-height:60vh">
|
|
132
|
+
<p class="subtitle">Continuing in terminal...</p>
|
|
133
|
+
</div>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
This prevents the user from staring at a resolved choice while the conversation has moved on. When the next visual question comes up, push a new content file as usual.
|
|
137
|
+
|
|
138
|
+
6. Repeat until done.
|
|
139
|
+
|
|
140
|
+
## Writing Content Fragments
|
|
141
|
+
|
|
142
|
+
Write just the content that goes inside the page. The server wraps it in the frame template automatically (header, theme CSS, connection status, and all interactive infrastructure).
|
|
143
|
+
|
|
144
|
+
**Minimal example:**
|
|
145
|
+
|
|
146
|
+
```html
|
|
147
|
+
<h2>Which layout works better?</h2>
|
|
148
|
+
<p class="subtitle">Consider readability and visual hierarchy</p>
|
|
149
|
+
|
|
150
|
+
<div class="options">
|
|
151
|
+
<div class="option" data-choice="a" onclick="toggleSelect(this)">
|
|
152
|
+
<div class="letter">A</div>
|
|
153
|
+
<div class="content">
|
|
154
|
+
<h3>Single Column</h3>
|
|
155
|
+
<p>Clean, focused reading experience</p>
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
<div class="option" data-choice="b" onclick="toggleSelect(this)">
|
|
159
|
+
<div class="letter">B</div>
|
|
160
|
+
<div class="content">
|
|
161
|
+
<h3>Two Column</h3>
|
|
162
|
+
<p>Sidebar navigation with main content</p>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
That's it. No `<html>`, no CSS, no `<script>` tags needed. The server provides all of that.
|
|
169
|
+
|
|
170
|
+
## CSS Classes Available
|
|
171
|
+
|
|
172
|
+
The frame template provides these CSS classes for your content:
|
|
173
|
+
|
|
174
|
+
### Options (A/B/C choices)
|
|
175
|
+
|
|
176
|
+
```html
|
|
177
|
+
<div class="options">
|
|
178
|
+
<div class="option" data-choice="a" onclick="toggleSelect(this)">
|
|
179
|
+
<div class="letter">A</div>
|
|
180
|
+
<div class="content">
|
|
181
|
+
<h3>Title</h3>
|
|
182
|
+
<p>Description</p>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Multi-select:** Add `data-multiselect` to the container to let users select multiple options. Each click toggles the item's selected styling.
|
|
189
|
+
|
|
190
|
+
```html
|
|
191
|
+
<div class="options" data-multiselect>
|
|
192
|
+
<!-- same option markup — users can select/deselect multiple -->
|
|
193
|
+
</div>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Cards (visual designs)
|
|
197
|
+
|
|
198
|
+
```html
|
|
199
|
+
<div class="cards">
|
|
200
|
+
<div class="card" data-choice="design1" onclick="toggleSelect(this)">
|
|
201
|
+
<div class="card-image"><!-- mockup content --></div>
|
|
202
|
+
<div class="card-body">
|
|
203
|
+
<h3>Name</h3>
|
|
204
|
+
<p>Description</p>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Mockup container
|
|
211
|
+
|
|
212
|
+
```html
|
|
213
|
+
<div class="mockup">
|
|
214
|
+
<div class="mockup-header">Preview: Dashboard Layout</div>
|
|
215
|
+
<div class="mockup-body"><!-- your mockup HTML --></div>
|
|
216
|
+
</div>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Split view (side-by-side)
|
|
220
|
+
|
|
221
|
+
```html
|
|
222
|
+
<div class="split">
|
|
223
|
+
<div class="mockup"><!-- left --></div>
|
|
224
|
+
<div class="mockup"><!-- right --></div>
|
|
225
|
+
</div>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Pros/Cons
|
|
229
|
+
|
|
230
|
+
```html
|
|
231
|
+
<div class="pros-cons">
|
|
232
|
+
<div class="pros"><h4>Pros</h4><ul><li>Benefit</li></ul></div>
|
|
233
|
+
<div class="cons"><h4>Cons</h4><ul><li>Drawback</li></ul></div>
|
|
234
|
+
</div>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Mock elements (wireframe building blocks)
|
|
238
|
+
|
|
239
|
+
```html
|
|
240
|
+
<div class="mock-nav">Logo | Home | About | Contact</div>
|
|
241
|
+
<div style="display: flex;">
|
|
242
|
+
<div class="mock-sidebar">Navigation</div>
|
|
243
|
+
<div class="mock-content">Main content area</div>
|
|
244
|
+
</div>
|
|
245
|
+
<button class="mock-button">Action Button</button>
|
|
246
|
+
<input class="mock-input" placeholder="Input field">
|
|
247
|
+
<div class="placeholder">Placeholder area</div>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Typography and sections
|
|
251
|
+
|
|
252
|
+
- `h2` — page title
|
|
253
|
+
- `h3` — section heading
|
|
254
|
+
- `.subtitle` — secondary text below title
|
|
255
|
+
- `.section` — content block with bottom margin
|
|
256
|
+
- `.label` — small uppercase label text
|
|
257
|
+
|
|
258
|
+
## Browser Events Format
|
|
259
|
+
|
|
260
|
+
When the user clicks options in the browser, their interactions are recorded to `$STATE_DIR/events` (one JSON object per line). The file is cleared automatically when you push a new screen.
|
|
261
|
+
|
|
262
|
+
```jsonl
|
|
263
|
+
{"type":"click","choice":"a","text":"Option A - Simple Layout","timestamp":1706000101}
|
|
264
|
+
{"type":"click","choice":"c","text":"Option C - Complex Grid","timestamp":1706000108}
|
|
265
|
+
{"type":"click","choice":"b","text":"Option B - Hybrid","timestamp":1706000115}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
The full event stream shows the user's exploration path — they may click multiple options before settling. The last `choice` event is typically the final selection, but the pattern of clicks can reveal hesitation or preferences worth asking about.
|
|
269
|
+
|
|
270
|
+
If `$STATE_DIR/events` doesn't exist, the user didn't interact with the browser — use only their terminal text.
|
|
271
|
+
|
|
272
|
+
## Design Tips
|
|
273
|
+
|
|
274
|
+
- **Scale fidelity to the question** — wireframes for layout, polish for polish questions
|
|
275
|
+
- **Explain the question on each page** — "Which layout feels more professional?" not just "Pick one"
|
|
276
|
+
- **Iterate before advancing** — if feedback changes current screen, write a new version
|
|
277
|
+
- **2-4 options max** per screen
|
|
278
|
+
- **Use real content when it matters** — for a photography portfolio, use actual images (Unsplash). Placeholder content obscures design issues.
|
|
279
|
+
- **Keep mockups simple** — focus on layout and structure, not pixel-perfect design
|
|
280
|
+
|
|
281
|
+
## File Naming
|
|
282
|
+
|
|
283
|
+
- Use semantic names: `platform.html`, `visual-style.html`, `layout.html`
|
|
284
|
+
- Never reuse filenames — each screen must be a new file
|
|
285
|
+
- For iterations: append version suffix like `layout-v2.html`, `layout-v3.html`
|
|
286
|
+
- Server serves newest file by modification time
|
|
287
|
+
|
|
288
|
+
## Cleaning Up
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
scripts/stop-server.sh $SESSION_DIR
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
If the session used `--project-dir`, mockup files persist in `.superpowers/brainstorm/` for later reference. Only `/tmp` sessions get deleted on stop.
|
|
295
|
+
|
|
296
|
+
## Reference
|
|
297
|
+
|
|
298
|
+
- Frame template (CSS reference): `scripts/frame-template.html`
|
|
299
|
+
- Helper script (client-side): `scripts/helper.js`
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: crs-and-units
|
|
3
|
+
description: Choose and verify coordinate reference systems, coordinate order, datum transformations, and measurement units for vector or raster analysis; use before distance, length, area, buffering, reprojection, or work across projection boundaries.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CRS and units
|
|
7
|
+
|
|
8
|
+
## Choose a measurement CRS
|
|
9
|
+
|
|
10
|
+
Start from the dataset CRS, full AOI, required accuracy, and intended measurement.
|
|
11
|
+
A projected CRS is not automatically a good measurement CRS.
|
|
12
|
+
|
|
13
|
+
- For compact local distance/buffer work, consider an appropriate UTM zone or an
|
|
14
|
+
authoritative local projected CRS whose area of use contains the AOI.
|
|
15
|
+
- UTM is conformal, with 60 generally 6-degree longitude zones [S1]. It preserves
|
|
16
|
+
local angles, not exact distances or areas everywhere. Inspect distortion over
|
|
17
|
+
the whole AOI; a centroid-based zone estimate is only a candidate.
|
|
18
|
+
- For regional area totals, prefer a suitable equal-area projection (for example
|
|
19
|
+
Albers or Lambert azimuthal equal-area). Conformal projections prioritize local
|
|
20
|
+
shape/angles instead; neither property guarantees the other [S2].
|
|
21
|
+
- For large, multi-zone, or polar AOIs, consider a regional/polar projection or
|
|
22
|
+
ellipsoidal geodesic calculation. Do not force every AOI into one UTM zone.
|
|
23
|
+
- Do not choose Web Mercator merely because it displays the basemap. Projection
|
|
24
|
+
scale distortion must fit the measurement error budget.
|
|
25
|
+
|
|
26
|
+
Use [GeoPandas](../geopandas/SKILL.md) for vector API details and
|
|
27
|
+
[GDAL](../gdal/SKILL.md) for raster/vector reprojection commands.
|
|
28
|
+
General implementation rules live in [engineering](../../instructions/engineering.md),
|
|
29
|
+
[simplicity](../../instructions/simplicity.md), and [security](../../instructions/security.md).
|
|
30
|
+
|
|
31
|
+
## Look up EPSG definitions and units
|
|
32
|
+
|
|
33
|
+
Use `projinfo EPSG:4326` to inspect the authoritative axes, units, datum and area
|
|
34
|
+
of use [S3]. Use the PROJ CRS Explorer linked in [S3] or query the local EPSG
|
|
35
|
+
catalog through pyproj; prefer an authority ID or WKT over a lossy PROJ string.
|
|
36
|
+
Do not assign a guessed EPSG code based only on coordinate magnitude.
|
|
37
|
+
|
|
38
|
+
This example estimates a UTM candidate for a compact, non-crossing AOI. Review
|
|
39
|
+
its area of use and distortion before accepting it:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
import geopandas as gpd
|
|
43
|
+
from pyproj import CRS
|
|
44
|
+
|
|
45
|
+
gdf = gpd.read_file("local_aoi.gpkg", engine="pyogrio")
|
|
46
|
+
if gdf.crs is None:
|
|
47
|
+
raise ValueError("Obtain the source CRS from the data provider")
|
|
48
|
+
try:
|
|
49
|
+
candidate = gdf.estimate_utm_crs()
|
|
50
|
+
except RuntimeError as exc:
|
|
51
|
+
# GeoPandas raises when no UTM candidate exists, e.g. for polar or multi-zone AOIs.
|
|
52
|
+
# Choose a regional or polar projection whose area of use contains the AOI instead.
|
|
53
|
+
raise ValueError("No UTM candidate: select an appropriate regional or polar CRS") from exc
|
|
54
|
+
crs = CRS(candidate)
|
|
55
|
+
print(crs.to_authority(), crs.area_of_use)
|
|
56
|
+
print([(a.name, a.unit_name, a.unit_conversion_factor) for a in crs.axis_info])
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`set_crs()` labels existing coordinates; `to_crs()` changes coordinates. Assign
|
|
60
|
+
metadata only when the actual source definition is known. Geographic horizontal
|
|
61
|
+
coordinates are angular. Projected horizontal units can be metres, feet, or other
|
|
62
|
+
units; inspect each relevant axis instead of assuming that projected means metres.
|
|
63
|
+
|
|
64
|
+
## Resolve axis order explicitly
|
|
65
|
+
|
|
66
|
+
EPSG:4326 defines latitude then longitude [S3]. GIS coordinate arrays commonly
|
|
67
|
+
use longitude then latitude. RFC 7946 GeoJSON uses WGS 84 longitude, latitude in
|
|
68
|
+
decimal degrees, equivalent to OGC:CRS84 [S4]; the axis convention is part of the
|
|
69
|
+
interface contract, not evidence that coordinates should be swapped blindly.
|
|
70
|
+
|
|
71
|
+
For explicit pyproj arrays in GIS order, use `always_xy=True`:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from pyproj import Transformer
|
|
75
|
+
|
|
76
|
+
def project_lonlat(lon, lat, target_crs):
|
|
77
|
+
transform = Transformer.from_crs(
|
|
78
|
+
"EPSG:4326", target_crs, always_xy=True, allow_ballpark=False
|
|
79
|
+
)
|
|
80
|
+
return transform.transform(lon, lat, errcheck=True)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Use a known control point inside the AOI to test position, axis order, and units.
|
|
84
|
+
A forward/inverse round trip alone cannot reveal consistently swapped axes or a
|
|
85
|
+
wrong but reversible CRS assignment.
|
|
86
|
+
|
|
87
|
+
## Inspect datum transformations and grids
|
|
88
|
+
|
|
89
|
+
Reprojection can include a datum transformation, not just a projection change.
|
|
90
|
+
Choose the operation for the AOI and required accuracy, inspect unavailable grids,
|
|
91
|
+
and reject an unjustified ballpark fallback. With known `source_crs`, `target_crs`,
|
|
92
|
+
and geographic AOI bounds supplied by the caller [S5]:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from pyproj import network
|
|
96
|
+
from pyproj.aoi import AreaOfInterest
|
|
97
|
+
from pyproj.transformer import TransformerGroup
|
|
98
|
+
|
|
99
|
+
def transformation_candidates(source_crs, target_crs, geographic_bounds):
|
|
100
|
+
network.set_network_enabled(False)
|
|
101
|
+
group = TransformerGroup(
|
|
102
|
+
source_crs, target_crs, always_xy=True,
|
|
103
|
+
area_of_interest=AreaOfInterest(*geographic_bounds),
|
|
104
|
+
allow_ballpark=False,
|
|
105
|
+
)
|
|
106
|
+
for operation in group.unavailable_operations:
|
|
107
|
+
print(operation.name, [(g.short_name, g.available) for g in operation.grids])
|
|
108
|
+
if not group.best_available or not group.transformers:
|
|
109
|
+
raise RuntimeError("Required transformation unavailable; resolve grids first")
|
|
110
|
+
for transform in group.transformers:
|
|
111
|
+
print(transform.description, transform.accuracy, transform.area_of_use)
|
|
112
|
+
return group.transformers # Select against the task's accuracy requirement.
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Unknown accuracy is not zero error. Record the selected pipeline, PROJ/database
|
|
116
|
+
versions and grid names. If a required grid is unavailable, obtain it through an
|
|
117
|
+
approved installation process and rerun the selection. A horizontal transform does
|
|
118
|
+
not by itself establish vertical datum or coordinate-epoch correctness.
|
|
119
|
+
|
|
120
|
+
## Compute area, length, and buffers with honest units
|
|
121
|
+
|
|
122
|
+
For planar GeoPandas/Shapely operations, length/distance/buffer parameters use CRS
|
|
123
|
+
units and area uses squared CRS units. Transform all operands into the chosen CRS
|
|
124
|
+
before analysis. In a foot-based CRS, convert requested metric tolerances before
|
|
125
|
+
buffering; for areas, square the linear conversion factor. Do not label an area
|
|
126
|
+
as square metres just because the CRS is projected.
|
|
127
|
+
|
|
128
|
+
For a compact AOI with an already reviewed metre-based `measurement_crs`:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
import geopandas as gpd
|
|
132
|
+
from pyproj import CRS
|
|
133
|
+
|
|
134
|
+
def measure_parcels(input_path, measurement_crs):
|
|
135
|
+
gdf = gpd.read_file(input_path, engine="pyogrio")
|
|
136
|
+
target = CRS(measurement_crs)
|
|
137
|
+
if gdf.crs is None or not target.is_projected:
|
|
138
|
+
raise ValueError("Defined source and reviewed projected target required")
|
|
139
|
+
if any(a.unit_name != "metre" for a in target.axis_info[:2]):
|
|
140
|
+
raise ValueError("This example requires metre-based horizontal axes")
|
|
141
|
+
projected = gdf.to_crs(target)
|
|
142
|
+
projected["area_m2"] = projected.geometry.area
|
|
143
|
+
projected["perimeter_m"] = projected.geometry.length
|
|
144
|
+
return projected
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
For survey-grade work, a projected grid distance is not the elevation-dependent
|
|
148
|
+
ground distance: the difference depends on the projection scale factor and surface
|
|
149
|
+
height, so state which distance a result reports.
|
|
150
|
+
|
|
151
|
+
Geodesic area/distance is an alternative when appropriate: use pyproj `Geod` on
|
|
152
|
+
geographic coordinates with explicit ellipsoid and ring orientation [S6]. A
|
|
153
|
+
geodesic calculation does not make a planar buffer in degrees correct.
|
|
154
|
+
|
|
155
|
+
## Handle antimeridian and polar data
|
|
156
|
+
|
|
157
|
+
Do not infer crossing extent by a naive longitude minimum/maximum. A GeoJSON
|
|
158
|
+
antimeridian bbox may have west longitude greater than east longitude. RFC 7946
|
|
159
|
+
recommends cutting crossing geometries so no part crosses the antimeridian [S4].
|
|
160
|
+
|
|
161
|
+
Before transforming, establish the intended side of the globe and edge model;
|
|
162
|
+
split/unwrap crossing parts, densify when the edge approximation requires it,
|
|
163
|
+
and validate the transformed geometry. A generic vertex-only transform is not
|
|
164
|
+
an automatic geodesic densifier. Near poles, choose a suitable polar projection
|
|
165
|
+
or geodesic method and inspect its area of use. Check ring orientation, enclosed
|
|
166
|
+
region and extent on a globe as well as a flat map.
|
|
167
|
+
|
|
168
|
+
## Verify with Terraproof
|
|
169
|
+
|
|
170
|
+
Run with an installed Python core and replace these example paths with real local
|
|
171
|
+
datasets. Checks are selected by inputs/options, not by a check-id CLI argument:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
python -m terraproof check parcels_projected.gpkg --operation area --format md --lang en --out crs-report.md
|
|
175
|
+
python -m terraproof check roads_projected.gpkg parcels_projected.gpkg --operation distance
|
|
176
|
+
python -m terraproof check parcels_geographic.gpkg --operation buffer
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
`crs.defined` checks presence, not whether the label is true. `crs.consistent`
|
|
180
|
+
compares multiple positional datasets with the first; it does not reproject them.
|
|
181
|
+
`crs.metric_operation` fails for a geographic or geocentric CRS with the declared
|
|
182
|
+
operation. It passes only a projected horizontal CRS (including a compound CRS whose
|
|
183
|
+
horizontal part is projected) in metre- **or foot-based** units, and warns when the
|
|
184
|
+
units cannot be confirmed. The last command
|
|
185
|
+
is an intentional negative preflight, not a recipe for a geographic buffer.
|
|
186
|
+
|
|
187
|
+
Projection distortion, unit conversion in your arithmetic, axis order, control
|
|
188
|
+
point accuracy, grid availability, datum/epoch correctness, antimeridian handling,
|
|
189
|
+
and geodesic algorithms are **not checked automatically yet**. A pass is not a
|
|
190
|
+
survey-accuracy claim. See [verification](../verification/SKILL.md).
|
|
191
|
+
|
|
192
|
+
## Sources
|
|
193
|
+
|
|
194
|
+
- [S1 — PROJ UTM](https://proj.org/en/stable/operations/projections/utm.html): conformal classification, 60 zones, generally 6-degree width.
|
|
195
|
+
- [S2 — PROJ Albers](https://proj.org/en/stable/operations/projections/aea.html), [Lambert azimuthal equal-area](https://proj.org/en/stable/operations/projections/laea.html), and [Lambert conformal conic](https://proj.org/en/stable/operations/projections/lcc.html): projection properties.
|
|
196
|
+
- [S3 — PROJ FAQ](https://proj.org/en/stable/faq.html): EPSG:4326 latitude/longitude axes, CRS lookup, WKT and authority definitions.
|
|
197
|
+
- [S4 — RFC 7946](https://www.rfc-editor.org/rfc/rfc7946): sections 3.1.1, 3.1.9, 4 and 5 cover coordinate order, degrees, antimeridian and poles.
|
|
198
|
+
- [S5 — pyproj advanced examples](https://pyproj4.github.io/pyproj/stable/advanced_examples.html): TransformerGroup, missing grids and AOI selection.
|
|
199
|
+
- [S6 — pyproj Geod](https://pyproj4.github.io/pyproj/stable/api/geod.html): ellipsoidal distance/area and signed ring areas.
|
|
200
|
+
- [GeoPandas projections](https://geopandas.org/en/stable/docs/user_guide/projections.html): CRS assignment versus transformation and geographic boundary limitations.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Attribution
|
|
2
|
+
|
|
3
|
+
Terraproof native — no upstream source.
|
|
4
|
+
|
|
5
|
+
Authored for Terraproof by Geova. License: MIT; see the [project license](../../LICENSE).
|
|
6
|
+
Primary technical references are listed in [SKILL.md](SKILL.md#sources).
|
|
7
|
+
No upstream skill text or code was copied or adapted.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "crs-and-units",
|
|
3
|
+
"layer": "domain",
|
|
4
|
+
"domains": [
|
|
5
|
+
"geospatial"
|
|
6
|
+
],
|
|
7
|
+
"capabilities": [
|
|
8
|
+
"coordinate-reference-systems",
|
|
9
|
+
"datum-transformation",
|
|
10
|
+
"axis-order",
|
|
11
|
+
"measurement-units"
|
|
12
|
+
],
|
|
13
|
+
"triggers": [
|
|
14
|
+
"coordinate reference system",
|
|
15
|
+
"datum transformation",
|
|
16
|
+
"axis order",
|
|
17
|
+
"utm zone",
|
|
18
|
+
"equal-area projection",
|
|
19
|
+
"measurement crs",
|
|
20
|
+
"nad83",
|
|
21
|
+
"wgs 84"
|
|
22
|
+
],
|
|
23
|
+
"recommended": [],
|
|
24
|
+
"requires": [],
|
|
25
|
+
"conflicts": [],
|
|
26
|
+
"explanation": "Chooses and verifies coordinate reference systems, axis order, datum transformations, and measurement units before distance, area, buffer, or reprojection work.",
|
|
27
|
+
"sections": [
|
|
28
|
+
{
|
|
29
|
+
"id": "choose-a-measurement-crs",
|
|
30
|
+
"title": "Choose a measurement CRS",
|
|
31
|
+
"source": "SKILL.md#choose-a-measurement-crs"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "look-up-epsg-definitions-and-units",
|
|
35
|
+
"title": "Look up EPSG definitions and units",
|
|
36
|
+
"source": "SKILL.md#look-up-epsg-definitions-and-units"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "resolve-axis-order-explicitly",
|
|
40
|
+
"title": "Resolve axis order explicitly",
|
|
41
|
+
"source": "SKILL.md#resolve-axis-order-explicitly"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "inspect-datum-transformations-and-grids",
|
|
45
|
+
"title": "Inspect datum transformations and grids",
|
|
46
|
+
"source": "SKILL.md#inspect-datum-transformations-and-grids"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "compute-area-length-and-buffers-with-honest-units",
|
|
50
|
+
"title": "Compute area, length, and buffers with honest units",
|
|
51
|
+
"source": "SKILL.md#compute-area-length-and-buffers-with-honest-units"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"id": "handle-antimeridian-and-polar-data",
|
|
55
|
+
"title": "Handle antimeridian and polar data",
|
|
56
|
+
"source": "SKILL.md#handle-antimeridian-and-polar-data"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "verify-with-terraproof",
|
|
60
|
+
"title": "Verify with Terraproof",
|
|
61
|
+
"source": "SKILL.md#verify-with-terraproof"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"id": "sources",
|
|
65
|
+
"title": "Sources",
|
|
66
|
+
"source": "SKILL.md#sources"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"checks": [
|
|
70
|
+
"crs.defined",
|
|
71
|
+
"crs.consistent",
|
|
72
|
+
"crs.metric_operation"
|
|
73
|
+
]
|
|
74
|
+
}
|