@venturekit/cli 0.0.20 → 0.0.22

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.
@@ -1,9 +1,9 @@
1
1
  /**
2
- * vk review — Prepare an AI-driven branch review inside Windsurf.
2
+ * vk review — Prepare an AI-driven branch review inside the IDE agent.
3
3
  *
4
4
  * The CLI itself does not call any LLM. Its job is to:
5
5
  * 1. Validate that <branch> and <base> exist in the local repo.
6
- * 2. Drop a Windsurf workflow at `.windsurf/workflows/review.md`
6
+ * 2. Drop an agent workflow at `.devin/workflows/review.md`
7
7
  * so the user can run `/review` from the IDE.
8
8
  * 3. Persist the review parameters to `.vk/review/context.json`
9
9
  * so the workflow knows which branch/base to compare without
@@ -15,9 +15,29 @@
15
15
  */
16
16
  import chalk from 'chalk';
17
17
  import { execSync } from 'node:child_process';
18
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
18
+ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
19
19
  import { dirname, join, resolve } from 'node:path';
20
- import { REVIEW_WORKFLOW_MD } from '../templates/review-workflow.js';
20
+ import { REVIEW_WORKFLOW_MARKER, REVIEW_WORKFLOW_MD } from '../templates/review-workflow.js';
21
+ /**
22
+ * Where current IDE builds look for slash-command workflows. Relative
23
+ * to the repo root, POSIX-style segments joined per-platform below.
24
+ */
25
+ const WORKFLOW_PATH_SEGMENTS = ['.devin', 'workflows', 'review.md'];
26
+ /**
27
+ * Pre-rename location. Older `vk review` runs installed here; leaving
28
+ * that file behind would expose a second, stale `/review` command, so
29
+ * we retire it whenever it is recognisably CLI-generated.
30
+ */
31
+ const LEGACY_WORKFLOW_PATH_SEGMENTS = ['.windsurf', 'workflows', 'review.md'];
32
+ /**
33
+ * True when `content` came from this CLI (any template revision). The
34
+ * first heading is deliberately stable across revisions precisely so
35
+ * generated files can be refreshed without prompting, while a
36
+ * hand-authored `review.md` is left alone.
37
+ */
38
+ function isGeneratedWorkflow(content) {
39
+ return content.includes(REVIEW_WORKFLOW_MARKER);
40
+ }
21
41
  /**
22
42
  * Run a git command silently and return stdout (trimmed). Returns
23
43
  * `null` instead of throwing so callers can branch on missing repo /
@@ -62,9 +82,9 @@ function branchExists(name, repoRoot) {
62
82
  export function reviewCommand(program) {
63
83
  program
64
84
  .command('review <branch> [base]')
65
- .description('Prepare an AI review of <branch> vs [base] (default: dev) and install the /review Windsurf workflow')
85
+ .description('Prepare an AI review of <branch> vs [base] (default: dev) and install the /review agent workflow')
66
86
  .option('--no-fetch', 'Skip `git fetch` before validating refs')
67
- .option('--force', 'Overwrite an existing .windsurf/workflows/review.md without prompting')
87
+ .option('--force', 'Overwrite an existing .devin/workflows/review.md without prompting')
68
88
  .action((branch, base, options) => {
69
89
  const cwd = process.cwd();
70
90
  const repoRoot = findRepoRoot(cwd);
@@ -96,32 +116,33 @@ export function reviewCommand(program) {
96
116
  console.error(chalk.dim(` Pass an existing base explicitly: \`vk review ${branch} <base>\`\n`));
97
117
  process.exit(1);
98
118
  }
99
- // Write the workflow. We always overwrite when --force or when
100
- // the existing file looks like one we generated (same header) —
101
- // keeping it in sync is the whole point of shipping it via the
102
- // CLI. If a user has hand-edited it, ask before clobbering.
103
- const workflowDir = join(repoRoot, '.windsurf', 'workflows');
104
- const workflowPath = join(workflowDir, 'review.md');
105
- mkdirSync(workflowDir, { recursive: true });
119
+ // Write the workflow. We overwrite when --force, when the file
120
+ // is absent, or when the existing file is one we generated (even
121
+ // an older template revision) — keeping it in sync is the whole
122
+ // point of shipping it via the CLI. A hand-authored file is only
123
+ // touched with --force.
124
+ const workflowPath = join(repoRoot, ...WORKFLOW_PATH_SEGMENTS);
125
+ mkdirSync(dirname(workflowPath), { recursive: true });
106
126
  let wroteWorkflow = false;
107
127
  if (existsSync(workflowPath) && options.force !== true) {
108
- // Only warn when the existing file diverges from the shipped
109
- // template — identical content is a silent no-op.
110
128
  let current = null;
111
129
  try {
112
130
  current = readFileSync(workflowPath, 'utf-8');
113
131
  }
114
132
  catch {
115
- current = null;
116
- }
117
- if (current === null) {
118
133
  // Couldn't read it; safest to overwrite so the workflow is
119
134
  // guaranteed present.
120
- writeFileSync(workflowPath, REVIEW_WORKFLOW_MD, 'utf-8');
121
- wroteWorkflow = true;
135
+ current = null;
122
136
  }
123
- else if (current !== REVIEW_WORKFLOW_MD) {
124
- console.warn(chalk.yellow(`⚠ ${workflowPath} already exists and was not overwritten.`));
137
+ if (current === null || isGeneratedWorkflow(current)) {
138
+ // Identical content is a silent no-op, not a rewrite.
139
+ if (current !== REVIEW_WORKFLOW_MD) {
140
+ writeFileSync(workflowPath, REVIEW_WORKFLOW_MD, 'utf-8');
141
+ wroteWorkflow = true;
142
+ }
143
+ }
144
+ else {
145
+ console.warn(chalk.yellow(`⚠ ${workflowPath} looks hand-authored and was not overwritten.`));
125
146
  console.warn(chalk.dim(' Re-run with `--force` to refresh it from the CLI template.\n'));
126
147
  }
127
148
  }
@@ -129,6 +150,30 @@ export function reviewCommand(program) {
129
150
  writeFileSync(workflowPath, REVIEW_WORKFLOW_MD, 'utf-8');
130
151
  wroteWorkflow = true;
131
152
  }
153
+ // Retire the pre-rename copy so the IDE only sees one /review.
154
+ const legacyPath = join(repoRoot, ...LEGACY_WORKFLOW_PATH_SEGMENTS);
155
+ let legacyState = null;
156
+ if (existsSync(legacyPath)) {
157
+ let legacy = null;
158
+ try {
159
+ legacy = readFileSync(legacyPath, 'utf-8');
160
+ }
161
+ catch {
162
+ legacy = null;
163
+ }
164
+ if (legacy !== null && isGeneratedWorkflow(legacy)) {
165
+ try {
166
+ rmSync(legacyPath);
167
+ legacyState = 'removed';
168
+ }
169
+ catch {
170
+ legacyState = 'kept';
171
+ }
172
+ }
173
+ else {
174
+ legacyState = 'kept';
175
+ }
176
+ }
132
177
  // Persist context for the workflow to consume.
133
178
  const contextPath = join(repoRoot, '.vk', 'review', 'context.json');
134
179
  mkdirSync(dirname(contextPath), { recursive: true });
@@ -146,11 +191,25 @@ export function reviewCommand(program) {
146
191
  console.log('');
147
192
  console.log(` ${chalk.bold('Workflow:')} ${chalk.dim(workflowPath)} ${wroteWorkflow ? chalk.green('(written)') : chalk.dim('(unchanged)')}`);
148
193
  console.log(` ${chalk.bold('Context:')} ${chalk.dim(contextPath)}`);
194
+ if (legacyState === 'removed') {
195
+ console.log(` ${chalk.bold('Legacy:')} ${chalk.dim(legacyPath)} ${chalk.green('(removed)')}`);
196
+ }
197
+ else if (legacyState === 'kept') {
198
+ console.log(` ${chalk.bold('Legacy:')} ${chalk.dim(legacyPath)} ${chalk.yellow('(still present — delete it to avoid a duplicate /review)')}`);
199
+ }
149
200
  console.log('');
150
201
  console.log(chalk.bold('Next step:'));
151
- console.log(` Open this repo in Windsurf and run ${chalk.cyan('/review')} in Cascade.`);
152
- console.log(chalk.dim(' Cascade will read the context file, diff the branch, propose fixes,'));
202
+ console.log(` Open this repo in your IDE and run ${chalk.cyan('/review')} in the agent panel.`);
203
+ console.log(chalk.dim(' The agent will read the context file, diff the branch, propose fixes,'));
153
204
  console.log(chalk.dim(' apply approved changes, and prepare a commit for you to push.\n'));
154
205
  });
155
206
  }
207
+ /** Test-only — exposes the install paths and the generated-file
208
+ * heuristic so unit tests can pin them without running the action
209
+ * (which shells out to git and writes to disk). */
210
+ export const _internals = {
211
+ WORKFLOW_PATH_SEGMENTS,
212
+ LEGACY_WORKFLOW_PATH_SEGMENTS,
213
+ isGeneratedWorkflow,
214
+ };
156
215
  //# sourceMappingURL=review.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"review.js","sourceRoot":"","sources":["../../src/commands/review.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO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CAAC;aAAM,IAAI,WAAW,KAAK,MAAM,EAAE,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,0DAA0D,CAAC,EAAE,CAAC,CAAC;QACpJ,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,yCAAyC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;QAClG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,0EAA0E,CAAC,CAAC,CAAC;QACnG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;mDAEmD;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,sBAAsB;IACtB,6BAA6B;IAC7B,mBAAmB;CACpB,CAAC"}
@@ -1,12 +1,25 @@
1
1
  /**
2
- * Source-of-truth for the `/review` Windsurf workflow that ships with
2
+ * Source-of-truth for the `/review` agent workflow that ships with
3
3
  * `vk review`. Kept as an inlined string (not a `.md` file) so the
4
4
  * compiled `dist/` package can write it without a separate copy step
5
5
  * in the build pipeline.
6
6
  *
7
- * The workflow is meant to be driven by Cascade inside the IDE after
7
+ * Installed at `.devin/workflows/review.md`, the path current IDE
8
+ * builds read slash-command workflows from. The pre-rename
9
+ * `.windsurf/workflows/` copy is retired by `vk review` itself so a
10
+ * repo never exposes two divergent `/review` commands.
11
+ *
12
+ * The workflow is meant to be driven by the IDE agent after
8
13
  * `vk review <branch> [base]` has prepared `.vk/review/context.json`
9
14
  * with the branch / base / repo metadata.
10
15
  */
11
- export declare const REVIEW_WORKFLOW_MD = "---\ndescription: Review a git branch with AI, fix detected issues, and prepare a commit\n---\n\n# /review \u2014 AI pull-request review\n\nThis workflow reviews a branch against a base, fixes issues you approve,\nand prepares a commit you can push. It is invoked by the user via the\n`vk review` CLI, which writes `.vk/review/context.json` with the\ntarget branch and base before they trigger this slash command.\n\n## 0. Load context\n\nRead `.vk/review/context.json` from the repo root. It contains:\n\n- `branch` \u2014 the branch under review\n- `base` \u2014 the comparison base (default `dev`)\n- `repoRoot` \u2014 absolute path to the repo\n- `generatedAt` \u2014 ISO timestamp\n\nIf the file is missing, ask the user to run `vk review <branch> [base]`\nfirst and stop.\n\n## 1. Snapshot the working tree\n\nBefore checking anything out, verify the working tree is clean:\n\n```\ngit status --porcelain\n```\n\nIf there are uncommitted changes, stop and ask the user to commit or\nstash. Do **not** auto-stash \u2014 the user might be mid-edit.\n\nRecord the current branch so you can restore it at the end:\n\n```\ngit rev-parse --abbrev-ref HEAD\n```\n\n## 2. Fetch and check out the branch\n\n```\ngit fetch --all --prune\ngit checkout <branch>\ngit pull --ff-only\n```\n\nIf `pull --ff-only` fails, stop and surface the divergence \u2014 do not\nforce anything.\n\n## 3. Gather the diff\n\nCompute the merge-base diff so you only see what `<branch>` adds on\ntop of `<base>`:\n\n```\ngit merge-base <base> <branch>\ngit diff <merge-base>...<branch> --stat\ngit diff <merge-base>...<branch>\ngit log <merge-base>..<branch> --oneline\n```\n\nFor each changed file, read the **full current content** (not just\nthe hunk) so you understand context. Use `code_search` for any\nsymbols referenced from outside the diff.\n\n## 4. Run the project's own checks\n\nRun whatever the project ships, in this order, capturing output:\n\n1. **Typecheck** \u2014 e.g. `pnpm -w typecheck`, `pnpm typecheck`,\n `tsc --noEmit`. Pick the one defined in `package.json`.\n2. **Lint** \u2014 e.g. `pnpm lint`, `pnpm -w lint`, `eslint .`.\n3. **Unit tests** \u2014 e.g. `pnpm test`, `pnpm -w test`,\n `vitest run`, `jest`. Skip if the project has none.\n4. **Build** (only if fast and not network-dependent).\n\nIf any of these is unavailable, note it and move on \u2014 don't invent\ncommands.\n\n## 5. Produce the review\n\nWrite a structured review covering, in this order:\n\n1. **Correctness** \u2014 bugs, race conditions, broken edge cases,\n incorrect error handling, missing await, leaked promises.\n2. **Security** \u2014 injection, authz/authn gaps, secrets, unsafe\n deserialization, SSRF, path traversal.\n3. **API / contract changes** \u2014 backwards-incompatible schema, route,\n or config changes; missing migrations; broken consumers.\n4. **Tests** \u2014 coverage gaps for new behaviour, weakened assertions,\n skipped or deleted tests.\n5. **Performance** \u2014 obvious N+1, unbounded loops, large allocations,\n missing indexes.\n6. **Style / maintainability** \u2014 only call out items that materially\n hurt readability or violate the project's conventions. Do not\n nitpick.\n\nFor every issue, include: file path with line range, severity\n(`blocker` / `major` / `minor` / `nit`), what's wrong, and the\nsuggested fix. Cite using the standard `@/abs/path:start-end` format.\n\nSave the review to `.vk/review/<branch>.md` (sanitize slashes in the\nbranch name to `-`). Show a concise summary in chat.\n\n## 6. Apply fixes\n\nGroup issues into a todo list, **blockers and majors first**. For each\nitem:\n\n- Show the proposed change.\n- Apply it via the `edit` / `multi_edit` tool \u2014 never rewrite\n whole files unless the file is new.\n- After each cluster of fixes, re-run typecheck (and lint if it was\n fast). Don't accumulate unverified changes.\n\nDo **not** fix `nit`-level items by default. Ask the user once\nwhether to include them.\n\nIf a fix is risky or the right behaviour is ambiguous, leave the issue\nin the review with a `needs-decision` tag instead of guessing.\n\n## 7. Re-run checks\n\nRepeat step 4 in full. All previously-passing checks must still pass.\nIf anything regressed, revert the offending fix or address it before\nmoving on.\n\n## 8. Prepare the commit\n\nStage only the files **you** modified during step 6 (not unrelated\nworking-tree noise that may have appeared):\n\n```\ngit status --porcelain\ngit add <files>\n```\n\nCompose a commit message of the form:\n\n```\nreview: <short summary of fixes>\n\nAddresses review of <branch> against <base>.\n\n- <blocker/major fix 1>\n- <blocker/major fix 2>\n- ...\n\nReviewed-by: Cascade (vk review)\n```\n\nShow the staged diff (`git diff --cached`) and the proposed message,\nthen **stop and ask the user to confirm** before committing. On\nconfirmation:\n\n```\ngit commit -m \"<message>\"\n```\n\n## 9. Push (only on explicit confirmation)\n\nAfter the commit, ask the user whether to push. If yes:\n\n```\ngit push origin <branch>\n```\n\nNever push without explicit confirmation, even if the user pre-\napproved `git` commands earlier in the session.\n\n## 10. Restore\n\nCheck the original branch back out:\n\n```\ngit checkout <original-branch>\n```\n\nPrint a final summary: number of issues found by severity, fixes\napplied, checks re-run, and the commit SHA (if one was made).\n";
16
+ /**
17
+ * First heading of every generated workflow, and the only part of the
18
+ * template that must stay byte-stable across revisions: `vk review`
19
+ * matches on it to recognise files it wrote earlier (including older
20
+ * template versions) so it can refresh them in place instead of
21
+ * warning about a hand-authored file.
22
+ */
23
+ export declare const REVIEW_WORKFLOW_MARKER = "# /review \u2014 AI pull-request review";
24
+ export declare const REVIEW_WORKFLOW_MD = "---\ndescription: Review a git branch with AI, fix detected issues, and prepare a commit\n---\n\n# /review \u2014 AI pull-request review\n\nThis workflow reviews a branch against a base, fixes issues you approve,\nand prepares a commit you can push. It is invoked by the user via the\n`vk review` CLI, which writes `.vk/review/context.json` with the\ntarget branch and base before they trigger this slash command.\n\n## 0. Load context\n\nRead `.vk/review/context.json` from the repo root. It contains:\n\n- `branch` \u2014 the branch under review\n- `base` \u2014 the comparison base (default `dev`)\n- `repoRoot` \u2014 absolute path to the repo\n- `generatedAt` \u2014 ISO timestamp\n\nIf the file is missing, ask the user to run `vk review <branch> [base]`\nfirst and stop.\n\n## 1. Snapshot the working tree\n\nBefore checking anything out, verify the working tree is clean:\n\n// turbo\n```\ngit status --porcelain\n```\n\nIf there are uncommitted changes, stop and ask the user to commit or\nstash. Do **not** auto-stash \u2014 the user might be mid-edit.\n\nRecord the current branch so you can restore it at the end:\n\n// turbo\n```\ngit rev-parse --abbrev-ref HEAD\n```\n\n## 2. Fetch and check out the branch\n\n```\ngit fetch --all --prune\ngit checkout <branch>\ngit pull --ff-only\n```\n\nIf `pull --ff-only` fails, stop and surface the divergence \u2014 do not\nforce anything.\n\n## 3. Gather the diff\n\nCompute the merge-base diff so you only see what `<branch>` adds on\ntop of `<base>`:\n\n// turbo\n```\ngit merge-base <base> <branch>\ngit diff <merge-base>...<branch> --stat\ngit diff <merge-base>...<branch>\ngit log <merge-base>..<branch> --oneline\n```\n\nFor each changed file, read the **full current content** (not just\nthe hunk) so you understand context. Use `code_search` for any\nsymbols referenced from outside the diff.\n\n## 4. Run the project's own checks\n\nRun whatever the project ships, in this order, capturing output:\n\n1. **Typecheck** \u2014 e.g. `pnpm -w typecheck`, `pnpm typecheck`,\n `tsc --noEmit`. Pick the one defined in `package.json`.\n2. **Lint** \u2014 e.g. `pnpm lint`, `pnpm -w lint`, `eslint .`.\n3. **Unit tests** \u2014 e.g. `pnpm test`, `pnpm -w test`,\n `vitest run`, `jest`. Skip if the project has none.\n4. **Build** (only if fast and not network-dependent).\n\nIf any of these is unavailable, note it and move on \u2014 don't invent\ncommands.\n\n## 5. Produce the review\n\nWrite a structured review covering, in this order:\n\n1. **Correctness** \u2014 bugs, race conditions, broken edge cases,\n incorrect error handling, missing await, leaked promises.\n2. **Security** \u2014 injection, authz/authn gaps, secrets, unsafe\n deserialization, SSRF, path traversal.\n3. **API / contract changes** \u2014 backwards-incompatible schema, route,\n or config changes; missing migrations; broken consumers.\n4. **Tests** \u2014 coverage gaps for new behaviour, weakened assertions,\n skipped or deleted tests.\n5. **Performance** \u2014 obvious N+1, unbounded loops, large allocations,\n missing indexes.\n6. **Style / maintainability** \u2014 only call out items that materially\n hurt readability or violate the project's conventions. Do not\n nitpick.\n\nFor every issue, include: file path with line range, severity\n(`blocker` / `major` / `minor` / `nit`), what's wrong, and the\nsuggested fix. Cite using the standard `@/abs/path:start-end` format.\n\nSave the review to `.vk/review/<branch>.md` (sanitize slashes in the\nbranch name to `-`). Show a concise summary in chat.\n\n## 6. Apply fixes\n\nGroup issues into a plan / todo list, **blockers and majors first**.\nFor each item:\n\n- Show the proposed change.\n- Apply it via the `edit` / `multi_edit` tool \u2014 never rewrite\n whole files unless the file is new.\n- After each cluster of fixes, re-run typecheck (and lint if it was\n fast). Don't accumulate unverified changes.\n\nDo **not** fix `nit`-level items by default. Ask the user once\nwhether to include them.\n\nIf a fix is risky or the right behaviour is ambiguous, leave the issue\nin the review with a `needs-decision` tag instead of guessing.\n\n## 7. Re-run checks\n\nRepeat step 4 in full. All previously-passing checks must still pass.\nIf anything regressed, revert the offending fix or address it before\nmoving on.\n\n## 8. Prepare the commit\n\nStage only the files **you** modified during step 6 (not unrelated\nworking-tree noise that may have appeared):\n\n```\ngit status --porcelain\ngit add <files>\n```\n\nCompose a commit message of the form:\n\n```\nreview: <short summary of fixes>\n\nAddresses review of <branch> against <base>.\n\n- <blocker/major fix 1>\n- <blocker/major fix 2>\n- ...\n\nReviewed-by: vk review (AI-assisted)\n```\n\nShow the staged diff (`git diff --cached`) and the proposed message,\nthen **stop and ask the user to confirm** before committing. On\nconfirmation:\n\n```\ngit commit -m \"<message>\"\n```\n\n## 9. Push (only on explicit confirmation)\n\nAfter the commit, ask the user whether to push. If yes:\n\n```\ngit push origin <branch>\n```\n\nNever push without explicit confirmation, even if the user pre-\napproved `git` commands earlier in the session.\n\n## 10. Restore\n\nCheck the original branch back out:\n\n```\ngit checkout <original-branch>\n```\n\nPrint a final summary: number of issues found by severity, fixes\napplied, checks re-run, and the commit SHA (if one was made).\n";
12
25
  //# sourceMappingURL=review-workflow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"review-workflow.d.ts","sourceRoot":"","sources":["../../src/templates/review-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,qyKAsL9B,CAAC"}
1
+ {"version":3,"file":"review-workflow.d.ts","sourceRoot":"","sources":["../../src/templates/review-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,4CAAuC,CAAC;AAE3E,eAAO,MAAM,kBAAkB,80KAyL9B,CAAC"}
@@ -1,13 +1,26 @@
1
1
  /**
2
- * Source-of-truth for the `/review` Windsurf workflow that ships with
2
+ * Source-of-truth for the `/review` agent workflow that ships with
3
3
  * `vk review`. Kept as an inlined string (not a `.md` file) so the
4
4
  * compiled `dist/` package can write it without a separate copy step
5
5
  * in the build pipeline.
6
6
  *
7
- * The workflow is meant to be driven by Cascade inside the IDE after
7
+ * Installed at `.devin/workflows/review.md`, the path current IDE
8
+ * builds read slash-command workflows from. The pre-rename
9
+ * `.windsurf/workflows/` copy is retired by `vk review` itself so a
10
+ * repo never exposes two divergent `/review` commands.
11
+ *
12
+ * The workflow is meant to be driven by the IDE agent after
8
13
  * `vk review <branch> [base]` has prepared `.vk/review/context.json`
9
14
  * with the branch / base / repo metadata.
10
15
  */
16
+ /**
17
+ * First heading of every generated workflow, and the only part of the
18
+ * template that must stay byte-stable across revisions: `vk review`
19
+ * matches on it to recognise files it wrote earlier (including older
20
+ * template versions) so it can refresh them in place instead of
21
+ * warning about a hand-authored file.
22
+ */
23
+ export const REVIEW_WORKFLOW_MARKER = '# /review — AI pull-request review';
11
24
  export const REVIEW_WORKFLOW_MD = `---
12
25
  description: Review a git branch with AI, fix detected issues, and prepare a commit
13
26
  ---
@@ -35,6 +48,7 @@ first and stop.
35
48
 
36
49
  Before checking anything out, verify the working tree is clean:
37
50
 
51
+ // turbo
38
52
  \`\`\`
39
53
  git status --porcelain
40
54
  \`\`\`
@@ -44,6 +58,7 @@ stash. Do **not** auto-stash — the user might be mid-edit.
44
58
 
45
59
  Record the current branch so you can restore it at the end:
46
60
 
61
+ // turbo
47
62
  \`\`\`
48
63
  git rev-parse --abbrev-ref HEAD
49
64
  \`\`\`
@@ -64,6 +79,7 @@ force anything.
64
79
  Compute the merge-base diff so you only see what \`<branch>\` adds on
65
80
  top of \`<base>\`:
66
81
 
82
+ // turbo
67
83
  \`\`\`
68
84
  git merge-base <base> <branch>
69
85
  git diff <merge-base>...<branch> --stat
@@ -116,8 +132,8 @@ branch name to \`-\`). Show a concise summary in chat.
116
132
 
117
133
  ## 6. Apply fixes
118
134
 
119
- Group issues into a todo list, **blockers and majors first**. For each
120
- item:
135
+ Group issues into a plan / todo list, **blockers and majors first**.
136
+ For each item:
121
137
 
122
138
  - Show the proposed change.
123
139
  - Apply it via the \`edit\` / \`multi_edit\` tool — never rewrite
@@ -158,7 +174,7 @@ Addresses review of <branch> against <base>.
158
174
  - <blocker/major fix 2>
159
175
  - ...
160
176
 
161
- Reviewed-by: Cascade (vk review)
177
+ Reviewed-by: vk review (AI-assisted)
162
178
  \`\`\`
163
179
 
164
180
  Show the staged diff (\`git diff --cached\`) and the proposed message,
@@ -1 +1 @@
1
- {"version":3,"file":"review-workflow.js","sourceRoot":"","sources":["../../src/templates/review-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsLjC,CAAC"}
1
+ {"version":3,"file":"review-workflow.js","sourceRoot":"","sources":["../../src/templates/review-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,oCAAoC,CAAC;AAE3E,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyLjC,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * File contents emitted by `vk generate e2e`.
3
+ *
4
+ * Kept pure (options in, file contents out) so the generated wiring can be
5
+ * asserted in unit tests. The previous version of this scaffold hand-rolled
6
+ * the Playwright `webServer` block and shipped two silent failures to every
7
+ * new project:
8
+ *
9
+ * - it never created the database, so a cold machine died on the first
10
+ * migration with `database "…" does not exist`; and
11
+ * - it left cron schedules running against the database under assertion.
12
+ *
13
+ * Both now live in `vkWebServers()` from `@venturekit/testing/playwright`,
14
+ * so the generated config is a handful of declarative lines and the ordering
15
+ * rules are enforced by a unit-tested library rather than by a comment.
16
+ *
17
+ * File bodies are built as line arrays, not template literals: the generated
18
+ * code itself contains `${...}` and backticks, which a template literal here
19
+ * would interpolate.
20
+ */
21
+ export interface E2eScaffoldOptions {
22
+ /**
23
+ * Declared database name — `infrastructure.databases[].name` (or its `id`)
24
+ * from `vk.config.ts`. Omitted for projects with no database intent, which
25
+ * then get no creation or migration step.
26
+ */
27
+ database?: string;
28
+ /** True when the project declares an `auth` intent. Drives the role setup. */
29
+ hasAuth?: boolean;
30
+ /** Stage the suite runs against. Defaults to `test`. */
31
+ stage?: string;
32
+ /** Default port for the test API. Overridable at runtime via `E2E_API_PORT`. */
33
+ apiPort?: number;
34
+ /**
35
+ * Workspace filter for the package holding `vk.config.ts`, e.g. `@acme/api`.
36
+ * Omit for a single-package project, which runs the CLI in place.
37
+ */
38
+ apiFilter?: string;
39
+ /** Role keys to establish. Defaults to a single `admin`. */
40
+ roles?: string[];
41
+ }
42
+ export interface ScaffoldFile {
43
+ /** Path relative to the project root. */
44
+ relPath: string;
45
+ content: string;
46
+ }
47
+ export declare function playwrightConfigFile(options?: E2eScaffoldOptions): string;
48
+ export declare function globalSetupFile(): string;
49
+ export declare function rolesSetupFile(options?: E2eScaffoldOptions): string;
50
+ export declare function smokeSpecFile(options?: E2eScaffoldOptions): string;
51
+ /** Every file the scaffold writes, in the order it writes them. */
52
+ export declare function e2eScaffoldFiles(options?: E2eScaffoldOptions): ScaffoldFile[];
53
+ /**
54
+ * devDependencies the scaffold needs. `pg` only appears when there is a
55
+ * database to create — it is what `ensureStageDatabase` issues the DDL with.
56
+ */
57
+ export declare function e2eDevDependencies(options?: E2eScaffoldOptions): Record<string, string>;
58
+ //# sourceMappingURL=e2e-scaffold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e2e-scaffold.d.ts","sourceRoot":"","sources":["../../src/utils/e2e-scaffold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAiCD,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,kBAAuB,GAAG,MAAM,CAsF7E;AAED,wBAAgB,eAAe,IAAI,MAAM,CAYxC;AAED,wBAAgB,cAAc,CAAC,OAAO,GAAE,kBAAuB,GAAG,MAAM,CA6BvE;AAED,wBAAgB,aAAa,CAAC,OAAO,GAAE,kBAAuB,GAAG,MAAM,CAuBtE;AAED,mEAAmE;AACnE,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,kBAAuB,GAAG,YAAY,EAAE,CAiBjF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,kBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAW3F"}
@@ -0,0 +1,164 @@
1
+ /**
2
+ * File contents emitted by `vk generate e2e`.
3
+ *
4
+ * Kept pure (options in, file contents out) so the generated wiring can be
5
+ * asserted in unit tests. The previous version of this scaffold hand-rolled
6
+ * the Playwright `webServer` block and shipped two silent failures to every
7
+ * new project:
8
+ *
9
+ * - it never created the database, so a cold machine died on the first
10
+ * migration with `database "…" does not exist`; and
11
+ * - it left cron schedules running against the database under assertion.
12
+ *
13
+ * Both now live in `vkWebServers()` from `@venturekit/testing/playwright`,
14
+ * so the generated config is a handful of declarative lines and the ordering
15
+ * rules are enforced by a unit-tested library rather than by a comment.
16
+ *
17
+ * File bodies are built as line arrays, not template literals: the generated
18
+ * code itself contains `${...}` and backticks, which a template literal here
19
+ * would interpolate.
20
+ */
21
+ const DEFAULT_STAGE = 'test';
22
+ const DEFAULT_PORT = 4001;
23
+ function resolve(options) {
24
+ return {
25
+ database: options.database,
26
+ hasAuth: options.hasAuth === true,
27
+ stage: options.stage ?? DEFAULT_STAGE,
28
+ apiPort: options.apiPort ?? DEFAULT_PORT,
29
+ apiFilter: options.apiFilter,
30
+ roles: options.roles && options.roles.length > 0 ? options.roles : ['admin'],
31
+ };
32
+ }
33
+ /** Shared preamble: the stage/port constants every generated file uses. */
34
+ function portLines(apiPort) {
35
+ return [
36
+ `const API_PORT = Number(process.env.E2E_API_PORT ?? ${apiPort});`,
37
+ 'const API_URL = `http://127.0.0.1:${API_PORT}`;',
38
+ ];
39
+ }
40
+ export function playwrightConfigFile(options = {}) {
41
+ const o = resolve(options);
42
+ const imports = o.hasAuth
43
+ ? "import { vkWebServers, storageStatePath } from '@venturekit/testing/playwright';"
44
+ : "import { vkWebServers } from '@venturekit/testing/playwright';";
45
+ const lines = [
46
+ "import { defineConfig } from '@playwright/test';",
47
+ imports,
48
+ '',
49
+ '// An isolated stage and port, so E2E never touches your `vk dev` data.',
50
+ `const STAGE = '${o.stage}';`,
51
+ ...portLines(o.apiPort),
52
+ '',
53
+ 'export default defineConfig({',
54
+ " testDir: './e2e',",
55
+ ];
56
+ if (o.hasAuth) {
57
+ lines.push(" globalSetup: './e2e/global-setup.ts',");
58
+ }
59
+ lines.push(' timeout: 30_000,', ' fullyParallel: true,', ' forbidOnly: !!process.env.CI,', ' retries: process.env.CI ? 2 : 0,', " reporter: process.env.CI ? [['github'], ['html', { open: 'never' }]] : 'list',", ' use: {', ' baseURL: API_URL,', " trace: 'on-first-retry',", ' },');
60
+ if (o.hasAuth) {
61
+ lines.push(' projects: [', ' // Logs every role in once and saves its cookie jar.', ' { name: \'setup\', testMatch: /.*\\.setup\\.ts/ },', ' {', " name: 'api',", " dependencies: ['setup'],", ' // Without this the setup file matches here too and runs twice.', ' testIgnore: /.*\\.setup\\.ts/,', ' use: {', ' baseURL: API_URL,', ` storageState: storageStatePath('${o.roles[0]}'),`, ' },', ' },', ' ],');
62
+ }
63
+ lines.push(' // Builds the whole server chain in the one order that works:', o.database
64
+ ? ' // create the stage database, migrate + seed it, then boot `vk dev`'
65
+ : ' // boot `vk dev` (this project declares no database to migrate)', ' // with crons off. See @venturekit/testing/playwright for why each of', ' // those matters — every one of them fails far from its cause.', ' webServer: vkWebServers({', ' stage: STAGE,');
66
+ if (o.database) {
67
+ lines.push(' // From vk.config.ts. `vk dev` derives <database>_<stage> itself and', ' // ignores DATABASE_URL, so the harness must agree with it.', ` database: '${o.database}',`);
68
+ }
69
+ lines.push(o.apiFilter
70
+ ? ` api: { filter: '${o.apiFilter}', port: API_PORT },`
71
+ : " api: { cwd: '.', port: API_PORT },", ' // Add your UI here for browser specs, then point `use.baseURL` at it:', ' //', " // web: { name: 'Admin', command: 'pnpm --filter @acme/admin exec next dev -p 3100',", " // url: 'http://127.0.0.1:3100' },", ' }),', '});', '');
72
+ return lines.join('\n');
73
+ }
74
+ export function globalSetupFile() {
75
+ return [
76
+ "import { wipeAuthDir } from '@venturekit/testing/playwright';",
77
+ '',
78
+ '// Storage state left over from a previous run points at users the',
79
+ '// freshly created database no longer has. The resulting 401s look like',
80
+ '// an auth bug, so clear the directory before anything runs.',
81
+ 'export default async function globalSetup() {',
82
+ ' await wipeAuthDir();',
83
+ '}',
84
+ '',
85
+ ].join('\n');
86
+ }
87
+ export function rolesSetupFile(options = {}) {
88
+ const o = resolve(options);
89
+ const roleLines = o.roles.map((role) => ` ${role}: { email: '${role}@example.com', password: 'Passw0rd!' },`);
90
+ return [
91
+ "import { test as setup } from '@playwright/test';",
92
+ "import { establishRoles } from '@venturekit/testing/playwright';",
93
+ '',
94
+ ...portLines(o.apiPort),
95
+ '',
96
+ '// Runs once, before the suites that depend on it. Creates each',
97
+ '// cognito-local user, logs it in, and writes .auth/<role>.json — specs',
98
+ '// then adopt a role through `storageState` instead of logging in.',
99
+ "setup('establish roles', async () => {",
100
+ ' await establishRoles({',
101
+ ' baseUrl: API_URL,',
102
+ ' roles: {',
103
+ ...roleLines,
104
+ ' },',
105
+ ' // Add cognito attributes a role needs, e.g.:',
106
+ " // admin: { email: '…', password: '…', attributes: { tenantId: 'dev' } },",
107
+ ' });',
108
+ '});',
109
+ '',
110
+ ].join('\n');
111
+ }
112
+ export function smokeSpecFile(options = {}) {
113
+ const o = resolve(options);
114
+ return [
115
+ "import { test, expect } from '@playwright/test';",
116
+ '',
117
+ ...portLines(o.apiPort),
118
+ '',
119
+ "test('the API dev server is up', async ({ request }) => {",
120
+ ' const res = await request.get(`${API_URL}/_dev/health`);',
121
+ ' expect(res.ok()).toBeTruthy();',
122
+ ' const body = await res.json();',
123
+ " expect(body.vk).toBe('dev-server');",
124
+ '});',
125
+ '',
126
+ '// Replace with a real route from your API. The `request` fixture needs',
127
+ '// no browser, so this runs without `playwright install`.',
128
+ "test.skip('GET /health returns ok', async ({ request }) => {",
129
+ ' const res = await request.get(`${API_URL}/health`);',
130
+ ' expect(res.ok()).toBeTruthy();',
131
+ '});',
132
+ '',
133
+ ].join('\n');
134
+ }
135
+ /** Every file the scaffold writes, in the order it writes them. */
136
+ export function e2eScaffoldFiles(options = {}) {
137
+ const o = resolve(options);
138
+ const files = [
139
+ { relPath: 'playwright.config.ts', content: playwrightConfigFile(options) },
140
+ { relPath: 'e2e/health.spec.ts', content: smokeSpecFile(options) },
141
+ ];
142
+ // Role plumbing only makes sense when the project actually declares auth.
143
+ if (o.hasAuth) {
144
+ files.push({ relPath: 'e2e/global-setup.ts', content: globalSetupFile() }, { relPath: 'e2e/roles.setup.ts', content: rolesSetupFile(options) });
145
+ }
146
+ return files;
147
+ }
148
+ /**
149
+ * devDependencies the scaffold needs. `pg` only appears when there is a
150
+ * database to create — it is what `ensureStageDatabase` issues the DDL with.
151
+ */
152
+ export function e2eDevDependencies(options = {}) {
153
+ const o = resolve(options);
154
+ const deps = {
155
+ '@playwright/test': '^1.49.0',
156
+ '@venturekit/testing': 'latest',
157
+ };
158
+ if (o.database) {
159
+ deps['pg'] = '^8.13.1';
160
+ deps['@types/pg'] = '^8.11.10';
161
+ }
162
+ return deps;
163
+ }
164
+ //# sourceMappingURL=e2e-scaffold.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e2e-scaffold.js","sourceRoot":"","sources":["../../src/utils/e2e-scaffold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA8BH,MAAM,aAAa,GAAG,MAAM,CAAC;AAC7B,MAAM,YAAY,GAAG,IAAI,CAAC;AAW1B,SAAS,OAAO,CAAC,OAA2B;IAC1C,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,IAAI;QACjC,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,aAAa;QACrC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,YAAY;QACxC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,C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G;AACH,MAAM,UAAU,kBAAkB,CAAC,UAA8B,EAAE;IACjE,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3B,MAAM,IAAI,GAA2B;QACnC,kBAAkB,EAAE,SAAS;QAC7B,qBAAqB,EAAE,QAAQ;KAChC,CAAC;IACF,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;QACf,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,WAAW,CAAC,GAAG,UAAU,CAAC;IACjC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -4,20 +4,34 @@
4
4
  * Runs cron handlers on a schedule during local development.
5
5
  * Reads schedule expressions from handler file exports or defaults to every 60s.
6
6
  *
7
- * Supported schedule formats:
8
- * - 'rate(5 minutes)' — AWS EventBridge rate expression
9
- * - '* * * * *' — standard cron expression (minute-level)
10
- * - Default: runs every 60 seconds if no schedule is exported
7
+ * Supported schedule formats (all of which a `ScheduleIntent.schedule`
8
+ * can produce):
9
+ * - `{ rate: '5 minutes' }` / 'rate(5 minutes)' — EventBridge rate expression
10
+ * - `{ cron: '0 3 * * ? *' }` — EventBridge 6-field cron (with the `?`
11
+ * day-of-week/day-of-month wildcard and trailing year)
12
+ * - '* * * * *' — standard 5-field cron
13
+ * - Default: runs every 60 seconds when the caller passes no schedule
11
14
  */
12
15
  interface CronDef {
13
16
  name: string;
14
17
  handlerFile: string;
15
18
  }
19
+ /**
20
+ * A schedule as declared on `ScheduleIntent.schedule`, or the raw string
21
+ * form. Accepting the intent shape directly means callers hand over what
22
+ * `vk.config.ts` already declares instead of stringifying it into a
23
+ * `rate(…)` expression only for this module to parse it back out.
24
+ */
25
+ export type CronScheduleExpr = {
26
+ rate: string;
27
+ } | {
28
+ cron: string;
29
+ } | string;
16
30
  /**
17
31
  * Create a local cron scheduler.
18
32
  */
19
33
  export declare function createLocalCronScheduler(): {
20
- registerCrons: (cronDefs: CronDef[], schedules?: Record<string, string>) => void;
34
+ registerCrons: (cronDefs: CronDef[], schedules?: Record<string, CronScheduleExpr | false>) => void;
21
35
  setHandlerLoader: (loader: (file: string) => Promise<Function | null>) => void;
22
36
  start: (projectName: string, stage: string) => void;
23
37
  stop: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"local-cron.d.ts","sourceRoot":"","sources":["../../src/utils/local-cron.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,UAAU,OAAO;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAsED;;GAEG;AACH,wBAAgB,wBAAwB;8BAWL,OAAO,EAAE,cAAc,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAG,IAAI;+BAgCnD,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAG,IAAI;yBAiFvD,MAAM,SAAS,MAAM,KAAG,IAAI;gBA6BvC,IAAI;6BAWS,IAAI;;;;;;;EAwBnC;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
1
+ {"version":3,"file":"local-cron.d.ts","sourceRoot":"","sources":["../../src/utils/local-cron.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,UAAU,OAAO;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC;AA8F5E;;GAEG;AACH,wBAAgB,wBAAwB;8BAY1B,OAAO,EAAE,cACP,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,KAAK,CAAC,KACnD,IAAI;+BA4B2B,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAG,IAAI;yBAiFvD,MAAM,SAAS,MAAM,KAAG,IAAI;gBA6BvC,IAAI;6BAWS,IAAI;;;;;;;EAwBnC;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC"}