@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.
- package/CHANGELOG.md +95 -42
- package/LICENSE.md +213 -0
- package/README.md +8 -4
- package/dist/bin.js +9 -1
- package/dist/config/index.d.ts +1818 -0
- package/dist/config/index.js +2 -0
- package/dist/generate/index.d.ts +1 -1
- package/dist/generate/index.js +3 -1
- package/dist/packem_chunks/applyDefaults.js +336 -0
- package/dist/packem_chunks/bin.js +9554 -64
- package/dist/packem_chunks/doctor-probe.js +112 -0
- package/dist/packem_chunks/fix.js +229 -48
- package/dist/packem_chunks/handler.js +99 -1
- package/dist/packem_chunks/handler10.js +53 -1
- package/dist/packem_chunks/handler11.js +32 -1
- package/dist/packem_chunks/handler12.js +100 -2
- package/dist/packem_chunks/handler13.js +25 -1
- package/dist/packem_chunks/handler14.js +916 -5
- package/dist/packem_chunks/handler15.js +206 -1
- package/dist/packem_chunks/handler16.js +122 -18
- package/dist/packem_chunks/handler17.js +13 -1
- package/dist/packem_chunks/handler18.js +106 -1
- package/dist/packem_chunks/handler19.js +19 -1
- package/dist/packem_chunks/handler2.js +75 -1
- package/dist/packem_chunks/handler20.js +29 -1
- package/dist/packem_chunks/handler21.js +222 -1
- package/dist/packem_chunks/handler22.js +237 -5
- package/dist/packem_chunks/handler23.js +101 -1
- package/dist/packem_chunks/handler24.js +110 -1
- package/dist/packem_chunks/handler25.js +402 -5
- package/dist/packem_chunks/handler26.js +13 -1
- package/dist/packem_chunks/handler27.js +63 -3
- package/dist/packem_chunks/handler28.js +34 -1
- package/dist/packem_chunks/handler29.js +458 -7
- package/dist/packem_chunks/handler3.js +95 -2
- package/dist/packem_chunks/handler30.js +168 -21
- package/dist/packem_chunks/handler31.js +530 -3
- package/dist/packem_chunks/handler32.js +214 -2
- package/dist/packem_chunks/handler33.js +119 -24
- package/dist/packem_chunks/handler34.js +630 -2
- package/dist/packem_chunks/handler35.js +283 -19
- package/dist/packem_chunks/handler36.js +521 -407
- package/dist/packem_chunks/handler37.js +762 -22
- package/dist/packem_chunks/handler38.js +989 -22
- package/dist/packem_chunks/handler39.js +574 -22
- package/dist/packem_chunks/handler4.js +90 -4
- package/dist/packem_chunks/handler40.js +1685 -3
- package/dist/packem_chunks/handler41.js +1088 -10
- package/dist/packem_chunks/handler42.js +785 -141
- package/dist/packem_chunks/handler43.js +2658 -42
- package/dist/packem_chunks/handler44.js +3886 -3
- package/dist/packem_chunks/handler45.js +2568 -21
- package/dist/packem_chunks/handler46.js +3769 -0
- package/dist/packem_chunks/handler47.js +1491 -0
- package/dist/packem_chunks/handler5.js +174 -2
- package/dist/packem_chunks/handler6.js +95 -13
- package/dist/packem_chunks/handler7.js +115 -8
- package/dist/packem_chunks/handler8.js +12 -1
- package/dist/packem_chunks/handler9.js +29 -1
- package/dist/packem_chunks/heal-accept.js +522 -0
- package/dist/packem_chunks/heal.js +673 -0
- package/dist/packem_chunks/index.js +873 -7
- package/dist/packem_chunks/loader.js +23 -1
- package/dist/packem_shared/VisUpdateApp-D-Yz_wvg.js +1316 -0
- package/dist/packem_shared/_commonjsHelpers-BqLXS_qQ.js +5 -0
- package/dist/packem_shared/ai-analysis-CHeB1joD.js +367 -0
- package/dist/packem_shared/ai-cache-Be_jexe4.js +142 -0
- package/dist/packem_shared/ai-fix-B9iQVcD2.js +379 -0
- package/dist/packem_shared/cache-directory-2qvs4goY.js +98 -0
- package/dist/packem_shared/catalog-BJTtyi-O.js +1371 -0
- package/dist/packem_shared/dependency-scan-A0KSklpG.js +188 -0
- package/dist/packem_shared/docker-2iZzc280.js +181 -0
- package/dist/packem_shared/failure-log-Cz3Z4SKL.js +100 -0
- package/dist/packem_shared/flakiness-goTxXuCX.js +180 -0
- package/dist/packem_shared/otel-DCvqCTz_.js +158 -0
- package/dist/packem_shared/otelPlugin-DFaLDvJf.js +3 -0
- package/dist/packem_shared/registry-CbqXI0rc.js +272 -0
- package/dist/packem_shared/run-summary-utils-PVMl4aIh.js +130 -0
- package/dist/packem_shared/runtime-check-Cobi3p6l.js +127 -0
- package/dist/packem_shared/selectors-SM69TfqC.js +194 -0
- package/dist/packem_shared/symbols-Ta7g2nU-.js +14 -0
- package/dist/packem_shared/toolchain-BdZd9eBi.js +975 -0
- package/dist/packem_shared/typosquats-C-bCh3PX.js +1210 -0
- package/dist/packem_shared/use-measured-height-CNP0vT4M.js +20 -0
- package/dist/packem_shared/utils-CthVdBPS.js +40 -0
- package/dist/packem_shared/xxh3-Ck8mXNg1.js +239 -0
- package/index.js +727 -555
- package/package.json +35 -17
- package/schemas/project.schema.json +8 -10
- package/schemas/vis-config.schema.json +132 -8
- package/skills/vis/SKILL.md +96 -0
- package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
- package/templates/buildkite-ci/template.yml +20 -0
- package/dist/errors/index.d.ts +0 -26
- package/dist/errors/index.js +0 -1
- package/dist/packem_chunks/config.js +0 -2
- package/dist/packem_shared/VisConfigCycleError-CAYNC7d-.js +0 -1
- package/dist/packem_shared/VisConfigError-B5LP1zRf.js +0 -1
- package/dist/packem_shared/VisConfigLoadError-CeqBSd2Z.js +0 -2
- package/dist/packem_shared/VisConfigNotFoundError-DZ9KC527.js +0 -5
- package/dist/packem_shared/VisUpdateApp-D-L4_-Iu.js +0 -1
- package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +0 -1
- package/dist/packem_shared/ai-analysis-CGuy7dfE.js +0 -67
- package/dist/packem_shared/ai-cache-Bynt6Y9x.js +0 -1
- package/dist/packem_shared/cache-directory-D72ZEag2.js +0 -1
- package/dist/packem_shared/catalog-BVPerCwG.js +0 -12
- package/dist/packem_shared/dependency-scan-Du0tBu64.js +0 -2
- package/dist/packem_shared/docker-BcfqH4Av.js +0 -2
- package/dist/packem_shared/failure-log-DqYen0LC.js +0 -2
- package/dist/packem_shared/flakiness-DSIHZGBT.js +0 -1
- package/dist/packem_shared/run-summary-utils-C24Aaf9E.js +0 -1
- package/dist/packem_shared/runtime-check-CGHal8SO.js +0 -1
- package/dist/packem_shared/selectors-CfH9ZY08.js +0 -3
- package/dist/packem_shared/symbols-CQmER5MT.js +0 -1
- package/dist/packem_shared/target-merge-DNa-6eWu.js +0 -1
- package/dist/packem_shared/toolchain-DQfTQY8E.js +0 -5
- package/dist/packem_shared/typosquats-DOR8izpX.js +0 -1
- package/dist/packem_shared/use-measured-height-DjYgUOKk.js +0 -1
- package/dist/packem_shared/utils-DrNg0XTR.js +0 -1
- package/dist/packem_shared/xxh3-DrAUNq4n.js +0 -1
|
@@ -1,23 +1,170 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
};
|
|
15
92
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 };
|