Convert
Converts a set of files, separately, using a script.
npx genaiscript convert <script> "<files...>"
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.
Unlike run
which works on all files at once, convert
processes each file individually.
Files
convert
takes one or more glob patterns to match files in the workspace.
npx genaiscript run <script> "**/*.md" "**/*.ts"
—excluded-files <files…>
Excludes the specified files from the file set.
npx genaiscript convert <script> <files> --excluded-files <excluded-files...>
—exclude-git-ignore
Exclude files ignored by the .gitignore
file at the workspace root.
npx genaiscript convert <script> <files> --exclude-git-ignore
Output
The output of each file is saved to a new or existing file. You can control the logic to decide which part of the output to save where to save it.
By default, a conversion result of a file <filename>
is saved to a file <filename>.genai.md
.
—suffix <suffix>
The --suffix
option allows you to specify a suffix to append to the output file name.
npx genaiscript convert <script> <files> --suffix .genai.txt
GenAIScript will “unfence” output in the markdown that match the suffix (after .genai
) automatically. So if the LLM generates
```txt:)```
The converted content in <filename>.genai.txt
will be :)
.
—rewrite
This flag override suffix
and tells GenAIScript to rewrite the original file with the converted content.
npx genaiscript convert <script> <files> --rewrite
—cancel-word <word>
Specify the “ignore output, nothing to see here” keyword using the -cw
flag.
npx genaiscript convert <script> <files> --cancel-word "<NO>"
Read more
The full list of options is available in the CLI reference.