cxs is a local-first CLI for searching Codex session logs. It is designed for progressive retrieval: find the right session first, then read
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

test(cli): 覆盖缺索引提示

cat 76a7dbe6 38460231

+33
+33
cli.test.ts
··· 162 162 expect(result.stdout).not.toContain("next: cxs window"); 163 163 }); 164 164 165 + test("find emits friendly guidance when index is missing", async () => { 166 + const base = mkdtempSync(join(tmpdir(), "cxs-cli-missing-index-")); 167 + tempDirs.push(base); 168 + const dbPath = join(base, "index.sqlite"); 169 + 170 + const result = await runCli(["find", "hi", "--db", dbPath]); 171 + 172 + expect(result.exitCode).toBe(1); 173 + expect(result.stderr).toContain(`index not found: ${dbPath}`); 174 + expect(result.stderr).toContain("cxs sync"); 175 + expect(result.stderr).toContain("No separate init command is needed"); 176 + expect(result.stderr).not.toContain("Error:"); 177 + expect(result.stderr).not.toContain("at openReadDb"); 178 + }); 179 + 180 + test("stats --json emits structured guidance when index is missing", async () => { 181 + const base = mkdtempSync(join(tmpdir(), "cxs-cli-missing-index-json-")); 182 + tempDirs.push(base); 183 + const dbPath = join(base, "index.sqlite"); 184 + 185 + const result = await runCli(["stats", "--json", "--db", dbPath]); 186 + 187 + expect(result.exitCode).toBe(1); 188 + const payload = JSON.parse(result.stdout) as { 189 + error: { code: string; message: string; dbPath: string; hint: string }; 190 + }; 191 + expect(payload.error.code).toBe("index_unavailable"); 192 + expect(payload.error.message).toContain(dbPath); 193 + expect(payload.error.dbPath).toBe(dbPath); 194 + expect(payload.error.hint).toContain("cxs sync"); 195 + expect(result.stderr).toBe(""); 196 + }); 197 + 165 198 test("list filters by cwd substring and respects sort", async () => { 166 199 const base = mkdtempSync(join(tmpdir(), "cxs-cli-list-")); 167 200 tempDirs.push(base);