ticketpro-auto-setup 1.1.1 → 1.1.2
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.
|
@@ -5,7 +5,7 @@ import fs from 'node:fs';
|
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import ora from 'ora';
|
|
7
7
|
import { execCommand, execAsync } from '../utils/shell.js';
|
|
8
|
-
import { getPlatform, getClaudeDir } from '../utils/platform.js';
|
|
8
|
+
import { getPlatform, getClaudeDir, getClaudeJsonPath } from '../utils/platform.js';
|
|
9
9
|
import { log } from '../utils/logger.js';
|
|
10
10
|
/**
|
|
11
11
|
* 安装 Claude Code CLI
|
|
@@ -32,6 +32,7 @@ export async function installClaudeCode() {
|
|
|
32
32
|
*/
|
|
33
33
|
export function configureClaudeCode(state) {
|
|
34
34
|
const claudeDir = getClaudeDir();
|
|
35
|
+
const claudeJsonPath = getClaudeJsonPath();
|
|
35
36
|
try {
|
|
36
37
|
// 确保目录存在
|
|
37
38
|
fs.mkdirSync(claudeDir, { recursive: true });
|
|
@@ -55,6 +56,20 @@ export function configureClaudeCode(state) {
|
|
|
55
56
|
};
|
|
56
57
|
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), 'utf-8');
|
|
57
58
|
log.success(`Claude Code config written to ${settingsPath}`);
|
|
59
|
+
// 写入 ~/.claude.json 以跳过首次 onboarding 登录提示
|
|
60
|
+
// 保留用户已有字段,只覆盖 hasCompletedOnboarding
|
|
61
|
+
let claudeMeta = {};
|
|
62
|
+
if (fs.existsSync(claudeJsonPath)) {
|
|
63
|
+
try {
|
|
64
|
+
claudeMeta = JSON.parse(fs.readFileSync(claudeJsonPath, 'utf-8'));
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
claudeMeta = {};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
claudeMeta.hasCompletedOnboarding = true;
|
|
71
|
+
fs.writeFileSync(claudeJsonPath, JSON.stringify(claudeMeta, null, 2), 'utf-8');
|
|
72
|
+
log.success(`Claude onboarding bypass configured at ${claudeJsonPath}`);
|
|
58
73
|
return { name: 'Claude Code Config', success: true };
|
|
59
74
|
}
|
|
60
75
|
catch (err) {
|
package/dist/utils/platform.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { PlatformInfo } from '../types/index.js';
|
|
|
2
2
|
export declare function getPlatform(): PlatformInfo;
|
|
3
3
|
/** 获取 ~/.claude 路径 */
|
|
4
4
|
export declare function getClaudeDir(): string;
|
|
5
|
+
/** 获取 ~/.claude.json 路径(onboarding 状态文件,在 home 目录下,非 .claude/ 目录内) */
|
|
6
|
+
export declare function getClaudeJsonPath(): string;
|
|
5
7
|
/** 获取 ~/.codex 路径 */
|
|
6
8
|
export declare function getCodexDir(): string;
|
|
7
9
|
/** 获取 shell profile 文件路径 */
|
package/dist/utils/platform.js
CHANGED
|
@@ -36,6 +36,10 @@ export function getPlatform() {
|
|
|
36
36
|
export function getClaudeDir() {
|
|
37
37
|
return path.join(getPlatform().homeDir, '.claude');
|
|
38
38
|
}
|
|
39
|
+
/** 获取 ~/.claude.json 路径(onboarding 状态文件,在 home 目录下,非 .claude/ 目录内) */
|
|
40
|
+
export function getClaudeJsonPath() {
|
|
41
|
+
return path.join(getPlatform().homeDir, '.claude.json');
|
|
42
|
+
}
|
|
39
43
|
/** 获取 ~/.codex 路径 */
|
|
40
44
|
export function getCodexDir() {
|
|
41
45
|
return path.join(getPlatform().homeDir, '.codex');
|