ccg-ros2-workflow 2.2.0 → 2.2.2
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/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import cac from 'cac';
|
|
3
3
|
import ansis from 'ansis';
|
|
4
|
-
import { z as diagnoseMcpConfig, A as isWindows, B as readClaudeCodeConfig, C as fixWindowsMcpConfig, D as writeClaudeCodeConfig, t as readCcgConfig, n as initI18n, u as showMainMenu, m as init, E as configMcp, F as version, l as i18n } from './shared/ccg-ros2-workflow.
|
|
4
|
+
import { z as diagnoseMcpConfig, A as isWindows, B as readClaudeCodeConfig, C as fixWindowsMcpConfig, D as writeClaudeCodeConfig, t as readCcgConfig, n as initI18n, u as showMainMenu, m as init, E as configMcp, F as version, l as i18n } from './shared/ccg-ros2-workflow.DnOr3oPi.mjs';
|
|
5
5
|
import 'inquirer';
|
|
6
6
|
import 'node:child_process';
|
|
7
7
|
import 'node:util';
|
package/dist/index.d.mts
CHANGED
|
@@ -95,6 +95,9 @@ interface AceToolConfig {
|
|
|
95
95
|
baseUrl: string;
|
|
96
96
|
token: string;
|
|
97
97
|
}
|
|
98
|
+
interface ContextWeaverConfig {
|
|
99
|
+
siliconflowApiKey: string;
|
|
100
|
+
}
|
|
98
101
|
|
|
99
102
|
declare function init(options?: InitOptions): Promise<void>;
|
|
100
103
|
|
|
@@ -140,6 +143,7 @@ declare function installWorkflows(workflowIds: string[], installDir: string, for
|
|
|
140
143
|
};
|
|
141
144
|
};
|
|
142
145
|
liteMode?: boolean;
|
|
146
|
+
mcpProvider?: string;
|
|
143
147
|
}): Promise<InstallResult>;
|
|
144
148
|
/**
|
|
145
149
|
* Install and configure ace-tool MCP for Claude Code
|
|
@@ -226,4 +230,4 @@ declare function checkForUpdates(): Promise<{
|
|
|
226
230
|
}>;
|
|
227
231
|
|
|
228
232
|
export { changeLanguage, checkForUpdates, compareVersions, createDefaultConfig, createDefaultRouting, getCcgDir, getConfigPath, getCurrentVersion, getLatestVersion, getWorkflowById, getWorkflowConfigs, i18n, init, initI18n, installAceTool, installAceToolRs, installWorkflows, migrateToV1_4_0, needsMigration, readCcgConfig, showMainMenu, uninstallAceTool, uninstallWorkflows, update, writeCcgConfig };
|
|
229
|
-
export type { AceToolConfig, CcgConfig, CliOptions, CollaborationMode, InitOptions, InstallResult, ModelRouting, ModelType, RoutingStrategy, SupportedLang, WorkflowConfig };
|
|
233
|
+
export type { AceToolConfig, CcgConfig, CliOptions, CollaborationMode, ContextWeaverConfig, InitOptions, InstallResult, ModelRouting, ModelType, RoutingStrategy, SupportedLang, WorkflowConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -95,6 +95,9 @@ interface AceToolConfig {
|
|
|
95
95
|
baseUrl: string;
|
|
96
96
|
token: string;
|
|
97
97
|
}
|
|
98
|
+
interface ContextWeaverConfig {
|
|
99
|
+
siliconflowApiKey: string;
|
|
100
|
+
}
|
|
98
101
|
|
|
99
102
|
declare function init(options?: InitOptions): Promise<void>;
|
|
100
103
|
|
|
@@ -140,6 +143,7 @@ declare function installWorkflows(workflowIds: string[], installDir: string, for
|
|
|
140
143
|
};
|
|
141
144
|
};
|
|
142
145
|
liteMode?: boolean;
|
|
146
|
+
mcpProvider?: string;
|
|
143
147
|
}): Promise<InstallResult>;
|
|
144
148
|
/**
|
|
145
149
|
* Install and configure ace-tool MCP for Claude Code
|
|
@@ -226,4 +230,4 @@ declare function checkForUpdates(): Promise<{
|
|
|
226
230
|
}>;
|
|
227
231
|
|
|
228
232
|
export { changeLanguage, checkForUpdates, compareVersions, createDefaultConfig, createDefaultRouting, getCcgDir, getConfigPath, getCurrentVersion, getLatestVersion, getWorkflowById, getWorkflowConfigs, i18n, init, initI18n, installAceTool, installAceToolRs, installWorkflows, migrateToV1_4_0, needsMigration, readCcgConfig, showMainMenu, uninstallAceTool, uninstallWorkflows, update, writeCcgConfig };
|
|
229
|
-
export type { AceToolConfig, CcgConfig, CliOptions, CollaborationMode, InitOptions, InstallResult, ModelRouting, ModelType, RoutingStrategy, SupportedLang, WorkflowConfig };
|
|
233
|
+
export type { AceToolConfig, CcgConfig, CliOptions, CollaborationMode, ContextWeaverConfig, InitOptions, InstallResult, ModelRouting, ModelType, RoutingStrategy, SupportedLang, WorkflowConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as changeLanguage, a as checkForUpdates, b as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, h as getCurrentVersion, i as getLatestVersion, j as getWorkflowById, k as getWorkflowConfigs, l as i18n, m as init, n as initI18n, o as installAceTool, p as installAceToolRs, q as installWorkflows, r as migrateToV1_4_0, s as needsMigration, t as readCcgConfig, u as showMainMenu, v as uninstallAceTool, w as uninstallWorkflows, x as update, y as writeCcgConfig } from './shared/ccg-ros2-workflow.
|
|
1
|
+
export { c as changeLanguage, a as checkForUpdates, b as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, h as getCurrentVersion, i as getLatestVersion, j as getWorkflowById, k as getWorkflowConfigs, l as i18n, m as init, n as initI18n, o as installAceTool, p as installAceToolRs, q as installWorkflows, r as migrateToV1_4_0, s as needsMigration, t as readCcgConfig, u as showMainMenu, v as uninstallAceTool, w as uninstallWorkflows, x as update, y as writeCcgConfig } from './shared/ccg-ros2-workflow.DnOr3oPi.mjs';
|
|
2
2
|
import 'ansis';
|
|
3
3
|
import 'inquirer';
|
|
4
4
|
import 'node:child_process';
|
|
@@ -10,7 +10,7 @@ import i18next from 'i18next';
|
|
|
10
10
|
import ora from 'ora';
|
|
11
11
|
import { parse, stringify } from 'smol-toml';
|
|
12
12
|
|
|
13
|
-
const version = "2.2.
|
|
13
|
+
const version = "2.2.2";
|
|
14
14
|
|
|
15
15
|
function isWindows() {
|
|
16
16
|
return process.platform === "win32";
|
|
@@ -892,6 +892,78 @@ async function installAceToolRs(config) {
|
|
|
892
892
|
};
|
|
893
893
|
}
|
|
894
894
|
}
|
|
895
|
+
async function installContextWeaver(config) {
|
|
896
|
+
const { siliconflowApiKey } = config;
|
|
897
|
+
try {
|
|
898
|
+
console.log(" \u23F3 \u6B63\u5728\u5B89\u88C5 ContextWeaver CLI...");
|
|
899
|
+
const { execSync } = await import('node:child_process');
|
|
900
|
+
try {
|
|
901
|
+
execSync("npm install -g @hsingjui/contextweaver", { stdio: "pipe" });
|
|
902
|
+
console.log(" \u2713 ContextWeaver CLI \u5B89\u88C5\u6210\u529F");
|
|
903
|
+
} catch {
|
|
904
|
+
if (process.platform !== "win32") {
|
|
905
|
+
try {
|
|
906
|
+
execSync("sudo npm install -g @hsingjui/contextweaver", { stdio: "pipe" });
|
|
907
|
+
console.log(" \u2713 ContextWeaver CLI \u5B89\u88C5\u6210\u529F (sudo)");
|
|
908
|
+
} catch {
|
|
909
|
+
console.log(" \u26A0 ContextWeaver CLI \u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u8FD0\u884C: npm install -g @hsingjui/contextweaver");
|
|
910
|
+
}
|
|
911
|
+
} else {
|
|
912
|
+
console.log(" \u26A0 ContextWeaver CLI \u5B89\u88C5\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u8FD0\u884C: npm install -g @hsingjui/contextweaver");
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
const contextWeaverDir = join(homedir(), ".contextweaver");
|
|
916
|
+
await fs.ensureDir(contextWeaverDir);
|
|
917
|
+
const envContent = `# ContextWeaver \u914D\u7F6E (\u7531 CCG-ROS2 \u81EA\u52A8\u751F\u6210)
|
|
918
|
+
|
|
919
|
+
# Embedding API - \u7845\u57FA\u6D41\u52A8
|
|
920
|
+
EMBEDDINGS_API_KEY=${siliconflowApiKey}
|
|
921
|
+
EMBEDDINGS_BASE_URL=https://api.siliconflow.cn/v1/embeddings
|
|
922
|
+
EMBEDDINGS_MODEL=Qwen/Qwen3-Embedding-8B
|
|
923
|
+
EMBEDDINGS_MAX_CONCURRENCY=10
|
|
924
|
+
EMBEDDINGS_DIMENSIONS=1024
|
|
925
|
+
|
|
926
|
+
# Reranker - \u7845\u57FA\u6D41\u52A8
|
|
927
|
+
RERANK_API_KEY=${siliconflowApiKey}
|
|
928
|
+
RERANK_BASE_URL=https://api.siliconflow.cn/v1/rerank
|
|
929
|
+
RERANK_MODEL=Qwen/Qwen3-Reranker-8B
|
|
930
|
+
RERANK_TOP_N=20
|
|
931
|
+
`;
|
|
932
|
+
await fs.writeFile(join(contextWeaverDir, ".env"), envContent, "utf-8");
|
|
933
|
+
let existingConfig = await readClaudeCodeConfig();
|
|
934
|
+
if (!existingConfig) {
|
|
935
|
+
existingConfig = { mcpServers: {} };
|
|
936
|
+
}
|
|
937
|
+
if (existingConfig.mcpServers && Object.keys(existingConfig.mcpServers).length > 0) {
|
|
938
|
+
const backupPath = await backupClaudeCodeConfig();
|
|
939
|
+
if (backupPath) {
|
|
940
|
+
console.log(` \u2713 Backup created: ${backupPath}`);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
const contextWeaverMcpConfig = buildMcpServerConfig({
|
|
944
|
+
type: "stdio",
|
|
945
|
+
command: "contextweaver",
|
|
946
|
+
args: ["mcp"]
|
|
947
|
+
});
|
|
948
|
+
let mergedConfig = mergeMcpServers(existingConfig, {
|
|
949
|
+
contextweaver: contextWeaverMcpConfig
|
|
950
|
+
});
|
|
951
|
+
if (isWindows()) {
|
|
952
|
+
mergedConfig = fixWindowsMcpConfig(mergedConfig);
|
|
953
|
+
}
|
|
954
|
+
await writeClaudeCodeConfig(mergedConfig);
|
|
955
|
+
return {
|
|
956
|
+
success: true,
|
|
957
|
+
message: "ContextWeaver MCP configured successfully",
|
|
958
|
+
configPath: join(homedir(), ".claude.json")
|
|
959
|
+
};
|
|
960
|
+
} catch (error) {
|
|
961
|
+
return {
|
|
962
|
+
success: false,
|
|
963
|
+
message: `Failed to configure ContextWeaver: ${error}`
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
}
|
|
895
967
|
|
|
896
968
|
async function configMcp() {
|
|
897
969
|
console.log();
|
|
@@ -1518,34 +1590,39 @@ async function init(options = {}) {
|
|
|
1518
1590
|
const mode = "smart";
|
|
1519
1591
|
const selectedWorkflows = getAllCommandIds();
|
|
1520
1592
|
let liteMode = false;
|
|
1521
|
-
let mcpProvider = "
|
|
1593
|
+
let mcpProvider = "contextweaver";
|
|
1522
1594
|
let aceToolBaseUrl = "";
|
|
1523
1595
|
let aceToolToken = "";
|
|
1596
|
+
let contextWeaverApiKey = "";
|
|
1524
1597
|
if (options.skipMcp) {
|
|
1525
1598
|
mcpProvider = "skip";
|
|
1526
1599
|
} else if (!options.skipPrompt) {
|
|
1527
1600
|
console.log();
|
|
1528
|
-
console.log(ansis.cyan.bold(` \u{1F527} MCP \u5DE5\u5177\u914D\u7F6E`));
|
|
1601
|
+
console.log(ansis.cyan.bold(` \u{1F527} MCP \u4EE3\u7801\u68C0\u7D22\u5DE5\u5177\u914D\u7F6E`));
|
|
1529
1602
|
console.log();
|
|
1530
1603
|
const { selectedMcp } = await inquirer.prompt([{
|
|
1531
1604
|
type: "list",
|
|
1532
1605
|
name: "selectedMcp",
|
|
1533
|
-
message: "\u9009\u62E9 MCP \u5DE5\u5177",
|
|
1606
|
+
message: "\u9009\u62E9\u4EE3\u7801\u68C0\u7D22 MCP \u5DE5\u5177",
|
|
1534
1607
|
choices: [
|
|
1535
1608
|
{
|
|
1536
|
-
name: `
|
|
1609
|
+
name: `contextweaver ${ansis.green("(\u63A8\u8350)")} ${ansis.gray("- \u672C\u5730\u5411\u91CF\u5E93\uFF0C\u6DF7\u5408\u641C\u7D22 + Rerank")}`,
|
|
1610
|
+
value: "contextweaver"
|
|
1611
|
+
},
|
|
1612
|
+
{
|
|
1613
|
+
name: `ace-tool ${ansis.red("(\u6536\u8D39)")} ${ansis.gray("(Node.js) - Augment \u5B98\u65B9")}`,
|
|
1537
1614
|
value: "ace-tool"
|
|
1538
1615
|
},
|
|
1539
1616
|
{
|
|
1540
|
-
name: `ace-tool-rs ${ansis.
|
|
1617
|
+
name: `ace-tool-rs ${ansis.red("(\u6536\u8D39)")} ${ansis.gray("(Rust) - \u66F4\u8F7B\u91CF")}`,
|
|
1541
1618
|
value: "ace-tool-rs"
|
|
1542
1619
|
},
|
|
1543
1620
|
{
|
|
1544
|
-
name: `\u8DF3\u8FC7 ${ansis.gray("- \u7A0D\u540E\u624B\u52A8\u914D\u7F6E
|
|
1621
|
+
name: `\u8DF3\u8FC7 ${ansis.gray("- \u7A0D\u540E\u624B\u52A8\u914D\u7F6E")}`,
|
|
1545
1622
|
value: "skip"
|
|
1546
1623
|
}
|
|
1547
1624
|
],
|
|
1548
|
-
default: "
|
|
1625
|
+
default: "contextweaver"
|
|
1549
1626
|
}]);
|
|
1550
1627
|
mcpProvider = selectedMcp;
|
|
1551
1628
|
if (selectedMcp === "ace-tool" || selectedMcp === "ace-tool-rs") {
|
|
@@ -1596,6 +1673,41 @@ async function init(options = {}) {
|
|
|
1596
1673
|
console.log(ansis.gray(` \u2022 \u83B7\u53D6 Token: ${ansis.cyan("https://augmentcode.com/")}`));
|
|
1597
1674
|
console.log();
|
|
1598
1675
|
}
|
|
1676
|
+
} else if (selectedMcp === "contextweaver") {
|
|
1677
|
+
console.log();
|
|
1678
|
+
console.log(ansis.cyan.bold(` \u{1F527} ContextWeaver MCP \u914D\u7F6E`));
|
|
1679
|
+
console.log(ansis.gray(` \u672C\u5730\u8BED\u4E49\u4EE3\u7801\u68C0\u7D22\u5F15\u64CE\uFF0C\u6DF7\u5408\u641C\u7D22 + Rerank`));
|
|
1680
|
+
console.log();
|
|
1681
|
+
const { skipKey } = await inquirer.prompt([{
|
|
1682
|
+
type: "confirm",
|
|
1683
|
+
name: "skipKey",
|
|
1684
|
+
message: "\u662F\u5426\u8DF3\u8FC7 API Key \u914D\u7F6E\uFF1F\uFF08\u53EF\u7A0D\u540E\u8FD0\u884C npx ccg config mcp \u914D\u7F6E\uFF09",
|
|
1685
|
+
default: false
|
|
1686
|
+
}]);
|
|
1687
|
+
if (!skipKey) {
|
|
1688
|
+
console.log();
|
|
1689
|
+
console.log(ansis.cyan(` \u{1F4D6} \u83B7\u53D6\u7845\u57FA\u6D41\u52A8 API Key\uFF1A`));
|
|
1690
|
+
console.log();
|
|
1691
|
+
console.log(` ${ansis.gray("1.")} \u8BBF\u95EE ${ansis.underline("https://siliconflow.cn/")} \u6CE8\u518C\u8D26\u53F7`);
|
|
1692
|
+
console.log(` ${ansis.gray("2.")} \u8FDB\u5165\u63A7\u5236\u53F0 \u2192 API \u5BC6\u94A5 \u2192 \u521B\u5EFA\u5BC6\u94A5`);
|
|
1693
|
+
console.log(` ${ansis.gray("3.")} \u65B0\u7528\u6237\u6709\u514D\u8D39\u989D\u5EA6\uFF0CEmbedding + Rerank \u5B8C\u5168\u591F\u7528`);
|
|
1694
|
+
console.log();
|
|
1695
|
+
const cwAnswers = await inquirer.prompt([{
|
|
1696
|
+
type: "password",
|
|
1697
|
+
name: "apiKey",
|
|
1698
|
+
message: `\u7845\u57FA\u6D41\u52A8 API Key ${ansis.gray("(sk-xxx)")}`,
|
|
1699
|
+
mask: "*",
|
|
1700
|
+
validate: (input) => input.trim() !== "" || "\u8BF7\u8F93\u5165 API Key"
|
|
1701
|
+
}]);
|
|
1702
|
+
contextWeaverApiKey = cwAnswers.apiKey || "";
|
|
1703
|
+
} else {
|
|
1704
|
+
console.log();
|
|
1705
|
+
console.log(ansis.yellow(` \u2139\uFE0F \u5DF2\u8DF3\u8FC7 API Key \u914D\u7F6E`));
|
|
1706
|
+
console.log(ansis.gray(` \u2022 ContextWeaver MCP \u5C06\u4E0D\u4F1A\u81EA\u52A8\u5B89\u88C5`));
|
|
1707
|
+
console.log(ansis.gray(` \u2022 \u53EF\u7A0D\u540E\u8FD0\u884C ${ansis.cyan("npx ccg config mcp")} \u914D\u7F6E`));
|
|
1708
|
+
console.log(ansis.gray(` \u2022 \u83B7\u53D6 Key: ${ansis.cyan("https://siliconflow.cn/")}`));
|
|
1709
|
+
console.log();
|
|
1710
|
+
}
|
|
1599
1711
|
} else {
|
|
1600
1712
|
console.log();
|
|
1601
1713
|
console.log(ansis.yellow(` \u2139\uFE0F \u5DF2\u8DF3\u8FC7 MCP \u914D\u7F6E`));
|
|
@@ -1603,6 +1715,38 @@ async function init(options = {}) {
|
|
|
1603
1715
|
console.log();
|
|
1604
1716
|
}
|
|
1605
1717
|
}
|
|
1718
|
+
let apiUrl = "";
|
|
1719
|
+
let apiKey = "";
|
|
1720
|
+
if (!options.skipPrompt) {
|
|
1721
|
+
console.log();
|
|
1722
|
+
console.log(ansis.cyan.bold(` \u{1F511} Claude Code API \u914D\u7F6E`));
|
|
1723
|
+
console.log();
|
|
1724
|
+
const { configureApi } = await inquirer.prompt([{
|
|
1725
|
+
type: "confirm",
|
|
1726
|
+
name: "configureApi",
|
|
1727
|
+
message: "\u662F\u5426\u914D\u7F6E\u81EA\u5B9A\u4E49 API\uFF1F\uFF08\u4F7F\u7528\u5B98\u65B9\u8D26\u53F7\u53EF\u8DF3\u8FC7\uFF09",
|
|
1728
|
+
default: false
|
|
1729
|
+
}]);
|
|
1730
|
+
if (configureApi) {
|
|
1731
|
+
const apiAnswers = await inquirer.prompt([
|
|
1732
|
+
{
|
|
1733
|
+
type: "input",
|
|
1734
|
+
name: "url",
|
|
1735
|
+
message: `API URL ${ansis.gray("(\u5FC5\u586B)")}`,
|
|
1736
|
+
validate: (v) => v.trim() !== "" || "\u8BF7\u8F93\u5165 API URL"
|
|
1737
|
+
},
|
|
1738
|
+
{
|
|
1739
|
+
type: "password",
|
|
1740
|
+
name: "key",
|
|
1741
|
+
message: `API Key ${ansis.gray("(\u5FC5\u586B)")}`,
|
|
1742
|
+
mask: "*",
|
|
1743
|
+
validate: (v) => v.trim() !== "" || "\u8BF7\u8F93\u5165 API Key"
|
|
1744
|
+
}
|
|
1745
|
+
]);
|
|
1746
|
+
apiUrl = apiAnswers.url?.trim() || "";
|
|
1747
|
+
apiKey = apiAnswers.key?.trim() || "";
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1606
1750
|
if (!options.skipPrompt) {
|
|
1607
1751
|
const existingConfig = await readCcgConfig();
|
|
1608
1752
|
const currentLiteMode = existingConfig?.performance?.liteMode || false;
|
|
@@ -1645,7 +1789,11 @@ async function init(options = {}) {
|
|
|
1645
1789
|
console.log(` ${ansis.cyan("\u76EE\u6807\u5E73\u53F0")} ${ansis.green("ROS2 Humble")} \u7269\u7406\u673A\u5668\u4EBA`);
|
|
1646
1790
|
console.log(` ${ansis.cyan("\u6A21\u578B\u8DEF\u7531")} ${ansis.green("Gemini")} (\u4E0A\u5C42\u5E94\u7528) + ${ansis.blue("Codex")} (\u5E95\u5C42\u63A7\u5236)`);
|
|
1647
1791
|
console.log(` ${ansis.cyan("\u547D\u4EE4\u6570\u91CF")} ${ansis.yellow(selectedWorkflows.length.toString())} \u4E2A`);
|
|
1648
|
-
|
|
1792
|
+
if (mcpProvider === "contextweaver") {
|
|
1793
|
+
console.log(` ${ansis.cyan("MCP \u5DE5\u5177")} ${contextWeaverApiKey ? ansis.green("contextweaver") : ansis.yellow("contextweaver (\u5F85\u914D\u7F6E)")}`);
|
|
1794
|
+
} else {
|
|
1795
|
+
console.log(` ${ansis.cyan("MCP \u5DE5\u5177")} ${mcpProvider === "ace-tool" || mcpProvider === "ace-tool-rs" ? aceToolToken ? ansis.green(mcpProvider) : ansis.yellow(`${mcpProvider} (\u5F85\u914D\u7F6E)`) : ansis.gray("\u8DF3\u8FC7")}`);
|
|
1796
|
+
}
|
|
1649
1797
|
console.log(` ${ansis.cyan("Web UI")} ${liteMode ? ansis.gray("\u7981\u7528") : ansis.green("\u542F\u7528")}`);
|
|
1650
1798
|
console.log(ansis.yellow("\u2501".repeat(50)));
|
|
1651
1799
|
console.log();
|
|
@@ -1703,7 +1851,8 @@ async function init(options = {}) {
|
|
|
1703
1851
|
const installDir = options.installDir || join(homedir(), ".claude");
|
|
1704
1852
|
const result = await installWorkflows(selectedWorkflows, installDir, options.force, {
|
|
1705
1853
|
routing,
|
|
1706
|
-
liteMode
|
|
1854
|
+
liteMode,
|
|
1855
|
+
mcpProvider
|
|
1707
1856
|
});
|
|
1708
1857
|
if ((mcpProvider === "ace-tool" || mcpProvider === "ace-tool-rs") && aceToolToken) {
|
|
1709
1858
|
const toolName = mcpProvider === "ace-tool-rs" ? "ace-tool-rs" : "ace-tool";
|
|
@@ -1721,6 +1870,28 @@ async function init(options = {}) {
|
|
|
1721
1870
|
spinner.warn(ansis.yellow(mcpProvider === "ace-tool-rs" ? i18n.t("init:aceToolRs.failed") : i18n.t("init:aceTool.failed")));
|
|
1722
1871
|
console.log(ansis.gray(` ${aceResult.message}`));
|
|
1723
1872
|
}
|
|
1873
|
+
} else if (mcpProvider === "contextweaver" && contextWeaverApiKey) {
|
|
1874
|
+
spinner.text = "\u6B63\u5728\u914D\u7F6E ContextWeaver MCP...";
|
|
1875
|
+
const cwResult = await installContextWeaver({
|
|
1876
|
+
siliconflowApiKey: contextWeaverApiKey
|
|
1877
|
+
});
|
|
1878
|
+
if (cwResult.success) {
|
|
1879
|
+
spinner.succeed(ansis.green(i18n.t("init:installSuccess")));
|
|
1880
|
+
console.log();
|
|
1881
|
+
console.log(` ${ansis.green("\u2713")} ContextWeaver MCP ${ansis.gray(`\u2192 ${cwResult.configPath}`)}`);
|
|
1882
|
+
console.log(` ${ansis.green("\u2713")} \u914D\u7F6E\u6587\u4EF6 ${ansis.gray("\u2192 ~/.contextweaver/.env")}`);
|
|
1883
|
+
console.log();
|
|
1884
|
+
console.log(ansis.cyan(` \u{1F4D6} \u9996\u6B21\u4F7F\u7528\u9700\u8981\u7D22\u5F15\u4EE3\u7801\u5E93\uFF1A`));
|
|
1885
|
+
console.log(ansis.gray(` cd your-project && cw index`));
|
|
1886
|
+
} else {
|
|
1887
|
+
spinner.warn(ansis.yellow("ContextWeaver MCP \u914D\u7F6E\u5931\u8D25"));
|
|
1888
|
+
console.log(ansis.gray(` ${cwResult.message}`));
|
|
1889
|
+
}
|
|
1890
|
+
} else if (mcpProvider === "contextweaver" && !contextWeaverApiKey) {
|
|
1891
|
+
spinner.succeed(ansis.green(i18n.t("init:installSuccess")));
|
|
1892
|
+
console.log();
|
|
1893
|
+
console.log(` ${ansis.yellow("\u26A0")} ContextWeaver MCP \u672A\u5B89\u88C5 ${ansis.gray("(API Key \u672A\u63D0\u4F9B)")}`);
|
|
1894
|
+
console.log(` ${ansis.gray("\u2192")} \u7A0D\u540E\u8FD0\u884C ${ansis.cyan("npx ccg config mcp")} \u5B8C\u6210\u914D\u7F6E`);
|
|
1724
1895
|
} else if ((mcpProvider === "ace-tool" || mcpProvider === "ace-tool-rs") && !aceToolToken) {
|
|
1725
1896
|
const toolName = mcpProvider === "ace-tool-rs" ? "ace-tool-rs" : "ace-tool";
|
|
1726
1897
|
spinner.succeed(ansis.green(i18n.t("init:installSuccess")));
|
|
@@ -1730,6 +1901,38 @@ async function init(options = {}) {
|
|
|
1730
1901
|
} else {
|
|
1731
1902
|
spinner.succeed(ansis.green(i18n.t("init:installSuccess")));
|
|
1732
1903
|
}
|
|
1904
|
+
if (apiUrl && apiKey) {
|
|
1905
|
+
const settingsPath = join(installDir, "settings.json");
|
|
1906
|
+
let settings = {};
|
|
1907
|
+
if (await fs.pathExists(settingsPath)) {
|
|
1908
|
+
settings = await fs.readJSON(settingsPath);
|
|
1909
|
+
}
|
|
1910
|
+
if (!settings.env)
|
|
1911
|
+
settings.env = {};
|
|
1912
|
+
settings.env.ANTHROPIC_BASE_URL = apiUrl;
|
|
1913
|
+
settings.env.ANTHROPIC_API_KEY = apiKey;
|
|
1914
|
+
delete settings.env.ANTHROPIC_AUTH_TOKEN;
|
|
1915
|
+
settings.env.DISABLE_TELEMETRY = "1";
|
|
1916
|
+
settings.env.DISABLE_ERROR_REPORTING = "1";
|
|
1917
|
+
settings.env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = "1";
|
|
1918
|
+
settings.env.CLAUDE_CODE_ATTRIBUTION_HEADER = "0";
|
|
1919
|
+
settings.env.MCP_TIMEOUT = "60000";
|
|
1920
|
+
if (!settings.permissions)
|
|
1921
|
+
settings.permissions = {};
|
|
1922
|
+
if (!settings.permissions.allow)
|
|
1923
|
+
settings.permissions.allow = [];
|
|
1924
|
+
const wrapperPerms = [
|
|
1925
|
+
"Bash(~/.claude/bin/codeagent-wrapper --backend gemini*)",
|
|
1926
|
+
"Bash(~/.claude/bin/codeagent-wrapper --backend codex*)"
|
|
1927
|
+
];
|
|
1928
|
+
for (const perm of wrapperPerms) {
|
|
1929
|
+
if (!settings.permissions.allow.includes(perm))
|
|
1930
|
+
settings.permissions.allow.push(perm);
|
|
1931
|
+
}
|
|
1932
|
+
await fs.writeJSON(settingsPath, settings, { spaces: 2 });
|
|
1933
|
+
console.log();
|
|
1934
|
+
console.log(` ${ansis.green("\u2713")} API \u914D\u7F6E ${ansis.gray(`\u2192 ${settingsPath}`)}`);
|
|
1935
|
+
}
|
|
1733
1936
|
console.log();
|
|
1734
1937
|
console.log(ansis.cyan(` ${i18n.t("init:installedCommands")}`));
|
|
1735
1938
|
result.installedCommands.forEach((cmd) => {
|
|
@@ -1795,7 +1998,7 @@ async function init(options = {}) {
|
|
|
1795
1998
|
console.log(` ${ansis.green("\u2713")} PATH ${ansis.gray(`\u2192 ${shellRcDisplay} (\u5DF2\u914D\u7F6E)`)}`);
|
|
1796
1999
|
} else {
|
|
1797
2000
|
const configLine = `
|
|
1798
|
-
# CCG multi-model collaboration system
|
|
2001
|
+
# CCG-ROS2 multi-model collaboration system
|
|
1799
2002
|
${exportCommand}
|
|
1800
2003
|
`;
|
|
1801
2004
|
await fs.appendFile(shellRc, configLine, "utf-8");
|
|
@@ -1809,18 +2012,21 @@ ${exportCommand}
|
|
|
1809
2012
|
}
|
|
1810
2013
|
}
|
|
1811
2014
|
}
|
|
1812
|
-
if (mcpProvider === "skip" || (mcpProvider === "ace-tool" || mcpProvider === "ace-tool-rs") && !aceToolToken) {
|
|
2015
|
+
if (mcpProvider === "skip" || (mcpProvider === "ace-tool" || mcpProvider === "ace-tool-rs") && !aceToolToken || mcpProvider === "contextweaver" && !contextWeaverApiKey) {
|
|
1813
2016
|
console.log();
|
|
1814
2017
|
console.log(ansis.cyan.bold(` \u{1F4D6} MCP \u670D\u52A1\u9009\u9879`));
|
|
1815
2018
|
console.log();
|
|
1816
|
-
console.log(ansis.gray(` \u5982\u9700\u4F7F\u7528\u4EE3\u7801\u68C0\u7D22\
|
|
2019
|
+
console.log(ansis.gray(` \u5982\u9700\u4F7F\u7528\u4EE3\u7801\u68C0\u7D22\u529F\u80FD\uFF0C\u53EF\u9009\u62E9\u4EE5\u4E0B MCP \u670D\u52A1\uFF1A`));
|
|
1817
2020
|
console.log();
|
|
1818
|
-
console.log(` ${ansis.green("1.")} ${ansis.cyan("ace-tool
|
|
1819
|
-
console.log(` ${ansis.gray("\
|
|
2021
|
+
console.log(` ${ansis.green("1.")} ${ansis.cyan("ace-tool / ace-tool-rs")}: ${ansis.underline("https://augmentcode.com/")}`);
|
|
2022
|
+
console.log(` ${ansis.gray("Augment \u5B98\u65B9\uFF0C\u542B Prompt \u589E\u5F3A + \u4EE3\u7801\u68C0\u7D22")}`);
|
|
1820
2023
|
console.log();
|
|
1821
2024
|
console.log(` ${ansis.green("2.")} ${ansis.cyan("ace-tool \u4E2D\u8F6C\u670D\u52A1")} ${ansis.yellow("(\u65E0\u9700\u6CE8\u518C)")}: ${ansis.underline("https://linux.do/t/topic/1291730")}`);
|
|
1822
2025
|
console.log(` ${ansis.gray("linux.do \u793E\u533A\u63D0\u4F9B\u7684\u514D\u8D39\u4E2D\u8F6C\u670D\u52A1")}`);
|
|
1823
2026
|
console.log();
|
|
2027
|
+
console.log(` ${ansis.green("3.")} ${ansis.cyan("ContextWeaver")} ${ansis.yellow("(\u672C\u5730)")}: ${ansis.underline("https://siliconflow.cn/")}`);
|
|
2028
|
+
console.log(` ${ansis.gray("\u672C\u5730\u5411\u91CF\u5E93\uFF0C\u9700\u8981\u7845\u57FA\u6D41\u52A8 API Key\uFF08\u6709\u514D\u8D39\u989D\u5EA6\uFF09")}`);
|
|
2029
|
+
console.log();
|
|
1824
2030
|
}
|
|
1825
2031
|
console.log();
|
|
1826
2032
|
} catch (error) {
|
|
@@ -1852,7 +2058,7 @@ async function getCurrentVersion() {
|
|
|
1852
2058
|
return "0.0.0";
|
|
1853
2059
|
}
|
|
1854
2060
|
}
|
|
1855
|
-
async function getLatestVersion(packageName = "ccg-workflow") {
|
|
2061
|
+
async function getLatestVersion(packageName = "ccg-ros2-workflow") {
|
|
1856
2062
|
try {
|
|
1857
2063
|
const { stdout } = await execAsync$2(`npm view ${packageName} version`);
|
|
1858
2064
|
return stdout.trim();
|
|
@@ -1945,8 +2151,8 @@ async function update() {
|
|
|
1945
2151
|
}
|
|
1946
2152
|
async function checkIfGlobalInstall$1() {
|
|
1947
2153
|
try {
|
|
1948
|
-
const { stdout } = await execAsync$1("npm list -g ccg-workflow --depth=0", { timeout: 5e3 });
|
|
1949
|
-
return stdout.includes("ccg-workflow@");
|
|
2154
|
+
const { stdout } = await execAsync$1("npm list -g ccg-ros2-workflow --depth=0", { timeout: 5e3 });
|
|
2155
|
+
return stdout.includes("ccg-ros2-workflow@");
|
|
1950
2156
|
} catch {
|
|
1951
2157
|
return false;
|
|
1952
2158
|
}
|
|
@@ -1967,7 +2173,7 @@ async function performUpdate(fromVersion, toVersion, isNewVersion) {
|
|
|
1967
2173
|
console.log();
|
|
1968
2174
|
console.log("\u63A8\u8350\u7684\u66F4\u65B0\u65B9\u5F0F\uFF1A");
|
|
1969
2175
|
console.log();
|
|
1970
|
-
console.log(ansis.cyan(" npm install -g ccg-workflow@latest"));
|
|
2176
|
+
console.log(ansis.cyan(" npm install -g ccg-ros2-workflow@latest"));
|
|
1971
2177
|
console.log();
|
|
1972
2178
|
console.log(ansis.gray("\u8FD9\u5C06\u540C\u65F6\u66F4\u65B0\u547D\u4EE4\u548C\u5DE5\u4F5C\u6D41\u6587\u4EF6"));
|
|
1973
2179
|
console.log();
|
|
@@ -1981,7 +2187,7 @@ async function performUpdate(fromVersion, toVersion, isNewVersion) {
|
|
|
1981
2187
|
console.log();
|
|
1982
2188
|
console.log(ansis.cyan("\u8BF7\u5728\u65B0\u7684\u7EC8\u7AEF\u7A97\u53E3\u4E2D\u8FD0\u884C\uFF1A"));
|
|
1983
2189
|
console.log();
|
|
1984
|
-
console.log(ansis.cyan.bold(" npm install -g ccg-workflow@latest"));
|
|
2190
|
+
console.log(ansis.cyan.bold(" npm install -g ccg-ros2-workflow@latest"));
|
|
1985
2191
|
console.log();
|
|
1986
2192
|
console.log(ansis.gray("(\u8FD0\u884C\u5B8C\u6210\u540E\uFF0C\u5F53\u524D\u7248\u672C\u5C06\u81EA\u52A8\u66F4\u65B0)"));
|
|
1987
2193
|
console.log();
|
|
@@ -2008,7 +2214,7 @@ async function performUpdate(fromVersion, toVersion, isNewVersion) {
|
|
|
2008
2214
|
}
|
|
2009
2215
|
}
|
|
2010
2216
|
spinner.text = "\u6B63\u5728\u4E0B\u8F7D\u6700\u65B0\u7248\u672C...";
|
|
2011
|
-
await execAsync$1(`npx --yes ccg-workflow@latest --version`, { timeout: 6e4 });
|
|
2217
|
+
await execAsync$1(`npx --yes ccg-ros2-workflow@latest --version`, { timeout: 6e4 });
|
|
2012
2218
|
spinner.succeed("\u6700\u65B0\u7248\u672C\u4E0B\u8F7D\u5B8C\u6210");
|
|
2013
2219
|
} catch (error) {
|
|
2014
2220
|
spinner.fail("\u4E0B\u8F7D\u6700\u65B0\u7248\u672C\u5931\u8D25");
|
|
@@ -2058,7 +2264,7 @@ async function performUpdate(fromVersion, toVersion, isNewVersion) {
|
|
|
2058
2264
|
}
|
|
2059
2265
|
spinner = ora("\u6B63\u5728\u5B89\u88C5\u65B0\u7248\u672C\u5DE5\u4F5C\u6D41\u548C\u4E8C\u8FDB\u5236...").start();
|
|
2060
2266
|
try {
|
|
2061
|
-
await execAsync$1(`npx --yes ccg-workflow@latest init --force --skip-mcp --skip-prompt`, {
|
|
2267
|
+
await execAsync$1(`npx --yes ccg-ros2-workflow@latest init --force --skip-mcp --skip-prompt`, {
|
|
2062
2268
|
timeout: 12e4,
|
|
2063
2269
|
env: {
|
|
2064
2270
|
...process.env,
|
|
@@ -2080,7 +2286,7 @@ async function performUpdate(fromVersion, toVersion, isNewVersion) {
|
|
|
2080
2286
|
console.log(ansis.red(`\u9519\u8BEF: ${error}`));
|
|
2081
2287
|
console.log();
|
|
2082
2288
|
console.log(ansis.yellow("\u8BF7\u5C1D\u8BD5\u624B\u52A8\u8FD0\u884C:"));
|
|
2083
|
-
console.log(ansis.cyan(" npx ccg-workflow@latest"));
|
|
2289
|
+
console.log(ansis.cyan(" npx ccg-ros2-workflow@latest"));
|
|
2084
2290
|
return;
|
|
2085
2291
|
}
|
|
2086
2292
|
console.log();
|
|
@@ -2181,8 +2387,8 @@ function showHelp() {
|
|
|
2181
2387
|
}
|
|
2182
2388
|
async function checkIfGlobalInstall() {
|
|
2183
2389
|
try {
|
|
2184
|
-
const { stdout } = await execAsync("npm list -g ccg-workflow --depth=0", { timeout: 5e3 });
|
|
2185
|
-
return stdout.includes("ccg-workflow@");
|
|
2390
|
+
const { stdout } = await execAsync("npm list -g ccg-ros2-workflow --depth=0", { timeout: 5e3 });
|
|
2391
|
+
return stdout.includes("ccg-ros2-workflow@");
|
|
2186
2392
|
} catch {
|
|
2187
2393
|
return false;
|
|
2188
2394
|
}
|
|
@@ -2250,7 +2456,7 @@ async function uninstall() {
|
|
|
2250
2456
|
console.log();
|
|
2251
2457
|
console.log("\u8BF7\u5728\u65B0\u7684\u7EC8\u7AEF\u7A97\u53E3\u4E2D\u8FD0\u884C\uFF1A");
|
|
2252
2458
|
console.log();
|
|
2253
|
-
console.log(ansis.cyan.bold(" npm uninstall -g ccg-workflow"));
|
|
2459
|
+
console.log(ansis.cyan.bold(" npm uninstall -g ccg-ros2-workflow"));
|
|
2254
2460
|
console.log();
|
|
2255
2461
|
console.log(ansis.gray("(\u5B8C\u6210\u540E ccg \u547D\u4EE4\u5C06\u5F7B\u5E95\u79FB\u9664)"));
|
|
2256
2462
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccg-ros2-workflow",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "ROS2 Multi-Model Collaborative Development Workflow - Codex (Low-level Control) + Gemini (Upper-layer Application) + Claude (Orchestration)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@10.17.1",
|