ccjk 14.0.0 → 14.0.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ccjk",
3
3
  "type": "module",
4
- "version": "14.0.0",
4
+ "version": "14.0.1",
5
5
  "packageManager": "pnpm@10.17.1",
6
6
  "description": "Production-ready AI dev environment for Claude Code, Codex, and modern coding workflows with 30-second onboarding, persistent memory, Agent Teams, remote control, and capability discovery.",
7
7
  "author": {
@@ -1,142 +0,0 @@
1
- import process__default from 'node:process';
2
-
3
- const INTENT_RULES = [
4
- {
5
- keywords: ["commit", "\u63D0\u4EA4", "\u63D0\u4EA4\u4EE3\u7801", "git commit", "\u4FDD\u5B58\u66F4\u6539"],
6
- skill: "commit",
7
- confidence: 0.9,
8
- description: "Smart commit with AI-generated messages"
9
- },
10
- {
11
- keywords: ["github", "gh", "pr", "pull request", "merge request", "\u5408\u5E76\u8BF7\u6C42"],
12
- skill: "github",
13
- confidence: 0.85,
14
- description: "GitHub operations"
15
- },
16
- {
17
- keywords: ["review", "\u5BA1\u67E5", "code review", "\u4EE3\u7801\u5BA1\u67E5", "\u68C0\u67E5\u4EE3\u7801"],
18
- skill: "review",
19
- confidence: 0.85,
20
- description: "Code review"
21
- },
22
- {
23
- keywords: ["test", "\u6D4B\u8BD5", "run test", "\u8FD0\u884C\u6D4B\u8BD5", "testing"],
24
- skill: "test",
25
- confidence: 0.8,
26
- description: "Run tests"
27
- },
28
- {
29
- keywords: ["doc", "\u6587\u6863", "documentation", "\u751F\u6210\u6587\u6863", "generate doc"],
30
- skill: "doc",
31
- confidence: 0.8,
32
- description: "Generate documentation"
33
- },
34
- {
35
- keywords: ["deploy", "\u90E8\u7F72", "deployment", "\u53D1\u5E03", "release"],
36
- skill: "deploy",
37
- confidence: 0.85,
38
- description: "Deploy application"
39
- },
40
- {
41
- keywords: ["fix", "\u4FEE\u590D", "bug", "debug", "\u8C03\u8BD5", "error", "\u9519\u8BEF"],
42
- skill: "fix",
43
- confidence: 0.75,
44
- description: "Fix bugs and errors"
45
- },
46
- {
47
- keywords: ["refactor", "\u91CD\u6784", "optimize", "\u4F18\u5316", "improve", "\u6539\u8FDB"],
48
- skill: "refactor",
49
- confidence: 0.75,
50
- description: "Refactor code"
51
- }
52
- ];
53
- function recognizeIntent(input) {
54
- const normalizedInput = input.toLowerCase().trim();
55
- let bestMatch = null;
56
- let highestScore = 0;
57
- for (const rule of INTENT_RULES) {
58
- const matchedKeywords = [];
59
- let score = 0;
60
- for (const keyword of rule.keywords) {
61
- if (normalizedInput.includes(keyword.toLowerCase())) {
62
- matchedKeywords.push(keyword);
63
- if (normalizedInput === keyword.toLowerCase()) {
64
- score += 1;
65
- } else {
66
- score += 0.5;
67
- }
68
- }
69
- }
70
- const confidence = score / rule.keywords.length;
71
- if (confidence >= rule.confidence && score > highestScore) {
72
- highestScore = score;
73
- bestMatch = {
74
- skill: rule.skill,
75
- confidence,
76
- description: rule.description,
77
- matchedKeywords
78
- };
79
- }
80
- }
81
- return bestMatch;
82
- }
83
- function shouldTriggerSkill(args) {
84
- if (args.length > 0 && args[0].startsWith("/")) {
85
- return null;
86
- }
87
- const knownCommands = [
88
- "init",
89
- "update",
90
- "doctor",
91
- "help",
92
- "mcp",
93
- "skill",
94
- "agent",
95
- "hook",
96
- "memory",
97
- "quick-setup",
98
- "config",
99
- "template",
100
- "brain",
101
- "session"
102
- ];
103
- if (args.length > 0 && knownCommands.includes(args[0])) {
104
- return null;
105
- }
106
- const input = args.join(" ");
107
- return recognizeIntent(input);
108
- }
109
- async function executeSkill(skillName, _originalArgs) {
110
- try {
111
- const { executeSlashCommand } = await import('./slash-commands.mjs');
112
- const skillCommand = `/${skillName}`;
113
- const handled = await executeSlashCommand(skillCommand);
114
- return handled;
115
- } catch (error) {
116
- console.error(`Failed to execute skill "${skillName}":`, error);
117
- return false;
118
- }
119
- }
120
- async function handleIntentRecognition() {
121
- const args = process__default.argv.slice(2);
122
- const intent = shouldTriggerSkill(args);
123
- if (!intent) {
124
- return false;
125
- }
126
- if (intent.confidence >= 0.9) {
127
- console.log(`\u{1F3AF} Detected intent: ${intent.description}`);
128
- console.log(` Executing skill: /${intent.skill}
129
- `);
130
- return await executeSkill(intent.skill);
131
- }
132
- if (intent.confidence >= 0.7) {
133
- console.log(`\u{1F914} Did you mean: /${intent.skill} (${intent.description})?`);
134
- console.log(` Matched keywords: ${intent.matchedKeywords.join(", ")}`);
135
- console.log(` Confidence: ${(intent.confidence * 100).toFixed(0)}%
136
- `);
137
- return await executeSkill(intent.skill);
138
- }
139
- return false;
140
- }
141
-
142
- export { executeSkill, handleIntentRecognition, recognizeIntent, shouldTriggerSkill };
@@ -1,425 +0,0 @@
1
- import { execSync } from 'node:child_process';
2
- import { existsSync, readFileSync } from 'node:fs';
3
- import { homedir } from 'node:os';
4
- import { CCJK_CONFIG_DIR, CODE_TOOL_INFO } from './constants.mjs';
5
- import { writeJsonConfig } from './json-config.mjs';
6
- import { j as join } from '../shared/ccjk.bQ7Dh1g4.mjs';
7
- import { g as getPlatform, h as commandExists } from './platform.mjs';
8
- import { s as scanProject } from '../shared/ccjk.DJuyfrlL.mjs';
9
-
10
- const ORCHESTRATION_LEVELS = ["off", "minimal", "standard", "max"];
11
- function parseOrchestrationLevel(value) {
12
- if (!value) {
13
- return "max";
14
- }
15
- const normalized = value.trim().toLowerCase();
16
- if (ORCHESTRATION_LEVELS.includes(normalized)) {
17
- return normalized;
18
- }
19
- throw new Error(`Invalid orchestration level: ${value}. Valid values: ${ORCHESTRATION_LEVELS.join(", ")}`);
20
- }
21
- function buildDefaults(level) {
22
- if (level === "off") {
23
- return {
24
- planForNonTrivial: false,
25
- useSubagentsForResearch: false,
26
- verifyBeforeDone: false,
27
- rootCauseFirst: true,
28
- lessonsLoop: false
29
- };
30
- }
31
- if (level === "minimal") {
32
- return {
33
- planForNonTrivial: true,
34
- useSubagentsForResearch: false,
35
- verifyBeforeDone: true,
36
- rootCauseFirst: true,
37
- lessonsLoop: false
38
- };
39
- }
40
- if (level === "max") {
41
- return {
42
- planForNonTrivial: true,
43
- useSubagentsForResearch: true,
44
- verifyBeforeDone: true,
45
- rootCauseFirst: true,
46
- lessonsLoop: true
47
- };
48
- }
49
- return {
50
- planForNonTrivial: true,
51
- useSubagentsForResearch: true,
52
- verifyBeforeDone: true,
53
- rootCauseFirst: true,
54
- lessonsLoop: true
55
- };
56
- }
57
- function resolveOrchestrationLevelFromRuntime(runtime) {
58
- if (!runtime) {
59
- return "max";
60
- }
61
- if (runtime.isCI || runtime.isContainer) {
62
- return "minimal";
63
- }
64
- if (runtime.isSSH) {
65
- return "minimal";
66
- }
67
- return "max";
68
- }
69
- function writeOrchestrationPolicy(params) {
70
- const filePath = join(CCJK_CONFIG_DIR, "orchestration.json");
71
- const policy = {
72
- version: "1.0.0",
73
- enabled: params.level !== "off",
74
- level: params.level,
75
- language: params.language,
76
- defaults: buildDefaults(params.level),
77
- generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
78
- source: params.source
79
- };
80
- writeJsonConfig(filePath, policy, { atomic: true });
81
- return filePath;
82
- }
83
-
84
- class SmartDefaultsDetector {
85
- /**
86
- * Detect environment and generate smart defaults
87
- */
88
- async detect(cwd) {
89
- const platform = getPlatform();
90
- const apiKey = this.detectApiKey();
91
- const apiProvider = this.detectApiProvider(apiKey);
92
- const ccVersion = await this.detectClaudeCodeVersion();
93
- const projectContext = scanProject(cwd);
94
- return {
95
- // Environment detection
96
- platform,
97
- homeDir: homedir(),
98
- // API configuration
99
- apiKey,
100
- apiProvider,
101
- // Recommended MCP services based on platform + project
102
- mcpServices: this.getRecommendedMcpServices(platform, projectContext),
103
- // Essential skills — reduced in CI/container (non-interactive)
104
- skills: projectContext.runtime.isCI || projectContext.runtime.isContainer ? ["ccjk:git-commit"] : [
105
- "ccjk:git-commit",
106
- "ccjk:feat",
107
- "ccjk:workflow",
108
- "ccjk:init-project",
109
- "ccjk:git-worktree"
110
- ],
111
- // Core agents — skip in CI/container (non-interactive)
112
- agents: projectContext.runtime.isCI || projectContext.runtime.isContainer ? [] : [
113
- "typescript-cli-architect",
114
- "ccjk-testing-specialist"
115
- ],
116
- // Code tool detection
117
- codeToolType: this.detectCodeToolType(),
118
- // Workflow preferences
119
- workflows: {
120
- outputStyle: "engineer-professional",
121
- gitWorkflow: projectContext.usesConventionalCommits ? "conventional-commits" : "conventional-commits",
122
- sixStepWorkflow: true,
123
- orchestrationLevel: resolveOrchestrationLevelFromRuntime(projectContext.runtime)
124
- },
125
- // Tool integrations
126
- tools: {
127
- ccr: this.shouldEnableCCR(),
128
- cometix: this.shouldEnableCometix(),
129
- ccusage: this.shouldEnableCCUsage()
130
- },
131
- // Claude Code native features
132
- claudeCodeVersion: ccVersion,
133
- nativeFeatures: this.detectNativeFeatures(ccVersion),
134
- // Project context
135
- projectContext,
136
- // Recommended hooks based on project toolchain
137
- recommendedHooks: this.getRecommendedHooks(projectContext),
138
- // SSH session flag for quick-setup notice
139
- sshDetected: projectContext.runtime.isSSH || void 0
140
- };
141
- }
142
- /**
143
- * Detect installed Claude Code version
144
- */
145
- async detectClaudeCodeVersion() {
146
- const candidateCommands = [
147
- CODE_TOOL_INFO["claude-code"].runtimeCommand,
148
- CODE_TOOL_INFO.myclaude.runtimeCommand
149
- ];
150
- for (const command of candidateCommands) {
151
- try {
152
- if (!await commandExists(command)) {
153
- continue;
154
- }
155
- const output = execSync(`${command} --version 2>/dev/null || echo ""`, {
156
- encoding: "utf-8",
157
- timeout: 5e3
158
- }).trim();
159
- const match = output.match(/(\d+\.\d+\.\d+)/);
160
- if (match) {
161
- return match[1];
162
- }
163
- } catch {
164
- }
165
- }
166
- return void 0;
167
- }
168
- /**
169
- * Detect which Claude Code native features are available
170
- * based on installed version
171
- */
172
- detectNativeFeatures(version) {
173
- return {
174
- hooks: this.versionSupports(version, "1.0.6"),
175
- plansDirectory: this.versionSupports(version, "1.0.10"),
176
- memory: this.versionSupports(version, "1.0.12"),
177
- subagents: this.versionSupports(version, "1.0.3"),
178
- toolSearch: this.versionSupports(version, "1.0.10"),
179
- statusLine: this.versionSupports(version, "1.0.8")
180
- };
181
- }
182
- /**
183
- * Check if a version meets the minimum requirement
184
- */
185
- versionSupports(version, minVersion) {
186
- if (!version)
187
- return false;
188
- const parts = version.split(".").map(Number);
189
- const minParts = minVersion.split(".").map(Number);
190
- for (let i = 0; i < 3; i++) {
191
- if ((parts[i] || 0) > (minParts[i] || 0))
192
- return true;
193
- if ((parts[i] || 0) < (minParts[i] || 0))
194
- return false;
195
- }
196
- return true;
197
- }
198
- /**
199
- * Detect API key from environment variables
200
- */
201
- detectApiKey() {
202
- const envVars = [
203
- "ANTHROPIC_API_KEY",
204
- "CLAUDE_API_KEY",
205
- "API_KEY"
206
- ];
207
- for (const envVar of envVars) {
208
- const value = process.env[envVar];
209
- if (value && value.length >= 10) {
210
- return value;
211
- }
212
- }
213
- const claudeConfigPath = join(homedir(), ".config", "claude", "config.json");
214
- if (existsSync(claudeConfigPath)) {
215
- try {
216
- const configContent = readFileSync(claudeConfigPath, "utf-8");
217
- const config = JSON.parse(configContent);
218
- if (config.apiKey && config.apiKey.length >= 10) {
219
- return config.apiKey;
220
- }
221
- } catch {
222
- }
223
- }
224
- return void 0;
225
- }
226
- /**
227
- * Detect API provider based on API key pattern
228
- */
229
- detectApiProvider(apiKey) {
230
- if (!apiKey) {
231
- return void 0;
232
- }
233
- if (apiKey.startsWith("sk-ant-")) {
234
- return "anthropic";
235
- }
236
- return void 0;
237
- }
238
- /**
239
- * Detect installed code tool type (instance method delegates to static)
240
- */
241
- detectCodeToolType() {
242
- return SmartDefaultsDetector.detectCodeToolType();
243
- }
244
- /**
245
- * Detect installed code tool type by checking filesystem markers.
246
- * This is a static method so it can be called without instantiating the full detector.
247
- */
248
- static detectCodeToolType() {
249
- const myclaudeMarkers = [
250
- join(homedir(), ".claude.json"),
251
- join(homedir(), ".claude", "config.json")
252
- ];
253
- try {
254
- if (myclaudeMarkers.some((p) => existsSync(p))) {
255
- const globalConfigPath = join(homedir(), ".claude.json");
256
- if (existsSync(globalConfigPath)) {
257
- const configContent = readFileSync(globalConfigPath, "utf-8");
258
- const config = JSON.parse(configContent);
259
- if (config.myclaudeActiveProviderProfileId || config.myclaudeProviderProfiles) {
260
- return "myclaude";
261
- }
262
- }
263
- }
264
- } catch {
265
- }
266
- const claudeCodePaths = [
267
- join(homedir(), ".claude"),
268
- join(homedir(), ".config", "claude")
269
- ];
270
- if (claudeCodePaths.some((p) => existsSync(p))) {
271
- return "claude-code";
272
- }
273
- const codexPath = join(homedir(), ".codex");
274
- if (existsSync(codexPath)) {
275
- return "codex";
276
- }
277
- return "myclaude";
278
- }
279
- /**
280
- * Check if CCR (Claude Code Router) should be enabled
281
- */
282
- shouldEnableCCR() {
283
- const ccrPaths = [
284
- join(homedir(), ".local", "bin", "ccr"),
285
- join(homedir(), ".cargo", "bin", "ccr"),
286
- "/usr/local/bin/ccr"
287
- ];
288
- return ccrPaths.some((path) => existsSync(path));
289
- }
290
- /**
291
- * Check if Cometix should be enabled
292
- */
293
- shouldEnableCometix() {
294
- const cometixPaths = [
295
- join(homedir(), ".local", "bin", "cometix"),
296
- join(homedir(), ".cargo", "bin", "cometix"),
297
- "/usr/local/bin/cometix"
298
- ];
299
- return cometixPaths.some((path) => existsSync(path));
300
- }
301
- /**
302
- * Check if CCUsage should be enabled
303
- */
304
- shouldEnableCCUsage() {
305
- const ccusagePaths = [
306
- join(homedir(), ".local", "bin", "ccusage"),
307
- join(homedir(), ".cargo", "bin", "ccusage"),
308
- "/usr/local/bin/ccusage"
309
- ];
310
- return ccusagePaths.some((path) => existsSync(path));
311
- }
312
- /**
313
- * Get recommended MCP services based on environment + project context
314
- */
315
- getRecommendedMcpServices(platform, project) {
316
- return ["context7"];
317
- }
318
- /**
319
- * Get recommended hook template IDs based on project toolchain
320
- */
321
- getRecommendedHooks(project) {
322
- const runtime = project.runtime;
323
- if (runtime.isCI) {
324
- const hooks2 = [];
325
- if (project.linter !== "none")
326
- hooks2.push("pre-commit-lint-check");
327
- if (project.testRunner !== "none")
328
- hooks2.push("test-before-commit");
329
- return hooks2;
330
- }
331
- if (runtime.isContainer) {
332
- const hooks2 = [];
333
- if (project.linter !== "none")
334
- hooks2.push("pre-commit-lint-check");
335
- if (project.testRunner !== "none")
336
- hooks2.push("test-before-commit");
337
- return hooks2;
338
- }
339
- const hooks = [];
340
- if (!runtime.isHeadless) {
341
- hooks.push("block-dev-server");
342
- }
343
- hooks.push("git-push-confirm");
344
- const jsLangs = ["typescript", "javascript"];
345
- if (jsLangs.includes(project.language)) {
346
- hooks.push("warn-console-log");
347
- }
348
- hooks.push("block-unwanted-docs");
349
- if (project.testRunner !== "none") {
350
- hooks.push("test-before-commit");
351
- }
352
- if (project.formatter !== "none") {
353
- hooks.push("auto-format-on-save");
354
- }
355
- if (project.linter !== "none") {
356
- hooks.push("pre-commit-lint-check");
357
- }
358
- return hooks;
359
- }
360
- /**
361
- * Get recommended skills based on user type
362
- */
363
- getRecommendedSkills(userType = "intermediate") {
364
- const core = [
365
- "ccjk:git-commit",
366
- "ccjk:init-project"
367
- ];
368
- if (userType === "beginner") {
369
- return [...core, "ccjk:workflow"];
370
- }
371
- if (userType === "intermediate") {
372
- return [...core, "ccjk:feat", "ccjk:workflow", "ccjk:git-worktree"];
373
- }
374
- if (userType === "advanced") {
375
- return [
376
- ...core,
377
- "ccjk:feat",
378
- "ccjk:workflow",
379
- "ccjk:git-worktree",
380
- "ccjk:git-rollback",
381
- "ccjk:git-cleanBranches"
382
- ];
383
- }
384
- return core;
385
- }
386
- /**
387
- * Validate detected defaults
388
- */
389
- validateDefaults(defaults) {
390
- const issues = [];
391
- if (defaults.apiKey) {
392
- if (defaults.apiKey.length < 10) {
393
- issues.push("API key appears too short to be valid");
394
- } else if (defaults.apiProvider === "anthropic" && !defaults.apiKey.startsWith("sk-ant-")) {
395
- issues.push("API key format appears invalid (should start with sk-ant-)");
396
- }
397
- }
398
- if (!["darwin", "linux", "win32"].includes(defaults.platform)) {
399
- issues.push(`Platform ${defaults.platform} may not be fully supported`);
400
- }
401
- if (!existsSync(defaults.homeDir)) {
402
- issues.push("Home directory is not accessible");
403
- }
404
- return {
405
- valid: issues.length === 0,
406
- issues
407
- };
408
- }
409
- }
410
- async function detectSmartDefaults() {
411
- const detector = new SmartDefaultsDetector();
412
- return detector.detect();
413
- }
414
- function detectCodeToolType() {
415
- return SmartDefaultsDetector.detectCodeToolType();
416
- }
417
-
418
- const smartDefaults = {
419
- __proto__: null,
420
- SmartDefaultsDetector: SmartDefaultsDetector,
421
- detectCodeToolType: detectCodeToolType,
422
- detectSmartDefaults: detectSmartDefaults
423
- };
424
-
425
- export { detectCodeToolType as a, detectSmartDefaults as d, parseOrchestrationLevel as p, smartDefaults as s, writeOrchestrationPolicy as w };