@evatick/skill 0.3.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 EVA Tick CLI contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # EVA Skill for Codex
2
+
3
+ This package installs the EVA Codex Skill, which teaches Codex how to select and
4
+ use the locally installed `eva` CLI safely and predictably.
5
+
6
+ The Skill package depends on the matching EVA CLI version, so one npm command
7
+ installs both the `eva` command and the Skill installer:
8
+
9
+ ```shell
10
+ npm install --global @evatick/skill
11
+ eva-skill install
12
+ eva-skill status
13
+ ```
14
+
15
+ Restart Codex after installing or updating a Skill so it can rediscover the
16
+ instructions. To update an existing installation while preserving a recoverable
17
+ backup:
18
+
19
+ ```shell
20
+ npm update --global @evatick/skill
21
+ eva-skill update
22
+ ```
23
+
24
+ `eva-skill` installs into `$CODEX_HOME/skills/eva`, or `~/.codex/skills/eva`
25
+ when `CODEX_HOME` is unset. It does not use npm lifecycle scripts and never
26
+ silently overwrites an existing Skill.
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ const fs = require("node:fs");
6
+ const os = require("node:os");
7
+ const path = require("node:path");
8
+
9
+ const packageRoot = path.resolve(__dirname, "..");
10
+ const source = path.join(packageRoot, "skill", "eva");
11
+ const codexRoot = path.resolve(
12
+ process.env.CODEX_HOME || path.join(os.homedir(), ".codex"),
13
+ );
14
+ const skillsRoot = path.join(codexRoot, "skills");
15
+ const target = path.join(skillsRoot, "eva");
16
+
17
+ function fail(message) {
18
+ console.error(message);
19
+ process.exit(1);
20
+ }
21
+
22
+ function stageSkill() {
23
+ fs.mkdirSync(skillsRoot, { recursive: true });
24
+ const temporary = path.join(
25
+ skillsRoot,
26
+ `.eva.install-${process.pid}-${Date.now()}`,
27
+ );
28
+ fs.cpSync(source, temporary, { recursive: true, errorOnExist: true });
29
+ return temporary;
30
+ }
31
+
32
+ function install() {
33
+ if (fs.existsSync(target)) {
34
+ fail(
35
+ `EVA Skill already exists at ${target}. Run "eva-skill update" to replace it safely.`,
36
+ );
37
+ }
38
+ const temporary = stageSkill();
39
+ fs.renameSync(temporary, target);
40
+ console.log(JSON.stringify({ installed: true, path: target }));
41
+ }
42
+
43
+ function update() {
44
+ if (!fs.existsSync(target)) {
45
+ fail(
46
+ `EVA Skill is not installed at ${target}. Run "eva-skill install" first.`,
47
+ );
48
+ }
49
+ const temporary = stageSkill();
50
+ const backup = path.join(
51
+ skillsRoot,
52
+ `eva.backup-${Date.now()}-${process.pid}`,
53
+ );
54
+ fs.renameSync(target, backup);
55
+ try {
56
+ fs.renameSync(temporary, target);
57
+ } catch (error) {
58
+ fs.renameSync(backup, target);
59
+ throw error;
60
+ }
61
+ console.log(JSON.stringify({ updated: true, path: target, backup }));
62
+ }
63
+
64
+ function status() {
65
+ console.log(
66
+ JSON.stringify({
67
+ installed: fs.existsSync(path.join(target, "SKILL.md")),
68
+ path: target,
69
+ }),
70
+ );
71
+ }
72
+
73
+ const command = process.argv[2];
74
+ if (command === "install") install();
75
+ else if (command === "update") update();
76
+ else if (command === "status") status();
77
+ else {
78
+ fail("Usage: eva-skill install|update|status");
79
+ }
package/bin/eva.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ require("@evatick/cli/bin/eva.js");
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@evatick/skill",
3
+ "version": "0.3.0",
4
+ "description": "Codex Skill for using the EVA market data CLI",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/xiaochaohit/evatick-cli.git"
9
+ },
10
+ "homepage": "https://github.com/xiaochaohit/evatick-cli#readme",
11
+ "bugs": "https://github.com/xiaochaohit/evatick-cli/issues",
12
+ "bin": {
13
+ "eva": "bin/eva.js",
14
+ "eva-skill": "bin/eva-skill.js"
15
+ },
16
+ "files": [
17
+ "bin",
18
+ "skill",
19
+ "README.md",
20
+ "LICENSE"
21
+ ],
22
+ "engines": {
23
+ "node": ">=18"
24
+ },
25
+ "dependencies": {
26
+ "@evatick/cli": "0.3.0"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ }
31
+ }
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: eva
3
+ description: Query and export mainland A-share and Chinese index data through the locally installed EVA CLI and EVA service. Use for instrument listing, search, resolution and inspection; stock and index quotes or bars; index constituents; EVA service health checks; and EVA CLI HTTP or authentication troubleshooting.
4
+ ---
5
+
6
+ # Use EVA
7
+
8
+ Treat `eva` as a thin HTTP client. Let the EVA service own data-source selection,
9
+ fallback, retries, normalization, and catalog persistence.
10
+
11
+ ## Workflow
12
+
13
+ 1. Verify the CLI with `command -v eva`.
14
+ 2. Verify the service with `eva health`. The default URL is `https://api.evatick.com`; use `--server-url URL` or `EVA_SERVER_URL` when needed.
15
+ 3. If authentication fails, check `eva config show`, `EVA_CONFIG`, and `EVA_API_KEY` without printing or exposing the key.
16
+ 4. Resolve uncertain user input with `eva instrument search` or `eva instrument resolve`.
17
+ 5. Run leaf help before unfamiliar calls.
18
+ 6. Parse stdout as one strict JSON value. Treat a nonzero status and the single stderr JSON object as failure.
19
+ 7. Report the canonical instrument, requested period, and data limitations. Do not present results as investment advice.
20
+
21
+ Read [references/command-guide.md](references/command-guide.md) for the complete
22
+ v1 command tree, output options, configuration, and error handling.
23
+
24
+ ## Guardrails
25
+
26
+ - Use named options only.
27
+ - Prefer canonical instrument IDs when a symbol or name is ambiguous.
28
+ - Use ISO dates such as `2026-08-15` for `--start`, `--end`, and `--as-of`.
29
+ - Use `--output PATH` for large results. Add `--format` only to select `json`, `jsonl`, `csv`, or `parquet`.
30
+ - Do not add `--overwrite` without user authorization.
31
+ - Never expose API keys from environment variables or configuration files.
32
+ - Let the EVA service handle provider routing. Report retryable service failures instead of calling providers directly.
33
+ - Do not invent unsupported commands for funds, futures, options, bonds, FX, macro data, calendars, or alternative data.
34
+
35
+ ## Quick sequence
36
+
37
+ ```shell
38
+ eva health
39
+ eva instrument search --query 平安银行 --type equity
40
+ eva stock bars --help
41
+ eva stock bars --symbol 000001 --start 2026-08-01 --end 2026-08-15 --limit 20
42
+ ```
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "EVA"
3
+ short_description: "通过 EVA CLI 查询、解析并导出中国股票和指数数据"
4
+ default_prompt: "Use $eva to find and run the right EVA market data command."
@@ -0,0 +1,80 @@
1
+ # EVA v1 command guide
2
+
3
+ ## Connection and configuration
4
+
5
+ The default service URL is `https://api.evatick.com`. Persist connection settings with:
6
+
7
+ ```shell
8
+ eva config set --base-url https://api.example.com --api-key 'eva_...'
9
+ eva config show
10
+ ```
11
+
12
+ The default configuration path on macOS and Linux is
13
+ `~/.config/eva/config.json`. Overrides are:
14
+
15
+ - `EVA_CONFIG`: configuration path
16
+ - `EVA_SERVER_URL`: service URL
17
+ - `EVA_API_KEY`: API key
18
+
19
+ Explicit command options take precedence over environment variables, which take
20
+ precedence over the configuration file. Never display the raw API key.
21
+
22
+ ## Command tree
23
+
24
+ ```shell
25
+ eva health
26
+ eva version
27
+ eva config set|show
28
+
29
+ eva instrument list [--type equity|index] [--venue VENUE] [--publisher PUBLISHER]
30
+ eva instrument search --query TEXT [--type equity|index]
31
+ eva instrument resolve --query TEXT [--type equity|index]
32
+ eva instrument show --id CANONICAL_ID
33
+
34
+ eva stock quotes --symbol SYMBOL_OR_ID
35
+ eva stock bars --symbol SYMBOL_OR_ID [--interval INTERVAL] [--start DATE] [--end DATE]
36
+
37
+ eva index quotes --symbol SYMBOL_OR_ID
38
+ eva index bars --symbol SYMBOL_OR_ID [--interval INTERVAL] [--start DATE] [--end DATE]
39
+ eva index constituents --symbol SYMBOL_OR_ID [--as-of DATE]
40
+ ```
41
+
42
+ Supported bar intervals are `1m`, `5m`, `15m`, `30m`, `60m`, `1d`, `1w`, and
43
+ `1mo`. Inspect leaf help for context and adjustment options.
44
+
45
+ ## Results and files
46
+
47
+ Successful data commands unwrap the service envelope and write one strict JSON
48
+ value to stdout.
49
+
50
+ - `--limit N`: retain the first N returned records.
51
+ - `--output PATH`: atomically write data and return a JSON path/record summary.
52
+ - `--format json|jsonl|csv|parquet`: explicitly select the file format.
53
+ - `--overwrite`: replace an existing regular file only when authorized.
54
+ - CSV requires consistent flat records. JSONL and Parquet require record lists.
55
+ - Parquet requires the optional Python dependency `evatick[parquet]`; native npm CLI installations support JSON, JSONL, and CSV.
56
+
57
+ Example:
58
+
59
+ ```shell
60
+ eva stock bars --symbol 000001 \
61
+ --start 2026-08-01 --end 2026-08-15 \
62
+ --output /absolute/path/bars.csv --format csv
63
+ ```
64
+
65
+ ## Errors
66
+
67
+ stderr contains one JSON object, for example:
68
+
69
+ ```json
70
+ {"code":"SERVER_UNAVAILABLE","message":"EVA service is unavailable","retryable":true}
71
+ ```
72
+
73
+ - `INVALID_ARGUMENT`: correct the command or options; do not retry unchanged input.
74
+ - `API_KEY_REQUIRED`: configure a valid EVA API key without exposing it.
75
+ - `SERVER_UNAVAILABLE` or `TIMEOUT`: check `eva health` and the configured service URL; for a self-hosted service, also check its process.
76
+ - `AMBIGUOUS_INSTRUMENT`: search first or pass a canonical instrument ID.
77
+ - `INSTRUMENT_NOT_FOUND`: verify the catalog and instrument type.
78
+ - `OUTPUT_EXISTS`: choose another path or obtain authorization for `--overwrite`.
79
+ - `PARQUET_UNAVAILABLE`: use the Python distribution with its optional extra or choose another format.
80
+ - Provider errors are service responsibilities; do not call a data source directly.