@claudeink/mcp-server 0.6.2 → 0.6.3
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 +31 -28
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -82,21 +82,12 @@ async function getCredentials() {
|
|
|
82
82
|
if (!await fileExists(paths.credentials)) return null;
|
|
83
83
|
return readJson(paths.credentials, null);
|
|
84
84
|
}
|
|
85
|
-
async function saveCredentials(creds) {
|
|
86
|
-
const paths = getPaths();
|
|
87
|
-
await writeJson(paths.credentials, creds, true);
|
|
88
|
-
}
|
|
89
85
|
async function getConfig() {
|
|
90
86
|
const paths = getPaths();
|
|
91
87
|
const config = await readJson(paths.config, DEFAULT_CONFIG);
|
|
92
88
|
config.workflowDir = getWorkDir();
|
|
93
89
|
return config;
|
|
94
90
|
}
|
|
95
|
-
async function saveConfig(config) {
|
|
96
|
-
const paths = getPaths();
|
|
97
|
-
const current = await readJson(paths.config, DEFAULT_CONFIG);
|
|
98
|
-
await writeJson(paths.config, { ...current, ...config });
|
|
99
|
-
}
|
|
100
91
|
async function getTagQueue() {
|
|
101
92
|
const paths = getPaths();
|
|
102
93
|
return readJson(paths.tagQueue, DEFAULT_TAG_QUEUE);
|
|
@@ -941,7 +932,7 @@ async function syncPull(input) {
|
|
|
941
932
|
|
|
942
933
|
// src/tools/workflow.ts
|
|
943
934
|
import { z as z6 } from "zod";
|
|
944
|
-
import { cp, mkdir as mkdir6, access as access2 } from "fs/promises";
|
|
935
|
+
import { cp, mkdir as mkdir6, access as access2, writeFile as writeFile7 } from "fs/promises";
|
|
945
936
|
import { join as join8, dirname } from "path";
|
|
946
937
|
import { fileURLToPath } from "url";
|
|
947
938
|
var DEFAULT_API_BASE_URL = "https://app.claudeink.com";
|
|
@@ -956,6 +947,7 @@ async function workflowInit(input) {
|
|
|
956
947
|
const cwd = input.workDir;
|
|
957
948
|
const results = [];
|
|
958
949
|
try {
|
|
950
|
+
setWorkDir(cwd);
|
|
959
951
|
const items = ["CLAUDE.md", "base-rules.md", "platforms", "accounts", "tools"];
|
|
960
952
|
for (const item of items) {
|
|
961
953
|
const src = join8(WORKFLOW_SRC, item);
|
|
@@ -968,25 +960,33 @@ async function workflowInit(input) {
|
|
|
968
960
|
results.push(`\u2705 ${item}`);
|
|
969
961
|
}
|
|
970
962
|
}
|
|
963
|
+
const claudeinkDir = join8(cwd, ".claudeink");
|
|
971
964
|
const dirs = [
|
|
972
965
|
"sources/articles",
|
|
973
966
|
"sources/video-transcripts",
|
|
974
967
|
"sources/notes",
|
|
975
968
|
"sources/data",
|
|
976
969
|
"sources/daily",
|
|
977
|
-
"templates"
|
|
978
|
-
".claudeink"
|
|
970
|
+
"templates"
|
|
979
971
|
];
|
|
980
972
|
for (const dir of dirs) {
|
|
981
973
|
await mkdir6(join8(cwd, dir), { recursive: true });
|
|
982
974
|
}
|
|
975
|
+
await mkdir6(claudeinkDir, { recursive: true });
|
|
983
976
|
results.push("\u2705 \u8FD0\u884C\u65F6\u76EE\u5F55\u5DF2\u521B\u5EFA");
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
977
|
+
const configPath = join8(claudeinkDir, "config.json");
|
|
978
|
+
const statePath = join8(claudeinkDir, "state.json");
|
|
979
|
+
await writeFile7(configPath, JSON.stringify({
|
|
980
|
+
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
981
|
+
syncIntervalMs: 3e5,
|
|
982
|
+
heartbeatIntervalMs: 3e5,
|
|
983
|
+
maxTagQueueBatch: 20,
|
|
984
|
+
workflowDir: cwd
|
|
985
|
+
}, null, 2), "utf-8");
|
|
986
|
+
results.push("\u2705 config.json");
|
|
987
987
|
try {
|
|
988
988
|
await access2(statePath);
|
|
989
|
-
results.push("\u23ED\uFE0F \
|
|
989
|
+
results.push("\u23ED\uFE0F state.json \u5DF2\u5B58\u5728\uFF0C\u8DF3\u8FC7");
|
|
990
990
|
} catch {
|
|
991
991
|
const emptyState = {
|
|
992
992
|
sources: {},
|
|
@@ -997,8 +997,8 @@ async function workflowInit(input) {
|
|
|
997
997
|
writingMasters: {},
|
|
998
998
|
lastSyncAt: ""
|
|
999
999
|
};
|
|
1000
|
-
await
|
|
1001
|
-
results.push("\u2705
|
|
1000
|
+
await writeFile7(statePath, JSON.stringify(emptyState, null, 2), "utf-8");
|
|
1001
|
+
results.push("\u2705 state.json");
|
|
1002
1002
|
}
|
|
1003
1003
|
let activated = false;
|
|
1004
1004
|
if (input.licenseKey) {
|
|
@@ -1011,13 +1011,17 @@ async function workflowInit(input) {
|
|
|
1011
1011
|
});
|
|
1012
1012
|
const data = await res.json();
|
|
1013
1013
|
if (data.userId) {
|
|
1014
|
-
await
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1014
|
+
await writeFile7(
|
|
1015
|
+
join8(claudeinkDir, "credentials.json"),
|
|
1016
|
+
JSON.stringify({
|
|
1017
|
+
licenseKey: input.licenseKey,
|
|
1018
|
+
token: data.token,
|
|
1019
|
+
userId: data.userId,
|
|
1020
|
+
plan: data.plan,
|
|
1021
|
+
expiresAt: data.expiresAt
|
|
1022
|
+
}, null, 2),
|
|
1023
|
+
{ mode: 384 }
|
|
1024
|
+
);
|
|
1021
1025
|
results.push(`\u2705 License \u6FC0\u6D3B\u6210\u529F\uFF08\u5957\u9910: ${data.plan}\uFF09`);
|
|
1022
1026
|
activated = true;
|
|
1023
1027
|
} else {
|
|
@@ -1058,8 +1062,7 @@ async function workflowInit(input) {
|
|
|
1058
1062
|
"",
|
|
1059
1063
|
"\u{1F3AF} \u4E0B\u4E00\u6B65\uFF1A",
|
|
1060
1064
|
"1. \u8BFB\u53D6 CLAUDE.md \u4E86\u89E3\u4E09\u5C42\u914D\u7F6E\u67B6\u6784",
|
|
1061
|
-
"2. \
|
|
1062
|
-
"3. \u4F7F\u7528 /\u7F16\u5199 \u5F00\u59CB\u5185\u5BB9\u521B\u4F5C"
|
|
1065
|
+
"2. \u5F00\u59CB\u5185\u5BB9\u521B\u4F5C"
|
|
1063
1066
|
].join("\n")
|
|
1064
1067
|
};
|
|
1065
1068
|
} catch (err) {
|
|
@@ -1073,7 +1076,7 @@ async function workflowInit(input) {
|
|
|
1073
1076
|
// src/index.ts
|
|
1074
1077
|
var server = new McpServer({
|
|
1075
1078
|
name: "ClaudeInk",
|
|
1076
|
-
version: "0.6.
|
|
1079
|
+
version: "0.6.3"
|
|
1077
1080
|
});
|
|
1078
1081
|
server.tool("workflow.init", "\u521D\u59CB\u5316\u5199\u4F5C\u5DE5\u4F5C\u6D41\uFF08\u91CA\u653E\u4E09\u5C42\u914D\u7F6E + \u6FC0\u6D3B License + \u81EA\u52A8\u540C\u6B65\u4E91\u7AEF\u914D\u7F6E\uFF09", workflowInitSchema.shape, async (input) => {
|
|
1079
1082
|
const result = await workflowInit(input);
|