@nbtca/prompt 1.3.2 → 1.4.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.
Files changed (69) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +45 -1
  3. package/SECURITY.md +47 -0
  4. package/dist/app/app.js +202 -0
  5. package/dist/app/chrome.js +104 -0
  6. package/dist/app/fields/list-field.js +174 -0
  7. package/dist/app/fields/text-field.js +38 -0
  8. package/dist/app/frame.js +48 -0
  9. package/dist/app/keys.js +20 -0
  10. package/dist/app/tabs.js +11 -0
  11. package/dist/app/view.js +1 -0
  12. package/dist/app/views/docs-render.js +82 -0
  13. package/dist/app/views/docs.js +450 -0
  14. package/dist/app/views/events-render.js +111 -0
  15. package/dist/app/views/events.js +228 -0
  16. package/dist/app/views/home.js +195 -0
  17. package/dist/app/views/schedule-grid-cursor.js +52 -0
  18. package/dist/app/views/schedule-render.js +317 -0
  19. package/dist/app/views/schedule.js +463 -0
  20. package/dist/app/views/settings-render.js +53 -0
  21. package/dist/app/views/settings.js +153 -0
  22. package/dist/auth/cookie-transport.js +222 -0
  23. package/dist/auth/errors.js +18 -0
  24. package/dist/auth/nbt-auth.js +239 -0
  25. package/dist/auth/session-store.js +118 -0
  26. package/dist/config/data.js +1 -2
  27. package/dist/config/paths.js +22 -2
  28. package/dist/core/canvas.js +23 -0
  29. package/dist/core/capabilities.js +42 -0
  30. package/dist/core/components/confirm.js +75 -0
  31. package/dist/core/components/input-session.js +24 -0
  32. package/dist/core/components/menu.js +122 -0
  33. package/dist/core/components/messages.js +16 -0
  34. package/dist/core/components/note.js +18 -0
  35. package/dist/core/components/painter.js +26 -0
  36. package/dist/core/components/screen.js +18 -0
  37. package/dist/core/components/spinner.js +47 -0
  38. package/dist/core/components/text-input.js +98 -0
  39. package/dist/core/logo.js +33 -22
  40. package/dist/core/menu.js +24 -9
  41. package/dist/core/motion.js +86 -0
  42. package/dist/core/text.js +121 -5
  43. package/dist/core/theme.js +61 -0
  44. package/dist/core/transitions.js +19 -0
  45. package/dist/core/ui.js +4 -45
  46. package/dist/features/calendar-heatmap.js +29 -27
  47. package/dist/features/calendar-query.js +50 -0
  48. package/dist/features/calendar.js +192 -98
  49. package/dist/features/docs.js +222 -61
  50. package/dist/features/links.js +7 -7
  51. package/dist/features/schedule-query.js +47 -0
  52. package/dist/features/schedule-render.js +573 -0
  53. package/dist/features/schedule-store.js +73 -0
  54. package/dist/features/schedule-view.js +253 -0
  55. package/dist/features/settings.js +43 -35
  56. package/dist/features/status.js +37 -16
  57. package/dist/features/student-timetable.js +346 -0
  58. package/dist/features/theme.js +0 -3
  59. package/dist/features/update.js +16 -18
  60. package/dist/i18n/index.js +5 -47
  61. package/dist/i18n/locales/en.json +149 -6
  62. package/dist/i18n/locales/zh.json +149 -6
  63. package/dist/index.js +61 -11
  64. package/dist/logo/ca-dotmatrix-large.txt +26 -0
  65. package/dist/logo/ca-dotmatrix-small.txt +12 -0
  66. package/dist/logo/ca-dotmatrix.txt +18 -16
  67. package/dist/logo/ca-logo.png +0 -0
  68. package/dist/main.js +33 -13
  69. package/package.json +18 -12
@@ -1,16 +1,18 @@
1
- ⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⡶⢞⢛⣛⣛⣛⣛⣛⡳⠶⣦⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀
2
- ⠀⠀⠀⠀⠀⢀⣤⠾⡋⠁⠘⢽⣛⣿⣯⣿⣭⣯⣿⣛⡁⢴⣮⡝⠷⣤⡀⠀⠀⠀⠀⠀
3
- ⠀⠀⠀⢀⣴⢟⣵⡿⣻⡵⠞⠋⠉⠀⠀⠀⠀⠀⠀⠉⠙⠳⢮⣟⢷⣎⡻⣦⡀⠀⠀⠀
4
- ⠀⠀⣠⡟⣵⡦⣩⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⣝⢿⣎⣻⣄⠀⠀
5
- ⠀⣰⠏⣼⣎⣾⡥⠶⠶⠶⠶⢤⣀⠀⠀⠀⠀⠀⣠⡤⠶⠶⠶⠦⣄⡈⢷⣻⣯⠹⣆⠀
6
- ⢰⣟⣾⣿⣾⣥⠀⢀⣀⣀⣀⡀⠈⠳⡄⠀⣴⣯⣅⠀⢀⣀⣀⣀⠀⠙⢮⣷⡹⣃⢻⡆
7
- ⣾⢱⣬⣿⣿⣿⠟⠋⠉⠀⠈⠉⠳⣄⣿⠐⣿⣿⣿⠞⠉⠉⠉⠉⠙⢦⣀⡟⣧⠿⠬⣷
8
- ⣿⢸⡅⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⢰⣶⣿
9
- ⣿⢨⣁⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⢸⢿⣿
10
- ⢿⡸⣿⢿⡄⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⠃⢠⡟⠈⢉⡿
11
- ⠸⣧⢷⣏⢷⠘⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠏⠀⡾⣭⡷⣿⠇
12
- ⠀⠹⣎⢽⣎⢷⡘⢧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⠋⢀⡾⣵⡦⣰⠏⠀
13
- ⠀⠀⠙⣧⡻⣷⣝⢦⡙⠲⣤⣀⠀⠀⠀⠀⠀⠀⠀⢀⣠⡴⠋⢁⡴⣫⣌⢛⣼⠋⠀⠀
14
- ⠀⠀⠀⠈⠻⣮⡿⣡⣽⡳⢤⣍⡙⠓⠒⠶⠖⠒⠛⢉⣡⡤⣞⣫⣦⢙⣵⠟⠁⠀⠀⠀
15
- ⠀⠀⠀⠀⠀⠈⠛⢷⣍⡁⠷⣞⣭⣟⣟⣟⣛⢛⣿⣭⣵⠆⢛⣩⡷⠛⠁⠀⠀⠀⠀⠀
16
- ⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠻⠶⢯⣭⣭⣭⣭⣭⣭⡽⠶⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀
1
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⠤⠶⠒⠛⠛⢛⠛⠛⠛⠒⠶⠤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2
+ ⠀⠀⠀⠀⠀⠀⠀⣠⡴⠚⠉⠀⢎⠔⠕⢃⣊⣐⣋⣚⣃⠛⠄⢀⣴⢉⠓⢦⣄⠀⠀⠀⠀⠀⠀⠀
3
+ ⠀⠀⠀⠀⠀⣠⠞⢁⠂⠲⣀⡤⠖⠚⠉⠉⠀⠀⠀⠀⠉⠉⠓⠲⢬⣘⠰⠂⠈⠳⣄⠀⠀⠀⠀⠀
4
+ ⠀⠀⠀⣠⠞⢁⠈⢕⡠⠚⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠓⢬⡡⠡⠈⠳⣄⠀⠀⠀
5
+ ⠀⠀⣰⠋⢄⠑⣠⠊⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣌⠪⡂⠙⣆⠀⠀
6
+ ⠀⣰⠃⠸⠁⡼⠓⠋⠉⠁⠀⠉⠉⠒⢄⠀⠀⠀⠀⢀⠴⠒⠉⠉⠉⠉⠉⠒⢤⡈⢧⠈⠃⠘⣆⠀
7
+ ⢠⡇⠴⢫⣾⣶⣆⠀⣀⠤⠤⠤⢄⡀⠀⠑⡄⠀⣴⣷⣦⠀⢀⣀⠤⠤⢄⡀⠀⠈⢎⣇⢈⢀⢸⡄
8
+ ⣼⠀⠒⢸⣿⣿⠟⠉⠀⠀⠀⠀⠀⠈⠢⠤⠇⠀⢿⣿⡿⠋⠁⠀⠀⠀⠀⠈⠑⢄⡸⢸⡌⠑⠂⣧
9
+ ⣿⢀⣉⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠠⠂⣿
10
+ ⣿⠀⣉⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠫⠅⣿
11
+ ⢻⠀⣕⠺⡇⠸⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠇⠀⢸⠃⠉⠁⡟
12
+ ⠘⡇⠨⡅⢹⡀⢣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡼⠀⢀⡏⣀⠤⢸⠃
13
+ ⠀⠹⡄⠪⡂⠳⡀⠳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡜⠁⢀⡞⣀⠀⢠⠏⠀
14
+ ⠀⠀⠹⣄⢩⡢⡙⢄⠈⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡤⠊⠀⣠⠋⢔⠄⣡⠏⠀⠀
15
+ ⠀⠀⠀⠙⢦⡀⢢⢆⠑⢤⡈⠑⠦⢄⣀⡀⠀⠀⠀⠀⣀⣠⠤⠒⠉⢀⡤⠚⢕⠵⢀⡴⠋⠀⠀⠀
16
+ ⠀⠀⠀⠀⠀⠙⢦⡁⠠⠀⡌⠓⠦⢤⣀⣉⠉⠉⠉⠉⣀⣀⡤⠴⠚⢉⢔⠕⢀⡴⠋⠀⠀⠀⠀⠀
17
+ ⠀⠀⠀⠀⠀⠀⠀⠙⠳⢤⣀⠂⠱⠄⢄⠈⣍⢍⣭⢩⢁⣤⠢⠞⠀⣉⡤⠞⠋⠀⠀⠀⠀⠀⠀⠀
18
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠒⠶⠤⣤⣤⣥⣬⣤⣤⠤⠶⠒⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
Binary file
package/dist/main.js CHANGED
@@ -1,4 +1,4 @@
1
- import { printLogo } from './core/logo.js';
1
+ import { runStartup } from './core/logo.js';
2
2
  import { clearScreen, handleGracefulExit } from './core/ui.js';
3
3
  import { showMainMenu } from './core/menu.js';
4
4
  import { c } from './core/theme.js';
@@ -12,19 +12,39 @@ export async function main(options = {}) {
12
12
  clearScreen();
13
13
  }
14
14
  if (!options.skipLogo) {
15
- printLogo();
15
+ await runStartup();
16
+ }
17
+ // Fire update check in background; events fetch provides natural wait time.
18
+ // Its own AbortController is tied to whichever path finishes first, so a
19
+ // still-in-flight request never keeps the process alive after we're done
20
+ // with (or have stopped caring about) its result.
21
+ const updateAbort = new AbortController();
22
+ const updatePromise = checkForUpdate(updateAbort.signal);
23
+ if (process.stdin.isTTY && process.stdout.isTTY) {
24
+ // Launch app shell for interactive terminals
25
+ const { runApp } = await import('./app/app.js');
26
+ await runApp();
27
+ updateAbort.abort();
28
+ }
29
+ else {
30
+ // Classic path for non-TTY (CI, pipes, redirects)
31
+ await showEventsPreview();
32
+ try {
33
+ const line = (await import('./features/schedule-view.js')).peekNextClassLine();
34
+ if (line)
35
+ console.log(line);
36
+ }
37
+ catch { /* best effort */ }
38
+ // Update check is very likely done by now; give it a short window if not
39
+ const updateMsg = await Promise.race([
40
+ updatePromise,
41
+ new Promise(r => setTimeout(r, 100, null)),
42
+ ]);
43
+ updateAbort.abort();
44
+ if (updateMsg)
45
+ console.log(c.warn(updateMsg));
46
+ await showMainMenu();
16
47
  }
17
- // Fire update check in background; events fetch provides natural wait time
18
- const updatePromise = checkForUpdate();
19
- await showEventsPreview();
20
- // Update check is very likely done by now; give it a short window if not
21
- const updateMsg = await Promise.race([
22
- updatePromise,
23
- new Promise(r => setTimeout(r, 100, null)),
24
- ]);
25
- if (updateMsg)
26
- console.log(c.warn(updateMsg));
27
- await showMainMenu();
28
48
  }
29
49
  catch (err) {
30
50
  handleGracefulExit(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nbtca/prompt",
3
- "version": "1.3.2",
3
+ "version": "1.4.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -14,6 +14,7 @@
14
14
  "dist",
15
15
  "bin/nbtca-welcome.js",
16
16
  "README.md",
17
+ "SECURITY.md",
17
18
  "LICENSE"
18
19
  ],
19
20
  "scripts": {
@@ -32,27 +33,29 @@
32
33
  "terminal",
33
34
  "welcome",
34
35
  "nbtca",
35
- "ningbotech",
36
- "computer-association",
36
+ "community",
37
+ "calendar",
37
38
  "tui",
38
39
  "interactive"
39
40
  ],
40
41
  "dependencies": {
41
- "@clack/prompts": "^1.2.0",
42
- "@nbtca/docs": "^0.2.0",
43
- "@nbtca/nbtcal": "^0.3.0",
42
+ "@nbtca/docs": "^0.2.3",
43
+ "@nbtca/nbtcal": "^0.3.7",
44
44
  "chalk": "^5.6.2",
45
+ "cheerio": "1.0.0",
46
+ "fetch-cookie": "^3.2.0",
45
47
  "gradient-string": "^3.0.0",
46
48
  "marked": "^15.0.12",
47
49
  "marked-terminal": "^7.0.0",
48
- "open": "^11.0.0"
50
+ "open": "^11.0.0",
51
+ "tough-cookie": "^6.0.2"
49
52
  },
50
53
  "devDependencies": {
51
54
  "@types/gradient-string": "^1.1.6",
52
- "@types/node": "^22.19.17",
53
- "tsx": "^4.21.0",
55
+ "@types/node": "^22.20.1",
56
+ "tsx": "^4.23.5",
54
57
  "typescript": "^5.9.3",
55
- "vitest": "^3.2.4"
58
+ "vitest": "^3.2.7"
56
59
  },
57
60
  "engines": {
58
61
  "node": ">=20.12.0"
@@ -64,11 +67,14 @@
64
67
  },
65
68
  "repository": {
66
69
  "type": "git",
67
- "url": "https://github.com/nbtca/prompt.git"
70
+ "url": "git+https://github.com/nbtca/prompt.git"
68
71
  },
69
72
  "bugs": {
70
73
  "url": "https://github.com/nbtca/prompt/issues"
71
74
  },
72
75
  "homepage": "https://github.com/nbtca/prompt#readme",
73
- "description": "NBTCA Prompt - Minimalist CLI tool for NingboTech Computer Association"
76
+ "description": "Terminal information system for the NBTCA community",
77
+ "directories": {
78
+ "doc": "docs"
79
+ }
74
80
  }