mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 16:33:36 +00:00
main
6
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ef2e31ed04 |
Warn that deep links are attacker-triggerable navigations
Any web page can open a custom-scheme URL, and `DeepLinkHandler` turns that into a `navigate()` call — so a route that acts on mount (publishing, following, paying, deleting) is an action any website can fire silently, with no user intent beyond a tap on an unrelated page. The `appUrlOpen` event gives no way to tell a verified universal link from a custom scheme, so the destination has to be treated as attacker-chosen. Document the constraint where it will be read, rather than filtering to `https:` in the component: this skill documents custom schemes as a supported setup, and filtering would silently break them. |
||
|
|
4efc3c7273 |
Modernize ESLint setup to v10 with defineConfig
Replaces the deprecated `tseslint.config(...)` helper with ESLint core's
`defineConfig()` (available since ESLint 9.22, recommended in 10.x) and
upgrades the lint stack to the latest majors:
eslint 9.39 -> 10.2
@eslint/js 10.0 -> 10.0
typescript-eslint 8.0 -> 8.59
eslint-plugin-react-hooks 5.1 -> 7.1
eslint-plugin-react-refresh 0.4 -> 0.5
@html-eslint/{eslint-plugin,parser} 0.41 -> 0.59
globals 15.9 -> 17.5
Config changes:
- Use `defineConfig` + `globalIgnores()` instead of `tseslint.config`.
- Adopt `reactHooks.configs.flat.recommended` (adds React Compiler rules:
purity, refs, set-state-in-effect, etc.).
- Adopt `reactRefresh.configs.vite` (matches the Vite setup exactly).
- Adopt `@html-eslint` `flat/recommended` (adds indent, quotes,
use-baseline, require-closing-tags, etc.).
- Disable `@html-eslint/use-baseline` for the `rel="manifest"` false
positive.
Custom rule fixes for ESLint 10:
- `context.getSourceCode()` -> `context.sourceCode`
- `context.getFilename()` -> `context.filename`
Code fixes for the stricter new presets:
- NostrProvider: lazy-init NPool via `useState(() => new NPool(...))` and
move `ref.current = x` assignments into effects to satisfy the new
`react-hooks/refs` rule.
- useIsMobile: drop the redundant setState-in-effect by initialising
`useState` from the media query synchronously.
- AuthDialog: move `loginRef.current = login` into an effect.
- sidebar.tsx: derive skeleton width from `useId()` instead of
`Math.random()` so the render is pure.
- index.html: reindent to 4 spaces to satisfy `@html-eslint/indent`.
- .agents/skills/**: add `{ cause: err }` to `throw new Error(...)` calls
inside catch blocks (new `preserve-caught-error` rule) and a handful
of targeted `eslint-disable` comments for legitimate external-system
sync / state-reset-on-prop-change patterns.
The six intentional template failures (missing manifest, missing title /
description / OG tags, two FIXME comments) are unchanged -- they're the
template's way of nudging downstream users to fill the site in.
Re: "someday maybe tseslint won't be needed" -- still in the future.
ESLint 10 now loads `eslint.config.ts` natively (via jiti or Node's
`--experimental-strip-types`), but that only parses the config file. For
linting .ts/.tsx source you still need @typescript-eslint/parser and its
rules, which the `typescript-eslint` package bundles together. So the
"typescript" prefix is gone from rule names in practice, but the package
stays.
|
||
|
|
75598c45b1 |
Tighten capacitor skill (434 -> 184 lines)
The skill was the longest in the repo; most of the bulk was narrative duplication of content that already ships in the JSDoc headers of the files users copy in. Material changes: - Drop the per-package bullet list (17 lines of 'what is @capacitor/*') in favor of a single-line pointer to Capacitor's own docs. - Drop the 'Using the APIs' section (~110 lines of Haptics / Download / SecureStorage / useSecureLocalStorage walkthroughs). Each source file has thorough @example blocks in its JSDoc — the skill now shows a short import+call tour and directs readers to the file headers for the rest. - Collapse the three 'Files Provided by This Skill' tables (source / project-root / optional) into one table with inline notes. Same information, a third of the vertical space. - Merge the former ten setup steps into seven: trivial steps like 'run npx cap add/sync/open' are one code block now; removed the cap:sync package.json snippet (a convenience script the user can trivially add themselves). - Shrink the safe-area utilities table to a bulleted highlight list with a link to the plugin README for the full utility surface. - Replace the four standalone safe-area example snippets with a single four-line example block. - Trim troubleshooting to the five most common issues, noting that the remaining edge cases (secureStorage per-bundle-id behavior, custom- theme status-bar sync) are documented in the relevant file headers. No API changes, no Tailwind-v4 regressions — all the instructions from the previous revision are preserved or pushed down into the copied files' JSDoc where they belong. |
||
|
|
924d430310 |
Update capacitor skill for Tailwind v4 safe-area plugin
The previous version pinned tailwindcss-safe-area to 0.8.0 and walked through registering it in a tailwind.config.ts plugins array. mkstack now ships Tailwind v4 with CSS-first config (@import "tailwindcss" in src/index.css, no tailwind.config.ts), and the plugin's v1.x line has switched from a JS plugin entry point to a plain CSS file consumed via @import — using @plugin fails to resolve. Updates: - Install step now pulls the latest tailwindcss-safe-area (1.x) with a note that v3 projects still need 0.8.0 + plugins array. - Step 3 replaces the tailwind.config.ts edit with an @import line in src/index.css, placed after @import "tailwindcss". - Troubleshooting entries for WebView <140 and 'pt-safe does not exist' rewritten to reference the CSS import model. - Utilities table refreshed to match the v4 README (adds border-*-safe, h-svh-safe/h-lvh-safe/h-vh-safe/h-fill-safe, start/end logical variants, and the safe/safe-none enable-disable toggles). - safe-area-shim.css header updated to show the v4 import order (@import "tailwindcss-safe-area"; then @import "./safe-area-shim.css") instead of the old @tailwind utilities directive. |
||
|
|
3866c0a119 |
Use tailwindcss-safe-area plugin in capacitor skill
Replaces the hand-rolled safe-area CSS utilities with the
tailwindcss-safe-area Tailwind plugin (same approach Shakespeare uses),
which gives us a richer utility set plus offset / or variants:
pt-safe, pb-safe, px-safe, p-safe, mt-safe, inset-safe,
top-safe, bottom-safe, h-dvh-safe, min-h-dvh-safe,
pt-safe-offset-4 (safe area + 1rem),
pb-safe-or-8 (max of safe area and 2rem),
scroll-p-safe, border-t-safe, and more.
Critically, the SKILL.md now pins the plugin version per Tailwind
major \u2014 the plugin changed its registration API between 0.x and
1.x to match Tailwind's own v3\u2192v4 transition:
Plugin 0.8.0 \u2192 Tailwind 3.x (add to plugins: array in config)
Plugin >=1.0 \u2192 Tailwind 4.x (@import in main CSS, not @plugin)
mkstack ships Tailwind 3.4.x, so install targets 0.8.0 specifically.
Using @latest on a Tailwind 3 project silently produces no utilities
at all \u2014 documented in both the setup section and troubleshooting.
Also documents the Android WebView <140 caveat: Chromium bug 40699457
causes env(safe-area-inset-*) to return 0. Capacitor's SystemBars
plugin (insetsHandling: 'css', already preset in our capacitor.config.ts
template) works around it by injecting --safe-area-inset-* CSS variables,
but tailwindcss-safe-area uses env() directly and can't see them.
Two fixes:
1. preferred: target WebView 140+ (Aug 2025+, auto-updated on any
active Android >=7 via Play Services)
2. fallback: new files/safe-area-shim.css that redeclares the common
utilities with var(--safe-area-inset-*, env(..., 0px)) so the
SystemBars-injected variables win. Copy to src/ and @import after
@tailwind utilities; if targeting older Android fleets.
Changes:
- Remove files/safe-area.css (hand-rolled utilities)
- Add files/safe-area-shim.css (optional Android <140 override)
- SKILL.md: new step 3 'Register the Tailwind Safe-Area Plugin'
inserted between 'Copy Skill Files' and 'Edit capacitor.config.ts';
subsequent steps renumbered 4\u201310
- SKILL.md: 'Install Dependencies' adds the Tailwind plugin with a
version matrix table and explicit v3-pinning rationale
- SKILL.md: 'Using the APIs \u2192 Safe-area utilities' rewritten with
a real-world usage cheatsheet mapping plugin classes to use cases
- SKILL.md: expanded troubleshooting with three new safe-area
entries (Android env-0 WebView<140, 'pt-safe doesn't exist' =
plugin not registered or wrong major version, iOS missing
viewport-fit=cover)
Validated: full stack staged into src/ + package.json (including
[email protected] and tailwind.config.ts plugins
registration). npm run test passes with only the 6 pre-existing
baseline errors; reverted cleanly.
|
||
|
|
f927a00dcf |
Add capacitor skill for native iOS/Android builds
Provides the cross-platform primitives needed to wrap the mkstack web app as a native iOS and Android binary using Capacitor, modeled on how Ditto integrates the framework. Each helper works unconditionally on every platform \u2014 native builds use the real Capacitor plugin, web falls back to an equivalent browser API: - haptics: impactLight/Medium/Heavy, notificationSuccess/Warning/Error, selectionChanged \u2014 taptic engine on native, navigator.vibrate() on web, silent no-op where neither exists - downloadTextFile / openUrl \u2014 @capacitor/filesystem and native share sheet on native, <a download> and window.open on web - secureStorage + useSecureLocalStorage \u2014 iOS Keychain / Android KeyStore adapter with automatic migration of existing plaintext values from localStorage on first native read, plus an async-aware React hook that exposes a 'ready' flag - DeepLinkHandler \u2014 listens for Capacitor appUrlOpen and forwards into React Router navigation - bootstrapNative() \u2014 hides the iOS keyboard accessory bar and keeps the system-bar icon style in sync with the active CSS theme via MutationObserver on both the <html> class and the theme-vars style element; detects dark background from theme class or computed body luminance - safe-area CSS utilities \u2014 .safe-area-top/-bottom/-left/-right padding classes plus .safe-area-inset-top/-bottom positional variants, preferring --safe-area-inset-* CSS vars (injected by the SystemBars plugin on Android) over env(safe-area-inset-*) so Chromium <140 on Android Just Works - capacitor.config.ts template \u2014 preconfigured with androidScheme https, ios contentInset never, SystemBars insetsHandling css; placeholder appId / appName / scheme ready to be customized - patch-cap-config.mjs \u2014 post-cap-sync hook that restores packageClassList entries for local (non-SPM) native plugin classes so they get registered at startup SKILL.md documents the full setup sequence: install the nine @capacitor/* + capacitor-secure-storage-plugin packages, copy files into src/, paste the CSS snippet into index.css, edit capacitor.config.ts identity fields, add viewport-fit=cover, wire bootstrapNative() into main.tsx and DeepLinkHandler into AppRouter, npx cap add android / ios, build, sync, run. Also covers common follow-ups (custom plugins, icons, splash, push, deep-link verification, credential manager integration) and troubleshooting (safe-area zero on Android, navigation no-op, keychain orphaning, keyboard accessory bar timing, custom theme detection). Validated: all files staged into src/ + deps installed \u2014 npm run test passes with only the 6 pre-existing baseline errors (template FIXMEs + missing index.html manifest/meta), then cleanly reverted. |