@arvoretech/hub 0.8.0 → 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
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
checkAndAutoRegenerate,
|
|
4
4
|
generateCommand,
|
|
5
5
|
loadHubConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-T2UKYK2B.js";
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
9
|
import { Command as Command19 } from "commander";
|
|
@@ -3102,7 +3102,7 @@ async function syncAssets(hubDir, assets) {
|
|
|
3102
3102
|
}
|
|
3103
3103
|
}
|
|
3104
3104
|
}
|
|
3105
|
-
var scanCommand = new Command18("scan").description("Detect git repositories not registered in hub.yaml").option("-y, --yes", "Auto-add all found repos without prompting").action(async (opts) => {
|
|
3105
|
+
var scanCommand = new Command18("scan").description("Detect git repositories not registered in hub.yaml").option("-y, --yes", "Auto-add all found repos without prompting").option("--check", "Check for unsynced assets without prompting (exit code 1 if found)").action(async (opts) => {
|
|
3106
3106
|
const hubDir = process.cwd();
|
|
3107
3107
|
const configPath = join17(hubDir, "hub.yaml");
|
|
3108
3108
|
if (!existsSync14(configPath)) {
|
|
@@ -3111,6 +3111,23 @@ var scanCommand = new Command18("scan").description("Detect git repositories not
|
|
|
3111
3111
|
}
|
|
3112
3112
|
const content = await readFile8(configPath, "utf-8");
|
|
3113
3113
|
const config = parse2(content);
|
|
3114
|
+
if (opts.check) {
|
|
3115
|
+
const unregistered2 = await findUnregisteredRepos(hubDir, config);
|
|
3116
|
+
const unsyncedAssets2 = await findUnsyncedAssets(hubDir);
|
|
3117
|
+
const total = unregistered2.length + unsyncedAssets2.length;
|
|
3118
|
+
if (total > 0) {
|
|
3119
|
+
if (unregistered2.length > 0) {
|
|
3120
|
+
console.log(chalk18.yellow(`Found ${unregistered2.length} unregistered repo(s): ${unregistered2.join(", ")}`));
|
|
3121
|
+
}
|
|
3122
|
+
if (unsyncedAssets2.length > 0) {
|
|
3123
|
+
console.log(chalk18.yellow(`Found ${unsyncedAssets2.length} unsynced asset(s): ${unsyncedAssets2.map((a) => a.name).join(", ")}`));
|
|
3124
|
+
}
|
|
3125
|
+
console.log(chalk18.yellow("Run 'hub scan' to sync."));
|
|
3126
|
+
process.exit(1);
|
|
3127
|
+
}
|
|
3128
|
+
console.log(chalk18.green("All repos and assets are synced."));
|
|
3129
|
+
return;
|
|
3130
|
+
}
|
|
3114
3131
|
let hasChanges = false;
|
|
3115
3132
|
console.log(chalk18.blue("\nScanning for unregistered repositories...\n"));
|
|
3116
3133
|
const unregistered = await findUnregisteredRepos(hubDir, config);
|