@spaceflow/core 0.23.0 → 0.25.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/dist/index.js +190 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/commands/install/install.service.ts +26 -3
- package/src/locales/en/install.json +1 -0
- package/src/locales/zh-cn/install.json +1 -0
- package/src/shared/git-sdk/git-sdk.service.ts +157 -0
- package/src/shared/git-sdk/index.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as __rspack_external_fs_promises_400951f8 from "fs/promises";
|
|
|
4
4
|
import * as __rspack_external_path from "path";
|
|
5
5
|
import * as __rspack_external_zod from "zod";
|
|
6
6
|
import { execSync, spawn, spawnSync } from "child_process";
|
|
7
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, writeFileSync } from "fs";
|
|
7
8
|
import { query as claude_agent_sdk_query } from "@anthropic-ai/claude-agent-sdk";
|
|
8
9
|
import { homedir, platform } from "os";
|
|
9
10
|
import { CONFIG_FILE_NAME, DEFAULT_EDITOR, DEFAULT_SUPPORT_EDITOR, EDITOR_DIR_MAPPING, LOG_LEVEL_PRIORITY, PACKAGE_JSON, RC_FILE_NAME, SPACEFLOW_DIR, buildGitPackageSpec, deepMerge, detectPackageManager, ensureDependencies, ensureEditorGitignore, ensureSpaceflowDir, ensureSpaceflowPackageJson, extractName, extractNpmPackageName, findConfigFileWithField, findProjectRoot, getConfigPath, getConfigPaths, getDependencies, getEditorDirName, getEnvFilePaths, getPackageManager, getSourceType, getSpaceflowCoreVersion, getSpaceflowDir, getSupportedEditors, isGitUrl, isLocalPath, isPnpmWorkspace as shared_isPnpmWorkspace, loadEnvFiles, loadExtensionsFromDir, normalizeSource, normalizeVerbose, parseVerbose, readConfigSync, removeDependency, shouldLog, toLogLevel, updateDependency, writeConfigSync } from "@spaceflow/shared";
|
|
@@ -12,7 +13,6 @@ import { createOpencode } from "@opencode-ai/sdk";
|
|
|
12
13
|
import { createHash, randomUUID } from "crypto";
|
|
13
14
|
import { EventEmitter } from "events";
|
|
14
15
|
import { AppType, Client, Domain, EventDispatcher } from "@larksuiteoapi/node-sdk";
|
|
15
|
-
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, writeFileSync } from "fs";
|
|
16
16
|
import { jsonrepair } from "jsonrepair";
|
|
17
17
|
import "reflect-metadata";
|
|
18
18
|
import { Command } from "commander";
|
|
@@ -2671,9 +2671,15 @@ function parseDiffText(diffText) {
|
|
|
2671
2671
|
|
|
2672
2672
|
|
|
2673
2673
|
|
|
2674
|
+
;// CONCATENATED MODULE: external "fs"
|
|
2675
|
+
|
|
2676
|
+
// EXTERNAL MODULE: external "path"
|
|
2677
|
+
var external_path_ = __webpack_require__(521);
|
|
2674
2678
|
;// CONCATENATED MODULE: ./src/shared/git-sdk/git-sdk.service.ts
|
|
2675
2679
|
|
|
2676
2680
|
|
|
2681
|
+
|
|
2682
|
+
|
|
2677
2683
|
class GitSdkService {
|
|
2678
2684
|
defaultOptions = {
|
|
2679
2685
|
cwd: process.cwd(),
|
|
@@ -2862,6 +2868,15 @@ class GitSdkService {
|
|
|
2862
2868
|
`${ref}:${filename}`
|
|
2863
2869
|
], options);
|
|
2864
2870
|
}
|
|
2871
|
+
/**
|
|
2872
|
+
* 获取工作区文件的当前内容(包含未提交的修改)
|
|
2873
|
+
* 直接读取文件系统,而不是从 git 获取
|
|
2874
|
+
* @throws 如果文件不存在或无法读取
|
|
2875
|
+
*/ getWorkingFileContent(filename, options) {
|
|
2876
|
+
const cwd = options?.cwd || process.cwd();
|
|
2877
|
+
const filepath = external_path_.join(cwd, filename);
|
|
2878
|
+
return readFileSync(filepath, "utf-8");
|
|
2879
|
+
}
|
|
2865
2880
|
getCommitDiff(sha, options) {
|
|
2866
2881
|
try {
|
|
2867
2882
|
const output = this.runCommandSync([
|
|
@@ -2877,6 +2892,153 @@ class GitSdkService {
|
|
|
2877
2892
|
}
|
|
2878
2893
|
}
|
|
2879
2894
|
/**
|
|
2895
|
+
* 获取暂存区的变更文件列表
|
|
2896
|
+
*/ getStagedFiles(options) {
|
|
2897
|
+
try {
|
|
2898
|
+
const output = this.runCommandSync([
|
|
2899
|
+
"diff",
|
|
2900
|
+
"--cached",
|
|
2901
|
+
"--name-status"
|
|
2902
|
+
], options);
|
|
2903
|
+
return this.parseNameStatusOutput(output);
|
|
2904
|
+
} catch {
|
|
2905
|
+
return [];
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
/**
|
|
2909
|
+
* 获取暂存区的 diff(包含 patch 信息)
|
|
2910
|
+
*/ getStagedDiff(options) {
|
|
2911
|
+
try {
|
|
2912
|
+
const output = this.runCommandSync([
|
|
2913
|
+
"diff",
|
|
2914
|
+
"--cached"
|
|
2915
|
+
], options);
|
|
2916
|
+
return parseDiffText(output);
|
|
2917
|
+
} catch {
|
|
2918
|
+
return [];
|
|
2919
|
+
}
|
|
2920
|
+
}
|
|
2921
|
+
/**
|
|
2922
|
+
* 获取工作区未暂存的变更文件列表
|
|
2923
|
+
*/ getUnstagedFiles(options) {
|
|
2924
|
+
try {
|
|
2925
|
+
const output = this.runCommandSync([
|
|
2926
|
+
"diff",
|
|
2927
|
+
"--name-status"
|
|
2928
|
+
], options);
|
|
2929
|
+
return this.parseNameStatusOutput(output);
|
|
2930
|
+
} catch {
|
|
2931
|
+
return [];
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
/**
|
|
2935
|
+
* 获取工作区未暂存的 diff(包含 patch 信息)
|
|
2936
|
+
*/ getUnstagedDiff(options) {
|
|
2937
|
+
try {
|
|
2938
|
+
const output = this.runCommandSync([
|
|
2939
|
+
"diff"
|
|
2940
|
+
], options);
|
|
2941
|
+
return parseDiffText(output);
|
|
2942
|
+
} catch {
|
|
2943
|
+
return [];
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
/**
|
|
2947
|
+
* 获取所有未提交的变更文件(暂存区 + 工作区 + untracked)
|
|
2948
|
+
* 注意:staged 状态优先于 unstaged(因为 staged 反映了文件的原始变更类型)
|
|
2949
|
+
*/ getUncommittedFiles(options) {
|
|
2950
|
+
const staged = this.getStagedFiles(options);
|
|
2951
|
+
const unstaged = this.getUnstagedFiles(options);
|
|
2952
|
+
const untracked = this.getUntrackedFiles(options);
|
|
2953
|
+
// staged 优先:如果文件在 staged 中是 added,即使 unstaged 中是 modified,也应该保持 added
|
|
2954
|
+
const fileMap = new Map();
|
|
2955
|
+
for (const file of [
|
|
2956
|
+
...unstaged,
|
|
2957
|
+
...staged
|
|
2958
|
+
]){
|
|
2959
|
+
fileMap.set(file.filename, file);
|
|
2960
|
+
}
|
|
2961
|
+
// 添加 untracked 文件
|
|
2962
|
+
for (const filename of untracked){
|
|
2963
|
+
if (!fileMap.has(filename)) {
|
|
2964
|
+
fileMap.set(filename, {
|
|
2965
|
+
filename,
|
|
2966
|
+
status: "added"
|
|
2967
|
+
});
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
return Array.from(fileMap.values());
|
|
2971
|
+
}
|
|
2972
|
+
/**
|
|
2973
|
+
* 获取未跟踪的文件列表
|
|
2974
|
+
*/ getUntrackedFiles(options) {
|
|
2975
|
+
try {
|
|
2976
|
+
const output = this.runCommandSync([
|
|
2977
|
+
"ls-files",
|
|
2978
|
+
"--others",
|
|
2979
|
+
"--exclude-standard"
|
|
2980
|
+
], options);
|
|
2981
|
+
return output.trim().split("\n").filter(Boolean);
|
|
2982
|
+
} catch {
|
|
2983
|
+
return [];
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
/**
|
|
2987
|
+
* 获取所有未提交的 diff(暂存区 + 工作区 + untracked)
|
|
2988
|
+
* 使用 HEAD 作为基准比较,untracked 文件生成伪 patch
|
|
2989
|
+
*/ getUncommittedDiff(options) {
|
|
2990
|
+
const diffs = [];
|
|
2991
|
+
// 1. 获取已跟踪文件的 diff(staged + unstaged)
|
|
2992
|
+
try {
|
|
2993
|
+
const output = this.runCommandSync([
|
|
2994
|
+
"diff",
|
|
2995
|
+
"HEAD"
|
|
2996
|
+
], options);
|
|
2997
|
+
diffs.push(...parseDiffText(output));
|
|
2998
|
+
} catch {
|
|
2999
|
+
// ignore
|
|
3000
|
+
}
|
|
3001
|
+
// 2. 为 untracked 文件生成伪 patch
|
|
3002
|
+
const untrackedFiles = this.getUntrackedFiles(options);
|
|
3003
|
+
for (const filename of untrackedFiles){
|
|
3004
|
+
try {
|
|
3005
|
+
const content = this.getWorkingFileContent(filename, options);
|
|
3006
|
+
const patch = this.generateAddedFilePatch(content);
|
|
3007
|
+
diffs.push({
|
|
3008
|
+
filename,
|
|
3009
|
+
patch
|
|
3010
|
+
});
|
|
3011
|
+
} catch {
|
|
3012
|
+
// 文件读取失败,跳过
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
return diffs;
|
|
3016
|
+
}
|
|
3017
|
+
/**
|
|
3018
|
+
* 为新增文件生成伪 patch(所有行都是新增)
|
|
3019
|
+
*/ generateAddedFilePatch(content) {
|
|
3020
|
+
const lines = content.split("\n");
|
|
3021
|
+
const lineCount = lines.length;
|
|
3022
|
+
const patchLines = lines.map((line)=>`+${line}`);
|
|
3023
|
+
return `@@ -0,0 +1,${lineCount} @@\n${patchLines.join("\n")}`;
|
|
3024
|
+
}
|
|
3025
|
+
/**
|
|
3026
|
+
* 解析 git diff --name-status 输出
|
|
3027
|
+
*/ parseNameStatusOutput(output) {
|
|
3028
|
+
const files = [];
|
|
3029
|
+
const lines = output.trim().split("\n").filter(Boolean);
|
|
3030
|
+
for (const line of lines){
|
|
3031
|
+
const [status, filename] = line.split("\t");
|
|
3032
|
+
if (filename) {
|
|
3033
|
+
files.push({
|
|
3034
|
+
filename,
|
|
3035
|
+
status: mapGitStatus(status)
|
|
3036
|
+
});
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
return files;
|
|
3040
|
+
}
|
|
3041
|
+
/**
|
|
2880
3042
|
* 解析 ref,支持本地分支、远程分支、commit SHA
|
|
2881
3043
|
* 优先级:commit SHA > 本地分支 > origin/分支 > fetch后重试 > 原始值
|
|
2882
3044
|
*/ async resolveRef(ref, options) {
|
|
@@ -2944,8 +3106,6 @@ const LLM_ADAPTER = Symbol("LLM_ADAPTER");
|
|
|
2944
3106
|
|
|
2945
3107
|
// EXTERNAL MODULE: external "fs/promises"
|
|
2946
3108
|
var promises_ = __webpack_require__(932);
|
|
2947
|
-
// EXTERNAL MODULE: external "path"
|
|
2948
|
-
var external_path_ = __webpack_require__(521);
|
|
2949
3109
|
;// CONCATENATED MODULE: external "os"
|
|
2950
3110
|
|
|
2951
3111
|
;// CONCATENATED MODULE: external "@spaceflow/shared"
|
|
@@ -4491,8 +4651,6 @@ class LlmProxyService {
|
|
|
4491
4651
|
}
|
|
4492
4652
|
}
|
|
4493
4653
|
|
|
4494
|
-
;// CONCATENATED MODULE: external "fs"
|
|
4495
|
-
|
|
4496
4654
|
;// CONCATENATED MODULE: ./src/shared/storage/adapters/file.adapter.ts
|
|
4497
4655
|
|
|
4498
4656
|
|
|
@@ -5516,9 +5674,9 @@ var dev_namespaceObject = JSON.parse('{"description":"开发模式 - 监听 skil
|
|
|
5516
5674
|
;// CONCATENATED MODULE: ./src/locales/en/dev.json
|
|
5517
5675
|
var en_dev_namespaceObject = JSON.parse('{"description":"Dev mode - watch and auto-rebuild skill packages","startFailed":"❌ Dev mode failed to start: {{error}}","extensionDescription":"Start plugin dev mode (watch and auto-rebuild)"}')
|
|
5518
5676
|
;// CONCATENATED MODULE: ./src/locales/zh-cn/install.json
|
|
5519
|
-
var install_namespaceObject = JSON.parse('{"description":"安装技能包(支持 npm 包和 git 仓库),不带参数时更新配置文件中的所有 skills","options.name":"指定技能包名称(默认从 source 自动提取)","options.global":"安装到全局目录 (~/.spaceflow) 并关联到全局编辑器目录","options.ignoreErrors":"忽略安装错误,不退出进程","globalNoSource":"❌ 全局安装必须指定 source 参数","globalUsage":" 用法: spaceflow install <source> -g [--name <名称>]","installFailed":"❌ 安装失败: {{error}}","extensionDescription":"安装插件/技能到项目中","envPlaceholder":"<请填写 {{key}}>","registerMcp":" 注册 MCP Server: {{name}}","mcpEnvHint":" ⚠️ 请在 {{path}} 中配置环境变量: {{vars}}","installingExtension":"📦 安装 Extension: {{source}}","installDone":"✅ 安装完成: {{name}}","typeLocal":" 类型: 本地路径","sourcePath":" 源路径: {{path}}","typeGit":" 类型: git 仓库","sourceUrl":" 源: {{url}}","typeNpm":" 类型: npm 包","targetDir":" 目标目录: {{dir}}","extensionInstallFailed":"Extension 安装失败: {{source}}","creatingDir":" 创建目录: {{dir}}","dirExistsSkip":" 目录已存在,跳过克隆","cloningRepo":" 克隆仓库...","cloneFailed":"克隆仓库失败: {{error}}","removingGit":" 移除 .git 目录...","depsLinkExists":" deps 链接已存在,跳过","depsExists":" deps/{{name}} 已存在,跳过","createDepsLink":" 创建 deps 链接: {{dep}} -> {{source}}","skillLinkExists":" skills/{{name}} 链接已存在,跳过","createSkillLink":" 创建 skills 链接: skills/{{name}} -> {{target}}","copySkill":" 复制 skills/{{name}}","globalInstalling":"🔄 全局安装: {{name}} ({{dir}})","pluginTypes":" 插件类型: {{types}}","globalInstallDone":"\\n✅ 全局安装完成","updatingAll":"🔄 更新所有依赖...","noDeps":" 配置文件中没有 dependencies","foundDeps":" 找到 {{count}} 个依赖","installingDeps":"\\n📦 安装依赖...","pmInstallFailed":" 警告: {{pm}} install 失败","depNotInstalled":" ⚠️ {{name}} 未安装成功,跳过","allExtensionsDone":"\\n✅ 所有 Extension 更新完成","updatedPackageJson":" ✓ 更新 .spaceflow/package.json","symlinkExists":" ✓ 符号链接已存在","createSymlink":" 创建符号链接: {{target}} -> {{source}}","createSymlinkFailed":"创建符号链接失败: {{error}}","pullFailed":" 警告: 拉取最新代码失败","checkoutVersion":" 切换到版本: {{ref}}","checkoutFailed":" 警告: 切换版本失败","installingDepsEllipsis":" 安装依赖...","depsInstallFailed":" 警告: 依赖安装失败","depsInstalled":" ✓ 依赖已安装","buildingPlugin":" 构建插件...","buildFailed":" 警告: 构建失败","buildExists":" ✓ 构建已存在","repoExists":" 仓库已存在,更新...","repoUpdateFailed":" 警告: 更新仓库失败","cloneRepoFailed":" 警告: 克隆仓库失败","skillMdExists":" ✓ SKILL.md 已存在","skillMdGenerated":" ✓ 生成 SKILL.md","skillMdFailed":" 警告: 生成 SKILL.md 失败","commandMdGenerated":" ✓ 生成 commands/{{name}}.md","commandMdFailed":" 警告: 生成 commands/{{name}}.md 失败","configUpdated":" 更新配置文件: {{path}}","configAlreadyExists":" 配置文件已包含该技能包","depsUpToDate":" ✓ 依赖已是最新","buildUpToDate":" ✓ 构建已是最新","detailSection":"详细说明","usageSection":"用法","commandDefault":"{{name}} 命令"}')
|
|
5677
|
+
var install_namespaceObject = JSON.parse('{"description":"安装技能包(支持 npm 包和 git 仓库),不带参数时更新配置文件中的所有 skills","options.name":"指定技能包名称(默认从 source 自动提取)","options.global":"安装到全局目录 (~/.spaceflow) 并关联到全局编辑器目录","options.ignoreErrors":"忽略安装错误,不退出进程","globalNoSource":"❌ 全局安装必须指定 source 参数","globalUsage":" 用法: spaceflow install <source> -g [--name <名称>]","installFailed":"❌ 安装失败: {{error}}","extensionDescription":"安装插件/技能到项目中","envPlaceholder":"<请填写 {{key}}>","registerMcp":" 注册 MCP Server: {{name}}","mcpEnvHint":" ⚠️ 请在 {{path}} 中配置环境变量: {{vars}}","installingExtension":"📦 安装 Extension: {{source}}","installDone":"✅ 安装完成: {{name}}","typeLocal":" 类型: 本地路径","sourcePath":" 源路径: {{path}}","typeGit":" 类型: git 仓库","sourceUrl":" 源: {{url}}","typeNpm":" 类型: npm 包","targetDir":" 目标目录: {{dir}}","extensionInstallFailed":"Extension 安装失败: {{source}}","creatingDir":" 创建目录: {{dir}}","dirExistsSkip":" 目录已存在,跳过克隆","cloningRepo":" 克隆仓库...","cloneFailed":"克隆仓库失败: {{error}}","removingGit":" 移除 .git 目录...","depsLinkExists":" deps 链接已存在,跳过","depsExists":" deps/{{name}} 已存在,跳过","createDepsLink":" 创建 deps 链接: {{dep}} -> {{source}}","skillLinkExists":" skills/{{name}} 链接已存在,跳过","createSkillLink":" 创建 skills 链接: skills/{{name}} -> {{target}}","copySkill":" 复制 skills/{{name}}","globalInstalling":"🔄 全局安装: {{name}} ({{dir}})","pluginTypes":" 插件类型: {{types}}","globalInstallDone":"\\n✅ 全局安装完成","updatingAll":"🔄 更新所有依赖...","noDeps":" 配置文件中没有 dependencies","foundDeps":" 找到 {{count}} 个依赖","coreVersionChanged":"📦 @spaceflow/core 版本变更: {{prev}} → {{current}}","installingDeps":"\\n📦 安装依赖...","pmInstallFailed":" 警告: {{pm}} install 失败","depNotInstalled":" ⚠️ {{name}} 未安装成功,跳过","allExtensionsDone":"\\n✅ 所有 Extension 更新完成","updatedPackageJson":" ✓ 更新 .spaceflow/package.json","symlinkExists":" ✓ 符号链接已存在","createSymlink":" 创建符号链接: {{target}} -> {{source}}","createSymlinkFailed":"创建符号链接失败: {{error}}","pullFailed":" 警告: 拉取最新代码失败","checkoutVersion":" 切换到版本: {{ref}}","checkoutFailed":" 警告: 切换版本失败","installingDepsEllipsis":" 安装依赖...","depsInstallFailed":" 警告: 依赖安装失败","depsInstalled":" ✓ 依赖已安装","buildingPlugin":" 构建插件...","buildFailed":" 警告: 构建失败","buildExists":" ✓ 构建已存在","repoExists":" 仓库已存在,更新...","repoUpdateFailed":" 警告: 更新仓库失败","cloneRepoFailed":" 警告: 克隆仓库失败","skillMdExists":" ✓ SKILL.md 已存在","skillMdGenerated":" ✓ 生成 SKILL.md","skillMdFailed":" 警告: 生成 SKILL.md 失败","commandMdGenerated":" ✓ 生成 commands/{{name}}.md","commandMdFailed":" 警告: 生成 commands/{{name}}.md 失败","configUpdated":" 更新配置文件: {{path}}","configAlreadyExists":" 配置文件已包含该技能包","depsUpToDate":" ✓ 依赖已是最新","buildUpToDate":" ✓ 构建已是最新","detailSection":"详细说明","usageSection":"用法","commandDefault":"{{name}} 命令"}')
|
|
5520
5678
|
;// CONCATENATED MODULE: ./src/locales/en/install.json
|
|
5521
|
-
var en_install_namespaceObject = JSON.parse('{"description":"Install skill packages (npm or git), update all skills when no arguments","options.name":"Specify skill package name (auto-detected from source by default)","options.global":"Install to global directory (~/.spaceflow) and link to global editor directories","options.ignoreErrors":"Ignore installation errors without exiting","globalNoSource":"❌ Global install requires a source argument","globalUsage":" Usage: spaceflow install <source> -g [--name <name>]","installFailed":"❌ Installation failed: {{error}}","extensionDescription":"Install plugins/skills to project","envPlaceholder":"<Please fill in {{key}}>","registerMcp":" Register MCP Server: {{name}}","mcpEnvHint":" ⚠️ Please configure environment variables in {{path}}: {{vars}}","installingExtension":"📦 Installing Extension: {{source}}","installDone":"✅ Installation complete: {{name}}","typeLocal":" Type: local path","sourcePath":" Source path: {{path}}","typeGit":" Type: git repository","sourceUrl":" Source: {{url}}","typeNpm":" Type: npm package","targetDir":" Target directory: {{dir}}","extensionInstallFailed":"Extension installation failed: {{source}}","creatingDir":" Creating directory: {{dir}}","dirExistsSkip":" Directory exists, skipping clone","cloningRepo":" Cloning repository...","cloneFailed":"Failed to clone repository: {{error}}","removingGit":" Removing .git directory...","depsLinkExists":" deps link exists, skipping","depsExists":" deps/{{name}} exists, skipping","createDepsLink":" Creating deps link: {{dep}} -> {{source}}","skillLinkExists":" skills/{{name}} link exists, skipping","createSkillLink":" Creating skills link: skills/{{name}} -> {{target}}","copySkill":" Copying skills/{{name}}","globalInstalling":"🔄 Global install: {{name}} ({{dir}})","pluginTypes":" Plugin types: {{types}}","globalInstallDone":"\\n✅ Global installation complete","updatingAll":"🔄 Updating all dependencies...","noDeps":" No dependencies in config file","foundDeps":" Found {{count}} dependencies","installingDeps":"\\n📦 Installing dependencies...","pmInstallFailed":" Warning: {{pm}} install failed","depNotInstalled":" ⚠️ {{name}} not installed successfully, skipping","allExtensionsDone":"\\n✅ All extensions updated","updatedPackageJson":" ✓ Updated .spaceflow/package.json","symlinkExists":" ✓ Symlink already exists","createSymlink":" Creating symlink: {{target}} -> {{source}}","createSymlinkFailed":"Failed to create symlink: {{error}}","pullFailed":" Warning: Failed to pull latest code","checkoutVersion":" Checking out version: {{ref}}","checkoutFailed":" Warning: Failed to checkout version","installingDepsEllipsis":" Installing dependencies...","depsInstallFailed":" Warning: Dependency installation failed","depsInstalled":" ✓ Dependencies installed","buildingPlugin":" Building plugin...","buildFailed":" Warning: Build failed","buildExists":" ✓ Build exists","repoExists":" Repository exists, updating...","repoUpdateFailed":" Warning: Repository update failed","cloneRepoFailed":" Warning: Clone repository failed","skillMdExists":" ✓ SKILL.md already exists","skillMdGenerated":" ✓ Generated SKILL.md","skillMdFailed":" Warning: Failed to generate SKILL.md","commandMdGenerated":" ✓ Generated commands/{{name}}.md","commandMdFailed":" Warning: Failed to generate commands/{{name}}.md","configUpdated":" Config updated: {{path}}","configAlreadyExists":" Config already contains this skill package","depsUpToDate":" ✓ Dependencies are up to date","buildUpToDate":" ✓ Build is up to date","detailSection":"Details","usageSection":"Usage","commandDefault":"{{name}} command"}')
|
|
5679
|
+
var en_install_namespaceObject = JSON.parse('{"description":"Install skill packages (npm or git), update all skills when no arguments","options.name":"Specify skill package name (auto-detected from source by default)","options.global":"Install to global directory (~/.spaceflow) and link to global editor directories","options.ignoreErrors":"Ignore installation errors without exiting","globalNoSource":"❌ Global install requires a source argument","globalUsage":" Usage: spaceflow install <source> -g [--name <name>]","installFailed":"❌ Installation failed: {{error}}","extensionDescription":"Install plugins/skills to project","envPlaceholder":"<Please fill in {{key}}>","registerMcp":" Register MCP Server: {{name}}","mcpEnvHint":" ⚠️ Please configure environment variables in {{path}}: {{vars}}","installingExtension":"📦 Installing Extension: {{source}}","installDone":"✅ Installation complete: {{name}}","typeLocal":" Type: local path","sourcePath":" Source path: {{path}}","typeGit":" Type: git repository","sourceUrl":" Source: {{url}}","typeNpm":" Type: npm package","targetDir":" Target directory: {{dir}}","extensionInstallFailed":"Extension installation failed: {{source}}","creatingDir":" Creating directory: {{dir}}","dirExistsSkip":" Directory exists, skipping clone","cloningRepo":" Cloning repository...","cloneFailed":"Failed to clone repository: {{error}}","removingGit":" Removing .git directory...","depsLinkExists":" deps link exists, skipping","depsExists":" deps/{{name}} exists, skipping","createDepsLink":" Creating deps link: {{dep}} -> {{source}}","skillLinkExists":" skills/{{name}} link exists, skipping","createSkillLink":" Creating skills link: skills/{{name}} -> {{target}}","copySkill":" Copying skills/{{name}}","globalInstalling":"🔄 Global install: {{name}} ({{dir}})","pluginTypes":" Plugin types: {{types}}","globalInstallDone":"\\n✅ Global installation complete","updatingAll":"🔄 Updating all dependencies...","noDeps":" No dependencies in config file","foundDeps":" Found {{count}} dependencies","coreVersionChanged":"📦 @spaceflow/core version changed: {{prev}} → {{current}}","installingDeps":"\\n📦 Installing dependencies...","pmInstallFailed":" Warning: {{pm}} install failed","depNotInstalled":" ⚠️ {{name}} not installed successfully, skipping","allExtensionsDone":"\\n✅ All extensions updated","updatedPackageJson":" ✓ Updated .spaceflow/package.json","symlinkExists":" ✓ Symlink already exists","createSymlink":" Creating symlink: {{target}} -> {{source}}","createSymlinkFailed":"Failed to create symlink: {{error}}","pullFailed":" Warning: Failed to pull latest code","checkoutVersion":" Checking out version: {{ref}}","checkoutFailed":" Warning: Failed to checkout version","installingDepsEllipsis":" Installing dependencies...","depsInstallFailed":" Warning: Dependency installation failed","depsInstalled":" ✓ Dependencies installed","buildingPlugin":" Building plugin...","buildFailed":" Warning: Build failed","buildExists":" ✓ Build exists","repoExists":" Repository exists, updating...","repoUpdateFailed":" Warning: Repository update failed","cloneRepoFailed":" Warning: Clone repository failed","skillMdExists":" ✓ SKILL.md already exists","skillMdGenerated":" ✓ Generated SKILL.md","skillMdFailed":" Warning: Failed to generate SKILL.md","commandMdGenerated":" ✓ Generated commands/{{name}}.md","commandMdFailed":" Warning: Failed to generate commands/{{name}}.md","configUpdated":" Config updated: {{path}}","configAlreadyExists":" Config already contains this skill package","depsUpToDate":" ✓ Dependencies are up to date","buildUpToDate":" ✓ Build is up to date","detailSection":"Details","usageSection":"Usage","commandDefault":"{{name}} command"}')
|
|
5522
5680
|
;// CONCATENATED MODULE: ./src/locales/zh-cn/list.json
|
|
5523
5681
|
var list_namespaceObject = JSON.parse('{"description":"列出已安装的技能包","extensionDescription":"列出已安装的插件/技能","noSkills":"📦 没有已安装的技能包","installHint":"使用以下命令安装技能包:","installedExtensions":"📦 已安装的扩展 ({{installed}}/{{total}}):","commands":"命令: {{commands}}"}')
|
|
5524
5682
|
;// CONCATENATED MODULE: ./src/locales/en/list.json
|
|
@@ -9003,9 +9161,30 @@ class InstallService {
|
|
|
9003
9161
|
if (shouldLog(verbose, 1)) console.log(i18n_t("install:foundDeps", {
|
|
9004
9162
|
count: Object.keys(dependencies).length
|
|
9005
9163
|
}));
|
|
9006
|
-
// 1.
|
|
9164
|
+
// 1. 记录更新前的 @spaceflow/core 版本
|
|
9165
|
+
const spaceflowPkgPath = (0,external_path_.join)(spaceflowDir, "package.json");
|
|
9166
|
+
let prevCoreVersion;
|
|
9167
|
+
if (existsSync(spaceflowPkgPath)) {
|
|
9168
|
+
try {
|
|
9169
|
+
const prevPkg = JSON.parse(await (0,promises_.readFile)(spaceflowPkgPath, "utf-8"));
|
|
9170
|
+
prevCoreVersion = prevPkg.dependencies?.["@spaceflow/core"];
|
|
9171
|
+
} catch {
|
|
9172
|
+
// ignore
|
|
9173
|
+
}
|
|
9174
|
+
}
|
|
9175
|
+
// 2. 更新 .spaceflow/package.json 中的所有依赖
|
|
9007
9176
|
await this.updateSpaceflowPackageJson(dependencies, spaceflowDir, verbose);
|
|
9008
|
-
//
|
|
9177
|
+
// 3. 版本变更提示
|
|
9178
|
+
const currentCoreVersion = getSpaceflowCoreVersion();
|
|
9179
|
+
if (prevCoreVersion && prevCoreVersion !== currentCoreVersion) {
|
|
9180
|
+
if (shouldLog(verbose, 1)) {
|
|
9181
|
+
console.log(i18n_t("install:coreVersionChanged", {
|
|
9182
|
+
prev: prevCoreVersion,
|
|
9183
|
+
current: currentCoreVersion
|
|
9184
|
+
}));
|
|
9185
|
+
}
|
|
9186
|
+
}
|
|
9187
|
+
// 4. 安装所有依赖
|
|
9009
9188
|
if (shouldLog(verbose, 1)) console.log(i18n_t("install:installingDeps"));
|
|
9010
9189
|
const pm = detectPackageManager(spaceflowDir);
|
|
9011
9190
|
try {
|
|
@@ -9018,7 +9197,7 @@ class InstallService {
|
|
|
9018
9197
|
pm
|
|
9019
9198
|
}));
|
|
9020
9199
|
}
|
|
9021
|
-
//
|
|
9200
|
+
// 5. 处理每个依赖的 skills/commands 关联
|
|
9022
9201
|
for (const [name, config] of Object.entries(dependencies)){
|
|
9023
9202
|
const { source } = this.parseExtensionConfig(config);
|
|
9024
9203
|
const sourceType = getSourceType(source);
|
|
@@ -11461,7 +11640,7 @@ async function exec(extensions = [], options = {}) {
|
|
|
11461
11640
|
// 6. 创建 CLI 程序
|
|
11462
11641
|
const program = new Command();
|
|
11463
11642
|
const cliVersion = options.cliVersion || "0.0.0";
|
|
11464
|
-
const coreVersion = true ? "0.
|
|
11643
|
+
const coreVersion = true ? "0.25.0" : 0;
|
|
11465
11644
|
const versionOutput = `spaceflow/${cliVersion} core/${coreVersion}`;
|
|
11466
11645
|
program.name("spaceflow").description("Spaceflow CLI").version(versionOutput, "-V, --version", "显示版本信息");
|
|
11467
11646
|
// 定义全局 verbose 选项(支持计数:-v, -vv, -vvv)
|