pattyeng 1.0.0 → 1.0.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.
- package/lib/install.js +55 -13
- package/package.json +7 -2
package/lib/install.js
CHANGED
|
@@ -26,8 +26,24 @@ const SA_USER = 'admin';
|
|
|
26
26
|
const SA_PASS = 'pattyeng0805@';
|
|
27
27
|
|
|
28
28
|
// ─── Platform ────────────────────────────────────────────────────────────────
|
|
29
|
-
const IS_WIN
|
|
30
|
-
const HOME
|
|
29
|
+
const IS_WIN = process.platform === 'win32';
|
|
30
|
+
const HOME = os.homedir();
|
|
31
|
+
|
|
32
|
+
// Detect current shell
|
|
33
|
+
function detectShell() {
|
|
34
|
+
if (IS_WIN) {
|
|
35
|
+
const shell = (process.env.COMSPEC || '').toLowerCase();
|
|
36
|
+
if (process.env.PSModulePath) return 'powershell';
|
|
37
|
+
if (shell.includes('cmd.exe')) return 'cmd';
|
|
38
|
+
return 'powershell'; // default windows fallback
|
|
39
|
+
}
|
|
40
|
+
const shell = process.env.SHELL || '';
|
|
41
|
+
if (shell.includes('zsh')) return 'zsh';
|
|
42
|
+
if (shell.includes('bash')) return 'bash';
|
|
43
|
+
if (shell.includes('fish')) return 'fish';
|
|
44
|
+
return 'bash'; // fallback
|
|
45
|
+
}
|
|
46
|
+
const SHELL = detectShell();
|
|
31
47
|
|
|
32
48
|
// ─── Logging ─────────────────────────────────────────────────────────────────
|
|
33
49
|
function log(msg) { process.stdout.write(msg + '\n'); }
|
|
@@ -97,15 +113,20 @@ function getRcFiles() {
|
|
|
97
113
|
const ps = path.join(HOME, 'Documents', 'WindowsPowerShell', 'Microsoft.PowerShell_profile.ps1');
|
|
98
114
|
return [ps];
|
|
99
115
|
}
|
|
100
|
-
const files = [];
|
|
101
116
|
const zshrc = path.join(HOME, '.zshrc');
|
|
102
117
|
const bashrc = path.join(HOME, '.bashrc');
|
|
103
118
|
const bashProfile = path.join(HOME, '.bash_profile');
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (
|
|
108
|
-
return
|
|
119
|
+
const fishConfig = path.join(HOME, '.config', 'fish', 'config.fish');
|
|
120
|
+
|
|
121
|
+
// Write only to the active shell's rc file
|
|
122
|
+
if (SHELL === 'zsh') return [zshrc];
|
|
123
|
+
if (SHELL === 'fish') return [fishConfig];
|
|
124
|
+
// bash: prefer .bashrc, fallback .bash_profile
|
|
125
|
+
if (fs.existsSync(bashrc)) return [bashrc];
|
|
126
|
+
if (fs.existsSync(bashProfile)) return [bashProfile];
|
|
127
|
+
// fallback: create .bashrc
|
|
128
|
+
fs.writeFileSync(bashrc, '');
|
|
129
|
+
return [bashrc];
|
|
109
130
|
}
|
|
110
131
|
|
|
111
132
|
function appendToRc(block) {
|
|
@@ -374,7 +395,23 @@ async function ssoLogin() {
|
|
|
374
395
|
// ─── Step 5: Write API key to rc ─────────────────────────────────────────────
|
|
375
396
|
function writeApiKeyToRc(apiKey) {
|
|
376
397
|
step('PATTY_AGENT_API_KEY 환경변수 등록 중...');
|
|
377
|
-
|
|
398
|
+
|
|
399
|
+
if (IS_WIN) {
|
|
400
|
+
// PowerShell profile (new PS sessions)
|
|
401
|
+
appendToRc(`# pattyeng — Patty Agent API Key\n$env:PATTY_AGENT_API_KEY = "${apiKey}"`);
|
|
402
|
+
// setx: Windows user-level env var — persists across ALL new terminals (cmd, PS, git bash)
|
|
403
|
+
try {
|
|
404
|
+
execSync(`setx PATTY_AGENT_API_KEY "${apiKey}"`, { stdio: 'pipe' });
|
|
405
|
+
log(' → Windows 사용자 환경변수 등록 완료 (setx)');
|
|
406
|
+
} catch (e) {
|
|
407
|
+
warn('setx 실패: ' + e.message);
|
|
408
|
+
}
|
|
409
|
+
} else if (SHELL === 'fish') {
|
|
410
|
+
appendToRc(`# pattyeng — Patty Agent API Key\nset -Ux PATTY_AGENT_API_KEY "${apiKey}"`);
|
|
411
|
+
} else {
|
|
412
|
+
appendToRc(`# pattyeng — Patty Agent API Key\nexport PATTY_AGENT_API_KEY="${apiKey}"`);
|
|
413
|
+
}
|
|
414
|
+
|
|
378
415
|
process.env.PATTY_AGENT_API_KEY = apiKey;
|
|
379
416
|
ok('PATTY_AGENT_API_KEY 등록 완료');
|
|
380
417
|
}
|
|
@@ -415,7 +452,10 @@ function addCodexAlias() {
|
|
|
415
452
|
fs.writeFileSync(rc, content);
|
|
416
453
|
log(` → 기존 alias에 -p patty 추가: ${rc}`);
|
|
417
454
|
} else {
|
|
418
|
-
|
|
455
|
+
const aliasLine = SHELL === 'fish'
|
|
456
|
+
? '\n# pattyeng — codex -p patty alias\nalias codex \'codex -p patty\'\n'
|
|
457
|
+
: '\n# pattyeng — codex -p patty alias\nalias codex="codex -p patty"\n';
|
|
458
|
+
fs.appendFileSync(rc, aliasLine);
|
|
419
459
|
log(` → 새 alias 추가: ${rc}`);
|
|
420
460
|
}
|
|
421
461
|
}
|
|
@@ -437,9 +477,11 @@ ${username ? ` 👤 로그인: ${username}\n` : ''}
|
|
|
437
477
|
|
|
438
478
|
📋 마지막 단계 (딱 한 번만):
|
|
439
479
|
지금 터미널에 이 명령어 하나만 실행하세요:
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
480
|
+
${IS_WIN
|
|
481
|
+
? '\n > 터미널을 닫고 새로 열기\n (환경변수는 setx로 이미 영구 등록되었습니다)\n'
|
|
482
|
+
: SHELL === 'zsh' ? '\n $ exec zsh\n'
|
|
483
|
+
: SHELL === 'fish' ? '\n $ exec fish\n'
|
|
484
|
+
: '\n $ exec bash\n'}
|
|
443
485
|
💡 그 다음부터는 바로 사용 가능:
|
|
444
486
|
$ codex "안녕하세요!"
|
|
445
487
|
$ codex --session xyz "작업 시작"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pattyeng",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Patty Engineering CLI - Codex SSO setup tool",
|
|
5
5
|
"bin": {
|
|
6
6
|
"pattyeng": "./bin/pattyeng.js"
|
|
@@ -15,7 +15,12 @@
|
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=18.0.0"
|
|
17
17
|
},
|
|
18
|
-
"keywords": [
|
|
18
|
+
"keywords": [
|
|
19
|
+
"patty",
|
|
20
|
+
"codex",
|
|
21
|
+
"cli",
|
|
22
|
+
"engineering"
|
|
23
|
+
],
|
|
19
24
|
"license": "MIT",
|
|
20
25
|
"publishConfig": {
|
|
21
26
|
"access": "public"
|