@zeliper/zscode 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.
@@ -0,0 +1,10 @@
1
+ export interface InitOptions {
2
+ force?: boolean;
3
+ claudeMd?: boolean;
4
+ projectName?: string;
5
+ }
6
+ /**
7
+ * Init command handler
8
+ */
9
+ export declare function initCommand(options: InitOptions): Promise<void>;
10
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAoLD;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA4HrE"}
@@ -0,0 +1,282 @@
1
+ import { writeFile } from "fs/promises";
2
+ import chalk from "chalk";
3
+ import ora from "ora";
4
+ import inquirer from "inquirer";
5
+ import { joinPath, ensureDir, fileExists, getClaudeDir, getStateFilePath, getPlansDir, getArchiveDir, getCommandsDir, toPosixPath, } from "../utils/paths.js";
6
+ /**
7
+ * Prompt for project name
8
+ */
9
+ async function promptProjectInfo(cwd) {
10
+ const defaultName = cwd.split(/[/\\]/).pop() || "my-project";
11
+ const answers = await inquirer.prompt([
12
+ {
13
+ type: "input",
14
+ name: "name",
15
+ message: "Project name:",
16
+ default: defaultName,
17
+ },
18
+ {
19
+ type: "input",
20
+ name: "description",
21
+ message: "Project description (optional):",
22
+ default: "",
23
+ },
24
+ ]);
25
+ return {
26
+ name: answers.name,
27
+ description: answers.description,
28
+ };
29
+ }
30
+ /**
31
+ * Create initial state.json content
32
+ */
33
+ function createInitialState(name, description) {
34
+ const now = new Date().toISOString();
35
+ return {
36
+ version: "2.0.0",
37
+ project: {
38
+ name,
39
+ description: description || undefined,
40
+ goals: [],
41
+ constraints: [],
42
+ createdAt: now,
43
+ updatedAt: now,
44
+ },
45
+ plans: {},
46
+ stagings: {},
47
+ tasks: {},
48
+ history: [
49
+ {
50
+ id: `hist-${Date.now()}-init`,
51
+ timestamp: now,
52
+ type: "project_initialized",
53
+ details: { projectName: name },
54
+ },
55
+ ],
56
+ context: {
57
+ lastUpdated: now,
58
+ activeFiles: [],
59
+ decisions: [],
60
+ },
61
+ };
62
+ }
63
+ /**
64
+ * Create mcp.json content
65
+ */
66
+ function createMcpConfig() {
67
+ return {
68
+ mcpServers: {
69
+ zscode: {
70
+ command: "npx",
71
+ args: ["-y", "@zeliper/zscode-mcp-server"],
72
+ env: {
73
+ ZSCODE_PROJECT_ROOT: "${workspaceFolder}",
74
+ },
75
+ },
76
+ },
77
+ };
78
+ }
79
+ /**
80
+ * Create zscode-planning.md slash command
81
+ */
82
+ function createPlanningCommand() {
83
+ return `# ZSCode Planning
84
+
85
+ This command enters planning mode for the current project.
86
+
87
+ ## Usage
88
+
89
+ \`\`\`
90
+ /zscode:planning [task description]
91
+ \`\`\`
92
+
93
+ ## Behavior
94
+
95
+ 1. If a task description is provided:
96
+ - Analyze the task
97
+ - Create a new Plan with appropriate Stagings and Tasks
98
+ - Present the plan for review
99
+
100
+ 2. If no task description:
101
+ - Show current project status using \`zscode:status\`
102
+ - List active and pending plans
103
+
104
+ ## Available MCP Tools
105
+
106
+ - \`get_full_context\` - Get complete project state
107
+ - \`create_plan\` - Create a new plan with stagings and tasks
108
+ - \`zscode:start planId stagingId\` - Start a specific staging
109
+ - \`zscode:status [planId]\` - Get status of all plans or specific plan
110
+ - \`zscode:archive planId\` - Archive a completed/cancelled plan
111
+ - \`zscode:cancel planId\` - Cancel an active plan
112
+ - \`update_task\` - Update task status
113
+ - \`save_task_output\` - Save task output/artifacts
114
+ - \`get_staging_artifacts\` - Get previous staging outputs
115
+
116
+ ## Workflow
117
+
118
+ 1. Create a plan: Define stagings (phases) with tasks
119
+ 2. Start staging: \`zscode:start plan-xxx staging-0001\`
120
+ 3. Work on tasks: Update status as you complete them
121
+ 4. Save outputs: Store results for next staging to use
122
+ 5. Complete: Archive when done
123
+ `;
124
+ }
125
+ /**
126
+ * Create CLAUDE.md content
127
+ */
128
+ function createClaudeMd(projectName, description) {
129
+ return `# ${projectName}
130
+
131
+ ${description || "Project managed with ZSCode Planning System."}
132
+
133
+ ## ZSCode Commands
134
+
135
+ This project uses ZSCode Planning System for task management.
136
+
137
+ ### Quick Start
138
+
139
+ - \`/zscode:planning\` - Enter planning mode
140
+ - \`/zscode:planning <task>\` - Create a new plan for the task
141
+
142
+ ### MCP Tools
143
+
144
+ All commands are available as MCP tools:
145
+
146
+ | Tool | Description |
147
+ |------|-------------|
148
+ | \`zscode:start\` | Start a staging phase |
149
+ | \`zscode:status\` | Check plan status |
150
+ | \`zscode:archive\` | Archive completed plan |
151
+ | \`zscode:cancel\` | Cancel active plan |
152
+
153
+ ### Workflow
154
+
155
+ 1. **Plan**: Use \`/zscode:planning\` to create a structured plan
156
+ 2. **Start**: Begin work with \`zscode:start planId stagingId\`
157
+ 3. **Execute**: Complete tasks, save outputs for next staging
158
+ 4. **Review**: Check progress with \`zscode:status\`
159
+ 5. **Archive**: Clean up with \`zscode:archive\` when done
160
+
161
+ ## Project Structure
162
+
163
+ \`\`\`
164
+ .claude/
165
+ ├── state.json # Project state
166
+ ├── plans/ # Plan artifacts
167
+ ├── archive/ # Archived plans
168
+ └── commands/ # Slash commands
169
+ \`\`\`
170
+ `;
171
+ }
172
+ /**
173
+ * Init command handler
174
+ */
175
+ export async function initCommand(options) {
176
+ const cwd = process.cwd();
177
+ const claudeDir = getClaudeDir(cwd);
178
+ console.log(chalk.blue.bold("\n ZSCode Planning System\n"));
179
+ // Check existing configuration
180
+ const spinner = ora("Checking existing configuration...").start();
181
+ const stateExists = await fileExists(getStateFilePath(cwd));
182
+ if (stateExists && !options.force) {
183
+ spinner.fail("ZSCode is already initialized in this project");
184
+ console.log(chalk.yellow("\n Use --force to overwrite existing configuration\n"));
185
+ return;
186
+ }
187
+ if (stateExists && options.force) {
188
+ spinner.warn("Overwriting existing configuration");
189
+ }
190
+ else {
191
+ spinner.succeed("Ready to initialize");
192
+ }
193
+ // Get project info
194
+ let projectInfo;
195
+ if (options.projectName) {
196
+ projectInfo = { name: options.projectName, description: "" };
197
+ }
198
+ else {
199
+ projectInfo = await promptProjectInfo(cwd);
200
+ }
201
+ // Create directory structure
202
+ spinner.start("Creating directory structure...");
203
+ try {
204
+ await ensureDir(claudeDir);
205
+ await ensureDir(getPlansDir(cwd));
206
+ await ensureDir(getArchiveDir(cwd));
207
+ await ensureDir(getCommandsDir(cwd));
208
+ spinner.succeed("Directory structure created");
209
+ }
210
+ catch (error) {
211
+ spinner.fail("Failed to create directory structure");
212
+ console.error(chalk.red(` Error: ${error}`));
213
+ return;
214
+ }
215
+ // Create state.json
216
+ spinner.start("Creating state.json...");
217
+ try {
218
+ const initialState = createInitialState(projectInfo.name, projectInfo.description);
219
+ await writeFile(getStateFilePath(cwd), JSON.stringify(initialState, null, 2), "utf-8");
220
+ spinner.succeed("state.json created");
221
+ }
222
+ catch (error) {
223
+ spinner.fail("Failed to create state.json");
224
+ console.error(chalk.red(` Error: ${error}`));
225
+ return;
226
+ }
227
+ // Create mcp.json
228
+ spinner.start("Creating mcp.json...");
229
+ try {
230
+ const mcpConfig = createMcpConfig();
231
+ await writeFile(joinPath(claudeDir, "mcp.json"), JSON.stringify(mcpConfig, null, 2), "utf-8");
232
+ spinner.succeed("mcp.json created");
233
+ }
234
+ catch (error) {
235
+ spinner.fail("Failed to create mcp.json");
236
+ console.error(chalk.red(` Error: ${error}`));
237
+ return;
238
+ }
239
+ // Create slash command
240
+ spinner.start("Creating slash commands...");
241
+ try {
242
+ const planningCommand = createPlanningCommand();
243
+ await writeFile(joinPath(getCommandsDir(cwd), "zscode-planning.md"), planningCommand, "utf-8");
244
+ spinner.succeed("Slash commands created");
245
+ }
246
+ catch (error) {
247
+ spinner.fail("Failed to create slash commands");
248
+ console.error(chalk.red(` Error: ${error}`));
249
+ return;
250
+ }
251
+ // Create CLAUDE.md (optional)
252
+ if (options.claudeMd !== false) {
253
+ const claudeMdPath = joinPath(cwd, "CLAUDE.md");
254
+ const claudeMdExists = await fileExists(claudeMdPath);
255
+ if (!claudeMdExists || options.force) {
256
+ spinner.start("Creating CLAUDE.md...");
257
+ try {
258
+ const claudeMdContent = createClaudeMd(projectInfo.name, projectInfo.description);
259
+ await writeFile(claudeMdPath, claudeMdContent, "utf-8");
260
+ spinner.succeed("CLAUDE.md created");
261
+ }
262
+ catch (error) {
263
+ spinner.fail("Failed to create CLAUDE.md");
264
+ console.error(chalk.red(` Error: ${error}`));
265
+ }
266
+ }
267
+ else {
268
+ console.log(chalk.gray(" CLAUDE.md already exists, skipping"));
269
+ }
270
+ }
271
+ // Success message
272
+ console.log(chalk.green.bold("\n ZSCode initialized successfully!\n"));
273
+ console.log(chalk.white(" Next steps:\n"));
274
+ console.log(chalk.gray(" 1. Configure MCP server in Claude Code settings:"));
275
+ console.log(chalk.cyan(` claude mcp add zscode -- npx -y @zeliper/zscode-mcp-server`));
276
+ console.log(chalk.gray("\n 2. Start planning with:"));
277
+ console.log(chalk.cyan(" /zscode:planning\n"));
278
+ console.log(chalk.gray(" Project root: ") + chalk.white(cwd));
279
+ console.log(chalk.gray(" State file: ") + chalk.white(toPosixPath(getStateFilePath(cwd))));
280
+ console.log();
281
+ }
282
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EACL,QAAQ,EACR,SAAS,EACT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AAC,iBAAiB,CAAC,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC,CAAC;IAC9E,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,iEAAiE,CAAC,CAAC,CAAC;IAC3F,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC;IAEnD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9F,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import { initCommand } from "./commands/init.js";
4
+ const VERSION = "1.0.0";
5
+ const program = new Command();
6
+ program
7
+ .name("zscode")
8
+ .description("ZSCode Planning System CLI - Claude Code project management plugin")
9
+ .version(VERSION);
10
+ program
11
+ .command("init")
12
+ .description("Initialize ZSCode Planning System in the current project")
13
+ .option("-f, --force", "Overwrite existing configuration", false)
14
+ .option("--no-claude-md", "Skip creating CLAUDE.md file")
15
+ .option("-p, --project-name <name>", "Set project name (skip prompt)")
16
+ .action(async (options) => {
17
+ try {
18
+ await initCommand(options);
19
+ }
20
+ catch (error) {
21
+ console.error("Error:", error);
22
+ process.exit(1);
23
+ }
24
+ });
25
+ program
26
+ .command("version")
27
+ .description("Show version information")
28
+ .action(() => {
29
+ console.log(`ZSCode CLI v${VERSION}`);
30
+ });
31
+ // Parse arguments
32
+ program.parse();
33
+ // Show help if no command provided
34
+ if (!process.argv.slice(2).length) {
35
+ program.outputHelp();
36
+ }
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAoB,MAAM,oBAAoB,CAAC;AAEnE,MAAM,OAAO,GAAG,OAAO,CAAC;AAExB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,QAAQ,CAAC;KACd,WAAW,CAAC,oEAAoE,CAAC;KACjF,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,0DAA0D,CAAC;KACvE,MAAM,CAAC,aAAa,EAAE,kCAAkC,EAAE,KAAK,CAAC;KAChE,MAAM,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;KACxD,MAAM,CAAC,2BAA2B,EAAE,gCAAgC,CAAC;KACrE,MAAM,CAAC,KAAK,EAAE,OAAoB,EAAE,EAAE;IACrC,IAAI,CAAC;QACH,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAC/B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,0BAA0B,CAAC;KACvC,MAAM,CAAC,GAAG,EAAE;IACX,OAAO,CAAC,GAAG,CAAC,eAAe,OAAO,EAAE,CAAC,CAAC;AACxC,CAAC,CAAC,CAAC;AAEL,kBAAkB;AAClB,OAAO,CAAC,KAAK,EAAE,CAAC;AAEhB,mCAAmC;AACnC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Normalize path for current OS
3
+ */
4
+ export declare function normalizePath(filePath: string): string;
5
+ /**
6
+ * Convert path to POSIX style (forward slashes)
7
+ */
8
+ export declare function toPosixPath(filePath: string): string;
9
+ /**
10
+ * Convert POSIX path to OS-specific path
11
+ */
12
+ export declare function fromPosixPath(posixPath: string): string;
13
+ /**
14
+ * Create directory recursively
15
+ */
16
+ export declare function ensureDir(dirPath: string): Promise<void>;
17
+ /**
18
+ * Join paths and normalize for current OS
19
+ */
20
+ export declare function joinPath(...paths: string[]): string;
21
+ /**
22
+ * Get directory name from path
23
+ */
24
+ export declare function getDirname(filePath: string): string;
25
+ /**
26
+ * Get file name from path
27
+ */
28
+ export declare function getBasename(filePath: string): string;
29
+ /**
30
+ * Check if path is absolute
31
+ */
32
+ export declare function isAbsolutePath(filePath: string): boolean;
33
+ /**
34
+ * Check if file exists
35
+ */
36
+ export declare function fileExists(filePath: string): Promise<boolean>;
37
+ /**
38
+ * Check if directory exists
39
+ */
40
+ export declare function dirExists(dirPath: string): Promise<boolean>;
41
+ /**
42
+ * Get the .claude directory path
43
+ */
44
+ export declare function getClaudeDir(projectRoot: string): string;
45
+ /**
46
+ * Get the state.json path
47
+ */
48
+ export declare function getStateFilePath(projectRoot: string): string;
49
+ /**
50
+ * Get the plans directory path
51
+ */
52
+ export declare function getPlansDir(projectRoot: string): string;
53
+ /**
54
+ * Get the archive directory path
55
+ */
56
+ export declare function getArchiveDir(projectRoot: string): string;
57
+ /**
58
+ * Get the commands directory path
59
+ */
60
+ export declare function getCommandsDir(projectRoot: string): string;
61
+ /**
62
+ * Check if running on Windows
63
+ */
64
+ export declare function isWindows(): boolean;
65
+ /**
66
+ * Get path separator for current OS
67
+ */
68
+ export declare function getPathSeparator(): string;
69
+ /**
70
+ * Sanitize path component (remove invalid characters)
71
+ */
72
+ export declare function sanitizePathComponent(component: string): string;
73
+ /**
74
+ * Escape path for JSON (double backslashes on Windows)
75
+ */
76
+ export declare function escapeForJson(filePath: string): string;
77
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;GAEG;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,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOjE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAExD;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,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAK/D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKtD"}
@@ -0,0 +1,136 @@
1
+ import { mkdir, access } from "fs/promises";
2
+ import { sep, normalize, join, dirname, basename, isAbsolute } from "path";
3
+ import { constants } from "fs";
4
+ /**
5
+ * Normalize path for current OS
6
+ */
7
+ export function normalizePath(filePath) {
8
+ return normalize(filePath);
9
+ }
10
+ /**
11
+ * Convert path to POSIX style (forward slashes)
12
+ */
13
+ export function toPosixPath(filePath) {
14
+ return filePath.split(sep).join("/");
15
+ }
16
+ /**
17
+ * Convert POSIX path to OS-specific path
18
+ */
19
+ export function fromPosixPath(posixPath) {
20
+ return posixPath.split("/").join(sep);
21
+ }
22
+ /**
23
+ * Create directory recursively
24
+ */
25
+ export async function ensureDir(dirPath) {
26
+ await mkdir(dirPath, { recursive: true });
27
+ }
28
+ /**
29
+ * Join paths and normalize for current OS
30
+ */
31
+ export function joinPath(...paths) {
32
+ return normalizePath(join(...paths));
33
+ }
34
+ /**
35
+ * Get directory name from path
36
+ */
37
+ export function getDirname(filePath) {
38
+ return dirname(filePath);
39
+ }
40
+ /**
41
+ * Get file name from path
42
+ */
43
+ export function getBasename(filePath) {
44
+ return basename(filePath);
45
+ }
46
+ /**
47
+ * Check if path is absolute
48
+ */
49
+ export function isAbsolutePath(filePath) {
50
+ return isAbsolute(filePath);
51
+ }
52
+ /**
53
+ * Check if file exists
54
+ */
55
+ export async function fileExists(filePath) {
56
+ try {
57
+ await access(filePath, constants.F_OK);
58
+ return true;
59
+ }
60
+ catch {
61
+ return false;
62
+ }
63
+ }
64
+ /**
65
+ * Check if directory exists
66
+ */
67
+ export async function dirExists(dirPath) {
68
+ try {
69
+ await access(dirPath, constants.F_OK);
70
+ return true;
71
+ }
72
+ catch {
73
+ return false;
74
+ }
75
+ }
76
+ /**
77
+ * Get the .claude directory path
78
+ */
79
+ export function getClaudeDir(projectRoot) {
80
+ return joinPath(projectRoot, ".claude");
81
+ }
82
+ /**
83
+ * Get the state.json path
84
+ */
85
+ export function getStateFilePath(projectRoot) {
86
+ return joinPath(projectRoot, ".claude", "state.json");
87
+ }
88
+ /**
89
+ * Get the plans directory path
90
+ */
91
+ export function getPlansDir(projectRoot) {
92
+ return joinPath(projectRoot, ".claude", "plans");
93
+ }
94
+ /**
95
+ * Get the archive directory path
96
+ */
97
+ export function getArchiveDir(projectRoot) {
98
+ return joinPath(projectRoot, ".claude", "archive");
99
+ }
100
+ /**
101
+ * Get the commands directory path
102
+ */
103
+ export function getCommandsDir(projectRoot) {
104
+ return joinPath(projectRoot, ".claude", "commands");
105
+ }
106
+ /**
107
+ * Check if running on Windows
108
+ */
109
+ export function isWindows() {
110
+ return process.platform === "win32";
111
+ }
112
+ /**
113
+ * Get path separator for current OS
114
+ */
115
+ export function getPathSeparator() {
116
+ return sep;
117
+ }
118
+ /**
119
+ * Sanitize path component (remove invalid characters)
120
+ */
121
+ export function sanitizePathComponent(component) {
122
+ return component
123
+ .replace(/[<>:"/\\|?*]/g, "_")
124
+ .replace(/\s+/g, "_")
125
+ .slice(0, 255);
126
+ }
127
+ /**
128
+ * Escape path for JSON (double backslashes on Windows)
129
+ */
130
+ export function escapeForJson(filePath) {
131
+ if (isWindows()) {
132
+ return filePath.replace(/\\/g, "\\\\");
133
+ }
134
+ return filePath;
135
+ }
136
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE/B;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,SAAiB;IAC7C,OAAO,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAe;IAC7C,MAAM,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAG,KAAe;IACzC,OAAO,aAAa,CAAC,IAAI,CAAC,GAAG,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AAM,UAAU,aAAa,CAAC,WAAmB;IAC/C,OAAO,QAAQ,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,WAAmB;IAChD,OAAO,QAAQ,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AACtD,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,qBAAqB,CAAC,SAAiB;IACrD,OAAO,SAAS;SACb,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC;SAC7B,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,IAAI,SAAS,EAAE,EAAE,CAAC;QAChB,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@zeliper/zscode",
3
+ "version": "1.0.0",
4
+ "description": "ZSCode CLI - Initialize and manage ZSCode Planning System in your projects",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "type": "module",
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "bin": {
12
+ "zscode": "./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
+ "chalk": "^5.3.0",
23
+ "commander": "^12.0.0",
24
+ "inquirer": "^9.2.0",
25
+ "ora": "^8.0.0"
26
+ },
27
+ "devDependencies": {
28
+ "@types/inquirer": "^9.0.0",
29
+ "@types/node": "^20.10.0",
30
+ "typescript": "^5.3.0"
31
+ },
32
+ "engines": {
33
+ "node": ">=18.0.0"
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "README.md"
38
+ ],
39
+ "keywords": [
40
+ "claude-code",
41
+ "cli",
42
+ "zscode",
43
+ "project-management",
44
+ "initialization"
45
+ ],
46
+ "author": "Zeliper",
47
+ "license": "MIT",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/Zeliper/zscode.git",
51
+ "directory": "packages/cli"
52
+ }
53
+ }