Skip to content

Commit dab847f

Browse files
committed
feat(cli): add update command
1 parent c39d383 commit dab847f

8 files changed

Lines changed: 402 additions & 183 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [5.23.0]
6+
7+
- added `update` command to self-update the CLI binary in-place
8+
- startup update notification now hints at `crystallize update` instead of showing the curl reinstall command
9+
510
## [5.22.1]
611

712
- fix dump mass-operation dump-content-model command when the tenant has no Piece.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@crystallize/cli",
3-
"version": "5.22.1",
3+
"version": "5.23.0",
44
"description": "Crystallize CLI",
55
"license": "MIT",
66
"contributors": [

src/command/update.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Command } from 'commander';
2+
import packageJson from '../../package.json';
3+
import type { Updater } from '../core/create-updater';
4+
5+
type Deps = {
6+
updater: Updater;
7+
};
8+
9+
export const createUpdateCommand = ({ updater }: Deps): Command => {
10+
const command = new Command('update');
11+
command.description('Update the Crystallize CLI to the latest version.');
12+
command.action(async () => {
13+
await updater.update(packageJson.version);
14+
});
15+
return command;
16+
};

src/content/completion_file.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ _crystallize_completions() {
44
local subcmd="${COMP_WORDS[2]}"
55
local subsubcmd="${COMP_WORDS[3]}"
66

7-
local commands="help changelog doc boilerplate tenant login whoami mass-operation token image file serve add-mcp add-skills update-skills"
7+
local commands="help changelog doc boilerplate tenant login whoami mass-operation token image file serve add-mcp add-skills update-skills update"
88
local program_options="--version"
99
local default_options="--help"
1010
local i_login_options="--no-interactive --token_id= --token_secret="
@@ -17,7 +17,7 @@ _crystallize_completions() {
1717
fi
1818

1919
case "${cmd}" in
20-
login|whoami|serve|add-skills|update-skills)
20+
login|whoami|serve|add-skills|update-skills|update)
2121
local options="${default_options}"
2222
COMPREPLY=($(compgen -W "${options}" -- "${cur}"))
2323
return 0

src/core/check-for-update.tsx

Lines changed: 0 additions & 177 deletions
This file was deleted.

0 commit comments

Comments
 (0)