@canonry/canonry 7.130.1 → 7.131.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/assets/agent-workspace/skills/canonry/references/canonry-cli.md +5 -3
- package/dist/{activity-VIJVNTMK.js → activity-URKAZ4QI.js} +4 -4
- package/dist/{ads-PLZRG4BQ.js → ads-OEKDHREI.js} +4 -4
- package/dist/{agent-RFRMOTLE.js → agent-TBU46LO6.js} +6 -6
- package/dist/{agent-ask-CB756SUB.js → agent-ask-EDJZGROO.js} +25 -21
- package/dist/agent-conversations-BQKCD4CA.js +44 -0
- package/dist/{agent-journeys-PLYAVLGB.js → agent-journeys-ASY5XCAJ.js} +3 -3
- package/dist/agent-memory-HAGNNLCP.js +74 -0
- package/dist/agent-providers-WUDOCAHF.js +49 -0
- package/dist/agent-transcript-4MAQ7NCM.js +62 -0
- package/dist/{analytics-W6B2FQSA.js → analytics-RYRF5TFC.js} +3 -3
- package/dist/{answerability-BDOOPOJF.js → answerability-7VPMCZHE.js} +3 -3
- package/dist/{apply-LCANKKT5.js → apply-BNTPH5FW.js} +8 -5
- package/dist/{backfill-AM2VXWLI.js → backfill-2DYJLCOU.js} +3 -3
- package/dist/{backlinks-ZXSN3XNV.js → backlinks-5HZTCZFW.js} +11 -6
- package/dist/{bing-FMDKRCXN.js → bing-S6BOIOTS.js} +31 -17
- package/dist/{bootstrap-IHKKYDBO.js → bootstrap-EITWL66P.js} +6 -6
- package/dist/{cdp-ASPLW35M.js → cdp-TY2TZB7J.js} +13 -7
- package/dist/{chunk-6UU2I6AG.js → chunk-3CDHCDCE.js} +22 -21
- package/dist/{chunk-JUZ4ZCOX.js → chunk-3GAJD5NP.js} +3 -3
- package/dist/{chunk-MARIMDMX.js → chunk-3LXRY57V.js} +60 -48
- package/dist/{chunk-56TGVPRB.js → chunk-3STPYNCP.js} +3 -3
- package/dist/{chunk-Z77D43M5.js → chunk-623X526L.js} +1 -1
- package/dist/{chunk-M3BKRPB7.js → chunk-63FHJJUO.js} +435 -444
- package/dist/chunk-APKBR2BP.js +40 -0
- package/dist/{chunk-VEDGR4LZ.js → chunk-BJWPYUKT.js} +1 -1
- package/dist/{chunk-NUYKLS2R.js → chunk-CUXA47XW.js} +2 -2
- package/dist/{chunk-HH6FQW5W.js → chunk-DYDATNE5.js} +6 -3
- package/dist/{chunk-S6X3HHSN.js → chunk-IPUZGRSN.js} +2 -2
- package/dist/{chunk-WZPKPA6I.js → chunk-KJX5CMPC.js} +1 -1
- package/dist/{chunk-4ISL4JNK.js → chunk-LXFLUFQT.js} +2 -2
- package/dist/{chunk-ZZSKYOHV.js → chunk-NK4G4JPQ.js} +2 -2
- package/dist/{chunk-JMJSAK2H.js → chunk-NYZH7SM2.js} +2 -2
- package/dist/{chunk-MQFH765X.js → chunk-P4ETUNQR.js} +3 -3
- package/dist/{chunk-VON4PHNS.js → chunk-RGT2S3VS.js} +35 -15
- package/dist/{chunk-KQQERQJ2.js → chunk-RSB3X7UR.js} +2 -2
- package/dist/{chunk-52J7GFCK.js → chunk-T6CABZ3N.js} +1 -1
- package/dist/{chunk-GVCL4XBU.js → chunk-UFVVOJU3.js} +2 -2
- package/dist/{chunk-N5GK27RW.js → chunk-WIQBXZMU.js} +3 -3
- package/dist/{chunk-ZHWJJVCT.js → chunk-X3ES2XOJ.js} +1 -1
- package/dist/{chunk-QRIKJT6Y.js → chunk-Y7JEJNNS.js} +32 -3
- package/dist/{chunk-VEBSXHB2.js → chunk-ZSVQTHX3.js} +4 -3
- package/dist/{citations-YWXR3WBL.js → citations-ERRYYKNY.js} +7 -5
- package/dist/{cli-catalog-RT3QPDLR.js → cli-catalog-ETUQDYOX.js} +3 -3
- package/dist/{cli-commands-PSZFKTZM.js → cli-commands-ORLKC2XM.js} +7 -6
- package/dist/cli.js +30 -19
- package/dist/{competitor-6ZTA2SZH.js → competitor-IC6KRZAD.js} +7 -4
- package/dist/{content-DJYGQ5CP.js → content-3Y6ZKQHG.js} +6 -5
- package/dist/{dashboard-QNOTLZUI.js → dashboard-XBS4EVSA.js} +3 -3
- package/dist/{demo-FVTIXDAO.js → demo-7D4W32J6.js} +2 -2
- package/dist/{demo-server-R7LG5BRB.js → demo-server-CGOD7EPX.js} +3 -3
- package/dist/{discover-3E7QM2TL.js → discover-34E5JIM5.js} +3 -3
- package/dist/{discover-eval-NAZPA6PV.js → discover-eval-TLH2MMNK.js} +41 -16
- package/dist/{doctor-OFFSPNBK.js → doctor-SGJQPWRI.js} +3 -3
- package/dist/{evidence-VOSSML2G.js → evidence-TFFVSNEL.js} +6 -5
- package/dist/{export-cmd-IVACTDSV.js → export-cmd-YRG7CEVX.js} +3 -3
- package/dist/{ga-BX4C7TPI.js → ga-VVJWYWQX.js} +6 -5
- package/dist/{gbp-SV3J2VG3.js → gbp-RYA62WDX.js} +23 -10
- package/dist/{google-J23OD7TR.js → google-5HRSXPUF.js} +13 -12
- package/dist/{google-marketing-TTLXMDMD.js → google-marketing-UGMDLFPE.js} +1 -1
- package/dist/{health-cmd-26AHD5XL.js → health-cmd-WUBFEQX6.js} +3 -3
- package/dist/{history-QWBRFDQR.js → history-5GFG76UO.js} +5 -3
- package/dist/index.d.ts +15 -15
- package/dist/index.js +12 -12
- package/dist/{init-IZVPCO36.js → init-CHZSBQOK.js} +10 -9
- package/dist/{insights-PMTHHZ2H.js → insights-LWLKXKNO.js} +3 -3
- package/dist/{journeys-IA7TF753.js → journeys-IQLWLZBY.js} +3 -3
- package/dist/{keys-DOHLZTRI.js → keys-3VVORLK2.js} +3 -3
- package/dist/{keyword-3C2ZU6OB.js → keyword-3MWGUBHL.js} +7 -4
- package/dist/{logs-P7VRVZ5N.js → logs-PSV4DZ6F.js} +3 -3
- package/dist/{mcp-6NA62OAY.js → mcp-NNBM3MLW.js} +5 -4
- package/dist/mcp.js +8 -8
- package/dist/{measurement-plan-RHKCARVE.js → measurement-plan-M4VLA2ZN.js} +5 -4
- package/dist/{notify-ODCY7TD3.js → notify-EDSJINE5.js} +3 -3
- package/dist/{organic-evidence-76P5AYB3.js → organic-evidence-VBT6URMQ.js} +3 -3
- package/dist/{overview-5T776SEB.js → overview-LRNI342W.js} +6 -6
- package/dist/{project-ITMGW45M.js → project-HO4GOEC4.js} +3 -3
- package/dist/{project-setup-A3Q6ZX73.js → project-setup-AXVIZND6.js} +4 -4
- package/dist/{query-3QAQITK3.js → query-E2D2K6MD.js} +8 -5
- package/dist/{research-R74N3VRL.js → research-Z3IZQH2M.js} +3 -3
- package/dist/{results-export-23GY45AY.js → results-export-TVWWLJQA.js} +3 -3
- package/dist/{run-ID66JYBN.js → run-RJDJPROH.js} +4 -4
- package/dist/{schedule-HZ2CRUAL.js → schedule-NVDN72YG.js} +3 -3
- package/dist/{search-DM5WWMTE.js → search-A4PBZ53D.js} +3 -3
- package/dist/{serve-PKDK7ZWB.js → serve-7WPMQUVW.js} +13 -13
- package/dist/{session-EZ6I5VUF.js → session-VPJH4TRC.js} +7 -7
- package/dist/{settings-SIEKVYD7.js → settings-EYEXRKTM.js} +5 -5
- package/dist/{sitemaps-M4IAZLK2.js → sitemaps-4HCWZJOZ.js} +3 -3
- package/dist/{skills-J6LWTNU5.js → skills-GPYMDDRH.js} +2 -2
- package/dist/{snapshot-SM3BVX5M.js → snapshot-SNR7KBK4.js} +3 -3
- package/dist/{status-BHJJOUCK.js → status-VTQJVZFU.js} +12 -6
- package/dist/{support-FPXXXJPZ.js → support-H7ANOX67.js} +1 -1
- package/dist/{technical-aeo-4DJWWPUN.js → technical-aeo-IDMFUDXP.js} +7 -5
- package/dist/{telemetry-LKVQUSO7.js → telemetry-DA43ILAA.js} +4 -4
- package/dist/{tools-NFVIW4YP.js → tools-F3FZEG5K.js} +6 -6
- package/dist/{traffic-QSZYZHFW.js → traffic-EPWP3D2K.js} +21 -29
- package/dist/{trends-WIHWJVJR.js → trends-IVYSKMND.js} +3 -3
- package/dist/{users-HQOPQRTP.js → users-ZJMBGWUF.js} +3 -3
- package/dist/{visibility-stats-MCY5CAUC.js → visibility-stats-M2I3SUES.js} +11 -5
- package/dist/{wordpress-IB5YOJSM.js → wordpress-BGIOJPIF.js} +3 -3
- package/package.json +1 -1
- package/dist/agent-conversations-RRI7T74B.js +0 -51
- package/dist/agent-memory-R5Q7DLRZ.js +0 -91
- package/dist/agent-providers-HNMGZ7GY.js +0 -58
- package/dist/agent-transcript-N6ZBTF72.js +0 -76
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CliError
|
|
3
|
+
} from "./chunk-Y7JEJNNS.js";
|
|
4
|
+
import {
|
|
5
|
+
describeError
|
|
6
|
+
} from "./chunk-FGEBFVHB.js";
|
|
7
|
+
|
|
8
|
+
// src/cli-input.ts
|
|
9
|
+
import fs from "fs";
|
|
10
|
+
import { parse as parseYaml } from "yaml";
|
|
11
|
+
function readInputText(source, what) {
|
|
12
|
+
try {
|
|
13
|
+
return fs.readFileSync(source === "-" ? 0 : source, "utf8");
|
|
14
|
+
} catch (error) {
|
|
15
|
+
throw new CliError({
|
|
16
|
+
code: "FILE_READ_ERROR",
|
|
17
|
+
message: `${what} could not be read: ${describeError(error)}`,
|
|
18
|
+
details: { source }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function parseInputDocument(content, what, syntax, details = {}) {
|
|
23
|
+
try {
|
|
24
|
+
return syntax === "json" ? JSON.parse(content) : parseYaml(content);
|
|
25
|
+
} catch (error) {
|
|
26
|
+
throw new CliError({
|
|
27
|
+
code: "VALIDATION_ERROR",
|
|
28
|
+
message: `${what} is not valid ${syntax === "json" ? "JSON" : "YAML"}: ${describeError(error)}`,
|
|
29
|
+
details
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function readInputDocument(source, what, syntax) {
|
|
34
|
+
return parseInputDocument(readInputText(source, what), what, syntax, { source });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
readInputText,
|
|
39
|
+
readInputDocument
|
|
40
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
trackIntegrationConnection
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LXFLUFQT.js";
|
|
4
4
|
import {
|
|
5
5
|
cliRuntimeContext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KJX5CMPC.js";
|
|
7
7
|
|
|
8
8
|
// src/cli-connection-telemetry.ts
|
|
9
9
|
function trackCliConnection(properties) {
|
|
@@ -2,13 +2,16 @@ import {
|
|
|
2
2
|
findMcpClient,
|
|
3
3
|
listMcpClientIds
|
|
4
4
|
} from "./chunk-VJWDBFSL.js";
|
|
5
|
+
import {
|
|
6
|
+
readInputText
|
|
7
|
+
} from "./chunk-APKBR2BP.js";
|
|
5
8
|
import {
|
|
6
9
|
createApiClient
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RSB3X7UR.js";
|
|
8
11
|
import {
|
|
9
12
|
CliError,
|
|
10
13
|
isMachineFormat
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-Y7JEJNNS.js";
|
|
12
15
|
import {
|
|
13
16
|
describeError
|
|
14
17
|
} from "./chunk-FGEBFVHB.js";
|
|
@@ -64,7 +67,7 @@ function renderClientSnippet(client, serverName, entry) {
|
|
|
64
67
|
}
|
|
65
68
|
function readJsonConfig(configPath) {
|
|
66
69
|
if (!fs.existsSync(configPath)) return {};
|
|
67
|
-
const raw =
|
|
70
|
+
const raw = readInputText(configPath, `The MCP client config ${configPath}`).trim();
|
|
68
71
|
if (!raw) return {};
|
|
69
72
|
try {
|
|
70
73
|
const parsed = JSON.parse(raw);
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
dedupeGscSitemapUrls,
|
|
6
6
|
resolveDiscoveredGscSitemapUrls,
|
|
7
7
|
submitGscSitemapBatches
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BJWPYUKT.js";
|
|
9
9
|
import {
|
|
10
10
|
measurementDraftOperationSchema,
|
|
11
11
|
runMeasurementDraftAction
|
|
12
12
|
} from "./chunk-ZHXPH7WB.js";
|
|
13
13
|
import {
|
|
14
14
|
CliError
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-Y7JEJNNS.js";
|
|
16
16
|
import {
|
|
17
17
|
AGENT_MEMORY_KEY_MAX_LENGTH,
|
|
18
18
|
AGENT_MEMORY_VALUE_MAX_BYTES,
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
bucketCliCommandDuration,
|
|
3
3
|
isTelemetryEnabled,
|
|
4
4
|
trackEvent
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KJX5CMPC.js";
|
|
6
6
|
import {
|
|
7
7
|
getConfigDir
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-T6CABZ3N.js";
|
|
9
9
|
import {
|
|
10
10
|
currentOutcomeAttribution
|
|
11
11
|
} from "./chunk-C4JM5HJW.js";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
configExists,
|
|
6
6
|
loadConfigRaw
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-T6CABZ3N.js";
|
|
8
8
|
|
|
9
9
|
// src/setup-state.ts
|
|
10
10
|
import fs from "fs";
|
|
@@ -47,7 +47,7 @@ function queueServeHandoff() {
|
|
|
47
47
|
async function runPendingServeHandoff(format) {
|
|
48
48
|
if (!pendingServeHandoff) return;
|
|
49
49
|
pendingServeHandoff = false;
|
|
50
|
-
const { serveCommand } = await import("./serve-
|
|
50
|
+
const { serveCommand } = await import("./serve-7WPMQUVW.js");
|
|
51
51
|
await serveCommand(format);
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
configExists,
|
|
3
3
|
loadConfigRaw,
|
|
4
4
|
saveConfigPatch
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-T6CABZ3N.js";
|
|
6
6
|
import {
|
|
7
7
|
BUNDLED_SKILL_NAMES,
|
|
8
8
|
installSkills
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-623X526L.js";
|
|
10
10
|
import {
|
|
11
11
|
PACKAGE_VERSION
|
|
12
12
|
} from "./chunk-AOJU5LKX.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
resolveCliAccess,
|
|
4
4
|
resolveCliAccessForInvocation,
|
|
5
5
|
windowOptions
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-X3ES2XOJ.js";
|
|
7
7
|
import {
|
|
8
8
|
emitJsonl
|
|
9
9
|
} from "./chunk-Z7IUAJOF.js";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
CliError,
|
|
12
12
|
EXIT_USER_ERROR,
|
|
13
13
|
usageError
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-Y7JEJNNS.js";
|
|
15
15
|
import {
|
|
16
16
|
OperationAccesses
|
|
17
17
|
} from "./chunk-FGEBFVHB.js";
|
|
@@ -122,7 +122,7 @@ async function dispatchRegisteredCommand(args, fallbackFormat, specs) {
|
|
|
122
122
|
const accessValue = accessFilterFromArgs(argsWithoutHelp);
|
|
123
123
|
validateAccessFilter(accessValue);
|
|
124
124
|
if (fallbackFormat !== "text") {
|
|
125
|
-
const { printCliCatalog: printCliCatalog2 } = await import("./cli-catalog-
|
|
125
|
+
const { printCliCatalog: printCliCatalog2 } = await import("./cli-catalog-ETUQDYOX.js");
|
|
126
126
|
const group2 = argsWithoutHelp.find((arg) => !arg.startsWith("--"));
|
|
127
127
|
printCliCatalog2(specs, fallbackFormat, group2, accessValue);
|
|
128
128
|
return true;
|
|
@@ -5,15 +5,19 @@ import {
|
|
|
5
5
|
} from "./chunk-QHQZ2226.js";
|
|
6
6
|
import {
|
|
7
7
|
createApiClient
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RSB3X7UR.js";
|
|
9
9
|
import {
|
|
10
10
|
emitJsonl
|
|
11
11
|
} from "./chunk-Z7IUAJOF.js";
|
|
12
12
|
import {
|
|
13
13
|
CliError,
|
|
14
14
|
EXIT_SYSTEM_ERROR,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
errorCodeFor,
|
|
16
|
+
exitCodeFor,
|
|
17
|
+
isMachineFormat,
|
|
18
|
+
mostSevereExitCode,
|
|
19
|
+
systemError
|
|
20
|
+
} from "./chunk-Y7JEJNNS.js";
|
|
17
21
|
import {
|
|
18
22
|
MentionIdentities,
|
|
19
23
|
OUTSTANDING_PROVIDER_BATCH_STATUSES,
|
|
@@ -22,7 +26,8 @@ import {
|
|
|
22
26
|
describeError,
|
|
23
27
|
formatMicros,
|
|
24
28
|
formatRunErrorOneLine,
|
|
25
|
-
resolveProviderInput
|
|
29
|
+
resolveProviderInput,
|
|
30
|
+
shellQuote
|
|
26
31
|
} from "./chunk-FGEBFVHB.js";
|
|
27
32
|
|
|
28
33
|
// src/commands/run.ts
|
|
@@ -56,9 +61,6 @@ async function previewRun(project, format) {
|
|
|
56
61
|
console.log(preview.blockedReason === null ? " Ready to start." : ` ${reasons[preview.blockedReason]}`);
|
|
57
62
|
}
|
|
58
63
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "partial", "failed", "cancelled"]);
|
|
59
|
-
function shellArg(value) {
|
|
60
|
-
return /^[\w.-]+$/.test(value) ? value : `'${value.replaceAll("'", `'\\''`)}'`;
|
|
61
|
-
}
|
|
62
64
|
function providerAccountStreakLine(provider, streak) {
|
|
63
65
|
return `${provider} (${streak.code}): failed on its account in each of its last ${streak.consecutiveRuns} runs; called again after ${streak.retryAfter}`;
|
|
64
66
|
}
|
|
@@ -66,7 +68,7 @@ function providersThatKeepFailing(count) {
|
|
|
66
68
|
return count === 1 ? "a provider that keeps failing on its account" : `${count} providers that keep failing on their accounts`;
|
|
67
69
|
}
|
|
68
70
|
function providerAccountFixLine(project) {
|
|
69
|
-
return `Fix the key, access or billing in the provider's console. Saving a new key, model or endpoint (canonry settings provider <name>) retries at once; canonry run ${
|
|
71
|
+
return `Fix the key, access or billing in the provider's console. Saving a new key, model or endpoint (\`canonry settings provider <name> --api-key <key>\`, or \`--model <model>\` or \`--base-url <url>\` in place of the key) retries at once; \`canonry run ${shellQuote(project)} --force\` calls every provider now.`;
|
|
70
72
|
}
|
|
71
73
|
function admissionDecisionKey(admission) {
|
|
72
74
|
return JSON.stringify([
|
|
@@ -98,15 +100,19 @@ Not calling ${providersThatKeepFailing(held.length)}:`);
|
|
|
98
100
|
for (const [provider, streak] of held) console.log(` ${providerAccountStreakLine(provider, streak)}`);
|
|
99
101
|
console.log(providerAccountFixLine(project));
|
|
100
102
|
}
|
|
101
|
-
function
|
|
103
|
+
function notStartedSentence({ projectCount, projects }) {
|
|
104
|
+
return `Could not start a run for ${projects.length} of ${projectCount} project${projectCount === 1 ? "" : "s"}: ` + projects.map((p) => `${p.project}: ${p.error}`).join("; ");
|
|
105
|
+
}
|
|
106
|
+
function throwIfWaitedRunFailed(waited, notStarted) {
|
|
102
107
|
const failed = waited.filter((r) => r.status === RunStatuses.failed);
|
|
103
108
|
if (failed.length === 0) return;
|
|
104
109
|
const reason = (r) => r.error ? formatRunErrorOneLine(r.error) : null;
|
|
105
110
|
const label = (r) => [r.project, r.location ? `(${r.location})` : null, `run ${r.runId}`].filter(Boolean).join(" ");
|
|
106
111
|
const message = waited.length === 1 ? `Run ${failed[0].runId} failed${reason(failed[0]) ? `: ${reason(failed[0])}` : ""}` : `${failed.length} of ${waited.length} runs failed: ${failed.map((r) => `${label(r)}${reason(r) ? `: ${reason(r)}` : ""}`).join("; ")}`;
|
|
112
|
+
const alsoNotStarted = notStarted && notStarted.projects.length > 0 ? notStarted : null;
|
|
107
113
|
throw new CliError({
|
|
108
114
|
code: "RUN_FAILED",
|
|
109
|
-
message,
|
|
115
|
+
message: alsoNotStarted ? `${message.replace(/\.$/, "")}. ${notStartedSentence(alsoNotStarted)}` : message,
|
|
110
116
|
exitCode: EXIT_SYSTEM_ERROR,
|
|
111
117
|
details: {
|
|
112
118
|
waitedRunCount: waited.length,
|
|
@@ -115,10 +121,21 @@ function throwIfWaitedRunFailed(waited) {
|
|
|
115
121
|
...r.project ? { project: r.project } : {},
|
|
116
122
|
...r.location ? { location: r.location } : {},
|
|
117
123
|
error: reason(r)
|
|
118
|
-
}))
|
|
124
|
+
})),
|
|
125
|
+
...alsoNotStarted ? { notStarted: alsoNotStarted.projects } : {}
|
|
119
126
|
}
|
|
120
127
|
});
|
|
121
128
|
}
|
|
129
|
+
function throwIfRunAllFailed(notStarted, waited) {
|
|
130
|
+
if (waited) throwIfWaitedRunFailed(waited, notStarted);
|
|
131
|
+
if (notStarted.projects.length === 0) return;
|
|
132
|
+
throw new CliError({
|
|
133
|
+
code: "RUNS_NOT_STARTED",
|
|
134
|
+
message: notStartedSentence(notStarted),
|
|
135
|
+
exitCode: mostSevereExitCode(notStarted.projects.map((p) => p.exitCode)),
|
|
136
|
+
details: { projectCount: notStarted.projectCount, notStarted: notStarted.projects }
|
|
137
|
+
});
|
|
138
|
+
}
|
|
122
139
|
async function triggerRun(project, opts) {
|
|
123
140
|
const client = getClient();
|
|
124
141
|
const body = {};
|
|
@@ -282,6 +299,7 @@ async function triggerRunAll(opts) {
|
|
|
282
299
|
baseBody.force = true;
|
|
283
300
|
}
|
|
284
301
|
const results = [];
|
|
302
|
+
const notStartedProjects = [];
|
|
285
303
|
for (const p of projects) {
|
|
286
304
|
const body = { ...baseBody };
|
|
287
305
|
if (body.allLocations && p.locations.length === 0) {
|
|
@@ -301,6 +319,7 @@ async function triggerRunAll(opts) {
|
|
|
301
319
|
} catch (err) {
|
|
302
320
|
const msg = describeError(err);
|
|
303
321
|
results.push({ project: p.name, runId: "", status: "error", location: null, error: msg });
|
|
322
|
+
notStartedProjects.push({ project: p.name, code: errorCodeFor(err), exitCode: exitCodeFor(err), error: msg });
|
|
304
323
|
}
|
|
305
324
|
}
|
|
306
325
|
const errors = /* @__PURE__ */ new Map();
|
|
@@ -320,10 +339,11 @@ async function triggerRunAll(opts) {
|
|
|
320
339
|
if (showProgress) process.stderr.write("\n");
|
|
321
340
|
}
|
|
322
341
|
}
|
|
323
|
-
const waited = results.filter((r) => r.runId).map((r) => ({ runId: r.runId, status: r.status, project: r.project, location: r.location, error: errors.get(r.runId) }));
|
|
342
|
+
const waited = opts?.wait ? results.filter((r) => r.runId).map((r) => ({ runId: r.runId, status: r.status, project: r.project, location: r.location, error: errors.get(r.runId) })) : null;
|
|
343
|
+
const notStarted = { projectCount: projects.length, projects: notStartedProjects };
|
|
324
344
|
if (isMachineFormat(opts?.format)) {
|
|
325
345
|
console.log(JSON.stringify(results, null, 2));
|
|
326
|
-
|
|
346
|
+
throwIfRunAllFailed(notStarted, waited);
|
|
327
347
|
return;
|
|
328
348
|
}
|
|
329
349
|
const showLocationColumn = results.some((r) => r.location !== null);
|
|
@@ -353,7 +373,7 @@ async function triggerRunAll(opts) {
|
|
|
353
373
|
const waiting = batchWaits.get(r.runId);
|
|
354
374
|
if (waiting) console.log(` ${r.location ? `${r.project} (${r.location})` : r.project}: ${waiting}`);
|
|
355
375
|
}
|
|
356
|
-
|
|
376
|
+
throwIfRunAllFailed(notStarted, waited);
|
|
357
377
|
}
|
|
358
378
|
async function cancelRun(project, runId, format) {
|
|
359
379
|
const client = getClient();
|
|
@@ -445,7 +465,7 @@ async function pollRun(client, runId, showProgress = true) {
|
|
|
445
465
|
for (; ; ) {
|
|
446
466
|
await new Promise((r) => setTimeout(r, 2e3));
|
|
447
467
|
if (Date.now() > deadline) {
|
|
448
|
-
throw
|
|
468
|
+
throw systemError(`Timed out waiting for run ${runId} after ${POLL_TIMEOUT_MS / 1e3}s`, { details: { runId } });
|
|
449
469
|
}
|
|
450
470
|
const run = await client.getRun(runId);
|
|
451
471
|
if (showProgress) process.stderr.write(".");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-T6CABZ3N.js";
|
|
4
4
|
import {
|
|
5
5
|
PACKAGE_VERSION
|
|
6
6
|
} from "./chunk-AOJU5LKX.js";
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
CliError,
|
|
9
9
|
EXIT_SYSTEM_ERROR,
|
|
10
10
|
EXIT_USER_ERROR
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-Y7JEJNNS.js";
|
|
12
12
|
import {
|
|
13
13
|
CANONRY_NPM_PACKAGE_URL,
|
|
14
14
|
OPERATIONAL_LOG_FIELDS_HEADER,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runWithUsageTags
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RSB3X7UR.js";
|
|
4
4
|
import {
|
|
5
5
|
CanonryMcpToolNames,
|
|
6
6
|
DEPRECATED_MCP_TOOL_ALIAS_NAMES,
|
|
7
7
|
canonryMcpTools
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IPUZGRSN.js";
|
|
9
9
|
import {
|
|
10
10
|
CliError
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-Y7JEJNNS.js";
|
|
12
12
|
import {
|
|
13
13
|
buildOpenApiDocument
|
|
14
14
|
} from "./chunk-HMCDVKHS.js";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
AppError,
|
|
3
|
+
CANONRY_COMMUNITY_LINKS,
|
|
4
|
+
formatValidationIssues
|
|
3
5
|
} from "./chunk-FGEBFVHB.js";
|
|
4
6
|
|
|
5
7
|
// src/cli-error.ts
|
|
@@ -31,6 +33,17 @@ function usageError(displayMessage, options) {
|
|
|
31
33
|
details: options?.details
|
|
32
34
|
});
|
|
33
35
|
}
|
|
36
|
+
function parseCliInput(schema, input, what, details) {
|
|
37
|
+
const parsed = schema.safeParse(input);
|
|
38
|
+
if (parsed.success) return parsed.data;
|
|
39
|
+
const { issues } = parsed.error;
|
|
40
|
+
throw new CliError({
|
|
41
|
+
code: "VALIDATION_ERROR",
|
|
42
|
+
message: `${what} is not valid: ${formatValidationIssues(issues)}`,
|
|
43
|
+
// The MCP envelope's shape for the same refusal (`mcp/results.ts`).
|
|
44
|
+
details: { ...details, issues: issues.map((issue) => ({ path: issue.path.map(String).join("."), message: issue.message })) }
|
|
45
|
+
});
|
|
46
|
+
}
|
|
34
47
|
function isEndpointMissing(err) {
|
|
35
48
|
if (!(err instanceof CliError)) return false;
|
|
36
49
|
const status = err.details?.httpStatus;
|
|
@@ -45,9 +58,21 @@ function systemError(message, options) {
|
|
|
45
58
|
exitCode: EXIT_SYSTEM_ERROR
|
|
46
59
|
});
|
|
47
60
|
}
|
|
61
|
+
function exitCodeFor(err) {
|
|
62
|
+
if (err instanceof CliError) return err.exitCode;
|
|
63
|
+
if (err instanceof AppError) return err.statusCode < 500 ? EXIT_USER_ERROR : EXIT_SYSTEM_ERROR;
|
|
64
|
+
return EXIT_SYSTEM_ERROR;
|
|
65
|
+
}
|
|
66
|
+
function errorCodeFor(err) {
|
|
67
|
+
return err instanceof CliError || err instanceof AppError ? err.code : "CLI_ERROR";
|
|
68
|
+
}
|
|
69
|
+
function mostSevereExitCode(codes) {
|
|
70
|
+
for (const code of codes) if (code === EXIT_SYSTEM_ERROR) return EXIT_SYSTEM_ERROR;
|
|
71
|
+
return EXIT_USER_ERROR;
|
|
72
|
+
}
|
|
48
73
|
function printCliError(err, format) {
|
|
49
74
|
if (isMachineFormat(format)) {
|
|
50
|
-
const envelope = err instanceof CliError ? { error: { code: err
|
|
75
|
+
const envelope = err instanceof CliError || err instanceof AppError ? { error: { code: errorCodeFor(err), message: err.message, ...err.details ? { details: err.details } : {} } } : { error: { code: errorCodeFor(err), message: err instanceof Error ? err.message : "An unexpected error occurred" } };
|
|
51
76
|
console.error(JSON.stringify(envelope, null, format === "jsonl" ? 0 : 2));
|
|
52
77
|
return;
|
|
53
78
|
}
|
|
@@ -58,7 +83,7 @@ function printCliError(err, format) {
|
|
|
58
83
|
} else {
|
|
59
84
|
console.error("An unexpected error occurred");
|
|
60
85
|
}
|
|
61
|
-
const unexpected =
|
|
86
|
+
const unexpected = exitCodeFor(err) === EXIT_SYSTEM_ERROR;
|
|
62
87
|
if (unexpected && process.stderr.isTTY) {
|
|
63
88
|
console.error(`
|
|
64
89
|
Need help? Run 'canonry support' or ask in the Canonry Discord: ${CANONRY_COMMUNITY_LINKS.discord}`);
|
|
@@ -71,7 +96,11 @@ export {
|
|
|
71
96
|
EXIT_SYSTEM_ERROR,
|
|
72
97
|
CliError,
|
|
73
98
|
usageError,
|
|
99
|
+
parseCliInput,
|
|
74
100
|
isEndpointMissing,
|
|
75
101
|
systemError,
|
|
102
|
+
exitCodeFor,
|
|
103
|
+
errorCodeFor,
|
|
104
|
+
mostSevereExitCode,
|
|
76
105
|
printCliError
|
|
77
106
|
};
|
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
} from "./chunk-CBREBUUV.js";
|
|
12
12
|
import {
|
|
13
13
|
loadConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-T6CABZ3N.js";
|
|
15
15
|
import {
|
|
16
16
|
CliError,
|
|
17
17
|
isMachineFormat
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-Y7JEJNNS.js";
|
|
19
19
|
import {
|
|
20
20
|
determineCitationState
|
|
21
21
|
} from "./chunk-LJ65QBRP.js";
|
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
effectiveDomains,
|
|
52
52
|
extractRecommendedCompetitors,
|
|
53
53
|
normalizeUrlPath,
|
|
54
|
+
notFound,
|
|
54
55
|
openRouterRouteModel
|
|
55
56
|
} from "./chunk-FGEBFVHB.js";
|
|
56
57
|
|
|
@@ -591,7 +592,7 @@ async function backfillSnapshotAttributionCommand(opts) {
|
|
|
591
592
|
migrate(db);
|
|
592
593
|
const project = db.select().from(projects).where(eq(projects.name, opts.project)).get();
|
|
593
594
|
if (!project) {
|
|
594
|
-
throw
|
|
595
|
+
throw notFound("Project", opts.project);
|
|
595
596
|
}
|
|
596
597
|
const isJson = isMachineFormat(opts.format);
|
|
597
598
|
const isDryRun = opts.dryRun === true;
|
|
@@ -6,16 +6,18 @@ import {
|
|
|
6
6
|
} from "./chunk-QHQZ2226.js";
|
|
7
7
|
import {
|
|
8
8
|
createApiClient
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-RSB3X7UR.js";
|
|
10
|
+
import "./chunk-T6CABZ3N.js";
|
|
11
11
|
import {
|
|
12
12
|
emitJsonl
|
|
13
13
|
} from "./chunk-Z7IUAJOF.js";
|
|
14
14
|
import "./chunk-AOJU5LKX.js";
|
|
15
15
|
import {
|
|
16
16
|
isMachineFormat
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import
|
|
17
|
+
} from "./chunk-Y7JEJNNS.js";
|
|
18
|
+
import {
|
|
19
|
+
shellQuote
|
|
20
|
+
} from "./chunk-FGEBFVHB.js";
|
|
19
21
|
|
|
20
22
|
// src/commands/citations.ts
|
|
21
23
|
async function showCitationVisibility(project, opts) {
|
|
@@ -27,7 +29,7 @@ async function showCitationVisibility(project, opts) {
|
|
|
27
29
|
}
|
|
28
30
|
if (data.status === "no-data") {
|
|
29
31
|
if (data.reason === "no-queries") {
|
|
30
|
-
console.log(
|
|
32
|
+
console.log(`No queries configured. Add some with \`canonry query add ${shellQuote(project)} <query>\`.`);
|
|
31
33
|
} else {
|
|
32
34
|
console.log("No citation data yet \u2014 run a sweep first (canonry run <project>).");
|
|
33
35
|
}
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
buildCliCatalog,
|
|
4
4
|
printCliCatalog,
|
|
5
5
|
renderTopLevelHelp
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-P4ETUNQR.js";
|
|
7
|
+
import "./chunk-X3ES2XOJ.js";
|
|
8
8
|
import "./chunk-Z7IUAJOF.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-Y7JEJNNS.js";
|
|
10
10
|
import "./chunk-FGEBFVHB.js";
|
|
11
11
|
export {
|
|
12
12
|
CLI_ROOT_SUMMARIES,
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
REGISTERED_CLI_COMMANDS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-63FHJJUO.js";
|
|
4
4
|
import "./chunk-6GO5VVAC.js";
|
|
5
5
|
import "./chunk-VJWDBFSL.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-3LXRY57V.js";
|
|
7
|
+
import "./chunk-APKBR2BP.js";
|
|
7
8
|
import "./chunk-TSENU4GG.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-RSB3X7UR.js";
|
|
10
|
+
import "./chunk-T6CABZ3N.js";
|
|
11
|
+
import "./chunk-X3ES2XOJ.js";
|
|
11
12
|
import "./chunk-Z7IUAJOF.js";
|
|
12
13
|
import "./chunk-ZHXPH7WB.js";
|
|
13
14
|
import "./chunk-AOJU5LKX.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-Y7JEJNNS.js";
|
|
15
16
|
import "./chunk-FGEBFVHB.js";
|
|
16
17
|
export {
|
|
17
18
|
REGISTERED_CLI_COMMANDS
|