tycono 0.1.11 → 0.1.12
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 +1 -1
- package/src/api/src/routes/roles.ts +24 -8
package/package.json
CHANGED
|
@@ -11,13 +11,27 @@ rolesRouter.get('/', (_req: Request, res: Response, next: NextFunction) => {
|
|
|
11
11
|
const content = readFile('roles/roles.md');
|
|
12
12
|
const rows = parseMarkdownTable(content);
|
|
13
13
|
|
|
14
|
-
const roles = rows.map(row =>
|
|
15
|
-
id
|
|
16
|
-
name
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
const roles = rows.map(row => {
|
|
15
|
+
const id = row.id ?? '';
|
|
16
|
+
let name = row.role ?? row.name ?? '';
|
|
17
|
+
|
|
18
|
+
// role.yaml의 name이 있으면 우선 사용 (rename 반영)
|
|
19
|
+
const yamlPath = `roles/${id}/role.yaml`;
|
|
20
|
+
if (id && fileExists(yamlPath)) {
|
|
21
|
+
try {
|
|
22
|
+
const raw = YAML.parse(readFile(yamlPath)) as Record<string, unknown>;
|
|
23
|
+
if (raw.name) name = raw.name as string;
|
|
24
|
+
} catch { /* fallback to roles.md name */ }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
id,
|
|
29
|
+
name,
|
|
30
|
+
level: row.level ?? '',
|
|
31
|
+
reportsTo: row.reports_to ?? '',
|
|
32
|
+
status: row.상태 ?? row.status ?? '',
|
|
33
|
+
};
|
|
34
|
+
});
|
|
21
35
|
|
|
22
36
|
res.json(roles);
|
|
23
37
|
} catch (err) {
|
|
@@ -51,11 +65,13 @@ rolesRouter.get('/:id', (req: Request, res: Response, next: NextFunction) => {
|
|
|
51
65
|
journal: '',
|
|
52
66
|
};
|
|
53
67
|
|
|
54
|
-
// role.yaml에서 persona + authority 읽기
|
|
68
|
+
// role.yaml에서 name + persona + authority + skills 읽기
|
|
55
69
|
const yamlPath = `roles/${id}/role.yaml`;
|
|
56
70
|
if (fileExists(yamlPath)) {
|
|
57
71
|
const raw = YAML.parse(readFile(yamlPath)) as Record<string, unknown>;
|
|
72
|
+
if (raw.name) role.name = raw.name;
|
|
58
73
|
if (raw.persona) role.persona = raw.persona;
|
|
74
|
+
if (Array.isArray(raw.skills)) role.skills = raw.skills;
|
|
59
75
|
const auth = raw.authority as Record<string, string[]> | undefined;
|
|
60
76
|
if (auth) {
|
|
61
77
|
role.authority = {
|