36b642e23f
Universal: Cascade Main → Dev / Cascade main → branches (push) Successful in 1s
Universal: Changelog Validation / Validate CHANGELOG.md (push) Failing after 3s
Generic: Repo Health / Access control (push) Successful in 2s
MCP: Standards Compliance / Secret Scanning (push) Successful in 4s
MCP: Standards Compliance / Repository Structure Validation (push) Failing after 3s
MCP: Standards Compliance / License Header Validation (push) Failing after 4s
MCP: Standards Compliance / Coding Standards Check (push) Failing after 3s
MCP: Standards Compliance / Workflow Configuration Check (push) Failing after 4s
MCP: Standards Compliance / Documentation Quality Check (push) Failing after 3s
MCP: Tool Inventory / inventory (push) Failing after 16s
MCP: Standards Compliance / README Completeness Check (push) Failing after 3s
MCP: Standards Compliance / Git Repository Hygiene (push) Successful in 3s
MCP: Standards Compliance / Line Length Check (push) Failing after 5s
MCP: Standards Compliance / File Naming Standards (push) Successful in 4s
MCP: Build & Release / Build, Validate & Release (push) Failing after 33s
MCP: Standards Compliance / Insecure Code Pattern Detection (push) Successful in 5s
MCP: Build & Validate / build (20) (push) Failing after 41s
MCP: Build & Validate / build (22) (push) Failing after 41s
MCP: Standards Compliance / File Size Limits (push) Successful in 4s
MCP: Standards Compliance / Binary File Detection (push) Successful in 3s
MCP: Standards Compliance / Script Integrity Validation (push) Successful in 33s
MCP: Standards Compliance / TODO/FIXME Tracking (push) Successful in 3s
MCP: Standards Compliance / Version Consistency Check (push) Successful in 49s
MCP: Standards Compliance / Broken Link Detection (push) Successful in 4s
Universal: CodeQL Analysis / Analyze (actions) (push) Failing after 1m2s
MCP: Standards Compliance / Dead Code Detection (push) Successful in 20s
Universal: CodeQL Analysis / Analyze (javascript) (push) Failing after 1m5s
MCP: Standards Compliance / API Documentation Coverage (push) Successful in 5s
MCP: Standards Compliance / Accessibility Check (push) Successful in 4s
MCP: Standards Compliance / Performance Metrics (push) Successful in 4s
Universal: CodeQL Analysis / Security Scan Summary (push) Successful in 1s
MCP: Standards Compliance / Terraform Configuration Validation (push) Successful in 13s
MCP: Standards Compliance / Code Complexity Analysis (push) Successful in 46s
MCP: Standards Compliance / Code Duplication Detection (push) Successful in 46s
MCP: Standards Compliance / Unused Dependencies Check (push) Successful in 46s
MCP: Standards Compliance / Dependency Vulnerability Scanning (push) Successful in 48s
Universal: Sync Version on Merge / Propagate README version (push) Failing after 37s
MCP: Standards Compliance / Enterprise Readiness Check (push) Successful in 41s
MCP: Standards Compliance / Repository Health Check (push) Successful in 40s
MCP: Standards Compliance / Compliance Summary (push) Failing after 1s
Generic: Repo Health / Release configuration (push) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Authored-by: Moko Consulting
124 lines
4.1 KiB
JavaScript
124 lines
4.1 KiB
JavaScript
#!/usr/bin/env node
|
|
/* Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
*
|
|
* This file is part of a Moko Consulting project.
|
|
*
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*
|
|
* FILE INFORMATION
|
|
* DEFGROUP: mcp_windows.Scripts
|
|
* INGROUP: mcp_windows
|
|
* REPO: https://git.mokoconsulting.tech/MokoConsulting/mcp_windows
|
|
* PATH: /scripts/setup.mjs
|
|
* VERSION: 01.00.00
|
|
* BRIEF: Interactive setup — prompts for API connection details and writes config
|
|
*/
|
|
|
|
import { createInterface } from 'node:readline/promises';
|
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
import { resolve } from 'node:path';
|
|
import { homedir } from 'node:os';
|
|
|
|
// ── Customize these ─────────────────────────────────────────────────────
|
|
const PROJECT_NAME = 'mcp_windows';
|
|
const CONFIG_PATH = resolve(homedir(), `.${PROJECT_NAME}.json`);
|
|
const API_LABEL = 'Windows Desktop'; // e.g. "Dolibarr", "Joomla"
|
|
const AUTH_FIELD = 'apiKey'; // field name in config
|
|
const AUTH_PROMPT = 'API key'; // what to ask the user for
|
|
// ────────────────────────────────────────────────────────────────────────
|
|
|
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
|
|
async function prompt(question, defaultValue) {
|
|
const suffix = defaultValue ? ` [${defaultValue}]` : '';
|
|
const answer = await rl.question(`${question}${suffix}: `);
|
|
return answer.trim() || defaultValue || '';
|
|
}
|
|
|
|
async function promptRequired(question) {
|
|
let answer = '';
|
|
while (!answer) {
|
|
answer = (await rl.question(`${question}: `)).trim();
|
|
if (!answer) {
|
|
console.log(' This field is required.');
|
|
}
|
|
}
|
|
return answer;
|
|
}
|
|
|
|
async function main() {
|
|
console.log('');
|
|
console.log(`=== ${PROJECT_NAME} Setup ===`);
|
|
console.log('');
|
|
console.log('This will create your configuration file at:');
|
|
console.log(` ${CONFIG_PATH}`);
|
|
console.log('');
|
|
|
|
let existing = null;
|
|
try {
|
|
const raw = await readFile(CONFIG_PATH, 'utf-8');
|
|
existing = JSON.parse(raw);
|
|
console.log('Existing config found. You can add a new connection or overwrite.');
|
|
console.log(` Current connections: ${Object.keys(existing.connections).join(', ')}`);
|
|
console.log('');
|
|
} catch {
|
|
// No existing config
|
|
}
|
|
|
|
const connectionName = await prompt('Connection name', 'production');
|
|
const baseUrl = await promptRequired(`${API_LABEL} URL (e.g. https://api.example.com)`);
|
|
const authValue = await promptRequired(`${API_LABEL} ${AUTH_PROMPT}`);
|
|
|
|
const cleanUrl = baseUrl.replace(/\/+$/, '');
|
|
|
|
const insecureAnswer = await prompt('Skip TLS verification for self-signed certs? (y/N)', 'N');
|
|
const insecure = insecureAnswer.toLowerCase() === 'y';
|
|
|
|
const connection = { baseUrl: cleanUrl, [AUTH_FIELD]: authValue };
|
|
if (insecure) {
|
|
connection.insecure = true;
|
|
}
|
|
|
|
let config;
|
|
if (existing) {
|
|
config = existing;
|
|
config.connections[connectionName] = connection;
|
|
const setDefault = await prompt(`Set "${connectionName}" as default connection? (y/N)`, 'N');
|
|
if (setDefault.toLowerCase() === 'y') {
|
|
config.defaultConnection = connectionName;
|
|
}
|
|
} else {
|
|
config = {
|
|
defaultConnection: connectionName,
|
|
connections: {
|
|
[connectionName]: connection,
|
|
},
|
|
};
|
|
}
|
|
|
|
await writeFile(CONFIG_PATH, JSON.stringify(config, null, '\t') + '\n', 'utf-8');
|
|
|
|
console.log('');
|
|
console.log(`Config written to ${CONFIG_PATH}`);
|
|
console.log(` Connection "${connectionName}" configured for ${cleanUrl}`);
|
|
console.log('');
|
|
|
|
const addAnother = await prompt('Add another connection? (y/N)', 'N');
|
|
if (addAnother.toLowerCase() === 'y') {
|
|
rl.close();
|
|
const { execFileSync } = await import('node:child_process');
|
|
execFileSync('node', [new URL(import.meta.url).pathname], { stdio: 'inherit' });
|
|
return;
|
|
}
|
|
|
|
console.log('Setup complete. You can now use the MCP server.');
|
|
console.log('');
|
|
rl.close();
|
|
}
|
|
|
|
main().catch((err) => {
|
|
console.error(`Setup failed: ${err.message}`);
|
|
rl.close();
|
|
process.exit(1);
|
|
});
|