Public Access
b73c1eba25
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
Generic: Project CI / Tests (pull_request) Has been cancelled
Platform: mokoplatform CI / Gate 2: Unit Tests (8.1) (pull_request) Has been cancelled
Platform: mokoplatform CI / Gate 2: Unit Tests (8.2) (pull_request) Has been cancelled
Platform: mokoplatform CI / Gate 2: Unit Tests (8.3) (pull_request) Has been cancelled
Platform: mokoplatform CI / Gate 3: Self-Health Check (pull_request) Has been cancelled
Platform: mokoplatform CI / Gate 4: Governance (pull_request) Has been cancelled
Platform: mokoplatform CI / Gate 5: Template Integrity (pull_request) Has been cancelled
Platform: mokoplatform CI / CI Summary (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Site Health (push) Has been cancelled
Generic: Repo Health / Access control (push) Has been cancelled
Generic: Repo Health / Site Health (pull_request) Has been cancelled
Universal: PR Check / Branch Policy (pull_request) Has been cancelled
Generic: Repo Health / Access control (pull_request) Has been cancelled
Universal: Build & Release / Promote to RC (pull_request) Has been cancelled
RC Revert / Rename rc/ back to dev/ (pull_request) Has been cancelled
Universal: Security Audit / Dependency Audit (pull_request) Has been cancelled
Branch Cleanup / Delete merged branch (pull_request) Has been cancelled
Universal: Secret Scanning / Gitleaks Secret Scan (pull_request) Has been cancelled
Universal: PR Check / Validate PR (pull_request) Has been cancelled
Universal: Build & Release / Build & Release Pipeline (pull_request) Has been cancelled
Generic: Project CI / Lint & Validate (pull_request) Has been cancelled
Platform: mokoplatform CI / Gate 1: Code Quality (pull_request) Has been cancelled
Scans source files to detect platform, name, version, element_name, package_type, language, entry_point, description, and license_spdx. Supports Joomla, Dolibarr, Go, MCP/Node, and generic platforms. Includes --diff and --update modes for comparing against and pushing to the Gitea manifest API. Warns on missing core fields. Also removes deprecated mcp/servers/mokowaas_api (consolidated to separate repo) and syncs dev branch changes.
120 lines
3.5 KiB
JavaScript
120 lines
3.5 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: joomla-api-mcp.Scripts
|
|
* INGROUP: joomla-api-mcp
|
|
* REPO: https://git.mokoconsulting.tech/MokoConsulting/joomla-api-mcp
|
|
* PATH: /scripts/setup.mjs
|
|
* VERSION: 00.00.01
|
|
* BRIEF: Interactive setup — prompts for Joomla 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';
|
|
|
|
const CONFIG_PATH = resolve(homedir(), '.joomla-api-mcp.json');
|
|
|
|
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('=== joomla-api-mcp Setup ===');
|
|
console.log('');
|
|
console.log('This will create your configuration file at:');
|
|
console.log(` ${CONFIG_PATH}`);
|
|
console.log('');
|
|
|
|
// Check for existing config
|
|
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('Joomla site URL (e.g. https://www.example.com)');
|
|
const apiToken = await promptRequired('Joomla API token');
|
|
|
|
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, apiToken };
|
|
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();
|
|
// Re-run to add another
|
|
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);
|
|
});
|