@jimhoyd/urlcode 0.5.6 → 0.5.9

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.
Files changed (114) hide show
  1. package/.claude/skills/urlcode-authoring/SKILL.md +15 -0
  2. package/.claude/skills/urlcode-operations/SKILL.md +4 -0
  3. package/README.md +24 -14
  4. package/dist/BUILD-MANIFEST.json +51 -50
  5. package/dist/agent-context.js +9 -0
  6. package/dist/agents-guide.js +5 -2
  7. package/dist/assets.js +2 -2
  8. package/dist/authoring.js +3 -58
  9. package/dist/aws.js +21 -4
  10. package/dist/body-schema.js +2 -3
  11. package/dist/capability-query.js +3 -3
  12. package/dist/catalog.js +1 -1
  13. package/dist/cli.js +42 -15
  14. package/dist/cloudflare.js +26 -1
  15. package/dist/config.js +1 -1
  16. package/dist/context.js +6 -6
  17. package/dist/egress.js +1 -1
  18. package/dist/examples.js +2 -2
  19. package/dist/explain.js +4 -6
  20. package/dist/extension-artifacts.js +8 -8
  21. package/dist/extension-transport.js +6 -4
  22. package/dist/function-worker.js +5 -2
  23. package/dist/functions.js +1 -1
  24. package/dist/guest-api.js +22 -15
  25. package/dist/http-policy.js +1 -3
  26. package/dist/http-response.js +61 -10
  27. package/dist/init-with.js +8 -8
  28. package/dist/interchange.js +3 -2
  29. package/dist/logging.js +4 -4
  30. package/dist/match.js +1 -1
  31. package/dist/mcp-authoring.js +1 -2
  32. package/dist/mcp.js +6 -3
  33. package/dist/object-guards.js +17 -0
  34. package/dist/pattern-guard.js +33 -3
  35. package/dist/policies/cache.js +16 -4
  36. package/dist/policies/compression.js +1 -1
  37. package/dist/policies/throttle.js +1 -1
  38. package/dist/policy.js +3 -3
  39. package/dist/prerender.js +1 -2
  40. package/dist/project-dependencies.js +8 -8
  41. package/dist/proxy.js +1 -1
  42. package/dist/readiness.js +16 -17
  43. package/dist/review.js +2 -2
  44. package/dist/route-diff.js +4 -4
  45. package/dist/router.js +1 -1
  46. package/dist/runtime.js +4 -1
  47. package/dist/scaffold.js +1 -1
  48. package/dist/schema-query.js +1 -1
  49. package/dist/server.js +49 -7
  50. package/dist/signals.js +2 -2
  51. package/dist/site.js +2 -2
  52. package/dist/trusted-functions.js +1 -1
  53. package/dist/types/assets.d.ts +3 -2
  54. package/dist/types/authoring.d.ts +3 -6
  55. package/dist/types/body-schema.d.ts +2 -1
  56. package/dist/types/catalog.d.ts +2 -1
  57. package/dist/types/config.d.ts +0 -8
  58. package/dist/types/context.d.ts +3 -1
  59. package/dist/types/egress.d.ts +1 -1
  60. package/dist/types/explain.d.ts +4 -4
  61. package/dist/types/extension-artifacts.d.ts +4 -13
  62. package/dist/types/extension-transport.d.ts +6 -4
  63. package/dist/types/functions.d.ts +1 -1
  64. package/dist/types/http-response.d.ts +7 -3
  65. package/dist/types/init-with.d.ts +3 -9
  66. package/dist/types/logging.d.ts +4 -3
  67. package/dist/types/match.d.ts +2 -1
  68. package/dist/types/object-guards.d.ts +7 -0
  69. package/dist/types/pattern-guard.d.ts +0 -1
  70. package/dist/types/policies/cache.d.ts +4 -3
  71. package/dist/types/policies/compression.d.ts +1 -1
  72. package/dist/types/policies/throttle.d.ts +1 -1
  73. package/dist/types/policy.d.ts +4 -3
  74. package/dist/types/project-dependencies.d.ts +1 -40
  75. package/dist/types/proxy.d.ts +2 -1
  76. package/dist/types/readiness.d.ts +12 -16
  77. package/dist/types/review.d.ts +0 -2
  78. package/dist/types/route-diff.d.ts +4 -3
  79. package/dist/types/router.d.ts +1 -1
  80. package/dist/types/server.d.ts +22 -0
  81. package/dist/types/signals.d.ts +3 -2
  82. package/dist/types/site.d.ts +1 -2
  83. package/dist/types/trusted-functions.d.ts +1 -1
  84. package/dist/types/types.d.ts +17 -11
  85. package/dist/types/vercel.d.ts +1 -0
  86. package/dist/types/verify-deployment.d.ts +1 -1
  87. package/dist/types.js +18 -11
  88. package/dist/vercel.js +12 -3
  89. package/dist/verify-deployment.js +29 -11
  90. package/docs/AI-AUTHORING.md +9 -0
  91. package/docs/FUNCTION-SECURITY.md +4 -0
  92. package/docs/README.md +2 -2
  93. package/docs/TOOLING.md +35 -1
  94. package/examples/assets/Makefile +1 -1
  95. package/examples/compliance/rules.mjs +2 -2
  96. package/llms-full.txt +44 -13
  97. package/llms.txt +9 -2
  98. package/package.json +8 -3
  99. package/skills/urlcode/SKILL.md +6 -6
  100. package/starters/default/.github/workflows/urlcode.yml +2 -1
  101. package/starters/default/AGENTS.md +3 -3
  102. package/starters/default/Makefile +1 -1
  103. package/starters/default/README.md +13 -11
  104. package/starters/default/tests/requests.json +0 -50
  105. package/starters/default/urlcode.yaml +1 -4
  106. package/dist/scripts/operational-drills.js +0 -33
  107. package/starters/default/functions/hello.mjs +0 -3
  108. package/starters/default/middleware/headers.mjs +0 -6
  109. package/starters/default/routes/functions.yaml +0 -20
  110. package/starters/default/routes/marketing/links.yaml +0 -7
  111. package/starters/page/README.md +0 -14
  112. package/starters/page/public/index.html +0 -12
  113. package/starters/page/tests/requests.json +0 -17
  114. package/starters/page/urlcode.yaml +0 -6
@@ -1,56 +1,6 @@
1
1
  [
2
- {
3
- "path": "/hello/Ada",
4
- "status": 200,
5
- "expectBody": "{\"message\":\"Hello, Ada!\"}",
6
- "expectHeaders": {
7
- "x-powered-by": "URLCode",
8
- "cache-control": "no-store",
9
- "x-example-middleware": "active"
10
- }
11
- },
12
- {
13
- "path": "/hello/Ada",
14
- "method": "HEAD",
15
- "status": 200,
16
- "expectBody": "",
17
- "expectHeaders": {
18
- "x-example-middleware": "active"
19
- }
20
- },
21
- {
22
- "path": "/go",
23
- "status": 302,
24
- "expectHeaders": {
25
- "location": "https://example.com/"
26
- }
27
- },
28
- {
29
- "path": "/go",
30
- "method": "POST",
31
- "status": 405,
32
- "expectHeaders": {
33
- "allow": "GET, HEAD"
34
- }
35
- },
36
2
  {
37
3
  "path": "/missing",
38
4
  "status": 404
39
- },
40
- {
41
- "path": "/hello/Ada",
42
- "method": "POST",
43
- "status": 405,
44
- "expectHeaders": {
45
- "allow": "GET, HEAD"
46
- }
47
- },
48
- {
49
- "path": "/hello/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
50
- "status": 400
51
- },
52
- {
53
- "path": "/hello/%ZZ",
54
- "status": 400
55
5
  }
56
6
  ]
@@ -1,7 +1,4 @@
1
1
  # yaml-language-server: $schema=https://raw.githubusercontent.com/jimhoyd-com/urlcode/669632fb4f188f293a0f622847f87ee019c0627f/schemas/urlcode.schema.json
2
- # Organize files however you like; list their paths from this project root.
2
+ # Start with no routes. Add only the files and routes your application needs.
3
3
  version: "1"
4
- includes:
5
- - routes/functions.yaml
6
- - routes/marketing/links.yaml
7
4
  routes: {}
@@ -1,33 +0,0 @@
1
- // Disposable local proof, never a claim about the production deployment.
2
- import assert from 'node:assert/strict';
3
- import {mkdtemp,mkdir,writeFile,rm} from 'node:fs/promises';
4
- import {tmpdir} from 'node:os';
5
- import {join} from 'node:path';
6
- import {startServer} from '../server.js';
7
-
8
-
9
- const seconds=Number(process.env.URLCODE_SOAK_SECONDS||5);
10
- assert(Number.isInteger(seconds)&&seconds>=1&&seconds<=3600,'Soak must be 1–3600 seconds');
11
- const directory=await mkdtemp(join(tmpdir(),'urlcode-drills-')),project=join(directory,'app');
12
- let app ;
13
- try {
14
- await mkdir(project);
15
- const config='version: "1"\nroutes:\n /go:\n redirect: {url: "https://example.com/v1"}\n /function:\n function: {source: f.mjs}\n';
16
- await writeFile(join(project,'urlcode.yaml'),config);
17
- await writeFile(join(project,'f.mjs'),'export default () => new Response("isolated");');
18
- app=await startServer({project,port:0,log:()=>{}});
19
- const server=app;
20
- const get=async(path )=>{const r=await fetch(`http://127.0.0.1:${server.address.port}${path}`,{redirect:'manual'});const body=await r.text();return {status:r.status,location:r.headers.get('location'),body};};
21
- const start=performance.now(),samples =[];let requests=0;
22
- while(performance.now()-start<seconds*1000){
23
- const before=performance.now();const responses=await Promise.all(['/go','/function'].map(get));
24
- assert.deepEqual(responses.map(r=>r.status),[302,200]);assert.equal(responses[1]?.body,'isolated');
25
- samples.push(performance.now()-before);requests+=2;
26
- }
27
- await writeFile(join(project,'urlcode.yaml'),'invalid: configuration');assert.equal(await app.reload(),false);assert.equal((await get('/go')).location,'https://example.com/v1');
28
- await writeFile(join(project,'urlcode.yaml'),config.replace('/v1','/v2'));assert.equal(await app.reload(),true);assert.equal((await get('/go')).location,'https://example.com/v2');
29
- await writeFile(join(project,'urlcode.yaml'),config);assert.equal(await app.reload(),true);assert.equal((await get('/go')).location,'https://example.com/v1');
30
- await app.close();app=undefined;
31
- samples.sort((a,b)=>a-b);
32
- console.log(JSON.stringify({event:'local-operational-proof',seconds,requests,batchP99Ms:samples[Math.floor(samples.length*.99)],rssBytes:process.memoryUsage().rss,checks:['mixed HTTP load','invalid reload preserves last-good','configuration rollback'],deploymentProof:false}));
33
- } finally {await app?.close();await rm(directory,{recursive:true,force:true});}
@@ -1,3 +0,0 @@
1
- export default function hello(request, { args }) {
2
- return Response.json({ message: `Hello, ${args.name}!` });
3
- }
@@ -1,6 +0,0 @@
1
- // Reusable logic around a route: run downstream, then add a response header.
2
- export default async function headers(request, context, next) {
3
- const response = await next();
4
- response.headers.set('x-example-middleware', 'active');
5
- return response;
6
- }
@@ -1,20 +0,0 @@
1
- # yaml-language-server: $schema=https://raw.githubusercontent.com/jimhoyd-com/urlcode/669632fb4f188f293a0f622847f87ee019c0627f/schemas/urlcode.schema.json
2
- # File locations do not change route paths. GET/HEAD are the default methods.
3
- version: "1"
4
- routes:
5
- # Your code runs when this URL is requested.
6
- /hello/{name}:
7
- parameters:
8
- - name: name
9
- in: path
10
- required: true
11
- schema: {type: string, minLength: 1, maxLength: 80}
12
- middleware:
13
- - source: middleware/headers.mjs
14
- function:
15
- source: functions/hello.mjs
16
- args:
17
- name: {from: path, name: name}
18
- response:
19
- headers:
20
- X-Powered-By: URLCode
@@ -1,7 +0,0 @@
1
- # yaml-language-server: $schema=https://raw.githubusercontent.com/jimhoyd-com/urlcode/669632fb4f188f293a0f622847f87ee019c0627f/schemas/urlcode.schema.json
2
- version: "1"
3
- routes:
4
- # A regular redirect needs no custom code.
5
- /go:
6
- redirect:
7
- url: https://example.com
@@ -1,14 +0,0 @@
1
- # Your URLCode page
2
-
3
- The smallest project: one route that serves `public/index.html`.
4
- Created with `urlcode init <dir> --template page`.
5
-
6
- ```sh
7
- urlcode validate --local
8
- urlcode test
9
- urlcode dev # http://127.0.0.1:3000/
10
- ```
11
-
12
- Edit `public/index.html`. Add more pages, a `static` directory, downloads,
13
- redirects or functions as routes in `urlcode.yaml` (see docs/ASSETS.md in the
14
- URLCode repository). Keep `tests/requests.json` in step with the routes.
@@ -1,12 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <title>Hello, URLCode</title>
7
- </head>
8
- <body>
9
- <h1>Hello, URLCode</h1>
10
- <p>This page is served by a page route in urlcode.yaml.</p>
11
- </body>
12
- </html>
@@ -1,17 +0,0 @@
1
- [
2
- {
3
- "path": "/",
4
- "status": 200,
5
- "expectBody": "<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>Hello, URLCode</title>\n</head>\n<body>\n<h1>Hello, URLCode</h1>\n<p>This page is served by a page route in urlcode.yaml.</p>\n</body>\n</html>\n"
6
- },
7
- {
8
- "path": "/",
9
- "method": "HEAD",
10
- "status": 200,
11
- "expectBody": ""
12
- },
13
- {
14
- "path": "/missing",
15
- "status": 404
16
- }
17
- ]
@@ -1,6 +0,0 @@
1
- version: "1"
2
- routes:
3
- /:
4
- description: The home page, served from a file. Add routes beside it as the project grows.
5
- page:
6
- file: public/index.html