diff --git a/PLANE-SYNC-GUIDE.md b/PLANE-SYNC-GUIDE.md index 19c504c..d318f23 100644 --- a/PLANE-SYNC-GUIDE.md +++ b/PLANE-SYNC-GUIDE.md @@ -52,13 +52,13 @@ node plane-sync.js --help # súgó ## ⚙️ **Konfiguráció** -**Precedencia**: `.env` > `.mcp.json` (`mcpServers.plane.env`) +**Precedencia**: a `PLANE_WORKSPACE_SLUG` esetén a projekt `.mcp.json` értéke elsőbbséget élvez a külső környezetből örökölt változóval szemben, majd a projektalapértelmezés következik (`developments`). A többi változónál `.env` > `.mcp.json` (`mcpServers.plane.env`). | Változó | Forrás | Leírás | | --- | --- | --- | | `PLANE_API_KEY` | `.mcp.json` / `.env` | Plane API kulcs | | `PLANE_API_HOST_URL` | `.mcp.json` / `.env` | Plane URL (alap: `https://pm.llmdev.mozdit.hu/`) | -| `PLANE_WORKSPACE_SLUG` | `.mcp.json` / `.env` | Workspace slug (alap: `developments`) | +| `PLANE_WORKSPACE_SLUG` | `.mcp.json` > `.env`/környezet | Workspace slug (projektalapértelmezés: `developments`) | | `PLANE_PROJECT_ID` | `.env` | Projekt ID (alap: MITHOME `643f7055-1237-4912-912f-99ec49fd0f0e`) | A kulcs elsődlegesen a `.mcp.json`-ban van (gitignore-olt) — a script ezt használja, így nincs duplikáció. diff --git a/scripts/plane/config.js b/scripts/plane/config.js index 1392f9d..77e895a 100644 --- a/scripts/plane/config.js +++ b/scripts/plane/config.js @@ -7,6 +7,7 @@ const MCP_PATH = path.join(__dirname, '..', '..', '.mcp.json'); const DEFAULT_PROJECT_ID = '643f7055-1237-4912-912f-99ec49fd0f0e'; const DEFAULT_PROJECT_IDENTIFIER = 'MITHOME'; +const DEFAULT_WORKSPACE_SLUG = 'developments'; function loadDotEnv() { try { @@ -44,10 +45,16 @@ function getConfig() { return { apiKey: process.env.PLANE_API_KEY || mcp.PLANE_API_KEY, host: (process.env.PLANE_API_HOST_URL || mcp.PLANE_API_HOST_URL || 'https://pm.llmdev.mozdit.hu/').replace(/\/+$/, ''), - workspace: process.env.PLANE_WORKSPACE_SLUG || mcp.PLANE_WORKSPACE_SLUG, + workspace: resolveWorkspaceSlug(process.env, mcp), projectId: process.env.PLANE_PROJECT_ID || DEFAULT_PROJECT_ID, projectIdentifier: process.env.PLANE_PROJECT_IDENTIFIER || DEFAULT_PROJECT_IDENTIFIER }; } -module.exports = { getConfig, loadDotEnv }; +function resolveWorkspaceSlug(environment, mcpConfig) { + // DECISION: workspace is project-scoped; prefer this repo's MCP config over + // a workspace slug inherited from another active Conductor connection. + return mcpConfig.PLANE_WORKSPACE_SLUG || environment.PLANE_WORKSPACE_SLUG || DEFAULT_WORKSPACE_SLUG; +} + +module.exports = { getConfig, loadDotEnv, resolveWorkspaceSlug }; diff --git a/scripts/plane/plane-sync.test.js b/scripts/plane/plane-sync.test.js index 35e14b4..e483186 100644 --- a/scripts/plane/plane-sync.test.js +++ b/scripts/plane/plane-sync.test.js @@ -3,6 +3,7 @@ const assert = require('node:assert/strict'); const { parseTodoFile, buildTable, regenerate, seqNum, SECTIONS } = require('./todo'); const { groupToSection, buildDiscrepancies, buildFinalSections } = require('./sync'); +const { resolveWorkspaceSlug } = require('./config'); const SAMPLE_TODO = `# mozdIT Weboldal @@ -47,6 +48,19 @@ Next.js 15 alapú weboldal. - **Frontend**: Next.js 15 `; +test('resolveWorkspaceSlug defaults to the project workspace', () => { + assert.equal(resolveWorkspaceSlug({}, {}), 'developments'); +}); + +test('resolveWorkspaceSlug prefers the project MCP config over inherited environment', () => { + assert.equal(resolveWorkspaceSlug({ PLANE_WORKSPACE_SLUG: 'priws' }, { PLANE_WORKSPACE_SLUG: 'developments' }), 'developments'); +}); + +test('resolveWorkspaceSlug uses the environment when no project config is present', () => { + assert.equal(resolveWorkspaceSlug({ PLANE_WORKSPACE_SLUG: 'custom' }, {}), 'custom'); + assert.equal(resolveWorkspaceSlug({}, { PLANE_WORKSPACE_SLUG: 'mcp' }), 'mcp'); +}); + test('parseTodoFile parses sections and rows with notes', () => { const { sections, rows } = parseTodoFile(SAMPLE_TODO); assert.equal(sections.completed.rows.length, 2);