cursedops 0.2.3 → 0.2.4
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/README.md +6 -1
- package/package.json +1 -1
- package/src/apiFloor.ts +13 -4
package/README.md
CHANGED
|
@@ -156,7 +156,7 @@ const floor = (c) => {
|
|
|
156
156
|
if (canonicalApiPath(urlPath) !== null) return app.fetch(canonicalApiRequest(c.req.raw));
|
|
157
157
|
return Response.json(apiNotFoundBody(c.req.method, urlPath, "myapp", commit), { status: 404 });
|
|
158
158
|
};
|
|
159
|
-
app.all(API_PREFIX, floor);
|
|
159
|
+
app.all(API_PREFIX, floor);
|
|
160
160
|
app.all(`${API_PREFIX}/*`, floor);
|
|
161
161
|
```
|
|
162
162
|
|
|
@@ -173,6 +173,11 @@ drives `app.fetch` — and a wrap installed at one of them is absent from the re
|
|
|
173
173
|
the exact fault the previous generation's artifact shipped for six days with a green
|
|
174
174
|
harness.
|
|
175
175
|
|
|
176
|
+
Both patterns are registered although `"/api/*"` alone already matches a bare `/api` on
|
|
177
|
+
hono@4.13.7 (measured 2026-09-18) — that is an undocumented property of one matcher
|
|
178
|
+
version, and one extra route registration is cheaper than a floor with a hole in it the
|
|
179
|
+
day it tightens.
|
|
180
|
+
|
|
176
181
|
No `node:` import, no `Bun.` global, no `process` — asserted by `apiFloor.test.ts`, not
|
|
177
182
|
by this paragraph — so it mounts unchanged inside a Cloudflare Worker, which is where
|
|
178
183
|
`patterns` mounts it. `apiNotFoundBody` is the DEFAULT body and not the only one: an app
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cursedops",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "The build-and-ops answers this generation's apps wrote independently and identically: finding a generation's roots without knowing a path, macOS launchd agent install/replace/remove, the scaffolding of a deployed smoke, and the static-serving helpers eight apps copied — the path-traversal guard among them — and the API floor that keeps an unmatched /api/... from ever being answered with the app shell. Mechanism only — no app knows its name from here. Bun, zero dependencies, ships source.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
package/src/apiFloor.ts
CHANGED
|
@@ -50,10 +50,19 @@ export const API_PREFIX = "/api";
|
|
|
50
50
|
/**
|
|
51
51
|
* Is this path inside the API namespace? `/api` itself counts; `/apiary` does not.
|
|
52
52
|
*
|
|
53
|
-
* 🔴
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
53
|
+
* 🔴 `/apiary` and `/api-docs` are the cases a `startsWith("/api")` gets wrong, and they
|
|
54
|
+
* are page URLs — a floor that swallowed them would answer JSON where the client expects
|
|
55
|
+
* its own route. The namespace ITSELF counting is the other half: a caller that types
|
|
56
|
+
* `/api` by hand is inside it.
|
|
57
|
+
*
|
|
58
|
+
* 🔴 **This does NOT mirror what Hono's router does, and the difference is the reason to
|
|
59
|
+
* register both patterns.** Measured 2026-09-18 against hono@4.13.7: `app.all("/api/*")`
|
|
60
|
+
* already matches a bare `/api` — the `*` matches zero segments including the slash in
|
|
61
|
+
* front of it. So `app.all(API_PREFIX, floor)` is redundant TODAY. It is in the wiring
|
|
62
|
+
* anyway because that is an undocumented property of one matcher version, it costs one
|
|
63
|
+
* route registration, and the alternative is a floor with a hole in it the day the
|
|
64
|
+
* matcher tightens. What proves the rule is each app's spec asking for `/api` and
|
|
65
|
+
* getting the phrase — never this arithmetic.
|
|
57
66
|
*/
|
|
58
67
|
export const isApiPath = (urlPath: string): boolean =>
|
|
59
68
|
urlPath === API_PREFIX || urlPath.startsWith(`${API_PREFIX}/`);
|