fix(ck): quote session names in native memory frontmatter

This commit is contained in:
Yann Roberto committed 2026-11-18 13:14:18 +08:00
1 parent 3f14a103a8
commit 62d32dc66d
3 files changed
+20 -2

No files matched your search

@@ -10,7 +10,7 @@
"id": "hand-seeded",
"source": "manual-curation-pending-regeneration"
},
"registryDigest": "cf9879ff972740a7d2af9b56a0f682870375d3abc75eea9164bd2b1838fd5b81",
"registryDigest": "9343c4f74ead89f41003be49c07644931e4c1c1adcdfbd84a2de2e8fa8c4819b",
"schemaVersion": 1,
"triggers": {
"skill:agent-runtime-gateway-smoke-test": [
+1 -1
View File
@@ -193,7 +193,7 @@ try {
const memContent = [
`---`,
`name: Session ${today()} — ${session.summary}`,
`name: ${JSON.stringify(`Session ${today()} — ${session.summary}`)}`,
`description: Key decisions and outcomes from ck session ${sessionId.slice(0, 8)}`,
`type: project`,
`source: ck`,
+18
View File
@@ -7,6 +7,7 @@ const fs = require('fs');
const os = require('os');
const path = require('path');
const { spawnSync } = require('child_process');
const yaml = require('js-yaml');
const repoRoot = path.resolve(__dirname, '..', '..');
const commandsDir = path.join(repoRoot, 'skills', 'ck', 'commands');
@@ -43,6 +44,23 @@ function runOk(home, project, script, args, payload) {
console.log('\nck init tests:');
test('saving a summary with YAML punctuation preserves the native memory name', home => {
const project = path.join(home, 'app');
fs.mkdirSync(project);
runOk(home, project, 'save.mjs', ['--init'], { name: 'app', path: project });
runOk(home, project, 'save.mjs', [], { summary: 'Fix: reconnect #42' });
const projectsDir = path.join(home, '.claude', 'projects');
const [projectDir] = fs.readdirSync(projectsDir);
const memoryDir = path.join(projectsDir, projectDir, 'memory');
const file = fs.readdirSync(memoryDir).find(name => name.startsWith('ck_') && name.endsWith('.md'));
assert.ok(file, 'expected a native memory file');
const markdown = fs.readFileSync(path.join(memoryDir, file), 'utf8');
const frontmatter = markdown.match(/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
assert.ok(frontmatter, 'expected YAML frontmatter');
assert.match(yaml.load(frontmatter[1]).name, /^Session \d{4}-\d{2}-\d{2} — Fix: reconnect #42$/);
});
test('initializing a registered project again keeps its saved sessions', home => {
const project = path.join(home, 'app');
fs.mkdirSync(project);