@quangnv13/nonstop 1.0.7 → 1.0.8
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 +3 -0
- package/README.vi.md +3 -0
- package/dist/store.js +4 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -97,6 +97,9 @@ nonstop
|
|
|
97
97
|
|
|
98
98
|
## 🕹️ Usage Guide
|
|
99
99
|
|
|
100
|
+
> [!IMPORTANT]
|
|
101
|
+
> **No workspaces are auto-generated on first launch.** To start working on any folder, you must first configure/create a workspace mapping to that folder (either via the local TUI Control Center or the Telegram Bot's `📁 Workspaces` menu).
|
|
102
|
+
|
|
100
103
|
### 1. Local TUI Control Center
|
|
101
104
|
Simply run `nonstop` in your terminal to open the management dashboard. From here, you can:
|
|
102
105
|
* **Start / Stop** the background bot runtime.
|
package/README.vi.md
CHANGED
|
@@ -97,6 +97,9 @@ nonstop
|
|
|
97
97
|
|
|
98
98
|
## 🕹️ Hướng Dẫn Sử Dụng
|
|
99
99
|
|
|
100
|
+
> [!IMPORTANT]
|
|
101
|
+
> **Không có workspace nào được tự động tạo sẵn trong lần chạy đầu tiên.** Để bắt đầu làm việc trên thư mục mong muốn, bạn phải tạo/cấu hình ít nhất một workspace liên kết với thư mục đó (thông qua Trung tâm điều khiển TUI cục bộ hoặc menu `📁 Workspaces` của Bot Telegram).
|
|
102
|
+
|
|
100
103
|
### 1. Trung Tâm Điều Khiển TUI Cục Bộ
|
|
101
104
|
Chỉ cần chạy lệnh `nonstop` trên terminal của bạn để mở giao diện bảng điều khiển. Từ đây bạn có thể:
|
|
102
105
|
* **Khởi động / Dừng (Start / Stop)** bot chạy ẩn.
|
package/dist/store.js
CHANGED
|
@@ -52,26 +52,22 @@ exports.workspacesFilePath = path.join(exports.DATA_DIR, 'workspaces.json');
|
|
|
52
52
|
function loadWorkspaces() {
|
|
53
53
|
ensureDataDir();
|
|
54
54
|
if (!fs.existsSync(exports.workspacesFilePath)) {
|
|
55
|
-
return
|
|
55
|
+
return [];
|
|
56
56
|
}
|
|
57
57
|
try {
|
|
58
58
|
const raw = fs.readFileSync(exports.workspacesFilePath, 'utf8');
|
|
59
59
|
const parsed = JSON.parse(raw);
|
|
60
60
|
if (!Array.isArray(parsed)) {
|
|
61
|
-
return
|
|
61
|
+
return [];
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
return parsed.filter(isWorkspaceRecord).map((workspace) => ({
|
|
64
64
|
id: workspace.id,
|
|
65
65
|
name: workspace.name,
|
|
66
66
|
path: workspace.path
|
|
67
67
|
}));
|
|
68
|
-
if (workspaces.length === 0) {
|
|
69
|
-
return regenerateDefaultWorkspaces();
|
|
70
|
-
}
|
|
71
|
-
return workspaces;
|
|
72
68
|
}
|
|
73
69
|
catch {
|
|
74
|
-
return
|
|
70
|
+
return [];
|
|
75
71
|
}
|
|
76
72
|
}
|
|
77
73
|
function saveWorkspaces(workspaces) {
|
|
@@ -90,25 +86,3 @@ function isWorkspaceRecord(value) {
|
|
|
90
86
|
typeof record.name === 'string' &&
|
|
91
87
|
typeof record.path === 'string');
|
|
92
88
|
}
|
|
93
|
-
function regenerateDefaultWorkspaces() {
|
|
94
|
-
const rootDir = path.resolve(exports.DATA_DIR, '..');
|
|
95
|
-
const defaultWorkspaces = [
|
|
96
|
-
{
|
|
97
|
-
id: 'ws_root',
|
|
98
|
-
name: 'Project Root',
|
|
99
|
-
path: rootDir.replace(/\\/g, '/')
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: 'ws_src',
|
|
103
|
-
name: 'Source',
|
|
104
|
-
path: path.join(rootDir, 'src').replace(/\\/g, '/')
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
id: 'ws_docs',
|
|
108
|
-
name: 'Docs',
|
|
109
|
-
path: path.join(rootDir, 'docs').replace(/\\/g, '/')
|
|
110
|
-
}
|
|
111
|
-
];
|
|
112
|
-
saveWorkspaces(defaultWorkspaces);
|
|
113
|
-
return defaultWorkspaces;
|
|
114
|
-
}
|