Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ jobs:
echo "tag=latest" >> "$GITHUB_OUTPUT"
fi

- name: Audit npm dependencies
run: |
# CLI builds with Bun, but npm audit reads package-lock.json.
# update-lockfiles.sh updates both lockfiles; this catches npm lock drift.
npm install --package-lock-only --ignore-scripts
git diff --exit-code package-lock.json
npm audit --audit-level=high --omit=dev
Comment on lines +146 to +151

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Lock-drift check may produce false failures across npm versions

npm install --package-lock-only regenerates package-lock.json using the npm version present on the runner. If CI uses a different npm version than the one used to commit the lockfile (e.g. a developer on npm 10 vs the runner on npm 9 or vice-versa), the regenerated lockfile will differ in formatting or resolved fields and git diff --exit-code will fail — blocking the publish even when there is no real drift. Pinning the npm version in this step (e.g. npm install -g npm@<version>) or documenting the exact required npm version would avoid spurious failures.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/publish.yml
Line: 146-151

Comment:
**Lock-drift check may produce false failures across npm versions**

`npm install --package-lock-only` regenerates `package-lock.json` using the npm version present on the runner. If CI uses a different npm version than the one used to commit the lockfile (e.g. a developer on npm 10 vs the runner on npm 9 or vice-versa), the regenerated lockfile will differ in formatting or resolved fields and `git diff --exit-code` will fail — blocking the publish even when there is no real drift. Pinning the npm version in this step (e.g. `npm install -g npm@<version>`) or documenting the exact required npm version would avoid spurious failures.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code Fix in Codex


- name: Publish
run: npm publish --provenance --access public --tag ${{ steps.release_tag.outputs.tag }}

Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Change Log

## 22.5.0

* Updated: `tablesdb create` now takes `--specification` instead of `--dedicated-database-id`
* Updated: Removed `health get-queue-logs` command
* Added: `notifications` command group for console notifications
* Added: `organization get`, `update`, and `delete` commands
* Added: `organization list-memberships`, `create-membership`, `get-membership`, `update-membership`, and `delete-membership` commands
* Added: `tablesdb list-migrations`, `create-migration`, `get-migration`, and `delete-migration` commands for dedicated database migrations
* Added: `oauth2 create-par`, `list-organizations`, and `list-projects` commands
* Added: `--request-_uri` option on `oauth2 authorize`; client ID, redirect URI, and response type are now optional
* Added: `projects list-addons`, `get-addon`, `delete-addon`, `confirm-addon-payment`, and `get-addon-price` commands
* Added: `create-premium-geo-db-addon` command on `projects` and `organizations`
* Added: `account list-logs`, `teams list-logs`, and `users list-logs` commands
* Added: `health get-geo` and `get-geo-premium` commands
* Added: `--new-specification` option on `backups create-restoration`
* Added: `--prompt` and `--max-age` options on `project update-o-auth-2-oidc`
* Fixed: Project config validation now sends the `X-Appwrite-Project` header, fixing 401 errors for guest sessions
* Fixed: Update check now reads the latest version from the Homebrew tap instead of stale local metadata

## 22.4.0

* Updated: Removed pre-release activity log commands `list-logs`, `list-collection-logs`, `list-document-logs`, `list-table-logs`, `list-row-logs`, `list-message-logs`, `list-provider-logs`, `list-subscriber-logs`, and `list-topic-logs`
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using

```sh
$ appwrite -v
22.4.0
22.5.0
```

### Install using prebuilt binaries
Expand Down Expand Up @@ -83,7 +83,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
Once the installation completes, you can verify your install using
```
$ appwrite -v
22.4.0
22.5.0
```

## Getting Started
Expand Down
26 changes: 2 additions & 24 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { health } from './lib/commands/services/health.js';
import { locale } from './lib/commands/services/locale.js';
import { messaging } from './lib/commands/services/messaging.js';
import { migrations } from './lib/commands/services/migrations.js';
import { notifications } from './lib/commands/services/notifications.js';
import { oauth2 } from './lib/commands/services/oauth-2.js';
import { organization } from './lib/commands/services/organization.js';
import { organizations } from './lib/commands/services/organizations.js';
Expand Down Expand Up @@ -217,6 +218,7 @@ if (process.argv.includes('-v') || process.argv.includes('--version')) {
.addCommand(locale)
.addCommand(messaging)
.addCommand(migrations)
.addCommand(notifications)
.addCommand(oauth2)
.addCommand(organization)
.addCommand(organizations)
Expand Down
4 changes: 4 additions & 0 deletions docs/examples/account/list-logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```bash
appwrite account list-logs \
--limit 25
```
3 changes: 3 additions & 0 deletions docs/examples/health/get-geo-premium.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```bash
appwrite health get-geo-premium
```
3 changes: 3 additions & 0 deletions docs/examples/health/get-geo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```bash
appwrite health get-geo
```
3 changes: 0 additions & 3 deletions docs/examples/health/get-queue-logs.md

This file was deleted.

4 changes: 4 additions & 0 deletions docs/examples/notifications/list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```bash
appwrite notifications list \
--limit 25
```
5 changes: 5 additions & 0 deletions docs/examples/notifications/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```bash
appwrite notifications update \
--notification-id <NOTIFICATION_ID> \
--read false
```
5 changes: 1 addition & 4 deletions docs/examples/oauth2/authorize.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
```bash
appwrite oauth-2 authorize \
--client-_id <CLIENT_ID> \
--redirect-_uri https://example.com \
--response-_type code
appwrite oauth-2 authorize
```
7 changes: 7 additions & 0 deletions docs/examples/oauth2/create-par.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```bash
appwrite oauth-2 create-par \
--client-_id <CLIENT_ID> \
--redirect-_uri https://example.com \
--response-_type code \
--scope <SCOPE>
```
3 changes: 3 additions & 0 deletions docs/examples/oauth2/list-organizations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```bash
appwrite oauth-2 list-organizations
```
3 changes: 3 additions & 0 deletions docs/examples/oauth2/list-projects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```bash
appwrite oauth-2 list-projects
```
4 changes: 4 additions & 0 deletions docs/examples/organization/create-membership.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```bash
appwrite organization create-membership \
--roles one two three
```
4 changes: 4 additions & 0 deletions docs/examples/organization/delete-membership.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```bash
appwrite organization delete-membership \
--membership-id <MEMBERSHIP_ID>
```
3 changes: 3 additions & 0 deletions docs/examples/organization/delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```bash
appwrite organization delete
```
4 changes: 4 additions & 0 deletions docs/examples/organization/get-membership.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```bash
appwrite organization get-membership \
--membership-id <MEMBERSHIP_ID>
```
3 changes: 3 additions & 0 deletions docs/examples/organization/get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```bash
appwrite organization get
```
4 changes: 4 additions & 0 deletions docs/examples/organization/list-memberships.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```bash
appwrite organization list-memberships \
--limit 25
```
5 changes: 5 additions & 0 deletions docs/examples/organization/update-membership.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```bash
appwrite organization update-membership \
--membership-id <MEMBERSHIP_ID> \
--roles one two three
```
4 changes: 4 additions & 0 deletions docs/examples/organization/update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```bash
appwrite organization update \
--name <NAME>
```
4 changes: 4 additions & 0 deletions docs/examples/organizations/create-premium-geo-db-addon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```bash
appwrite organizations create-premium-geo-db-addon \
--organization-id <ORGANIZATION_ID>
```
5 changes: 5 additions & 0 deletions docs/examples/projects/confirm-addon-payment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```bash
appwrite projects confirm-addon-payment \
--project-id <PROJECT_ID> \
--addon-id <ADDON_ID>
```
4 changes: 4 additions & 0 deletions docs/examples/projects/create-premium-geo-db-addon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```bash
appwrite projects create-premium-geo-db-addon \
--project-id <PROJECT_ID>
```
5 changes: 5 additions & 0 deletions docs/examples/projects/delete-addon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```bash
appwrite projects delete-addon \
--project-id <PROJECT_ID> \
--addon-id <ADDON_ID>
```
5 changes: 5 additions & 0 deletions docs/examples/projects/get-addon-price.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```bash
appwrite projects get-addon-price \
--project-id <PROJECT_ID> \
--addon baa
```
5 changes: 5 additions & 0 deletions docs/examples/projects/get-addon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```bash
appwrite projects get-addon \
--project-id <PROJECT_ID> \
--addon-id <ADDON_ID>
```
4 changes: 4 additions & 0 deletions docs/examples/projects/list-addons.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```bash
appwrite projects list-addons \
--project-id <PROJECT_ID>
```
5 changes: 5 additions & 0 deletions docs/examples/tablesdb/create-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```bash
appwrite tables-db create-migration \
--database-id <DATABASE_ID> \
--specification s-1vcpu-1gb
```
5 changes: 5 additions & 0 deletions docs/examples/tablesdb/delete-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```bash
appwrite tables-db delete-migration \
--database-id <DATABASE_ID> \
--migration-id <MIGRATION_ID>
```
5 changes: 5 additions & 0 deletions docs/examples/tablesdb/get-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```bash
appwrite tables-db get-migration \
--database-id <DATABASE_ID> \
--migration-id <MIGRATION_ID>
```
4 changes: 4 additions & 0 deletions docs/examples/tablesdb/list-migrations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```bash
appwrite tables-db list-migrations \
--database-id <DATABASE_ID>
```
5 changes: 5 additions & 0 deletions docs/examples/teams/list-logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```bash
appwrite teams list-logs \
--team-id <TEAM_ID> \
--limit 25
```
5 changes: 5 additions & 0 deletions docs/examples/users/list-logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```bash
appwrite users list-logs \
--user-id <USER_ID> \
--limit 25
```
4 changes: 2 additions & 2 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# You can use "View source" of this page to see the full script.

# REPO
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/22.4.0/appwrite-cli-win-x64.exe"
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/22.4.0/appwrite-cli-win-arm64.exe"
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/22.5.0/appwrite-cli-win-x64.exe"
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/22.5.0/appwrite-cli-win-arm64.exe"

$APPWRITE_BINARY_NAME = "appwrite.exe"

Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ verifyMacOSCodeSignature() {
downloadBinary() {
echo "[2/5] Downloading executable for $OS ($ARCH) ..."

GITHUB_LATEST_VERSION="22.4.0"
GITHUB_LATEST_VERSION="22.5.0"
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"

Expand Down
20 changes: 20 additions & 0 deletions lib/commands/services/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,26 @@ const accountDeleteKeyCommand = account
);


const accountListLogsCommand = account
.command(`list-logs`)
.description(`Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.`)
.option(`--queries [queries...]`, `Raw Appwrite JSON query strings (legacy). Use this for advanced queries or automation; for common pagination prefer --limit and --offset. When mixed, raw --queries are sent before generated flag queries. Array of query strings generated using the Query class provided by the SDK. Learn more about queries (https://appwrite.io/docs/queries). Only supported methods are limit and offset`)
.option(
`--total [value]`,
`When set to false, the total count returned will be 0 and will not be calculated.`,
(value: string | undefined) =>
value === undefined ? true : parseBool(value),
)
.option(`--limit <limit>`, `Maximum number of results to return.`, parseInteger)
.option(`--offset <offset>`, `Number of results to skip.`, parseInteger)
.action(
actionRunner(
async ({ queries, total, limit, offset }) =>
parse(await (await getAccountClient()).listLogs(buildQueries({ queries, limit, offset }), total)),
),
);


const accountUpdateMFACommand = account
.command(`update-mfa`)
.description(`Enable or disable MFA on an account.`)
Expand Down
10 changes: 7 additions & 3 deletions lib/commands/services/backups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,19 @@ const backupsDeletePolicyCommand = backups

const backupsCreateRestorationCommand = backups
.command(`create-restoration`)
.description(`Create and trigger a new restoration for a backup on a project.`)
.description(`Create and trigger a new restoration for a backup on a project.

When restoring a DocumentsDB or VectorsDB database to a new resource, pass \`newSpecification\` to provision the restored database on a different specification than the archived one (for example, restoring onto a larger or smaller dedicated database). Use \`serverless\` to restore onto the shared pool, or a dedicated specification slug to restore onto a dedicated database of that size. The specification must be permitted by the organization's plan. \`newSpecification\` is not supported for legacy/TablesDB databases or for bucket restores.
`)
.requiredOption(`--archive-id <archive-id>`, `Backup archive ID to restore`)
.requiredOption(`--services [services...]`, `Array of services to restore`)
.option(`--new-resource-id <new-resource-id>`, `Unique Id. Choose a custom ID or generate a random ID with \`ID.unique()\`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
.option(`--new-resource-name <new-resource-name>`, `Database name. Max length: 128 chars.`)
.option(`--new-specification <new-specification>`, `Specification to provision the restored database on, when restoring a DocumentsDB or VectorsDB database to a new resource. Defaults to the archived database's specification. Use \`serverless\` for the shared pool or a dedicated specification slug.`)
.action(
actionRunner(
async ({ archiveId, services, newResourceId, newResourceName }) =>
parse(await (await getBackupsClient()).createRestoration(archiveId, services, newResourceId, newResourceName)),
async ({ archiveId, services, newResourceId, newResourceName, newSpecification }) =>
parse(await (await getBackupsClient()).createRestoration(archiveId, services, newResourceId, newResourceName, newSpecification)),
),
);

Expand Down
Loading