@zeliper/zscode-mcp-server 1.0.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/errors/index.d.ts +112 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +231 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -0
- package/dist/state/manager.d.ts +54 -0
- package/dist/state/manager.d.ts.map +1 -0
- package/dist/state/manager.js +500 -0
- package/dist/state/manager.js.map +1 -0
- package/dist/state/schema.d.ts +942 -0
- package/dist/state/schema.d.ts.map +1 -0
- package/dist/state/schema.js +179 -0
- package/dist/state/schema.js.map +1 -0
- package/dist/state/types.d.ts +117 -0
- package/dist/state/types.d.ts.map +1 -0
- package/dist/state/types.js +2 -0
- package/dist/state/types.js.map +1 -0
- package/dist/tools/archive.d.ts +6 -0
- package/dist/tools/archive.d.ts.map +1 -0
- package/dist/tools/archive.js +67 -0
- package/dist/tools/archive.js.map +1 -0
- package/dist/tools/cancel.d.ts +6 -0
- package/dist/tools/cancel.d.ts.map +1 -0
- package/dist/tools/cancel.js +65 -0
- package/dist/tools/cancel.js.map +1 -0
- package/dist/tools/context.d.ts +6 -0
- package/dist/tools/context.d.ts.map +1 -0
- package/dist/tools/context.js +124 -0
- package/dist/tools/context.js.map +1 -0
- package/dist/tools/index.d.ts +6 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +24 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/plan.d.ts +6 -0
- package/dist/tools/plan.d.ts.map +1 -0
- package/dist/tools/plan.js +186 -0
- package/dist/tools/plan.js.map +1 -0
- package/dist/tools/staging.d.ts +6 -0
- package/dist/tools/staging.d.ts.map +1 -0
- package/dist/tools/staging.js +224 -0
- package/dist/tools/staging.js.map +1 -0
- package/dist/tools/status.d.ts +6 -0
- package/dist/tools/status.d.ts.map +1 -0
- package/dist/tools/status.js +144 -0
- package/dist/tools/status.js.map +1 -0
- package/dist/utils/artifacts.d.ts +57 -0
- package/dist/utils/artifacts.d.ts.map +1 -0
- package/dist/utils/artifacts.js +180 -0
- package/dist/utils/artifacts.js.map +1 -0
- package/dist/utils/paths.d.ts +68 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +122 -0
- package/dist/utils/paths.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/tools/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACL,iBAAiB,EACjB,0BAA0B,EAC1B,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAG5B;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,0CAA0C;IAC1C,MAAM,CAAC,IAAI,CACT,eAAe,EACf,uKAAuK,EACvK;QACE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,8DAA8D,CAAC;KACvG,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,KAAK,IAAI,EAAE;YAChD,MAAM,OAAO,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC;YAE3C,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC;gBAC7B,MAAM,IAAI,0BAA0B,EAAE,CAAC;YACzC,CAAC;YAED,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAChB,oCAAoC;gBACpC,OAAO,qBAAqB,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACrD,CAAC;iBAAM,CAAC;gBACN,wBAAwB;gBACxB,OAAO,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AE,EAAE,OAAO,CAAC,EAAE;YACd,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,cAAc,EAAE,OAAO,CAAC,cAAc;YACtC,SAAS,EAAE,KAAK,CAAC,MAAM;YACvB,kBAAkB,EAAE,cAAc;YAClC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACxB,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM;aACzB,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,UAAU,GAAe;QAC7B,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,QAAQ,EAAE,cAAc;QACxB,SAAS;QACT,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC;IAEF,OAAO;QACL,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,UAAU;KACjB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { TaskOutput } from "../state/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Artifacts manager for handling staging outputs
|
|
4
|
+
*/
|
|
5
|
+
export declare class ArtifactsManager {
|
|
6
|
+
private projectRoot;
|
|
7
|
+
constructor(projectRoot: string);
|
|
8
|
+
/**
|
|
9
|
+
* Create artifacts directory for a staging
|
|
10
|
+
*/
|
|
11
|
+
createStagingArtifactsDir(planId: string, stagingId: string): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Save task output to artifacts directory
|
|
14
|
+
*/
|
|
15
|
+
saveTaskOutput(planId: string, stagingId: string, taskId: string, output: TaskOutput): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Get task output from artifacts directory
|
|
18
|
+
*/
|
|
19
|
+
getTaskOutput(planId: string, stagingId: string, taskId: string): Promise<TaskOutput | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Get all task outputs for a staging
|
|
22
|
+
*/
|
|
23
|
+
getStagingOutputs(planId: string, stagingId: string): Promise<Record<string, TaskOutput>>;
|
|
24
|
+
/**
|
|
25
|
+
* List all files in staging artifacts directory
|
|
26
|
+
*/
|
|
27
|
+
listStagingArtifacts(planId: string, stagingId: string): Promise<string[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Save arbitrary file to staging artifacts
|
|
30
|
+
*/
|
|
31
|
+
saveArtifactFile(planId: string, stagingId: string, filename: string, content: string | Buffer): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Read arbitrary file from staging artifacts
|
|
34
|
+
*/
|
|
35
|
+
readArtifactFile(planId: string, stagingId: string, filename: string): Promise<string | null>;
|
|
36
|
+
/**
|
|
37
|
+
* Archive plan artifacts
|
|
38
|
+
*/
|
|
39
|
+
archivePlanArtifacts(planId: string): Promise<string>;
|
|
40
|
+
/**
|
|
41
|
+
* Delete plan artifacts (use with caution)
|
|
42
|
+
*/
|
|
43
|
+
deletePlanArtifacts(planId: string): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Get total size of staging artifacts
|
|
46
|
+
*/
|
|
47
|
+
getStagingArtifactsSize(planId: string, stagingId: string): Promise<number>;
|
|
48
|
+
/**
|
|
49
|
+
* Check if staging has artifacts
|
|
50
|
+
*/
|
|
51
|
+
hasStagingArtifacts(planId: string, stagingId: string): Promise<boolean>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create artifacts manager instance
|
|
55
|
+
*/
|
|
56
|
+
export declare function createArtifactsManager(projectRoot: string): ArtifactsManager;
|
|
57
|
+
//# sourceMappingURL=artifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/utils/artifacts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,WAAW,CAAS;gBAEhB,WAAW,EAAE,MAAM;IAI/B;;OAEG;IACG,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAMnF;;OAEG;IACG,cAAc,CAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,MAAM,CAAC;IAUlB;;OAEG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAalG;;OAEG;IACG,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAsB/F;;OAEG;IACG,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAYhF;;OAEG;IACG,gBAAgB,CACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GAAG,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC;IAUlB;;OAEG;IACG,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAYnG;;OAEG;IACG,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAiB3D;;OAEG;IACG,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWxD;;OAEG;IACG,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAsBjF;;OAEG;IACG,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAW/E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB,CAE5E"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { readFile, writeFile, readdir, access, rm, cp, stat } from "fs/promises";
|
|
2
|
+
import { constants } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { ensureDir, normalizePath, toPosixPath, getArtifactsPath, getArchivePath } from "./paths.js";
|
|
5
|
+
/**
|
|
6
|
+
* Artifacts manager for handling staging outputs
|
|
7
|
+
*/
|
|
8
|
+
export class ArtifactsManager {
|
|
9
|
+
projectRoot;
|
|
10
|
+
constructor(projectRoot) {
|
|
11
|
+
this.projectRoot = normalizePath(projectRoot);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create artifacts directory for a staging
|
|
15
|
+
*/
|
|
16
|
+
async createStagingArtifactsDir(planId, stagingId) {
|
|
17
|
+
const artifactsPath = getArtifactsPath(this.projectRoot, planId, stagingId);
|
|
18
|
+
await ensureDir(artifactsPath);
|
|
19
|
+
return artifactsPath;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Save task output to artifacts directory
|
|
23
|
+
*/
|
|
24
|
+
async saveTaskOutput(planId, stagingId, taskId, output) {
|
|
25
|
+
const artifactsPath = getArtifactsPath(this.projectRoot, planId, stagingId);
|
|
26
|
+
await ensureDir(artifactsPath);
|
|
27
|
+
const outputPath = normalizePath(join(artifactsPath, `${taskId}-output.json`));
|
|
28
|
+
await writeFile(outputPath, JSON.stringify(output, null, 2), "utf-8");
|
|
29
|
+
return toPosixPath(outputPath);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get task output from artifacts directory
|
|
33
|
+
*/
|
|
34
|
+
async getTaskOutput(planId, stagingId, taskId) {
|
|
35
|
+
const artifactsPath = getArtifactsPath(this.projectRoot, planId, stagingId);
|
|
36
|
+
const outputPath = normalizePath(join(artifactsPath, `${taskId}-output.json`));
|
|
37
|
+
try {
|
|
38
|
+
await access(outputPath, constants.R_OK);
|
|
39
|
+
const content = await readFile(outputPath, "utf-8");
|
|
40
|
+
return JSON.parse(content);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get all task outputs for a staging
|
|
48
|
+
*/
|
|
49
|
+
async getStagingOutputs(planId, stagingId) {
|
|
50
|
+
const artifactsPath = getArtifactsPath(this.projectRoot, planId, stagingId);
|
|
51
|
+
const outputs = {};
|
|
52
|
+
try {
|
|
53
|
+
await access(artifactsPath, constants.R_OK);
|
|
54
|
+
const files = await readdir(artifactsPath);
|
|
55
|
+
for (const file of files) {
|
|
56
|
+
if (file.endsWith("-output.json")) {
|
|
57
|
+
const taskId = file.replace("-output.json", "");
|
|
58
|
+
const content = await readFile(normalizePath(join(artifactsPath, file)), "utf-8");
|
|
59
|
+
outputs[taskId] = JSON.parse(content);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// Directory doesn't exist or is empty
|
|
65
|
+
}
|
|
66
|
+
return outputs;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* List all files in staging artifacts directory
|
|
70
|
+
*/
|
|
71
|
+
async listStagingArtifacts(planId, stagingId) {
|
|
72
|
+
const artifactsPath = getArtifactsPath(this.projectRoot, planId, stagingId);
|
|
73
|
+
try {
|
|
74
|
+
await access(artifactsPath, constants.R_OK);
|
|
75
|
+
const files = await readdir(artifactsPath, { recursive: true });
|
|
76
|
+
return files.map(f => toPosixPath(String(f)));
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Save arbitrary file to staging artifacts
|
|
84
|
+
*/
|
|
85
|
+
async saveArtifactFile(planId, stagingId, filename, content) {
|
|
86
|
+
const artifactsPath = getArtifactsPath(this.projectRoot, planId, stagingId);
|
|
87
|
+
await ensureDir(artifactsPath);
|
|
88
|
+
const filePath = normalizePath(join(artifactsPath, filename));
|
|
89
|
+
await writeFile(filePath, content, typeof content === "string" ? "utf-8" : undefined);
|
|
90
|
+
return toPosixPath(filePath);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Read arbitrary file from staging artifacts
|
|
94
|
+
*/
|
|
95
|
+
async readArtifactFile(planId, stagingId, filename) {
|
|
96
|
+
const artifactsPath = getArtifactsPath(this.projectRoot, planId, stagingId);
|
|
97
|
+
const filePath = normalizePath(join(artifactsPath, filename));
|
|
98
|
+
try {
|
|
99
|
+
await access(filePath, constants.R_OK);
|
|
100
|
+
return await readFile(filePath, "utf-8");
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Archive plan artifacts
|
|
108
|
+
*/
|
|
109
|
+
async archivePlanArtifacts(planId) {
|
|
110
|
+
const sourcePath = normalizePath(join(this.projectRoot, ".claude", "plans", planId));
|
|
111
|
+
const archivePath = getArchivePath(this.projectRoot, planId);
|
|
112
|
+
try {
|
|
113
|
+
await access(sourcePath, constants.R_OK);
|
|
114
|
+
await ensureDir(normalizePath(join(this.projectRoot, ".claude", "archive")));
|
|
115
|
+
await cp(sourcePath, archivePath, { recursive: true });
|
|
116
|
+
await rm(sourcePath, { recursive: true, force: true });
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
// Source might not exist if no artifacts were created
|
|
120
|
+
console.error(`Failed to archive artifacts: ${error}`);
|
|
121
|
+
}
|
|
122
|
+
return toPosixPath(archivePath);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Delete plan artifacts (use with caution)
|
|
126
|
+
*/
|
|
127
|
+
async deletePlanArtifacts(planId) {
|
|
128
|
+
const planPath = normalizePath(join(this.projectRoot, ".claude", "plans", planId));
|
|
129
|
+
try {
|
|
130
|
+
await access(planPath, constants.R_OK);
|
|
131
|
+
await rm(planPath, { recursive: true, force: true });
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// Already deleted or never existed
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get total size of staging artifacts
|
|
139
|
+
*/
|
|
140
|
+
async getStagingArtifactsSize(planId, stagingId) {
|
|
141
|
+
const artifactsPath = getArtifactsPath(this.projectRoot, planId, stagingId);
|
|
142
|
+
let totalSize = 0;
|
|
143
|
+
try {
|
|
144
|
+
await access(artifactsPath, constants.R_OK);
|
|
145
|
+
const files = await readdir(artifactsPath, { recursive: true, withFileTypes: true });
|
|
146
|
+
for (const file of files) {
|
|
147
|
+
if (file.isFile()) {
|
|
148
|
+
const filePath = normalizePath(join(String(file.parentPath || file.path), file.name));
|
|
149
|
+
const stats = await stat(filePath);
|
|
150
|
+
totalSize += stats.size;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
// Directory doesn't exist
|
|
156
|
+
}
|
|
157
|
+
return totalSize;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Check if staging has artifacts
|
|
161
|
+
*/
|
|
162
|
+
async hasStagingArtifacts(planId, stagingId) {
|
|
163
|
+
const artifactsPath = getArtifactsPath(this.projectRoot, planId, stagingId);
|
|
164
|
+
try {
|
|
165
|
+
await access(artifactsPath, constants.R_OK);
|
|
166
|
+
const files = await readdir(artifactsPath);
|
|
167
|
+
return files.length > 0;
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Create artifacts manager instance
|
|
176
|
+
*/
|
|
177
|
+
export function createArtifactsManager(projectRoot) {
|
|
178
|
+
return new ArtifactsManager(projectRoot);
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=artifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/utils/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGrG;;GAEG;AACH,MAAM,OAAO,gBAAgB;IACnB,WAAW,CAAS;IAE5B,YAAY,WAAmB;QAC7B,IAAI,CAAC,WAAW,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,yBAAyB,CAAC,MAAc,EAAE,SAAiB;QAC/D,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,WAAW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AAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize path for current OS
|
|
3
|
+
* Windows: uses backslashes
|
|
4
|
+
* Unix: uses forward slashes
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizePath(filePath: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Convert path to POSIX style (forward slashes)
|
|
9
|
+
* Used for JSON storage and config files for cross-platform compatibility
|
|
10
|
+
*/
|
|
11
|
+
export declare function toPosixPath(filePath: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Convert POSIX path to OS-specific path
|
|
14
|
+
*/
|
|
15
|
+
export declare function fromPosixPath(posixPath: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Create directory recursively
|
|
18
|
+
*/
|
|
19
|
+
export declare function ensureDir(dirPath: string): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Join paths and normalize for current OS
|
|
22
|
+
*/
|
|
23
|
+
export declare function joinPath(...paths: string[]): string;
|
|
24
|
+
/**
|
|
25
|
+
* Get directory name from path
|
|
26
|
+
*/
|
|
27
|
+
export declare function getDirname(filePath: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Check if path is absolute
|
|
30
|
+
*/
|
|
31
|
+
export declare function isAbsolutePath(filePath: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Calculate relative path from base to target
|
|
34
|
+
*/
|
|
35
|
+
export declare function relativePath(from: string, to: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Get artifacts path for a staging
|
|
38
|
+
*/
|
|
39
|
+
export declare function getArtifactsPath(projectRoot: string, planId: string, stagingId: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Get archive path for a plan
|
|
42
|
+
*/
|
|
43
|
+
export declare function getArchivePath(projectRoot: string, planId: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Get state file path
|
|
46
|
+
*/
|
|
47
|
+
export declare function getStateFilePath(projectRoot: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Get plans directory path
|
|
50
|
+
*/
|
|
51
|
+
export declare function getPlansDir(projectRoot: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Sanitize path component (remove invalid characters)
|
|
54
|
+
*/
|
|
55
|
+
export declare function sanitizePathComponent(component: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Check if running on Windows
|
|
58
|
+
*/
|
|
59
|
+
export declare function isWindows(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Get path separator for current OS
|
|
62
|
+
*/
|
|
63
|
+
export declare function getPathSeparator(): string;
|
|
64
|
+
/**
|
|
65
|
+
* Escape path for use in shell commands (Windows compatible)
|
|
66
|
+
*/
|
|
67
|
+
export declare function escapeForShell(filePath: string): string;
|
|
68
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAU7D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE/F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE1E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAM/D;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAWvD"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { mkdir } from "fs/promises";
|
|
2
|
+
import { sep, normalize, join, dirname, isAbsolute } from "path";
|
|
3
|
+
/**
|
|
4
|
+
* Normalize path for current OS
|
|
5
|
+
* Windows: uses backslashes
|
|
6
|
+
* Unix: uses forward slashes
|
|
7
|
+
*/
|
|
8
|
+
export function normalizePath(filePath) {
|
|
9
|
+
return normalize(filePath);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Convert path to POSIX style (forward slashes)
|
|
13
|
+
* Used for JSON storage and config files for cross-platform compatibility
|
|
14
|
+
*/
|
|
15
|
+
export function toPosixPath(filePath) {
|
|
16
|
+
return filePath.split(sep).join("/");
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Convert POSIX path to OS-specific path
|
|
20
|
+
*/
|
|
21
|
+
export function fromPosixPath(posixPath) {
|
|
22
|
+
return posixPath.split("/").join(sep);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create directory recursively
|
|
26
|
+
*/
|
|
27
|
+
export async function ensureDir(dirPath) {
|
|
28
|
+
await mkdir(dirPath, { recursive: true });
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Join paths and normalize for current OS
|
|
32
|
+
*/
|
|
33
|
+
export function joinPath(...paths) {
|
|
34
|
+
return normalizePath(join(...paths));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get directory name from path
|
|
38
|
+
*/
|
|
39
|
+
export function getDirname(filePath) {
|
|
40
|
+
return dirname(filePath);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Check if path is absolute
|
|
44
|
+
*/
|
|
45
|
+
export function isAbsolutePath(filePath) {
|
|
46
|
+
return isAbsolute(filePath);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Calculate relative path from base to target
|
|
50
|
+
*/
|
|
51
|
+
export function relativePath(from, to) {
|
|
52
|
+
const normalizedFrom = normalizePath(from);
|
|
53
|
+
const normalizedTo = normalizePath(to);
|
|
54
|
+
if (normalizedTo.startsWith(normalizedFrom)) {
|
|
55
|
+
const relative = normalizedTo.slice(normalizedFrom.length);
|
|
56
|
+
return relative.startsWith(sep) ? relative.slice(1) : relative;
|
|
57
|
+
}
|
|
58
|
+
return normalizedTo;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get artifacts path for a staging
|
|
62
|
+
*/
|
|
63
|
+
export function getArtifactsPath(projectRoot, planId, stagingId) {
|
|
64
|
+
return normalizePath(join(projectRoot, ".claude", "plans", planId, "artifacts", stagingId));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get archive path for a plan
|
|
68
|
+
*/
|
|
69
|
+
export function getArchivePath(projectRoot, planId) {
|
|
70
|
+
return normalizePath(join(projectRoot, ".claude", "archive", planId));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get state file path
|
|
74
|
+
*/
|
|
75
|
+
export function getStateFilePath(projectRoot) {
|
|
76
|
+
return normalizePath(join(projectRoot, ".claude", "state.json"));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get plans directory path
|
|
80
|
+
*/
|
|
81
|
+
export function getPlansDir(projectRoot) {
|
|
82
|
+
return normalizePath(join(projectRoot, ".claude", "plans"));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Sanitize path component (remove invalid characters)
|
|
86
|
+
*/
|
|
87
|
+
export function sanitizePathComponent(component) {
|
|
88
|
+
// Remove or replace invalid characters for both Windows and Unix
|
|
89
|
+
return component
|
|
90
|
+
.replace(/[<>:"/\\|?*]/g, "_")
|
|
91
|
+
.replace(/\s+/g, "_")
|
|
92
|
+
.slice(0, 255); // Max filename length
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Check if running on Windows
|
|
96
|
+
*/
|
|
97
|
+
export function isWindows() {
|
|
98
|
+
return process.platform === "win32";
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get path separator for current OS
|
|
102
|
+
*/
|
|
103
|
+
export function getPathSeparator() {
|
|
104
|
+
return sep;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Escape path for use in shell commands (Windows compatible)
|
|
108
|
+
*/
|
|
109
|
+
export function escapeForShell(filePath) {
|
|
110
|
+
if (isWindows()) {
|
|
111
|
+
// Windows: wrap in double quotes if contains spaces
|
|
112
|
+
if (filePath.includes(" ")) {
|
|
113
|
+
return `"${filePath}"`;
|
|
114
|
+
}
|
|
115
|
+
return filePath;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
// Unix: escape spaces and special characters
|
|
119
|
+
return filePath.replace(/(["\s'$`\\])/g, "\\$1");
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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,GAAG,CAAC,CAAC,CAAC,sBAAsB;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,IAAI,SAAS,EAAE,EAAE,CAAC;QAChB,oDAAoD;QACpD,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,IAAI,QAAQ,GAAG,CAAC;QACzB,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;SAAM,CAAC;QACN,6CAA6C;QAC7C,OAAO,QAAQ,CAAC,OAAO,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zeliper/zscode-mcp-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "ZSCode MCP Server for Claude Code - Project planning and task management",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"bin": {
|
|
12
|
+
"zscode-mcp-server": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
17
|
+
"dev": "tsc --watch",
|
|
18
|
+
"start": "node dist/index.js",
|
|
19
|
+
"test": "echo \"No tests yet\" && exit 0"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
23
|
+
"zod": "^3.22.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^20.10.0",
|
|
27
|
+
"typescript": "^5.3.0"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"zod": "^3.22.0"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18.0.0"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"README.md"
|
|
38
|
+
],
|
|
39
|
+
"keywords": [
|
|
40
|
+
"claude-code",
|
|
41
|
+
"mcp",
|
|
42
|
+
"model-context-protocol",
|
|
43
|
+
"planning",
|
|
44
|
+
"project-management"
|
|
45
|
+
],
|
|
46
|
+
"author": "Zeliper",
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "https://github.com/Zeliper/zscode.git",
|
|
51
|
+
"directory": "packages/mcp-server"
|
|
52
|
+
}
|
|
53
|
+
}
|