@alphafox/cli 0.3.3 → 0.3.5
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 +1 -1
- package/README.md +28 -9
- package/dist/auth/loopback-callback.js +3 -3
- package/dist/catalog/allowlist.d.ts +1 -1
- package/dist/catalog/allowlist.js +1 -1
- package/dist/catalog/generated/registry.json +338 -49
- package/dist/catalog/generated/schemas.json +1880 -779
- package/dist/catalog/omit.d.ts +6 -0
- package/dist/catalog/omit.js +11 -0
- package/dist/catalog/operations.d.ts +1 -1
- package/dist/catalog/operations.js +5 -2
- package/dist/commands/run.js +25 -3
- package/dist/engine-backtest/load-config.d.ts +4 -0
- package/dist/engine-backtest/load-config.js +44 -0
- package/dist/engine-backtest/parse-args.d.ts +3 -1
- package/dist/engine-backtest/parse-args.js +87 -3
- package/dist/engine-backtest/parse-axes.d.ts +3 -0
- package/dist/engine-backtest/parse-axes.js +167 -0
- package/dist/engine-backtest/persist.d.ts +60 -1
- package/dist/engine-backtest/persist.js +196 -1
- package/dist/engine-backtest/return-curve.d.ts +27 -0
- package/dist/engine-backtest/return-curve.js +80 -0
- package/dist/engine-backtest/run-command.d.ts +1 -4
- package/dist/engine-backtest/run-command.js +61 -45
- package/dist/engine-backtest/sweep-command.d.ts +13 -0
- package/dist/engine-backtest/sweep-command.js +749 -0
- package/dist/engine-backtest/sweep-kernel/caps.d.ts +26 -0
- package/dist/engine-backtest/sweep-kernel/caps.js +48 -0
- package/dist/engine-backtest/sweep-kernel/index.d.ts +13 -0
- package/dist/engine-backtest/sweep-kernel/index.js +34 -0
- package/dist/engine-backtest/sweep-kernel/plan.d.ts +22 -0
- package/dist/engine-backtest/sweep-kernel/plan.js +320 -0
- package/dist/engine-backtest/sweep-kernel/results.d.ts +72 -0
- package/dist/engine-backtest/sweep-kernel/results.js +150 -0
- package/dist/engine-backtest/sweep-kernel/session.d.ts +55 -0
- package/dist/engine-backtest/sweep-kernel/session.js +56 -0
- package/dist/engine-backtest/sweep-kernel/types.d.ts +36 -0
- package/dist/engine-backtest/sweep-kernel/types.js +2 -0
- package/dist/engine-backtest/types.d.ts +130 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +16 -1
- package/dist/install/types.d.ts +8 -1
- package/dist/install/types.js +1 -0
- package/dist/install/wizard.js +92 -55
- package/dist/keychain/windows-credential.d.ts +1 -1
- package/dist/keychain/windows-credential.js +1 -1
- package/dist/resolve-symbols/catalog.d.ts +3 -0
- package/dist/resolve-symbols/catalog.js +50 -0
- package/dist/resolve-symbols/errors.d.ts +18 -0
- package/dist/resolve-symbols/errors.js +26 -0
- package/dist/resolve-symbols/exchanges.d.ts +8 -0
- package/dist/resolve-symbols/exchanges.js +53 -0
- package/dist/resolve-symbols/match.d.ts +6 -0
- package/dist/resolve-symbols/match.js +250 -0
- package/dist/resolve-symbols/parse-args.d.ts +5 -0
- package/dist/resolve-symbols/parse-args.js +106 -0
- package/dist/resolve-symbols/run-command.d.ts +21 -0
- package/dist/resolve-symbols/run-command.js +149 -0
- package/dist/resolve-symbols/types.d.ts +37 -0
- package/dist/resolve-symbols/types.js +2 -0
- package/dist/skills/manager.d.ts +96 -0
- package/dist/skills/manager.js +445 -0
- package/dist/skills/run-command.d.ts +22 -0
- package/dist/skills/run-command.js +143 -0
- package/dist/skills-manifest.json +141 -0
- package/dist/update/run-command.d.ts +41 -0
- package/dist/update/run-command.js +204 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/agents/issue-tracker.md +2 -2
- package/docs/agents/triage-labels.md +1 -1
- package/docs/alphafox-cli-installation-guide.md +16 -17
- package/docs/index.html +11 -11
- package/docs/release-supply-chain.md +11 -6
- package/package.json +2 -2
- package/skills/account/SKILL.md +1 -1
- package/skills/admin/SKILL.md +1 -1
- package/skills/alphafox/SKILL.md +38 -0
- package/skills/alphafox-shared/SKILL.md +20 -4
- package/skills/auth/SKILL.md +2 -2
- package/skills/engine-backtest/SKILL.md +48 -6
- package/skills/exchange/SKILL.md +1 -1
- package/skills/market/SKILL.md +27 -4
- package/skills/notification/SKILL.md +1 -1
- package/skills/strategy/SKILL.md +7 -20
- package/skills/trading/SKILL.md +3 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"packageName": "@alphafox/cli",
|
|
4
|
+
"packageVersion": "0.3.5",
|
|
5
|
+
"contractVersion": "2026-08-13",
|
|
6
|
+
"bundleHash": "797ff48c83d6f0274e8726c4c6b5a3c9271c79116e9d8f90a268b4936efaeb65",
|
|
7
|
+
"skills": [
|
|
8
|
+
{
|
|
9
|
+
"name": "alphafox",
|
|
10
|
+
"version": "0.3.5",
|
|
11
|
+
"files": [
|
|
12
|
+
{
|
|
13
|
+
"path": "SKILL.md",
|
|
14
|
+
"sha256": "9b96984c09a656ef1f0c2b8c2d4c0c7a2ae10177d1b0abe0470ea9e5687095cd",
|
|
15
|
+
"size": 2184
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"hash": "1662dc2d889ef7429a4abf53061c6b5e83b2665998b4ccbfbf43338f373ef938"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "alphafox-account",
|
|
22
|
+
"version": "0.3.5",
|
|
23
|
+
"files": [
|
|
24
|
+
{
|
|
25
|
+
"path": "SKILL.md",
|
|
26
|
+
"sha256": "5e6244d3072e7cd9c9a5603d9c72e8ddf959cbca870f81603b7cfcb8d35b6212",
|
|
27
|
+
"size": 783
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"hash": "674fe691cdf52c64af5360c09475b7444e8ce6a1c59fa061c39d9ed6b1dfd78e"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "alphafox-admin",
|
|
34
|
+
"version": "0.3.5",
|
|
35
|
+
"files": [
|
|
36
|
+
{
|
|
37
|
+
"path": "SKILL.md",
|
|
38
|
+
"sha256": "cf3503e7d8114767b806d3d2349695b0a2af582d470c16c99064df60792baaca",
|
|
39
|
+
"size": 787
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"hash": "e33bb16a3f241ff29423023aebc044c26c6b4689feabe9b5f780dc3a5bdbb4a5"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "alphafox-auth",
|
|
46
|
+
"version": "0.3.5",
|
|
47
|
+
"files": [
|
|
48
|
+
{
|
|
49
|
+
"path": "SKILL.md",
|
|
50
|
+
"sha256": "848fcd9422977c0bb3ee3355c2359c6efbb54e964b64ea253660e7ee12598f1a",
|
|
51
|
+
"size": 1919
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
"hash": "c17ebdb46ebb36036d9958d8a6a31717af6945267575d7464561728e0c9d3205"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "alphafox-engine-backtest",
|
|
58
|
+
"version": "0.3.5",
|
|
59
|
+
"files": [
|
|
60
|
+
{
|
|
61
|
+
"path": "SKILL.md",
|
|
62
|
+
"sha256": "8e91f3779ee93b680b90fa21d0e7e8fa7cc5ad4ca89941e1b9076526f09075e2",
|
|
63
|
+
"size": 7346
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"hash": "73943798e3787ad78a9955aad937154ca0b8a975e44117b78f1afecc9866f13b"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "alphafox-exchange",
|
|
70
|
+
"version": "0.3.5",
|
|
71
|
+
"files": [
|
|
72
|
+
{
|
|
73
|
+
"path": "SKILL.md",
|
|
74
|
+
"sha256": "ea7d153cd5806f471e45e5df2f0558835aa6ad413abe92667352288fa534ff2a",
|
|
75
|
+
"size": 743
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"hash": "88d3826590356eed7b3a3405188242ca7e3936856fcd74400c06da701da0b062"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "alphafox-market",
|
|
82
|
+
"version": "0.3.5",
|
|
83
|
+
"files": [
|
|
84
|
+
{
|
|
85
|
+
"path": "SKILL.md",
|
|
86
|
+
"sha256": "c816116463f6b8ef7d7281593500153119bd62d6635517faf71e769e36522385",
|
|
87
|
+
"size": 1801
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"hash": "01ae4ac923c4284af527f78991784e9b1bf2599daa57dcead89f2f72510278df"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "alphafox-notification",
|
|
94
|
+
"version": "0.3.5",
|
|
95
|
+
"files": [
|
|
96
|
+
{
|
|
97
|
+
"path": "SKILL.md",
|
|
98
|
+
"sha256": "00c6b87f4742c3c5ea07276228c4b1ba718683abdf6e40c35024b270ec4abd49",
|
|
99
|
+
"size": 698
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"hash": "c23e5ed2458d8d2fa58f04b24a1efe300c554b2029f9b218685d204c5f9ed2b7"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "alphafox-shared",
|
|
106
|
+
"version": "0.3.5",
|
|
107
|
+
"files": [
|
|
108
|
+
{
|
|
109
|
+
"path": "SKILL.md",
|
|
110
|
+
"sha256": "c8b7624e43242c3bf1a5f5e8d2101a6b53a0a7c62f04afac079e49a478eaaca9",
|
|
111
|
+
"size": 4750
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"hash": "a8d5bedffabb5b0c715bf88bd94f7a3ef4e3be77f854065806d4dd1440ef606f"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "alphafox-strategy",
|
|
118
|
+
"version": "0.3.5",
|
|
119
|
+
"files": [
|
|
120
|
+
{
|
|
121
|
+
"path": "SKILL.md",
|
|
122
|
+
"sha256": "8f94ea6fc3d36ddc8e6808e1e6ebdfcec56973a93fc86d0c6832eff2d6cf4022",
|
|
123
|
+
"size": 1450
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"hash": "b1f5c6ae08bc2ea486b32c34c2e271ea504843972ccc7dbbb1e7e68d6a714f7d"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "alphafox-trading",
|
|
130
|
+
"version": "0.3.5",
|
|
131
|
+
"files": [
|
|
132
|
+
{
|
|
133
|
+
"path": "SKILL.md",
|
|
134
|
+
"sha256": "2eddaa9c903daa62790ead007db4f0f6f412d1a14b291025937927eda6719d03",
|
|
135
|
+
"size": 1435
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"hash": "d4b9e260145aca858e4d3a1f13bf81081c96bd8048d8d6eeb487e35dd78129fb"
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { InstallRunner } from "../install/types";
|
|
2
|
+
import type { SkillsSyncResult } from "../skills/manager";
|
|
3
|
+
export interface UpdateArgs {
|
|
4
|
+
readonly check: boolean;
|
|
5
|
+
readonly help: boolean;
|
|
6
|
+
readonly version?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface UpdateExecutionFlags {
|
|
9
|
+
readonly yes: boolean;
|
|
10
|
+
readonly dryRun: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface UpdateCliFlags extends UpdateExecutionFlags {
|
|
13
|
+
readonly format: "json" | "jsonl" | "text";
|
|
14
|
+
readonly noInput: boolean;
|
|
15
|
+
readonly jq?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface UpdateDeps {
|
|
18
|
+
readonly runner?: InstallRunner;
|
|
19
|
+
readonly packageHasSkills?: (packageRoot: string) => boolean;
|
|
20
|
+
readonly sync?: (packageRoot: string, runner: InstallRunner) => Promise<SkillsSyncResult>;
|
|
21
|
+
}
|
|
22
|
+
export interface CliUpdateResult {
|
|
23
|
+
readonly currentVersion: string | null;
|
|
24
|
+
readonly targetVersion: string;
|
|
25
|
+
readonly updateAvailable: boolean;
|
|
26
|
+
readonly checkOnly: boolean;
|
|
27
|
+
readonly dryRun: boolean;
|
|
28
|
+
readonly cli: {
|
|
29
|
+
readonly action: "available" | "planned" | "updated" | "current";
|
|
30
|
+
readonly previousVersion: string | null;
|
|
31
|
+
readonly version: string;
|
|
32
|
+
};
|
|
33
|
+
readonly skills: SkillsSyncResult | {
|
|
34
|
+
readonly action: "not-run";
|
|
35
|
+
readonly reason: "check-only" | "dry-run";
|
|
36
|
+
};
|
|
37
|
+
readonly restartRequired: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare function parseUpdateArgs(args: readonly string[]): UpdateArgs;
|
|
40
|
+
export declare function executeCliUpdate(args: UpdateArgs, flags: UpdateExecutionFlags, env?: NodeJS.ProcessEnv, deps?: UpdateDeps): Promise<CliUpdateResult>;
|
|
41
|
+
export declare function cmdUpdate(args: string[], flags: UpdateCliFlags, env?: NodeJS.ProcessEnv, deps?: UpdateDeps): Promise<number>;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseUpdateArgs = parseUpdateArgs;
|
|
4
|
+
exports.executeCliUpdate = executeCliUpdate;
|
|
5
|
+
exports.cmdUpdate = cmdUpdate;
|
|
6
|
+
const envelope_1 = require("../envelope");
|
|
7
|
+
const exec_1 = require("../install/exec");
|
|
8
|
+
const package_root_1 = require("../install/package-root");
|
|
9
|
+
const wizard_1 = require("../install/wizard");
|
|
10
|
+
const run_command_1 = require("../skills/run-command");
|
|
11
|
+
const version_1 = require("../version");
|
|
12
|
+
const NPM_TIMEOUT_MS = 120_000;
|
|
13
|
+
function parseUpdateArgs(args) {
|
|
14
|
+
let check = false;
|
|
15
|
+
let help = false;
|
|
16
|
+
let version;
|
|
17
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
18
|
+
const arg = args[i];
|
|
19
|
+
if (arg === "--check") {
|
|
20
|
+
check = true;
|
|
21
|
+
}
|
|
22
|
+
else if (arg === "--version") {
|
|
23
|
+
version = args[++i];
|
|
24
|
+
if (!version)
|
|
25
|
+
throw updateUsage("--version requires a value");
|
|
26
|
+
}
|
|
27
|
+
else if (arg.startsWith("--version=")) {
|
|
28
|
+
version = arg.slice("--version=".length);
|
|
29
|
+
}
|
|
30
|
+
else if (arg === "--help" || arg === "-h" || arg === "help") {
|
|
31
|
+
help = true;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
throw updateUsage(`Unknown update argument: ${arg}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (version && !/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(version)) {
|
|
38
|
+
throw updateUsage(`Invalid version: ${version}`);
|
|
39
|
+
}
|
|
40
|
+
return { check, help, ...(version ? { version } : {}) };
|
|
41
|
+
}
|
|
42
|
+
async function executeCliUpdate(args, flags, env = process.env, deps = {}) {
|
|
43
|
+
const runner = deps.runner ??
|
|
44
|
+
(0, exec_1.createDefaultInstallRunner)(env, [__dirname, process.cwd()]);
|
|
45
|
+
const currentVersion = await readGlobalVersion(runner);
|
|
46
|
+
const targetVersion = await readTargetVersion(runner, args.version);
|
|
47
|
+
const updateAvailable = args.version
|
|
48
|
+
? currentVersion !== targetVersion
|
|
49
|
+
: currentVersion == null || (0, wizard_1.semverLessThan)(currentVersion, targetVersion);
|
|
50
|
+
const effectiveVersion = updateAvailable ? targetVersion : (currentVersion ?? targetVersion);
|
|
51
|
+
if (args.check) {
|
|
52
|
+
return {
|
|
53
|
+
currentVersion,
|
|
54
|
+
targetVersion,
|
|
55
|
+
updateAvailable,
|
|
56
|
+
checkOnly: true,
|
|
57
|
+
dryRun: false,
|
|
58
|
+
cli: {
|
|
59
|
+
action: updateAvailable ? "available" : "current",
|
|
60
|
+
previousVersion: currentVersion,
|
|
61
|
+
version: effectiveVersion,
|
|
62
|
+
},
|
|
63
|
+
skills: { action: "not-run", reason: "check-only" },
|
|
64
|
+
restartRequired: false,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
if (updateAvailable &&
|
|
68
|
+
args.version &&
|
|
69
|
+
currentVersion &&
|
|
70
|
+
(0, wizard_1.semverLessThan)(targetVersion, currentVersion) &&
|
|
71
|
+
!flags.yes) {
|
|
72
|
+
throw Object.assign(new Error(`Downgrading ${version_1.CLI_PACKAGE} from ${currentVersion} to ${targetVersion} requires --yes`), {
|
|
73
|
+
type: "confirmation",
|
|
74
|
+
subtype: "cli_downgrade_confirmation_required",
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
if (flags.dryRun) {
|
|
78
|
+
return {
|
|
79
|
+
currentVersion,
|
|
80
|
+
targetVersion,
|
|
81
|
+
updateAvailable,
|
|
82
|
+
checkOnly: false,
|
|
83
|
+
dryRun: true,
|
|
84
|
+
cli: {
|
|
85
|
+
action: updateAvailable ? "planned" : "current",
|
|
86
|
+
previousVersion: currentVersion,
|
|
87
|
+
version: effectiveVersion,
|
|
88
|
+
},
|
|
89
|
+
skills: { action: "not-run", reason: "dry-run" },
|
|
90
|
+
restartRequired: updateAvailable,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (updateAvailable) {
|
|
94
|
+
await runner.exec("npm", ["install", "-g", `${version_1.CLI_PACKAGE}@${targetVersion}`], { timeoutMs: NPM_TIMEOUT_MS });
|
|
95
|
+
const installedVersion = await readGlobalVersion(runner);
|
|
96
|
+
if (installedVersion !== targetVersion) {
|
|
97
|
+
throw Object.assign(new Error(`npm reported ${installedVersion ?? "no global install"} after updating to ${targetVersion}`), {
|
|
98
|
+
type: "install",
|
|
99
|
+
subtype: "cli_update_verify_failed",
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
const packageRoot = await resolveUpdatedPackageRoot(runner, deps.packageHasSkills ?? package_root_1.packageHasSkills, !updateAvailable);
|
|
104
|
+
const sync = deps.sync ??
|
|
105
|
+
(async (root, activeRunner) => await (0, run_command_1.syncCurrentSkills)({ force: false, dryRun: false }, env, { runner: activeRunner, packageRoot: root }));
|
|
106
|
+
const skills = await sync(packageRoot, runner);
|
|
107
|
+
return {
|
|
108
|
+
currentVersion,
|
|
109
|
+
targetVersion,
|
|
110
|
+
updateAvailable,
|
|
111
|
+
checkOnly: false,
|
|
112
|
+
dryRun: false,
|
|
113
|
+
cli: {
|
|
114
|
+
action: updateAvailable ? "updated" : "current",
|
|
115
|
+
previousVersion: currentVersion,
|
|
116
|
+
version: effectiveVersion,
|
|
117
|
+
},
|
|
118
|
+
skills,
|
|
119
|
+
restartRequired: updateAvailable || skills.restartRequired,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async function cmdUpdate(args, flags, env = process.env, deps = {}) {
|
|
123
|
+
const parsed = parseUpdateArgs(args);
|
|
124
|
+
if (parsed.help) {
|
|
125
|
+
(0, envelope_1.writeSuccess)({
|
|
126
|
+
name: "update",
|
|
127
|
+
usage: [
|
|
128
|
+
"alphafox update --check",
|
|
129
|
+
"alphafox update [--dry-run]",
|
|
130
|
+
"alphafox update --version <version> [--yes]",
|
|
131
|
+
],
|
|
132
|
+
notes: [
|
|
133
|
+
"Updates @alphafox/cli through npm, then syncs the verified co-versioned Skills bundle",
|
|
134
|
+
"A downgrade requires --yes",
|
|
135
|
+
"No Skills are downloaded independently from GitHub",
|
|
136
|
+
],
|
|
137
|
+
}, { format: flags.format, jq: flags.jq });
|
|
138
|
+
return 0;
|
|
139
|
+
}
|
|
140
|
+
const result = await executeCliUpdate(parsed, flags, env, deps);
|
|
141
|
+
(0, envelope_1.writeSuccess)(result, { format: flags.format, jq: flags.jq });
|
|
142
|
+
return result.skills.action !== "not-run" &&
|
|
143
|
+
result.skills.blocked.length > 0
|
|
144
|
+
? 1
|
|
145
|
+
: 0;
|
|
146
|
+
}
|
|
147
|
+
async function readGlobalVersion(runner) {
|
|
148
|
+
try {
|
|
149
|
+
const { stdout, stderr } = await runner.exec("npm", ["list", "-g", version_1.CLI_PACKAGE, "--depth=0"], { timeoutMs: 15_000 });
|
|
150
|
+
return (0, wizard_1.parseNpmListVersion)(`${stdout}\n${stderr}`);
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async function readTargetVersion(runner, requested) {
|
|
157
|
+
const spec = requested ? `${version_1.CLI_PACKAGE}@${requested}` : version_1.CLI_PACKAGE;
|
|
158
|
+
const { stdout } = await runner.exec("npm", ["view", spec, "version"], {
|
|
159
|
+
timeoutMs: 15_000,
|
|
160
|
+
});
|
|
161
|
+
const version = stdout.trim();
|
|
162
|
+
if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(version)) {
|
|
163
|
+
throw Object.assign(new Error(`npm returned an invalid version for ${spec}`), {
|
|
164
|
+
type: "install",
|
|
165
|
+
subtype: "npm_version_invalid",
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
return version;
|
|
169
|
+
}
|
|
170
|
+
async function resolveUpdatedPackageRoot(runner, packageHasSkills, allowCurrentFallback) {
|
|
171
|
+
try {
|
|
172
|
+
const { stdout } = await runner.exec("npm", ["root", "-g"], {
|
|
173
|
+
timeoutMs: 15_000,
|
|
174
|
+
});
|
|
175
|
+
const root = (0, package_root_1.globalPackageRoot)(stdout.trim());
|
|
176
|
+
if (packageHasSkills(root))
|
|
177
|
+
return root;
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
// Fall back to the currently executing package for repair-only updates.
|
|
181
|
+
}
|
|
182
|
+
if (!allowCurrentFallback) {
|
|
183
|
+
throw Object.assign(new Error("Updated @alphafox/cli package does not contain Skills"), {
|
|
184
|
+
type: "install",
|
|
185
|
+
subtype: "updated_skills_missing",
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
const current = (0, run_command_1.resolveCurrentSkillsPackageRoot)(runner.packageSearchDirs().length > 0
|
|
189
|
+
? runner.packageSearchDirs()
|
|
190
|
+
: [__dirname, process.cwd()]);
|
|
191
|
+
if (packageHasSkills(current))
|
|
192
|
+
return current;
|
|
193
|
+
throw Object.assign(new Error("Updated @alphafox/cli package does not contain Skills"), {
|
|
194
|
+
type: "install",
|
|
195
|
+
subtype: "updated_skills_missing",
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function updateUsage(message) {
|
|
199
|
+
return Object.assign(new Error(message), {
|
|
200
|
+
type: "usage",
|
|
201
|
+
subtype: "invalid_update_args",
|
|
202
|
+
status: 64,
|
|
203
|
+
});
|
|
204
|
+
}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CLI_CONTRACT_VERSION = exports.CLI_VERSION = exports.CLI_PACKAGE = exports.CLI_NAME = void 0;
|
|
4
4
|
exports.CLI_NAME = "alphafox";
|
|
5
5
|
exports.CLI_PACKAGE = "@alphafox/cli";
|
|
6
|
-
exports.CLI_VERSION = "0.3.
|
|
6
|
+
exports.CLI_VERSION = "0.3.5";
|
|
7
7
|
var operations_1 = require("./catalog/operations");
|
|
8
8
|
Object.defineProperty(exports, "CLI_CONTRACT_VERSION", { enumerable: true, get: function () { return operations_1.CATALOG_VERSION; } });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Issue tracker: Feishu Tasks
|
|
2
2
|
|
|
3
|
-
Issues and specs for this repo live as tasks in the **
|
|
3
|
+
Issues and specs for this repo live as tasks in the **AlphaFox-Issues** Feishu (Lark) tasklist. Use the `lark-cli` CLI ([`@larksuite/cli`](https://github.com/larksuite/cli)) for all operations, always with `--as user` — a task created by the bot identity is invisible in the human's task centre.
|
|
4
4
|
|
|
5
5
|
List: <https://applink.feishu.cn/client/todo/task_list?guid=6d628d79-cdfe-47cc-98f7-35561944494b>
|
|
6
6
|
|
|
@@ -46,7 +46,7 @@ Every other label is an option on the single-select `Type` field. Address an opt
|
|
|
46
46
|
## Conventions
|
|
47
47
|
|
|
48
48
|
- **Shared-list title** — prefix every issue/task title with `[alphafox-cli]` so the repository remains identifiable on the shared board.
|
|
49
|
-
- **Tracker boundary** — Matt Skills issues, specs, tickets, triage items, and wayfinder maps belong in `
|
|
49
|
+
- **Tracker boundary** — Matt Skills issues, specs, tickets, triage items, and wayfinder maps belong in `AlphaFox-Issues`, not a quarterly execution list. If quarterly planning initiated the work, link its absolute Feishu task URL instead of duplicating workflow state.
|
|
50
50
|
|
|
51
51
|
- **Create an issue** — one call sets body, section (triage role) and `Type`:
|
|
52
52
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Triage Labels
|
|
2
2
|
|
|
3
|
-
The skills speak in terms of five canonical triage roles. On this repo's tracker (Feishu Tasks) a role is not a label but a **section** of the
|
|
3
|
+
The skills speak in terms of five canonical triage roles. On this repo's tracker (Feishu Tasks) a role is not a label but a **section** of the AlphaFox-Issues tasklist — a task sits in exactly one, so the state machine can't be violated. `issue-tracker.md` holds the section GUIDs and the command that moves a task between them.
|
|
4
4
|
|
|
5
5
|
| Label in mattpocock/skills | Section in our tracker | Meaning |
|
|
6
6
|
| -------------------------- | ---------------------- | ---------------------------------------- |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AlphaFox CLI installation guide
|
|
2
2
|
|
|
3
3
|
The following steps are designed for AI Agents. Some steps require the user
|
|
4
4
|
to complete a browser or Device Flow approval. Always use
|
|
@@ -20,26 +20,25 @@ Skills do **not** register with Cursor / Claude Code / Codex from
|
|
|
20
20
|
# Install CLI
|
|
21
21
|
npm install -g @alphafox/cli
|
|
22
22
|
|
|
23
|
-
#
|
|
24
|
-
|
|
23
|
+
# Verify and globally sync the exact co-versioned Skills bundle
|
|
24
|
+
alphafox skills sync --format json --no-input
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
Do not install Skills from GitHub `main` as a fallback. The CLI verifies the
|
|
28
|
+
manifest and hashes inside the npm package before syncing. If sync fails, stop
|
|
29
|
+
and report the error rather than downloading a different Skills version.
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
npx -y skills add alphafoxai/alphafox-cli -y
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
To install Skills for every project on this machine instead of the current
|
|
35
|
-
repo, add `-g`:
|
|
31
|
+
For future updates:
|
|
36
32
|
|
|
37
33
|
```shell
|
|
38
|
-
|
|
34
|
+
alphafox update --check --format json --no-input
|
|
35
|
+
alphafox update --format json --no-input
|
|
39
36
|
```
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
`alphafox update` upgrades the npm CLI first, then syncs its bundled Skills.
|
|
39
|
+
Modified Skills are preserved and reported. Only use
|
|
40
|
+
`alphafox skills sync --force --yes` when the user explicitly wants to replace
|
|
41
|
+
them; a backup is created before replacement.
|
|
43
42
|
|
|
44
43
|
## Step 2: Login
|
|
45
44
|
|
|
@@ -88,8 +87,8 @@ Parse the JSON envelope: `ok === true` means success. Errors land on
|
|
|
88
87
|
## Step 4: Tell the user to restart
|
|
89
88
|
|
|
90
89
|
Ask the user to **restart the AI tool** so the new Skills are loaded.
|
|
91
|
-
Then they can ask the Agent to use
|
|
92
|
-
engine-backtest,
|
|
90
|
+
Then they can ask the Agent to use AlphaFox. The entry skill `alphafox` routes
|
|
91
|
+
to auth, market, engine-backtest, strategy, trading, and the rest.
|
|
93
92
|
|
|
94
93
|
## Human wizard (do not run this from an Agent)
|
|
95
94
|
|
|
@@ -100,6 +99,6 @@ stepping through the commands above:
|
|
|
100
99
|
npx @alphafox/cli@latest install
|
|
101
100
|
```
|
|
102
101
|
|
|
103
|
-
That wizard installs the CLI globally,
|
|
102
|
+
That wizard installs the CLI globally, verifies and syncs the packaged Skills,
|
|
104
103
|
and may prompt for `alphafox auth login --browser`. It is TTY-oriented.
|
|
105
104
|
Agents must follow Steps 1–4 in this document rather than the wizard.
|
package/docs/index.html
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<title>
|
|
6
|
+
<title>AlphaFox CLI</title>
|
|
7
7
|
<meta
|
|
8
8
|
name="description"
|
|
9
|
-
content="仅需一行指令,在任意 Agent 操作
|
|
9
|
+
content="仅需一行指令,在任意 Agent 操作 AlphaFox。安装 CLI 与 Skills,用 Public Application API 做回测、策略与交易。"
|
|
10
10
|
/>
|
|
11
11
|
<meta name="theme-color" content="#FF991F" />
|
|
12
12
|
<link rel="icon" href="favicon.svg" type="image/svg+xml" />
|
|
@@ -491,7 +491,7 @@
|
|
|
491
491
|
<body>
|
|
492
492
|
<header class="site-header">
|
|
493
493
|
<div class="site-header-inner">
|
|
494
|
-
<a class="brand" href="./" aria-label="
|
|
494
|
+
<a class="brand" href="./" aria-label="AlphaFox CLI">
|
|
495
495
|
<img class="mark" src="logo/alphafox-mark.svg" alt="" width="36" height="36" />
|
|
496
496
|
<img
|
|
497
497
|
class="wordmark wordmark-light"
|
|
@@ -544,8 +544,8 @@
|
|
|
544
544
|
|
|
545
545
|
<main class="wrap">
|
|
546
546
|
<section class="hero">
|
|
547
|
-
<p class="kicker">
|
|
548
|
-
<h1 class="headline" data-i18n="headline">仅需一行指令,在任意 Agent 操作
|
|
547
|
+
<p class="kicker">AlphaFox CLI</p>
|
|
548
|
+
<h1 class="headline" data-i18n="headline">仅需一行指令,在任意 Agent 操作 AlphaFox</h1>
|
|
549
549
|
<p class="lede" data-i18n="lede">
|
|
550
550
|
安装 CLI 与 Skills,用 Public Application API 做回测、策略与交易。
|
|
551
551
|
</p>
|
|
@@ -576,7 +576,7 @@
|
|
|
576
576
|
<section class="panel" id="panel-agent" role="tabpanel" aria-labelledby="tab-agent" hidden>
|
|
577
577
|
<p class="hint" data-i18n="agentHint">把下面这段话发给任意 AI Agent,它会按安装指南完成配置:</p>
|
|
578
578
|
<div class="cmd">
|
|
579
|
-
<code id="agent-cmd">帮我安装
|
|
579
|
+
<code id="agent-cmd">帮我安装 AlphaFox CLI:https://github.com/alphafoxai/alphafox-cli/blob/main/docs/alphafox-cli-installation-guide.md</code>
|
|
580
580
|
<button class="copy" type="button" data-copy="agent-cmd">
|
|
581
581
|
<svg viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
582
582
|
<rect x="5.5" y="5.5" width="8" height="8" rx="1.5" stroke="currentColor" />
|
|
@@ -604,7 +604,7 @@
|
|
|
604
604
|
</main>
|
|
605
605
|
|
|
606
606
|
<footer class="site-footer">
|
|
607
|
-
<span>© 2026
|
|
607
|
+
<span>© 2026 AlphaFox</span>
|
|
608
608
|
·
|
|
609
609
|
<a href="https://www.alphafox.app">alphafox.app</a>
|
|
610
610
|
</footer>
|
|
@@ -613,7 +613,7 @@
|
|
|
613
613
|
const copyLabels = { zh: { idle: "复制", done: "已复制" }, en: { idle: "Copy", done: "Copied" } };
|
|
614
614
|
const i18n = {
|
|
615
615
|
zh: {
|
|
616
|
-
headline: "仅需一行指令,在任意 Agent 操作
|
|
616
|
+
headline: "仅需一行指令,在任意 Agent 操作 AlphaFox",
|
|
617
617
|
lede: "安装 CLI 与 Skills,用 Public Application API 做回测、策略与交易。",
|
|
618
618
|
tabManual: "手动安装",
|
|
619
619
|
tabAgent: "通过 AI Agent 安装",
|
|
@@ -629,10 +629,10 @@
|
|
|
629
629
|
themeAriaDark: "切换到浅色模式",
|
|
630
630
|
langAria: "切换语言",
|
|
631
631
|
agentCmd:
|
|
632
|
-
"帮我安装
|
|
632
|
+
"帮我安装 AlphaFox CLI:https://github.com/alphafoxai/alphafox-cli/blob/main/docs/alphafox-cli-installation-guide.md",
|
|
633
633
|
},
|
|
634
634
|
en: {
|
|
635
|
-
headline: "One command to operate
|
|
635
|
+
headline: "One command to operate AlphaFox from any Agent",
|
|
636
636
|
lede: "Install the CLI and Skills, then run backtests, strategies, and trades through the Public Application API.",
|
|
637
637
|
tabManual: "Manual install",
|
|
638
638
|
tabAgent: "Install via AI Agent",
|
|
@@ -648,7 +648,7 @@
|
|
|
648
648
|
themeAriaDark: "Switch to light mode",
|
|
649
649
|
langAria: "Switch language",
|
|
650
650
|
agentCmd:
|
|
651
|
-
"Install
|
|
651
|
+
"Install AlphaFox CLI for me: https://github.com/alphafoxai/alphafox-cli/blob/main/docs/alphafox-cli-installation-guide.md",
|
|
652
652
|
},
|
|
653
653
|
};
|
|
654
654
|
|
|
@@ -58,12 +58,17 @@ OIDC-provenance release.
|
|
|
58
58
|
- Skills major aligns with CLI major. There is no separate Skills registry
|
|
59
59
|
in v1 and no silent download of a different Skills version at runtime.
|
|
60
60
|
- `npm install -g @alphafox/cli` places `skills/` next to the binary only.
|
|
61
|
-
Agents do not load that directory. `alphafox install`
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
Agents do not load that directory. `alphafox install`, `alphafox update`,
|
|
62
|
+
and `alphafox skills sync` verify `dist/skills-manifest.json`, then copy
|
|
63
|
+
only from that exact package into global Agent skill dirs.
|
|
64
|
+
- GitHub `main` is not an update fallback. A missing or invalid package
|
|
65
|
+
manifest fails closed instead of silently changing the Skills version.
|
|
66
|
+
- Sync state and per-Skill hashes live under the AlphaFox config directory.
|
|
67
|
+
Missing or unchanged stale Skills may update automatically. Modified Skills
|
|
68
|
+
require `alphafox skills sync --force --yes` and are backed up first.
|
|
69
|
+
- Retired Skills are removed only when the state proves they are AlphaFox
|
|
70
|
+
managed and unmodified. Failed copy/removal verification does not advance
|
|
71
|
+
sync state.
|
|
67
72
|
- `contractVersion` on the CLI profile MUST match the Public API
|
|
68
73
|
`contractVersion` (or the documented compatible range). Mismatch → fail
|
|
69
74
|
closed; do not download an older contract or degrade quietly.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alphafox/cli",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.5",
|
|
4
|
+
"description": "AlphaFox CLI — Agent/Human entry for the public Application API.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"bin": {
|
|
7
7
|
"alphafox": "bin/alphafox.js"
|
package/skills/account/SKILL.md
CHANGED