codeep 1.1.14 → 1.1.16

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.
@@ -11,7 +11,7 @@ import { renderPermissionScreen, getPermissionOptions } from './components/Permi
11
11
  // Intro animation is now handled by App.startIntro()
12
12
  import { chat, setProjectContext } from '../api/index.js';
13
13
  import { runAgent } from '../utils/agent.js';
14
- import { config, loadApiKey, loadAllApiKeys, getCurrentProvider, getModelsForCurrentProvider, PROTOCOLS, LANGUAGES, setProvider, setApiKey, clearApiKey, autoSaveSession, saveSession, startNewSession, getCurrentSessionId, loadSession, listSessionsWithInfo, deleteSession, renameSession, hasReadPermission, hasWritePermission, setProjectPermission, } from '../config/index.js';
14
+ import { config, loadApiKey, loadAllApiKeys, getCurrentProvider, getModelsForCurrentProvider, PROTOCOLS, LANGUAGES, setProvider, setApiKey, clearApiKey, autoSaveSession, saveSession, startNewSession, getCurrentSessionId, loadSession, listSessionsWithInfo, deleteSession, renameSession, hasReadPermission, hasWritePermission, setProjectPermission, initializeAsProject, isManuallyInitializedProject, } from '../config/index.js';
15
15
  import { isProjectDirectory, getProjectContext } from '../utils/project.js';
16
16
  import { getCurrentVersion } from '../utils/update.js';
17
17
  import { getProviderList } from '../config/providers.js';
@@ -48,7 +48,7 @@ let agentAbortController = null;
48
48
  async function handleSubmit(message) {
49
49
  // Check if we're waiting for interactive mode answers
50
50
  if (pendingInteractiveContext) {
51
- const { parseAnswers, enhancePromptWithAnswers } = await import('../utils/interactive');
51
+ const { parseAnswers, enhancePromptWithAnswers } = await import('../utils/interactive.js');
52
52
  const answers = parseAnswers(message, pendingInteractiveContext.context);
53
53
  // Enhance the original prompt with user's answers
54
54
  const enhancedTask = enhancePromptWithAnswers(pendingInteractiveContext.context, answers);
@@ -191,7 +191,7 @@ async function runAgentTask(task, dryRun = false) {
191
191
  const interactiveMode = config.get('agentInteractive') !== false;
192
192
  if (interactiveMode) {
193
193
  // Analyze task for ambiguity
194
- const { analyzeForClarification, formatQuestions } = await import('../utils/interactive');
194
+ const { analyzeForClarification, formatQuestions } = await import('../utils/interactive.js');
195
195
  const interactiveContext = analyzeForClarification(task);
196
196
  if (interactiveContext.needsClarification) {
197
197
  // Store context for follow-up
@@ -516,7 +516,7 @@ function handleCommand(command, args) {
516
516
  const staged = args.includes('--staged') || args.includes('-s');
517
517
  app.notify(staged ? 'Getting staged diff...' : 'Getting diff...');
518
518
  // Import dynamically to avoid circular deps
519
- import('../utils/git').then(({ getGitDiff, formatDiffForDisplay }) => {
519
+ import('../utils/git.js').then(({ getGitDiff, formatDiffForDisplay }) => {
520
520
  const result = getGitDiff(staged, projectPath);
521
521
  if (!result.success || !result.diff) {
522
522
  app.notify(result.error || 'No changes');
@@ -534,7 +534,7 @@ function handleCommand(command, args) {
534
534
  app.notify('No project context');
535
535
  return;
536
536
  }
537
- import('../utils/git').then(({ getGitDiff, getGitStatus, suggestCommitMessage }) => {
537
+ import('../utils/git.js').then(({ getGitDiff, getGitStatus, suggestCommitMessage }) => {
538
538
  const status = getGitStatus(projectPath);
539
539
  if (!status.isRepo) {
540
540
  app.notify('Not a git repository');
@@ -552,14 +552,14 @@ function handleCommand(command, args) {
552
552
  break;
553
553
  }
554
554
  case 'undo': {
555
- import('../utils/agent').then(({ undoLastAction }) => {
555
+ import('../utils/agent.js').then(({ undoLastAction }) => {
556
556
  const result = undoLastAction();
557
557
  app.notify(result.success ? `Undo: ${result.message}` : `Cannot undo: ${result.message}`);
558
558
  });
559
559
  break;
560
560
  }
561
561
  case 'undo-all': {
562
- import('../utils/agent').then(({ undoAllActions }) => {
562
+ import('../utils/agent.js').then(({ undoAllActions }) => {
563
563
  const result = undoAllActions();
564
564
  app.notify(result.success ? `Undone ${result.results.length} action(s)` : 'Nothing to undo');
565
565
  });
@@ -571,7 +571,7 @@ function handleCommand(command, args) {
571
571
  return;
572
572
  }
573
573
  app.notify('Scanning project...');
574
- import('../utils/projectIntelligence').then(({ scanProject, saveProjectIntelligence, generateContextFromIntelligence }) => {
574
+ import('../utils/projectIntelligence.js').then(({ scanProject, saveProjectIntelligence, generateContextFromIntelligence }) => {
575
575
  scanProject(projectContext.root).then(intelligence => {
576
576
  saveProjectIntelligence(projectContext.root, intelligence);
577
577
  const context = generateContextFromIntelligence(intelligence);
@@ -591,7 +591,7 @@ function handleCommand(command, args) {
591
591
  app.notify('No project context');
592
592
  return;
593
593
  }
594
- import('../utils/codeReview').then(({ performCodeReview, formatReviewResult }) => {
594
+ import('../utils/codeReview.js').then(({ performCodeReview, formatReviewResult }) => {
595
595
  const reviewFiles = args.length > 0 ? args : undefined;
596
596
  const result = performCodeReview(projectContext, reviewFiles);
597
597
  app.addMessage({
@@ -603,7 +603,7 @@ function handleCommand(command, args) {
603
603
  }
604
604
  case 'update': {
605
605
  app.notify('Checking for updates...');
606
- import('../utils/update').then(({ checkForUpdates, formatVersionInfo }) => {
606
+ import('../utils/update.js').then(({ checkForUpdates, formatVersionInfo }) => {
607
607
  checkForUpdates().then(info => {
608
608
  const message = formatVersionInfo(info);
609
609
  app.notify(message.split('\n')[0], 5000);
@@ -817,7 +817,7 @@ function handleCommand(command, args) {
817
817
  app.notify(`Invalid block number. Available: 1-${codeBlocks.length}`);
818
818
  return;
819
819
  }
820
- import('../utils/clipboard').then(({ copyToClipboard }) => {
820
+ import('../utils/clipboard.js').then(({ copyToClipboard }) => {
821
821
  if (copyToClipboard(codeBlocks[index])) {
822
822
  app.notify(`Copied block ${index + 1} to clipboard`);
823
823
  }
@@ -944,7 +944,7 @@ function handleCommand(command, args) {
944
944
  }
945
945
  // Agent history and changes
946
946
  case 'history': {
947
- import('../utils/agent').then(({ getAgentHistory }) => {
947
+ import('../utils/agent.js').then(({ getAgentHistory }) => {
948
948
  const history = getAgentHistory();
949
949
  if (history.length === 0) {
950
950
  app.notify('No agent history');
@@ -964,7 +964,7 @@ function handleCommand(command, args) {
964
964
  break;
965
965
  }
966
966
  case 'changes': {
967
- import('../utils/agent').then(({ getCurrentSessionActions }) => {
967
+ import('../utils/agent.js').then(({ getCurrentSessionActions }) => {
968
968
  const actions = getCurrentSessionActions();
969
969
  if (actions.length === 0) {
970
970
  app.notify('No changes in current session');
@@ -1011,7 +1011,7 @@ function handleCommand(command, args) {
1011
1011
  // Learning mode
1012
1012
  case 'learn': {
1013
1013
  if (args[0] === 'status') {
1014
- import('../utils/learning').then(({ getLearningStatus }) => {
1014
+ import('../utils/learning.js').then(({ getLearningStatus }) => {
1015
1015
  const status = getLearningStatus(projectPath);
1016
1016
  app.addMessage({
1017
1017
  role: 'system',
@@ -1023,7 +1023,7 @@ function handleCommand(command, args) {
1023
1023
  return;
1024
1024
  }
1025
1025
  if (args[0] === 'rule' && args.length > 1) {
1026
- import('../utils/learning').then(({ addCustomRule }) => {
1026
+ import('../utils/learning.js').then(({ addCustomRule }) => {
1027
1027
  addCustomRule(projectPath, args.slice(1).join(' '));
1028
1028
  app.notify('Custom rule added');
1029
1029
  }).catch(() => {
@@ -1036,7 +1036,7 @@ function handleCommand(command, args) {
1036
1036
  return;
1037
1037
  }
1038
1038
  app.notify('Learning from project...');
1039
- import('../utils/learning').then(({ learnFromProject, formatPreferencesForPrompt }) => {
1039
+ import('../utils/learning.js').then(({ learnFromProject, formatPreferencesForPrompt }) => {
1040
1040
  // Get some source files to learn from
1041
1041
  import('fs').then(fs => {
1042
1042
  import('path').then(path => {
@@ -1200,7 +1200,7 @@ function handleCommand(command, args) {
1200
1200
  break;
1201
1201
  }
1202
1202
  case 'skills': {
1203
- import('../utils/skills').then(({ getAllSkills, searchSkills, formatSkillsList, getSkillStats }) => {
1203
+ import('../utils/skills.js').then(({ getAllSkills, searchSkills, formatSkillsList, getSkillStats }) => {
1204
1204
  const query = args.join(' ').toLowerCase();
1205
1205
  // Check for stats subcommand
1206
1206
  if (query === 'stats') {
@@ -1224,7 +1224,7 @@ function handleCommand(command, args) {
1224
1224
  break;
1225
1225
  }
1226
1226
  case 'skill': {
1227
- import('../utils/skills').then(({ findSkill, formatSkillHelp, createSkillTemplate, saveCustomSkill, deleteCustomSkill }) => {
1227
+ import('../utils/skills.js').then(({ findSkill, formatSkillHelp, createSkillTemplate, saveCustomSkill, deleteCustomSkill }) => {
1228
1228
  const subCommand = args[0]?.toLowerCase();
1229
1229
  const skillName = args[1];
1230
1230
  if (!subCommand) {
@@ -1549,37 +1549,65 @@ Commands (in chat):
1549
1549
  app.start();
1550
1550
  // Show intro animation first (if terminal is large enough)
1551
1551
  const showIntroAnimation = process.stdout.rows >= 20;
1552
- const continueStartup = () => {
1553
- // Show permission dialog inline if needed
1554
- if (needsPermissionDialog) {
1555
- app.showPermission(projectPath, isProject, (permission) => {
1556
- if (permission === 'read') {
1557
- setProjectPermission(projectPath, true, false);
1558
- hasWriteAccess = false;
1559
- projectContext = getProjectContext(projectPath);
1560
- if (projectContext) {
1561
- projectContext.hasWriteAccess = false;
1562
- setProjectContext(projectContext);
1563
- }
1564
- app.notify('Read-only access granted');
1552
+ const showPermissionAndContinue = () => {
1553
+ app.showPermission(projectPath, isProject, (permission) => {
1554
+ if (permission === 'read') {
1555
+ setProjectPermission(projectPath, true, false);
1556
+ hasWriteAccess = false;
1557
+ projectContext = getProjectContext(projectPath);
1558
+ if (projectContext) {
1559
+ projectContext.hasWriteAccess = false;
1560
+ setProjectContext(projectContext);
1565
1561
  }
1566
- else if (permission === 'write') {
1567
- setProjectPermission(projectPath, true, true);
1568
- hasWriteAccess = true;
1569
- projectContext = getProjectContext(projectPath);
1570
- if (projectContext) {
1571
- projectContext.hasWriteAccess = true;
1572
- setProjectContext(projectContext);
1573
- }
1574
- app.notify('Read & Write access granted');
1575
- }
1576
- else {
1577
- app.notify('No project access - chat only mode');
1562
+ app.notify('Read-only access granted');
1563
+ }
1564
+ else if (permission === 'write') {
1565
+ setProjectPermission(projectPath, true, true);
1566
+ hasWriteAccess = true;
1567
+ projectContext = getProjectContext(projectPath);
1568
+ if (projectContext) {
1569
+ projectContext.hasWriteAccess = true;
1570
+ setProjectContext(projectContext);
1578
1571
  }
1579
- // After permission, show session picker
1580
- showSessionPickerInline();
1572
+ app.notify('Read & Write access granted');
1573
+ }
1574
+ else {
1575
+ app.notify('No project access - chat only mode');
1576
+ }
1577
+ // After permission, show session picker
1578
+ showSessionPickerInline();
1579
+ });
1580
+ };
1581
+ const continueStartup = () => {
1582
+ // If not a git project and not manually initialized, ask if user wants to set it as project
1583
+ const isManualProject = isManuallyInitializedProject(projectPath);
1584
+ if (needsPermissionDialog && !isProject && !isManualProject) {
1585
+ // Ask user if they want to use this folder as a project
1586
+ app.showConfirm({
1587
+ title: 'Set as Project?',
1588
+ message: [
1589
+ `Current folder: ${projectPath}`,
1590
+ '',
1591
+ 'This folder is not a Git repository.',
1592
+ 'Would you like to use it as a Codeep project?',
1593
+ ],
1594
+ confirmLabel: 'Yes, set as project',
1595
+ cancelLabel: 'No, chat only',
1596
+ onConfirm: () => {
1597
+ initializeAsProject(projectPath);
1598
+ app.notify('Folder initialized as project');
1599
+ showPermissionAndContinue();
1600
+ },
1601
+ onCancel: () => {
1602
+ app.notify('Chat only mode - no project context');
1603
+ showSessionPickerInline();
1604
+ },
1581
1605
  });
1582
1606
  }
1607
+ else if (needsPermissionDialog) {
1608
+ // Is a project (git or manual), just ask for permissions
1609
+ showPermissionAndContinue();
1610
+ }
1583
1611
  else {
1584
1612
  // No permission needed, show session picker directly
1585
1613
  showSessionPickerInline();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",