@lantharos/pult 0.0.0-stage → 0.9.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lantharos
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,86 @@
1
- # Temporary Holding Version
1
+ # @lantharos/pult
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The other side of your app. Describe your inboxes, resources, actions, pages and flags in code next to your app, and Pult turns them into a console your team runs the product from. Every action runs back inside your app.
4
+
5
+ ```bash
6
+ bun add @lantharos/pult
7
+ ```
8
+
9
+ Then run `bunx pult init` to set up a config, a first resource and inbox, and the client. Everything is imported from `"@lantharos/pult"`, and the package also gives you the `pult` command.
10
+
11
+ Resources are the records your team looks up and acts on, and flags can target them:
12
+
13
+ ```ts
14
+ // src/users/user.pult.ts
15
+ import { b, flag, resource } from "@lantharos/pult"
16
+ import { z } from "zod"
17
+
18
+ export const user = resource("user", {
19
+ get: (id) => db.user.byId(id),
20
+ find: (query) => db.user.search(query),
21
+ title: (u) => u.username,
22
+ render: (u) => [b.fields({ email: b.sensitive(u.email), plan: u.plan })],
23
+ actions: (action) => ({
24
+ ban: action({
25
+ input: z.object({ reason: z.string().min(3) }),
26
+ when: (u) => u.banned === null,
27
+ danger: "reauth",
28
+ run: ({ record, input }) => banUser(record.id, input.reason),
29
+ }),
30
+ }),
31
+ })
32
+
33
+ export const newEditor = flag("new-editor", { target: user })
34
+ ```
35
+
36
+ Inboxes collect what needs a look, each item linked to the record it's about:
37
+
38
+ ```ts
39
+ // src/users/reports.pult.ts
40
+ import { b, inbox } from "@lantharos/pult"
41
+ import { z } from "zod"
42
+ import { user } from "./user.pult"
43
+
44
+ export const reports = inbox("reports", {
45
+ resource: user,
46
+ data: z.object({ reason: z.string(), body: z.string() }),
47
+ title: (data) => data.reason,
48
+ render: (item) => [b.markdown(item.data.body), b.actions("ban")],
49
+ })
50
+ ```
51
+
52
+ Your app sends items as things happen and reads flags where it needs them:
53
+
54
+ ```ts
55
+ // src/pult.ts
56
+ import { createPult } from "@lantharos/pult"
57
+ import project from "../.pult"
58
+ import { reports } from "./users/reports.pult"
59
+ import { newEditor } from "./users/user.pult"
60
+
61
+ export const pult = createPult({ project })
62
+ pult.listen()
63
+
64
+ export async function report(userId: string, reason: string, body: string) {
65
+ await pult.send(reports, { record: userId, fingerprint: userId, data: { reason, body } })
66
+ }
67
+
68
+ export const editorFor = (userId: string) => pult.flag(newEditor, userId)
69
+ ```
70
+
71
+ On Cloudflare Workers, set `delivery: { mode: "webhook", path: "/pult" }` in `pult.config.ts` and hand those requests to `pult.handler()` instead of calling `listen()`.
72
+
73
+ The `pult` command sets up, builds, checks and deploys your definitions:
74
+
75
+ - `pult init` writes a config, a first resource and inbox, and the client.
76
+ - `pult build` compiles your definitions into `.pult/`. Commit it.
77
+ - `pult check` catches broken references and stale builds. Run it in CI.
78
+ - `pult diff` shows what a deploy would change, including who gains which permission.
79
+ - `pult deploy` pushes your definitions to the environment behind `PULT_KEY`.
80
+ - `pult dev` rebuilds on every change.
81
+
82
+ Everything else is in the [docs](https://docs.pult.sh).
83
+
84
+ ## License
85
+
86
+ MIT