Prepare v0.10.36 release changes
This commit is contained in:
1 parent
37f5567ab5
commit
e52e145eba
14 files changed
+218
-197
No files matched your search
@@ -61,8 +61,9 @@ export async function handleRulesCommand(
|
||||
}
|
||||
|
||||
const result = await runToolResult("seal_approval_rules_list", client, corp, { limit, offset });
|
||||
protectLargeRuleListOutput(result, booleanOption(args.options.full) === true);
|
||||
printJson(result);
|
||||
const output = outputOptions(args.options);
|
||||
protectLargeRuleListOutput(result, output.allowFull === true || Boolean(output.outputFile));
|
||||
printJson(result, output);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -416,6 +416,20 @@ function homebrewFormulaPrefix(): string | undefined {
|
||||
}
|
||||
}
|
||||
|
||||
function homebrewInstalledVersion(): string | undefined {
|
||||
try {
|
||||
const result = spawnSync("brew", ["list", "--versions", "seal-use"], {
|
||||
stdio: ["ignore", "pipe", "ignore"],
|
||||
encoding: "utf-8"
|
||||
});
|
||||
if (result.status !== 0 || typeof result.stdout !== "string") return undefined;
|
||||
const parts = result.stdout.trim().split(/\s+/);
|
||||
return parts.length >= 2 ? parts[parts.length - 1] : undefined;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export function isHomebrewInstall(
|
||||
execPath = process.execPath,
|
||||
formulaPrefix = homebrewFormulaPrefix()
|
||||
@@ -500,16 +514,22 @@ async function handleHomebrewUpdate(
|
||||
}
|
||||
|
||||
console.error("ℹ️ 检测到当前 seal-use 由 Homebrew 管理。");
|
||||
console.error("📦 正在通过 Homebrew 极速更新: brew update yunyingk/tap && brew upgrade seal-use ...");
|
||||
console.error("📦 正在通过 Homebrew 极速更新: brew update && brew upgrade seal-use ...");
|
||||
|
||||
const wasRunning = serviceStatus(serviceConfig).running;
|
||||
if (wasRunning) await runServiceCommand("stop", serviceConfig);
|
||||
|
||||
let alreadyLatest = false;
|
||||
const installedBefore = homebrewInstalledVersion();
|
||||
const alreadyLatestBeforeUpdate = installedBefore
|
||||
? !isNewerVersion(latestVersion, installedBefore)
|
||||
: false;
|
||||
let alreadyLatest = alreadyLatestBeforeUpdate;
|
||||
let updateError: unknown;
|
||||
try {
|
||||
// 1. Fast update of the dedicated tap
|
||||
const tapUpdate = spawnSync("brew", ["update", "yunyingk/tap"], {
|
||||
// `brew update` refreshes all configured taps. Passing a tap name here is
|
||||
// parsed as a formula upgrade by newer Homebrew versions (and fails with
|
||||
// "No available formula ... tap").
|
||||
const tapUpdate = spawnSync("brew", ["update"], {
|
||||
stdio: ["ignore", "pipe", "pipe"],
|
||||
encoding: "utf-8",
|
||||
env: { ...process.env, NONINTERACTIVE: "1" }
|
||||
@@ -517,7 +537,7 @@ async function handleHomebrewUpdate(
|
||||
|
||||
if (tapUpdate.status !== 0) {
|
||||
const msg = tapUpdate.stderr?.trim() || tapUpdate.stdout?.trim();
|
||||
if (msg) console.error(`⚠️ brew update yunyingk/tap 提示: ${msg}`);
|
||||
throw new Error(`brew update failed (exit ${tapUpdate.status}): ${msg || "unknown error"}`);
|
||||
}
|
||||
|
||||
// 2. Upgrade the formula
|
||||
@@ -528,14 +548,23 @@ async function handleHomebrewUpdate(
|
||||
});
|
||||
|
||||
const outCombined = `${upgradeRes.stdout || ""} ${upgradeRes.stderr || ""}`;
|
||||
alreadyLatest =
|
||||
const brewReportsAlreadyLatest =
|
||||
outCombined.includes("already installed") || outCombined.includes("latest version already installed");
|
||||
|
||||
if (upgradeRes.status !== 0 && !alreadyLatest) {
|
||||
if (upgradeRes.status !== 0 && !brewReportsAlreadyLatest) {
|
||||
throw new Error(
|
||||
`brew upgrade seal-use failed (exit ${upgradeRes.status}): ${upgradeRes.stderr?.trim() || upgradeRes.stdout?.trim()}`
|
||||
);
|
||||
}
|
||||
|
||||
const installedVersion = homebrewInstalledVersion();
|
||||
if (installedVersion && isNewerVersion(latestVersion, installedVersion)) {
|
||||
throw new Error(
|
||||
`Homebrew still has seal-use v${installedVersion}; expected v${latestVersion}. ` +
|
||||
"Refresh the tap and run `brew upgrade seal-use` again."
|
||||
);
|
||||
}
|
||||
alreadyLatest = alreadyLatestBeforeUpdate;
|
||||
} catch (err) {
|
||||
updateError = err;
|
||||
throw err;
|
||||
@@ -560,10 +589,14 @@ async function handleHomebrewUpdate(
|
||||
// best-effort
|
||||
}
|
||||
|
||||
console.error("✅ seal-use 已通过 Homebrew 成功更新!");
|
||||
console.error(
|
||||
alreadyLatest
|
||||
? "ℹ️ seal-use 已是 Homebrew 中的最新版本。"
|
||||
: "✅ seal-use 已通过 Homebrew 成功更新!"
|
||||
);
|
||||
|
||||
printJson({
|
||||
updated: true,
|
||||
updated: !alreadyLatest,
|
||||
previousVersion: VERSION,
|
||||
latestVersion,
|
||||
mode: "homebrew",
|
||||
|
||||
+11
-5
@@ -219,12 +219,13 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
{
|
||||
name: "list",
|
||||
summary: "List approval rules with optional pagination and summary",
|
||||
usage: ["seal-use rules list [--summary] [--count] [--limit 20] [--offset 0] [--corp <corpId>]"],
|
||||
usage: ["seal-use rules list [--summary] [--count] [--limit 20] [--offset 0] [--output-file <path>] [--corp <corpId>]"],
|
||||
options: [
|
||||
{ flag: "--summary", description: "Output compact summary fields (id, code, strictness, scope)" },
|
||||
{ flag: "--summary", description: "Output compact summary fields (code, status, strictness, scope, updatedAt)" },
|
||||
{ flag: "--limit <n>", description: "Number of rules to fetch (default: 20)" },
|
||||
{ flag: "--offset <n>", description: "Offset index for pagination" },
|
||||
{ flag: "--full", description: "Allow large payloads beyond standard size limits" }
|
||||
{ flag: "--full", description: "Allow large payloads beyond standard size limits" },
|
||||
{ flag: "--output-file <path>", description: "Write the complete JSON payload to a file" }
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -258,7 +259,7 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
{
|
||||
name: "lint",
|
||||
summary: "Lint rule text or rule file using builtin or custom linter",
|
||||
usage: ["seal-use rules lint [--file <path>] [--linter <name|path>] [--min-score <score>] [--corp <corpId>]"]
|
||||
usage: ["seal-use rules lint [--file <path>] [--linter <name|path>] [--version <id|num|latest>] [--code <code>] [--rule <ruleId>] [--min-score <score>] [--level all|error|warning] [--summary] [--corp <corpId>]"]
|
||||
},
|
||||
{
|
||||
name: "linters",
|
||||
@@ -268,12 +269,17 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
{
|
||||
name: "pull",
|
||||
summary: "Export rules to local JSON file",
|
||||
usage: ["seal-use rules pull [--out <file>] [--corp <corpId>]"]
|
||||
usage: ["seal-use rules pull [--version <id|num|latest>] [--out <file>] [--corp <corpId>]"]
|
||||
},
|
||||
{
|
||||
name: "push",
|
||||
summary: "Push rules from local JSON file to enterprise draft space",
|
||||
usage: ["seal-use rules push --file <path> [--publish] [--version-name <name>] [--dry-run|--yes] [--corp <corpId>]"]
|
||||
},
|
||||
{
|
||||
name: "map",
|
||||
summary: "Inspect locally synced production/test rule code mappings",
|
||||
usage: ["seal-use rules map [--version <id|num|latest>] [--code <code>] [--corp <corpId>]"]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
+1
-2
@@ -58,7 +58,7 @@ export function protectLargeRuleListOutput(result: unknown, allowFull: boolean)
|
||||
|
||||
if (effectiveCount > RULE_LIST_FULL_COUNT_LIMIT || bodyBytes > RULE_LIST_FULL_BYTES_LIMIT) {
|
||||
throw new PayloadTooLargeError(
|
||||
`Rule list is large (${effectiveCount} rules, ${bodyBytes} bytes). Use "seal-use rules list --summary" or "seal-use rules count"; pass --full only when you really need full descriptions.`,
|
||||
`Rule list is large (${effectiveCount} rules, ${bodyBytes} bytes). Use "seal-use rules list --summary", "seal-use rules count", or --output-file; pass --full only when you really need full descriptions.`,
|
||||
"seal-use rules list --summary"
|
||||
);
|
||||
}
|
||||
@@ -76,4 +76,3 @@ import { renderHelp } from "./help.js";
|
||||
export function printHelp(target: string[] = []) {
|
||||
console.log(renderHelp(target));
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ const AREA_ALIASES: Record<string, string> = {
|
||||
*/
|
||||
const READ_ONLY_COMMANDS: Record<string, string[]> = {
|
||||
corps: ["list", "search", "get", "current"],
|
||||
rules: ["count", "list", "versions", "version", "get", "search", "lint", "linters", "pull"],
|
||||
rules: ["count", "list", "versions", "version", "get", "search", "lint", "linters", "pull", "map"],
|
||||
webhook: ["ready", "status", "list", "get", "resource-pack export", "resource-pack preview"],
|
||||
"approval-runs": [
|
||||
"summary",
|
||||
|
||||
Reference in new issue
Block a user