@leejungkiin/awkit 1.3.4 → 1.3.7

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/bin/awk.js CHANGED
@@ -27,6 +27,7 @@ const fs = require('fs');
27
27
  const path = require('path');
28
28
  const https = require('https');
29
29
  const { execSync, spawnSync } = require('child_process');
30
+ const os = require('os');
30
31
 
31
32
  const packageJson = require(path.join(__dirname, '..', 'package.json'));
32
33
  const AWK_VERSION = packageJson.version;
@@ -1817,9 +1818,11 @@ async function cmdInit(forceFlag = false) {
1817
1818
  });
1818
1819
 
1819
1820
  const question = (query) => new Promise(resolve => rl.question(query, resolve));
1821
+ // Sanitize: strip ALL whitespace (spaces, tabs, newlines) from pasted input
1822
+ const sanitize = (s) => s.replace(/\s+/g, '');
1820
1823
 
1821
1824
  try {
1822
- const apiKey = (await question(` ${C.yellow}Enter Trello API Key: ${C.reset}`)).trim();
1825
+ const apiKey = sanitize(await question(` ${C.yellow}Enter Trello API Key: ${C.reset}`));
1823
1826
 
1824
1827
  if (apiKey) {
1825
1828
  const tokenUrl = `https://trello.com/1/authorize?expiration=never&scope=read,write&response_type=token&key=${apiKey}&name=AWKit`;
@@ -1829,7 +1832,7 @@ async function cmdInit(forceFlag = false) {
1829
1832
  log('');
1830
1833
  }
1831
1834
 
1832
- const apiToken = (await question(` ${C.yellow}Enter Trello API Token: ${C.reset}`)).trim();
1835
+ const apiToken = sanitize(await question(` ${C.yellow}Enter Trello API Token: ${C.reset}`));
1833
1836
 
1834
1837
  if (apiKey && apiToken) {
1835
1838
  let profilePath = path.join(os.homedir(), '.zshrc');
@@ -1840,13 +1843,17 @@ async function cmdInit(forceFlag = false) {
1840
1843
  const exportLines = `\n# Trello API Credentials for AWKit\nexport TRELLO_KEY="${apiKey}"\nexport TRELLO_TOKEN="${apiToken}"\n`;
1841
1844
  fs.appendFileSync(profilePath, exportLines);
1842
1845
 
1843
- ok(`Credentials saved to ${profilePath}`);
1844
- log(` ${C.cyan}👉 Please run 'source ~/${path.basename(profilePath)}' or restart your terminal to apply them.${C.reset}`);
1846
+ // Also inject into current process so immediate awkit trello calls work
1847
+ process.env.TRELLO_KEY = apiKey;
1848
+ process.env.TRELLO_TOKEN = apiToken;
1849
+
1850
+ ok(`Credentials saved to ${path.basename(profilePath)} ✅`);
1851
+ log(` ${C.green}👉 Trello is ready! Credentials are active for this session and all future terminals.${C.reset}`);
1845
1852
  } else {
1846
1853
  warn('Setup skipped. Automated Trello sync will be disabled.');
1847
1854
  }
1848
1855
  } catch (e) {
1849
- warn('Failed to setup Trello interactively.');
1856
+ warn(`Failed to setup Trello: ${e.message}`);
1850
1857
  } finally {
1851
1858
  rl.close();
1852
1859
  }
@@ -2207,7 +2214,7 @@ function cmdTrello(args) {
2207
2214
  switch (subCmd) {
2208
2215
  case 'desc':
2209
2216
  info(`Updating card description...`);
2210
- trelloExec(['card:update', '--desc', text]);
2217
+ trelloExec(['card:update', '--description', text]);
2211
2218
  break;
2212
2219
 
2213
2220
  case 'comment':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leejungkiin/awkit",
3
- "version": "1.3.4",
3
+ "version": "1.3.7",
4
4
  "description": "Antigravity Workflow Kit. Unified AI agent orchestration system.",
5
5
  "main": "bin/awk.js",
6
6
  "bin": {
@@ -40,4 +40,4 @@
40
40
  "@leejungkiin/awkit-symphony": "^0.1.0",
41
41
  "@leejungkiin/gitnexus": "file:../gitnexus/gitnexus"
42
42
  }
43
- }
43
+ }
@@ -42,17 +42,15 @@ KHÔNG CÓ NGOẠI LỆ:
42
42
 
43
43
  ## 🔐 Auth & Config
44
44
 
45
- Bảo mật: API Key Token được lưu tại Global, cấu hình dự án (Board/List/Card) lưu tại Local.
45
+ Credentials được lưu dưới dạng **environment variables** (`TRELLO_KEY`, `TRELLO_TOKEN`) trong shell profile (`~/.zshrc` hoặc `~/.bashrc`). Cấu hình dự án (Board/List/Card) lưu tại `.trello-config.json` ở root mỗi dự án.
46
46
 
47
- ### 1. Global Credentials (đặt tại `~/.gemini/antigravity/credentials/trello.json`)
48
- ```json
49
- {
50
- "api_key": "YOUR_TRELLO_API_KEY",
51
- "api_token": "YOUR_TRELLO_API_TOKEN"
52
- }
53
- ```
47
+ ### 1. Global Credentials (Environment Variables)
48
+
49
+ User setup lần đầu qua **interactive wizard** khi chạy `awkit init`:
50
+ - CLI tự hỏi API Key → tạo link authorize token → hỏi Token → lưu vào `~/.zshrc`.
51
+ - Nếu user đã setup rồi, CLI tự skip bước này.
54
52
 
55
- ### 2. Local Project Config (đặt file `.trello-config.json` tại root mỗi dự án)
53
+ ### 2. Local Project Config (`.trello-config.json` tại root dự án)
56
54
  ```json
57
55
  {
58
56
  "board": "Appdexter - Code Magic",
@@ -67,9 +65,21 @@ Bảo mật: API Key và Token được lưu tại Global, cấu hình dự án
67
65
  | `list` | Tên list chứa card (= team member đang phụ trách) |
68
66
  | `card` | Tên card dự án (phải khớp chính xác trên Trello) |
69
67
 
68
+ ### 🔄 Credential Auto-Recovery (BẮT BUỘC cho AI)
69
+
70
+ Khi `awkit trello` báo **"Trello credentials not found"**, AI PHẢI thực hiện:
71
+
72
+ ```text
73
+ Lần 1: chạy `source ~/.zshrc` → retry lệnh awkit trello
74
+ Lần 2: chạy `source ~/.zshrc` → retry lệnh awkit trello
75
+ Lần 3 (vẫn lỗi): báo user "Trello chưa được cấu hình. Vui lòng chạy awkit init để setup lại."
76
+ ```
77
+
78
+ > ⚠️ KHÔNG được tự tạo script, tự inject biến, hay tự sửa file `.zshrc`. CHỈ dùng `source` và `awkit init`.
79
+
70
80
  ### Tự Động Hóa Qua `awkit trello` (BẮT BUỘC)
71
81
 
72
- AI không cần tự inject ENV hay tìm kiếm cấu hình. Công cụ lệnh `awkit trello` v1.3.0+ sẽ TỰ ĐỘNG đọc từ Global ConfigLocal Config để thực thi nhanh chóng. MỌI thao tác Trello phải đi qua `awkit trello`.
82
+ AI không cần tự inject ENV hay tìm kiếm cấu hình. Công cụ lệnh `awkit trello` v1.3.0+ sẽ TỰ ĐỘNG đọc từ env vars`.trello-config.json`. MỌI thao tác Trello phải đi qua `awkit trello`.
73
83
  ---
74
84
 
75
85
  ## 📚 Command Reference
@@ -198,12 +208,13 @@ Trong comment, **PHẢI** ghi Symphony Task ID: `Symphony: #sym-XXX`
198
208
  | Tình huống | Xử lý |
199
209
  |-----------|--------|
200
210
  | `.trello-config.json` không tồn tại | ⛔ Bỏ qua Trello sync, log cảnh báo, tiếp tục code |
211
+ | **Credentials not found** | `source ~/.zshrc` → retry (max 2 lần). Vẫn lỗi → báo user chạy `awkit init` |
201
212
  | Card not found | Chạy `sync`, retry. Nếu vẫn lỗi → báo user |
202
- | Checklist chưa có | Tạo checklist mới bằng `card:checklist` |
213
+ | Checklist chưa có | Tạo checklist mới bằng `awkit trello checklist` |
203
214
  | Item trùng tên | Dùng `card:checklists` kiểm tra trước khi thêm |
204
- | Rate limit / API error | Log warning, tiếp tục code, KHÔNG block flow |
205
- | Token hết hạn | Báo user refresh trong `.trello-config.json` |
206
- | Dự án chưa có card trên Trello | Báo user tạo card trên board, cập nhật config |
215
+ | Rate limit / API error | Log warning, tiếp tục code, KHÔNG block flow. CLI tự retry 429. |
216
+ | Token hết hạn | Báo user chạy `awkit init` để setup lại credential mới |
217
+ | Dự án chưa có card trên Trello | Báo user tạo card trên board, cập nhật `.trello-config.json` |
207
218
 
208
219
  ---
209
220