@spaceflow/core 0.24.0 → 0.26.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": "@spaceflow/core",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "description": "Spaceflow 核心能力库",
5
5
  "license": "MIT",
6
6
  "author": "Lydanne",
@@ -99,7 +99,7 @@
99
99
  "zod-to-json-schema": "^3.25.1",
100
100
  "commander": "^12.1.0",
101
101
  "i18next": "^25.8.4",
102
- "@spaceflow/shared": "0.6.0"
102
+ "@spaceflow/shared": "0.8.0"
103
103
  },
104
104
  "devDependencies": {
105
105
  "@swc/core": "1.15.3",
@@ -16,12 +16,13 @@ import {
16
16
  getPackageManager,
17
17
  detectPackageManager,
18
18
  getSpaceflowDir,
19
+ getSpaceflowCoreVersion,
19
20
  ensureSpaceflowPackageJson,
20
21
  ensureEditorGitignore,
21
22
  SchemaGeneratorService,
22
23
  findConfigFileWithField,
23
24
  getSupportedEditors,
24
- getDependencies,
25
+ getExtensionDependencies,
25
26
  updateDependency,
26
27
  SPACEFLOW_DIR,
27
28
  } from "@spaceflow/core";
@@ -664,10 +665,32 @@ export class InstallService {
664
665
  if (shouldLog(verbose, 1))
665
666
  console.log(t("install:foundDeps", { count: Object.keys(dependencies).length }));
666
667
 
667
- // 1. 先更新 .spaceflow/package.json 中的所有依赖
668
+ // 1. 记录更新前的 @spaceflow/core 版本
669
+ const spaceflowPkgPath = join(spaceflowDir, "package.json");
670
+ let prevCoreVersion: string | undefined;
671
+ if (existsSync(spaceflowPkgPath)) {
672
+ try {
673
+ const prevPkg = JSON.parse(await readFile(spaceflowPkgPath, "utf-8"));
674
+ prevCoreVersion = prevPkg.dependencies?.["@spaceflow/core"];
675
+ } catch {
676
+ // ignore
677
+ }
678
+ }
679
+
680
+ // 2. 更新 .spaceflow/package.json 中的所有依赖
668
681
  await this.updateSpaceflowPackageJson(dependencies, spaceflowDir, verbose);
669
682
 
670
- // 2. 一次性安装所有依赖
683
+ // 3. 版本变更提示
684
+ const currentCoreVersion = getSpaceflowCoreVersion();
685
+ if (prevCoreVersion && prevCoreVersion !== currentCoreVersion) {
686
+ if (shouldLog(verbose, 1)) {
687
+ console.log(
688
+ t("install:coreVersionChanged", { prev: prevCoreVersion, current: currentCoreVersion }),
689
+ );
690
+ }
691
+ }
692
+
693
+ // 4. 安装所有依赖
671
694
  if (shouldLog(verbose, 1)) console.log(t("install:installingDeps"));
672
695
  const pm = detectPackageManager(spaceflowDir);
673
696
  try {
@@ -676,7 +699,7 @@ export class InstallService {
676
699
  console.warn(t("install:pmInstallFailed", { pm }));
677
700
  }
678
701
 
679
- // 3. 处理每个依赖的 skills/commands 关联
702
+ // 5. 处理每个依赖的 skills/commands 关联
680
703
  for (const [name, config] of Object.entries(dependencies)) {
681
704
  const { source } = this.parseExtensionConfig(config);
682
705
  const sourceType = getSourceType(source);
@@ -790,7 +813,7 @@ export class InstallService {
790
813
  * 从配置文件解析扩展
791
814
  */
792
815
  protected parseExtensionsFromConfig(cwd?: string): Record<string, ExtensionConfig> {
793
- return getDependencies(cwd);
816
+ return getExtensionDependencies(cwd);
794
817
  }
795
818
 
796
819
  /**
@@ -7,7 +7,7 @@ import {
7
7
  getEditorDirName,
8
8
  getSourceType,
9
9
  normalizeSource,
10
- getDependencies,
10
+ getExtensionDependencies,
11
11
  getSupportedEditors,
12
12
  t,
13
13
  } from "@spaceflow/core";
@@ -30,7 +30,7 @@ export class ListService {
30
30
  const cwd = process.cwd();
31
31
 
32
32
  // 读取合并后的 dependencies(支持 .spaceflowrc、.spaceflow/spaceflow.json 等所有配置源)
33
- const dependencies = getDependencies(cwd);
33
+ const dependencies = getExtensionDependencies(cwd);
34
34
 
35
35
  if (Object.keys(dependencies).length === 0) {
36
36
  if (shouldLog(verbose, 1)) {
@@ -3,7 +3,7 @@ import { readFile } from "fs/promises";
3
3
  import { join } from "path";
4
4
  import { existsSync } from "fs";
5
5
  import { shouldLog, type VerboseLevel, t } from "@spaceflow/core";
6
- import { getDependencies } from "@spaceflow/core";
6
+ import { getExtensionDependencies } from "@spaceflow/core";
7
7
  import type { ExtensionConfig } from "../install/install.service";
8
8
 
9
9
  export interface UpdateOptions {
@@ -305,7 +305,7 @@ export class UpdateService {
305
305
 
306
306
  async updateDependency(name: string, verbose: VerboseLevel = 1): Promise<boolean> {
307
307
  const cwd = process.cwd();
308
- const dependencies = getDependencies(cwd);
308
+ const dependencies = getExtensionDependencies(cwd);
309
309
 
310
310
  if (!dependencies[name]) {
311
311
  if (shouldLog(verbose, 1)) console.log(t("update:depNotFound", { name }));
@@ -330,7 +330,7 @@ export class UpdateService {
330
330
 
331
331
  async updateAll(verbose: VerboseLevel = 1): Promise<void> {
332
332
  const cwd = process.cwd();
333
- const dependencies = getDependencies(cwd);
333
+ const dependencies = getExtensionDependencies(cwd);
334
334
 
335
335
  if (Object.keys(dependencies).length === 0) {
336
336
  if (shouldLog(verbose, 1)) console.log(t("update:noDeps"));
@@ -15,6 +15,7 @@ export {
15
15
  writeConfigSync,
16
16
  getSupportedEditors,
17
17
  getDependencies,
18
+ getExtensionDependencies,
18
19
  findConfigFileWithField,
19
20
  updateDependency,
20
21
  removeDependency,
@@ -36,6 +36,7 @@
36
36
  "updatingAll": "🔄 Updating all dependencies...",
37
37
  "noDeps": " No dependencies in config file",
38
38
  "foundDeps": " Found {{count}} dependencies",
39
+ "coreVersionChanged": "📦 @spaceflow/core version changed: {{prev}} → {{current}}",
39
40
  "installingDeps": "\n📦 Installing dependencies...",
40
41
  "pmInstallFailed": " Warning: {{pm}} install failed",
41
42
  "depNotInstalled": " ⚠️ {{name}} not installed successfully, skipping",
@@ -36,6 +36,7 @@
36
36
  "updatingAll": "🔄 更新所有依赖...",
37
37
  "noDeps": " 配置文件中没有 dependencies",
38
38
  "foundDeps": " 找到 {{count}} 个依赖",
39
+ "coreVersionChanged": "📦 @spaceflow/core 版本变更: {{prev}} → {{current}}",
39
40
  "installingDeps": "\n📦 安装依赖...",
40
41
  "pmInstallFailed": " 警告: {{pm}} install 失败",
41
42
  "depNotInstalled": " ⚠️ {{name}} 未安装成功,跳过",