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
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Change Log

## 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`
* Updated: Removed `oauth2 approve` command, meant for the console consent screen only
* Updated: `--scope` on `oauth2 authorize` is now optional and supports the `phone` scope
* Updated: CLI OAuth login now requests the `all` scope instead of `account.admin`
* Updated: Skills install now uses the `appwrite/skills` repository
* Updated: API key scope limits raised from 100 to 200 scopes
* Fixed: Empty error messages now fall back to the response body instead of a bare `Error:`
* Updated: Verbose error output is formatted with colored details and indented stack traces

## 22.3.0

* Added: Regional cloud endpoints are now derived from your configured endpoint in `init` and `push`
Expand Down
8 changes: 4 additions & 4 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.3.0
22.4.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.3.0
22.4.0
```

## Getting Started
Expand All @@ -97,7 +97,7 @@ $ appwrite login
? Enter your password ********
✓ Success
```
This will also prompt you to enter your Appwrite endpoint ( default: http://localhost/v1 )
This will also prompt you to enter your Appwrite endpoint ( default: http://localhost:9520/v1 )

* ### Initialising your project
Once logged in, the CLI needs to be initialised before you can use it with your Appwrite project. You can do this with the `appwrite init project` command.
Expand Down Expand Up @@ -227,7 +227,7 @@ $ appwrite client --reset
The Appwrite CLI can also work in a CI environment. The initialisation of the CLI works a bit differently in CI. In CI, you set your `endpoint`, `projectId` and `API Key` using

```sh
appwrite client --endpoint http://localhost/v1 --projectId <PROJECT_ID> --key <API KEY>
appwrite client --endpoint http://localhost:9520/v1 --projectId <PROJECT_ID> --key <API KEY>
```


Expand Down
4 changes: 0 additions & 4 deletions docs/examples/account/list-logs.md

This file was deleted.

6 changes: 0 additions & 6 deletions docs/examples/databases/list-collection-logs.md

This file was deleted.

7 changes: 0 additions & 7 deletions docs/examples/databases/list-document-logs.md

This file was deleted.

5 changes: 0 additions & 5 deletions docs/examples/databases/list-logs.md

This file was deleted.

5 changes: 0 additions & 5 deletions docs/examples/messaging/list-message-logs.md

This file was deleted.

5 changes: 0 additions & 5 deletions docs/examples/messaging/list-provider-logs.md

This file was deleted.

5 changes: 0 additions & 5 deletions docs/examples/messaging/list-subscriber-logs.md

This file was deleted.

5 changes: 0 additions & 5 deletions docs/examples/messaging/list-topic-logs.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/examples/oauth2/approve.md

This file was deleted.

3 changes: 1 addition & 2 deletions docs/examples/oauth2/authorize.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
appwrite oauth-2 authorize \
--client-_id <CLIENT_ID> \
--redirect-_uri https://example.com \
--response-_type code \
--scope <SCOPE>
--response-_type code
```
7 changes: 0 additions & 7 deletions docs/examples/tablesdb/list-row-logs.md

This file was deleted.

6 changes: 0 additions & 6 deletions docs/examples/tablesdb/list-table-logs.md

This file was deleted.

5 changes: 0 additions & 5 deletions docs/examples/teams/list-logs.md

This file was deleted.

5 changes: 0 additions & 5 deletions docs/examples/users/list-logs.md

This file was deleted.

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.3.0/appwrite-cli-win-x64.exe"
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/22.3.0/appwrite-cli-win-arm64.exe"
$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"

$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.3.0"
GITHUB_LATEST_VERSION="22.4.0"
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"

Expand Down
3 changes: 2 additions & 1 deletion lib/auth/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { SessionData } from "../types.js";
import ClientLegacy from "../client.js";
import { OAUTH2_CLIENT_ID } from "../constants.js";
import { revokeRefreshToken } from "./oauth.js";
import { getErrorMessage } from "../utils.js";
import {
deleteStoredRefreshToken,
getStoredRefreshToken,
Expand Down Expand Up @@ -124,7 +125,7 @@ export const deleteServerSession = async (
} catch (e) {
return {
deleted: false,
error: e instanceof Error ? e.message : String(e),
error: getErrorMessage(e),
};
}
};
Expand Down
8 changes: 2 additions & 6 deletions lib/commands/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,8 @@ export const logout = new Command("logout")
remainingSessions[0];
globalConfig.setCurrentSession(nextSession.id);

if (!logoutFailed) {
success(
nextSession.email
? `Switched to ${nextSession.email}`
: `Switched to session at ${nextSession.endpoint}`,
);
if (!logoutFailed && nextSession.email) {
success(`Switched to ${nextSession.email}`);
}
Comment thread
ChiragAgg5k marked this conversation as resolved.
} else if (remainingSessions.length === 0) {
globalConfig.setCurrentSession("");
Expand Down
6 changes: 3 additions & 3 deletions lib/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ const installInitProjectSkills = async (): Promise<void> => {
}
} catch (e) {
const msg = e instanceof Error ? e.message : String(e);
error(`Failed to install agent skills: ${msg}`);
error(`Failed to install skills: ${msg}`);
hint(`You can install them later with '${EXECUTABLE_NAME} init skill'.`);
}
};
Expand Down Expand Up @@ -573,7 +573,7 @@ const initSkill = async (): Promise<void> => {
process.chdir(localConfig.configDirectoryPath);
const cwd = process.cwd();

log("Fetching available Appwrite agent skills ...");
log("Fetching available Appwrite skills ...");
const { skills, tempDir } = fetchAvailableSkills();

try {
Expand Down Expand Up @@ -1089,7 +1089,7 @@ init
init
.command("skill")
.alias("skills")
.description("Install Appwrite agent skills for AI coding agents")
.description("Install Appwrite skills for AI coding agents")
.action(actionRunner(initSkill));

init
Expand Down
24 changes: 2 additions & 22 deletions lib/commands/services/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ const accountCreateKeyCommand = account
.command(`create-key`)
.description(`Create a new account API key.`)
.requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
.requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 100 scopes are allowed.`)
.requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 200 scopes are allowed.`)
.option(`--expire <expire>`, `Expiration time in ISO 8601 (https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.`)
.action(
actionRunner(
Expand All @@ -181,7 +181,7 @@ const accountUpdateKeyCommand = account
.description(`Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key.`)
.requiredOption(`--key-id <key-id>`, `Key unique ID.`)
.requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
.requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 100 scopes are allowed.`)
.requiredOption(`--scopes [scopes...]`, `Key scopes list. Maximum of 200 scopes are allowed.`)
.option(`--expire <expire>`, `Expiration time in ISO 8601 (https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.`)
.action(
actionRunner(
Expand All @@ -203,26 +203,6 @@ 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
48 changes: 0 additions & 48 deletions lib/commands/services/databases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1357,23 +1357,6 @@ const databasesDeleteDocumentCommand = databases
);


const databasesListDocumentLogsCommand = databases
.command(`list-document-logs`)
.description(`Get the document activity logs list by its unique ID.`)
.requiredOption(`--database-id <database-id>`, `Database ID.`)
.requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
.requiredOption(`--document-id <document-id>`, `Document ID.`)
.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(`--limit <limit>`, `Maximum number of results to return.`, parseInteger)
.option(`--offset <offset>`, `Number of results to skip.`, parseInteger)
.action(
actionRunner(
async ({ databaseId, collectionId, documentId, queries, limit, offset }) =>
parse(await (await getDatabasesClient()).listDocumentLogs(databaseId, collectionId, documentId, buildQueries({ queries, limit, offset }))),
),
);


const databasesDecrementDocumentAttributeCommand = databases
.command(`decrement-document-attribute`)
.description(`Decrement a specific attribute of a document by a given value.`)
Expand Down Expand Up @@ -1485,22 +1468,6 @@ const databasesDeleteIndexCommand = databases
);


const databasesListCollectionLogsCommand = databases
.command(`list-collection-logs`)
.description(`Get the collection activity logs list by its unique ID.`)
.requiredOption(`--database-id <database-id>`, `Database ID.`)
.requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
.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(`--limit <limit>`, `Maximum number of results to return.`, parseInteger)
.option(`--offset <offset>`, `Number of results to skip.`, parseInteger)
.action(
actionRunner(
async ({ databaseId, collectionId, queries, limit, offset }) =>
parse(await (await getDatabasesClient()).listCollectionLogs(databaseId, collectionId, buildQueries({ queries, limit, offset }))),
),
);


const databasesGetCollectionUsageCommand = databases
.command(`get-collection-usage`)
.description(`Get usage metrics and statistics for a collection. Returning the total number of documents. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`)
Expand All @@ -1515,21 +1482,6 @@ const databasesGetCollectionUsageCommand = databases
);


const databasesListLogsCommand = databases
.command(`list-logs`)
.description(`Get the database activity logs list by its unique ID.`)
.requiredOption(`--database-id <database-id>`, `Database ID.`)
.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(`--limit <limit>`, `Maximum number of results to return.`, parseInteger)
.option(`--offset <offset>`, `Number of results to skip.`, parseInteger)
.action(
actionRunner(
async ({ databaseId, queries, limit, offset }) =>
parse(await (await getDatabasesClient()).listLogs(databaseId, buildQueries({ queries, limit, offset }))),
),
);


const databasesGetUsageCommand = databases
.command(`get-usage`)
.description(`Get usage metrics and statistics for a database. You can view the total number of collections, documents, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`)
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/services/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const functionsCreateCommand = functions
)
.option(`--entrypoint <entrypoint>`, `Entrypoint File. This path is relative to the "providerRootDirectory".`)
.option(`--commands <commands>`, `Build Commands.`)
.option(`--scopes [scopes...]`, `List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.`)
.option(`--scopes [scopes...]`, `List of scopes allowed for API key auto-generated for every execution. Maximum of 200 scopes are allowed.`)
.option(`--installation-id <installation-id>`, `Appwrite Installation ID for VCS (Version Control System) deployment.`)
.option(`--provider-repository-id <provider-repository-id>`, `Repository ID of the repo linked to the function.`)
.option(`--provider-branch <provider-branch>`, `Production branch for the repo linked to the function.`)
Expand Down Expand Up @@ -213,7 +213,7 @@ const functionsUpdateCommand = functions
)
.option(`--entrypoint <entrypoint>`, `Entrypoint File. This path is relative to the "providerRootDirectory".`)
.option(`--commands <commands>`, `Build Commands.`)
.option(`--scopes [scopes...]`, `List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed.`)
.option(`--scopes [scopes...]`, `List of scopes allowed for API Key auto-generated for every execution. Maximum of 200 scopes are allowed.`)
.option(`--installation-id <installation-id>`, `Appwrite Installation ID for VCS (Version Controle System) deployment.`)
.option(`--provider-repository-id <provider-repository-id>`, `Repository ID of the repo linked to the function`)
.option(`--provider-branch <provider-branch>`, `Production branch for the repo linked to the function`)
Expand Down
Loading