@pmelab/gtd 1.4.3 → 1.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gtd.bundle.mjs +1408 -1367
- package/package.json +3 -2
package/dist/gtd.bundle.mjs
CHANGED
|
@@ -367877,7 +367877,16 @@ var makeGitImpl = (executor, root2) => {
|
|
|
367877
367877
|
}),
|
|
367878
367878
|
commitAllWithPrefix: (prefix) => Effect_exports.gen(function* () {
|
|
367879
367879
|
yield* exec2("git", "add", "-A");
|
|
367880
|
-
yield* exec2("git", "commit", "--allow-empty", "-m", prefix)
|
|
367880
|
+
yield* exec2("git", "commit", "--allow-empty", "-m", prefix).pipe(
|
|
367881
|
+
Effect_exports.catchAll(
|
|
367882
|
+
(error) => (
|
|
367883
|
+
// Hooks like lint-staged block empty commits even with --allow-empty.
|
|
367884
|
+
// gtd's workflow commits have nothing for code-quality hooks to validate,
|
|
367885
|
+
// so retry without the pre-commit hook when that guard fires.
|
|
367886
|
+
error.message.includes("empty git commit") ? exec2("git", "commit", "--allow-empty", "--no-verify", "-m", prefix) : Effect_exports.fail(error)
|
|
367887
|
+
)
|
|
367888
|
+
)
|
|
367889
|
+
);
|
|
367881
367890
|
}).pipe(Effect_exports.asVoid),
|
|
367882
367891
|
softResetTo: (ref) => exec2("git", "reset", "--soft", ref).pipe(Effect_exports.asVoid)
|
|
367883
367892
|
};
|
|
@@ -367931,43 +367940,46 @@ var TestRunner = class _TestRunner extends Context_exports.Tag("TestRunner")() {
|
|
|
367931
367940
|
};
|
|
367932
367941
|
|
|
367933
367942
|
// src/Events.ts
|
|
367934
|
-
import { join as
|
|
367943
|
+
import { join as join9 } from "path";
|
|
367935
367944
|
|
|
367936
367945
|
// src/prompts/header.md
|
|
367937
367946
|
var header_default = "You are an autonomous coding agent orchestrating work on the user's repo. The\ncontext below describes the current state of the working tree; follow the task\nsections that follow it.\n\nDo **not** ask the user clarifying questions \u2014 record uncertainty in `TODO.md`\nunder `## Open Questions` instead.\n";
|
|
367938
367947
|
|
|
367939
367948
|
// src/prompts/grilling.md
|
|
367940
|
-
var grilling_default = '## Task: Grill the plan in `TODO.md`\n\n`TODO.md` holds the plan under development. The grilling loop interviews it \u2014\nsurfacing and resolving open questions \u2014 until the plan is solid enough to\ndecompose into work packages.\n\n### The convergence marker\n\nEvery open question carries a single placeholder comment on its own line,\ndirectly beneath the question:\n\n`<!-- user answers here -->`\n\nThis placeholder is the **convergence marker**. While _any_ marker is present in\n`TODO.md`,
|
|
367949
|
+
var grilling_default = '## Task: Grill the plan in `TODO.md`\n\n`TODO.md` holds the plan under development. The grilling loop interviews it \u2014\nsurfacing and resolving open questions \u2014 until the plan is solid enough to\ndecompose into work packages.\n\n### The convergence marker\n\nEvery open question carries a single placeholder comment on its own line,\ndirectly beneath the question:\n\n`<!-- user answers here -->`\n\nThis placeholder is the **convergence marker**. While _any_ marker is present in\n`TODO.md`, the harness **stops** and waits for the user to answer inline. When\nthere are genuinely no open questions left, write the sentinel line\n\n`no open questions \u2014 ready to plan`\n\nand leave **no** markers \u2014 the next cycle advances the plan to decomposition.\nThe sentinel means the plan is fully developed and ready to decompose \u2014 it is\nnever a substitute for writing the plan.\n\n<!-- gtd:iterate -->\n\n### Develop the plan\n\nSpawn a **planning-model subagent** using model `{{MODEL}}` to develop the plan.\nThe subagent works entirely by editing `TODO.md` (it cannot talk to the user):\n\n1. **Always develop `TODO.md` into a concrete plan.** Replace the captured input\n / seed template with a real implementation plan \u2014 the files to change,\n exactly what changes, and why \u2014 grounded in the codebase. Do this on every\n iteration, whether or not any questions remain open. A plan that still\n contains only the seed "Captured input" block is never ready to converge.\n2. **Read any "Captured input" diff block as feedback, not finished work:** code\n changes are suggestions \u2014 fold them into the plan and re-implement them\n properly, including test coverage, rather than restoring them verbatim; code\n comments are positional feedback about the code at that location;\n TODO.md/REVIEW.md text changes are global feedback on the plan or the\n reviewed work as a whole; checkbox flips in a captured REVIEW.md diff are\n approval noise \u2014 ignore them. the harness has already reverted captured code\n from the working tree.\n3. For every question the user has just answered (the answer written in place of\n its `<!-- user answers here -->` marker): integrate the answer into the plan\n body, then move the question into a `## Resolved` section at the bottom,\n recording the user\'s response as `**Answer:** \u2026`.\n4. Continue interviewing the plan with this discipline:\n - **Explore before asking** \u2014 if the codebase or docs answer it, explore\n instead of asking.\n - **Prioritize high-stakes questions** \u2014 hard-to-reverse decisions before\n easy-to-change ones.\n - **Walk branches completely** \u2014 group related questions so the user can\n resolve one branch fully before the next.\n - **Every question advances a decision** \u2014 never ask something that would not\n change the implementation.\n - Every answer opens new branches; generate fresh questions for any ambiguity\n the answers surface.\n5. Write each new open question near the top of the file, each followed on its\n own line by the `<!-- user answers here -->` marker.\n6. If the plan is now fully resolved, leave **no** markers and write the\n sentinel `no open questions \u2014 ready to plan` instead. Only write the sentinel\n once `TODO.md` holds a concrete plan \u2014 the sentinel signals the plan is ready\n to decompose, not that planning can be skipped.\n\nLeave `TODO.md` **uncommitted** \u2014 the next cycle commits it `gtd: grilling` and\nre-derives.\n\n<!-- gtd:stop -->\n\n### Open questions await the user\n\n`TODO.md` contains one or more `<!-- user answers here -->` markers \u2014 unanswered\nquestions. This is a human gate; there is nothing for you to do.\n\nTell the user to open `TODO.md`, answer each question inline (replacing its\n`<!-- user answers here -->` marker with the answer).\n';
|
|
367941
367950
|
|
|
367942
367951
|
// src/prompts/decompose.md
|
|
367943
|
-
var decompose_default = '## Task: Decompose the plan into work packages\n\nThe plan in `TODO.md` is settled (no open questions). Decompose it into an\nordered set of executable work packages under `.gtd/`. If `.gtd/` already holds\npackages from an earlier turn, continue and refine them rather than starting\nover.\n\n### Orchestration\n\nSpawn a **planning-model subagent** using model `{{MODEL}}` to perform the\ndecomposition. It creates numbered package directories, each holding numbered\ntask files:\n\n```\n.gtd/\n 01-<package-name>/\n 01-<task-name>.md\n 02-<task-name>.md\n 02-<package-name>/\n ...\n```\n\n**Rules for the subagent:**\n\n1. **Packages are sequential, in dependency order** \u2014 ordinal-prefixed\n directories (`01-`, `02-`, \u2026) execute in that order and the set is frozen\n once written. Order them so each package depends only on lower-numbered ones.\n\n2. **Each package is green on its own** \u2014 the test suite runs after every\n package. Never split a feature so the tree stays red until a later package\n lands.\n\n3. **Tasks within a package are parallel and file-disjoint** \u2014 all tasks in a\n package run simultaneously, each via one subagent, against the same working\n tree with no isolation. Two tasks that would touch the same file must be\n **merged** into one. If task B depends on task A, put them in separate\n packages.\n\n4. **Vertical slices, not horizontal** \u2014 each package is a thin, end-to-end\n slice that is demoable or verifiable on its own. Prefer many thin packages\n over few thick ones; never a "set up infrastructure" package.\n\n5. **Task files are self-contained** \u2014 each task `.md` includes a clear\n description of what to build, acceptance criteria as `- [ ] Criterion`\n checkboxes, the relevant file paths to examine, and any constraints or edge\n cases.\n\n### After the subagent completes\n\nLeave every change **uncommitted**; the next
|
|
367952
|
+
var decompose_default = '## Task: Decompose the plan into work packages\n\nThe plan in `TODO.md` is settled (no open questions). Decompose it into an\nordered set of executable work packages under `.gtd/`. If `.gtd/` already holds\npackages from an earlier turn, continue and refine them rather than starting\nover.\n\n### Orchestration\n\nSpawn a **planning-model subagent** using model `{{MODEL}}` to perform the\ndecomposition. It creates numbered package directories, each holding numbered\ntask files:\n\n```\n.gtd/\n 01-<package-name>/\n 01-<task-name>.md\n 02-<task-name>.md\n 02-<package-name>/\n ...\n```\n\n**Rules for the subagent:**\n\n1. **Packages are sequential, in dependency order** \u2014 ordinal-prefixed\n directories (`01-`, `02-`, \u2026) execute in that order and the set is frozen\n once written. Order them so each package depends only on lower-numbered ones.\n\n2. **Each package is green on its own** \u2014 the test suite runs after every\n package. Never split a feature so the tree stays red until a later package\n lands.\n\n3. **Tasks within a package are parallel and file-disjoint** \u2014 all tasks in a\n package run simultaneously, each via one subagent, against the same working\n tree with no isolation. Two tasks that would touch the same file must be\n **merged** into one. If task B depends on task A, put them in separate\n packages.\n\n4. **Vertical slices, not horizontal** \u2014 each package is a thin, end-to-end\n slice that is demoable or verifiable on its own. Prefer many thin packages\n over few thick ones; never a "set up infrastructure" package.\n\n5. **Task files are self-contained** \u2014 each task `.md` includes a clear\n description of what to build, acceptance criteria as `- [ ] Criterion`\n checkboxes, the relevant file paths to examine, and any constraints or edge\n cases.\n\n### After the subagent completes\n\nLeave every change **uncommitted**; the next cycle commits `.gtd/` as\n`gtd: planning`, preserving the plan and its full Q&A history in git. The plan\nis now executable.\n\n`TODO.md` is **deleted** at the first Building turn (when HEAD is\n`gtd: planning` and TODO.md is still present) \u2014 committed under the same\n`gtd: planning` prefix so HEAD advances correctly. The Q&A history lives in git\nfrom that point on; build subagents receive only their concrete `.gtd/` task\nfiles and never see TODO.md.\n';
|
|
367944
367953
|
|
|
367945
367954
|
// src/prompts/building.md
|
|
367946
|
-
var building_default = "## Task: Build one work package\n\
|
|
367955
|
+
var building_default = "## Task: Build one work package\n\nThe package below was selected for this cycle and its task contents are inlined\nbelow. Build exactly this package \u2014 do not browse `.gtd/`, choose a different\npackage, or loop over other packages. Leave the work uncommitted; the next cycle\ncommits and tests it.\n\n### Orchestration\n\nYou orchestrate the execution \u2014 you do not implement the tasks yourself. Spawn\n**one subagent per task** in the package below, all in **parallel**, each using\nmodel `{{MODEL}}`:\n\n- **Context**: the task content only (it is self-contained).\n- **Fresh context**: each worker starts cold, with no shared history.\n- **TDD discipline** (inline rules for workers):\n - Write ONE test \u2192 implement \u2192 pass \u2192 repeat (vertical slices).\n - **Do NOT** write all tests first then implement (horizontal slicing).\n - Tests verify behavior through public interfaces, not implementation details\n \u2014 a good test survives a refactor.\n\nWait for all workers to complete. **If any worker fails** (crash, timeout, error\n\u2014 not a test failure): report which tasks failed and ask the user whether to\nretry the failed tasks, skip and continue, or abort.\n\n### No TODO.md during the build loop\n\n`TODO.md` was deleted at the start of the build loop (committed under\n`gtd: planning`). Its absence is intentional \u2014 the `.gtd/` task files are the\nsole source of truth from here on.\n\n### Leave the work uncommitted\n\nDo **not** commit, do **not** delete the package directory, and do **not** touch\n`.gtd/`. Leave every change uncommitted. The next cycle commits the package as\n`gtd: building`, then runs the test suite to verify it \u2014 do not run or determine\na test command here.\n";
|
|
367947
367956
|
|
|
367948
367957
|
// src/prompts/fixing.md
|
|
367949
|
-
var fixing_default = "## Task: Fix the package against `FEEDBACK.md`\n\nThe feedback is reproduced inline below in the **Feedback to address** section.\nIt holds either captured test-failure output (from a failed test run) or\nagentic-review findings \u2014 in both cases, the authoritative list of what to fix.\nDo **not** try to read `FEEDBACK.md` from disk:
|
|
367958
|
+
var fixing_default = "## Task: Fix the package against `FEEDBACK.md`\n\nThe feedback is reproduced inline below in the **Feedback to address** section.\nIt holds either captured test-failure output (from a failed test run) or\nagentic-review findings \u2014 in both cases, the authoritative list of what to fix.\nDo **not** try to read `FEEDBACK.md` from disk: the harness has already\ncommitted its removal, so the inlined copy below is the only source.\n\n### Orchestration\n\nSpawn a **fix subagent** using model `{{MODEL}}` to apply the fixes:\n\n1. **Work through the Feedback to address section below** \u2014 address every item\n it lists. For test output, make the failing tests pass; for review findings,\n satisfy each finding against the package's task specs.\n2. **Make the fix in place** \u2014 change the code to resolve the feedback. Keep the\n change focused; do not refactor unrelated code.\n3. **Leave every change uncommitted** \u2014 do **not** commit or stage. The harness\n already removed `FEEDBACK.md`; the next cycle commits your fix and re-runs\n the tests (and, for a review fix, re-reviews the package).\n";
|
|
367950
367959
|
|
|
367951
367960
|
// src/prompts/agentic-review.md
|
|
367952
367961
|
var agentic_review_default = "## Task: Agentic review of the built package\n\nThe package's accumulated diff has landed. Review it against the package's task\nspecs and record the verdict in `FEEDBACK.md`.\n\n### Orchestration\n\nSpawn a **reviewing subagent** using model `{{MODEL}}`. The package's task spec\nfiles and its cumulative diff are inlined below by the orchestrator. The\nsubagent must:\n\n1. **Read the task spec files** \u2014 they define the acceptance criteria. Every\n requirement must be checked.\n2. **Read the package diff** \u2014 examine every hunk to determine whether the\n implementation satisfies the spec.\n3. **Always write `FEEDBACK.md`** in the repo root:\n - **Fully satisfies the spec** \u2192 write an **empty** `FEEDBACK.md` (zero bytes\n or whitespace only). An empty file is the **approval** signal \u2014 the edge\n closes the package.\n - **Does not fully satisfy** \u2192 write concrete, actionable findings anchored\n to specific file and symbol names, grouped under short headings, so the fix\n agent can act without re-reading the diff.\n4. **Do not edit source files and do not commit** \u2014 the reviewer only writes\n `FEEDBACK.md`, left uncommitted.\n";
|
|
367953
367962
|
|
|
367954
367963
|
// src/prompts/clean.md
|
|
367955
|
-
var clean_default = "## Task: Create `REVIEW.md` for the finished work\n\nThe working tree is clean and there is unreviewed work since the review base.\nProduce a `REVIEW.md` that guides the user through it. The diff to review\n(`git diff <base> HEAD`) is inlined below; workflow files (REVIEW.md, TODO.md,\nFEEDBACK.md, ERRORS.md, `.gtd/`) are already excluded \u2014 never write review\nchunks about them.\n\n### Orchestration\n\nSpawn a **planning-model subagent** using model `{{MODEL}}` to author the\nreview. It must:\n\n1. **Read the inlined diff** \u2014 extract the changed hunks with their file paths.\n2. **Group hunks semantically** \u2014 cluster hunks that serve the same logical\n concern (the same feature, refactor, or fix), even across files. Aim for the\n fewest chunks that keep the review navigable.\n3. **Write `REVIEW.md`** in the repo root in this format:\n\n ```markdown\n # Review: <short-hash>\n\n <!-- base: <full-hash> -->\n\n ## <Chunk Title>\n\n <What this chunk changes and why>\n\n - [ ] ./path/to/file.ts#42\n - [ ] ./path/to/file.ts#99\n\n ## <Another Chunk Title>\n\n <Explanation>\n\n - [ ] ./path/to/another.ts#1\n ```\n\n - `<short-hash>` is the first 7 characters of the review base SHA;\n `<full-hash>` is the full SHA. Both are read from the `Review base:` line /\n diff label in the prompt context.\n - Chunk titles are short imperative phrases (\u2264 6 words).\n - Explanations describe _what_ changed and _why_, not just where.\n - File pointers are relative, prefixed with `./`; the line numbers (`#42`)\n are creation-time hints that will drift \u2014 not authoritative.\n - Checkboxes (`- [ ]`) signal approval \u2014 ticking them (with no other edits)\n counts as approving the review (`gtd: done`). Only non-checkbox edits to\n `REVIEW.md` (or any code edits) are treated as a change-request.\n - The user checks off or edits items in place as they work through the\n review; there is no separate Resolved section.\n\n4.
|
|
367964
|
+
var clean_default = "## Task: Create `REVIEW.md` for the finished work\n\nThe working tree is clean and there is unreviewed work since the review base.\nProduce a `REVIEW.md` that guides the user through it. The diff to review\n(`git diff <base> HEAD`) is inlined below; workflow files (REVIEW.md, TODO.md,\nFEEDBACK.md, ERRORS.md, `.gtd/`) are already excluded \u2014 never write review\nchunks about them.\n\n### Orchestration\n\nSpawn a **planning-model subagent** using model `{{MODEL}}` to author the\nreview. It must:\n\n1. **Read the inlined diff** \u2014 extract the changed hunks with their file paths.\n2. **Group hunks semantically** \u2014 cluster hunks that serve the same logical\n concern (the same feature, refactor, or fix), even across files. Aim for the\n fewest chunks that keep the review navigable.\n3. **Write `REVIEW.md`** in the repo root in this format:\n\n ```markdown\n # Review: <short-hash>\n\n <!-- base: <full-hash> -->\n\n ## <Chunk Title>\n\n <What this chunk changes and why>\n\n - [ ] ./path/to/file.ts#42\n - [ ] ./path/to/file.ts#99\n\n ## <Another Chunk Title>\n\n <Explanation>\n\n - [ ] ./path/to/another.ts#1\n ```\n\n - `<short-hash>` is the first 7 characters of the review base SHA;\n `<full-hash>` is the full SHA. Both are read from the `Review base:` line /\n diff label in the prompt context.\n - Chunk titles are short imperative phrases (\u2264 6 words).\n - Explanations describe _what_ changed and _why_, not just where.\n - File pointers are relative, prefixed with `./`; the line numbers (`#42`)\n are creation-time hints that will drift \u2014 not authoritative.\n - Checkboxes (`- [ ]`) signal approval \u2014 ticking them (with no other edits)\n counts as approving the review (`gtd: done`). Only non-checkbox edits to\n `REVIEW.md` (or any code edits) are treated as a change-request.\n - The user checks off or edits items in place as they work through the\n review; there is no separate Resolved section.\n\n4. Leave `REVIEW.md` **uncommitted**.\n\nTell the user `REVIEW.md` is ready and the review continues on the next cycle.\n";
|
|
367956
367965
|
|
|
367957
367966
|
// src/prompts/squashing.md
|
|
367958
|
-
var squashing_default = "## Task: Squash all `gtd: *` commits into one conventional-commits message\n\nThe process is **approved and done**. Your job is to author a clean\nconventional-commits squash message and hand it off to
|
|
367967
|
+
var squashing_default = "## Task: Squash all `gtd: *` commits into one conventional-commits message\n\nThe process is **approved and done**. Your job is to author a clean\nconventional-commits squash message and hand it off to the harness.\n\n### Step 1 \u2014 Extract decisions from grilling rounds\n\nScan the inlined full-process diff below. Look for changes to `TODO.md` \u2014\nspecifically the `## Captured input (grilling)` sections and any edits to plan\ntext. Extract **key decisions, trade-offs, and design choices** made during\ngrilling rounds. These will appear in the commit body so the history is\nself-documenting.\n\n### Step 2 \u2014 Draft the commit message\n\nDraft ONE conventional-commits message:\n\n```\ntype(scope): subject\n\nbody (explain the why \u2014 motivation, trade-offs, key decisions from grilling)\n```\n\n- **type**: `feat` / `fix` / `refactor` / `chore` / `docs` / `test`\n- **subject**: imperative mood, \u2264 72 characters, lowercase after the colon\n- **body**: include the important decisions / trade-offs from grilling sessions.\n Omit if there were no meaningful decisions to capture.\n\n### Step 3 \u2014 Write SQUASH_MSG.md and hand off\n\nWrite the commit message (plain text, no markdown wrapper) to `SQUASH_MSG.md` in\nthe repo root, then leave it uncommitted \u2014 the harness handles the squash commit\non the next cycle once it sees `SQUASH_MSG.md`.\n\n**Do not run `git reset --soft` or `git commit` yourself** \u2014 the harness handles\nthe squash commit.\n";
|
|
367959
367968
|
|
|
367960
367969
|
// src/prompts/escalate.md
|
|
367961
|
-
var escalate_default = "## Task: Escalate \u2014 the test gate is stuck\n\nA committed `ERRORS.md` is present: the automatic fix loop hit the fix-attempt\ncap without getting the tests green. Automatic fixing has stopped so it does not\nburn further effort on a problem it cannot solve.\n\n### What to do\n\n1. **Surface the failure** \u2014 read `ERRORS.md` and show the user the captured\n failing output verbatim (assertions, stack traces), not a summary.\n2. **Report** that the fix attempts were exhausted and the root cause needs\n human judgement.\n3. **Tell the user how to resume** \u2014 investigate and fix the root cause (or\n nudge the code), then **delete `ERRORS.md`**. Removing `ERRORS.md` resets the\n fix-attempt budget: the next
|
|
367970
|
+
var escalate_default = "## Task: Escalate \u2014 the test gate is stuck\n\nA committed `ERRORS.md` is present: the automatic fix loop hit the fix-attempt\ncap without getting the tests green. Automatic fixing has stopped so it does not\nburn further effort on a problem it cannot solve.\n\n### What to do\n\n1. **Surface the failure** \u2014 read `ERRORS.md` and show the user the captured\n failing output verbatim (assertions, stack traces), not a summary.\n2. **Report** that the fix attempts were exhausted and the root cause needs\n human judgement.\n3. **Tell the user how to resume** \u2014 investigate and fix the root cause (or\n nudge the code), then **delete `ERRORS.md`**. Removing `ERRORS.md` resets the\n fix-attempt budget: the next cycle re-tests and grants a fresh round of\n automatic fixes before escalating again. While `ERRORS.md` exists, every run\n resolves straight back to this gate.\n";
|
|
367962
367971
|
|
|
367963
367972
|
// src/prompts/idle.md
|
|
367964
|
-
var idle_default = "## Task: Nothing to do\n\nThere are no steering files, the working tree is clean, and there is nothing to\nreview \u2014 the last review is already closed (`gtd: done`, with no new commits\nsince), or no reviewable changes exist. No plan is in progress.\n\nReport that the repository is idle \u2014 nothing
|
|
367973
|
+
var idle_default = "## Task: Nothing to do\n\nThere are no steering files, the working tree is clean, and there is nothing to\nreview \u2014 the last review is already closed (`gtd: done`, with no new commits\nsince), or no reviewable changes exist. No plan is in progress.\n\nReport that the repository is idle \u2014 nothing to do.\n";
|
|
367965
367974
|
|
|
367966
367975
|
// src/prompts/partials/auto-advance.md
|
|
367967
|
-
var auto_advance_default = "## Auto-advance\n\
|
|
367976
|
+
var auto_advance_default = "## Auto-advance\n\nContinue immediately after completing the steps above \u2014 re-run the harness. Do\nnot wait for user input. If an unrecoverable error occurs that requires human\ndecision, stop and report the problem instead of re-running.\n";
|
|
367977
|
+
|
|
367978
|
+
// src/prompts/partials/neutral.md
|
|
367979
|
+
var neutral_default = "Complete the steps above, then end your turn \u2014 the harness decides what happens\nnext.\n";
|
|
367968
367980
|
|
|
367969
367981
|
// src/prompts/partials/stop.md
|
|
367970
|
-
var stop_default = "\u26D4 **STOP \u2014 do not re-run
|
|
367982
|
+
var stop_default = "\u26D4 **STOP \u2014 do not re-run the harness.** This is a human gate. Only the user may\nresume this step. Re-running now with no changes will loop or advance without\nhuman input.\n";
|
|
367971
367983
|
|
|
367972
367984
|
// src/Prompt.ts
|
|
367973
367985
|
var EDGE_ONLY_STATES = /* @__PURE__ */ new Set([
|
|
@@ -368084,1327 +368096,810 @@ var renderStateSection = (promptState, context10, resolveModel) => {
|
|
|
368084
368096
|
}
|
|
368085
368097
|
return parts2;
|
|
368086
368098
|
};
|
|
368087
|
-
var buildPrompt = (result, resolveModel = builtinResolveModel) => {
|
|
368099
|
+
var buildPrompt = (result, resolveModel = builtinResolveModel, output = "plain") => {
|
|
368088
368100
|
const { state, context: context10 } = result;
|
|
368089
368101
|
if (EDGE_ONLY_STATES.has(state)) {
|
|
368090
368102
|
throw new Error(`State "${state}" is performed by the edge and must never reach buildPrompt`);
|
|
368091
368103
|
}
|
|
368092
368104
|
const promptState = state;
|
|
368105
|
+
const tail = output === "json" ? neutral_default : result.autoAdvance ? auto_advance_default : stop_default;
|
|
368093
368106
|
const parts2 = [
|
|
368094
368107
|
header_default,
|
|
368095
368108
|
"",
|
|
368096
368109
|
buildContextBlock(context10),
|
|
368097
368110
|
...renderStateSection(promptState, context10, resolveModel),
|
|
368098
|
-
|
|
368111
|
+
tail,
|
|
368099
368112
|
""
|
|
368100
368113
|
];
|
|
368101
368114
|
return parts2.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd() + "\n";
|
|
368102
368115
|
};
|
|
368103
368116
|
|
|
368104
|
-
// src/
|
|
368105
|
-
|
|
368106
|
-
|
|
368107
|
-
|
|
368108
|
-
|
|
368109
|
-
|
|
368110
|
-
|
|
368111
|
-
|
|
368112
|
-
|
|
368113
|
-
|
|
368114
|
-
|
|
368115
|
-
|
|
368116
|
-
|
|
368117
|
-
|
|
368118
|
-
|
|
368119
|
-
|
|
368120
|
-
|
|
368121
|
-
|
|
368122
|
-
|
|
368123
|
-
|
|
368124
|
-
|
|
368125
|
-
|
|
368126
|
-
|
|
368127
|
-
|
|
368128
|
-
|
|
368129
|
-
|
|
368130
|
-
|
|
368131
|
-
|
|
368132
|
-
|
|
368133
|
-
|
|
368134
|
-
|
|
368135
|
-
|
|
368136
|
-
|
|
368137
|
-
|
|
368138
|
-
|
|
368139
|
-
|
|
368140
|
-
|
|
368141
|
-
|
|
368142
|
-
|
|
368143
|
-
|
|
368144
|
-
|
|
368145
|
-
|
|
368146
|
-
|
|
368147
|
-
|
|
368148
|
-
|
|
368149
|
-
|
|
368150
|
-
|
|
368151
|
-
|
|
368152
|
-
|
|
368153
|
-
}
|
|
368154
|
-
const esc = inner[i + 1];
|
|
368155
|
-
if (esc === void 0) {
|
|
368156
|
-
flushBytes();
|
|
368157
|
-
chars.push("\\");
|
|
368158
|
-
i++;
|
|
368159
|
-
continue;
|
|
368160
|
-
}
|
|
368161
|
-
if (esc >= "0" && esc <= "7") {
|
|
368162
|
-
const oct = inner.slice(i + 1, i + 4);
|
|
368163
|
-
bytes.push(parseInt(oct, 8));
|
|
368164
|
-
i += 4;
|
|
368165
|
-
continue;
|
|
368166
|
-
}
|
|
368167
|
-
flushBytes();
|
|
368168
|
-
switch (esc) {
|
|
368169
|
-
case "n":
|
|
368170
|
-
chars.push("\n");
|
|
368171
|
-
break;
|
|
368172
|
-
case "t":
|
|
368173
|
-
chars.push(" ");
|
|
368174
|
-
break;
|
|
368175
|
-
case "r":
|
|
368176
|
-
chars.push("\r");
|
|
368177
|
-
break;
|
|
368178
|
-
case "\\":
|
|
368179
|
-
chars.push("\\");
|
|
368180
|
-
break;
|
|
368181
|
-
case '"':
|
|
368182
|
-
chars.push('"');
|
|
368183
|
-
break;
|
|
368184
|
-
default:
|
|
368185
|
-
chars.push("\\", esc);
|
|
368186
|
-
}
|
|
368187
|
-
i += 2;
|
|
368188
|
-
}
|
|
368189
|
-
flushBytes();
|
|
368190
|
-
return chars.join("");
|
|
368117
|
+
// src/Format.ts
|
|
368118
|
+
import { extname as extname2 } from "path";
|
|
368119
|
+
|
|
368120
|
+
// node_modules/prettier/index.mjs
|
|
368121
|
+
import { createRequire as __prettierCreateRequire } from "module";
|
|
368122
|
+
import { fileURLToPath as __prettierFileUrlToPath } from "url";
|
|
368123
|
+
import { dirname as __prettierDirname } from "path";
|
|
368124
|
+
import path10 from "path";
|
|
368125
|
+
import * as path from "path";
|
|
368126
|
+
import * as url2 from "url";
|
|
368127
|
+
import path5 from "path";
|
|
368128
|
+
import * as path4 from "path";
|
|
368129
|
+
import * as fs7 from "fs/promises";
|
|
368130
|
+
import * as path2 from "path";
|
|
368131
|
+
import process2 from "process";
|
|
368132
|
+
import * as path3 from "path";
|
|
368133
|
+
import process3 from "process";
|
|
368134
|
+
import path9 from "path";
|
|
368135
|
+
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
368136
|
+
import fs22 from "fs/promises";
|
|
368137
|
+
import path8 from "path";
|
|
368138
|
+
import { pathToFileURL as pathToFileURL4 } from "url";
|
|
368139
|
+
import assert3 from "assert";
|
|
368140
|
+
import { statSync, realpathSync } from "fs";
|
|
368141
|
+
import process4 from "process";
|
|
368142
|
+
import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL3 } from "url";
|
|
368143
|
+
import path7 from "path";
|
|
368144
|
+
import { builtinModules } from "module";
|
|
368145
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
368146
|
+
import fs32 from "fs";
|
|
368147
|
+
import path6 from "path";
|
|
368148
|
+
import { fileURLToPath as fileURLToPath22 } from "url";
|
|
368149
|
+
import v82 from "v8";
|
|
368150
|
+
import assert2 from "assert";
|
|
368151
|
+
import { format as format8, inspect } from "util";
|
|
368152
|
+
import { createRequire } from "module";
|
|
368153
|
+
|
|
368154
|
+
// node_modules/prettier/doc.mjs
|
|
368155
|
+
var doc_exports = {};
|
|
368156
|
+
__export(doc_exports, {
|
|
368157
|
+
builders: () => builders,
|
|
368158
|
+
default: () => public_exports,
|
|
368159
|
+
printer: () => printer,
|
|
368160
|
+
utils: () => utils
|
|
368161
|
+
});
|
|
368162
|
+
var __defProp2 = Object.defineProperty;
|
|
368163
|
+
var __export2 = (target, all7) => {
|
|
368164
|
+
for (var name in all7)
|
|
368165
|
+
__defProp2(target, name, { get: all7[name], enumerable: true });
|
|
368191
368166
|
};
|
|
368192
|
-
var
|
|
368193
|
-
|
|
368194
|
-
|
|
368195
|
-
|
|
368196
|
-
|
|
368197
|
-
|
|
368198
|
-
|
|
368199
|
-
|
|
368200
|
-
|
|
368201
|
-
|
|
368202
|
-
const packages = [];
|
|
368203
|
-
for (const dir of packageDirs) {
|
|
368204
|
-
const packagePath = `${GTD_DIR}/${dir}`;
|
|
368205
|
-
const stat4 = yield* fs8.stat(resolve5(packagePath));
|
|
368206
|
-
if (stat4.type !== "Directory") continue;
|
|
368207
|
-
const files = yield* fs8.readDirectory(resolve5(packagePath));
|
|
368208
|
-
const tasks = files.filter(isTaskFile).sort();
|
|
368209
|
-
const taskContents = [];
|
|
368210
|
-
for (const taskFile of tasks) {
|
|
368211
|
-
const content = yield* fs8.readFileString(resolve5(`${packagePath}/${taskFile}`));
|
|
368212
|
-
taskContents.push({ name: taskFile, content });
|
|
368213
|
-
}
|
|
368214
|
-
packages.push({ name: dir, tasks, taskContents });
|
|
368167
|
+
var public_exports = {};
|
|
368168
|
+
__export2(public_exports, {
|
|
368169
|
+
builders: () => builders,
|
|
368170
|
+
printer: () => printer,
|
|
368171
|
+
utils: () => utils
|
|
368172
|
+
});
|
|
368173
|
+
var OPTIONAL_OBJECT = 1;
|
|
368174
|
+
var createMethodShim = (methodName, getImplementation) => (flags, object2, ...arguments_) => {
|
|
368175
|
+
if (flags | OPTIONAL_OBJECT && (object2 === void 0 || object2 === null)) {
|
|
368176
|
+
return;
|
|
368215
368177
|
}
|
|
368216
|
-
|
|
368217
|
-
|
|
368218
|
-
var CAPTURE_RULES = [
|
|
368219
|
-
"Interpret the captured diff with these rules:",
|
|
368220
|
-
"",
|
|
368221
|
-
"- **Code changes** are suggestions, not finished work \u2014 plan to re-implement",
|
|
368222
|
-
" them properly, including test coverage, rather than restoring them verbatim.",
|
|
368223
|
-
"- **Code comments** are positional feedback about the code at that location.",
|
|
368224
|
-
"- **TODO.md / REVIEW.md text changes** are global feedback on the plan or the",
|
|
368225
|
-
" reviewed work as a whole.",
|
|
368226
|
-
"- **Checkbox flips** in a captured REVIEW.md diff are approval noise \u2014 ignore",
|
|
368227
|
-
" them."
|
|
368228
|
-
].join("\n");
|
|
368229
|
-
var seedTodo = (capturedDiff) => {
|
|
368230
|
-
const body = capturedDiff.replace(/\n+$/, "");
|
|
368231
|
-
const fence = fenceFor(body);
|
|
368232
|
-
return [
|
|
368233
|
-
"# Plan",
|
|
368234
|
-
"",
|
|
368235
|
-
"## Captured input",
|
|
368236
|
-
"",
|
|
368237
|
-
"These changes were captured as the starting point for this feature. Develop",
|
|
368238
|
-
"them into a concrete plan and surface any open questions for the user.",
|
|
368239
|
-
"",
|
|
368240
|
-
CAPTURE_RULES,
|
|
368241
|
-
"",
|
|
368242
|
-
`${fence}diff`,
|
|
368243
|
-
body,
|
|
368244
|
-
fence,
|
|
368245
|
-
""
|
|
368246
|
-
].join("\n");
|
|
368247
|
-
};
|
|
368248
|
-
var appendCapturedInput = (todo, capturedDiff) => {
|
|
368249
|
-
const body = capturedDiff.replace(/\n+$/, "");
|
|
368250
|
-
if (todo.includes(body)) return todo;
|
|
368251
|
-
const fence = fenceFor(body);
|
|
368252
|
-
const section = [
|
|
368253
|
-
"## Captured input (grilling)",
|
|
368254
|
-
"",
|
|
368255
|
-
"These code changes were made during grilling and captured as suggestions;",
|
|
368256
|
-
"gtd has reverted them from the working tree.",
|
|
368257
|
-
"",
|
|
368258
|
-
...todo.includes(CAPTURE_RULES) ? [] : [CAPTURE_RULES, ""],
|
|
368259
|
-
`${fence}diff`,
|
|
368260
|
-
body,
|
|
368261
|
-
fence,
|
|
368262
|
-
""
|
|
368263
|
-
].join("\n");
|
|
368264
|
-
return todo.replace(/\n*$/, "\n\n") + section;
|
|
368178
|
+
const implementation = getImplementation.call(object2) ?? object2[methodName];
|
|
368179
|
+
return implementation.apply(object2, arguments_);
|
|
368265
368180
|
};
|
|
368266
|
-
|
|
368267
|
-
|
|
368268
|
-
|
|
368269
|
-
|
|
368270
|
-
|
|
368271
|
-
|
|
368272
|
-
const line3 = raw.replace(/\r$/, "");
|
|
368273
|
-
if (line3.startsWith("---") || line3.startsWith("+++") || line3.startsWith("@@") || line3.startsWith("diff ") || line3.startsWith("index ") || line3.startsWith("new file") || line3.startsWith("deleted file") || line3.startsWith("similarity") || line3.startsWith("rename"))
|
|
368274
|
-
continue;
|
|
368275
|
-
if (line3.startsWith("-")) {
|
|
368276
|
-
removedLines.push(line3.slice(1));
|
|
368277
|
-
} else if (line3.startsWith("+")) {
|
|
368278
|
-
addedLines.push(line3.slice(1));
|
|
368279
|
-
}
|
|
368280
|
-
}
|
|
368281
|
-
if (removedLines.length !== addedLines.length) return false;
|
|
368282
|
-
let flips = 0;
|
|
368283
|
-
for (let i = 0; i < removedLines.length; i++) {
|
|
368284
|
-
const rm4 = removedLines[i];
|
|
368285
|
-
const add7 = addedLines[i];
|
|
368286
|
-
if (rm4 === add7) continue;
|
|
368287
|
-
if (!checkboxRe.test(rm4) || !checkboxRe.test(add7)) return false;
|
|
368288
|
-
const rmNorm = rm4.replace(/\[[ xX]\]/, "[ ]");
|
|
368289
|
-
const addNorm = add7.replace(/\[[ xX]\]/, "[ ]");
|
|
368290
|
-
if (rmNorm !== addNorm) return false;
|
|
368291
|
-
flips += 1;
|
|
368181
|
+
function stringOrArrayAt(index) {
|
|
368182
|
+
return this[index < 0 ? this.length + index : index];
|
|
368183
|
+
}
|
|
368184
|
+
var at = createMethodShim("at", function() {
|
|
368185
|
+
if (Array.isArray(this) || typeof this === "string") {
|
|
368186
|
+
return stringOrArrayAt;
|
|
368292
368187
|
}
|
|
368293
|
-
|
|
368188
|
+
});
|
|
368189
|
+
var method_at_default = at;
|
|
368190
|
+
var noop = () => {
|
|
368294
368191
|
};
|
|
368295
|
-
var
|
|
368296
|
-
|
|
368297
|
-
|
|
368298
|
-
|
|
368299
|
-
|
|
368300
|
-
|
|
368301
|
-
|
|
368302
|
-
|
|
368303
|
-
|
|
368304
|
-
|
|
368305
|
-
|
|
368306
|
-
|
|
368307
|
-
|
|
368308
|
-
|
|
368309
|
-
|
|
368310
|
-
|
|
368311
|
-
|
|
368312
|
-
|
|
368313
|
-
|
|
368314
|
-
|
|
368315
|
-
|
|
368316
|
-
|
|
368317
|
-
|
|
368318
|
-
|
|
368319
|
-
|
|
368320
|
-
|
|
368321
|
-
|
|
368322
|
-
|
|
368323
|
-
|
|
368324
|
-
|
|
368325
|
-
|
|
368326
|
-
|
|
368327
|
-
|
|
368328
|
-
|
|
368329
|
-
|
|
368330
|
-
|
|
368331
|
-
|
|
368332
|
-
|
|
368333
|
-
|
|
368334
|
-
|
|
368335
|
-
|
|
368336
|
-
|
|
368337
|
-
|
|
368338
|
-
|
|
368339
|
-
|
|
368340
|
-
|
|
368341
|
-
|
|
368342
|
-
|
|
368343
|
-
|
|
368344
|
-
|
|
368345
|
-
|
|
368346
|
-
|
|
368347
|
-
|
|
368348
|
-
|
|
368349
|
-
|
|
368350
|
-
|
|
368351
|
-
|
|
368352
|
-
|
|
368353
|
-
|
|
368354
|
-
|
|
368355
|
-
|
|
368356
|
-
|
|
368357
|
-
|
|
368358
|
-
|
|
368359
|
-
|
|
368360
|
-
|
|
368361
|
-
|
|
368362
|
-
|
|
368363
|
-
|
|
368364
|
-
|
|
368192
|
+
var noop_default = noop;
|
|
368193
|
+
var DOC_TYPE_STRING = (
|
|
368194
|
+
/** @type {const} */
|
|
368195
|
+
"string"
|
|
368196
|
+
);
|
|
368197
|
+
var DOC_TYPE_ARRAY = (
|
|
368198
|
+
/** @type {const} */
|
|
368199
|
+
"array"
|
|
368200
|
+
);
|
|
368201
|
+
var DOC_TYPE_CURSOR = (
|
|
368202
|
+
/** @type {const} */
|
|
368203
|
+
"cursor"
|
|
368204
|
+
);
|
|
368205
|
+
var DOC_TYPE_INDENT = (
|
|
368206
|
+
/** @type {const} */
|
|
368207
|
+
"indent"
|
|
368208
|
+
);
|
|
368209
|
+
var DOC_TYPE_ALIGN = (
|
|
368210
|
+
/** @type {const} */
|
|
368211
|
+
"align"
|
|
368212
|
+
);
|
|
368213
|
+
var DOC_TYPE_TRIM = (
|
|
368214
|
+
/** @type {const} */
|
|
368215
|
+
"trim"
|
|
368216
|
+
);
|
|
368217
|
+
var DOC_TYPE_GROUP = (
|
|
368218
|
+
/** @type {const} */
|
|
368219
|
+
"group"
|
|
368220
|
+
);
|
|
368221
|
+
var DOC_TYPE_FILL = (
|
|
368222
|
+
/** @type {const} */
|
|
368223
|
+
"fill"
|
|
368224
|
+
);
|
|
368225
|
+
var DOC_TYPE_IF_BREAK = (
|
|
368226
|
+
/** @type {const} */
|
|
368227
|
+
"if-break"
|
|
368228
|
+
);
|
|
368229
|
+
var DOC_TYPE_INDENT_IF_BREAK = (
|
|
368230
|
+
/** @type {const} */
|
|
368231
|
+
"indent-if-break"
|
|
368232
|
+
);
|
|
368233
|
+
var DOC_TYPE_LINE_SUFFIX = (
|
|
368234
|
+
/** @type {const} */
|
|
368235
|
+
"line-suffix"
|
|
368236
|
+
);
|
|
368237
|
+
var DOC_TYPE_LINE_SUFFIX_BOUNDARY = (
|
|
368238
|
+
/** @type {const} */
|
|
368239
|
+
"line-suffix-boundary"
|
|
368240
|
+
);
|
|
368241
|
+
var DOC_TYPE_LINE = (
|
|
368242
|
+
/** @type {const} */
|
|
368243
|
+
"line"
|
|
368244
|
+
);
|
|
368245
|
+
var DOC_TYPE_LABEL = (
|
|
368246
|
+
/** @type {const} */
|
|
368247
|
+
"label"
|
|
368248
|
+
);
|
|
368249
|
+
var DOC_TYPE_BREAK_PARENT = (
|
|
368250
|
+
/** @type {const} */
|
|
368251
|
+
"break-parent"
|
|
368252
|
+
);
|
|
368253
|
+
var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
|
|
368254
|
+
DOC_TYPE_CURSOR,
|
|
368255
|
+
DOC_TYPE_INDENT,
|
|
368256
|
+
DOC_TYPE_ALIGN,
|
|
368257
|
+
DOC_TYPE_TRIM,
|
|
368258
|
+
DOC_TYPE_GROUP,
|
|
368259
|
+
DOC_TYPE_FILL,
|
|
368260
|
+
DOC_TYPE_IF_BREAK,
|
|
368261
|
+
DOC_TYPE_INDENT_IF_BREAK,
|
|
368262
|
+
DOC_TYPE_LINE_SUFFIX,
|
|
368263
|
+
DOC_TYPE_LINE_SUFFIX_BOUNDARY,
|
|
368264
|
+
DOC_TYPE_LINE,
|
|
368265
|
+
DOC_TYPE_LABEL,
|
|
368266
|
+
DOC_TYPE_BREAK_PARENT
|
|
368267
|
+
]);
|
|
368268
|
+
function trimNewlinesEnd(string7) {
|
|
368269
|
+
let end6 = string7.length;
|
|
368270
|
+
while (end6 > 0 && (string7[end6 - 1] === "\r" || string7[end6 - 1] === "\n")) {
|
|
368271
|
+
end6--;
|
|
368272
|
+
}
|
|
368273
|
+
return end6 < string7.length ? string7.slice(0, end6) : string7;
|
|
368274
|
+
}
|
|
368275
|
+
function getDocType(doc) {
|
|
368276
|
+
if (typeof doc === "string") {
|
|
368277
|
+
return DOC_TYPE_STRING;
|
|
368278
|
+
}
|
|
368279
|
+
if (Array.isArray(doc)) {
|
|
368280
|
+
return DOC_TYPE_ARRAY;
|
|
368281
|
+
}
|
|
368282
|
+
if (!doc) {
|
|
368283
|
+
return;
|
|
368284
|
+
}
|
|
368285
|
+
const { type } = doc;
|
|
368286
|
+
if (VALID_OBJECT_DOC_TYPES.has(type)) {
|
|
368287
|
+
return type;
|
|
368288
|
+
}
|
|
368289
|
+
}
|
|
368290
|
+
var get_doc_type_default = getDocType;
|
|
368291
|
+
var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
|
|
368292
|
+
function getDocErrorMessage(doc) {
|
|
368293
|
+
const type = doc === null ? "null" : typeof doc;
|
|
368294
|
+
if (type !== "string" && type !== "object") {
|
|
368295
|
+
return `Unexpected doc '${type}',
|
|
368296
|
+
Expected it to be 'string' or 'object'.`;
|
|
368297
|
+
}
|
|
368298
|
+
if (get_doc_type_default(doc)) {
|
|
368299
|
+
throw new Error("doc is valid.");
|
|
368300
|
+
}
|
|
368301
|
+
const objectType = Object.prototype.toString.call(doc);
|
|
368302
|
+
if (objectType !== "[object Object]") {
|
|
368303
|
+
return `Unexpected doc '${objectType}'.`;
|
|
368304
|
+
}
|
|
368305
|
+
const EXPECTED_TYPE_VALUES = disjunctionListFormat(
|
|
368306
|
+
[...VALID_OBJECT_DOC_TYPES].map((type2) => `'${type2}'`)
|
|
368307
|
+
);
|
|
368308
|
+
return `Unexpected doc.type '${doc.type}'.
|
|
368309
|
+
Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
368310
|
+
}
|
|
368311
|
+
var InvalidDocError = class extends Error {
|
|
368312
|
+
name = "InvalidDocError";
|
|
368313
|
+
constructor(doc) {
|
|
368314
|
+
super(getDocErrorMessage(doc));
|
|
368315
|
+
this.doc = doc;
|
|
368316
|
+
}
|
|
368317
|
+
};
|
|
368318
|
+
var invalid_doc_error_default = InvalidDocError;
|
|
368319
|
+
var traverseDocOnExitStackMarker = {};
|
|
368320
|
+
function traverseDoc(doc, onEnter, onExit4, shouldTraverseConditionalGroups) {
|
|
368321
|
+
const docsStack = [doc];
|
|
368322
|
+
while (docsStack.length > 0) {
|
|
368323
|
+
const doc2 = docsStack.pop();
|
|
368324
|
+
if (doc2 === traverseDocOnExitStackMarker) {
|
|
368325
|
+
onExit4(docsStack.pop());
|
|
368326
|
+
continue;
|
|
368327
|
+
}
|
|
368328
|
+
if (onExit4) {
|
|
368329
|
+
docsStack.push(doc2, traverseDocOnExitStackMarker);
|
|
368330
|
+
}
|
|
368331
|
+
const docType = get_doc_type_default(doc2);
|
|
368332
|
+
if (!docType) {
|
|
368333
|
+
throw new invalid_doc_error_default(doc2);
|
|
368334
|
+
}
|
|
368335
|
+
if (onEnter?.(doc2) === false) {
|
|
368336
|
+
continue;
|
|
368337
|
+
}
|
|
368338
|
+
switch (docType) {
|
|
368339
|
+
case DOC_TYPE_ARRAY:
|
|
368340
|
+
case DOC_TYPE_FILL: {
|
|
368341
|
+
const parts2 = docType === DOC_TYPE_ARRAY ? doc2 : doc2.parts;
|
|
368342
|
+
for (let ic3 = parts2.length, i = ic3 - 1; i >= 0; --i) {
|
|
368343
|
+
docsStack.push(parts2[i]);
|
|
368365
368344
|
}
|
|
368366
|
-
|
|
368367
|
-
}
|
|
368368
|
-
|
|
368369
|
-
|
|
368370
|
-
|
|
368371
|
-
|
|
368372
|
-
|
|
368373
|
-
|
|
368374
|
-
|
|
368375
|
-
for (const c7 of currentCycle) {
|
|
368376
|
-
if ((c7.message.split("\n")[0] ?? "").trim().startsWith(AWAITING_REVIEW_SUBJECT)) {
|
|
368377
|
-
found = c7;
|
|
368345
|
+
break;
|
|
368346
|
+
}
|
|
368347
|
+
case DOC_TYPE_IF_BREAK:
|
|
368348
|
+
docsStack.push(doc2.flatContents, doc2.breakContents);
|
|
368349
|
+
break;
|
|
368350
|
+
case DOC_TYPE_GROUP:
|
|
368351
|
+
if (shouldTraverseConditionalGroups && doc2.expandedStates) {
|
|
368352
|
+
for (let ic3 = doc2.expandedStates.length, i = ic3 - 1; i >= 0; --i) {
|
|
368353
|
+
docsStack.push(doc2.expandedStates[i]);
|
|
368378
368354
|
}
|
|
368379
|
-
}
|
|
368380
|
-
return found;
|
|
368381
|
-
})();
|
|
368382
|
-
const withinProcess = firstGrilling !== void 0;
|
|
368383
|
-
let candidate;
|
|
368384
|
-
if (withinProcess) {
|
|
368385
|
-
if (lastAwaitingReview !== void 0) {
|
|
368386
|
-
candidate = lastAwaitingReview.hash ?? EMPTY_TREE;
|
|
368387
368355
|
} else {
|
|
368388
|
-
|
|
368356
|
+
docsStack.push(doc2.contents);
|
|
368389
368357
|
}
|
|
368390
|
-
|
|
368391
|
-
|
|
368392
|
-
|
|
368393
|
-
|
|
368394
|
-
|
|
368395
|
-
|
|
368396
|
-
|
|
368397
|
-
|
|
368398
|
-
|
|
368399
|
-
|
|
368400
|
-
|
|
368358
|
+
break;
|
|
368359
|
+
case DOC_TYPE_ALIGN:
|
|
368360
|
+
case DOC_TYPE_INDENT:
|
|
368361
|
+
case DOC_TYPE_INDENT_IF_BREAK:
|
|
368362
|
+
case DOC_TYPE_LABEL:
|
|
368363
|
+
case DOC_TYPE_LINE_SUFFIX:
|
|
368364
|
+
docsStack.push(doc2.contents);
|
|
368365
|
+
break;
|
|
368366
|
+
case DOC_TYPE_STRING:
|
|
368367
|
+
case DOC_TYPE_CURSOR:
|
|
368368
|
+
case DOC_TYPE_TRIM:
|
|
368369
|
+
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
|
368370
|
+
case DOC_TYPE_LINE:
|
|
368371
|
+
case DOC_TYPE_BREAK_PARENT:
|
|
368372
|
+
break;
|
|
368373
|
+
default:
|
|
368374
|
+
throw new invalid_doc_error_default(doc2);
|
|
368375
|
+
}
|
|
368376
|
+
}
|
|
368377
|
+
}
|
|
368378
|
+
var traverse_doc_default = traverseDoc;
|
|
368379
|
+
function mapDoc(doc, cb2) {
|
|
368380
|
+
if (typeof doc === "string") {
|
|
368381
|
+
return cb2(doc);
|
|
368382
|
+
}
|
|
368383
|
+
const mapped = /* @__PURE__ */ new Map();
|
|
368384
|
+
return rec(doc);
|
|
368385
|
+
function rec(doc2) {
|
|
368386
|
+
if (mapped.has(doc2)) {
|
|
368387
|
+
return mapped.get(doc2);
|
|
368388
|
+
}
|
|
368389
|
+
const result = process22(doc2);
|
|
368390
|
+
mapped.set(doc2, result);
|
|
368391
|
+
return result;
|
|
368392
|
+
}
|
|
368393
|
+
function process22(doc2) {
|
|
368394
|
+
switch (get_doc_type_default(doc2)) {
|
|
368395
|
+
case DOC_TYPE_ARRAY:
|
|
368396
|
+
return cb2(doc2.map(rec));
|
|
368397
|
+
case DOC_TYPE_FILL:
|
|
368398
|
+
return cb2({
|
|
368399
|
+
...doc2,
|
|
368400
|
+
parts: doc2.parts.map(rec)
|
|
368401
|
+
});
|
|
368402
|
+
case DOC_TYPE_IF_BREAK:
|
|
368403
|
+
return cb2({
|
|
368404
|
+
...doc2,
|
|
368405
|
+
breakContents: rec(doc2.breakContents),
|
|
368406
|
+
flatContents: rec(doc2.flatContents)
|
|
368407
|
+
});
|
|
368408
|
+
case DOC_TYPE_GROUP: {
|
|
368409
|
+
let {
|
|
368410
|
+
expandedStates,
|
|
368411
|
+
contents
|
|
368412
|
+
} = doc2;
|
|
368413
|
+
if (expandedStates) {
|
|
368414
|
+
expandedStates = expandedStates.map(rec);
|
|
368415
|
+
contents = expandedStates[0];
|
|
368416
|
+
} else {
|
|
368417
|
+
contents = rec(contents);
|
|
368401
368418
|
}
|
|
368419
|
+
return cb2({
|
|
368420
|
+
...doc2,
|
|
368421
|
+
contents,
|
|
368422
|
+
expandedStates
|
|
368423
|
+
});
|
|
368402
368424
|
}
|
|
368425
|
+
case DOC_TYPE_ALIGN:
|
|
368426
|
+
case DOC_TYPE_INDENT:
|
|
368427
|
+
case DOC_TYPE_INDENT_IF_BREAK:
|
|
368428
|
+
case DOC_TYPE_LABEL:
|
|
368429
|
+
case DOC_TYPE_LINE_SUFFIX:
|
|
368430
|
+
return cb2({
|
|
368431
|
+
...doc2,
|
|
368432
|
+
contents: rec(doc2.contents)
|
|
368433
|
+
});
|
|
368434
|
+
case DOC_TYPE_STRING:
|
|
368435
|
+
case DOC_TYPE_CURSOR:
|
|
368436
|
+
case DOC_TYPE_TRIM:
|
|
368437
|
+
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
|
368438
|
+
case DOC_TYPE_LINE:
|
|
368439
|
+
case DOC_TYPE_BREAK_PARENT:
|
|
368440
|
+
return cb2(doc2);
|
|
368441
|
+
default:
|
|
368442
|
+
throw new invalid_doc_error_default(doc2);
|
|
368403
368443
|
}
|
|
368404
|
-
|
|
368405
|
-
|
|
368406
|
-
|
|
368407
|
-
|
|
368408
|
-
|
|
368409
|
-
|
|
368410
|
-
|
|
368411
|
-
|
|
368412
|
-
|
|
368413
|
-
|
|
368414
|
-
|
|
368415
|
-
|
|
368416
|
-
|
|
368417
|
-
|
|
368418
|
-
|
|
368419
|
-
|
|
368420
|
-
|
|
368421
|
-
|
|
368422
|
-
|
|
368423
|
-
|
|
368424
|
-
|
|
368425
|
-
|
|
368426
|
-
|
|
368427
|
-
|
|
368428
|
-
|
|
368429
|
-
|
|
368430
|
-
|
|
368431
|
-
|
|
368432
|
-
|
|
368433
|
-
|
|
368434
|
-
|
|
368435
|
-
|
|
368436
|
-
|
|
368437
|
-
|
|
368444
|
+
}
|
|
368445
|
+
}
|
|
368446
|
+
function findInDoc(doc, fn10, defaultValue) {
|
|
368447
|
+
let result = defaultValue;
|
|
368448
|
+
let shouldSkipFurtherProcessing = false;
|
|
368449
|
+
function findInDocOnEnterFn(doc2) {
|
|
368450
|
+
if (shouldSkipFurtherProcessing) {
|
|
368451
|
+
return false;
|
|
368452
|
+
}
|
|
368453
|
+
const maybeResult = fn10(doc2);
|
|
368454
|
+
if (maybeResult !== void 0) {
|
|
368455
|
+
shouldSkipFurtherProcessing = true;
|
|
368456
|
+
result = maybeResult;
|
|
368457
|
+
}
|
|
368458
|
+
}
|
|
368459
|
+
traverse_doc_default(doc, findInDocOnEnterFn);
|
|
368460
|
+
return result;
|
|
368461
|
+
}
|
|
368462
|
+
function willBreakFn(doc) {
|
|
368463
|
+
if (doc.type === DOC_TYPE_GROUP && doc.break) {
|
|
368464
|
+
return true;
|
|
368465
|
+
}
|
|
368466
|
+
if (doc.type === DOC_TYPE_LINE && doc.hard) {
|
|
368467
|
+
return true;
|
|
368468
|
+
}
|
|
368469
|
+
if (doc.type === DOC_TYPE_BREAK_PARENT) {
|
|
368470
|
+
return true;
|
|
368471
|
+
}
|
|
368472
|
+
}
|
|
368473
|
+
function willBreak(doc) {
|
|
368474
|
+
return findInDoc(doc, willBreakFn, false);
|
|
368475
|
+
}
|
|
368476
|
+
function breakParentGroup(groupStack) {
|
|
368477
|
+
if (groupStack.length > 0) {
|
|
368478
|
+
const parentGroup = method_at_default(
|
|
368479
|
+
/* OPTIONAL_OBJECT: false */
|
|
368480
|
+
0,
|
|
368481
|
+
groupStack,
|
|
368482
|
+
-1
|
|
368483
|
+
);
|
|
368484
|
+
if (!parentGroup.expandedStates && !parentGroup.break) {
|
|
368485
|
+
parentGroup.break = "propagated";
|
|
368486
|
+
}
|
|
368487
|
+
}
|
|
368488
|
+
return null;
|
|
368489
|
+
}
|
|
368490
|
+
function propagateBreaks(doc) {
|
|
368491
|
+
const alreadyVisitedSet = /* @__PURE__ */ new Set();
|
|
368492
|
+
const groupStack = [];
|
|
368493
|
+
function propagateBreaksOnEnterFn(doc2) {
|
|
368494
|
+
if (doc2.type === DOC_TYPE_BREAK_PARENT) {
|
|
368495
|
+
breakParentGroup(groupStack);
|
|
368496
|
+
}
|
|
368497
|
+
if (doc2.type === DOC_TYPE_GROUP) {
|
|
368498
|
+
groupStack.push(doc2);
|
|
368499
|
+
if (alreadyVisitedSet.has(doc2)) {
|
|
368500
|
+
return false;
|
|
368438
368501
|
}
|
|
368502
|
+
alreadyVisitedSet.add(doc2);
|
|
368439
368503
|
}
|
|
368440
|
-
const squashMsgPresent = yield* fs8.exists(resolve5(SQUASH_MSG_FILE));
|
|
368441
|
-
const squashMsgContent = squashMsgPresent ? yield* fs8.readFileString(resolve5(SQUASH_MSG_FILE)) : "";
|
|
368442
|
-
const payload = {
|
|
368443
|
-
todoExists,
|
|
368444
|
-
todoCommitted,
|
|
368445
|
-
gtdDirExists,
|
|
368446
|
-
reviewPresent,
|
|
368447
|
-
feedbackPresent,
|
|
368448
|
-
errorsPresent,
|
|
368449
|
-
gtdModified,
|
|
368450
|
-
codeDirty,
|
|
368451
|
-
todoMarkerPresent,
|
|
368452
|
-
feedbackCommitted,
|
|
368453
|
-
feedbackEmpty,
|
|
368454
|
-
feedbackContent,
|
|
368455
|
-
reviewCommitted,
|
|
368456
|
-
reviewDirty,
|
|
368457
|
-
reviewCheckboxOnly,
|
|
368458
|
-
pendingErrorsDeletion,
|
|
368459
|
-
lastCommitSubject,
|
|
368460
|
-
workingTreeClean,
|
|
368461
|
-
packages,
|
|
368462
|
-
diff: diff8,
|
|
368463
|
-
...reviewBase !== void 0 ? { reviewBase } : {},
|
|
368464
|
-
...refDiff !== void 0 ? { refDiff } : {},
|
|
368465
|
-
hasCommitsAfterLastDone,
|
|
368466
|
-
agenticReviewEnabled: config2.agenticReview,
|
|
368467
|
-
fixAttemptCap: config2.fixAttemptCap,
|
|
368468
|
-
reviewThreshold: config2.reviewThreshold,
|
|
368469
|
-
squashEnabled: config2.squash,
|
|
368470
|
-
...squashBase !== void 0 ? { squashBase } : {},
|
|
368471
|
-
...squashDiff !== void 0 ? { squashDiff } : {},
|
|
368472
|
-
squashMsgPresent,
|
|
368473
|
-
squashMsgContent
|
|
368474
|
-
};
|
|
368475
|
-
const resolveEvent = { type: "RESOLVE", payload };
|
|
368476
|
-
return [...commitEvents, resolveEvent];
|
|
368477
|
-
}).pipe(Effect_exports.mapError((e7) => e7 instanceof Error ? e7 : new Error(String(e7))))
|
|
368478
|
-
);
|
|
368479
|
-
var captureAndRevert = (git, subject, onRegen) => Effect_exports.gen(function* () {
|
|
368480
|
-
const head7 = yield* git.lastCommitSubject().pipe(Effect_exports.catchAll(() => Effect_exports.succeed("")));
|
|
368481
|
-
if (head7 !== subject) {
|
|
368482
|
-
yield* git.commitAllWithPrefix(subject);
|
|
368483
|
-
} else {
|
|
368484
|
-
yield* onRegen;
|
|
368485
368504
|
}
|
|
368486
|
-
|
|
368487
|
-
|
|
368488
|
-
|
|
368489
|
-
|
|
368490
|
-
|
|
368491
|
-
var perform = (action) => (
|
|
368492
|
-
// fallow-ignore-next-line complexity
|
|
368493
|
-
Effect_exports.gen(function* () {
|
|
368494
|
-
const git = yield* GitService;
|
|
368495
|
-
const fs8 = yield* FileSystem_exports.FileSystem;
|
|
368496
|
-
const { root: root2 } = yield* Cwd;
|
|
368497
|
-
const resolve5 = (p4) => join7(root2, p4);
|
|
368498
|
-
switch (action.kind) {
|
|
368499
|
-
// Transport: mixed-reset the hand-made `gtd: transport` HEAD, keeping the
|
|
368500
|
-
// work in the tree, then re-derive. (No producer command — consume only.)
|
|
368501
|
-
case "transportReset": {
|
|
368502
|
-
yield* git.mixedResetHead();
|
|
368503
|
-
return;
|
|
368505
|
+
function propagateBreaksOnExitFn(doc2) {
|
|
368506
|
+
if (doc2.type === DOC_TYPE_GROUP) {
|
|
368507
|
+
const group2 = groupStack.pop();
|
|
368508
|
+
if (group2.break) {
|
|
368509
|
+
breakParentGroup(groupStack);
|
|
368504
368510
|
}
|
|
368505
|
-
|
|
368506
|
-
|
|
368507
|
-
|
|
368508
|
-
|
|
368509
|
-
|
|
368510
|
-
|
|
368511
|
-
|
|
368511
|
+
}
|
|
368512
|
+
}
|
|
368513
|
+
traverse_doc_default(
|
|
368514
|
+
doc,
|
|
368515
|
+
propagateBreaksOnEnterFn,
|
|
368516
|
+
propagateBreaksOnExitFn,
|
|
368517
|
+
/* shouldTraverseConditionalGroups */
|
|
368518
|
+
true
|
|
368519
|
+
);
|
|
368520
|
+
}
|
|
368521
|
+
function removeLinesFn(doc) {
|
|
368522
|
+
if (doc.type === DOC_TYPE_LINE && !doc.hard) {
|
|
368523
|
+
return doc.soft ? "" : " ";
|
|
368524
|
+
}
|
|
368525
|
+
if (doc.type === DOC_TYPE_IF_BREAK) {
|
|
368526
|
+
return doc.flatContents;
|
|
368527
|
+
}
|
|
368528
|
+
return doc;
|
|
368529
|
+
}
|
|
368530
|
+
function removeLines(doc) {
|
|
368531
|
+
return mapDoc(doc, removeLinesFn);
|
|
368532
|
+
}
|
|
368533
|
+
function stripTrailingHardlineFromParts(parts2) {
|
|
368534
|
+
parts2 = [...parts2];
|
|
368535
|
+
while (parts2.length >= 2 && method_at_default(
|
|
368536
|
+
/* OPTIONAL_OBJECT: false */
|
|
368537
|
+
0,
|
|
368538
|
+
parts2,
|
|
368539
|
+
-2
|
|
368540
|
+
).type === DOC_TYPE_LINE && method_at_default(
|
|
368541
|
+
/* OPTIONAL_OBJECT: false */
|
|
368542
|
+
0,
|
|
368543
|
+
parts2,
|
|
368544
|
+
-1
|
|
368545
|
+
).type === DOC_TYPE_BREAK_PARENT) {
|
|
368546
|
+
parts2.length -= 2;
|
|
368547
|
+
}
|
|
368548
|
+
if (parts2.length > 0) {
|
|
368549
|
+
const lastPart = stripTrailingHardlineFromDoc(method_at_default(
|
|
368550
|
+
/* OPTIONAL_OBJECT: false */
|
|
368551
|
+
0,
|
|
368552
|
+
parts2,
|
|
368553
|
+
-1
|
|
368554
|
+
));
|
|
368555
|
+
parts2[parts2.length - 1] = lastPart;
|
|
368556
|
+
}
|
|
368557
|
+
return parts2;
|
|
368558
|
+
}
|
|
368559
|
+
function stripTrailingHardlineFromDoc(doc) {
|
|
368560
|
+
switch (get_doc_type_default(doc)) {
|
|
368561
|
+
case DOC_TYPE_INDENT:
|
|
368562
|
+
case DOC_TYPE_INDENT_IF_BREAK:
|
|
368563
|
+
case DOC_TYPE_GROUP:
|
|
368564
|
+
case DOC_TYPE_LINE_SUFFIX:
|
|
368565
|
+
case DOC_TYPE_LABEL: {
|
|
368566
|
+
const contents = stripTrailingHardlineFromDoc(doc.contents);
|
|
368567
|
+
return {
|
|
368568
|
+
...doc,
|
|
368569
|
+
contents
|
|
368570
|
+
};
|
|
368571
|
+
}
|
|
368572
|
+
case DOC_TYPE_IF_BREAK:
|
|
368573
|
+
return {
|
|
368574
|
+
...doc,
|
|
368575
|
+
breakContents: stripTrailingHardlineFromDoc(doc.breakContents),
|
|
368576
|
+
flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
|
|
368577
|
+
};
|
|
368578
|
+
case DOC_TYPE_FILL:
|
|
368579
|
+
return {
|
|
368580
|
+
...doc,
|
|
368581
|
+
parts: stripTrailingHardlineFromParts(doc.parts)
|
|
368582
|
+
};
|
|
368583
|
+
case DOC_TYPE_ARRAY:
|
|
368584
|
+
return stripTrailingHardlineFromParts(doc);
|
|
368585
|
+
case DOC_TYPE_STRING:
|
|
368586
|
+
return trimNewlinesEnd(doc);
|
|
368587
|
+
case DOC_TYPE_ALIGN:
|
|
368588
|
+
case DOC_TYPE_CURSOR:
|
|
368589
|
+
case DOC_TYPE_TRIM:
|
|
368590
|
+
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
|
368591
|
+
case DOC_TYPE_LINE:
|
|
368592
|
+
case DOC_TYPE_BREAK_PARENT:
|
|
368593
|
+
break;
|
|
368594
|
+
default:
|
|
368595
|
+
throw new invalid_doc_error_default(doc);
|
|
368596
|
+
}
|
|
368597
|
+
return doc;
|
|
368598
|
+
}
|
|
368599
|
+
function stripTrailingHardline(doc) {
|
|
368600
|
+
return stripTrailingHardlineFromDoc(cleanDoc(doc));
|
|
368601
|
+
}
|
|
368602
|
+
function cleanDocFn(doc) {
|
|
368603
|
+
switch (get_doc_type_default(doc)) {
|
|
368604
|
+
case DOC_TYPE_FILL:
|
|
368605
|
+
if (doc.parts.every((part) => part === "")) {
|
|
368606
|
+
return "";
|
|
368512
368607
|
}
|
|
368513
|
-
|
|
368514
|
-
|
|
368515
|
-
|
|
368516
|
-
|
|
368517
|
-
// diff. The regen case (the machine's rule-4 carve-out fired) discards
|
|
368518
|
-
// any partial revert/seed state with a hard reset first.
|
|
368519
|
-
case "seedAcceptReview": {
|
|
368520
|
-
const captured = yield* captureAndRevert(git, REVIEW_FEEDBACK_SUBJECT, git.resetHard());
|
|
368521
|
-
yield* fs8.remove(resolve5(REVIEW_FILE)).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
368522
|
-
yield* fs8.writeFileString(resolve5(TODO_FILE), seedTodo(captured));
|
|
368523
|
-
return;
|
|
368608
|
+
break;
|
|
368609
|
+
case DOC_TYPE_GROUP:
|
|
368610
|
+
if (!doc.contents && !doc.id && !doc.break && !doc.expandedStates) {
|
|
368611
|
+
return "";
|
|
368524
368612
|
}
|
|
368525
|
-
|
|
368526
|
-
|
|
368527
|
-
// files excluded) into TODO.md as a suggestion block, drop the code
|
|
368528
|
-
// changes — reset tracked, delete untracked/added — and commit the lot as
|
|
368529
|
-
// one `gtd: grilling`. TODO.md's own pending edits are preserved verbatim
|
|
368530
|
-
// (snapshotted before the reset). Binary edits survive only as the diff's
|
|
368531
|
-
// "Binary files differ" line — an accepted limitation.
|
|
368532
|
-
case "captureGrillingEdits": {
|
|
368533
|
-
const porcelain = yield* git.statusPorcelain();
|
|
368534
|
-
const entries2 = parsePorcelainPaths(porcelain);
|
|
368535
|
-
const pendingCodeFiles = entries2.filter(
|
|
368536
|
-
(e7) => isUncommittedStatus(e7.status) && !isSteeringFile(e7.path) && !isGtdPath(e7.path)
|
|
368537
|
-
);
|
|
368538
|
-
const todoNow = yield* fs8.readFileString(resolve5(TODO_FILE));
|
|
368539
|
-
const captured = yield* git.diffHead(WORKFLOW_FILE_EXCLUDES);
|
|
368540
|
-
yield* git.resetHard();
|
|
368541
|
-
for (const entry of pendingCodeFiles) {
|
|
368542
|
-
yield* fs8.remove(resolve5(entry.path), { recursive: true }).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
368543
|
-
}
|
|
368544
|
-
yield* fs8.writeFileString(resolve5(TODO_FILE), appendCapturedInput(todoNow, captured));
|
|
368545
|
-
yield* git.commitAllWithPrefix(GRILLING_SUBJECT);
|
|
368546
|
-
return;
|
|
368613
|
+
if (doc.contents.type === DOC_TYPE_GROUP && doc.contents.id === doc.id && doc.contents.break === doc.break && doc.contents.expandedStates === doc.expandedStates) {
|
|
368614
|
+
return doc.contents;
|
|
368547
368615
|
}
|
|
368548
|
-
|
|
368549
|
-
|
|
368550
|
-
|
|
368551
|
-
|
|
368552
|
-
|
|
368553
|
-
|
|
368554
|
-
|
|
368555
|
-
if (committedBuilding) {
|
|
368556
|
-
yield* git.commitAllWithPrefix(BUILDING_SUBJECT);
|
|
368557
|
-
}
|
|
368558
|
-
const result = yield* runner.run();
|
|
368559
|
-
if (result.exitCode === 0) {
|
|
368560
|
-
if (!committedBuilding) {
|
|
368561
|
-
yield* git.commitAllWithPrefix(BUILDING_SUBJECT);
|
|
368562
|
-
}
|
|
368563
|
-
return;
|
|
368564
|
-
}
|
|
368565
|
-
const target = action.capReached ? ERRORS_FILE : FEEDBACK_FILE;
|
|
368566
|
-
const body = /\S/.test(result.output) ? result.output : EMPTY_FAILURE_SENTINEL;
|
|
368567
|
-
yield* fs8.writeFileString(resolve5(target), body);
|
|
368568
|
-
yield* git.commitAllWithPrefix(ERRORS_SUBJECT);
|
|
368569
|
-
return;
|
|
368616
|
+
break;
|
|
368617
|
+
case DOC_TYPE_ALIGN:
|
|
368618
|
+
case DOC_TYPE_INDENT:
|
|
368619
|
+
case DOC_TYPE_INDENT_IF_BREAK:
|
|
368620
|
+
case DOC_TYPE_LINE_SUFFIX:
|
|
368621
|
+
if (!doc.contents) {
|
|
368622
|
+
return "";
|
|
368570
368623
|
}
|
|
368571
|
-
|
|
368572
|
-
|
|
368573
|
-
|
|
368574
|
-
|
|
368575
|
-
// of returning to Testing (STATES.md § Fixing).
|
|
368576
|
-
case "commitPending": {
|
|
368577
|
-
if (action.removeFeedback === true) {
|
|
368578
|
-
yield* fs8.remove(resolve5(FEEDBACK_FILE)).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
368579
|
-
}
|
|
368580
|
-
if (action.removeTodo === true) {
|
|
368581
|
-
yield* fs8.remove(resolve5(TODO_FILE)).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
368582
|
-
}
|
|
368583
|
-
yield* git.commitAllWithPrefix(action.prefix);
|
|
368584
|
-
return;
|
|
368624
|
+
break;
|
|
368625
|
+
case DOC_TYPE_IF_BREAK:
|
|
368626
|
+
if (!doc.flatContents && !doc.breakContents) {
|
|
368627
|
+
return "";
|
|
368585
368628
|
}
|
|
368586
|
-
|
|
368587
|
-
|
|
368588
|
-
|
|
368589
|
-
|
|
368590
|
-
|
|
368591
|
-
|
|
368592
|
-
const first2 = packages[0];
|
|
368593
|
-
if (first2 !== void 0) {
|
|
368594
|
-
yield* git.removePackageDir(`${GTD_DIR}/${first2.name}`);
|
|
368629
|
+
break;
|
|
368630
|
+
case DOC_TYPE_ARRAY: {
|
|
368631
|
+
const parts2 = [];
|
|
368632
|
+
for (const part of doc) {
|
|
368633
|
+
if (!part) {
|
|
368634
|
+
continue;
|
|
368595
368635
|
}
|
|
368596
|
-
|
|
368597
|
-
|
|
368598
|
-
|
|
368599
|
-
|
|
368600
|
-
|
|
368601
|
-
|
|
368602
|
-
|
|
368636
|
+
const [currentPart, ...restParts] = Array.isArray(part) ? part : [part];
|
|
368637
|
+
if (typeof currentPart === "string" && typeof method_at_default(
|
|
368638
|
+
/* OPTIONAL_OBJECT: false */
|
|
368639
|
+
0,
|
|
368640
|
+
parts2,
|
|
368641
|
+
-1
|
|
368642
|
+
) === "string") {
|
|
368643
|
+
parts2[parts2.length - 1] += currentPart;
|
|
368644
|
+
} else {
|
|
368645
|
+
parts2.push(currentPart);
|
|
368646
|
+
}
|
|
368647
|
+
parts2.push(...restParts);
|
|
368603
368648
|
}
|
|
368604
|
-
|
|
368605
|
-
|
|
368606
|
-
yield* fs8.remove(resolve5(REVIEW_FILE)).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
368607
|
-
yield* git.commitAllWithPrefix(DONE_SUBJECT);
|
|
368608
|
-
return;
|
|
368649
|
+
if (parts2.length === 0) {
|
|
368650
|
+
return "";
|
|
368609
368651
|
}
|
|
368610
|
-
|
|
368611
|
-
|
|
368612
|
-
case "squashCommit": {
|
|
368613
|
-
yield* fs8.remove(resolve5(SQUASH_MSG_FILE)).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
368614
|
-
yield* git.softResetTo(action.squashBase);
|
|
368615
|
-
yield* git.commitAllWithPrefix(action.commitMessage);
|
|
368616
|
-
return;
|
|
368652
|
+
if (parts2.length === 1) {
|
|
368653
|
+
return parts2[0];
|
|
368617
368654
|
}
|
|
368655
|
+
return parts2;
|
|
368618
368656
|
}
|
|
368619
|
-
|
|
368620
|
-
|
|
368621
|
-
|
|
368622
|
-
|
|
368623
|
-
|
|
368624
|
-
|
|
368625
|
-
|
|
368626
|
-
|
|
368627
|
-
|
|
368628
|
-
|
|
368629
|
-
import path10 from "path";
|
|
368630
|
-
import * as path from "path";
|
|
368631
|
-
import * as url2 from "url";
|
|
368632
|
-
import path5 from "path";
|
|
368633
|
-
import * as path4 from "path";
|
|
368634
|
-
import * as fs7 from "fs/promises";
|
|
368635
|
-
import * as path2 from "path";
|
|
368636
|
-
import process2 from "process";
|
|
368637
|
-
import * as path3 from "path";
|
|
368638
|
-
import process3 from "process";
|
|
368639
|
-
import path9 from "path";
|
|
368640
|
-
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
368641
|
-
import fs22 from "fs/promises";
|
|
368642
|
-
import path8 from "path";
|
|
368643
|
-
import { pathToFileURL as pathToFileURL4 } from "url";
|
|
368644
|
-
import assert3 from "assert";
|
|
368645
|
-
import { statSync, realpathSync } from "fs";
|
|
368646
|
-
import process4 from "process";
|
|
368647
|
-
import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL3 } from "url";
|
|
368648
|
-
import path7 from "path";
|
|
368649
|
-
import { builtinModules } from "module";
|
|
368650
|
-
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
368651
|
-
import fs32 from "fs";
|
|
368652
|
-
import path6 from "path";
|
|
368653
|
-
import { fileURLToPath as fileURLToPath22 } from "url";
|
|
368654
|
-
import v82 from "v8";
|
|
368655
|
-
import assert2 from "assert";
|
|
368656
|
-
import { format as format8, inspect } from "util";
|
|
368657
|
-
import { createRequire } from "module";
|
|
368658
|
-
|
|
368659
|
-
// node_modules/prettier/doc.mjs
|
|
368660
|
-
var doc_exports = {};
|
|
368661
|
-
__export(doc_exports, {
|
|
368662
|
-
builders: () => builders,
|
|
368663
|
-
default: () => public_exports,
|
|
368664
|
-
printer: () => printer,
|
|
368665
|
-
utils: () => utils
|
|
368666
|
-
});
|
|
368667
|
-
var __defProp2 = Object.defineProperty;
|
|
368668
|
-
var __export2 = (target, all7) => {
|
|
368669
|
-
for (var name in all7)
|
|
368670
|
-
__defProp2(target, name, { get: all7[name], enumerable: true });
|
|
368671
|
-
};
|
|
368672
|
-
var public_exports = {};
|
|
368673
|
-
__export2(public_exports, {
|
|
368674
|
-
builders: () => builders,
|
|
368675
|
-
printer: () => printer,
|
|
368676
|
-
utils: () => utils
|
|
368677
|
-
});
|
|
368678
|
-
var OPTIONAL_OBJECT = 1;
|
|
368679
|
-
var createMethodShim = (methodName, getImplementation) => (flags, object2, ...arguments_) => {
|
|
368680
|
-
if (flags | OPTIONAL_OBJECT && (object2 === void 0 || object2 === null)) {
|
|
368681
|
-
return;
|
|
368657
|
+
case DOC_TYPE_STRING:
|
|
368658
|
+
case DOC_TYPE_CURSOR:
|
|
368659
|
+
case DOC_TYPE_TRIM:
|
|
368660
|
+
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
|
368661
|
+
case DOC_TYPE_LINE:
|
|
368662
|
+
case DOC_TYPE_LABEL:
|
|
368663
|
+
case DOC_TYPE_BREAK_PARENT:
|
|
368664
|
+
break;
|
|
368665
|
+
default:
|
|
368666
|
+
throw new invalid_doc_error_default(doc);
|
|
368682
368667
|
}
|
|
368683
|
-
|
|
368684
|
-
return implementation.apply(object2, arguments_);
|
|
368685
|
-
};
|
|
368686
|
-
function stringOrArrayAt(index) {
|
|
368687
|
-
return this[index < 0 ? this.length + index : index];
|
|
368668
|
+
return doc;
|
|
368688
368669
|
}
|
|
368689
|
-
|
|
368690
|
-
|
|
368691
|
-
return stringOrArrayAt;
|
|
368692
|
-
}
|
|
368693
|
-
});
|
|
368694
|
-
var method_at_default = at;
|
|
368695
|
-
var noop = () => {
|
|
368696
|
-
};
|
|
368697
|
-
var noop_default = noop;
|
|
368698
|
-
var DOC_TYPE_STRING = (
|
|
368699
|
-
/** @type {const} */
|
|
368700
|
-
"string"
|
|
368701
|
-
);
|
|
368702
|
-
var DOC_TYPE_ARRAY = (
|
|
368703
|
-
/** @type {const} */
|
|
368704
|
-
"array"
|
|
368705
|
-
);
|
|
368706
|
-
var DOC_TYPE_CURSOR = (
|
|
368707
|
-
/** @type {const} */
|
|
368708
|
-
"cursor"
|
|
368709
|
-
);
|
|
368710
|
-
var DOC_TYPE_INDENT = (
|
|
368711
|
-
/** @type {const} */
|
|
368712
|
-
"indent"
|
|
368713
|
-
);
|
|
368714
|
-
var DOC_TYPE_ALIGN = (
|
|
368715
|
-
/** @type {const} */
|
|
368716
|
-
"align"
|
|
368717
|
-
);
|
|
368718
|
-
var DOC_TYPE_TRIM = (
|
|
368719
|
-
/** @type {const} */
|
|
368720
|
-
"trim"
|
|
368721
|
-
);
|
|
368722
|
-
var DOC_TYPE_GROUP = (
|
|
368723
|
-
/** @type {const} */
|
|
368724
|
-
"group"
|
|
368725
|
-
);
|
|
368726
|
-
var DOC_TYPE_FILL = (
|
|
368727
|
-
/** @type {const} */
|
|
368728
|
-
"fill"
|
|
368729
|
-
);
|
|
368730
|
-
var DOC_TYPE_IF_BREAK = (
|
|
368731
|
-
/** @type {const} */
|
|
368732
|
-
"if-break"
|
|
368733
|
-
);
|
|
368734
|
-
var DOC_TYPE_INDENT_IF_BREAK = (
|
|
368735
|
-
/** @type {const} */
|
|
368736
|
-
"indent-if-break"
|
|
368737
|
-
);
|
|
368738
|
-
var DOC_TYPE_LINE_SUFFIX = (
|
|
368739
|
-
/** @type {const} */
|
|
368740
|
-
"line-suffix"
|
|
368741
|
-
);
|
|
368742
|
-
var DOC_TYPE_LINE_SUFFIX_BOUNDARY = (
|
|
368743
|
-
/** @type {const} */
|
|
368744
|
-
"line-suffix-boundary"
|
|
368745
|
-
);
|
|
368746
|
-
var DOC_TYPE_LINE = (
|
|
368747
|
-
/** @type {const} */
|
|
368748
|
-
"line"
|
|
368749
|
-
);
|
|
368750
|
-
var DOC_TYPE_LABEL = (
|
|
368751
|
-
/** @type {const} */
|
|
368752
|
-
"label"
|
|
368753
|
-
);
|
|
368754
|
-
var DOC_TYPE_BREAK_PARENT = (
|
|
368755
|
-
/** @type {const} */
|
|
368756
|
-
"break-parent"
|
|
368757
|
-
);
|
|
368758
|
-
var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
|
|
368759
|
-
DOC_TYPE_CURSOR,
|
|
368760
|
-
DOC_TYPE_INDENT,
|
|
368761
|
-
DOC_TYPE_ALIGN,
|
|
368762
|
-
DOC_TYPE_TRIM,
|
|
368763
|
-
DOC_TYPE_GROUP,
|
|
368764
|
-
DOC_TYPE_FILL,
|
|
368765
|
-
DOC_TYPE_IF_BREAK,
|
|
368766
|
-
DOC_TYPE_INDENT_IF_BREAK,
|
|
368767
|
-
DOC_TYPE_LINE_SUFFIX,
|
|
368768
|
-
DOC_TYPE_LINE_SUFFIX_BOUNDARY,
|
|
368769
|
-
DOC_TYPE_LINE,
|
|
368770
|
-
DOC_TYPE_LABEL,
|
|
368771
|
-
DOC_TYPE_BREAK_PARENT
|
|
368772
|
-
]);
|
|
368773
|
-
function trimNewlinesEnd(string7) {
|
|
368774
|
-
let end6 = string7.length;
|
|
368775
|
-
while (end6 > 0 && (string7[end6 - 1] === "\r" || string7[end6 - 1] === "\n")) {
|
|
368776
|
-
end6--;
|
|
368777
|
-
}
|
|
368778
|
-
return end6 < string7.length ? string7.slice(0, end6) : string7;
|
|
368670
|
+
function cleanDoc(doc) {
|
|
368671
|
+
return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
|
|
368779
368672
|
}
|
|
368780
|
-
function
|
|
368781
|
-
|
|
368782
|
-
return DOC_TYPE_STRING;
|
|
368783
|
-
}
|
|
368784
|
-
if (Array.isArray(doc)) {
|
|
368785
|
-
return DOC_TYPE_ARRAY;
|
|
368786
|
-
}
|
|
368787
|
-
if (!doc) {
|
|
368788
|
-
return;
|
|
368789
|
-
}
|
|
368790
|
-
const { type } = doc;
|
|
368791
|
-
if (VALID_OBJECT_DOC_TYPES.has(type)) {
|
|
368792
|
-
return type;
|
|
368793
|
-
}
|
|
368673
|
+
function replaceEndOfLine(doc, replacement = literalline) {
|
|
368674
|
+
return mapDoc(doc, (currentDoc) => typeof currentDoc === "string" ? join7(replacement, currentDoc.split("\n")) : currentDoc);
|
|
368794
368675
|
}
|
|
368795
|
-
|
|
368796
|
-
|
|
368797
|
-
|
|
368798
|
-
const type = doc === null ? "null" : typeof doc;
|
|
368799
|
-
if (type !== "string" && type !== "object") {
|
|
368800
|
-
return `Unexpected doc '${type}',
|
|
368801
|
-
Expected it to be 'string' or 'object'.`;
|
|
368802
|
-
}
|
|
368803
|
-
if (get_doc_type_default(doc)) {
|
|
368804
|
-
throw new Error("doc is valid.");
|
|
368805
|
-
}
|
|
368806
|
-
const objectType = Object.prototype.toString.call(doc);
|
|
368807
|
-
if (objectType !== "[object Object]") {
|
|
368808
|
-
return `Unexpected doc '${objectType}'.`;
|
|
368676
|
+
function canBreakFn(doc) {
|
|
368677
|
+
if (doc.type === DOC_TYPE_LINE) {
|
|
368678
|
+
return true;
|
|
368809
368679
|
}
|
|
368810
|
-
const EXPECTED_TYPE_VALUES = disjunctionListFormat(
|
|
368811
|
-
[...VALID_OBJECT_DOC_TYPES].map((type2) => `'${type2}'`)
|
|
368812
|
-
);
|
|
368813
|
-
return `Unexpected doc.type '${doc.type}'.
|
|
368814
|
-
Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
368815
368680
|
}
|
|
368816
|
-
|
|
368817
|
-
|
|
368818
|
-
|
|
368819
|
-
|
|
368820
|
-
|
|
368821
|
-
}
|
|
368822
|
-
|
|
368823
|
-
|
|
368824
|
-
|
|
368825
|
-
|
|
368826
|
-
|
|
368827
|
-
|
|
368828
|
-
|
|
368829
|
-
|
|
368830
|
-
|
|
368831
|
-
|
|
368681
|
+
function canBreak(doc) {
|
|
368682
|
+
return findInDoc(doc, canBreakFn, false);
|
|
368683
|
+
}
|
|
368684
|
+
var assertDoc = true ? noop_default : (
|
|
368685
|
+
/**
|
|
368686
|
+
@param {Doc} doc
|
|
368687
|
+
*/
|
|
368688
|
+
(function(doc) {
|
|
368689
|
+
traverse_doc_default(doc, (doc2) => {
|
|
368690
|
+
if (typeof doc2 === "string" || checked.has(doc2)) {
|
|
368691
|
+
return false;
|
|
368692
|
+
}
|
|
368693
|
+
checked.add(doc2);
|
|
368694
|
+
});
|
|
368695
|
+
})
|
|
368696
|
+
);
|
|
368697
|
+
var assertDocArray = true ? noop_default : (
|
|
368698
|
+
/**
|
|
368699
|
+
@param {readonly Doc[]} docs
|
|
368700
|
+
@param {boolean} [optional = false]
|
|
368701
|
+
*/
|
|
368702
|
+
(function(docs, optional2 = false) {
|
|
368703
|
+
if (optional2 && !docs) {
|
|
368704
|
+
return;
|
|
368832
368705
|
}
|
|
368833
|
-
if (
|
|
368834
|
-
|
|
368706
|
+
if (!Array.isArray(docs)) {
|
|
368707
|
+
throw new TypeError("Unexpected doc array.");
|
|
368835
368708
|
}
|
|
368836
|
-
const
|
|
368837
|
-
|
|
368838
|
-
throw new invalid_doc_error_default(doc2);
|
|
368709
|
+
for (const doc of docs) {
|
|
368710
|
+
assertDoc(doc);
|
|
368839
368711
|
}
|
|
368840
|
-
|
|
368841
|
-
|
|
368712
|
+
})
|
|
368713
|
+
);
|
|
368714
|
+
var assertDocFillParts = true ? noop_default : (
|
|
368715
|
+
/**
|
|
368716
|
+
@param {readonly Doc[]} parts
|
|
368717
|
+
*/
|
|
368718
|
+
(function(parts2) {
|
|
368719
|
+
assertDocArray(parts2);
|
|
368720
|
+
if (parts2.length > 1 && isEmptyDoc(method_at_default(
|
|
368721
|
+
/* OPTIONAL_OBJECT: false */
|
|
368722
|
+
0,
|
|
368723
|
+
parts2,
|
|
368724
|
+
-1
|
|
368725
|
+
))) {
|
|
368726
|
+
parts2 = parts2.slice(0, -1);
|
|
368842
368727
|
}
|
|
368843
|
-
|
|
368844
|
-
|
|
368845
|
-
|
|
368846
|
-
|
|
368847
|
-
for (let ic3 = parts2.length, i = ic3 - 1; i >= 0; --i) {
|
|
368848
|
-
docsStack.push(parts2[i]);
|
|
368849
|
-
}
|
|
368850
|
-
break;
|
|
368728
|
+
for (const [i, doc] of parts2.entries()) {
|
|
368729
|
+
if (i % 2 === 1 && !isValidSeparator(doc)) {
|
|
368730
|
+
const type = get_doc_type_default(doc);
|
|
368731
|
+
throw new Error(`Unexpected non-line-break doc at ${i}. Doc type is ${type}.`);
|
|
368851
368732
|
}
|
|
368852
|
-
case DOC_TYPE_IF_BREAK:
|
|
368853
|
-
docsStack.push(doc2.flatContents, doc2.breakContents);
|
|
368854
|
-
break;
|
|
368855
|
-
case DOC_TYPE_GROUP:
|
|
368856
|
-
if (shouldTraverseConditionalGroups && doc2.expandedStates) {
|
|
368857
|
-
for (let ic3 = doc2.expandedStates.length, i = ic3 - 1; i >= 0; --i) {
|
|
368858
|
-
docsStack.push(doc2.expandedStates[i]);
|
|
368859
|
-
}
|
|
368860
|
-
} else {
|
|
368861
|
-
docsStack.push(doc2.contents);
|
|
368862
|
-
}
|
|
368863
|
-
break;
|
|
368864
|
-
case DOC_TYPE_ALIGN:
|
|
368865
|
-
case DOC_TYPE_INDENT:
|
|
368866
|
-
case DOC_TYPE_INDENT_IF_BREAK:
|
|
368867
|
-
case DOC_TYPE_LABEL:
|
|
368868
|
-
case DOC_TYPE_LINE_SUFFIX:
|
|
368869
|
-
docsStack.push(doc2.contents);
|
|
368870
|
-
break;
|
|
368871
|
-
case DOC_TYPE_STRING:
|
|
368872
|
-
case DOC_TYPE_CURSOR:
|
|
368873
|
-
case DOC_TYPE_TRIM:
|
|
368874
|
-
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
|
368875
|
-
case DOC_TYPE_LINE:
|
|
368876
|
-
case DOC_TYPE_BREAK_PARENT:
|
|
368877
|
-
break;
|
|
368878
|
-
default:
|
|
368879
|
-
throw new invalid_doc_error_default(doc2);
|
|
368880
368733
|
}
|
|
368734
|
+
})
|
|
368735
|
+
);
|
|
368736
|
+
var assertAlignType = true ? noop_default : function(alignType) {
|
|
368737
|
+
if (!(typeof alignType === "number" || typeof alignType === "string" || alignType?.type === "root")) {
|
|
368738
|
+
throw new TypeError(`Invalid alignType '${alignType}'.`);
|
|
368881
368739
|
}
|
|
368740
|
+
};
|
|
368741
|
+
function indent(contents) {
|
|
368742
|
+
assertDoc(contents);
|
|
368743
|
+
return { type: DOC_TYPE_INDENT, contents };
|
|
368882
368744
|
}
|
|
368883
|
-
|
|
368884
|
-
|
|
368885
|
-
|
|
368886
|
-
|
|
368887
|
-
}
|
|
368888
|
-
const mapped = /* @__PURE__ */ new Map();
|
|
368889
|
-
return rec(doc);
|
|
368890
|
-
function rec(doc2) {
|
|
368891
|
-
if (mapped.has(doc2)) {
|
|
368892
|
-
return mapped.get(doc2);
|
|
368893
|
-
}
|
|
368894
|
-
const result = process22(doc2);
|
|
368895
|
-
mapped.set(doc2, result);
|
|
368896
|
-
return result;
|
|
368897
|
-
}
|
|
368898
|
-
function process22(doc2) {
|
|
368899
|
-
switch (get_doc_type_default(doc2)) {
|
|
368900
|
-
case DOC_TYPE_ARRAY:
|
|
368901
|
-
return cb2(doc2.map(rec));
|
|
368902
|
-
case DOC_TYPE_FILL:
|
|
368903
|
-
return cb2({
|
|
368904
|
-
...doc2,
|
|
368905
|
-
parts: doc2.parts.map(rec)
|
|
368906
|
-
});
|
|
368907
|
-
case DOC_TYPE_IF_BREAK:
|
|
368908
|
-
return cb2({
|
|
368909
|
-
...doc2,
|
|
368910
|
-
breakContents: rec(doc2.breakContents),
|
|
368911
|
-
flatContents: rec(doc2.flatContents)
|
|
368912
|
-
});
|
|
368913
|
-
case DOC_TYPE_GROUP: {
|
|
368914
|
-
let {
|
|
368915
|
-
expandedStates,
|
|
368916
|
-
contents
|
|
368917
|
-
} = doc2;
|
|
368918
|
-
if (expandedStates) {
|
|
368919
|
-
expandedStates = expandedStates.map(rec);
|
|
368920
|
-
contents = expandedStates[0];
|
|
368921
|
-
} else {
|
|
368922
|
-
contents = rec(contents);
|
|
368923
|
-
}
|
|
368924
|
-
return cb2({
|
|
368925
|
-
...doc2,
|
|
368926
|
-
contents,
|
|
368927
|
-
expandedStates
|
|
368928
|
-
});
|
|
368929
|
-
}
|
|
368930
|
-
case DOC_TYPE_ALIGN:
|
|
368931
|
-
case DOC_TYPE_INDENT:
|
|
368932
|
-
case DOC_TYPE_INDENT_IF_BREAK:
|
|
368933
|
-
case DOC_TYPE_LABEL:
|
|
368934
|
-
case DOC_TYPE_LINE_SUFFIX:
|
|
368935
|
-
return cb2({
|
|
368936
|
-
...doc2,
|
|
368937
|
-
contents: rec(doc2.contents)
|
|
368938
|
-
});
|
|
368939
|
-
case DOC_TYPE_STRING:
|
|
368940
|
-
case DOC_TYPE_CURSOR:
|
|
368941
|
-
case DOC_TYPE_TRIM:
|
|
368942
|
-
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
|
368943
|
-
case DOC_TYPE_LINE:
|
|
368944
|
-
case DOC_TYPE_BREAK_PARENT:
|
|
368945
|
-
return cb2(doc2);
|
|
368946
|
-
default:
|
|
368947
|
-
throw new invalid_doc_error_default(doc2);
|
|
368948
|
-
}
|
|
368949
|
-
}
|
|
368745
|
+
function align(alignType, contents) {
|
|
368746
|
+
assertAlignType(alignType);
|
|
368747
|
+
assertDoc(contents);
|
|
368748
|
+
return { type: DOC_TYPE_ALIGN, contents, n: alignType };
|
|
368950
368749
|
}
|
|
368951
|
-
function
|
|
368952
|
-
|
|
368953
|
-
let shouldSkipFurtherProcessing = false;
|
|
368954
|
-
function findInDocOnEnterFn(doc2) {
|
|
368955
|
-
if (shouldSkipFurtherProcessing) {
|
|
368956
|
-
return false;
|
|
368957
|
-
}
|
|
368958
|
-
const maybeResult = fn10(doc2);
|
|
368959
|
-
if (maybeResult !== void 0) {
|
|
368960
|
-
shouldSkipFurtherProcessing = true;
|
|
368961
|
-
result = maybeResult;
|
|
368962
|
-
}
|
|
368963
|
-
}
|
|
368964
|
-
traverse_doc_default(doc, findInDocOnEnterFn);
|
|
368965
|
-
return result;
|
|
368750
|
+
function dedentToRoot(contents) {
|
|
368751
|
+
return align(Number.NEGATIVE_INFINITY, contents);
|
|
368966
368752
|
}
|
|
368967
|
-
function
|
|
368968
|
-
|
|
368969
|
-
return true;
|
|
368970
|
-
}
|
|
368971
|
-
if (doc.type === DOC_TYPE_LINE && doc.hard) {
|
|
368972
|
-
return true;
|
|
368973
|
-
}
|
|
368974
|
-
if (doc.type === DOC_TYPE_BREAK_PARENT) {
|
|
368975
|
-
return true;
|
|
368976
|
-
}
|
|
368753
|
+
function markAsRoot(contents) {
|
|
368754
|
+
return align({ type: "root" }, contents);
|
|
368977
368755
|
}
|
|
368978
|
-
function
|
|
368979
|
-
return
|
|
368756
|
+
function dedent(contents) {
|
|
368757
|
+
return align(-1, contents);
|
|
368980
368758
|
}
|
|
368981
|
-
function
|
|
368982
|
-
|
|
368983
|
-
|
|
368984
|
-
|
|
368985
|
-
|
|
368986
|
-
|
|
368987
|
-
-1
|
|
368988
|
-
);
|
|
368989
|
-
if (!parentGroup.expandedStates && !parentGroup.break) {
|
|
368990
|
-
parentGroup.break = "propagated";
|
|
368759
|
+
function addAlignmentToDoc(doc, size16, tabWidth) {
|
|
368760
|
+
assertDoc(doc);
|
|
368761
|
+
let aligned = doc;
|
|
368762
|
+
if (size16 > 0) {
|
|
368763
|
+
for (let level = 0; level < Math.floor(size16 / tabWidth); ++level) {
|
|
368764
|
+
aligned = indent(aligned);
|
|
368991
368765
|
}
|
|
368766
|
+
aligned = align(size16 % tabWidth, aligned);
|
|
368767
|
+
aligned = align(Number.NEGATIVE_INFINITY, aligned);
|
|
368992
368768
|
}
|
|
368993
|
-
return
|
|
368769
|
+
return aligned;
|
|
368994
368770
|
}
|
|
368995
|
-
|
|
368996
|
-
|
|
368997
|
-
|
|
368998
|
-
|
|
368999
|
-
|
|
369000
|
-
|
|
369001
|
-
|
|
369002
|
-
|
|
369003
|
-
|
|
369004
|
-
|
|
369005
|
-
|
|
369006
|
-
}
|
|
369007
|
-
alreadyVisitedSet.add(doc2);
|
|
369008
|
-
}
|
|
369009
|
-
}
|
|
369010
|
-
function propagateBreaksOnExitFn(doc2) {
|
|
369011
|
-
if (doc2.type === DOC_TYPE_GROUP) {
|
|
369012
|
-
const group2 = groupStack.pop();
|
|
369013
|
-
if (group2.break) {
|
|
369014
|
-
breakParentGroup(groupStack);
|
|
369015
|
-
}
|
|
369016
|
-
}
|
|
369017
|
-
}
|
|
369018
|
-
traverse_doc_default(
|
|
369019
|
-
doc,
|
|
369020
|
-
propagateBreaksOnEnterFn,
|
|
369021
|
-
propagateBreaksOnExitFn,
|
|
369022
|
-
/* shouldTraverseConditionalGroups */
|
|
368771
|
+
var breakParent = { type: DOC_TYPE_BREAK_PARENT };
|
|
368772
|
+
var cursor = { type: DOC_TYPE_CURSOR };
|
|
368773
|
+
function fill(parts2) {
|
|
368774
|
+
assertDocFillParts(parts2);
|
|
368775
|
+
return { type: DOC_TYPE_FILL, parts: parts2 };
|
|
368776
|
+
}
|
|
368777
|
+
function group(contents, options8 = {}) {
|
|
368778
|
+
assertDoc(contents);
|
|
368779
|
+
assertDocArray(
|
|
368780
|
+
options8.expandedStates,
|
|
368781
|
+
/* optional */
|
|
369023
368782
|
true
|
|
369024
368783
|
);
|
|
368784
|
+
return {
|
|
368785
|
+
type: DOC_TYPE_GROUP,
|
|
368786
|
+
id: options8.id,
|
|
368787
|
+
contents,
|
|
368788
|
+
break: Boolean(options8.shouldBreak),
|
|
368789
|
+
expandedStates: options8.expandedStates
|
|
368790
|
+
};
|
|
369025
368791
|
}
|
|
369026
|
-
function
|
|
369027
|
-
|
|
369028
|
-
|
|
369029
|
-
|
|
369030
|
-
|
|
369031
|
-
|
|
368792
|
+
function conditionalGroup(states, options8) {
|
|
368793
|
+
return group(states[0], { ...options8, expandedStates: states });
|
|
368794
|
+
}
|
|
368795
|
+
function ifBreak(breakContents, flatContents = "", options8 = {}) {
|
|
368796
|
+
assertDoc(breakContents);
|
|
368797
|
+
if (flatContents !== "") {
|
|
368798
|
+
assertDoc(flatContents);
|
|
369032
368799
|
}
|
|
369033
|
-
return
|
|
368800
|
+
return {
|
|
368801
|
+
type: DOC_TYPE_IF_BREAK,
|
|
368802
|
+
breakContents,
|
|
368803
|
+
flatContents,
|
|
368804
|
+
groupId: options8.groupId
|
|
368805
|
+
};
|
|
369034
368806
|
}
|
|
369035
|
-
function
|
|
369036
|
-
|
|
368807
|
+
function indentIfBreak(contents, options8) {
|
|
368808
|
+
assertDoc(contents);
|
|
368809
|
+
return {
|
|
368810
|
+
type: DOC_TYPE_INDENT_IF_BREAK,
|
|
368811
|
+
contents,
|
|
368812
|
+
groupId: options8.groupId,
|
|
368813
|
+
negate: options8.negate
|
|
368814
|
+
};
|
|
369037
368815
|
}
|
|
369038
|
-
function
|
|
369039
|
-
|
|
369040
|
-
|
|
369041
|
-
|
|
369042
|
-
|
|
369043
|
-
|
|
369044
|
-
|
|
369045
|
-
|
|
369046
|
-
|
|
369047
|
-
0,
|
|
369048
|
-
parts2,
|
|
369049
|
-
-1
|
|
369050
|
-
).type === DOC_TYPE_BREAK_PARENT) {
|
|
369051
|
-
parts2.length -= 2;
|
|
369052
|
-
}
|
|
369053
|
-
if (parts2.length > 0) {
|
|
369054
|
-
const lastPart = stripTrailingHardlineFromDoc(method_at_default(
|
|
369055
|
-
/* OPTIONAL_OBJECT: false */
|
|
369056
|
-
0,
|
|
369057
|
-
parts2,
|
|
369058
|
-
-1
|
|
369059
|
-
));
|
|
369060
|
-
parts2[parts2.length - 1] = lastPart;
|
|
368816
|
+
function join7(separator, docs) {
|
|
368817
|
+
assertDoc(separator);
|
|
368818
|
+
assertDocArray(docs);
|
|
368819
|
+
const parts2 = [];
|
|
368820
|
+
for (let i = 0; i < docs.length; i++) {
|
|
368821
|
+
if (i !== 0) {
|
|
368822
|
+
parts2.push(separator);
|
|
368823
|
+
}
|
|
368824
|
+
parts2.push(docs[i]);
|
|
369061
368825
|
}
|
|
369062
368826
|
return parts2;
|
|
369063
368827
|
}
|
|
369064
|
-
function
|
|
369065
|
-
|
|
369066
|
-
|
|
369067
|
-
case DOC_TYPE_INDENT_IF_BREAK:
|
|
369068
|
-
case DOC_TYPE_GROUP:
|
|
369069
|
-
case DOC_TYPE_LINE_SUFFIX:
|
|
369070
|
-
case DOC_TYPE_LABEL: {
|
|
369071
|
-
const contents = stripTrailingHardlineFromDoc(doc.contents);
|
|
369072
|
-
return {
|
|
369073
|
-
...doc,
|
|
369074
|
-
contents
|
|
369075
|
-
};
|
|
369076
|
-
}
|
|
369077
|
-
case DOC_TYPE_IF_BREAK:
|
|
369078
|
-
return {
|
|
369079
|
-
...doc,
|
|
369080
|
-
breakContents: stripTrailingHardlineFromDoc(doc.breakContents),
|
|
369081
|
-
flatContents: stripTrailingHardlineFromDoc(doc.flatContents)
|
|
369082
|
-
};
|
|
369083
|
-
case DOC_TYPE_FILL:
|
|
369084
|
-
return {
|
|
369085
|
-
...doc,
|
|
369086
|
-
parts: stripTrailingHardlineFromParts(doc.parts)
|
|
369087
|
-
};
|
|
369088
|
-
case DOC_TYPE_ARRAY:
|
|
369089
|
-
return stripTrailingHardlineFromParts(doc);
|
|
369090
|
-
case DOC_TYPE_STRING:
|
|
369091
|
-
return trimNewlinesEnd(doc);
|
|
369092
|
-
case DOC_TYPE_ALIGN:
|
|
369093
|
-
case DOC_TYPE_CURSOR:
|
|
369094
|
-
case DOC_TYPE_TRIM:
|
|
369095
|
-
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
|
369096
|
-
case DOC_TYPE_LINE:
|
|
369097
|
-
case DOC_TYPE_BREAK_PARENT:
|
|
369098
|
-
break;
|
|
369099
|
-
default:
|
|
369100
|
-
throw new invalid_doc_error_default(doc);
|
|
369101
|
-
}
|
|
369102
|
-
return doc;
|
|
368828
|
+
function label(label2, contents) {
|
|
368829
|
+
assertDoc(contents);
|
|
368830
|
+
return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents;
|
|
369103
368831
|
}
|
|
369104
|
-
|
|
369105
|
-
|
|
368832
|
+
var line = { type: DOC_TYPE_LINE };
|
|
368833
|
+
var softline = { type: DOC_TYPE_LINE, soft: true };
|
|
368834
|
+
var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
|
|
368835
|
+
var hardline = [hardlineWithoutBreakParent, breakParent];
|
|
368836
|
+
var literallineWithoutBreakParent = {
|
|
368837
|
+
type: DOC_TYPE_LINE,
|
|
368838
|
+
hard: true,
|
|
368839
|
+
literal: true
|
|
368840
|
+
};
|
|
368841
|
+
var literalline = [literallineWithoutBreakParent, breakParent];
|
|
368842
|
+
function lineSuffix(contents) {
|
|
368843
|
+
assertDoc(contents);
|
|
368844
|
+
return { type: DOC_TYPE_LINE_SUFFIX, contents };
|
|
369106
368845
|
}
|
|
369107
|
-
|
|
369108
|
-
|
|
369109
|
-
|
|
369110
|
-
|
|
369111
|
-
|
|
369112
|
-
}
|
|
369113
|
-
break;
|
|
369114
|
-
case DOC_TYPE_GROUP:
|
|
369115
|
-
if (!doc.contents && !doc.id && !doc.break && !doc.expandedStates) {
|
|
369116
|
-
return "";
|
|
369117
|
-
}
|
|
369118
|
-
if (doc.contents.type === DOC_TYPE_GROUP && doc.contents.id === doc.id && doc.contents.break === doc.break && doc.contents.expandedStates === doc.expandedStates) {
|
|
369119
|
-
return doc.contents;
|
|
369120
|
-
}
|
|
369121
|
-
break;
|
|
369122
|
-
case DOC_TYPE_ALIGN:
|
|
369123
|
-
case DOC_TYPE_INDENT:
|
|
369124
|
-
case DOC_TYPE_INDENT_IF_BREAK:
|
|
369125
|
-
case DOC_TYPE_LINE_SUFFIX:
|
|
369126
|
-
if (!doc.contents) {
|
|
369127
|
-
return "";
|
|
369128
|
-
}
|
|
369129
|
-
break;
|
|
369130
|
-
case DOC_TYPE_IF_BREAK:
|
|
369131
|
-
if (!doc.flatContents && !doc.breakContents) {
|
|
369132
|
-
return "";
|
|
369133
|
-
}
|
|
369134
|
-
break;
|
|
369135
|
-
case DOC_TYPE_ARRAY: {
|
|
369136
|
-
const parts2 = [];
|
|
369137
|
-
for (const part of doc) {
|
|
369138
|
-
if (!part) {
|
|
369139
|
-
continue;
|
|
369140
|
-
}
|
|
369141
|
-
const [currentPart, ...restParts] = Array.isArray(part) ? part : [part];
|
|
369142
|
-
if (typeof currentPart === "string" && typeof method_at_default(
|
|
369143
|
-
/* OPTIONAL_OBJECT: false */
|
|
369144
|
-
0,
|
|
369145
|
-
parts2,
|
|
369146
|
-
-1
|
|
369147
|
-
) === "string") {
|
|
369148
|
-
parts2[parts2.length - 1] += currentPart;
|
|
369149
|
-
} else {
|
|
369150
|
-
parts2.push(currentPart);
|
|
369151
|
-
}
|
|
369152
|
-
parts2.push(...restParts);
|
|
369153
|
-
}
|
|
369154
|
-
if (parts2.length === 0) {
|
|
369155
|
-
return "";
|
|
369156
|
-
}
|
|
369157
|
-
if (parts2.length === 1) {
|
|
369158
|
-
return parts2[0];
|
|
369159
|
-
}
|
|
369160
|
-
return parts2;
|
|
369161
|
-
}
|
|
369162
|
-
case DOC_TYPE_STRING:
|
|
369163
|
-
case DOC_TYPE_CURSOR:
|
|
369164
|
-
case DOC_TYPE_TRIM:
|
|
369165
|
-
case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
|
369166
|
-
case DOC_TYPE_LINE:
|
|
369167
|
-
case DOC_TYPE_LABEL:
|
|
369168
|
-
case DOC_TYPE_BREAK_PARENT:
|
|
369169
|
-
break;
|
|
369170
|
-
default:
|
|
369171
|
-
throw new invalid_doc_error_default(doc);
|
|
368846
|
+
var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
|
|
368847
|
+
var trim = { type: DOC_TYPE_TRIM };
|
|
368848
|
+
var stringReplaceAll = String.prototype.replaceAll ?? function(pattern2, replacement) {
|
|
368849
|
+
if (pattern2.global) {
|
|
368850
|
+
return this.replace(pattern2, replacement);
|
|
369172
368851
|
}
|
|
369173
|
-
return
|
|
368852
|
+
return this.split(pattern2).join(replacement);
|
|
368853
|
+
};
|
|
368854
|
+
var replaceAll = createMethodShim("replaceAll", function() {
|
|
368855
|
+
if (typeof this === "string") {
|
|
368856
|
+
return stringReplaceAll;
|
|
368857
|
+
}
|
|
368858
|
+
});
|
|
368859
|
+
var method_replace_all_default = replaceAll;
|
|
368860
|
+
var OPTION_CR = "cr";
|
|
368861
|
+
var OPTION_CRLF = "crlf";
|
|
368862
|
+
var CHARACTER_CR = "\r";
|
|
368863
|
+
var CHARACTER_CRLF = "\r\n";
|
|
368864
|
+
var CHARACTER_LF = "\n";
|
|
368865
|
+
var DEFAULT_EOL = CHARACTER_LF;
|
|
368866
|
+
function convertEndOfLineOptionToCharacter(endOfLineOption) {
|
|
368867
|
+
return endOfLineOption === OPTION_CR ? CHARACTER_CR : endOfLineOption === OPTION_CRLF ? CHARACTER_CRLF : DEFAULT_EOL;
|
|
369174
368868
|
}
|
|
369175
|
-
|
|
369176
|
-
return mapDoc(doc, (currentDoc) => cleanDocFn(currentDoc));
|
|
368869
|
+
var emoji_regex_default = () => {
|
|
368870
|
+
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
368871
|
+
};
|
|
368872
|
+
function isFullWidth(x8) {
|
|
368873
|
+
return x8 === 12288 || x8 >= 65281 && x8 <= 65376 || x8 >= 65504 && x8 <= 65510;
|
|
369177
368874
|
}
|
|
369178
|
-
function
|
|
369179
|
-
return
|
|
368875
|
+
function isWide(x8) {
|
|
368876
|
+
return x8 >= 4352 && x8 <= 4447 || x8 === 8986 || x8 === 8987 || x8 === 9001 || x8 === 9002 || x8 >= 9193 && x8 <= 9196 || x8 === 9200 || x8 === 9203 || x8 === 9725 || x8 === 9726 || x8 === 9748 || x8 === 9749 || x8 >= 9776 && x8 <= 9783 || x8 >= 9800 && x8 <= 9811 || x8 === 9855 || x8 >= 9866 && x8 <= 9871 || x8 === 9875 || x8 === 9889 || x8 === 9898 || x8 === 9899 || x8 === 9917 || x8 === 9918 || x8 === 9924 || x8 === 9925 || x8 === 9934 || x8 === 9940 || x8 === 9962 || x8 === 9970 || x8 === 9971 || x8 === 9973 || x8 === 9978 || x8 === 9981 || x8 === 9989 || x8 === 9994 || x8 === 9995 || x8 === 10024 || x8 === 10060 || x8 === 10062 || x8 >= 10067 && x8 <= 10069 || x8 === 10071 || x8 >= 10133 && x8 <= 10135 || x8 === 10160 || x8 === 10175 || x8 === 11035 || x8 === 11036 || x8 === 11088 || x8 === 11093 || x8 >= 11904 && x8 <= 11929 || x8 >= 11931 && x8 <= 12019 || x8 >= 12032 && x8 <= 12245 || x8 >= 12272 && x8 <= 12287 || x8 >= 12289 && x8 <= 12350 || x8 >= 12353 && x8 <= 12438 || x8 >= 12441 && x8 <= 12543 || x8 >= 12549 && x8 <= 12591 || x8 >= 12593 && x8 <= 12686 || x8 >= 12688 && x8 <= 12773 || x8 >= 12783 && x8 <= 12830 || x8 >= 12832 && x8 <= 12871 || x8 >= 12880 && x8 <= 42124 || x8 >= 42128 && x8 <= 42182 || x8 >= 43360 && x8 <= 43388 || x8 >= 44032 && x8 <= 55203 || x8 >= 63744 && x8 <= 64255 || x8 >= 65040 && x8 <= 65049 || x8 >= 65072 && x8 <= 65106 || x8 >= 65108 && x8 <= 65126 || x8 >= 65128 && x8 <= 65131 || x8 >= 94176 && x8 <= 94180 || x8 >= 94192 && x8 <= 94198 || x8 >= 94208 && x8 <= 101589 || x8 >= 101631 && x8 <= 101662 || x8 >= 101760 && x8 <= 101874 || x8 >= 110576 && x8 <= 110579 || x8 >= 110581 && x8 <= 110587 || x8 === 110589 || x8 === 110590 || x8 >= 110592 && x8 <= 110882 || x8 === 110898 || x8 >= 110928 && x8 <= 110930 || x8 === 110933 || x8 >= 110948 && x8 <= 110951 || x8 >= 110960 && x8 <= 111355 || x8 >= 119552 && x8 <= 119638 || x8 >= 119648 && x8 <= 119670 || x8 === 126980 || x8 === 127183 || x8 === 127374 || x8 >= 127377 && x8 <= 127386 || x8 >= 127488 && x8 <= 127490 || x8 >= 127504 && x8 <= 127547 || x8 >= 127552 && x8 <= 127560 || x8 === 127568 || x8 === 127569 || x8 >= 127584 && x8 <= 127589 || x8 >= 127744 && x8 <= 127776 || x8 >= 127789 && x8 <= 127797 || x8 >= 127799 && x8 <= 127868 || x8 >= 127870 && x8 <= 127891 || x8 >= 127904 && x8 <= 127946 || x8 >= 127951 && x8 <= 127955 || x8 >= 127968 && x8 <= 127984 || x8 === 127988 || x8 >= 127992 && x8 <= 128062 || x8 === 128064 || x8 >= 128066 && x8 <= 128252 || x8 >= 128255 && x8 <= 128317 || x8 >= 128331 && x8 <= 128334 || x8 >= 128336 && x8 <= 128359 || x8 === 128378 || x8 === 128405 || x8 === 128406 || x8 === 128420 || x8 >= 128507 && x8 <= 128591 || x8 >= 128640 && x8 <= 128709 || x8 === 128716 || x8 >= 128720 && x8 <= 128722 || x8 >= 128725 && x8 <= 128728 || x8 >= 128732 && x8 <= 128735 || x8 === 128747 || x8 === 128748 || x8 >= 128756 && x8 <= 128764 || x8 >= 128992 && x8 <= 129003 || x8 === 129008 || x8 >= 129292 && x8 <= 129338 || x8 >= 129340 && x8 <= 129349 || x8 >= 129351 && x8 <= 129535 || x8 >= 129648 && x8 <= 129660 || x8 >= 129664 && x8 <= 129674 || x8 >= 129678 && x8 <= 129734 || x8 === 129736 || x8 >= 129741 && x8 <= 129756 || x8 >= 129759 && x8 <= 129770 || x8 >= 129775 && x8 <= 129784 || x8 >= 131072 && x8 <= 196605 || x8 >= 196608 && x8 <= 262141;
|
|
369180
368877
|
}
|
|
369181
|
-
|
|
369182
|
-
|
|
369183
|
-
|
|
368878
|
+
var narrow_emojis_evaluate_default = "\xA9\xAE\u203C\u2049\u2122\u2139\u2194\u2195\u2196\u2197\u2198\u2199\u21A9\u21AA\u2328\u23CF\u23F1\u23F2\u23F8\u23F9\u23FA\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600\u2601\u2602\u2603\u2604\u260E\u2611\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638\u2639\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694\u2695\u2696\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F1\u26F7\u26F8\u26F9\u2702\u2708\u2709\u270C\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u2764\u27A1\u2934\u2935\u2B05\u2B06\u2B07";
|
|
368879
|
+
var notAsciiRegex = /[^\x20-\x7F]/u;
|
|
368880
|
+
var narrowEmojisSet = new Set(narrow_emojis_evaluate_default);
|
|
368881
|
+
function getStringWidth(text) {
|
|
368882
|
+
if (!text) {
|
|
368883
|
+
return 0;
|
|
369184
368884
|
}
|
|
369185
|
-
|
|
369186
|
-
|
|
369187
|
-
|
|
369188
|
-
|
|
369189
|
-
|
|
369190
|
-
|
|
369191
|
-
|
|
369192
|
-
|
|
369193
|
-
(
|
|
369194
|
-
|
|
369195
|
-
|
|
369196
|
-
|
|
369197
|
-
}
|
|
369198
|
-
checked.add(doc2);
|
|
369199
|
-
});
|
|
369200
|
-
})
|
|
369201
|
-
);
|
|
369202
|
-
var assertDocArray = true ? noop_default : (
|
|
369203
|
-
/**
|
|
369204
|
-
@param {readonly Doc[]} docs
|
|
369205
|
-
@param {boolean} [optional = false]
|
|
369206
|
-
*/
|
|
369207
|
-
(function(docs, optional2 = false) {
|
|
369208
|
-
if (optional2 && !docs) {
|
|
369209
|
-
return;
|
|
369210
|
-
}
|
|
369211
|
-
if (!Array.isArray(docs)) {
|
|
369212
|
-
throw new TypeError("Unexpected doc array.");
|
|
369213
|
-
}
|
|
369214
|
-
for (const doc of docs) {
|
|
369215
|
-
assertDoc(doc);
|
|
368885
|
+
if (!notAsciiRegex.test(text)) {
|
|
368886
|
+
return text.length;
|
|
368887
|
+
}
|
|
368888
|
+
text = text.replace(
|
|
368889
|
+
emoji_regex_default(),
|
|
368890
|
+
(match19) => narrowEmojisSet.has(match19) ? " " : " "
|
|
368891
|
+
);
|
|
368892
|
+
let width = 0;
|
|
368893
|
+
for (const character of text) {
|
|
368894
|
+
const codePoint = character.codePointAt(0);
|
|
368895
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
368896
|
+
continue;
|
|
369216
368897
|
}
|
|
369217
|
-
|
|
369218
|
-
|
|
369219
|
-
var assertDocFillParts = true ? noop_default : (
|
|
369220
|
-
/**
|
|
369221
|
-
@param {readonly Doc[]} parts
|
|
369222
|
-
*/
|
|
369223
|
-
(function(parts2) {
|
|
369224
|
-
assertDocArray(parts2);
|
|
369225
|
-
if (parts2.length > 1 && isEmptyDoc(method_at_default(
|
|
369226
|
-
/* OPTIONAL_OBJECT: false */
|
|
369227
|
-
0,
|
|
369228
|
-
parts2,
|
|
369229
|
-
-1
|
|
369230
|
-
))) {
|
|
369231
|
-
parts2 = parts2.slice(0, -1);
|
|
368898
|
+
if (codePoint >= 768 && codePoint <= 879) {
|
|
368899
|
+
continue;
|
|
369232
368900
|
}
|
|
369233
|
-
|
|
369234
|
-
|
|
369235
|
-
const type = get_doc_type_default(doc);
|
|
369236
|
-
throw new Error(`Unexpected non-line-break doc at ${i}. Doc type is ${type}.`);
|
|
369237
|
-
}
|
|
369238
|
-
}
|
|
369239
|
-
})
|
|
369240
|
-
);
|
|
369241
|
-
var assertAlignType = true ? noop_default : function(alignType) {
|
|
369242
|
-
if (!(typeof alignType === "number" || typeof alignType === "string" || alignType?.type === "root")) {
|
|
369243
|
-
throw new TypeError(`Invalid alignType '${alignType}'.`);
|
|
369244
|
-
}
|
|
369245
|
-
};
|
|
369246
|
-
function indent(contents) {
|
|
369247
|
-
assertDoc(contents);
|
|
369248
|
-
return { type: DOC_TYPE_INDENT, contents };
|
|
369249
|
-
}
|
|
369250
|
-
function align(alignType, contents) {
|
|
369251
|
-
assertAlignType(alignType);
|
|
369252
|
-
assertDoc(contents);
|
|
369253
|
-
return { type: DOC_TYPE_ALIGN, contents, n: alignType };
|
|
369254
|
-
}
|
|
369255
|
-
function dedentToRoot(contents) {
|
|
369256
|
-
return align(Number.NEGATIVE_INFINITY, contents);
|
|
369257
|
-
}
|
|
369258
|
-
function markAsRoot(contents) {
|
|
369259
|
-
return align({ type: "root" }, contents);
|
|
369260
|
-
}
|
|
369261
|
-
function dedent(contents) {
|
|
369262
|
-
return align(-1, contents);
|
|
369263
|
-
}
|
|
369264
|
-
function addAlignmentToDoc(doc, size16, tabWidth) {
|
|
369265
|
-
assertDoc(doc);
|
|
369266
|
-
let aligned = doc;
|
|
369267
|
-
if (size16 > 0) {
|
|
369268
|
-
for (let level = 0; level < Math.floor(size16 / tabWidth); ++level) {
|
|
369269
|
-
aligned = indent(aligned);
|
|
369270
|
-
}
|
|
369271
|
-
aligned = align(size16 % tabWidth, aligned);
|
|
369272
|
-
aligned = align(Number.NEGATIVE_INFINITY, aligned);
|
|
369273
|
-
}
|
|
369274
|
-
return aligned;
|
|
369275
|
-
}
|
|
369276
|
-
var breakParent = { type: DOC_TYPE_BREAK_PARENT };
|
|
369277
|
-
var cursor = { type: DOC_TYPE_CURSOR };
|
|
369278
|
-
function fill(parts2) {
|
|
369279
|
-
assertDocFillParts(parts2);
|
|
369280
|
-
return { type: DOC_TYPE_FILL, parts: parts2 };
|
|
369281
|
-
}
|
|
369282
|
-
function group(contents, options8 = {}) {
|
|
369283
|
-
assertDoc(contents);
|
|
369284
|
-
assertDocArray(
|
|
369285
|
-
options8.expandedStates,
|
|
369286
|
-
/* optional */
|
|
369287
|
-
true
|
|
369288
|
-
);
|
|
369289
|
-
return {
|
|
369290
|
-
type: DOC_TYPE_GROUP,
|
|
369291
|
-
id: options8.id,
|
|
369292
|
-
contents,
|
|
369293
|
-
break: Boolean(options8.shouldBreak),
|
|
369294
|
-
expandedStates: options8.expandedStates
|
|
369295
|
-
};
|
|
369296
|
-
}
|
|
369297
|
-
function conditionalGroup(states, options8) {
|
|
369298
|
-
return group(states[0], { ...options8, expandedStates: states });
|
|
369299
|
-
}
|
|
369300
|
-
function ifBreak(breakContents, flatContents = "", options8 = {}) {
|
|
369301
|
-
assertDoc(breakContents);
|
|
369302
|
-
if (flatContents !== "") {
|
|
369303
|
-
assertDoc(flatContents);
|
|
369304
|
-
}
|
|
369305
|
-
return {
|
|
369306
|
-
type: DOC_TYPE_IF_BREAK,
|
|
369307
|
-
breakContents,
|
|
369308
|
-
flatContents,
|
|
369309
|
-
groupId: options8.groupId
|
|
369310
|
-
};
|
|
369311
|
-
}
|
|
369312
|
-
function indentIfBreak(contents, options8) {
|
|
369313
|
-
assertDoc(contents);
|
|
369314
|
-
return {
|
|
369315
|
-
type: DOC_TYPE_INDENT_IF_BREAK,
|
|
369316
|
-
contents,
|
|
369317
|
-
groupId: options8.groupId,
|
|
369318
|
-
negate: options8.negate
|
|
369319
|
-
};
|
|
369320
|
-
}
|
|
369321
|
-
function join8(separator, docs) {
|
|
369322
|
-
assertDoc(separator);
|
|
369323
|
-
assertDocArray(docs);
|
|
369324
|
-
const parts2 = [];
|
|
369325
|
-
for (let i = 0; i < docs.length; i++) {
|
|
369326
|
-
if (i !== 0) {
|
|
369327
|
-
parts2.push(separator);
|
|
369328
|
-
}
|
|
369329
|
-
parts2.push(docs[i]);
|
|
369330
|
-
}
|
|
369331
|
-
return parts2;
|
|
369332
|
-
}
|
|
369333
|
-
function label(label2, contents) {
|
|
369334
|
-
assertDoc(contents);
|
|
369335
|
-
return label2 ? { type: DOC_TYPE_LABEL, label: label2, contents } : contents;
|
|
369336
|
-
}
|
|
369337
|
-
var line = { type: DOC_TYPE_LINE };
|
|
369338
|
-
var softline = { type: DOC_TYPE_LINE, soft: true };
|
|
369339
|
-
var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
|
|
369340
|
-
var hardline = [hardlineWithoutBreakParent, breakParent];
|
|
369341
|
-
var literallineWithoutBreakParent = {
|
|
369342
|
-
type: DOC_TYPE_LINE,
|
|
369343
|
-
hard: true,
|
|
369344
|
-
literal: true
|
|
369345
|
-
};
|
|
369346
|
-
var literalline = [literallineWithoutBreakParent, breakParent];
|
|
369347
|
-
function lineSuffix(contents) {
|
|
369348
|
-
assertDoc(contents);
|
|
369349
|
-
return { type: DOC_TYPE_LINE_SUFFIX, contents };
|
|
369350
|
-
}
|
|
369351
|
-
var lineSuffixBoundary = { type: DOC_TYPE_LINE_SUFFIX_BOUNDARY };
|
|
369352
|
-
var trim = { type: DOC_TYPE_TRIM };
|
|
369353
|
-
var stringReplaceAll = String.prototype.replaceAll ?? function(pattern2, replacement) {
|
|
369354
|
-
if (pattern2.global) {
|
|
369355
|
-
return this.replace(pattern2, replacement);
|
|
369356
|
-
}
|
|
369357
|
-
return this.split(pattern2).join(replacement);
|
|
369358
|
-
};
|
|
369359
|
-
var replaceAll = createMethodShim("replaceAll", function() {
|
|
369360
|
-
if (typeof this === "string") {
|
|
369361
|
-
return stringReplaceAll;
|
|
369362
|
-
}
|
|
369363
|
-
});
|
|
369364
|
-
var method_replace_all_default = replaceAll;
|
|
369365
|
-
var OPTION_CR = "cr";
|
|
369366
|
-
var OPTION_CRLF = "crlf";
|
|
369367
|
-
var CHARACTER_CR = "\r";
|
|
369368
|
-
var CHARACTER_CRLF = "\r\n";
|
|
369369
|
-
var CHARACTER_LF = "\n";
|
|
369370
|
-
var DEFAULT_EOL = CHARACTER_LF;
|
|
369371
|
-
function convertEndOfLineOptionToCharacter(endOfLineOption) {
|
|
369372
|
-
return endOfLineOption === OPTION_CR ? CHARACTER_CR : endOfLineOption === OPTION_CRLF ? CHARACTER_CRLF : DEFAULT_EOL;
|
|
369373
|
-
}
|
|
369374
|
-
var emoji_regex_default = () => {
|
|
369375
|
-
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
369376
|
-
};
|
|
369377
|
-
function isFullWidth(x8) {
|
|
369378
|
-
return x8 === 12288 || x8 >= 65281 && x8 <= 65376 || x8 >= 65504 && x8 <= 65510;
|
|
369379
|
-
}
|
|
369380
|
-
function isWide(x8) {
|
|
369381
|
-
return x8 >= 4352 && x8 <= 4447 || x8 === 8986 || x8 === 8987 || x8 === 9001 || x8 === 9002 || x8 >= 9193 && x8 <= 9196 || x8 === 9200 || x8 === 9203 || x8 === 9725 || x8 === 9726 || x8 === 9748 || x8 === 9749 || x8 >= 9776 && x8 <= 9783 || x8 >= 9800 && x8 <= 9811 || x8 === 9855 || x8 >= 9866 && x8 <= 9871 || x8 === 9875 || x8 === 9889 || x8 === 9898 || x8 === 9899 || x8 === 9917 || x8 === 9918 || x8 === 9924 || x8 === 9925 || x8 === 9934 || x8 === 9940 || x8 === 9962 || x8 === 9970 || x8 === 9971 || x8 === 9973 || x8 === 9978 || x8 === 9981 || x8 === 9989 || x8 === 9994 || x8 === 9995 || x8 === 10024 || x8 === 10060 || x8 === 10062 || x8 >= 10067 && x8 <= 10069 || x8 === 10071 || x8 >= 10133 && x8 <= 10135 || x8 === 10160 || x8 === 10175 || x8 === 11035 || x8 === 11036 || x8 === 11088 || x8 === 11093 || x8 >= 11904 && x8 <= 11929 || x8 >= 11931 && x8 <= 12019 || x8 >= 12032 && x8 <= 12245 || x8 >= 12272 && x8 <= 12287 || x8 >= 12289 && x8 <= 12350 || x8 >= 12353 && x8 <= 12438 || x8 >= 12441 && x8 <= 12543 || x8 >= 12549 && x8 <= 12591 || x8 >= 12593 && x8 <= 12686 || x8 >= 12688 && x8 <= 12773 || x8 >= 12783 && x8 <= 12830 || x8 >= 12832 && x8 <= 12871 || x8 >= 12880 && x8 <= 42124 || x8 >= 42128 && x8 <= 42182 || x8 >= 43360 && x8 <= 43388 || x8 >= 44032 && x8 <= 55203 || x8 >= 63744 && x8 <= 64255 || x8 >= 65040 && x8 <= 65049 || x8 >= 65072 && x8 <= 65106 || x8 >= 65108 && x8 <= 65126 || x8 >= 65128 && x8 <= 65131 || x8 >= 94176 && x8 <= 94180 || x8 >= 94192 && x8 <= 94198 || x8 >= 94208 && x8 <= 101589 || x8 >= 101631 && x8 <= 101662 || x8 >= 101760 && x8 <= 101874 || x8 >= 110576 && x8 <= 110579 || x8 >= 110581 && x8 <= 110587 || x8 === 110589 || x8 === 110590 || x8 >= 110592 && x8 <= 110882 || x8 === 110898 || x8 >= 110928 && x8 <= 110930 || x8 === 110933 || x8 >= 110948 && x8 <= 110951 || x8 >= 110960 && x8 <= 111355 || x8 >= 119552 && x8 <= 119638 || x8 >= 119648 && x8 <= 119670 || x8 === 126980 || x8 === 127183 || x8 === 127374 || x8 >= 127377 && x8 <= 127386 || x8 >= 127488 && x8 <= 127490 || x8 >= 127504 && x8 <= 127547 || x8 >= 127552 && x8 <= 127560 || x8 === 127568 || x8 === 127569 || x8 >= 127584 && x8 <= 127589 || x8 >= 127744 && x8 <= 127776 || x8 >= 127789 && x8 <= 127797 || x8 >= 127799 && x8 <= 127868 || x8 >= 127870 && x8 <= 127891 || x8 >= 127904 && x8 <= 127946 || x8 >= 127951 && x8 <= 127955 || x8 >= 127968 && x8 <= 127984 || x8 === 127988 || x8 >= 127992 && x8 <= 128062 || x8 === 128064 || x8 >= 128066 && x8 <= 128252 || x8 >= 128255 && x8 <= 128317 || x8 >= 128331 && x8 <= 128334 || x8 >= 128336 && x8 <= 128359 || x8 === 128378 || x8 === 128405 || x8 === 128406 || x8 === 128420 || x8 >= 128507 && x8 <= 128591 || x8 >= 128640 && x8 <= 128709 || x8 === 128716 || x8 >= 128720 && x8 <= 128722 || x8 >= 128725 && x8 <= 128728 || x8 >= 128732 && x8 <= 128735 || x8 === 128747 || x8 === 128748 || x8 >= 128756 && x8 <= 128764 || x8 >= 128992 && x8 <= 129003 || x8 === 129008 || x8 >= 129292 && x8 <= 129338 || x8 >= 129340 && x8 <= 129349 || x8 >= 129351 && x8 <= 129535 || x8 >= 129648 && x8 <= 129660 || x8 >= 129664 && x8 <= 129674 || x8 >= 129678 && x8 <= 129734 || x8 === 129736 || x8 >= 129741 && x8 <= 129756 || x8 >= 129759 && x8 <= 129770 || x8 >= 129775 && x8 <= 129784 || x8 >= 131072 && x8 <= 196605 || x8 >= 196608 && x8 <= 262141;
|
|
369382
|
-
}
|
|
369383
|
-
var narrow_emojis_evaluate_default = "\xA9\xAE\u203C\u2049\u2122\u2139\u2194\u2195\u2196\u2197\u2198\u2199\u21A9\u21AA\u2328\u23CF\u23F1\u23F2\u23F8\u23F9\u23FA\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600\u2601\u2602\u2603\u2604\u260E\u2611\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638\u2639\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694\u2695\u2696\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F1\u26F7\u26F8\u26F9\u2702\u2708\u2709\u270C\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u2764\u27A1\u2934\u2935\u2B05\u2B06\u2B07";
|
|
369384
|
-
var notAsciiRegex = /[^\x20-\x7F]/u;
|
|
369385
|
-
var narrowEmojisSet = new Set(narrow_emojis_evaluate_default);
|
|
369386
|
-
function getStringWidth(text) {
|
|
369387
|
-
if (!text) {
|
|
369388
|
-
return 0;
|
|
369389
|
-
}
|
|
369390
|
-
if (!notAsciiRegex.test(text)) {
|
|
369391
|
-
return text.length;
|
|
369392
|
-
}
|
|
369393
|
-
text = text.replace(
|
|
369394
|
-
emoji_regex_default(),
|
|
369395
|
-
(match19) => narrowEmojisSet.has(match19) ? " " : " "
|
|
369396
|
-
);
|
|
369397
|
-
let width = 0;
|
|
369398
|
-
for (const character of text) {
|
|
369399
|
-
const codePoint = character.codePointAt(0);
|
|
369400
|
-
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
369401
|
-
continue;
|
|
369402
|
-
}
|
|
369403
|
-
if (codePoint >= 768 && codePoint <= 879) {
|
|
369404
|
-
continue;
|
|
369405
|
-
}
|
|
369406
|
-
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
369407
|
-
continue;
|
|
368901
|
+
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
368902
|
+
continue;
|
|
369408
368903
|
}
|
|
369409
368904
|
width += isFullWidth(codePoint) || isWide(codePoint) ? 2 : 1;
|
|
369410
368905
|
}
|
|
@@ -370030,7 +369525,7 @@ function printDocToString(doc, options8) {
|
|
|
370030
369525
|
}
|
|
370031
369526
|
}
|
|
370032
369527
|
var builders = {
|
|
370033
|
-
join:
|
|
369528
|
+
join: join7,
|
|
370034
369529
|
line,
|
|
370035
369530
|
softline,
|
|
370036
369531
|
hardline,
|
|
@@ -388188,119 +387683,641 @@ function makeString(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
|
|
|
388188
387683
|
if (escaped === otherQuote) {
|
|
388189
387684
|
return escaped;
|
|
388190
387685
|
}
|
|
388191
|
-
if (quote === enclosingQuote) {
|
|
388192
|
-
return "\\" + quote;
|
|
387686
|
+
if (quote === enclosingQuote) {
|
|
387687
|
+
return "\\" + quote;
|
|
387688
|
+
}
|
|
387689
|
+
if (quote) {
|
|
387690
|
+
return quote;
|
|
387691
|
+
}
|
|
387692
|
+
return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(escaped) ? escaped : "\\" + escaped;
|
|
387693
|
+
}
|
|
387694
|
+
);
|
|
387695
|
+
return enclosingQuote + raw + enclosingQuote;
|
|
387696
|
+
}
|
|
387697
|
+
function isNextLineEmpty2(text, startIndex) {
|
|
387698
|
+
return arguments.length === 2 || typeof startIndex === "number" ? is_next_line_empty_default(text, startIndex) : (
|
|
387699
|
+
// @ts-expect-error -- expected
|
|
387700
|
+
// eslint-disable-next-line prefer-rest-params
|
|
387701
|
+
legacyIsNextLineEmpty(...arguments)
|
|
387702
|
+
);
|
|
387703
|
+
}
|
|
387704
|
+
function withPlugins(fn10, optionsArgumentIndex = 1) {
|
|
387705
|
+
return async (...args2) => {
|
|
387706
|
+
const options8 = args2[optionsArgumentIndex] ?? {};
|
|
387707
|
+
const { plugins = [] } = options8;
|
|
387708
|
+
args2[optionsArgumentIndex] = {
|
|
387709
|
+
...options8,
|
|
387710
|
+
plugins: (await Promise.all([
|
|
387711
|
+
load_builtin_plugins_default(),
|
|
387712
|
+
// TODO: standalone version allow `plugins` to be `prettierPlugins` which is an object, should allow that too
|
|
387713
|
+
load_plugins_default(plugins)
|
|
387714
|
+
])).flat()
|
|
387715
|
+
};
|
|
387716
|
+
return fn10(...args2);
|
|
387717
|
+
};
|
|
387718
|
+
}
|
|
387719
|
+
var formatWithCursor2 = withPlugins(formatWithCursor);
|
|
387720
|
+
async function format22(text, options8) {
|
|
387721
|
+
const { formatted } = await formatWithCursor2(text, {
|
|
387722
|
+
...options8,
|
|
387723
|
+
cursorOffset: -1
|
|
387724
|
+
});
|
|
387725
|
+
return formatted;
|
|
387726
|
+
}
|
|
387727
|
+
async function check3(text, options8) {
|
|
387728
|
+
return await format22(text, options8) === text;
|
|
387729
|
+
}
|
|
387730
|
+
async function clearCache3() {
|
|
387731
|
+
clearCache();
|
|
387732
|
+
clearCache2();
|
|
387733
|
+
}
|
|
387734
|
+
var getSupportInfo2 = withPlugins(getSupportInfo, 0);
|
|
387735
|
+
var inferParser2 = withPlugins(
|
|
387736
|
+
(file, options8) => infer_parser_default(options8, { physicalFile: file })
|
|
387737
|
+
);
|
|
387738
|
+
var sharedWithCli = {
|
|
387739
|
+
errors: errors_exports2,
|
|
387740
|
+
optionCategories: option_categories_exports,
|
|
387741
|
+
createIsIgnoredFunction,
|
|
387742
|
+
formatOptionsHiddenDefaults,
|
|
387743
|
+
normalizeOptions: normalize_options_default,
|
|
387744
|
+
getSupportInfoWithoutPlugins: getSupportInfo,
|
|
387745
|
+
normalizeOptionSettings,
|
|
387746
|
+
inferParser: (file, options8) => Promise.resolve(options8?.parser ?? inferParser2(file, options8)),
|
|
387747
|
+
vnopts: {
|
|
387748
|
+
ChoiceSchema,
|
|
387749
|
+
apiDescriptor
|
|
387750
|
+
},
|
|
387751
|
+
fastGlob: import_fast_glob.default,
|
|
387752
|
+
createTwoFilesPatch,
|
|
387753
|
+
picocolors: import_picocolors5.default,
|
|
387754
|
+
closetLevenshteinMatch: closestMatch,
|
|
387755
|
+
utilities: {
|
|
387756
|
+
omit: object_omit_default,
|
|
387757
|
+
createMockable: create_mockable_default
|
|
387758
|
+
}
|
|
387759
|
+
};
|
|
387760
|
+
var debugApis = {
|
|
387761
|
+
parse: withPlugins(parse6),
|
|
387762
|
+
formatAST: withPlugins(formatAst),
|
|
387763
|
+
formatDoc: withPlugins(formatDoc),
|
|
387764
|
+
printToDoc: withPlugins(printToDoc),
|
|
387765
|
+
printDocToString: withPlugins(printDocToString2),
|
|
387766
|
+
// Exposed for tests
|
|
387767
|
+
mockable
|
|
387768
|
+
};
|
|
387769
|
+
|
|
387770
|
+
// src/Format.ts
|
|
387771
|
+
var PRETTIER_CONFIG = {
|
|
387772
|
+
parser: "markdown",
|
|
387773
|
+
printWidth: 80,
|
|
387774
|
+
proseWrap: "always"
|
|
387775
|
+
};
|
|
387776
|
+
var MARKDOWN_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".markdown"]);
|
|
387777
|
+
var formatString = (content) => Effect_exports.tryPromise({
|
|
387778
|
+
try: () => index_exports.format(content, PRETTIER_CONFIG),
|
|
387779
|
+
catch: (e7) => new Error(e7 instanceof Error ? e7.message : String(e7))
|
|
387780
|
+
});
|
|
387781
|
+
var formatFile = (path15) => Effect_exports.gen(function* () {
|
|
387782
|
+
const ext = extname2(path15).toLowerCase();
|
|
387783
|
+
if (!MARKDOWN_EXTENSIONS.has(ext)) {
|
|
387784
|
+
return yield* Effect_exports.fail(
|
|
387785
|
+
new Error(`gtd format: ${path15} is not a markdown file (expected .md or .markdown)`)
|
|
387786
|
+
);
|
|
387787
|
+
}
|
|
387788
|
+
const fs8 = yield* FileSystem_exports.FileSystem;
|
|
387789
|
+
const exists4 = yield* fs8.exists(path15);
|
|
387790
|
+
if (!exists4) {
|
|
387791
|
+
return yield* Effect_exports.fail(new Error(`gtd: skipped formatting ${path15}: not found`));
|
|
387792
|
+
}
|
|
387793
|
+
const content = yield* fs8.readFileString(path15, "utf8");
|
|
387794
|
+
const formatted = yield* formatString(content);
|
|
387795
|
+
if (formatted !== content) {
|
|
387796
|
+
yield* fs8.writeFileString(path15, formatted);
|
|
387797
|
+
}
|
|
387798
|
+
}).pipe(Effect_exports.mapError((e7) => e7 instanceof Error ? e7 : new Error(String(e7))));
|
|
387799
|
+
|
|
387800
|
+
// src/Events.ts
|
|
387801
|
+
var TODO_FILE = "TODO.md";
|
|
387802
|
+
var GTD_DIR = ".gtd";
|
|
387803
|
+
var REVIEW_FILE = "REVIEW.md";
|
|
387804
|
+
var FEEDBACK_FILE = "FEEDBACK.md";
|
|
387805
|
+
var ERRORS_FILE = "ERRORS.md";
|
|
387806
|
+
var EMPTY_FAILURE_SENTINEL = "Test command failed with no output (exit code non-zero).";
|
|
387807
|
+
var UNANSWERED_MARKER = "<!-- user answers here -->";
|
|
387808
|
+
var NEW_TASK_SUBJECT = "gtd: new task";
|
|
387809
|
+
var GRILLING_SUBJECT = "gtd: grilling";
|
|
387810
|
+
var PLANNING_SUBJECT = "gtd: planning";
|
|
387811
|
+
var BUILDING_SUBJECT = "gtd: building";
|
|
387812
|
+
var ERRORS_SUBJECT = "gtd: errors";
|
|
387813
|
+
var FEEDBACK_SUBJECT = "gtd: feedback";
|
|
387814
|
+
var PACKAGE_DONE_SUBJECT = "gtd: package done";
|
|
387815
|
+
var AWAITING_REVIEW_SUBJECT = "gtd: awaiting review";
|
|
387816
|
+
var DONE_SUBJECT = "gtd: done";
|
|
387817
|
+
var REVIEW_FEEDBACK_SUBJECT = "gtd: review feedback";
|
|
387818
|
+
var SQUASH_MSG_FILE = "SQUASH_MSG.md";
|
|
387819
|
+
var STEERING_FILES = [
|
|
387820
|
+
TODO_FILE,
|
|
387821
|
+
REVIEW_FILE,
|
|
387822
|
+
FEEDBACK_FILE,
|
|
387823
|
+
ERRORS_FILE,
|
|
387824
|
+
SQUASH_MSG_FILE
|
|
387825
|
+
];
|
|
387826
|
+
var WORKFLOW_FILE_EXCLUDES = [...STEERING_FILES, GTD_DIR];
|
|
387827
|
+
var isGtdPath = (path15) => path15 === GTD_DIR || path15.startsWith(`${GTD_DIR}/`);
|
|
387828
|
+
var isSteeringFile = (path15) => STEERING_FILES.includes(path15);
|
|
387829
|
+
var isUncommittedStatus = (status2) => status2.includes("?") || status2.includes("A");
|
|
387830
|
+
var EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
|
|
387831
|
+
var unquoteGitPath = (raw) => {
|
|
387832
|
+
if (!raw.startsWith('"')) return raw;
|
|
387833
|
+
const inner = raw.slice(1, raw.endsWith('"') ? raw.length - 1 : raw.length);
|
|
387834
|
+
const bytes = [];
|
|
387835
|
+
const chars = [];
|
|
387836
|
+
const flushBytes = () => {
|
|
387837
|
+
if (bytes.length === 0) return;
|
|
387838
|
+
const buf = Buffer.from(bytes);
|
|
387839
|
+
chars.push(buf.toString("utf8"));
|
|
387840
|
+
bytes.length = 0;
|
|
387841
|
+
};
|
|
387842
|
+
let i = 0;
|
|
387843
|
+
while (i < inner.length) {
|
|
387844
|
+
if (inner[i] !== "\\") {
|
|
387845
|
+
flushBytes();
|
|
387846
|
+
chars.push(inner[i]);
|
|
387847
|
+
i++;
|
|
387848
|
+
continue;
|
|
387849
|
+
}
|
|
387850
|
+
const esc = inner[i + 1];
|
|
387851
|
+
if (esc === void 0) {
|
|
387852
|
+
flushBytes();
|
|
387853
|
+
chars.push("\\");
|
|
387854
|
+
i++;
|
|
387855
|
+
continue;
|
|
387856
|
+
}
|
|
387857
|
+
if (esc >= "0" && esc <= "7") {
|
|
387858
|
+
const oct = inner.slice(i + 1, i + 4);
|
|
387859
|
+
bytes.push(parseInt(oct, 8));
|
|
387860
|
+
i += 4;
|
|
387861
|
+
continue;
|
|
387862
|
+
}
|
|
387863
|
+
flushBytes();
|
|
387864
|
+
switch (esc) {
|
|
387865
|
+
case "n":
|
|
387866
|
+
chars.push("\n");
|
|
387867
|
+
break;
|
|
387868
|
+
case "t":
|
|
387869
|
+
chars.push(" ");
|
|
387870
|
+
break;
|
|
387871
|
+
case "r":
|
|
387872
|
+
chars.push("\r");
|
|
387873
|
+
break;
|
|
387874
|
+
case "\\":
|
|
387875
|
+
chars.push("\\");
|
|
387876
|
+
break;
|
|
387877
|
+
case '"':
|
|
387878
|
+
chars.push('"');
|
|
387879
|
+
break;
|
|
387880
|
+
default:
|
|
387881
|
+
chars.push("\\", esc);
|
|
387882
|
+
}
|
|
387883
|
+
i += 2;
|
|
387884
|
+
}
|
|
387885
|
+
flushBytes();
|
|
387886
|
+
return chars.join("");
|
|
387887
|
+
};
|
|
387888
|
+
var parsePorcelainPaths = (porcelain) => porcelain.split("\n").map((line3) => line3.replace(/\r$/, "")).filter((line3) => line3.length > 0).map((line3) => ({ status: line3.slice(0, 2), path: unquoteGitPath(line3.slice(3)) }));
|
|
387889
|
+
var isNumberedDir = (name) => /^\d+-/.test(name);
|
|
387890
|
+
var isTaskFile = (name) => name.endsWith(".md");
|
|
387891
|
+
var stripCode = (content) => content.replace(/^(`{3,}|~{3,})[^\n]*\n[\s\S]*?(?:\n\1[^\n]*|$(?![\s\S]))/gm, "").replace(/`[^`\n]+`/g, "");
|
|
387892
|
+
var getPackages = (fs8, root2) => Effect_exports.gen(function* () {
|
|
387893
|
+
const resolve5 = (p4) => join9(root2, p4);
|
|
387894
|
+
const gtdExists = yield* fs8.exists(resolve5(GTD_DIR));
|
|
387895
|
+
if (!gtdExists) return [];
|
|
387896
|
+
const entries2 = yield* fs8.readDirectory(resolve5(GTD_DIR));
|
|
387897
|
+
const packageDirs = entries2.filter(isNumberedDir).sort();
|
|
387898
|
+
const packages = [];
|
|
387899
|
+
for (const dir of packageDirs) {
|
|
387900
|
+
const packagePath = `${GTD_DIR}/${dir}`;
|
|
387901
|
+
const stat4 = yield* fs8.stat(resolve5(packagePath));
|
|
387902
|
+
if (stat4.type !== "Directory") continue;
|
|
387903
|
+
const files = yield* fs8.readDirectory(resolve5(packagePath));
|
|
387904
|
+
const tasks = files.filter(isTaskFile).sort();
|
|
387905
|
+
const taskContents = [];
|
|
387906
|
+
for (const taskFile of tasks) {
|
|
387907
|
+
const content = yield* fs8.readFileString(resolve5(`${packagePath}/${taskFile}`));
|
|
387908
|
+
taskContents.push({ name: taskFile, content });
|
|
387909
|
+
}
|
|
387910
|
+
packages.push({ name: dir, tasks, taskContents });
|
|
387911
|
+
}
|
|
387912
|
+
return packages;
|
|
387913
|
+
}).pipe(Effect_exports.mapError((e7) => e7 instanceof Error ? e7 : new Error(String(e7))));
|
|
387914
|
+
var CAPTURE_RULES = [
|
|
387915
|
+
"Interpret the captured diff with these rules:",
|
|
387916
|
+
"",
|
|
387917
|
+
"- **Code changes** are suggestions, not finished work \u2014 plan to re-implement",
|
|
387918
|
+
" them properly, including test coverage, rather than restoring them verbatim.",
|
|
387919
|
+
"- **Code comments** are positional feedback about the code at that location.",
|
|
387920
|
+
"- **TODO.md / REVIEW.md text changes** are global feedback on the plan or the",
|
|
387921
|
+
" reviewed work as a whole.",
|
|
387922
|
+
"- **Checkbox flips** in a captured REVIEW.md diff are approval noise \u2014 ignore",
|
|
387923
|
+
" them."
|
|
387924
|
+
].join("\n");
|
|
387925
|
+
var seedTodo = (capturedDiff) => {
|
|
387926
|
+
const body = capturedDiff.replace(/\n+$/, "");
|
|
387927
|
+
const fence = fenceFor(body);
|
|
387928
|
+
return [
|
|
387929
|
+
"# Plan",
|
|
387930
|
+
"",
|
|
387931
|
+
"## Captured input",
|
|
387932
|
+
"",
|
|
387933
|
+
"These changes were captured as the starting point for this feature. Develop",
|
|
387934
|
+
"them into a concrete plan and surface any open questions for the user.",
|
|
387935
|
+
"",
|
|
387936
|
+
CAPTURE_RULES,
|
|
387937
|
+
"",
|
|
387938
|
+
`${fence}diff`,
|
|
387939
|
+
body,
|
|
387940
|
+
fence,
|
|
387941
|
+
""
|
|
387942
|
+
].join("\n");
|
|
387943
|
+
};
|
|
387944
|
+
var appendCapturedInput = (todo, capturedDiff) => {
|
|
387945
|
+
const body = capturedDiff.replace(/\n+$/, "");
|
|
387946
|
+
if (todo.includes(body)) return todo;
|
|
387947
|
+
const fence = fenceFor(body);
|
|
387948
|
+
const section = [
|
|
387949
|
+
"## Captured input (grilling)",
|
|
387950
|
+
"",
|
|
387951
|
+
"These code changes were made during grilling and captured as suggestions;",
|
|
387952
|
+
"gtd has reverted them from the working tree.",
|
|
387953
|
+
"",
|
|
387954
|
+
...todo.includes(CAPTURE_RULES) ? [] : [CAPTURE_RULES, ""],
|
|
387955
|
+
`${fence}diff`,
|
|
387956
|
+
body,
|
|
387957
|
+
fence,
|
|
387958
|
+
""
|
|
387959
|
+
].join("\n");
|
|
387960
|
+
return todo.replace(/\n*$/, "\n\n") + section;
|
|
387961
|
+
};
|
|
387962
|
+
var isCheckboxOnlyDiff = (diff8) => {
|
|
387963
|
+
if (diff8.trim() === "") return false;
|
|
387964
|
+
const checkboxRe = /^(\s*- \[)([xX ])\](.*)$/;
|
|
387965
|
+
const removedLines = [];
|
|
387966
|
+
const addedLines = [];
|
|
387967
|
+
for (const raw of diff8.split("\n")) {
|
|
387968
|
+
const line3 = raw.replace(/\r$/, "");
|
|
387969
|
+
if (line3.startsWith("---") || line3.startsWith("+++") || line3.startsWith("@@") || line3.startsWith("diff ") || line3.startsWith("index ") || line3.startsWith("new file") || line3.startsWith("deleted file") || line3.startsWith("similarity") || line3.startsWith("rename"))
|
|
387970
|
+
continue;
|
|
387971
|
+
if (line3.startsWith("-")) {
|
|
387972
|
+
removedLines.push(line3.slice(1));
|
|
387973
|
+
} else if (line3.startsWith("+")) {
|
|
387974
|
+
addedLines.push(line3.slice(1));
|
|
387975
|
+
}
|
|
387976
|
+
}
|
|
387977
|
+
if (removedLines.length !== addedLines.length) return false;
|
|
387978
|
+
let flips = 0;
|
|
387979
|
+
for (let i = 0; i < removedLines.length; i++) {
|
|
387980
|
+
const rm4 = removedLines[i];
|
|
387981
|
+
const add7 = addedLines[i];
|
|
387982
|
+
if (rm4 === add7) continue;
|
|
387983
|
+
if (!checkboxRe.test(rm4) || !checkboxRe.test(add7)) return false;
|
|
387984
|
+
const rmNorm = rm4.replace(/\[[ xX]\]/, "[ ]");
|
|
387985
|
+
const addNorm = add7.replace(/\[[ xX]\]/, "[ ]");
|
|
387986
|
+
if (rmNorm !== addNorm) return false;
|
|
387987
|
+
flips += 1;
|
|
387988
|
+
}
|
|
387989
|
+
return flips > 0;
|
|
387990
|
+
};
|
|
387991
|
+
var gatherEvents = () => (
|
|
387992
|
+
// fallow-ignore-next-line complexity
|
|
387993
|
+
Effect_exports.gen(function* () {
|
|
387994
|
+
const git = yield* GitService;
|
|
387995
|
+
const fs8 = yield* FileSystem_exports.FileSystem;
|
|
387996
|
+
const config2 = yield* ConfigService;
|
|
387997
|
+
const { root: root2 } = yield* Cwd;
|
|
387998
|
+
const resolve5 = (p4) => join9(root2, p4);
|
|
387999
|
+
const defaultBranch = yield* git.resolveDefaultBranch();
|
|
388000
|
+
const headHash = yield* git.resolveRef("HEAD").pipe(Effect_exports.catchAll(() => Effect_exports.succeed("")));
|
|
388001
|
+
const mergeBase = Option_exports.isSome(defaultBranch) ? yield* git.mergeBase(defaultBranch.value, "HEAD") : Option_exports.none();
|
|
388002
|
+
const base = Option_exports.isSome(mergeBase) && mergeBase.value !== headHash ? mergeBase : Option_exports.none();
|
|
388003
|
+
const history = yield* git.commitHistory(Option_exports.getOrUndefined(base));
|
|
388004
|
+
const commitEvents = history.map(
|
|
388005
|
+
({ message, removedErrors }) => {
|
|
388006
|
+
const subject = (message.split("\n")[0] ?? "").trim();
|
|
388007
|
+
return {
|
|
388008
|
+
type: "COMMIT",
|
|
388009
|
+
isErrors: subject === ERRORS_SUBJECT,
|
|
388010
|
+
isFeedback: subject === FEEDBACK_SUBJECT,
|
|
388011
|
+
isPackageStart: subject === PLANNING_SUBJECT || subject === PACKAGE_DONE_SUBJECT,
|
|
388012
|
+
isWorkflowCommit: subject.startsWith("gtd: "),
|
|
388013
|
+
removedErrors
|
|
388014
|
+
};
|
|
388015
|
+
}
|
|
388016
|
+
);
|
|
388017
|
+
const hasCommits = yield* git.hasCommits();
|
|
388018
|
+
const porcelain = yield* git.statusPorcelain();
|
|
388019
|
+
const entries2 = parsePorcelainPaths(porcelain);
|
|
388020
|
+
const workingTreeClean = entries2.length === 0;
|
|
388021
|
+
const lastCommitSubject = hasCommits ? yield* git.lastCommitSubject() : "";
|
|
388022
|
+
const gtdModified = entries2.some((e7) => isGtdPath(e7.path));
|
|
388023
|
+
const codeDirty = entries2.some((e7) => !isSteeringFile(e7.path) && !isGtdPath(e7.path));
|
|
388024
|
+
const todoExists = yield* fs8.exists(resolve5(TODO_FILE));
|
|
388025
|
+
const gtdDirExists = yield* fs8.exists(resolve5(GTD_DIR));
|
|
388026
|
+
const reviewPresent = yield* fs8.exists(resolve5(REVIEW_FILE));
|
|
388027
|
+
const feedbackPresent = yield* fs8.exists(resolve5(FEEDBACK_FILE));
|
|
388028
|
+
const errorsPresent = yield* fs8.exists(resolve5(ERRORS_FILE));
|
|
388029
|
+
const todoContent = todoExists ? yield* fs8.readFileString(resolve5(TODO_FILE)) : "";
|
|
388030
|
+
const todoMarkerPresent = todoExists && stripCode(todoContent).includes(UNANSWERED_MARKER);
|
|
388031
|
+
const isUncommitted = (path15) => {
|
|
388032
|
+
const entry = entries2.find((e7) => e7.path === path15);
|
|
388033
|
+
return entry !== void 0 && isUncommittedStatus(entry.status);
|
|
388034
|
+
};
|
|
388035
|
+
const feedbackCommitted = feedbackPresent && !isUncommitted(FEEDBACK_FILE);
|
|
388036
|
+
const feedbackContent = feedbackPresent ? yield* fs8.readFileString(resolve5(FEEDBACK_FILE)) : "";
|
|
388037
|
+
const feedbackEmpty = feedbackPresent && !/\S/.test(feedbackContent);
|
|
388038
|
+
const reviewTrackedAtHead = reviewPresent && !isUncommitted(REVIEW_FILE);
|
|
388039
|
+
const reviewCommitted = reviewTrackedAtHead && workingTreeClean;
|
|
388040
|
+
const reviewDirty = reviewTrackedAtHead && !workingTreeClean;
|
|
388041
|
+
const todoCommitted = todoExists && !isUncommitted(TODO_FILE);
|
|
388042
|
+
const pendingErrorsDeletion = entries2.some(
|
|
388043
|
+
(e7) => e7.path === ERRORS_FILE && e7.status.includes("D")
|
|
388044
|
+
);
|
|
388045
|
+
const packages = yield* getPackages(fs8, root2);
|
|
388046
|
+
const diff8 = hasCommits && entries2.length > 0 ? yield* git.diffHead() : "";
|
|
388047
|
+
const onlyReviewDirty = entries2.length > 0 && entries2.every((e7) => e7.path === REVIEW_FILE);
|
|
388048
|
+
const reviewCheckboxOnly = onlyReviewDirty && isCheckboxOnlyDiff(
|
|
388049
|
+
yield* git.diffPath(REVIEW_FILE).pipe(Effect_exports.catchAll(() => Effect_exports.succeed("")))
|
|
388050
|
+
);
|
|
388051
|
+
let reviewBase;
|
|
388052
|
+
let refDiff;
|
|
388053
|
+
let hasCommitsAfterLastDone = true;
|
|
388054
|
+
if (hasCommits) {
|
|
388055
|
+
const allHistory = Option_exports.isNone(base) ? history : yield* git.commitHistory();
|
|
388056
|
+
const lastDoneIdx = (() => {
|
|
388057
|
+
let idx = -1;
|
|
388058
|
+
for (let i = 0; i < allHistory.length; i++) {
|
|
388059
|
+
const subject = (allHistory[i].message.split("\n")[0] ?? "").trim();
|
|
388060
|
+
if (subject === DONE_SUBJECT) idx = i;
|
|
388061
|
+
}
|
|
388062
|
+
return idx;
|
|
388063
|
+
})();
|
|
388064
|
+
const currentCycle = lastDoneIdx === -1 ? allHistory : allHistory.slice(lastDoneIdx + 1);
|
|
388065
|
+
hasCommitsAfterLastDone = lastDoneIdx === -1 || currentCycle.length > 0;
|
|
388066
|
+
const firstGrilling = currentCycle.find(
|
|
388067
|
+
(c7) => (c7.message.split("\n")[0] ?? "").trim() === GRILLING_SUBJECT
|
|
388068
|
+
);
|
|
388069
|
+
const lastAwaitingReview = (() => {
|
|
388070
|
+
let found;
|
|
388071
|
+
for (const c7 of currentCycle) {
|
|
388072
|
+
if ((c7.message.split("\n")[0] ?? "").trim().startsWith(AWAITING_REVIEW_SUBJECT)) {
|
|
388073
|
+
found = c7;
|
|
388074
|
+
}
|
|
388075
|
+
}
|
|
388076
|
+
return found;
|
|
388077
|
+
})();
|
|
388078
|
+
const withinProcess = firstGrilling !== void 0;
|
|
388079
|
+
let candidate;
|
|
388080
|
+
if (withinProcess) {
|
|
388081
|
+
if (lastAwaitingReview !== void 0) {
|
|
388082
|
+
candidate = lastAwaitingReview.hash ?? EMPTY_TREE;
|
|
388083
|
+
} else {
|
|
388084
|
+
candidate = firstGrilling.hash ?? EMPTY_TREE;
|
|
388085
|
+
}
|
|
388086
|
+
} else {
|
|
388087
|
+
const mergeBaseCandidate = Option_exports.isSome(base) && base.value !== headHash ? base.value : void 0;
|
|
388088
|
+
if (mergeBaseCandidate !== void 0) {
|
|
388089
|
+
candidate = mergeBaseCandidate;
|
|
388090
|
+
}
|
|
388091
|
+
}
|
|
388092
|
+
if (candidate !== void 0 && hasCommitsAfterLastDone) {
|
|
388093
|
+
const candidateDiff = yield* git.diffRef(candidate, WORKFLOW_FILE_EXCLUDES).pipe(Effect_exports.catchAll(() => Effect_exports.succeed("")));
|
|
388094
|
+
if (candidateDiff.trim().length > 0) {
|
|
388095
|
+
reviewBase = candidate;
|
|
388096
|
+
refDiff = candidateDiff;
|
|
388097
|
+
}
|
|
388098
|
+
}
|
|
388099
|
+
}
|
|
388100
|
+
let squashBase;
|
|
388101
|
+
let squashDiff;
|
|
388102
|
+
if (hasCommits && lastCommitSubject === DONE_SUBJECT && config2.squash) {
|
|
388103
|
+
const allHistoryForSquash = Option_exports.isNone(base) ? history : yield* git.commitHistory();
|
|
388104
|
+
const lastDoneIdxForSquash = (() => {
|
|
388105
|
+
let idx = -1;
|
|
388106
|
+
for (let i = 0; i < allHistoryForSquash.length; i++) {
|
|
388107
|
+
const subject = (allHistoryForSquash[i].message.split("\n")[0] ?? "").trim();
|
|
388108
|
+
if (subject === DONE_SUBJECT) idx = i;
|
|
388109
|
+
}
|
|
388110
|
+
return idx;
|
|
388111
|
+
})();
|
|
388112
|
+
if (lastDoneIdxForSquash !== -1) {
|
|
388113
|
+
let prevDoneIdx = -1;
|
|
388114
|
+
for (let i = 0; i < lastDoneIdxForSquash; i++) {
|
|
388115
|
+
const subject = (allHistoryForSquash[i].message.split("\n")[0] ?? "").trim();
|
|
388116
|
+
if (subject === DONE_SUBJECT) prevDoneIdx = i;
|
|
388117
|
+
}
|
|
388118
|
+
const squashCycle = allHistoryForSquash.slice(prevDoneIdx + 1, lastDoneIdxForSquash + 1);
|
|
388119
|
+
const squashNewTask = squashCycle.find(
|
|
388120
|
+
(c7) => (c7.message.split("\n")[0] ?? "").trim() === NEW_TASK_SUBJECT
|
|
388121
|
+
);
|
|
388122
|
+
const squashGrilling = squashCycle.find(
|
|
388123
|
+
(c7) => (c7.message.split("\n")[0] ?? "").trim() === GRILLING_SUBJECT
|
|
388124
|
+
);
|
|
388125
|
+
const squashStart = squashNewTask ?? squashGrilling;
|
|
388126
|
+
if (squashStart !== void 0) {
|
|
388127
|
+
const squashStartParent = yield* git.resolveRef(`${squashStart.hash}~1`).pipe(Effect_exports.catchAll(() => Effect_exports.succeed(EMPTY_TREE)));
|
|
388128
|
+
const candidateDiff = yield* git.diffRef(squashStartParent).pipe(Effect_exports.catchAll(() => Effect_exports.succeed("")));
|
|
388129
|
+
if (candidateDiff.trim().length > 0) {
|
|
388130
|
+
squashBase = squashStartParent;
|
|
388131
|
+
squashDiff = candidateDiff;
|
|
388132
|
+
}
|
|
388133
|
+
}
|
|
388134
|
+
}
|
|
388135
|
+
}
|
|
388136
|
+
const squashMsgPresent = yield* fs8.exists(resolve5(SQUASH_MSG_FILE));
|
|
388137
|
+
const squashMsgContent = squashMsgPresent ? yield* fs8.readFileString(resolve5(SQUASH_MSG_FILE)) : "";
|
|
388138
|
+
const payload = {
|
|
388139
|
+
todoExists,
|
|
388140
|
+
todoCommitted,
|
|
388141
|
+
gtdDirExists,
|
|
388142
|
+
reviewPresent,
|
|
388143
|
+
feedbackPresent,
|
|
388144
|
+
errorsPresent,
|
|
388145
|
+
gtdModified,
|
|
388146
|
+
codeDirty,
|
|
388147
|
+
todoMarkerPresent,
|
|
388148
|
+
feedbackCommitted,
|
|
388149
|
+
feedbackEmpty,
|
|
388150
|
+
feedbackContent,
|
|
388151
|
+
reviewCommitted,
|
|
388152
|
+
reviewDirty,
|
|
388153
|
+
reviewCheckboxOnly,
|
|
388154
|
+
pendingErrorsDeletion,
|
|
388155
|
+
lastCommitSubject,
|
|
388156
|
+
workingTreeClean,
|
|
388157
|
+
packages,
|
|
388158
|
+
diff: diff8,
|
|
388159
|
+
...reviewBase !== void 0 ? { reviewBase } : {},
|
|
388160
|
+
...refDiff !== void 0 ? { refDiff } : {},
|
|
388161
|
+
hasCommitsAfterLastDone,
|
|
388162
|
+
agenticReviewEnabled: config2.agenticReview,
|
|
388163
|
+
fixAttemptCap: config2.fixAttemptCap,
|
|
388164
|
+
reviewThreshold: config2.reviewThreshold,
|
|
388165
|
+
squashEnabled: config2.squash,
|
|
388166
|
+
...squashBase !== void 0 ? { squashBase } : {},
|
|
388167
|
+
...squashDiff !== void 0 ? { squashDiff } : {},
|
|
388168
|
+
squashMsgPresent,
|
|
388169
|
+
squashMsgContent
|
|
388170
|
+
};
|
|
388171
|
+
const resolveEvent = { type: "RESOLVE", payload };
|
|
388172
|
+
return [...commitEvents, resolveEvent];
|
|
388173
|
+
}).pipe(Effect_exports.mapError((e7) => e7 instanceof Error ? e7 : new Error(String(e7))))
|
|
388174
|
+
);
|
|
388175
|
+
var captureAndRevert = (git, subject, onRegen) => Effect_exports.gen(function* () {
|
|
388176
|
+
const head7 = yield* git.lastCommitSubject().pipe(Effect_exports.catchAll(() => Effect_exports.succeed("")));
|
|
388177
|
+
if (head7 !== subject) {
|
|
388178
|
+
yield* git.commitAllWithPrefix(subject);
|
|
388179
|
+
} else {
|
|
388180
|
+
yield* onRegen;
|
|
388181
|
+
}
|
|
388182
|
+
const base = yield* git.resolveRef("HEAD~1").pipe(Effect_exports.catchAll(() => Effect_exports.succeed(EMPTY_TREE)));
|
|
388183
|
+
const captured = yield* git.diffRef(base).pipe(Effect_exports.catchAll(() => Effect_exports.succeed("")));
|
|
388184
|
+
yield* git.revertNoCommit("HEAD");
|
|
388185
|
+
return captured;
|
|
388186
|
+
});
|
|
388187
|
+
var perform = (action) => (
|
|
388188
|
+
// fallow-ignore-next-line complexity
|
|
388189
|
+
Effect_exports.gen(function* () {
|
|
388190
|
+
const git = yield* GitService;
|
|
388191
|
+
const fs8 = yield* FileSystem_exports.FileSystem;
|
|
388192
|
+
const { root: root2 } = yield* Cwd;
|
|
388193
|
+
const resolve5 = (p4) => join9(root2, p4);
|
|
388194
|
+
switch (action.kind) {
|
|
388195
|
+
// Transport: mixed-reset the hand-made `gtd: transport` HEAD, keeping the
|
|
388196
|
+
// work in the tree, then re-derive. (No producer command — consume only.)
|
|
388197
|
+
case "transportReset": {
|
|
388198
|
+
yield* git.mixedResetHead();
|
|
388199
|
+
return;
|
|
388200
|
+
}
|
|
388201
|
+
// New Feature: capture the raw input as `gtd: new task` (unless HEAD is
|
|
388202
|
+
// already there — the lost-seed regenerate case), revert it back to a
|
|
388203
|
+
// clean baseline (inverse staged), and seed TODO.md from that diff.
|
|
388204
|
+
case "seedNewFeature": {
|
|
388205
|
+
const captured = yield* captureAndRevert(git, NEW_TASK_SUBJECT, Effect_exports.void);
|
|
388206
|
+
yield* fs8.writeFileString(resolve5(TODO_FILE), seedTodo(captured));
|
|
388207
|
+
return;
|
|
388193
388208
|
}
|
|
388194
|
-
|
|
388195
|
-
|
|
388209
|
+
// Accept Review: capture the human's pending changeset durably as
|
|
388210
|
+
// `gtd: review feedback` (annotations, code edits, and new files alike),
|
|
388211
|
+
// revert it back to the reviewed baseline, rm REVIEW.md (which is what
|
|
388212
|
+
// stops Accept Review re-firing), and seed TODO.md from the captured
|
|
388213
|
+
// diff. The regen case (the machine's rule-4 carve-out fired) discards
|
|
388214
|
+
// any partial revert/seed state with a hard reset first.
|
|
388215
|
+
case "seedAcceptReview": {
|
|
388216
|
+
const captured = yield* captureAndRevert(git, REVIEW_FEEDBACK_SUBJECT, git.resetHard());
|
|
388217
|
+
yield* fs8.remove(resolve5(REVIEW_FILE)).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
388218
|
+
yield* fs8.writeFileString(resolve5(TODO_FILE), seedTodo(captured));
|
|
388219
|
+
return;
|
|
388220
|
+
}
|
|
388221
|
+
// Grilling capture: the plan is already committed and the user sketched
|
|
388222
|
+
// code during the round. Fold the code diff (untracked included, steering
|
|
388223
|
+
// files excluded) into TODO.md as a suggestion block, drop the code
|
|
388224
|
+
// changes — reset tracked, delete untracked/added — and commit the lot as
|
|
388225
|
+
// one `gtd: grilling`. TODO.md's own pending edits are preserved verbatim
|
|
388226
|
+
// (snapshotted before the reset). Binary edits survive only as the diff's
|
|
388227
|
+
// "Binary files differ" line — an accepted limitation.
|
|
388228
|
+
case "captureGrillingEdits": {
|
|
388229
|
+
const porcelain = yield* git.statusPorcelain();
|
|
388230
|
+
const entries2 = parsePorcelainPaths(porcelain);
|
|
388231
|
+
const pendingCodeFiles = entries2.filter(
|
|
388232
|
+
(e7) => isUncommittedStatus(e7.status) && !isSteeringFile(e7.path) && !isGtdPath(e7.path)
|
|
388233
|
+
);
|
|
388234
|
+
const todoNow = yield* fs8.readFileString(resolve5(TODO_FILE));
|
|
388235
|
+
const captured = yield* git.diffHead(WORKFLOW_FILE_EXCLUDES);
|
|
388236
|
+
yield* git.resetHard();
|
|
388237
|
+
for (const entry of pendingCodeFiles) {
|
|
388238
|
+
yield* fs8.remove(resolve5(entry.path), { recursive: true }).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
388239
|
+
}
|
|
388240
|
+
yield* fs8.writeFileString(resolve5(TODO_FILE), appendCapturedInput(todoNow, captured));
|
|
388241
|
+
yield* git.commitAllWithPrefix(GRILLING_SUBJECT);
|
|
388242
|
+
return;
|
|
388243
|
+
}
|
|
388244
|
+
// Testing: commit the pending tree `gtd: building` (nothing pending in the
|
|
388245
|
+
// no-op-fixer case), run tests; on red write FEEDBACK (below cap) or ERRORS
|
|
388246
|
+
// (at cap) and commit `gtd: errors`; on green proceed.
|
|
388247
|
+
case "runTest": {
|
|
388248
|
+
const runner = yield* TestRunner;
|
|
388249
|
+
const status2 = yield* git.statusPorcelain();
|
|
388250
|
+
const committedBuilding = status2.trim().length > 0;
|
|
388251
|
+
if (committedBuilding) {
|
|
388252
|
+
yield* git.commitAllWithPrefix(BUILDING_SUBJECT);
|
|
388253
|
+
}
|
|
388254
|
+
const result = yield* runner.run();
|
|
388255
|
+
if (result.exitCode === 0) {
|
|
388256
|
+
if (!committedBuilding) {
|
|
388257
|
+
yield* git.commitAllWithPrefix(BUILDING_SUBJECT);
|
|
388258
|
+
}
|
|
388259
|
+
return;
|
|
388260
|
+
}
|
|
388261
|
+
const target = action.capReached ? ERRORS_FILE : FEEDBACK_FILE;
|
|
388262
|
+
const body = /\S/.test(result.output) ? result.output : EMPTY_FAILURE_SENTINEL;
|
|
388263
|
+
yield* fs8.writeFileString(resolve5(target), body);
|
|
388264
|
+
yield* git.commitAllWithPrefix(ERRORS_SUBJECT);
|
|
388265
|
+
return;
|
|
388266
|
+
}
|
|
388267
|
+
// Grilling / Grilled / Planning / Fixing: commit the pending tree under a
|
|
388268
|
+
// fixed phase prefix. Fixing sets `removeFeedback` so FEEDBACK.md's removal
|
|
388269
|
+
// lands in the `gtd: fixing` / `gtd: feedback` commit — otherwise the next
|
|
388270
|
+
// run re-detects FEEDBACK (precedence 2) and Fixing re-fires forever instead
|
|
388271
|
+
// of returning to Testing (STATES.md § Fixing).
|
|
388272
|
+
case "commitPending": {
|
|
388273
|
+
if (action.removeFeedback === true) {
|
|
388274
|
+
yield* fs8.remove(resolve5(FEEDBACK_FILE)).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
388275
|
+
}
|
|
388276
|
+
if (action.removeTodo === true) {
|
|
388277
|
+
yield* fs8.remove(resolve5(TODO_FILE)).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
388278
|
+
}
|
|
388279
|
+
if (action.removeTodo !== true) {
|
|
388280
|
+
yield* formatFile(resolve5(TODO_FILE)).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
388281
|
+
}
|
|
388282
|
+
yield* git.commitAllWithPrefix(action.prefix);
|
|
388283
|
+
return;
|
|
388284
|
+
}
|
|
388285
|
+
// Close package: remove the (maybe-empty / maybe-absent) FEEDBACK.md, rm
|
|
388286
|
+
// the first (finished) package dir (+ the now-empty `.gtd/`), commit
|
|
388287
|
+
// `gtd: package done`. Tolerates an absent FEEDBACK.md (force-approve).
|
|
388288
|
+
case "closePackage": {
|
|
388289
|
+
yield* fs8.remove(resolve5(FEEDBACK_FILE)).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
388290
|
+
const packages = yield* getPackages(fs8, root2);
|
|
388291
|
+
const first2 = packages[0];
|
|
388292
|
+
if (first2 !== void 0) {
|
|
388293
|
+
yield* git.removePackageDir(`${GTD_DIR}/${first2.name}`);
|
|
388294
|
+
}
|
|
388295
|
+
yield* git.commitAllWithPrefix(PACKAGE_DONE_SUBJECT);
|
|
388296
|
+
return;
|
|
388297
|
+
}
|
|
388298
|
+
// Await Review: commit REVIEW.md as `gtd: awaiting review`.
|
|
388299
|
+
case "commitReview": {
|
|
388300
|
+
yield* formatFile(resolve5(REVIEW_FILE)).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
388301
|
+
yield* git.commitAllWithPrefix(AWAITING_REVIEW_SUBJECT);
|
|
388302
|
+
return;
|
|
388303
|
+
}
|
|
388304
|
+
// Done: rm REVIEW.md, commit `gtd: done`.
|
|
388305
|
+
case "done": {
|
|
388306
|
+
yield* fs8.remove(resolve5(REVIEW_FILE)).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
388307
|
+
yield* git.commitAllWithPrefix(DONE_SUBJECT);
|
|
388308
|
+
return;
|
|
388309
|
+
}
|
|
388310
|
+
// Squash: rm SQUASH_MSG.md, soft-reset to squashBase, commit everything
|
|
388311
|
+
// under the provided commit message.
|
|
388312
|
+
case "squashCommit": {
|
|
388313
|
+
yield* fs8.remove(resolve5(SQUASH_MSG_FILE)).pipe(Effect_exports.catchAll(() => Effect_exports.void));
|
|
388314
|
+
yield* git.softResetTo(action.squashBase);
|
|
388315
|
+
yield* git.commitAllWithPrefix(action.commitMessage);
|
|
388316
|
+
return;
|
|
388196
388317
|
}
|
|
388197
|
-
return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(escaped) ? escaped : "\\" + escaped;
|
|
388198
388318
|
}
|
|
388199
|
-
)
|
|
388200
|
-
return enclosingQuote + raw + enclosingQuote;
|
|
388201
|
-
}
|
|
388202
|
-
function isNextLineEmpty2(text, startIndex) {
|
|
388203
|
-
return arguments.length === 2 || typeof startIndex === "number" ? is_next_line_empty_default(text, startIndex) : (
|
|
388204
|
-
// @ts-expect-error -- expected
|
|
388205
|
-
// eslint-disable-next-line prefer-rest-params
|
|
388206
|
-
legacyIsNextLineEmpty(...arguments)
|
|
388207
|
-
);
|
|
388208
|
-
}
|
|
388209
|
-
function withPlugins(fn10, optionsArgumentIndex = 1) {
|
|
388210
|
-
return async (...args2) => {
|
|
388211
|
-
const options8 = args2[optionsArgumentIndex] ?? {};
|
|
388212
|
-
const { plugins = [] } = options8;
|
|
388213
|
-
args2[optionsArgumentIndex] = {
|
|
388214
|
-
...options8,
|
|
388215
|
-
plugins: (await Promise.all([
|
|
388216
|
-
load_builtin_plugins_default(),
|
|
388217
|
-
// TODO: standalone version allow `plugins` to be `prettierPlugins` which is an object, should allow that too
|
|
388218
|
-
load_plugins_default(plugins)
|
|
388219
|
-
])).flat()
|
|
388220
|
-
};
|
|
388221
|
-
return fn10(...args2);
|
|
388222
|
-
};
|
|
388223
|
-
}
|
|
388224
|
-
var formatWithCursor2 = withPlugins(formatWithCursor);
|
|
388225
|
-
async function format22(text, options8) {
|
|
388226
|
-
const { formatted } = await formatWithCursor2(text, {
|
|
388227
|
-
...options8,
|
|
388228
|
-
cursorOffset: -1
|
|
388229
|
-
});
|
|
388230
|
-
return formatted;
|
|
388231
|
-
}
|
|
388232
|
-
async function check3(text, options8) {
|
|
388233
|
-
return await format22(text, options8) === text;
|
|
388234
|
-
}
|
|
388235
|
-
async function clearCache3() {
|
|
388236
|
-
clearCache();
|
|
388237
|
-
clearCache2();
|
|
388238
|
-
}
|
|
388239
|
-
var getSupportInfo2 = withPlugins(getSupportInfo, 0);
|
|
388240
|
-
var inferParser2 = withPlugins(
|
|
388241
|
-
(file, options8) => infer_parser_default(options8, { physicalFile: file })
|
|
388319
|
+
}).pipe(Effect_exports.mapError((e7) => e7 instanceof Error ? e7 : new Error(String(e7))))
|
|
388242
388320
|
);
|
|
388243
|
-
var sharedWithCli = {
|
|
388244
|
-
errors: errors_exports2,
|
|
388245
|
-
optionCategories: option_categories_exports,
|
|
388246
|
-
createIsIgnoredFunction,
|
|
388247
|
-
formatOptionsHiddenDefaults,
|
|
388248
|
-
normalizeOptions: normalize_options_default,
|
|
388249
|
-
getSupportInfoWithoutPlugins: getSupportInfo,
|
|
388250
|
-
normalizeOptionSettings,
|
|
388251
|
-
inferParser: (file, options8) => Promise.resolve(options8?.parser ?? inferParser2(file, options8)),
|
|
388252
|
-
vnopts: {
|
|
388253
|
-
ChoiceSchema,
|
|
388254
|
-
apiDescriptor
|
|
388255
|
-
},
|
|
388256
|
-
fastGlob: import_fast_glob.default,
|
|
388257
|
-
createTwoFilesPatch,
|
|
388258
|
-
picocolors: import_picocolors5.default,
|
|
388259
|
-
closetLevenshteinMatch: closestMatch,
|
|
388260
|
-
utilities: {
|
|
388261
|
-
omit: object_omit_default,
|
|
388262
|
-
createMockable: create_mockable_default
|
|
388263
|
-
}
|
|
388264
|
-
};
|
|
388265
|
-
var debugApis = {
|
|
388266
|
-
parse: withPlugins(parse6),
|
|
388267
|
-
formatAST: withPlugins(formatAst),
|
|
388268
|
-
formatDoc: withPlugins(formatDoc),
|
|
388269
|
-
printToDoc: withPlugins(printToDoc),
|
|
388270
|
-
printDocToString: withPlugins(printDocToString2),
|
|
388271
|
-
// Exposed for tests
|
|
388272
|
-
mockable
|
|
388273
|
-
};
|
|
388274
|
-
|
|
388275
|
-
// src/Format.ts
|
|
388276
|
-
var PRETTIER_CONFIG = {
|
|
388277
|
-
parser: "markdown",
|
|
388278
|
-
printWidth: 80,
|
|
388279
|
-
proseWrap: "always"
|
|
388280
|
-
};
|
|
388281
|
-
var MARKDOWN_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".markdown"]);
|
|
388282
|
-
var formatString = (content) => Effect_exports.tryPromise({
|
|
388283
|
-
try: () => index_exports.format(content, PRETTIER_CONFIG),
|
|
388284
|
-
catch: (e7) => new Error(e7 instanceof Error ? e7.message : String(e7))
|
|
388285
|
-
});
|
|
388286
|
-
var formatFile = (path15) => Effect_exports.gen(function* () {
|
|
388287
|
-
const ext = extname2(path15).toLowerCase();
|
|
388288
|
-
if (!MARKDOWN_EXTENSIONS.has(ext)) {
|
|
388289
|
-
return yield* Effect_exports.fail(
|
|
388290
|
-
new Error(`gtd format: ${path15} is not a markdown file (expected .md or .markdown)`)
|
|
388291
|
-
);
|
|
388292
|
-
}
|
|
388293
|
-
const fs8 = yield* FileSystem_exports.FileSystem;
|
|
388294
|
-
const exists4 = yield* fs8.exists(path15);
|
|
388295
|
-
if (!exists4) {
|
|
388296
|
-
return yield* Effect_exports.fail(new Error(`gtd: skipped formatting ${path15}: not found`));
|
|
388297
|
-
}
|
|
388298
|
-
const content = yield* fs8.readFileString(path15, "utf8");
|
|
388299
|
-
const formatted = yield* formatString(content);
|
|
388300
|
-
if (formatted !== content) {
|
|
388301
|
-
yield* fs8.writeFileString(path15, formatted);
|
|
388302
|
-
}
|
|
388303
|
-
}).pipe(Effect_exports.mapError((e7) => e7 instanceof Error ? e7 : new Error(String(e7))));
|
|
388304
388321
|
|
|
388305
388322
|
// src/Machine.ts
|
|
388306
388323
|
var GtdStateError = class extends Error {
|
|
@@ -388609,10 +388626,15 @@ var MAX_EDGE_HOPS = 100;
|
|
|
388609
388626
|
function makeProgram(opts = {}) {
|
|
388610
388627
|
const argv = opts.argv ?? process.argv;
|
|
388611
388628
|
const write4 = opts.write ?? ((chunk4) => process.stdout.write(chunk4));
|
|
388629
|
+
const json2 = argv.includes("--json");
|
|
388630
|
+
const positional = argv.slice(2).find((a5) => !a5.startsWith("--"));
|
|
388612
388631
|
return Effect_exports.gen(function* () {
|
|
388613
|
-
const sub =
|
|
388632
|
+
const sub = positional;
|
|
388614
388633
|
if (sub === "format") {
|
|
388615
|
-
|
|
388634
|
+
if (json2) {
|
|
388635
|
+
return yield* Effect_exports.fail(new Error("gtd format does not accept --json"));
|
|
388636
|
+
}
|
|
388637
|
+
const args2 = argv.slice(3).filter((a5) => a5.length > 0 && !a5.startsWith("--"));
|
|
388616
388638
|
if (args2.length === 0) {
|
|
388617
388639
|
return yield* Effect_exports.fail(new Error("gtd format: missing file path argument"));
|
|
388618
388640
|
}
|
|
@@ -388655,10 +388677,29 @@ function makeProgram(opts = {}) {
|
|
|
388655
388677
|
if (isEdgeOnly(result.state)) {
|
|
388656
388678
|
continue;
|
|
388657
388679
|
}
|
|
388658
|
-
|
|
388680
|
+
const builtPrompt = buildPrompt(result, config2.resolveModel, json2 ? "json" : "plain");
|
|
388681
|
+
if (json2) {
|
|
388682
|
+
write4(
|
|
388683
|
+
JSON.stringify({
|
|
388684
|
+
state: result.state,
|
|
388685
|
+
autoAdvance: result.autoAdvance,
|
|
388686
|
+
prompt: builtPrompt
|
|
388687
|
+
}) + "\n"
|
|
388688
|
+
);
|
|
388689
|
+
} else {
|
|
388690
|
+
write4(builtPrompt);
|
|
388691
|
+
}
|
|
388659
388692
|
return;
|
|
388660
388693
|
}
|
|
388661
|
-
})
|
|
388694
|
+
}).pipe(
|
|
388695
|
+
json2 ? Effect_exports.catchAll(
|
|
388696
|
+
(error) => Effect_exports.sync(
|
|
388697
|
+
() => write4(
|
|
388698
|
+
JSON.stringify({ state: "error", autoAdvance: false, prompt: error.message }) + "\n"
|
|
388699
|
+
)
|
|
388700
|
+
).pipe(Effect_exports.zipRight(Effect_exports.fail(error)))
|
|
388701
|
+
) : (x8) => x8
|
|
388702
|
+
);
|
|
388662
388703
|
}
|
|
388663
388704
|
|
|
388664
388705
|
// src/main.ts
|