@kodycodes/cli 1.31.1 → 1.31.3
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 +2 -1
- package/dist/{auth-ENMPCMEF.js → auth-YATT6SVI.js} +3 -3
- package/dist/bin.js +5 -5
- package/dist/{chunk-AQA2OWJV.js → chunk-3B6YDTUS.js} +72 -30
- package/dist/chunk-3B6YDTUS.js.map +6 -0
- package/dist/{chunk-GGTDQ3DB.js → chunk-BLPFUGNH.js} +2 -2
- package/dist/{chunk-TEDLUC2N.js → chunk-QDOCN6Y6.js} +2 -2
- package/dist/{chunk-HE6DDGRA.js → chunk-SLAL53ZC.js} +2 -2
- package/dist/{chunk-KRFJTXGW.js → chunk-YKSELVAI.js} +7 -1
- package/dist/chunk-YKSELVAI.js.map +6 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +5 -5
- package/dist/{dev-command-PRFU6SUO.js → dev-command-LD5YHNKH.js} +125 -12
- package/dist/{dev-command-PRFU6SUO.js.map → dev-command-LD5YHNKH.js.map} +3 -3
- package/dist/dev-command.d.ts +25 -2
- package/dist/{git-credential-76LN5D43.js → git-credential-LWKMXX3S.js} +4 -4
- package/dist/{mock-dep-resolve-6TFZKV6K.js → mock-dep-resolve-UAMQLI6X.js} +4 -4
- package/dist/{open-api-client-PBYR7O3V.js → open-api-client-HVWBTRXF.js} +2 -2
- package/dist/package-check-files.d.ts +13 -0
- package/dist/{remote-execute-H4ICLP2Z.js → remote-execute-JIL4G3OF.js} +2 -2
- package/dist/{setup-git-VPH2XYYB.js → setup-git-6VJBUPOI.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-AQA2OWJV.js.map +0 -6
- package/dist/chunk-KRFJTXGW.js.map +0 -6
- /package/dist/{auth-ENMPCMEF.js.map → auth-YATT6SVI.js.map} +0 -0
- /package/dist/{chunk-GGTDQ3DB.js.map → chunk-BLPFUGNH.js.map} +0 -0
- /package/dist/{chunk-TEDLUC2N.js.map → chunk-QDOCN6Y6.js.map} +0 -0
- /package/dist/{chunk-HE6DDGRA.js.map → chunk-SLAL53ZC.js.map} +0 -0
- /package/dist/{git-credential-76LN5D43.js.map → git-credential-LWKMXX3S.js.map} +0 -0
- /package/dist/{mock-dep-resolve-6TFZKV6K.js.map → mock-dep-resolve-UAMQLI6X.js.map} +0 -0
- /package/dist/{open-api-client-PBYR7O3V.js.map → open-api-client-HVWBTRXF.js.map} +0 -0
- /package/dist/{remote-execute-H4ICLP2Z.js.map → remote-execute-JIL4G3OF.js.map} +0 -0
- /package/dist/{setup-git-VPH2XYYB.js.map → setup-git-6VJBUPOI.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
resolvePackagePublishTarget,
|
|
14
14
|
runCli,
|
|
15
15
|
shouldUseApiToken
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3B6YDTUS.js";
|
|
17
17
|
import "./chunk-2XPH7L2P.js";
|
|
18
18
|
import "./chunk-SLNAWWQK.js";
|
|
19
19
|
import "./chunk-YDWTXEKQ.js";
|
|
20
20
|
import {
|
|
21
21
|
resolveLocalExecuteBearer
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-SLAL53ZC.js";
|
|
23
23
|
import {
|
|
24
24
|
authBootstrap,
|
|
25
25
|
authBootstrapWithScopes,
|
|
@@ -31,12 +31,12 @@ import {
|
|
|
31
31
|
parseCliScopesFlag,
|
|
32
32
|
redeemBootstrapCode,
|
|
33
33
|
resolveCliTokenLifetime
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-BLPFUGNH.js";
|
|
35
35
|
import "./chunk-6ZYUGXVW.js";
|
|
36
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-QDOCN6Y6.js";
|
|
37
37
|
import "./chunk-CASGRYOF.js";
|
|
38
38
|
import "./chunk-ZILB2HWE.js";
|
|
39
|
-
import "./chunk-
|
|
39
|
+
import "./chunk-YKSELVAI.js";
|
|
40
40
|
import "./chunk-46IJPEID.js";
|
|
41
41
|
import "./chunk-PWWN6JI2.js";
|
|
42
42
|
import {
|
|
@@ -75,8 +75,8 @@ import {
|
|
|
75
75
|
import "./chunk-UW6AWLXX.js";
|
|
76
76
|
|
|
77
77
|
// src/dev-command.ts
|
|
78
|
-
import { access, mkdir as mkdir3, readFile as
|
|
79
|
-
import { dirname as dirname4, join as
|
|
78
|
+
import { access, mkdir as mkdir3, readFile as readFile6, rm as rm4, writeFile as writeFile4 } from "node:fs/promises";
|
|
79
|
+
import { dirname as dirname4, join as join10, resolve as resolve8 } from "node:path";
|
|
80
80
|
|
|
81
81
|
// src/credentialed-fetch-scan.ts
|
|
82
82
|
var esModuleLexerReady = init();
|
|
@@ -2400,11 +2400,11 @@ function createPattern(matcher) {
|
|
|
2400
2400
|
if (matcher.path === string)
|
|
2401
2401
|
return true;
|
|
2402
2402
|
if (matcher.recursive) {
|
|
2403
|
-
const
|
|
2404
|
-
if (!
|
|
2403
|
+
const relative7 = sysPath2.relative(matcher.path, string);
|
|
2404
|
+
if (!relative7) {
|
|
2405
2405
|
return false;
|
|
2406
2406
|
}
|
|
2407
|
-
return !
|
|
2407
|
+
return !relative7.startsWith("..") && !sysPath2.isAbsolute(relative7);
|
|
2408
2408
|
}
|
|
2409
2409
|
return false;
|
|
2410
2410
|
};
|
|
@@ -4996,6 +4996,62 @@ function joinUrlPath(base, path) {
|
|
|
4996
4996
|
return `${base}${rest === "/" ? "" : rest}` || base;
|
|
4997
4997
|
}
|
|
4998
4998
|
|
|
4999
|
+
// src/package-check-files.ts
|
|
5000
|
+
import { execFile } from "node:child_process";
|
|
5001
|
+
import { readdir as readdir4, readFile as readFile5 } from "node:fs/promises";
|
|
5002
|
+
import { join as join9, relative as relative6, sep as sep4 } from "node:path";
|
|
5003
|
+
import { promisify } from "node:util";
|
|
5004
|
+
var execFileAsync = promisify(execFile);
|
|
5005
|
+
var skippedDirectories = /* @__PURE__ */ new Set(["node_modules", ".git"]);
|
|
5006
|
+
async function listGitFiles(root) {
|
|
5007
|
+
try {
|
|
5008
|
+
const { stdout } = await execFileAsync(
|
|
5009
|
+
"git",
|
|
5010
|
+
["ls-files", "-z", "--cached", "--others", "--exclude-standard"],
|
|
5011
|
+
{ cwd: root, maxBuffer: 64 * 1024 * 1024 }
|
|
5012
|
+
);
|
|
5013
|
+
return stdout.split("\0").filter((path) => path.length > 0);
|
|
5014
|
+
} catch {
|
|
5015
|
+
return null;
|
|
5016
|
+
}
|
|
5017
|
+
}
|
|
5018
|
+
async function walkFiles(root, dir = root) {
|
|
5019
|
+
const entries = await readdir4(dir, { withFileTypes: true });
|
|
5020
|
+
const files = [];
|
|
5021
|
+
for (const entry of entries) {
|
|
5022
|
+
if (entry.isDirectory()) {
|
|
5023
|
+
if (skippedDirectories.has(entry.name)) continue;
|
|
5024
|
+
files.push(...await walkFiles(root, join9(dir, entry.name)));
|
|
5025
|
+
} else if (entry.isFile()) {
|
|
5026
|
+
files.push(relative6(root, join9(dir, entry.name)).split(sep4).join("/"));
|
|
5027
|
+
}
|
|
5028
|
+
}
|
|
5029
|
+
return files;
|
|
5030
|
+
}
|
|
5031
|
+
var utf8 = new TextDecoder("utf-8", { fatal: true });
|
|
5032
|
+
async function collectPackageCheckFiles(root) {
|
|
5033
|
+
const paths = await listGitFiles(root) ?? await walkFiles(root);
|
|
5034
|
+
const files = {};
|
|
5035
|
+
const skippedBinary = [];
|
|
5036
|
+
for (const path of paths.sort()) {
|
|
5037
|
+
if (path.split("/").some((segment) => skippedDirectories.has(segment))) {
|
|
5038
|
+
continue;
|
|
5039
|
+
}
|
|
5040
|
+
let bytes;
|
|
5041
|
+
try {
|
|
5042
|
+
bytes = await readFile5(join9(root, path));
|
|
5043
|
+
} catch {
|
|
5044
|
+
continue;
|
|
5045
|
+
}
|
|
5046
|
+
try {
|
|
5047
|
+
files[path] = utf8.decode(bytes);
|
|
5048
|
+
} catch {
|
|
5049
|
+
skippedBinary.push(path);
|
|
5050
|
+
}
|
|
5051
|
+
}
|
|
5052
|
+
return { files, skippedBinary };
|
|
5053
|
+
}
|
|
5054
|
+
|
|
4999
5055
|
// src/dev-command.ts
|
|
5000
5056
|
async function resolveDevAuth(input) {
|
|
5001
5057
|
if (input.target !== "mock") {
|
|
@@ -5319,7 +5375,7 @@ async function runDevWebhook(input) {
|
|
|
5319
5375
|
target: input.target
|
|
5320
5376
|
});
|
|
5321
5377
|
}
|
|
5322
|
-
const rawBody = await
|
|
5378
|
+
const rawBody = await readFile6(
|
|
5323
5379
|
resolve8(input.cwd ?? process.cwd(), input.bodyPath),
|
|
5324
5380
|
"utf8"
|
|
5325
5381
|
);
|
|
@@ -5390,7 +5446,7 @@ async function runDevEmit(input) {
|
|
|
5390
5446
|
target: input.target
|
|
5391
5447
|
});
|
|
5392
5448
|
}
|
|
5393
|
-
const rawBody = await
|
|
5449
|
+
const rawBody = await readFile6(
|
|
5394
5450
|
resolve8(input.cwd ?? process.cwd(), input.bodyPath),
|
|
5395
5451
|
"utf8"
|
|
5396
5452
|
);
|
|
@@ -5444,6 +5500,25 @@ async function runDevEmit(input) {
|
|
|
5444
5500
|
surface: `subscription:${input.event}`
|
|
5445
5501
|
});
|
|
5446
5502
|
}
|
|
5503
|
+
var devCheckOfflineDetail = "skipped (--offline). Only local checks ran; publish runs the full publish checks and can still refuse this package.";
|
|
5504
|
+
function parsePackageCheckResult(value) {
|
|
5505
|
+
const body = value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
5506
|
+
const checks = Array.isArray(body?.checks) ? body.checks : null;
|
|
5507
|
+
if (!body || typeof body.ok !== "boolean" || !checks) {
|
|
5508
|
+
throw new Error("packageCheck returned an unexpected response.");
|
|
5509
|
+
}
|
|
5510
|
+
return {
|
|
5511
|
+
ok: body.ok,
|
|
5512
|
+
checks: checks.map((entry) => {
|
|
5513
|
+
const check = entry ?? {};
|
|
5514
|
+
return {
|
|
5515
|
+
kind: typeof check.kind === "string" ? check.kind : "unknown",
|
|
5516
|
+
ok: check.ok === true,
|
|
5517
|
+
message: typeof check.message === "string" ? check.message : ""
|
|
5518
|
+
};
|
|
5519
|
+
})
|
|
5520
|
+
};
|
|
5521
|
+
}
|
|
5447
5522
|
async function runDevCheck(input) {
|
|
5448
5523
|
const manifest = await loadPackageManifest(input.cwd);
|
|
5449
5524
|
const checks = [];
|
|
@@ -5477,13 +5552,13 @@ async function runDevCheck(input) {
|
|
|
5477
5552
|
push("package.json", true, manifest.name);
|
|
5478
5553
|
push("kody.id", Boolean(manifest.kodyId), manifest.kodyId);
|
|
5479
5554
|
try {
|
|
5480
|
-
await
|
|
5555
|
+
await readFile6(resolve8(manifest.root, "README.md"));
|
|
5481
5556
|
push("README.md", true);
|
|
5482
5557
|
} catch {
|
|
5483
5558
|
push("README.md", false, "Publish requires README.md");
|
|
5484
5559
|
}
|
|
5485
5560
|
try {
|
|
5486
|
-
await
|
|
5561
|
+
await readFile6(resolve8(manifest.root, "AGENTS.md"));
|
|
5487
5562
|
push("AGENTS.md", true);
|
|
5488
5563
|
} catch {
|
|
5489
5564
|
push("AGENTS.md", false, "Publish requires AGENTS.md");
|
|
@@ -5516,7 +5591,7 @@ async function runDevCheck(input) {
|
|
|
5516
5591
|
}
|
|
5517
5592
|
let hasMocksFile = false;
|
|
5518
5593
|
try {
|
|
5519
|
-
await access(
|
|
5594
|
+
await access(join10(manifest.root, packageMocksRelativePath));
|
|
5520
5595
|
hasMocksFile = true;
|
|
5521
5596
|
} catch {
|
|
5522
5597
|
hasMocksFile = false;
|
|
@@ -5534,6 +5609,41 @@ async function runDevCheck(input) {
|
|
|
5534
5609
|
if (fetchBodyWarning) {
|
|
5535
5610
|
push("secret-resolution", true, fetchBodyWarning, "warning");
|
|
5536
5611
|
}
|
|
5612
|
+
let publishChecksOk = null;
|
|
5613
|
+
if (input.offline) {
|
|
5614
|
+
push("publish checks", true, devCheckOfflineDetail, "warning");
|
|
5615
|
+
} else if (!input.runPublishChecks) {
|
|
5616
|
+
push(
|
|
5617
|
+
"publish checks",
|
|
5618
|
+
false,
|
|
5619
|
+
"not run. Sign in with `kody login` (or pass --token), or pass --offline to run only the local checks."
|
|
5620
|
+
);
|
|
5621
|
+
} else {
|
|
5622
|
+
try {
|
|
5623
|
+
const tree = await collectPackageCheckFiles(manifest.root);
|
|
5624
|
+
const outcome = await input.runPublishChecks(tree.files);
|
|
5625
|
+
publishChecksOk = outcome.ok;
|
|
5626
|
+
for (const check of outcome.checks) {
|
|
5627
|
+
push(`publish:${check.kind}`, check.ok, check.message || void 0);
|
|
5628
|
+
}
|
|
5629
|
+
if (!outcome.ok && !outcome.checks.some((check) => !check.ok)) {
|
|
5630
|
+
push("publish checks", false, "publish checks failed");
|
|
5631
|
+
}
|
|
5632
|
+
if (tree.skippedBinary.length > 0) {
|
|
5633
|
+
push(
|
|
5634
|
+
"publish checks",
|
|
5635
|
+
true,
|
|
5636
|
+
`left out ${tree.skippedBinary.length} binary file(s); they only count toward publish size limits`
|
|
5637
|
+
);
|
|
5638
|
+
}
|
|
5639
|
+
} catch (error) {
|
|
5640
|
+
push(
|
|
5641
|
+
"publish checks",
|
|
5642
|
+
false,
|
|
5643
|
+
`could not run: ${error instanceof Error ? error.message : String(error)}. Sign in with \`kody login\` (or pass --token), or pass --offline to run only the local checks.`
|
|
5644
|
+
);
|
|
5645
|
+
}
|
|
5646
|
+
}
|
|
5537
5647
|
const failed = checks.filter((check) => !check.ok);
|
|
5538
5648
|
if (input.json) {
|
|
5539
5649
|
input.io.stdout(
|
|
@@ -5542,6 +5652,7 @@ async function runDevCheck(input) {
|
|
|
5542
5652
|
target: input.target,
|
|
5543
5653
|
checks,
|
|
5544
5654
|
ok: failed.length === 0,
|
|
5655
|
+
publishChecks: input.offline ? { ran: false, skipped: "offline" } : { ran: publishChecksOk !== null, ok: publishChecksOk },
|
|
5545
5656
|
...credentialSignals.length > 0 ? {
|
|
5546
5657
|
credentialedFetch: {
|
|
5547
5658
|
detected: true,
|
|
@@ -5670,15 +5781,17 @@ function parseDevSubcommand(positionals) {
|
|
|
5670
5781
|
}
|
|
5671
5782
|
async function removeOwnedReadyFile(path, ownerPid) {
|
|
5672
5783
|
try {
|
|
5673
|
-
const parsed = JSON.parse(await
|
|
5784
|
+
const parsed = JSON.parse(await readFile6(path, "utf8"));
|
|
5674
5785
|
if (parsed.pid !== ownerPid) return;
|
|
5675
5786
|
await rm4(path, { force: true });
|
|
5676
5787
|
} catch {
|
|
5677
5788
|
}
|
|
5678
5789
|
}
|
|
5679
5790
|
export {
|
|
5791
|
+
devCheckOfflineDetail,
|
|
5680
5792
|
parseDevPort,
|
|
5681
5793
|
parseDevSubcommand,
|
|
5794
|
+
parsePackageCheckResult,
|
|
5682
5795
|
removeOwnedReadyFile,
|
|
5683
5796
|
resolveDevAuth,
|
|
5684
5797
|
runDevCheck,
|
|
@@ -5694,4 +5807,4 @@ export {
|
|
|
5694
5807
|
chokidar/esm/index.js:
|
|
5695
5808
|
(*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
|
|
5696
5809
|
*/
|
|
5697
|
-
//# sourceMappingURL=dev-command-
|
|
5810
|
+
//# sourceMappingURL=dev-command-LD5YHNKH.js.map
|