@wayai/cli 0.3.88 → 0.3.89
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/dist/index.js +86 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -82,8 +82,8 @@ import { fileURLToPath } from "url";
|
|
|
82
82
|
import { homedir, platform, arch } from "os";
|
|
83
83
|
function getVersion() {
|
|
84
84
|
try {
|
|
85
|
-
const
|
|
86
|
-
const pkg2 = JSON.parse(readFileSync(join(
|
|
85
|
+
const __dirname2 = dirname(fileURLToPath(import.meta.url));
|
|
86
|
+
const pkg2 = JSON.parse(readFileSync(join(__dirname2, "..", "..", "package.json"), "utf-8"));
|
|
87
87
|
return pkg2.version || "0.0.0";
|
|
88
88
|
} catch {
|
|
89
89
|
return "0.0.0";
|
|
@@ -96,16 +96,16 @@ function isInstalledPackage() {
|
|
|
96
96
|
return false;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
function initSentry(command2) {
|
|
99
|
+
function initSentry(command2, version) {
|
|
100
100
|
if (initialized) return;
|
|
101
101
|
if (process.env.WAYAI_TELEMETRY_DISABLED === "1") return;
|
|
102
102
|
const dsn = process.env.SENTRY_DSN || HARDCODED_DSN;
|
|
103
103
|
if (!process.env.SENTRY_DSN && !isInstalledPackage()) return;
|
|
104
|
-
const
|
|
104
|
+
const resolvedVersion = version ?? getVersion();
|
|
105
105
|
Sentry.init({
|
|
106
106
|
dsn,
|
|
107
107
|
tracesSampleRate: 0,
|
|
108
|
-
release: `wayai-cli@${
|
|
108
|
+
release: `wayai-cli@${resolvedVersion}`,
|
|
109
109
|
environment: "production",
|
|
110
110
|
defaultIntegrations: false,
|
|
111
111
|
beforeSend(event) {
|
|
@@ -20222,19 +20222,58 @@ var init_admin = __esm({
|
|
|
20222
20222
|
}
|
|
20223
20223
|
});
|
|
20224
20224
|
|
|
20225
|
-
// src/
|
|
20226
|
-
|
|
20227
|
-
|
|
20228
|
-
|
|
20229
|
-
function
|
|
20230
|
-
|
|
20231
|
-
|
|
20232
|
-
|
|
20233
|
-
|
|
20234
|
-
|
|
20225
|
+
// src/lib/version-status.ts
|
|
20226
|
+
function componentStatus(current, latest) {
|
|
20227
|
+
return { current, latest, behind: Boolean(current && latest && isNewerVersion(latest, current)) };
|
|
20228
|
+
}
|
|
20229
|
+
function resolveVersionStatus(cliVersion) {
|
|
20230
|
+
const cliLatest = readVersionCache(CLI_CACHE_FILE)?.latest ?? null;
|
|
20231
|
+
const repoRoot = findRepoRootSync() ?? process.cwd();
|
|
20232
|
+
const skillCurrent = lowestInstalledVersion(findInstalledSkills(repoRoot));
|
|
20233
|
+
const skillLatest = skillCurrent ? readVersionCache(SKILL_CACHE_FILE)?.latest ?? null : null;
|
|
20234
|
+
return { cli: componentStatus(cliVersion, cliLatest), skill: componentStatus(skillCurrent, skillLatest) };
|
|
20235
|
+
}
|
|
20236
|
+
function isVersionBehind(status) {
|
|
20237
|
+
return status.cli.behind || status.skill.behind;
|
|
20238
|
+
}
|
|
20239
|
+
function formatClientVersion(status) {
|
|
20240
|
+
const cli = `cli@${status.cli.current ?? "unknown"}`;
|
|
20241
|
+
if (!status.skill.current) return cli.slice(0, 64);
|
|
20242
|
+
const withSkill = `${cli} skill@${status.skill.current}`;
|
|
20243
|
+
return withSkill.length <= 64 ? withSkill : cli.slice(0, 64);
|
|
20244
|
+
}
|
|
20245
|
+
function buildStaleToolingWarning(status) {
|
|
20246
|
+
const lines = [];
|
|
20247
|
+
if (status.cli.behind) {
|
|
20248
|
+
lines.push(` CLI ${status.cli.current} \u2192 ${status.cli.latest} (run: wayai update)`);
|
|
20249
|
+
}
|
|
20250
|
+
if (status.skill.behind) {
|
|
20251
|
+
lines.push(` Skill ${status.skill.current} \u2192 ${status.skill.latest} (run: npx skills add wayai-pro/wayai-skill -y)`);
|
|
20252
|
+
}
|
|
20253
|
+
if (lines.length === 0) return null;
|
|
20254
|
+
return [
|
|
20255
|
+
"Your WayAI tooling is behind the latest release:",
|
|
20256
|
+
...lines,
|
|
20257
|
+
"",
|
|
20258
|
+
"A stale CLI or skill is the most common cause of a false bug report \u2014 the issue may",
|
|
20259
|
+
"already be fixed upstream. Update, then reproduce before reporting."
|
|
20260
|
+
].join("\n");
|
|
20261
|
+
}
|
|
20262
|
+
var init_version_status = __esm({
|
|
20263
|
+
"src/lib/version-status.ts"() {
|
|
20264
|
+
"use strict";
|
|
20265
|
+
init_version_cache();
|
|
20266
|
+
init_skill_version();
|
|
20267
|
+
init_workspace();
|
|
20268
|
+
init_utils();
|
|
20235
20269
|
}
|
|
20270
|
+
});
|
|
20271
|
+
|
|
20272
|
+
// src/commands/report-create.ts
|
|
20273
|
+
function isVersionGateDisabled() {
|
|
20274
|
+
return Boolean(process.env.NO_UPDATE_NOTIFIER || process.env.WAYAI_NO_UPDATE_CHECK);
|
|
20236
20275
|
}
|
|
20237
|
-
async function reportCreateCommand(args2) {
|
|
20276
|
+
async function reportCreateCommand(args2, cliVersion = null) {
|
|
20238
20277
|
let title;
|
|
20239
20278
|
let description;
|
|
20240
20279
|
let source;
|
|
@@ -20245,9 +20284,12 @@ async function reportCreateCommand(args2) {
|
|
|
20245
20284
|
let errorMessage;
|
|
20246
20285
|
let steps;
|
|
20247
20286
|
let context;
|
|
20287
|
+
let skipVersionCheck = false;
|
|
20248
20288
|
for (let i = 0; i < args2.length; i++) {
|
|
20249
20289
|
const arg = args2[i];
|
|
20250
|
-
if (arg === "--
|
|
20290
|
+
if (arg === "--skip-version-check") {
|
|
20291
|
+
skipVersionCheck = true;
|
|
20292
|
+
} else if (arg === "--title" || arg === "-t") {
|
|
20251
20293
|
title = args2[++i];
|
|
20252
20294
|
} else if (arg === "--description" || arg === "-d") {
|
|
20253
20295
|
description = args2[++i];
|
|
@@ -20285,8 +20327,23 @@ async function reportCreateCommand(args2) {
|
|
|
20285
20327
|
console.error(" -e, --error <text> Error message or stack trace");
|
|
20286
20328
|
console.error(" -s, --steps <text> Steps to reproduce");
|
|
20287
20329
|
console.error(" --context <text> Additional context");
|
|
20330
|
+
console.error(" --skip-version-check File even when the CLI/skill is behind the latest release");
|
|
20288
20331
|
process.exit(1);
|
|
20289
20332
|
}
|
|
20333
|
+
const versionStatus = resolveVersionStatus(cliVersion);
|
|
20334
|
+
const clientVersion = formatClientVersion(versionStatus);
|
|
20335
|
+
if (isVersionBehind(versionStatus) && !isVersionGateDisabled()) {
|
|
20336
|
+
const warning = buildStaleToolingWarning(versionStatus);
|
|
20337
|
+
if (!skipVersionCheck) {
|
|
20338
|
+
console.error(warning);
|
|
20339
|
+
console.error("");
|
|
20340
|
+
console.error("To file this report anyway, re-run with --skip-version-check.");
|
|
20341
|
+
process.exit(1);
|
|
20342
|
+
}
|
|
20343
|
+
console.error("Filing on stale tooling (--skip-version-check):");
|
|
20344
|
+
console.error(warning);
|
|
20345
|
+
console.error("");
|
|
20346
|
+
}
|
|
20290
20347
|
const { config, accessToken } = await requireAuth();
|
|
20291
20348
|
const client = new ApiClient({ apiUrl: config.api_url, accessToken });
|
|
20292
20349
|
const repoConfig = readRepoConfig();
|
|
@@ -20304,7 +20361,7 @@ async function reportCreateCommand(args2) {
|
|
|
20304
20361
|
error_message: errorMessage,
|
|
20305
20362
|
steps_to_reproduce: steps,
|
|
20306
20363
|
additional_context: context,
|
|
20307
|
-
client_version:
|
|
20364
|
+
client_version: clientVersion
|
|
20308
20365
|
});
|
|
20309
20366
|
if (result.created) {
|
|
20310
20367
|
console.log(`Report submitted: ${result.report_id}`);
|
|
@@ -20328,14 +20385,13 @@ async function reportCreateCommand(args2) {
|
|
|
20328
20385
|
throw err;
|
|
20329
20386
|
}
|
|
20330
20387
|
}
|
|
20331
|
-
var __dirname;
|
|
20332
20388
|
var init_report_create = __esm({
|
|
20333
20389
|
"src/commands/report-create.ts"() {
|
|
20334
20390
|
"use strict";
|
|
20335
20391
|
init_auth();
|
|
20336
20392
|
init_repo_config();
|
|
20337
20393
|
init_api_client();
|
|
20338
|
-
|
|
20394
|
+
init_version_status();
|
|
20339
20395
|
}
|
|
20340
20396
|
});
|
|
20341
20397
|
|
|
@@ -20344,11 +20400,11 @@ var report_exports = {};
|
|
|
20344
20400
|
__export(report_exports, {
|
|
20345
20401
|
reportCommand: () => reportCommand
|
|
20346
20402
|
});
|
|
20347
|
-
async function reportCommand(args2) {
|
|
20403
|
+
async function reportCommand(args2, cliVersion) {
|
|
20348
20404
|
const sub = args2[0];
|
|
20349
20405
|
switch (sub) {
|
|
20350
20406
|
case "create":
|
|
20351
|
-
await reportCreateCommand(args2.slice(1));
|
|
20407
|
+
await reportCreateCommand(args2.slice(1), cliVersion ?? null);
|
|
20352
20408
|
return;
|
|
20353
20409
|
case "edit":
|
|
20354
20410
|
await reportEditCommand(args2.slice(1));
|
|
@@ -20610,9 +20666,9 @@ var init_update = __esm({
|
|
|
20610
20666
|
|
|
20611
20667
|
// src/index.ts
|
|
20612
20668
|
init_sentry();
|
|
20613
|
-
import { readFileSync as
|
|
20614
|
-
import { fileURLToPath as
|
|
20615
|
-
import { dirname as
|
|
20669
|
+
import { readFileSync as readFileSync18 } from "fs";
|
|
20670
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
20671
|
+
import { dirname as dirname9, join as join24 } from "path";
|
|
20616
20672
|
|
|
20617
20673
|
// src/lib/errors.ts
|
|
20618
20674
|
init_api_client();
|
|
@@ -20791,11 +20847,11 @@ Run \`wayai admin skill install\` to update.`);
|
|
|
20791
20847
|
}
|
|
20792
20848
|
|
|
20793
20849
|
// src/index.ts
|
|
20794
|
-
var
|
|
20795
|
-
var pkg = JSON.parse(
|
|
20850
|
+
var __dirname = dirname9(fileURLToPath2(import.meta.url));
|
|
20851
|
+
var pkg = JSON.parse(readFileSync18(join24(__dirname, "..", "package.json"), "utf-8"));
|
|
20796
20852
|
var [, , command, ...args] = process.argv;
|
|
20797
20853
|
var isBackgroundRefresh = command === REFRESH_COMMAND;
|
|
20798
|
-
if (!isBackgroundRefresh) initSentry(command);
|
|
20854
|
+
if (!isBackgroundRefresh) initSentry(command, pkg.version);
|
|
20799
20855
|
async function main() {
|
|
20800
20856
|
if (shouldInterceptHelp(command, args, OWN_HELP_COMMANDS)) {
|
|
20801
20857
|
printHelp3();
|
|
@@ -20978,7 +21034,7 @@ async function main() {
|
|
|
20978
21034
|
}
|
|
20979
21035
|
case "report": {
|
|
20980
21036
|
const { reportCommand: reportCommand2 } = await Promise.resolve().then(() => (init_report(), report_exports));
|
|
20981
|
-
await reportCommand2(args);
|
|
21037
|
+
await reportCommand2(args, pkg.version);
|
|
20982
21038
|
break;
|
|
20983
21039
|
}
|
|
20984
21040
|
case "update": {
|
|
@@ -21115,7 +21171,7 @@ async function runForeground() {
|
|
|
21115
21171
|
try {
|
|
21116
21172
|
await main();
|
|
21117
21173
|
if (command && !SKIP_UPDATE_CHECK.includes(command) && !wantsHelp(args)) {
|
|
21118
|
-
showUpdateNudges(pkg.version,
|
|
21174
|
+
showUpdateNudges(pkg.version, fileURLToPath2(import.meta.url));
|
|
21119
21175
|
}
|
|
21120
21176
|
await closeSentry();
|
|
21121
21177
|
} catch (err) {
|