Skip to content

Commit bd6844f

Browse files
committed
fix: update command examples to remove 'npx' and improve formatting in run documentation
1 parent 7fd2a23 commit bd6844f

1 file changed

Lines changed: 50 additions & 39 deletions

File tree

  • docs/src/content/docs/reference/cli

docs/src/content/docs/reference/cli/run.mdx

Lines changed: 50 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,54 @@
11
---
22
title: Run
3-
description: Learn how to execute genai scripts on files with streaming output
4-
to stdout, including usage of glob patterns, environment variables, and output
5-
options.
3+
description:
4+
Learn how to execute genai scripts on files with streaming output
5+
to stdout, including usage of glob patterns, environment variables, and output
6+
options.
67
sidebar:
7-
order: 1
8-
keywords: CLI tool execution, genai script running, stdout streaming, file
9-
globing, environment configuration
8+
order: 1
9+
keywords:
10+
CLI tool execution, genai script running, stdout streaming, file
11+
globing, environment configuration
1012
hero:
11-
image:
12-
alt:
13-
An abstract 8-bit style illustration depicts a colorful terminal window
14-
featuring a simple gear, a cloud, and a document icon, all rendered in
15-
bold, flat geometric shapes. Multiple file icons with glowing outlines
16-
overlap each other, accompanied by a small branching arrow symbolizing a
17-
pipeline, and a stylized folder icon. The color palette uses five
18-
distinct, bold corporate colors, and the image is strictly 2D, without
19-
background, text, shadows, or gradients. The layout is compact, sized at
20-
128 by 128 pixels.
21-
file: ./run.png
13+
image:
14+
alt:
15+
An abstract 8-bit style illustration depicts a colorful terminal window
16+
featuring a simple gear, a cloud, and a document icon, all rendered in
17+
bold, flat geometric shapes. Multiple file icons with glowing outlines
18+
overlap each other, accompanied by a small branching arrow symbolizing a
19+
pipeline, and a stylized folder icon. The color palette uses five
20+
distinct, bold corporate colors, and the image is strictly 2D, without
21+
background, text, shadows, or gradients. The layout is compact, sized at
22+
128 by 128 pixels.
23+
file: ./run.png
2224
---
2325

2426
Runs a script on files and streams the LLM output to stdout or a folder from the workspace root.
2527

2628
```bash
27-
npx genaiscript run <script> "<files...>"
29+
genaiscript run <script> "<files...>"
2830
```
2931

3032
where `<script>` is the id or file path of the tool to run, and `<files...>` is the name of the spec file to run it on.
3133

3234
Files can also include [glob](<https://en.wikipedia.org/wiki/Glob_(programming)>) pattern.
3335

3436
```sh
35-
npx genaiscript run code-annotator "src/*.ts"
37+
genaiscript run code-annotator "src/*.ts"
3638
```
3739

3840
If multiple files are specified, all files are included in `env.files`.
3941

4042
```sh
41-
npx genaiscript run <script> "src/*.bicep" "src/*.ts"
43+
genaiscript run <script> "src/*.bicep" "src/*.ts"
4244
```
4345

4446
## Files
4547

4648
`run` takes one or more [glob](<https://en.wikipedia.org/wiki/Glob_(programming)>) patterns to match files in the workspace.
4749

4850
```bash
49-
npx genaiscript run <script> "**/*.md" "**/*.ts"
51+
genaiscript run <script> "**/*.md" "**/*.ts"
5052
```
5153

5254
### Resource resolutions
@@ -74,15 +76,15 @@ cat README.md | genaiscript run summarize > summary.md
7476
Excludes the specified files from the file set.
7577

7678
```sh "--excluded-files <excluded-files...>"
77-
npx genaiscript run <script> <files> --excluded-files <excluded-files...>
79+
genaiscript run <script> <files> --excluded-files <excluded-files...>
7880
```
7981

8082
### `--exclude-git-ignore`
8183

8284
Exclude files ignored by the `.gitignore` file at the workspace root.
8385

8486
```sh "--exclude-git-ignore"
85-
npx genaiscript run <script> <files> --exclude-git-ignore
87+
genaiscript run <script> <files> --exclude-git-ignore
8688
```
8789

8890
## Configuration
@@ -106,13 +108,13 @@ Populate values in the `env.vars` map that can be used when running the prompt.
106108
Saves the results in a JSON file, along with markdown files of the output and the trace.
107109

108110
```sh "--out tmp"
109-
npx genaiscript run <script> <files> --out out/res.json
111+
genaiscript run <script> <files> --out out/res.json
110112
```
111113

112114
If `file` does not end with `.json`, the path is treated as a directory path.
113115

114116
```sh "--out tmp"
115-
npx genaiscript run <script> <files> --out tmp
117+
genaiscript run <script> <files> --out tmp
116118
```
117119

118120
### `--json`
@@ -121,25 +123,25 @@ Output the entire response as JSON to the stdout.
121123

122124
### `--out-trace` _file_
123125

124-
Save the markdown trace to the specified file.
126+
Save the markdown trace to the specified file. Use `--no-out-trace` to disable the trace output.
125127

126128
```sh wrap
127-
npx genaiscript run <script> <files> --out-trace file
129+
genaiscript run <script> <files> --out-trace file
128130
```
129131

130132
In a GitHub Actions workflow, you can use this feature to save the trace as a step summary (`GITHUB_STEP_SUMMARY`):
131133

132134
```yaml title=".github/workflows/genaiscript.yml" wrap
133135
- name: Run GenAIScript tool on spec
134136
run: |
135-
genaiscript run <script> <files> --out-trace $GITHUB_STEP_SUMMARY
137+
genaiscript run <script> <files> --out-trace $GITHUB_STEP_SUMMARY
136138
```
137139
138140
In Azure Dev Ops, you can use the [task.uploadSummary](https://learn.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?view=azure-devops&tabs=bash#uploadsummary-add-some-markdown-content-to-the-build-summary)
139141
in your pipeline to upload the trace as a summary.
140142
141143
```yaml title="genaiscript.pipeline.yml" "##vso[task.uploadsummary]" wrap
142-
- script: npx --yes genaiscript run poem --out-trace $(System.DefaultWorkingDirectory)/trace.md
144+
- script: --yes genaiscript run poem --out-trace $(System.DefaultWorkingDirectory)/trace.md
143145
displayName: "Run GenAIScript tool"
144146
continueOnError: true
145147
- script: echo "##vso[task.uploadsummary]$(System.DefaultWorkingDirectory)/trace.md"
@@ -151,13 +153,13 @@ in your pipeline to upload the trace as a summary.
151153
Emit annotations in the specified file as a JSON array, JSON Lines, [SARIF](https://sarifweb.azurewebsites.net/) or a CSV file if the file ends with `.csv`.
152154

153155
```sh wrap
154-
npx genaiscript run <script> <files> --out-annotations diags.csv
156+
genaiscript run <script> <files> --out-annotations diags.csv
155157
```
156158

157159
Use JSON lines (`.jsonl`) to aggregate annotations from multiple runs in a single file.
158160

159161
```sh wrap
160-
npx genaiscript run <script> <files> --out-annotations diags.jsonl
162+
genaiscript run <script> <files> --out-annotations diags.jsonl
161163
```
162164

163165
### `--out-data` _file_
@@ -166,15 +168,24 @@ Emits parsed data as JSON, YAML or JSONL. If a JSON schema is specified
166168
and available, the JSON validation result is also stored.
167169

168170
```sh
169-
npx genaiscript run <script> <files> --out-data data.jsonl
171+
genaiscript run <script> <files> --out-data data.jsonl
170172
```
171173

172174
### `--out-changelogs` _file_
173175

174176
Emit changelogs in the specified file as text.
175177

176178
```sh
177-
npx genaiscript run <script> <files> --out-changelogs changelogs.txt
179+
genaiscript run <script> <files> --out-changelogs changelogs.txt
180+
```
181+
182+
## Remote scripts
183+
184+
You can specify a repository, branch to run a script from a remote repository. In that mode,
185+
the scripts from the current repository are ignored.
186+
187+
```sh
188+
genaiscript run --remote <owner>/<repo>
178189
```
179190

180191
## Pull Requests and Issues <a href="" id="pull-requests" />
@@ -189,13 +200,13 @@ Update your workflow configuration to include the following:
189200

190201
```yaml
191202
permissions:
192-
pull-requests: write
203+
pull-requests: write
193204
```
194205

195206
- set the `GITHUB_TOKEN` secret in the `env` when running the cli
196207

197208
```yaml
198-
- run: npx --yes genaiscript run ... --pull-request-comment --out-trace $GITHUB_STEP_SUMMARY
209+
- run: --yes genaiscript run ... --pull-request-comment --out-trace $GITHUB_STEP_SUMMARY
199210
env:
200211
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
201212
... # LLM secrets
@@ -207,7 +218,7 @@ permissions:
207218
- pass secrets to scripts, including `System.AccessToken`
208219

209220
```yaml
210-
- script: npx genaiscript run ... --pull-request-description
221+
- script: genaiscript run ... --pull-request-description
211222
env:
212223
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
213224
... # LLM secrets
@@ -219,7 +230,7 @@ When running within a GitHub Action or Azure DevOps pipeline on a pull request,
219230
the CLI inserts the LLM output in the description of the pull request ([example](https://github.com/microsoft/genaiscript/pull/564))
220231

221232
```sh
222-
npx genaiscript run ... --pull-request-description
233+
genaiscript run ... --pull-request-description
223234
```
224235

225236
The `tag` parameter is a unique id used to differentiate description generate by different runs. Default is the script id.
@@ -229,7 +240,7 @@ The `tag` parameter is a unique id used to differentiate description generate by
229240
Upserts a comment on the pull request/issue with the LLM output ([example](https://github.com/microsoft/genaiscript/pull/564#issuecomment-2200474305))
230241

231242
```sh
232-
npx genaiscript run ... --pull-request-comment
243+
genaiscript run ... --pull-request-comment
233244
```
234245

235246
The `tag` parameter is a unique id used to differentiate description generate by different runs. Default is the script id.
@@ -240,7 +251,7 @@ Create pull request review comments from each [annotations](/genaiscript/referen
240251
([example](https://github.com/microsoft/genaiscript/pull/564#pullrequestreview-2151692644)).
241252

242253
```sh
243-
npx genaiscript run ... --pull-request-reviews
254+
genaiscript run ... --pull-request-reviews
244255
```
245256

246257
## Read more

0 commit comments

Comments
 (0)