tycono 0.1.19 → 0.1.20
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.
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Router, Request, Response, NextFunction } from 'express';
|
|
2
|
-
import
|
|
2
|
+
import YAML from 'yaml';
|
|
3
|
+
import { readFile, fileExists } from '../services/file-reader.js';
|
|
3
4
|
import { parseMarkdownTable, extractBoldKeyValues } from '../services/markdown-parser.js';
|
|
4
5
|
|
|
5
6
|
export const companyRouter = Router();
|
|
@@ -19,13 +20,27 @@ companyRouter.get('/', (_req: Request, res: Response, next: NextFunction) => {
|
|
|
19
20
|
const roleRows = parseMarkdownTable(rolesContent);
|
|
20
21
|
const roles = roleRows
|
|
21
22
|
.filter(row => (row.id ?? '').toLowerCase() !== 'ceo')
|
|
22
|
-
.map(row =>
|
|
23
|
-
id
|
|
24
|
-
name
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
.map(row => {
|
|
24
|
+
const id = row.id ?? '';
|
|
25
|
+
let name = row.role ?? row.name ?? '';
|
|
26
|
+
|
|
27
|
+
// role.yaml의 name이 있으면 우선 사용 (커스텀 이름 반영)
|
|
28
|
+
const yamlPath = `roles/${id}/role.yaml`;
|
|
29
|
+
if (id && fileExists(yamlPath)) {
|
|
30
|
+
try {
|
|
31
|
+
const raw = YAML.parse(readFile(yamlPath)) as Record<string, unknown>;
|
|
32
|
+
if (raw.name) name = raw.name as string;
|
|
33
|
+
} catch { /* fallback to roles.md name */ }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
id,
|
|
38
|
+
name,
|
|
39
|
+
level: row.level ?? '',
|
|
40
|
+
reportsTo: row.reports_to ?? '',
|
|
41
|
+
status: row.상태 ?? row.status ?? '',
|
|
42
|
+
};
|
|
43
|
+
});
|
|
29
44
|
|
|
30
45
|
const company = {
|
|
31
46
|
name: companyContent.split('\n').find(l => l.startsWith('# '))?.replace(/^#\s+/, '') ?? '',
|