@blinkhost/cli 2.2.0 → 2.4.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/CHANGELOG.md ADDED
@@ -0,0 +1,80 @@
1
+ # BlinkHost CLI changelog
2
+
3
+ This file records customer-visible CLI changes. BlinkHost uses semantic versioning for the CLI, while security and migration impact are classified separately. A patch may therefore require prompt action, and a major release may coexist with an earlier supported line during its documented migration window.
4
+
5
+ ## 2.4.0 — 2026-09-02
6
+
7
+ ### Added
8
+
9
+ - Terminal-accessible release notes from BlinkHost's immutable public release registry.
10
+ - Cached, non-blocking update notices with package-manager-specific instructions.
11
+ - Dashboard-linked compatibility guidance for confirmed CLI and SDK versions.
12
+
13
+ ### Changed
14
+
15
+ - Token refresh reports the installed CLI version so upgrading does not leave stale session evidence.
16
+ - Routine notices remain in the CLI and dashboard; required, security and retirement impact use targeted operational communication.
17
+
18
+ ### Compatibility
19
+
20
+ - Node.js 22.12 or newer.
21
+ - No project migration is required from 2.3.0.
22
+
23
+ ## 2.3.0 — 2026-08-31
24
+
25
+ ### Added
26
+
27
+ - Project-scoped `functions status` capability discovery.
28
+ - Direct trigger, invocation, result, cancellation and retry workflows.
29
+
30
+ ### Security and reliability
31
+
32
+ - Function payloads are bounded JSON objects.
33
+ - Retries support explicit idempotency keys.
34
+ - Update checks never install software and do not block CI or structured output.
35
+
36
+ ### Compatibility
37
+
38
+ - Node.js 22.12 or newer.
39
+ - Backend SDK contract 1.1.0.
40
+ - No migration is required from 2.2.0.
41
+
42
+ ## 2.2.0 — 2026-08-30
43
+
44
+ ### Added
45
+
46
+ - JavaScript, TypeScript and Python Function workflows with explicit beta availability.
47
+ - Commands for background, event and scheduled triggers.
48
+
49
+ ### Changed
50
+
51
+ - Function availability became project- and rollout-aware rather than inferred from the installed CLI version.
52
+
53
+ ## 2.1.0 — 2026-08-29
54
+
55
+ ### Added
56
+
57
+ - Public npm installation for `@blinkhost/cli`.
58
+ - Existing-repository detection, local validation, development and build checks.
59
+ - Device authorization, named profiles and revocable CLI sessions.
60
+ - Workload identity support for secretless GitHub automation.
61
+
62
+ ### Security
63
+
64
+ - Refresh credentials are stored in the operating-system credential service.
65
+ - Secret values are accepted through standard input rather than command arguments.
66
+
67
+ ## 2.0.0 — 2026-08-29
68
+
69
+ ### Added
70
+
71
+ - Stable command groups for projects, source connections, previews, builds, deployments, backend modules, databases and organizations.
72
+ - Machine-readable JSON output and stable exit categories.
73
+ - Explicit confirmation for destructive operations.
74
+
75
+ ## Compatibility and support policy
76
+
77
+ - BlinkHost documents supported Node.js, manifest, runtime, ABI and SDK versions with each release.
78
+ - Deprecations include an alternative and a published deadline before removal unless an active security issue requires faster action.
79
+ - Required and security migrations identify affected versions and link to a tested guide.
80
+ - Run `blinkhost update check` for the current version comparison or `blinkhost update notes [VERSION]` for release detail.
package/README.md CHANGED
@@ -7,12 +7,22 @@ The BlinkHost CLI brings project setup, local development, source control, previ
7
7
  Node.js 22.12 or newer is required.
8
8
 
9
9
  ```bash
10
- npm install --global @blinkhost/cli@2.2.0
10
+ npm install --global @blinkhost/cli@2.4.0
11
11
  blinkhost --version
12
12
  ```
13
13
 
14
14
  Signed release archives, checksums, the CycloneDX SBOM, and Sigstore verification bundle are available at <https://github.com/blinkhost-ltd/blinkhost-cli/releases>.
15
15
 
16
+ ## Current release
17
+
18
+ ### 2.4.0 — release intelligence and compatibility guidance
19
+
20
+ - Added `blinkhost update notes [VERSION]` for terminal-accessible, verified release history.
21
+ - Added cached, time-bounded update awareness that stays silent in CI, structured output, and non-interactive sessions.
22
+ - CLI token refresh now records the installed client version so project compatibility guidance does not rely on a stale login record.
23
+
24
+ Run `blinkhost update notes` to read published notes in the terminal. The complete version history and compatibility policy are maintained in [CHANGELOG.md](./CHANGELOG.md) and the [developer release notes](https://app.blinkhost.me/docs/releases).
25
+
16
26
  ## Start safely
17
27
 
18
28
  ```bash
@@ -107,6 +117,7 @@ Connected repository, release, approval, agency handoff, enterprise policy, and
107
117
  Manage beta event, schedule, and background triggers without using raw API routes:
108
118
 
109
119
  ```bash
120
+ blinkhost functions status [PROJECT_ID]
110
121
  blinkhost functions triggers list MODULE_ID
111
122
  blinkhost functions triggers create MODULE_ID --data @trigger.json
112
123
  blinkhost functions invoke run MODULE_ID TRIGGER_ID --data @payload.json --idempotency-key order-1042
@@ -117,7 +128,7 @@ blinkhost functions invocations cancel MODULE_ID INVOCATION_ID
117
128
  blinkhost functions invocations retry MODULE_ID INVOCATION_ID --idempotency-key retry-order-1042
118
129
  ```
119
130
 
120
- Payloads must be JSON objects no larger than 256 KiB. Use a stable idempotency key when repeating the same logical request. Runs remain subject to workspace roles, rollout availability, verified artifacts, runtime policy, and plan limits.
131
+ `functions status` reports the effective language and trigger capabilities for a project; omit the project ID inside a linked directory. Payloads must be JSON objects no larger than 256 KiB. Use a stable idempotency key when repeating the same logical request. Runs remain subject to workspace roles, rollout availability, verified artifacts, runtime policy, and plan limits.
121
132
 
122
133
  ## Secrets and resources
123
134
 
@@ -165,19 +176,21 @@ Stable exit codes distinguish usage, validation, filesystem, authentication, net
165
176
  ```bash
166
177
  blinkhost completion bash # also zsh, fish, or powershell
167
178
  blinkhost update check
179
+ blinkhost update notes
180
+ blinkhost update notes 2.4.0
168
181
  blinkhost plugins add /absolute/path/to/plugin --name example
169
182
  blinkhost plugins verify example
170
183
  blinkhost plugins run example -- arguments
171
184
  ```
172
185
 
173
- Update checks never install software. Plugins require explicit local approval, are pinned to their executable SHA-256 digest, stop when the executable changes, and receive neither BlinkHost credentials nor the parent environment. A plugin is still third-party code running with your operating-system account; review it before adding it.
186
+ Update checks never install software. At most once every 48 hours, an interactive terminal may perform a cached, time-bounded check after a successful command and print one upgrade line. Checks are suppressed in CI, JSON output, and non-interactive sessions; set `BLINKHOST_NO_UPDATE_NOTIFIER=1` to suppress them explicitly. Plugins require explicit local approval, are pinned to their executable SHA-256 digest, stop when the executable changes, and receive neither BlinkHost credentials nor the parent environment. A plugin is still third-party code running with your operating-system account; review it before adding it.
174
187
 
175
188
  Pin or roll back explicitly with `npm install --global @blinkhost/cli@VERSION`. Tagged packages are published from the `blinkhost-ltd/blinkhost-cli` release workflow through npm Trusted Publishing with provenance. To verify a downloaded GitHub release, first run `sha256sum --check SHA256SUMS`, then verify its Sigstore bundle:
176
189
 
177
190
  ```bash
178
191
  cosign verify-blob \
179
192
  --bundle SHA256SUMS.sigstore.json \
180
- --certificate-identity "https://github.com/blinkhost-ltd/blinkhost-cli/.github/workflows/release.yml@refs/tags/v2.2.0" \
193
+ --certificate-identity "https://github.com/blinkhost-ltd/blinkhost-cli/.github/workflows/release.yml@refs/tags/v2.4.0" \
181
194
  --certificate-oidc-issuer https://token.actions.githubusercontent.com \
182
195
  SHA256SUMS
183
196
  ```
package/dist/api.js CHANGED
@@ -89,7 +89,7 @@ export class ApiClient {
89
89
  const refresh = process.env.BLINKHOST_REFRESH_TOKEN || await getRefreshCredential(selected.name);
90
90
  if (!refresh)
91
91
  throw new CliError('Sign in with `blinkhost auth login` or provide BLINKHOST_ACCESS_TOKEN for CI.', EXIT.auth, 'not_authenticated');
92
- const result = await publicRequest(selected.profile.apiOrigin, '/api/cli/v2/token/refresh/', { method: 'POST', body: JSON.stringify({ refresh_token: refresh }) });
92
+ const result = await publicRequest(selected.profile.apiOrigin, '/api/cli/v2/token/refresh/', { method: 'POST', body: JSON.stringify({ refresh_token: refresh, client_version: VERSION }) });
93
93
  if (!result.response.ok) {
94
94
  if (!process.env.BLINKHOST_REFRESH_TOKEN)
95
95
  await deleteRefreshCredential(selected.name);
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import { ApiClient } from './api.js';
12
12
  import { login, logout } from './auth.js';
13
13
  import { activeProfile, readConfig, validateProfileName, writeConfig } from './config.js';
14
14
  import { openPreview, projectStatus, rawApi, readProjectLink, runFunctions, runRemote, runSecrets, syncProject, unlinkProject, uploadAsset, waitForRemote, writeProjectLink } from './remote.js';
15
- import { checkForUpdate, ciCheck, completion, observability, runDev, runPlugins, supportBundle, testProject } from './workflows.js';
15
+ import { checkForUpdate, ciCheck, completion, maybeUpdateNotice, observability, releaseNotes, runDev, runPlugins, supportBundle, testProject } from './workflows.js';
16
16
  import { documentationIndex, documentationTopic, quickstart, renderTopHelp, renderTopic, searchDocumentation, TOP_LEVEL_COMMANDS } from './guidance.js';
17
17
  import { VERSION, supportedNodeVersion } from './version.js';
18
18
  let quietOutput = false;
@@ -457,10 +457,21 @@ export async function main(argv = process.argv.slice(2)) {
457
457
  else
458
458
  process.stdout.write(output);
459
459
  }
460
- else if (command === 'update' && args.shift() === 'check') {
461
- assertNoUnknown(args);
462
- const data = await checkForUpdate();
463
- emit({ ok: true, command: 'update check', message: 'Release check completed.', data }, json);
460
+ else if (command === 'update') {
461
+ const action = args.shift() || 'check';
462
+ if (action === 'check') {
463
+ assertNoUnknown(args);
464
+ const data = await checkForUpdate(profile);
465
+ emit({ ok: true, command: 'update check', message: 'Release check completed. Updates are never installed automatically.', data }, json);
466
+ }
467
+ else if (action === 'notes') {
468
+ const version = args.shift();
469
+ assertNoUnknown(args);
470
+ const data = await releaseNotes(version, profile);
471
+ emit({ ok: true, command: 'update notes', message: version ? `Release notes for ${version}.` : 'Published CLI release notes.', data }, json);
472
+ }
473
+ else
474
+ throw new CliError(`Unknown update action: ${action}.`, EXIT.usage, 'unknown_action');
464
475
  }
465
476
  else if (command === 'ci' && args.shift() === 'check') {
466
477
  assertNoUnknown(args);
@@ -479,6 +490,11 @@ export async function main(argv = process.argv.slice(2)) {
479
490
  const suggestion = commandSuggestion(command);
480
491
  throw new CliError(`Unknown command: ${command}.${suggestion ? ` Did you mean \`${suggestion}\`?` : ' Run `blinkhost docs` to list commands.'}`, EXIT.usage, 'unknown_command');
481
492
  }
493
+ if (!json && !quietOutput && !nonInteractive && command !== 'update') {
494
+ const notice = await maybeUpdateNotice(profile);
495
+ if (notice)
496
+ process.stderr.write(`\n${terminalText(notice)}\n`);
497
+ }
482
498
  return EXIT.success;
483
499
  }
484
500
  catch (error) {
package/dist/config.d.ts CHANGED
@@ -15,6 +15,8 @@ export interface CliConfig {
15
15
  plugins?: Record<string, PluginRecord>;
16
16
  updateCheckedAt?: string;
17
17
  latestVersion?: string;
18
+ latestReleaseUrl?: string;
19
+ updateNotifications?: boolean;
18
20
  }
19
21
  export declare function configPath(): string;
20
22
  export declare function validateProfileName(value: string): string;
package/dist/config.js CHANGED
@@ -41,7 +41,15 @@ export async function readConfig() {
41
41
  continue;
42
42
  profiles[name] = { ...profile, apiOrigin: validateApiOrigin(profile.apiOrigin) };
43
43
  }
44
- return { activeProfile: validateProfileName(parsed.activeProfile || 'default'), profiles, plugins: parsed.plugins || {} };
44
+ return {
45
+ activeProfile: validateProfileName(parsed.activeProfile || 'default'),
46
+ profiles,
47
+ plugins: parsed.plugins || {},
48
+ ...(typeof parsed.updateCheckedAt === 'string' ? { updateCheckedAt: parsed.updateCheckedAt } : {}),
49
+ ...(typeof parsed.latestVersion === 'string' ? { latestVersion: parsed.latestVersion } : {}),
50
+ ...(typeof parsed.latestReleaseUrl === 'string' ? { latestReleaseUrl: parsed.latestReleaseUrl } : {}),
51
+ ...(typeof parsed.updateNotifications === 'boolean' ? { updateNotifications: parsed.updateNotifications } : {}),
52
+ };
45
53
  }
46
54
  catch (error) {
47
55
  if (error.code === 'ENOENT')
package/dist/guidance.js CHANGED
@@ -82,9 +82,9 @@ const TOPICS = {
82
82
  modules: resource('modules', 'Manage Rust, Go, Python, JavaScript and TypeScript Functions.'),
83
83
  functions: {
84
84
  name: 'functions', title: 'Function triggers and runs', summary: 'Manage beta event, schedule and background triggers with explicit retry and idempotency controls.',
85
- usage: ['blinkhost functions triggers list MODULE_ID', 'blinkhost functions triggers create MODULE_ID --data @trigger.json', 'blinkhost functions triggers update MODULE_ID TRIGGER_ID --data @trigger.json', 'blinkhost functions triggers delete MODULE_ID TRIGGER_ID --confirm TRIGGER_ID', 'blinkhost functions invoke run MODULE_ID TRIGGER_ID --data @payload.json [--idempotency-key KEY]', 'blinkhost functions invocations list MODULE_ID', 'blinkhost functions invocations get|result|cancel MODULE_ID INVOCATION_ID', 'blinkhost functions invocations retry MODULE_ID INVOCATION_ID [--idempotency-key KEY]'],
85
+ usage: ['blinkhost functions status [PROJECT_ID]', 'blinkhost functions triggers list MODULE_ID', 'blinkhost functions triggers create MODULE_ID --data @trigger.json', 'blinkhost functions triggers update MODULE_ID TRIGGER_ID --data @trigger.json', 'blinkhost functions triggers delete MODULE_ID TRIGGER_ID --confirm TRIGGER_ID', 'blinkhost functions invoke run MODULE_ID TRIGGER_ID --data @payload.json [--idempotency-key KEY]', 'blinkhost functions invocations list MODULE_ID', 'blinkhost functions invocations get|result|cancel MODULE_ID INVOCATION_ID', 'blinkhost functions invocations retry MODULE_ID INVOCATION_ID [--idempotency-key KEY]'],
86
86
  details: ['Event, schedule and background triggers are beta capabilities and may be enabled progressively by workspace. Workspace roles, runtime policy, verified artifacts, plan limits and the service rollout gate remain authoritative.', 'Payloads must be JSON objects no larger than 256 KiB. Results are bounded by the service. Use a stable idempotency key when repeating the same logical request; otherwise the CLI generates one for each submission.', 'Delivery is at least once. Handlers that can create duplicate writes, messages or charges must be idempotent. Cancellation cannot undo application work that has already completed.'],
87
- examples: ['blinkhost functions triggers list MODULE_ID --json', 'blinkhost functions invoke run MODULE_ID TRIGGER_ID --data @payload.json --idempotency-key order-1042 --json'], related: ['modules', 'automation', 'limits', 'troubleshooting'], url: DOCUMENTATION_URL,
87
+ examples: ['blinkhost functions status PROJECT_ID --json', 'blinkhost functions triggers list MODULE_ID --json', 'blinkhost functions invoke run MODULE_ID TRIGGER_ID --data @payload.json --idempotency-key order-1042 --json'], related: ['modules', 'automation', 'limits', 'troubleshooting'], url: DOCUMENTATION_URL,
88
88
  },
89
89
  databases: resource('databases', 'Manage database resources.', ['Database list, get, create, update, delete and supported server actions are remote and may require plan capacity or protected-environment approval.', 'The CLI does not invent local backup, restore, credential-rotation or migration semantics. Use only actions returned by the active workspace API and consult the detailed database guide before production data changes. Deletion retains exact-ID confirmation and server authorization.']),
90
90
  bindings: resource('bindings', 'Manage explicit application-to-resource bindings.'),
@@ -115,7 +115,7 @@ const TOPICS = {
115
115
  name: 'completion', title: 'Shell completion', summary: 'Generate deterministic completion for Bash, Zsh, Fish or PowerShell.', usage: ['blinkhost completion bash|zsh|fish|powershell'], details: ['The command prints a script to standard output; source or install it using your shell configuration.'], examples: ['source <(blinkhost completion bash)', 'blinkhost completion zsh > ~/.zfunc/_blinkhost'], related: ['portability'], url: DOCUMENTATION_URL,
116
116
  },
117
117
  update: {
118
- name: 'update', title: 'Check for CLI updates', summary: 'Compare this CLI version with the latest signed GitHub release.', usage: ['blinkhost update check'], details: ['The command reports an update but never installs one automatically. Pin a version with `npm install --global @blinkhost/cli@VERSION`; roll back with the same command and an earlier reviewed version.'], examples: ['blinkhost update check --json'], related: ['supply-chain'], url: DOCUMENTATION_URL,
118
+ name: 'update', title: 'CLI releases and updates', summary: 'Compare this CLI version with the verified BlinkHost release registry and read its release notes.', usage: ['blinkhost update check', 'blinkhost update notes [VERSION]'], details: ['Update checks and notices never install software automatically. Interactive notices are cached for 48 hours and stay silent in CI, JSON output and non-interactive sessions.', 'Pin a version with `npm install --global @blinkhost/cli@VERSION`; roll back with the same command and an earlier reviewed version.'], examples: ['blinkhost update check --json', 'blinkhost update notes 2.4.0'], related: ['supply-chain'], url: DOCUMENTATION_URL,
119
119
  },
120
120
  ci: {
121
121
  name: 'ci', title: 'CI readiness', summary: 'Verify the active workload identity and server-reported CLI capabilities.', usage: ['blinkhost ci check'], details: ['GitHub Actions should use an exact registered OIDC subject and id-token: write. No long-lived BlinkHost token is required.', 'Other CI systems may provide a short-lived BLINKHOST_ACCESS_TOKEN from an approved secret service; never commit or print it.'], examples: ['blinkhost ci check --non-interactive --json'], related: ['automation', 'auth', 'workloads'], url: DOCUMENTATION_URL,
package/dist/remote.js CHANGED
@@ -150,6 +150,19 @@ export async function runRemote(group, input, profile) {
150
150
  export async function runFunctions(input, profile) {
151
151
  const args = [...input];
152
152
  const resource = args.shift();
153
+ if (resource === 'status') {
154
+ let project = args.shift();
155
+ let selectedProfile = profile;
156
+ if (!project) {
157
+ const link = await readProjectLink();
158
+ project = link.project_id;
159
+ selectedProfile ||= link.profile;
160
+ }
161
+ const projectId = safeIdentifier(project, 'Project ID');
162
+ noExtra(args);
163
+ const client = await ApiClient.create(selectedProfile);
164
+ return client.request(`/api/backend-modules/rollout-status/?site_id=${projectId}`);
165
+ }
153
166
  const action = args.shift() || 'list';
154
167
  const moduleId = safeIdentifier(args.shift(), 'Module ID');
155
168
  const client = await ApiClient.create(profile);
@@ -217,7 +230,7 @@ export async function runFunctions(input, profile) {
217
230
  }
218
231
  throw new CliError(`Unknown invocation action: ${action}.`, EXIT.usage, 'unknown_action');
219
232
  }
220
- throw new CliError('Use `functions triggers`, `functions invoke`, or `functions invocations`.', EXIT.usage, 'invalid_function_command');
233
+ throw new CliError('Use `functions status`, `functions triggers`, `functions invoke`, or `functions invocations`.', EXIT.usage, 'invalid_function_command');
221
234
  }
222
235
  export async function writeProjectLink(projectId, profile, root) {
223
236
  safeIdentifier(projectId, 'Project ID');
package/dist/templates.js CHANGED
@@ -58,13 +58,14 @@ function moduleFiles(module) {
58
58
  const root = `_server_islands/${module.name}`;
59
59
  const files = new Map();
60
60
  if (module.language === 'python') {
61
- files.set(`${root}/main.py`, 'def handler(request):\n return {"status": 200, "body": {"ok": True}}\n');
62
- files.set(`${root}/requirements.txt`, '# Add pinned runtime dependencies here.\n');
61
+ files.set(`${root}/blinkhost.toml`, 'schema_version = 1\nlanguage = "python-wasi"\nentrypoint = "main.py"\nabi_version = "blinkhost-wasi-1"\nsdk_version = "1.1.0"\n');
62
+ files.set(`${root}/main.py`, 'import blinkhost\n\nblinkhost.respond(blinkhost.Response.json({"ok": True}))\n');
63
63
  return { entrypoint: 'main.py', files };
64
64
  }
65
65
  if (module.language === 'go') {
66
- files.set(`${root}/go.mod`, `module blinkhost/${module.name}\n\ngo 1.23\n`);
67
- files.set(`${root}/main.go`, 'package main\n\nfunc main() {}\n');
66
+ files.set(`${root}/blinkhost.toml`, 'schema_version = 1\nlanguage = "go-wasi"\nentrypoint = "main.go"\nabi_version = "blinkhost-wasi-1"\nsdk_version = "1.1.0"\n');
67
+ files.set(`${root}/go.mod`, `module blinkhost/${module.name}\n\ngo 1.24\n\nrequire blinkhost.dev/sdk/go v1.1.0\n\nreplace blinkhost.dev/sdk/go => /opt/blinkhost-sdk/go\n`);
68
+ files.set(`${root}/main.go`, 'package main\n\nimport "blinkhost.dev/sdk/go/blinkhost"\n\nfunc main() {\n\tresponse, err := blinkhost.JSONResponse(200, map[string]bool{"ok": true})\n\tif err != nil || blinkhost.Respond(response) != nil {\n\t\tpanic("BlinkHost response write failed")\n\t}\n}\n');
68
69
  return { entrypoint: 'main.go', files };
69
70
  }
70
71
  if (module.language === 'javascript' || module.language === 'typescript') {
@@ -80,9 +81,10 @@ function moduleFiles(module) {
80
81
  files.set(`${root}/${entrypoint}`, `${declaration}export default function handler(request${annotation}) {\n return {\n status: 200,\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ ok: true, received: request.json() }),\n };\n}\n`);
81
82
  return { entrypoint, files };
82
83
  }
83
- files.set(`${root}/Cargo.toml`, `[package]\nname = "${module.name}"\nversion = "0.1.0"\nedition = "2021"\n\n[lib]\ncrate-type = ["cdylib"]\n`);
84
- files.set(`${root}/src/lib.rs`, '#[no_mangle]\npub extern "C" fn blinkhost_module_version() -> u32 { 1 }\n');
85
- return { entrypoint: 'src/lib.rs', files };
84
+ files.set(`${root}/blinkhost.toml`, 'schema_version = 1\nlanguage = "rust-wasi"\nentrypoint = "src/main.rs"\nabi_version = "blinkhost-wasi-1"\nsdk_version = "1.1.0"\n');
85
+ files.set(`${root}/Cargo.toml`, `[package]\nname = "${module.name}"\nversion = "0.1.0"\nedition = "2021"\n\n[dependencies]\nblinkhost-sdk = { path = "/opt/blinkhost-sdk/rust", version = "=1.1.0" }\n\n[profile.release]\ncodegen-units = 1\nlto = true\nopt-level = "s"\npanic = "abort"\nstrip = true\n`);
86
+ files.set(`${root}/src/main.rs`, 'use blinkhost_sdk::{respond, Response};\n\nfn main() {\n if respond(Response::json(200, r#"{"ok":true}"#)).is_err() {\n std::process::abort();\n }\n}\n');
87
+ return { entrypoint: 'src/main.rs', files };
86
88
  }
87
89
  export function createScaffold(options) {
88
90
  const packageCommands = commands(options.packageManager);
@@ -92,7 +94,7 @@ export function createScaffold(options) {
92
94
  const generated = moduleFiles(item);
93
95
  for (const [path, contents] of generated.files)
94
96
  files.set(path, contents);
95
- modules.push({ name: item.name, path: `_server_islands/${item.name}`, language: item.language, entrypoint: generated.entrypoint, abi: 'blinkhost-wasi-1', sdk: '1.1' });
97
+ modules.push({ name: item.name, path: `_server_islands/${item.name}`, language: item.language, entrypoint: generated.entrypoint, abi: 'blinkhost-wasi-1', sdk: '1.1.0' });
96
98
  }
97
99
  const databases = options.database ? [{ binding: options.database, schema: `database/${options.database}/schema.sql`, migrations: `database/${options.database}/migrations` }] : [];
98
100
  if (options.database) {
package/dist/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "2.2.0";
1
+ export declare const VERSION = "2.4.0";
2
2
  export declare const DOCUMENTATION_URL = "https://app.blinkhost.me/docs/source-control/cli";
3
3
  export declare const RELEASES_URL = "https://github.com/blinkhost-ltd/blinkhost-cli/releases";
4
4
  export declare function supportedNodeVersion(version?: string): boolean;
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
- export const VERSION = '2.2.0';
1
+ export const VERSION = '2.4.0';
2
2
  export const DOCUMENTATION_URL = 'https://app.blinkhost.me/docs/source-control/cli';
3
3
  export const RELEASES_URL = 'https://github.com/blinkhost-ltd/blinkhost-cli/releases';
4
4
  export function supportedNodeVersion(version = process.versions.node) {
@@ -3,6 +3,22 @@ export declare function testProject(input: string[], json?: boolean): Promise<un
3
3
  export declare function observability(kind: 'logs' | 'metrics' | 'analytics', input: string[], profile?: string): Promise<unknown>;
4
4
  export declare function runPlugins(input: string[], json?: boolean): Promise<unknown>;
5
5
  export declare function completion(shell: string | undefined): string;
6
- export declare function checkForUpdate(): Promise<unknown>;
6
+ interface ReleaseCheck {
7
+ current_version: string;
8
+ latest_version: string | null;
9
+ update_available: boolean;
10
+ affected?: boolean;
11
+ impact?: string;
12
+ requires_action?: boolean;
13
+ summary?: string;
14
+ release_url?: string;
15
+ migration_url?: string;
16
+ install_command?: string;
17
+ automatic_install: false;
18
+ }
19
+ export declare function checkForUpdate(profile?: string, timeoutMs?: number): Promise<ReleaseCheck>;
20
+ export declare function releaseNotes(version?: string, profile?: string): Promise<unknown>;
21
+ export declare function maybeUpdateNotice(profile?: string): Promise<string | null>;
7
22
  export declare function ciCheck(profile?: string): Promise<unknown>;
8
23
  export declare function supportBundle(input: string[], profile?: string): Promise<unknown>;
24
+ export {};
package/dist/workflows.js CHANGED
@@ -4,7 +4,7 @@ import { hostname, platform, release } from 'node:os';
4
4
  import { basename, dirname, isAbsolute, join } from 'node:path';
5
5
  import { spawn } from 'node:child_process';
6
6
  import { ApiClient } from './api.js';
7
- import { readConfig, writeConfig } from './config.js';
7
+ import { activeProfile, readConfig, writeConfig } from './config.js';
8
8
  import { CliError, EXIT } from './errors.js';
9
9
  import { readProjectManifest, resolveLocalPath, validateProject } from './project.js';
10
10
  import { readProjectLink } from './remote.js';
@@ -177,12 +177,84 @@ const COMPLETIONS = {
177
177
  };
178
178
  export function completion(shell) { if (!shell || !COMPLETIONS[shell])
179
179
  throw new CliError('Choose bash, zsh, fish, or powershell.', EXIT.usage, 'invalid_shell'); return `${COMPLETIONS[shell]}\n`; }
180
- export async function checkForUpdate() {
181
- const response = await fetch('https://api.github.com/repos/blinkhost-ltd/blinkhost-cli/releases/latest', { headers: { Accept: 'application/vnd.github+json', 'User-Agent': `BlinkHost-CLI/${VERSION}` }, redirect: 'error' });
180
+ function versionTuple(value) {
181
+ const match = /^(\d+)\.(\d+)\.(\d+)(?:-[0-9A-Za-z.-]+)?$/.exec(value);
182
+ return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
183
+ }
184
+ function newerThan(candidate, current) {
185
+ const left = versionTuple(candidate);
186
+ const right = versionTuple(current);
187
+ if (!left || !right)
188
+ return false;
189
+ for (let index = 0; index < 3; index += 1) {
190
+ const candidatePart = left[index] ?? 0;
191
+ const currentPart = right[index] ?? 0;
192
+ if (candidatePart !== currentPart)
193
+ return candidatePart > currentPart;
194
+ }
195
+ return false;
196
+ }
197
+ async function releaseRequest(path, profile, timeoutMs = 3000) {
198
+ const selected = await activeProfile(profile);
199
+ return fetch(`${selected.profile.apiOrigin}${path}`, {
200
+ headers: { Accept: 'application/json', 'User-Agent': `BlinkHost-CLI/${VERSION}` },
201
+ redirect: 'error',
202
+ signal: AbortSignal.timeout(timeoutMs),
203
+ });
204
+ }
205
+ export async function checkForUpdate(profile, timeoutMs = 3000) {
206
+ const query = new URLSearchParams({ component: 'cli', channel: 'stable', current_version: VERSION });
207
+ const response = await releaseRequest(`/api/documentation/releases/latest/?${query}`, profile, timeoutMs);
182
208
  if (!response.ok)
183
209
  throw new CliError('The release service could not be reached.', EXIT.network, 'update_check_failed');
184
210
  const data = await response.json();
185
- return { current_version: VERSION, latest_version: data.tag_name?.replace(/^v/, '') || null, release_url: data.html_url || null, automatic_install: false };
211
+ return { ...data, current_version: VERSION, automatic_install: false };
212
+ }
213
+ export async function releaseNotes(version, profile) {
214
+ const query = new URLSearchParams({ component: 'cli', channel: 'stable' });
215
+ const response = await releaseRequest(`/api/documentation/releases/?${query}`, profile);
216
+ if (!response.ok)
217
+ throw new CliError('Release notes could not be loaded.', EXIT.network, 'release_notes_failed');
218
+ const payload = await response.json();
219
+ const rows = Array.isArray(payload) ? payload : (payload.results || []);
220
+ const releases = rows.filter((item) => Boolean(item && typeof item === 'object'));
221
+ if (version) {
222
+ const selected = releases.find((item) => item.version === version);
223
+ if (!selected)
224
+ throw new CliError(`No published CLI release notes were found for ${version}.`, EXIT.remote, 'release_not_found');
225
+ return selected;
226
+ }
227
+ return { component: 'cli', releases };
228
+ }
229
+ export async function maybeUpdateNotice(profile) {
230
+ if (!process.stderr.isTTY || process.env.CI || process.env.BLINKHOST_NO_UPDATE_NOTIFIER === '1')
231
+ return null;
232
+ const selected = await activeProfile(profile);
233
+ if (selected.config.updateNotifications === false)
234
+ return null;
235
+ const checkedAt = selected.config.updateCheckedAt ? Date.parse(selected.config.updateCheckedAt) : 0;
236
+ if (Number.isFinite(checkedAt) && Date.now() - checkedAt < 48 * 60 * 60 * 1000)
237
+ return null;
238
+ try {
239
+ const result = await checkForUpdate(profile, 500);
240
+ selected.config.updateCheckedAt = new Date().toISOString();
241
+ if (result.latest_version)
242
+ selected.config.latestVersion = result.latest_version;
243
+ else
244
+ delete selected.config.latestVersion;
245
+ if (result.release_url)
246
+ selected.config.latestReleaseUrl = result.release_url;
247
+ else
248
+ delete selected.config.latestReleaseUrl;
249
+ await writeConfig(selected.config);
250
+ if (!result.latest_version || !newerThan(result.latest_version, VERSION))
251
+ return null;
252
+ const instruction = result.install_command || `npm install --global @blinkhost/cli@${result.latest_version}`;
253
+ return `BlinkHost CLI ${result.latest_version} is available. Run ${instruction} or \`blinkhost update notes ${result.latest_version}\`.`;
254
+ }
255
+ catch {
256
+ return null;
257
+ }
186
258
  }
187
259
  export async function ciCheck(profile) {
188
260
  const client = await ApiClient.create(profile);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkhost/cli",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "Secure local and remote developer workflows for BlinkHost",
5
5
  "keywords": ["blinkhost", "deployment", "hosting", "cloud", "cli", "developer-tools"],
6
6
  "homepage": "https://app.blinkhost.me/docs/source-control/cli",
@@ -8,7 +8,7 @@
8
8
  "bugs": { "url": "https://github.com/blinkhost-ltd/blinkhost-cli/issues" },
9
9
  "type": "module",
10
10
  "bin": { "blinkhost": "dist/cli.js" },
11
- "files": ["dist/*.js", "dist/*.d.ts", "README.md", "LICENSE"],
11
+ "files": ["dist/*.js", "dist/*.d.ts", "README.md", "CHANGELOG.md", "LICENSE"],
12
12
  "engines": { "node": ">=22.12.0" },
13
13
  "scripts": {
14
14
  "build": "tsc -p tsconfig.json",