iteration-cli 0.15.0 → 0.16.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/README.md +10 -2
- package/dist/cli.js +1106 -560
- package/dist/cursor-hook-entry.js +6 -2
- package/dist/launcher.js +155 -149
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -10,7 +10,6 @@ import { spawnSync } from "node:child_process";
|
|
|
10
10
|
import { promises as fs24 } from "node:fs";
|
|
11
11
|
import os11 from "node:os";
|
|
12
12
|
import path30 from "node:path";
|
|
13
|
-
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
14
13
|
import { parseArgs } from "node:util";
|
|
15
14
|
|
|
16
15
|
// ../trace-vault/packages/cli/dist/index.js
|
|
@@ -1163,7 +1162,7 @@ function putProp(target, key, value) {
|
|
|
1163
1162
|
else
|
|
1164
1163
|
target[key] = value;
|
|
1165
1164
|
}
|
|
1166
|
-
function mirrorShape(target, source, keys,
|
|
1165
|
+
function mirrorShape(target, source, keys, wrap2) {
|
|
1167
1166
|
const raw = sourceShape(source);
|
|
1168
1167
|
for (const key of keys) {
|
|
1169
1168
|
const desc = Object.getOwnPropertyDescriptor(raw, key);
|
|
@@ -1172,10 +1171,10 @@ function mirrorShape(target, source, keys, wrap) {
|
|
|
1172
1171
|
if (desc.get) {
|
|
1173
1172
|
deferProp(target, key, () => {
|
|
1174
1173
|
const value = source._zod.def.shape[key];
|
|
1175
|
-
return
|
|
1174
|
+
return wrap2 ? wrap2(value, key) : value;
|
|
1176
1175
|
});
|
|
1177
1176
|
} else
|
|
1178
|
-
putProp(target, key,
|
|
1177
|
+
putProp(target, key, wrap2 ? wrap2(desc.value, key) : desc.value);
|
|
1179
1178
|
}
|
|
1180
1179
|
}
|
|
1181
1180
|
function mirrorProps(target, source) {
|
|
@@ -2015,9 +2014,9 @@ function formatError(error22, mapper = (issue22) => issue22.message) {
|
|
|
2015
2014
|
let i = 0;
|
|
2016
2015
|
while (i < fullpath.length) {
|
|
2017
2016
|
const el = fullpath[i];
|
|
2018
|
-
const
|
|
2017
|
+
const terminal2 = i === fullpath.length - 1;
|
|
2019
2018
|
if (el === "_errors") {
|
|
2020
|
-
if (
|
|
2019
|
+
if (terminal2)
|
|
2021
2020
|
curr._errors.push(mapper(issue22));
|
|
2022
2021
|
i++;
|
|
2023
2022
|
continue;
|
|
@@ -2031,7 +2030,7 @@ function formatError(error22, mapper = (issue22) => issue22.message) {
|
|
|
2031
2030
|
});
|
|
2032
2031
|
}
|
|
2033
2032
|
const node22 = curr[el];
|
|
2034
|
-
if (
|
|
2033
|
+
if (terminal2) {
|
|
2035
2034
|
node22._errors.push(mapper(issue22));
|
|
2036
2035
|
}
|
|
2037
2036
|
curr = node22;
|
|
@@ -7890,9 +7889,9 @@ var ClaudeAccountIndex = class {
|
|
|
7890
7889
|
add(map, session, id, record32) {
|
|
7891
7890
|
if (id === null) return;
|
|
7892
7891
|
const key = this.key(session, id);
|
|
7893
|
-
const
|
|
7894
|
-
|
|
7895
|
-
map.set(key,
|
|
7892
|
+
const rows2 = map.get(key) ?? [];
|
|
7893
|
+
rows2.push(record32);
|
|
7894
|
+
map.set(key, rows2);
|
|
7896
7895
|
}
|
|
7897
7896
|
get(map, session, id) {
|
|
7898
7897
|
return id ? map.get(this.key(session, id)) ?? [] : [];
|
|
@@ -7968,20 +7967,25 @@ var exportSchema = object({
|
|
|
7968
7967
|
});
|
|
7969
7968
|
var uuid3 = uuid2();
|
|
7970
7969
|
var identifier2 = string2().regex(/^[A-Za-z0-9_:./-]{1,255}$/);
|
|
7970
|
+
function consoleWriter(line, level) {
|
|
7971
|
+
if (level === "info") console.info(line);
|
|
7972
|
+
else console.error(line);
|
|
7973
|
+
}
|
|
7971
7974
|
var loggingContext = () => ({});
|
|
7972
|
-
|
|
7973
|
-
|
|
7975
|
+
var logWriter = consoleWriter;
|
|
7976
|
+
function configureCollectorLogging(context2, write = consoleWriter) {
|
|
7977
|
+
loggingContext = context2;
|
|
7978
|
+
logWriter = write;
|
|
7974
7979
|
}
|
|
7975
7980
|
function writeLog(line, level) {
|
|
7976
|
-
|
|
7977
|
-
else console.error(line);
|
|
7981
|
+
logWriter(line, level);
|
|
7978
7982
|
}
|
|
7979
|
-
function createLogger(
|
|
7983
|
+
function createLogger(context2, write = writeLog) {
|
|
7980
7984
|
return (entry) => {
|
|
7981
7985
|
write(
|
|
7982
7986
|
JSON.stringify({
|
|
7983
7987
|
...entry,
|
|
7984
|
-
...
|
|
7988
|
+
...context2,
|
|
7985
7989
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7986
7990
|
pid: process.pid,
|
|
7987
7991
|
...loggingContext()
|
|
@@ -8380,11 +8384,11 @@ var SecretLintRule = class {
|
|
|
8380
8384
|
ruleReportHandle;
|
|
8381
8385
|
ruleCreator;
|
|
8382
8386
|
descriptorRule;
|
|
8383
|
-
constructor({ descriptorRule, context }) {
|
|
8387
|
+
constructor({ descriptorRule, context: context2 }) {
|
|
8384
8388
|
this.descriptorRule = descriptorRule;
|
|
8385
8389
|
this.ruleCreator = descriptorRule.rule;
|
|
8386
8390
|
const ruleCreatorOptions = descriptorRule.options || {};
|
|
8387
|
-
this.ruleReportHandle = this.ruleCreator.create(
|
|
8391
|
+
this.ruleReportHandle = this.ruleCreator.create(context2, ruleCreatorOptions);
|
|
8388
8392
|
}
|
|
8389
8393
|
allowMessageIds() {
|
|
8390
8394
|
if (!this.descriptorRule.allowMessageIds) {
|
|
@@ -8552,7 +8556,7 @@ var createRunningEvents = () => {
|
|
|
8552
8556
|
runLint(options) {
|
|
8553
8557
|
return contextEvents.emit(LINT_HANDLE, options);
|
|
8554
8558
|
},
|
|
8555
|
-
registerRule({ descriptorRule, context }) {
|
|
8559
|
+
registerRule({ descriptorRule, context: context2 }) {
|
|
8556
8560
|
if (registerSet.has(descriptorRule.id)) {
|
|
8557
8561
|
throw new Error(`rule.id:${descriptorRule.id} is already registered.
|
|
8558
8562
|
|
|
@@ -8562,7 +8566,7 @@ Duplicated rule.id is something wrong in .secretlintrc.
|
|
|
8562
8566
|
registerSet.add(descriptorRule.id);
|
|
8563
8567
|
const rule = new SecretLintRule({
|
|
8564
8568
|
descriptorRule,
|
|
8565
|
-
context
|
|
8569
|
+
context: context2
|
|
8566
8570
|
});
|
|
8567
8571
|
rules2.push(rule);
|
|
8568
8572
|
contextEvents.on(LINT_HANDLE, async ({ sourceCode }) => {
|
|
@@ -8579,9 +8583,9 @@ Duplicated rule.id is something wrong in .secretlintrc.
|
|
|
8579
8583
|
});
|
|
8580
8584
|
});
|
|
8581
8585
|
},
|
|
8582
|
-
registerRulePreset({ descriptorRulePreset, context }) {
|
|
8586
|
+
registerRulePreset({ descriptorRulePreset, context: context2 }) {
|
|
8583
8587
|
const rulePresetCreatorOptions = descriptorRulePreset.options || [];
|
|
8584
|
-
descriptorRulePreset.rule.create(
|
|
8588
|
+
descriptorRulePreset.rule.create(context2, rulePresetCreatorOptions);
|
|
8585
8589
|
},
|
|
8586
8590
|
isRegistered(ruleId) {
|
|
8587
8591
|
return registerSet.has(ruleId);
|
|
@@ -8604,7 +8608,7 @@ var createRulePresetContext = ({ configRulePreset, sourceCode, runningEvents, co
|
|
|
8604
8608
|
const descriptorRuleDisabled = descriptorRule ? descriptorRule.disabled : void 0;
|
|
8605
8609
|
const descriptorRuleSeverity = descriptorRule ? descriptorRule.severity : void 0;
|
|
8606
8610
|
const descriptorAllowMessageIds = descriptorRule ? descriptorRule.allowMessageIds : void 0;
|
|
8607
|
-
const
|
|
8611
|
+
const context2 = createRuleContext({
|
|
8608
8612
|
// rule id is a single rule in a preset
|
|
8609
8613
|
ruleId: rule.meta.id,
|
|
8610
8614
|
// parent rule id is rule preset id
|
|
@@ -8631,7 +8635,7 @@ var createRulePresetContext = ({ configRulePreset, sourceCode, runningEvents, co
|
|
|
8631
8635
|
allowMessageIds: descriptorAllowMessageIds,
|
|
8632
8636
|
severity: descriptorRuleSeverity
|
|
8633
8637
|
},
|
|
8634
|
-
context
|
|
8638
|
+
context: context2
|
|
8635
8639
|
});
|
|
8636
8640
|
}
|
|
8637
8641
|
};
|
|
@@ -8841,7 +8845,7 @@ var registerRule = ({ sourceCode, config: config22, descriptorRule, contextEvent
|
|
|
8841
8845
|
debug("registerRule %s", ruleId);
|
|
8842
8846
|
const sharedOptionsWithDefault = config22.sharedOptions ?? {};
|
|
8843
8847
|
if (isRulePreset(descriptorRule)) {
|
|
8844
|
-
const
|
|
8848
|
+
const context2 = createRulePresetContext({
|
|
8845
8849
|
configRulePreset: descriptorRule,
|
|
8846
8850
|
sourceCode,
|
|
8847
8851
|
contextEvents,
|
|
@@ -8851,11 +8855,11 @@ var registerRule = ({ sourceCode, config: config22, descriptorRule, contextEvent
|
|
|
8851
8855
|
});
|
|
8852
8856
|
runningEvents.registerRulePreset({
|
|
8853
8857
|
descriptorRulePreset: descriptorRule,
|
|
8854
|
-
context
|
|
8858
|
+
context: context2
|
|
8855
8859
|
});
|
|
8856
8860
|
return;
|
|
8857
8861
|
} else if (isRule(descriptorRule)) {
|
|
8858
|
-
const
|
|
8862
|
+
const context2 = createRuleContext({
|
|
8859
8863
|
ruleId,
|
|
8860
8864
|
severity: descriptorRule.severity,
|
|
8861
8865
|
meta: descriptorRule.rule.meta,
|
|
@@ -8866,7 +8870,7 @@ var registerRule = ({ sourceCode, config: config22, descriptorRule, contextEvent
|
|
|
8866
8870
|
});
|
|
8867
8871
|
runningEvents.registerRule({
|
|
8868
8872
|
descriptorRule,
|
|
8869
|
-
context
|
|
8873
|
+
context: context2
|
|
8870
8874
|
});
|
|
8871
8875
|
return;
|
|
8872
8876
|
}
|
|
@@ -10569,7 +10573,7 @@ var messages$r = {
|
|
|
10569
10573
|
ja: (props) => `AWS Access Key Id: ${props.ID} \u304C\u307F\u3064\u304B\u308A\u307E\u3057\u305F`
|
|
10570
10574
|
}
|
|
10571
10575
|
};
|
|
10572
|
-
var reportAWSAccessKey = ({ t, source, context, options }) => {
|
|
10576
|
+
var reportAWSAccessKey = ({ t, source, context: context2, options }) => {
|
|
10573
10577
|
const AWSAccessKeyIDPattern = /\b(A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}\b/g;
|
|
10574
10578
|
const results = source.content.matchAll(AWSAccessKeyIDPattern);
|
|
10575
10579
|
for (const result of results) {
|
|
@@ -10583,7 +10587,7 @@ var reportAWSAccessKey = ({ t, source, context, options }) => {
|
|
|
10583
10587
|
if (allowedResults.length > 0) {
|
|
10584
10588
|
continue;
|
|
10585
10589
|
}
|
|
10586
|
-
|
|
10590
|
+
context2.report({
|
|
10587
10591
|
message: t("AWSAccessKeyID", {
|
|
10588
10592
|
ID: match
|
|
10589
10593
|
}),
|
|
@@ -10591,7 +10595,7 @@ var reportAWSAccessKey = ({ t, source, context, options }) => {
|
|
|
10591
10595
|
});
|
|
10592
10596
|
}
|
|
10593
10597
|
};
|
|
10594
|
-
var reportAWSSecretAccessKey = ({ t, source, context, options }) => {
|
|
10598
|
+
var reportAWSSecretAccessKey = ({ t, source, context: context2, options }) => {
|
|
10595
10599
|
const AWS = "(?:AWS|aws|Aws)?_?";
|
|
10596
10600
|
const QUOTE = `["']?`;
|
|
10597
10601
|
const CONNECT = "\\s*(?::|=>|=)\\s*";
|
|
@@ -10608,7 +10612,7 @@ var reportAWSSecretAccessKey = ({ t, source, context, options }) => {
|
|
|
10608
10612
|
if (allowedResults.length > 0) {
|
|
10609
10613
|
continue;
|
|
10610
10614
|
}
|
|
10611
|
-
|
|
10615
|
+
context2.report({
|
|
10612
10616
|
message: t("AWSSecretAccessKey", {
|
|
10613
10617
|
KEY: match
|
|
10614
10618
|
}),
|
|
@@ -10616,7 +10620,7 @@ var reportAWSSecretAccessKey = ({ t, source, context, options }) => {
|
|
|
10616
10620
|
});
|
|
10617
10621
|
}
|
|
10618
10622
|
};
|
|
10619
|
-
var reportAWSAccountID = ({ t, source, context, options }) => {
|
|
10623
|
+
var reportAWSAccountID = ({ t, source, context: context2, options }) => {
|
|
10620
10624
|
const AWS = "(AWS|aws|Aws)?_?";
|
|
10621
10625
|
const QUOTE = `("|')?`;
|
|
10622
10626
|
const CONNECT = "\\s*(:|=>|=)\\s*";
|
|
@@ -10630,7 +10634,7 @@ var reportAWSAccountID = ({ t, source, context, options }) => {
|
|
|
10630
10634
|
if (allowedResults.length > 0) {
|
|
10631
10635
|
continue;
|
|
10632
10636
|
}
|
|
10633
|
-
|
|
10637
|
+
context2.report({
|
|
10634
10638
|
message: t("AWSAccountID", {
|
|
10635
10639
|
ID: match
|
|
10636
10640
|
}),
|
|
@@ -10649,19 +10653,19 @@ var creator$s = {
|
|
|
10649
10653
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-aws/README.md"
|
|
10650
10654
|
}
|
|
10651
10655
|
},
|
|
10652
|
-
create(
|
|
10656
|
+
create(context2, options) {
|
|
10653
10657
|
const normalizedOptions = {
|
|
10654
10658
|
allows: options.allows || [],
|
|
10655
10659
|
enableIDScanRule: options.enableIDScanRule ?? false
|
|
10656
10660
|
};
|
|
10657
|
-
const t =
|
|
10661
|
+
const t = context2.createTranslator(messages$r);
|
|
10658
10662
|
return {
|
|
10659
10663
|
file(source) {
|
|
10660
10664
|
if (normalizedOptions.enableIDScanRule) {
|
|
10661
|
-
reportAWSAccessKey({ t, source, context, options: normalizedOptions });
|
|
10662
|
-
reportAWSAccountID({ t, source, context, options: normalizedOptions });
|
|
10665
|
+
reportAWSAccessKey({ t, source, context: context2, options: normalizedOptions });
|
|
10666
|
+
reportAWSAccountID({ t, source, context: context2, options: normalizedOptions });
|
|
10663
10667
|
}
|
|
10664
|
-
reportAWSSecretAccessKey({ t, source, context, options: normalizedOptions });
|
|
10668
|
+
reportAWSSecretAccessKey({ t, source, context: context2, options: normalizedOptions });
|
|
10665
10669
|
}
|
|
10666
10670
|
};
|
|
10667
10671
|
}
|
|
@@ -10862,7 +10866,7 @@ async function verifyPkcs12Mac(pfxBytes, password) {
|
|
|
10862
10866
|
}
|
|
10863
10867
|
}
|
|
10864
10868
|
var GCP_SERVICE_ACCOUNT_P12_PASSWORD = "notasecret";
|
|
10865
|
-
async function reportIfFoundPrivateKeyP12Format({ source, context, t }) {
|
|
10869
|
+
async function reportIfFoundPrivateKeyP12Format({ source, context: context2, t }) {
|
|
10866
10870
|
if (!source.filePath) {
|
|
10867
10871
|
return;
|
|
10868
10872
|
}
|
|
@@ -10874,7 +10878,7 @@ async function reportIfFoundPrivateKeyP12Format({ source, context, t }) {
|
|
|
10874
10878
|
if (!isGcpServiceAccountP12) {
|
|
10875
10879
|
return;
|
|
10876
10880
|
}
|
|
10877
|
-
|
|
10881
|
+
context2.report({
|
|
10878
10882
|
message: t("PrivateKeyP12", {
|
|
10879
10883
|
FILE_NAME: path172.basename(source.filePath)
|
|
10880
10884
|
}),
|
|
@@ -10893,7 +10897,7 @@ var messages$q = {
|
|
|
10893
10897
|
ja: (props) => `GCP\u30B5\u30FC\u30D3\u30B9\u30A2\u30AB\u30A6\u30F3\u30C8\u306E\u79D8\u5BC6\u9375(json): ${props.FILE_NAME} \u304C\u307F\u3064\u304B\u308A\u307E\u3057\u305F`
|
|
10894
10898
|
}
|
|
10895
10899
|
};
|
|
10896
|
-
function reportIfFoundPrivateKeyJSONFormat({ source, context, t }) {
|
|
10900
|
+
function reportIfFoundPrivateKeyJSONFormat({ source, context: context2, t }) {
|
|
10897
10901
|
try {
|
|
10898
10902
|
const credentialObject = JSON.parse(source.content);
|
|
10899
10903
|
const PRIVATE_KEY_PATTERN = /-----BEGIN\s?(DSA|RSA|EC|PGP|OPENSSH)?\s?PRIVATE KEY/gm;
|
|
@@ -10901,7 +10905,7 @@ function reportIfFoundPrivateKeyJSONFormat({ source, context, t }) {
|
|
|
10901
10905
|
if (!isGCPServiceAccountPrivateKeyJSON) {
|
|
10902
10906
|
return;
|
|
10903
10907
|
}
|
|
10904
|
-
|
|
10908
|
+
context2.report({
|
|
10905
10909
|
message: t("PrivateKeyJSON", {
|
|
10906
10910
|
FILE_NAME: source.filePath ? path3.basename(source.filePath) : ""
|
|
10907
10911
|
}),
|
|
@@ -10921,17 +10925,17 @@ var creator$r = {
|
|
|
10921
10925
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-gcp/README.md"
|
|
10922
10926
|
}
|
|
10923
10927
|
},
|
|
10924
|
-
create(
|
|
10925
|
-
const t =
|
|
10928
|
+
create(context2, options) {
|
|
10929
|
+
const t = context2.createTranslator(messages$q);
|
|
10926
10930
|
({
|
|
10927
10931
|
allows: options.allows || []
|
|
10928
10932
|
});
|
|
10929
10933
|
return {
|
|
10930
10934
|
file(source) {
|
|
10931
10935
|
if (source.ext === ".p12") {
|
|
10932
|
-
return reportIfFoundPrivateKeyP12Format({ source, context, t });
|
|
10936
|
+
return reportIfFoundPrivateKeyP12Format({ source, context: context2, t });
|
|
10933
10937
|
} else if (source.ext === ".json") {
|
|
10934
|
-
return reportIfFoundPrivateKeyJSONFormat({ source, context, t });
|
|
10938
|
+
return reportIfFoundPrivateKeyJSONFormat({ source, context: context2, t });
|
|
10935
10939
|
}
|
|
10936
10940
|
}
|
|
10937
10941
|
};
|
|
@@ -10951,7 +10955,7 @@ var messages$p = {
|
|
|
10951
10955
|
ja: (props) => `npm access token: ${props.TOKEN} \u304C\u307F\u3064\u304B\u308A\u307E\u3057\u305F`
|
|
10952
10956
|
}
|
|
10953
10957
|
};
|
|
10954
|
-
function reportIfFoundXOauthGitHubToken({ source, options, context, t }) {
|
|
10958
|
+
function reportIfFoundXOauthGitHubToken({ source, options, context: context2, t }) {
|
|
10955
10959
|
const XOAuthPattern = /https?:\/\/(.{1,256}):x-oauth-basic@github.com\//g;
|
|
10956
10960
|
const results = source.content.matchAll(XOAuthPattern);
|
|
10957
10961
|
for (const result of results) {
|
|
@@ -10962,7 +10966,7 @@ function reportIfFoundXOauthGitHubToken({ source, options, context, t }) {
|
|
|
10962
10966
|
if (allowedResults.length > 0) {
|
|
10963
10967
|
continue;
|
|
10964
10968
|
}
|
|
10965
|
-
|
|
10969
|
+
context2.report({
|
|
10966
10970
|
message: t("PackageJSON_xOauthToken", {
|
|
10967
10971
|
TOKEN: match
|
|
10968
10972
|
}),
|
|
@@ -10970,7 +10974,7 @@ function reportIfFoundXOauthGitHubToken({ source, options, context, t }) {
|
|
|
10970
10974
|
});
|
|
10971
10975
|
}
|
|
10972
10976
|
}
|
|
10973
|
-
function reportIfFound_AuthTokenInNpmrc({ source, options, context, t }) {
|
|
10977
|
+
function reportIfFound_AuthTokenInNpmrc({ source, options, context: context2, t }) {
|
|
10974
10978
|
const AuthTokenPattern = /_authToken=([^$].*)/g;
|
|
10975
10979
|
const results = source.content.matchAll(AuthTokenPattern);
|
|
10976
10980
|
for (const result of results) {
|
|
@@ -10981,7 +10985,7 @@ function reportIfFound_AuthTokenInNpmrc({ source, options, context, t }) {
|
|
|
10981
10985
|
if (allowedResults.length > 0) {
|
|
10982
10986
|
continue;
|
|
10983
10987
|
}
|
|
10984
|
-
|
|
10988
|
+
context2.report({
|
|
10985
10989
|
message: t("Npmrc_authToken", {
|
|
10986
10990
|
TOKEN: match
|
|
10987
10991
|
}),
|
|
@@ -10989,7 +10993,7 @@ function reportIfFound_AuthTokenInNpmrc({ source, options, context, t }) {
|
|
|
10989
10993
|
});
|
|
10990
10994
|
}
|
|
10991
10995
|
}
|
|
10992
|
-
function reportIfFound_NPM_ACCESS_TOKEN({ source, options, context, t }) {
|
|
10996
|
+
function reportIfFound_NPM_ACCESS_TOKEN({ source, options, context: context2, t }) {
|
|
10993
10997
|
const NPM_ACCESS_TOKEN_PATTERN = new RegExp("(?<!\\p{L})npm_[A-Za-z0-9_]{36}(?![A-Za-z0-9_])", "gu");
|
|
10994
10998
|
const results = source.content.matchAll(NPM_ACCESS_TOKEN_PATTERN);
|
|
10995
10999
|
for (const result of results) {
|
|
@@ -11000,7 +11004,7 @@ function reportIfFound_NPM_ACCESS_TOKEN({ source, options, context, t }) {
|
|
|
11000
11004
|
if (allowedResults.length > 0) {
|
|
11001
11005
|
continue;
|
|
11002
11006
|
}
|
|
11003
|
-
|
|
11007
|
+
context2.report({
|
|
11004
11008
|
message: t("NPM_ACCESS_TOKEN", {
|
|
11005
11009
|
TOKEN: match
|
|
11006
11010
|
}),
|
|
@@ -11031,19 +11035,19 @@ var creator$q = {
|
|
|
11031
11035
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-npm/README.md"
|
|
11032
11036
|
}
|
|
11033
11037
|
},
|
|
11034
|
-
create(
|
|
11035
|
-
const t =
|
|
11038
|
+
create(context2, options) {
|
|
11039
|
+
const t = context2.createTranslator(messages$p);
|
|
11036
11040
|
const normalizedOptions = {
|
|
11037
11041
|
allows: options.allows || []
|
|
11038
11042
|
};
|
|
11039
11043
|
return {
|
|
11040
11044
|
file(source) {
|
|
11041
11045
|
if (isPackageFile(source.filePath)) {
|
|
11042
|
-
reportIfFoundXOauthGitHubToken({ source, options: normalizedOptions, context, t });
|
|
11046
|
+
reportIfFoundXOauthGitHubToken({ source, options: normalizedOptions, context: context2, t });
|
|
11043
11047
|
} else if (isNpmrc(source.filePath)) {
|
|
11044
|
-
reportIfFound_AuthTokenInNpmrc({ source, options: normalizedOptions, context, t });
|
|
11048
|
+
reportIfFound_AuthTokenInNpmrc({ source, options: normalizedOptions, context: context2, t });
|
|
11045
11049
|
}
|
|
11046
|
-
reportIfFound_NPM_ACCESS_TOKEN({ source, options: normalizedOptions, context, t });
|
|
11050
|
+
reportIfFound_NPM_ACCESS_TOKEN({ source, options: normalizedOptions, context: context2, t });
|
|
11047
11051
|
}
|
|
11048
11052
|
};
|
|
11049
11053
|
}
|
|
@@ -11058,7 +11062,7 @@ var messages$o = {
|
|
|
11058
11062
|
ja: (props) => `Slack\u306EIncoming Webhooks: ${props.TOKEN} \u304C\u307F\u3064\u304B\u308A\u307E\u3057\u305F`
|
|
11059
11063
|
}
|
|
11060
11064
|
};
|
|
11061
|
-
function reportIfFoundRawPrivateKey$1({ source, options, context, t }) {
|
|
11065
|
+
function reportIfFoundRawPrivateKey$1({ source, options, context: context2, t }) {
|
|
11062
11066
|
const SLACK_TOKEN_PATTERN = /\b(?:xoxb|xoxp|xapp|xoxa|xoxo|xoxr)-(?:\d-)?(?:[a-zA-Z0-9]{1,40}-)+[a-zA-Z0-9]{1,40}\b/g;
|
|
11063
11067
|
const results = source.content.matchAll(SLACK_TOKEN_PATTERN);
|
|
11064
11068
|
for (const result of results) {
|
|
@@ -11069,7 +11073,7 @@ function reportIfFoundRawPrivateKey$1({ source, options, context, t }) {
|
|
|
11069
11073
|
if (allowedResults.length > 0) {
|
|
11070
11074
|
continue;
|
|
11071
11075
|
}
|
|
11072
|
-
|
|
11076
|
+
context2.report({
|
|
11073
11077
|
message: t("SLACK_TOKEN", {
|
|
11074
11078
|
TOKEN: match
|
|
11075
11079
|
}),
|
|
@@ -11077,7 +11081,7 @@ function reportIfFoundRawPrivateKey$1({ source, options, context, t }) {
|
|
|
11077
11081
|
});
|
|
11078
11082
|
}
|
|
11079
11083
|
}
|
|
11080
|
-
function reportIfFoundIncomingWebhook({ source, options, context, t }) {
|
|
11084
|
+
function reportIfFoundIncomingWebhook({ source, options, context: context2, t }) {
|
|
11081
11085
|
const IncomingWebhooksPattern = /https:\/\/hooks\.slack\.com\/services\/T[a-zA-Z0-9]{1,40}\/B[a-zA-Z0-9]{1,40}\/[a-zA-Z0-9]{1,40}/gi;
|
|
11082
11086
|
const results = source.content.matchAll(IncomingWebhooksPattern);
|
|
11083
11087
|
for (const result of results) {
|
|
@@ -11088,7 +11092,7 @@ function reportIfFoundIncomingWebhook({ source, options, context, t }) {
|
|
|
11088
11092
|
if (allowedResults.length > 0) {
|
|
11089
11093
|
continue;
|
|
11090
11094
|
}
|
|
11091
|
-
|
|
11095
|
+
context2.report({
|
|
11092
11096
|
message: t("IncomingWebhook", {
|
|
11093
11097
|
URL: match
|
|
11094
11098
|
}),
|
|
@@ -11107,15 +11111,15 @@ var creator$p = {
|
|
|
11107
11111
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-slack/README.md"
|
|
11108
11112
|
}
|
|
11109
11113
|
},
|
|
11110
|
-
create(
|
|
11111
|
-
const t =
|
|
11114
|
+
create(context2, options) {
|
|
11115
|
+
const t = context2.createTranslator(messages$o);
|
|
11112
11116
|
const normalizedOptions = {
|
|
11113
11117
|
allows: options.allows || []
|
|
11114
11118
|
};
|
|
11115
11119
|
return {
|
|
11116
11120
|
file(source) {
|
|
11117
|
-
reportIfFoundRawPrivateKey$1({ source, options: normalizedOptions, context, t });
|
|
11118
|
-
reportIfFoundIncomingWebhook({ source, options: normalizedOptions, context, t });
|
|
11121
|
+
reportIfFoundRawPrivateKey$1({ source, options: normalizedOptions, context: context2, t });
|
|
11122
|
+
reportIfFoundIncomingWebhook({ source, options: normalizedOptions, context: context2, t });
|
|
11119
11123
|
}
|
|
11120
11124
|
};
|
|
11121
11125
|
}
|
|
@@ -11180,7 +11184,7 @@ function isLikelyRealPassword(password) {
|
|
|
11180
11184
|
return false;
|
|
11181
11185
|
return true;
|
|
11182
11186
|
}
|
|
11183
|
-
function reportIfFoundBasicAuth({ source, options, context, t }) {
|
|
11187
|
+
function reportIfFoundBasicAuth({ source, options, context: context2, t }) {
|
|
11184
11188
|
const URL_PATTERN = /(?<protocol>(?:https?|ftp|ftps)):\/\/(?<user>[-a-zA-Z0-9_]{1,256}):(?<password>[-a-zA-Z0-9_]{1,256})@[-a-zA-Z0-9%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b/g;
|
|
11185
11189
|
const results = source.content.matchAll(URL_PATTERN);
|
|
11186
11190
|
for (const result of results) {
|
|
@@ -11199,7 +11203,7 @@ function reportIfFoundBasicAuth({ source, options, context, t }) {
|
|
|
11199
11203
|
if (allowedResults.length > 0) {
|
|
11200
11204
|
continue;
|
|
11201
11205
|
}
|
|
11202
|
-
|
|
11206
|
+
context2.report({
|
|
11203
11207
|
message: t("BasicAuth", {
|
|
11204
11208
|
CREDENTIAL: match
|
|
11205
11209
|
}),
|
|
@@ -11218,14 +11222,14 @@ var creator$o = {
|
|
|
11218
11222
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-basicauth/README.md"
|
|
11219
11223
|
}
|
|
11220
11224
|
},
|
|
11221
|
-
create(
|
|
11222
|
-
const t =
|
|
11225
|
+
create(context2, options) {
|
|
11226
|
+
const t = context2.createTranslator(messages$n);
|
|
11223
11227
|
const normalizedOptions = {
|
|
11224
11228
|
allows: options.allows || []
|
|
11225
11229
|
};
|
|
11226
11230
|
return {
|
|
11227
11231
|
file(source) {
|
|
11228
|
-
reportIfFoundBasicAuth({ source, options: normalizedOptions, context, t });
|
|
11232
|
+
reportIfFoundBasicAuth({ source, options: normalizedOptions, context: context2, t });
|
|
11229
11233
|
}
|
|
11230
11234
|
};
|
|
11231
11235
|
}
|
|
@@ -11247,8 +11251,8 @@ var creator$n = {
|
|
|
11247
11251
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-openai/README.md"
|
|
11248
11252
|
}
|
|
11249
11253
|
},
|
|
11250
|
-
create(
|
|
11251
|
-
const t =
|
|
11254
|
+
create(context2) {
|
|
11255
|
+
const t = context2.createTranslator(messages$m);
|
|
11252
11256
|
return {
|
|
11253
11257
|
file(source) {
|
|
11254
11258
|
const pattern = /sk-(?:proj|svcacct|admin)-(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})T3BlbkFJ(?:[A-Za-z0-9_-]{74}|[A-Za-z0-9_-]{58})\b|sk-[a-zA-Z0-9]{20}T3BlbkFJ[a-zA-Z0-9]{20}/g;
|
|
@@ -11257,7 +11261,7 @@ var creator$n = {
|
|
|
11257
11261
|
const index = match.index ?? 0;
|
|
11258
11262
|
const matchString = match[0] ?? "";
|
|
11259
11263
|
const range = [index, index + matchString.length];
|
|
11260
|
-
|
|
11264
|
+
context2.report({
|
|
11261
11265
|
message: t("OPENAI_TOKEN", {
|
|
11262
11266
|
TOKEN: matchString
|
|
11263
11267
|
}),
|
|
@@ -11285,8 +11289,8 @@ var creator$m = {
|
|
|
11285
11289
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-anthropic/README.md"
|
|
11286
11290
|
}
|
|
11287
11291
|
},
|
|
11288
|
-
create(
|
|
11289
|
-
const t =
|
|
11292
|
+
create(context2) {
|
|
11293
|
+
const t = context2.createTranslator(messages$l);
|
|
11290
11294
|
return {
|
|
11291
11295
|
file(source) {
|
|
11292
11296
|
const pattern = new RegExp("(?<!\\p{L})sk-ant-api0\\d-[A-Za-z0-9_-]{90,128}AA(?![A-Za-z0-9_-])", "gu");
|
|
@@ -11295,7 +11299,7 @@ var creator$m = {
|
|
|
11295
11299
|
const index = match.index ?? 0;
|
|
11296
11300
|
const matchString = match[0] ?? "";
|
|
11297
11301
|
const range = [index, index + matchString.length];
|
|
11298
|
-
|
|
11302
|
+
context2.report({
|
|
11299
11303
|
message: t("ANTHROPIC_API_KEY", {
|
|
11300
11304
|
KEY: matchString
|
|
11301
11305
|
}),
|
|
@@ -11323,8 +11327,8 @@ var creator$l = {
|
|
|
11323
11327
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-groq/README.md"
|
|
11324
11328
|
}
|
|
11325
11329
|
},
|
|
11326
|
-
create(
|
|
11327
|
-
const t =
|
|
11330
|
+
create(context2, options) {
|
|
11331
|
+
const t = context2.createTranslator(messages$k);
|
|
11328
11332
|
const normalizedOptions = {
|
|
11329
11333
|
allows: options?.allows ?? []
|
|
11330
11334
|
};
|
|
@@ -11340,7 +11344,7 @@ var creator$l = {
|
|
|
11340
11344
|
continue;
|
|
11341
11345
|
}
|
|
11342
11346
|
const range = [index, index + matchString.length];
|
|
11343
|
-
|
|
11347
|
+
context2.report({
|
|
11344
11348
|
message: t("GROQ_API_KEY", {
|
|
11345
11349
|
KEY: matchString
|
|
11346
11350
|
}),
|
|
@@ -11368,8 +11372,8 @@ var creator$k = {
|
|
|
11368
11372
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-huggingface/README.md"
|
|
11369
11373
|
}
|
|
11370
11374
|
},
|
|
11371
|
-
create(
|
|
11372
|
-
const t =
|
|
11375
|
+
create(context2, options) {
|
|
11376
|
+
const t = context2.createTranslator(messages$j);
|
|
11373
11377
|
const normalizedOptions = {
|
|
11374
11378
|
allows: options?.allows ?? []
|
|
11375
11379
|
};
|
|
@@ -11385,7 +11389,7 @@ var creator$k = {
|
|
|
11385
11389
|
continue;
|
|
11386
11390
|
}
|
|
11387
11391
|
const range = [index, index + matchString.length];
|
|
11388
|
-
|
|
11392
|
+
context2.report({
|
|
11389
11393
|
message: t("HUGGINGFACE_USER_ACCESS_TOKEN", {
|
|
11390
11394
|
TOKEN: matchString
|
|
11391
11395
|
}),
|
|
@@ -11413,8 +11417,8 @@ var creator$j = {
|
|
|
11413
11417
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-linear/README.md"
|
|
11414
11418
|
}
|
|
11415
11419
|
},
|
|
11416
|
-
create(
|
|
11417
|
-
const t =
|
|
11420
|
+
create(context2) {
|
|
11421
|
+
const t = context2.createTranslator(messages$i);
|
|
11418
11422
|
return {
|
|
11419
11423
|
file(source) {
|
|
11420
11424
|
const pattern = new RegExp("(?<!\\p{L})lin_api_[a-zA-Z0-9_]{32,128}(?![a-zA-Z0-9_])", "gu");
|
|
@@ -11423,7 +11427,7 @@ var creator$j = {
|
|
|
11423
11427
|
const index = match.index ?? 0;
|
|
11424
11428
|
const matchString = match[0] ?? "";
|
|
11425
11429
|
const range = [index, index + matchString.length];
|
|
11426
|
-
|
|
11430
|
+
context2.report({
|
|
11427
11431
|
message: t("LINEAR_API_TOKEN", {
|
|
11428
11432
|
ID: matchString
|
|
11429
11433
|
}),
|
|
@@ -11440,7 +11444,7 @@ var messages$h = {
|
|
|
11440
11444
|
ja: (props) => `Notion integration \u30C8\u30FC\u30AF\u30F3: ${props.TOKEN} \u304C\u307F\u3064\u304B\u308A\u307E\u3057\u305F`
|
|
11441
11445
|
}
|
|
11442
11446
|
};
|
|
11443
|
-
function reportIfFoundToken({ source, options, context, t }) {
|
|
11447
|
+
function reportIfFoundToken({ source, options, context: context2, t }) {
|
|
11444
11448
|
const NOTION_INTEGRATION_TOKEN_PATTERN = new RegExp("(?<!\\p{L})ntn_[0-9]{11}[A-Za-z0-9]{35}(?![A-Za-z0-9])", "gu");
|
|
11445
11449
|
const results = source.content.matchAll(NOTION_INTEGRATION_TOKEN_PATTERN);
|
|
11446
11450
|
for (const result of results) {
|
|
@@ -11451,7 +11455,7 @@ function reportIfFoundToken({ source, options, context, t }) {
|
|
|
11451
11455
|
if (allowedResults.length > 0) {
|
|
11452
11456
|
continue;
|
|
11453
11457
|
}
|
|
11454
|
-
|
|
11458
|
+
context2.report({
|
|
11455
11459
|
message: t("NOTION_INTEGRATION_TOKEN", {
|
|
11456
11460
|
TOKEN: match
|
|
11457
11461
|
}),
|
|
@@ -11470,14 +11474,14 @@ var creator$i = {
|
|
|
11470
11474
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-notion/README.md"
|
|
11471
11475
|
}
|
|
11472
11476
|
},
|
|
11473
|
-
create(
|
|
11474
|
-
const t =
|
|
11477
|
+
create(context2, options) {
|
|
11478
|
+
const t = context2.createTranslator(messages$h);
|
|
11475
11479
|
const normalizedOptions = {
|
|
11476
11480
|
allows: options.allows ?? []
|
|
11477
11481
|
};
|
|
11478
11482
|
return {
|
|
11479
11483
|
file(source) {
|
|
11480
|
-
reportIfFoundToken({ source, options: normalizedOptions, context, t });
|
|
11484
|
+
reportIfFoundToken({ source, options: normalizedOptions, context: context2, t });
|
|
11481
11485
|
}
|
|
11482
11486
|
};
|
|
11483
11487
|
}
|
|
@@ -11502,7 +11506,7 @@ function validateBase64KeyContent(base64Content) {
|
|
|
11502
11506
|
}
|
|
11503
11507
|
return true;
|
|
11504
11508
|
}
|
|
11505
|
-
function reportIfFoundRawPrivateKey({ source, options, context, t }) {
|
|
11509
|
+
function reportIfFoundRawPrivateKey({ source, options, context: context2, t }) {
|
|
11506
11510
|
const results = source.content.matchAll(PEM_CONTENT_PATTERN);
|
|
11507
11511
|
for (const result of results) {
|
|
11508
11512
|
const index = result.index || 0;
|
|
@@ -11517,7 +11521,7 @@ function reportIfFoundRawPrivateKey({ source, options, context, t }) {
|
|
|
11517
11521
|
if (!validateBase64KeyContent(base64Content)) {
|
|
11518
11522
|
continue;
|
|
11519
11523
|
}
|
|
11520
|
-
|
|
11524
|
+
context2.report({
|
|
11521
11525
|
message: t("PrivateKey", {
|
|
11522
11526
|
KEY: match
|
|
11523
11527
|
}),
|
|
@@ -11536,14 +11540,14 @@ var creator$h = {
|
|
|
11536
11540
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-privatekey/README.md"
|
|
11537
11541
|
}
|
|
11538
11542
|
},
|
|
11539
|
-
create(
|
|
11540
|
-
const t =
|
|
11543
|
+
create(context2, options) {
|
|
11544
|
+
const t = context2.createTranslator(messages$g);
|
|
11541
11545
|
const normalizedOptions = {
|
|
11542
11546
|
allows: options.allows || []
|
|
11543
11547
|
};
|
|
11544
11548
|
return {
|
|
11545
11549
|
file(source) {
|
|
11546
|
-
reportIfFoundRawPrivateKey({ source, options: normalizedOptions, context, t });
|
|
11550
|
+
reportIfFoundRawPrivateKey({ source, options: normalizedOptions, context: context2, t });
|
|
11547
11551
|
}
|
|
11548
11552
|
};
|
|
11549
11553
|
}
|
|
@@ -11554,7 +11558,7 @@ var messages$f = {
|
|
|
11554
11558
|
ja: (props) => `Sendgrid API\u30AD\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\uFF1A ${props.KEY}`
|
|
11555
11559
|
}
|
|
11556
11560
|
};
|
|
11557
|
-
function reportIfFoundKey$3({ source, options, context, t }) {
|
|
11561
|
+
function reportIfFoundKey$3({ source, options, context: context2, t }) {
|
|
11558
11562
|
const SENDGRID_KEY_PATTERN = new RegExp("(?<!\\p{L})SG\\.\\w{1,128}\\.\\w{1,128}([-_]?)\\w{1,128}(?!\\w)", "gu");
|
|
11559
11563
|
const results = source.content.matchAll(SENDGRID_KEY_PATTERN);
|
|
11560
11564
|
for (const result of results) {
|
|
@@ -11568,7 +11572,7 @@ function reportIfFoundKey$3({ source, options, context, t }) {
|
|
|
11568
11572
|
if (allowedResults.length > 0) {
|
|
11569
11573
|
continue;
|
|
11570
11574
|
}
|
|
11571
|
-
|
|
11575
|
+
context2.report({
|
|
11572
11576
|
message: t("SENDGRID_KEY", {
|
|
11573
11577
|
KEY: match
|
|
11574
11578
|
}),
|
|
@@ -11587,14 +11591,14 @@ var creator$g = {
|
|
|
11587
11591
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-sendgrid/README.md"
|
|
11588
11592
|
}
|
|
11589
11593
|
},
|
|
11590
|
-
create(
|
|
11591
|
-
const t =
|
|
11594
|
+
create(context2, options) {
|
|
11595
|
+
const t = context2.createTranslator(messages$f);
|
|
11592
11596
|
const normalizedOptions = {
|
|
11593
11597
|
allows: options.allows || []
|
|
11594
11598
|
};
|
|
11595
11599
|
return {
|
|
11596
11600
|
file(source) {
|
|
11597
|
-
reportIfFoundKey$3({ source, options: normalizedOptions, context, t });
|
|
11601
|
+
reportIfFoundKey$3({ source, options: normalizedOptions, context: context2, t });
|
|
11598
11602
|
}
|
|
11599
11603
|
};
|
|
11600
11604
|
}
|
|
@@ -11605,7 +11609,7 @@ var messages$e = {
|
|
|
11605
11609
|
ja: (props) => `Shopify API\u30AD\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\uFF1A ${props.KEY}`
|
|
11606
11610
|
}
|
|
11607
11611
|
};
|
|
11608
|
-
function reportIfFoundKey$2({ source, options, context, t }) {
|
|
11612
|
+
function reportIfFoundKey$2({ source, options, context: context2, t }) {
|
|
11609
11613
|
const SHOPIFY_KEY_PATTERN = new RegExp("(?<!\\p{L})(shppa|shpca|shpat|shpss)_[a-zA-Z0-9]{32,64}(?![a-zA-Z0-9])", "gu");
|
|
11610
11614
|
const results = source.content.matchAll(SHOPIFY_KEY_PATTERN);
|
|
11611
11615
|
for (const result of results) {
|
|
@@ -11616,7 +11620,7 @@ function reportIfFoundKey$2({ source, options, context, t }) {
|
|
|
11616
11620
|
if (allowedResults.length > 0) {
|
|
11617
11621
|
continue;
|
|
11618
11622
|
}
|
|
11619
|
-
|
|
11623
|
+
context2.report({
|
|
11620
11624
|
message: t("SHOPIFY_KEY", {
|
|
11621
11625
|
KEY: match
|
|
11622
11626
|
}),
|
|
@@ -11635,14 +11639,14 @@ var creator$f = {
|
|
|
11635
11639
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-shopify/README.md"
|
|
11636
11640
|
}
|
|
11637
11641
|
},
|
|
11638
|
-
create(
|
|
11639
|
-
const t =
|
|
11642
|
+
create(context2, options) {
|
|
11643
|
+
const t = context2.createTranslator(messages$e);
|
|
11640
11644
|
const normalizedOptions = {
|
|
11641
11645
|
allows: options.allows || []
|
|
11642
11646
|
};
|
|
11643
11647
|
return {
|
|
11644
11648
|
file(source) {
|
|
11645
|
-
reportIfFoundKey$2({ source, options: normalizedOptions, context, t });
|
|
11649
|
+
reportIfFoundKey$2({ source, options: normalizedOptions, context: context2, t });
|
|
11646
11650
|
}
|
|
11647
11651
|
};
|
|
11648
11652
|
}
|
|
@@ -11672,7 +11676,7 @@ var messageIdMap$1 = {
|
|
|
11672
11676
|
rk_test: "STRIPE_RESTRICTED_KEY_TEST"
|
|
11673
11677
|
};
|
|
11674
11678
|
var STRIPE_KEY_PATTERN = new RegExp("(?<!\\p{L})(?<prefix>sk_live|sk_test|rk_live|rk_test)_[a-zA-Z0-9]{24,99}(?![a-zA-Z0-9])", "gu");
|
|
11675
|
-
function reportIfFound$2({ source, options, context, t }) {
|
|
11679
|
+
function reportIfFound$2({ source, options, context: context2, t }) {
|
|
11676
11680
|
const results = source.content.matchAll(STRIPE_KEY_PATTERN);
|
|
11677
11681
|
for (const result of results) {
|
|
11678
11682
|
const index = result.index ?? 0;
|
|
@@ -11686,7 +11690,7 @@ function reportIfFound$2({ source, options, context, t }) {
|
|
|
11686
11690
|
if (allowedResults.length > 0) {
|
|
11687
11691
|
continue;
|
|
11688
11692
|
}
|
|
11689
|
-
|
|
11693
|
+
context2.report({
|
|
11690
11694
|
message: t(messageIdMap$1[prefix], {
|
|
11691
11695
|
KEY: match
|
|
11692
11696
|
}),
|
|
@@ -11705,14 +11709,14 @@ var creator$e = {
|
|
|
11705
11709
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-stripe/README.md"
|
|
11706
11710
|
}
|
|
11707
11711
|
},
|
|
11708
|
-
create(
|
|
11709
|
-
const t =
|
|
11712
|
+
create(context2, options) {
|
|
11713
|
+
const t = context2.createTranslator(messages$d);
|
|
11710
11714
|
const normalizedOptions = {
|
|
11711
11715
|
allows: options.allows ?? []
|
|
11712
11716
|
};
|
|
11713
11717
|
return {
|
|
11714
11718
|
file(source) {
|
|
11715
|
-
reportIfFound$2({ source, options: normalizedOptions, context, t });
|
|
11719
|
+
reportIfFound$2({ source, options: normalizedOptions, context: context2, t });
|
|
11716
11720
|
}
|
|
11717
11721
|
};
|
|
11718
11722
|
}
|
|
@@ -11731,7 +11735,7 @@ var typeMap = /* @__PURE__ */ new Map([
|
|
|
11731
11735
|
["ghr", "refresh tokens"],
|
|
11732
11736
|
["github_pat", "fine-grained personal access tokens"]
|
|
11733
11737
|
]);
|
|
11734
|
-
function reportIfFoundKey$1({ pattern, source, options, context, t }) {
|
|
11738
|
+
function reportIfFoundKey$1({ pattern, source, options, context: context2, t }) {
|
|
11735
11739
|
const results = source.content.matchAll(pattern);
|
|
11736
11740
|
for (const result of results) {
|
|
11737
11741
|
const index = result.index || 0;
|
|
@@ -11746,7 +11750,7 @@ function reportIfFoundKey$1({ pattern, source, options, context, t }) {
|
|
|
11746
11750
|
if (allowedResults.length > 0) {
|
|
11747
11751
|
continue;
|
|
11748
11752
|
}
|
|
11749
|
-
|
|
11753
|
+
context2.report({
|
|
11750
11754
|
message: t("GITHUB_TOKEN", {
|
|
11751
11755
|
KEY: match,
|
|
11752
11756
|
typeName
|
|
@@ -11766,7 +11770,7 @@ var creator$d = {
|
|
|
11766
11770
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-github/README.md"
|
|
11767
11771
|
}
|
|
11768
11772
|
},
|
|
11769
|
-
create(
|
|
11773
|
+
create(context2, options) {
|
|
11770
11774
|
const CLASSIC_GITHUB_TOKEN_PATTERN = new RegExp("(?<!\\p{L})(?<type>ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36}(?![A-Za-z0-9_])", "gu");
|
|
11771
11775
|
const FINE_GRAINED_GITHUB_TOKEN_PATTERN = new RegExp("(?<!\\p{L})(?<type>github_pat)_[A-Za-z0-9_]{82}(?![A-Za-z0-9_])", "gu");
|
|
11772
11776
|
const GITHUB_APP_INSTALLATION_TOKEN_PATTERN = new RegExp("(?<!\\p{L})(?<type>ghs)_[0-9]{1,20}_[A-Za-z0-9_-]{1,1000}\\.[A-Za-z0-9_-]{1,10000}\\.[A-Za-z0-9_-]{1,1000}(?![A-Za-z0-9_-])", "gu");
|
|
@@ -11775,14 +11779,14 @@ var creator$d = {
|
|
|
11775
11779
|
FINE_GRAINED_GITHUB_TOKEN_PATTERN,
|
|
11776
11780
|
GITHUB_APP_INSTALLATION_TOKEN_PATTERN
|
|
11777
11781
|
];
|
|
11778
|
-
const t =
|
|
11782
|
+
const t = context2.createTranslator(messages$c);
|
|
11779
11783
|
const normalizedOptions = {
|
|
11780
11784
|
allows: options.allows || []
|
|
11781
11785
|
};
|
|
11782
11786
|
return {
|
|
11783
11787
|
file(source) {
|
|
11784
11788
|
for (const pattern of patterns) {
|
|
11785
|
-
reportIfFoundKey$1({ pattern, source, options: normalizedOptions, context, t });
|
|
11789
|
+
reportIfFoundKey$1({ pattern, source, options: normalizedOptions, context: context2, t });
|
|
11786
11790
|
}
|
|
11787
11791
|
}
|
|
11788
11792
|
};
|
|
@@ -11794,7 +11798,7 @@ var messages$b = {
|
|
|
11794
11798
|
ja: (props) => `GitLab Personal Access Token\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F: ${props.KEY}`
|
|
11795
11799
|
}
|
|
11796
11800
|
};
|
|
11797
|
-
function reportIfFoundKey({ pattern, source, options, context, t }) {
|
|
11801
|
+
function reportIfFoundKey({ pattern, source, options, context: context2, t }) {
|
|
11798
11802
|
const results = source.content.matchAll(pattern);
|
|
11799
11803
|
for (const result of results) {
|
|
11800
11804
|
const index = result.index ?? 0;
|
|
@@ -11804,7 +11808,7 @@ function reportIfFoundKey({ pattern, source, options, context, t }) {
|
|
|
11804
11808
|
if (allowedResults.length > 0) {
|
|
11805
11809
|
continue;
|
|
11806
11810
|
}
|
|
11807
|
-
|
|
11811
|
+
context2.report({
|
|
11808
11812
|
message: t("GITLAB_PERSONAL_ACCESS_TOKEN", {
|
|
11809
11813
|
KEY: match
|
|
11810
11814
|
}),
|
|
@@ -11823,17 +11827,17 @@ var creator$c = {
|
|
|
11823
11827
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-gitlab/README.md"
|
|
11824
11828
|
}
|
|
11825
11829
|
},
|
|
11826
|
-
create(
|
|
11830
|
+
create(context2, options) {
|
|
11827
11831
|
const GITLAB_PERSONAL_ACCESS_TOKEN_PATTERN = new RegExp("(?<!\\p{L})glpat-[A-Za-z0-9_-]{20,128}(?![A-Za-z0-9_-])", "gu");
|
|
11828
11832
|
const patterns = [GITLAB_PERSONAL_ACCESS_TOKEN_PATTERN];
|
|
11829
|
-
const t =
|
|
11833
|
+
const t = context2.createTranslator(messages$b);
|
|
11830
11834
|
const normalizedOptions = {
|
|
11831
11835
|
allows: options.allows ?? []
|
|
11832
11836
|
};
|
|
11833
11837
|
return {
|
|
11834
11838
|
file(source) {
|
|
11835
11839
|
for (const pattern of patterns) {
|
|
11836
|
-
reportIfFoundKey({ pattern, source, options: normalizedOptions, context, t });
|
|
11840
|
+
reportIfFoundKey({ pattern, source, options: normalizedOptions, context: context2, t });
|
|
11837
11841
|
}
|
|
11838
11842
|
}
|
|
11839
11843
|
};
|
|
@@ -11849,7 +11853,7 @@ var messages$a = {
|
|
|
11849
11853
|
ja: (props) => `Grafana Service Account \u30C8\u30FC\u30AF\u30F3: ${props.TOKEN} \u304C\u307F\u3064\u304B\u308A\u307E\u3057\u305F`
|
|
11850
11854
|
}
|
|
11851
11855
|
};
|
|
11852
|
-
function reportIfFound$1({ pattern, messageId, source, options, context, t }) {
|
|
11856
|
+
function reportIfFound$1({ pattern, messageId, source, options, context: context2, t }) {
|
|
11853
11857
|
const results = source.content.matchAll(pattern);
|
|
11854
11858
|
for (const result of results) {
|
|
11855
11859
|
const index = result.index ?? 0;
|
|
@@ -11859,7 +11863,7 @@ function reportIfFound$1({ pattern, messageId, source, options, context, t }) {
|
|
|
11859
11863
|
continue;
|
|
11860
11864
|
}
|
|
11861
11865
|
const range = [index, index + match.length];
|
|
11862
|
-
|
|
11866
|
+
context2.report({
|
|
11863
11867
|
message: t(messageId, {
|
|
11864
11868
|
TOKEN: match
|
|
11865
11869
|
}),
|
|
@@ -11878,8 +11882,8 @@ var creator$b = {
|
|
|
11878
11882
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-grafana/README.md"
|
|
11879
11883
|
}
|
|
11880
11884
|
},
|
|
11881
|
-
create(
|
|
11882
|
-
const t =
|
|
11885
|
+
create(context2, options) {
|
|
11886
|
+
const t = context2.createTranslator(messages$a);
|
|
11883
11887
|
const normalizedOptions = {
|
|
11884
11888
|
allows: options?.allows ?? []
|
|
11885
11889
|
};
|
|
@@ -11892,7 +11896,7 @@ var creator$b = {
|
|
|
11892
11896
|
messageId: "GRAFANA_CLOUD_API_TOKEN",
|
|
11893
11897
|
source,
|
|
11894
11898
|
options: normalizedOptions,
|
|
11895
|
-
context,
|
|
11899
|
+
context: context2,
|
|
11896
11900
|
t
|
|
11897
11901
|
});
|
|
11898
11902
|
reportIfFound$1({
|
|
@@ -11900,7 +11904,7 @@ var creator$b = {
|
|
|
11900
11904
|
messageId: "GRAFANA_SERVICE_ACCOUNT_TOKEN",
|
|
11901
11905
|
source,
|
|
11902
11906
|
options: normalizedOptions,
|
|
11903
|
-
context,
|
|
11907
|
+
context: context2,
|
|
11904
11908
|
t
|
|
11905
11909
|
});
|
|
11906
11910
|
}
|
|
@@ -11933,8 +11937,8 @@ var creator$a = {
|
|
|
11933
11937
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-1password/README.md"
|
|
11934
11938
|
}
|
|
11935
11939
|
},
|
|
11936
|
-
create(
|
|
11937
|
-
const t =
|
|
11940
|
+
create(context2, options) {
|
|
11941
|
+
const t = context2.createTranslator(messages$9);
|
|
11938
11942
|
const normalizedOptions = {
|
|
11939
11943
|
allows: options?.allows ?? []
|
|
11940
11944
|
};
|
|
@@ -11954,7 +11958,7 @@ var creator$a = {
|
|
|
11954
11958
|
continue;
|
|
11955
11959
|
}
|
|
11956
11960
|
const range = [index, index + matchString.length];
|
|
11957
|
-
|
|
11961
|
+
context2.report({
|
|
11958
11962
|
message: t("OPS_TOKEN", {
|
|
11959
11963
|
TOKEN: matchString
|
|
11960
11964
|
}),
|
|
@@ -12036,7 +12040,7 @@ function isLikelyRealCredential(username, password) {
|
|
|
12036
12040
|
return false;
|
|
12037
12041
|
return true;
|
|
12038
12042
|
}
|
|
12039
|
-
function reportMongoDBConnectionString({ source, options, context, t }) {
|
|
12043
|
+
function reportMongoDBConnectionString({ source, options, context: context2, t }) {
|
|
12040
12044
|
const MONGODB_PATTERN = /mongodb(?:\+srv)?:\/\/(?:(?<username>[^:\/\s]{1,100}):(?<password>[^@\/\s]{1,200})@)?(?<host>[^\/\s?]{1,100})(?:\/(?<database>[^?\s]{0,100}))?(?:\?(?<options>[^\s]{0,500}))?/gi;
|
|
12041
12045
|
const results = source.content.matchAll(MONGODB_PATTERN);
|
|
12042
12046
|
for (const result of results) {
|
|
@@ -12053,7 +12057,7 @@ function reportMongoDBConnectionString({ source, options, context, t }) {
|
|
|
12053
12057
|
if (allowedResults.length > 0) {
|
|
12054
12058
|
continue;
|
|
12055
12059
|
}
|
|
12056
|
-
|
|
12060
|
+
context2.report({
|
|
12057
12061
|
message: t("MongoDBConnection", {
|
|
12058
12062
|
URI: match
|
|
12059
12063
|
}),
|
|
@@ -12061,7 +12065,7 @@ function reportMongoDBConnectionString({ source, options, context, t }) {
|
|
|
12061
12065
|
});
|
|
12062
12066
|
}
|
|
12063
12067
|
}
|
|
12064
|
-
function reportMySQLConnectionString({ source, options, context, t }) {
|
|
12068
|
+
function reportMySQLConnectionString({ source, options, context: context2, t }) {
|
|
12065
12069
|
const MYSQL_URI_PATTERN = /(?:jdbc:)?mysql(?:x)?:\/\/(?:(?<username>[^:\/\s]{1,100}):(?<password>[^@\/\s]{1,200})@)?(?<host>[^\/\s?]{1,100})(?:\/(?<database>[^?\s]{0,100}))?(?:\?(?<options>[^\s]{0,500}))?/gi;
|
|
12066
12070
|
const results = source.content.matchAll(MYSQL_URI_PATTERN);
|
|
12067
12071
|
for (const result of results) {
|
|
@@ -12078,7 +12082,7 @@ function reportMySQLConnectionString({ source, options, context, t }) {
|
|
|
12078
12082
|
if (allowedResults.length > 0) {
|
|
12079
12083
|
continue;
|
|
12080
12084
|
}
|
|
12081
|
-
|
|
12085
|
+
context2.report({
|
|
12082
12086
|
message: t("MySQLConnection", {
|
|
12083
12087
|
URI: match
|
|
12084
12088
|
}),
|
|
@@ -12086,7 +12090,7 @@ function reportMySQLConnectionString({ source, options, context, t }) {
|
|
|
12086
12090
|
});
|
|
12087
12091
|
}
|
|
12088
12092
|
}
|
|
12089
|
-
function reportPostgreSQLConnectionString({ source, options, context, t }) {
|
|
12093
|
+
function reportPostgreSQLConnectionString({ source, options, context: context2, t }) {
|
|
12090
12094
|
const POSTGRESQL_URI_PATTERN = /postgres(?:ql)?:\/\/(?:(?<username>[^:\/\s]{1,100}):(?<password>[^@\/\s]{1,200})@)?(?<host>[^\/\s?]{1,100})(?:\/(?<database>[^?\s]{0,100}))?(?:\?(?<options>[^\s]{0,500}))?/gi;
|
|
12091
12095
|
const results = source.content.matchAll(POSTGRESQL_URI_PATTERN);
|
|
12092
12096
|
for (const result of results) {
|
|
@@ -12103,7 +12107,7 @@ function reportPostgreSQLConnectionString({ source, options, context, t }) {
|
|
|
12103
12107
|
if (allowedResults.length > 0) {
|
|
12104
12108
|
continue;
|
|
12105
12109
|
}
|
|
12106
|
-
|
|
12110
|
+
context2.report({
|
|
12107
12111
|
message: t("PostgreSQLConnection", {
|
|
12108
12112
|
URI: match
|
|
12109
12113
|
}),
|
|
@@ -12122,16 +12126,16 @@ var creator$9 = {
|
|
|
12122
12126
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-database-connection-string/README.md"
|
|
12123
12127
|
}
|
|
12124
12128
|
},
|
|
12125
|
-
create(
|
|
12129
|
+
create(context2, options) {
|
|
12126
12130
|
const normalizedOptions = {
|
|
12127
12131
|
allows: options.allows || []
|
|
12128
12132
|
};
|
|
12129
|
-
const t =
|
|
12133
|
+
const t = context2.createTranslator(messages$8);
|
|
12130
12134
|
return {
|
|
12131
12135
|
file(source) {
|
|
12132
|
-
reportMongoDBConnectionString({ source, options: normalizedOptions, context, t });
|
|
12133
|
-
reportMySQLConnectionString({ source, options: normalizedOptions, context, t });
|
|
12134
|
-
reportPostgreSQLConnectionString({ source, options: normalizedOptions, context, t });
|
|
12136
|
+
reportMongoDBConnectionString({ source, options: normalizedOptions, context: context2, t });
|
|
12137
|
+
reportMySQLConnectionString({ source, options: normalizedOptions, context: context2, t });
|
|
12138
|
+
reportPostgreSQLConnectionString({ source, options: normalizedOptions, context: context2, t });
|
|
12135
12139
|
}
|
|
12136
12140
|
};
|
|
12137
12141
|
}
|
|
@@ -12164,8 +12168,8 @@ var creator$8 = {
|
|
|
12164
12168
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-hashicorp-vault/README.md"
|
|
12165
12169
|
}
|
|
12166
12170
|
},
|
|
12167
|
-
create(
|
|
12168
|
-
const t =
|
|
12171
|
+
create(context2, options) {
|
|
12172
|
+
const t = context2.createTranslator(messages$7);
|
|
12169
12173
|
const normalizedOptions = {
|
|
12170
12174
|
allows: options?.allows ?? []
|
|
12171
12175
|
};
|
|
@@ -12179,7 +12183,7 @@ var creator$8 = {
|
|
|
12179
12183
|
continue;
|
|
12180
12184
|
}
|
|
12181
12185
|
const range = [index, index + matchString.length];
|
|
12182
|
-
|
|
12186
|
+
context2.report({
|
|
12183
12187
|
message: t(messageId, {
|
|
12184
12188
|
TOKEN: matchString
|
|
12185
12189
|
}),
|
|
@@ -12236,8 +12240,8 @@ var creator$7 = {
|
|
|
12236
12240
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-vercel/README.md"
|
|
12237
12241
|
}
|
|
12238
12242
|
},
|
|
12239
|
-
create(
|
|
12240
|
-
const t =
|
|
12243
|
+
create(context2, options) {
|
|
12244
|
+
const t = context2.createTranslator(messages$6);
|
|
12241
12245
|
const normalizedOptions = {
|
|
12242
12246
|
allows: options?.allows ?? []
|
|
12243
12247
|
};
|
|
@@ -12255,7 +12259,7 @@ var creator$7 = {
|
|
|
12255
12259
|
continue;
|
|
12256
12260
|
}
|
|
12257
12261
|
const range = [index, index + matchString.length];
|
|
12258
|
-
|
|
12262
|
+
context2.report({
|
|
12259
12263
|
message: t(messageId, {
|
|
12260
12264
|
ID: matchString
|
|
12261
12265
|
}),
|
|
@@ -12283,8 +12287,8 @@ var creator$6 = {
|
|
|
12283
12287
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-databricks/README.md"
|
|
12284
12288
|
}
|
|
12285
12289
|
},
|
|
12286
|
-
create(
|
|
12287
|
-
const t =
|
|
12290
|
+
create(context2, options) {
|
|
12291
|
+
const t = context2.createTranslator(messages$5);
|
|
12288
12292
|
const normalizedOptions = {
|
|
12289
12293
|
allows: options?.allows ?? []
|
|
12290
12294
|
};
|
|
@@ -12300,7 +12304,7 @@ var creator$6 = {
|
|
|
12300
12304
|
continue;
|
|
12301
12305
|
}
|
|
12302
12306
|
const range = [index, index + matchString.length];
|
|
12303
|
-
|
|
12307
|
+
context2.report({
|
|
12304
12308
|
message: t("DATABRICKS_PERSONAL_ACCESS_TOKEN", {
|
|
12305
12309
|
ID: matchString
|
|
12306
12310
|
}),
|
|
@@ -12317,7 +12321,7 @@ var messages$4 = {
|
|
|
12317
12321
|
ja: (props) => `Docker Personal Access Token: ${props.TOKEN} \u304C\u307F\u3064\u304B\u308A\u307E\u3057\u305F`
|
|
12318
12322
|
}
|
|
12319
12323
|
};
|
|
12320
|
-
function reportIfFoundDockerPAT({ source, options, context, t }) {
|
|
12324
|
+
function reportIfFoundDockerPAT({ source, options, context: context2, t }) {
|
|
12321
12325
|
const DOCKER_PAT_PATTERN = new RegExp("(?<!\\p{L})dckr_pat_[a-zA-Z0-9_-]{27}(?![a-zA-Z0-9_-])", "gu");
|
|
12322
12326
|
const results = source.content.matchAll(DOCKER_PAT_PATTERN);
|
|
12323
12327
|
for (const result of results) {
|
|
@@ -12328,7 +12332,7 @@ function reportIfFoundDockerPAT({ source, options, context, t }) {
|
|
|
12328
12332
|
if (allowedResults.length > 0) {
|
|
12329
12333
|
continue;
|
|
12330
12334
|
}
|
|
12331
|
-
|
|
12335
|
+
context2.report({
|
|
12332
12336
|
message: t("DOCKER_PERSONAL_ACCESS_TOKEN", {
|
|
12333
12337
|
TOKEN: match
|
|
12334
12338
|
}),
|
|
@@ -12347,14 +12351,14 @@ var creator$5 = {
|
|
|
12347
12351
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-docker/README.md"
|
|
12348
12352
|
}
|
|
12349
12353
|
},
|
|
12350
|
-
create(
|
|
12351
|
-
const t =
|
|
12354
|
+
create(context2, options) {
|
|
12355
|
+
const t = context2.createTranslator(messages$4);
|
|
12352
12356
|
const normalizedOptions = {
|
|
12353
12357
|
allows: options.allows || []
|
|
12354
12358
|
};
|
|
12355
12359
|
return {
|
|
12356
12360
|
file(source) {
|
|
12357
|
-
reportIfFoundDockerPAT({ source, options: normalizedOptions, context, t });
|
|
12361
|
+
reportIfFoundDockerPAT({ source, options: normalizedOptions, context: context2, t });
|
|
12358
12362
|
}
|
|
12359
12363
|
};
|
|
12360
12364
|
}
|
|
@@ -12376,8 +12380,8 @@ var creator$4 = {
|
|
|
12376
12380
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-figma/README.md"
|
|
12377
12381
|
}
|
|
12378
12382
|
},
|
|
12379
|
-
create(
|
|
12380
|
-
const t =
|
|
12383
|
+
create(context2, options) {
|
|
12384
|
+
const t = context2.createTranslator(messages$3);
|
|
12381
12385
|
const normalizedOptions = {
|
|
12382
12386
|
allows: options?.allows ?? []
|
|
12383
12387
|
};
|
|
@@ -12393,7 +12397,7 @@ var creator$4 = {
|
|
|
12393
12397
|
continue;
|
|
12394
12398
|
}
|
|
12395
12399
|
const range = [index, index + matchString.length];
|
|
12396
|
-
|
|
12400
|
+
context2.report({
|
|
12397
12401
|
message: t("FIGMA_PERSONAL_ACCESS_TOKEN", {
|
|
12398
12402
|
ID: matchString
|
|
12399
12403
|
}),
|
|
@@ -12424,7 +12428,7 @@ var messageIdMap = {
|
|
|
12424
12428
|
cfat: "CLOUDFLARE_ACCOUNT_API_TOKEN"
|
|
12425
12429
|
};
|
|
12426
12430
|
var CLOUDFLARE_TOKEN_PATTERN = new RegExp("(?<!\\p{L})(?<prefix>cfk|cfut|cfat)_[A-Za-z0-9]{40}[0-9a-f]{8}(?![A-Za-z0-9])", "gu");
|
|
12427
|
-
function reportIfFound({ source, options, context, t }) {
|
|
12431
|
+
function reportIfFound({ source, options, context: context2, t }) {
|
|
12428
12432
|
const results = source.content.matchAll(CLOUDFLARE_TOKEN_PATTERN);
|
|
12429
12433
|
for (const result of results) {
|
|
12430
12434
|
const index = result.index ?? 0;
|
|
@@ -12438,7 +12442,7 @@ function reportIfFound({ source, options, context, t }) {
|
|
|
12438
12442
|
if (allowedResults.length > 0) {
|
|
12439
12443
|
continue;
|
|
12440
12444
|
}
|
|
12441
|
-
|
|
12445
|
+
context2.report({
|
|
12442
12446
|
message: t(messageIdMap[prefix], {
|
|
12443
12447
|
TOKEN: match
|
|
12444
12448
|
}),
|
|
@@ -12457,14 +12461,14 @@ var creator$3 = {
|
|
|
12457
12461
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-cloudflare/README.md"
|
|
12458
12462
|
}
|
|
12459
12463
|
},
|
|
12460
|
-
create(
|
|
12461
|
-
const t =
|
|
12464
|
+
create(context2, options) {
|
|
12465
|
+
const t = context2.createTranslator(messages$2);
|
|
12462
12466
|
const normalizedOptions = {
|
|
12463
12467
|
allows: options.allows ?? []
|
|
12464
12468
|
};
|
|
12465
12469
|
return {
|
|
12466
12470
|
file(source) {
|
|
12467
|
-
reportIfFound({ source, options: normalizedOptions, context, t });
|
|
12471
|
+
reportIfFound({ source, options: normalizedOptions, context: context2, t });
|
|
12468
12472
|
}
|
|
12469
12473
|
};
|
|
12470
12474
|
}
|
|
@@ -12513,8 +12517,8 @@ var creator$2 = {
|
|
|
12513
12517
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-tailscale/README.md"
|
|
12514
12518
|
}
|
|
12515
12519
|
},
|
|
12516
|
-
create(
|
|
12517
|
-
const t =
|
|
12520
|
+
create(context2, options) {
|
|
12521
|
+
const t = context2.createTranslator(messages$1);
|
|
12518
12522
|
const normalizedOptions = {
|
|
12519
12523
|
allows: options.allows ?? []
|
|
12520
12524
|
};
|
|
@@ -12532,7 +12536,7 @@ var creator$2 = {
|
|
|
12532
12536
|
continue;
|
|
12533
12537
|
}
|
|
12534
12538
|
const messageId = messageIdByType[type] ?? "TAILSCALE_KEY";
|
|
12535
|
-
|
|
12539
|
+
context2.report({
|
|
12536
12540
|
message: t(messageId, {
|
|
12537
12541
|
KEY: matchString
|
|
12538
12542
|
}),
|
|
@@ -12694,8 +12698,8 @@ var creator$1 = {
|
|
|
12694
12698
|
url: "https://github.com/secretlint/secretlint/blob/master/packages/%40secretlint/secretlint-rule-filter-comments/README.md"
|
|
12695
12699
|
}
|
|
12696
12700
|
},
|
|
12697
|
-
create(
|
|
12698
|
-
const t =
|
|
12701
|
+
create(context2) {
|
|
12702
|
+
const t = context2.createTranslator(messages);
|
|
12699
12703
|
return {
|
|
12700
12704
|
file(source) {
|
|
12701
12705
|
const state = new CommentState(source);
|
|
@@ -12712,7 +12716,7 @@ var creator$1 = {
|
|
|
12712
12716
|
}
|
|
12713
12717
|
}
|
|
12714
12718
|
state.getIgnoringMessages().forEach((message) => {
|
|
12715
|
-
|
|
12719
|
+
context2.ignore({
|
|
12716
12720
|
message: t("IGNORE_MESSAGE"),
|
|
12717
12721
|
range: [message.startIndex, message.endIndex],
|
|
12718
12722
|
targetRuleId: message.ruleId
|
|
@@ -15813,7 +15817,7 @@ function putProp2(target, key, value) {
|
|
|
15813
15817
|
else
|
|
15814
15818
|
target[key] = value;
|
|
15815
15819
|
}
|
|
15816
|
-
function mirrorShape2(target, source, keys,
|
|
15820
|
+
function mirrorShape2(target, source, keys, wrap2) {
|
|
15817
15821
|
const raw = sourceShape2(source);
|
|
15818
15822
|
for (const key of keys) {
|
|
15819
15823
|
const desc = Object.getOwnPropertyDescriptor(raw, key);
|
|
@@ -15822,10 +15826,10 @@ function mirrorShape2(target, source, keys, wrap) {
|
|
|
15822
15826
|
if (desc.get) {
|
|
15823
15827
|
deferProp2(target, key, () => {
|
|
15824
15828
|
const value = source._zod.def.shape[key];
|
|
15825
|
-
return
|
|
15829
|
+
return wrap2 ? wrap2(value, key) : value;
|
|
15826
15830
|
});
|
|
15827
15831
|
} else
|
|
15828
|
-
putProp2(target, key,
|
|
15832
|
+
putProp2(target, key, wrap2 ? wrap2(desc.value, key) : desc.value);
|
|
15829
15833
|
}
|
|
15830
15834
|
}
|
|
15831
15835
|
function mirrorProps2(target, source) {
|
|
@@ -16672,9 +16676,9 @@ function formatError2(error3, mapper = (issue3) => issue3.message) {
|
|
|
16672
16676
|
let i = 0;
|
|
16673
16677
|
while (i < fullpath.length) {
|
|
16674
16678
|
const el = fullpath[i];
|
|
16675
|
-
const
|
|
16679
|
+
const terminal2 = i === fullpath.length - 1;
|
|
16676
16680
|
if (el === "_errors") {
|
|
16677
|
-
if (
|
|
16681
|
+
if (terminal2)
|
|
16678
16682
|
curr._errors.push(mapper(issue3));
|
|
16679
16683
|
i++;
|
|
16680
16684
|
continue;
|
|
@@ -16688,7 +16692,7 @@ function formatError2(error3, mapper = (issue3) => issue3.message) {
|
|
|
16688
16692
|
});
|
|
16689
16693
|
}
|
|
16690
16694
|
const node3 = curr[el];
|
|
16691
|
-
if (
|
|
16695
|
+
if (terminal2) {
|
|
16692
16696
|
node3._errors.push(mapper(issue3));
|
|
16693
16697
|
}
|
|
16694
16698
|
curr = node3;
|
|
@@ -24242,9 +24246,13 @@ async function uninstallCursorHooks(cursorHome, dataDirectory2) {
|
|
|
24242
24246
|
}
|
|
24243
24247
|
|
|
24244
24248
|
// src/logger.ts
|
|
24245
|
-
|
|
24249
|
+
var context = () => ({
|
|
24246
24250
|
runtimeVersion: process.env.ITERATION_RUNTIME_VERSION ?? null
|
|
24247
|
-
})
|
|
24251
|
+
});
|
|
24252
|
+
configureCollectorLogging(context);
|
|
24253
|
+
function silenceCollectorLogs() {
|
|
24254
|
+
configureCollectorLogging(context, () => void 0);
|
|
24255
|
+
}
|
|
24248
24256
|
|
|
24249
24257
|
// src/turn-summary.ts
|
|
24250
24258
|
import { execFile as execFileCallback7 } from "node:child_process";
|
|
@@ -24976,8 +24984,157 @@ async function connectedConfig(source) {
|
|
|
24976
24984
|
|
|
24977
24985
|
// src/clerk-device-auth.ts
|
|
24978
24986
|
import { execFile as execFile8 } from "node:child_process";
|
|
24979
|
-
import { createInterface } from "node:readline/promises";
|
|
24980
24987
|
import { promisify as promisify8 } from "node:util";
|
|
24988
|
+
|
|
24989
|
+
// src/terminal.ts
|
|
24990
|
+
import { createInterface } from "node:readline/promises";
|
|
24991
|
+
import { stripVTControlCharacters, styleText } from "node:util";
|
|
24992
|
+
var MEASURE = 80;
|
|
24993
|
+
var INDENT = " ";
|
|
24994
|
+
var UNICODE_SYMBOLS = {
|
|
24995
|
+
brand: "\u25C6",
|
|
24996
|
+
success: "\u2713",
|
|
24997
|
+
warning: "!",
|
|
24998
|
+
failure: "\u2717",
|
|
24999
|
+
question: "?",
|
|
25000
|
+
on: "\u25CF",
|
|
25001
|
+
off: "\u25CB",
|
|
25002
|
+
spinner: ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"]
|
|
25003
|
+
};
|
|
25004
|
+
var BASIC_SYMBOLS = {
|
|
25005
|
+
brand: "*",
|
|
25006
|
+
success: "\u221A",
|
|
25007
|
+
warning: "!",
|
|
25008
|
+
failure: "\xD7",
|
|
25009
|
+
question: "?",
|
|
25010
|
+
on: "*",
|
|
25011
|
+
off: "-",
|
|
25012
|
+
spinner: ["-", "\\", "|", "/"]
|
|
25013
|
+
};
|
|
25014
|
+
var TONE_FORMAT = {
|
|
25015
|
+
success: "green",
|
|
25016
|
+
warning: "yellow",
|
|
25017
|
+
failure: "red",
|
|
25018
|
+
muted: "dim"
|
|
25019
|
+
};
|
|
25020
|
+
function supportsUnicode(env) {
|
|
25021
|
+
if (process.platform !== "win32") return env.TERM !== "linux";
|
|
25022
|
+
return env.WT_SESSION !== void 0 || env.TERM_PROGRAM === "vscode" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm" || env.ConEmuTask === "{cmd::Cmder}" || env.TERM === "xterm-256color" || env.TERM === "alacritty";
|
|
25023
|
+
}
|
|
25024
|
+
function terminalFor(stream, env = process.env) {
|
|
25025
|
+
const style = (format) => (text) => styleText(format, text, { stream });
|
|
25026
|
+
return {
|
|
25027
|
+
width: stream.isTTY && stream.columns > 0 ? Math.min(stream.columns, MEASURE) : MEASURE,
|
|
25028
|
+
symbols: supportsUnicode(env) ? UNICODE_SYMBOLS : BASIC_SYMBOLS,
|
|
25029
|
+
bold: style("bold"),
|
|
25030
|
+
dim: style("dim"),
|
|
25031
|
+
link: style("underline"),
|
|
25032
|
+
tone: (tone, text) => style(TONE_FORMAT[tone])(text)
|
|
25033
|
+
};
|
|
25034
|
+
}
|
|
25035
|
+
function safeWorkspaceName(value) {
|
|
25036
|
+
const cleaned = value?.split("").map((character) => {
|
|
25037
|
+
const code = character.charCodeAt(0);
|
|
25038
|
+
return code < 32 || code >= 127 && code <= 159 ? " " : character;
|
|
25039
|
+
}).join("").replace(/\s+/g, " ").trim();
|
|
25040
|
+
return cleaned === void 0 || cleaned === "" ? null : cleaned;
|
|
25041
|
+
}
|
|
25042
|
+
function visibleWidth(text) {
|
|
25043
|
+
return stripVTControlCharacters(text).length;
|
|
25044
|
+
}
|
|
25045
|
+
function padEnd(text, width) {
|
|
25046
|
+
return text + " ".repeat(Math.max(0, width - visibleWidth(text)));
|
|
25047
|
+
}
|
|
25048
|
+
function brand(terminal2, workspaceName = null) {
|
|
25049
|
+
const name = safeWorkspaceName(workspaceName);
|
|
25050
|
+
return `${terminal2.bold(`${terminal2.symbols.brand} Iteration`)}${name === null ? "" : `${terminal2.dim(" \xB7 ")}${name}`}`;
|
|
25051
|
+
}
|
|
25052
|
+
function wrap(terminal2, text, options = {}) {
|
|
25053
|
+
const indent = options.indent ?? INDENT;
|
|
25054
|
+
const style = options.style ?? ((line) => line);
|
|
25055
|
+
const lines = [];
|
|
25056
|
+
let prefix = options.first ?? indent;
|
|
25057
|
+
let words = [];
|
|
25058
|
+
let width = visibleWidth(prefix);
|
|
25059
|
+
const flush = () => {
|
|
25060
|
+
lines.push(`${prefix}${style(words.join(" "))}`.trimEnd());
|
|
25061
|
+
prefix = indent;
|
|
25062
|
+
words = [];
|
|
25063
|
+
width = visibleWidth(indent);
|
|
25064
|
+
};
|
|
25065
|
+
for (const word of text.split(" ")) {
|
|
25066
|
+
const wordWidth = visibleWidth(word);
|
|
25067
|
+
if (words.length > 0 && width + 1 + wordWidth > terminal2.width) flush();
|
|
25068
|
+
if (words.length === 0 && word === "" && lines.length > 0) continue;
|
|
25069
|
+
width += (words.length > 0 ? 1 : 0) + wordWidth;
|
|
25070
|
+
words.push(word);
|
|
25071
|
+
}
|
|
25072
|
+
flush();
|
|
25073
|
+
return lines.join("\n");
|
|
25074
|
+
}
|
|
25075
|
+
function mark(terminal2, kind, text, indent = "") {
|
|
25076
|
+
const tone = kind === "question" ? "success" : kind;
|
|
25077
|
+
return wrap(terminal2, text, {
|
|
25078
|
+
first: `${indent}${terminal2.tone(tone, terminal2.symbols[kind])} `,
|
|
25079
|
+
indent: `${indent}${INDENT}`
|
|
25080
|
+
});
|
|
25081
|
+
}
|
|
25082
|
+
function rows(terminal2, entries2, indent = INDENT) {
|
|
25083
|
+
const labelWidth = Math.max(
|
|
25084
|
+
0,
|
|
25085
|
+
...entries2.map(([label2]) => visibleWidth(label2))
|
|
25086
|
+
);
|
|
25087
|
+
const hanging = " ".repeat(visibleWidth(indent) + labelWidth + 2);
|
|
25088
|
+
return entries2.map(
|
|
25089
|
+
([label2, value]) => wrap(terminal2, value, {
|
|
25090
|
+
first: `${indent}${padEnd(label2, labelWidth + 2)}`,
|
|
25091
|
+
indent: hanging
|
|
25092
|
+
})
|
|
25093
|
+
).join("\n");
|
|
25094
|
+
}
|
|
25095
|
+
var SPINNER_INTERVAL_MS = 80;
|
|
25096
|
+
function startSpinner(stream, terminal2, text) {
|
|
25097
|
+
if (!stream.isTTY) {
|
|
25098
|
+
stream.write(`${text}
|
|
25099
|
+
`);
|
|
25100
|
+
return () => void 0;
|
|
25101
|
+
}
|
|
25102
|
+
const frames = terminal2.symbols.spinner;
|
|
25103
|
+
let frame = 0;
|
|
25104
|
+
const draw = () => {
|
|
25105
|
+
stream.cursorTo(0);
|
|
25106
|
+
stream.clearLine(1);
|
|
25107
|
+
stream.write(`${terminal2.dim(frames[frame % frames.length])} ${text}`);
|
|
25108
|
+
frame += 1;
|
|
25109
|
+
};
|
|
25110
|
+
draw();
|
|
25111
|
+
const timer = setInterval(draw, SPINNER_INTERVAL_MS);
|
|
25112
|
+
timer.unref();
|
|
25113
|
+
return () => {
|
|
25114
|
+
clearInterval(timer);
|
|
25115
|
+
stream.cursorTo(0);
|
|
25116
|
+
stream.clearLine(0);
|
|
25117
|
+
};
|
|
25118
|
+
}
|
|
25119
|
+
async function ask(terminal2, question) {
|
|
25120
|
+
const prompt = createInterface({
|
|
25121
|
+
input: process.stdin,
|
|
25122
|
+
output: process.stdout
|
|
25123
|
+
});
|
|
25124
|
+
try {
|
|
25125
|
+
return await prompt.question(
|
|
25126
|
+
`${terminal2.tone("success", terminal2.symbols.question)} ${question} `
|
|
25127
|
+
);
|
|
25128
|
+
} catch (error3) {
|
|
25129
|
+
if (!(error3 instanceof Error && error3.name === "AbortError")) throw error3;
|
|
25130
|
+
process.stdout.write("\n");
|
|
25131
|
+
return null;
|
|
25132
|
+
} finally {
|
|
25133
|
+
prompt.close();
|
|
25134
|
+
}
|
|
25135
|
+
}
|
|
25136
|
+
|
|
25137
|
+
// src/clerk-device-auth.ts
|
|
24981
25138
|
var execFileAsync = promisify8(execFile8);
|
|
24982
25139
|
var serverAuthConfigSchema = object3({
|
|
24983
25140
|
issuerUrl: url(),
|
|
@@ -25081,7 +25238,11 @@ $start.UseShellExecute = $true
|
|
|
25081
25238
|
await execFileAsync("xdg-open", [url2], { timeout: 5e3 });
|
|
25082
25239
|
else await execFileAsync("open", [url2], { timeout: 5e3 });
|
|
25083
25240
|
} catch {
|
|
25084
|
-
process.stdout
|
|
25241
|
+
const terminal2 = terminalFor(process.stdout);
|
|
25242
|
+
process.stdout.write(
|
|
25243
|
+
`${mark(terminal2, "warning", "Your browser did not open. Open the link above to sign in.")}
|
|
25244
|
+
`
|
|
25245
|
+
);
|
|
25085
25246
|
}
|
|
25086
25247
|
}
|
|
25087
25248
|
function delay4(milliseconds) {
|
|
@@ -25161,17 +25322,39 @@ async function clerkDeviceSignIn(configuration) {
|
|
|
25161
25322
|
configuration.clientId
|
|
25162
25323
|
);
|
|
25163
25324
|
const verificationUrl = challenge.verification_uri_complete ?? challenge.verification_uri;
|
|
25325
|
+
const terminal2 = terminalFor(process.stdout);
|
|
25164
25326
|
process.stdout.write(
|
|
25165
|
-
|
|
25327
|
+
[
|
|
25328
|
+
"",
|
|
25329
|
+
wrap(
|
|
25330
|
+
terminal2,
|
|
25331
|
+
"Sign in to Iteration in your browser and confirm this code",
|
|
25332
|
+
{ style: terminal2.bold }
|
|
25333
|
+
),
|
|
25334
|
+
rows(terminal2, [
|
|
25335
|
+
["Code", terminal2.bold(challenge.user_code)],
|
|
25336
|
+
["Link", terminal2.link(verificationUrl)]
|
|
25337
|
+
]),
|
|
25338
|
+
""
|
|
25339
|
+
].join("\n")
|
|
25166
25340
|
);
|
|
25167
25341
|
await openBrowser(verificationUrl);
|
|
25168
|
-
|
|
25169
|
-
|
|
25170
|
-
|
|
25171
|
-
|
|
25172
|
-
challenge.expires_in,
|
|
25173
|
-
challenge.interval
|
|
25342
|
+
const stopSpinner = startSpinner(
|
|
25343
|
+
process.stdout,
|
|
25344
|
+
terminal2,
|
|
25345
|
+
"Waiting for you to confirm in your browser\u2026"
|
|
25174
25346
|
);
|
|
25347
|
+
try {
|
|
25348
|
+
return await pollForAccessToken(
|
|
25349
|
+
endpoints.tokenUrl,
|
|
25350
|
+
configuration.clientId,
|
|
25351
|
+
challenge.device_code,
|
|
25352
|
+
challenge.expires_in,
|
|
25353
|
+
challenge.interval
|
|
25354
|
+
);
|
|
25355
|
+
} finally {
|
|
25356
|
+
stopSpinner();
|
|
25357
|
+
}
|
|
25175
25358
|
}
|
|
25176
25359
|
async function enrollDevice(endpoint, accessToken, deviceName, organizationId, source) {
|
|
25177
25360
|
const body = { deviceName };
|
|
@@ -25201,44 +25384,49 @@ async function enrollDevice(endpoint, accessToken, deviceName, organizationId, s
|
|
|
25201
25384
|
);
|
|
25202
25385
|
}
|
|
25203
25386
|
async function chooseOrganization(organizations, hasMore) {
|
|
25204
|
-
process.stdout
|
|
25205
|
-
|
|
25206
|
-
|
|
25207
|
-
|
|
25208
|
-
|
|
25209
|
-
|
|
25210
|
-
|
|
25211
|
-
|
|
25212
|
-
|
|
25213
|
-
|
|
25214
|
-
|
|
25387
|
+
const terminal2 = terminalFor(process.stdout);
|
|
25388
|
+
process.stdout.write(
|
|
25389
|
+
[
|
|
25390
|
+
"",
|
|
25391
|
+
wrap(terminal2, "Choose a workspace for this computer", {
|
|
25392
|
+
style: terminal2.bold
|
|
25393
|
+
}),
|
|
25394
|
+
rows(
|
|
25395
|
+
terminal2,
|
|
25396
|
+
organizations.map((organization2, index) => [
|
|
25397
|
+
String(index + 1),
|
|
25398
|
+
`${safeWorkspaceName(organization2.name) ?? "Unnamed workspace"} ${terminal2.dim(organization2.id)}`
|
|
25399
|
+
]),
|
|
25400
|
+
" "
|
|
25401
|
+
),
|
|
25402
|
+
...hasMore ? [
|
|
25403
|
+
wrap(
|
|
25404
|
+
terminal2,
|
|
25405
|
+
"More workspaces exist; enter a workspace ID to choose one not listed."
|
|
25406
|
+
)
|
|
25407
|
+
] : [],
|
|
25408
|
+
""
|
|
25409
|
+
].join("\n")
|
|
25410
|
+
);
|
|
25215
25411
|
if (process.stdin.isTTY !== true) {
|
|
25216
25412
|
throw new Error("Run iteration interactively or pass --workspace.");
|
|
25217
25413
|
}
|
|
25218
|
-
const
|
|
25219
|
-
|
|
25220
|
-
|
|
25221
|
-
|
|
25222
|
-
try {
|
|
25223
|
-
const answer = await prompt.question(
|
|
25224
|
-
"Workspace number or organization ID: "
|
|
25414
|
+
const answer = await ask(terminal2, terminal2.bold("Workspace number or ID"));
|
|
25415
|
+
if (answer === null)
|
|
25416
|
+
throw new Error(
|
|
25417
|
+
"No workspace was chosen. Run iteration connect to try again."
|
|
25225
25418
|
);
|
|
25226
|
-
|
|
25227
|
-
|
|
25228
|
-
|
|
25229
|
-
|
|
25230
|
-
|
|
25231
|
-
|
|
25232
|
-
|
|
25233
|
-
|
|
25234
|
-
|
|
25235
|
-
if (organization === void 0) {
|
|
25236
|
-
throw new Error("The selected workspace is not available.");
|
|
25237
|
-
}
|
|
25238
|
-
return organization.id;
|
|
25239
|
-
} finally {
|
|
25240
|
-
prompt.close();
|
|
25419
|
+
const id = uuid5().safeParse(answer.trim());
|
|
25420
|
+
if (id.success) return id.data;
|
|
25421
|
+
const selection = coerce_exports.number().int().min(1).max(organizations.length).safeParse(answer.trim());
|
|
25422
|
+
if (!selection.success) {
|
|
25423
|
+
throw new Error("Choose a listed number or enter a valid workspace ID.");
|
|
25424
|
+
}
|
|
25425
|
+
const organization = organizations[selection.data - 1];
|
|
25426
|
+
if (organization === void 0) {
|
|
25427
|
+
throw new Error("The selected workspace is not available.");
|
|
25241
25428
|
}
|
|
25429
|
+
return organization.id;
|
|
25242
25430
|
}
|
|
25243
25431
|
async function authenticateAndEnrollCollector(endpoint, deviceNameValue, organizationId, source = "codex") {
|
|
25244
25432
|
const deviceName = string5().trim().min(1).max(160).safeParse(deviceNameValue);
|
|
@@ -25751,10 +25939,10 @@ async function localAuthTurns(codexHome, modelProviders) {
|
|
|
25751
25939
|
feedback_log_body: string5().nullable()
|
|
25752
25940
|
});
|
|
25753
25941
|
try {
|
|
25754
|
-
const
|
|
25942
|
+
const rows2 = database.prepare(
|
|
25755
25943
|
"SELECT thread_id, feedback_log_body FROM logs WHERE target = 'feedback_tags' AND feedback_log_body LIKE '%auth_mode=Some(%'"
|
|
25756
25944
|
).iterate();
|
|
25757
|
-
for (const raw of
|
|
25945
|
+
for (const raw of rows2) {
|
|
25758
25946
|
const row = logRowSchema.safeParse(raw);
|
|
25759
25947
|
if (!row.success)
|
|
25760
25948
|
throw new Error("Codex's local log row has an invalid shape.");
|
|
@@ -26714,13 +26902,6 @@ var CODEX_APPROVAL_STEP = "Friction summary is off: in Codex, type /hooks and ap
|
|
|
26714
26902
|
function sourceName(source) {
|
|
26715
26903
|
return collectorSourceLabel(source);
|
|
26716
26904
|
}
|
|
26717
|
-
function safeWorkspaceName(value) {
|
|
26718
|
-
const cleaned = value?.split("").map((character) => {
|
|
26719
|
-
const code = character.charCodeAt(0);
|
|
26720
|
-
return code < 32 || code >= 127 && code <= 159 ? " " : character;
|
|
26721
|
-
}).join("").replace(/\s+/g, " ").trim();
|
|
26722
|
-
return cleaned === void 0 || cleaned === "" ? null : cleaned;
|
|
26723
|
-
}
|
|
26724
26905
|
function readableBytes(bytes) {
|
|
26725
26906
|
if (bytes < 1e3) return `${bytes} B`;
|
|
26726
26907
|
const units = ["KB", "MB", "GB", "TB"];
|
|
@@ -26777,219 +26958,341 @@ function historyDescription(status2, source) {
|
|
|
26777
26958
|
return "History imported; scanning current activity.";
|
|
26778
26959
|
return `History imported; ${readableBytes(remainingBytes)} of new activity waiting to scan.`;
|
|
26779
26960
|
}
|
|
26780
|
-
function
|
|
26781
|
-
const name = sourceName(source);
|
|
26961
|
+
function failureSummary(terminal2, status2, source, nowMs) {
|
|
26782
26962
|
const failure3 = status2.health.lastFailure;
|
|
26783
26963
|
if (failure3 === null) {
|
|
26784
26964
|
throw new Error("A collector failure is required to describe it.");
|
|
26785
26965
|
}
|
|
26786
|
-
|
|
26787
|
-
|
|
26788
|
-
|
|
26966
|
+
const describe2 = () => {
|
|
26967
|
+
if (failure3.kind === "http") {
|
|
26968
|
+
const code = failure3.status === null ? "HTTP error" : `HTTP ${failure3.status}`;
|
|
26969
|
+
if (failure3.status === 401 || failure3.status === 403)
|
|
26970
|
+
return {
|
|
26971
|
+
tone: "failure",
|
|
26972
|
+
headline: "Upload access needs attention",
|
|
26973
|
+
explanation: `Iteration denied this collector (${code}). Queued data stays on this computer. Contact Iteration support to reconnect it safely.`
|
|
26974
|
+
};
|
|
26975
|
+
if (failure3.status !== null && failure3.status < 500 && failure3.status !== 429)
|
|
26976
|
+
return {
|
|
26977
|
+
tone: "failure",
|
|
26978
|
+
headline: "Uploads need attention",
|
|
26979
|
+
explanation: `Iteration rejected an event batch (${code}). Check the collector log for details.`
|
|
26980
|
+
};
|
|
26789
26981
|
return {
|
|
26790
|
-
|
|
26791
|
-
|
|
26982
|
+
tone: "warning",
|
|
26983
|
+
headline: "Uploads are delayed",
|
|
26984
|
+
explanation: `Iteration could not accept an upload (${code}). Retrying automatically.`
|
|
26792
26985
|
};
|
|
26793
26986
|
}
|
|
26794
|
-
if (failure3.
|
|
26987
|
+
if (failure3.kind === "network")
|
|
26795
26988
|
return {
|
|
26796
|
-
|
|
26797
|
-
|
|
26989
|
+
tone: "warning",
|
|
26990
|
+
headline: "Uploads are delayed",
|
|
26991
|
+
explanation: "Could not reach Iteration. Retrying automatically."
|
|
26992
|
+
};
|
|
26993
|
+
if (failure3.kind === "response")
|
|
26994
|
+
return {
|
|
26995
|
+
tone: "warning",
|
|
26996
|
+
headline: "Uploads need attention",
|
|
26997
|
+
explanation: "Iteration returned an unexpected upload response. Retrying automatically."
|
|
26798
26998
|
};
|
|
26799
|
-
}
|
|
26800
26999
|
return {
|
|
26801
|
-
|
|
26802
|
-
|
|
27000
|
+
tone: "failure",
|
|
27001
|
+
headline: "Collector needs attention",
|
|
27002
|
+
explanation: "A local error interrupted collection."
|
|
26803
27003
|
};
|
|
26804
|
-
}
|
|
26805
|
-
|
|
27004
|
+
};
|
|
27005
|
+
const { tone, headline, explanation } = describe2();
|
|
27006
|
+
return {
|
|
27007
|
+
tone,
|
|
27008
|
+
headline,
|
|
27009
|
+
facts: [],
|
|
27010
|
+
details: [
|
|
27011
|
+
explanation,
|
|
27012
|
+
...status2.pendingEvents > 0 ? [`${pendingDescription(status2)}.`] : [],
|
|
27013
|
+
...status2.health.lastUploadAtMs === null ? [] : [
|
|
27014
|
+
`Last successful upload ${relativeTime(status2.health.lastUploadAtMs, nowMs)}.`
|
|
27015
|
+
]
|
|
27016
|
+
],
|
|
27017
|
+
next: `Details: ${terminal2.bold(`iteration status ${source}`)}`
|
|
27018
|
+
};
|
|
27019
|
+
}
|
|
27020
|
+
function connectionSummary(terminal2, status2, source, nowMs) {
|
|
27021
|
+
const name = sourceName(source);
|
|
27022
|
+
const pending = status2.pendingEvents > 0 ? [`${pendingDescription(status2)}.`] : [];
|
|
27023
|
+
const details = `Details: ${terminal2.bold(`iteration status ${source}`)}`;
|
|
27024
|
+
if (!status2.running)
|
|
26806
27025
|
return {
|
|
26807
|
-
|
|
26808
|
-
|
|
27026
|
+
tone: "warning",
|
|
27027
|
+
headline: "Stopped",
|
|
27028
|
+
facts: [],
|
|
27029
|
+
details: ["New sessions are not being collected.", ...pending],
|
|
27030
|
+
next: `Resume with ${terminal2.bold(`iteration start ${source}`)}`
|
|
26809
27031
|
};
|
|
26810
|
-
|
|
26811
|
-
if (failure3.kind === "response") {
|
|
27032
|
+
if (status2.hookFailureAtMs !== null && status2.hookFailureAtMs !== void 0)
|
|
26812
27033
|
return {
|
|
26813
|
-
|
|
26814
|
-
|
|
27034
|
+
tone: "warning",
|
|
27035
|
+
headline: "Hook capture needs attention",
|
|
27036
|
+
facts: [],
|
|
27037
|
+
details: [
|
|
27038
|
+
`A ${name} hook failed ${relativeTime(status2.hookFailureAtMs, nowMs)}. Some data may be missing.`
|
|
27039
|
+
],
|
|
27040
|
+
next: details
|
|
26815
27041
|
};
|
|
26816
|
-
|
|
26817
|
-
|
|
26818
|
-
|
|
26819
|
-
|
|
26820
|
-
|
|
27042
|
+
if (!status2.healthAvailable)
|
|
27043
|
+
return {
|
|
27044
|
+
tone: "warning",
|
|
27045
|
+
headline: "Running; local status needs attention",
|
|
27046
|
+
facts: [],
|
|
27047
|
+
details: [
|
|
27048
|
+
"Upload history could not be read. Collection continues in the background.",
|
|
27049
|
+
...pending
|
|
27050
|
+
],
|
|
27051
|
+
next: details
|
|
27052
|
+
};
|
|
27053
|
+
if (status2.health.lastFailure !== null)
|
|
27054
|
+
return failureSummary(terminal2, status2, source, nowMs);
|
|
27055
|
+
return null;
|
|
26821
27056
|
}
|
|
26822
|
-
function
|
|
27057
|
+
function scanSummary(status2, source, nowMs) {
|
|
26823
27058
|
const name = sourceName(source);
|
|
26824
|
-
|
|
26825
|
-
|
|
26826
|
-
|
|
26827
|
-
|
|
26828
|
-
|
|
26829
|
-
|
|
26830
|
-
|
|
26831
|
-
|
|
26832
|
-
|
|
27059
|
+
const pending = status2.pendingEvents > 0 ? [`${pendingDescription(status2)}.`] : [];
|
|
27060
|
+
const lastUpload = status2.health.lastUploadAtMs === null ? [] : [`last upload ${relativeTime(status2.health.lastUploadAtMs, nowMs)}`];
|
|
27061
|
+
const summary = (headline, details, facts = []) => ({
|
|
27062
|
+
tone: "success",
|
|
27063
|
+
headline,
|
|
27064
|
+
facts: [...facts, ...lastUpload],
|
|
27065
|
+
details,
|
|
27066
|
+
next: null
|
|
27067
|
+
});
|
|
27068
|
+
const scan = status2.scan;
|
|
27069
|
+
if (scan.kind === "waiting") return summary("Preparing your history", []);
|
|
27070
|
+
if (scan.totalBytes > 0 && scan.scannedBytes < scan.totalBytes && status2.health.historyCaughtUpAtMs === null)
|
|
27071
|
+
return summary("Importing existing sessions", [
|
|
27072
|
+
historyDescription(status2, source),
|
|
27073
|
+
"New activity is collected automatically."
|
|
27074
|
+
]);
|
|
27075
|
+
if (scan.totalBytes - scan.scannedBytes >= 1e6)
|
|
27076
|
+
return summary("Catching up with new activity", [
|
|
27077
|
+
historyDescription(status2, source),
|
|
27078
|
+
...pending
|
|
27079
|
+
]);
|
|
27080
|
+
if (status2.pendingEvents > 0)
|
|
27081
|
+
return summary("Uploading captured sessions", pending);
|
|
27082
|
+
if (scan.totalBytes === 0)
|
|
27083
|
+
return summary("Connected", [
|
|
27084
|
+
`Waiting for ${name} sessions on this computer.`
|
|
27085
|
+
]);
|
|
27086
|
+
if (scan.scannedBytes < scan.totalBytes)
|
|
27087
|
+
return summary("Collecting new activity", [
|
|
27088
|
+
"Local history is imported; current activity is being scanned."
|
|
27089
|
+
]);
|
|
27090
|
+
return summary("Collecting", [], ["caught up"]);
|
|
27091
|
+
}
|
|
27092
|
+
function sourceSummary(terminal2, status2, source, nowMs) {
|
|
27093
|
+
if (status2.kind === "not_connected")
|
|
27094
|
+
return {
|
|
27095
|
+
tone: "muted",
|
|
27096
|
+
headline: "Not connected",
|
|
27097
|
+
facts: [],
|
|
27098
|
+
details: [],
|
|
27099
|
+
next: `Run ${terminal2.bold("iteration connect")} to include it.`
|
|
27100
|
+
};
|
|
27101
|
+
if (status2.kind === "needs_repair")
|
|
27102
|
+
return {
|
|
27103
|
+
tone: "failure",
|
|
27104
|
+
headline: "Connection needs repair",
|
|
27105
|
+
facts: [],
|
|
27106
|
+
details: [
|
|
27107
|
+
"Local collector data exists, but its connection details are missing.",
|
|
27108
|
+
status2.pendingBytes > 0 ? `${readableBytes(status2.pendingBytes)} of queued data remains on this computer.` : "Existing local progress remains on this computer."
|
|
27109
|
+
],
|
|
27110
|
+
next: `Run ${terminal2.bold(`iteration status ${source}`)} for recovery details.`
|
|
27111
|
+
};
|
|
27112
|
+
return connectionSummary(terminal2, status2, source, nowMs) ?? scanSummary(status2, source, nowMs);
|
|
27113
|
+
}
|
|
27114
|
+
function statusDot(terminal2, tone) {
|
|
27115
|
+
return terminal2.tone(
|
|
27116
|
+
tone,
|
|
27117
|
+
tone === "muted" ? terminal2.symbols.off : terminal2.symbols.on
|
|
27118
|
+
);
|
|
27119
|
+
}
|
|
27120
|
+
function connectedStatuses(sources) {
|
|
27121
|
+
return sources.flatMap(
|
|
27122
|
+
({ status: status2 }) => status2.kind === "connected" ? [status2] : []
|
|
27123
|
+
);
|
|
27124
|
+
}
|
|
27125
|
+
function renderHome(terminal2, sources, nowMs = Date.now()) {
|
|
27126
|
+
const connected = connectedStatuses(sources);
|
|
27127
|
+
const workspaces = [
|
|
27128
|
+
...new Set(
|
|
27129
|
+
connected.flatMap(({ workspaceName }) => {
|
|
27130
|
+
const name = safeWorkspaceName(workspaceName);
|
|
27131
|
+
return name === null ? [] : [name];
|
|
27132
|
+
})
|
|
27133
|
+
)
|
|
27134
|
+
];
|
|
27135
|
+
const nameWidth = Math.max(
|
|
27136
|
+
...sources.map(({ source }) => sourceName(source).length)
|
|
27137
|
+
);
|
|
27138
|
+
const blocks = sources.map(({ source, status: status2 }) => {
|
|
27139
|
+
const summary = sourceSummary(terminal2, status2, source, nowMs);
|
|
27140
|
+
const workspace = workspaces.length > 1 && status2.kind === "connected" ? [safeWorkspaceName(status2.workspaceName) ?? "No workspace"] : [];
|
|
27141
|
+
const facts = [...workspace, ...summary.facts];
|
|
27142
|
+
const indent = " ".repeat(4 + nameWidth + 2);
|
|
26833
27143
|
return [
|
|
26834
|
-
|
|
26835
|
-
|
|
26836
|
-
|
|
26837
|
-
|
|
26838
|
-
|
|
26839
|
-
|
|
26840
|
-
|
|
26841
|
-
|
|
26842
|
-
|
|
27144
|
+
wrap(
|
|
27145
|
+
terminal2,
|
|
27146
|
+
`${summary.headline}${facts.length === 0 ? "" : terminal2.dim(` \xB7 ${facts.join(" \xB7 ")}`)}`,
|
|
27147
|
+
{
|
|
27148
|
+
first: ` ${statusDot(terminal2, summary.tone)} ${padEnd(sourceName(source), nameWidth)} `,
|
|
27149
|
+
indent
|
|
27150
|
+
}
|
|
27151
|
+
),
|
|
27152
|
+
...summary.details.map(
|
|
27153
|
+
(line) => wrap(terminal2, line, { indent, style: terminal2.dim })
|
|
27154
|
+
),
|
|
27155
|
+
...summary.next === null ? [] : [wrap(terminal2, summary.next, { indent })]
|
|
27156
|
+
];
|
|
27157
|
+
});
|
|
27158
|
+
const spaced = blocks.some((block) => block.length > 1);
|
|
26843
27159
|
const lines = [
|
|
26844
|
-
|
|
26845
|
-
""
|
|
27160
|
+
brand(terminal2, workspaces.length === 1 ? workspaces[0] : null),
|
|
27161
|
+
"",
|
|
27162
|
+
...blocks.flatMap(
|
|
27163
|
+
(block, index) => spaced && index > 0 ? ["", ...block] : block
|
|
27164
|
+
)
|
|
26846
27165
|
];
|
|
26847
|
-
|
|
26848
|
-
|
|
26849
|
-
|
|
26850
|
-
|
|
26851
|
-
|
|
26852
|
-
|
|
26853
|
-
|
|
26854
|
-
|
|
26855
|
-
`${name} hook capture needs attention`,
|
|
26856
|
-
`A ${name} hook failed ${relativeTime(status2.hookFailureAtMs, nowMs)}. Some data may be missing. See iteration status ${source}.`
|
|
26857
|
-
);
|
|
26858
|
-
} else if (!status2.healthAvailable) {
|
|
26859
|
-
lines.push(
|
|
26860
|
-
`${name} is running; local status needs attention`,
|
|
26861
|
-
"Upload history could not be read. Collection continues in the background."
|
|
26862
|
-
);
|
|
26863
|
-
if (status2.pendingEvents > 0)
|
|
26864
|
-
lines.push(`${pendingDescription(status2)}.`);
|
|
26865
|
-
lines.push(`Details: iteration status ${source}`);
|
|
26866
|
-
} else if (status2.health.lastFailure !== null) {
|
|
26867
|
-
const failure3 = failureDescription(status2, source);
|
|
26868
|
-
lines.push(failure3.heading, failure3.explanation);
|
|
26869
|
-
if (status2.pendingEvents > 0)
|
|
26870
|
-
lines.push(`${pendingDescription(status2)}.`);
|
|
26871
|
-
if (status2.health.lastUploadAtMs !== null) {
|
|
26872
|
-
lines.push(
|
|
26873
|
-
`Last successful upload ${relativeTime(status2.health.lastUploadAtMs, nowMs)}.`
|
|
26874
|
-
);
|
|
26875
|
-
}
|
|
26876
|
-
lines.push(`Details: iteration status ${source}`);
|
|
26877
|
-
} else return false;
|
|
26878
|
-
return true;
|
|
26879
|
-
};
|
|
26880
|
-
const appendScanStatus = () => {
|
|
26881
|
-
if (status2.scan.kind === "waiting") {
|
|
26882
|
-
lines.push(
|
|
26883
|
-
`${name} is preparing your history`,
|
|
26884
|
-
progressDescription(status2.scan, source)
|
|
26885
|
-
);
|
|
26886
|
-
} else if (status2.scan.kind === "scanning" && status2.scan.totalBytes > 0 && status2.scan.scannedBytes < status2.scan.totalBytes && status2.health.historyCaughtUpAtMs === null) {
|
|
26887
|
-
lines.push(
|
|
26888
|
-
`${name} is importing existing sessions`,
|
|
26889
|
-
historyDescription(status2, source),
|
|
26890
|
-
"New activity is collected automatically."
|
|
26891
|
-
);
|
|
26892
|
-
} else if (status2.scan.kind === "scanning" && status2.scan.totalBytes - status2.scan.scannedBytes >= 1e6) {
|
|
26893
|
-
lines.push(
|
|
26894
|
-
`${name} is catching up with new activity`,
|
|
26895
|
-
historyDescription(status2, source)
|
|
26896
|
-
);
|
|
26897
|
-
if (status2.pendingEvents > 0)
|
|
26898
|
-
lines.push(`${pendingDescription(status2)}.`);
|
|
26899
|
-
} else if (status2.pendingEvents > 0) {
|
|
26900
|
-
lines.push(
|
|
26901
|
-
`${name} is uploading captured sessions`,
|
|
26902
|
-
`${pendingDescription(status2)}.`
|
|
26903
|
-
);
|
|
26904
|
-
} else if (status2.scan.totalBytes === 0) {
|
|
26905
|
-
lines.push(
|
|
26906
|
-
`${name} is connected`,
|
|
26907
|
-
`Waiting for ${name} sessions on this computer.`
|
|
26908
|
-
);
|
|
26909
|
-
} else if (status2.scan.kind === "scanning" && status2.scan.scannedBytes < status2.scan.totalBytes) {
|
|
26910
|
-
lines.push(
|
|
26911
|
-
`${name} is collecting new activity`,
|
|
26912
|
-
"Local history is imported; current activity is being scanned."
|
|
26913
|
-
);
|
|
26914
|
-
} else {
|
|
26915
|
-
lines.push(
|
|
26916
|
-
`${name} is collecting`,
|
|
26917
|
-
"Local scan is caught up and no uploads are waiting.",
|
|
26918
|
-
"New activity is collected automatically."
|
|
26919
|
-
);
|
|
26920
|
-
}
|
|
26921
|
-
};
|
|
26922
|
-
if (!appendConnectionStatus()) appendScanStatus();
|
|
26923
|
-
const appendLastUpload = () => {
|
|
26924
|
-
if (status2.running && status2.health.lastFailure === null && status2.health.lastUploadAtMs !== null) {
|
|
26925
|
-
lines.push(
|
|
26926
|
-
`Last successful upload ${relativeTime(status2.health.lastUploadAtMs, nowMs)}.`
|
|
26927
|
-
);
|
|
26928
|
-
}
|
|
26929
|
-
};
|
|
26930
|
-
appendLastUpload();
|
|
26931
|
-
if (status2.turnSummaryNeedsApproval) lines.push("", CODEX_APPROVAL_STEP);
|
|
26932
|
-
lines.push("", `Explore traces ${status2.tracesUrl}`);
|
|
27166
|
+
if (connected.some((status2) => status2.turnSummaryNeedsApproval))
|
|
27167
|
+
lines.push("", mark(terminal2, "warning", CODEX_APPROVAL_STEP, " "));
|
|
27168
|
+
const links = [...new Set(connected.map(({ tracesUrl: tracesUrl2 }) => tracesUrl2))];
|
|
27169
|
+
if (links.length > 0)
|
|
27170
|
+
lines.push(
|
|
27171
|
+
"",
|
|
27172
|
+
...links.map((url2) => ` Open Iteration ${terminal2.link(url2)}`)
|
|
27173
|
+
);
|
|
26933
27174
|
return lines.join("\n");
|
|
26934
27175
|
}
|
|
26935
|
-
function
|
|
27176
|
+
function sourceHeading(terminal2, tone, source, note) {
|
|
27177
|
+
return `${statusDot(terminal2, tone)} ${terminal2.bold(sourceName(source))}${note === null ? "" : terminal2.dim(` \xB7 ${note}`)}`;
|
|
27178
|
+
}
|
|
27179
|
+
function sentenceCase(text) {
|
|
27180
|
+
return `${text.charAt(0).toUpperCase()}${text.slice(1)}`;
|
|
27181
|
+
}
|
|
27182
|
+
function renderDetailedStatus(terminal2, source, status2, nowMs = Date.now()) {
|
|
26936
27183
|
const name = sourceName(source);
|
|
26937
27184
|
if (status2.kind === "not_connected") {
|
|
26938
|
-
return
|
|
27185
|
+
return [
|
|
27186
|
+
sourceHeading(terminal2, "muted", source, "not connected"),
|
|
27187
|
+
wrap(terminal2, `Run ${terminal2.bold("iteration connect")} to connect.`)
|
|
27188
|
+
].join("\n");
|
|
26939
27189
|
}
|
|
26940
27190
|
if (status2.kind === "needs_repair") {
|
|
26941
27191
|
return [
|
|
26942
|
-
|
|
26943
|
-
|
|
26944
|
-
|
|
26945
|
-
|
|
26946
|
-
|
|
27192
|
+
sourceHeading(terminal2, "failure", source, "connection needs repair"),
|
|
27193
|
+
wrap(
|
|
27194
|
+
terminal2,
|
|
27195
|
+
"Local collector data exists without its connection details."
|
|
27196
|
+
),
|
|
27197
|
+
rows(terminal2, [["Queued data", readableBytes(status2.pendingBytes)]]),
|
|
27198
|
+
wrap(
|
|
27199
|
+
terminal2,
|
|
27200
|
+
`Restore the missing config from backup: ${status2.configPath}`
|
|
27201
|
+
),
|
|
27202
|
+
wrap(
|
|
27203
|
+
terminal2,
|
|
27204
|
+
"If you do not have it, contact Iteration support before reconnecting; existing data has been kept."
|
|
27205
|
+
)
|
|
26947
27206
|
].join("\n");
|
|
26948
27207
|
}
|
|
26949
|
-
const
|
|
26950
|
-
const
|
|
26951
|
-
|
|
26952
|
-
|
|
26953
|
-
|
|
26954
|
-
|
|
26955
|
-
|
|
27208
|
+
const summary = sourceSummary(terminal2, status2, source, nowMs);
|
|
27209
|
+
const entries2 = [
|
|
27210
|
+
["Background process", status2.running ? "Running" : "Stopped"],
|
|
27211
|
+
[
|
|
27212
|
+
"History",
|
|
27213
|
+
sentenceCase(historyDescription(status2, source).replace(/^History /, ""))
|
|
27214
|
+
],
|
|
27215
|
+
[
|
|
27216
|
+
"Uploads",
|
|
27217
|
+
status2.pendingEvents === 0 ? "None waiting" : sentenceCase(pendingDescription(status2))
|
|
27218
|
+
]
|
|
26956
27219
|
];
|
|
26957
|
-
if (!status2.healthAvailable)
|
|
26958
|
-
|
|
26959
|
-
"Local status
|
|
26960
|
-
|
|
26961
|
-
);
|
|
26962
|
-
|
|
26963
|
-
|
|
26964
|
-
|
|
26965
|
-
|
|
26966
|
-
);
|
|
26967
|
-
|
|
26968
|
-
if (
|
|
26969
|
-
const failure3 = status2.health.lastFailure;
|
|
27220
|
+
if (!status2.healthAvailable)
|
|
27221
|
+
entries2.push([
|
|
27222
|
+
"Local status",
|
|
27223
|
+
"Unavailable; check collector file permissions"
|
|
27224
|
+
]);
|
|
27225
|
+
if (status2.health.lastUploadAtMs !== null)
|
|
27226
|
+
entries2.push([
|
|
27227
|
+
"Last upload",
|
|
27228
|
+
relativeTime(status2.health.lastUploadAtMs, nowMs)
|
|
27229
|
+
]);
|
|
27230
|
+
const failure3 = status2.health.lastFailure;
|
|
27231
|
+
if (failure3 !== null) {
|
|
26970
27232
|
const label2 = failure3.kind === "http" && failure3.status !== null ? `HTTP ${failure3.status}` : failure3.kind === "network" ? "Network unavailable" : failure3.kind === "response" ? "Unexpected upload response" : "Local collector error";
|
|
26971
|
-
|
|
26972
|
-
|
|
26973
|
-
|
|
26974
|
-
);
|
|
27233
|
+
entries2.push([
|
|
27234
|
+
"Last issue",
|
|
27235
|
+
`${label2} (${relativeTime(failure3.atMs, nowMs)})`
|
|
27236
|
+
]);
|
|
26975
27237
|
}
|
|
26976
27238
|
if (status2.hookFailureAtMs !== null && status2.hookFailureAtMs !== void 0)
|
|
27239
|
+
entries2.push([
|
|
27240
|
+
"Hook capture",
|
|
27241
|
+
`Failed ${relativeTime(status2.hookFailureAtMs, nowMs)}. Some data may be missing; inspect ${name} hook logs.`
|
|
27242
|
+
]);
|
|
27243
|
+
if (!status2.healthAvailable || failure3 !== null)
|
|
27244
|
+
entries2.push(["Collector log", status2.logPath]);
|
|
27245
|
+
entries2.push(["Open Iteration", terminal2.link(status2.tracesUrl)]);
|
|
27246
|
+
const lines = [
|
|
27247
|
+
sourceHeading(
|
|
27248
|
+
terminal2,
|
|
27249
|
+
summary.tone,
|
|
27250
|
+
source,
|
|
27251
|
+
safeWorkspaceName(status2.workspaceName)
|
|
27252
|
+
),
|
|
27253
|
+
rows(terminal2, entries2)
|
|
27254
|
+
];
|
|
27255
|
+
if (status2.turnSummaryNeedsApproval)
|
|
27256
|
+
lines.push(mark(terminal2, "warning", CODEX_APPROVAL_STEP, " "));
|
|
27257
|
+
if (!status2.running)
|
|
26977
27258
|
lines.push(
|
|
26978
|
-
|
|
27259
|
+
wrap(
|
|
27260
|
+
terminal2,
|
|
27261
|
+
`Resume with ${terminal2.bold(`iteration start ${source}`)}`
|
|
27262
|
+
)
|
|
26979
27263
|
);
|
|
26980
|
-
if (status2.turnSummaryNeedsApproval) lines.push(CODEX_APPROVAL_STEP);
|
|
26981
|
-
if (!status2.running) lines.push(`Resume: iteration start ${source}`);
|
|
26982
|
-
lines.push(`Explore traces: ${status2.tracesUrl}`);
|
|
26983
27264
|
return lines.join("\n");
|
|
26984
27265
|
}
|
|
26985
|
-
function renderRuntime(summary) {
|
|
27266
|
+
function renderRuntime(terminal2, summary) {
|
|
26986
27267
|
return [
|
|
26987
|
-
|
|
26988
|
-
|
|
27268
|
+
wrap(
|
|
27269
|
+
terminal2,
|
|
27270
|
+
`Version ${summary.version} \xB7 ${summary.autoUpdate ? "updates automatically" : "automatic updates are off; run iteration update to update"}`,
|
|
27271
|
+
{ style: terminal2.dim }
|
|
27272
|
+
),
|
|
27273
|
+
...summary.confirming === null ? [] : [
|
|
27274
|
+
wrap(
|
|
27275
|
+
terminal2,
|
|
27276
|
+
`Starting version ${summary.confirming} after an update.`,
|
|
27277
|
+
{ style: terminal2.dim }
|
|
27278
|
+
)
|
|
27279
|
+
],
|
|
26989
27280
|
...summary.rolledBack === null ? [] : [
|
|
26990
|
-
|
|
27281
|
+
mark(
|
|
27282
|
+
terminal2,
|
|
27283
|
+
"warning",
|
|
27284
|
+
`Version ${summary.rolledBack.version} was rolled back: ${summary.rolledBack.reason}`,
|
|
27285
|
+
" "
|
|
27286
|
+
)
|
|
26991
27287
|
],
|
|
26992
|
-
...summary.checkError === null ? [] : [
|
|
27288
|
+
...summary.checkError === null ? [] : [
|
|
27289
|
+
mark(
|
|
27290
|
+
terminal2,
|
|
27291
|
+
"warning",
|
|
27292
|
+
`Last update check failed: ${summary.checkError}`,
|
|
27293
|
+
" "
|
|
27294
|
+
)
|
|
27295
|
+
]
|
|
26993
27296
|
].join("\n");
|
|
26994
27297
|
}
|
|
26995
27298
|
|
|
@@ -27101,6 +27404,14 @@ async function superviseCollector(source, dataDirectory2) {
|
|
|
27101
27404
|
|
|
27102
27405
|
// src/cli.ts
|
|
27103
27406
|
var DEFAULT_INGEST_ENDPOINT = "https://useiteration.com/api/traces/ingest";
|
|
27407
|
+
var terminal = terminalFor(process.stdout);
|
|
27408
|
+
function print(...lines) {
|
|
27409
|
+
process.stdout.write(`${lines.join("\n")}
|
|
27410
|
+
`);
|
|
27411
|
+
}
|
|
27412
|
+
function tracesUrl(endpoint) {
|
|
27413
|
+
return new URL("/app/sessions", endpoint).toString();
|
|
27414
|
+
}
|
|
27104
27415
|
function argumentsForCli() {
|
|
27105
27416
|
const parsed = parseArgs({
|
|
27106
27417
|
args: process.argv.slice(2),
|
|
@@ -27141,55 +27452,95 @@ function optionalString(values, name) {
|
|
|
27141
27452
|
return parsed.data;
|
|
27142
27453
|
}
|
|
27143
27454
|
function usage(command) {
|
|
27455
|
+
const section = (title, entries2) => [
|
|
27456
|
+
wrap(terminal, title, { style: terminal.bold }),
|
|
27457
|
+
rows(terminal, entries2, " ")
|
|
27458
|
+
];
|
|
27144
27459
|
if (command === "logout") {
|
|
27145
|
-
|
|
27146
|
-
|
|
27460
|
+
print(
|
|
27461
|
+
brand(terminal),
|
|
27462
|
+
"",
|
|
27463
|
+
...section("Sign out of Iteration on this computer", [
|
|
27464
|
+
["iteration logout", ""]
|
|
27465
|
+
]),
|
|
27466
|
+
"",
|
|
27467
|
+
wrap(
|
|
27468
|
+
terminal,
|
|
27469
|
+
"Stops all collectors and removes saved credentials and automatic connection approval. Local pending data is archived and will not be uploaded after reconnecting. Agent session files and previously uploaded data are kept."
|
|
27470
|
+
),
|
|
27471
|
+
"",
|
|
27472
|
+
...section("Options", [
|
|
27473
|
+
[
|
|
27474
|
+
"--data-directory DIR",
|
|
27475
|
+
"Also clear a custom collector directory with no installed service"
|
|
27476
|
+
]
|
|
27477
|
+
]),
|
|
27478
|
+
"",
|
|
27479
|
+
wrap(
|
|
27480
|
+
terminal,
|
|
27481
|
+
`Run ${terminal.bold("iteration connect")} to sign in again.`
|
|
27482
|
+
)
|
|
27147
27483
|
);
|
|
27148
27484
|
return;
|
|
27149
27485
|
}
|
|
27150
27486
|
if (command === "connect") {
|
|
27151
|
-
|
|
27152
|
-
|
|
27153
|
-
"Connect a coding agent to Iteration",
|
|
27154
|
-
" iteration connect Connect all detected agents on this computer",
|
|
27155
|
-
" iteration connect codex",
|
|
27156
|
-
" iteration connect claude",
|
|
27157
|
-
" iteration connect cursor",
|
|
27158
|
-
"",
|
|
27159
|
-
"Existing local sessions and new activity are collected automatically.",
|
|
27160
|
-
"",
|
|
27161
|
-
"Options for advanced setups:",
|
|
27162
|
-
" --device-name NAME Name this computer in Iteration",
|
|
27163
|
-
" --workspace ID Connect to this workspace without a prompt",
|
|
27164
|
-
" --codex-home DIR Use a different Codex data directory",
|
|
27165
|
-
" --claude-home DIR Use a different Claude data directory",
|
|
27166
|
-
" --cursor-home DIR Use a different Cursor data directory",
|
|
27167
|
-
" --yes Approve uploads without a terminal prompt",
|
|
27168
|
-
" --data-directory DIR Use a different state directory with a source-specific command",
|
|
27169
|
-
" --endpoint URL Use a different Iteration server"
|
|
27170
|
-
].join("\n") + "\n"
|
|
27171
|
-
);
|
|
27172
|
-
return;
|
|
27173
|
-
}
|
|
27174
|
-
process.stdout.write(
|
|
27175
|
-
[
|
|
27176
|
-
"Iteration CLI",
|
|
27487
|
+
print(
|
|
27488
|
+
brand(terminal),
|
|
27177
27489
|
"",
|
|
27178
|
-
"
|
|
27179
|
-
|
|
27490
|
+
...section("Connect coding agents", [
|
|
27491
|
+
["iteration connect", "Connect all detected agents on this computer"],
|
|
27492
|
+
[
|
|
27493
|
+
"iteration connect <agent>",
|
|
27494
|
+
"Connect one agent: codex, claude or cursor"
|
|
27495
|
+
]
|
|
27496
|
+
]),
|
|
27180
27497
|
"",
|
|
27181
|
-
|
|
27182
|
-
|
|
27183
|
-
|
|
27184
|
-
|
|
27185
|
-
" iteration disconnect codex|claude|cursor Stop a source",
|
|
27186
|
-
" iteration logout Sign out and stop all sources on this computer",
|
|
27187
|
-
" iteration update Update now (updates also install automatically)",
|
|
27188
|
-
" iteration update off|on Turn automatic updates off or on",
|
|
27189
|
-
" iteration version Show the installed version",
|
|
27498
|
+
wrap(
|
|
27499
|
+
terminal,
|
|
27500
|
+
"Existing local sessions and new activity are collected automatically."
|
|
27501
|
+
),
|
|
27190
27502
|
"",
|
|
27191
|
-
"
|
|
27192
|
-
|
|
27503
|
+
...section("Options for advanced setups", [
|
|
27504
|
+
["--device-name NAME", "Name this computer in Iteration"],
|
|
27505
|
+
["--workspace ID", "Connect to this workspace without a prompt"],
|
|
27506
|
+
["--codex-home DIR", "Use a different Codex data directory"],
|
|
27507
|
+
["--claude-home DIR", "Use a different Claude data directory"],
|
|
27508
|
+
["--cursor-home DIR", "Use a different Cursor data directory"],
|
|
27509
|
+
["--yes", "Approve uploads without a terminal prompt"],
|
|
27510
|
+
[
|
|
27511
|
+
"--data-directory DIR",
|
|
27512
|
+
"Use a different state directory with a one-agent command"
|
|
27513
|
+
],
|
|
27514
|
+
["--endpoint URL", "Use a different Iteration server"]
|
|
27515
|
+
])
|
|
27516
|
+
);
|
|
27517
|
+
return;
|
|
27518
|
+
}
|
|
27519
|
+
print(
|
|
27520
|
+
brand(terminal),
|
|
27521
|
+
"",
|
|
27522
|
+
...section("Get started", [
|
|
27523
|
+
["iteration connect", "Connect detected agents and import sessions"]
|
|
27524
|
+
]),
|
|
27525
|
+
"",
|
|
27526
|
+
...section("Commands", [
|
|
27527
|
+
["iteration", "See connection status"],
|
|
27528
|
+
["iteration status", "See scan, upload and error details"],
|
|
27529
|
+
[
|
|
27530
|
+
"iteration connect <agent>",
|
|
27531
|
+
"Connect one agent: codex, claude or cursor"
|
|
27532
|
+
],
|
|
27533
|
+
["iteration disconnect <agent>", "Stop one agent"],
|
|
27534
|
+
["iteration logout", "Sign out and stop all sources on this computer"],
|
|
27535
|
+
["iteration update", "Update now; updates also install automatically"],
|
|
27536
|
+
["iteration update off|on", "Turn automatic updates off or on"],
|
|
27537
|
+
["iteration version", "Show the installed version"]
|
|
27538
|
+
]),
|
|
27539
|
+
"",
|
|
27540
|
+
wrap(
|
|
27541
|
+
terminal,
|
|
27542
|
+
`Run ${terminal.bold("iteration connect --help")} for advanced setup options.`
|
|
27543
|
+
)
|
|
27193
27544
|
);
|
|
27194
27545
|
}
|
|
27195
27546
|
async function fileExists(filename) {
|
|
@@ -27212,29 +27563,20 @@ async function defaultCommand() {
|
|
|
27212
27563
|
snapshot: await statusSnapshot(source, {})
|
|
27213
27564
|
}))
|
|
27214
27565
|
);
|
|
27215
|
-
|
|
27216
|
-
({ snapshot }) => snapshot.kind !== "not_connected"
|
|
27217
|
-
);
|
|
27218
|
-
if (connected.length > 0) {
|
|
27219
|
-
process.stdout.write(
|
|
27220
|
-
`${connected.map(({ source, snapshot }) => renderHome(snapshot, Date.now(), source)).join("\n\n")}
|
|
27221
|
-
`
|
|
27222
|
-
);
|
|
27566
|
+
if (snapshots.some(({ snapshot }) => snapshot.kind !== "not_connected")) {
|
|
27223
27567
|
const discovered = await detectedSources({
|
|
27224
27568
|
codex: sourceHome("codex"),
|
|
27225
27569
|
claude: sourceHome("claude"),
|
|
27226
27570
|
cursor: sourceHome("cursor")
|
|
27227
27571
|
});
|
|
27228
|
-
|
|
27229
|
-
(
|
|
27572
|
+
print(
|
|
27573
|
+
renderHome(
|
|
27574
|
+
terminal,
|
|
27575
|
+
snapshots.flatMap(
|
|
27576
|
+
({ source, snapshot }) => snapshot.kind !== "not_connected" || discovered.includes(source) ? [{ source, status: snapshot }] : []
|
|
27577
|
+
)
|
|
27578
|
+
)
|
|
27230
27579
|
);
|
|
27231
|
-
if (missing2.length > 0) {
|
|
27232
|
-
process.stdout.write(
|
|
27233
|
-
`
|
|
27234
|
-
${missing2.map(collectorSourceLabel).join(" and ")} found on this computer but not connected. Run iteration connect to include ${missing2.length === 1 ? "it" : "them"}.
|
|
27235
|
-
`
|
|
27236
|
-
);
|
|
27237
|
-
}
|
|
27238
27580
|
return;
|
|
27239
27581
|
}
|
|
27240
27582
|
if (process.stdin.isTTY !== true || process.stdout.isTTY !== true) {
|
|
@@ -27248,19 +27590,78 @@ function dataDirectory(source, values) {
|
|
|
27248
27590
|
optionalString(values, "data-directory") ?? defaultCollectorDirectory(source)
|
|
27249
27591
|
);
|
|
27250
27592
|
}
|
|
27251
|
-
async function
|
|
27252
|
-
if ("cursorHome" in config3)
|
|
27253
|
-
return " Cursor hooks capture tool results and usage automatically.";
|
|
27593
|
+
async function setUpTurnSummary(config3) {
|
|
27594
|
+
if ("cursorHome" in config3) return { kind: "unsupported" };
|
|
27254
27595
|
try {
|
|
27255
27596
|
await installTurnSummary(config3);
|
|
27256
|
-
|
|
27257
|
-
return "\nOne more step: in Codex, type /hooks and approve Iteration to see your friction summary after each turn.";
|
|
27258
|
-
}
|
|
27259
|
-
return " A one-line friction summary now appears after agent turns in your repositories.";
|
|
27597
|
+
return await codexTurnSummaryApproval(config3) === "needs_approval" ? { kind: "needs_approval" } : { kind: "ready" };
|
|
27260
27598
|
} catch (error3) {
|
|
27261
|
-
return
|
|
27599
|
+
return {
|
|
27600
|
+
kind: "failed",
|
|
27601
|
+
reason: error3 instanceof Error ? error3.message : "unknown error"
|
|
27602
|
+
};
|
|
27262
27603
|
}
|
|
27263
27604
|
}
|
|
27605
|
+
function turnSummaryLines(results) {
|
|
27606
|
+
const warnings = results.flatMap(({ source, turnSummary }) => {
|
|
27607
|
+
const name = collectorSourceLabel(source);
|
|
27608
|
+
if (turnSummary.kind === "needs_approval")
|
|
27609
|
+
return [
|
|
27610
|
+
mark(
|
|
27611
|
+
terminal,
|
|
27612
|
+
"warning",
|
|
27613
|
+
`${terminal.bold(`One more step for ${name}:`)} type /hooks in ${name} and approve Iteration to see your friction summary after each turn.`
|
|
27614
|
+
)
|
|
27615
|
+
];
|
|
27616
|
+
if (turnSummary.kind === "failed")
|
|
27617
|
+
return [
|
|
27618
|
+
mark(
|
|
27619
|
+
terminal,
|
|
27620
|
+
"warning",
|
|
27621
|
+
`The ${name} friction summary could not be installed: ${turnSummary.reason} Run ${terminal.bold(`iteration start ${source}`)} to retry it.`
|
|
27622
|
+
)
|
|
27623
|
+
];
|
|
27624
|
+
return [];
|
|
27625
|
+
});
|
|
27626
|
+
return [
|
|
27627
|
+
...results.some(({ turnSummary }) => turnSummary.kind === "ready") ? [
|
|
27628
|
+
wrap(
|
|
27629
|
+
terminal,
|
|
27630
|
+
"A one-line friction summary now appears after agent turns in your repositories."
|
|
27631
|
+
)
|
|
27632
|
+
] : [],
|
|
27633
|
+
...warnings
|
|
27634
|
+
];
|
|
27635
|
+
}
|
|
27636
|
+
var CONNECTED_WIDTH = Math.max(
|
|
27637
|
+
...COLLECTOR_SOURCES2.map(
|
|
27638
|
+
(source) => `${collectorSourceLabel(source)} connected`.length
|
|
27639
|
+
)
|
|
27640
|
+
);
|
|
27641
|
+
function connectedLine(source, sessions) {
|
|
27642
|
+
return mark(
|
|
27643
|
+
terminal,
|
|
27644
|
+
"success",
|
|
27645
|
+
`${padEnd(`${collectorSourceLabel(source)} connected`, CONNECTED_WIDTH)} ${terminal.dim(
|
|
27646
|
+
sessions === 0 ? "no saved sessions yet" : `importing ${sessions.toLocaleString("en-US")} ${sessions === 1 ? "session" : "sessions"}`
|
|
27647
|
+
)}`
|
|
27648
|
+
);
|
|
27649
|
+
}
|
|
27650
|
+
function connectionSummary2(results, imported) {
|
|
27651
|
+
const links = [
|
|
27652
|
+
...new Set(results.map(({ endpoint }) => tracesUrl(endpoint)))
|
|
27653
|
+
];
|
|
27654
|
+
const notes = turnSummaryLines(results);
|
|
27655
|
+
return [
|
|
27656
|
+
...notes.length === 0 ? [] : ["", ...notes],
|
|
27657
|
+
"",
|
|
27658
|
+
wrap(
|
|
27659
|
+
terminal,
|
|
27660
|
+
imported ? `Sessions import newest first. Run ${terminal.bold("iteration")} to follow progress.` : `Run ${terminal.bold("iteration")} to see their status.`
|
|
27661
|
+
),
|
|
27662
|
+
...links.map((url2) => ` Open Iteration ${terminal.link(url2)}`)
|
|
27663
|
+
];
|
|
27664
|
+
}
|
|
27264
27665
|
async function initialize(source, values) {
|
|
27265
27666
|
requireCollectorPlatform();
|
|
27266
27667
|
const endpoint = optionalString(values, "endpoint") ?? DEFAULT_INGEST_ENDPOINT;
|
|
@@ -27285,6 +27686,13 @@ async function initialize(source, values) {
|
|
|
27285
27686
|
organizationId,
|
|
27286
27687
|
source
|
|
27287
27688
|
);
|
|
27689
|
+
print(
|
|
27690
|
+
mark(
|
|
27691
|
+
terminal,
|
|
27692
|
+
"success",
|
|
27693
|
+
`Signed in to ${terminal.bold(safeWorkspaceName(enrollment.organizationName) ?? "your workspace")}`
|
|
27694
|
+
)
|
|
27695
|
+
);
|
|
27288
27696
|
const connection = {
|
|
27289
27697
|
endpoint: endpointUrl.toString(),
|
|
27290
27698
|
token: enrollment.token,
|
|
@@ -27311,22 +27719,40 @@ async function initialize(source, values) {
|
|
|
27311
27719
|
{ cause: error3 }
|
|
27312
27720
|
);
|
|
27313
27721
|
}
|
|
27314
|
-
const
|
|
27315
|
-
|
|
27316
|
-
|
|
27317
|
-
|
|
27318
|
-
|
|
27319
|
-
|
|
27722
|
+
const turnSummary = await setUpTurnSummary(config3);
|
|
27723
|
+
print(connectedLine(source, await countSavedSessions(source, selectedHome)));
|
|
27724
|
+
return {
|
|
27725
|
+
config: config3,
|
|
27726
|
+
result: { source, endpoint: config3.endpoint, turnSummary }
|
|
27727
|
+
};
|
|
27320
27728
|
}
|
|
27321
27729
|
async function approveAllSources(sources, workspaceName, yes) {
|
|
27322
|
-
const names = sources.map(
|
|
27323
|
-
({ source, sessions }) => `${collectorSourceLabel(source)} (${sessions.toLocaleString("en-US")} saved ${sessions === 1 ? "session" : "sessions"})`
|
|
27324
|
-
).join(" and ");
|
|
27325
27730
|
const safeName = safeWorkspaceName(workspaceName);
|
|
27326
|
-
|
|
27327
|
-
|
|
27328
|
-
|
|
27329
|
-
`
|
|
27731
|
+
print(
|
|
27732
|
+
wrap(
|
|
27733
|
+
terminal,
|
|
27734
|
+
sources.length === 0 ? "No saved agent sessions found on this computer" : `Found ${sources.length} coding ${sources.length === 1 ? "agent" : "agents"} on this computer`,
|
|
27735
|
+
{ style: terminal.bold }
|
|
27736
|
+
),
|
|
27737
|
+
...sources.length === 0 ? [] : [
|
|
27738
|
+
"",
|
|
27739
|
+
rows(
|
|
27740
|
+
terminal,
|
|
27741
|
+
sources.map(({ source, sessions }) => [
|
|
27742
|
+
collectorSourceLabel(source),
|
|
27743
|
+
terminal.dim(
|
|
27744
|
+
`${sessions.toLocaleString("en-US")} saved ${sessions === 1 ? "session" : "sessions"}`
|
|
27745
|
+
)
|
|
27746
|
+
]),
|
|
27747
|
+
" "
|
|
27748
|
+
)
|
|
27749
|
+
],
|
|
27750
|
+
"",
|
|
27751
|
+
wrap(
|
|
27752
|
+
terminal,
|
|
27753
|
+
`Existing sessions and new activity, including prompts, code and tool output, upload to ${safeName ?? "your workspace"}, where its members can read them. Supported agents you install later connect automatically.${process.platform === "linux" ? " Collection continues after you log out." : ""}`
|
|
27754
|
+
),
|
|
27755
|
+
""
|
|
27330
27756
|
);
|
|
27331
27757
|
if (yes) return;
|
|
27332
27758
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
@@ -27334,17 +27760,15 @@ Connect supported agents${safeName ? ` to ${safeName}` : " to the workspace you
|
|
|
27334
27760
|
"Run iteration connect interactively or pass --yes to approve uploads."
|
|
27335
27761
|
);
|
|
27336
27762
|
}
|
|
27337
|
-
const
|
|
27338
|
-
|
|
27339
|
-
|
|
27340
|
-
|
|
27341
|
-
|
|
27342
|
-
|
|
27343
|
-
|
|
27344
|
-
|
|
27345
|
-
|
|
27346
|
-
prompt.close();
|
|
27347
|
-
}
|
|
27763
|
+
const answer = await ask(
|
|
27764
|
+
terminal,
|
|
27765
|
+
`${terminal.bold(sources.length === 1 ? "Connect this agent?" : "Connect these agents?")} ${terminal.dim("(y/N)")}`
|
|
27766
|
+
);
|
|
27767
|
+
const approved = answer?.trim().toLowerCase();
|
|
27768
|
+
if (approved !== "y" && approved !== "yes")
|
|
27769
|
+
throw new Error(
|
|
27770
|
+
"No agents were connected. Run iteration connect when you are ready."
|
|
27771
|
+
);
|
|
27348
27772
|
}
|
|
27349
27773
|
async function connectAll(values) {
|
|
27350
27774
|
requireCollectorPlatform();
|
|
@@ -27370,12 +27794,23 @@ async function connectAll(values) {
|
|
|
27370
27794
|
const existing = COLLECTOR_SOURCES2.flatMap(
|
|
27371
27795
|
(source, index) => configs[index] ? [{ source, config: configs[index] }] : []
|
|
27372
27796
|
);
|
|
27797
|
+
print(brand(terminal), "");
|
|
27373
27798
|
if (detected.length === 0 && existing.length === 0) {
|
|
27374
|
-
|
|
27375
|
-
"No supported local coding agents found yet
|
|
27799
|
+
print(
|
|
27800
|
+
mark(terminal, "warning", "No supported local coding agents found yet"),
|
|
27801
|
+
wrap(
|
|
27802
|
+
terminal,
|
|
27803
|
+
`Run ${terminal.bold("iteration connect")} after using Codex, Claude Code or Cursor on this computer.`
|
|
27804
|
+
)
|
|
27376
27805
|
);
|
|
27377
27806
|
return;
|
|
27378
27807
|
}
|
|
27808
|
+
const sessions = await Promise.all(
|
|
27809
|
+
detected.map(async (source) => ({
|
|
27810
|
+
source,
|
|
27811
|
+
sessions: await countSavedSessions(source, sourceHomes[source])
|
|
27812
|
+
}))
|
|
27813
|
+
);
|
|
27379
27814
|
const anchorSource = existing[0]?.source ?? detected[0];
|
|
27380
27815
|
const anchorExisting = existing[0]?.config ?? null;
|
|
27381
27816
|
const endpoint = validateCollectorEndpoint(
|
|
@@ -27414,12 +27849,7 @@ async function connectAll(values) {
|
|
|
27414
27849
|
const needsApproval = () => previousConsent === null || anchorExisting === null || previousConsent.endpoint !== endpoint || previousConsent.anchorSource !== anchorSource || previousConsent.anchorDataDirectory !== anchorExisting.dataDirectory || previousConsent.organizationId !== existingScopes[0]?.scope.organizationId || previousConsent.sourceHomes.codex !== sourceHomes.codex || previousConsent.sourceHomes.claude !== sourceHomes.claude || previousConsent.sourceHomes.cursor !== sourceHomes.cursor;
|
|
27415
27850
|
if (needsApproval()) {
|
|
27416
27851
|
await approveAllSources(
|
|
27417
|
-
|
|
27418
|
-
detected.map(async (source) => ({
|
|
27419
|
-
source,
|
|
27420
|
-
sessions: await countSavedSessions(source, sourceHomes[source])
|
|
27421
|
-
}))
|
|
27422
|
-
),
|
|
27852
|
+
sessions,
|
|
27423
27853
|
existingScopes[0]?.scope.organizationName ?? null,
|
|
27424
27854
|
values.yes === true
|
|
27425
27855
|
);
|
|
@@ -27427,7 +27857,13 @@ async function connectAll(values) {
|
|
|
27427
27857
|
};
|
|
27428
27858
|
await approveConnection();
|
|
27429
27859
|
await prepareBackgroundPersistence();
|
|
27430
|
-
|
|
27860
|
+
const results = [];
|
|
27861
|
+
const initializeAnchor = async () => {
|
|
27862
|
+
const initialized = await initialize(anchorSource, values);
|
|
27863
|
+
results.push(initialized.result);
|
|
27864
|
+
return initialized.config;
|
|
27865
|
+
};
|
|
27866
|
+
let anchor3 = anchorExisting ?? await initializeAnchor();
|
|
27431
27867
|
let organizationId = requestedOrganizationId ?? existingScopes[0]?.scope.organizationId ?? anchor3.organizationId ?? null;
|
|
27432
27868
|
const connectDetectedSources = async () => {
|
|
27433
27869
|
for (const source of detected) {
|
|
@@ -27449,10 +27885,16 @@ async function connectAll(values) {
|
|
|
27449
27885
|
state
|
|
27450
27886
|
);
|
|
27451
27887
|
organizationId = enrollment.organizationId;
|
|
27452
|
-
|
|
27453
|
-
|
|
27454
|
-
|
|
27455
|
-
|
|
27888
|
+
results.push({
|
|
27889
|
+
source,
|
|
27890
|
+
endpoint: config3.endpoint,
|
|
27891
|
+
turnSummary: await setUpTurnSummary(config3)
|
|
27892
|
+
});
|
|
27893
|
+
print(
|
|
27894
|
+
connectedLine(
|
|
27895
|
+
source,
|
|
27896
|
+
sessions.find((item) => item.source === source)?.sessions ?? 0
|
|
27897
|
+
)
|
|
27456
27898
|
);
|
|
27457
27899
|
}
|
|
27458
27900
|
};
|
|
@@ -27483,15 +27925,20 @@ async function connectAll(values) {
|
|
|
27483
27925
|
item.config.dataDirectory
|
|
27484
27926
|
);
|
|
27485
27927
|
await installBackgroundService(item.config.dataDirectory, item.source);
|
|
27486
|
-
|
|
27487
|
-
|
|
27488
|
-
|
|
27489
|
-
|
|
27928
|
+
results.push({
|
|
27929
|
+
source: item.source,
|
|
27930
|
+
endpoint: item.config.endpoint,
|
|
27931
|
+
turnSummary: await setUpTurnSummary(item.config)
|
|
27932
|
+
});
|
|
27933
|
+
print(
|
|
27934
|
+
mark(
|
|
27935
|
+
terminal,
|
|
27936
|
+
"success",
|
|
27937
|
+
`${collectorSourceLabel(item.source)} is still connected`
|
|
27938
|
+
)
|
|
27490
27939
|
);
|
|
27491
27940
|
}
|
|
27492
|
-
|
|
27493
|
-
"Detected agents are connected. New supported agents on this computer will connect automatically.\n"
|
|
27494
|
-
);
|
|
27941
|
+
print(...connectionSummary2(results, results.length > existing.length));
|
|
27495
27942
|
}
|
|
27496
27943
|
async function importHistory(source, values) {
|
|
27497
27944
|
requireCollectorPlatform();
|
|
@@ -27502,22 +27949,47 @@ async function importHistory(source, values) {
|
|
|
27502
27949
|
throw new Error(
|
|
27503
27950
|
`This collector directory belongs to ${collectorSource(config3)}.`
|
|
27504
27951
|
);
|
|
27952
|
+
const name = collectorSourceLabel(source);
|
|
27505
27953
|
const estimate = (await importSourceHistory(config3, paths, false)).size;
|
|
27506
|
-
|
|
27507
|
-
|
|
27508
|
-
|
|
27954
|
+
print(
|
|
27955
|
+
wrap(
|
|
27956
|
+
terminal,
|
|
27957
|
+
`Found ${estimate.files.toLocaleString("en-US")} local ${name} session files (${readableBytes(estimate.bytes)})`,
|
|
27958
|
+
{ indent: "", style: terminal.bold }
|
|
27959
|
+
),
|
|
27960
|
+
wrap(
|
|
27961
|
+
terminal,
|
|
27962
|
+
"History may include prompts, code and tool output that workspace members can read."
|
|
27963
|
+
)
|
|
27509
27964
|
);
|
|
27510
27965
|
if (values.yes !== true) {
|
|
27511
|
-
|
|
27512
|
-
|
|
27513
|
-
|
|
27966
|
+
print(
|
|
27967
|
+
mark(
|
|
27968
|
+
terminal,
|
|
27969
|
+
"warning",
|
|
27970
|
+
`No changes made. Run ${terminal.bold(`iteration import-history ${source} --yes`)} to confirm this upload.`
|
|
27971
|
+
)
|
|
27514
27972
|
);
|
|
27515
27973
|
return;
|
|
27516
27974
|
}
|
|
27517
27975
|
const result = await importSourceHistory(config3, paths, true);
|
|
27518
|
-
|
|
27519
|
-
|
|
27520
|
-
|
|
27976
|
+
print(
|
|
27977
|
+
mark(
|
|
27978
|
+
terminal,
|
|
27979
|
+
"success",
|
|
27980
|
+
`History scan scheduled for ${result.size.files.toLocaleString("en-US")} local session files (${readableBytes(result.size.bytes)})`
|
|
27981
|
+
),
|
|
27982
|
+
wrap(
|
|
27983
|
+
terminal,
|
|
27984
|
+
`Scanning and uploads run in bounded batches and may take time. Older sessions appear under the date Iteration receives them. Run ${terminal.bold(`iteration status ${source}`)} to see local scan progress and pending uploads.`
|
|
27985
|
+
),
|
|
27986
|
+
...result.backgroundRunning ? [] : [
|
|
27987
|
+
mark(
|
|
27988
|
+
terminal,
|
|
27989
|
+
"warning",
|
|
27990
|
+
`The collector was not running. Run ${terminal.bold(`iteration start ${source}`)} to begin scanning.`
|
|
27991
|
+
)
|
|
27992
|
+
]
|
|
27521
27993
|
);
|
|
27522
27994
|
}
|
|
27523
27995
|
async function start(source, values) {
|
|
@@ -27533,10 +28005,20 @@ async function start(source, values) {
|
|
|
27533
28005
|
if ("cursorHome" in config3)
|
|
27534
28006
|
await installCursorHooks(config3.cursorHome, config3.dataDirectory);
|
|
27535
28007
|
await installBackgroundService(directory, source);
|
|
27536
|
-
const
|
|
27537
|
-
|
|
27538
|
-
|
|
27539
|
-
|
|
28008
|
+
const turnSummary = await setUpTurnSummary(config3);
|
|
28009
|
+
print(
|
|
28010
|
+
mark(
|
|
28011
|
+
terminal,
|
|
28012
|
+
"success",
|
|
28013
|
+
`${collectorSourceLabel(source)} is collecting again`
|
|
28014
|
+
),
|
|
28015
|
+
...repairedState ? [
|
|
28016
|
+
wrap(terminal, "Incomplete setup was repaired.", {
|
|
28017
|
+
style: terminal.dim
|
|
28018
|
+
})
|
|
28019
|
+
] : [],
|
|
28020
|
+
...turnSummaryLines([{ source, endpoint: config3.endpoint, turnSummary }]),
|
|
28021
|
+
wrap(terminal, `Run ${terminal.bold("iteration")} to check progress.`)
|
|
27540
28022
|
);
|
|
27541
28023
|
}
|
|
27542
28024
|
async function statusSnapshot(source, values) {
|
|
@@ -27578,16 +28060,18 @@ async function statusSnapshot(source, values) {
|
|
|
27578
28060
|
healthAvailable: localHealth.kind === "available",
|
|
27579
28061
|
turnSummaryNeedsApproval: approval === "needs_approval",
|
|
27580
28062
|
hookFailureAtMs,
|
|
27581
|
-
tracesUrl:
|
|
28063
|
+
tracesUrl: tracesUrl(config3.endpoint),
|
|
27582
28064
|
logPath: collectorLogPath(source)
|
|
27583
28065
|
};
|
|
27584
28066
|
}
|
|
27585
28067
|
async function status(source, values) {
|
|
27586
28068
|
if (source !== void 0) {
|
|
27587
|
-
|
|
27588
|
-
|
|
27589
|
-
|
|
27590
|
-
|
|
28069
|
+
print(
|
|
28070
|
+
renderDetailedStatus(
|
|
28071
|
+
terminal,
|
|
28072
|
+
source,
|
|
28073
|
+
await statusSnapshot(source, values)
|
|
28074
|
+
)
|
|
27591
28075
|
);
|
|
27592
28076
|
return;
|
|
27593
28077
|
}
|
|
@@ -27597,9 +28081,10 @@ async function status(source, values) {
|
|
|
27597
28081
|
snapshot: await statusSnapshot(item, values)
|
|
27598
28082
|
}))
|
|
27599
28083
|
);
|
|
27600
|
-
|
|
27601
|
-
|
|
27602
|
-
|
|
28084
|
+
print(
|
|
28085
|
+
snapshots.map(
|
|
28086
|
+
({ source: item, snapshot }) => renderDetailedStatus(terminal, item, snapshot)
|
|
28087
|
+
).join("\n\n")
|
|
27603
28088
|
);
|
|
27604
28089
|
}
|
|
27605
28090
|
var ROLLBACK_NOTICE_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
@@ -27609,7 +28094,7 @@ async function runtimeSummaryText() {
|
|
|
27609
28094
|
if (state === null) return null;
|
|
27610
28095
|
const settings = await readRuntimeSettings(paths);
|
|
27611
28096
|
const rejected = state.rejected.at(-1);
|
|
27612
|
-
return renderRuntime({
|
|
28097
|
+
return renderRuntime(terminal, {
|
|
27613
28098
|
version: state.current,
|
|
27614
28099
|
autoUpdate: settings.autoUpdate,
|
|
27615
28100
|
confirming: state.trial?.version ?? null,
|
|
@@ -27667,10 +28152,15 @@ async function waitForTrial(to) {
|
|
|
27667
28152
|
`Version ${to} did not start and Iteration returned to ${state.current}. ${rejected?.reason ?? ""}`.trim()
|
|
27668
28153
|
);
|
|
27669
28154
|
}
|
|
27670
|
-
if (state?.trial === null)
|
|
28155
|
+
if (state?.trial === null)
|
|
28156
|
+
return mark(terminal, "success", `Iteration is updated to ${to}`);
|
|
27671
28157
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
27672
28158
|
}
|
|
27673
|
-
return
|
|
28159
|
+
return mark(
|
|
28160
|
+
terminal,
|
|
28161
|
+
"warning",
|
|
28162
|
+
`Iteration is updated to ${to}; collectors are still starting. Run ${terminal.bold("iteration")} to check.`
|
|
28163
|
+
);
|
|
27674
28164
|
}
|
|
27675
28165
|
async function update(setting, values) {
|
|
27676
28166
|
requireCollectorPlatform();
|
|
@@ -27687,8 +28177,16 @@ async function update(setting, values) {
|
|
|
27687
28177
|
...setting === void 0 ? {} : { autoUpdate: setting === "on" },
|
|
27688
28178
|
...registry3 === null ? {} : { registry: validateRegistryUrl(registry3).toString() }
|
|
27689
28179
|
});
|
|
27690
|
-
|
|
27691
|
-
setting === "off" ?
|
|
28180
|
+
print(
|
|
28181
|
+
setting === "off" ? mark(
|
|
28182
|
+
terminal,
|
|
28183
|
+
"success",
|
|
28184
|
+
`Automatic updates are off. Run ${terminal.bold("iteration update")} to update.`
|
|
28185
|
+
) : mark(
|
|
28186
|
+
terminal,
|
|
28187
|
+
"success",
|
|
28188
|
+
setting === "on" ? "Automatic updates are on" : "The update registry is saved"
|
|
28189
|
+
)
|
|
27692
28190
|
);
|
|
27693
28191
|
return;
|
|
27694
28192
|
}
|
|
@@ -27698,33 +28196,56 @@ async function update(setting, values) {
|
|
|
27698
28196
|
throw new Error(
|
|
27699
28197
|
"No collector is set up on this computer. Run iteration connect first."
|
|
27700
28198
|
);
|
|
28199
|
+
const stopChecking = startSpinner(
|
|
28200
|
+
process.stdout,
|
|
28201
|
+
terminal,
|
|
28202
|
+
"Checking for updates\u2026"
|
|
28203
|
+
);
|
|
27701
28204
|
const outcome = await updateRuntime(paths, {
|
|
27702
28205
|
manual: true,
|
|
27703
28206
|
expected,
|
|
27704
28207
|
nowMs: Date.now(),
|
|
27705
28208
|
signal: AbortSignal.timeout(6e5)
|
|
27706
|
-
});
|
|
28209
|
+
}).finally(stopChecking);
|
|
27707
28210
|
if (outcome.kind === "busy") {
|
|
27708
|
-
|
|
27709
|
-
|
|
28211
|
+
print(
|
|
28212
|
+
mark(
|
|
28213
|
+
terminal,
|
|
28214
|
+
"warning",
|
|
28215
|
+
`Another update is in progress. Run ${terminal.bold("iteration")} to check.`
|
|
28216
|
+
)
|
|
27710
28217
|
);
|
|
27711
28218
|
return;
|
|
27712
28219
|
}
|
|
27713
28220
|
if (outcome.kind === "up_to_date") {
|
|
27714
|
-
|
|
27715
|
-
|
|
27716
|
-
|
|
28221
|
+
print(
|
|
28222
|
+
mark(
|
|
28223
|
+
terminal,
|
|
28224
|
+
"success",
|
|
28225
|
+
`Iteration ${outcome.version} is the latest version`
|
|
28226
|
+
)
|
|
27717
28227
|
);
|
|
27718
28228
|
return;
|
|
27719
28229
|
}
|
|
27720
28230
|
if (outcome.kind === "waiting") {
|
|
27721
|
-
|
|
27722
|
-
`)
|
|
28231
|
+
print(
|
|
28232
|
+
mark(terminal, "warning", `No update was installed: ${outcome.reason}.`)
|
|
28233
|
+
);
|
|
27723
28234
|
return;
|
|
27724
28235
|
}
|
|
27725
|
-
|
|
27726
|
-
|
|
27727
|
-
|
|
28236
|
+
const stopStarting = startSpinner(
|
|
28237
|
+
process.stdout,
|
|
28238
|
+
terminal,
|
|
28239
|
+
`Starting Iteration ${outcome.to}\u2026`
|
|
28240
|
+
);
|
|
28241
|
+
let result;
|
|
28242
|
+
try {
|
|
28243
|
+
await refreshBackgroundServices(true);
|
|
28244
|
+
result = await waitForTrial(outcome.to);
|
|
28245
|
+
} finally {
|
|
28246
|
+
stopStarting();
|
|
28247
|
+
}
|
|
28248
|
+
print(result);
|
|
27728
28249
|
}
|
|
27729
28250
|
async function runInternalCommand() {
|
|
27730
28251
|
if (process.argv[2] === "supervise") {
|
|
@@ -27757,7 +28278,14 @@ async function runInternalCommand() {
|
|
|
27757
28278
|
}
|
|
27758
28279
|
return false;
|
|
27759
28280
|
}
|
|
28281
|
+
var BACKGROUND_COMMANDS = /* @__PURE__ */ new Set([
|
|
28282
|
+
"run",
|
|
28283
|
+
"supervise",
|
|
28284
|
+
"claude-git-hook",
|
|
28285
|
+
"turn-summary-hook"
|
|
28286
|
+
]);
|
|
27760
28287
|
async function main() {
|
|
28288
|
+
if (!BACKGROUND_COMMANDS.has(process.argv[2] ?? "")) silenceCollectorLogs();
|
|
27761
28289
|
if (await runInternalCommand()) return;
|
|
27762
28290
|
const delegated = await delegateToInstalledVersion();
|
|
27763
28291
|
if (delegated !== null) {
|
|
@@ -27805,8 +28333,22 @@ async function signOut(source, values) {
|
|
|
27805
28333
|
"Run iteration logout without a source. Only --data-directory is supported."
|
|
27806
28334
|
);
|
|
27807
28335
|
await logout(optionalString(values, "data-directory") ?? void 0);
|
|
27808
|
-
|
|
27809
|
-
|
|
28336
|
+
print(
|
|
28337
|
+
mark(
|
|
28338
|
+
terminal,
|
|
28339
|
+
"success",
|
|
28340
|
+
terminal.bold("Signed out of Iteration on this computer")
|
|
28341
|
+
),
|
|
28342
|
+
"",
|
|
28343
|
+
wrap(
|
|
28344
|
+
terminal,
|
|
28345
|
+
"Collection stopped and saved credentials were removed. Local pending data was archived. Agent sessions and uploaded data were kept."
|
|
28346
|
+
),
|
|
28347
|
+
"",
|
|
28348
|
+
wrap(
|
|
28349
|
+
terminal,
|
|
28350
|
+
`Run ${terminal.bold("iteration connect")} to sign in again.`
|
|
28351
|
+
)
|
|
27810
28352
|
);
|
|
27811
28353
|
}
|
|
27812
28354
|
async function showHome(values) {
|
|
@@ -27818,9 +28360,7 @@ async function showHome(values) {
|
|
|
27818
28360
|
if (isCollectorPlatform()) await adoptRuntime();
|
|
27819
28361
|
await defaultCommand();
|
|
27820
28362
|
const summary = await runtimeSummaryText();
|
|
27821
|
-
if (summary !== null)
|
|
27822
|
-
${summary}
|
|
27823
|
-
`);
|
|
28363
|
+
if (summary !== null) print("", summary);
|
|
27824
28364
|
}
|
|
27825
28365
|
async function disconnect(selectedSource, values) {
|
|
27826
28366
|
await uninstallBackgroundService(selectedSource);
|
|
@@ -27831,8 +28371,13 @@ async function disconnect(selectedSource, values) {
|
|
|
27831
28371
|
await uninstallCursorHooks(config3.cursorHome, config3.dataDirectory);
|
|
27832
28372
|
else await uninstallTurnSummary(config3);
|
|
27833
28373
|
}
|
|
27834
|
-
|
|
27835
|
-
|
|
28374
|
+
print(
|
|
28375
|
+
mark(
|
|
28376
|
+
terminal,
|
|
28377
|
+
"success",
|
|
28378
|
+
`${collectorSourceLabel(selectedSource)} is disconnected`
|
|
28379
|
+
),
|
|
28380
|
+
wrap(terminal, "Collection stopped. Local pending data was kept.")
|
|
27836
28381
|
);
|
|
27837
28382
|
}
|
|
27838
28383
|
async function dispatchSourceCommand(command, source, values, selectedSource) {
|
|
@@ -27847,7 +28392,9 @@ async function dispatchSourceCommand(command, source, values, selectedSource) {
|
|
|
27847
28392
|
};
|
|
27848
28393
|
validateSourceOptions();
|
|
27849
28394
|
if (command === "connect" && selectedSource !== null) {
|
|
27850
|
-
|
|
28395
|
+
print(brand(terminal), "");
|
|
28396
|
+
const { result } = await initialize(selectedSource, values);
|
|
28397
|
+
print(...connectionSummary2([result], true));
|
|
27851
28398
|
return;
|
|
27852
28399
|
}
|
|
27853
28400
|
if (command === "run") {
|
|
@@ -27879,9 +28426,7 @@ async function showStatus(source, selectedSource, values) {
|
|
|
27879
28426
|
await adoptRuntime();
|
|
27880
28427
|
await status(selectedSource ?? void 0, values);
|
|
27881
28428
|
const summary = await runtimeSummaryText();
|
|
27882
|
-
if (summary !== null)
|
|
27883
|
-
${summary}
|
|
27884
|
-
`);
|
|
28429
|
+
if (summary !== null) print("", summary);
|
|
27885
28430
|
}
|
|
27886
28431
|
var background = process.argv[2] === "run";
|
|
27887
28432
|
main().then(
|
|
@@ -27889,8 +28434,9 @@ main().then(
|
|
|
27889
28434
|
if (background) process.exit(process.exitCode ?? 0);
|
|
27890
28435
|
},
|
|
27891
28436
|
(error3) => {
|
|
28437
|
+
const message = error3 instanceof Error ? error3.message : "Unknown Iteration CLI error.";
|
|
27892
28438
|
process.stderr.write(
|
|
27893
|
-
`${
|
|
28439
|
+
`${process.stderr.isTTY ? mark(terminalFor(process.stderr), "failure", message) : message}
|
|
27894
28440
|
`
|
|
27895
28441
|
);
|
|
27896
28442
|
process.exitCode = 1;
|