bkper 4.29.4 → 4.30.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/README.md +1 -1
- package/lib/commands/apps/deploy.d.ts +24 -3
- package/lib/commands/apps/deploy.d.ts.map +1 -1
- package/lib/commands/apps/deploy.js +41 -25
- package/lib/commands/apps/deploy.js.map +1 -1
- package/lib/commands/apps/git/clone.d.ts +8 -0
- package/lib/commands/apps/git/clone.d.ts.map +1 -1
- package/lib/commands/apps/git/clone.js +20 -31
- package/lib/commands/apps/git/clone.js.map +1 -1
- package/lib/commands/apps/git/credentials.d.ts +2 -1
- package/lib/commands/apps/git/credentials.d.ts.map +1 -1
- package/lib/commands/apps/git/credentials.js +28 -12
- package/lib/commands/apps/git/credentials.js.map +1 -1
- package/lib/commands/apps/git/external-source.d.ts +16 -0
- package/lib/commands/apps/git/external-source.d.ts.map +1 -0
- package/lib/commands/apps/git/external-source.js +113 -0
- package/lib/commands/apps/git/external-source.js.map +1 -0
- package/lib/commands/apps/git/index.d.ts +2 -1
- package/lib/commands/apps/git/index.d.ts.map +1 -1
- package/lib/commands/apps/git/index.js +2 -1
- package/lib/commands/apps/git/index.js.map +1 -1
- package/lib/commands/apps/git/inspect.d.ts.map +1 -1
- package/lib/commands/apps/git/inspect.js +7 -2
- package/lib/commands/apps/git/inspect.js.map +1 -1
- package/lib/commands/apps/git/mode.d.ts +3 -2
- package/lib/commands/apps/git/mode.d.ts.map +1 -1
- package/lib/commands/apps/git/mode.js +5 -6
- package/lib/commands/apps/git/mode.js.map +1 -1
- package/lib/commands/apps/git/preflight.d.ts +8 -3
- package/lib/commands/apps/git/preflight.d.ts.map +1 -1
- package/lib/commands/apps/git/preflight.js +19 -12
- package/lib/commands/apps/git/preflight.js.map +1 -1
- package/lib/commands/apps/git/push.d.ts +6 -1
- package/lib/commands/apps/git/push.d.ts.map +1 -1
- package/lib/commands/apps/git/push.js +50 -40
- package/lib/commands/apps/git/push.js.map +1 -1
- package/lib/commands/apps/git/run-git.d.ts +1 -0
- package/lib/commands/apps/git/run-git.d.ts.map +1 -1
- package/lib/commands/apps/git/run-git.js +1 -1
- package/lib/commands/apps/git/run-git.js.map +1 -1
- package/lib/commands/apps/git/types.d.ts +2 -2
- package/lib/commands/apps/git/types.d.ts.map +1 -1
- package/lib/commands/apps/git/types.js.map +1 -1
- package/lib/commands/apps/register.js +5 -5
- package/lib/commands/apps/register.js.map +1 -1
- package/lib/commands/apps/source-workflow.d.ts +4 -1
- package/lib/commands/apps/source-workflow.d.ts.map +1 -1
- package/lib/commands/apps/source-workflow.js +87 -32
- package/lib/commands/apps/source-workflow.js.map +1 -1
- package/lib/commands/apps/sync.d.ts.map +1 -1
- package/lib/commands/apps/sync.js +1 -0
- package/lib/commands/apps/sync.js.map +1 -1
- package/lib/docs/apps/app-listing.md +3 -3
- package/lib/docs/apps/architecture.md +3 -3
- package/lib/docs/apps/configuration.md +5 -5
- package/lib/docs/apps/context-menu.md +3 -3
- package/lib/docs/apps/deploying.md +10 -8
- package/lib/docs/apps/event-handlers.md +5 -5
- package/lib/docs/apps/first-app.md +12 -12
- package/lib/docs/apps/overview.md +10 -10
- package/lib/docs/apps/quality.md +5 -5
- package/lib/docs/apps/security.md +5 -5
- package/lib/docs/apps/self-hosted.md +4 -4
- package/lib/docs/apps/shared-app-source.md +16 -11
- package/lib/docs/cli/app-management.md +17 -12
- package/lib/docs/core/core-concepts.md +1 -1
- package/lib/docs/sdk/bkper-api-types.md +2 -0
- package/lib/docs/sdk/bkper-js.md +2 -0
- package/package.json +1 -1
|
@@ -6,11 +6,11 @@ Event handlers are the code that reacts to events in your Bkper Books. When a tr
|
|
|
6
6
|
|
|
7
7
|
## How it works
|
|
8
8
|
|
|
9
|
-
1. You declare which events your app handles in [`bkper.yaml`](https://bkper.com/docs/
|
|
9
|
+
1. You declare which events your app handles in [`bkper.yaml`](https://bkper.com/docs/platform/apps/configuration.md)
|
|
10
10
|
2. Bkper sends an HTTP POST to your webhook URL when those events fire
|
|
11
11
|
3. Your handler processes the event and returns a response
|
|
12
12
|
|
|
13
|
-
On the [Bkper Platform](https://bkper.com/docs/
|
|
13
|
+
On the [Bkper Platform](https://bkper.com/docs/platform/apps/overview.md), events are routed to `/events` on your app's single Worker — including local development via tunnels. For [self-hosted](https://bkper.com/docs/platform/apps/self-hosted.md) setups, you configure the webhook URL directly.
|
|
14
14
|
|
|
15
15
|
## Agent identity
|
|
16
16
|
|
|
@@ -99,7 +99,7 @@ Do not read `bkper-oauth-token`, `bkper-agent-id`, or `Authorization` headers in
|
|
|
99
99
|
|
|
100
100
|
> **Note**
|
|
101
101
|
> During local development, events are routed through the Cloudflare tunnel started by `bkper app dev`. Local outbound uses your CLI credentials when the handler calls Bkper.
|
|
102
|
-
For [self-hosted](https://bkper.com/docs/
|
|
102
|
+
For [self-hosted](https://bkper.com/docs/platform/apps/self-hosted.md) setups, the event auth headers are sent to both `webhookUrl` and `webhookUrlDev` and must be handled directly by your infrastructure.
|
|
103
103
|
|
|
104
104
|
## Event routing pattern
|
|
105
105
|
|
|
@@ -197,7 +197,7 @@ The event payload has the following structure:
|
|
|
197
197
|
}
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
The event payload is the same structure exposed by the [REST API](https://bkper.com/docs/
|
|
200
|
+
The event payload is the same structure exposed by the [REST API](https://bkper.com/docs/platform/scripts/rest-api.md). If you use TypeScript, add the [`@bkper/bkper-api-types`](https://www.npmjs.com/package/@bkper/bkper-api-types) package to your project for full type definitions.
|
|
201
201
|
|
|
202
202
|
For update events, `data.previousAttributes` contains the fields that changed and their previous values — useful for computing diffs or reacting only to specific field changes.
|
|
203
203
|
|
|
@@ -212,7 +212,7 @@ events:
|
|
|
212
212
|
- ACCOUNT_CREATED
|
|
213
213
|
```
|
|
214
214
|
|
|
215
|
-
The complete
|
|
215
|
+
The complete API set of event types is listed below. `COMMENT_CREATED` and `COMMENT_DELETED` remain in the API for compatibility with historical Events; Comments are not available in the current Bkper PWA.
|
|
216
216
|
|
|
217
217
|
| Event | Description |
|
|
218
218
|
| --- | --- |
|
|
@@ -4,7 +4,7 @@ This tutorial walks you through building and deploying a Bkper app from scratch.
|
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
7
|
-
[Development Setup](https://bkper.com/docs/
|
|
7
|
+
[Development Setup](https://bkper.com/docs/platform/getting-started/setup.md) — the CLI installed and authenticated.
|
|
8
8
|
|
|
9
9
|
## Walkthrough
|
|
10
10
|
|
|
@@ -15,7 +15,7 @@ This tutorial walks you through building and deploying a Bkper app from scratch.
|
|
|
15
15
|
cd my-app
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
`bkper app init my-app` creates `./my-app` and uses `my-app` as the app id. The CLI sets your package name, URLs, and event-handler loop guards automatically. See [App Configuration](https://bkper.com/docs/
|
|
18
|
+
`bkper app init my-app` creates `./my-app` and uses `my-app` as the app id. The CLI sets your package name, URLs, and event-handler loop guards automatically. See [App Configuration](https://bkper.com/docs/platform/apps/configuration.md) for the full `bkper.yaml` reference.
|
|
19
19
|
|
|
20
20
|
2. **Install and start developing**
|
|
21
21
|
|
|
@@ -24,7 +24,7 @@ This tutorial walks you through building and deploying a Bkper app from scratch.
|
|
|
24
24
|
npm run dev
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
This runs the Vite client dev server and the local Worker runtime with automatic event tunneling. See [Development Experience](https://bkper.com/docs/
|
|
27
|
+
This runs the Vite client dev server and the local Worker runtime with automatic event tunneling. See [Development Experience](https://bkper.com/docs/platform/apps/development.md) for details.
|
|
28
28
|
|
|
29
29
|
3. **Open the app**
|
|
30
30
|
|
|
@@ -32,7 +32,7 @@ This tutorial walks you through building and deploying a Bkper app from scratch.
|
|
|
32
32
|
|
|
33
33
|
4. **Trigger an event**
|
|
34
34
|
|
|
35
|
-
Go to any Bkper book and check a transaction. The event handler creates a 20% draft using the original from and to Accounts. It does not affect balances unless posted. See [Event Handlers](https://bkper.com/docs/
|
|
35
|
+
Go to any Bkper book and check a transaction. The event handler creates a 20% draft using the original from and to Accounts. It does not affect balances unless posted. See [Event Handlers](https://bkper.com/docs/platform/apps/event-handlers.md) for the full event model.
|
|
36
36
|
|
|
37
37
|
5. **Make a change**
|
|
38
38
|
|
|
@@ -40,7 +40,7 @@ This tutorial walks you through building and deploying a Bkper app from scratch.
|
|
|
40
40
|
|
|
41
41
|
6. **Customize your listing**
|
|
42
42
|
|
|
43
|
-
Update `bkper.yaml` with your app's description and owner details. Replace the placeholder logos in `client/public/images/`. See [App Listing](https://bkper.com/docs/
|
|
43
|
+
Update `bkper.yaml` with your app's description and owner details. Replace the placeholder logos in `client/public/images/`. See [App Listing](https://bkper.com/docs/platform/apps/app-listing.md) for publishing details.
|
|
44
44
|
|
|
45
45
|
7. **Update the README**
|
|
46
46
|
|
|
@@ -56,7 +56,7 @@ This tutorial walks you through building and deploying a Bkper app from scratch.
|
|
|
56
56
|
bkper app sync
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
Stored Git source is required before an app can sync or deploy. For this standalone app without an external remote, sync creates the recommended private Bkper-managed source and configures it as `origin`. Authorized teammates and coding agents can then clone the same codebase with `bkper app clone my-app`. See [Shared App Source](https://bkper.com/docs/platform/apps/shared-app-source.md) for access rules and external source workflows.
|
|
60
60
|
|
|
61
61
|
9. **Check and deploy**
|
|
62
62
|
|
|
@@ -65,12 +65,12 @@ This tutorial walks you through building and deploying a Bkper app from scratch.
|
|
|
65
65
|
npm run deploy
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
Deployment is explicit: syncing or pushing source does not deploy the app. Your app is live at `https://my-app.bkper.app`. See [Building & Deploying](https://bkper.com/docs/
|
|
68
|
+
Deployment is explicit: syncing or pushing source does not deploy the app. Your app is live at `https://my-app.bkper.app`. See [Building & Deploying](https://bkper.com/docs/platform/apps/deploying.md) for preview environments, secrets, and KV.
|
|
69
69
|
|
|
70
70
|
## Next steps
|
|
71
71
|
|
|
72
|
-
- [Shared App Source](https://bkper.com/docs/
|
|
73
|
-
- [App Architecture](https://bkper.com/docs/
|
|
74
|
-
- [App Configuration](https://bkper.com/docs/
|
|
75
|
-
- [Event Handlers](https://bkper.com/docs/
|
|
76
|
-
- [Building & Deploying](https://bkper.com/docs/
|
|
72
|
+
- [Shared App Source](https://bkper.com/docs/platform/apps/shared-app-source.md) — Clone and improve one private app codebase together
|
|
73
|
+
- [App Architecture](https://bkper.com/docs/platform/apps/architecture.md) — Understand the single Worker client/server structure
|
|
74
|
+
- [App Configuration](https://bkper.com/docs/platform/apps/configuration.md) — Full `bkper.yaml` reference
|
|
75
|
+
- [Event Handlers](https://bkper.com/docs/platform/apps/event-handlers.md) — All event types and patterns
|
|
76
|
+
- [Building & Deploying](https://bkper.com/docs/platform/apps/deploying.md) — Preview environments and secrets
|
|
@@ -20,20 +20,20 @@ The same Worker can expose app-defined `/api/*` routes. Treat those routes as th
|
|
|
20
20
|
|
|
21
21
|
When an app needs model inference, use Bkper AI by default. An authenticated app API route or event establishes the user and app identity, then platform outbound supplies authorization and usage attribution for the Worker's Bkper AI requests. The app does not need provider credentials.
|
|
22
22
|
|
|
23
|
-
See [Add Bkper AI to an App](https://bkper.com/docs/
|
|
23
|
+
See [Add Bkper AI to an App](https://bkper.com/docs/platform/apps/ai.md) for live model discovery, strict structured output, validation, and the client-to-Worker authentication flow.
|
|
24
24
|
|
|
25
25
|
### Authentication
|
|
26
26
|
|
|
27
27
|
OAuth is pre-configured. No client IDs, no redirect URIs, no consent screens to build.
|
|
28
28
|
|
|
29
|
-
- **Web client** — Use `@bkper/web-auth`: `auth.getAccessToken()`. See [App Architecture → Client authentication](https://bkper.com/docs/
|
|
30
|
-
- **Server API routes** — Send `Authorization: Bearer <token>` to `/api/*`; dispatch validates it and platform outbound injects auth for server-side Bkper API calls. See [App Architecture → Server API authentication](https://bkper.com/docs/
|
|
31
|
-
- **Event handlers** — Handle `/events` in the same Worker and call Bkper with server-side `new Bkper()`; dispatch/outbound handle auth and agent identity. See [Event Handlers → Authentication](https://bkper.com/docs/
|
|
32
|
-
- **Local development** — The Vite auth middleware uses your CLI credentials. See [Development Experience → Local development authentication](https://bkper.com/docs/
|
|
29
|
+
- **Web client** — Use `@bkper/web-auth`: `auth.getAccessToken()`. See [App Architecture → Client authentication](https://bkper.com/docs/platform/apps/architecture.md#client-authentication).
|
|
30
|
+
- **Server API routes** — Send `Authorization: Bearer <token>` to `/api/*`; dispatch validates it and platform outbound injects auth for server-side Bkper API calls. See [App Architecture → Server API authentication](https://bkper.com/docs/platform/apps/architecture.md#server-api-authentication).
|
|
31
|
+
- **Event handlers** — Handle `/events` in the same Worker and call Bkper with server-side `new Bkper()`; dispatch/outbound handle auth and agent identity. See [Event Handlers → Authentication](https://bkper.com/docs/platform/apps/event-handlers.md#authentication).
|
|
32
|
+
- **Local development** — The Vite auth middleware uses your CLI credentials. See [Development Experience → Local development authentication](https://bkper.com/docs/platform/apps/development.md#local-development-authentication).
|
|
33
33
|
|
|
34
34
|
### Services
|
|
35
35
|
|
|
36
|
-
Declare the services you need in [`bkper.yaml`](https://bkper.com/docs/
|
|
36
|
+
Declare the services you need in [`bkper.yaml`](https://bkper.com/docs/platform/apps/configuration.md) and the platform provisions them:
|
|
37
37
|
|
|
38
38
|
- **KV storage** — Key-value storage for caching and state. Access via `c.env.KV` in your handlers.
|
|
39
39
|
- **Secrets** — Securely stored environment variables. Set via `bkper app secrets put`, access via `c.env.SECRET_NAME`.
|
|
@@ -54,7 +54,7 @@ Bkper can host one private codebase for your app. Authorized teammates and codin
|
|
|
54
54
|
|
|
55
55
|
Source synchronization remains separate from deployment. A Git push stores source but never builds or deploys the app.
|
|
56
56
|
|
|
57
|
-
See [Shared App Source](https://bkper.com/docs/
|
|
57
|
+
See [Shared App Source](https://bkper.com/docs/platform/apps/shared-app-source.md) for the collaboration workflow, access rules, and external Git options.
|
|
58
58
|
|
|
59
59
|
### Deployment
|
|
60
60
|
|
|
@@ -101,6 +101,6 @@ This gives you a working app with a client UI, server API routes, and `/events`
|
|
|
101
101
|
|
|
102
102
|
## Next steps
|
|
103
103
|
|
|
104
|
-
- [Your First App](https://bkper.com/docs/
|
|
105
|
-
- [Shared App Source](https://bkper.com/docs/
|
|
106
|
-
- [App Architecture](https://bkper.com/docs/
|
|
104
|
+
- [Your First App](https://bkper.com/docs/platform/apps/first-app.md) — Build and deploy a complete platform app
|
|
105
|
+
- [Shared App Source](https://bkper.com/docs/platform/apps/shared-app-source.md) — Collaborate from one private codebase
|
|
106
|
+
- [App Architecture](https://bkper.com/docs/platform/apps/architecture.md) — Understand how platform apps are structured
|
package/lib/docs/apps/quality.md
CHANGED
|
@@ -66,7 +66,7 @@ Keep the security boundary simple and explicit:
|
|
|
66
66
|
- Access only the Book data needed for the operation.
|
|
67
67
|
- Make event handling safe to retry and prevent event loops.
|
|
68
68
|
|
|
69
|
-
See [App Security](https://bkper.com/docs/
|
|
69
|
+
See [App Security](https://bkper.com/docs/platform/apps/security.md) and [Event Handlers](https://bkper.com/docs/platform/apps/event-handlers.md) for implementation details.
|
|
70
70
|
|
|
71
71
|
## Verification
|
|
72
72
|
|
|
@@ -81,7 +81,7 @@ App reviews should report concrete findings with file locations and suggested fi
|
|
|
81
81
|
|
|
82
82
|
## Next Steps
|
|
83
83
|
|
|
84
|
-
- [App Architecture](https://bkper.com/docs/
|
|
85
|
-
- [App Security](https://bkper.com/docs/
|
|
86
|
-
- [Context Menu](https://bkper.com/docs/
|
|
87
|
-
- [Development Experience](https://bkper.com/docs/
|
|
84
|
+
- [App Architecture](https://bkper.com/docs/platform/apps/architecture.md) — Client, server, API, and event structure.
|
|
85
|
+
- [App Security](https://bkper.com/docs/platform/apps/security.md) — Authentication and authorization boundaries.
|
|
86
|
+
- [Context Menu](https://bkper.com/docs/platform/apps/context-menu.md) — Embedded Book context and open modes.
|
|
87
|
+
- [Development Experience](https://bkper.com/docs/platform/apps/development.md) — Local development and deterministic checks.
|
|
@@ -8,7 +8,7 @@ Authentication identifies the Bkper user making a request. The platform handles
|
|
|
8
8
|
|
|
9
9
|
Authorization determines whether that user may perform a specific operation.
|
|
10
10
|
|
|
11
|
-
See [App Architecture](https://bkper.com/docs/
|
|
11
|
+
See [App Architecture](https://bkper.com/docs/platform/apps/architecture.md) for the client and server authentication flow.
|
|
12
12
|
|
|
13
13
|
## Authorize app operations
|
|
14
14
|
|
|
@@ -68,7 +68,7 @@ if (!isInstalled) {
|
|
|
68
68
|
|
|
69
69
|
## Next Steps
|
|
70
70
|
|
|
71
|
-
- [App Quality Guidelines](https://bkper.com/docs/
|
|
72
|
-
- [App Architecture](https://bkper.com/docs/
|
|
73
|
-
- [Building & Deploying](https://bkper.com/docs/
|
|
74
|
-
- [Event Handlers](https://bkper.com/docs/
|
|
71
|
+
- [App Quality Guidelines](https://bkper.com/docs/platform/apps/quality.md) — Review cross-cutting app quality and security expectations.
|
|
72
|
+
- [App Architecture](https://bkper.com/docs/platform/apps/architecture.md) — Understand client and server authentication flows.
|
|
73
|
+
- [Building & Deploying](https://bkper.com/docs/platform/apps/deploying.md#setting-secrets) — Store production and preview secrets.
|
|
74
|
+
- [Event Handlers](https://bkper.com/docs/platform/apps/event-handlers.md#authentication) — Understand authentication for platform and self-hosted events.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Bkper Self-Hosted Webhooks
|
|
2
2
|
|
|
3
|
-
The [Bkper Platform](https://bkper.com/docs/
|
|
3
|
+
The [Bkper Platform](https://bkper.com/docs/platform/apps/overview.md) handles hosting, authentication, and deployment for you. However, you can host event handlers on your own infrastructure if you have specific requirements — existing cloud setup, compliance constraints, or legacy apps.
|
|
4
4
|
|
|
5
5
|
> **Tip**
|
|
6
6
|
> Use the Bkper Platform unless you have a specific reason to self-host. It eliminates the need to manage authentication, secrets, hosting, and deployment yourself.
|
|
@@ -8,7 +8,7 @@ The [Bkper Platform](https://bkper.com/docs/build/apps/overview.md) handles host
|
|
|
8
8
|
|
|
9
9
|
A Bkper event handler running on [Google Cloud Functions](https://cloud.google.com/functions/) receives authenticated calls from the `bkper-hrd@appspot.gserviceaccount.com` service account. You need to grant this service account the [Cloud Functions Invoker IAM role](https://cloud.google.com/functions/docs/securing/managing-access-iam) (`roles/cloudfunctions.invoker`).
|
|
10
10
|
|
|
11
|
-
Set the production endpoint in [`bkper.yaml`](https://bkper.com/docs/
|
|
11
|
+
Set the production endpoint in [`bkper.yaml`](https://bkper.com/docs/platform/apps/configuration.md):
|
|
12
12
|
|
|
13
13
|
```yaml
|
|
14
14
|
webhookUrl: https://us-central1-my-project.cloudfunctions.net/events
|
|
@@ -32,7 +32,7 @@ The function response must follow the standard format:
|
|
|
32
32
|
{ result?: any, error?: any }
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
See [Event Handlers](https://bkper.com/docs/
|
|
35
|
+
See [Event Handlers](https://bkper.com/docs/platform/apps/event-handlers.md#response-format) for details on response handling.
|
|
36
36
|
|
|
37
37
|
### Considerations
|
|
38
38
|
|
|
@@ -46,7 +46,7 @@ See [Event Handlers](https://bkper.com/docs/build/apps/event-handlers.md#respons
|
|
|
46
46
|
|
|
47
47
|
You can host event handlers on any infrastructure — other cloud providers, containers, on-premise servers.
|
|
48
48
|
|
|
49
|
-
Configure the same `webhookUrl` property in [`bkper.yaml`](https://bkper.com/docs/
|
|
49
|
+
Configure the same `webhookUrl` property in [`bkper.yaml`](https://bkper.com/docs/platform/apps/configuration.md):
|
|
50
50
|
|
|
51
51
|
```yaml
|
|
52
52
|
webhookUrl: https://my-server.example.com/bkper/events
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Bkper-managed app source gives your team and coding agents one shared private codebase for a Bkper app. Authorized app developers can clone the same repository, improve it locally, and continue from one shared history without setting up a separate Git host.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Every app sync and deployment requires clean, committed source stored in a durable Git remote. Bkper-managed source is the recommended default for development collaboration. It does not automatically build or deploy your app.
|
|
6
6
|
|
|
7
7
|
## Who can access the source
|
|
8
8
|
|
|
@@ -66,7 +66,7 @@ Keep agent instructions such as `AGENTS.md` in the repository so every teammate
|
|
|
66
66
|
|
|
67
67
|
## Source synchronization is not deployment
|
|
68
68
|
|
|
69
|
-
Source storage and app deployment are separate operations
|
|
69
|
+
Source storage and app deployment are separate operations. Apps without a Git repository cannot sync or deploy; the CLI provides the initialization and managed-sync steps needed to establish source safely.
|
|
70
70
|
|
|
71
71
|
| Action | What it does with source | Does it deploy? |
|
|
72
72
|
| ------------------ | ------------------------------------------------------------------------------ | --------------- |
|
|
@@ -75,19 +75,24 @@ Source storage and app deployment are separate operations:
|
|
|
75
75
|
| `npm run build` | Creates local build output in `dist/`. | No |
|
|
76
76
|
| `bkper app deploy` | Pushes and verifies the managed commit, then uploads the existing local build. | Yes |
|
|
77
77
|
|
|
78
|
-
An ordinary Git push never deploys. `bkper app deploy` also does not run a build, so build locally before deploying the result you intend to release.
|
|
78
|
+
An ordinary Git push never deploys. `bkper app deploy` also does not run a build, so build locally before deploying the result you intend to release. The CLI verifies the stored source commit but does not prove that the local `dist/` output was built from it.
|
|
79
79
|
|
|
80
|
-
Managed sync and deploy require a clean, committed working tree and use fast-forward safety checks. The CLI does not automatically commit, merge, rebase, force-push, reset, or
|
|
80
|
+
Managed sync and deploy require a clean, committed working tree and use fast-forward safety checks. External sync and deploy require the current branch to track an upstream containing the current clean commit. The CLI does not automatically commit, merge, rebase, force-push, reset, discard files, choose an external remote, or push to an external provider.
|
|
81
81
|
|
|
82
82
|
## External Git and monorepos
|
|
83
83
|
|
|
84
84
|
Bkper-managed source is optional. Existing workflows remain external when:
|
|
85
85
|
|
|
86
|
-
- the app already has a GitHub, GitLab, or other provider remote;
|
|
87
|
-
- `bkper.yaml` is inside a monorepo rather than at the repository root
|
|
88
|
-
- the app is otherwise not rooted in a standalone Git repository.
|
|
86
|
+
- the app already has a GitHub, GitLab, or other provider remote; or
|
|
87
|
+
- `bkper.yaml` is inside a monorepo rather than at the repository root.
|
|
89
88
|
|
|
90
|
-
|
|
89
|
+
The current branch must have a configured upstream containing the commit being synced or deployed. If no upstream is configured, choose the intended provider remote and store the branch explicitly:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
git push --set-upstream <remote> <branch>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The CLI fetches and verifies the upstream without pushing or changing the working tree. Clone external apps from their provider. `bkper app clone` is for Bkper-managed source only.
|
|
91
96
|
|
|
92
97
|
Moving an existing standalone app from an external provider is intentional: the CLI never removes or renames an existing remote. Before changing remotes, make sure every branch and tag you want to preserve is available locally and the current `main` branch is clean and committed. Removing all external remotes and running `bkper app sync` then activates managed source for an eligible app.
|
|
93
98
|
|
|
@@ -95,7 +100,7 @@ The `repoUrl` field in `bkper.yaml` is app-listing metadata. It does not select
|
|
|
95
100
|
|
|
96
101
|
## Next steps
|
|
97
102
|
|
|
98
|
-
- [Your First App](https://bkper.com/docs/
|
|
99
|
-
- [Building & Deploying](https://bkper.com/docs/
|
|
100
|
-
- [CLI](https://bkper.com/docs/
|
|
103
|
+
- [Your First App](https://bkper.com/docs/platform/apps/first-app.md) — Scaffold an app and establish its shared source
|
|
104
|
+
- [Building & Deploying](https://bkper.com/docs/platform/apps/deploying.md) — Build, sync, preview, and deploy explicitly
|
|
105
|
+
- [CLI](https://bkper.com/docs/platform/tools/cli.md) — Install the CLI and review its app-development workflows
|
|
101
106
|
- [Coding Agents](https://bkper.com/docs/ai/coding-agents.md) — Give coding agents the Bkper and project context they need
|
|
@@ -9,14 +9,16 @@ Build, deploy, and manage Bkper apps using the `bkper` CLI.
|
|
|
9
9
|
|
|
10
10
|
## Source control modes
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Every App sync and deployment requires an attached, clean, committed Git source stored in a durable remote. Bkper-managed private Git is the recommended default:
|
|
13
13
|
|
|
14
14
|
- **Managed source:** `bkper app sync` activates private Bkper-managed Git for a new or existing App when `bkper.yaml` is at the root of a standalone Git repository, the current clean committed branch is `main`, and no Git remote exists. Bkper configures the managed repository as `origin`. New Apps initially upload `main`; existing Apps atomically upload all local branches and tags.
|
|
15
|
-
- **External source:** an App keeps
|
|
15
|
+
- **External source:** an App keeps its provider when it has an external Git remote or is nested in a monorepo. Its current branch must track an upstream branch containing the current commit. The CLI fetches and verifies that upstream before sync or deploy, but never chooses a remote or pushes external source.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Apps without a Git repository cannot sync or deploy. The CLI returns the exact initialization, review, commit, and managed-sync steps so a user or coding agent can establish source safely. To use GitHub, GitLab, or another provider instead, configure the intended branch upstream and push it before syncing.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Managed mode is sticky after activation; adding another remote later does not change it, and Artifacts remains `origin`. The App listing `repoUrl` metadata does not select source mode.
|
|
20
|
+
|
|
21
|
+
Source and deployment remain separate. `git push` stores source only and **never deploys**. `bkper app sync` pushes managed source or verifies external source before syncing local metadata. `bkper app deploy` pushes and verifies managed source, or verifies that the external upstream contains the current commit, before uploading the existing local `dist/server` and optional `dist/client` output. Builds remain local and explicit; Bkper does not prove that the local bundle was built from the verified commit.
|
|
20
22
|
|
|
21
23
|
CLI-managed pushes are clean-tree and fast-forward-only. The CLI never commits, merges, rebases, force-pushes, resets, or discards files. Authorized developers may use ordinary Git commands, including an intentional force-push, but a push still never deploys.
|
|
22
24
|
|
|
@@ -113,7 +115,7 @@ npm run build
|
|
|
113
115
|
bkper app deploy
|
|
114
116
|
```
|
|
115
117
|
|
|
116
|
-
For a managed App, sync and deploy safely push the current committed branch. For an external App, both commands preserve direct local metadata and bundle upload behavior without changing remotes.
|
|
118
|
+
For a managed App, sync and deploy safely push the current committed branch. For an external App, both commands require a configured upstream containing the current clean commit and preserve direct local metadata and bundle upload behavior without changing remotes.
|
|
117
119
|
|
|
118
120
|
Verify:
|
|
119
121
|
|
|
@@ -191,8 +193,9 @@ bkper app get <appId> --json
|
|
|
191
193
|
# Deploy to preview environment (URL: https://{appId}-preview.bkper.app)
|
|
192
194
|
bkper app deploy --preview
|
|
193
195
|
|
|
194
|
-
# Check deployment status
|
|
196
|
+
# Check deployment status from the current app or by ID
|
|
195
197
|
bkper app status
|
|
198
|
+
bkper app status <appId>
|
|
196
199
|
```
|
|
197
200
|
|
|
198
201
|
> **Note:** `bkper app dev` runs one local Worker runtime — Miniflare, file watching, and an optional Cloudflare tunnel to `/events` when the app subscribes to events. Miniflare is loaded from the app project's `devDependencies` so each app can keep its local Workers simulator aligned with its own code. The Vite client dev server is configured in the project's `vite.config.ts` and run separately. The project template composes both via `npm run dev` using `concurrently`. Open the printed `Open app` URL in your browser; the `Worker/API` URL is for `/api`, `/health`, `/openapi.json`, and events. If your Vite server uses a port other than `5173`, pass that port with `--cp, --client-port` so the local `ASSETS` binding can reach it. If needed, install Miniflare in the app root with `bun add -d miniflare` or `npm install -D miniflare`.
|
|
@@ -220,13 +223,13 @@ If Git authentication fails:
|
|
|
220
223
|
|
|
221
224
|
The helper command is intentionally `bkper app git-credential <appId> [operation]`. It is internal Git plumbing, not a root `git` command or an `app git` group.
|
|
222
225
|
|
|
223
|
-
##
|
|
226
|
+
## Source preflight recovery
|
|
224
227
|
|
|
225
|
-
|
|
228
|
+
Every sync and deploy requires an attached branch, committed `HEAD`, a clean tree, and durable source storage. Managed source additionally requires `bkper.yaml` at the Git root. Ignored build output such as `dist/` is allowed.
|
|
226
229
|
|
|
227
230
|
| Failure | Safe recovery |
|
|
228
231
|
| --- | --- |
|
|
229
|
-
| No Git repository |
|
|
232
|
+
| No Git repository | From the App root, run `git init -b main`, review `.gitignore` and all source files, commit, then run `bkper app sync` to activate the recommended managed source. |
|
|
230
233
|
| `bkper.yaml` below Git root | Keep the monorepo/external workflow; managed monorepos are not supported. |
|
|
231
234
|
| No commits | Review, then run `git add .` and `git commit -m "Initial app"`. |
|
|
232
235
|
| Detached `HEAD` | Attach a branch with `git switch -c <branch>`; use `main` for first activation. |
|
|
@@ -234,6 +237,8 @@ Managed sync and deploy require `bkper.yaml` at the Git root, an attached branch
|
|
|
234
237
|
| Staged changes | Inspect `git diff --cached`; commit them or intentionally unstage them before retrying. |
|
|
235
238
|
| Modified tracked files | Inspect `git diff`; commit or intentionally restore them before retrying. |
|
|
236
239
|
| Non-ignored untracked files | Inspect `git status`; commit, ignore, or intentionally remove them before retrying. |
|
|
240
|
+
| External branch has no upstream | Choose the intended provider remote and run `git push --set-upstream <remote> <branch>`, then retry. The CLI never guesses or pushes an external remote. |
|
|
241
|
+
| Current commit is not upstream | Push the current branch to its configured upstream, then retry. |
|
|
237
242
|
| Missing or incorrect managed `origin` | Inspect `git remote -v`; compare with a fresh managed clone. Do not overwrite an external remote. |
|
|
238
243
|
| Authentication or expired credential | Run `bkper auth login` if needed, then retry the Git operation for a new five-minute token. |
|
|
239
244
|
| Remote branch ahead or divergent | Run `git fetch origin <branch>` and inspect `git log --oneline --left-right HEAD...origin/<branch>`; merge or rebase by your own choice, then push and retry. The CLI never force-resolves divergence. |
|
|
@@ -549,11 +554,11 @@ Inside the interactive agent:
|
|
|
549
554
|
- `app clone <appId> [path]` - Clone a Bkper-managed App source repository. Does not install dependencies; run `bun install` explicitly afterward. External-source Apps must be cloned from their provider instead.
|
|
550
555
|
- `app git-credential <appId> [operation]` - Internal noninteractive Git credential helper for managed Artifacts source. Generated repository config pins the App ID and exact remote URL/path; Git appends `get`, `store`, or `erase`. Never persists tokens.
|
|
551
556
|
- `app list` - List all apps you have access to
|
|
552
|
-
- `app sync` -
|
|
557
|
+
- `app sync` - Verify that source is clean, committed, and stored before syncing [bkper.yaml][bkper.yaml reference]. For an eligible standalone repository with no remote, activate managed source for a new or existing App; existing migrations atomically upload all local branches and tags. For external source, verify that the configured upstream contains the current commit.
|
|
553
558
|
- `app build` - Build the server Worker bundle for deployment
|
|
554
|
-
- `app deploy` -
|
|
559
|
+
- `app deploy` - Require stored source, then explicitly deploy the existing local build. Managed Apps safely push and Platform-verifies the current commit. External Apps keep direct upload behavior after the CLI verifies that their upstream contains the current commit.
|
|
555
560
|
- `-p, --preview` - Deploy to preview environment
|
|
556
|
-
- `app status` - Show deployment status
|
|
561
|
+
- `app status [appId]` - Show deployment status. When `appId` is omitted, the app id is read from local app config.
|
|
557
562
|
- `app logs [appId]` - View recent app logs. When `appId` is omitted, the app id is read from local app config.
|
|
558
563
|
- `--since <time>` - ISO8601 or relative lower bound (e.g. `5m`, `1h`, `15d`)
|
|
559
564
|
- `--until <time>` - ISO8601 or relative upper bound
|
|
@@ -147,6 +147,6 @@ Collections can also serve as references for automations (Bots or Apps) that wor
|
|
|
147
147
|
|
|
148
148
|
## Events
|
|
149
149
|
|
|
150
|
-
Every action in a Book — posting a transaction, editing an account,
|
|
150
|
+
Every action in a Book — such as posting a transaction, editing an account, or attaching a file — generates an **Event**. Events record _who_ (a user) or _what_ (a bot, an automation) performed the action and _when_, forming a complete audit trail essential for collaboration and trust.
|
|
151
151
|
|
|
152
152
|
Events are also the foundation of Bkper's automation model. Bots and Agents listen for specific event types and react automatically — for example, calculating taxes when a transaction is posted or converting currencies when one is checked.
|
|
@@ -190,6 +190,8 @@ More information at the [Bkper Developer Documentation](https://bkper.com/docs/#
|
|
|
190
190
|
- `startedTrial?`: `boolean` — True if the user has started the trial period
|
|
191
191
|
- `totalTransactionsThisMonth?`: `number` — User-level total transactions this month
|
|
192
192
|
- `totalTransactionsThisYear?`: `number` — User-level total transactions this year
|
|
193
|
+
- `transactionsAverage?`: `number` — Authoritative rounded-up rolling monthly average of posted transactions for the current plan
|
|
194
|
+
- `transactionsCapacity?`: `number` — Confirmed average monthly transaction capacity for the current plan
|
|
193
195
|
|
|
194
196
|
### Book
|
|
195
197
|
|
package/lib/docs/sdk/bkper-js.md
CHANGED
|
@@ -509,6 +509,8 @@ The Billing information includes the plan, the admin email, and the billing port
|
|
|
509
509
|
- `getPortalUrl(returnUrl: string)` → `Promise<string | undefined>` — Gets the URL to redirect the User to the billing portal.
|
|
510
510
|
- `getTotalTransactionsThisMonth()` → `number | undefined` — Gets the number of total transactions this month for the User's billing account.
|
|
511
511
|
- `getTotalTransactionsThisYear()` → `number | undefined` — Gets the number of total transactions this year for the User's billing account.
|
|
512
|
+
- `getTransactionsAverage()` → `number | undefined` — Gets the authoritative rolling monthly average of posted transactions.
|
|
513
|
+
- `getTransactionsCapacity()` → `number | undefined` — Gets the confirmed average monthly transaction capacity.
|
|
512
514
|
- `hasStartedTrial()` → `boolean | undefined` — Tells if the User has started the trial period.
|
|
513
515
|
- `isEnabled()` → `boolean | undefined` — Tells if billing is enabled for the User.
|
|
514
516
|
- `isPlanOverdue()` → `boolean | undefined` — Tells if the User's current plan payment is overdue.
|