@cnwenf/occ 2.1.300 → 2.1.301
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +137 -23
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
globalThis.MACRO={"VERSION":"2.1.
|
|
2
|
+
globalThis.MACRO={"VERSION":"2.1.301","BINARY_NAME":"occ","BUILD_TIME":"2026-08-14T18:51:25.355Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
|
|
3
3
|
// @bun
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -53615,12 +53615,13 @@ __export(exports_git, {
|
|
|
53615
53615
|
getChangedFiles: () => getChangedFiles,
|
|
53616
53616
|
getBranch: () => getBranch,
|
|
53617
53617
|
findRemoteBase: () => findRemoteBase,
|
|
53618
|
+
findGitRootUncached: () => findGitRootUncached,
|
|
53618
53619
|
findGitRoot: () => findGitRoot,
|
|
53619
53620
|
findCanonicalGitRoot: () => findCanonicalGitRoot,
|
|
53620
53621
|
dirIsInGitRepo: () => dirIsInGitRepo
|
|
53621
53622
|
});
|
|
53622
53623
|
import { createHash } from "crypto";
|
|
53623
|
-
import { readFileSync as readFileSync5, realpathSync as realpathSync3, statSync as statSync4 } from "fs";
|
|
53624
|
+
import { lstatSync as lstatSync2, readFileSync as readFileSync5, realpathSync as realpathSync3, statSync as statSync4 } from "fs";
|
|
53624
53625
|
import { open as open2, readFile as readFile5, realpath as realpath3, stat as stat4 } from "fs/promises";
|
|
53625
53626
|
import { basename as basename3, dirname as dirname8, join as join14, resolve as resolve6, sep as sep3 } from "path";
|
|
53626
53627
|
function createFindGitRoot() {
|
|
@@ -53631,6 +53632,35 @@ function createFindGitRoot() {
|
|
|
53631
53632
|
wrapper.cache = findGitRootImpl.cache;
|
|
53632
53633
|
return wrapper;
|
|
53633
53634
|
}
|
|
53635
|
+
function findGitRootUncached(startPath) {
|
|
53636
|
+
let current = resolve6(startPath);
|
|
53637
|
+
const root2 = current.substring(0, current.indexOf(sep3) + 1) || sep3;
|
|
53638
|
+
while (current !== root2) {
|
|
53639
|
+
if (isGitRootForTrust(current)) {
|
|
53640
|
+
return current.normalize("NFC");
|
|
53641
|
+
}
|
|
53642
|
+
const parent = dirname8(current);
|
|
53643
|
+
if (parent === current) {
|
|
53644
|
+
break;
|
|
53645
|
+
}
|
|
53646
|
+
current = parent;
|
|
53647
|
+
}
|
|
53648
|
+
if (isGitRootForTrust(root2)) {
|
|
53649
|
+
return root2.normalize("NFC");
|
|
53650
|
+
}
|
|
53651
|
+
return null;
|
|
53652
|
+
}
|
|
53653
|
+
function isGitRootForTrust(dir) {
|
|
53654
|
+
try {
|
|
53655
|
+
const s = lstatSync2(join14(dir, ".git"));
|
|
53656
|
+
if (s.isSymbolicLink()) {
|
|
53657
|
+
return false;
|
|
53658
|
+
}
|
|
53659
|
+
return s.isDirectory() || s.isFile();
|
|
53660
|
+
} catch {
|
|
53661
|
+
return false;
|
|
53662
|
+
}
|
|
53663
|
+
}
|
|
53634
53664
|
function createFindCanonicalGitRoot() {
|
|
53635
53665
|
function wrapper(startPath) {
|
|
53636
53666
|
const root2 = findGitRoot(startPath);
|
|
@@ -152932,31 +152962,44 @@ function computeTrustDialogAccepted() {
|
|
|
152932
152962
|
if (projectConfig?.hasTrustDialogAccepted) {
|
|
152933
152963
|
return true;
|
|
152934
152964
|
}
|
|
152935
|
-
|
|
152965
|
+
const resolvedCwd = resolve9(getCwd());
|
|
152966
|
+
const repoRoot = findGitRootUncached(resolvedCwd);
|
|
152967
|
+
const boundary = repoRoot !== null ? normalizePathForConfigKey(resolve9(repoRoot)) : null;
|
|
152968
|
+
return walkAncestorsForTrust(config4, resolvedCwd, boundary);
|
|
152969
|
+
}
|
|
152970
|
+
function walkAncestorsForTrust(config4, startPath, boundary) {
|
|
152971
|
+
let currentPath = normalizePathForConfigKey(startPath);
|
|
152936
152972
|
while (true) {
|
|
152937
|
-
|
|
152938
|
-
|
|
152973
|
+
if (!(boundary === null || currentPath === boundary || currentPath.startsWith(boundary.endsWith("/") ? boundary : `${boundary}/`))) {
|
|
152974
|
+
return false;
|
|
152975
|
+
}
|
|
152976
|
+
if (config4.projects?.[currentPath]?.hasTrustDialogAccepted) {
|
|
152939
152977
|
return true;
|
|
152940
152978
|
}
|
|
152979
|
+
if (currentPath === boundary) {
|
|
152980
|
+
return false;
|
|
152981
|
+
}
|
|
152941
152982
|
const parentPath = normalizePathForConfigKey(resolve9(currentPath, ".."));
|
|
152942
152983
|
if (parentPath === currentPath) {
|
|
152943
|
-
|
|
152984
|
+
return false;
|
|
152944
152985
|
}
|
|
152945
152986
|
currentPath = parentPath;
|
|
152946
152987
|
}
|
|
152947
|
-
return false;
|
|
152948
152988
|
}
|
|
152949
|
-
function isPathTrusted(dir) {
|
|
152989
|
+
function isPathTrusted(dir, opts = {}) {
|
|
152950
152990
|
const config4 = getGlobalConfig();
|
|
152951
|
-
|
|
152952
|
-
|
|
152953
|
-
if (config4.projects?.[currentPath]?.hasTrustDialogAccepted)
|
|
152954
|
-
return true;
|
|
152955
|
-
const parentPath = normalizePathForConfigKey(resolve9(currentPath, ".."));
|
|
152956
|
-
if (parentPath === currentPath)
|
|
152957
|
-
return false;
|
|
152958
|
-
currentPath = parentPath;
|
|
152991
|
+
if (opts.advisoryNoFsProbe) {
|
|
152992
|
+
return walkAncestorsForTrust(config4, resolve9(dir), null);
|
|
152959
152993
|
}
|
|
152994
|
+
const canonicalRoot = findCanonicalGitRoot(dir);
|
|
152995
|
+
const persistKey = normalizePathForConfigKey(canonicalRoot !== null ? resolve9(canonicalRoot) : resolve9(dir));
|
|
152996
|
+
if (config4.projects?.[persistKey]?.hasTrustDialogAccepted === true) {
|
|
152997
|
+
return true;
|
|
152998
|
+
}
|
|
152999
|
+
const resolved = resolve9(dir);
|
|
153000
|
+
const repoRoot = findGitRootUncached(resolved);
|
|
153001
|
+
const boundary = repoRoot !== null ? normalizePathForConfigKey(resolve9(repoRoot)) : null;
|
|
153002
|
+
return walkAncestorsForTrust(config4, resolved, boundary);
|
|
152960
153003
|
}
|
|
152961
153004
|
function isProjectConfigKey(key) {
|
|
152962
153005
|
return PROJECT_CONFIG_KEYS.includes(key);
|
|
@@ -201262,7 +201305,7 @@ __export(exports_sandbox_adapter, {
|
|
|
201262
201305
|
SandboxRuntimeConfigSchema: () => SandboxRuntimeConfigSchema,
|
|
201263
201306
|
SandboxManager: () => SandboxManager2
|
|
201264
201307
|
});
|
|
201265
|
-
import { lstatSync as
|
|
201308
|
+
import { lstatSync as lstatSync4, readdirSync as readdirSync4, realpathSync as realpathSync6, rmSync as rmSync4, statSync as statSync8 } from "fs";
|
|
201266
201309
|
import { readFile as readFile15 } from "fs/promises";
|
|
201267
201310
|
import { join as join39, resolve as resolve17, sep as sep9 } from "path";
|
|
201268
201311
|
function permissionRuleValueFromString2(ruleString) {
|
|
@@ -201425,7 +201468,7 @@ function convertToSandboxRuntimeConfig(settings) {
|
|
|
201425
201468
|
}
|
|
201426
201469
|
}
|
|
201427
201470
|
const { rgPath, rgArgs, argv0 } = ripgrepCommand();
|
|
201428
|
-
const ripgrepConfig =
|
|
201471
|
+
const ripgrepConfig = ["policySettings", "flagSettings", "userSettings"].map((source) => getSettingsForSource(source)?.sandbox?.ripgrep).find((config5) => config5 !== undefined) ?? {
|
|
201429
201472
|
command: rgPath,
|
|
201430
201473
|
args: rgArgs,
|
|
201431
201474
|
argv0
|
|
@@ -201465,7 +201508,7 @@ function reconcileClaudeSymlinks(dirs) {
|
|
|
201465
201508
|
for (const name3 of entries) {
|
|
201466
201509
|
const entryPath = join39(claudeDir, name3);
|
|
201467
201510
|
try {
|
|
201468
|
-
if (!
|
|
201511
|
+
if (!lstatSync4(entryPath).isSymbolicLink()) {
|
|
201469
201512
|
continue;
|
|
201470
201513
|
}
|
|
201471
201514
|
} catch {
|
|
@@ -372210,7 +372253,9 @@ function ruleIdToLabel(ruleId) {
|
|
|
372210
372253
|
digitalocean: "DigitalOcean",
|
|
372211
372254
|
huggingface: "HuggingFace",
|
|
372212
372255
|
hashicorp: "HashiCorp",
|
|
372213
|
-
sendgrid: "SendGrid"
|
|
372256
|
+
sendgrid: "SendGrid",
|
|
372257
|
+
ci: "CI",
|
|
372258
|
+
scim: "SCIM"
|
|
372214
372259
|
};
|
|
372215
372260
|
return ruleId.split("-").map((part) => specialCase[part] ?? capitalize(part)).join(" ");
|
|
372216
372261
|
}
|
|
@@ -372241,7 +372286,7 @@ function redactSecrets(content) {
|
|
|
372241
372286
|
}
|
|
372242
372287
|
return content;
|
|
372243
372288
|
}
|
|
372244
|
-
var ANT_KEY_PFX, SECRET_RULES, compiledRules = null, redactRules = null;
|
|
372289
|
+
var ANT_KEY_PFX, GITLAB_TOKEN_BODY = "[\\w=-]{20,}(?:\\.[0-9a-z]{9})?", SECRET_RULES, compiledRules = null, redactRules = null;
|
|
372245
372290
|
var init_secretScanner = __esm(() => {
|
|
372246
372291
|
init_stringUtils();
|
|
372247
372292
|
ANT_KEY_PFX = ["sk", "ant", "api"].join("-");
|
|
@@ -372304,11 +372349,47 @@ var init_secretScanner = __esm(() => {
|
|
|
372304
372349
|
},
|
|
372305
372350
|
{
|
|
372306
372351
|
id: "gitlab-pat",
|
|
372307
|
-
source:
|
|
372352
|
+
source: `glpat-${GITLAB_TOKEN_BODY}`
|
|
372308
372353
|
},
|
|
372309
372354
|
{
|
|
372310
372355
|
id: "gitlab-deploy-token",
|
|
372311
|
-
source:
|
|
372356
|
+
source: `gldt-${GITLAB_TOKEN_BODY}`
|
|
372357
|
+
},
|
|
372358
|
+
{
|
|
372359
|
+
id: "gitlab-runner-authentication-token",
|
|
372360
|
+
source: `glrt-${GITLAB_TOKEN_BODY}`
|
|
372361
|
+
},
|
|
372362
|
+
{
|
|
372363
|
+
id: "gitlab-oauth-app-secret",
|
|
372364
|
+
source: `gloas-${GITLAB_TOKEN_BODY}`
|
|
372365
|
+
},
|
|
372366
|
+
{
|
|
372367
|
+
id: "gitlab-pipeline-trigger-token",
|
|
372368
|
+
source: `glptt-${GITLAB_TOKEN_BODY}`
|
|
372369
|
+
},
|
|
372370
|
+
{
|
|
372371
|
+
id: "gitlab-kubernetes-agent-token",
|
|
372372
|
+
source: `glagent-${GITLAB_TOKEN_BODY}`
|
|
372373
|
+
},
|
|
372374
|
+
{
|
|
372375
|
+
id: "gitlab-incoming-mail-token",
|
|
372376
|
+
source: `glimt-${GITLAB_TOKEN_BODY}`
|
|
372377
|
+
},
|
|
372378
|
+
{
|
|
372379
|
+
id: "gitlab-scim-oauth-token",
|
|
372380
|
+
source: `glsoat-${GITLAB_TOKEN_BODY}`
|
|
372381
|
+
},
|
|
372382
|
+
{
|
|
372383
|
+
id: "gitlab-ci-build-token",
|
|
372384
|
+
source: `glcbt-${GITLAB_TOKEN_BODY}`
|
|
372385
|
+
},
|
|
372386
|
+
{
|
|
372387
|
+
id: "gitlab-feed-token",
|
|
372388
|
+
source: `glft-${GITLAB_TOKEN_BODY}`
|
|
372389
|
+
},
|
|
372390
|
+
{
|
|
372391
|
+
id: "gitlab-feature-flag-client-token",
|
|
372392
|
+
source: `glffct-${GITLAB_TOKEN_BODY}`
|
|
372312
372393
|
},
|
|
372313
372394
|
{
|
|
372314
372395
|
id: "slack-bot-token",
|
|
@@ -379587,6 +379668,33 @@ function validateOutputRedirections(redirections, cwd2, toolPermissionContext, c
|
|
|
379587
379668
|
message: "No unsafe redirections found"
|
|
379588
379669
|
};
|
|
379589
379670
|
}
|
|
379671
|
+
function validateInputRedirections(astRedirects, cwd2, toolPermissionContext) {
|
|
379672
|
+
for (const r4 of astRedirects) {
|
|
379673
|
+
if (r4.op !== "<" || r4.target === "/dev/null") {
|
|
379674
|
+
continue;
|
|
379675
|
+
}
|
|
379676
|
+
const { allowed, resolvedPath, decisionReason } = validatePath(r4.target, cwd2, toolPermissionContext, "read");
|
|
379677
|
+
if (allowed) {
|
|
379678
|
+
continue;
|
|
379679
|
+
}
|
|
379680
|
+
const message = decisionReason?.type === "other" || decisionReason?.type === "safetyCheck" ? decisionReason.reason : decisionReason?.type === "rule" ? `Input redirection from '${resolvedPath}' was blocked by a deny rule.` : `Input redirection from '${resolvedPath}' was blocked. For security, Claude Code may only read files in the allowed working directories for this session.`;
|
|
379681
|
+
if (decisionReason?.type === "rule") {
|
|
379682
|
+
return { behavior: "deny", message, decisionReason };
|
|
379683
|
+
}
|
|
379684
|
+
const suggestion = decisionReason === undefined ? createReadRuleSuggestion(getDirectoryForPath(resolvedPath), "session") : undefined;
|
|
379685
|
+
return {
|
|
379686
|
+
behavior: "ask",
|
|
379687
|
+
message,
|
|
379688
|
+
blockedPath: resolvedPath,
|
|
379689
|
+
decisionReason,
|
|
379690
|
+
...suggestion !== undefined && { suggestions: [suggestion] }
|
|
379691
|
+
};
|
|
379692
|
+
}
|
|
379693
|
+
return {
|
|
379694
|
+
behavior: "passthrough",
|
|
379695
|
+
message: "No unsafe input redirections found"
|
|
379696
|
+
};
|
|
379697
|
+
}
|
|
379590
379698
|
function checkPathConstraints(input, cwd2, toolPermissionContext, compoundCommandHasCd, astRedirects, astCommands) {
|
|
379591
379699
|
if (!astCommands && />>\s*>\s*\(|>\s*>\s*\(|<\s*\(/.test(input.command)) {
|
|
379592
379700
|
return {
|
|
@@ -379613,6 +379721,12 @@ function checkPathConstraints(input, cwd2, toolPermissionContext, compoundComman
|
|
|
379613
379721
|
if (redirectionResult.behavior !== "passthrough") {
|
|
379614
379722
|
return redirectionResult;
|
|
379615
379723
|
}
|
|
379724
|
+
if (astRedirects) {
|
|
379725
|
+
const inputRedirectResult = validateInputRedirections(astRedirects, cwd2, toolPermissionContext);
|
|
379726
|
+
if (inputRedirectResult.behavior !== "passthrough") {
|
|
379727
|
+
return inputRedirectResult;
|
|
379728
|
+
}
|
|
379729
|
+
}
|
|
379616
379730
|
if (astCommands) {
|
|
379617
379731
|
for (const cmd of astCommands) {
|
|
379618
379732
|
const result = validateSinglePathCommandArgv(cmd, cwd2, toolPermissionContext, compoundCommandHasCd);
|