@littlebearapps/platform-admin-sdk 1.1.0 → 1.2.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 CHANGED
@@ -81,25 +81,84 @@ my-platform/
81
81
 
82
82
  ## Post-Scaffold Steps
83
83
 
84
+ ### 1. Install dependencies
85
+
84
86
  ```bash
85
87
  cd my-platform
86
88
  npm install
89
+ ```
90
+
91
+ ### 2. Create Cloudflare resources
92
+
93
+ **All tiers:**
87
94
 
88
- # Create Cloudflare resources
95
+ ```bash
89
96
  npx wrangler d1 create my-platform-metrics
90
97
  npx wrangler kv namespace create PLATFORM_CACHE
91
98
  npx wrangler queues create my-platform-telemetry
92
99
  npx wrangler queues create my-platform-telemetry-dlq
100
+ ```
101
+
102
+ **Standard tier** — also create:
103
+
104
+ ```bash
105
+ npx wrangler kv namespace create PLATFORM_ALERTS
106
+ ```
107
+
108
+ **Full tier** — also create:
109
+
110
+ ```bash
111
+ npx wrangler kv namespace create SERVICE_REGISTRY
112
+ ```
93
113
 
94
- # Update resource IDs in wrangler.*.jsonc, then:
114
+ Update the resource IDs in each `wrangler.*.jsonc` file.
115
+
116
+ ### 3. Configure secrets
117
+
118
+ ```bash
119
+ # Standard tier — error-collector (GitHub App for auto-issue creation)
120
+ npx wrangler secret put GITHUB_APP_ID -c wrangler.my-platform-error-collector.jsonc
121
+ npx wrangler secret put GITHUB_APP_PRIVATE_KEY -c wrangler.my-platform-error-collector.jsonc
122
+ npx wrangler secret put GITHUB_APP_INSTALLATION_ID -c wrangler.my-platform-error-collector.jsonc
123
+
124
+ # Standard tier — sentinel (Cloudflare API for cost monitoring)
125
+ npx wrangler secret put CLOUDFLARE_API_TOKEN -c wrangler.my-platform-sentinel.jsonc
126
+
127
+ # Optional — Slack alerts (any worker with SLACK_WEBHOOK_URL)
128
+ npx wrangler secret put SLACK_WEBHOOK_URL -c wrangler.my-platform-sentinel.jsonc
129
+
130
+ # Full tier — alert-router (GitHub token for issue creation)
131
+ npx wrangler secret put GITHUB_TOKEN -c wrangler.my-platform-alert-router.jsonc
132
+ npx wrangler secret put SLACK_WEBHOOK_URL -c wrangler.my-platform-alert-router.jsonc
133
+ ```
134
+
135
+ ### 4. Apply migrations and deploy
136
+
137
+ ```bash
138
+ # Sync config to D1/KV
95
139
  npm run sync:config
140
+
141
+ # Apply D1 migrations
96
142
  npx wrangler d1 migrations apply my-platform-metrics --remote
143
+
144
+ # Deploy workers (order matters — deploy usage first, then tail consumers)
97
145
  npx wrangler deploy -c wrangler.my-platform-usage.jsonc
146
+
147
+ # Standard tier
148
+ npx wrangler deploy -c wrangler.my-platform-error-collector.jsonc
149
+ npx wrangler deploy -c wrangler.my-platform-sentinel.jsonc
150
+
151
+ # Full tier
152
+ npx wrangler deploy -c wrangler.my-platform-notifications.jsonc
153
+ npx wrangler deploy -c wrangler.my-platform-search.jsonc
154
+ npx wrangler deploy -c wrangler.my-platform-settings.jsonc
155
+ npx wrangler deploy -c wrangler.my-platform-pattern-discovery.jsonc
156
+ npx wrangler deploy -c wrangler.my-platform-alert-router.jsonc
98
157
  ```
99
158
 
100
159
  ## Updating Your Platform
101
160
 
102
- Starting with v1.1.0, the Admin SDK writes a `.platform-scaffold.json` manifest that tracks what was generated. This enables safe, incremental upgrades.
161
+ Starting with v1.1.0, the Admin SDK writes a `.platform-scaffold.json` manifest that tracks what was generated. This enables safe, incremental upgrades. **Commit this file to git** — it's how the upgrade command knows what to update.
103
162
 
104
163
  ### Upgrade an existing project
105
164
 
package/dist/scaffold.js CHANGED
@@ -45,6 +45,9 @@ export async function scaffold(options, outputDir) {
45
45
  gatusUrl: options.gatusUrl,
46
46
  defaultAssignee: options.defaultAssignee,
47
47
  sdkVersion: SDK_VERSION,
48
+ // Computed flags for Handlebars conditionals in templates
49
+ isStandard: (options.tier === 'standard' || options.tier === 'full') ? 'true' : '',
50
+ isFull: options.tier === 'full' ? 'true' : '',
48
51
  };
49
52
  mkdirSync(outputDir, { recursive: true });
50
53
  const fileHashes = {};
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import type { Tier } from './prompts.js';
8
8
  /** Single source of truth for the SDK version. */
9
- export declare const SDK_VERSION = "1.1.0";
9
+ export declare const SDK_VERSION = "1.2.0";
10
10
  /** Returns true if `to` is the same or higher tier than `from`. */
11
11
  export declare function isTierUpgradeOrSame(from: Tier, to: Tier): boolean;
12
12
  /** Check if a template file is a numbered migration (not seed.sql). */
package/dist/templates.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * All other files are copied verbatim.
6
6
  */
7
7
  /** Single source of truth for the SDK version. */
8
- export const SDK_VERSION = '1.1.0';
8
+ export const SDK_VERSION = '1.2.0';
9
9
  /** Tier ordering for upgrade validation. */
10
10
  const TIER_ORDER = { minimal: 0, standard: 1, full: 2 };
11
11
  /** Returns true if `to` is the same or higher tier than `from`. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@littlebearapps/platform-admin-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Platform Admin SDK — scaffold backend infrastructure with workers, circuit breakers, and cost protection for Cloudflare",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,13 +22,28 @@
22
22
  {
23
23
  "binding": "PLATFORM_ALERTS",
24
24
  "id": "YOUR_KV_ALERTS_NAMESPACE_ID"
25
+ },
26
+ {
27
+ "binding": "SERVICE_REGISTRY",
28
+ "id": "YOUR_SERVICE_REGISTRY_KV_ID"
25
29
  }
26
30
  ],
27
31
 
32
+ "queues": {
33
+ "producers": [
34
+ { "binding": "PLATFORM_TELEMETRY", "queue": "{{projectSlug}}-telemetry" }
35
+ ]
36
+ },
37
+
38
+ "services": [
39
+ { "binding": "NOTIFICATIONS_API", "service": "{{projectSlug}}-notifications" }
40
+ ],
41
+
28
42
  "vars": {
29
43
  "CLOUDFLARE_ACCOUNT_ID": "YOUR_CLOUDFLARE_ACCOUNT_ID"
30
44
  }
31
45
 
32
- // Secrets needed:
46
+ // Secrets needed (set via wrangler secret put):
33
47
  // SLACK_WEBHOOK_URL
48
+ // GITHUB_TOKEN
34
49
  }
@@ -27,6 +27,11 @@
27
27
 
28
28
  "ai": { "binding": "AI" },
29
29
 
30
+ // Dashboard notifications for new patterns and review-ready items
31
+ "services": [
32
+ { "binding": "NOTIFICATIONS_API", "service": "{{projectSlug}}-notifications" }
33
+ ],
34
+
30
35
  "vars": {
31
36
  "GATUS_HEARTBEAT_URL": "{{gatusUrl}}"
32
37
  }
@@ -20,6 +20,50 @@ projects:
20
20
  script_name: {{projectSlug}}-usage
21
21
  status: active
22
22
  schedule: "0 * * * *"
23
+ {{#if isStandard}}
24
+
25
+ - id: {{projectSlug}}-error-collector
26
+ name: "Error Collector"
27
+ script_name: {{projectSlug}}-error-collector
28
+ status: active
29
+ schedule: "*/15 * * * *"
30
+ metadata:
31
+ type: tail-worker
32
+
33
+ - id: {{projectSlug}}-sentinel
34
+ name: "Platform Sentinel"
35
+ script_name: {{projectSlug}}-sentinel
36
+ status: active
37
+ schedule: "*/15 * * * *"
38
+ {{/if}}
39
+ {{#if isFull}}
40
+
41
+ - id: {{projectSlug}}-pattern-discovery
42
+ name: "Pattern Discovery"
43
+ script_name: {{projectSlug}}-pattern-discovery
44
+ status: active
45
+ schedule: "0 2 * * *"
46
+
47
+ - id: {{projectSlug}}-alert-router
48
+ name: "Alert Router"
49
+ script_name: {{projectSlug}}-alert-router
50
+ status: active
51
+
52
+ - id: {{projectSlug}}-notifications
53
+ name: "Notifications"
54
+ script_name: {{projectSlug}}-notifications
55
+ status: active
56
+
57
+ - id: {{projectSlug}}-search
58
+ name: "Search"
59
+ script_name: {{projectSlug}}-search
60
+ status: active
61
+
62
+ - id: {{projectSlug}}-settings
63
+ name: "Settings"
64
+ script_name: {{projectSlug}}-settings
65
+ status: active
66
+ {{/if}}
23
67
  storage:
24
68
  d1:
25
69
  - database_name: {{projectSlug}}-metrics
@@ -43,3 +87,58 @@ projects:
43
87
  feature_id: "{{projectSlug}}:queue:telemetry"
44
88
  circuit_breaker: true
45
89
  cost_tier: low
90
+ {{#if isStandard}}
91
+ error-collection:
92
+ tail-processing:
93
+ display_name: "Error Tail Processing"
94
+ feature_id: "{{projectSlug}}:error-collection:tail"
95
+ circuit_breaker: true
96
+ cost_tier: medium
97
+ daily-digest:
98
+ display_name: "Error Daily Digest"
99
+ feature_id: "{{projectSlug}}:error-collection:digest"
100
+ circuit_breaker: true
101
+ cost_tier: low
102
+ gap-alerts:
103
+ display_name: "Gap Alert Processing"
104
+ feature_id: "{{projectSlug}}:error-collection:gap-alerts"
105
+ circuit_breaker: false
106
+ cost_tier: low
107
+ monitor:
108
+ sentinel:
109
+ display_name: "Platform Sentinel"
110
+ feature_id: "{{projectSlug}}:monitor:sentinel"
111
+ circuit_breaker: true
112
+ cost_tier: low
113
+ {{/if}}
114
+ {{#if isFull}}
115
+ pattern-discovery:
116
+ ai-discovery:
117
+ display_name: "AI Pattern Discovery"
118
+ feature_id: "{{projectSlug}}:pattern-discovery:ai"
119
+ circuit_breaker: true
120
+ cost_tier: high
121
+ shadow-evaluation:
122
+ display_name: "Shadow Evaluation"
123
+ feature_id: "{{projectSlug}}:pattern-discovery:shadow"
124
+ circuit_breaker: true
125
+ cost_tier: medium
126
+ notifications:
127
+ api:
128
+ display_name: "Notifications API"
129
+ feature_id: "{{projectSlug}}:notifications:api"
130
+ circuit_breaker: true
131
+ cost_tier: low
132
+ search:
133
+ api:
134
+ display_name: "Search API"
135
+ feature_id: "{{projectSlug}}:search:api"
136
+ circuit_breaker: true
137
+ cost_tier: low
138
+ settings:
139
+ api:
140
+ display_name: "Settings API"
141
+ feature_id: "{{projectSlug}}:settings:api"
142
+ circuit_breaker: true
143
+ cost_tier: low
144
+ {{/if}}
@@ -51,7 +51,7 @@
51
51
  "CLOUDFLARE_ACCOUNT_ID": "YOUR_CLOUDFLARE_ACCOUNT_ID"
52
52
  }
53
53
 
54
- // Uncomment when you add error-collector (standard tier):
54
+ // Uncomment when you add notifications (full tier):
55
55
  // "services": [
56
56
  // { "binding": "NOTIFICATIONS_API", "service": "{{projectSlug}}-notifications" }
57
57
  // ]
@@ -34,11 +34,18 @@
34
34
  "vars": {
35
35
  "GITHUB_ORG": "{{githubOrg}}",
36
36
  "DEFAULT_ASSIGNEE": "{{defaultAssignee}}",
37
- "GATUS_HEARTBEAT_URL": "{{gatusUrl}}"
37
+ "GATUS_HEARTBEAT_URL_15M": "{{gatusUrl}}",
38
+ "GATUS_HEARTBEAT_URL_DIGEST": "{{gatusUrl}}"
38
39
  }
39
40
 
41
+ // Uncomment when you add notifications (full tier):
42
+ // "services": [
43
+ // { "binding": "NOTIFICATIONS_API", "service": "{{projectSlug}}-notifications" }
44
+ // ]
45
+
40
46
  // Secrets needed (set via wrangler secret put):
41
47
  // GITHUB_APP_ID
42
48
  // GITHUB_APP_PRIVATE_KEY
43
49
  // GITHUB_APP_INSTALLATION_ID
50
+ // GATUS_TOKEN (optional: bearer token for Gatus external endpoints)
44
51
  }
@@ -39,6 +39,9 @@
39
39
  "GATUS_HEARTBEAT_URL": "{{gatusUrl}}"
40
40
  }
41
41
 
42
+ // When you add notifications (full tier), add to the "services" array above:
43
+ // { "binding": "NOTIFICATIONS_API", "service": "{{projectSlug}}-notifications" }
44
+
42
45
  // Secrets needed (set via wrangler secret put):
43
46
  // CLOUDFLARE_API_TOKEN
44
47
  // SLACK_WEBHOOK_URL (optional)