feat: xavis ai_platform 기능 이전 및 ncue 환경 전환

xavis 소스·DB 스키마·활용사례/F-Scan/프롬프트 라이브러리 등 기능 반영.
@xavis.co.kr → @ncue.net, 관리자 토큰 ncue-admin, 런타임 data/ Git 추적 제외.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dsyoon
2026-05-26 22:27:48 +09:00
parent 7bee72f287
commit 073a8343dd
84 changed files with 10883 additions and 1043 deletions

View File

@@ -142,9 +142,16 @@ function parseBulletItems(body) {
cur = null;
}
};
let inFootnote = false;
for (const raw of lines) {
const t = raw.trim();
if (!t) continue;
if (/^※/.test(t)) {
inFootnote = true;
flush();
continue;
}
if (inFootnote) continue;
let m = t.match(/^\s*[-*•]\s+\[([ xX✓])\]\s*(.+)$/);
if (m) {
flush();
@@ -205,6 +212,95 @@ function parseBulletItems(body) {
return items.filter((x) => x.title.length > 0);
}
/**
* 마크다운 표 행에서 셀 배열 추출 (`| a | b | c |` → ["a","b","c"])
* @param {string} line
* @returns {string[]}
*/
function parseTableCells(line) {
let s = String(line || "").trim();
if (/^\d+\s*\|/.test(s) && !s.startsWith("|")) s = "| " + s;
return s
.replace(/^\s*\|\s*/, "")
.replace(/\s*\|\s*$/, "")
.split("|")
.map((cell) => cell.trim());
}
/**
* 마크다운 표 구분선 행인지 판별 (각 셀이 `-`, `:`, 공백만 포함)
* @param {string} t - trim된 행
*/
function isTableSeparatorRow(t) {
const cells = t.replace(/^\s*\|\s*/, "").replace(/\s*\|\s*$/, "").split("|");
return cells.length > 0 && cells.every((c) => /^[\s:]*-+[\s:-]*$/.test(c.trim()) || c.trim() === "");
}
/**
* 마크다운 표 형식 액션 아이템 파싱 (# | 담당 | 내용 | 기한 구조)
* @param {string} body
* @returns {ParsedItem[]}
*/
function parseTableActionRows(body) {
if (!body || !body.trim()) return [];
const lines = body.split(/\r?\n/);
/** @type {string[]|null} */
let headers = null;
/** @type {ParsedItem[]} */
const out = [];
for (const raw of lines) {
const t = raw.trim();
if (!t) continue;
const isPipeRow = /^\|/.test(t) || /^\d+\s*\|/.test(t);
if (!isPipeRow) continue;
const tSep = /^\d+\s*\|/.test(t) && !t.startsWith("|") ? "| " + t : t;
if (isTableSeparatorRow(tSep)) continue;
const cells = parseTableCells(t);
if (!cells.length) continue;
if (headers === null) {
headers = cells.map((h) => h.toLowerCase());
continue;
}
const get = (keywords) => {
for (const kw of keywords) {
const idx = headers.findIndex((h) => h.includes(kw));
if (idx !== -1 && idx < cells.length) return cells[idx].trim();
}
return "";
};
let title = get(["내용", "항목", "task", "할 일"]);
let assignee = get(["담당", "assignee", "담당자"]);
let due_note = get(["기한", "due", "마감"]);
const numFirstCell =
cells.length >= 4 && /^\d+$/.test(String(cells[0] || "").trim());
const headerHasOrdinalCol = headers.some((h) => {
const x = String(h || "").trim().toLowerCase();
return x === "#" || x === "no" || /^no\.?$/.test(x) || x.includes("순번") || x.includes("번호");
});
/** 헤더에 '#'/순번 열이 빠져 있으나 데이터 줄은 순번 포함 4열 — 담당·내용·기한 순으로 해석 */
if (numFirstCell && !headerHasOrdinalCol && headers.length >= 3 && headers.length <= cells.length - 1) {
assignee = String(cells[1] || "").trim();
due_note = String(cells[cells.length - 1] || "").trim();
title = cells
.slice(2, cells.length - 1)
.join(" ")
.replace(/\s*\|\s*/g, " ")
.trim();
}
if (!title) continue;
out.push({
title: stripMd(title),
detail: "",
assignee: assignee || null,
due_note: due_note || null,
completed: false,
});
}
return out.filter((x) => x.title.length > 0);
}
/**
* 액션 아이템 번호 목록 블록 (담당/기한/할 일)
* @param {string} body
@@ -329,6 +425,8 @@ function parseItemsFromMinutes(generatedMinutes, mode = "checklist") {
if (mode === "actions") {
const section = extractActionSectionBody(text);
if (!section) return [];
const tableRows = parseTableActionRows(section);
if (tableRows.length) return tableRows;
const numbered = parseNumberedActionBlocks(section);
if (numbered.length) return numbered;
return parseBulletItems(section);
@@ -345,6 +443,9 @@ module.exports = {
extractActionSectionBody,
parseBulletItems,
parseNumberedActionBlocks,
parseTableCells,
parseTableActionRows,
isTableSeparatorRow,
parseItemsFromMinutes,
parseAllRuleBasedWorkItems,
CHECKLIST_HEADINGS,