@framers/agentos-ext-cloud-cloudflare-pages 0.1.2 → 0.1.3

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 (3) hide show
  1. package/README.md +108 -0
  2. package/manifest.json +1 -1
  3. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # Cloudflare Pages and Workers
2
+
3
+ This pack gives agents tools to deploy Pages projects from Git repositories, list projects, manage DNS records, and upload Worker scripts. It uses the Cloudflare REST API with bearer-token authentication.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @framers/agentos-ext-cloud-cloudflare-pages
9
+ ```
10
+
11
+ Peer dependency: `@framers/agentos` with range `>=0.10.40`.
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { AgentOS } from '@framers/agentos';
17
+
18
+ const agentos = await AgentOS.create({
19
+ extensionManifest: {
20
+ packs: [
21
+ {
22
+ package: '@framers/agentos-ext-cloud-cloudflare-pages',
23
+ options: {
24
+ apiToken: process.env.CLOUDFLARE_API_TOKEN,
25
+ accountId: process.env.CLOUDFLARE_ACCOUNT_ID,
26
+ },
27
+ },
28
+ ],
29
+ },
30
+ });
31
+ ```
32
+
33
+ ## Configuration
34
+
35
+ | Option | Secret id | Environment variable | Required | Default |
36
+ | --- | --- | --- | --- | --- |
37
+ | `apiToken` | `cloudflare.apiToken` | `CLOUDFLARE_API_TOKEN` | Yes | Empty string |
38
+ | `accountId` | `cloudflare.accountId` | `CLOUDFLARE_ACCOUNT_ID` | Yes | Empty string |
39
+ | `secrets` | | | No | `context.secrets`, then `{}` |
40
+
41
+ Explicit options take precedence over secrets, then environment variables. `options.secrets` takes precedence over `context.secrets`.
42
+
43
+ ## Tools
44
+
45
+ | Tool | What it does |
46
+ | --- | --- |
47
+ | `cfDeployPages` | Deploys a Pages project from a Git repository, creating the project if needed. |
48
+ | `cfListProjects` | Lists Pages projects with their repository, branch, subdomain, and latest deployment status. |
49
+ | `cfConfigureDns` | Adds, removes, lists, or updates DNS records after looking up the zone by domain. |
50
+ | `cfCreateWorker` | Deploys a Worker script with route patterns, a compatibility date, and environment bindings. |
51
+
52
+ ### `cfDeployPages`
53
+
54
+ | Parameter | Type | Required | Description |
55
+ | --- | --- | --- | --- |
56
+ | `gitUrl` | string | Yes | Git repository URL. |
57
+ | `projectName` | string | No | Pages project name, auto-generated from the repository name if omitted. |
58
+ | `productionBranch` | string | No | Production branch name, default `main`. |
59
+ | `buildCommand` | string | No | Build command override. |
60
+ | `buildOutputDirectory` | string | No | Build output directory. |
61
+ | `envVars` | object | No | Environment variables to set on the project as key-value pairs. |
62
+
63
+ ### `cfListProjects`
64
+
65
+ | Parameter | Type | Required | Description |
66
+ | --- | --- | --- | --- |
67
+ | `limit` | number | No | Maximum projects to return, default 25, schema description maximum 100. |
68
+
69
+ ### `cfConfigureDns`
70
+
71
+ | Parameter | Type | Required | Description |
72
+ | --- | --- | --- | --- |
73
+ | `domain` | string | Yes | Root domain for the Cloudflare zone. |
74
+ | `action` | string: `add`, `remove`, `list`, `update` | No | Action to perform, default `list`. |
75
+ | `recordType` | string: `A`, `AAAA`, `CNAME`, `TXT`, `MX` | No | DNS record type, described as required for add and update. |
76
+ | `name` | string | No | Record name or hostname. |
77
+ | `content` | string | No | IP address, hostname, or text content. |
78
+ | `ttl` | number | No | TTL in seconds, default 1, which selects automatic TTL. |
79
+ | `proxied` | boolean | No | Whether to proxy through Cloudflare, default `false`. |
80
+ | `priority` | number | No | Priority for MX records. |
81
+ | `comment` | string | No | Optional comment for the record. |
82
+ | `recordId` | string | No | Record ID, required for update and remove. |
83
+
84
+ ### `cfCreateWorker`
85
+
86
+ | Parameter | Type | Required | Description |
87
+ | --- | --- | --- | --- |
88
+ | `name` | string | Yes | Worker script name used as its identifier. |
89
+ | `script` | string | Yes | JavaScript or TypeScript source in ES modules format with a default export. |
90
+ | `routes` | string[] | No | Route patterns to bind the Worker to. |
91
+ | `compatibilityDate` | string | No | Runtime compatibility date, default `2024-01-01`. |
92
+ | `bindings` | object | No | Environment variable bindings as key-value pairs. |
93
+
94
+ ## Notes
95
+
96
+ Activation fails if the API token or account ID is missing. It verifies the token through the Cloudflare token verification endpoint.
97
+
98
+ Pages deployment creates projects, sets production environment variables, and triggers a remote build without waiting for completion. The tool ignores `projectName` and derives the name from `gitUrl`. The URL parser accepts GitHub, GitLab, and Bitbucket hosts, but project creation always sends the source type `github`. Build settings are sent when creating a project.
99
+
100
+ Project environment variables and Worker bindings use `plain_text`. Worker source is uploaded as `worker.js` with a JavaScript module content type; the service does not transpile TypeScript. Worker route setup errors are ignored.
101
+
102
+ DNS add, update, and remove actions change remote records. Adding requires `recordType`, `name`, and `content`; updating and removing require `recordId`. Updating allows partial fields, including omission of `recordType`. A domain with no matching zone returns an error.
103
+
104
+ Project listing forwards `limit` without enforcing the schema description's maximum. Project and DNS listing fetch a page without following pagination.
105
+
106
+ ## License
107
+
108
+ Apache-2.0
package/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
3
3
  "id": "com.framers.cloud.cloudflare-pages",
4
4
  "name": "Cloudflare Pages & Workers",
5
- "version": "0.1.2",
5
+ "version": "0.1.3",
6
6
  "description": "Deploy Cloudflare Pages projects, manage DNS records, and deploy Workers. Supports static sites, full-stack frameworks, and edge functions via the Cloudflare API v4.",
7
7
  "author": {
8
8
  "name": "Frame.dev",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@framers/agentos-ext-cloud-cloudflare-pages",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Cloudflare Pages cloud extension — deploy Pages projects, manage DNS records, and deploy Workers via the Cloudflare API v4.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -54,7 +54,7 @@
54
54
  "rimraf": "^5.0.7",
55
55
  "typescript": "^5.4.5",
56
56
  "vitest": "^3.2.7",
57
- "@framers/agentos": "^0.13.40"
57
+ "@framers/agentos": "^0.13.47"
58
58
  },
59
59
  "homepage": "https://github.com/framerslab/agentos-extensions/tree/master/registry/curated/cloud/cloudflare-pages#readme",
60
60
  "bugs": {