@solarains/va-cli 0.1.1 → 0.1.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 CHANGED
@@ -1,132 +1,18 @@
1
- # va-cli
1
+ # @solarains/va-cli
2
2
 
3
- Bootstrap CLI for the new VAOne product.
3
+ VisionAlpha CLI.
4
4
 
5
- This project intentionally starts as a runnable but business-light CLI shell. It
6
- defines the command tree, local config and state layout, token-storage
7
- abstraction, diagnostics path, and placeholder commands that later child
8
- changes will extend for browser auth, installation binding, and usage queries.
9
-
10
- Parent architecture references:
11
-
12
- - `openspec/changes/define-skills-mvp-architecture/proposal.md`
13
- - `openspec/changes/define-skills-mvp-architecture/design.md`
14
- - `openspec/changes/define-skills-mvp-architecture/specs/skills-system-architecture/spec.md`
15
- - `openspec/changes/define-skills-mvp-architecture/master-task-list.md`
16
- - `openspec/changes/bootstrap-va-cli/design.md`
17
- - `openspec/changes/add-cli-browser-auth-flow/proposal.md`
18
- - `openspec/changes/add-cli-browser-auth-flow/design.md`
19
-
20
- Current command surface:
21
-
22
- - `vaone init`
23
- - `vaone auth login`
24
- - `vaone auth logout`
25
- - `vaone usage`
26
- - `vaone doctor`
27
-
28
- Current auth foundation:
29
-
30
- - `vaone auth login` now generates PKCE verifier/challenge pairs for a public CLI client
31
- - the CLI creates or resumes a durable installation identity with ed25519 key material
32
- - primary completion uses a localhost loopback callback
33
- - fallback completion prints the browser URL and terminal QR code, then polls the same auth session
34
- - token persistence stores account id, installation id, session id, access token, and refresh token metadata
35
- - refresh continuation signs `refreshToken + installationId + signedAt` with the local installation private key
36
- - revoked installations and invalid installation-proof refresh attempts now resolve to explicit re-login guidance instead of generic refresh failure
37
-
38
- Current source layout:
39
-
40
- - `src/cli/` startup, command tree, help rendering
41
- - `src/commands/` grouped command handlers
42
- - `src/config/` runtime configuration and endpoint loading
43
- - `src/features/init/` agent target detection, managed pack generation, init orchestration
44
- - `src/state/` local path layout and file-backed storage adapters
45
- - `src/shared/` logging and output helpers
46
-
47
- ## `vaone init`
48
-
49
- `vaone init` is the supported onboarding path for agent-ready setup. It now:
50
-
51
- - detects Codex, Claude Code, and OpenClaw install surfaces
52
- - supports `project` and `user` scope installation
53
- - installs thin VAOne-managed agent packs that call back into `vaone`
54
- - chains into `vaone auth login` by default unless `--skip-login` is set
55
- - runs CLI-native readiness checks before exit
56
-
57
- Supported flags:
58
-
59
- - `--agents codex,claude,openclaw`
60
- - `--scope project|user`
61
- - `--skip-login`
62
- - `--force`
63
- - `--yes`
64
-
65
- Target-specific install behavior:
66
-
67
- - Codex: installs `vaone/SKILL.md` under `.codex/skills` or `~/.codex/skills`
68
- - Claude Code: installs managed files under `.claude/commands`, `.claude/agents`, and `.claude/VAONE.md`
69
- - OpenClaw: installs `vaone/SKILL.md` under `skills` or `~/.openclaw/skills`
70
-
71
- Current MVP limits:
72
-
73
- - Claude Code support is limited to managed command and agent guide files; deeper adapter behavior can be expanded later
74
- - OpenClaw marketplace plugin packaging is still deferred; this change only installs local skill assets
75
- - Agents may need a full restart or a new session before they discover newly installed files
76
-
77
- ## Local development
78
-
79
- ```bash
80
- pnpm install
81
- pnpm cli -- --help
82
- ```
83
-
84
- ## Validation
5
+ ## Install
85
6
 
86
7
  ```bash
87
- pnpm typecheck
88
- pnpm lint
89
- pnpm test
90
- pnpm build
91
- node dist/main.js --help
8
+ npm install -g @solarains/va-cli
92
9
  ```
93
10
 
94
- ## npm release packaging
95
-
96
- `va-cli` now assembles a dedicated publish root under `dist/publish/` and
97
- publishes from that directory instead of from the repository root.
98
-
99
- Useful commands:
11
+ ## Usage
100
12
 
101
13
  ```bash
102
- pnpm build:publish
103
- pnpm pack:publish
104
- pnpm verify:publish
14
+ vaone --help
15
+ vaone init
105
16
  ```
106
17
 
107
- Release flow:
108
-
109
- ```bash
110
- pnpm release:prepare
111
- pnpm verify:publish
112
- npm publish dist/publish --access public
113
- ```
114
-
115
- `pnpm release:prepare` increments the patch version in the root
116
- `package.json`, then rebuilds `dist/publish/` with the updated version.
117
-
118
- Before the first real npm publish, add the intended license text at
119
- `va-cli/LICENSE`. The packaging flow copies that file into `dist/publish/` when
120
- present.
121
-
122
- ## Git Workflow
123
-
124
- - 提交信息使用 Conventional Commits,建议以中文描述主要变更,例如 `feat(cli): 增加日报查询命令`
125
- - 本仓库启用 Husky:
126
- - `pre-commit` 会执行 `pnpm lint-staged` 和 `pnpm typecheck`
127
- - `commit-msg` 会执行 `pnpm commitlint --edit`
128
- - PR 需要填写摘要、背景、验证方式,以及配置 / 认证 / 本地状态影响
129
- - CLI 相关 PR 请附关键命令示例输出
130
- - 提交前最少通过:
131
- - `pnpm lint`
132
- - `pnpm typecheck`
18
+ Use `vaone ...` to access the CLI command surface.
@@ -6,6 +6,14 @@ const auth_api_client_1 = require("../../features/auth/auth-api-client");
6
6
  const browser_login_1 = require("../../features/auth/browser-login");
7
7
  const installation_state_1 = require("../../features/auth/installation-state");
8
8
  const AUTH_TIMEOUT_MS = 10 * 60 * 1000;
9
+ function formatBrowserOrigin(continuationUri) {
10
+ try {
11
+ return new URL(continuationUri).origin;
12
+ }
13
+ catch {
14
+ return continuationUri;
15
+ }
16
+ }
9
17
  function printFallbackInstructions(logger, continuationUri, callbackMode) {
10
18
  (0, output_1.printSection)(logger, 'Browser continuation');
11
19
  (0, output_1.printKeyValue)(logger, 'URL', continuationUri);
@@ -71,7 +79,8 @@ exports.loginCommand = {
71
79
  }
72
80
  (0, output_1.printSection)(context.logger, 'Login context');
73
81
  (0, output_1.printList)(context.logger, [
74
- `Account login is handled in the browser against ${context.runtimeConfig.apiBaseUrl}.`,
82
+ `Account login is handled in the browser against ${formatBrowserOrigin(session.continuationUri)}.`,
83
+ `API requests use ${context.runtimeConfig.apiBaseUrl}.`,
75
84
  `Installation binding uses ${installation.installationId} on ${installation.clientPlatform}/${installation.clientArch}.`,
76
85
  `Callback mode: ${callbackMode}.`,
77
86
  ]);
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_API_BASE_URL = void 0;
3
4
  exports.loadRuntimeConfig = loadRuntimeConfig;
4
5
  exports.saveRuntimeConfig = saveRuntimeConfig;
5
6
  const node_os_1 = require("node:os");
6
7
  const promises_1 = require("node:fs/promises");
7
8
  const node_path_1 = require("node:path");
8
9
  const locale_1 = require("./locale");
10
+ exports.DEFAULT_API_BASE_URL = 'https://skills.api.dev.vizionalpha.com';
9
11
  function parseBoolean(value) {
10
12
  if (value === undefined) {
11
13
  return undefined;
@@ -46,7 +48,7 @@ async function loadRuntimeConfig(env, paths) {
46
48
  appEnv: env.VAONE_ENV ?? fileConfig.appEnv ?? 'local',
47
49
  apiBaseUrl: normalizeHomePath(env.VAONE_API_BASE_URL ??
48
50
  fileConfig.apiBaseUrl ??
49
- 'http://localhost:3000').replace(/\/$/, ''),
51
+ exports.DEFAULT_API_BASE_URL).replace(/\/$/, ''),
50
52
  debug: parseBoolean(env.VAONE_DEBUG) ?? fileConfig.debug ?? false,
51
53
  authCallbackMode,
52
54
  locale,
@@ -121,6 +121,9 @@ function getInitCopy(locale) {
121
121
  summaryBrowser(value) {
122
122
  return `浏览器状态: ${value}`;
123
123
  },
124
+ summaryBrowserOrigin(value) {
125
+ return `浏览器地址: ${value}`;
126
+ },
124
127
  summaryCallbackMode(value) {
125
128
  return `回调模式: ${value}`;
126
129
  },
@@ -279,6 +282,9 @@ function getInitCopy(locale) {
279
282
  summaryBrowser(value) {
280
283
  return `Browser: ${value}`;
281
284
  },
285
+ summaryBrowserOrigin(value) {
286
+ return `Browser origin: ${value}`;
287
+ },
282
288
  summaryCallbackMode(value) {
283
289
  return `Callback mode: ${value}`;
284
290
  },
@@ -69,6 +69,11 @@ function extractValue(lines, key) {
69
69
  function extractLoginSummary(lines, copy) {
70
70
  const summary = [];
71
71
  const details = [];
72
+ const browserOrigin = lines
73
+ .find((line) => line.startsWith('Account login is handled in the browser against '))
74
+ ?.replace('Account login is handled in the browser against ', '')
75
+ .replace(/\.$/, '')
76
+ .trim();
72
77
  const browserLine = lines.find((line) => line.includes('Automatic browser launch failed') ||
73
78
  line.includes('Browser opened'));
74
79
  const callbackMode = extractValue(lines, 'Callback mode');
@@ -79,6 +84,9 @@ function extractLoginSummary(lines, copy) {
79
84
  if (browserLine) {
80
85
  summary.push(copy.messages.summaryBrowser(browserLine));
81
86
  }
87
+ if (browserOrigin) {
88
+ summary.push(copy.messages.summaryBrowserOrigin(browserOrigin));
89
+ }
82
90
  if (callbackMode) {
83
91
  summary.push(copy.messages.summaryCallbackMode(callbackMode));
84
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solarains/va-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Bootstrap CLI for the VAOne product.",
5
5
  "bin": {
6
6
  "vaone": "dist/main.js"