# CLI reference

The Comind.work CLI ships as part of the `@comind/api` package and is invoked via `npx comind <command>`. It handles every step between local source code and a running workspace - building, deploying, syncing, and importing data. All commands are scriptable, so they work equally well at a developer's terminal or inside a CI/CD pipeline.

## Command reference[​](#command-reference "Direct link to Command reference")

| Command             | Alias | Purpose                                         | Example                                                  |
| ------------------- | ----- | ----------------------------------------------- | -------------------------------------------------------- |
| `install`           | `i`   | Compile an app and deploy it to a workspace     | `npx comind i app-task CMW 100`                          |
| `push`              |       | Upload source files to METAMETA/APPCODEFILE     | `npx comind push app-task`                               |
| `pull`              |       | Download app source from METAMETA/APPCODEFILE   | `npx comind pull app-task apps-dev/app-task`             |
| `build`             |       | Compile app to JS (output to `__upload/build/`) | `npx comind build app-task`                              |
| `dump`              |       | Export a running app schema to TypeScript files | `npx comind dump default-app-wiki apps-dev/app-wiki`     |
| `dumpLint`          |       | Dump with ESLint auto-fix applied               | `npx comind dumpLint default-app-wiki apps-dev/app-wiki` |
| `promote`           |       | Promote an app to another environment           | `npx comind promote ...`                                 |
| `createRecords`     |       | Create records from CSV or JSON                 | `npx comind createRecords ...`                           |
| `importRecords`     |       | Import records into a workspace                 | `npx comind importRecords ...`                           |
| `importCustomViews` |       | Import list view configurations                 | `npx comind importCustomViews ...`                       |

## Key workflows[​](#key-workflows "Direct link to Key workflows")

### install - local dev to running workspace[​](#install---local-dev-to-running-workspace "Direct link to install - local dev to running workspace")

The most common command during development. It builds the full [compilation pipeline](/developer-guide/app-architecture/compilation-pipeline.md) and deploys the result in a single step.

```
npx comind install app-task CMW
  → buildAppSchemaObject("app-task")
  → buildAppSchemaCompiledJsCode(schema)
  → comind.schema.deploy(code, "CMW", position)
```

* The optional third argument sets the app's position (sort order) in the workspace sidebar.
* The builder resolves the full dependency tree - base, plugins, and any parent app declared via `inheritFrom` - before compiling.

### push - local source to backend storage[​](#push---local-source-to-backend-storage "Direct link to push - local source to backend storage")

Syncs your local files to the platform's source storage. Unlike `install`, this does not compile or deploy; it only persists the source.

```
npx comind push app-task
  → Build schema, get app GUID
  → Load remote source files from the server
  → Diff local vs remote files
  → Upload changed files
  → Publish the updated source
```

Only changed files are uploaded. The final publish step makes the new source visible in the platform's app editor.

### pull - backend to local source[​](#pull---backend-to-local-source "Direct link to pull - backend to local source")

The inverse of `push`. Downloads the current app source from the platform and writes it to a local directory. Useful when an app was edited in the browser and you need to bring those changes into your codebase.

```
npx comind pull app-task apps-dev/app-task
  → Fetch source files from the server
  → Write each file to local directory
  → Format with Prettier
```

Output is auto-formatted with Prettier so the downloaded code matches the project's style conventions.

### Choosing between install and push[​](#choosing-between-install-and-push "Direct link to Choosing between install and push")

Both `install` and `push` move code from your machine to the platform, but they serve different purposes and behave differently.

|                       | `npx comind install`                        | `npx comind push`                                               |
| --------------------- | ------------------------------------------- | --------------------------------------------------------------- |
| **What it does**      | Compiles TypeScript + deploys JS to target  | Uploads source files to AppCode (no compilation)                |
| **Speed**             | Fast (seconds)                              | Slower (10-15 sec, syncs each file)                             |
| **Audit trail**       | Shows as system deploy                      | Shows individual file changes with author                       |
| **Use when**          | Active development, testing changes quickly | Syncing source to AppCode for web-based editing or traceability |
| **Reverse direction** | N/A                                         | `npx comind pull` downloads AppCode back to local files         |
| **Production**        | Preferred for deploys (atomic, compiled)    | Use for source backup to AppCode                                |

Bidirectional sync pitfall

If someone edits AppCode in the web UI while you have local changes, `install` or `push` will overwrite the web changes silently. Always run `npx comind pull` before pushing if web edits are possible. There is no built-in conflict detection - the last write wins.

### dump - running app to TypeScript[​](#dump---running-app-to-typescript "Direct link to dump - running app to TypeScript")

Reverse-engineers a compiled app back into TypeScript source files. This is the primary tool for migrating legacy apps to the v2 [package structure](/developer-guide/app-architecture/package-structure.md).

```
npx comind dump app-id target-dir
  → comind.schema.load(appId)
  → Parse compiled JS back into TypeScript components
  → Generate fields/, actions/, views/, settings/
  → Format with Prettier
```

The `dumpLint` variant runs ESLint with auto-fix on the generated files, saving a manual cleanup step.

### build - compile without deploying[​](#build---compile-without-deploying "Direct link to build - compile without deploying")

Produces compiled JS output in the `__upload/build/` directory without deploying to any workspace. Useful for validating that an app compiles cleanly, or for inspecting the build output.

```
npx comind build app-task
```

## Scaffolding[​](#scaffolding "Direct link to Scaffolding")

New customer apps can be scaffolded using `npm-init-comind`. This generates the standard [package structure](/developer-guide/app-architecture/package-structure.md) - fields, actions, views, settings, and `package.json` - ready for development.

```
npm init comind
```

## CI/CD usage[​](#cicd-usage "Direct link to CI/CD usage")

Customer CI/CD pipelines typically script `npx comind install` for each app in deployment order. The CLI is designed to be non-interactive, so it runs without modification in TeamCity, GitHub Actions, or any other CI system.

A typical deployment script installs apps sequentially to respect dependency order:

```
npx comind install app-base-task PROD
npx comind install app-custom-task PROD
npx comind install app-custom-deal PROD
```

For more on how install fits into the broader development process, see [App lifecycle](/developer-guide/app-architecture/app-lifecycle.md).

## Related[​](#related "Direct link to Related")

* [Data import and export](/developer-guide/how-to/advanced/data-import-export.md) - practical guide to `createRecords`, `importRecords`, and `dump` workflows
* [Production deployment](/developer-guide/how-to/advanced/production-deployment.md) - pre-deploy checklist and multi-environment CLI usage
