@visulima/vis 1.0.0-alpha.10 → 1.0.0-alpha.11

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.
Files changed (120) hide show
  1. package/CHANGELOG.md +95 -42
  2. package/LICENSE.md +213 -0
  3. package/README.md +8 -4
  4. package/dist/bin.js +9 -1
  5. package/dist/config/index.d.ts +1818 -0
  6. package/dist/config/index.js +2 -0
  7. package/dist/generate/index.d.ts +1 -1
  8. package/dist/generate/index.js +3 -1
  9. package/dist/packem_chunks/applyDefaults.js +336 -0
  10. package/dist/packem_chunks/bin.js +9554 -64
  11. package/dist/packem_chunks/doctor-probe.js +112 -0
  12. package/dist/packem_chunks/fix.js +229 -48
  13. package/dist/packem_chunks/handler.js +99 -1
  14. package/dist/packem_chunks/handler10.js +53 -1
  15. package/dist/packem_chunks/handler11.js +32 -1
  16. package/dist/packem_chunks/handler12.js +100 -2
  17. package/dist/packem_chunks/handler13.js +25 -1
  18. package/dist/packem_chunks/handler14.js +916 -5
  19. package/dist/packem_chunks/handler15.js +206 -1
  20. package/dist/packem_chunks/handler16.js +122 -18
  21. package/dist/packem_chunks/handler17.js +13 -1
  22. package/dist/packem_chunks/handler18.js +106 -1
  23. package/dist/packem_chunks/handler19.js +19 -1
  24. package/dist/packem_chunks/handler2.js +75 -1
  25. package/dist/packem_chunks/handler20.js +29 -1
  26. package/dist/packem_chunks/handler21.js +222 -1
  27. package/dist/packem_chunks/handler22.js +237 -5
  28. package/dist/packem_chunks/handler23.js +101 -1
  29. package/dist/packem_chunks/handler24.js +110 -1
  30. package/dist/packem_chunks/handler25.js +402 -5
  31. package/dist/packem_chunks/handler26.js +13 -1
  32. package/dist/packem_chunks/handler27.js +63 -3
  33. package/dist/packem_chunks/handler28.js +34 -1
  34. package/dist/packem_chunks/handler29.js +458 -7
  35. package/dist/packem_chunks/handler3.js +95 -2
  36. package/dist/packem_chunks/handler30.js +168 -21
  37. package/dist/packem_chunks/handler31.js +530 -3
  38. package/dist/packem_chunks/handler32.js +214 -2
  39. package/dist/packem_chunks/handler33.js +119 -24
  40. package/dist/packem_chunks/handler34.js +630 -2
  41. package/dist/packem_chunks/handler35.js +283 -19
  42. package/dist/packem_chunks/handler36.js +521 -407
  43. package/dist/packem_chunks/handler37.js +762 -22
  44. package/dist/packem_chunks/handler38.js +989 -22
  45. package/dist/packem_chunks/handler39.js +574 -22
  46. package/dist/packem_chunks/handler4.js +90 -4
  47. package/dist/packem_chunks/handler40.js +1685 -3
  48. package/dist/packem_chunks/handler41.js +1088 -10
  49. package/dist/packem_chunks/handler42.js +785 -141
  50. package/dist/packem_chunks/handler43.js +2658 -42
  51. package/dist/packem_chunks/handler44.js +3886 -3
  52. package/dist/packem_chunks/handler45.js +2568 -21
  53. package/dist/packem_chunks/handler46.js +3769 -0
  54. package/dist/packem_chunks/handler47.js +1491 -0
  55. package/dist/packem_chunks/handler5.js +174 -2
  56. package/dist/packem_chunks/handler6.js +95 -13
  57. package/dist/packem_chunks/handler7.js +115 -8
  58. package/dist/packem_chunks/handler8.js +12 -1
  59. package/dist/packem_chunks/handler9.js +29 -1
  60. package/dist/packem_chunks/heal-accept.js +522 -0
  61. package/dist/packem_chunks/heal.js +673 -0
  62. package/dist/packem_chunks/index.js +873 -7
  63. package/dist/packem_chunks/loader.js +23 -1
  64. package/dist/packem_shared/VisUpdateApp-D-Yz_wvg.js +1316 -0
  65. package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +5 -0
  66. package/dist/packem_shared/ai-analysis-CHeB1joD.js +367 -0
  67. package/dist/packem_shared/ai-cache-Be_jexe4.js +142 -0
  68. package/dist/packem_shared/ai-fix-B9iQVcD2.js +379 -0
  69. package/dist/packem_shared/cache-directory-2qvs4goY.js +98 -0
  70. package/dist/packem_shared/catalog-BJTtyi-O.js +1371 -0
  71. package/dist/packem_shared/dependency-scan-A0KSklpG.js +188 -0
  72. package/dist/packem_shared/docker-2iZzc280.js +181 -0
  73. package/dist/packem_shared/failure-log-Cz3Z4SKL.js +100 -0
  74. package/dist/packem_shared/flakiness-goTxXuCX.js +180 -0
  75. package/dist/packem_shared/otel-DCvqCTz_.js +158 -0
  76. package/dist/packem_shared/otelPlugin-DFaLDvJf.js +3 -0
  77. package/dist/packem_shared/registry-CbqXI0rc.js +272 -0
  78. package/dist/packem_shared/run-summary-utils-PVMl4aIh.js +130 -0
  79. package/dist/packem_shared/runtime-check-Cobi3p6l.js +127 -0
  80. package/dist/packem_shared/selectors-SM69TfqC.js +194 -0
  81. package/dist/packem_shared/symbols-Ta7g2nU-.js +14 -0
  82. package/dist/packem_shared/toolchain-BdZd9eBi.js +975 -0
  83. package/dist/packem_shared/typosquats-C-bCh3PX.js +1210 -0
  84. package/dist/packem_shared/use-measured-height-CNP0vT4M.js +20 -0
  85. package/dist/packem_shared/utils-CthVdBPS.js +40 -0
  86. package/dist/packem_shared/xxh3-Ck8mXNg1.js +239 -0
  87. package/index.js +727 -555
  88. package/package.json +35 -17
  89. package/schemas/project.schema.json +8 -10
  90. package/schemas/vis-config.schema.json +132 -8
  91. package/skills/vis/SKILL.md +96 -0
  92. package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
  93. package/templates/buildkite-ci/template.yml +20 -0
  94. package/dist/errors/index.d.ts +0 -26
  95. package/dist/errors/index.js +0 -1
  96. package/dist/packem_chunks/config.js +0 -2
  97. package/dist/packem_shared/VisConfigCycleError-CAYNC7d-.js +0 -1
  98. package/dist/packem_shared/VisConfigError-B5LP1zRf.js +0 -1
  99. package/dist/packem_shared/VisConfigLoadError-CeqBSd2Z.js +0 -2
  100. package/dist/packem_shared/VisConfigNotFoundError-DZ9KC527.js +0 -5
  101. package/dist/packem_shared/VisUpdateApp-D-L4_-Iu.js +0 -1
  102. package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +0 -1
  103. package/dist/packem_shared/ai-analysis-CGuy7dfE.js +0 -67
  104. package/dist/packem_shared/ai-cache-Bynt6Y9x.js +0 -1
  105. package/dist/packem_shared/cache-directory-D72ZEag2.js +0 -1
  106. package/dist/packem_shared/catalog-BVPerCwG.js +0 -12
  107. package/dist/packem_shared/dependency-scan-Du0tBu64.js +0 -2
  108. package/dist/packem_shared/docker-BcfqH4Av.js +0 -2
  109. package/dist/packem_shared/failure-log-DqYen0LC.js +0 -2
  110. package/dist/packem_shared/flakiness-DSIHZGBT.js +0 -1
  111. package/dist/packem_shared/run-summary-utils-C24Aaf9E.js +0 -1
  112. package/dist/packem_shared/runtime-check-CGHal8SO.js +0 -1
  113. package/dist/packem_shared/selectors-CfH9ZY08.js +0 -3
  114. package/dist/packem_shared/symbols-CQmER5MT.js +0 -1
  115. package/dist/packem_shared/target-merge-DNa-6eWu.js +0 -1
  116. package/dist/packem_shared/toolchain-DQfTQY8E.js +0 -5
  117. package/dist/packem_shared/typosquats-DOR8izpX.js +0 -1
  118. package/dist/packem_shared/use-measured-height-DjYgUOKk.js +0 -1
  119. package/dist/packem_shared/utils-DrNg0XTR.js +0 -1
  120. package/dist/packem_shared/xxh3-DrAUNq4n.js +0 -1
@@ -0,0 +1,112 @@
1
+ import { green, red, bold, dim, cyan, yellow } from '@visulima/colorize';
2
+ import { ReapiRemoteCache } from '@visulima/task-runner';
3
+ import { p as pail } from './bin.js';
4
+
5
+ const inferBackend = (url, override) => {
6
+ if (override === "http" || override === "reapi") {
7
+ return override;
8
+ }
9
+ if (url.startsWith("grpc://") || url.startsWith("grpcs://")) {
10
+ return "reapi";
11
+ }
12
+ return "http";
13
+ };
14
+ const probeHttp = async (url, timeoutMs) => {
15
+ const startedAt = Date.now();
16
+ const controller = new AbortController();
17
+ const timer = setTimeout(() => {
18
+ controller.abort();
19
+ }, timeoutMs);
20
+ try {
21
+ const response = await fetch(url, { method: "HEAD", signal: controller.signal });
22
+ return {
23
+ backend: "http",
24
+ durationMs: Date.now() - startedAt,
25
+ httpStatus: response.status,
26
+ ok: true,
27
+ url
28
+ };
29
+ } catch (error) {
30
+ return {
31
+ backend: "http",
32
+ durationMs: Date.now() - startedAt,
33
+ error: error instanceof Error ? error.message : String(error),
34
+ ok: false,
35
+ url
36
+ };
37
+ } finally {
38
+ clearTimeout(timer);
39
+ }
40
+ };
41
+ const probeReapi = async (options, timeoutMs) => {
42
+ const startedAt = Date.now();
43
+ const cache = new ReapiRemoteCache({ ...options, timeout: timeoutMs });
44
+ try {
45
+ const capabilities = await cache.probeCapabilities();
46
+ return {
47
+ backend: "reapi",
48
+ capabilities,
49
+ durationMs: Date.now() - startedAt,
50
+ ok: true,
51
+ url: options.url
52
+ };
53
+ } catch (error) {
54
+ return {
55
+ backend: "reapi",
56
+ durationMs: Date.now() - startedAt,
57
+ error: error instanceof Error ? error.message : String(error),
58
+ ok: false,
59
+ url: options.url
60
+ };
61
+ } finally {
62
+ try {
63
+ await cache.close();
64
+ } catch {
65
+ }
66
+ }
67
+ };
68
+ const formatTable = (result) => {
69
+ const lines = [];
70
+ const status = result.ok ? green("OK") : red("FAIL");
71
+ lines.push(`${bold("Remote cache")} ${status}`);
72
+ lines.push(` ${dim("URL:")} ${cyan(result.url)}`);
73
+ lines.push(` ${dim("Backend:")} ${result.backend}`);
74
+ lines.push(` ${dim("Latency:")} ${String(result.durationMs)}ms`);
75
+ if (result.httpStatus !== void 0) {
76
+ lines.push(` ${dim("Status:")} ${String(result.httpStatus)}`);
77
+ }
78
+ if (result.capabilities) {
79
+ const digestFunctions = result.capabilities.digestFunctions.length > 0 ? result.capabilities.digestFunctions.join(", ") : yellow("(none advertised)");
80
+ lines.push(` ${dim("Digests:")} ${digestFunctions}`);
81
+ lines.push(` ${dim("Batch:")} ${String(result.capabilities.maxBatchTotalSizeBytes)} bytes`);
82
+ }
83
+ if (result.error) {
84
+ lines.push(` ${dim("Error:")} ${red(result.error)}`);
85
+ }
86
+ return lines.join("\n");
87
+ };
88
+ const cacheDoctorExecute = async ({ logger, options, visConfig }) => {
89
+ const cfg = visConfig ?? {};
90
+ const configRemoteCache = cfg.taskRunnerOptions?.remoteCache;
91
+ const cliUrl = options.url;
92
+ const url = cliUrl ?? configRemoteCache?.url;
93
+ const format = options.format ?? "table";
94
+ const timeoutMs = options.timeout ?? 5e3;
95
+ if (!url) {
96
+ pail.error("No remote cache configured. Set taskRunnerOptions.remoteCache.url in vis.config.ts or pass --url=...");
97
+ process.exitCode = 1;
98
+ return;
99
+ }
100
+ const backend = inferBackend(url, options.backend);
101
+ const result = backend === "reapi" ? await probeReapi({ ...configRemoteCache ?? { url }, backend: "reapi", url }, timeoutMs) : await probeHttp(url, timeoutMs);
102
+ if (format === "json") {
103
+ logger.log(JSON.stringify(result, null, 2));
104
+ } else {
105
+ logger.log(formatTable(result));
106
+ }
107
+ if (!result.ok) {
108
+ process.exitCode = 1;
109
+ }
110
+ };
111
+
112
+ export { cacheDoctorExecute };
@@ -1,53 +1,234 @@
1
- var J=Object.defineProperty;var y=(t,e)=>J(t,"name",{value:e,configurable:!0});import{createRequire as L}from"node:module";import{bold as P,dim as O,yellow as j,cyan as K,red as E,green as M}from"@visulima/colorize";import{isAbsolute as B,resolve as T,join as z,relative as F}from"@visulima/path";import{readLastRunSummary as G}from"@visulima/task-runner";import{l as Q,a as N}from"../packem_shared/failure-log-DqYen0LC.js";import{r as V,f as R,a as X,d as Z}from"../packem_shared/run-summary-utils-C24Aaf9E.js";import{w as rt,b as at,r as it}from"../packem_shared/ai-analysis-CGuy7dfE.js";import{M as ot,N as st,O as nt}from"../packem_shared/ai-cache-Bynt6Y9x.js";import{p as d}from"./bin.js";const U=L(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=y(t=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[e,r]=$.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return $.getBuiltinModule(t)}return U(t)},"__cjs_getBuiltinModule"),{createInterface:Y}=_("node:readline"),{readFile:tt,writeFile:et}=_("node:fs/promises");var ut=Object.defineProperty,k=y((t,e)=>ut(t,"name",{value:e,configurable:!0}),"u");const ct=32*1024,pt=k((t,e)=>{if(t.length<=e)return t;const r=t.slice(-e),a=t.length-r.length;return`[…${String(a)} bytes truncated from head…]
2
- ${r}`},"truncateHead"),lt=k(async(t,e)=>e===void 0?G(t):V(t,e),"loadSummary"),dt=k(async(t,e,r={})=>{const a=r.terminalOutputLimit??ct,[o,s]=await Promise.all([Q(t,e),lt(t,r.runId)]),i=s?R(s,e):void 0;if(!o&&!i)return;let n,u;if(s&&i){const c=await X(t,s.id),h=c?R(c,e):void 0;n=Z(i.hashDetails,h?.hashDetails),u=c?.id}const l=o?.terminalOutput??"";return{command:o?.command??void 0,cwd:o?.cwd??void 0,dependencies:i?.dependencies??[],duration:i?.duration,exitCode:o?.exitCode??i?.exitCode,hash:i?.hash??o?.hash,hashDetails:i?.hashDetails,hashDiff:n,previousRunId:u,project:i?.target.project,runId:s?.id??o?.runId,status:o?.status??(i?ht(i):void 0),target:i?.target.target,taskId:e,terminalOutput:pt(l,a),terminalOutputCaptured:!!o,timestamp:o?.timestamp??i?.endTime??i?.startTime}},"aggregateFailureContext"),ht=k(t=>{if(t.exitCode!==void 0&&t.exitCode!==0)return"failure";switch(t.cacheStatus){case"HIT":return"local-cache";case"REMOTE_HIT":return"remote-cache";case"SKIPPED":return"skipped";default:return t.exitCode===0?"success":void 0}},"mapCacheStatusToTaskStatus");var ft=Object.defineProperty,p=y((t,e)=>ft(t,"name",{value:e,configurable:!0}),"a");const mt=3600*1e3,D=80,gt=new Set(["high","low","medium"]),wt=p(()=>`You are an expert software engineer helping fix a failing build/test/lint task.
1
+ import { createRequire as __cjs_createRequire } from "node:module";
3
2
 
4
- You will be given:
5
- - The terminal output (stdout/stderr) from the failed task.
6
- - Optional metadata: command, working directory, project, task hash, and a diff describing what changed in the task's hash inputs since the previous run that did not fail.
3
+ const __cjs_require = __cjs_createRequire(import.meta.url);
7
4
 
8
- Your job:
9
- 1. Identify the root cause from the terminal output.
10
- 2. Propose a minimal set of source-file patches that fix the cause.
11
- 3. If you cannot determine a safe fix, set "cannotFix" with a clear, actionable explanation.
5
+ const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
12
6
 
13
- Constraints:
14
- - Patches MUST be exact string replacements. The "oldString" must appear verbatim in the named file. Paths are relative to the working directory.
15
- - Each "oldString" must be unique within its file. Include surrounding context so the match is unambiguous.
16
- - Do NOT include unrelated cleanup, formatting changes, or speculative refactors.
17
- - If the failure is environmental (missing tool, network) or requires running commands, prefer "cannotFix" over a guess.
18
- - Keep "explanation" short (1-3 sentences). Reserve "reason" on each patch for why that specific edit fixes the cause.
7
+ const __cjs_getBuiltinModule = (module) => {
8
+ // Check if we're in Node.js and version supports getBuiltinModule
9
+ if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
+ const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
+ // Node.js 20.16.0+ and 22.3.0+
12
+ if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
+ return __cjs_getProcess.getBuiltinModule(module);
14
+ }
15
+ }
16
+ // Fallback to createRequire
17
+ return __cjs_require(module);
18
+ };
19
+
20
+ const {
21
+ createInterface
22
+ } = __cjs_getBuiltinModule("node:readline");
23
+ import { bold, dim, yellow, cyan, red, green } from '@visulima/colorize';
24
+ import { relative } from '@visulima/path';
25
+ import { a as aggregateFailureContext, r as runFixAnalysis, b as applyFixProposal, c as resolvePatchPath } from '../packem_shared/ai-fix-B9iQVcD2.js';
26
+ import { p as pail } from './bin.js';
27
+ import { l as listFailureLogs } from '../packem_shared/failure-log-Cz3Z4SKL.js';
19
28
 
20
- Respond ONLY with valid JSON in this exact structure:
21
- {
22
- "explanation": "Brief root-cause analysis and what the fix does.",
23
- "confidence": "low|medium|high",
24
- "patches": [
25
- {
26
- "file": "path/relative/to/cwd.ts",
27
- "oldString": "exact text to find",
28
- "newString": "exact replacement text",
29
- "reason": "why this change fixes it"
30
- }
31
- ],
32
- "cannotFix": "optional — set when no safe patch can be proposed"
33
- }`,"buildSystemPrompt"),C=p((t,e)=>{const r=[];if(e.added.length>0&&r.push(` added: ${e.added.join(", ")}`),e.changed.length>0&&r.push(` changed: ${e.changed.join(", ")}`),e.removed.length>0&&r.push(` removed: ${e.removed.join(", ")}`),r.length!==0)return`- ${t}:
34
- ${r.join(`
35
- `)}`},"formatBucket"),vt=p(t=>{if(!t.hashDiff)return"No hash-diff available — there is no previous run to compare against.";const e=[];t.hashDiff.commandChanged&&e.push("- command line changed since previous run");const r=C("file inputs",t.hashDiff.nodes),a=C("implicit deps",t.hashDiff.implicitDeps),o=C("runtime/env",t.hashDiff.runtime);return r&&e.push(r),a&&e.push(a),o&&e.push(o),e.length===0?"No detectable changes between this run and the previous run.":e.join(`
36
- `)},"buildHashDiffSummary"),xt=p(t=>{const e=[];return e.push(`Task: ${t.taskId}`),t.project&&e.push(`Project: ${t.project}`),t.target&&e.push(`Target: ${t.target}`),t.command&&e.push(`Command: ${t.command}`),t.cwd&&e.push(`CWD: ${t.cwd}`),t.exitCode!==void 0&&e.push(`Exit code: ${String(t.exitCode)}`),t.hash&&e.push(`Task hash: ${t.hash}`),e.push("","Hash-diff since previous run:",vt(t),""),t.terminalOutputCaptured?e.push("Terminal output:","```",t.terminalOutput,"```"):e.push("Terminal output: <no failure log was captured for this task>",'Set "cannotFix" and tell the user to re-run with `vis run` so logs can be captured.'),e.join(`
37
- `)},"buildUserPrompt"),yt=p(t=>`${wt()}
29
+ const PATCH_STATUS_LABEL = {
30
+ "ambiguous-match": "ambiguous match",
31
+ applied: "applied",
32
+ error: "error",
33
+ "missing-file": "missing file",
34
+ "no-match": "no match",
35
+ "outside-workspace": "outside workspace"
36
+ };
37
+ const formatDisplayPath = (workspaceRoot, cwd, file) => {
38
+ const absolute = resolvePatchPath(workspaceRoot, cwd, file);
39
+ const rel = relative(workspaceRoot, absolute);
40
+ return rel === "" || rel.startsWith("..") ? absolute : rel;
41
+ };
42
+ const formatProposalText = (proposal, workspaceRoot, cwd) => {
43
+ const lines = [];
44
+ lines.push(bold(`Fix proposal (${proposal.provider}, confidence: ${proposal.confidence})`));
45
+ lines.push("");
46
+ lines.push(proposal.explanation || dim("<no explanation>"));
47
+ if (proposal.cannotFix) {
48
+ lines.push("");
49
+ lines.push(yellow(`Cannot fix automatically: ${proposal.cannotFix}`));
50
+ return lines.join("\n");
51
+ }
52
+ if (proposal.patches.length === 0) {
53
+ lines.push("");
54
+ lines.push(yellow("No patches were proposed."));
55
+ return lines.join("\n");
56
+ }
57
+ lines.push("");
58
+ lines.push(bold(`Patches (${String(proposal.patches.length)}):`));
59
+ for (const [index, patch] of proposal.patches.entries()) {
60
+ const displayPath = formatDisplayPath(workspaceRoot, cwd, patch.file);
61
+ lines.push("");
62
+ lines.push(cyan(`[${String(index + 1)}] ${displayPath}`));
63
+ if (patch.reason) {
64
+ lines.push(dim(` reason: ${patch.reason}`));
65
+ }
66
+ for (const line of patch.oldString.split("\n")) {
67
+ lines.push(red(` - ${line}`));
68
+ }
69
+ for (const line of patch.newString.split("\n")) {
70
+ lines.push(green(` + ${line}`));
71
+ }
72
+ }
73
+ return lines.join("\n");
74
+ };
75
+ const formatPatchResultsText = (results, workspaceRoot, cwd) => {
76
+ const lines = [];
77
+ for (const result of results) {
78
+ const displayPath = result.absolutePath ? relative(workspaceRoot, result.absolutePath) || result.absolutePath : formatDisplayPath(workspaceRoot, cwd, result.patch.file);
79
+ const label = PATCH_STATUS_LABEL[result.status];
80
+ if (result.status === "applied") {
81
+ lines.push(green(` ✓ ${displayPath}: ${label}`));
82
+ } else {
83
+ lines.push(red(` ✗ ${displayPath}: ${label}${result.error ? ` (${result.error})` : ""}`));
84
+ }
85
+ }
86
+ return lines.join("\n");
87
+ };
88
+ const summarizePatchResults = (results) => {
89
+ let applied = 0;
90
+ let failed = 0;
91
+ for (const result of results) {
92
+ if (result.status === "applied") {
93
+ applied += 1;
94
+ } else {
95
+ failed += 1;
96
+ }
97
+ }
98
+ return { applied, failed };
99
+ };
100
+ const confirmPrompt = (question) => new Promise((resolvePromise) => {
101
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
102
+ rl.question(`${question} (y/N) `, (answer) => {
103
+ rl.close();
104
+ const trimmed = answer.trim().toLowerCase();
105
+ resolvePromise(trimmed === "y" || trimmed === "yes");
106
+ });
107
+ });
108
+ const resolveWorkspaceRoot = (workspaceRoot) => workspaceRoot ?? process.cwd();
109
+ const aiFix = async ({ argument, logger, options, visConfig, workspaceRoot: wsRoot }) => {
110
+ const taskId = argument[0];
111
+ const workspaceRoot = resolveWorkspaceRoot(wsRoot);
112
+ const format = options.format ?? "text";
113
+ const isJson = format === "json";
114
+ if (!taskId) {
115
+ if (isJson) {
116
+ const available = listFailureLogs(workspaceRoot);
117
+ process.stdout.write(`${JSON.stringify({ availableTasks: available, error: "No task ID specified" }, void 0, 2)}
118
+ `);
119
+ } else {
120
+ pail.error("No task ID specified. Usage: vis ai fix <project>:<target>");
121
+ const available = listFailureLogs(workspaceRoot);
122
+ if (available.length > 0) {
123
+ pail.info("Tasks with captured failure logs:");
124
+ for (const id of available) {
125
+ pail.info(` - ${id}`);
126
+ }
127
+ } else {
128
+ pail.notice("No failure logs found. Re-run a failing task with `vis run` to capture logs.");
129
+ }
130
+ }
131
+ process.exitCode = 1;
132
+ return;
133
+ }
134
+ const failureContext = await aggregateFailureContext(workspaceRoot, taskId, { runId: options.run });
135
+ if (!failureContext) {
136
+ if (isJson) {
137
+ process.stdout.write(`${JSON.stringify({ error: "No failure log or run summary found", taskId }, void 0, 2)}
138
+ `);
139
+ } else {
140
+ pail.error(`No failure log or run summary found for task "${taskId}".`);
141
+ pail.notice("Re-run the task with `vis run` so its terminal output and run metadata are captured.");
142
+ }
143
+ process.exitCode = 1;
144
+ return;
145
+ }
146
+ if (!failureContext.terminalOutputCaptured) {
147
+ pail.warn(`No captured terminal output for "${taskId}". Re-run with \`vis run\` for a better fix proposal.`);
148
+ }
149
+ const aiConfig = visConfig?.ai;
150
+ const proposal = await runFixAnalysis(failureContext, logger, {
151
+ cache: options.noCache !== true,
152
+ config: aiConfig
153
+ });
154
+ if (!proposal) {
155
+ if (isJson) {
156
+ process.stdout.write(`${JSON.stringify({ error: "AI fix proposal failed or no provider available", taskId }, void 0, 2)}
157
+ `);
158
+ }
159
+ process.exitCode = 1;
160
+ return;
161
+ }
162
+ const apply = options.apply === true;
163
+ if (isJson) {
164
+ const dryRunResults2 = apply ? void 0 : await applyFixProposal(workspaceRoot, failureContext.cwd, proposal, { dryRun: true });
165
+ const appliedResults = apply ? await applyFixProposal(workspaceRoot, failureContext.cwd, proposal) : void 0;
166
+ process.stdout.write(
167
+ `${JSON.stringify(
168
+ {
169
+ appliedResults,
170
+ dryRunResults: dryRunResults2,
171
+ failureContext: {
172
+ cwd: failureContext.cwd,
173
+ hash: failureContext.hash,
174
+ runId: failureContext.runId,
175
+ taskId: failureContext.taskId,
176
+ terminalOutputCaptured: failureContext.terminalOutputCaptured
177
+ },
178
+ proposal
179
+ },
180
+ void 0,
181
+ 2
182
+ )}
183
+ `
184
+ );
185
+ if (apply && appliedResults) {
186
+ const { failed } = summarizePatchResults(appliedResults);
187
+ if (failed > 0) {
188
+ process.exitCode = 1;
189
+ }
190
+ }
191
+ return;
192
+ }
193
+ logger.info(formatProposalText(proposal, workspaceRoot, failureContext.cwd));
194
+ if (proposal.cannotFix || proposal.patches.length === 0) {
195
+ return;
196
+ }
197
+ const dryRunResults = await applyFixProposal(workspaceRoot, failureContext.cwd, proposal, { dryRun: true });
198
+ const dryRunSummary = summarizePatchResults(dryRunResults);
199
+ logger.info("");
200
+ logger.info(bold("Patch validation:"));
201
+ logger.info(formatPatchResultsText(dryRunResults, workspaceRoot, failureContext.cwd));
202
+ if (!apply) {
203
+ logger.info("");
204
+ pail.info("Re-run with --apply to write these patches to disk.");
205
+ return;
206
+ }
207
+ if (dryRunSummary.applied === 0) {
208
+ pail.error("No patches can be applied (every patch failed validation).");
209
+ process.exitCode = 1;
210
+ return;
211
+ }
212
+ if (options.yes !== true) {
213
+ logger.info("");
214
+ const confirmed = await confirmPrompt(`Apply ${String(dryRunSummary.applied)} patch${dryRunSummary.applied === 1 ? "" : "es"} to disk?`);
215
+ if (!confirmed) {
216
+ pail.notice("Aborted. Nothing written.");
217
+ return;
218
+ }
219
+ }
220
+ const applyResults = await applyFixProposal(workspaceRoot, failureContext.cwd, proposal);
221
+ const applySummary = summarizePatchResults(applyResults);
222
+ logger.info("");
223
+ logger.info(bold("Apply results:"));
224
+ logger.info(formatPatchResultsText(applyResults, workspaceRoot, failureContext.cwd));
225
+ logger.info("");
226
+ if (applySummary.failed === 0) {
227
+ pail.success(`Applied ${String(applySummary.applied)} patch${applySummary.applied === 1 ? "" : "es"}.`);
228
+ } else {
229
+ pail.warn(`${String(applySummary.applied)} applied, ${String(applySummary.failed)} failed.`);
230
+ process.exitCode = 1;
231
+ }
232
+ };
38
233
 
39
- ${xt(t)}`,"buildFixPrompt"),$t=p((t,e)=>{const r=Array.isArray(t.patches)?t.patches:[],a=[];for(const s of r)typeof s.file!="string"||s.file.length===0||typeof s.oldString!="string"||s.oldString.length===0||typeof s.newString=="string"&&a.push({file:s.file,newString:s.newString,oldString:s.oldString,reason:typeof s.reason=="string"&&s.reason.length>0?s.reason:void 0});const o=typeof t.cannotFix=="string"&&t.cannotFix.length>0?t.cannotFix:void 0;return{cannotFix:o,confidence:gt.has(t.confidence)?t.confidence:"low",explanation:typeof t.explanation=="string"?t.explanation:"",patches:o?[]:a,provider:e}},"normalizeFixProposal"),bt=p((t,e)=>{const r=rt(t);return!r||typeof r!="object"?{cannotFix:"AI response was not valid JSON.",confidence:"low",explanation:"Failed to parse AI response.",patches:[],provider:e}:$t(r,e)},"parseFixResponse"),St=p((t,e)=>ot({cwd:e.cwd??null,flow:"ai-fix",hash:e.hash??null,provider:t,taskId:e.taskId,terminalOutput:e.terminalOutput,terminalOutputCaptured:e.terminalOutputCaptured}),"buildFixCacheKey"),Pt=p(async(t,e,r={})=>{const a=at(r.config);if(!a){e.warn(`No AI provider available — install one of: claude, gemini, copilot, codex.
40
- `);return}const o=r.cache!==!1,s=St(a.name,t);if(o){const i=st(s);if(i)return e.info(`Using cached fix proposal from ${i.provider}.
41
- `),i}e.info(`Generating fix proposal with ${a.name}...
42
- `);try{const i=await it(a,yt(t)),n=bt(i,a.name);return o&&n.patches.length>0&&!n.cannotFix&&nt(s,n,mt),n}catch(i){const n=i instanceof Error?i.message:String(i);e.warn(`AI fix proposal failed (${n}).
43
- `);return}},"runFixAnalysis"),W=p((t,e,r)=>B(r)?T(r):T(z(e??t,r)),"resolvePatchPath"),kt=p((t,e)=>{const r=F(t,e);return r===""?!0:!r.startsWith("..")&&!B(r)},"isInsideWorkspace"),Ct=p((t,e,r)=>{const a=t.indexOf(e),o=Math.max(0,a-D),s=Math.min(t.length,a+e.length+D),i=t.slice(o,s);return{previewAfter:`${t.slice(o,a)}${r}${t.slice(a+e.length,s)}`,previewBefore:i}},"buildPreview"),S=p(async(t,e,r,a={})=>{const o=a.dryRun===!0,s=new Map,i=[];for(const n of r.patches){const u=W(t,e,n.file);if(!kt(t,u)){i.push({absolutePath:u,patch:n,status:"outside-workspace"});continue}let l=s.get(u);if(l===void 0){try{l=await tt(u,"utf8")}catch(m){const f=m.code;i.push({absolutePath:u,error:f==="ENOENT"?void 0:m.message,patch:n,status:f==="ENOENT"?"missing-file":"error"});continue}s.set(u,l)}const c=l.indexOf(n.oldString);if(c===-1){i.push({absolutePath:u,patch:n,status:"no-match"});continue}if(l.indexOf(n.oldString,c+n.oldString.length)!==-1){i.push({absolutePath:u,patch:n,status:"ambiguous-match"});continue}const{previewAfter:h,previewBefore:b}=Ct(l,n.oldString,n.newString),w=`${l.slice(0,c)}${n.newString}${l.slice(c+n.oldString.length)}`;if(!o)try{await et(u,w,"utf8")}catch(m){s.delete(u),i.push({absolutePath:u,error:m.message,patch:n,status:"error"});continue}s.set(u,w),i.push({absolutePath:u,patch:n,previewAfter:h,previewBefore:b,status:"applied"})}return i},"applyFixProposal");var It=Object.defineProperty,g=y((t,e)=>It(t,"name",{value:e,configurable:!0}),"c");const Ft={"ambiguous-match":"ambiguous match",applied:"applied",error:"error","missing-file":"missing file","no-match":"no match","outside-workspace":"outside workspace"},q=g((t,e,r)=>{const a=W(t,e,r),o=F(t,a);return o===""||o.startsWith("..")?a:o},"formatDisplayPath"),Ot=g((t,e,r)=>{const a=[];if(a.push(P(`Fix proposal (${t.provider}, confidence: ${t.confidence})`)),a.push(""),a.push(t.explanation||O("<no explanation>")),t.cannotFix)return a.push(""),a.push(j(`Cannot fix automatically: ${t.cannotFix}`)),a.join(`
44
- `);if(t.patches.length===0)return a.push(""),a.push(j("No patches were proposed.")),a.join(`
45
- `);a.push(""),a.push(P(`Patches (${String(t.patches.length)}):`));for(const[o,s]of t.patches.entries()){const i=q(e,r,s.file);a.push(""),a.push(K(`[${String(o+1)}] ${i}`)),s.reason&&a.push(O(` reason: ${s.reason}`));for(const n of s.oldString.split(`
46
- `))a.push(E(` - ${n}`));for(const n of s.newString.split(`
47
- `))a.push(M(` + ${n}`))}return a.join(`
48
- `)},"formatProposalText"),A=g((t,e,r)=>{const a=[];for(const o of t){const s=o.absolutePath?F(e,o.absolutePath)||o.absolutePath:q(e,r,o.patch.file),i=Ft[o.status];o.status==="applied"?a.push(M(` ✓ ${s}: ${i}`)):a.push(E(` ✗ ${s}: ${i}${o.error?` (${o.error})`:""}`))}return a.join(`
49
- `)},"formatPatchResultsText"),I=g(t=>{let e=0,r=0;for(const a of t)a.status==="applied"?e+=1:r+=1;return{applied:e,failed:r}},"summarizePatchResults"),jt=g(t=>new Promise(e=>{const r=Y({input:process.stdin,output:process.stderr});r.question(`${t} (y/N) `,a=>{r.close();const o=a.trim().toLowerCase();e(o==="y"||o==="yes")})}),"confirmPrompt"),Tt=g(t=>t??process.cwd(),"resolveWorkspaceRoot"),Ht=g(async({argument:t,logger:e,options:r,visConfig:a,workspaceRoot:o})=>{const s=t[0],i=Tt(o),n=(r.format??"text")==="json";if(!s){if(n){const v=N(i);process.stdout.write(`${JSON.stringify({availableTasks:v,error:"No task ID specified"},void 0,2)}
50
- `)}else{d.error("No task ID specified. Usage: vis ai fix <project>:<target>");const v=N(i);if(v.length>0){d.info("Tasks with captured failure logs:");for(const x of v)d.info(` - ${x}`)}else d.notice("No failure logs found. Re-run a failing task with `vis run` to capture logs.")}process.exitCode=1;return}const u=await dt(i,s,{runId:r.run});if(!u){n?process.stdout.write(`${JSON.stringify({error:"No failure log or run summary found",taskId:s},void 0,2)}
51
- `):(d.error(`No failure log or run summary found for task "${s}".`),d.notice("Re-run the task with `vis run` so its terminal output and run metadata are captured.")),process.exitCode=1;return}u.terminalOutputCaptured||d.warn(`No captured terminal output for "${s}". Re-run with \`vis run\` for a better fix proposal.`);const l=a?.ai,c=await Pt(u,e,{cache:r.noCache!==!0,config:l});if(!c){n&&process.stdout.write(`${JSON.stringify({error:"AI fix proposal failed or no provider available",taskId:s},void 0,2)}
52
- `),process.exitCode=1;return}const h=r.apply===!0;if(n){const v=h?void 0:await S(i,u.cwd,c,{dryRun:!0}),x=h?await S(i,u.cwd,c):void 0;if(process.stdout.write(`${JSON.stringify({appliedResults:x,dryRunResults:v,failureContext:{cwd:u.cwd,hash:u.hash,runId:u.runId,taskId:u.taskId,terminalOutputCaptured:u.terminalOutputCaptured},proposal:c},void 0,2)}
53
- `),h&&x){const{failed:H}=I(x);H>0&&(process.exitCode=1)}return}if(e.info(Ot(c,i,u.cwd)),c.cannotFix||c.patches.length===0)return;const b=await S(i,u.cwd,c,{dryRun:!0}),w=I(b);if(e.info(""),e.info(P("Patch validation:")),e.info(A(b,i,u.cwd)),!h){e.info(""),d.info("Re-run with --apply to write these patches to disk.");return}if(w.applied===0){d.error("No patches can be applied (every patch failed validation)."),process.exitCode=1;return}if(r.yes!==!0&&(e.info(""),!await jt(`Apply ${String(w.applied)} patch${w.applied===1?"":"es"} to disk?`))){d.notice("Aborted. Nothing written.");return}const m=await S(i,u.cwd,c),f=I(m);e.info(""),e.info(P("Apply results:")),e.info(A(m,i,u.cwd)),e.info(""),f.failed===0?d.success(`Applied ${String(f.applied)} patch${f.applied===1?"":"es"}.`):(d.warn(`${String(f.applied)} applied, ${String(f.failed)} failed.`),process.exitCode=1)},"aiFix");export{Ht as aiFix};
234
+ export { aiFix };
@@ -1 +1,99 @@
1
- var O=Object.defineProperty;var w=(o,e)=>O(o,"name",{value:e,configurable:!0});import{createTaskGraph as b}from"@visulima/task-runner";import{r as E,s as R}from"./bin.js";import{r as x,f as G}from"../packem_shared/selectors-CfH9ZY08.js";var J=Object.defineProperty,m=w((o,e)=>J(o,"name",{value:e,configurable:!0}),"u");const P=m((o,e,n)=>{const c=[],t=new Set,l=m((r,f)=>{if(t.has(r))return;t.add(r);const s=e[r]??[];for(const i of s)l(i,f+1);const d=n[r],u=" ".repeat(f);c.push(`${u}${r}${d?.cache===!1?" (no-cache)":""}`)},"walk");for(const r of o)l(r,0);return c},"renderPlan"),S=m((o,e,n)=>({roots:o,tasks:Object.fromEntries(Object.entries(n).map(([c,t])=>[c,{cache:t.cache,dependsOn:e[c]??[],outputs:t.outputs,parallelism:t.parallelism,projectRoot:t.projectRoot,target:t.target}]))}),"toJson"),T=m(async({argument:o,logger:e,options:n,visConfig:c,workspaceRoot:t})=>{const l=o[0];if(!l)throw new Error("Missing selector. Usage: vis action-graph <selector>");if(!t)throw new Error("Could not determine workspace root. Run inside a monorepo.");const{config:r,packageJsons:f,workspace:s}=E(t,c),d=R(t,s,f),u=await x(l,s,process.cwd(),t),{target:i}=u;let h=u.projects;n.query&&(h=G(h,s,n.query));const j=h.filter(p=>s.projects[p]?.targets?.[i]!==void 0);if(j.length===0){e.info(`No projects have a "${i}" target.`);return}const v=j.map(p=>{const k=s.projects[p],g=k.targets?.[i],$={project:p,target:i};return{cache:g?.cache,id:`${p}:${i}`,outputs:g?.outputs??[],overrides:{command:g?.command},parallelism:g?.parallelism,projectRoot:k.root,target:$}}),a=b(v,{projectGraph:d,targetDefaults:r.targetDefaults,workspace:s});if(n.json){e.info(JSON.stringify(S(a.roots,a.dependencies,a.tasks),null,2));return}const y=P(a.roots,a.dependencies,a.tasks);e.info(`Execution plan (${Object.keys(a.tasks).length} task(s), ${a.roots.length} root(s)):`),e.info("");for(const p of y)e.info(p)},"execute");export{T as default};
1
+ import { createTaskGraph } from '@visulima/task-runner';
2
+ import { d as discoverWorkspace, b as buildProjectGraph } from './bin.js';
3
+ import { r as resolveSelector, f as filterProjectsByQuery } from '../packem_shared/selectors-SM69TfqC.js';
4
+
5
+ const renderPlan = (roots, dependencies, tasks) => {
6
+ const lines = [];
7
+ const visited = /* @__PURE__ */ new Set();
8
+ const walk = (id, depth) => {
9
+ if (visited.has(id)) {
10
+ return;
11
+ }
12
+ visited.add(id);
13
+ const deps = dependencies[id] ?? [];
14
+ for (const dep of deps) {
15
+ walk(dep, depth + 1);
16
+ }
17
+ const task = tasks[id];
18
+ const indent = " ".repeat(depth);
19
+ lines.push(`${indent}${id}${task?.cache === false ? " (no-cache)" : ""}`);
20
+ };
21
+ for (const root of roots) {
22
+ walk(root, 0);
23
+ }
24
+ return lines;
25
+ };
26
+ const toJson = (roots, dependencies, tasks) => {
27
+ return {
28
+ roots,
29
+ tasks: Object.fromEntries(
30
+ Object.entries(tasks).map(([id, task]) => [
31
+ id,
32
+ {
33
+ cache: task.cache,
34
+ dependsOn: dependencies[id] ?? [],
35
+ outputs: task.outputs,
36
+ parallelism: task.parallelism,
37
+ projectRoot: task.projectRoot,
38
+ target: task.target
39
+ }
40
+ ])
41
+ )
42
+ };
43
+ };
44
+ const execute = async ({ argument, logger, options, visConfig, workspaceRoot: wsRoot }) => {
45
+ const rawSelector = argument[0];
46
+ if (!rawSelector) {
47
+ throw new Error("Missing selector. Usage: vis action-graph <selector>");
48
+ }
49
+ if (!wsRoot) {
50
+ throw new Error("Could not determine workspace root. Run inside a monorepo.");
51
+ }
52
+ const { config, packageJsons, workspace } = discoverWorkspace(wsRoot, visConfig);
53
+ const projectGraph = buildProjectGraph(wsRoot, workspace, packageJsons);
54
+ const selectorResult = await resolveSelector(rawSelector, workspace, process.cwd(), wsRoot);
55
+ const { target } = selectorResult;
56
+ let projectNames = selectorResult.projects;
57
+ if (options.query) {
58
+ projectNames = filterProjectsByQuery(projectNames, workspace, options.query);
59
+ }
60
+ const candidates = projectNames.filter((name) => {
61
+ const project = workspace.projects[name];
62
+ return project?.targets?.[target] !== void 0;
63
+ });
64
+ if (candidates.length === 0) {
65
+ logger.info(`No projects have a "${target}" target.`);
66
+ return;
67
+ }
68
+ const initialTasks = candidates.map((projectName) => {
69
+ const project = workspace.projects[projectName];
70
+ const targetConfig = project.targets?.[target];
71
+ const taskTarget = { project: projectName, target };
72
+ return {
73
+ cache: targetConfig?.cache,
74
+ id: `${projectName}:${target}`,
75
+ outputs: targetConfig?.outputs ?? [],
76
+ overrides: { command: targetConfig?.command },
77
+ parallelism: targetConfig?.parallelism,
78
+ projectRoot: project.root,
79
+ target: taskTarget
80
+ };
81
+ });
82
+ const taskGraph = createTaskGraph(initialTasks, {
83
+ projectGraph,
84
+ targetDefaults: config.targetDefaults,
85
+ workspace
86
+ });
87
+ if (options.json) {
88
+ logger.info(JSON.stringify(toJson(taskGraph.roots, taskGraph.dependencies, taskGraph.tasks), null, 2));
89
+ return;
90
+ }
91
+ const lines = renderPlan(taskGraph.roots, taskGraph.dependencies, taskGraph.tasks);
92
+ logger.info(`Execution plan (${Object.keys(taskGraph.tasks).length} task(s), ${taskGraph.roots.length} root(s)):`);
93
+ logger.info("");
94
+ for (const line of lines) {
95
+ logger.info(line);
96
+ }
97
+ };
98
+
99
+ export { execute as default };
@@ -1 +1,53 @@
1
- var i=Object.defineProperty;var n=(e,o)=>i(e,"name",{value:o,configurable:!0});import{J as p,n as d}from"./bin.js";var f=Object.defineProperty,l=n((e,o)=>f(e,"name",{value:o,configurable:!0}),"t");const k=l(async({logger:e,options:o,visConfig:s,workspaceRoot:t})=>{const c=t??process.cwd(),r=p(c,{configBackend:s?.install?.backend}),a=d(r,o.check||!1,c,e);a!==0&&(process.exitCode=a)},"execute");export{k as default};
1
+ import { join } from '@visulima/path';
2
+ import { d as discoverWorkspace, b as buildProjectGraph } from './bin.js';
3
+ import { s as scaffoldDockerContext, p as pruneDockerContext } from '../packem_shared/docker-2iZzc280.js';
4
+
5
+ const execute = async ({ argument, logger, options, visConfig, workspaceRoot: wsRoot }) => {
6
+ const subcommand = argument[0];
7
+ if (!subcommand) {
8
+ throw new Error("Missing subcommand. Usage: vis docker <scaffold|prune>");
9
+ }
10
+ if (!wsRoot) {
11
+ throw new Error("Could not determine workspace root. Run inside a monorepo.");
12
+ }
13
+ const { packageJsons, workspace } = discoverWorkspace(wsRoot, visConfig);
14
+ if (subcommand === "scaffold") {
15
+ const projectGraph = buildProjectGraph(wsRoot, workspace, packageJsons);
16
+ const focusRaw = options.focus;
17
+ if (!focusRaw) {
18
+ throw new Error("Missing --focus. Pass one or more project names, comma-separated.");
19
+ }
20
+ const focus = focusRaw.split(",").map((name) => name.trim()).filter(Boolean);
21
+ if (focus.length === 0) {
22
+ throw new Error("--focus resolved to an empty list. Provide at least one project name.");
23
+ }
24
+ const outDir = join(wsRoot, options.out ?? ".vis/docker");
25
+ const { projects } = scaffoldDockerContext({
26
+ focus,
27
+ includeSources: Boolean(options.includeSources),
28
+ outDir,
29
+ projectGraph,
30
+ workspace,
31
+ workspaceRoot: wsRoot
32
+ });
33
+ logger.info(`Scaffolded ${projects.length} project(s) into ${outDir}`);
34
+ logger.info(`Focus closure: ${projects.sort().join(", ")}`);
35
+ return;
36
+ }
37
+ if (subcommand === "prune") {
38
+ const contextRoot = join(wsRoot, options.context ?? ".vis/docker");
39
+ const { removed } = pruneDockerContext({
40
+ contextRoot,
41
+ workspace,
42
+ workspaceRoot: wsRoot
43
+ });
44
+ logger.info(`Pruned ${removed.length} unfocused project(s)`);
45
+ if (removed.length > 0) {
46
+ logger.debug?.(removed.join("\n"));
47
+ }
48
+ return;
49
+ }
50
+ throw new Error(`Unknown subcommand: "${subcommand}". Expected scaffold or prune.`);
51
+ };
52
+
53
+ export { execute as default };
@@ -1 +1,32 @@
1
- var k=Object.defineProperty;var n=(e,s)=>k(e,"name",{value:s,configurable:!0});import{J as f,o as u}from"./bin.js";var v=Object.defineProperty,h=n((e,s)=>v(e,"name",{value:s,configurable:!0}),"n");const x=h(async({argument:e,logger:s,options:a,visConfig:i,workspaceRoot:t})=>{const o=e;if(!o||o.length===0)throw new Error("No package specified. Usage: vis dlx <package[@version]> [args...]");const[g,...l]=o,r=t??process.cwd(),p=f(r,{configBackend:i?.install?.backend}),d=a.package?Array.isArray(a.package)?a.package:[a.package]:[],c=u(p,{additionalPackages:d,args:l,package:g,shellMode:a.shellMode||!1,silent:a.silent||!1},r,s);c!==0&&(process.exitCode=c)},"execute");export{x as default};
1
+ import { r as resolveInstaller, m as runExec } from './bin.js';
2
+ import { t as toStringArray } from '../packem_shared/utils-CthVdBPS.js';
3
+
4
+ const execute = async ({ argument, logger, options, visConfig, workspaceRoot: wsRoot }) => {
5
+ const args = argument;
6
+ if (!args || args.length === 0) {
7
+ throw new Error("No command specified. Usage: vis exec <command> [args...]");
8
+ }
9
+ const [command, ...rest] = args;
10
+ const cwd = wsRoot ?? process.cwd();
11
+ const pm = resolveInstaller(cwd, { configBackend: visConfig?.install?.backend });
12
+ const code = runExec(
13
+ pm,
14
+ {
15
+ args: rest,
16
+ command,
17
+ filter: toStringArray(options.filter),
18
+ parallel: options.parallel || false,
19
+ recursive: options.recursive || false,
20
+ reverse: options.reverse || false,
21
+ shellMode: options.shellMode || false,
22
+ workspaceRoot: options.workspaceRoot || false
23
+ },
24
+ cwd,
25
+ logger
26
+ );
27
+ if (code !== 0) {
28
+ process.exitCode = code;
29
+ }
30
+ };
31
+
32
+ export { execute as default };