diff --git a/package.json b/package.json
index 7398691c37..174b2dac31 100644
--- a/package.json
+++ b/package.json
@@ -15,9 +15,10 @@
"build:references": "pnpm --filter js-api-generator run build",
"build:releases": "pnpm --filter releases-generator run build",
"build:config": "pnpm --filter config-generator run build",
+ "build:cli": "pnpm --filter cli-generator run build",
"build:astro": "astro build",
"build:i18n": "pnpm --filter docs-i18n-tracker run build",
- "build": "pnpm dev:setup && pnpm build:references && pnpm build:config && pnpm build:releases && pnpm build:astro && pnpm build:i18n",
+ "build": "pnpm dev:setup && pnpm build:references && pnpm build:config && pnpm build:cli && pnpm build:releases && pnpm build:astro && pnpm build:i18n",
"preview": "astro preview"
},
"dependencies": {
diff --git a/packages/cli-generator/build.ts b/packages/cli-generator/build.ts
new file mode 100644
index 0000000000..42571275a2
--- /dev/null
+++ b/packages/cli-generator/build.ts
@@ -0,0 +1,100 @@
+import { readFileSync, writeFileSync } from 'node:fs';
+import { execSync } from 'node:child_process';
+import { slug } from 'github-slugger';
+
+interface Command {
+ name: string;
+ description: string;
+}
+
+function getSubcommands(commandOutput: string): Command[] {
+ const subcommands = [];
+
+ let readingSubcommands = false;
+ for (const line of commandOutput.split('\n').map((l) => l.trim())) {
+ if (readingSubcommands) {
+ if (line.length === 0) {
+ readingSubcommands = false;
+ } else {
+ const subcommand = line.substring(0, line.indexOf(' '));
+ const description = line.substring(subcommand.length).trim();
+ if (subcommand !== 'help') {
+ subcommands.push({ name: subcommand, description });
+ }
+ }
+ }
+ if (line === 'Commands:') {
+ readingSubcommands = true;
+ }
+ }
+
+ return subcommands;
+}
+
+function generateCommandDoc(command: string, level: number, subcommandList: Command[]): string {
+ const output = execSync(`pnpm tauri ${command} --help`)
+ .toString()
+ .replace('pnpm run build', 'tauri');
+ const subcommands = getSubcommands(output);
+
+ subcommandList.push(
+ ...subcommands.map((subcommand) => ({
+ ...subcommand,
+ name: `${command} ${subcommand.name}`,
+ }))
+ );
+
+ const subcommandsDoc =
+ subcommands.length === 0
+ ? ''
+ : `\n${subcommands.map(({ name }) => generateCommandDoc(`${command} ${name}`, level + 1, commandList)).join('\n\n')}`;
+
+ const heading = '#'.repeat(level);
+ return `${heading} \`${command}\`
+
+
+
+\`\`\`
+${output}
+\`\`\`
+${subcommandsDoc}
+`;
+}
+
+const output = execSync('pnpm tauri --help').toString();
+const subcommands = getSubcommands(output);
+
+const commandList: Command[] = [];
+
+let doc = '';
+
+for (const command of subcommands) {
+ commandList.push(command);
+ const commandDoc = generateCommandDoc(command.name, 3, commandList);
+ doc += commandDoc;
+}
+
+let summary = `| Command | Description |
+| ---------- | ------------------- |
+`;
+
+for (const { name, description } of commandList) {
+ summary += `| [\`${name}\`](#${slug(name)}) | ${description} |\n`;
+}
+
+const template = readFileSync('../../src/content/docs/reference/_cli.mdx').toString();
+
+writeFileSync(
+ '../../src/content/docs/reference/cli.mdx',
+ template.replace(
+ '$LIST_OF_COMMANDS',
+ `${summary}
+
+${doc}`
+ )
+);
diff --git a/packages/cli-generator/package.json b/packages/cli-generator/package.json
new file mode 100644
index 0000000000..1fe8d8b18d
--- /dev/null
+++ b/packages/cli-generator/package.json
@@ -0,0 +1,21 @@
+{
+ "name": "cli-generator",
+ "version": "1.0.0",
+ "private": "true",
+ "description": "",
+ "main": "index.js",
+ "type": "module",
+ "scripts": {
+ "build": "tsm ./build.ts"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "MIT",
+ "dependencies": {
+ "@tauri-apps/cli": "2.0.0-rc.3",
+ "@types/node": "^20.11.20",
+ "github-slugger": "^2.0.0",
+ "tsm": "^2.3.0",
+ "typescript": "^5.3.3"
+ }
+}
diff --git a/packages/cli-generator/tsconfig.json b/packages/cli-generator/tsconfig.json
new file mode 100644
index 0000000000..e70b1b2dab
--- /dev/null
+++ b/packages/cli-generator/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "compilerOptions": {
+ "target": "ES2021",
+ "esModuleInterop": true,
+ "strict": true,
+ "skipLibCheck": true
+ }
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index dd6e1be5f4..baf93a195f 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -71,6 +71,24 @@ importers:
specifier: ^0.10.0
version: 0.10.1(@astrojs/starlight@0.24.5(patch_hash=kv7yo3q5mkk7b2of2xzi4btao4)(astro@4.13.3(@types/node@22.2.0)(sass@1.77.8)(terser@5.31.0)(typescript@5.5.4)))(astro@4.13.3(@types/node@22.2.0)(sass@1.77.8)(terser@5.31.0)(typescript@5.5.4))
+ packages/cli-generator:
+ dependencies:
+ '@tauri-apps/cli':
+ specifier: 2.0.0-rc.3
+ version: 2.0.0-rc.3
+ '@types/node':
+ specifier: ^20.11.20
+ version: 20.14.15
+ github-slugger:
+ specifier: ^2.0.0
+ version: 2.0.0
+ tsm:
+ specifier: ^2.3.0
+ version: 2.3.0
+ typescript:
+ specifier: ^5.3.3
+ version: 5.5.4
+
packages/config-generator:
dependencies:
'@types/json-schema':
@@ -1273,6 +1291,71 @@ packages:
'@surma/rollup-plugin-off-main-thread@2.2.3':
resolution: {integrity: sha512-lR8q/9W7hZpMWweNiAKU7NQerBnzQQLvi8qnTDU/fxItPhtZVMbPV3lbCwjhIlNBe9Bbr5V+KHshvWmVSG9cxQ==}
+ '@tauri-apps/cli-darwin-arm64@2.0.0-rc.3':
+ resolution: {integrity: sha512-szYCSr/ChbCF+S6Wnr15TYpI2cZR07d+AQOiFGuScP0preM8Pbsk/sb0hfLwqzepjVFFNVWQba9sG7FEW2Y2XA==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@tauri-apps/cli-darwin-x64@2.0.0-rc.3':
+ resolution: {integrity: sha512-BJv6EJOY1DJbRzVtfg8CcBAlnS5OjhBAc5YKjh4BT7EyOcop8HStBSxhL6yjWrUP7eLR1iIsW/uSehVJwzYIdQ==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [darwin]
+
+ '@tauri-apps/cli-linux-arm-gnueabihf@2.0.0-rc.3':
+ resolution: {integrity: sha512-fwx805/xL4sF/EdMYqcUHQHzMYwo+OVTBTz5x/JWK8D57rnmLHAP+ZhnfFsZQLRo2QRT2l1Ye3bDyU+QRA1JFA==}
+ engines: {node: '>= 10'}
+ cpu: [arm]
+ os: [linux]
+
+ '@tauri-apps/cli-linux-arm64-gnu@2.0.0-rc.3':
+ resolution: {integrity: sha512-3KauzO1Ls4kuY0nr82S4X8XFxlQAMN+Mqp8LLqvQ+PPMp92XQAkPH7osQdoHIEoW5gsE69U2JaiQ5tHSqNM9og==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [linux]
+
+ '@tauri-apps/cli-linux-arm64-musl@2.0.0-rc.3':
+ resolution: {integrity: sha512-ngHS0foffm1xO5gqnDKGeYMKj8ceGmrFP5dDldoaaMQubw1SyFa0pRUjb7fZSYiO7F4SOSa8NYeMqlF9peZmnQ==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [linux]
+
+ '@tauri-apps/cli-linux-x64-gnu@2.0.0-rc.3':
+ resolution: {integrity: sha512-0/am9pVvuUHGmz32M8ffz1fpLnc08j3nzcRe5wUdL2AxfT+wKMII+Dn99GtCVgcdDW4jSXDMRUwrBkGocGC2OA==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [linux]
+
+ '@tauri-apps/cli-linux-x64-musl@2.0.0-rc.3':
+ resolution: {integrity: sha512-r7mRi8q8TqTFVjb9kAsU7IgwUgno2s8Ip4xwq9psQhlRE3JGEZQmSEcy1jqTjfl6KFh6lJcDR7l+9/EMhL/D3Q==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [linux]
+
+ '@tauri-apps/cli-win32-arm64-msvc@2.0.0-rc.3':
+ resolution: {integrity: sha512-2J6KjmDIQCw6HF1X6/yPcd+JLl7pxrH2zVMGmNllaoWhHeByvRobqFWnT7gcdHaA3dGTo432CwWvOgTgrINQpQ==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [win32]
+
+ '@tauri-apps/cli-win32-ia32-msvc@2.0.0-rc.3':
+ resolution: {integrity: sha512-8q75CsHDSEDdgi6xPwim+BaQZFCswK2Dn/qL38V3Mh9kmVvC8oGJMPC66bC20dF+v3KWeFm2FNNGQqOSXCveHg==}
+ engines: {node: '>= 10'}
+ cpu: [ia32]
+ os: [win32]
+
+ '@tauri-apps/cli-win32-x64-msvc@2.0.0-rc.3':
+ resolution: {integrity: sha512-qeBRJYalahxEXolekcpZJ/HBrIJacG2NWJBGhhi797mIwnbmlpbHMc8blIJtNNNwVUb2BjXuxKQVfojQ5YYrcg==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [win32]
+
+ '@tauri-apps/cli@2.0.0-rc.3':
+ resolution: {integrity: sha512-iNF95pieBmverl1EmQyqh+fhcIClS544fN5Ex5lAbYLTiHZ/gm3lOfVBhF6NPaKd/sfLuy7K1tfDXlHztBfANw==}
+ engines: {node: '>= 10'}
+ hasBin: true
+
'@types/acorn@4.0.6':
resolution: {integrity: sha512-veQTnWP+1D/xbxVrPC3zHnCZRjSrKfhbMUlEA43iMZLu7EsnTtkJklIuwrCPbOi8YkvDQAiW05VQQFvvz9oieQ==}
@@ -5119,6 +5202,49 @@ snapshots:
magic-string: 0.25.9
string.prototype.matchall: 4.0.11
+ '@tauri-apps/cli-darwin-arm64@2.0.0-rc.3':
+ optional: true
+
+ '@tauri-apps/cli-darwin-x64@2.0.0-rc.3':
+ optional: true
+
+ '@tauri-apps/cli-linux-arm-gnueabihf@2.0.0-rc.3':
+ optional: true
+
+ '@tauri-apps/cli-linux-arm64-gnu@2.0.0-rc.3':
+ optional: true
+
+ '@tauri-apps/cli-linux-arm64-musl@2.0.0-rc.3':
+ optional: true
+
+ '@tauri-apps/cli-linux-x64-gnu@2.0.0-rc.3':
+ optional: true
+
+ '@tauri-apps/cli-linux-x64-musl@2.0.0-rc.3':
+ optional: true
+
+ '@tauri-apps/cli-win32-arm64-msvc@2.0.0-rc.3':
+ optional: true
+
+ '@tauri-apps/cli-win32-ia32-msvc@2.0.0-rc.3':
+ optional: true
+
+ '@tauri-apps/cli-win32-x64-msvc@2.0.0-rc.3':
+ optional: true
+
+ '@tauri-apps/cli@2.0.0-rc.3':
+ optionalDependencies:
+ '@tauri-apps/cli-darwin-arm64': 2.0.0-rc.3
+ '@tauri-apps/cli-darwin-x64': 2.0.0-rc.3
+ '@tauri-apps/cli-linux-arm-gnueabihf': 2.0.0-rc.3
+ '@tauri-apps/cli-linux-arm64-gnu': 2.0.0-rc.3
+ '@tauri-apps/cli-linux-arm64-musl': 2.0.0-rc.3
+ '@tauri-apps/cli-linux-x64-gnu': 2.0.0-rc.3
+ '@tauri-apps/cli-linux-x64-musl': 2.0.0-rc.3
+ '@tauri-apps/cli-win32-arm64-msvc': 2.0.0-rc.3
+ '@tauri-apps/cli-win32-ia32-msvc': 2.0.0-rc.3
+ '@tauri-apps/cli-win32-x64-msvc': 2.0.0-rc.3
+
'@types/acorn@4.0.6':
dependencies:
'@types/estree': 1.0.5
@@ -5187,16 +5313,17 @@ snapshots:
'@types/node@22.2.0':
dependencies:
undici-types: 6.13.0
+ optional: true
'@types/resolve@1.17.1':
dependencies:
- '@types/node': 22.2.0
+ '@types/node': 20.14.15
'@types/retry@0.12.2': {}
'@types/sax@1.2.7':
dependencies:
- '@types/node': 17.0.45
+ '@types/node': 20.14.15
'@types/trusted-types@2.0.7': {}
@@ -6505,7 +6632,7 @@ snapshots:
jest-worker@26.6.2:
dependencies:
- '@types/node': 22.2.0
+ '@types/node': 20.14.15
merge-stream: 2.0.0
supports-color: 7.2.0
@@ -8003,7 +8130,8 @@ snapshots:
undici-types@5.26.5: {}
- undici-types@6.13.0: {}
+ undici-types@6.13.0:
+ optional: true
unicode-canonical-property-names-ecmascript@2.0.0: {}
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 46e2ae91db..9310e0c71f 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -2,5 +2,6 @@ packages:
- 'packages/i18n-tracker'
- 'packages/js-api-generator'
- 'packages/config-generator'
+ - 'packages/cli-generator'
- 'packages/tauri-typedoc-theme'
- 'packages/releases-generator'
diff --git a/src/content/docs/reference/.gitignore b/src/content/docs/reference/.gitignore
index 8f0e898675..ab8924aded 100644
--- a/src/content/docs/reference/.gitignore
+++ b/src/content/docs/reference/.gitignore
@@ -1,4 +1,5 @@
config.md
acl/*.md
+cli.mdx
javascript/*
!javascript/index.mdx
diff --git a/src/content/docs/reference/_cli.mdx b/src/content/docs/reference/_cli.mdx
new file mode 100644
index 0000000000..6820d3a68e
--- /dev/null
+++ b/src/content/docs/reference/_cli.mdx
@@ -0,0 +1,32 @@
+---
+title: Command Line Interface
+sidebar:
+ order: 1
+tableOfContents:
+ minHeadingLevel: 2
+ maxHeadingLevel: 5
+---
+
+import { Tabs, TabItem } from '@astrojs/starlight/components';
+import CommandTabs from '@components/CommandTabs.astro';
+
+The Tauri command line interface (CLI) is the way to interact with Tauri throughout the development lifecycle.
+
+You can add the Tauri CLI to your current project using your package manager of choice:
+
+
+
+:::tip[Developing a Plugin]
+
+For CLI commands related to developing plugins visit the [Develop a Tauri Plugin guide](/develop/plugins/).
+
+:::
+
+## List of Commands
+
+$LIST_OF_COMMANDS
diff --git a/src/content/docs/reference/cli.mdx b/src/content/docs/reference/cli.mdx
deleted file mode 100644
index 468343197c..0000000000
--- a/src/content/docs/reference/cli.mdx
+++ /dev/null
@@ -1,666 +0,0 @@
----
-title: Command Line Interface
-sidebar:
- order: 1
----
-
-import { Tabs, TabItem } from '@astrojs/starlight/components';
-import CommandTabs from '@components/CommandTabs.astro';
-
-The Tauri command line interface (CLI) is the way to interact with Tauri throughout the development lifecycle.
-
-You can add the Tauri CLI to your current project using your package manager of choice:
-
-
-{/* TODO: 2.0 */}
-
-:::tip[Developing a Plugin]
-
-For CLI commands related to developing plugins visit the [Develop a Tauri Plugin guide](/develop/plugins/).
-
-:::
-
-## List of Commands
-
-| Command | Description |
-| ----------------------------- | -------------------------------------------------------------------- |
-| [`build`](#build) | Tauri build |
-| [`dev`](#dev) | Tauri dev |
-| [`icon`](#icon) | Generates various icons for all major platforms |
-| [`info`](#info) | Shows information about Tauri dependencies and project configuration |
-| [`init`](#init) | Initializes a Tauri project |
-| [`add`](#add) | Manage Tauri plugins |
-| [`signer`](#signer) | Tauri updater signer |
-| [`completions`](#completions) | Shell completions |
-| [`ios`](#ios) | iOS commands |
-| [`android`](#android) | Android commands |
-| [`migrate`](#migrate) | Migrate from v1 to v2 |
-| [`permission`](#permission) | Manage permissions |
-| [`capability`](#capability) | Manage permissions |
-| [`help`](#help) | Print this message or the help of the given subcommand(s) |
-
-## `build`
-
-
-
-```
-Tauri build
-
-Usage: cargo tauri build [OPTIONS] [ARGS]...
-
-Arguments:
- [ARGS]...
- Command line arguments passed to the runner
-
-Options:
- -r, --runner
- Binary to use to build the application, defaults to `cargo`
- -v, --verbose...
- Enables verbose logging
- -d, --debug
- Builds with the debug flag
- -t, --target
- Target triple to build against.
- It must be one of the values outputted by `$rustc --print target-list` or `universal-apple-darwin` for an universal macOS application.
- Note that compiling an universal macOS application requires both `aarch64-apple-darwin` and `x86_64-apple-darwin` targets to be installed.
- -f, --features [...]
- Space or comma separated list of features to activate
- -b, --bundles [...]
- Space or comma separated list of bundles to package.
- Each bundle must be one of `deb`, `appimage`, `msi`, `app` or `dmg` on MacOS and `updater` on all platforms.
- Note that the `updater` bundle is not automatically added so you must specify it if the updater is enabled.
- --no-bundle
- Bundler will be skipped
- -c, --config
- JSON string or path to JSON file to merge with tauri.conf.json
- --ci
- Skip prompting for values
- -h, --help
- Print help (see a summary with '-h')
- -V, --version
- Print version
-```
-
-## `dev`
-
-
-
-```
-Tauri dev
-
-Usage: cargo tauri dev [OPTIONS] [ARGS]...
-
-Arguments:
- [ARGS]... Command line arguments passed to the runner. Arguments after `--` are passed to the application
-
-Options:
- -r, --runner Binary to use to run the application
- -v, --verbose... Enables verbose logging
- -t, --target Target triple to build against
- -f, --features [...] List of cargo features to activate
- -e, --exit-on-panic Exit on panic
- -c, --config JSON string or path to JSON file to merge with tauri.conf.json
- --release Run the code in release mode
- --no-watch Disable the file watcher
- --no-dev-server Disable the dev server for static files
- --port Specify port for the dev server for static files. Defaults to 1430 Can also be set using `TAURI_DEV_SERVER_PORT` env var
- --force-ip-prompt Force prompting for an IP to use to connect to the dev server on mobile
- -h, --help Print help
- -V, --version Print version
-```
-
-This command will open the WebView in development mode. It makes use of the `build.devPath` property from your `tauri.conf.json` file.
-
-If you have entered a command to the `build.beforeDevCommand` property, this one will be executed before the dev command.
-
-## `icon`
-
-
-
-```
-Generates various icons for all major platforms
-
-Usage: cargo tauri icon [OPTIONS] [INPUT]
-
-Arguments:
- [INPUT] Path to the source icon (png, 1240x1240px with transparency) [default: ./app-icon.png]
-
-Options:
- -o, --output