ccjk 9.7.0 → 9.8.1

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.
@@ -1,245 +1,7 @@
1
- import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
2
- import process__default from 'node:process';
1
+ import { existsSync, readdirSync, statSync, readFileSync } from 'node:fs';
2
+ import { CLAUDE_AGENTS_DIR, SETTINGS_FILE, CCJK_SKILLS_DIR } from '../chunks/constants.mjs';
3
3
  import { join } from 'pathe';
4
- import { SETTINGS_FILE, CLAUDE_AGENTS_DIR, CCJK_SKILLS_DIR } from '../chunks/constants.mjs';
5
-
6
- function analyzeProject(root) {
7
- const cwd = process__default.cwd();
8
- const profile = {
9
- language: "unknown",
10
- frameworks: [],
11
- packageManager: "unknown",
12
- hasCI: false,
13
- hasDocker: false,
14
- hasMCP: false,
15
- hasClaudeMd: false,
16
- isMonorepo: false,
17
- tags: []
18
- };
19
- const pkgPath = join(cwd, "package.json");
20
- let pkg = null;
21
- if (existsSync(pkgPath)) {
22
- try {
23
- pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
24
- profile.projectName = pkg?.name;
25
- } catch {
26
- }
27
- }
28
- profile.language = detectLanguage(cwd, pkg);
29
- profile.packageManager = detectPackageManager(cwd);
30
- profile.frameworks = detectFrameworks(cwd, pkg);
31
- profile.testFramework = detectTestFramework(cwd, pkg);
32
- profile.buildTool = detectBuildTool(cwd, pkg);
33
- profile.hasCI = existsSync(join(cwd, ".github/workflows")) || existsSync(join(cwd, ".gitlab-ci.yml")) || existsSync(join(cwd, ".circleci")) || existsSync(join(cwd, "Jenkinsfile"));
34
- profile.hasDocker = existsSync(join(cwd, "Dockerfile")) || existsSync(join(cwd, "docker-compose.yml")) || existsSync(join(cwd, "docker-compose.yaml"));
35
- profile.hasMCP = checkMcpConfigured();
36
- profile.hasClaudeMd = existsSync(join(cwd, "CLAUDE.md"));
37
- profile.isMonorepo = existsSync(join(cwd, "pnpm-workspace.yaml")) || existsSync(join(cwd, "lerna.json")) || pkg?.workspaces != null;
38
- profile.tags = generateTags(profile);
39
- return profile;
40
- }
41
- function detectLanguage(cwd, pkg) {
42
- if (existsSync(join(cwd, "tsconfig.json")) || pkg?.devDependencies?.typescript) return "typescript";
43
- if (existsSync(join(cwd, "pyproject.toml")) || existsSync(join(cwd, "setup.py"))) return "python";
44
- if (existsSync(join(cwd, "go.mod"))) return "go";
45
- if (existsSync(join(cwd, "Cargo.toml"))) return "rust";
46
- if (existsSync(join(cwd, "Gemfile"))) return "ruby";
47
- if (existsSync(join(cwd, "pom.xml")) || existsSync(join(cwd, "build.gradle"))) return "java";
48
- if (existsSync(join(cwd, "Package.swift"))) return "swift";
49
- if (pkg) return "javascript";
50
- return "unknown";
51
- }
52
- function detectPackageManager(cwd) {
53
- if (existsSync(join(cwd, "pnpm-lock.yaml")) || existsSync(join(cwd, "pnpm-workspace.yaml"))) return "pnpm";
54
- if (existsSync(join(cwd, "yarn.lock"))) return "yarn";
55
- if (existsSync(join(cwd, "bun.lockb")) || existsSync(join(cwd, "bun.lock"))) return "bun";
56
- if (existsSync(join(cwd, "package-lock.json"))) return "npm";
57
- return "unknown";
58
- }
59
- function detectFrameworks(_cwd, pkg) {
60
- const frameworks = [];
61
- const allDeps = { ...pkg?.dependencies, ...pkg?.devDependencies };
62
- if (allDeps?.react || allDeps?.["react-dom"]) frameworks.push("react");
63
- if (allDeps?.vue) frameworks.push("vue");
64
- if (allDeps?.svelte) frameworks.push("svelte");
65
- if (allDeps?.angular || allDeps?.["@angular/core"]) frameworks.push("angular");
66
- if (allDeps?.next) frameworks.push("nextjs");
67
- if (allDeps?.nuxt) frameworks.push("nuxt");
68
- if (allDeps?.astro) frameworks.push("astro");
69
- if (allDeps?.express) frameworks.push("express");
70
- if (allDeps?.fastify) frameworks.push("fastify");
71
- if (allDeps?.koa) frameworks.push("koa");
72
- if (allDeps?.hono) frameworks.push("hono");
73
- if (allDeps?.["@nestjs/core"]) frameworks.push("nestjs");
74
- if (allDeps?.electron) frameworks.push("electron");
75
- if (allDeps?.["@tauri-apps/api"]) frameworks.push("tauri");
76
- if (allDeps?.["react-native"]) frameworks.push("react-native");
77
- if (allDeps?.cac || allDeps?.commander || allDeps?.yargs) frameworks.push("cli");
78
- return frameworks;
79
- }
80
- function detectTestFramework(cwd, pkg) {
81
- const allDeps = { ...pkg?.dependencies, ...pkg?.devDependencies };
82
- if (allDeps?.vitest || existsSync(join(cwd, "vitest.config.ts"))) return "vitest";
83
- if (allDeps?.jest || existsSync(join(cwd, "jest.config.js"))) return "jest";
84
- if (allDeps?.mocha) return "mocha";
85
- if (allDeps?.playwright || allDeps?.["@playwright/test"]) return "playwright";
86
- if (allDeps?.cypress) return "cypress";
87
- if (existsSync(join(cwd, "pytest.ini")) || existsSync(join(cwd, "conftest.py"))) return "pytest";
88
- return void 0;
89
- }
90
- function detectBuildTool(cwd, pkg) {
91
- const allDeps = { ...pkg?.dependencies, ...pkg?.devDependencies };
92
- if (allDeps?.vite || existsSync(join(cwd, "vite.config.ts"))) return "vite";
93
- if (allDeps?.webpack) return "webpack";
94
- if (allDeps?.esbuild) return "esbuild";
95
- if (allDeps?.unbuild) return "unbuild";
96
- if (allDeps?.rollup) return "rollup";
97
- if (allDeps?.turbo || existsSync(join(cwd, "turbo.json"))) return "turbo";
98
- return void 0;
99
- }
100
- function checkMcpConfigured() {
101
- try {
102
- if (!existsSync(SETTINGS_FILE)) return false;
103
- const settings = JSON.parse(readFileSync(SETTINGS_FILE, "utf-8"));
104
- return Object.keys(settings.mcpServers || {}).length > 0;
105
- } catch {
106
- return false;
107
- }
108
- }
109
- function generateTags(profile) {
110
- const tags = [];
111
- tags.push(profile.language);
112
- tags.push(...profile.frameworks);
113
- if (profile.testFramework) tags.push(profile.testFramework);
114
- if (profile.buildTool) tags.push(profile.buildTool);
115
- if (profile.packageManager !== "unknown") tags.push(profile.packageManager);
116
- if (profile.hasCI) tags.push("ci");
117
- if (profile.hasDocker) tags.push("docker");
118
- if (profile.isMonorepo) tags.push("monorepo");
119
- if (profile.frameworks.some((f) => ["react", "vue", "svelte", "angular"].includes(f))) tags.push("frontend");
120
- if (profile.frameworks.some((f) => ["express", "fastify", "koa", "nestjs", "hono"].includes(f))) tags.push("backend");
121
- if (profile.frameworks.some((f) => ["nextjs", "nuxt", "astro"].includes(f))) tags.push("fullstack");
122
- if (profile.frameworks.includes("cli")) tags.push("cli-tool");
123
- return [...new Set(tags)];
124
- }
125
-
126
- const SKILL_RULES = [
127
- {
128
- tags: ["typescript", "javascript", "python", "go", "rust", "ruby", "java"],
129
- skill: { id: "git-commit", name: "Smart Git Commit", description: "AI-powered conventional commit messages", reason: "Every project needs good commits", category: "git" }
130
- },
131
- {
132
- tags: ["typescript", "javascript", "python", "go", "rust"],
133
- skill: { id: "code-review", name: "Code Review", description: "Two-phase deep code review", reason: "Catch bugs before they ship", category: "review" }
134
- },
135
- {
136
- tags: ["react", "vue", "svelte", "angular", "frontend"],
137
- skill: { id: "component-gen", name: "Component Generator", description: "Generate UI components with tests", reason: "Frontend framework detected", category: "dev" }
138
- },
139
- {
140
- tags: ["express", "fastify", "koa", "nestjs", "hono", "backend"],
141
- skill: { id: "api-design", name: "API Design", description: "Design RESTful/GraphQL APIs", reason: "Backend framework detected", category: "dev" }
142
- },
143
- {
144
- tags: ["backend", "fullstack"],
145
- skill: { id: "security-audit", name: "Security Audit", description: "Check for common vulnerabilities", reason: "Server-side code needs security review", category: "review" }
146
- },
147
- {
148
- tags: ["vitest", "jest", "pytest", "mocha"],
149
- skill: { id: "tdd-workflow", name: "TDD Workflow", description: "Test-driven development cycle", reason: "Test framework detected", category: "testing" }
150
- },
151
- {
152
- tags: ["playwright", "cypress"],
153
- skill: { id: "e2e-helper", name: "E2E Test Helper", description: "Generate end-to-end tests", reason: "E2E framework detected", category: "testing" }
154
- },
155
- {
156
- tags: ["docker"],
157
- skill: { id: "docker-optimize", name: "Docker Optimizer", description: "Optimize Dockerfile", reason: "Docker detected", category: "devops" }
158
- },
159
- {
160
- tags: ["ci"],
161
- skill: { id: "ci-pipeline", name: "CI Pipeline", description: "Optimize CI/CD pipeline", reason: "CI configuration detected", category: "devops" }
162
- },
163
- {
164
- tags: ["cli-tool", "cli"],
165
- skill: { id: "cli-ux", name: "CLI UX Design", description: "Better CLI interfaces", reason: "CLI tool detected", category: "dev" }
166
- },
167
- {
168
- tags: ["monorepo"],
169
- skill: { id: "monorepo-manage", name: "Monorepo Manager", description: "Manage packages and releases", reason: "Monorepo detected", category: "dev" }
170
- },
171
- {
172
- tags: ["typescript", "javascript", "python"],
173
- skill: { id: "doc-gen", name: "Documentation Generator", description: "Generate API docs and README", reason: "Good docs improve maintainability", category: "docs" }
174
- },
175
- {
176
- tags: ["react", "vue", "nextjs", "nuxt", "frontend"],
177
- skill: { id: "perf-audit", name: "Performance Audit", description: "Bundle size and Core Web Vitals", reason: "Frontend performance matters", category: "review" }
178
- },
179
- {
180
- tags: ["nextjs", "nuxt", "astro", "fullstack"],
181
- skill: { id: "fullstack-debug", name: "Fullstack Debugger", description: "Debug across client/server boundary", reason: "Fullstack framework detected", category: "debug" }
182
- }
183
- ];
184
- const MCP_RULES = [
185
- {
186
- tags: ["typescript", "javascript", "python", "go", "rust", "ruby", "java"],
187
- mcp: { id: "context7", name: "Context7", description: "Up-to-date library docs", reason: "Essential for accurate API usage" }
188
- },
189
- {
190
- tags: ["playwright", "frontend", "fullstack"],
191
- mcp: { id: "playwright", name: "Playwright MCP", description: "Browser automation", reason: "Frontend/E2E project detected" }
192
- },
193
- {
194
- tags: ["backend", "fullstack", "express", "fastify", "nestjs"],
195
- mcp: { id: "sqlite", name: "SQLite MCP", description: "Local database", reason: "Backend project detected" }
196
- },
197
- {
198
- tags: ["typescript", "javascript", "python", "go", "rust"],
199
- mcp: { id: "mcp-search", name: "Web Search", description: "Search for docs and solutions", reason: "Quick access to online resources" }
200
- }
201
- ];
202
- function matchSkills(profile) {
203
- const results = [];
204
- const seen = /* @__PURE__ */ new Set();
205
- for (const rule of SKILL_RULES) {
206
- if (seen.has(rule.skill.id)) continue;
207
- const matchingTags = rule.tags.filter((t) => profile.tags.includes(t));
208
- if (matchingTags.length === 0) continue;
209
- const matchScore = Math.min(100, Math.round(matchingTags.length / rule.tags.length * 100) + 20);
210
- results.push({ ...rule.skill, matchScore });
211
- seen.add(rule.skill.id);
212
- }
213
- results.sort((a, b) => b.matchScore - a.matchScore);
214
- return results;
215
- }
216
- function matchMcpServices(profile) {
217
- const results = [];
218
- const seen = /* @__PURE__ */ new Set();
219
- for (const rule of MCP_RULES) {
220
- if (seen.has(rule.mcp.id)) continue;
221
- const matchingTags = rule.tags.filter((t) => profile.tags.includes(t));
222
- if (matchingTags.length === 0) continue;
223
- const matchScore = Math.min(100, Math.round(matchingTags.length / rule.tags.length * 100) + 20);
224
- results.push({ ...rule.mcp, matchScore });
225
- seen.add(rule.mcp.id);
226
- }
227
- results.sort((a, b) => b.matchScore - a.matchScore);
228
- return results;
229
- }
230
- function getRecommendations(profile) {
231
- const skills = matchSkills(profile);
232
- const mcpServices = matchMcpServices(profile);
233
- const parts = [];
234
- if (profile.language !== "unknown") parts.push(profile.language);
235
- parts.push(...profile.frameworks.slice(0, 3));
236
- const stackDesc = parts.join(" + ") || "your project";
237
- return {
238
- skills,
239
- mcpServices,
240
- summary: `Found ${skills.length} skills and ${mcpServices.length} MCP services for ${stackDesc}`
241
- };
242
- }
4
+ import process__default from 'node:process';
243
5
 
244
6
  const agentsCheck = {
245
7
  name: "Agents",
@@ -635,4 +397,4 @@ async function runHealthCheck(checks) {
635
397
  };
636
398
  }
637
399
 
638
- export { analyzeProject as a, getRecommendations as g, runHealthCheck as r };
400
+ export { runHealthCheck as r };
@@ -0,0 +1,62 @@
1
+ import { detectCodeToolType } from '../chunks/smart-defaults.mjs';
2
+ import { DEFAULT_CODE_TOOL_TYPE } from '../chunks/constants.mjs';
3
+ import { i18n } from '../chunks/index.mjs';
4
+ import { readZcfConfigAsync, saveZcfConfig } from '../chunks/ccjk-config.mjs';
5
+
6
+ const CODE_TYPE_ABBREVIATIONS = {
7
+ cc: "claude-code",
8
+ cx: "codex"
9
+ };
10
+ async function resolveCodeType(codeTypeParam) {
11
+ if (codeTypeParam) {
12
+ const normalizedParam = codeTypeParam.toLowerCase().trim();
13
+ if (normalizedParam in CODE_TYPE_ABBREVIATIONS) {
14
+ return CODE_TYPE_ABBREVIATIONS[normalizedParam];
15
+ }
16
+ if (isValidCodeType(normalizedParam)) {
17
+ return normalizedParam;
18
+ }
19
+ const validAbbreviations = Object.keys(CODE_TYPE_ABBREVIATIONS);
20
+ const validFullTypes = Object.values(CODE_TYPE_ABBREVIATIONS);
21
+ const validOptions = [...validAbbreviations, ...validFullTypes].join(", ");
22
+ let defaultValue = DEFAULT_CODE_TOOL_TYPE;
23
+ try {
24
+ const config = await readZcfConfigAsync();
25
+ if (config?.codeToolType && isValidCodeType(config.codeToolType)) {
26
+ defaultValue = config.codeToolType;
27
+ }
28
+ } catch {
29
+ }
30
+ throw new Error(
31
+ i18n.t("errors:invalidCodeType", { value: codeTypeParam, validOptions, defaultValue })
32
+ );
33
+ }
34
+ try {
35
+ const freshDetected = detectCodeToolType();
36
+ if (isValidCodeType(freshDetected)) {
37
+ try {
38
+ const config = await readZcfConfigAsync();
39
+ if (config && config.codeToolType !== freshDetected) {
40
+ config.codeToolType = freshDetected;
41
+ await saveZcfConfig(config);
42
+ }
43
+ } catch {
44
+ }
45
+ return freshDetected;
46
+ }
47
+ } catch {
48
+ }
49
+ try {
50
+ const config = await readZcfConfigAsync();
51
+ if (config?.codeToolType && isValidCodeType(config.codeToolType)) {
52
+ return config.codeToolType;
53
+ }
54
+ } catch {
55
+ }
56
+ return DEFAULT_CODE_TOOL_TYPE;
57
+ }
58
+ function isValidCodeType(value) {
59
+ return ["claude-code", "codex"].includes(value);
60
+ }
61
+
62
+ export { resolveCodeType as r };
@@ -0,0 +1,266 @@
1
+ import { execSync } from 'node:child_process';
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import process__default from 'node:process';
4
+ import { join } from 'pathe';
5
+
6
+ function scanProject(cwd) {
7
+ const root = cwd || process__default.cwd();
8
+ const pkg = readPackageJson(root);
9
+ const language = detectLanguage(root, pkg);
10
+ const secondaryLanguages = detectSecondaryLanguages(root, pkg, language);
11
+ return {
12
+ language,
13
+ secondaryLanguages,
14
+ framework: detectFramework(root, pkg),
15
+ testRunner: detectTestRunner(root, pkg),
16
+ packageManager: detectPackageManager(root),
17
+ linter: detectLinter(root, pkg),
18
+ formatter: detectFormatter(root, pkg),
19
+ database: detectDatabase(root),
20
+ runtime: detectRuntime(),
21
+ isMonorepo: detectMonorepo(root, pkg),
22
+ usesConventionalCommits: detectConventionalCommits(root, pkg),
23
+ hasGitHooks: detectGitHooks(root, pkg),
24
+ hasDocker: existsSync(join(root, "Dockerfile")) || existsSync(join(root, "docker-compose.yml")) || existsSync(join(root, "docker-compose.yaml")),
25
+ hasCI: detectCI(root),
26
+ root
27
+ };
28
+ }
29
+ function readPackageJson(root) {
30
+ const p = join(root, "package.json");
31
+ if (!existsSync(p)) return null;
32
+ try {
33
+ return JSON.parse(readFileSync(p, "utf-8"));
34
+ } catch {
35
+ return null;
36
+ }
37
+ }
38
+ function hasDep(pkg, name) {
39
+ if (!pkg) return false;
40
+ return !!(pkg.dependencies?.[name] || pkg.devDependencies?.[name] || pkg.peerDependencies?.[name]);
41
+ }
42
+ function detectLanguage(root, pkg) {
43
+ if (existsSync(join(root, "tsconfig.json")) || hasDep(pkg, "typescript")) {
44
+ return "typescript";
45
+ }
46
+ if (existsSync(join(root, "pyproject.toml")) || existsSync(join(root, "setup.py")) || existsSync(join(root, "requirements.txt")) || existsSync(join(root, "Pipfile"))) {
47
+ return "python";
48
+ }
49
+ if (existsSync(join(root, "go.mod"))) {
50
+ return "go";
51
+ }
52
+ if (existsSync(join(root, "Cargo.toml"))) {
53
+ return "rust";
54
+ }
55
+ if (existsSync(join(root, "pom.xml")) || existsSync(join(root, "build.gradle")) || existsSync(join(root, "build.gradle.kts"))) {
56
+ return "java";
57
+ }
58
+ if (existsSync(join(root, "Gemfile"))) {
59
+ return "ruby";
60
+ }
61
+ if (existsSync(join(root, "composer.json"))) {
62
+ return "php";
63
+ }
64
+ if (existsSync(join(root, "Package.swift"))) {
65
+ return "swift";
66
+ }
67
+ if (existsSync(join(root, "*.csproj")) || existsSync(join(root, "*.sln"))) {
68
+ return "csharp";
69
+ }
70
+ if (pkg) {
71
+ return "javascript";
72
+ }
73
+ return "unknown";
74
+ }
75
+ function detectSecondaryLanguages(root, pkg, primary) {
76
+ const langs = [];
77
+ const checks = [
78
+ ["typescript", () => existsSync(join(root, "tsconfig.json")) || hasDep(pkg, "typescript")],
79
+ ["javascript", () => !!pkg],
80
+ ["python", () => existsSync(join(root, "pyproject.toml")) || existsSync(join(root, "requirements.txt"))],
81
+ ["go", () => existsSync(join(root, "go.mod"))],
82
+ ["rust", () => existsSync(join(root, "Cargo.toml"))]
83
+ ];
84
+ for (const [lang, check] of checks) {
85
+ if (lang !== primary && check()) langs.push(lang);
86
+ }
87
+ return langs;
88
+ }
89
+ function detectFramework(root, pkg) {
90
+ if (!pkg) {
91
+ if (existsSync(join(root, "pyproject.toml"))) {
92
+ const content = safeRead(join(root, "pyproject.toml"));
93
+ if (content.includes("fastapi")) return "fastapi";
94
+ if (content.includes("django")) return "django";
95
+ if (content.includes("flask")) return "flask";
96
+ }
97
+ if (existsSync(join(root, "requirements.txt"))) {
98
+ const content = safeRead(join(root, "requirements.txt"));
99
+ if (content.includes("fastapi")) return "fastapi";
100
+ if (content.includes("django")) return "django";
101
+ if (content.includes("flask")) return "flask";
102
+ }
103
+ return "none";
104
+ }
105
+ if (hasDep(pkg, "next")) return "next";
106
+ if (hasDep(pkg, "nuxt")) return "nuxt";
107
+ if (hasDep(pkg, "@angular/core")) return "angular";
108
+ if (hasDep(pkg, "svelte") || hasDep(pkg, "@sveltejs/kit")) return "svelte";
109
+ if (hasDep(pkg, "@nestjs/core")) return "nest";
110
+ if (hasDep(pkg, "@tauri-apps/api") || hasDep(pkg, "@tauri-apps/cli")) return "tauri";
111
+ if (hasDep(pkg, "electron")) return "electron";
112
+ if (hasDep(pkg, "vue")) return "vue";
113
+ if (hasDep(pkg, "react")) return "react";
114
+ if (hasDep(pkg, "fastify")) return "fastify";
115
+ if (hasDep(pkg, "express")) return "express";
116
+ return "none";
117
+ }
118
+ function detectTestRunner(root, pkg) {
119
+ if (hasDep(pkg, "vitest")) return "vitest";
120
+ if (hasDep(pkg, "jest") || hasDep(pkg, "@jest/core")) return "jest";
121
+ if (hasDep(pkg, "mocha")) return "mocha";
122
+ if (existsSync(join(root, "pytest.ini")) || existsSync(join(root, "conftest.py"))) return "pytest";
123
+ if (existsSync(join(root, "pyproject.toml"))) {
124
+ const content = safeRead(join(root, "pyproject.toml"));
125
+ if (content.includes("[tool.pytest") || content.includes("pytest")) return "pytest";
126
+ }
127
+ if (existsSync(join(root, "go.mod"))) return "go-test";
128
+ if (existsSync(join(root, "Cargo.toml"))) return "cargo-test";
129
+ if (existsSync(join(root, "pom.xml")) || existsSync(join(root, "build.gradle"))) return "junit";
130
+ if (existsSync(join(root, "Gemfile"))) {
131
+ const content = safeRead(join(root, "Gemfile"));
132
+ if (content.includes("rspec")) return "rspec";
133
+ }
134
+ if (hasDep(pkg, "phpunit") || existsSync(join(root, "phpunit.xml"))) return "phpunit";
135
+ return "none";
136
+ }
137
+ function detectPackageManager(root) {
138
+ if (existsSync(join(root, "pnpm-lock.yaml")) || existsSync(join(root, "pnpm-workspace.yaml"))) return "pnpm";
139
+ if (existsSync(join(root, "bun.lockb")) || existsSync(join(root, "bun.lock"))) return "bun";
140
+ if (existsSync(join(root, "yarn.lock"))) return "yarn";
141
+ if (existsSync(join(root, "package-lock.json"))) return "npm";
142
+ if (existsSync(join(root, "poetry.lock"))) return "poetry";
143
+ if (existsSync(join(root, "Pipfile.lock")) || existsSync(join(root, "requirements.txt"))) return "pip";
144
+ if (existsSync(join(root, "Cargo.lock"))) return "cargo";
145
+ if (existsSync(join(root, "go.sum"))) return "go";
146
+ if (existsSync(join(root, "pom.xml"))) return "maven";
147
+ if (existsSync(join(root, "build.gradle")) || existsSync(join(root, "build.gradle.kts"))) return "gradle";
148
+ return "none";
149
+ }
150
+ function detectLinter(root, pkg) {
151
+ if (hasDep(pkg, "@biomejs/biome") || existsSync(join(root, "biome.json")) || existsSync(join(root, "biome.jsonc"))) return "biome";
152
+ if (hasDep(pkg, "oxlint") || hasDep(pkg, "oxc")) return "oxlint";
153
+ if (hasDep(pkg, "eslint") || existsSync(join(root, ".eslintrc.json")) || existsSync(join(root, ".eslintrc.js")) || existsSync(join(root, "eslint.config.js")) || existsSync(join(root, "eslint.config.mjs"))) return "eslint";
154
+ if (existsSync(join(root, "ruff.toml")) || existsSync(join(root, ".ruff.toml"))) return "ruff";
155
+ if (existsSync(join(root, "pyproject.toml"))) {
156
+ const content = safeRead(join(root, "pyproject.toml"));
157
+ if (content.includes("[tool.ruff")) return "ruff";
158
+ if (content.includes("[tool.pylint") || content.includes("pylint")) return "pylint";
159
+ if (content.includes("flake8")) return "flake8";
160
+ }
161
+ if (existsSync(join(root, ".golangci.yml")) || existsSync(join(root, ".golangci.yaml"))) return "golangci-lint";
162
+ if (existsSync(join(root, "Cargo.toml"))) return "clippy";
163
+ if (existsSync(join(root, ".rubocop.yml"))) return "rubocop";
164
+ return "none";
165
+ }
166
+ function detectFormatter(root, pkg) {
167
+ if (hasDep(pkg, "@biomejs/biome") || existsSync(join(root, "biome.json"))) return "biome";
168
+ if (hasDep(pkg, "prettier") || existsSync(join(root, ".prettierrc")) || existsSync(join(root, ".prettierrc.json")) || existsSync(join(root, "prettier.config.js")) || existsSync(join(root, "prettier.config.mjs"))) return "prettier";
169
+ if (existsSync(join(root, "pyproject.toml"))) {
170
+ const content = safeRead(join(root, "pyproject.toml"));
171
+ if (content.includes("[tool.ruff") && content.includes("format")) return "ruff";
172
+ if (content.includes("[tool.black") || content.includes("black")) return "black";
173
+ }
174
+ if (existsSync(join(root, "go.mod"))) return "gofmt";
175
+ if (existsSync(join(root, "Cargo.toml"))) return "rustfmt";
176
+ return "none";
177
+ }
178
+ function detectDatabase(root) {
179
+ for (const f of ["docker-compose.yml", "docker-compose.yaml", "compose.yml", "compose.yaml"]) {
180
+ const content = safeRead(join(root, f));
181
+ if (!content) continue;
182
+ if (content.includes("postgres")) return "postgresql";
183
+ if (content.includes("mysql") || content.includes("mariadb")) return "mysql";
184
+ if (content.includes("mongo")) return "mongodb";
185
+ if (content.includes("redis")) return "redis";
186
+ }
187
+ for (const f of [".env", ".env.local", ".env.development"]) {
188
+ const content = safeRead(join(root, f));
189
+ if (!content) continue;
190
+ if (content.includes("postgres")) return "postgresql";
191
+ if (content.includes("mysql")) return "mysql";
192
+ if (content.includes("mongodb") || content.includes("mongo+srv")) return "mongodb";
193
+ if (content.includes("redis://")) return "redis";
194
+ }
195
+ if (existsSync(join(root, "prisma", "schema.prisma"))) {
196
+ const content = safeRead(join(root, "prisma", "schema.prisma"));
197
+ if (content.includes("postgresql")) return "postgresql";
198
+ if (content.includes("mysql")) return "mysql";
199
+ if (content.includes("sqlite")) return "sqlite";
200
+ if (content.includes("mongodb")) return "mongodb";
201
+ }
202
+ for (const f of ["*.db", "*.sqlite", "*.sqlite3"]) {
203
+ if (existsSync(join(root, "db.sqlite")) || existsSync(join(root, "database.sqlite")) || existsSync(join(root, "dev.db"))) {
204
+ return "sqlite";
205
+ }
206
+ }
207
+ return "none";
208
+ }
209
+ function detectRuntime() {
210
+ const isContainer = existsSync("/.dockerenv") || existsSync("/run/.containerenv") || safeRead("/proc/1/cgroup").includes("docker");
211
+ const isSSH = !!process__default.env.SSH_CLIENT || !!process__default.env.SSH_TTY || !!process__default.env.SSH_CONNECTION;
212
+ const isCI = !!(process__default.env.CI || process__default.env.GITHUB_ACTIONS || process__default.env.GITLAB_CI || process__default.env.JENKINS_URL || process__default.env.CIRCLECI || process__default.env.TRAVIS || process__default.env.BUILDKITE);
213
+ const isWSL = safeRead("/proc/version").toLowerCase().includes("microsoft");
214
+ const isMac = process__default.platform === "darwin";
215
+ const hasDisplay = !!(process__default.env.DISPLAY || process__default.env.WAYLAND_DISPLAY || process__default.env.TERM_PROGRAM);
216
+ const isHeadless = !isMac && !hasDisplay && !isWSL;
217
+ const hasBrowser = isMac || hasDisplay || isWSL;
218
+ return {
219
+ isContainer,
220
+ isHeadless,
221
+ isSSH,
222
+ isCI,
223
+ isWSL,
224
+ hasBrowser
225
+ };
226
+ }
227
+ function detectMonorepo(root, pkg) {
228
+ if (pkg?.workspaces) return true;
229
+ if (existsSync(join(root, "pnpm-workspace.yaml"))) return true;
230
+ if (existsSync(join(root, "lerna.json"))) return true;
231
+ if (existsSync(join(root, "nx.json"))) return true;
232
+ if (existsSync(join(root, "turbo.json"))) return true;
233
+ return false;
234
+ }
235
+ function detectConventionalCommits(root, pkg) {
236
+ if (existsSync(join(root, ".commitlintrc.json")) || existsSync(join(root, ".commitlintrc.js")) || existsSync(join(root, "commitlint.config.js")) || existsSync(join(root, "commitlint.config.mjs"))) return true;
237
+ if (hasDep(pkg, "@commitlint/cli") || hasDep(pkg, "@commitlint/config-conventional")) return true;
238
+ try {
239
+ const log = execSync("git log --oneline -10 2>/dev/null", { cwd: root, encoding: "utf-8", timeout: 3e3 });
240
+ const conventionalPattern = /^[a-f0-9]+ (feat|fix|chore|docs|style|refactor|perf|test|build|ci|revert)(\(.+\))?[!]?:/m;
241
+ const lines = log.trim().split("\n").filter(Boolean);
242
+ const matches = lines.filter((l) => conventionalPattern.test(l));
243
+ return lines.length > 0 && matches.length / lines.length > 0.5;
244
+ } catch {
245
+ return false;
246
+ }
247
+ }
248
+ function detectGitHooks(root, pkg) {
249
+ if (existsSync(join(root, ".husky"))) return true;
250
+ if (hasDep(pkg, "husky") || hasDep(pkg, "simple-git-hooks") || hasDep(pkg, "lefthook")) return true;
251
+ if (existsSync(join(root, ".lefthook.yml"))) return true;
252
+ return false;
253
+ }
254
+ function detectCI(root) {
255
+ return existsSync(join(root, ".github", "workflows")) || existsSync(join(root, ".gitlab-ci.yml")) || existsSync(join(root, ".circleci")) || existsSync(join(root, "Jenkinsfile")) || existsSync(join(root, ".travis.yml")) || existsSync(join(root, "bitbucket-pipelines.yml"));
256
+ }
257
+ function safeRead(path) {
258
+ try {
259
+ if (!existsSync(path)) return "";
260
+ return readFileSync(path, "utf-8");
261
+ } catch {
262
+ return "";
263
+ }
264
+ }
265
+
266
+ export { scanProject as s };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ccjk",
3
3
  "type": "module",
4
- "version": "9.7.0",
4
+ "version": "9.8.1",
5
5
  "packageManager": "pnpm@10.17.1",
6
6
  "description": "CCJK v9.0.0 - Revolutionary AI Development Platform with Enterprise Security, Streaming Cloud Sync, CRDT Conflict Resolution, and Unified V3 Architecture",
7
7
  "author": {