Skip to content

Commit 70ed744

Browse files
authored
feat: add algokit init example command
Feature/add example init cmd
2 parents 71088cf + 2864a42 commit 70ed744

28 files changed

+1299
-506
lines changed

docs/cli/index.md

Lines changed: 65 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,14 @@
8989
- [--ide, --no-ide](#--ide---no-ide)
9090
- [--workspace, --no-workspace](#--workspace---no-workspace)
9191
- [-a, --answer ](#-a---answer--)
92+
- [example](#example)
93+
- [Options](#options-13)
94+
- [-l, --list](#-l---list)
95+
- [Arguments](#arguments-9)
96+
- [EXAMPLE_ID](#example_id)
9297
- [localnet](#localnet)
9398
- [codespace](#codespace)
94-
- [Options](#options-13)
99+
- [Options](#options-14)
95100
- [-m, --machine ](#-m---machine-)
96101
- [-a, --algod-port ](#-a---algod-port-)
97102
- [-i, --indexer-port ](#-i---indexer-port-)
@@ -101,22 +106,22 @@
101106
- [-t, --timeout ](#-t---timeout-)
102107
- [-f, --force](#-f---force-1)
103108
- [config](#config-1)
104-
- [Options](#options-14)
109+
- [Options](#options-15)
105110
- [-f, --force](#-f---force-2)
106-
- [Arguments](#arguments-9)
111+
- [Arguments](#arguments-10)
107112
- [ENGINE](#engine-1)
108113
- [console](#console)
109114
- [explore](#explore-1)
110115
- [logs](#logs)
111-
- [Options](#options-15)
116+
- [Options](#options-16)
112117
- [--follow, -f](#--follow--f)
113118
- [--tail ](#--tail-)
114119
- [reset](#reset)
115-
- [Options](#options-16)
120+
- [Options](#options-17)
116121
- [--update, --no-update](#--update---no-update)
117122
- [-P, --config-dir ](#-p---config-dir-)
118123
- [start](#start)
119-
- [Options](#options-17)
124+
- [Options](#options-18)
120125
- [-n, --name ](#-n---name--1)
121126
- [-P, --config-dir ](#-p---config-dir--1)
122127
- [-d, --dev, --no-dev](#-d---dev---no-dev)
@@ -125,54 +130,54 @@
125130
- [stop](#stop)
126131
- [project](#project)
127132
- [bootstrap](#bootstrap)
128-
- [Options](#options-18)
129-
- [--force](#--force-1)
130133
- [Options](#options-19)
134+
- [--force](#--force-1)
135+
- [Options](#options-20)
131136
- [--interactive, --no-ci, --non-interactive, --ci](#--interactive---no-ci---non-interactive---ci)
132137
- [-p, --project-name ](#-p---project-name-)
133138
- [-t, --type ](#-t---type-)
134-
- [Options](#options-20)
135-
- [--interactive, --non-interactive, --ci](#--interactive---non-interactive---ci)
136139
- [Options](#options-21)
140+
- [--interactive, --non-interactive, --ci](#--interactive---non-interactive---ci)
141+
- [Options](#options-22)
137142
- [--ci, --no-ci](#--ci---no-ci)
138143
- [deploy](#deploy)
139-
- [Options](#options-22)
144+
- [Options](#options-23)
140145
- [-C, -c, --command ](#-c--c---command-)
141146
- [--interactive, --non-interactive, --ci](#--interactive---non-interactive---ci-1)
142147
- [-P, --path ](#-p---path-)
143148
- [--deployer ](#--deployer-)
144149
- [--dispenser ](#--dispenser-)
145150
- [-p, --project-name ](#-p---project-name--1)
146-
- [Arguments](#arguments-10)
151+
- [Arguments](#arguments-11)
147152
- [ENVIRONMENT_NAME](#environment_name)
148153
- [EXTRA_ARGS](#extra_args)
149154
- [link](#link)
150-
- [Options](#options-23)
155+
- [Options](#options-24)
151156
- [-p, --project-name ](#-p---project-name--2)
152157
- [-l, --language ](#-l---language--1)
153158
- [-a, --all](#-a---all)
154159
- [-f, --fail-fast](#-f---fail-fast)
155160
- [-v, --version ](#-v---version--2)
156161
- [list](#list)
157-
- [Arguments](#arguments-11)
162+
- [Arguments](#arguments-12)
158163
- [WORKSPACE_PATH](#workspace_path)
159164
- [run](#run)
160165
- [task](#task)
161166
- [analyze](#analyze)
162-
- [Options](#options-24)
167+
- [Options](#options-25)
163168
- [-r, --recursive](#-r---recursive)
164169
- [--force](#--force-2)
165170
- [--diff](#--diff)
166171
- [-o, --output ](#-o---output--2)
167172
- [-e, --exclude ](#-e---exclude-)
168-
- [Arguments](#arguments-12)
173+
- [Arguments](#arguments-13)
169174
- [INPUT_PATHS](#input_paths)
170175
- [ipfs](#ipfs)
171-
- [Options](#options-25)
176+
- [Options](#options-26)
172177
- [-f, --file ](#-f---file--1)
173178
- [-n, --name ](#-n---name--2)
174179
- [mint](#mint)
175-
- [Options](#options-26)
180+
- [Options](#options-27)
176181
- [--creator ](#--creator-)
177182
- [--name ](#--name-)
178183
- [-u, --unit ](#-u---unit-)
@@ -184,66 +189,66 @@
184189
- [--mutable, --immutable](#--mutable---immutable)
185190
- [-n, --network ](#-n---network-)
186191
- [nfd-lookup](#nfd-lookup)
187-
- [Options](#options-27)
192+
- [Options](#options-28)
188193
- [-o, --output ](#-o---output--3)
189-
- [Arguments](#arguments-13)
194+
- [Arguments](#arguments-14)
190195
- [VALUE](#value)
191196
- [opt-in](#opt-in)
192-
- [Options](#options-28)
197+
- [Options](#options-29)
193198
- [-a, --account ](#-a---account-)
194199
- [-n, --network ](#-n---network--1)
195-
- [Arguments](#arguments-14)
200+
- [Arguments](#arguments-15)
196201
- [ASSET_IDS](#asset_ids)
197202
- [opt-out](#opt-out)
198-
- [Options](#options-29)
203+
- [Options](#options-30)
199204
- [-a, --account ](#-a---account--1)
200205
- [--all](#--all)
201206
- [-n, --network ](#-n---network--2)
202-
- [Arguments](#arguments-15)
207+
- [Arguments](#arguments-16)
203208
- [ASSET_IDS](#asset_ids-1)
204209
- [send](#send)
205-
- [Options](#options-30)
210+
- [Options](#options-31)
206211
- [-f, --file ](#-f---file--2)
207212
- [-t, --transaction ](#-t---transaction-)
208213
- [-n, --network ](#-n---network--3)
209214
- [sign](#sign)
210-
- [Options](#options-31)
215+
- [Options](#options-32)
211216
- [-a, --account ](#-a---account--2)
212217
- [-f, --file ](#-f---file--3)
213218
- [-t, --transaction ](#-t---transaction--1)
214219
- [-o, --output ](#-o---output--4)
215220
- [--force](#--force-3)
216221
- [transfer](#transfer)
217-
- [Options](#options-32)
222+
- [Options](#options-33)
218223
- [-s, --sender ](#-s---sender-)
219224
- [-r, --receiver ](#-r---receiver--1)
220225
- [--asset, --id ](#--asset---id-)
221226
- [-a, --amount ](#-a---amount--1)
222227
- [--whole-units](#--whole-units-2)
223228
- [-n, --network ](#-n---network--4)
224229
- [vanity-address](#vanity-address)
225-
- [Options](#options-33)
230+
- [Options](#options-34)
226231
- [-m, --match ](#-m---match-)
227232
- [-o, --output ](#-o---output--5)
228233
- [-a, --alias ](#-a---alias-)
229234
- [--file-path ](#--file-path-)
230235
- [-f, --force](#-f---force-3)
231-
- [Arguments](#arguments-16)
236+
- [Arguments](#arguments-17)
232237
- [KEYWORD](#keyword)
233238
- [wallet](#wallet)
234-
- [Options](#options-34)
239+
- [Options](#options-35)
235240
- [-a, --address ](#-a---address-)
236241
- [-m, --mnemonic](#-m---mnemonic)
237242
- [-f, --force](#-f---force-4)
238-
- [Arguments](#arguments-17)
239-
- [ALIAS_NAME](#alias_name)
240243
- [Arguments](#arguments-18)
244+
- [ALIAS_NAME](#alias_name)
245+
- [Arguments](#arguments-19)
241246
- [ALIAS](#alias)
242-
- [Options](#options-35)
247+
- [Options](#options-36)
243248
- [-f, --force](#-f---force-5)
244-
- [Arguments](#arguments-19)
249+
- [Arguments](#arguments-20)
245250
- [ALIAS](#alias-1)
246-
- [Options](#options-36)
251+
- [Options](#options-37)
247252
- [-f, --force](#-f---force-6)
248253

249254
# algokit
@@ -659,7 +664,7 @@ the new project is created in a standalone target directory. This is
659664
suitable for isolated projects or when workspace integration is unnecessary.
660665

661666
```shell
662-
algokit init [OPTIONS]
667+
algokit init [OPTIONS] COMMAND [ARGS]...
663668
```
664669

665670
### Options
@@ -714,6 +719,30 @@ Whether to prefer structuring standalone projects as part of a workspace. An Alg
714719
### -a, --answer <key> <value>
715720
Answers key/value pairs to pass to the template.
716721

722+
### example
723+
724+
Initialize a new project from an example template.
725+
726+
Allows you to quickly create a new project by copying one of the official AlgoKit example templates.
727+
If no example ID is provided, launches an interactive selector to choose from available examples.
728+
The example will be copied to a new directory in your current location.
729+
730+
```shell
731+
algokit init example [OPTIONS] [EXAMPLE_ID]
732+
```
733+
734+
### Options
735+
736+
737+
### -l, --list
738+
List all available examples
739+
740+
### Arguments
741+
742+
743+
### EXAMPLE_ID
744+
Optional argument
745+
717746
## localnet
718747

719748
Manage the AlgoKit LocalNet.

docs/features/init.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,42 @@ As a suggestion, if you wanted to open the project in VS Code you could execute:
119119
120120
```
121121

122+
## Initializing Examples
123+
124+
AlgoKit provides a collection of pre-built example projects that you can use to quickly start development. These examples demonstrate various use cases and best practices for Algorand development.
125+
126+
### Using the Example Command
127+
128+
You can initialize a new project from an example using the `algokit init example` command:
129+
130+
```bash
131+
# List and select from available examples interactively
132+
algokit init example
133+
134+
#List the available examples
135+
algokit init example -l/--list
136+
137+
# Initialize a specific example directly
138+
algokit init example <example_id>
139+
```
140+
141+
When run without an example ID, the command launches an interactive selector that displays available examples with their descriptions and categories. Examples are copied to a new directory in your current location, named after the example ID.
142+
143+
### Available Examples
144+
145+
Examples are organized in the AlgoKit templates repository and cover various use cases including:
146+
147+
- Smart contract examples
148+
- dApp frontend examples
149+
- Full-stack applications
150+
- Integration samples
151+
152+
Each example comes with all necessary files and configurations to get started immediately. After initialization, you can navigate to the example directory and begin development.
153+
154+
### Exploring Example Code
155+
156+
To explore what examples are available before initializing, you can run the interactive selector and browse through the options. Examples include a name and type to help you select the most appropriate one for your needs.
157+
158+
After initializing an example, AlgoKit automatically attempts to open the project in your default IDE to help you quickly start exploring and modifying the code.
159+
122160
For more details about the `AlgoKit init` command, please refer to the [AlgoKit CLI reference documentation](../cli/index.md#init).

0 commit comments

Comments
 (0)