@yandy0725/mediagen-cli 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -122,15 +122,30 @@ code `TaskNotFinished`, and `video status <id>` resumes it without paying again.
122
122
  ## Configuration
123
123
 
124
124
  `config.toml` — the file you edit — lives in the first of
125
- `$MEDIAGEN_CLI_CONFIG_DIR`, `$XDG_CONFIG_HOME/mediagen-cli`, `~/.config/mediagen-cli`.
125
+ `$MEDIAGEN_CLI_CONFIG_DIR`, `$XDG_CONFIG_HOME/mediagen`, `~/.config/mediagen`.
126
126
 
127
127
  `auth.json` (mode `600`) is **state, not config**, and lives apart from it: the first
128
- of `$MEDIAGEN_CLI_STATE_DIR`, `$XDG_STATE_HOME/mediagen-cli`,
129
- `~/.local/state/mediagen-cli`. `~/.config` is the directory people sync, share and
128
+ of `$MEDIAGEN_CLI_STATE_DIR`, `$XDG_STATE_HOME/mediagen`,
129
+ `~/.local/state/mediagen`. `~/.config` is the directory people sync, share and
130
130
  commit; a key store there is one `.gitignore` mistake away from a leaked key. The
131
131
  state directory is machine-local by definition, which is what a device-bound
132
132
  credential is.
133
133
 
134
+ Upgrading from 0.1.1 or earlier: both directories dropped the `-cli` suffix, and nothing
135
+ migrates them for you. Move the files, not the directories — a first run of this version
136
+ already creates the new directories, and `mv dir dir` would bury your config inside them:
137
+
138
+ ```bash
139
+ mkdir -p ~/.config/mediagen ~/.local/state/mediagen
140
+ mv ~/.config/mediagen-cli/config.toml ~/.config/mediagen/config.toml
141
+ mv ~/.local/state/mediagen-cli/auth.json ~/.local/state/mediagen/auth.json
142
+ ```
143
+
144
+ (With `XDG_CONFIG_HOME` or `XDG_STATE_HOME` set, the paths are `<that>/mediagen-cli` →
145
+ `<that>/mediagen` instead. If you set `MEDIAGEN_CLI_CONFIG_DIR` or
146
+ `MEDIAGEN_CLI_STATE_DIR`, the names are unchanged and there is nothing to move. Skip a
147
+ line whose `mediagen-cli` path does not exist — most users never had an `auth.json`.)
148
+
134
149
  ```toml
135
150
  default_provider = "volcengine"
136
151
  # output_dir = "./media-output"
@@ -265,8 +280,8 @@ unmasked key. A provider speaking an existing dialect needs no code — only a
265
280
  `DIALECTS` (`src/api/index.ts`) plus its `path` field — the endpoint file name the
266
281
  dialect appends to `base_url`.
267
282
 
268
- Release: `npm pack --dry-run` to inspect the tarball (`dist/` and `skills/` are
269
- published), then `npm version patch && npm publish`. Design docs live in
270
- `docs/superpowers/specs/`.
283
+ Release: cut a `vX.Y.Z` GitHub Release and Actions publishes it — see
284
+ `docs/guides/release.md` (`dist/` and `skills/` are what ships, and CI runs
285
+ `npm pack --dry-run` on every push). Design docs live in `docs/superpowers/specs/`.
271
286
 
272
287
  MIT
package/README.zh-CN.md CHANGED
@@ -110,15 +110,29 @@ stdout 上每行打印一个绝对路径;`--json` 打印一个对象:
110
110
  ## 配置
111
111
 
112
112
  `config.toml` —— 你手动编辑的那个文件 —— 位于
113
- `$MEDIAGEN_CLI_CONFIG_DIR`、`$XDG_CONFIG_HOME/mediagen-cli`、
114
- `~/.config/mediagen-cli` 三者中第一个存在的。
113
+ `$MEDIAGEN_CLI_CONFIG_DIR`、`$XDG_CONFIG_HOME/mediagen`、
114
+ `~/.config/mediagen` 三者中第一个存在的。
115
115
 
116
116
  `auth.json`(权限 `600`)属于**状态而非配置**,单独存放:取
117
- `$MEDIAGEN_CLI_STATE_DIR`、`$XDG_STATE_HOME/mediagen-cli`、
118
- `~/.local/state/mediagen-cli` 三者中第一个。`~/.config` 是人们会同步、分享、提交到
117
+ `$MEDIAGEN_CLI_STATE_DIR`、`$XDG_STATE_HOME/mediagen`、
118
+ `~/.local/state/mediagen` 三者中第一个。`~/.config` 是人们会同步、分享、提交到
119
119
  仓库的目录,把密钥放在那里,一次 `.gitignore` 疏忽就等于泄露。state 目录按定义是
120
120
  「本机状态、不该被同步」,正合设备绑定的凭证。
121
121
 
122
+ 从 0.1.1 及更早版本升级:两个目录都去掉了 `-cli` 后缀,程序不会替你迁移。挪文件,别挪目录
123
+ —— 新版本第一次运行就已经建好了新目录,`mv 目录 目录` 只会把你的配置埋进去:
124
+
125
+ ```bash
126
+ mkdir -p ~/.config/mediagen ~/.local/state/mediagen
127
+ mv ~/.config/mediagen-cli/config.toml ~/.config/mediagen/config.toml
128
+ mv ~/.local/state/mediagen-cli/auth.json ~/.local/state/mediagen/auth.json
129
+ ```
130
+
131
+ (设置了 `XDG_CONFIG_HOME` 或 `XDG_STATE_HOME` 的,路径相应改为 `<该目录>/mediagen-cli` →
132
+ `<该目录>/mediagen`。用了 `MEDIAGEN_CLI_CONFIG_DIR` 或 `MEDIAGEN_CLI_STATE_DIR` 的,变量名
133
+ 没变,不需要动。`mediagen-cli` 路径不存在的那一行跳过就好 —— 大多数用户本来就没有
134
+ `auth.json`。)
135
+
122
136
  ```toml
123
137
  default_provider = "volcengine"
124
138
  # output_dir = "./media-output"
@@ -239,7 +253,8 @@ npm run dev -- image generate --help
239
253
  (`src/api/index.ts`)里的一行,以及适配器上的 `path` 字段 —— 方言拼在 `base_url`
240
254
  后面的那个端点文件名。
241
255
 
242
- 发布:`npm pack --dry-run` 检查 tarball(发布 `dist/` 和 `skills/`),然后
243
- `npm version patch && npm publish`。设计文档在 `docs/superpowers/specs/`。
256
+ 发布:打一个 `vX.Y.Z` 的 GitHub Release,Actions 会自动发布 —— 见
257
+ `docs/guides/release.md`(发布的是 `dist/` 和 `skills/`,CI 每次 push 都会跑
258
+ `npm pack --dry-run`)。设计文档在 `docs/superpowers/specs/`。
244
259
 
245
260
  MIT
package/dist/cli.js CHANGED
@@ -753,19 +753,20 @@ function getAdapter(apiType, task) {
753
753
  }
754
754
 
755
755
  // src/config.ts
756
+ var APP_DIR_NAME = "mediagen";
756
757
  function configDir() {
757
758
  const override = process.env.MEDIAGEN_CLI_CONFIG_DIR;
758
759
  if (override) return override;
759
760
  const xdgConfigHome = process.env.XDG_CONFIG_HOME;
760
- if (xdgConfigHome) return path2.join(xdgConfigHome, "mediagen-cli");
761
- return path2.join(os.homedir(), ".config", "mediagen-cli");
761
+ if (xdgConfigHome) return path2.join(xdgConfigHome, APP_DIR_NAME);
762
+ return path2.join(os.homedir(), ".config", APP_DIR_NAME);
762
763
  }
763
764
  function stateDir() {
764
765
  const override = process.env.MEDIAGEN_CLI_STATE_DIR;
765
766
  if (override) return override;
766
767
  const xdgStateHome = process.env.XDG_STATE_HOME;
767
- if (xdgStateHome) return path2.join(xdgStateHome, "mediagen-cli");
768
- return path2.join(os.homedir(), ".local", "state", "mediagen-cli");
768
+ if (xdgStateHome) return path2.join(xdgStateHome, APP_DIR_NAME);
769
+ return path2.join(os.homedir(), ".local", "state", APP_DIR_NAME);
769
770
  }
770
771
  function configPath() {
771
772
  return path2.join(configDir(), "config.toml");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yandy0725/mediagen-cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Non-interactive image generation and editing, plus short video generation, for agents: qwen-image, doubao/seedream, doubao/seedance, MiniMax H3, files on disk, JSON output.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,6 +34,7 @@
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup src/cli.ts --format esm --target node18 --clean",
37
+ "typecheck": "tsc --noEmit",
37
38
  "test": "vitest run",
38
39
  "dev": "tsx src/cli.ts",
39
40
  "prepack": "npm run build"