pattyeng 1.0.1 → 1.0.3
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/README.md +113 -0
- package/lib/install.js +38 -10
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# pattyeng
|
|
2
|
+
|
|
3
|
+
Patty Engineering 팀을 위한 CLI 도구입니다.
|
|
4
|
+
Codex 설치, SSO 로그인, 환경변수 등록을 한 번에 자동으로 처리합니다.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 필요 조건
|
|
9
|
+
|
|
10
|
+
- **Node.js** 18 이상
|
|
11
|
+
- **npm** 설치되어 있을 것
|
|
12
|
+
- **Patty 계정** (`@patty.io` 이메일)
|
|
13
|
+
- **pattyeng 그룹** 멤버일 것 (관리자에게 요청)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 설치 방법
|
|
18
|
+
|
|
19
|
+
### 1단계 — pattyeng CLI 설치
|
|
20
|
+
|
|
21
|
+
터미널을 열고 아래 명령어를 실행하세요:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g pattyeng
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 2단계 — Codex 설치 및 SSO 로그인
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pattyeng install codex
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
실행하면 아래 작업이 **자동으로** 진행됩니다:
|
|
34
|
+
|
|
35
|
+
| 순서 | 작업 |
|
|
36
|
+
|------|------|
|
|
37
|
+
| ① | Codex 설치 확인 및 최신 버전 업데이트 |
|
|
38
|
+
| ② | Patty 설정 파일 (`patty.config.toml`) 복사 |
|
|
39
|
+
| ③ | 브라우저 자동 열림 → Patty 계정으로 로그인 |
|
|
40
|
+
| ④ | `PATTY_AGENT_API_KEY` 환경변수 자동 등록 |
|
|
41
|
+
| ⑤ | `codex` 명령어에 Patty 설정 자동 적용 |
|
|
42
|
+
|
|
43
|
+
### 3단계 — 터미널 재시작
|
|
44
|
+
|
|
45
|
+
**Mac / Linux / WSL:**
|
|
46
|
+
```bash
|
|
47
|
+
exec zsh # zsh 사용자
|
|
48
|
+
exec bash # bash 사용자
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Windows:**
|
|
52
|
+
터미널을 닫고 새로 여세요. (환경변수는 이미 자동 등록됨)
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 완료 확인
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
codex "안녕하세요!"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
위 명령어가 실행되면 설치 완료입니다 🎉
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## 자주 묻는 질문
|
|
67
|
+
|
|
68
|
+
**Q. 브라우저가 자동으로 안 열려요.**
|
|
69
|
+
|
|
70
|
+
터미널에 출력된 `🔗 로그인 URL`을 복사해서 브라우저에 직접 붙여넣으세요.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
**Q. "pattyeng 그룹에 속하지 않습니다" 오류가 나요.**
|
|
75
|
+
|
|
76
|
+
관리자에게 `pattyeng` 그룹 추가를 요청하세요.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
**Q. `codex` 명령어가 없다고 나와요.**
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm install -g @openai/codex
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
**Q. Windows에서 `setx` 오류가 나요.**
|
|
89
|
+
|
|
90
|
+
관리자 권한으로 터미널을 열고 다시 실행하세요.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
**Q. 이미 설치했는데 다시 실행해도 되나요?**
|
|
95
|
+
|
|
96
|
+
네, 안전합니다. 이미 등록된 항목은 건너뜁니다.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 지원 환경
|
|
101
|
+
|
|
102
|
+
| 환경 | 지원 여부 |
|
|
103
|
+
|------|----------|
|
|
104
|
+
| macOS (zsh / bash) | ✅ |
|
|
105
|
+
| Linux (zsh / bash / fish) | ✅ |
|
|
106
|
+
| WSL 2 | ✅ |
|
|
107
|
+
| Windows (PowerShell / CMD) | ✅ |
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## 문의
|
|
112
|
+
|
|
113
|
+
Patty Engineering 슬랙 채널로 문의하세요.
|
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) {
|
|
@@ -385,6 +406,8 @@ function writeApiKeyToRc(apiKey) {
|
|
|
385
406
|
} catch (e) {
|
|
386
407
|
warn('setx 실패: ' + e.message);
|
|
387
408
|
}
|
|
409
|
+
} else if (SHELL === 'fish') {
|
|
410
|
+
appendToRc(`# pattyeng — Patty Agent API Key\nset -Ux PATTY_AGENT_API_KEY "${apiKey}"`);
|
|
388
411
|
} else {
|
|
389
412
|
appendToRc(`# pattyeng — Patty Agent API Key\nexport PATTY_AGENT_API_KEY="${apiKey}"`);
|
|
390
413
|
}
|
|
@@ -429,7 +452,10 @@ function addCodexAlias() {
|
|
|
429
452
|
fs.writeFileSync(rc, content);
|
|
430
453
|
log(` → 기존 alias에 -p patty 추가: ${rc}`);
|
|
431
454
|
} else {
|
|
432
|
-
|
|
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);
|
|
433
459
|
log(` → 새 alias 추가: ${rc}`);
|
|
434
460
|
}
|
|
435
461
|
}
|
|
@@ -453,7 +479,9 @@ ${username ? ` 👤 로그인: ${username}\n` : ''}
|
|
|
453
479
|
지금 터미널에 이 명령어 하나만 실행하세요:
|
|
454
480
|
${IS_WIN
|
|
455
481
|
? '\n > 터미널을 닫고 새로 열기\n (환경변수는 setx로 이미 영구 등록되었습니다)\n'
|
|
456
|
-
:
|
|
482
|
+
: SHELL === 'zsh' ? '\n $ exec zsh\n'
|
|
483
|
+
: SHELL === 'fish' ? '\n $ exec fish\n'
|
|
484
|
+
: '\n $ exec bash\n'}
|
|
457
485
|
💡 그 다음부터는 바로 사용 가능:
|
|
458
486
|
$ codex "안녕하세요!"
|
|
459
487
|
$ codex --session xyz "작업 시작"
|