@arbol-ai/maximus 7.4.0 → 8.0.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.
Files changed (135) hide show
  1. package/README.md +36 -38
  2. package/bin/maximus.js +4 -0
  3. package/config/oxfmt.mjs +1 -0
  4. package/config/oxlint.mjs +10 -0
  5. package/dist/analytics/analytics.d.ts +21 -9
  6. package/dist/analytics/analytics.js +19 -5
  7. package/dist/body.d.ts +1 -1
  8. package/dist/body.js +2 -2
  9. package/dist/chunks/agent-skills-Ef65jTf_.js +49 -0
  10. package/dist/chunks/agent-skills-m7y1EUch.js +3 -0
  11. package/dist/chunks/{body-6LichrQm.js → body-DOIHwIIl.js} +14 -7
  12. package/dist/chunks/{correlation-BEkcFFGT.js → correlation-4b23a-a4.js} +8 -5
  13. package/dist/chunks/define-app-CfVZBt7D.js +336 -0
  14. package/dist/chunks/{errors-D7zG9kx9.js → errors-WfyKhiyk.js} +9 -4
  15. package/dist/chunks/{execution-kVUJPy1A.js → execution-CfZEx_JP.js} +28 -15
  16. package/dist/chunks/generate-C-9FKW0o.js +197 -0
  17. package/dist/chunks/handler-DWTGoduQ.js +140 -0
  18. package/dist/chunks/http-layout-_h7xwgPC.js +128 -0
  19. package/dist/chunks/{http-paths-yKD6TSNJ.js → http-paths-DMBxwpp6.js} +50 -31
  20. package/dist/chunks/{json-Bu4BLT25.js → json-B14evE6-.js} +21 -5
  21. package/dist/chunks/names-ncD7A3DV.js +280 -0
  22. package/dist/chunks/openapi-CV0KmJpS.js +1588 -0
  23. package/dist/chunks/openapi-file-OjSs9mRv.js +83 -0
  24. package/dist/chunks/pages-DyC0m8Zb.js +14 -0
  25. package/dist/chunks/prepare-configured-BmRJLg6J.js +3 -0
  26. package/dist/chunks/prepare-configured-Cithjf80.js +52 -0
  27. package/dist/chunks/project-files-C0OX7MQQ.js +130 -0
  28. package/dist/chunks/query-kind-CWKAXEME.js +40 -0
  29. package/dist/chunks/record-DQUDTpEA.js +10 -0
  30. package/dist/chunks/result-CKgZHrnj.js +56 -0
  31. package/dist/chunks/{runtime-DlqA7J38.js → runtime-CVVf5hmp.js} +50 -26
  32. package/dist/chunks/scaffold-DGrcjR3h.js +3 -0
  33. package/dist/chunks/scaffold-DZD6dfoZ.js +138 -0
  34. package/dist/chunks/{schemas-CzTvbXb6.js → schemas-p_aRcMC1.js} +30 -14
  35. package/dist/chunks/server-CCc7fil4.js +410 -0
  36. package/dist/chunks/src--HZrH1U9.js +568 -0
  37. package/dist/chunks/{telemetry-BTwB68m5.js → telemetry-C3LfZcOB.js} +32 -11
  38. package/dist/chunks/{types-DQdfRF3f.d.ts → types-BQYB4Ads.d.ts} +993 -341
  39. package/dist/chunks/{validation-r-sgmsqb.js → validation-fTohBT6R.js} +69 -28
  40. package/dist/chunks/workers-types-iONp32T4.d.ts +143 -0
  41. package/dist/chunks/yaml-Dk2L24yQ.js +74 -0
  42. package/dist/diagnostics.d.ts +6 -4
  43. package/dist/diagnostics.js +2 -2
  44. package/dist/errors.d.ts +2 -2
  45. package/dist/errors.js +2 -2
  46. package/dist/http-paths.d.ts +1 -1
  47. package/dist/http-paths.js +1 -1
  48. package/dist/index.d.ts +2 -2
  49. package/dist/index.js +12 -11
  50. package/dist/internals.d.ts +1 -1
  51. package/dist/internals.js +5 -4
  52. package/dist/mcp/index.d.ts +3 -2
  53. package/dist/mcp/index.js +5 -387
  54. package/dist/postgres/index.d.ts +25 -8
  55. package/dist/postgres/index.js +17 -8
  56. package/dist/project/config.d.ts +110 -72
  57. package/dist/project/config.js +161 -45
  58. package/dist/project/index.d.ts +17 -4
  59. package/dist/project/index.js +44 -9
  60. package/dist/projection.d.ts +14 -13
  61. package/dist/projection.js +8 -32
  62. package/dist/schemas.d.ts +1 -1
  63. package/dist/schemas.js +2 -2
  64. package/dist/standard-failures.d.ts +2 -89
  65. package/dist/tooling/cli.js +149 -105
  66. package/dist/tooling/testing.js +2 -2
  67. package/dist/vite/cloudflare-workers.js +25 -0
  68. package/dist/vite/index.d.ts +157 -0
  69. package/dist/vite/index.js +1477 -0
  70. package/dist/webhooks.d.ts +12 -10
  71. package/dist/webhooks.js +26 -12
  72. package/dist/workers/runtime.d.ts +1 -1
  73. package/dist/workers/runtime.js +1 -1
  74. package/package.json +26 -22
  75. package/skills/maximus/SKILL.md +165 -68
  76. package/skills/maximus/references/deploying.md +73 -0
  77. package/skills/maximus/references/errors-and-results.md +114 -55
  78. package/skills/maximus/references/project.md +202 -0
  79. package/skills/maximus/references/routes-and-tools.md +256 -0
  80. package/skills/maximus/references/testing.md +137 -50
  81. package/skills/maximus/references/transports.md +113 -100
  82. package/skills/maximus/references/writing-code.md +84 -0
  83. package/templates/mcp/mcp/instructions.md.template +2 -0
  84. package/templates/mcp/routes/v1/greeting.get.ts.template +12 -0
  85. package/templates/mcp/tests/mcp.test.ts.template +36 -0
  86. package/templates/project/.agents/skills/project/SKILL.md.template +21 -12
  87. package/templates/project/.github/workflows/ci.yml.template +4 -1
  88. package/templates/project/CLAUDE.md.template +41 -25
  89. package/templates/project/README.md.template +54 -48
  90. package/templates/project/middleware/10-response.ts.template +5 -2
  91. package/templates/project/package.json.template +13 -9
  92. package/templates/project/pages/index.ts.template +2 -4
  93. package/templates/project/routes/v1/greeting.get.ts.template +10 -0
  94. package/templates/project/routes/v1/greeting.post.ts.template +12 -0
  95. package/templates/project/tests/greeting.test.ts.template +45 -0
  96. package/templates/project/tsconfig.json.template +8 -6
  97. package/templates/project/vite.config.ts.template +15 -7
  98. package/templates/web/app/main.tsx.template +16 -0
  99. package/templates/web/app/root.tsx.template +17 -0
  100. package/templates/web/app/routes/index.tsx.template +9 -0
  101. package/templates/web/index.html.template +12 -0
  102. package/templates/web/package.json.template +12 -0
  103. package/templates/web/tsconfig.json.template +7 -0
  104. package/templates/web/vite.config.ts.template +22 -0
  105. package/dist/chunks/builder-BiXv7d2v.js +0 -100
  106. package/dist/chunks/define-app-DvD_1jUE.js +0 -625
  107. package/dist/chunks/prepare-project-CMyGSEtI.js +0 -236
  108. package/dist/chunks/prepare-project-MtS0-W_n.js +0 -3
  109. package/dist/chunks/record-DY-lX9w1.js +0 -34
  110. package/dist/chunks/src-N3oyx5QF.js +0 -1091
  111. package/dist/client/client.d.ts +0 -129
  112. package/dist/client/client.js +0 -321
  113. package/dist/tooling/vite.d.ts +0 -3
  114. package/dist/tooling/vite.js +0 -57
  115. package/skills/maximus/references/adding-an-operation.md +0 -179
  116. package/skills/maximus/references/building-a-service.md +0 -167
  117. package/skills/maximus/references/migration-from-v2.md +0 -62
  118. package/skills/maximus/references/migration-to-v5.md +0 -37
  119. package/skills/maximus/references/publishing-and-verification.md +0 -42
  120. package/templates/project/cloudflare.config.ts.template +0 -24
  121. package/templates/project/maximus.config.ts.template +0 -20
  122. package/templates/project/routes/v1/greeting.ts.template +0 -38
  123. package/templates/service/.agents/skills/project/SKILL.md.template +0 -10
  124. package/templates/service/.github/workflows/ci.yml.template +0 -21
  125. package/templates/service/.gitignore.template +0 -9
  126. package/templates/service/CLAUDE.md.template +0 -5
  127. package/templates/service/README.md.template +0 -45
  128. package/templates/service/cloudflare.config.ts.template +0 -30
  129. package/templates/service/package.json.template +0 -36
  130. package/templates/service/src/app.ts.template +0 -30
  131. package/templates/service/src/index.ts.template +0 -13
  132. package/templates/service/tests/contract.test.ts.template +0 -12
  133. package/templates/service/tsconfig.json.template +0 -16
  134. package/templates/service/vite.config.ts.template +0 -13
  135. package/templates/service/vitest.config.ts.template +0 -10
@@ -1,45 +0,0 @@
1
- # `__PROJECT_NAME__`
2
-
3
- A [Maximus](https://github.com/getarbol/maximus) service on Cloudflare Workers. It
4
- declares each operation once and serves it over HTTP with its OpenAPI document, and, when an
5
- operation asks for them, as an MCP tool and a Worker RPC method.
6
-
7
- ## Before the first deployment
8
-
9
- `src/app.ts` uses placeholders: set `origin` to the service's public HTTPS origin, `tokens.audience`
10
- to the audience its access tokens carry and `tokens.issuer` to the authorization server that issues
11
- them. The starter declares no operation, so it serves only its discovery documents and `/health`.
12
-
13
- ## Run it locally
14
-
15
- `bun run dev` serves the Worker on `localhost` with `vp dev`. `maximus init` wrote a random development
16
- token to `.dev.vars`, which Git ignores and `cloudflare.config.ts` declares for `vp dev` alone, so no
17
- deployed build carries it. From `localhost` it is a developer holding every scope the service declares:
18
-
19
- ```sh
20
- TOKEN=$(sed 's/^DEVELOPMENT_TOKEN=//' .dev.vars)
21
- curl -H "authorization: Bearer $TOKEN" http://localhost:5173/v1/<your operation's route>
22
- ```
23
-
24
- ## Commands
25
-
26
- | Command | Runs |
27
- | ------------------------------- | -------------------------------------------------------------------------------------------- |
28
- | `bun install` | Installs the dependencies. |
29
- | `bun run dev` | The Worker locally, with `vp dev`. |
30
- | `bun run typecheck` | Generates the binding and runtime types with `cf workers types`, then TypeScript. |
31
- | `bun run check` / `bun run fix` | Vite+ lint and format with the Maximus presets. |
32
- | `bun run test` | The tests, in the Workers runtime. |
33
- | `bun run build` | `vp build`, which writes the build `cf deploy` uploads. |
34
- | `bun run verify` | Type generation, TypeScript, Vite+ lint/format and build; no tests. |
35
- | `bun run deploy` | `verify`, then deploys that same build with `cf deploy`. Sign in with `cf auth login` first. |
36
-
37
- ## Layout
38
-
39
- - `src/app.ts`: the application. Declare operations in resource modules
40
- (`src/api/<resource>/operations.ts`) that build on `base`, and mount each module here once.
41
- - `src/index.ts`: the Worker: its default export serves HTTP, and the named entrypoint serves RPC.
42
- - `tests/`: the contract smoke and the tests for what is specific to this service.
43
-
44
- Use synthetic data in tests, give previews their own resources and never point CI at production.
45
- Keep credentials and provider evidence out of the repository (`.private/` is ignored).
@@ -1,30 +0,0 @@
1
- /**
2
- * The Worker as `cf` develops, builds and deploys it: its name, runtime, entrypoint and bindings.
3
- */
4
- import { bindings, defineConfig } from 'cf/config';
5
-
6
- import * as entrypoint from './src/index.ts' with { type: 'cf-worker' };
7
-
8
- export default defineConfig(({ mode }) => ({
9
- worker: {
10
- name: '__PROJECT_NAME__',
11
- compatibilityDate: '2026-10-12',
12
- // Maximus keeps per-invocation diagnostics in AsyncLocalStorage (node:async_hooks).
13
- compatibilityFlags: ['nodejs_compat'],
14
- entrypoint,
15
- // A workers.dev URL or a preview URL would be one more origin for the same Worker.
16
- workersDev: false,
17
- previewUrls: false,
18
- observability: {
19
- enabled: true,
20
- redactQueryString: true,
21
- logs: { enabled: true, invocationLogs: true },
22
- traces: { enabled: true },
23
- },
24
- env: {
25
- // The development token `maximus init` wrote to .dev.vars, declared for `cf dev` alone: no build that
26
- // is deployed carries it.
27
- DEVELOPMENT_TOKEN: mode === 'development' && bindings.secret(),
28
- },
29
- },
30
- }));
@@ -1,36 +0,0 @@
1
- {
2
- "name": "__PROJECT_NAME__",
3
- "private": true,
4
- "type": "module",
5
- "scripts": {
6
- "dev": "vp dev",
7
- "typecheck": "cf workers types && tsc",
8
- "check": "vp check",
9
- "fix": "vp check --fix",
10
- "test": "vp test run",
11
- "build": "vp build",
12
- "verify": "bun run typecheck && bun run check && bun run build",
13
- "deploy": "bun run verify && cf deploy --prebuilt --mode production"
14
- },
15
- "dependencies": {
16
- "@arbol-ai/maximus": "__MAXIMUS_VERSION__"
17
- },
18
- "devDependencies": {
19
- "@cloudflare/vite-plugin": "^2.0.0-beta.v.1",
20
- "@cloudflare/vitest-plugin": "^1.4.4",
21
- "@types/node": "^26.6.5",
22
- "cf": "^1.0.0-beta.18",
23
- "oxfmt": "0.74.0",
24
- "oxlint": "1.89.0",
25
- "typescript": "^7.0.2",
26
- "ultracite": "^8.0.1",
27
- "vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
28
- "vite-plus": "1.4.0",
29
- "vitest": "^5.0.5"
30
- },
31
- "overrides": {
32
- "vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
33
- "vitest": "5.0.5"
34
- },
35
- "packageManager": "bun@1.4.3"
36
- }
@@ -1,30 +0,0 @@
1
- /**
2
- * The service's application: its configuration, its error catalog and, as you add them, its operations.
3
- */
4
- import { defineErrors, maximus } from '@arbol-ai/maximus';
5
-
6
- /**
7
- * The service's one application. Set its public origin, the OAuth audience its tokens are issued for
8
- * and the authorization server that issues them before the first deployment.
9
- */
10
- export const base = maximus<Env>({
11
- name: '__PROJECT_NAME__',
12
- namespace: '__PROJECT_NAME__',
13
- title: '__PROJECT_NAME__',
14
- version: '0.1.0',
15
- origin: 'https://__PROJECT_NAME__.example.com',
16
- tokens: {
17
- audience: 'https://__PROJECT_NAME__.example.com',
18
- issuer: 'https://auth.example.com/',
19
- // From localhost only: the token `maximus init` wrote to `.dev.vars`, for `cf dev`.
20
- development: { binding: 'DEVELOPMENT_TOKEN' },
21
- },
22
- errors: defineErrors({}),
23
- rpc: { callers: [] },
24
- });
25
-
26
- /**
27
- * The checked application. Chain operations on `base`, or mount resource modules built on it, before
28
- * `.build()`.
29
- */
30
- export const app = base.build();
@@ -1,13 +0,0 @@
1
- /**
2
- * The service's Worker: its fetch handler and its RPC entrypoint.
3
- */
4
- import { createWorker } from '@arbol-ai/maximus/workers';
5
-
6
- import { app } from './app';
7
-
8
- /** The application as a Worker. */
9
- const worker = createWorker(app);
10
-
11
- /** The named RPC entrypoint other Workers bind to; its methods are the operations that declare `rpc`. */
12
- export const __ENTRYPOINT__ = worker.entrypoint;
13
- export default worker.handler;
@@ -1,12 +0,0 @@
1
- /**
2
- * The service's contract smoke test, against the Worker in workerd.
3
- */
4
- import { verifyContract } from '@arbol-ai/maximus/testing';
5
- import { exports } from 'cloudflare:workers';
6
- import { expect, it } from 'vite-plus/test';
7
-
8
- it('publishes one runtime contract', async () => {
9
- const contract = await verifyContract((request) => exports.default.fetch(request), 'https://example.test');
10
- // A new service publishes no paths yet; list them here as you add operations.
11
- expect(contract.paths).toEqual([]);
12
- });
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2024",
4
- "lib": ["ES2024"],
5
- "module": "preserve",
6
- "moduleResolution": "bundler",
7
- "types": ["node"],
8
- "strict": true,
9
- "noEmit": true,
10
- "allowImportingTsExtensions": true,
11
- "isolatedModules": true,
12
- "verbatimModuleSyntax": true,
13
- "skipLibCheck": true
14
- },
15
- "include": ["src", "tests", "cloudflare.config.ts", ".cloudflare/types"]
16
- }
@@ -1,13 +0,0 @@
1
- import fmt from '@arbol-ai/maximus/oxfmt';
2
- import lint from '@arbol-ai/maximus/oxlint';
3
- /**
4
- * The build `cf` runs: Cloudflare's Vite plugin bundles the Worker and, under `cf dev`, runs it in workerd.
5
- */
6
- import { cloudflare } from '@cloudflare/vite-plugin';
7
- import { defineConfig } from 'vite-plus';
8
-
9
- export default defineConfig({
10
- lint: { ...lint, options: { typeAware: false } },
11
- fmt,
12
- plugins: [cloudflare()],
13
- });
@@ -1,10 +0,0 @@
1
- /**
2
- * The tests run in workerd, with the Worker and the bindings cloudflare.config.ts declares.
3
- */
4
- import { cloudflareTest } from '@cloudflare/vitest-plugin';
5
- import { defineConfig } from 'vite-plus/test/config';
6
-
7
- export default defineConfig({
8
- plugins: [cloudflareTest({ remoteBindings: false, experimental: { newConfig: true } })],
9
- test: { include: ['tests/**/*.test.ts'] },
10
- });