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

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 (116) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/LICENSE.md +559 -186
  3. package/README.md +18 -0
  4. package/dist/bin.js +1 -9
  5. package/dist/config/index.d.ts +477 -556
  6. package/dist/config/index.js +1 -2
  7. package/dist/generate/index.js +1 -3
  8. package/dist/packem_chunks/applyDefaults.js +2 -336
  9. package/dist/packem_chunks/bin.js +234 -9552
  10. package/dist/packem_chunks/doctor-probe.js +2 -112
  11. package/dist/packem_chunks/fix.js +11 -234
  12. package/dist/packem_chunks/handler.js +1 -99
  13. package/dist/packem_chunks/handler10.js +2 -53
  14. package/dist/packem_chunks/handler11.js +1 -32
  15. package/dist/packem_chunks/handler12.js +5 -100
  16. package/dist/packem_chunks/handler13.js +1 -25
  17. package/dist/packem_chunks/handler14.js +18 -916
  18. package/dist/packem_chunks/handler15.js +15 -201
  19. package/dist/packem_chunks/handler16.js +1 -124
  20. package/dist/packem_chunks/handler17.js +1 -13
  21. package/dist/packem_chunks/handler18.js +1 -106
  22. package/dist/packem_chunks/handler19.js +1 -19
  23. package/dist/packem_chunks/handler2.js +2 -75
  24. package/dist/packem_chunks/handler20.js +5 -29
  25. package/dist/packem_chunks/handler21.js +1 -222
  26. package/dist/packem_chunks/handler22.js +1 -237
  27. package/dist/packem_chunks/handler23.js +5 -101
  28. package/dist/packem_chunks/handler24.js +1 -110
  29. package/dist/packem_chunks/handler25.js +3 -402
  30. package/dist/packem_chunks/handler26.js +1 -13
  31. package/dist/packem_chunks/handler27.js +1 -63
  32. package/dist/packem_chunks/handler28.js +7 -34
  33. package/dist/packem_chunks/handler29.js +21 -456
  34. package/dist/packem_chunks/handler3.js +4 -95
  35. package/dist/packem_chunks/handler30.js +3 -170
  36. package/dist/packem_chunks/handler31.js +1 -530
  37. package/dist/packem_chunks/handler32.js +2 -214
  38. package/dist/packem_chunks/handler33.js +25 -119
  39. package/dist/packem_chunks/handler34.js +2 -630
  40. package/dist/packem_chunks/handler35.js +3 -283
  41. package/dist/packem_chunks/handler36.js +22 -542
  42. package/dist/packem_chunks/handler37.js +410 -744
  43. package/dist/packem_chunks/handler38.js +22 -989
  44. package/dist/packem_chunks/handler39.js +22 -574
  45. package/dist/packem_chunks/handler4.js +2 -90
  46. package/dist/packem_chunks/handler40.js +22 -1685
  47. package/dist/packem_chunks/handler41.js +6 -1088
  48. package/dist/packem_chunks/handler42.js +5 -797
  49. package/dist/packem_chunks/handler43.js +10 -2658
  50. package/dist/packem_chunks/handler44.js +51 -3784
  51. package/dist/packem_chunks/handler45.js +25 -2574
  52. package/dist/packem_chunks/handler46.js +3 -3769
  53. package/dist/packem_chunks/handler47.js +21 -1485
  54. package/dist/packem_chunks/handler48.js +42 -0
  55. package/dist/packem_chunks/handler5.js +8 -174
  56. package/dist/packem_chunks/handler6.js +1 -95
  57. package/dist/packem_chunks/handler7.js +1 -115
  58. package/dist/packem_chunks/handler8.js +1 -12
  59. package/dist/packem_chunks/handler9.js +1 -29
  60. package/dist/packem_chunks/heal-accept.js +10 -522
  61. package/dist/packem_chunks/heal.js +14 -673
  62. package/dist/packem_chunks/index.js +7 -873
  63. package/dist/packem_chunks/loader.js +1 -23
  64. package/dist/packem_chunks/tar.js +3 -0
  65. package/dist/packem_shared/ai-analysis-hm8d2W7z.js +67 -0
  66. package/dist/packem_shared/ai-cache-DoiF80AR.js +1 -0
  67. package/dist/packem_shared/ai-fix-nn4zOE95.js +43 -0
  68. package/dist/packem_shared/cache-directory-CwHlJhgx.js +1 -0
  69. package/dist/packem_shared/dependency-scan-COr5n63B.js +2 -0
  70. package/dist/packem_shared/docker-D6OGr5_S.js +2 -0
  71. package/dist/packem_shared/failure-log-iUVLf6ts.js +2 -0
  72. package/dist/packem_shared/flakiness-D9wf0t56.js +1 -0
  73. package/dist/packem_shared/giget-CcEy_Elm.js +2 -0
  74. package/dist/packem_shared/index-DH-5hsrC.js +1 -0
  75. package/dist/packem_shared/otel-DxDUPJJH.js +6 -0
  76. package/dist/packem_shared/otelPlugin-CQq6poq8.js +1 -0
  77. package/dist/packem_shared/registry-CkubDdiY.js +2 -0
  78. package/dist/packem_shared/run-summary-utils-BfBvjzhY.js +1 -0
  79. package/dist/packem_shared/runtime-check-BXZ43CBW.js +1 -0
  80. package/dist/packem_shared/selectors-BylODRiM.js +3 -0
  81. package/dist/packem_shared/symbols-CQmER5MT.js +1 -0
  82. package/dist/packem_shared/toolchain-BgBOUHII.js +5 -0
  83. package/dist/packem_shared/typosquats-CcZl99B1.js +1 -0
  84. package/dist/packem_shared/use-measured-height-DjYgUOKk.js +1 -0
  85. package/dist/packem_shared/utils-DrNg0XTR.js +1 -0
  86. package/dist/packem_shared/verify-Baj5mFJ7.js +1 -0
  87. package/dist/packem_shared/vis-update-app-D1jl0UZZ.js +1 -0
  88. package/dist/packem_shared/xxh3-DrAUNq4n.js +1 -0
  89. package/index.js +556 -727
  90. package/package.json +19 -29
  91. package/schemas/project.schema.json +739 -297
  92. package/schemas/vis-config.schema.json +3365 -384
  93. package/templates/buildkite-ci/template.yml +20 -20
  94. package/dist/packem_shared/VisUpdateApp-D-Yz_wvg.js +0 -1316
  95. package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +0 -5
  96. package/dist/packem_shared/ai-analysis-CHeB1joD.js +0 -367
  97. package/dist/packem_shared/ai-cache-Be_jexe4.js +0 -142
  98. package/dist/packem_shared/ai-fix-B9iQVcD2.js +0 -379
  99. package/dist/packem_shared/cache-directory-2qvs4goY.js +0 -98
  100. package/dist/packem_shared/catalog-BJTtyi-O.js +0 -1371
  101. package/dist/packem_shared/dependency-scan-A0KSklpG.js +0 -188
  102. package/dist/packem_shared/docker-2iZzc280.js +0 -181
  103. package/dist/packem_shared/failure-log-Cz3Z4SKL.js +0 -100
  104. package/dist/packem_shared/flakiness-goTxXuCX.js +0 -180
  105. package/dist/packem_shared/otel-DCvqCTz_.js +0 -158
  106. package/dist/packem_shared/otelPlugin-DFaLDvJf.js +0 -3
  107. package/dist/packem_shared/registry-CbqXI0rc.js +0 -272
  108. package/dist/packem_shared/run-summary-utils-PVMl4aIh.js +0 -130
  109. package/dist/packem_shared/runtime-check-Cobi3p6l.js +0 -127
  110. package/dist/packem_shared/selectors-SM69TfqC.js +0 -194
  111. package/dist/packem_shared/symbols-Ta7g2nU-.js +0 -14
  112. package/dist/packem_shared/toolchain-BdZd9eBi.js +0 -975
  113. package/dist/packem_shared/typosquats-C-bCh3PX.js +0 -1210
  114. package/dist/packem_shared/use-measured-height-CNP0vT4M.js +0 -20
  115. package/dist/packem_shared/utils-CthVdBPS.js +0 -40
  116. package/dist/packem_shared/xxh3-Ck8mXNg1.js +0 -239
@@ -1,170 +1,3 @@
1
- import { detectAllProviders, runProvider } from '@visulima/find-ai-runner';
2
- import { renderToString, Table } from '@visulima/tui';
3
- import React from 'react';
4
- import { a as resolveProvider, D as DEFAULT_PRIORITY } from '../packem_shared/ai-analysis-CHeB1joD.js';
5
- import { bold, dim, cyan, green, yellow } from '@visulima/colorize';
6
-
7
- const AI_DISCOVERY_META = {
8
- command: "ai",
9
- description: "AI-assisted commands: provider detection, cache management, and failure-fix proposals."
10
- };
11
- const typeName = (type) => {
12
- if (typeof type !== "function") {
13
- return String(type);
14
- }
15
- const { name } = type;
16
- if (name === "Boolean") {
17
- return "boolean";
18
- }
19
- if (name === "Number") {
20
- return "number";
21
- }
22
- if (name === "String") {
23
- return "string";
24
- }
25
- return name ?? "unknown";
26
- };
27
- const buildSubcommand = (command) => {
28
- const path = [...command.commandPath ?? [], command.name].join(" ");
29
- const examples = (command.examples ?? []).map(([cmd, description]) => {
30
- return {
31
- command: cmd ?? "",
32
- description: description ?? ""
33
- };
34
- });
35
- const options = (command.options ?? []).map((option) => {
36
- return {
37
- defaultValue: option.defaultValue,
38
- description: option.description,
39
- name: option.name,
40
- type: typeName(option.type)
41
- };
42
- });
43
- return {
44
- argument: command.argument ? { description: command.argument.description, name: command.argument.name } : void 0,
45
- description: command.description ?? "",
46
- examples,
47
- name: command.name,
48
- options,
49
- path
50
- };
51
- };
52
- const buildDiscoveryPayload = (subcommands, meta = AI_DISCOVERY_META) => {
53
- return {
54
- command: meta.command,
55
- description: meta.description,
56
- subcommands: subcommands.map((subcommand) => buildSubcommand(subcommand))
57
- };
58
- };
59
- const renderDiscoveryJson = (subcommands, meta = AI_DISCOVERY_META) => `${JSON.stringify(buildDiscoveryPayload(subcommands, meta), void 0, 2)}
60
- `;
61
- const renderDiscoveryText = (subcommands, meta = AI_DISCOVERY_META) => {
62
- const payload = buildDiscoveryPayload(subcommands, meta);
63
- const lines = [];
64
- lines.push(bold(`vis ${payload.command} — ${payload.description}`));
65
- lines.push("");
66
- lines.push(dim("Subcommands:"));
67
- for (const subcommand of payload.subcommands) {
68
- const argumentSegment = subcommand.argument ? ` ${cyan(`<${subcommand.argument.name}>`)}` : "";
69
- lines.push("");
70
- lines.push(` ${green(`vis ${subcommand.path}`)}${argumentSegment}`);
71
- if (subcommand.description) {
72
- lines.push(` ${subcommand.description}`);
73
- }
74
- if (subcommand.options.length > 0) {
75
- const optionList = subcommand.options.map((option) => `--${option.name}${option.type === "boolean" ? "" : `=<${option.type}>`}`).join(", ");
76
- lines.push(dim(` options: ${optionList}`));
77
- }
78
- if (subcommand.examples.length > 0) {
79
- lines.push(dim(" examples:"));
80
- for (const example of subcommand.examples) {
81
- const trailing = example.description ? dim(` — ${example.description}`) : "";
82
- lines.push(` ${yellow(example.command)}${trailing}`);
83
- }
84
- }
85
- }
86
- lines.push("");
87
- lines.push(dim(`Run \`vis ${payload.command} discover-help\` for the machine-readable JSON catalogue (designed for AI agents).`));
88
- lines.push(dim(`Run \`vis ${payload.command} <subcommand> --help\` for full usage of a specific subcommand.`));
89
- return `${lines.join("\n")}
90
- `;
91
- };
92
-
93
- const loadDiscoverableSubcommands = async () => {
94
- const { default: aiCommands } = await import('./bin.js').then(n => n.ac);
95
- return aiCommands.filter((cmd) => cmd.name !== "ai");
96
- };
97
- const aiRootExecute = async () => {
98
- const subcommands = await loadDiscoverableSubcommands();
99
- process.stderr.write(renderDiscoveryText(subcommands));
100
- };
101
- const aiDiscoverHelpExecute = async () => {
102
- const subcommands = await loadDiscoverableSubcommands();
103
- process.stdout.write(renderDiscoveryJson(subcommands));
104
- };
105
- const aiTestExecute = async ({ logger, visConfig }) => {
106
- const aiConfig = visConfig?.ai;
107
- const provider = resolveProvider(aiConfig);
108
- if (!provider) {
109
- logger.error("No AI provider available to test.");
110
- process.exitCode = 1;
111
- return;
112
- }
113
- logger.info(`Testing ${provider.name}...`);
114
- try {
115
- const result = await runProvider(provider, "Reply with exactly: OK", { timeoutMs: 3e4 });
116
- logger.info(`Provider ${provider.name} responded: ${result.stdout.trim().slice(0, 200)}`);
117
- } catch (error) {
118
- const message = error instanceof Error ? error.message : String(error);
119
- logger.error(`Provider ${provider.name} failed: ${message}`);
120
- process.exitCode = 1;
121
- }
122
- };
123
- const aiProvidersExecute = ({ logger, options, visConfig }) => {
124
- const format = options.format ?? "table";
125
- const aiConfig = visConfig?.ai;
126
- const allProviders = detectAllProviders();
127
- const selected = resolveProvider(aiConfig);
128
- if (format === "json") {
129
- const output2 = allProviders.map((p) => {
130
- return {
131
- available: p.available,
132
- method: p.detectionMethod,
133
- name: p.name,
134
- path: p.path,
135
- priority: DEFAULT_PRIORITY[p.name] ?? 0,
136
- selected: p.name === selected?.name,
137
- version: p.version
138
- };
139
- });
140
- process.stdout.write(`${JSON.stringify(output2, void 0, 2)}
141
- `);
142
- return;
143
- }
144
- const tableData = allProviders.map((provider) => {
145
- return {
146
- method: provider.detectionMethod ?? "-",
147
- path: provider.path ?? "-",
148
- priority: String(DEFAULT_PRIORITY[provider.name] ?? 0),
149
- provider: provider.name,
150
- selected: provider.name === selected?.name ? ">>>" : "",
151
- status: provider.available ? "available" : "not found",
152
- version: provider.version ?? "-"
153
- };
154
- });
155
- const columns = process.stdout.columns || 80;
156
- const output = renderToString(React.createElement(Table, { data: tableData }), { columns });
157
- logger.info(output);
158
- if (selected) {
159
- logger.info(`
160
- Selected provider: ${selected.name} (priority ${String(DEFAULT_PRIORITY[selected.name] ?? 0)})`);
161
- } else {
162
- logger.info("\nNo AI provider available. Install one of the supported AI CLI tools.");
163
- }
164
- };
165
- const aiFixExecute = async (toolbox) => {
166
- const { aiFix } = await import('./fix.js');
167
- await aiFix(toolbox);
168
- };
169
-
170
- export { aiDiscoverHelpExecute, aiFixExecute, aiProvidersExecute, aiRootExecute, aiTestExecute };
1
+ var I=Object.defineProperty;var y=(e,t)=>I(e,"name",{value:t,configurable:!0});import{createRequire as D}from"node:module";import{getAffectedProjects as G}from"@visulima/task-runner";import{k as q,y as L}from"./bin.js";const T=D(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=y(e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,r]=h.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return h.getBuiltinModule(e)}return T(e)},"__cjs_getBuiltinModule"),{execFile:N}=A("node:child_process"),{promisify:U}=A("node:util");var V=Object.defineProperty,i=y((e,t)=>V(e,"name",{value:t,configurable:!0}),"t");const M=U(N),J=["[skip ci]","[ci skip]","[no ci]","[vis skip]","[nx skip]"],z=["[vis deploy]","[nx deploy]"],W=["vis","nx"],Z=["CACHED_COMMIT_REF","VERCEL_GIT_PREVIOUS_SHA","GITHUB_BASE_REF","CI_COMMIT_BEFORE_SHA"],K=/^[\w./~^@{}][\w.\-/~^@{}]*$/,Q=i((e=process.env)=>{for(const t of Z){const r=e[t];if(r&&r.trim().length>0)return r.trim()}},"resolveCiBaseSha"),R=i(e=>{if(!K.test(e))throw new Error(`Invalid git ref: "${e}". Refs must start with an alphanumeric character or one of _ . / ~ ^ @ { } and may only contain letters, digits, dots, dashes, underscores, slashes, tildes, carets, @, and braces.`)},"validateGitRef"),X=i(async(e,t)=>{try{return await M("git",["rev-parse","--verify",`${t}^{commit}`],{cwd:e}),!0}catch{return!1}},"isRefReachable"),Y=i(async e=>{try{const{stdout:t}=await M("git",["log","-1","--pretty=%B"],{cwd:e});return t}catch{return""}},"readLastCommitMessage"),B=i((e,t,r)=>W.some(a=>e.includes(`[${a} ${t} ${r}]`)),"matchesPerProjectToken"),ee=i((e,t)=>J.some(r=>e.includes(r))||B(e,"skip",t),"commitHasSkipMessage"),te=i((e,t)=>z.some(r=>e.includes(r))||B(e,"deploy",t),"commitHasForceDeployMessage"),l=i((e,t,r,a)=>({action:"build",message:r,project:e,reason:t,...a}),"decideBuild"),v=i((e,t,r,a)=>({action:"skip",message:r,project:e,reason:t,...a}),"decideSkip"),re=i(e=>`${e.action==="skip"?"🛑":"✅"} ${e.message}`,"formatDecisionLine"),oe=i((e,t)=>e.action==="skip"||t?0:1,"exitCodeFor");var se=Object.defineProperty,_=y((e,t)=>se(e,"name",{value:t,configurable:!0}),"u");const S=new Set(["deep","direct","none"]),de=_(async({argument:e,logger:t,options:r,visConfig:a,workspaceRoot:p})=>{const o=e[0]??"",E=!!r.json,C=!!r.verbose,O=!!(r["exit-zero-on-build"]??r.exitZeroOnBuild),u=_(s=>{C&&!E&&t.info(`❱ ${s}`)},"debug"),n=_(s=>{E?process.stdout.write(`${JSON.stringify(s)}
2
+ `):t.info(re(s)),process.exit(oe(s,O))},"emit");if(!o)return n(l("","missing-project-argument","Missing project argument. Usage: vis ignore <project>"));if(!p)return n(l(o,"workspace-error","Could not determine workspace root — building defensively"));const g=await Y(p),w=g.trim().split(`
3
+ `)[0]??"";if(u(`commit: ${w}`),g&&te(g,o))return n(l(o,"commit-force-deploy",`Force-deploy keyword in commit: "${w}"`));if(g&&ee(g,o))return n(v(o,"commit-skip",`Skip keyword in commit: "${w}"`));let $,P;try{({packageJsons:P,workspace:$}=q(p,a))}catch(s){const d=s instanceof Error?s.message:String(s);return n(l(o,"workspace-error",`Workspace discovery failed (${d}) — building defensively`))}if(!Object.hasOwn($.projects,o))return n(l(o,"project-unknown",`Project "${o}" not found in workspace — building defensively`));try{const s=r.base?.trim(),d=Q();let c=s||d||"HEAD~1";const m=r.head?.trim()||"HEAD";R(c),R(m),u(`resolved base ref: ${c} (source: ${s?"flag":d?"ci-env":"default"})`);const x=X(p,c),F=L(p,$,P);await x||(u(`base ref ${c} not reachable — falling back to HEAD~1`),c="HEAD~1"),u(`comparing ${c}...${m}`);const j=r.downstream??"deep",b=r.upstream??"none";if(!S.has(j))throw new Error(`Invalid --downstream value: "${j}". Must be "none", "direct", or "deep".`);if(!S.has(b))throw new Error(`Invalid --upstream value: "${b}". Must be "none", "direct", or "deep".`);const H={base:c,downstream:j,head:m,projectGraph:F,projects:$.projects,upstream:b,workspaceRoot:p},f=await G(H);u(`changed files: ${f.changedFiles.length}`),u(`affected projects: ${f.affectedProjects.join(", ")||"(none)"}`);const k={base:c,head:m};return f.changedFiles.length===0?n(v(o,"no-changes",`No files changed between ${c}...${m}`,{...k,affectedProjects:[]})):f.affectedProjects.includes(o)?n(l(o,"project-affected",`Build ${o}: affected by ${f.changedFiles.length} changed file(s)`,{...k,affectedProjects:f.affectedProjects})):n(v(o,"project-not-affected",`Skip ${o}: not affected by changes between ${c}...${m}`,{...k,affectedProjects:f.affectedProjects}))}catch(s){const d=s instanceof Error?s.message:String(s);return t.error(`Affected detection failed: ${d}`),n(l(o,"workspace-error",`Affected detection failed (${d}) — building defensively`))}},"execute");export{de as default};