@solarains/va-cli 0.1.1

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 (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +132 -0
  3. package/dist/cli/command-types.js +2 -0
  4. package/dist/cli/help-copy.js +97 -0
  5. package/dist/cli/help.js +29 -0
  6. package/dist/cli/root-command.js +24 -0
  7. package/dist/cli/run-cli.js +107 -0
  8. package/dist/commands/assets/assets-command.js +10 -0
  9. package/dist/commands/assets/list-command.js +52 -0
  10. package/dist/commands/auth/auth-command.js +11 -0
  11. package/dist/commands/auth/login-command.js +127 -0
  12. package/dist/commands/auth/logout-command.js +57 -0
  13. package/dist/commands/doctor/doctor-command.js +33 -0
  14. package/dist/commands/init/init-command.js +19 -0
  15. package/dist/commands/intelligence/intelligence-command.js +10 -0
  16. package/dist/commands/intelligence/query-command.js +109 -0
  17. package/dist/commands/reports/get-command.js +69 -0
  18. package/dist/commands/reports/list-command.js +33 -0
  19. package/dist/commands/reports/reports-command.js +11 -0
  20. package/dist/commands/usage/usage-command.js +27 -0
  21. package/dist/config/locale.js +30 -0
  22. package/dist/config/runtime-config.js +64 -0
  23. package/dist/features/assets/assets-api-client.js +18 -0
  24. package/dist/features/assets/assets-output.js +28 -0
  25. package/dist/features/auth/auth-api-client.js +60 -0
  26. package/dist/features/auth/authenticated-api-client.js +142 -0
  27. package/dist/features/auth/browser-login.js +191 -0
  28. package/dist/features/auth/installation-state.js +65 -0
  29. package/dist/features/auth/loopback-callback-page.js +231 -0
  30. package/dist/features/daily-reports/daily-reports-api-client.js +22 -0
  31. package/dist/features/daily-reports/daily-reports-output.js +54 -0
  32. package/dist/features/init/detect-targets.js +57 -0
  33. package/dist/features/init/init-copy.js +348 -0
  34. package/dist/features/init/init-flow.js +661 -0
  35. package/dist/features/init/installer.js +122 -0
  36. package/dist/features/init/manifest.js +29 -0
  37. package/dist/features/init/presentation.js +147 -0
  38. package/dist/features/init/prompt.js +135 -0
  39. package/dist/features/init/target-registry.js +45 -0
  40. package/dist/features/init/templates.js +84 -0
  41. package/dist/features/init/types.js +2 -0
  42. package/dist/features/intelligence/intelligence-api-client.js +18 -0
  43. package/dist/features/intelligence/intelligence-output.js +36 -0
  44. package/dist/features/intelligence/intelligence-query-state.js +20 -0
  45. package/dist/features/usage/usage-api-client.js +7 -0
  46. package/dist/features/usage/usage-output.js +52 -0
  47. package/dist/main.js +7 -0
  48. package/dist/shared/argv.js +65 -0
  49. package/dist/shared/logger.js +32 -0
  50. package/dist/shared/output.js +22 -0
  51. package/dist/state/paths.js +32 -0
  52. package/dist/state/stores/file-json-store.js +29 -0
  53. package/dist/state/stores/installation-store.js +20 -0
  54. package/dist/state/stores/token-store.js +20 -0
  55. package/package.json +19 -0
  56. package/skills/visionalpha-operator/SKILL.md +38 -0
  57. package/skills/visionalpha-operator/agents/openai.yaml +4 -0
  58. package/skills/visionalpha-operator/references/asset-intelligence.md +35 -0
  59. package/skills/visionalpha-operator/references/assets.md +29 -0
  60. package/skills/visionalpha-operator/references/auth-recovery.md +26 -0
  61. package/skills/visionalpha-operator/references/daily-reports.md +30 -0
  62. package/skills/visionalpha-operator/references/usage-summary.md +24 -0
@@ -0,0 +1,348 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatInstallLocationLabel = formatInstallLocationLabel;
4
+ exports.getInitCopy = getInitCopy;
5
+ function describeTargetSurface(locale, surface, targetId) {
6
+ if (locale === 'zh-CN') {
7
+ if (surface === 'workspace') {
8
+ return targetId === 'openclaw'
9
+ ? '检测到当前项目的 skills 目录'
10
+ : `检测到当前项目的 .${targetId === 'claude' ? 'claude' : 'codex'} 目录`;
11
+ }
12
+ return targetId === 'openclaw'
13
+ ? '检测到全局 ~/.openclaw 目录'
14
+ : `检测到全局 ~/.${targetId === 'claude' ? 'claude' : 'codex'} 目录`;
15
+ }
16
+ if (surface === 'workspace') {
17
+ return targetId === 'openclaw'
18
+ ? 'workspace skills directory detected'
19
+ : `workspace .${targetId === 'claude' ? 'claude' : 'codex'} directory detected`;
20
+ }
21
+ return targetId === 'openclaw'
22
+ ? 'global ~/.openclaw directory detected'
23
+ : `global ~/.${targetId === 'claude' ? 'claude' : 'codex'} directory detected`;
24
+ }
25
+ function formatInstallLocationLabel(locale, scope) {
26
+ if (locale === 'zh-CN') {
27
+ return scope === 'project' ? '当前项目' : '全局';
28
+ }
29
+ return scope === 'project' ? 'Current project' : 'Global';
30
+ }
31
+ function getInitCopy(locale) {
32
+ if (locale === 'zh-CN') {
33
+ return {
34
+ sections: {
35
+ detection: '环境检测',
36
+ installationPlan: '安装计划',
37
+ installation: '安装结果',
38
+ login: '登录',
39
+ verification: '验证',
40
+ nextSteps: '下一步',
41
+ },
42
+ statuses: {
43
+ inProgress: '进行中',
44
+ completed: '已完成',
45
+ failed: '失败',
46
+ skipped: '已跳过',
47
+ },
48
+ steps: {
49
+ login: '浏览器登录',
50
+ doctor: 'Doctor 检查',
51
+ usage: 'Usage 检查',
52
+ completed: '初始化完成',
53
+ loginSkipped: '已跳过登录',
54
+ usageSkipped: '已跳过 Usage 检查',
55
+ },
56
+ boxes: {
57
+ loginOutput: '登录输出',
58
+ doctorOutput: 'Doctor 输出',
59
+ usageOutput: 'Usage 输出',
60
+ loginDetails: '登录详情',
61
+ doctorDetails: 'Doctor 详情',
62
+ usageDetails: 'Usage 详情',
63
+ },
64
+ prompts: {
65
+ selectLanguage: '选择 CLI 语言',
66
+ selectInstallLocation: '选择安装位置',
67
+ selectAgentApps: '选择要安装的 Agent Apps',
68
+ confirmOverwriteConflicts: '检测到未受管文件,是否允许覆盖?',
69
+ },
70
+ choices: {
71
+ currentProject: '当前项目',
72
+ currentProjectDescription: '仅影响当前工作区,适合团队协作与仓库内共享',
73
+ global: '全局',
74
+ globalDescription: '安装到当前用户环境,适合跨项目复用',
75
+ },
76
+ labels: {
77
+ detected: '已检测到',
78
+ notDetected: '未检测到',
79
+ installLocation: '安装位置',
80
+ targets: '目标',
81
+ root: '根目录',
82
+ create: '新建',
83
+ refresh: '刷新',
84
+ conflicts: '冲突',
85
+ installedAt: '已安装到',
86
+ created: '新增',
87
+ refreshed: '刷新',
88
+ overwritten: '覆盖未受管文件',
89
+ configuredTargets: '已配置目标',
90
+ },
91
+ messages: {
92
+ detectedIn(targetName, surface, targetId) {
93
+ return `${targetName}: ${describeTargetSurface('zh-CN', surface, targetId)}`;
94
+ },
95
+ notDetectedReason(targetName) {
96
+ return `${targetName}: 当前未检测到目标目录,仍然允许安装`;
97
+ },
98
+ agentChoiceDescription(target, scope) {
99
+ const scopeSurface = scope === 'project' ? 'workspace' : 'user';
100
+ if (!target.detectedIn.includes(scopeSurface)) {
101
+ return '当前安装位置未检测到现有目录,仍可安装';
102
+ }
103
+ return scopeSurface === 'workspace'
104
+ ? '已检测当前项目'
105
+ : '已检测全局环境';
106
+ },
107
+ loginSkippedByFlag: '已根据参数跳过登录。',
108
+ runLoginLater: '如需稍后完成绑定,请运行 `vaone auth login`。',
109
+ loginPhaseCompletedSuccessfully: '登录阶段已完成。',
110
+ doctorVerificationPassed: 'Doctor 验证通过。',
111
+ usageVerificationSkippedDeferred: '由于登录被延后,已跳过 usage 验证。',
112
+ usageVerificationPassed: 'Usage 验证通过。',
113
+ restartAgent: '请重启目标 agent,或开启新的会话,让它重新加载已安装文件。',
114
+ startUsingAfterRestart: '重启后即可在 agent 中开始使用 VisionAlpha operator 能力。',
115
+ pressEnterToExit: '按 Enter 退出。',
116
+ overwriteUnmanagedFiles: '覆盖未受管文件',
117
+ spinnerInstalling: '正在写入受管文件',
118
+ spinnerLoggingIn: '正在完成浏览器登录',
119
+ spinnerDoctor: '正在执行 Doctor 检查',
120
+ spinnerUsage: '正在执行 Usage 检查',
121
+ summaryBrowser(value) {
122
+ return `浏览器状态: ${value}`;
123
+ },
124
+ summaryCallbackMode(value) {
125
+ return `回调模式: ${value}`;
126
+ },
127
+ summaryContinuationUrl(value) {
128
+ return `继续地址: ${value}`;
129
+ },
130
+ summaryAccount(value) {
131
+ return `账户: ${value}`;
132
+ },
133
+ summaryInstallation(value) {
134
+ return `安装实例: ${value}`;
135
+ },
136
+ summaryAccessTokenExpiresAt(value) {
137
+ return `访问令牌过期时间: ${value}`;
138
+ },
139
+ summaryEnvironment(value) {
140
+ return `环境: ${value}`;
141
+ },
142
+ summaryApiBaseUrl(value) {
143
+ return `API 地址: ${value}`;
144
+ },
145
+ summaryRoot(value) {
146
+ return `根目录: ${value}`;
147
+ },
148
+ summaryAuthState(value) {
149
+ return `认证状态: ${value}`;
150
+ },
151
+ summaryInstallationState(value) {
152
+ return `安装状态: ${value}`;
153
+ },
154
+ summaryPlan(value) {
155
+ return `当前计划: ${value}`;
156
+ },
157
+ summaryCommercialStatus(value) {
158
+ return `商业状态: ${value}`;
159
+ },
160
+ summaryDailyReport(value) {
161
+ return `日报状态: ${value}`;
162
+ },
163
+ summaryLockedReport(value) {
164
+ return `锁定日报: ${value}`;
165
+ },
166
+ summaryIntelligence(value) {
167
+ return `情报额度: ${value}`;
168
+ },
169
+ summaryResetCadence(value) {
170
+ return `重置周期: ${value}`;
171
+ },
172
+ },
173
+ errors: {
174
+ unsupportedAgent(value, supported) {
175
+ return `不支持的 agent 目标 "${value}"。可用值:${supported.join(', ')}。`;
176
+ },
177
+ invalidScopeOption: '参数 "--scope" 只能是 "project" 或 "user"。',
178
+ invalidPositionalArgument: '`vaone init` 只接受一个可选位置参数 `.`,表示安装到当前项目。',
179
+ initDotScopeConflict: '`vaone init .` 表示当前项目安装,不能同时与 `--scope user` 一起使用。',
180
+ nonInteractiveNeedsScope: '非交互模式下必须显式提供安装位置,使用 `.` 或 `--scope project|user`。',
181
+ nonInteractiveNeedsAgents: '非交互模式下必须通过 `--agents codex,claude,openclaw` 指定至少一个 agent。',
182
+ unresolvedScope: '无法解析安装位置。',
183
+ noAgentSelected: '至少需要选择一个 agent target。',
184
+ cancelledForUnmanagedFiles: '由于未批准覆盖未受管文件,初始化已取消。',
185
+ unmanagedFilesNeedOverride: '初始化发现未受管目标文件。请使用 --force,或在交互模式下确认覆盖。',
186
+ postInitDoctorFailed: 'init 完成后的 doctor 验证失败。',
187
+ postInitUsageFailed: 'init 完成后的 usage 验证失败。',
188
+ },
189
+ };
190
+ }
191
+ return {
192
+ sections: {
193
+ detection: 'Detection',
194
+ installationPlan: 'Installation plan',
195
+ installation: 'Installation',
196
+ login: 'Login',
197
+ verification: 'Verification',
198
+ nextSteps: 'Next steps',
199
+ },
200
+ statuses: {
201
+ inProgress: 'In progress',
202
+ completed: 'Completed',
203
+ failed: 'Failed',
204
+ skipped: 'Skipped',
205
+ },
206
+ steps: {
207
+ login: 'Browser login',
208
+ doctor: 'Doctor check',
209
+ usage: 'Usage check',
210
+ completed: 'Initialization complete',
211
+ loginSkipped: 'Login skipped',
212
+ usageSkipped: 'Usage check skipped',
213
+ },
214
+ boxes: {
215
+ loginOutput: 'Login output',
216
+ doctorOutput: 'Doctor output',
217
+ usageOutput: 'Usage output',
218
+ loginDetails: 'Login details',
219
+ doctorDetails: 'Doctor details',
220
+ usageDetails: 'Usage details',
221
+ },
222
+ prompts: {
223
+ selectLanguage: 'Select CLI language',
224
+ selectInstallLocation: 'Select install location',
225
+ selectAgentApps: 'Select agent apps to install',
226
+ confirmOverwriteConflicts: 'Unmanaged files were detected. Allow overwrite?',
227
+ },
228
+ choices: {
229
+ currentProject: 'Current project',
230
+ currentProjectDescription: 'Only affect this workspace and keep onboarding repo-local',
231
+ global: 'Global',
232
+ globalDescription: 'Install into your user environment for reuse across projects',
233
+ },
234
+ labels: {
235
+ detected: 'detected',
236
+ notDetected: 'not detected',
237
+ installLocation: 'Install location',
238
+ targets: 'Targets',
239
+ root: 'root',
240
+ create: 'create',
241
+ refresh: 'refresh',
242
+ conflicts: 'conflicts',
243
+ installedAt: 'installed at',
244
+ created: 'created',
245
+ refreshed: 'refreshed',
246
+ overwritten: 'overwritten unmanaged files',
247
+ configuredTargets: 'Configured targets',
248
+ },
249
+ messages: {
250
+ detectedIn(targetName, surface, targetId) {
251
+ return `${targetName}: ${describeTargetSurface('en', surface, targetId)}`;
252
+ },
253
+ notDetectedReason(targetName) {
254
+ return `${targetName}: no existing target-specific directory detected; installation is still allowed`;
255
+ },
256
+ agentChoiceDescription(target, scope) {
257
+ const scopeSurface = scope === 'project' ? 'workspace' : 'user';
258
+ if (!target.detectedIn.includes(scopeSurface)) {
259
+ return 'No existing directory detected in the selected install location yet; installation is still allowed';
260
+ }
261
+ return scopeSurface === 'workspace'
262
+ ? 'workspace config detected'
263
+ : 'global config detected';
264
+ },
265
+ loginSkippedByFlag: 'Login was skipped by flag.',
266
+ runLoginLater: 'Run `vaone auth login` later to finish account binding.',
267
+ loginPhaseCompletedSuccessfully: 'Login phase completed successfully.',
268
+ doctorVerificationPassed: 'Doctor verification passed.',
269
+ usageVerificationSkippedDeferred: 'Usage verification was skipped because login was deferred.',
270
+ usageVerificationPassed: 'Usage verification passed.',
271
+ restartAgent: 'Restart the target agent or start a new session so it reloads the installed files.',
272
+ startUsingAfterRestart: 'After restart, you can begin using VisionAlpha operator capabilities from the agent.',
273
+ pressEnterToExit: 'Press Enter to exit.',
274
+ overwriteUnmanagedFiles: 'Overwrite unmanaged files',
275
+ spinnerInstalling: 'Writing managed files',
276
+ spinnerLoggingIn: 'Completing browser login',
277
+ spinnerDoctor: 'Running doctor checks',
278
+ spinnerUsage: 'Running usage checks',
279
+ summaryBrowser(value) {
280
+ return `Browser: ${value}`;
281
+ },
282
+ summaryCallbackMode(value) {
283
+ return `Callback mode: ${value}`;
284
+ },
285
+ summaryContinuationUrl(value) {
286
+ return `Continuation URL: ${value}`;
287
+ },
288
+ summaryAccount(value) {
289
+ return `Account: ${value}`;
290
+ },
291
+ summaryInstallation(value) {
292
+ return `Installation: ${value}`;
293
+ },
294
+ summaryAccessTokenExpiresAt(value) {
295
+ return `Access token expires at: ${value}`;
296
+ },
297
+ summaryEnvironment(value) {
298
+ return `Environment: ${value}`;
299
+ },
300
+ summaryApiBaseUrl(value) {
301
+ return `API base URL: ${value}`;
302
+ },
303
+ summaryRoot(value) {
304
+ return `Root: ${value}`;
305
+ },
306
+ summaryAuthState(value) {
307
+ return `Auth state: ${value}`;
308
+ },
309
+ summaryInstallationState(value) {
310
+ return `Installation state: ${value}`;
311
+ },
312
+ summaryPlan(value) {
313
+ return `Current plan: ${value}`;
314
+ },
315
+ summaryCommercialStatus(value) {
316
+ return `Commercial status: ${value}`;
317
+ },
318
+ summaryDailyReport(value) {
319
+ return `Daily report: ${value}`;
320
+ },
321
+ summaryLockedReport(value) {
322
+ return `Locked report: ${value}`;
323
+ },
324
+ summaryIntelligence(value) {
325
+ return `Intelligence quota: ${value}`;
326
+ },
327
+ summaryResetCadence(value) {
328
+ return `Reset cadence: ${value}`;
329
+ },
330
+ },
331
+ errors: {
332
+ unsupportedAgent(value, supported) {
333
+ return `Unsupported agent target "${value}". Supported values: ${supported.join(', ')}.`;
334
+ },
335
+ invalidScopeOption: 'Option "--scope" must be "project" or "user".',
336
+ invalidPositionalArgument: '`vaone init` accepts only one optional positional argument: `.` for current-project install.',
337
+ initDotScopeConflict: '`vaone init .` means current-project install and cannot be combined with `--scope user`.',
338
+ nonInteractiveNeedsScope: 'Non-interactive init requires an explicit install location via `.` or `--scope project|user`.',
339
+ nonInteractiveNeedsAgents: 'Non-interactive init requires `--agents codex,claude,openclaw`.',
340
+ unresolvedScope: 'Initialization scope could not be resolved.',
341
+ noAgentSelected: 'At least one agent target must be selected.',
342
+ cancelledForUnmanagedFiles: 'Initialization was cancelled because unmanaged files were not approved for overwrite.',
343
+ unmanagedFilesNeedOverride: 'Init found unmanaged target files. Re-run with --force or run interactively to confirm overwrite.',
344
+ postInitDoctorFailed: 'Post-init doctor verification failed.',
345
+ postInitUsageFailed: 'Post-init usage verification failed.',
346
+ },
347
+ };
348
+ }