Further updates to configure
This commit is contained in:
@@ -14,6 +14,7 @@ const CODE = readFileSync(
|
||||
function load(extra = {}) {
|
||||
const sandbox = {
|
||||
TextDecoder,
|
||||
TextEncoder,
|
||||
Uint8Array,
|
||||
console,
|
||||
...extra
|
||||
@@ -145,3 +146,29 @@ test('bareAgentEnsureSkillTemplates copies skill seeds when missing', async (t)
|
||||
t.ok(written.some(([p]) => p === '/home/x/.agent/workspace/skills/bare-os-kernel-proc/SKILL.md'))
|
||||
t.ok(written.some(([p]) => p === '/home/x/.agent/skill-loader.js'))
|
||||
})
|
||||
|
||||
test('bareAgentSyncWorkspaceFromConfig writes IDENTITY and USER from config', async (t) => {
|
||||
const written = []
|
||||
const vfs = {
|
||||
async mkdir(_p, _o) {},
|
||||
async writeFile(p, buf) {
|
||||
const txt =
|
||||
buf instanceof Uint8Array ? new TextDecoder().decode(buf) : String(buf)
|
||||
written.push([p, txt])
|
||||
}
|
||||
}
|
||||
const s = load()
|
||||
const sync = /** @type {(ctx: object, paths: object, cfg: object) => Promise<void>} */ (
|
||||
s.bareAgentSyncWorkspaceFromConfig
|
||||
)
|
||||
await sync(
|
||||
{ vfs, b4a: null },
|
||||
{ workspace: '/home/x/.agent/workspace' },
|
||||
{ owner_name: 'Raven', agent_label: 'Bear' }
|
||||
)
|
||||
const id = written.find(([p]) => p === '/home/x/.agent/workspace/IDENTITY.md')
|
||||
t.ok(id && id[1].includes('**Name:** Bear'))
|
||||
t.ok(id && id[1].includes('Raven'))
|
||||
const user = written.find(([p]) => p === '/home/x/.agent/workspace/USER.md')
|
||||
t.ok(user && user[1].includes('Raven'))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user