@attalabs/vinaya 0.34.0 → 0.35.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/LICENSE +104 -201
- package/README.md +1 -1
- package/aeg-root/roles/planner/reference.md +1 -1
- package/dist/checks/bin/check-body-bare-digits.js +5 -2
- package/dist/checks/bin/check-branch-topology.js +13 -0
- package/dist/checks/bin/check-brief-shape.js +5 -2
- package/dist/checks/bin/check-changeset-coverage.js +38 -5
- package/dist/checks/bin/check-closes-n.js +13 -0
- package/dist/checks/bin/check-coherence.js +16 -2
- package/dist/checks/bin/check-dead-branch-push.js +2 -0
- package/dist/checks/bin/check-dispatch-readiness.js +16 -2
- package/dist/checks/bin/check-doc-coverage-push.js +38 -5
- package/dist/checks/bin/check-doc-coverage.js +38 -5
- package/dist/checks/bin/check-doctrine-no-procedures.js +5 -2
- package/dist/checks/bin/check-doctrine-portability.js +38 -5
- package/dist/checks/bin/check-evidence-fresh.js +38 -5
- package/dist/checks/bin/check-exec-bits.js +38 -5
- package/dist/checks/bin/check-first-push-dispatch.js +16 -2
- package/dist/checks/bin/check-issue-assignment.js +13 -0
- package/dist/checks/bin/check-issue-milestone-attach.js +2 -0
- package/dist/checks/bin/check-issue-objectives-numbering.js +5 -2
- package/dist/checks/bin/check-issue-parts-coverage.js +2 -0
- package/dist/checks/bin/check-issue-surface-globs.js +16 -2
- package/dist/checks/bin/check-issue-title-grammar.js +2 -0
- package/dist/checks/bin/check-issue-tranche-label.js +2 -0
- package/dist/checks/bin/check-main-branch-refusal.js +2 -0
- package/dist/checks/bin/check-no-disk-state.js +2 -0
- package/dist/checks/bin/check-pr-premise-reassert.js +5 -2
- package/dist/checks/bin/check-pr-report-density.js +2 -0
- package/dist/checks/bin/check-principal-test-plan-wait.js +2 -0
- package/dist/checks/bin/check-quoted-command.js +38 -5
- package/dist/checks/bin/check-reader-resolvable-prose.js +38 -5
- package/dist/checks/bin/check-registry-gates.js +2 -0
- package/dist/checks/bin/check-retired-vocabulary.js +38 -5
- package/dist/checks/bin/check-review-gate.js +5 -2
- package/dist/checks/bin/check-single-plan-pr.js +2 -0
- package/dist/checks/bin/check-surface-scope.js +13 -0
- package/dist/checks/bin/check-test-plan.js +2 -0
- package/dist/checks/bin/check-token-collection-wired.js +2 -0
- package/dist/checks/bin/check-token-report.js +2 -0
- package/dist/checks/bin/check-workspace-escape.js +38 -5
- package/dist/index.js +308 -113
- package/dist/lib/pre-push-cache-test-run.js +36 -5
- package/dist/lib/pre-push-select-tests.js +3 -2
- package/package.json +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +153 -37
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +87 -24
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +9 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +7 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +28 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-cutovers.ts +49 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +12 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +138 -54
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +26 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives-cutover-config.ts +31 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +15 -6
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +122 -23
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +38 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__07uhu5z._.js → [root-of-the-server]__0zc_0gx._.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_15gdg48._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2174nz5he_oc4.js → 3goaig_rysc6p.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{0q9p7c6vn-x2w.js → 3ip5z3cf43bgo.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xnma0-359j17.js → 3u9emqjwpd0t9.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- /package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/{aeg-core → vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{HmoeqXdX1E4drt7GReFOO → ca66rAHI_w9D7S7ceXDvR}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{HmoeqXdX1E4drt7GReFOO → ca66rAHI_w9D7S7ceXDvR}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{HmoeqXdX1E4drt7GReFOO → ca66rAHI_w9D7S7ceXDvR}/_ssgManifest.js +0 -0
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
5
|
-
import { readFileSync as
|
|
6
|
-
import { dirname as dirname25, join as
|
|
5
|
+
import { readFileSync as readFileSync46 } from "node:fs";
|
|
6
|
+
import { dirname as dirname25, join as join43 } from "node:path";
|
|
7
7
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
8
8
|
|
|
9
9
|
// src/commands/archive.ts
|
|
@@ -3560,6 +3560,8 @@ function parseIssueSurface(body) {
|
|
|
3560
3560
|
function globCoversPath(glob, path) {
|
|
3561
3561
|
const g = glob.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
|
|
3562
3562
|
const p = path.replace(/\/+$/, "");
|
|
3563
|
+
if (g === "*")
|
|
3564
|
+
return !p.includes("/");
|
|
3563
3565
|
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
3564
3566
|
}
|
|
3565
3567
|
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
@@ -5677,6 +5679,9 @@ function buildRoundRecord(round, verdicts, confidence, outcome) {
|
|
|
5677
5679
|
}
|
|
5678
5680
|
return { round, countsBySeverity, confidence, outcome };
|
|
5679
5681
|
}
|
|
5682
|
+
function buildUnreviewedRecord(round, confidence, outcome, reason) {
|
|
5683
|
+
return { round, countsBySeverity: {}, confidence, outcome, notReviewed: reason };
|
|
5684
|
+
}
|
|
5680
5685
|
function withRoundStats(state, stats) {
|
|
5681
5686
|
return {
|
|
5682
5687
|
totalWallMs: state.totalWallMs + stats.wallMs,
|
|
@@ -5726,7 +5731,7 @@ function assessGate(state, obs) {
|
|
|
5726
5731
|
events.push(gateResultReadEvent(state, obs.round, obs.stats.head, obs.green, obs.confidence));
|
|
5727
5732
|
if (!obs.green) {
|
|
5728
5733
|
events.push(roundEndedEvent(state, obs.round, obs.stats, "changes_requested"));
|
|
5729
|
-
const record =
|
|
5734
|
+
const record = buildUnreviewedRecord(obs.round, null, "changes_requested", "checks_red");
|
|
5730
5735
|
const newState = {
|
|
5731
5736
|
...state,
|
|
5732
5737
|
rounds: [...state.rounds, record],
|
|
@@ -5787,7 +5792,7 @@ function assessGate(state, obs) {
|
|
|
5787
5792
|
return { decision: { type: "pause", reason: "confidence" }, state: preFinalize, events };
|
|
5788
5793
|
}
|
|
5789
5794
|
events.push(roundEndedEvent(state, obs.round, obs.stats, "changes_requested"));
|
|
5790
|
-
const record =
|
|
5795
|
+
const record = buildUnreviewedRecord(obs.round, confidence, "changes_requested", "low_confidence");
|
|
5791
5796
|
const newState = {
|
|
5792
5797
|
...state,
|
|
5793
5798
|
rounds: [...state.rounds, record],
|
|
@@ -5959,8 +5964,17 @@ function countCells(record) {
|
|
|
5959
5964
|
return SEVERITY_COLUMNS.map(() => CONFIDENCE_NOT_ASKED_CELL);
|
|
5960
5965
|
return SEVERITY_COLUMNS.map((key) => String(record.countsBySeverity[key] ?? 0));
|
|
5961
5966
|
}
|
|
5967
|
+
var NOT_REVIEWED_REASON_TEXT = {
|
|
5968
|
+
checks_red: "checks red",
|
|
5969
|
+
low_confidence: "low confidence"
|
|
5970
|
+
};
|
|
5971
|
+
function outcomeCell(record) {
|
|
5972
|
+
if (record.notReviewed !== undefined)
|
|
5973
|
+
return `not reviewed — ${NOT_REVIEWED_REASON_TEXT[record.notReviewed]}`;
|
|
5974
|
+
return record.outcome;
|
|
5975
|
+
}
|
|
5962
5976
|
function row(record) {
|
|
5963
|
-
return `| ${record.round} | ${countCells(record).join(" | ")} | ${confidenceCell(record.confidence)} | ${record
|
|
5977
|
+
return `| ${record.round} | ${countCells(record).join(" | ")} | ${confidenceCell(record.confidence)} | ${outcomeCell(record)} |`;
|
|
5964
5978
|
}
|
|
5965
5979
|
function renderSummary(journal) {
|
|
5966
5980
|
const header = SUMMARY_TABLE_HEADER;
|
|
@@ -7996,7 +8010,8 @@ async function trustAnchorRepoAsync() {
|
|
|
7996
8010
|
try {
|
|
7997
8011
|
const { stdout } = await execFileAsync4("git", ["remote", "get-url", "origin"], {
|
|
7998
8012
|
encoding: "utf-8",
|
|
7999
|
-
timeout: 1e4
|
|
8013
|
+
timeout: 1e4,
|
|
8014
|
+
killSignal: "SIGKILL"
|
|
8000
8015
|
});
|
|
8001
8016
|
return trustAnchorRepoFromRemoteUrl(stdout);
|
|
8002
8017
|
} catch {
|
|
@@ -8057,7 +8072,7 @@ async function ghFetchTrustAnchorConfigAsync() {
|
|
|
8057
8072
|
const repo = await trustAnchorRepoAsync();
|
|
8058
8073
|
if (!repo)
|
|
8059
8074
|
throw new Error("could not resolve repo identity for the trust-anchor read");
|
|
8060
|
-
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4 });
|
|
8075
|
+
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4, killSignal: "SIGKILL" });
|
|
8061
8076
|
return stdout;
|
|
8062
8077
|
}
|
|
8063
8078
|
function firstLine(err) {
|
|
@@ -8777,7 +8792,14 @@ async function drainOutboxToWebhook(outboxTask, webhookUrl, headers, fetchTimeou
|
|
|
8777
8792
|
|
|
8778
8793
|
// src/lib/log-sink.ts
|
|
8779
8794
|
var OUTBOX_MAX_BYTES = 8 * 1024 * 1024;
|
|
8795
|
+
function describeFolderFallback(reason) {
|
|
8796
|
+
if (reason.kind === "anchor-unreadable") {
|
|
8797
|
+
return `not delivering to the configured log server ${reason.intendedUrl} — the default branch's ` + "vinaya.config.json could not be read to confirm it (the trust-anchor read via `gh` was offline, " + "unauthenticated, or slower than its deadline); events are written to the local folder and can be " + "delivered later with `vinaya log send`";
|
|
8798
|
+
}
|
|
8799
|
+
return `not delivering to the working-tree log server ${reason.intendedUrl} — the default branch's ` + "vinaya.config.json does not declare it, so an unattended run does not honour it (a pull request cannot " + "redirect telemetry); events are written to the local folder";
|
|
8800
|
+
}
|
|
8780
8801
|
var LOG_CONTEXT_LOOKUP_DEADLINE_MS = 3000;
|
|
8802
|
+
var LOG_DESTINATION_ANCHOR_DEADLINE_MS = 8000;
|
|
8781
8803
|
function withDeadline(work, ms, fallback) {
|
|
8782
8804
|
return new Promise((resolve) => {
|
|
8783
8805
|
const timer = setTimeout(() => resolve(fallback), ms);
|
|
@@ -8792,7 +8814,7 @@ function withDeadline(work, ms, fallback) {
|
|
|
8792
8814
|
});
|
|
8793
8815
|
}
|
|
8794
8816
|
async function safeLoadTrustAnchorConfig() {
|
|
8795
|
-
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }),
|
|
8817
|
+
return withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_DESTINATION_ANCHOR_DEADLINE_MS, null);
|
|
8796
8818
|
}
|
|
8797
8819
|
function logsCredentialMissing(headers, env) {
|
|
8798
8820
|
if (!headers)
|
|
@@ -8809,8 +8831,16 @@ function logsCredentialMissing(headers, env) {
|
|
|
8809
8831
|
function resolveLogDestinationFrom(input) {
|
|
8810
8832
|
const local = resolveLogsSetting(input.localConfig);
|
|
8811
8833
|
let effective = null;
|
|
8834
|
+
let fallbackReason;
|
|
8812
8835
|
if (input.unattended) {
|
|
8813
|
-
|
|
8836
|
+
if (local) {
|
|
8837
|
+
effective = resolveTrustAnchorLogsDestination(local, input.trustAnchorConfig);
|
|
8838
|
+
if (effective === null && "url" in local) {
|
|
8839
|
+
fallbackReason = input.trustAnchorConfig === null ? { kind: "anchor-unreadable", intendedUrl: local.url } : { kind: "anchor-mismatch", intendedUrl: local.url };
|
|
8840
|
+
}
|
|
8841
|
+
} else {
|
|
8842
|
+
effective = resolveLogsSetting(input.trustAnchorConfig);
|
|
8843
|
+
}
|
|
8814
8844
|
} else {
|
|
8815
8845
|
effective = local;
|
|
8816
8846
|
}
|
|
@@ -8836,7 +8866,7 @@ function resolveLogDestinationFrom(input) {
|
|
|
8836
8866
|
effective = null;
|
|
8837
8867
|
}
|
|
8838
8868
|
const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
|
|
8839
|
-
return { kind: "folder", folder };
|
|
8869
|
+
return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
|
|
8840
8870
|
}
|
|
8841
8871
|
var processTrustAnchorOnce;
|
|
8842
8872
|
function processTrustAnchor() {
|
|
@@ -8983,6 +9013,9 @@ function safeRepoSlug(repo) {
|
|
|
8983
9013
|
return null;
|
|
8984
9014
|
return isSafeRepoSegment3(repo.owner) && isSafeRepoSegment3(repo.repo) ? `${repo.owner}/${repo.repo}` : null;
|
|
8985
9015
|
}
|
|
9016
|
+
function telemetryOutboxRoot() {
|
|
9017
|
+
return join8(GLOBAL_VINAYA_HOME, "outbox");
|
|
9018
|
+
}
|
|
8986
9019
|
function outboxPathFor(deps, repo, issue) {
|
|
8987
9020
|
const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
8988
9021
|
const fileName = `${issue ?? "none"}.ndjson`;
|
|
@@ -9224,6 +9257,10 @@ function createLogSink(overrides = {}) {
|
|
|
9224
9257
|
`);
|
|
9225
9258
|
return;
|
|
9226
9259
|
}
|
|
9260
|
+
if (resolvedDestination.kind === "folder" && resolvedDestination.fallbackReason) {
|
|
9261
|
+
warnOnce(`vinaya: ${describeFolderFallback(resolvedDestination.fallbackReason)}
|
|
9262
|
+
`);
|
|
9263
|
+
}
|
|
9227
9264
|
const branchIssue = envFields.task ? null : await branchIssueOnce(repo);
|
|
9228
9265
|
const header = buildHeader({
|
|
9229
9266
|
now,
|
|
@@ -10739,6 +10776,17 @@ var COMMANDS = [
|
|
|
10739
10776
|
"issue-711 O4: this command — `--task <n>`, `--resume <pr>`, `--cancel <pr>` alike — stays `task run`'s own one-shot debug/direct entry; the watching driver that survives a pause and continues on its own is `task run`'s (see that command's own entry)."
|
|
10740
10777
|
],
|
|
10741
10778
|
status: "shipped"
|
|
10779
|
+
},
|
|
10780
|
+
{
|
|
10781
|
+
name: "log send",
|
|
10782
|
+
description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
|
|
10783
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
10784
|
+
details: [
|
|
10785
|
+
"For a run whose events ended up on local disk instead of the configured server — an unattended run that fell back to the local folder because the trust-anchor read could not confirm its `logs.url` (a developer machine slower than the read deadline, or genuinely offline), or a retry queue holding a backlog or a `.draining.ndjson` a dead drain left behind. It moves the local folder's events into the retry queue and drains every queue for this repository through the SAME webhook delivery a live event uses.",
|
|
10786
|
+
"It resolves the destination exactly the way a normal event does — the sink's own decision over `vinaya.config.json`'s `logs` setting, trust-anchor-gated for an unattended caller — never a URL passed on the command line. A repository whose destination is a folder (or none) has nothing to send to a server and the command says so.",
|
|
10787
|
+
"Safe to run more than once: the server stores events by `event_id` and ignores one it already holds, so a re-sent chunk creates no duplicate, and a second run finds the folder emptied and the queue drained."
|
|
10788
|
+
],
|
|
10789
|
+
status: "shipped"
|
|
10742
10790
|
}
|
|
10743
10791
|
];
|
|
10744
10792
|
// ../../packages/sources/src/doctrine-file-adapter.ts
|
|
@@ -29269,7 +29317,7 @@ function logDestinationTargetFrom(input) {
|
|
|
29269
29317
|
async function resolveLogDestinationForDoctor() {
|
|
29270
29318
|
const localConfig = loadConfig();
|
|
29271
29319
|
const unattended = isUnattendedProcess(process.env) || Boolean(process.env.GITHUB_ACTIONS);
|
|
29272
|
-
const trustAnchorConfig = unattended ? await withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }),
|
|
29320
|
+
const trustAnchorConfig = unattended ? await withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_DESTINATION_ANCHOR_DEADLINE_MS, null) : null;
|
|
29273
29321
|
const repo = await withDeadline(resolveRepo(), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
|
|
29274
29322
|
return logDestinationTargetFrom({
|
|
29275
29323
|
localConfig,
|
|
@@ -29770,9 +29818,17 @@ async function diagnoseLogDestination(deps) {
|
|
|
29770
29818
|
}
|
|
29771
29819
|
if (destination.kind === "folder") {
|
|
29772
29820
|
const deliverable = folderDeliverable(destination.folder);
|
|
29773
|
-
|
|
29774
|
-
|
|
29775
|
-
|
|
29821
|
+
if (!deliverable.ok) {
|
|
29822
|
+
return [
|
|
29823
|
+
error("logs", `log events go to the folder ${destination.folder}, which cannot be written — ${deliverable.detail}. ` + "Every event is dropped, with one warning per process, until it can be.")
|
|
29824
|
+
];
|
|
29825
|
+
}
|
|
29826
|
+
const writable = `log events go to the folder ${destination.folder}, and it is writable` + `${deliverable.probed === destination.folder ? "" : ` (its nearest existing parent ${deliverable.probed} is)`}.`;
|
|
29827
|
+
if (destination.fallbackReason) {
|
|
29828
|
+
const message = `${writable} But it ${describeFolderFallback(destination.fallbackReason)}.`;
|
|
29829
|
+
return [destination.fallbackReason.kind === "anchor-mismatch" ? warn("logs", message) : info("logs", message)];
|
|
29830
|
+
}
|
|
29831
|
+
return [ok5("logs", writable)];
|
|
29776
29832
|
}
|
|
29777
29833
|
const probe = await deps.probeLogServer(destination.url, destination.headers);
|
|
29778
29834
|
const where = urlForDisplay(destination.url);
|
|
@@ -29884,9 +29940,138 @@ async function doctorCommand(args) {
|
|
|
29884
29940
|
process.exit(await runDoctor(args, realDeps4()));
|
|
29885
29941
|
}
|
|
29886
29942
|
|
|
29887
|
-
// src/commands/
|
|
29888
|
-
import { existsSync as existsSync28, readFileSync as readFileSync34 } from "node:fs";
|
|
29943
|
+
// src/commands/log-send.ts
|
|
29944
|
+
import { existsSync as existsSync28, readFileSync as readFileSync34, readdirSync as readdirSync16, unlinkSync as unlinkSync7 } from "node:fs";
|
|
29889
29945
|
import { join as join32 } from "node:path";
|
|
29946
|
+
function repoSegment2(repo) {
|
|
29947
|
+
return repo ? `${repo.owner}-${repo.repo}` : "unresolved";
|
|
29948
|
+
}
|
|
29949
|
+
function issueFromToken(token) {
|
|
29950
|
+
if (token === "none")
|
|
29951
|
+
return null;
|
|
29952
|
+
return /^\d+$/.test(token) ? Number(token) : undefined;
|
|
29953
|
+
}
|
|
29954
|
+
function deliverableTokens(dir) {
|
|
29955
|
+
const tokens = new Set;
|
|
29956
|
+
if (!existsSync28(dir))
|
|
29957
|
+
return tokens;
|
|
29958
|
+
for (const name of readdirSync16(dir)) {
|
|
29959
|
+
const match = /^(none|\d+)(?:\.1|\.draining)?\.ndjson$/.exec(name);
|
|
29960
|
+
if (match)
|
|
29961
|
+
tokens.add(match[1]);
|
|
29962
|
+
}
|
|
29963
|
+
return tokens;
|
|
29964
|
+
}
|
|
29965
|
+
function moveFolderFileIntoQueue(folderFile, queuePath) {
|
|
29966
|
+
const content = readFileSync34(folderFile, "utf8");
|
|
29967
|
+
const lines = content.split(`
|
|
29968
|
+
`).filter((l) => l.length > 0);
|
|
29969
|
+
if (lines.length > 0) {
|
|
29970
|
+
const failure = appendHardenedLine(queuePath, `${lines.join(`
|
|
29971
|
+
`)}
|
|
29972
|
+
`);
|
|
29973
|
+
if (failure !== null) {
|
|
29974
|
+
throw new Error(`could not move ${folderFile} into the retry queue ${queuePath} — ${failure}`);
|
|
29975
|
+
}
|
|
29976
|
+
}
|
|
29977
|
+
unlinkSync7(folderFile);
|
|
29978
|
+
return lines.length;
|
|
29979
|
+
}
|
|
29980
|
+
async function logSendCommand(args) {
|
|
29981
|
+
const jsonOutput = args.includes("--json");
|
|
29982
|
+
const repo = await resolveRepo();
|
|
29983
|
+
const localConfig = loadConfig();
|
|
29984
|
+
const unattended = isUnattendedProcess(process.env);
|
|
29985
|
+
const trustAnchorConfig = unattended ? await withDeadline(loadTrustAnchorConfigAsync(undefined, { quiet: true }), LOG_DESTINATION_ANCHOR_DEADLINE_MS, null) : null;
|
|
29986
|
+
const defaultFolder = join32(await runtimeDirForRepoAsync(repo), "logs");
|
|
29987
|
+
const destination = resolveLogDestinationFrom({
|
|
29988
|
+
localConfig,
|
|
29989
|
+
trustAnchorConfig,
|
|
29990
|
+
unattended,
|
|
29991
|
+
env: process.env,
|
|
29992
|
+
defaultFolder,
|
|
29993
|
+
repoRoot: repoRootSync()
|
|
29994
|
+
});
|
|
29995
|
+
if (destination.kind !== "server") {
|
|
29996
|
+
const why = destination.kind === "none" ? destination.reason : destination.fallbackReason ? describeFolderFallback(destination.fallbackReason) : "this repository is configured to write log events to a local folder, not a server";
|
|
29997
|
+
const message = `vinaya log send: no server destination to deliver to — ${why}.`;
|
|
29998
|
+
if (jsonOutput)
|
|
29999
|
+
printJson({ sent: false, reason: message });
|
|
30000
|
+
else
|
|
30001
|
+
process.stderr.write(`${message}
|
|
30002
|
+
`);
|
|
30003
|
+
process.exit(1);
|
|
30004
|
+
}
|
|
30005
|
+
const segment = repoSegment2(repo);
|
|
30006
|
+
const folderDir = join32(defaultFolder, segment);
|
|
30007
|
+
const outboxDir = join32(telemetryOutboxRoot(), segment);
|
|
30008
|
+
const tokens = new Set([...deliverableTokens(folderDir), ...deliverableTokens(outboxDir)]);
|
|
30009
|
+
const report = {
|
|
30010
|
+
destination: destination.url,
|
|
30011
|
+
tasks: [],
|
|
30012
|
+
totals: { moved: 0, delivered: 0, chunks: 0, rejected: 0 },
|
|
30013
|
+
failures: []
|
|
30014
|
+
};
|
|
30015
|
+
for (const token of [...tokens].sort()) {
|
|
30016
|
+
const issue = issueFromToken(token);
|
|
30017
|
+
if (issue === undefined)
|
|
30018
|
+
continue;
|
|
30019
|
+
let moved = 0;
|
|
30020
|
+
try {
|
|
30021
|
+
const queuePath = outboxPathFor({ outboxRoot: telemetryOutboxRoot }, repo, issue);
|
|
30022
|
+
for (const suffix of [".1.ndjson", ".ndjson"]) {
|
|
30023
|
+
const folderFile = join32(folderDir, `${token}${suffix}`);
|
|
30024
|
+
if (existsSync28(folderFile))
|
|
30025
|
+
moved += moveFolderFileIntoQueue(folderFile, queuePath);
|
|
30026
|
+
}
|
|
30027
|
+
const outcome = await drainOutboxToWebhook(issue, destination.url, destination.headers);
|
|
30028
|
+
report.tasks.push({
|
|
30029
|
+
issue,
|
|
30030
|
+
moved,
|
|
30031
|
+
delivered: outcome.lineCount,
|
|
30032
|
+
chunks: outcome.chunks,
|
|
30033
|
+
rejected: outcome.rejected
|
|
30034
|
+
});
|
|
30035
|
+
report.totals.moved += moved;
|
|
30036
|
+
report.totals.delivered += outcome.lineCount;
|
|
30037
|
+
report.totals.chunks += outcome.chunks;
|
|
30038
|
+
report.totals.rejected += outcome.rejected;
|
|
30039
|
+
} catch (err) {
|
|
30040
|
+
report.failures.push({ issue, reason: err instanceof Error ? err.message : String(err) });
|
|
30041
|
+
}
|
|
30042
|
+
}
|
|
30043
|
+
if (jsonOutput) {
|
|
30044
|
+
printJson({ sent: true, ...report });
|
|
30045
|
+
process.exit(report.failures.length > 0 ? 1 : 0);
|
|
30046
|
+
}
|
|
30047
|
+
process.stdout.write(`vinaya log send → ${report.destination}
|
|
30048
|
+
|
|
30049
|
+
`);
|
|
30050
|
+
if (report.tasks.length === 0 && report.failures.length === 0) {
|
|
30051
|
+
process.stdout.write(`Nothing to send — the local folder and the retry queue hold no undelivered events.
|
|
30052
|
+
`);
|
|
30053
|
+
return;
|
|
30054
|
+
}
|
|
30055
|
+
for (const task of report.tasks) {
|
|
30056
|
+
const who = task.issue === null ? "(unattributed)" : `#${task.issue}`;
|
|
30057
|
+
process.stdout.write(`· ${who}: delivered ${task.delivered} line(s) in ${task.chunks} POST(s)` + `${task.moved > 0 ? ` (${task.moved} from the local folder)` : ""}` + `${task.rejected > 0 ? `, ${task.rejected} set aside` : ""}
|
|
30058
|
+
`);
|
|
30059
|
+
}
|
|
30060
|
+
for (const failure of report.failures) {
|
|
30061
|
+
const who = failure.issue === null ? "(unattributed)" : `#${failure.issue}`;
|
|
30062
|
+
process.stderr.write(`✗ ${who}: ${failure.reason}
|
|
30063
|
+
`);
|
|
30064
|
+
}
|
|
30065
|
+
process.stdout.write(`
|
|
30066
|
+
Sent ${report.totals.delivered} line(s) across ${report.tasks.length} task(s). ` + `The server deduplicates by event id, so nothing was posted twice.
|
|
30067
|
+
`);
|
|
30068
|
+
if (report.failures.length > 0)
|
|
30069
|
+
process.exit(1);
|
|
30070
|
+
}
|
|
30071
|
+
|
|
30072
|
+
// src/commands/eject.ts
|
|
30073
|
+
import { existsSync as existsSync29, readFileSync as readFileSync35 } from "node:fs";
|
|
30074
|
+
import { join as join33 } from "node:path";
|
|
29890
30075
|
function realDeps5() {
|
|
29891
30076
|
return {
|
|
29892
30077
|
detectRepo: detectGitRepo,
|
|
@@ -29903,12 +30088,12 @@ function parse2(args) {
|
|
|
29903
30088
|
return { dryRun: args.includes("--dry-run"), yes: args.includes("--yes") };
|
|
29904
30089
|
}
|
|
29905
30090
|
function readManifest3(repoRoot) {
|
|
29906
|
-
const p =
|
|
29907
|
-
if (!
|
|
30091
|
+
const p = join33(repoRoot, CONFIG_PATH);
|
|
30092
|
+
if (!existsSync29(p))
|
|
29908
30093
|
return { kind: "none" };
|
|
29909
30094
|
let raw;
|
|
29910
30095
|
try {
|
|
29911
|
-
raw = JSON.parse(
|
|
30096
|
+
raw = JSON.parse(readFileSync35(p, "utf-8"));
|
|
29912
30097
|
} catch (err) {
|
|
29913
30098
|
return { kind: "orphan", reason: `vinaya.config.json is not valid JSON: ${err.message}` };
|
|
29914
30099
|
}
|
|
@@ -29998,8 +30183,8 @@ async function ejectCommand(args) {
|
|
|
29998
30183
|
}
|
|
29999
30184
|
|
|
30000
30185
|
// src/commands/init.ts
|
|
30001
|
-
import { existsSync as
|
|
30002
|
-
import { join as
|
|
30186
|
+
import { existsSync as existsSync30, readFileSync as readFileSync36, writeFileSync as writeFileSync20 } from "node:fs";
|
|
30187
|
+
import { join as join34 } from "node:path";
|
|
30003
30188
|
function realDeps6() {
|
|
30004
30189
|
return {
|
|
30005
30190
|
detectRepo: detectGitRepo,
|
|
@@ -30039,18 +30224,18 @@ function parseAgentsFlag(args) {
|
|
|
30039
30224
|
}
|
|
30040
30225
|
var PRODUCT_NAME_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
30041
30226
|
function readManifest4(repoRoot) {
|
|
30042
|
-
const p =
|
|
30043
|
-
if (!
|
|
30227
|
+
const p = join34(repoRoot, CONFIG_PATH);
|
|
30228
|
+
if (!existsSync30(p))
|
|
30044
30229
|
return null;
|
|
30045
30230
|
try {
|
|
30046
|
-
return VinayaConfigSchema.parse(JSON.parse(
|
|
30231
|
+
return VinayaConfigSchema.parse(JSON.parse(readFileSync36(p, "utf-8"))).managed ?? null;
|
|
30047
30232
|
} catch {
|
|
30048
30233
|
return null;
|
|
30049
30234
|
}
|
|
30050
30235
|
}
|
|
30051
30236
|
function writeManifest2(repoRoot, manifest) {
|
|
30052
|
-
const configAbs =
|
|
30053
|
-
const seed = JSON.parse(
|
|
30237
|
+
const configAbs = join34(repoRoot, CONFIG_PATH);
|
|
30238
|
+
const seed = JSON.parse(readFileSync36(configAbs, "utf-8"));
|
|
30054
30239
|
writeFileSync20(configAbs, `${JSON.stringify({ ...seed, managed: manifest }, null, 2)}
|
|
30055
30240
|
`, "utf-8");
|
|
30056
30241
|
}
|
|
@@ -30275,7 +30460,7 @@ async function issueEditCommand(args) {
|
|
|
30275
30460
|
import { execFileSync as execFileSync31 } from "node:child_process";
|
|
30276
30461
|
import { mkdtempSync as mkdtempSync7, rmSync as rmSync14, writeFileSync as writeFileSync21 } from "node:fs";
|
|
30277
30462
|
import { tmpdir as tmpdir8 } from "node:os";
|
|
30278
|
-
import { join as
|
|
30463
|
+
import { join as join35 } from "node:path";
|
|
30279
30464
|
var RETRY = 'vinaya issue objectives edit <n> --add "<sentence>" | --drop O<k> | --replace O<k> "<sentence>" --reason "<text>"';
|
|
30280
30465
|
var MARKER_PREFIX = "<!-- aeg:objectives:v";
|
|
30281
30466
|
var HEADING_RE2 = /^##[ \t]*Objectives[ \t]*$/im;
|
|
@@ -30491,8 +30676,8 @@ async function issueObjectivesEditCommand(args) {
|
|
|
30491
30676
|
} else if (op.kind === "drop") {
|
|
30492
30677
|
finalBody = removePartLinesCitingOnly(finalBody, op.id);
|
|
30493
30678
|
}
|
|
30494
|
-
const dir = mkdtempSync7(
|
|
30495
|
-
const tmp =
|
|
30679
|
+
const dir = mkdtempSync7(join35(tmpdir8(), "vinaya-objectives-edit-"));
|
|
30680
|
+
const tmp = join35(dir, "body.md");
|
|
30496
30681
|
writeFileSync21(tmp, finalBody, "utf8");
|
|
30497
30682
|
try {
|
|
30498
30683
|
const ghArgs = ["--body-file", tmp];
|
|
@@ -31032,10 +31217,10 @@ async function milestoneStatusCommand(args) {
|
|
|
31032
31217
|
}
|
|
31033
31218
|
|
|
31034
31219
|
// src/commands/new-check.ts
|
|
31035
|
-
import { chmodSync as chmodSync5, existsSync as
|
|
31036
|
-
import { join as
|
|
31037
|
-
var TEMPLATE_PATH2 =
|
|
31038
|
-
var CHECKS_DIR =
|
|
31220
|
+
import { chmodSync as chmodSync5, existsSync as existsSync31, mkdirSync as mkdirSync12, readFileSync as readFileSync37, writeFileSync as writeFileSync22 } from "node:fs";
|
|
31221
|
+
import { join as join36 } from "node:path";
|
|
31222
|
+
var TEMPLATE_PATH2 = join36(packageRoot(import.meta.url), "templates", "custom-check.template.ts");
|
|
31223
|
+
var CHECKS_DIR = join36("scripts", "vinaya-checks");
|
|
31039
31224
|
var USAGE2 = "Usage: vinaya new check <yourname>/<id> (both segments: lowercase letters, digits, hyphens; e.g. myteam/vocab-check)";
|
|
31040
31225
|
function newCheckCommand(args) {
|
|
31041
31226
|
const name = args[0];
|
|
@@ -31052,20 +31237,20 @@ function newCheckCommand(args) {
|
|
|
31052
31237
|
\`vinaya check\` refuses the entire run over a key it cannot resolve, so a bare, un-namespaced name would brick every check invocation in this repo.`);
|
|
31053
31238
|
process.exit(2);
|
|
31054
31239
|
}
|
|
31055
|
-
const scriptsDir =
|
|
31056
|
-
if (!
|
|
31240
|
+
const scriptsDir = join36(process.cwd(), CHECKS_DIR);
|
|
31241
|
+
if (!existsSync31(scriptsDir))
|
|
31057
31242
|
mkdirSync12(scriptsDir, { recursive: true });
|
|
31058
31243
|
const fileStem = name.slice(name.indexOf("/") + 1);
|
|
31059
|
-
const targetPath =
|
|
31060
|
-
if (
|
|
31244
|
+
const targetPath = join36(scriptsDir, `${fileStem}.ts`);
|
|
31245
|
+
if (existsSync31(targetPath)) {
|
|
31061
31246
|
console.error(`Error: ${targetPath} already exists.`);
|
|
31062
31247
|
process.exit(1);
|
|
31063
31248
|
}
|
|
31064
|
-
const template =
|
|
31249
|
+
const template = readFileSync37(TEMPLATE_PATH2, "utf-8");
|
|
31065
31250
|
const contents = template.split("{{CHECK_NAME}}").join(name);
|
|
31066
31251
|
writeFileSync22(targetPath, contents, "utf-8");
|
|
31067
31252
|
chmodSync5(targetPath, 493);
|
|
31068
|
-
const relPath =
|
|
31253
|
+
const relPath = join36(CHECKS_DIR, `${fileStem}.ts`);
|
|
31069
31254
|
const registration = JSON.stringify({ checks: { [name]: { run: `./${relPath}`, scope: "diff" } } }, null, 2);
|
|
31070
31255
|
process.stdout.write(`Created ${relPath}
|
|
31071
31256
|
|
|
@@ -31075,10 +31260,10 @@ ${registration}
|
|
|
31075
31260
|
}
|
|
31076
31261
|
|
|
31077
31262
|
// src/commands/new-noop-check.ts
|
|
31078
|
-
import { chmodSync as chmodSync6, existsSync as
|
|
31079
|
-
import { join as
|
|
31080
|
-
var TEMPLATE_PATH3 =
|
|
31081
|
-
var CHECKS_DIR2 =
|
|
31263
|
+
import { chmodSync as chmodSync6, existsSync as existsSync32, mkdirSync as mkdirSync13, readFileSync as readFileSync38, writeFileSync as writeFileSync23 } from "node:fs";
|
|
31264
|
+
import { join as join37 } from "node:path";
|
|
31265
|
+
var TEMPLATE_PATH3 = join37(packageRoot(import.meta.url), "templates", "noop-check.template.ts");
|
|
31266
|
+
var CHECKS_DIR2 = join37("vinaya", "checks");
|
|
31082
31267
|
var USAGE3 = "Usage: vinaya new noop-check <core-check-id> (the exact id of a core check — run `vinaya check --plan` to list them)";
|
|
31083
31268
|
function newNoopCheckCommand(args) {
|
|
31084
31269
|
const name = args[0];
|
|
@@ -31092,19 +31277,19 @@ function newNoopCheckCommand(args) {
|
|
|
31092
31277
|
\`new noop-check\` only silences a CORE check — a \`checks\` key that exactly matches a core check id REPLACES it. A namespaced or unknown name has nothing to replace; use \`vinaya new check\` to scaffold a new, additive check instead.`);
|
|
31093
31278
|
process.exit(2);
|
|
31094
31279
|
}
|
|
31095
|
-
const checksDir =
|
|
31096
|
-
if (!
|
|
31280
|
+
const checksDir = join37(process.cwd(), CHECKS_DIR2);
|
|
31281
|
+
if (!existsSync32(checksDir))
|
|
31097
31282
|
mkdirSync13(checksDir, { recursive: true });
|
|
31098
|
-
const targetPath =
|
|
31099
|
-
if (
|
|
31283
|
+
const targetPath = join37(checksDir, `${name}.ts`);
|
|
31284
|
+
if (existsSync32(targetPath)) {
|
|
31100
31285
|
console.error(`Error: ${targetPath} already exists.`);
|
|
31101
31286
|
process.exit(1);
|
|
31102
31287
|
}
|
|
31103
|
-
const template =
|
|
31288
|
+
const template = readFileSync38(TEMPLATE_PATH3, "utf-8");
|
|
31104
31289
|
const contents = template.split("{{CHECK_NAME}}").join(name);
|
|
31105
31290
|
writeFileSync23(targetPath, contents, "utf-8");
|
|
31106
31291
|
chmodSync6(targetPath, 493);
|
|
31107
|
-
const relPath =
|
|
31292
|
+
const relPath = join37(CHECKS_DIR2, `${name}.ts`);
|
|
31108
31293
|
const entry = {
|
|
31109
31294
|
run: `./${relPath}`,
|
|
31110
31295
|
scope: coreSpec.scope
|
|
@@ -31124,10 +31309,10 @@ ${registration}
|
|
|
31124
31309
|
}
|
|
31125
31310
|
|
|
31126
31311
|
// src/commands/new-role.ts
|
|
31127
|
-
import { existsSync as
|
|
31128
|
-
import { join as
|
|
31129
|
-
var TEMPLATE_PATH4 =
|
|
31130
|
-
var ROLES_DIR =
|
|
31312
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync14, readFileSync as readFileSync39, writeFileSync as writeFileSync24 } from "node:fs";
|
|
31313
|
+
import { join as join38 } from "node:path";
|
|
31314
|
+
var TEMPLATE_PATH4 = join38(packageRoot(import.meta.url), "templates", "role.template.md");
|
|
31315
|
+
var ROLES_DIR = join38("vinaya", "roles");
|
|
31131
31316
|
var USAGE4 = "Usage: vinaya new role <yourname>/<id> (both segments: lowercase letters, digits, hyphens; e.g. acme/qa-lead)";
|
|
31132
31317
|
function newRoleCommand(args) {
|
|
31133
31318
|
const name = args[0];
|
|
@@ -31140,19 +31325,19 @@ function newRoleCommand(args) {
|
|
|
31140
31325
|
A bare, un-namespaced key resolves as an OVERRIDE of a core role — a complete replacement of that role's contract, and a real governance decision this scaffolder does not make for you. Pick a namespaced name, or write the override entry by hand if you really mean to replace a core role's contract.`);
|
|
31141
31326
|
process.exit(2);
|
|
31142
31327
|
}
|
|
31143
|
-
const rolesDir =
|
|
31144
|
-
if (!
|
|
31328
|
+
const rolesDir = join38(process.cwd(), ROLES_DIR);
|
|
31329
|
+
if (!existsSync33(rolesDir))
|
|
31145
31330
|
mkdirSync14(rolesDir, { recursive: true });
|
|
31146
31331
|
const roleId = name.slice(name.indexOf("/") + 1);
|
|
31147
|
-
const targetPath =
|
|
31148
|
-
if (
|
|
31332
|
+
const targetPath = join38(rolesDir, `${roleId}.md`);
|
|
31333
|
+
if (existsSync33(targetPath)) {
|
|
31149
31334
|
console.error(`Error: ${targetPath} already exists.`);
|
|
31150
31335
|
process.exit(1);
|
|
31151
31336
|
}
|
|
31152
|
-
const template =
|
|
31337
|
+
const template = readFileSync39(TEMPLATE_PATH4, "utf-8");
|
|
31153
31338
|
const contents = template.split("{{ROLE_ID}}").join(roleId);
|
|
31154
31339
|
writeFileSync24(targetPath, contents, "utf-8");
|
|
31155
|
-
const relPath =
|
|
31340
|
+
const relPath = join38(ROLES_DIR, `${roleId}.md`);
|
|
31156
31341
|
const registration = JSON.stringify({ roles: { [name]: { contract: `./${relPath}` } } }, null, 2);
|
|
31157
31342
|
process.stdout.write(`Created ${relPath}
|
|
31158
31343
|
|
|
@@ -31647,7 +31832,7 @@ async function prEditCommand(args) {
|
|
|
31647
31832
|
|
|
31648
31833
|
// src/commands/pr-rule.ts
|
|
31649
31834
|
import { execFileSync as execFileSync34 } from "node:child_process";
|
|
31650
|
-
import { readFileSync as
|
|
31835
|
+
import { readFileSync as readFileSync40 } from "node:fs";
|
|
31651
31836
|
var RETRY2 = "vinaya pr rule <pr> --file <ruling.md>";
|
|
31652
31837
|
var NO_CODE_REVIEW_CANDIDATE = "no code-reviewer verdict comment found on this PR";
|
|
31653
31838
|
var NO_SECURITY_CANDIDATE = "no security-review verdict comment found on this PR";
|
|
@@ -31712,7 +31897,7 @@ function prRuleCommand(args) {
|
|
|
31712
31897
|
refuseUnlessPrincipal(RETRY2);
|
|
31713
31898
|
let body;
|
|
31714
31899
|
try {
|
|
31715
|
-
body =
|
|
31900
|
+
body = readFileSync40(filePath, "utf8");
|
|
31716
31901
|
} catch (err) {
|
|
31717
31902
|
refuse([
|
|
31718
31903
|
makeCheckError("forge-args", `Could not read ${filePath}: ${err instanceof Error ? err.message : String(err)}`, "Pass a readable `--file <path>`, then retry.")
|
|
@@ -31732,7 +31917,7 @@ function prRuleCommand(args) {
|
|
|
31732
31917
|
|
|
31733
31918
|
// src/commands/pr-report.ts
|
|
31734
31919
|
import { execFileSync as execFileSync35 } from "node:child_process";
|
|
31735
|
-
import { existsSync as
|
|
31920
|
+
import { existsSync as existsSync34, readFileSync as readFileSync41, writeFileSync as writeFileSync25 } from "node:fs";
|
|
31736
31921
|
function git6(args) {
|
|
31737
31922
|
try {
|
|
31738
31923
|
return execFileSync35("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], env: process.env }).trim();
|
|
@@ -31792,7 +31977,7 @@ ${USAGE5}`);
|
|
|
31792
31977
|
${USAGE5}`);
|
|
31793
31978
|
process.exit(2);
|
|
31794
31979
|
}
|
|
31795
|
-
if (bodyFilePath && !
|
|
31980
|
+
if (bodyFilePath && !existsSync34(bodyFilePath)) {
|
|
31796
31981
|
console.error(`vinaya pr report: refused — --body-file ${bodyFilePath} does not exist.
|
|
31797
31982
|
${USAGE5}`);
|
|
31798
31983
|
process.exit(2);
|
|
@@ -31809,11 +31994,11 @@ ${USAGE5}`);
|
|
|
31809
31994
|
process.env.PR_NUMBER = pushPr;
|
|
31810
31995
|
process.env.BRANCH = git6(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
31811
31996
|
}
|
|
31812
|
-
const bodyFileSource = bodyFilePath !== undefined ?
|
|
31997
|
+
const bodyFileSource = bodyFilePath !== undefined ? readFileSync41(bodyFilePath, "utf8") : undefined;
|
|
31813
31998
|
if (bodyFileSource !== undefined) {
|
|
31814
31999
|
process.env.PR_BODY = bodyFileSource;
|
|
31815
32000
|
}
|
|
31816
|
-
const existingForWrite = writePath === undefined ? undefined :
|
|
32001
|
+
const existingForWrite = writePath === undefined ? undefined : existsSync34(writePath) ? readFileSync41(writePath, "utf8") : "";
|
|
31817
32002
|
if (writePath !== undefined) {
|
|
31818
32003
|
process.env.PR_BODY = existingForWrite;
|
|
31819
32004
|
process.env.BRANCH = git6(["rev-parse", "--abbrev-ref", "HEAD"]);
|
|
@@ -32113,12 +32298,12 @@ async function prVerifyEvidenceCommand(args) {
|
|
|
32113
32298
|
|
|
32114
32299
|
// src/commands/quickstart.ts
|
|
32115
32300
|
import { execFileSync as execFileSync37 } from "node:child_process";
|
|
32116
|
-
import { existsSync as
|
|
32117
|
-
import { join as
|
|
32301
|
+
import { existsSync as existsSync36, readFileSync as readFileSync43 } from "node:fs";
|
|
32302
|
+
import { join as join40 } from "node:path";
|
|
32118
32303
|
|
|
32119
32304
|
// src/lib/doc-owners-write.ts
|
|
32120
|
-
import { existsSync as
|
|
32121
|
-
import { dirname as dirname23, join as
|
|
32305
|
+
import { existsSync as existsSync35, mkdirSync as mkdirSync15, readFileSync as readFileSync42, writeFileSync as writeFileSync26 } from "node:fs";
|
|
32306
|
+
import { dirname as dirname23, join as join39 } from "node:path";
|
|
32122
32307
|
function bindingLine(glob, pointer) {
|
|
32123
32308
|
return `${glob} ${pointer}`;
|
|
32124
32309
|
}
|
|
@@ -32134,22 +32319,22 @@ function appendDocOwnersBinding(content, glob, pointer) {
|
|
|
32134
32319
|
`;
|
|
32135
32320
|
}
|
|
32136
32321
|
function planDocOwnersBinding(repoRoot, glob, pointer) {
|
|
32137
|
-
const abs =
|
|
32322
|
+
const abs = join39(repoRoot, DOC_OWNERS_PATH);
|
|
32138
32323
|
const line = bindingLine(glob, pointer);
|
|
32139
|
-
if (!
|
|
32324
|
+
if (!existsSync35(abs)) {
|
|
32140
32325
|
return { action: "create-host", line, path: DOC_OWNERS_PATH };
|
|
32141
32326
|
}
|
|
32142
|
-
const existing =
|
|
32327
|
+
const existing = readFileSync42(abs, "utf-8");
|
|
32143
32328
|
const already = parseDocOwners(existing).bindings.some((b) => b.glob === glob);
|
|
32144
32329
|
return { action: already ? "skip-present" : "append-row", line, path: DOC_OWNERS_PATH };
|
|
32145
32330
|
}
|
|
32146
32331
|
function applyDocOwnersBinding(repoRoot, plan, glob, pointer) {
|
|
32147
|
-
const abs =
|
|
32332
|
+
const abs = join39(repoRoot, DOC_OWNERS_PATH);
|
|
32148
32333
|
if (plan.action === "create-host") {
|
|
32149
32334
|
mkdirSync15(dirname23(abs), { recursive: true });
|
|
32150
32335
|
writeFileSync26(abs, freshDocOwners(glob, pointer), "utf-8");
|
|
32151
32336
|
} else if (plan.action === "append-row") {
|
|
32152
|
-
const existing =
|
|
32337
|
+
const existing = readFileSync42(abs, "utf-8");
|
|
32153
32338
|
writeFileSync26(abs, appendDocOwnersBinding(existing, glob, pointer), "utf-8");
|
|
32154
32339
|
}
|
|
32155
32340
|
}
|
|
@@ -32213,7 +32398,7 @@ function pointerIsMissingLocalFile(repoRoot, pointer) {
|
|
|
32213
32398
|
if (/^https?:\/\//i.test(pointer))
|
|
32214
32399
|
return false;
|
|
32215
32400
|
const path = pointer.split("#")[0] ?? pointer;
|
|
32216
|
-
return !
|
|
32401
|
+
return !existsSync36(join40(repoRoot, path));
|
|
32217
32402
|
}
|
|
32218
32403
|
async function bindDocOwnerLoop(deps, repoRoot) {
|
|
32219
32404
|
let any = false;
|
|
@@ -32280,7 +32465,7 @@ async function registerProjectLoop(deps) {
|
|
|
32280
32465
|
}
|
|
32281
32466
|
}
|
|
32282
32467
|
function readPackageVersion() {
|
|
32283
|
-
const pkg = JSON.parse(
|
|
32468
|
+
const pkg = JSON.parse(readFileSync43(join40(packageRoot(import.meta.url), "package.json"), "utf-8"));
|
|
32284
32469
|
return pkg.version;
|
|
32285
32470
|
}
|
|
32286
32471
|
function realDeps7() {
|
|
@@ -32709,9 +32894,9 @@ async function reviewStatusCommand(args) {
|
|
|
32709
32894
|
|
|
32710
32895
|
// src/commands/studio.ts
|
|
32711
32896
|
import { execFile as execFile9, spawn as spawn6 } from "node:child_process";
|
|
32712
|
-
import { existsSync as
|
|
32897
|
+
import { existsSync as existsSync37, readFileSync as readFileSync44, renameSync as renameSync5 } from "node:fs";
|
|
32713
32898
|
import net from "node:net";
|
|
32714
|
-
import { dirname as dirname24, join as
|
|
32899
|
+
import { dirname as dirname24, join as join41 } from "node:path";
|
|
32715
32900
|
import { promisify as promisify9 } from "node:util";
|
|
32716
32901
|
|
|
32717
32902
|
// src/lib/studio-bundle.ts
|
|
@@ -32764,25 +32949,25 @@ class PortFlagError extends Error {
|
|
|
32764
32949
|
function resolveStudioTarget(cwd, moduleUrl = import.meta.url) {
|
|
32765
32950
|
let dir = cwd;
|
|
32766
32951
|
for (;; ) {
|
|
32767
|
-
const webDir =
|
|
32768
|
-
const pkgPath =
|
|
32769
|
-
if (
|
|
32952
|
+
const webDir = join41(dir, "apps", "vinaya-studio", "web");
|
|
32953
|
+
const pkgPath = join41(webDir, "package.json");
|
|
32954
|
+
if (existsSync37(pkgPath)) {
|
|
32770
32955
|
try {
|
|
32771
|
-
const pkg = JSON.parse(
|
|
32956
|
+
const pkg = JSON.parse(readFileSync44(pkgPath, "utf-8"));
|
|
32772
32957
|
if (pkg.name === "@atta/vinaya-studio-web") {
|
|
32773
32958
|
return { kind: "workspace", webDir };
|
|
32774
32959
|
}
|
|
32775
32960
|
} catch {}
|
|
32776
32961
|
}
|
|
32777
|
-
if (
|
|
32962
|
+
if (existsSync37(join41(dir, ".git")))
|
|
32778
32963
|
break;
|
|
32779
32964
|
const parent = dirname24(dir);
|
|
32780
32965
|
if (parent === dir)
|
|
32781
32966
|
break;
|
|
32782
32967
|
dir = parent;
|
|
32783
32968
|
}
|
|
32784
|
-
const standaloneWebDir =
|
|
32785
|
-
if (
|
|
32969
|
+
const standaloneWebDir = join41(packageRoot(moduleUrl), "studio-standalone", "apps", "vinaya-studio", "web");
|
|
32970
|
+
if (existsSync37(join41(standaloneWebDir, "server.js"))) {
|
|
32786
32971
|
return { kind: "package", packageDir: standaloneWebDir };
|
|
32787
32972
|
}
|
|
32788
32973
|
return { kind: "missing" };
|
|
@@ -32802,9 +32987,9 @@ function isPortFree(port) {
|
|
|
32802
32987
|
});
|
|
32803
32988
|
}
|
|
32804
32989
|
function ensureStudioNodeModules(bundleRoot) {
|
|
32805
|
-
const real =
|
|
32806
|
-
const packed =
|
|
32807
|
-
if (!
|
|
32990
|
+
const real = join41(bundleRoot, "node_modules");
|
|
32991
|
+
const packed = join41(bundleRoot, STUDIO_NODE_MODULES_PACKED_DIRNAME);
|
|
32992
|
+
if (!existsSync37(real) && existsSync37(packed)) {
|
|
32808
32993
|
renameSync5(packed, real);
|
|
32809
32994
|
}
|
|
32810
32995
|
}
|
|
@@ -32853,8 +33038,8 @@ async function runStudio(cwd, args, moduleUrl = import.meta.url) {
|
|
|
32853
33038
|
}
|
|
32854
33039
|
return spawnDev(target.webDir, args);
|
|
32855
33040
|
case "package": {
|
|
32856
|
-
const bundleRoot =
|
|
32857
|
-
return spawnStandalone(cwd,
|
|
33041
|
+
const bundleRoot = join41(target.packageDir, "..", "..", "..");
|
|
33042
|
+
return spawnStandalone(cwd, join41(target.packageDir, "server.js"), bundleRoot, explicitPort);
|
|
32858
33043
|
}
|
|
32859
33044
|
case "missing":
|
|
32860
33045
|
console.error("Vinaya Studio isn't available in this install — no published @attalabs/vinaya build bundles the Studio app yet. Inside a checkout that contains Studio's source (apps/vinaya-studio/web), `vinaya studio` runs it directly.");
|
|
@@ -33303,8 +33488,8 @@ async function taskToolsServeCommand(_args) {
|
|
|
33303
33488
|
}
|
|
33304
33489
|
|
|
33305
33490
|
// src/commands/upgrade.ts
|
|
33306
|
-
import { existsSync as
|
|
33307
|
-
import { join as
|
|
33491
|
+
import { existsSync as existsSync38, readFileSync as readFileSync45, rmSync as rmSync15, writeFileSync as writeFileSync27 } from "node:fs";
|
|
33492
|
+
import { join as join42 } from "node:path";
|
|
33308
33493
|
function realDeps9() {
|
|
33309
33494
|
return {
|
|
33310
33495
|
detectRepo: detectGitRepo,
|
|
@@ -33322,12 +33507,12 @@ function flags2(args) {
|
|
|
33322
33507
|
return { dryRun: args.includes("--dry-run"), yes: args.includes("--yes") };
|
|
33323
33508
|
}
|
|
33324
33509
|
function readManifest5(repoRoot) {
|
|
33325
|
-
const p =
|
|
33326
|
-
if (!
|
|
33510
|
+
const p = join42(repoRoot, CONFIG_PATH);
|
|
33511
|
+
if (!existsSync38(p))
|
|
33327
33512
|
return { kind: "missing" };
|
|
33328
33513
|
let raw;
|
|
33329
33514
|
try {
|
|
33330
|
-
raw = JSON.parse(
|
|
33515
|
+
raw = JSON.parse(readFileSync45(p, "utf-8"));
|
|
33331
33516
|
} catch (err) {
|
|
33332
33517
|
return { kind: "invalid", error: `invalid JSON: ${err.message}` };
|
|
33333
33518
|
}
|
|
@@ -33354,8 +33539,8 @@ function planRingsMigration(manifestVersion, rings) {
|
|
|
33354
33539
|
return { ring1, ring2 };
|
|
33355
33540
|
}
|
|
33356
33541
|
function writeManifestVersion(repoRoot, manifest, ringsMigration) {
|
|
33357
|
-
const configAbs =
|
|
33358
|
-
const seed = JSON.parse(
|
|
33542
|
+
const configAbs = join42(repoRoot, CONFIG_PATH);
|
|
33543
|
+
const seed = JSON.parse(readFileSync45(configAbs, "utf-8"));
|
|
33359
33544
|
const updated = { ...manifest, version: MANAGED_MANIFEST_VERSION };
|
|
33360
33545
|
const rings = ringsMigration ? {
|
|
33361
33546
|
...seed.rings,
|
|
@@ -33367,9 +33552,9 @@ function writeManifestVersion(repoRoot, manifest, ringsMigration) {
|
|
|
33367
33552
|
}
|
|
33368
33553
|
function stripFor(repoRoot, path, marker, comment) {
|
|
33369
33554
|
const abs = resolveManagedBlockPath(repoRoot, path);
|
|
33370
|
-
if (!
|
|
33555
|
+
if (!existsSync38(abs))
|
|
33371
33556
|
return { path, marker, comment, present: false, removesHost: false };
|
|
33372
|
-
const stripped = stripBlockFromContent(
|
|
33557
|
+
const stripped = stripBlockFromContent(readFileSync45(abs, "utf-8"), marker, comment);
|
|
33373
33558
|
if (stripped === null)
|
|
33374
33559
|
return { path, marker, comment, present: false, removesHost: false };
|
|
33375
33560
|
return { path, marker, comment, present: true, removesHost: blockStripLeavesEmpty(stripped) };
|
|
@@ -33396,9 +33581,9 @@ function planHookRouting(repoRoot, manifest, recorded, hooksPathValue) {
|
|
|
33396
33581
|
const blocked = [];
|
|
33397
33582
|
for (const b of legacy) {
|
|
33398
33583
|
const abs = resolveManagedBlockPath(repoRoot, b.path);
|
|
33399
|
-
if (!
|
|
33584
|
+
if (!existsSync38(abs))
|
|
33400
33585
|
continue;
|
|
33401
|
-
const stripped = stripBlockFromContent(
|
|
33586
|
+
const stripped = stripBlockFromContent(readFileSync45(abs, "utf-8"), b.marker, b.comment);
|
|
33402
33587
|
if (stripped === null)
|
|
33403
33588
|
blocked.push(`${b.path} exists without vinaya's managed block`);
|
|
33404
33589
|
else if (!blockStripLeavesEmpty(stripped))
|
|
@@ -33433,7 +33618,7 @@ function planUpgrade(ops, repoRoot, manifest, routing, staleManagedPaths = []) {
|
|
|
33433
33618
|
const entries = [];
|
|
33434
33619
|
const staleFiles = staleManagedPaths.map((path) => ({
|
|
33435
33620
|
path,
|
|
33436
|
-
present:
|
|
33621
|
+
present: existsSync38(join42(repoRoot, path))
|
|
33437
33622
|
}));
|
|
33438
33623
|
let hasChanges = routing.arm || routing.migratesManifest || routing.strips.some((s) => s.present) || staleFiles.some((f) => f.present);
|
|
33439
33624
|
const ownedFiles = new Set(manifest.files);
|
|
@@ -33441,8 +33626,8 @@ function planUpgrade(ops, repoRoot, manifest, routing, staleManagedPaths = []) {
|
|
|
33441
33626
|
const ownedBlocks = new Set(manifest.blocks.map((b) => blockKey(b.path, b.marker)));
|
|
33442
33627
|
for (const op of ops) {
|
|
33443
33628
|
if (op.kind === "create-file") {
|
|
33444
|
-
const abs =
|
|
33445
|
-
const exists =
|
|
33629
|
+
const abs = join42(repoRoot, op.path);
|
|
33630
|
+
const exists = existsSync38(abs);
|
|
33446
33631
|
const owned = ownedFiles.has(op.path) || isDefaultedAgentVendorPath(op.path, manifest);
|
|
33447
33632
|
let action;
|
|
33448
33633
|
let triggerChange;
|
|
@@ -33460,7 +33645,7 @@ function planUpgrade(ops, repoRoot, manifest, routing, staleManagedPaths = []) {
|
|
|
33460
33645
|
action = "recreate";
|
|
33461
33646
|
hasChanges = true;
|
|
33462
33647
|
} else {
|
|
33463
|
-
const diskContent =
|
|
33648
|
+
const diskContent = readFileSync45(abs, "utf-8");
|
|
33464
33649
|
if (diskContent !== op.content) {
|
|
33465
33650
|
action = "regenerate";
|
|
33466
33651
|
hasChanges = true;
|
|
@@ -33482,11 +33667,11 @@ function planUpgrade(ops, repoRoot, manifest, routing, staleManagedPaths = []) {
|
|
|
33482
33667
|
let action;
|
|
33483
33668
|
if (!owned) {
|
|
33484
33669
|
action = "not-installed";
|
|
33485
|
-
} else if (!
|
|
33670
|
+
} else if (!existsSync38(abs)) {
|
|
33486
33671
|
action = "recreate-host";
|
|
33487
33672
|
hasChanges = true;
|
|
33488
33673
|
} else {
|
|
33489
|
-
const content =
|
|
33674
|
+
const content = readFileSync45(abs, "utf-8");
|
|
33490
33675
|
const { begin, end } = markerLines(op.marker, op.comment);
|
|
33491
33676
|
if (!(content.includes(begin) && content.includes(end))) {
|
|
33492
33677
|
action = "recreate-append";
|
|
@@ -33625,7 +33810,7 @@ function renderUpgradeDiff(plan) {
|
|
|
33625
33810
|
}
|
|
33626
33811
|
function regenerateBlock(repoRoot, op) {
|
|
33627
33812
|
const abs = resolveManagedBlockPath(repoRoot, op.path);
|
|
33628
|
-
const content =
|
|
33813
|
+
const content = readFileSync45(abs, "utf-8");
|
|
33629
33814
|
const stripped = stripBlockFromContent(content, op.marker, op.comment);
|
|
33630
33815
|
if (stripped !== null) {
|
|
33631
33816
|
writeFileSync27(abs, stripped.endsWith(`
|
|
@@ -33638,7 +33823,7 @@ function applyUpgrade(plan, repoRoot) {
|
|
|
33638
33823
|
for (const e of plan.entries) {
|
|
33639
33824
|
if (e.kind === "create-file") {
|
|
33640
33825
|
if (e.action === "regenerate" || e.action === "recreate") {
|
|
33641
|
-
writeFileWithDirs(
|
|
33826
|
+
writeFileWithDirs(join42(repoRoot, e.op.path), e.op.content, e.op.mode);
|
|
33642
33827
|
}
|
|
33643
33828
|
} else {
|
|
33644
33829
|
if (e.action === "recreate-host")
|
|
@@ -33660,9 +33845,9 @@ function applyUpgrade(plan, repoRoot) {
|
|
|
33660
33845
|
if (!s.present)
|
|
33661
33846
|
continue;
|
|
33662
33847
|
const abs = resolveManagedBlockPath(repoRoot, s.path);
|
|
33663
|
-
if (!
|
|
33848
|
+
if (!existsSync38(abs))
|
|
33664
33849
|
continue;
|
|
33665
|
-
const stripped = stripBlockFromContent(
|
|
33850
|
+
const stripped = stripBlockFromContent(readFileSync45(abs, "utf-8"), s.marker, s.comment);
|
|
33666
33851
|
if (stripped === null)
|
|
33667
33852
|
continue;
|
|
33668
33853
|
if (blockStripLeavesEmpty(stripped))
|
|
@@ -33919,7 +34104,7 @@ function printHelp() {
|
|
|
33919
34104
|
}
|
|
33920
34105
|
|
|
33921
34106
|
// src/index.ts
|
|
33922
|
-
var PACKAGE_ROOT2 =
|
|
34107
|
+
var PACKAGE_ROOT2 = join43(dirname25(fileURLToPath2(import.meta.url)), "..");
|
|
33923
34108
|
function maybeDeferToAuthorRepoSource() {
|
|
33924
34109
|
if (process.env.VINAYA_NO_DEFER === "1")
|
|
33925
34110
|
return;
|
|
@@ -33948,7 +34133,7 @@ function maybeDeferToAuthorRepoSource() {
|
|
|
33948
34133
|
}
|
|
33949
34134
|
maybeDeferToAuthorRepoSource();
|
|
33950
34135
|
function readVersion2() {
|
|
33951
|
-
const pkg = JSON.parse(
|
|
34136
|
+
const pkg = JSON.parse(readFileSync46(join43(PACKAGE_ROOT2, "package.json"), "utf-8"));
|
|
33952
34137
|
return pkg.version;
|
|
33953
34138
|
}
|
|
33954
34139
|
var [, , command, ...args] = process.argv;
|
|
@@ -34169,6 +34354,16 @@ try {
|
|
|
34169
34354
|
await devReviewLoopCommand(args);
|
|
34170
34355
|
break;
|
|
34171
34356
|
}
|
|
34357
|
+
case "log": {
|
|
34358
|
+
const [subcommand, ...rest] = args;
|
|
34359
|
+
if (subcommand === "send") {
|
|
34360
|
+
await logSendCommand(rest);
|
|
34361
|
+
} else {
|
|
34362
|
+
console.error(`Unknown 'log' subcommand: ${subcommand ?? "(none)"} (expected 'send')`);
|
|
34363
|
+
process.exit(2);
|
|
34364
|
+
}
|
|
34365
|
+
break;
|
|
34366
|
+
}
|
|
34172
34367
|
default:
|
|
34173
34368
|
console.error(`Unknown command: ${command}`);
|
|
34174
34369
|
printHelp();
|