Skip to main content

kapi add

kapi add <pattern> [pattern...]

Add file patterns to this project's content so kapi knows which files to process. Patterns support ** for recursive matching. Format is auto-detected from the extension unless --format is given.

By default each pattern becomes a bare entry, which the project's default point governs. --name puts them in a named collection instead, and --channel binds that collection to a point in the context space (profile/channel), so a surface is governed by the voice that suits it rather than by the project default. Adding to a name that already exists extends that collection.

--target declares where a translated file goes: a template over {lang} and the path tokens ({path}, {name}, {ext}), or a directory to mirror into. Without one a flow that writes has nowhere of its own to write, so give it here rather than by hand-editing the recipe. A target that lands back inside the pattern it comes from is refused: the collection would re-track its own output as source.

kapi add "src//.html" kapi add "locales/.json" --format json kapi add "src//.html" "content/**/.md" kapi add "docs//*.md" --target "translated/{lang}/{path}.md" kapi add "support//*.md" --name northsea-support --channel northsea/docs

Commandadd
Groupwork
Try it

Runs in your browser against a small sample file. Edit the command before running, or press Run to execute it as shown.

kapi add
Flags
FlagTypeDefaultDescription
--channelstringbind the named collection to a point in the context space (profile/channel)
--colorstringautocolorize output: auto, always, never
--format, -fstringfile format (e.g. html, json); auto-detected if omitted
--jqstringfilter JSON output through a jq expression (implies --json)
--jsonboolfalseOutput in JSON format
--namestringput the patterns in a named collection (created, or extended if it exists)
--output-formatstringOutput format: text (alias: table), json, yaml
--project, -pstringpath to a kapi.yaml project recipe or its directory (auto-discovered from cwd if omitted)
--targetstringwhere translated files go: a template over {lang} and the path tokens, or a directory to mirror into
--textboolfalseOutput in text format (default)

← Back to the Command Reference