@xqyz/xq-cli 0.1.0 → 0.1.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 (3) hide show
  1. package/README.md +26 -3
  2. package/package.json +1 -1
  3. package/src/cli.mjs +27 -18
package/README.md CHANGED
@@ -4,6 +4,26 @@ Standalone CLI project for xique brand task workflows.
4
4
 
5
5
  Project execution rules for agents live in [AGENTS.md](./AGENTS.md). That file defines the mandatory config-confirmation flow before any bid generation run.
6
6
 
7
+ ## Install from npm
8
+
9
+ Install the published package from the public npm registry:
10
+
11
+ ```bash
12
+ npm install -g @xqyz/xq-cli
13
+ ```
14
+
15
+ If your local npm registry points to a mirror or private source, use:
16
+
17
+ ```bash
18
+ npm install -g @xqyz/xq-cli --registry=https://registry.npmjs.org/
19
+ ```
20
+
21
+ Upgrade to the latest published version with:
22
+
23
+ ```bash
24
+ npm update -g @xqyz/xq-cli --registry=https://registry.npmjs.org/
25
+ ```
26
+
7
27
  ## Install from this repo
8
28
 
9
29
  ```bash
@@ -20,14 +40,15 @@ npm pack
20
40
  That command produces a `.tgz` tarball which can be shared and installed with:
21
41
 
22
42
  ```bash
23
- npm install -g .\xqyz-xq-cli-0.1.0.tgz
43
+ npm install -g .\xqyz-xq-cli-0.1.2.tgz
24
44
  ```
25
45
 
26
46
  ## Usage
27
47
 
28
48
  ```bash
29
- xq-cli login --base-url https://xqai.atest.qianlima.com/api
30
- xq-cli login --base-url https://xqai.atest.qianlima.com/api --name mahao3 --password 123456
49
+ xq-cli login
50
+ xq-cli login --name your-account --password your-password
51
+ xq-cli login --base-url https://xqai.atest.qianlima.com/api --browser
31
52
  xq-cli wizard
32
53
  xq-cli wizard --file D:\bids\tender.docx
33
54
  xq-cli init --file D:\bids\tender.docx --wait
@@ -39,6 +60,8 @@ xq-cli export --cid <cid> --interactive --out D:\output
39
60
  xq-cli export --cid <cid> --out D:\output
40
61
  ```
41
62
 
63
+ Fresh installs default to the production API address `https://ai.bidfile.qianlima.com/api`. Use `--base-url` only when you need to target another environment such as `https://xqai.atest.qianlima.com/api`.
64
+
42
65
  `login` now defaults to browser authorization. If you explicitly pass `--name` and `--password`, the CLI falls back to password login.
43
66
 
44
67
  When `outline --wait` or `write --wait` hits a required response-basis step, the CLI will pause and ask you to choose `0/1/2` before continuing. It no longer auto-selects a default when you just press Enter.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xqyz/xq-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "CLI for xique bid-book task workflows",
5
5
  "type": "module",
6
6
  "scripts": {
package/src/cli.mjs CHANGED
@@ -15,6 +15,7 @@ import { AI_PURPOSE_MAP, detectFileType } from './fileTypeConfig.mjs';
15
15
 
16
16
  const APP_DIR = path.join(os.homedir(), '.xq-opencli');
17
17
  const CONFIG_FILE = path.join(APP_DIR, 'config.json');
18
+ const DEFAULT_BASE_URL = 'https://ai.bidfile.qianlima.com/api';
18
19
  const DEFAULT_PARSE_INTERVAL_MS = 10_000;
19
20
  const DEFAULT_TASK_INTERVAL_MS = 10_000;
20
21
  const DEFAULT_TIMEOUT_MS = 10 * 60 * 1000;
@@ -365,9 +366,9 @@ Commands
365
366
  export Download the generated docx
366
367
 
367
368
  Examples
368
- xq-cli login --base-url http://localhost:9021/api
369
- xq-cli login --base-url http://localhost:9021/api --name demo --password secret
370
- xq-cli login --base-url http://localhost:9021/api --browser
369
+ xq-cli login
370
+ xq-cli login --name your-account --password your-password
371
+ xq-cli login --base-url https://xqai.atest.qianlima.com/api --browser
371
372
  xq-cli init --file D:\\bids\\tender.docx --wait
372
373
  xq-cli parse-status --cid <cid> --uuid <uuid> --wait
373
374
  xq-cli choices
@@ -389,7 +390,7 @@ Examples
389
390
 
390
391
  Common options
391
392
  --json Print machine-readable JSON output
392
- --base-url <url> Override the saved base URL
393
+ --base-url <url> Override the default or saved base URL
393
394
  --timeout-sec <n> Poll timeout in seconds, default 600
394
395
  --interval-sec <n> Poll interval in seconds, default 10
395
396
  --reference-type <0|1|2> Outline reference choice: 0=merge, 1=format only, 2=score only
@@ -3193,26 +3194,34 @@ function normalizeBaseUrl(value) {
3193
3194
  return String(value).replace(/\/+$/, '');
3194
3195
  }
3195
3196
 
3197
+ function createDefaultState() {
3198
+ return {
3199
+ baseUrl: DEFAULT_BASE_URL,
3200
+ token: '',
3201
+ user: {},
3202
+ lastCid: '',
3203
+ tasks: {},
3204
+ };
3205
+ }
3206
+
3196
3207
  function readState() {
3208
+ const defaultState = createDefaultState();
3197
3209
  if (!fs.existsSync(CONFIG_FILE)) {
3198
- return {
3199
- baseUrl: '',
3200
- token: '',
3201
- user: {},
3202
- lastCid: '',
3203
- tasks: {},
3204
- };
3210
+ return defaultState;
3205
3211
  }
3206
3212
  try {
3207
- return JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
3208
- } catch (error) {
3213
+ const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
3209
3214
  return {
3210
- baseUrl: '',
3211
- token: '',
3212
- user: {},
3213
- lastCid: '',
3214
- tasks: {},
3215
+ ...defaultState,
3216
+ ...parsed,
3217
+ baseUrl: normalizeBaseUrl(parsed?.baseUrl || defaultState.baseUrl),
3218
+ token: parsed?.token || '',
3219
+ user: parsed?.user && typeof parsed.user === 'object' ? parsed.user : {},
3220
+ lastCid: parsed?.lastCid || '',
3221
+ tasks: parsed?.tasks && typeof parsed.tasks === 'object' ? parsed.tasks : {},
3215
3222
  };
3223
+ } catch (error) {
3224
+ return defaultState;
3216
3225
  }
3217
3226
  }
3218
3227