costclaw 0.16.1 → 0.16.2
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/index.js +39 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6337,6 +6337,12 @@ async function applyDerivedSettings(target, suggestedJson) {
|
|
|
6337
6337
|
mergedPerms.deny = unionStrings(asStringArray(existingPerms.deny), suggestedDeny);
|
|
6338
6338
|
const merged = { ...existing, permissions: mergedPerms };
|
|
6339
6339
|
const mergedText = JSON.stringify(merged, null, 2) + "\n";
|
|
6340
|
+
if (mergedText === existingText) {
|
|
6341
|
+
return {
|
|
6342
|
+
lines: [`${target} already has every derived permission; nothing to merge.`],
|
|
6343
|
+
file: null
|
|
6344
|
+
};
|
|
6345
|
+
}
|
|
6340
6346
|
await mkdir4(dirname3(target), { recursive: true });
|
|
6341
6347
|
const backup = await backupFile(target);
|
|
6342
6348
|
await writeFile4(target, mergedText, "utf8");
|
|
@@ -7060,22 +7066,26 @@ td code.cmd{margin-top:0;font-size:.78rem;white-space:pre-wrap;word-break:break-
|
|
|
7060
7066
|
.state.on{color:var(--good);font-weight:650}
|
|
7061
7067
|
.state.off{color:var(--ink2)}
|
|
7062
7068
|
|
|
7063
|
-
/* What changed: one
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
details.chg>summary:hover{border-color:var(--accent)}
|
|
7072
|
-
details.chg>ul{margin:0;padding:0 18px 10px 40px;font-size:.88rem}
|
|
7069
|
+
/* What changed: one always-open block per project, each holding real diffs.
|
|
7070
|
+
The project name is a link to that project's report, not a toggle. */
|
|
7071
|
+
.chg{border:1px solid var(--line);border-radius:10px;margin:0 0 10px;background:var(--panel)}
|
|
7072
|
+
.chghead{padding:10px 14px;display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
|
|
7073
|
+
.chgname{font-weight:650;font-size:.95rem;color:var(--ink);text-decoration:none}
|
|
7074
|
+
a.chgname{border-bottom:1px solid var(--line);padding-bottom:1px}
|
|
7075
|
+
a.chgname:hover{border-color:var(--accent);color:var(--accent)}
|
|
7076
|
+
.chg>ul{margin:0;padding:0 18px 10px 32px;font-size:.88rem}
|
|
7073
7077
|
.chgstat{font-size:.78rem;color:var(--ink2);font-family:var(--mono)}
|
|
7074
7078
|
.plus{color:var(--good);font-weight:650}
|
|
7075
7079
|
.minus{color:var(--bad);font-weight:650}
|
|
7076
|
-
.filediff{margin:0 14px 14px;border:1px solid var(--line);border-radius:9px;overflow:hidden}
|
|
7077
|
-
.fhead{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:8px 12px;
|
|
7078
|
-
|
|
7080
|
+
details.filediff{margin:0 14px 14px;border:1px solid var(--line);border-radius:9px;overflow:hidden}
|
|
7081
|
+
.fhead{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:8px 12px;cursor:pointer;
|
|
7082
|
+
list-style:none;background:color-mix(in srgb,var(--ink) 4%,transparent)}
|
|
7083
|
+
.fhead::-webkit-details-marker{display:none}
|
|
7084
|
+
.fhead::before{content:"\\25B8";color:var(--ink2);font-size:.8rem;display:inline-block;
|
|
7085
|
+
transition:transform .12s ease}
|
|
7086
|
+
details.filediff[open] .fhead{border-bottom:1px solid var(--line)}
|
|
7087
|
+
details.filediff[open] .fhead::before{transform:rotate(90deg)}
|
|
7088
|
+
.fhead:hover code{color:var(--accent)}
|
|
7079
7089
|
.fhead code{font-size:.82rem}
|
|
7080
7090
|
.tag{font-size:.7rem;text-transform:uppercase;letter-spacing:.04em;padding:2px 7px;border-radius:999px;
|
|
7081
7091
|
border:1px solid var(--line);color:var(--ink2)}
|
|
@@ -7100,9 +7110,9 @@ function renderProjectChange(c) {
|
|
|
7100
7110
|
const totals = files.map((f) => alignLines(f.before, f.after));
|
|
7101
7111
|
const added = totals.reduce((s, t) => s + t.added, 0);
|
|
7102
7112
|
const removed = totals.reduce((s, t) => s + t.removed, 0);
|
|
7103
|
-
const
|
|
7104
|
-
const
|
|
7105
|
-
return `<
|
|
7113
|
+
const name = c.href ? `<a class="chgname" href="${esc(c.href)}" target="_blank" rel="noopener">${esc(c.slug)}</a>` : `<b class="chgname">${esc(c.slug)}</b>`;
|
|
7114
|
+
const head = `<div class="chghead">${name}` + (files.length > 0 ? `<span class="chgstat">${files.length} ${plural2(files.length, "file")} <span class="plus">+${added}</span> <span class="minus">-${removed}</span></span>` : `<span class="chgstat">no file changed</span>`) + (c.href ? `<span class="chgstat">open the full report</span>` : "") + `</div>`;
|
|
7115
|
+
return `<div class="chg">${head}<ul>${summary.map((l) => `<li>${esc(l)}</li>`).join("")}</ul>` + files.map((f, i) => renderFileDiff(f, totals[i])).join("") + `</div>`;
|
|
7106
7116
|
}
|
|
7107
7117
|
function renderFileDiff(file, align) {
|
|
7108
7118
|
const state = file.before === null ? "created" : file.after === null ? "removed" : "changed";
|
|
@@ -7113,11 +7123,15 @@ function renderFileDiff(file, align) {
|
|
|
7113
7123
|
const cls = r.kind === "same" ? "" : ` class="${r.kind}"`;
|
|
7114
7124
|
return `<tr${cls}><td class="ln">${r.leftNo ?? ""}</td><td class="side l">${r.left === null ? "" : esc(r.left)}</td><td class="ln">${r.rightNo ?? ""}</td><td class="side r">${r.right === null ? "" : esc(r.right)}</td></tr>`;
|
|
7115
7125
|
}).join("");
|
|
7116
|
-
return
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7126
|
+
return (
|
|
7127
|
+
// Collapsed by default: the project block above is always open, so ten
|
|
7128
|
+
// projects' worth of open diffs would bury the summary lines.
|
|
7129
|
+
`<details class="filediff"><summary class="fhead"><code>${esc(file.label)}</code><span class="tag ${state}">${state}</span><span class="chgstat"><span class="plus">+${align.added}</span> <span class="minus">-${align.removed}</span></span></summary>` + (align.truncated ? `<p class="note">This file is too large to pair line by line, so the two sides are listed in full instead.</p>` : "") + // table-layout:fixed takes its widths from the first row, and the first row
|
|
7130
|
+
// is the header, whose cells are colspan'd across the two number columns.
|
|
7131
|
+
// Without an explicit colgroup the browser splits four equal columns and the
|
|
7132
|
+
// gutters eat half the width.
|
|
7133
|
+
`<table class="sbs"><colgroup><col class="cn"><col class="cs"><col class="cn"><col class="cs"></colgroup><thead><tr><th colspan="2">Before</th><th colspan="2">After</th></tr></thead><tbody>${rows}</tbody></table><p class="note">${esc(file.path)}</p></details>`
|
|
7134
|
+
);
|
|
7121
7135
|
}
|
|
7122
7136
|
function indexTokens(tokens) {
|
|
7123
7137
|
if (tokens.before === null) return `${esc(approxTokens(tokens.after))} (new file)`;
|
|
@@ -7923,6 +7937,7 @@ async function startApplyServer(opts) {
|
|
|
7923
7937
|
const changes = [];
|
|
7924
7938
|
const errors = [];
|
|
7925
7939
|
for (const { entry, action } of targets) {
|
|
7940
|
+
const href = `${entry.dir}/${DASHBOARD_NAME}`;
|
|
7926
7941
|
try {
|
|
7927
7942
|
const { lines, files } = await opts.apply(entry, action);
|
|
7928
7943
|
if (action === "remove") {
|
|
@@ -7932,11 +7947,11 @@ async function startApplyServer(opts) {
|
|
|
7932
7947
|
entry.appliedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7933
7948
|
entry.appliedMode = action;
|
|
7934
7949
|
}
|
|
7935
|
-
changes.push({ slug: entry.slug, lines, files });
|
|
7950
|
+
changes.push({ slug: entry.slug, lines, files, href });
|
|
7936
7951
|
} catch (err) {
|
|
7937
7952
|
const text2 = `Error: ${err instanceof Error ? err.message : String(err)}`;
|
|
7938
7953
|
errors.push(text2);
|
|
7939
|
-
changes.push({ slug: entry.slug, lines: [text2], files: [] });
|
|
7954
|
+
changes.push({ slug: entry.slug, lines: [text2], files: [], href });
|
|
7940
7955
|
}
|
|
7941
7956
|
}
|
|
7942
7957
|
if (opts.onManifestChange) await opts.onManifestChange(manifest);
|
|
@@ -8769,7 +8784,7 @@ function parseApplyFlags(args) {
|
|
|
8769
8784
|
};
|
|
8770
8785
|
}
|
|
8771
8786
|
function cliVersion() {
|
|
8772
|
-
return true ? "0.16.
|
|
8787
|
+
return true ? "0.16.2" : "0.0.0-dev";
|
|
8773
8788
|
}
|
|
8774
8789
|
function isHelpRequest(command, args) {
|
|
8775
8790
|
if (command === void 0) return false;
|