# @lark-project/cli

Command line tool for lark project plugin development.

# Installation & Usage

To install the cli globally you need to run:

```
npm i -g @lark-project/cli
```

Then you can use the commands by typing:

> lmp stands for Lark Project Management. You can use the "lpm" command to perform various tasks such as init a new project, building and releasing applications, etc.

```
lpm <cmd> [options]
```

# Commands

- [`lpm init <project-name> [plugin-id] [plugin-secret]`](#lpm-init-project-name-plugin-id-plugin-secret)
- [`lpm config <operate> [key] [value]`](#lpm-config-operate-key-value)
- [`lpm start`](#lpm-start)
- [`lpm build`](#lpm-build)
- [`lpm release`](#lpm-release)
- [`lpm debug-env`](#lpm-debug-env) （hidden, 本地调试用）

## `lpm init <project-name> [plugin-id] [plugin-secret]`

> Initialize an Lark Project plugin project

```
USAGE
  $ lpm init <project-name> [plugin-id] [plugin-secret]

OPTIONS
  -f, --force     overwrite target directory if it exist
  -h, --help      show CLI help

EXAMPLE
  $ lpm init plugin-demo MII_0123456789ABCDEF xxxxxx
```

## `lpm config <operate> [key] [value]`

> Set, get or remove plugin configuration

```
USAGE
  $ lpm config <operate> [key] [value]

OPTIONS
  -g, --global    operate global configuration
  -h, --help      show CLI help

EXAMPLE
  $ lpm config set pluginID MII_0123456789ABCDEF
  $ lpm config get pluginID
  $ lpm config remove pluginID
```

## `lpm start`

> Start the plugin locally

```
USAGE
  $ lpm start

OPTIONS
  -h, --help      show CLI help

EXAMPLE
  $ lpm start
```

## `lpm build`

> Build the plugin project as a product file

```
USAGE
  $ lpm build

OPTIONS
  -h, --help      show CLI help

EXAMPLE
  $ lpm build
```

## `lpm release`

> Build the plugin project as a product file and upload it to the cloud.

```
USAGE
  $ lpm release

OPTIONS
  -h, --help      show CLI help

EXAMPLE
  $ lpm release
```

## `lpm debug-env`

> 本地调试用的持久化设置。命令对 `lpm --help` 顶层隐藏，但 `lpm debug-env --help` 仍可查看子命令。
> 设置写入 `<configDir>/settings.json`，下次直接生效。

```
USAGE
  $ lpm debug-env                            # 打印当前所有设置 + help
  $ lpm debug-env list                       # 仅打印当前所有设置
  $ lpm debug-env tt-env set <value>         # 设置 x-tt-env 头（如 boe_xxx / ppe_xxx）
  $ lpm debug-env tt-env get
  $ lpm debug-env tt-env clear
  $ lpm debug-env local-schema on            # 绕过远端 schema 接口，使用仓库内的 schema/developer-plugin.yaml
  $ lpm debug-env local-schema off
  $ lpm debug-env local-schema status

ENV VARS （单次覆盖，优先级 > 持久化设置）
  LPM_TT_ENV=boe_xxx       等价 tt-env set
  LPM_LOCAL_SCHEMA=1       等价 local-schema on

EXAMPLE
  # 调试 schema/developer-plugin.yaml 改动：开启后所有读取 schema 的命令都走本地文件
  $ lpm debug-env local-schema on
  $ lpm config            # ← 此时使用本地 schema 校验，不打远端

  # 单次临时覆盖
  $ LPM_LOCAL_SCHEMA=1 lpm config
```

