@xiaozhi-client/cli 1.9.5 → 1.9.6-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiaozhi-client/cli",
3
- "version": "1.9.5",
3
+ "version": "1.9.6-beta.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "consola": "^3.4.2",
21
- "@xiaozhi-client/config": "1.9.5"
21
+ "@xiaozhi-client/config": "1.9.6-beta.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "^24.3.0",
@@ -59,7 +59,7 @@ export class ServiceManagerImpl implements IServiceManager {
59
59
  }
60
60
 
61
61
  // 检查环境配置
62
- this.checkEnvironment();
62
+ await this.checkEnvironment();
63
63
 
64
64
  // 根据模式启动服务
65
65
  switch (options.mode) {
@@ -161,13 +161,27 @@ export class ServiceManagerImpl implements IServiceManager {
161
161
  /**
162
162
  * 检查环境配置
163
163
  */
164
- private checkEnvironment(): void {
164
+ private async checkEnvironment(): Promise<void> {
165
165
  // 检查配置文件是否存在
166
166
  if (!this.configManager.configExists()) {
167
- throw ConfigError.configNotFound();
167
+ // 尝试初始化默认配置
168
+ try {
169
+ console.log("ℹ️ 未找到配置文件,正在创建默认配置...");
170
+
171
+ const { ConfigInitializer } = await import("@xiaozhi-client/config");
172
+ const configPath = await ConfigInitializer.initializeDefaultConfig();
173
+
174
+ console.log(`✅ 默认配置已创建: ${configPath}`);
175
+ console.log("💡 提示: 您可以稍后编辑此配置文件以自定义设置");
176
+
177
+ // 重新加载配置管理器
178
+ this.configManager.reloadConfig();
179
+ } catch (error) {
180
+ throw ConfigError.configNotFound();
181
+ }
168
182
  }
169
183
 
170
- // 可以添加更多环境检查
184
+ // 验证配置文件
171
185
  try {
172
186
  const config = this.configManager.getConfig();
173
187
  if (!config) {