@arvoretech/hub 0.8.1 → 0.8.2
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.
|
@@ -121,7 +121,7 @@ async function checkAndAutoRegenerate(hubDir) {
|
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
console.log(chalk.yellow("\n Detected outdated configs, auto-regenerating..."));
|
|
124
|
-
const { generators: generators2 } = await import("./generate-
|
|
124
|
+
const { generators: generators2 } = await import("./generate-7YPRUSN5.js");
|
|
125
125
|
const generator = generators2[result.editor];
|
|
126
126
|
if (!generator) {
|
|
127
127
|
console.log(chalk.red(` Unknown editor '${result.editor}' in cache. Run 'hub generate' manually.`));
|
|
@@ -1798,6 +1798,47 @@ async function generateVSCodeSettings(config, hubDir) {
|
|
|
1798
1798
|
await writeFile2(workspacePath, JSON.stringify(workspace, null, " ") + "\n", "utf-8");
|
|
1799
1799
|
console.log(chalk2.green(` Generated ${workspaceFile}`));
|
|
1800
1800
|
}
|
|
1801
|
+
function extractEnvVarsByMcp(mcps) {
|
|
1802
|
+
const envVarPattern = /\$\{env:([^}]+)\}/;
|
|
1803
|
+
const groups = [];
|
|
1804
|
+
for (const mcp of mcps) {
|
|
1805
|
+
if (!mcp.env) continue;
|
|
1806
|
+
const vars = [];
|
|
1807
|
+
const seenInGroup = /* @__PURE__ */ new Set();
|
|
1808
|
+
for (const value of Object.values(mcp.env)) {
|
|
1809
|
+
const match = envVarPattern.exec(value);
|
|
1810
|
+
if (match && !seenInGroup.has(match[1])) {
|
|
1811
|
+
seenInGroup.add(match[1]);
|
|
1812
|
+
vars.push(match[1]);
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
if (vars.length > 0) {
|
|
1816
|
+
groups.push({ name: mcp.name, vars: vars.sort() });
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
return groups;
|
|
1820
|
+
}
|
|
1821
|
+
async function generateEnvExample(config, hubDir) {
|
|
1822
|
+
if (!config.mcps?.length) return;
|
|
1823
|
+
const groups = extractEnvVarsByMcp(config.mcps);
|
|
1824
|
+
if (groups.length === 0) return;
|
|
1825
|
+
let totalVars = 0;
|
|
1826
|
+
const lines = [];
|
|
1827
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1828
|
+
for (const group of groups) {
|
|
1829
|
+
const uniqueVars = group.vars.filter((v) => !seen.has(v));
|
|
1830
|
+
if (uniqueVars.length === 0) continue;
|
|
1831
|
+
for (const v of uniqueVars) seen.add(v);
|
|
1832
|
+
if (lines.length > 0) lines.push("");
|
|
1833
|
+
lines.push(`# ${group.name}`);
|
|
1834
|
+
for (const v of uniqueVars) {
|
|
1835
|
+
lines.push(`${v}=`);
|
|
1836
|
+
}
|
|
1837
|
+
totalVars += uniqueVars.length;
|
|
1838
|
+
}
|
|
1839
|
+
await writeFile2(join3(hubDir, ".env.example"), lines.join("\n") + "\n", "utf-8");
|
|
1840
|
+
console.log(chalk2.green(` Generated .env.example (${totalVars} vars)`));
|
|
1841
|
+
}
|
|
1801
1842
|
function buildGitignoreLines(config) {
|
|
1802
1843
|
const lines = [
|
|
1803
1844
|
"node_modules/",
|
|
@@ -1928,6 +1969,7 @@ var generateCommand = new Command("generate").description("Generate editor-speci
|
|
|
1928
1969
|
Generating ${generator.name} configuration
|
|
1929
1970
|
`));
|
|
1930
1971
|
await generator.generate(config, hubDir);
|
|
1972
|
+
await generateEnvExample(config, hubDir);
|
|
1931
1973
|
await saveGenerateState(hubDir, editorKey);
|
|
1932
1974
|
console.log(chalk2.green("\nDone!\n"));
|
|
1933
1975
|
});
|
package/dist/index.js
CHANGED