@vitorcen/context-resume 1.0.0 → 1.0.1

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/dist/index.js CHANGED
@@ -13,6 +13,14 @@ program
13
13
  .action(async (options) => {
14
14
  const cwd = process.cwd();
15
15
  const limit = parseInt(options.number, 10) || 10;
16
- render(_jsx(App, { cwd: cwd, limit: limit }));
16
+ let selectionOutput = '';
17
+ const app = render(_jsx(App, { cwd: cwd, limit: limit, onSubmit: (output) => {
18
+ selectionOutput = output;
19
+ } }));
20
+ await app.waitUntilExit();
21
+ if (selectionOutput) {
22
+ app.clear();
23
+ process.stdout.write(selectionOutput);
24
+ }
17
25
  });
18
26
  program.parse(process.argv);
package/dist/ui/app.js CHANGED
@@ -3,7 +3,7 @@ import { useState, useEffect } from 'react';
3
3
  import { Box, Text, useInput, useApp } from 'ink';
4
4
  import SelectInput from 'ink-select-input';
5
5
  import { getClaudeSessions, getCodexSessions } from '../adapters/index.js';
6
- const App = ({ cwd, limit = 10 }) => {
6
+ const App = ({ cwd, limit = 10, onSubmit }) => {
7
7
  const [claudeItems, setClaudeItems] = useState([]);
8
8
  const [codexItems, setCodexItems] = useState([]);
9
9
  const [activePanel, setActivePanel] = useState('claude');
@@ -21,6 +21,9 @@ const App = ({ cwd, limit = 10 }) => {
21
21
  if (key.rightArrow && activePanel === 'claude') {
22
22
  setActivePanel('codex');
23
23
  }
24
+ if (key.escape) {
25
+ exit();
26
+ }
24
27
  });
25
28
  useEffect(() => {
26
29
  const loadSessions = async () => {
@@ -54,7 +57,7 @@ const App = ({ cwd, limit = 10 }) => {
54
57
  const englishPrompt = `Here's a context file ${selectedItem.session.path} from the user's previous operations. Analyze what the user was doing. Then use TodoWrite to list what might be incomplete, and what needs to be done next (if mentioned in the context), otherwise wait for user instructions.`;
55
58
  const chinesePrompt = `这里有份上下文 ${selectedItem.session.path} ,是用户曾经的操作。你分析下用户在做什么。然后用TodoWrite列出可能没做完的事情,和接下来要的事情(如果上下文中有提到),如果没有就等待用户指令。`;
56
59
  const output = `\n\n${englishPrompt}\n\n${chinesePrompt}\n\n`;
57
- process.stdout.write(output);
60
+ onSubmit?.(output);
58
61
  exit();
59
62
  };
60
63
  const handleHighlightClaude = (item) => setActiveClaudeItem(item);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitorcen/context-resume",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Context Resume CLI - Browse and mutually restore the conversation history of Claude Code and Codex",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",