@joshuafolkken/kit 1.1128.0 → 1.1166.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/.claude/agents/investigator.md +17 -0
- package/.claude/settings.json +5 -4
- package/.claude/skills/epic-commands/SKILL.md +27 -239
- package/.claude/skills/epic-commands/epic-bundle.md +115 -0
- package/.claude/skills/epic-commands/execution-waves.md +126 -0
- package/.claude/skills/workflow-commands/SKILL.md +48 -194
- package/.claude/skills/workflow-commands/background-commands.md +1 -1
- package/.claude/skills/workflow-commands/backlogrun-child.md +12 -123
- package/.claude/skills/workflow-commands/backlogrun-lanes.md +11 -60
- package/.claude/skills/workflow-commands/backlogrun-park.md +10 -8
- package/.claude/skills/workflow-commands/backlogrun-progress.md +19 -175
- package/.claude/skills/workflow-commands/backlogrun-recovery.md +155 -0
- package/.claude/skills/workflow-commands/backlogrun-steps.md +64 -144
- package/.claude/skills/workflow-commands/backlogrun.md +5 -4
- package/.claude/skills/workflow-commands/chain-rule.md +3 -2
- package/.claude/skills/workflow-commands/delegation.md +7 -3
- package/.claude/skills/workflow-commands/entry-sequence.md +62 -0
- package/.claude/skills/workflow-commands/followup.md +104 -181
- package/.claude/skills/workflow-commands/fullrun-steps.md +8 -9
- package/.claude/skills/workflow-commands/fullrun.md +16 -73
- package/.claude/skills/workflow-commands/halfrun.md +10 -36
- package/.claude/skills/workflow-commands/into-target.md +4 -4
- package/.claude/skills/workflow-commands/issue-comments.md +7 -8
- package/.claude/skills/workflow-commands/issue-scout.md +6 -6
- package/.claude/skills/workflow-commands/kickoff.md +6 -6
- package/.claude/skills/workflow-commands/needs-human-review.md +6 -6
- package/.claude/skills/workflow-commands/observation-filing.md +21 -172
- package/.claude/skills/workflow-commands/observation-ledger.md +150 -0
- package/.claude/skills/workflow-commands/pre-gate-cut.md +33 -93
- package/.claude/skills/workflow-commands/prerequisite.md +6 -6
- package/.claude/skills/workflow-commands/progress-watcher.md +90 -0
- package/.claude/skills/workflow-commands/prrun.md +5 -5
- package/.claude/skills/workflow-commands/retrospective.md +9 -9
- package/.claude/skills/workflow-commands/split-assessment.md +2 -2
- package/.claude/skills/workflow-commands/target-repository.md +2 -2
- package/.claude/skills/workflow-commands/working-tree-hold.md +7 -5
- package/.codex/hooks.json +4 -4
- package/AGENTS.md +1 -6
- package/CLAUDE.md +58 -120
- package/GEMINI.md +1 -6
- package/SECURITY.md +1 -0
- package/dist/CLAUDE.md +58 -120
- package/dist/hooks/batch-guard.js +4 -4
- package/dist/hooks/{chunk-MKVGBQPA.js → chunk-5KTCMCOT.js} +14 -1
- package/dist/hooks/{chunk-NXYMNPUQ.js → chunk-A6P7PN7P.js} +59 -21
- package/dist/hooks/{chunk-77J7IEQM.js → chunk-ANJ2WGFD.js} +1 -1
- package/dist/hooks/{chunk-4JZDP5X5.js → chunk-DYAVAM6S.js} +572 -127
- package/dist/hooks/{chunk-7HVB7SZG.js → chunk-ENA7P5FB.js} +4 -4
- package/dist/hooks/{chunk-M7QKEKWO.js → chunk-GU5MATVE.js} +214 -85
- package/dist/hooks/chunk-GYNGP7HI.js +56 -0
- package/dist/hooks/{chunk-5SD2YM7Z.js → chunk-URJA6XY4.js} +4 -4
- package/dist/hooks/{chunk-XYUIQOW3.js → chunk-V2BTOZHT.js} +6 -4
- package/dist/hooks/{chunk-AIOIOMPX.js → chunk-ZDZ555YH.js} +225 -78
- package/dist/hooks/codex-hook-adapter.js +10 -10
- package/dist/hooks/duplicate-read-guard.js +5 -5
- package/dist/hooks/format-edited.js +2 -2
- package/dist/hooks/inputs.json +186 -184
- package/dist/hooks/investigation-guard.js +5 -5
- package/dist/hooks/pretool-guard.js +11 -10
- package/dist/hooks/stop-guard.js +5 -5
- package/dist/josh.js +33 -3
- package/dist/version/index.js +5 -1
- package/package.json +7 -4
- package/prompts/collaboration-workflow/file-edits.md +11 -10
- package/prompts/collaboration-workflow/gh-rest.md +2 -4
- package/prompts/collaboration-workflow/glossary.md +1 -1
- package/prompts/collaboration-workflow/issue-citation.md +5 -9
- package/prompts/collaboration-workflow/issue-template.md +40 -115
- package/prompts/collaboration-workflow/operating-rules.md +4 -5
- package/prompts/collaboration-workflow/output-bounds.md +12 -78
- package/prompts/collaboration-workflow/overview.md +7 -13
- package/prompts/collaboration-workflow/plan-comment.md +11 -39
- package/prompts/collaboration-workflow/principles.md +3 -4
- package/prompts/collaboration-workflow/report-format.md +28 -74
- package/prompts/collaboration-workflow/residency.md +12 -109
- package/prompts/collaboration-workflow/rule-delivery.md +98 -97
- package/prompts/collaboration-workflow/shell-body.md +3 -13
- package/prompts/collaboration-workflow/turn-batching.md +14 -88
- package/prompts/collaboration-workflow/upstream-interrupt.md +12 -14
- package/prompts/collaboration-workflow/wip-cap.md +6 -45
- package/prompts/collaboration-workflow.md +1 -13
- package/prompts/review-rubric.md +8 -71
- package/prompts/review.md +25 -55
- package/prompts/testing-guide.md +18 -67
- package/scripts/agent/agent-role-profile.ts +1 -1
- package/scripts/agent/codex-hooks.ts +3 -12
- package/scripts/backlog/backlog-budget.ts +1 -1
- package/scripts/backlog/backlog-drive-cli.ts +4 -3
- package/scripts/backlog/backlog-drive-offer-argv.ts +10 -1
- package/scripts/backlog/backlog-offer.ts +6 -6
- package/scripts/behavior/behavior-rules.ts +11 -4
- package/scripts/delegation/delegation-policy.ts +9 -1
- package/scripts/delegation/investigation-guard.ts +1 -1
- package/scripts/delegation/investigation-reads.ts +109 -23
- package/scripts/discovery/repo-discovery.ts +21 -7
- package/scripts/discovery/repo-origin.ts +26 -0
- package/scripts/discovery/repo-party.ts +42 -1
- package/scripts/document/backlogrun-parent-read-set.ts +14 -15
- package/scripts/document/capped-print.ts +74 -0
- package/scripts/document/document-byte-budget.ts +34 -20
- package/scripts/document/document-section-cli.ts +4 -3
- package/scripts/document/entry-read-budget.ts +21 -9
- package/scripts/document/lane-child-read-set.ts +12 -14
- package/scripts/document/read-set-cli.ts +4 -4
- package/scripts/document/read-set-point-of-use.ts +10 -2
- package/scripts/document/resident-budget.ts +47 -0
- package/scripts/epic/epic-shape.ts +10 -13
- package/scripts/epic/epic-solo.ts +1 -1
- package/scripts/exports/unused-members-cli.ts +7 -3
- package/scripts/gate/scoped-green.ts +25 -14
- package/scripts/gh/git-gh-api-path.ts +7 -0
- package/scripts/hooks/pretool-guard-cli.ts +2 -2
- package/scripts/hooks/pretool-guard.ts +45 -2
- package/scripts/hooks/run-hook.sh +41 -0
- package/scripts/init/claude-kit-only-settings.ts +29 -0
- package/scripts/init/hook-command-rewrite.ts +18 -35
- package/scripts/init/hook-launch.ts +21 -32
- package/scripts/init/init-copy-content.ts +8 -2
- package/scripts/init/initial-commit.ts +24 -0
- package/scripts/init/start-exec.ts +16 -3
- package/scripts/init/start-steps.ts +8 -12
- package/scripts/issue/issue-auto-ok.ts +95 -0
- package/scripts/issue/issue-file-cli.ts +53 -7
- package/scripts/issue/issue-file.ts +28 -5
- package/scripts/issue/issue-labels.ts +12 -12
- package/scripts/issue/issue-rank.ts +1 -1
- package/scripts/issue/issue-read-cli.ts +4 -3
- package/scripts/issue/issue-read.ts +2 -2
- package/scripts/issue/issue-report-failures.ts +6 -2
- package/scripts/issue/issue-scout-cli.ts +2 -2
- package/scripts/issue/issue-state-cli.ts +2 -2
- package/scripts/issue/issue-state.ts +2 -2
- package/scripts/issue/issue-wip.ts +70 -0
- package/scripts/josh/hook-decision.ts +17 -0
- package/scripts/josh/josh-commands-development.ts +10 -0
- package/scripts/josh/josh-commands-issue.ts +2 -2
- package/scripts/josh/josh-commands-lane.ts +1 -1
- package/scripts/josh/josh-commands-project.ts +7 -0
- package/scripts/lane/lane-await.ts +46 -2
- package/scripts/lane/lane-cli.ts +11 -13
- package/scripts/lines/bytes-command.ts +29 -6
- package/scripts/observations/observation-ledger-line.ts +1 -1
- package/scripts/release/github-release-environment.ts +1 -0
- package/scripts/release/github-release.ts +103 -17
- package/scripts/release/release-progress.ts +167 -0
- package/scripts/release/release-publish.ts +19 -8
- package/scripts/release/release-tag.ts +22 -8
- package/scripts/rules/decision-oracle-stage.ts +1 -1
- package/scripts/rules/decision-oracle.ts +6 -6
- package/scripts/rules/delivered-rules.ts +11 -11
- package/scripts/rules/direct-pr-create.ts +110 -0
- package/scripts/rules/file-body.ts +98 -42
- package/scripts/rules/filing-cap.ts +2 -2
- package/scripts/rules/filing-offer.ts +1 -1
- package/scripts/rules/gh-api.ts +18 -1
- package/scripts/rules/implementation-cut.ts +3 -1
- package/scripts/rules/lane-background.ts +67 -10
- package/scripts/rules/permission-guards.ts +10 -2
- package/scripts/rules/stop-rules.ts +4 -4
- package/scripts/rules/test-declared-commit.ts +1 -1
- package/scripts/rules/third-party-write.ts +56 -12
- package/scripts/run/run-carry-cli.ts +3 -1
- package/scripts/run/run-carry-conversation.ts +94 -0
- package/scripts/run/run-carry-reclaim.ts +37 -0
- package/scripts/run/run-carry.ts +21 -5
- package/scripts/run/run-cut-handoff.ts +21 -1
- package/scripts/run/run-entry-cli.ts +11 -3
- package/scripts/run/run-hold-cli.ts +16 -2
- package/scripts/run/run-label.ts +50 -0
- package/scripts/run/run-merge-steps.ts +12 -4
- package/scripts/run/run-merge.ts +1 -1
- package/scripts/run/run-prep-cli.ts +6 -2
- package/scripts/run/run-prep.ts +17 -0
- package/scripts/run/run-ship-preflight.ts +34 -3
- package/scripts/run/run-ship-review-steps.ts +1 -1
- package/scripts/run/run-ship-review.ts +26 -5
- package/scripts/run/run-step-cli.ts +20 -7
- package/scripts/run/run-wake-driver.ts +24 -1
- package/scripts/run/run-wake-session.ts +2 -1
- package/scripts/test/test-declared-logic.ts +1 -1
- package/scripts/test/test-related.ts +1 -6
- package/scripts/test/test-unit-guard.ts +21 -7
- package/scripts/time-runtime/time-batch-guard.ts +52 -16
- package/scripts/time-runtime/time-density-hook.ts +20 -2
- package/scripts/time-runtime/time-density.ts +4 -3
- package/scripts/time-runtime/time-markers.ts +15 -4
- package/scripts/time-runtime/time-spans.ts +4 -0
- package/scripts/version/npm-registry.ts +11 -1
- package/templates/workflows/ci.yml +9 -1
- package/templates/workflows/github-release.yml +13 -25
- package/.claude/skills/workflow-commands/followup-reference.md +0 -118
- package/dist/hooks/chunk-QVLT52OV.js +0 -464
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
lane_child_marker,
|
|
3
3
|
run_issue_number
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5KTCMCOT.js";
|
|
5
5
|
import {
|
|
6
6
|
PLATFORM_TEMP_ROOT,
|
|
7
7
|
cost_blocks,
|
|
8
|
+
cost_transcript,
|
|
8
9
|
cost_usage,
|
|
9
10
|
file_reader,
|
|
10
11
|
json_value,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
time_density_hook,
|
|
14
15
|
time_shell,
|
|
15
16
|
time_transcript_line
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-DYAVAM6S.js";
|
|
17
18
|
import {
|
|
18
19
|
ENV_FILE_NAME,
|
|
19
20
|
LANE_SEAT_KEY,
|
|
@@ -146,7 +147,7 @@ function turn_filing_count(tail) {
|
|
|
146
147
|
function decide(_call, run3) {
|
|
147
148
|
return prior_filing_count(time_density_hook.read_tail(run3.transcript)) >= CAP_REACHED;
|
|
148
149
|
}
|
|
149
|
-
var FILING_CAP_REASON = `\u26D4 filing cap: this run has already filed ${String(FILING_CAP)} Issues, the per-run ceiling \u2014 on reaching it, stop and report rather than filing more. Automatic filing is capped so a run cannot manufacture Issues faster than they can be closed (\`.claude/skills/workflow-commands/SKILL.md\` \u2192
|
|
150
|
+
var FILING_CAP_REASON = `\u26D4 filing cap: this run has already filed ${String(FILING_CAP)} Issues, the per-run ceiling \u2014 on reaching it, stop and report rather than filing more. Automatic filing is capped so a run cannot manufacture Issues faster than they can be closed (\`.claude/skills/workflow-commands/SKILL.md\` \u2192 \`prerequisite.md\`, \`observation-filing.md\`). A further Issue that genuinely must exist is a person's call, not this run's. **This rule fires on every filing past the cap, not once per run**, so reissuing the same filing will be refused again.`;
|
|
150
151
|
var ROW = {
|
|
151
152
|
id: "filing-cap",
|
|
152
153
|
is_trigger: bash_triggers.on_bash_command(bash_triggers.is_issue_filing),
|
|
@@ -1593,6 +1594,11 @@ var REMAINING_LABEL = "Remaining";
|
|
|
1593
1594
|
var UNTOUCHED_LABEL = "Deliberately untouched";
|
|
1594
1595
|
var INSTRUCTION_LABEL = "Instruction (verbatim)";
|
|
1595
1596
|
var EMPTY_LIST_NOTE = "(none)";
|
|
1597
|
+
function describe_key(key2) {
|
|
1598
|
+
const value = handoff_schema.shape[key2] instanceof z4.ZodArray ? '["\u2026"]' : '"\u2026"';
|
|
1599
|
+
return `"${key2}": ${value}`;
|
|
1600
|
+
}
|
|
1601
|
+
var HANDOFF_FORMAT = `a JSON object {${handoff_schema.keyof().options.map((key2) => describe_key(key2)).join(", ")}}`;
|
|
1596
1602
|
function parse_handoff(raw) {
|
|
1597
1603
|
try {
|
|
1598
1604
|
const parsed = handoff_schema.safeParse(JSON.parse(raw));
|
|
@@ -1618,7 +1624,10 @@ function load_handoff(handoff_path, max_bytes) {
|
|
|
1618
1624
|
if (handoff_path === void 0) return { kind: "ok", handoff: void 0 };
|
|
1619
1625
|
const handoff = read_handoff_file(handoff_path);
|
|
1620
1626
|
if (handoff === void 0) {
|
|
1621
|
-
return {
|
|
1627
|
+
return {
|
|
1628
|
+
kind: "bad",
|
|
1629
|
+
note: `--handoff ${handoff_path} is not a readable handoff file \u2014 write ${HANDOFF_FORMAT}`
|
|
1630
|
+
};
|
|
1622
1631
|
}
|
|
1623
1632
|
if (!is_within_bound(handoff, max_bytes)) {
|
|
1624
1633
|
return { kind: "bad", note: `--handoff ${handoff_path} is too large to carry across the cut` };
|
|
@@ -1641,6 +1650,7 @@ ${handoff.instruction}`,
|
|
|
1641
1650
|
].join("\n\n");
|
|
1642
1651
|
}
|
|
1643
1652
|
var run_cut_handoff = {
|
|
1653
|
+
HANDOFF_FORMAT,
|
|
1644
1654
|
describe_handoff,
|
|
1645
1655
|
handoff_schema,
|
|
1646
1656
|
is_complete_handoff,
|
|
@@ -1898,24 +1908,47 @@ var run_tail = {
|
|
|
1898
1908
|
};
|
|
1899
1909
|
|
|
1900
1910
|
// scripts/rules/lane-background.ts
|
|
1901
|
-
var
|
|
1902
|
-
|
|
1903
|
-
)
|
|
1911
|
+
var SHIP_COMMAND = `${time_shell.JOSH_PREFIX}ship`;
|
|
1912
|
+
var LONG_RUNNING_COMMANDS = /* @__PURE__ */ new Set([
|
|
1913
|
+
...["gate", "git", "followup"].map((name) => `${time_shell.JOSH_PREFIX}${name}`),
|
|
1914
|
+
SHIP_COMMAND
|
|
1915
|
+
]);
|
|
1904
1916
|
var BACKGROUND_KEY2 = "run_in_background";
|
|
1917
|
+
var TIMEOUT_KEY = "timeout";
|
|
1918
|
+
var FOREGROUND_TIMEOUT_MS = 6e5;
|
|
1905
1919
|
function is_backgrounded2(input) {
|
|
1906
1920
|
return json_value.is_record(input) && input[BACKGROUND_KEY2] === true;
|
|
1907
1921
|
}
|
|
1908
|
-
function
|
|
1909
|
-
return time_shell.josh_commands_of(command).
|
|
1922
|
+
function long_commands_of(command) {
|
|
1923
|
+
return time_shell.josh_commands_of(command).filter((name) => LONG_RUNNING_COMMANDS.has(name));
|
|
1924
|
+
}
|
|
1925
|
+
function ships_alone(command) {
|
|
1926
|
+
const names = long_commands_of(command);
|
|
1927
|
+
return names.length > 0 && names.every((name) => name === SHIP_COMMAND);
|
|
1928
|
+
}
|
|
1929
|
+
function backgrounded_bash_command(call) {
|
|
1930
|
+
if (call.name !== cost_blocks.BASH_TOOL || !is_backgrounded2(call.input)) return void 0;
|
|
1931
|
+
return time_shell.bash_command(call.input);
|
|
1932
|
+
}
|
|
1933
|
+
function is_backgrounded_ship(call) {
|
|
1934
|
+
const command = backgrounded_bash_command(call);
|
|
1935
|
+
return command !== void 0 && ships_alone(command);
|
|
1910
1936
|
}
|
|
1911
1937
|
function is_candidate(call) {
|
|
1912
1938
|
if (run_tail.is_push_step_call(call)) return true;
|
|
1913
|
-
|
|
1914
|
-
|
|
1939
|
+
const command = backgrounded_bash_command(call);
|
|
1940
|
+
if (command === void 0 || is_backgrounded_ship(call)) return false;
|
|
1941
|
+
return long_commands_of(command).length > 0;
|
|
1915
1942
|
}
|
|
1916
1943
|
function is_background_long_run(call, is_lane_child = () => lane_child_marker.is_child_of(process.cwd())) {
|
|
1917
1944
|
return is_candidate(call) && is_lane_child();
|
|
1918
1945
|
}
|
|
1946
|
+
function foreground_input(call, is_lane_child = () => lane_child_marker.is_child_of(process.cwd())) {
|
|
1947
|
+
if (!is_backgrounded_ship(call) || !json_value.is_record(call.input)) return void 0;
|
|
1948
|
+
if (!is_lane_child()) return void 0;
|
|
1949
|
+
return { ...call.input, [BACKGROUND_KEY2]: false, [TIMEOUT_KEY]: FOREGROUND_TIMEOUT_MS };
|
|
1950
|
+
}
|
|
1951
|
+
var FOREGROUND_NOTE = "lane background: this lane child backgrounded `josh ship`, which would die with the headless turn before its supervisor exists \u2014 so it was run in the foreground instead, where it detaches itself after the preflight. End the turn on `launched` / `busy` (joshuafolkken/kit#3154).";
|
|
1919
1952
|
function unfinished_ids(tail, launched_ids) {
|
|
1920
1953
|
const lines = tail.split("\n").map((line) => time_transcript_line.parse_line(line));
|
|
1921
1954
|
const finished = new Set(lines.map((line) => line?.finished_background ?? ""));
|
|
@@ -1929,7 +1962,7 @@ function pending_background_ids(tail) {
|
|
|
1929
1962
|
function pending_agent_ids(tail) {
|
|
1930
1963
|
return unfinished_ids(tail, (block) => [block.agent_id]);
|
|
1931
1964
|
}
|
|
1932
|
-
var LANE_BACKGROUND_REASON = '\u26D4 lane background: this session is a dispatched lane child (`JOSH_LANE_CHILD`), a headless `claude -p` process whose background Bash tasks are killed when the turn ends \u2014 so a backgrounded `josh gate` / `josh git` / `josh followup` / `josh ship` never re-invokes you; it dies at `exit code 143` (joshuafolkken/kit#2704, measured on the #2606 child: implementation, review and live verification done, the run parked instead of merged). Hand the gate-to-merge region to the detached supervisor instead: `pnpm josh ship --detach --review "<title> #<N>"` (add `--cite <N>`) issued in the foreground \u2014 its preflight runs in this process before the supervisor exists, so a backgrounded `ship` dies with the turn (joshuafolkken/kit#3027) \u2014 then end the turn on `launched` / `busy`. `.claude/skills/workflow-commands/chain-rule.md` step 0 is the single source. A single check you must read before continuing runs in the foreground within the tool timeout; the commit-push step does not \u2014 in a child it too belongs to the detached ship, in either spelling. This rule fires on every occurrence, not once per run.';
|
|
1965
|
+
var LANE_BACKGROUND_REASON = '\u26D4 lane background: this session is a dispatched lane child (`JOSH_LANE_CHILD`), a headless `claude -p` process whose background Bash tasks are killed when the turn ends \u2014 so a backgrounded `josh gate` / `josh git` / `josh followup` / `josh ship` never re-invokes you; it dies at `exit code 143` (joshuafolkken/kit#2704, measured on the #2606 child: implementation, review and live verification done, the run parked instead of merged). Hand the gate-to-merge region to the detached supervisor instead: `pnpm josh ship --detach --review "<title> #<N>"` (add `--cite <N>`) issued in the foreground \u2014 its preflight runs in this process before the supervisor exists, so a backgrounded `ship` dies with the turn (joshuafolkken/kit#3027; a backgrounded `ship` issued alone is moved to the foreground for you, joshuafolkken/kit#3154) \u2014 then end the turn on `launched` / `busy`. `.claude/skills/workflow-commands/chain-rule.md` step 0 is the single source. A single check you must read before continuing runs in the foreground within the tool timeout; the commit-push step does not \u2014 in a child it too belongs to the detached ship, in either spelling. This rule fires on every occurrence, not once per run.';
|
|
1933
1966
|
var LANE_BACKGROUND_STOP_REASON = "\u26D4 lane background stop: this is a dispatched lane child (`JOSH_LANE_CHILD`) and a background task it launched has not finished \u2014 ending this headless turn kills it, and nothing re-invokes you afterwards (joshuafolkken/kit#2704). Do not send a notification and do not stop: wait for the task in the foreground and act on its result, or re-issue the work through `pnpm josh ship --detach`, whose supervisor outlives the turn (`.claude/skills/workflow-commands/chain-rule.md` step 0). Do not repeat your previous reply.";
|
|
1934
1967
|
var ROW2 = {
|
|
1935
1968
|
id: "lane-background",
|
|
@@ -1938,9 +1971,11 @@ var ROW2 = {
|
|
|
1938
1971
|
decide: () => true
|
|
1939
1972
|
};
|
|
1940
1973
|
var lane_background = {
|
|
1974
|
+
FOREGROUND_NOTE,
|
|
1941
1975
|
LANE_BACKGROUND_REASON,
|
|
1942
1976
|
LANE_BACKGROUND_STOP_REASON,
|
|
1943
1977
|
ROW: ROW2,
|
|
1978
|
+
foreground_input,
|
|
1944
1979
|
is_background_long_run,
|
|
1945
1980
|
pending_agent_ids,
|
|
1946
1981
|
pending_background_ids
|
|
@@ -2199,6 +2234,67 @@ function apply_change(target, carry, change, now = /* @__PURE__ */ new Date()) {
|
|
|
2199
2234
|
}
|
|
2200
2235
|
var run_carry_change = { apply_change };
|
|
2201
2236
|
|
|
2237
|
+
// scripts/run/run-carry-conversation.ts
|
|
2238
|
+
import { existsSync, statSync } from "node:fs";
|
|
2239
|
+
import path2 from "node:path";
|
|
2240
|
+
|
|
2241
|
+
// scripts/cost-runtime/own-session.ts
|
|
2242
|
+
var NOT_FOUND = -1;
|
|
2243
|
+
function session_id_of(environment2) {
|
|
2244
|
+
const value = environment2[agent_session_environment.SESSION_ID_KEY];
|
|
2245
|
+
return value === void 0 || value === "" ? void 0 : value;
|
|
2246
|
+
}
|
|
2247
|
+
function select_own_session(files, environment2) {
|
|
2248
|
+
const session_id = session_id_of(environment2);
|
|
2249
|
+
if (session_id === void 0) {
|
|
2250
|
+
return { kind: "own", index: cost_transcript.latest_own_index(files) };
|
|
2251
|
+
}
|
|
2252
|
+
const index = files.findIndex((file) => file.session_id === session_id);
|
|
2253
|
+
return index === NOT_FOUND ? { kind: "absent", session_id } : { kind: "own", index };
|
|
2254
|
+
}
|
|
2255
|
+
var own_session = {
|
|
2256
|
+
session_id_of,
|
|
2257
|
+
select_own_session
|
|
2258
|
+
};
|
|
2259
|
+
|
|
2260
|
+
// scripts/run/run-carry-conversation.ts
|
|
2261
|
+
var CONVERSATION_QUIET_MS = 6e5;
|
|
2262
|
+
function own_transcript(environment2 = process.env, directories2 = cost_transcript.transcript_directories(process.cwd())) {
|
|
2263
|
+
const session_id = own_session.session_id_of(environment2);
|
|
2264
|
+
if (session_id === void 0) return void 0;
|
|
2265
|
+
const name = `${session_id}${cost_transcript.TRANSCRIPT_EXTENSION}`;
|
|
2266
|
+
return directories2.map((directory) => path2.join(directory, name)).find((file) => existsSync(file));
|
|
2267
|
+
}
|
|
2268
|
+
function modified_ms(transcript) {
|
|
2269
|
+
try {
|
|
2270
|
+
return statSync(transcript).mtimeMs;
|
|
2271
|
+
} catch {
|
|
2272
|
+
return void 0;
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
function is_recent(modified, now) {
|
|
2276
|
+
return modified !== void 0 && now.getTime() - modified <= CONVERSATION_QUIET_MS;
|
|
2277
|
+
}
|
|
2278
|
+
function is_conversation_live(carry, now = /* @__PURE__ */ new Date(), read_modified = modified_ms) {
|
|
2279
|
+
if (carry.is_handed_off === true || carry.owner_transcript === void 0) return false;
|
|
2280
|
+
return is_recent(read_modified(carry.owner_transcript), now);
|
|
2281
|
+
}
|
|
2282
|
+
function is_same_conversation(carry, owner) {
|
|
2283
|
+
return owner.transcript !== void 0 && owner.transcript === carry.owner_transcript;
|
|
2284
|
+
}
|
|
2285
|
+
function reclaim_owner(carry, owner) {
|
|
2286
|
+
if (carry.is_handed_off === true || !is_same_conversation(carry, owner)) return carry;
|
|
2287
|
+
if (owner.pid === carry.owner_pid) return carry;
|
|
2288
|
+
return { ...carry, owner_pid: owner.pid, owner_start: owner.start };
|
|
2289
|
+
}
|
|
2290
|
+
var run_carry_conversation = {
|
|
2291
|
+
CONVERSATION_QUIET_MS,
|
|
2292
|
+
own_transcript,
|
|
2293
|
+
is_conversation_live,
|
|
2294
|
+
is_same_conversation,
|
|
2295
|
+
reclaim_owner
|
|
2296
|
+
};
|
|
2297
|
+
|
|
2202
2298
|
// scripts/backlog/backlog-budget-cli.ts
|
|
2203
2299
|
import { fileURLToPath } from "node:url";
|
|
2204
2300
|
|
|
@@ -2419,7 +2515,7 @@ var VALUE_OFFSET = 1;
|
|
|
2419
2515
|
var FLAG_PAIR_LENGTH = 2;
|
|
2420
2516
|
var ONLY_STEP = 1;
|
|
2421
2517
|
var EMPTY_LENGTH2 = 0;
|
|
2422
|
-
var
|
|
2518
|
+
var NOT_FOUND2 = -1;
|
|
2423
2519
|
function tokens_of(invocation) {
|
|
2424
2520
|
return invocation.split(TOKEN_SEPARATOR).filter((token) => token.length > EMPTY_LENGTH2);
|
|
2425
2521
|
}
|
|
@@ -2455,7 +2551,7 @@ function issue_of(token) {
|
|
|
2455
2551
|
}
|
|
2456
2552
|
function take_leading_prefixed(args) {
|
|
2457
2553
|
const stop = args.findIndex((token) => !token.startsWith(ISSUE_PREFIX));
|
|
2458
|
-
return args.slice(FIRST_TOKEN, stop ===
|
|
2554
|
+
return args.slice(FIRST_TOKEN, stop === NOT_FOUND2 ? args.length : stop);
|
|
2459
2555
|
}
|
|
2460
2556
|
function leading_issues(tokens) {
|
|
2461
2557
|
const issues = [];
|
|
@@ -2535,6 +2631,7 @@ var run_carry_schema = z6.object({
|
|
|
2535
2631
|
// which is the not-provably-live answer rather than a live one.
|
|
2536
2632
|
owner_pid: z6.number().optional(),
|
|
2537
2633
|
owner_start: z6.string().optional(),
|
|
2634
|
+
owner_transcript: z6.string().optional(),
|
|
2538
2635
|
is_handed_off: z6.boolean().optional(),
|
|
2539
2636
|
done: z6.array(z6.number()).optional(),
|
|
2540
2637
|
// Optional, so a record written before the retrospective existed still parses (joshuafolkken/kit#2328).
|
|
@@ -2569,8 +2666,8 @@ function classify3(raw, now) {
|
|
|
2569
2666
|
function read_carry(target, now = /* @__PURE__ */ new Date()) {
|
|
2570
2667
|
return classify3(stamp_file.read_stamp_text(target), now);
|
|
2571
2668
|
}
|
|
2572
|
-
function owner_of(pid, read3 = process_identity.read_start) {
|
|
2573
|
-
return { pid, start: read3(pid) };
|
|
2669
|
+
function owner_of(pid, read3 = process_identity.read_start, transcript = run_carry_conversation.own_transcript()) {
|
|
2670
|
+
return { pid, start: read3(pid), transcript };
|
|
2574
2671
|
}
|
|
2575
2672
|
function fresh_carry(invocation, owner, now) {
|
|
2576
2673
|
return {
|
|
@@ -2582,7 +2679,8 @@ function fresh_carry(invocation, owner, now) {
|
|
|
2582
2679
|
failures: NO_INCREMENT3,
|
|
2583
2680
|
outages: NO_INCREMENT3,
|
|
2584
2681
|
owner_pid: owner.pid,
|
|
2585
|
-
owner_start: owner.start
|
|
2682
|
+
owner_start: owner.start,
|
|
2683
|
+
owner_transcript: owner.transcript
|
|
2586
2684
|
};
|
|
2587
2685
|
}
|
|
2588
2686
|
function begin_carry(target, invocation, owner = NO_OWNER, now = /* @__PURE__ */ new Date()) {
|
|
@@ -2598,15 +2696,18 @@ function adopt_carry(target, carry, owner = NO_OWNER) {
|
|
|
2598
2696
|
...carry,
|
|
2599
2697
|
owner_pid: owner.pid,
|
|
2600
2698
|
owner_start: owner.start,
|
|
2699
|
+
owner_transcript: owner.transcript,
|
|
2601
2700
|
is_handed_off: false
|
|
2602
2701
|
};
|
|
2603
2702
|
stamp_file.remove_stamp(target);
|
|
2604
2703
|
return stamp_file.create_stamp(target, next) ? next : void 0;
|
|
2605
2704
|
}
|
|
2606
|
-
function is_owner_live(carry) {
|
|
2607
|
-
|
|
2705
|
+
function is_owner_live(carry, now = /* @__PURE__ */ new Date()) {
|
|
2706
|
+
if (process_identity.is_same_process(carry.owner_pid, carry.owner_start) !== false) return true;
|
|
2707
|
+
return run_carry_conversation.is_conversation_live(carry, now);
|
|
2608
2708
|
}
|
|
2609
2709
|
function is_owned_by(carry, owner) {
|
|
2710
|
+
if (run_carry_conversation.is_same_conversation(carry, owner)) return true;
|
|
2610
2711
|
return carry.owner_pid === owner.pid && carry.owner_start === owner.start;
|
|
2611
2712
|
}
|
|
2612
2713
|
function is_foreign_live_owner(carry, owner) {
|
|
@@ -2727,8 +2828,8 @@ import { spawn } from "node:child_process";
|
|
|
2727
2828
|
import { closeSync, constants, openSync, writeSync } from "node:fs";
|
|
2728
2829
|
|
|
2729
2830
|
// scripts/agent/agent-launch-environment.ts
|
|
2730
|
-
import { existsSync, lstatSync, mkdirSync, readlinkSync, symlinkSync, unlinkSync } from "node:fs";
|
|
2731
|
-
import
|
|
2831
|
+
import { existsSync as existsSync2, lstatSync, mkdirSync, readlinkSync, symlinkSync, unlinkSync } from "node:fs";
|
|
2832
|
+
import path4 from "node:path";
|
|
2732
2833
|
|
|
2733
2834
|
// scripts/gh/gh-cli-token.ts
|
|
2734
2835
|
import { execaSync as execaSync2 } from "execa";
|
|
@@ -2746,9 +2847,9 @@ var gh_cli_token = { get };
|
|
|
2746
2847
|
|
|
2747
2848
|
// scripts/agent/codex-home-source.ts
|
|
2748
2849
|
import os from "node:os";
|
|
2749
|
-
import
|
|
2850
|
+
import path3 from "node:path";
|
|
2750
2851
|
function default_home() {
|
|
2751
|
-
return
|
|
2852
|
+
return path3.join(os.homedir(), ".codex");
|
|
2752
2853
|
}
|
|
2753
2854
|
var codex_home_source = { default_home };
|
|
2754
2855
|
|
|
@@ -2765,18 +2866,18 @@ function remove_old_home_link(source, target) {
|
|
|
2765
2866
|
const current = lstatSync(target, { throwIfNoEntry: false });
|
|
2766
2867
|
if (current === void 0) return false;
|
|
2767
2868
|
if (!current.isSymbolicLink()) throw new Error(`Reviewer home file is not a link: ${target}`);
|
|
2768
|
-
if (
|
|
2869
|
+
if (existsSync2(source) && readlinkSync(target) === source) return true;
|
|
2769
2870
|
unlinkSync(target);
|
|
2770
2871
|
return false;
|
|
2771
2872
|
}
|
|
2772
2873
|
function link_home_file(source_home, target_home, name) {
|
|
2773
|
-
const source =
|
|
2774
|
-
const target =
|
|
2775
|
-
if (!remove_old_home_link(source, target) &&
|
|
2874
|
+
const source = path4.join(source_home, name);
|
|
2875
|
+
const target = path4.join(target_home, name);
|
|
2876
|
+
if (!remove_old_home_link(source, target) && existsSync2(source)) symlinkSync(source, target);
|
|
2776
2877
|
}
|
|
2777
2878
|
function reviewer_home(cwd, environment2) {
|
|
2778
2879
|
const source = environment2["CODEX_HOME"] ?? process.env["CODEX_HOME"] ?? codex_home_source.default_home();
|
|
2779
|
-
const target =
|
|
2880
|
+
const target = path4.resolve(cwd, ...REVIEWER_HOME);
|
|
2780
2881
|
mkdirSync(target, { recursive: true, mode: PRIVATE_DIRECTORY_MODE });
|
|
2781
2882
|
for (const name of HOME_FILES) link_home_file(source, target, name);
|
|
2782
2883
|
return target;
|
|
@@ -3492,17 +3593,17 @@ var DEPTH_LABELS = [
|
|
|
3492
3593
|
{
|
|
3493
3594
|
name: DEPTH_0_LABEL,
|
|
3494
3595
|
color: "0e8a16",
|
|
3495
|
-
description: "Depth 0 \u2014 what a consumer of this package touches (
|
|
3596
|
+
description: "Depth 0 \u2014 what a consumer of this package touches (observation-filing.md)"
|
|
3496
3597
|
},
|
|
3497
3598
|
{
|
|
3498
3599
|
name: DEPTH_1_LABEL,
|
|
3499
3600
|
color: "fbc02d",
|
|
3500
|
-
description: "Depth 1 \u2014 the run orchestration that executes an Issue (
|
|
3601
|
+
description: "Depth 1 \u2014 the run orchestration that executes an Issue (observation-filing.md)"
|
|
3501
3602
|
},
|
|
3502
3603
|
{
|
|
3503
3604
|
name: DEPTH_2_LABEL,
|
|
3504
3605
|
color: "c5def5",
|
|
3505
|
-
description: "Depth 2 \u2014 what measures a run (
|
|
3606
|
+
description: "Depth 2 \u2014 what measures a run (observation-filing.md)"
|
|
3506
3607
|
}
|
|
3507
3608
|
];
|
|
3508
3609
|
var WORKFLOW_LABELS = [
|
|
@@ -3604,8 +3705,8 @@ var lane_park = {
|
|
|
3604
3705
|
};
|
|
3605
3706
|
|
|
3606
3707
|
// scripts/discovery/repo-discovery.ts
|
|
3607
|
-
import { existsSync as
|
|
3608
|
-
import
|
|
3708
|
+
import { existsSync as existsSync3, readdirSync, readFileSync as readFileSync3, statSync as statSync2 } from "node:fs";
|
|
3709
|
+
import path5 from "node:path";
|
|
3609
3710
|
|
|
3610
3711
|
// scripts/discovery/repo-origin.ts
|
|
3611
3712
|
var GITHUB_HOST = "github.com";
|
|
@@ -3617,9 +3718,10 @@ var HOST_SEPARATOR = ":";
|
|
|
3617
3718
|
var OWNER_INDEX = 0;
|
|
3618
3719
|
var REPO_INDEX = 1;
|
|
3619
3720
|
var REPO_PATH_SEGMENTS = 2;
|
|
3620
|
-
var
|
|
3721
|
+
var NOT_FOUND3 = -1;
|
|
3621
3722
|
var SECTION_PREFIX = "[";
|
|
3622
3723
|
var ORIGIN_SECTION = /^\[remote\s+"origin"\]$/u;
|
|
3724
|
+
var REMOTE_SECTION = /^\[remote\s+"[^"]+"\]$/u;
|
|
3623
3725
|
var URL_KEY = "url";
|
|
3624
3726
|
function is_github_hostname(host) {
|
|
3625
3727
|
return host.toLowerCase() === GITHUB_HOST;
|
|
@@ -3640,9 +3742,9 @@ function to_identity(repository_path) {
|
|
|
3640
3742
|
}
|
|
3641
3743
|
function parse_scp_like(url) {
|
|
3642
3744
|
const user_end = url.indexOf(USER_SEPARATOR);
|
|
3643
|
-
const authority = user_end ===
|
|
3745
|
+
const authority = user_end === NOT_FOUND3 ? url : url.slice(user_end + 1);
|
|
3644
3746
|
const host_end = authority.indexOf(HOST_SEPARATOR);
|
|
3645
|
-
if (host_end ===
|
|
3747
|
+
if (host_end === NOT_FOUND3) return void 0;
|
|
3646
3748
|
if (!is_github_ssh_host(authority.slice(0, host_end))) return void 0;
|
|
3647
3749
|
return to_identity(authority.slice(host_end + 1));
|
|
3648
3750
|
}
|
|
@@ -3664,14 +3766,14 @@ function is_section_header(line) {
|
|
|
3664
3766
|
}
|
|
3665
3767
|
function origin_section_lines(lines) {
|
|
3666
3768
|
const start = lines.findIndex((line) => ORIGIN_SECTION.test(line));
|
|
3667
|
-
if (start ===
|
|
3769
|
+
if (start === NOT_FOUND3) return [];
|
|
3668
3770
|
const rest = lines.slice(start + 1);
|
|
3669
3771
|
const end = rest.findIndex((line) => is_section_header(line));
|
|
3670
|
-
return end ===
|
|
3772
|
+
return end === NOT_FOUND3 ? rest : rest.slice(0, end);
|
|
3671
3773
|
}
|
|
3672
3774
|
function entry_value(line, key2) {
|
|
3673
3775
|
const separator = line.indexOf("=");
|
|
3674
|
-
if (separator ===
|
|
3776
|
+
if (separator === NOT_FOUND3) return void 0;
|
|
3675
3777
|
if (line.slice(0, separator).trim() !== key2) return void 0;
|
|
3676
3778
|
return line.slice(separator + 1).trim();
|
|
3677
3779
|
}
|
|
@@ -3679,6 +3781,18 @@ function parse_origin_from_config(content) {
|
|
|
3679
3781
|
const lines = content.split("\n").map((line) => line.trim());
|
|
3680
3782
|
return origin_section_lines(lines).map((line) => entry_value(line, URL_KEY)).find((url) => url !== void 0);
|
|
3681
3783
|
}
|
|
3784
|
+
function section_groups(lines) {
|
|
3785
|
+
const groups = [];
|
|
3786
|
+
for (const line of lines) {
|
|
3787
|
+
if (is_section_header(line)) groups.push([line]);
|
|
3788
|
+
else groups.at(-1)?.push(line);
|
|
3789
|
+
}
|
|
3790
|
+
return groups;
|
|
3791
|
+
}
|
|
3792
|
+
function parse_remote_urls_from_config(content) {
|
|
3793
|
+
const lines = content.split("\n").map((line) => line.trim());
|
|
3794
|
+
return section_groups(lines).filter((group) => REMOTE_SECTION.test(group[0] ?? "")).flatMap((group) => group.map((line) => entry_value(line, URL_KEY))).filter((url) => url !== void 0);
|
|
3795
|
+
}
|
|
3682
3796
|
function format_identity(identity) {
|
|
3683
3797
|
return `${identity.owner}${PATH_SEPARATOR2}${identity.repo}`.toLowerCase();
|
|
3684
3798
|
}
|
|
@@ -3688,6 +3802,7 @@ var repo_origin = {
|
|
|
3688
3802
|
is_github_ssh_host,
|
|
3689
3803
|
parse_origin_from_config,
|
|
3690
3804
|
parse_origin_url,
|
|
3805
|
+
parse_remote_urls_from_config,
|
|
3691
3806
|
format_identity
|
|
3692
3807
|
};
|
|
3693
3808
|
|
|
@@ -3738,10 +3853,10 @@ var GITDIR_PREFIX = "gitdir:";
|
|
|
3738
3853
|
var COMMON_DIRECTORY_FILE = "commondir";
|
|
3739
3854
|
var OVERRIDE_ENV_KEY = "JOSH_REPO_PATHS";
|
|
3740
3855
|
function resolve_common_directory(git_directory) {
|
|
3741
|
-
const pointer =
|
|
3742
|
-
if (!
|
|
3856
|
+
const pointer = path5.join(git_directory, COMMON_DIRECTORY_FILE);
|
|
3857
|
+
if (!existsSync3(pointer)) return git_directory;
|
|
3743
3858
|
try {
|
|
3744
|
-
return
|
|
3859
|
+
return path5.resolve(git_directory, readFileSync3(pointer, "utf8").trim());
|
|
3745
3860
|
} catch {
|
|
3746
3861
|
return git_directory;
|
|
3747
3862
|
}
|
|
@@ -3749,33 +3864,39 @@ function resolve_common_directory(git_directory) {
|
|
|
3749
3864
|
function follow_git_file(repository_path, git_file) {
|
|
3750
3865
|
const pointer = readFileSync3(git_file, "utf8").trim();
|
|
3751
3866
|
if (!pointer.startsWith(GITDIR_PREFIX)) return void 0;
|
|
3752
|
-
return
|
|
3867
|
+
return path5.resolve(repository_path, pointer.slice(GITDIR_PREFIX.length).trim());
|
|
3753
3868
|
}
|
|
3754
3869
|
function resolve_git_directory(repository_path) {
|
|
3755
|
-
const candidate =
|
|
3756
|
-
if (!
|
|
3870
|
+
const candidate = path5.join(repository_path, GIT_DIRECTORY);
|
|
3871
|
+
if (!existsSync3(candidate)) return void 0;
|
|
3757
3872
|
try {
|
|
3758
|
-
if (
|
|
3873
|
+
if (statSync2(candidate).isDirectory()) return candidate;
|
|
3759
3874
|
const linked = follow_git_file(repository_path, candidate);
|
|
3760
3875
|
return linked === void 0 ? void 0 : resolve_common_directory(linked);
|
|
3761
3876
|
} catch {
|
|
3762
3877
|
return void 0;
|
|
3763
3878
|
}
|
|
3764
3879
|
}
|
|
3765
|
-
function
|
|
3880
|
+
function read_config(repository_path) {
|
|
3766
3881
|
const git_directory = resolve_git_directory(repository_path);
|
|
3767
3882
|
if (git_directory === void 0) return void 0;
|
|
3768
3883
|
try {
|
|
3769
|
-
return
|
|
3770
|
-
readFileSync3(path4.join(git_directory, GIT_CONFIG), "utf8")
|
|
3771
|
-
);
|
|
3884
|
+
return readFileSync3(path5.join(git_directory, GIT_CONFIG), "utf8");
|
|
3772
3885
|
} catch {
|
|
3773
3886
|
return void 0;
|
|
3774
3887
|
}
|
|
3775
3888
|
}
|
|
3889
|
+
function read_origin_url(repository_path) {
|
|
3890
|
+
const config = read_config(repository_path);
|
|
3891
|
+
return config === void 0 ? void 0 : repo_origin.parse_origin_from_config(config);
|
|
3892
|
+
}
|
|
3893
|
+
function read_remote_urls(repository_path) {
|
|
3894
|
+
const config = read_config(repository_path);
|
|
3895
|
+
return config === void 0 ? [] : repo_origin.parse_remote_urls_from_config(config);
|
|
3896
|
+
}
|
|
3776
3897
|
function sibling_directories(parent) {
|
|
3777
3898
|
try {
|
|
3778
|
-
return readdirSync(parent, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) =>
|
|
3899
|
+
return readdirSync(parent, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => path5.join(parent, entry.name)).toSorted((left, right) => left.localeCompare(right));
|
|
3779
3900
|
} catch {
|
|
3780
3901
|
return [];
|
|
3781
3902
|
}
|
|
@@ -3794,15 +3915,15 @@ function resolve_current_owner(repository_path) {
|
|
|
3794
3915
|
function main_worktree(repository_path) {
|
|
3795
3916
|
const git_directory = resolve_git_directory(repository_path);
|
|
3796
3917
|
if (git_directory === void 0) return repository_path;
|
|
3797
|
-
if (
|
|
3798
|
-
return
|
|
3918
|
+
if (path5.basename(git_directory) !== GIT_DIRECTORY) return repository_path;
|
|
3919
|
+
return path5.dirname(git_directory);
|
|
3799
3920
|
}
|
|
3800
3921
|
function discover_repositories(repository_path, environment2 = process.env) {
|
|
3801
3922
|
const main2 = main_worktree(repository_path);
|
|
3802
3923
|
const current_owner2 = resolve_current_owner(main2);
|
|
3803
3924
|
if (current_owner2 === void 0) return /* @__PURE__ */ new Map();
|
|
3804
3925
|
return repo_map_logic.build_repository_map(
|
|
3805
|
-
scan_siblings(
|
|
3926
|
+
scan_siblings(path5.dirname(main2)),
|
|
3806
3927
|
current_owner2,
|
|
3807
3928
|
environment2[OVERRIDE_ENV_KEY]
|
|
3808
3929
|
);
|
|
@@ -3811,6 +3932,7 @@ var repo_discovery = {
|
|
|
3811
3932
|
OVERRIDE_ENV_KEY,
|
|
3812
3933
|
main_worktree,
|
|
3813
3934
|
read_origin_url,
|
|
3935
|
+
read_remote_urls,
|
|
3814
3936
|
resolve_current_owner,
|
|
3815
3937
|
scan_siblings,
|
|
3816
3938
|
discover_repositories
|
|
@@ -3820,6 +3942,8 @@ var repo_discovery = {
|
|
|
3820
3942
|
var FIRST_PARTY = "first-party";
|
|
3821
3943
|
var THIRD_PARTY = "third-party";
|
|
3822
3944
|
var UNKNOWN = "unknown";
|
|
3945
|
+
var GH_REPO_ENV_KEY = "GH_REPO";
|
|
3946
|
+
var GH_REPO_PATH_SEGMENTS = 2;
|
|
3823
3947
|
function classify4(session_owner, target) {
|
|
3824
3948
|
if (session_owner === void 0 || target === void 0) return UNKNOWN;
|
|
3825
3949
|
return session_owner.toLowerCase() === target.toLowerCase() ? FIRST_PARTY : THIRD_PARTY;
|
|
@@ -3830,7 +3954,25 @@ function target_owner(owner_repo) {
|
|
|
3830
3954
|
function current_owner(repository_path = process.cwd()) {
|
|
3831
3955
|
return repo_discovery.resolve_current_owner(repository_path);
|
|
3832
3956
|
}
|
|
3833
|
-
|
|
3957
|
+
function gh_repo_owners(gh_repo) {
|
|
3958
|
+
return [target_owner(gh_repo.split("/").slice(-GH_REPO_PATH_SEGMENTS).join("/"))];
|
|
3959
|
+
}
|
|
3960
|
+
function remote_owners(repository_path) {
|
|
3961
|
+
return repo_discovery.read_remote_urls(repository_path).map((url) => repo_origin.parse_origin_url(url)?.owner);
|
|
3962
|
+
}
|
|
3963
|
+
function placeholder_owners(repository_path = process.cwd(), environment2 = process.env) {
|
|
3964
|
+
const gh_repo = environment2[GH_REPO_ENV_KEY];
|
|
3965
|
+
return gh_repo === void 0 || gh_repo === "" ? remote_owners(repository_path) : gh_repo_owners(gh_repo);
|
|
3966
|
+
}
|
|
3967
|
+
var repo_party = {
|
|
3968
|
+
FIRST_PARTY,
|
|
3969
|
+
THIRD_PARTY,
|
|
3970
|
+
UNKNOWN,
|
|
3971
|
+
classify: classify4,
|
|
3972
|
+
current_owner,
|
|
3973
|
+
placeholder_owners,
|
|
3974
|
+
target_owner
|
|
3975
|
+
};
|
|
3834
3976
|
|
|
3835
3977
|
// scripts/lane/lane-reap.ts
|
|
3836
3978
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
@@ -3912,8 +4054,8 @@ var lane_reap = {
|
|
|
3912
4054
|
};
|
|
3913
4055
|
|
|
3914
4056
|
// scripts/lane/lane-registry.ts
|
|
3915
|
-
import { existsSync as
|
|
3916
|
-
import
|
|
4057
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
4058
|
+
import path6 from "node:path";
|
|
3917
4059
|
|
|
3918
4060
|
// scripts/git/git-ls-remote.ts
|
|
3919
4061
|
var LS_REMOTE_COMMAND = "ls-remote";
|
|
@@ -4191,7 +4333,7 @@ function held_seat(content) {
|
|
|
4191
4333
|
return seat_from_content(content) ?? EMPTY_SEAT;
|
|
4192
4334
|
}
|
|
4193
4335
|
function read_environment(directory) {
|
|
4194
|
-
return file_reader.read_if_readable(
|
|
4336
|
+
return file_reader.read_if_readable(path6.join(directory, ENV_FILE_NAME));
|
|
4195
4337
|
}
|
|
4196
4338
|
function branch_issue(branch2) {
|
|
4197
4339
|
if (!branch2?.endsWith(lane_paths.LANE_BRANCH_SUFFIX)) return void 0;
|
|
@@ -4199,7 +4341,7 @@ function branch_issue(branch2) {
|
|
|
4199
4341
|
return ISSUE_PATTERN.test(issue) ? issue : void 0;
|
|
4200
4342
|
}
|
|
4201
4343
|
function is_gone(directory) {
|
|
4202
|
-
return !
|
|
4344
|
+
return !existsSync4(directory);
|
|
4203
4345
|
}
|
|
4204
4346
|
function build_lane(issue, branch2, directory, is_stranded) {
|
|
4205
4347
|
const content = is_stranded ? void 0 : read_environment(directory);
|
|
@@ -4427,10 +4569,14 @@ function commit_status_api_path(commit_sha, repo) {
|
|
|
4427
4569
|
function tag_reference_api_path(tag, repo) {
|
|
4428
4570
|
return `${repo_api_path(repo)}/git/ref/tags/${tag}`;
|
|
4429
4571
|
}
|
|
4572
|
+
function release_by_tag_api_path(tag, repo) {
|
|
4573
|
+
return `${repo_api_path(repo)}/releases/tags/${tag}`;
|
|
4574
|
+
}
|
|
4430
4575
|
var git_gh_api_path = {
|
|
4431
4576
|
FULL_PAGE_QUERY,
|
|
4432
4577
|
repo_api_path,
|
|
4433
4578
|
tag_ref_api_path: tag_reference_api_path,
|
|
4579
|
+
release_by_tag_api_path,
|
|
4434
4580
|
issues_api_path,
|
|
4435
4581
|
issue_api_path,
|
|
4436
4582
|
blocked_by_api_path,
|
|
@@ -4596,20 +4742,20 @@ function parse_status_line(output) {
|
|
|
4596
4742
|
function status_of_failure(error) {
|
|
4597
4743
|
return has_stdout_field(error) ? parse_status_line(error.stdout) : void 0;
|
|
4598
4744
|
}
|
|
4599
|
-
async function exec_gh_api_status(
|
|
4745
|
+
async function exec_gh_api_status(path7, timeout_ms) {
|
|
4600
4746
|
const options = to_spawn_options(timeout_ms);
|
|
4601
4747
|
try {
|
|
4602
4748
|
await check_gh_installed();
|
|
4603
|
-
const { stdout } = await execa5("gh", ["api", "--include", "--silent",
|
|
4749
|
+
const { stdout } = await execa5("gh", ["api", "--include", "--silent", path7], options);
|
|
4604
4750
|
return parse_status_line(stdout);
|
|
4605
4751
|
} catch (error) {
|
|
4606
4752
|
return status_of_failure(error);
|
|
4607
4753
|
}
|
|
4608
4754
|
}
|
|
4609
|
-
function exec_gh_api_status_sync(
|
|
4755
|
+
function exec_gh_api_status_sync(path7, timeout_ms) {
|
|
4610
4756
|
const options = to_spawn_options(timeout_ms);
|
|
4611
4757
|
try {
|
|
4612
|
-
const { stdout } = execaSync3("gh", ["api", "--include", "--silent",
|
|
4758
|
+
const { stdout } = execaSync3("gh", ["api", "--include", "--silent", path7], options);
|
|
4613
4759
|
return parse_status_line(stdout);
|
|
4614
4760
|
} catch (error) {
|
|
4615
4761
|
return status_of_failure(error);
|
|
@@ -5001,9 +5147,9 @@ async function issue_get_labels_and_body(issue_number) {
|
|
|
5001
5147
|
return await issue_view_json(issue_number, "number,state,labels,body");
|
|
5002
5148
|
}
|
|
5003
5149
|
async function issue_list_comments(issue_number) {
|
|
5004
|
-
const
|
|
5150
|
+
const path7 = `${git_gh_api_path.issue_comments_api_path(issue_number)}${git_gh_api_path.FULL_PAGE_QUERY}`;
|
|
5005
5151
|
try {
|
|
5006
|
-
return await git_gh_exec.exec_gh_api({ path:
|
|
5152
|
+
return await git_gh_exec.exec_gh_api({ path: path7, should_paginate: true });
|
|
5007
5153
|
} catch {
|
|
5008
5154
|
return void 0;
|
|
5009
5155
|
}
|
|
@@ -5078,8 +5224,8 @@ function is_selected(rest, request) {
|
|
|
5078
5224
|
return !git_gh_issue_rest.is_pull_request(rest) && matches_body(rest, request.body_term);
|
|
5079
5225
|
}
|
|
5080
5226
|
async function fetch_page(request, page) {
|
|
5081
|
-
const
|
|
5082
|
-
const rows = git_gh_issue_rest.parse_rest_issues(await git_gh_exec.exec_gh_api({ path:
|
|
5227
|
+
const path7 = listing_path(request, page);
|
|
5228
|
+
const rows = git_gh_issue_rest.parse_rest_issues(await git_gh_exec.exec_gh_api({ path: path7 }));
|
|
5083
5229
|
return {
|
|
5084
5230
|
selected: rows.filter((row) => is_selected(row, request)),
|
|
5085
5231
|
is_full: rows.length >= PER_PAGE
|
|
@@ -5381,9 +5527,9 @@ function select_issue_classification(issue_json) {
|
|
|
5381
5527
|
return label2;
|
|
5382
5528
|
}
|
|
5383
5529
|
function fetch_current_labels(repository2, pull_number) {
|
|
5384
|
-
const
|
|
5530
|
+
const path7 = `repos/${repository2}/issues/${String(pull_number)}/labels`;
|
|
5385
5531
|
try {
|
|
5386
|
-
const names = git_gh_exec.exec_gh_api_sync({ path:
|
|
5532
|
+
const names = git_gh_exec.exec_gh_api_sync({ path: path7, jq_filter: ".[].name" });
|
|
5387
5533
|
return names.split("\n").filter((name) => name !== "");
|
|
5388
5534
|
} catch (error) {
|
|
5389
5535
|
const detail = error_text.message_of(error);
|
|
@@ -5626,9 +5772,9 @@ async function pr_view(branch_name) {
|
|
|
5626
5772
|
async function read_comments(branch_name, to_path, to_json) {
|
|
5627
5773
|
const pr_number = await resolve_pr_number(branch_name);
|
|
5628
5774
|
if (pr_number === void 0) return void 0;
|
|
5629
|
-
const
|
|
5775
|
+
const path7 = `${to_path(String(pr_number))}${COMMENTS_QUERY}`;
|
|
5630
5776
|
try {
|
|
5631
|
-
return to_json(await git_gh_exec.exec_gh_api({ path:
|
|
5777
|
+
return to_json(await git_gh_exec.exec_gh_api({ path: path7, should_paginate: true }));
|
|
5632
5778
|
} catch {
|
|
5633
5779
|
return void 0;
|
|
5634
5780
|
}
|
|
@@ -5774,16 +5920,16 @@ var git_gh_pr_rollup = {
|
|
|
5774
5920
|
|
|
5775
5921
|
// scripts/gh/git-gh-pr-snapshot.ts
|
|
5776
5922
|
var NO_HEAD_SHA_MESSAGE = "gh api answered a pull request with no head commit";
|
|
5777
|
-
async function read_object_pages(
|
|
5923
|
+
async function read_object_pages(path7) {
|
|
5778
5924
|
return await git_gh_exec.exec_gh_api({
|
|
5779
|
-
path: `${
|
|
5925
|
+
path: `${path7}${FULL_PAGE_QUERY}`,
|
|
5780
5926
|
should_paginate: true,
|
|
5781
5927
|
should_slurp: true
|
|
5782
5928
|
});
|
|
5783
5929
|
}
|
|
5784
|
-
async function read_array_pages(
|
|
5930
|
+
async function read_array_pages(path7) {
|
|
5785
5931
|
return await git_gh_exec.exec_gh_api({
|
|
5786
|
-
path: `${
|
|
5932
|
+
path: `${path7}${FULL_PAGE_QUERY}`,
|
|
5787
5933
|
should_paginate: true
|
|
5788
5934
|
});
|
|
5789
5935
|
}
|
|
@@ -5800,8 +5946,8 @@ async function read_status_check_rollup(commit_sha) {
|
|
|
5800
5946
|
return git_gh_pr_rollup.to_status_check_rollup({ check_runs_json, status_json });
|
|
5801
5947
|
}
|
|
5802
5948
|
async function pr_get_review_decision(pr_number) {
|
|
5803
|
-
const
|
|
5804
|
-
return git_gh_pr_review.to_review_decision(await read_array_pages(
|
|
5949
|
+
const path7 = git_gh_api_path.pull_reviews_api_path(String(pr_number));
|
|
5950
|
+
return git_gh_pr_review.to_review_decision(await read_array_pages(path7));
|
|
5805
5951
|
}
|
|
5806
5952
|
async function build_checks_fields(pull) {
|
|
5807
5953
|
return {
|
|
@@ -6364,10 +6510,11 @@ export {
|
|
|
6364
6510
|
filing_cap,
|
|
6365
6511
|
CONTEXT_CUT_THRESHOLD,
|
|
6366
6512
|
RECENT_REQUEST_WINDOW,
|
|
6367
|
-
agent_session_environment,
|
|
6368
6513
|
agent_role_profile,
|
|
6369
6514
|
cli_flags,
|
|
6515
|
+
own_session,
|
|
6370
6516
|
backlog_budget,
|
|
6517
|
+
run_cut_handoff,
|
|
6371
6518
|
run_hold,
|
|
6372
6519
|
run_cut,
|
|
6373
6520
|
run_tail,
|