fix: parse .env and SOUL.md fields from hermes profile show output (#669)
The regex `^(\w[\w\s]*?)` could not match keys containing dots (`.env`, `SOUL.md`), so `hasEnv` and `hasSoulMd` were always `undefined` → false. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -428,7 +428,7 @@ export async function getProfile(name: string): Promise<HermesProfileDetail> {
|
|||||||
|
|
||||||
const result: Record<string, string> = {}
|
const result: Record<string, string> = {}
|
||||||
for (const line of stdout.trim().split('\n')) {
|
for (const line of stdout.trim().split('\n')) {
|
||||||
const match = line.match(/^(\w[\w\s]*?):\s+(.+)$/)
|
const match = line.match(/^([^\s:]+):\s+(.+)$/)
|
||||||
if (match) {
|
if (match) {
|
||||||
result[match[1].trim().toLowerCase().replace(/\s+/g, '_')] = match[2].trim()
|
result[match[1].trim().toLowerCase().replace(/\s+/g, '_')] = match[2].trim()
|
||||||
}
|
}
|
||||||
@@ -446,7 +446,7 @@ export async function getProfile(name: string): Promise<HermesProfileDetail> {
|
|||||||
gateway: result.gateway || '',
|
gateway: result.gateway || '',
|
||||||
skills: parseInt(result.skills || '0', 10),
|
skills: parseInt(result.skills || '0', 10),
|
||||||
hasEnv: result['.env'] === 'exists',
|
hasEnv: result['.env'] === 'exists',
|
||||||
hasSoulMd: result.soul_md === 'exists',
|
hasSoulMd: result['soul.md'] === 'exists',
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
if (err.code === 1 || err.status === 1) {
|
if (err.code === 1 || err.status === 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user