@alphafox/cli 0.3.5 → 0.3.6
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 +3 -0
- package/dist/commands/run.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -1
- package/dist/skills-manifest.json +37 -37
- package/dist/update/notify.d.ts +24 -0
- package/dist/update/notify.js +109 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/skills/account/SKILL.md +1 -1
- package/skills/admin/SKILL.md +1 -1
- package/skills/alphafox/SKILL.md +24 -2
- package/skills/alphafox-shared/SKILL.md +10 -2
- package/skills/auth/SKILL.md +1 -1
- package/skills/engine-backtest/SKILL.md +1 -1
- package/skills/exchange/SKILL.md +1 -1
- package/skills/market/SKILL.md +1 -1
- package/skills/notification/SKILL.md +1 -1
- package/skills/strategy/SKILL.md +1 -1
- package/skills/trading/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -45,6 +45,9 @@ alphafox update
|
|
|
45
45
|
alphafox skills status
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
Ordinary CLI commands check npm at most once every 24 hours and only print a
|
|
49
|
+
stderr notice when a newer version exists. They never auto-upgrade.
|
|
50
|
+
|
|
48
51
|
`alphafox update` upgrades the npm package and then syncs the exact Skills
|
|
49
52
|
bundle shipped inside it. It never updates Skills independently from GitHub.
|
|
50
53
|
Locally modified Skills are reported and preserved; use
|
package/dist/commands/run.js
CHANGED
|
@@ -16,6 +16,7 @@ const version_1 = require("../version");
|
|
|
16
16
|
const run_command_1 = require("../engine-backtest/run-command");
|
|
17
17
|
const run_command_2 = require("../resolve-symbols/run-command");
|
|
18
18
|
const run_command_3 = require("../skills/run-command");
|
|
19
|
+
const notify_1 = require("../update/notify");
|
|
19
20
|
const run_command_4 = require("../update/run-command");
|
|
20
21
|
const validate_body_1 = require("../catalog/validate-body");
|
|
21
22
|
const types_1 = require("../install/types");
|
|
@@ -107,6 +108,14 @@ async function runCli(argv, env = process.env) {
|
|
|
107
108
|
return 0;
|
|
108
109
|
}
|
|
109
110
|
try {
|
|
111
|
+
if (!(0, notify_1.shouldSkipUpdateCheck)(cmd, env)) {
|
|
112
|
+
try {
|
|
113
|
+
await (0, notify_1.maybeNotifyCliUpdate)({ env, currentVersion: version_1.CLI_VERSION });
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// Update notices must never fail a command.
|
|
117
|
+
}
|
|
118
|
+
}
|
|
110
119
|
if (cmd !== "version" &&
|
|
111
120
|
cmd !== "install" &&
|
|
112
121
|
cmd !== "update" &&
|
package/dist/index.d.ts
CHANGED
|
@@ -20,3 +20,4 @@ export { AGENT_INSTALL_GUIDE_BLOB_URL, AGENT_INSTALL_GUIDE_URL, SKILLS_GITHUB_SO
|
|
|
20
20
|
export { buildSkillsManifest, inspectSkills, loadAndVerifySkillsManifest, loadSkillsState, syncSkills, writeSkillsManifest, } from "./skills/manager";
|
|
21
21
|
export { inspectCurrentSkills, installedSkillsRoot, skillsStatePath, syncCurrentSkills, } from "./skills/run-command";
|
|
22
22
|
export { executeCliUpdate, parseUpdateArgs, } from "./update/run-command";
|
|
23
|
+
export { formatUpdateNotice, maybeNotifyCliUpdate, shouldSkipUpdateCheck, } from "./update/notify";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateCatalogWriteBody = exports.CLI_CONTRACT_VERSION = exports.CLI_PACKAGE = exports.CLI_VERSION = exports.checkGeneratedCatalogCompatibility = exports.buildCapabilityManifest = exports.getOperationSchemaDocument = exports.findCatalogOperationByRoute = exports.findCatalogOperation = exports.COMPATIBILITY_RANGE = exports.CATALOG_VERSION = exports.CATALOG_SOURCE = exports.CATALOG_OPERATIONS = exports.startLoopbackCallbackServer = exports.runBrowserPkceLogin = exports.accessTokenNeedsRefresh = exports.refreshStoredTokensOrNull = exports.refreshStoredTokens = exports.requiresHighRiskConfirmation = exports.inferRawApiRisk = exports.assertHighRiskConfirmation = exports.resolveTypedCommand = exports.checkCliCompatibility = exports.pathTemplateMatches = exports.normalizeApiPath = exports.isInternalDisallowedPath = exports.isFacadeAllowlistedPath = exports.WINDOWS_CRED_MAX_BYTES = exports.windowsCredentialTarget = exports.linuxSecretToolBin = exports.linuxSecretServiceArgs = exports.keychainPlatform = exports.probeOsKeychain = exports.getLastTokenSaveResult = exports.tokenFingerprint = exports.deleteTokens = exports.loadTokens = exports.saveTokens = exports.assertNoTokenFields = exports.saveConfigFile = exports.loadConfigFile = exports.resolveProfile = exports.applyJqFilter = exports.writeError = exports.writeSuccess = exports.parseJsonEnvelope = exports.errorEnvelope = exports.successEnvelope = exports.parseGlobalFlags = exports.runCli = void 0;
|
|
4
|
-
exports.parseUpdateArgs = exports.executeCliUpdate = exports.syncCurrentSkills = exports.skillsStatePath = exports.installedSkillsRoot = exports.inspectCurrentSkills = exports.writeSkillsManifest = exports.syncSkills = exports.loadSkillsState = exports.loadAndVerifySkillsManifest = exports.inspectSkills = exports.buildSkillsManifest = exports.SKILLS_GITHUB_SOURCE = exports.AGENT_INSTALL_GUIDE_URL = exports.AGENT_INSTALL_GUIDE_BLOB_URL = exports.skillsListHasAlphafox = exports.semverLessThan = exports.runInstallWizard = exports.parseInstallArgs = exports.loadJsonArg = exports.parseRequestBodyFlags = void 0;
|
|
4
|
+
exports.shouldSkipUpdateCheck = exports.maybeNotifyCliUpdate = exports.formatUpdateNotice = exports.parseUpdateArgs = exports.executeCliUpdate = exports.syncCurrentSkills = exports.skillsStatePath = exports.installedSkillsRoot = exports.inspectCurrentSkills = exports.writeSkillsManifest = exports.syncSkills = exports.loadSkillsState = exports.loadAndVerifySkillsManifest = exports.inspectSkills = exports.buildSkillsManifest = exports.SKILLS_GITHUB_SOURCE = exports.AGENT_INSTALL_GUIDE_URL = exports.AGENT_INSTALL_GUIDE_BLOB_URL = exports.skillsListHasAlphafox = exports.semverLessThan = exports.runInstallWizard = exports.parseInstallArgs = exports.loadJsonArg = exports.parseRequestBodyFlags = void 0;
|
|
5
5
|
var run_1 = require("./commands/run");
|
|
6
6
|
Object.defineProperty(exports, "runCli", { enumerable: true, get: function () { return run_1.runCli; } });
|
|
7
7
|
Object.defineProperty(exports, "parseGlobalFlags", { enumerable: true, get: function () { return run_1.parseGlobalFlags; } });
|
|
@@ -95,3 +95,7 @@ Object.defineProperty(exports, "syncCurrentSkills", { enumerable: true, get: fun
|
|
|
95
95
|
var run_command_2 = require("./update/run-command");
|
|
96
96
|
Object.defineProperty(exports, "executeCliUpdate", { enumerable: true, get: function () { return run_command_2.executeCliUpdate; } });
|
|
97
97
|
Object.defineProperty(exports, "parseUpdateArgs", { enumerable: true, get: function () { return run_command_2.parseUpdateArgs; } });
|
|
98
|
+
var notify_1 = require("./update/notify");
|
|
99
|
+
Object.defineProperty(exports, "formatUpdateNotice", { enumerable: true, get: function () { return notify_1.formatUpdateNotice; } });
|
|
100
|
+
Object.defineProperty(exports, "maybeNotifyCliUpdate", { enumerable: true, get: function () { return notify_1.maybeNotifyCliUpdate; } });
|
|
101
|
+
Object.defineProperty(exports, "shouldSkipUpdateCheck", { enumerable: true, get: function () { return notify_1.shouldSkipUpdateCheck; } });
|
|
@@ -1,141 +1,141 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"packageName": "@alphafox/cli",
|
|
4
|
-
"packageVersion": "0.3.
|
|
4
|
+
"packageVersion": "0.3.6",
|
|
5
5
|
"contractVersion": "2026-08-13",
|
|
6
|
-
"bundleHash": "
|
|
6
|
+
"bundleHash": "1eb4c16a941eee4c125efc6bb64ed7bb0db1d12b71f71cae66e55e64f600cf9a",
|
|
7
7
|
"skills": [
|
|
8
8
|
{
|
|
9
9
|
"name": "alphafox",
|
|
10
|
-
"version": "0.3.
|
|
10
|
+
"version": "0.3.6",
|
|
11
11
|
"files": [
|
|
12
12
|
{
|
|
13
13
|
"path": "SKILL.md",
|
|
14
|
-
"sha256": "
|
|
15
|
-
"size":
|
|
14
|
+
"sha256": "a60f579e6321533d4f965c607f1158ddb50d1a89905d8793eca0b401b3f67fd2",
|
|
15
|
+
"size": 3055
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
|
-
"hash": "
|
|
18
|
+
"hash": "c47e6e2d6154e831a681b731e123053c2d20c6c77654191f0a78ae2137ce5304"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"name": "alphafox-account",
|
|
22
|
-
"version": "0.3.
|
|
22
|
+
"version": "0.3.6",
|
|
23
23
|
"files": [
|
|
24
24
|
{
|
|
25
25
|
"path": "SKILL.md",
|
|
26
|
-
"sha256": "
|
|
26
|
+
"sha256": "c60baab539cca008ccc48d53f0262d7a019db82b3945402d16b5ac84624b475f",
|
|
27
27
|
"size": 783
|
|
28
28
|
}
|
|
29
29
|
],
|
|
30
|
-
"hash": "
|
|
30
|
+
"hash": "e828192ec19a24bc18ce64d07a583eaba498e6a0c356214dbe18ccae6e9f6a6d"
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
"name": "alphafox-admin",
|
|
34
|
-
"version": "0.3.
|
|
34
|
+
"version": "0.3.6",
|
|
35
35
|
"files": [
|
|
36
36
|
{
|
|
37
37
|
"path": "SKILL.md",
|
|
38
|
-
"sha256": "
|
|
38
|
+
"sha256": "87bbc12b803be021d94ad8161293263ce69e1d6c50f887a245ebe5c0a285e4f6",
|
|
39
39
|
"size": 787
|
|
40
40
|
}
|
|
41
41
|
],
|
|
42
|
-
"hash": "
|
|
42
|
+
"hash": "2881be10858efaad4543ffbe94f3bf87a91d4b0a4f3d905c3e0a5b8463e8756b"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
"name": "alphafox-auth",
|
|
46
|
-
"version": "0.3.
|
|
46
|
+
"version": "0.3.6",
|
|
47
47
|
"files": [
|
|
48
48
|
{
|
|
49
49
|
"path": "SKILL.md",
|
|
50
|
-
"sha256": "
|
|
50
|
+
"sha256": "99e954df23206b0deb32761ce39396897d5af2ee8852e3a8340ed1b9c2e88a46",
|
|
51
51
|
"size": 1919
|
|
52
52
|
}
|
|
53
53
|
],
|
|
54
|
-
"hash": "
|
|
54
|
+
"hash": "659ca92bdfa0b31bcd1d39d7af151c308f1f9e7cd541bd38cf89326a825a38b8"
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
"name": "alphafox-engine-backtest",
|
|
58
|
-
"version": "0.3.
|
|
58
|
+
"version": "0.3.6",
|
|
59
59
|
"files": [
|
|
60
60
|
{
|
|
61
61
|
"path": "SKILL.md",
|
|
62
|
-
"sha256": "
|
|
62
|
+
"sha256": "176c329a665709461403671d34e73dd5b58bf389a328010c8a32cec5b949a9c5",
|
|
63
63
|
"size": 7346
|
|
64
64
|
}
|
|
65
65
|
],
|
|
66
|
-
"hash": "
|
|
66
|
+
"hash": "23db5ab285f8600a43561ce3d4b7641ea45cd55c7c3b16d9f6fb7ff0c862b379"
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
"name": "alphafox-exchange",
|
|
70
|
-
"version": "0.3.
|
|
70
|
+
"version": "0.3.6",
|
|
71
71
|
"files": [
|
|
72
72
|
{
|
|
73
73
|
"path": "SKILL.md",
|
|
74
|
-
"sha256": "
|
|
74
|
+
"sha256": "089db4794cd55ba04278d4616cd6d5e92bc4c1d4c7c183001ea363bc4eeba578",
|
|
75
75
|
"size": 743
|
|
76
76
|
}
|
|
77
77
|
],
|
|
78
|
-
"hash": "
|
|
78
|
+
"hash": "d4b0fe876ced82185eb477a23420cb24a8990f3dcbb6d4d5e9412dfd4cd2c279"
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
"name": "alphafox-market",
|
|
82
|
-
"version": "0.3.
|
|
82
|
+
"version": "0.3.6",
|
|
83
83
|
"files": [
|
|
84
84
|
{
|
|
85
85
|
"path": "SKILL.md",
|
|
86
|
-
"sha256": "
|
|
86
|
+
"sha256": "79fd7431c119b9d9318566c0419e2820ad9b06f0fda2882fdf9d1d7f4c1b9566",
|
|
87
87
|
"size": 1801
|
|
88
88
|
}
|
|
89
89
|
],
|
|
90
|
-
"hash": "
|
|
90
|
+
"hash": "8814883b9b5bfb7eab4406fe1236091410dcb1130d4904dae8756e1302a02687"
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
"name": "alphafox-notification",
|
|
94
|
-
"version": "0.3.
|
|
94
|
+
"version": "0.3.6",
|
|
95
95
|
"files": [
|
|
96
96
|
{
|
|
97
97
|
"path": "SKILL.md",
|
|
98
|
-
"sha256": "
|
|
98
|
+
"sha256": "9a90360b83b72bb252349612cb052ffded40d00e07ca8568b76a6b13479252ac",
|
|
99
99
|
"size": 698
|
|
100
100
|
}
|
|
101
101
|
],
|
|
102
|
-
"hash": "
|
|
102
|
+
"hash": "99f8309b235b2b89734ed49d0a9e0e8981b5216025815fbe69f9101cf4f412cc"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
105
|
"name": "alphafox-shared",
|
|
106
|
-
"version": "0.3.
|
|
106
|
+
"version": "0.3.6",
|
|
107
107
|
"files": [
|
|
108
108
|
{
|
|
109
109
|
"path": "SKILL.md",
|
|
110
|
-
"sha256": "
|
|
111
|
-
"size":
|
|
110
|
+
"sha256": "60051a6c9b789e306ec968d3c8762a75039c34a0db2470dfddd1063bf2a3553f",
|
|
111
|
+
"size": 5071
|
|
112
112
|
}
|
|
113
113
|
],
|
|
114
|
-
"hash": "
|
|
114
|
+
"hash": "20832738f9f15063291309871197b6274fd24f2630bd2525092ac017f7491b68"
|
|
115
115
|
},
|
|
116
116
|
{
|
|
117
117
|
"name": "alphafox-strategy",
|
|
118
|
-
"version": "0.3.
|
|
118
|
+
"version": "0.3.6",
|
|
119
119
|
"files": [
|
|
120
120
|
{
|
|
121
121
|
"path": "SKILL.md",
|
|
122
|
-
"sha256": "
|
|
122
|
+
"sha256": "e4188e115eca6610c482bbcdf11ab1eb455cb5b6f242af96d1d8090e6ce9ce9d",
|
|
123
123
|
"size": 1450
|
|
124
124
|
}
|
|
125
125
|
],
|
|
126
|
-
"hash": "
|
|
126
|
+
"hash": "878fd5c365eb33a431e91f6922a8cf45bcf94a7136b0105d50f3b487112c3573"
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
129
|
"name": "alphafox-trading",
|
|
130
|
-
"version": "0.3.
|
|
130
|
+
"version": "0.3.6",
|
|
131
131
|
"files": [
|
|
132
132
|
{
|
|
133
133
|
"path": "SKILL.md",
|
|
134
|
-
"sha256": "
|
|
134
|
+
"sha256": "098e0f975ae9f0169b0da696b76e74ffd3c6748e898e7c4f8c8f8a33aec47dc8",
|
|
135
135
|
"size": 1435
|
|
136
136
|
}
|
|
137
137
|
],
|
|
138
|
-
"hash": "
|
|
138
|
+
"hash": "99b72870808f871ddeffd69ee89872e8532f2847494a0e5ad83de48ad58c675a"
|
|
139
139
|
}
|
|
140
140
|
]
|
|
141
141
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const UPDATE_CHECK_INTERVAL_MS: number;
|
|
2
|
+
export interface UpdateCheckState {
|
|
3
|
+
readonly schemaVersion: 1;
|
|
4
|
+
readonly checkedAt: string;
|
|
5
|
+
readonly currentVersion: string;
|
|
6
|
+
readonly latestVersion: string | null;
|
|
7
|
+
readonly updateAvailable: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface UpdateNoticeResult {
|
|
10
|
+
readonly checked: boolean;
|
|
11
|
+
readonly notified: boolean;
|
|
12
|
+
readonly latestVersion: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface UpdateNoticeDeps {
|
|
15
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
16
|
+
readonly currentVersion?: string;
|
|
17
|
+
readonly now?: Date;
|
|
18
|
+
readonly fetchLatest?: () => Promise<string>;
|
|
19
|
+
readonly writeNotice?: (line: string) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare function updateCheckStatePath(env?: NodeJS.ProcessEnv): string;
|
|
22
|
+
export declare function formatUpdateNotice(currentVersion: string, latestVersion: string): string;
|
|
23
|
+
export declare function shouldSkipUpdateCheck(command: string | undefined, env?: NodeJS.ProcessEnv): boolean;
|
|
24
|
+
export declare function maybeNotifyCliUpdate(deps?: UpdateNoticeDeps): Promise<UpdateNoticeResult>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UPDATE_CHECK_INTERVAL_MS = void 0;
|
|
4
|
+
exports.updateCheckStatePath = updateCheckStatePath;
|
|
5
|
+
exports.formatUpdateNotice = formatUpdateNotice;
|
|
6
|
+
exports.shouldSkipUpdateCheck = shouldSkipUpdateCheck;
|
|
7
|
+
exports.maybeNotifyCliUpdate = maybeNotifyCliUpdate;
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
10
|
+
const profiles_1 = require("../config/profiles");
|
|
11
|
+
const exec_1 = require("../install/exec");
|
|
12
|
+
const wizard_1 = require("../install/wizard");
|
|
13
|
+
const version_1 = require("../version");
|
|
14
|
+
exports.UPDATE_CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
15
|
+
const NPM_VIEW_TIMEOUT_MS = 4_000;
|
|
16
|
+
function updateCheckStatePath(env = process.env) {
|
|
17
|
+
return (0, node_path_1.join)((0, profiles_1.defaultConfigDir)(env), "update-check.json");
|
|
18
|
+
}
|
|
19
|
+
function formatUpdateNotice(currentVersion, latestVersion) {
|
|
20
|
+
return `[alphafox] update available: ${currentVersion} -> ${latestVersion}. After the user confirms, run: alphafox update --format json --no-input`;
|
|
21
|
+
}
|
|
22
|
+
function shouldSkipUpdateCheck(command, env = process.env) {
|
|
23
|
+
if (env.ALPHAFOX_SKIP_UPDATE_CHECK === "1")
|
|
24
|
+
return true;
|
|
25
|
+
return command === "update" || command === "install";
|
|
26
|
+
}
|
|
27
|
+
async function maybeNotifyCliUpdate(deps = {}) {
|
|
28
|
+
const env = deps.env ?? process.env;
|
|
29
|
+
const currentVersion = deps.currentVersion ?? version_1.CLI_VERSION;
|
|
30
|
+
const now = deps.now ?? new Date();
|
|
31
|
+
const writeNotice = deps.writeNotice ??
|
|
32
|
+
((line) => {
|
|
33
|
+
process.stderr.write(`${line}\n`);
|
|
34
|
+
});
|
|
35
|
+
const previous = loadUpdateCheckState(updateCheckStatePath(env));
|
|
36
|
+
if (previous &&
|
|
37
|
+
now.getTime() - Date.parse(previous.checkedAt) < exports.UPDATE_CHECK_INTERVAL_MS) {
|
|
38
|
+
return {
|
|
39
|
+
checked: false,
|
|
40
|
+
notified: false,
|
|
41
|
+
latestVersion: previous.latestVersion,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
let latestVersion = null;
|
|
45
|
+
try {
|
|
46
|
+
latestVersion = await (deps.fetchLatest ?? defaultFetchLatest)(env);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
saveUpdateCheckState(updateCheckStatePath(env), {
|
|
50
|
+
schemaVersion: 1,
|
|
51
|
+
checkedAt: now.toISOString(),
|
|
52
|
+
currentVersion,
|
|
53
|
+
latestVersion: previous?.latestVersion ?? null,
|
|
54
|
+
updateAvailable: false,
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
checked: true,
|
|
58
|
+
notified: false,
|
|
59
|
+
latestVersion: previous?.latestVersion ?? null,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const updateAvailable = (0, wizard_1.semverLessThan)(currentVersion, latestVersion);
|
|
63
|
+
saveUpdateCheckState(updateCheckStatePath(env), {
|
|
64
|
+
schemaVersion: 1,
|
|
65
|
+
checkedAt: now.toISOString(),
|
|
66
|
+
currentVersion,
|
|
67
|
+
latestVersion,
|
|
68
|
+
updateAvailable,
|
|
69
|
+
});
|
|
70
|
+
if (updateAvailable) {
|
|
71
|
+
writeNotice(formatUpdateNotice(currentVersion, latestVersion));
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
checked: true,
|
|
75
|
+
notified: updateAvailable,
|
|
76
|
+
latestVersion,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function loadUpdateCheckState(path) {
|
|
80
|
+
if (!(0, node_fs_1.existsSync)(path))
|
|
81
|
+
return null;
|
|
82
|
+
try {
|
|
83
|
+
const parsed = JSON.parse((0, node_fs_1.readFileSync)(path, "utf8"));
|
|
84
|
+
if (parsed.schemaVersion !== 1 ||
|
|
85
|
+
typeof parsed.checkedAt !== "string" ||
|
|
86
|
+
Number.isNaN(Date.parse(parsed.checkedAt))) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
return parsed;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function saveUpdateCheckState(path, state) {
|
|
96
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.join)(path, ".."), { recursive: true });
|
|
97
|
+
(0, node_fs_1.writeFileSync)(path, `${JSON.stringify(state, null, 2)}\n`, { mode: 0o600 });
|
|
98
|
+
}
|
|
99
|
+
async function defaultFetchLatest(env) {
|
|
100
|
+
const runner = (0, exec_1.createDefaultInstallRunner)(env, []);
|
|
101
|
+
const { stdout } = await runner.exec("npm", ["view", version_1.CLI_PACKAGE, "version"], {
|
|
102
|
+
timeoutMs: NPM_VIEW_TIMEOUT_MS,
|
|
103
|
+
});
|
|
104
|
+
const version = stdout.trim();
|
|
105
|
+
if (!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(version)) {
|
|
106
|
+
throw new Error(`invalid npm version: ${version}`);
|
|
107
|
+
}
|
|
108
|
+
return version;
|
|
109
|
+
}
|
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.6";
|
|
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; } });
|
package/package.json
CHANGED
package/skills/account/SKILL.md
CHANGED
package/skills/admin/SKILL.md
CHANGED
package/skills/alphafox/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: alphafox
|
|
3
|
-
description: AlphaFox CLI entry router. Use for any AlphaFox request — install, update, login, whoami, 回测, engine backtest, strategy chat, traders, ticker/标的 resolve, market data, exchange connectors, wallet, subscriptions, notifications, or admin. Start here, then open the routed domain skill. Do not guess alphafox-engine-backtest vs alphafox-strategy from memory.
|
|
4
|
-
version: 0.3.
|
|
3
|
+
description: AlphaFox CLI entry router. Use for any AlphaFox request — install, update, login, whoami, 回测, engine backtest, strategy chat, traders, ticker/标的 resolve, market data, exchange connectors, wallet, subscriptions, notifications, or admin. If a CLI command prints `[alphafox] update available`, ask the user「检测到新的版本,是否需要我帮你升级?」and only then run `alphafox update --format json --no-input`. Start here, then open the routed domain skill. Do not guess alphafox-engine-backtest vs alphafox-strategy from memory.
|
|
4
|
+
version: 0.3.6
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AlphaFox
|
|
@@ -29,6 +29,28 @@ Human-mentioned tickers go through `alphafox-market` (`alphafox resolve-symbols`
|
|
|
29
29
|
|
|
30
30
|
If several rows apply, load **all** of them (typical: `alphafox-shared` + `alphafox-market` + one domain skill).
|
|
31
31
|
|
|
32
|
+
## Upgrade reminder
|
|
33
|
+
|
|
34
|
+
The CLI may print this on **stderr** at most once every 24 hours:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
[alphafox] update available: 0.3.5 -> 0.3.6. After the user confirms, run: alphafox update --format json --no-input
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If you see that notice (or `updateAvailable: true` from `alphafox update --check`):
|
|
41
|
+
|
|
42
|
+
1. Ask the user: **检测到新的版本,是否需要我帮你升级?**
|
|
43
|
+
2. Wait for an explicit yes. Do not upgrade on your own.
|
|
44
|
+
3. After they confirm:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
alphafox update --format json --no-input
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
4. Tell the user to **restart the AI tool** so the new Skills load.
|
|
51
|
+
|
|
52
|
+
Do not install Skills from GitHub. Details and dry-run / check commands live in `alphafox-shared`.
|
|
53
|
+
|
|
32
54
|
## Do not mix these backtest paths
|
|
33
55
|
|
|
34
56
|
- Local Engine tape + wasm + optional persist → `alphafox-engine-backtest` (`alphafox engine-backtest run`, hyphen).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: alphafox-shared
|
|
3
3
|
description: Shared AlphaFox CLI rules for Agents — auth, profiles, envelopes, risk gates, and public operationIds only.
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.6
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AlphaFox shared Agent contract
|
|
@@ -24,7 +24,13 @@ npx @alphafox/cli version --format json --no-input
|
|
|
24
24
|
npx @alphafox/cli doctor --format json --no-input
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
The CLI checks npm at most once every 24 hours and only prints a notice on
|
|
28
|
+
**stderr**. It never auto-upgrades. If you see
|
|
29
|
+
`[alphafox] update available` (or `updateAvailable: true`), ask the user:
|
|
30
|
+
|
|
31
|
+
**检测到新的版本,是否需要我帮你升级?**
|
|
32
|
+
|
|
33
|
+
Wait for an explicit yes. Then keep CLI and Skills co-versioned:
|
|
28
34
|
|
|
29
35
|
```bash
|
|
30
36
|
alphafox update --check --format json --no-input
|
|
@@ -32,6 +38,8 @@ alphafox update --format json --no-input
|
|
|
32
38
|
alphafox skills status --format json --no-input
|
|
33
39
|
```
|
|
34
40
|
|
|
41
|
+
After a successful `alphafox update`, tell the user to restart the AI tool.
|
|
42
|
+
|
|
35
43
|
Never update AlphaFox Skills independently from GitHub. If `skills status`
|
|
36
44
|
reports local modifications, stop and ask before using
|
|
37
45
|
`alphafox skills sync --force --yes`; the CLI backs up replaced files.
|
package/skills/auth/SKILL.md
CHANGED
package/skills/exchange/SKILL.md
CHANGED
package/skills/market/SKILL.md
CHANGED
package/skills/strategy/SKILL.md
CHANGED