@idea1/cli 1.0.0

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.
Files changed (62) hide show
  1. package/README.md +160 -0
  2. package/dist/cli.d.ts +10 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +105 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/close-worktree.d.ts +3 -0
  7. package/dist/commands/close-worktree.d.ts.map +1 -0
  8. package/dist/commands/close-worktree.js +184 -0
  9. package/dist/commands/close-worktree.js.map +1 -0
  10. package/dist/commands/help.d.ts +3 -0
  11. package/dist/commands/help.d.ts.map +1 -0
  12. package/dist/commands/help.js +45 -0
  13. package/dist/commands/help.js.map +1 -0
  14. package/dist/commands/index.d.ts +18 -0
  15. package/dist/commands/index.d.ts.map +1 -0
  16. package/dist/commands/index.js +46 -0
  17. package/dist/commands/index.js.map +1 -0
  18. package/dist/commands/start-project-item.d.ts +3 -0
  19. package/dist/commands/start-project-item.d.ts.map +1 -0
  20. package/dist/commands/start-project-item.js +214 -0
  21. package/dist/commands/start-project-item.js.map +1 -0
  22. package/dist/index.d.ts +3 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +18 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/interactive.d.ts +5 -0
  27. package/dist/interactive.d.ts.map +1 -0
  28. package/dist/interactive.js +348 -0
  29. package/dist/interactive.js.map +1 -0
  30. package/dist/lib/logger.d.ts +16 -0
  31. package/dist/lib/logger.d.ts.map +1 -0
  32. package/dist/lib/logger.js +44 -0
  33. package/dist/lib/logger.js.map +1 -0
  34. package/dist/lib/settings.d.ts +10 -0
  35. package/dist/lib/settings.d.ts.map +1 -0
  36. package/dist/lib/settings.js +27 -0
  37. package/dist/lib/settings.js.map +1 -0
  38. package/dist/lib/shell.d.ts +23 -0
  39. package/dist/lib/shell.d.ts.map +1 -0
  40. package/dist/lib/shell.js +61 -0
  41. package/dist/lib/shell.js.map +1 -0
  42. package/dist/services/claude.d.ts +25 -0
  43. package/dist/services/claude.d.ts.map +1 -0
  44. package/dist/services/claude.js +81 -0
  45. package/dist/services/claude.js.map +1 -0
  46. package/dist/services/config.d.ts +35 -0
  47. package/dist/services/config.d.ts.map +1 -0
  48. package/dist/services/config.js +63 -0
  49. package/dist/services/config.js.map +1 -0
  50. package/dist/services/git.d.ts +89 -0
  51. package/dist/services/git.d.ts.map +1 -0
  52. package/dist/services/git.js +246 -0
  53. package/dist/services/git.js.map +1 -0
  54. package/dist/services/github.d.ts +18 -0
  55. package/dist/services/github.d.ts.map +1 -0
  56. package/dist/services/github.js +90 -0
  57. package/dist/services/github.js.map +1 -0
  58. package/dist/types/index.d.ts +61 -0
  59. package/dist/types/index.d.ts.map +1 -0
  60. package/dist/types/index.js +2 -0
  61. package/dist/types/index.js.map +1 -0
  62. package/package.json +53 -0
@@ -0,0 +1,44 @@
1
+ import chalk from 'chalk';
2
+ /**
3
+ * Logger utility for consistent console output with colors
4
+ */
5
+ export const logger = {
6
+ info: (message) => {
7
+ console.log(chalk.blue(message));
8
+ },
9
+ success: (message) => {
10
+ console.log(chalk.green(`✓ ${message}`));
11
+ },
12
+ warning: (message) => {
13
+ console.log(chalk.yellow(`⚠ ${message}`));
14
+ },
15
+ error: (message) => {
16
+ console.error(chalk.red(`✗ ${message}`));
17
+ },
18
+ step: (message) => {
19
+ console.log(chalk.cyan(`→ ${message}`));
20
+ },
21
+ dim: (message) => {
22
+ console.log(chalk.dim(message));
23
+ },
24
+ plain: (message) => {
25
+ console.log(message);
26
+ },
27
+ header: (message) => {
28
+ console.log('');
29
+ console.log(chalk.blue('═'.repeat(50)));
30
+ console.log(chalk.blue.bold(message));
31
+ console.log(chalk.blue('═'.repeat(50)));
32
+ console.log('');
33
+ },
34
+ section: (message) => {
35
+ console.log('');
36
+ console.log(chalk.blue('─'.repeat(40)));
37
+ console.log(chalk.blue(message));
38
+ console.log(chalk.blue('─'.repeat(40)));
39
+ },
40
+ newline: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,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,EAAE,CAAC,OAAe,EAAQ,EAAE;QACjC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACjC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,EAAE,GAAS,EAAE;QAClB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;CACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { Idea1Settings } from '../types/index.js';
2
+ /**
3
+ * Read .idea1/settings.json from a repository
4
+ */
5
+ export declare function readSettings(repoRoot: string): Promise<Idea1Settings | null>;
6
+ /**
7
+ * Get the setup-worktree hook command if defined
8
+ */
9
+ export declare function getSetupWorktreeHook(repoRoot: string): Promise<string | null>;
10
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/lib/settings.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;GAEG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAalF;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAGnF"}
@@ -0,0 +1,27 @@
1
+ import { readFile } from 'fs/promises';
2
+ import { existsSync } from 'fs';
3
+ import { join } from 'path';
4
+ /**
5
+ * Read .idea1/settings.json from a repository
6
+ */
7
+ export async function readSettings(repoRoot) {
8
+ const settingsPath = join(repoRoot, '.idea1', 'settings.json');
9
+ if (!existsSync(settingsPath)) {
10
+ return null;
11
+ }
12
+ try {
13
+ const content = await readFile(settingsPath, 'utf-8');
14
+ return JSON.parse(content);
15
+ }
16
+ catch {
17
+ return null;
18
+ }
19
+ }
20
+ /**
21
+ * Get the setup-worktree hook command if defined
22
+ */
23
+ export async function getSetupWorktreeHook(repoRoot) {
24
+ const settings = await readSettings(repoRoot);
25
+ return settings?.hooks?.['setup-worktree'] ?? null;
26
+ }
27
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/lib/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB;IACjD,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;IAE/D,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACtD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAkB,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,QAAgB;IACzD,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9C,OAAO,QAAQ,EAAE,KAAK,EAAE,CAAC,gBAAgB,CAAC,IAAI,IAAI,CAAC;AACrD,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { type Options as ExecaOptions } from 'execa';
2
+ export interface ShellResult {
3
+ stdout: string;
4
+ stderr: string;
5
+ exitCode: number;
6
+ }
7
+ /**
8
+ * Execute a shell command and return the result
9
+ */
10
+ export declare function exec(command: string, args?: string[], options?: ExecaOptions): Promise<ShellResult>;
11
+ /**
12
+ * Execute a shell command and throw on error
13
+ */
14
+ export declare function execOrThrow(command: string, args?: string[], options?: ExecaOptions): Promise<string>;
15
+ /**
16
+ * Execute a shell command with live output streaming
17
+ */
18
+ export declare function execWithOutput(command: string, args?: string[], options?: ExecaOptions): Promise<number>;
19
+ /**
20
+ * Check if a command exists
21
+ */
22
+ export declare function commandExists(command: string): Promise<boolean>;
23
+ //# sourceMappingURL=shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/lib/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,OAAO,IAAI,YAAY,EAAE,MAAM,OAAO,CAAC;AAG5D,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAsB,IAAI,CACxB,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CAoBtB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,MAAM,EAAO,EACnB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,MAAM,CAAC,CAajB;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGrE"}
@@ -0,0 +1,61 @@
1
+ import { execa } from 'execa';
2
+ import { logger } from './logger.js';
3
+ /**
4
+ * Execute a shell command and return the result
5
+ */
6
+ export async function exec(command, args = [], options = {}) {
7
+ try {
8
+ const result = await execa(command, args, {
9
+ ...options,
10
+ reject: false
11
+ });
12
+ return {
13
+ stdout: result.stdout?.toString() ?? '',
14
+ stderr: result.stderr?.toString() ?? '',
15
+ exitCode: result.exitCode ?? 0
16
+ };
17
+ }
18
+ catch (error) {
19
+ const err = error;
20
+ return {
21
+ stdout: '',
22
+ stderr: err.message,
23
+ exitCode: 1
24
+ };
25
+ }
26
+ }
27
+ /**
28
+ * Execute a shell command and throw on error
29
+ */
30
+ export async function execOrThrow(command, args = [], options = {}) {
31
+ const result = await exec(command, args, options);
32
+ if (result.exitCode !== 0) {
33
+ throw new Error(result.stderr || `Command failed: ${command} ${args.join(' ')}`);
34
+ }
35
+ return result.stdout;
36
+ }
37
+ /**
38
+ * Execute a shell command with live output streaming
39
+ */
40
+ export async function execWithOutput(command, args = [], options = {}) {
41
+ try {
42
+ const result = await execa(command, args, {
43
+ ...options,
44
+ stdio: 'inherit',
45
+ reject: false
46
+ });
47
+ return result.exitCode ?? 0;
48
+ }
49
+ catch (error) {
50
+ logger.error(`Command failed: ${command} ${args.join(' ')}`);
51
+ return 1;
52
+ }
53
+ }
54
+ /**
55
+ * Check if a command exists
56
+ */
57
+ export async function commandExists(command) {
58
+ const result = await exec('which', [command]);
59
+ return result.exitCode === 0;
60
+ }
61
+ //# sourceMappingURL=shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/lib/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAgC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,OAAe,EACf,OAAiB,EAAE,EACnB,UAAwB,EAAE;IAE1B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE;YACxC,GAAG,OAAO;YACV,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QAEH,OAAO;YACL,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;YACvC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;YACvC,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,CAAC;SAC/B,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,GAAG,GAAG,KAAc,CAAC;QAC3B,OAAO;YACL,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,GAAG,CAAC,OAAO;YACnB,QAAQ,EAAE,CAAC;SACZ,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAe,EACf,OAAiB,EAAE,EACnB,UAAwB,EAAE;IAE1B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAElD,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,mBAAmB,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAe,EACf,OAAiB,EAAE,EACnB,UAAwB,EAAE;IAE1B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE;YACxC,GAAG,OAAO;YACV,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,KAAK;SACd,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,mBAAmB,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC7D,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAe;IACjD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Ensure Claude CLI is available
3
+ */
4
+ export declare function ensureClaudeCli(): Promise<boolean>;
5
+ /**
6
+ * Run claude with a specific prompt (non-interactive, returns output)
7
+ */
8
+ export declare function runWithPrompt(prompt: string): Promise<string>;
9
+ /**
10
+ * Launch interactive claude session
11
+ */
12
+ export declare function runInteractive(initialPrompt?: string, cwd?: string): Promise<number>;
13
+ /**
14
+ * Set workflow status on an idea1.ai project item
15
+ */
16
+ export declare function setWorkflowStatus(itemUrl: string, status: string): Promise<boolean>;
17
+ /**
18
+ * Generate a branch name from a project item description
19
+ */
20
+ export declare function generateBranchName(itemUrl: string): Promise<string>;
21
+ /**
22
+ * Get the implementation prompt for a project item
23
+ */
24
+ export declare function getImplementationPrompt(itemUrl: string): string;
25
+ //# sourceMappingURL=claude.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/services/claude.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAMxD;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAanE;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAS1F;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAiBzF;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBzE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/D"}
@@ -0,0 +1,81 @@
1
+ import { exec, execWithOutput, commandExists } from '../lib/shell.js';
2
+ import { logger } from '../lib/logger.js';
3
+ /**
4
+ * Ensure Claude CLI is available
5
+ */
6
+ export async function ensureClaudeCli() {
7
+ if (!await commandExists('claude')) {
8
+ logger.warning('Claude CLI is not installed. Some features will be unavailable.');
9
+ return false;
10
+ }
11
+ return true;
12
+ }
13
+ /**
14
+ * Run claude with a specific prompt (non-interactive, returns output)
15
+ */
16
+ export async function runWithPrompt(prompt) {
17
+ const hasClaudie = await ensureClaudeCli();
18
+ if (!hasClaudie) {
19
+ throw new Error('Claude CLI is not available');
20
+ }
21
+ const result = await exec('claude', ['-p', prompt]);
22
+ if (result.exitCode !== 0) {
23
+ throw new Error(`Claude command failed: ${result.stderr}`);
24
+ }
25
+ return result.stdout.trim();
26
+ }
27
+ /**
28
+ * Launch interactive claude session
29
+ */
30
+ export async function runInteractive(initialPrompt, cwd) {
31
+ const hasClaudie = await ensureClaudeCli();
32
+ if (!hasClaudie) {
33
+ logger.error('Claude CLI is not available');
34
+ return 1;
35
+ }
36
+ const args = initialPrompt ? [initialPrompt] : [];
37
+ return execWithOutput('claude', args, { cwd });
38
+ }
39
+ /**
40
+ * Set workflow status on an idea1.ai project item
41
+ */
42
+ export async function setWorkflowStatus(itemUrl, status) {
43
+ const hasClaudie = await ensureClaudeCli();
44
+ if (!hasClaudie) {
45
+ logger.warning('Claude CLI not available, skipping workflow status update');
46
+ return false;
47
+ }
48
+ logger.step(`Setting workflow status to "${status}"...`);
49
+ try {
50
+ await runWithPrompt(`Set the workflow status of ${itemUrl} to "${status}"`);
51
+ logger.success(`Workflow status updated to "${status}"`);
52
+ return true;
53
+ }
54
+ catch (error) {
55
+ logger.warning(`Could not update workflow status: ${error}`);
56
+ return false;
57
+ }
58
+ }
59
+ /**
60
+ * Generate a branch name from a project item description
61
+ */
62
+ export async function generateBranchName(itemUrl) {
63
+ const hasClaudie = await ensureClaudeCli();
64
+ if (!hasClaudie) {
65
+ throw new Error('Claude CLI is required to generate branch names');
66
+ }
67
+ logger.step('Generating branch name from item description...');
68
+ const prompt = `Get the description of ${itemUrl} and generate a git branch name based on the description. Don't use any branch name prefix or folder structure, just a one part branch name. Your answer should be a single branch name and nothing else, in plain text, with no explanation - For example, "my-branch-name"`;
69
+ const branchName = await runWithPrompt(prompt);
70
+ // Clean up any extra whitespace/newlines
71
+ const cleanedName = branchName.replace(/\n/g, '').trim();
72
+ logger.dim(`Generated branch name: ${cleanedName}`);
73
+ return cleanedName;
74
+ }
75
+ /**
76
+ * Get the implementation prompt for a project item
77
+ */
78
+ export function getImplementationPrompt(itemUrl) {
79
+ return `Think deeply and make a step-by-step plan to implement the idea1.ai project item ${itemUrl}. Remember the project item's url so you can refer to the url later. Read the project items' context and description from idea1.ai using get_item_context_for_agent_implementation. Ask me to approve the plan before you implement it.`;
80
+ }
81
+ //# sourceMappingURL=claude.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/services/claude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,IAAI,CAAC,MAAM,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,iEAAiE,CAAC,CAAC;QAClF,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAc;IAChD,MAAM,UAAU,GAAG,MAAM,eAAe,EAAE,CAAC;IAC3C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAEpD,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,0BAA0B,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAA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AAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;IAE/D,MAAM,MAAM,GAAG,0BAA0B,OAAO,8QAA8Q,CAAC;IAE/T,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;IAE/C,yCAAyC;IACzC,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAEzD,MAAM,CAAC,GAAG,CAAC,0BAA0B,WAAW,EAAE,CAAC,CAAC;IACpD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACrD,OAAO,oFAAoF,OAAO,yOAAyO,CAAC;AAC9U,CAAC"}
@@ -0,0 +1,35 @@
1
+ export declare const configService: {
2
+ /**
3
+ * Get the default base branch
4
+ */
5
+ getDefaultBaseBranch(): string;
6
+ /**
7
+ * Set the default base branch
8
+ */
9
+ setDefaultBaseBranch(branch: string): void;
10
+ /**
11
+ * Get the default isolation mode
12
+ */
13
+ getDefaultIsolationMode(): "worktree" | "container";
14
+ /**
15
+ * Set the default isolation mode
16
+ */
17
+ setDefaultIsolationMode(mode: "worktree" | "container"): void;
18
+ /**
19
+ * Get the last used project item URL
20
+ */
21
+ getLastUsedProjectItemUrl(): string | undefined;
22
+ /**
23
+ * Set the last used project item URL
24
+ */
25
+ setLastUsedProjectItemUrl(url: string): void;
26
+ /**
27
+ * Get the config file path
28
+ */
29
+ getConfigPath(): string;
30
+ /**
31
+ * Clear all configuration
32
+ */
33
+ clear(): void;
34
+ };
35
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/services/config.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,aAAa;IACxB;;OAEG;4BACqB,MAAM;IAI9B;;OAEG;iCAC0B,MAAM,GAAG,IAAI;IAI1C;;OAEG;+BACwB,UAAU,GAAG,WAAW;IAInD;;OAEG;kCAC2B,UAAU,GAAG,WAAW,GAAG,IAAI;IAI7D;;OAEG;iCAC0B,MAAM,GAAG,SAAS;IAI/C;;OAEG;mCAC4B,MAAM,GAAG,IAAI;IAI5C;;OAEG;qBACc,MAAM;IAIvB;;OAEG;aACM,IAAI;CAGd,CAAC"}
@@ -0,0 +1,63 @@
1
+ import Conf from 'conf';
2
+ /**
3
+ * Configuration store for user settings
4
+ * Stored in XDG-compliant directory
5
+ */
6
+ const config = new Conf({
7
+ projectName: 'idea1-cli',
8
+ defaults: {
9
+ defaultBaseBranch: 'working/release',
10
+ defaultIsolationMode: 'worktree'
11
+ }
12
+ });
13
+ export const configService = {
14
+ /**
15
+ * Get the default base branch
16
+ */
17
+ getDefaultBaseBranch() {
18
+ return config.get('defaultBaseBranch');
19
+ },
20
+ /**
21
+ * Set the default base branch
22
+ */
23
+ setDefaultBaseBranch(branch) {
24
+ config.set('defaultBaseBranch', branch);
25
+ },
26
+ /**
27
+ * Get the default isolation mode
28
+ */
29
+ getDefaultIsolationMode() {
30
+ return config.get('defaultIsolationMode');
31
+ },
32
+ /**
33
+ * Set the default isolation mode
34
+ */
35
+ setDefaultIsolationMode(mode) {
36
+ config.set('defaultIsolationMode', mode);
37
+ },
38
+ /**
39
+ * Get the last used project item URL
40
+ */
41
+ getLastUsedProjectItemUrl() {
42
+ return config.get('lastUsedProjectItemUrl');
43
+ },
44
+ /**
45
+ * Set the last used project item URL
46
+ */
47
+ setLastUsedProjectItemUrl(url) {
48
+ config.set('lastUsedProjectItemUrl', url);
49
+ },
50
+ /**
51
+ * Get the config file path
52
+ */
53
+ getConfigPath() {
54
+ return config.path;
55
+ },
56
+ /**
57
+ * Clear all configuration
58
+ */
59
+ clear() {
60
+ config.clear();
61
+ }
62
+ };
63
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/services/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAQxB;;;GAGG;AACH,MAAM,MAAM,GAAG,IAAI,IAAI,CAAe;IACpC,WAAW,EAAE,WAAW;IACxB,QAAQ,EAAE;QACR,iBAAiB,EAAE,iBAAiB;QACpC,oBAAoB,EAAE,UAAU;KACjC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;;OAEG;IACH,oBAAoB;QAClB,OAAO,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,oBAAoB,CAAC,MAAc;QACjC,MAAM,CAAC,GAAG,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,uBAAuB;QACrB,OAAO,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,uBAAuB,CAAC,IAA8B;QACpD,MAAM,CAAC,GAAG,CAAC,sBAAsB,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,yBAAyB;QACvB,OAAO,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,yBAAyB,CAAC,GAAW;QACnC,MAAM,CAAC,GAAG,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,aAAa;QACX,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,KAAK;QACH,MAAM,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;CACF,CAAC"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Get the repository root path from git
3
+ */
4
+ export declare function getRepoRoot(): Promise<string>;
5
+ /**
6
+ * Get the repository name (directory name of the repo root)
7
+ */
8
+ export declare function getRepoName(): Promise<string>;
9
+ /**
10
+ * Get the main repository root (even when inside a worktree)
11
+ */
12
+ export declare function getMainRepoRoot(): Promise<string>;
13
+ /**
14
+ * Get the current branch name
15
+ */
16
+ export declare function getCurrentBranch(): Promise<string>;
17
+ /**
18
+ * Check if inside a git worktree (not the main repo)
19
+ */
20
+ export declare function isInsideWorktree(): Promise<boolean>;
21
+ /**
22
+ * Ensure the current repository has no uncommitted changes or untracked files
23
+ */
24
+ export declare function ensureCleanWorkingDirectory(): Promise<void>;
25
+ /**
26
+ * Check if there are uncommitted changes (including untracked files)
27
+ */
28
+ export declare function hasUncommittedChanges(): Promise<boolean>;
29
+ /**
30
+ * Fetch latest changes from origin
31
+ */
32
+ export declare function fetchLatest(): Promise<void>;
33
+ /**
34
+ * Checkout and pull the latest from a branch
35
+ */
36
+ export declare function checkoutAndPullBranch(branchName: string): Promise<void>;
37
+ /**
38
+ * Create a new branch from a base branch and push it to origin
39
+ */
40
+ export declare function createAndPushBranch(fullBranchName: string, baseBranchName: string): Promise<void>;
41
+ /**
42
+ * Prepare the repository for worktree creation by fetching and syncing branches
43
+ */
44
+ export declare function prepareRepoForWorktree(fullBranchName: string, destBranchName: string): Promise<void>;
45
+ /**
46
+ * Create a git worktree for the given branch
47
+ */
48
+ export declare function createWorktree(fullBranchName: string, shortBranchName: string): Promise<string>;
49
+ /**
50
+ * Remove a git worktree
51
+ */
52
+ export declare function removeWorktree(worktreePath: string): Promise<void>;
53
+ /**
54
+ * Enter worktree and set up upstream
55
+ */
56
+ export declare function enterWorktreeAndSetup(worktreePath: string, fullBranchName: string): Promise<void>;
57
+ /**
58
+ * Store project item URL in git config for later retrieval
59
+ */
60
+ export declare function storeProjectItemUrl(projectItemUrl: string, branchName?: string): Promise<void>;
61
+ /**
62
+ * Retrieve project item URL from git config
63
+ */
64
+ export declare function getProjectItemUrl(branchName?: string): Promise<string | null>;
65
+ /**
66
+ * Store base branch in git config for later retrieval
67
+ */
68
+ export declare function storeBaseBranch(baseBranch: string, branchName?: string): Promise<void>;
69
+ /**
70
+ * Retrieve base branch for a branch (with hierarchical resolution)
71
+ */
72
+ export declare function getBaseBranch(branchName?: string): Promise<string | null>;
73
+ /**
74
+ * Validate that a branch exists
75
+ */
76
+ export declare function branchExists(branchName: string): Promise<boolean>;
77
+ /**
78
+ * Add all changes and commit
79
+ */
80
+ export declare function commitAllChanges(message: string): Promise<void>;
81
+ /**
82
+ * Push to remote branch
83
+ */
84
+ export declare function pushToRemote(branchName: string): Promise<void>;
85
+ /**
86
+ * Garbage collect orphaned branch configs
87
+ */
88
+ export declare function gcOrphanedBranchConfigs(): Promise<void>;
89
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/services/git.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAEnD;AAED;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CAGnD;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAMvD;AAED;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAGxD;AAED;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAQzD;AAED;;GAEG;AACH,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC,CAYjE;AAED;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC,CAM9D;AAED;;GAEG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAGjD;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7E;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG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