@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.
- package/CHANGELOG.md +90 -0
- package/LICENSE.md +559 -186
- package/README.md +18 -0
- package/dist/bin.js +1 -9
- package/dist/config/index.d.ts +477 -556
- package/dist/config/index.js +1 -2
- package/dist/generate/index.js +1 -3
- package/dist/packem_chunks/applyDefaults.js +2 -336
- package/dist/packem_chunks/bin.js +234 -9552
- package/dist/packem_chunks/doctor-probe.js +2 -112
- package/dist/packem_chunks/fix.js +11 -234
- package/dist/packem_chunks/handler.js +1 -99
- package/dist/packem_chunks/handler10.js +2 -53
- package/dist/packem_chunks/handler11.js +1 -32
- package/dist/packem_chunks/handler12.js +5 -100
- package/dist/packem_chunks/handler13.js +1 -25
- package/dist/packem_chunks/handler14.js +18 -916
- package/dist/packem_chunks/handler15.js +15 -201
- package/dist/packem_chunks/handler16.js +1 -124
- package/dist/packem_chunks/handler17.js +1 -13
- package/dist/packem_chunks/handler18.js +1 -106
- package/dist/packem_chunks/handler19.js +1 -19
- package/dist/packem_chunks/handler2.js +2 -75
- package/dist/packem_chunks/handler20.js +5 -29
- package/dist/packem_chunks/handler21.js +1 -222
- package/dist/packem_chunks/handler22.js +1 -237
- package/dist/packem_chunks/handler23.js +5 -101
- package/dist/packem_chunks/handler24.js +1 -110
- package/dist/packem_chunks/handler25.js +3 -402
- package/dist/packem_chunks/handler26.js +1 -13
- package/dist/packem_chunks/handler27.js +1 -63
- package/dist/packem_chunks/handler28.js +7 -34
- package/dist/packem_chunks/handler29.js +21 -456
- package/dist/packem_chunks/handler3.js +4 -95
- package/dist/packem_chunks/handler30.js +3 -170
- package/dist/packem_chunks/handler31.js +1 -530
- package/dist/packem_chunks/handler32.js +2 -214
- package/dist/packem_chunks/handler33.js +25 -119
- package/dist/packem_chunks/handler34.js +2 -630
- package/dist/packem_chunks/handler35.js +3 -283
- package/dist/packem_chunks/handler36.js +22 -542
- package/dist/packem_chunks/handler37.js +410 -744
- package/dist/packem_chunks/handler38.js +22 -989
- package/dist/packem_chunks/handler39.js +22 -574
- package/dist/packem_chunks/handler4.js +2 -90
- package/dist/packem_chunks/handler40.js +22 -1685
- package/dist/packem_chunks/handler41.js +6 -1088
- package/dist/packem_chunks/handler42.js +5 -797
- package/dist/packem_chunks/handler43.js +10 -2658
- package/dist/packem_chunks/handler44.js +51 -3784
- package/dist/packem_chunks/handler45.js +25 -2574
- package/dist/packem_chunks/handler46.js +3 -3769
- package/dist/packem_chunks/handler47.js +21 -1485
- package/dist/packem_chunks/handler48.js +42 -0
- package/dist/packem_chunks/handler5.js +8 -174
- package/dist/packem_chunks/handler6.js +1 -95
- package/dist/packem_chunks/handler7.js +1 -115
- package/dist/packem_chunks/handler8.js +1 -12
- package/dist/packem_chunks/handler9.js +1 -29
- package/dist/packem_chunks/heal-accept.js +10 -522
- package/dist/packem_chunks/heal.js +14 -673
- package/dist/packem_chunks/index.js +7 -873
- package/dist/packem_chunks/loader.js +1 -23
- package/dist/packem_chunks/tar.js +3 -0
- package/dist/packem_shared/ai-analysis-hm8d2W7z.js +67 -0
- package/dist/packem_shared/ai-cache-DoiF80AR.js +1 -0
- package/dist/packem_shared/ai-fix-nn4zOE95.js +43 -0
- package/dist/packem_shared/cache-directory-CwHlJhgx.js +1 -0
- package/dist/packem_shared/dependency-scan-COr5n63B.js +2 -0
- package/dist/packem_shared/docker-D6OGr5_S.js +2 -0
- package/dist/packem_shared/failure-log-iUVLf6ts.js +2 -0
- package/dist/packem_shared/flakiness-D9wf0t56.js +1 -0
- package/dist/packem_shared/giget-CcEy_Elm.js +2 -0
- package/dist/packem_shared/index-DH-5hsrC.js +1 -0
- package/dist/packem_shared/otel-DxDUPJJH.js +6 -0
- package/dist/packem_shared/otelPlugin-CQq6poq8.js +1 -0
- package/dist/packem_shared/registry-CkubDdiY.js +2 -0
- package/dist/packem_shared/run-summary-utils-BfBvjzhY.js +1 -0
- package/dist/packem_shared/runtime-check-BXZ43CBW.js +1 -0
- package/dist/packem_shared/selectors-BylODRiM.js +3 -0
- package/dist/packem_shared/symbols-CQmER5MT.js +1 -0
- package/dist/packem_shared/toolchain-BgBOUHII.js +5 -0
- package/dist/packem_shared/typosquats-CcZl99B1.js +1 -0
- package/dist/packem_shared/use-measured-height-DjYgUOKk.js +1 -0
- package/dist/packem_shared/utils-DrNg0XTR.js +1 -0
- package/dist/packem_shared/verify-Baj5mFJ7.js +1 -0
- package/dist/packem_shared/vis-update-app-D1jl0UZZ.js +1 -0
- package/dist/packem_shared/xxh3-DrAUNq4n.js +1 -0
- package/index.js +556 -727
- package/package.json +19 -29
- package/schemas/project.schema.json +739 -297
- package/schemas/vis-config.schema.json +3365 -384
- package/templates/buildkite-ci/template.yml +20 -20
- package/dist/packem_shared/VisUpdateApp-D-Yz_wvg.js +0 -1316
- package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +0 -5
- package/dist/packem_shared/ai-analysis-CHeB1joD.js +0 -367
- package/dist/packem_shared/ai-cache-Be_jexe4.js +0 -142
- package/dist/packem_shared/ai-fix-B9iQVcD2.js +0 -379
- package/dist/packem_shared/cache-directory-2qvs4goY.js +0 -98
- package/dist/packem_shared/catalog-BJTtyi-O.js +0 -1371
- package/dist/packem_shared/dependency-scan-A0KSklpG.js +0 -188
- package/dist/packem_shared/docker-2iZzc280.js +0 -181
- package/dist/packem_shared/failure-log-Cz3Z4SKL.js +0 -100
- package/dist/packem_shared/flakiness-goTxXuCX.js +0 -180
- package/dist/packem_shared/otel-DCvqCTz_.js +0 -158
- package/dist/packem_shared/otelPlugin-DFaLDvJf.js +0 -3
- package/dist/packem_shared/registry-CbqXI0rc.js +0 -272
- package/dist/packem_shared/run-summary-utils-PVMl4aIh.js +0 -130
- package/dist/packem_shared/runtime-check-Cobi3p6l.js +0 -127
- package/dist/packem_shared/selectors-SM69TfqC.js +0 -194
- package/dist/packem_shared/symbols-Ta7g2nU-.js +0 -14
- package/dist/packem_shared/toolchain-BdZd9eBi.js +0 -975
- package/dist/packem_shared/typosquats-C-bCh3PX.js +0 -1210
- package/dist/packem_shared/use-measured-height-CNP0vT4M.js +0 -20
- package/dist/packem_shared/utils-CthVdBPS.js +0 -40
- package/dist/packem_shared/xxh3-Ck8mXNg1.js +0 -239
|
@@ -1,170 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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};
|