idea-manager 1.5.1 → 1.6.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 (151) hide show
  1. package/.next/build-manifest.json +2 -2
  2. package/.next/prerender-manifest.json +3 -3
  3. package/.next/required-server-files.js +5 -0
  4. package/.next/required-server-files.json +5 -0
  5. package/.next/routes-manifest.json +10 -0
  6. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  7. package/.next/server/app/_global-error.html +2 -2
  8. package/.next/server/app/_global-error.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  16. package/.next/server/app/_not-found.html +2 -2
  17. package/.next/server/app/_not-found.rsc +2 -2
  18. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  19. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  21. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  23. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  24. package/.next/server/app/api/archive/route.js +34 -4
  25. package/.next/server/app/api/archive/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/filesystem/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/filesystem/tree/route_client-reference-manifest.js +1 -1
  28. package/.next/server/app/api/global-memo/route.js +34 -4
  29. package/.next/server/app/api/global-memo/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/projects/[id]/apply-distribute/route.js +6 -82
  32. package/.next/server/app/api/projects/[id]/apply-distribute/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/projects/[id]/auto-distribute/route.js +6 -6
  34. package/.next/server/app/api/projects/[id]/auto-distribute/route_client-reference-manifest.js +1 -1
  35. package/.next/server/app/api/projects/[id]/brainstorm/route.js +1 -77
  36. package/.next/server/app/api/projects/[id]/brainstorm/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/projects/[id]/git-sync/route.js +1 -77
  38. package/.next/server/app/api/projects/[id]/git-sync/route_client-reference-manifest.js +1 -1
  39. package/.next/server/app/api/projects/[id]/route.js +1 -77
  40. package/.next/server/app/api/projects/[id]/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/projects/[id]/sub-projects/[subId]/route.js +38 -8
  42. package/.next/server/app/api/projects/[id]/sub-projects/[subId]/route_client-reference-manifest.js +1 -1
  43. package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/chat/route.js +15 -10
  44. package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/chat/route_client-reference-manifest.js +1 -1
  45. package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/prompt/route.js +34 -4
  46. package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/prompt/route_client-reference-manifest.js +1 -1
  47. package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/refine/route.js +26 -0
  48. package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/refine/route_client-reference-manifest.js +1 -0
  49. package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/route.js +34 -4
  50. package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/route_client-reference-manifest.js +1 -1
  51. package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/route.js +34 -4
  52. package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/route_client-reference-manifest.js +1 -1
  53. package/.next/server/app/api/projects/[id]/sub-projects/route.js +38 -8
  54. package/.next/server/app/api/projects/[id]/sub-projects/route_client-reference-manifest.js +1 -1
  55. package/.next/server/app/api/projects/route.js +1 -77
  56. package/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
  57. package/.next/server/app/api/sync/route.js +34 -4
  58. package/.next/server/app/api/sync/route_client-reference-manifest.js +1 -1
  59. package/.next/server/app/index.html +2 -2
  60. package/.next/server/app/index.rsc +3 -3
  61. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  62. package/.next/server/app/index.segments/_full.segment.rsc +3 -3
  63. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  64. package/.next/server/app/index.segments/_index.segment.rsc +2 -2
  65. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  66. package/.next/server/app/page.js +15 -6
  67. package/.next/server/app/page_client-reference-manifest.js +1 -1
  68. package/.next/server/app/projects/[id]/page_client-reference-manifest.js +1 -1
  69. package/.next/server/app-paths-manifest.json +9 -8
  70. package/.next/server/chunks/117.js +107 -0
  71. package/.next/server/pages/404.html +2 -2
  72. package/.next/server/pages/500.html +2 -2
  73. package/.next/server/server-reference-manifest.json +1 -1
  74. package/.next/static/chunks/363642f4-9eb39e0bc542c65b.js +1 -0
  75. package/.next/static/chunks/374-23189d7e246ad164.js +1 -0
  76. package/.next/static/chunks/app/_global-error/page-6ec0e723e471f87a.js +1 -0
  77. package/.next/static/chunks/app/api/archive/route-6ec0e723e471f87a.js +1 -0
  78. package/.next/static/chunks/app/api/filesystem/route-6ec0e723e471f87a.js +1 -0
  79. package/.next/static/chunks/app/api/filesystem/tree/route-6ec0e723e471f87a.js +1 -0
  80. package/.next/static/chunks/app/api/global-memo/route-6ec0e723e471f87a.js +1 -0
  81. package/.next/static/chunks/app/api/health/route-6ec0e723e471f87a.js +1 -0
  82. package/.next/static/chunks/app/api/projects/[id]/apply-distribute/route-6ec0e723e471f87a.js +1 -0
  83. package/.next/static/chunks/app/api/projects/[id]/auto-distribute/route-6ec0e723e471f87a.js +1 -0
  84. package/.next/static/chunks/app/api/projects/[id]/brainstorm/route-6ec0e723e471f87a.js +1 -0
  85. package/.next/static/chunks/app/api/projects/[id]/git-sync/route-6ec0e723e471f87a.js +1 -0
  86. package/.next/static/chunks/app/api/projects/[id]/route-6ec0e723e471f87a.js +1 -0
  87. package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/route-6ec0e723e471f87a.js +1 -0
  88. package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/chat/route-6ec0e723e471f87a.js +1 -0
  89. package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/prompt/route-6ec0e723e471f87a.js +1 -0
  90. package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/refine/route-6ec0e723e471f87a.js +1 -0
  91. package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/route-6ec0e723e471f87a.js +1 -0
  92. package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/route-6ec0e723e471f87a.js +1 -0
  93. package/.next/static/chunks/app/api/projects/[id]/sub-projects/route-6ec0e723e471f87a.js +1 -0
  94. package/.next/static/chunks/app/api/projects/route-6ec0e723e471f87a.js +1 -0
  95. package/.next/static/chunks/app/api/sync/route-6ec0e723e471f87a.js +1 -0
  96. package/.next/static/chunks/app/page-6a511af64da7531f.js +28 -0
  97. package/.next/static/chunks/next/dist/client/components/builtin/app-error-6ec0e723e471f87a.js +1 -0
  98. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-6ec0e723e471f87a.js +1 -0
  99. package/.next/static/chunks/next/dist/client/components/builtin/not-found-6ec0e723e471f87a.js +1 -0
  100. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-6ec0e723e471f87a.js +1 -0
  101. package/.next/static/css/cc32379d0efa7d1d.css +3 -0
  102. package/next.config.mjs +3 -0
  103. package/package.json +11 -6
  104. package/src/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/chat/route.ts +9 -5
  105. package/src/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/refine/route.ts +76 -0
  106. package/src/components/dashboard/DashboardPanel.tsx +1 -1
  107. package/src/components/dashboard/SubProjectCard.tsx +1 -0
  108. package/src/components/task/CommandPalette.tsx +137 -0
  109. package/src/components/task/NoteEditor.tsx +411 -0
  110. package/src/components/task/ProjectTree.tsx +1 -1
  111. package/src/components/task/StatusFlow.tsx +43 -20
  112. package/src/components/task/TaskChat.tsx +7 -7
  113. package/src/components/task/TaskDetail.tsx +270 -89
  114. package/src/components/task/TaskList.tsx +1 -1
  115. package/src/components/workspace/WorkspacePanel.tsx +8 -3
  116. package/src/lib/ai/agents.ts +3 -3
  117. package/src/lib/ai/client.ts +3 -1
  118. package/src/lib/db/index.ts +4 -1
  119. package/src/lib/db/queries/sub-projects.ts +3 -3
  120. package/src/lib/db/queries/tasks.ts +1 -1
  121. package/src/lib/db/schema.ts +60 -1
  122. package/src/types/index.ts +3 -1
  123. package/.next/server/chunks/806.js +0 -77
  124. package/.next/static/chunks/151-332d463cd8bd4db6.js +0 -1
  125. package/.next/static/chunks/app/_global-error/page-fd75b71b49e9729e.js +0 -1
  126. package/.next/static/chunks/app/api/archive/route-fd75b71b49e9729e.js +0 -1
  127. package/.next/static/chunks/app/api/filesystem/route-fd75b71b49e9729e.js +0 -1
  128. package/.next/static/chunks/app/api/filesystem/tree/route-fd75b71b49e9729e.js +0 -1
  129. package/.next/static/chunks/app/api/global-memo/route-fd75b71b49e9729e.js +0 -1
  130. package/.next/static/chunks/app/api/health/route-fd75b71b49e9729e.js +0 -1
  131. package/.next/static/chunks/app/api/projects/[id]/apply-distribute/route-fd75b71b49e9729e.js +0 -1
  132. package/.next/static/chunks/app/api/projects/[id]/auto-distribute/route-fd75b71b49e9729e.js +0 -1
  133. package/.next/static/chunks/app/api/projects/[id]/brainstorm/route-fd75b71b49e9729e.js +0 -1
  134. package/.next/static/chunks/app/api/projects/[id]/git-sync/route-fd75b71b49e9729e.js +0 -1
  135. package/.next/static/chunks/app/api/projects/[id]/route-fd75b71b49e9729e.js +0 -1
  136. package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/route-fd75b71b49e9729e.js +0 -1
  137. package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/chat/route-fd75b71b49e9729e.js +0 -1
  138. package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/prompt/route-fd75b71b49e9729e.js +0 -1
  139. package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/route-fd75b71b49e9729e.js +0 -1
  140. package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/route-fd75b71b49e9729e.js +0 -1
  141. package/.next/static/chunks/app/api/projects/[id]/sub-projects/route-fd75b71b49e9729e.js +0 -1
  142. package/.next/static/chunks/app/api/projects/route-fd75b71b49e9729e.js +0 -1
  143. package/.next/static/chunks/app/api/sync/route-fd75b71b49e9729e.js +0 -1
  144. package/.next/static/chunks/app/page-d0d563bda0034c18.js +0 -19
  145. package/.next/static/chunks/next/dist/client/components/builtin/app-error-fd75b71b49e9729e.js +0 -1
  146. package/.next/static/chunks/next/dist/client/components/builtin/forbidden-fd75b71b49e9729e.js +0 -1
  147. package/.next/static/chunks/next/dist/client/components/builtin/not-found-fd75b71b49e9729e.js +0 -1
  148. package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-fd75b71b49e9729e.js +0 -1
  149. package/.next/static/css/22a3bf63fb41db4f.css +0 -3
  150. /package/.next/static/{3dIOxF31xgLe9pGE0yrsa → 63zinfEtSLCdG9nUZ3W-E}/_buildManifest.js +0 -0
  151. /package/.next/static/{3dIOxF31xgLe9pGE0yrsa → 63zinfEtSLCdG9nUZ3W-E}/_ssgManifest.js +0 -0
@@ -8,6 +8,8 @@ export type OnRawEvent = (event: Record<string, unknown>) => void;
8
8
  export interface RunAgentOptions {
9
9
  cwd?: string;
10
10
  timeoutMs?: number;
11
+ /** Optional model override (e.g. "sonnet" for faster light tasks). */
12
+ model?: string;
11
13
  }
12
14
 
13
15
  /**
@@ -28,7 +30,7 @@ export function runAgent(
28
30
 
29
31
  return new Promise((resolve, reject) => {
30
32
  const useStreamJson = !!(onText || onRawEvent);
31
- const args = config.buildArgs({ streaming: useStreamJson });
33
+ const args = config.buildArgs({ streaming: useStreamJson, model: options?.model });
32
34
  const env = config.buildEnv();
33
35
 
34
36
  const proc = spawn(config.binary, args, {
@@ -143,7 +143,10 @@ async function initAsync(): Promise<DatabaseWrapper> {
143
143
  if (wrapper) return wrapper;
144
144
 
145
145
  // eslint-disable-next-line @typescript-eslint/no-require-imports
146
- const initSqlJs = require('sql.js/dist/sql-asm.js');
146
+ const initSqlJs = require('sql.js/dist/sql-wasm.js');
147
+ // In Node, sql.js resolves the .wasm file relative to its own __dirname
148
+ // (node_modules/sql.js/dist). `serverExternalPackages: ['sql.js']` keeps
149
+ // the package unbundled so that resolution works.
147
150
  const SQL = await initSqlJs();
148
151
 
149
152
  const dbPath = getDbPath();
@@ -24,7 +24,7 @@ export function getSubProjectsWithStats(projectId: string): ISubProjectWithStats
24
24
  const stats = db.prepare(`
25
25
  SELECT
26
26
  COUNT(*) as task_count,
27
- SUM(CASE WHEN status IN ('submitted','testing') THEN 1 ELSE 0 END) as active_count,
27
+ SUM(CASE WHEN status IN ('doing','submitted','testing') THEN 1 ELSE 0 END) as active_count,
28
28
  SUM(CASE WHEN status IN ('idea','writing') THEN 1 ELSE 0 END) as pending_count,
29
29
  SUM(CASE WHEN status = 'done' THEN 1 ELSE 0 END) as done_count,
30
30
  SUM(CASE WHEN status = 'problem' THEN 1 ELSE 0 END) as problem_count,
@@ -42,8 +42,8 @@ export function getSubProjectsWithStats(projectId: string): ISubProjectWithStats
42
42
  const previewTasks = db.prepare(
43
43
  `SELECT title, status FROM tasks WHERE sub_project_id = ? AND is_archived = 0
44
44
  ORDER BY CASE status
45
- WHEN 'submitted' THEN 0 WHEN 'testing' THEN 1 WHEN 'writing' THEN 2
46
- WHEN 'idea' THEN 3 WHEN 'problem' THEN 4 WHEN 'done' THEN 5
45
+ WHEN 'doing' THEN 0 WHEN 'submitted' THEN 1 WHEN 'testing' THEN 2 WHEN 'writing' THEN 3
46
+ WHEN 'idea' THEN 4 WHEN 'problem' THEN 5 WHEN 'done' THEN 6
47
47
  END, sort_order ASC LIMIT 5`
48
48
  ).all(sp.id) as { title: string; status: TaskStatus }[];
49
49
 
@@ -57,7 +57,7 @@ export function getTodayTasks(projectId: string): ITask[] {
57
57
  export function getActiveTasks(projectId: string): ITask[] {
58
58
  const db = getDb();
59
59
  const rows = db.prepare(
60
- "SELECT * FROM tasks WHERE project_id = ? AND status IN ('submitted','testing') AND is_archived = 0 ORDER BY sort_order ASC"
60
+ "SELECT * FROM tasks WHERE project_id = ? AND status IN ('doing','submitted','testing') AND is_archived = 0 ORDER BY sort_order ASC"
61
61
  ).all(projectId) as TaskRow[];
62
62
  return rows.map(rowToTask);
63
63
  }
@@ -57,7 +57,7 @@ export function initSchema(db: any): void {
57
57
  title TEXT NOT NULL,
58
58
  description TEXT NOT NULL DEFAULT '',
59
59
  status TEXT NOT NULL DEFAULT 'idea'
60
- CHECK(status IN ('idea','writing','submitted','testing','done','problem')),
60
+ CHECK(status IN ('idea','doing','writing','submitted','testing','done','problem')),
61
61
  priority TEXT NOT NULL DEFAULT 'medium'
62
62
  CHECK(priority IN ('high','medium','low')),
63
63
  is_today INTEGER NOT NULL DEFAULT 0,
@@ -103,4 +103,63 @@ export function initSchema(db: any): void {
103
103
  if (!taskCols.some(c => c.name === 'tags')) {
104
104
  db.exec("ALTER TABLE tasks ADD COLUMN tags TEXT NOT NULL DEFAULT '[]'");
105
105
  }
106
+
107
+ // Legacy prompt → description 병합 (한 번만 실행; 마커로 중복 방지)
108
+ const LEGACY_MARKER = '<!-- legacy-prompt -->';
109
+ const promptRows = db.prepare(`
110
+ SELECT tp.task_id AS task_id, tp.content AS content, t.description AS description
111
+ FROM task_prompts tp
112
+ JOIN tasks t ON t.id = tp.task_id
113
+ WHERE tp.content IS NOT NULL AND TRIM(tp.content) <> ''
114
+ AND (t.description IS NULL OR t.description NOT LIKE '%${LEGACY_MARKER}%')
115
+ `).all() as { task_id: string; content: string; description: string | null }[];
116
+ if (promptRows.length > 0) {
117
+ const updateStmt = db.prepare('UPDATE tasks SET description = ? WHERE id = ?');
118
+ for (const row of promptRows) {
119
+ const existing = (row.description ?? '').trimEnd();
120
+ const merged = [
121
+ existing,
122
+ existing ? '' : null,
123
+ existing ? '---' : null,
124
+ `${LEGACY_MARKER}`,
125
+ '**Legacy Prompt**',
126
+ '',
127
+ row.content.trim(),
128
+ ].filter(v => v !== null).join('\n');
129
+ updateStmt.run(merged, row.task_id);
130
+ }
131
+ }
132
+
133
+ // 'doing' status migration: old CHECK constraint lacks 'doing'.
134
+ // SQLite can't alter CHECK, so rebuild tasks table when needed.
135
+ const tasksTableRow = db.prepare(
136
+ "SELECT sql FROM sqlite_master WHERE type='table' AND name='tasks'"
137
+ ).get() as { sql: string } | undefined;
138
+ if (tasksTableRow && !tasksTableRow.sql.includes("'doing'")) {
139
+ db.exec(`
140
+ CREATE TABLE tasks_new (
141
+ id TEXT PRIMARY KEY,
142
+ project_id TEXT NOT NULL,
143
+ sub_project_id TEXT NOT NULL,
144
+ title TEXT NOT NULL,
145
+ description TEXT NOT NULL DEFAULT '',
146
+ status TEXT NOT NULL DEFAULT 'idea'
147
+ CHECK(status IN ('idea','doing','writing','submitted','testing','done','problem')),
148
+ priority TEXT NOT NULL DEFAULT 'medium'
149
+ CHECK(priority IN ('high','medium','low')),
150
+ is_today INTEGER NOT NULL DEFAULT 0,
151
+ sort_order INTEGER NOT NULL DEFAULT 0,
152
+ created_at TEXT NOT NULL DEFAULT (datetime('now')),
153
+ updated_at TEXT NOT NULL DEFAULT (datetime('now')),
154
+ is_archived INTEGER NOT NULL DEFAULT 0,
155
+ tags TEXT NOT NULL DEFAULT '[]',
156
+ FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE,
157
+ FOREIGN KEY (sub_project_id) REFERENCES sub_projects(id) ON DELETE CASCADE
158
+ );
159
+ INSERT INTO tasks_new (id, project_id, sub_project_id, title, description, status, priority, is_today, sort_order, created_at, updated_at, is_archived, tags)
160
+ SELECT id, project_id, sub_project_id, title, description, status, priority, is_today, sort_order, created_at, updated_at, is_archived, tags FROM tasks;
161
+ DROP TABLE tasks;
162
+ ALTER TABLE tasks_new RENAME TO tasks;
163
+ `);
164
+ }
106
165
  }
@@ -22,7 +22,9 @@ export interface IBrainstorm {
22
22
  }
23
23
 
24
24
  export type ItemPriority = 'high' | 'medium' | 'low';
25
- export type TaskStatus = 'idea' | 'writing' | 'submitted' | 'testing' | 'done' | 'problem';
25
+ export type TaskStatus = 'idea' | 'doing' | 'writing' | 'submitted' | 'testing' | 'done' | 'problem';
26
+ export const ACTIVE_STATUSES: TaskStatus[] = ['idea', 'doing', 'done', 'problem'];
27
+ export const LEGACY_STATUSES: TaskStatus[] = ['writing', 'submitted', 'testing'];
26
28
 
27
29
  export interface ISubProject {
28
30
  id: string;
@@ -1,77 +0,0 @@
1
- exports.id=806,exports.ids=[806],exports.modules={1799:(a,b,c)=>{"use strict";c.d(b,{bE:()=>m,sA:()=>k});var d=c(3873),e=c.n(d),f=c(1820),g=c.n(f),h=c(9021),i=c.n(h);let j=e().join(g().homedir(),".idea-manager","data");function k(){return e().join((i().existsSync(j)||i().mkdirSync(j,{recursive:!0}),j),"im.db")}let l=e().join(g().homedir(),".idea-manager","sync");function m(){return i().existsSync(l)||i().mkdirSync(l,{recursive:!0}),l}},3052:(a,b,c)=>{"use strict";c.d(b,{J:()=>f});var d=c(1421);let e={claude:{name:"Claude",binary:"claude",buildArgs:({streaming:a})=>["--dangerously-skip-permissions","--model","opus",...a?["--output-format","stream-json","--verbose"]:["--output-format","text"],"--max-turns","80","-p","-"],buildEnv:()=>{let a={...process.env};for(let b of(delete a.CLAUDECODE,delete a.CLAUDE_CODE_ENTRYPOINT,delete a.CLAUDE_CODE_MAX_OUTPUT_TOKENS,Object.keys(a)))(b.startsWith("CLAUDE_CODE_")||"ANTHROPIC_PARENT_SESSION"===b)&&delete a[b];return{...a,FORCE_COLOR:"0"}},parseStreamEvent:a=>{if("content_block_delta"===a.type&&a.delta?.text)return{text:a.delta.text};if("assistant"===a.type&&a.message?.content){let b="";for(let c of a.message.content)"text"===c.type&&(b+=c.text);return{final:b}}return"result"===a.type&&a.result?{final:a.result}:null},cleanOutput:a=>a.replace(/Error: Reached max turns \(\d+\)\s*/g,"").trim()},gemini:{name:"Gemini",binary:"gemini",buildArgs:({streaming:a})=>["--yolo","-m","gemini-2.5-flash",...a?["--output-format","stream-json"]:["--output-format","json"],"-p","-"],buildEnv:()=>({...process.env,FORCE_COLOR:"0"}),parseStreamEvent:a=>"content_block_delta"===a.type&&a.delta?.text?{text:a.delta.text}:"result"===a.type?{final:a.response||a.text||a.result}:null,cleanOutput:a=>{let b=a.trim();if(!b.startsWith("{"))return b;try{let a=JSON.parse(b);return a.response||a.text||a.result||b}catch{return b}}},codex:{name:"Codex",binary:"codex",buildArgs:({streaming:a})=>["exec","--full-auto",...a?["--json"]:[],"-"],buildEnv:()=>({...process.env,FORCE_COLOR:"0"}),parseStreamEvent:a=>"item.completed"===a.type&&a.item?.type==="agent_message"?{final:a.item.text}:"item.updated"===a.type&&a.item?.type==="agent_message"?{text:a.item.text}:null}};function f(a,b,c,f,g){let h=e[a];return h?new Promise((a,e)=>{let i=!!(c||f),j=h.buildArgs({streaming:i}),k=h.buildEnv(),l=(0,d.spawn)(h.binary,j,{cwd:g?.cwd||process.cwd(),stdio:["pipe","pipe","pipe"],shell:"win32"===process.platform,env:k}),m=null,n=!1;g?.timeoutMs&&(m=setTimeout(()=>{n=!0,l.kill("SIGTERM")},g.timeoutMs)),l.stdin?.write(b),l.stdin?.end();let o="",p="",q="",r=0;i?l.stdout?.on("data",a=>{let b=(o+=a.toString()).split("\n");for(let a of(o=b.pop()??"",b)){let b=a.trim();if(b)try{let a=JSON.parse(b);f?.(a);let d=h.parseStreamEvent(a);if(d)if(d.final){if(d.final.length>r){let a=d.final.slice(r);c?.(a),r=d.final.length}p=d.final}else d.text&&(p+=d.text,r=p.length,c?.(d.text))}catch{}}}):l.stdout?.on("data",a=>{p+=a.toString()}),l.stderr?.on("data",a=>{q+=a.toString()}),l.on("error",a=>{e(Error(`${h.name} CLI error: ${a.message}`))}),l.on("exit",(b,c)=>{if(m&&clearTimeout(m),!i&&h.cleanOutput&&(p=h.cleanOutput(p)),n)return void e(Error(`${h.name} CLI timed out after ${Math.round((g?.timeoutMs||0)/1e3)}s`));if(0!==b&&!p){let a=q.slice(0,500)||(c?`killed by signal ${c}`:"no output");e(Error(`${h.name} CLI exited with code ${b}: ${a}`));return}a(p)})}):Promise.reject(Error(`Unknown agent type: ${a}`))}},4181:(a,b,c)=>{"use strict";c.d(b,{T:()=>f,a:()=>e});var d=c(5440);function e(a){return(0,d.L)().prepare("SELECT * FROM brainstorms WHERE project_id = ? ORDER BY version DESC LIMIT 1").get(a)}function f(a,b){let c=(0,d.L)(),f=new Date().toISOString(),g=e(a);if(g)return c.prepare("UPDATE brainstorms SET content = ?, version = version + 1, updated_at = ? WHERE id = ?").run(b,f,g.id),c.prepare("UPDATE projects SET updated_at = ? WHERE id = ?").run(f,a),e(a)}},5359:(a,b,c)=>{"use strict";let d,e;c.d(b,{$:()=>g});var f=c(7598);function g(){return function(a=21){var b;b=a|=0,!d||d.length<b?(d=Buffer.allocUnsafe(128*b),f.webcrypto.getRandomValues(d),e=0):e+b>d.length&&(f.webcrypto.getRandomValues(d),e=0),e+=b;let c="";for(let b=e-a;b<e;b++)c+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&d[b]];return c}(16)}},5440:(a,b,c)=>{"use strict";c.d(b,{t:()=>o,L:()=>p});var d=c(9021),e=c.n(d),f=c(1799),g=c(1421);let h=!1,i="";async function j(){let a=new Date,b=a.getHours(),c=`${a.getFullYear()}-${String(a.getMonth()+1).padStart(2,"0")}-${String(a.getDate()).padStart(2,"0")}`;if(9===b&&i!==c)try{let a,b;await o();let d=p(),e=d.prepare("SELECT t.title, t.status, p.name as project_name FROM tasks t JOIN projects p ON t.project_id = p.id WHERE t.is_today = 1 AND t.status != 'done'").all(),f=d.prepare("SELECT COUNT(*) as count FROM tasks WHERE status IN ('submitted', 'testing')").get(),h=d.prepare("SELECT COUNT(*) as count FROM tasks WHERE status = 'problem'").get(),j=[];if(e.length>0){for(let a of(j.push(`Today: ${e.length}개`),e.slice(0,5)))j.push(` - ${a.title}`);e.length>5&&j.push(` ... +${e.length-5}개`)}else j.push("Today 태스크가 없습니다.");f.count>0&&j.push(`진행 중: ${f.count}개`),h.count>0&&j.push(`문제: ${h.count}개`),a=j.join("\n").replace(/"/g,'\\"').replace(/\n/g,"\\n"),b=`display notification "${a}" with title "IM - 오늘의 할 일"`,(0,g.exec)(`osascript -e '${b}'`,a=>{a&&console.error("[Scheduler] notification error:",a.message)}),i=c}catch(a){console.error("[Scheduler] error:",a)}}class k{constructor(a,b){this.dirty=!1,this.inTransaction=!1,this.db=a,this.dbPath=b}save(){if(!this.dirty)return;let a=this.db.export();e().writeFileSync(this.dbPath,Buffer.from(a)),this.dirty=!1}immediatelySave(){this.dirty=!0,this.inTransaction||this.save()}rowsToObjects(a,b){return b.map(b=>{let c={};return a.forEach((a,d)=>{c[a]=b[d]}),c})}prepare(a){let b=this,c=/^\s*(INSERT|UPDATE|DELETE|CREATE|ALTER|DROP)/i.test(a);return{all(...c){let d=b.db.prepare(a);c.length>0&&d.bind(c);let e=d.getColumnNames(),f=[];for(;d.step();)f.push(d.get());return d.free(),b.rowsToObjects(e,f)},get(...c){let d,e=b.db.prepare(a);if(c.length>0&&e.bind(c),e.step()){let a=e.getColumnNames(),b=e.get(),c={};a.forEach((a,d)=>{c[a]=b[d]}),d=c}return e.free(),d},run:(...d)=>(b.db.run(a,d),c&&b.immediatelySave(),{changes:b.db.getRowsModified()})}}exec(a){this.db.exec(a),/^\s*(INSERT|UPDATE|DELETE|CREATE|ALTER|DROP)/im.test(a)&&this.immediatelySave()}pragma(a){if(a.startsWith("table_info(")){let b=a.match(/table_info\((\w+)\)/)?.[1];if(!b)return[];let c=this.db.exec(`PRAGMA table_info(${b})`);return c.length?this.rowsToObjects(c[0].columns,c[0].values):[]}if(a.includes("journal_mode")||a.includes("wal_checkpoint"))return this.immediatelySave(),"memory";if(a.includes("foreign_keys")){try{this.db.run(`PRAGMA ${a}`)}catch{}return}try{let b=this.db.exec(`PRAGMA ${a}`);if(b.length>0&&b[0].values.length>0)return b[0].values[0][0]}catch{}}transaction(a){let b=this;return()=>{b.inTransaction=!0,b.db.run("BEGIN");try{let c=a();return b.db.run("COMMIT"),b.inTransaction=!1,b.immediatelySave(),c}catch(a){b.inTransaction=!1;try{b.db.run("ROLLBACK")}catch{}throw a}}}close(){this.immediatelySave(),this.db.close()}}let l=null,m=null;async function n(){var a;let b,d,g;if(l)return l;let i=c(7604),m=await i(),n=(0,f.sA)();if(e().existsSync(n)){let a=e().readFileSync(n);b=new m.Database(a)}else b=new m.Database;return(a=l=new k(b,n)).exec(`
2
- CREATE TABLE IF NOT EXISTS projects (
3
- id TEXT PRIMARY KEY,
4
- name TEXT NOT NULL,
5
- description TEXT NOT NULL DEFAULT '',
6
- project_path TEXT,
7
- created_at TEXT NOT NULL DEFAULT (datetime('now')),
8
- updated_at TEXT NOT NULL DEFAULT (datetime('now'))
9
- );
10
-
11
- CREATE TABLE IF NOT EXISTS brainstorms (
12
- id TEXT PRIMARY KEY,
13
- project_id TEXT NOT NULL,
14
- content TEXT NOT NULL DEFAULT '',
15
- version INTEGER NOT NULL DEFAULT 1,
16
- created_at TEXT NOT NULL DEFAULT (datetime('now')),
17
- updated_at TEXT NOT NULL DEFAULT (datetime('now')),
18
- FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
19
- );
20
-
21
- `),(d=a.prepare("PRAGMA table_info(projects)").all()).some(a=>"project_path"===a.name)||a.exec("ALTER TABLE projects ADD COLUMN project_path TEXT"),d.some(a=>"ai_context"===a.name)||a.exec("ALTER TABLE projects ADD COLUMN ai_context TEXT NOT NULL DEFAULT ''"),d.some(a=>"watch_enabled"===a.name)||a.exec("ALTER TABLE projects ADD COLUMN watch_enabled INTEGER NOT NULL DEFAULT 0"),d.some(a=>"agent_type"===a.name)||a.exec("ALTER TABLE projects ADD COLUMN agent_type TEXT NOT NULL DEFAULT 'claude'"),a.exec(`
22
- CREATE TABLE IF NOT EXISTS sub_projects (
23
- id TEXT PRIMARY KEY,
24
- project_id TEXT NOT NULL,
25
- name TEXT NOT NULL,
26
- description TEXT NOT NULL DEFAULT '',
27
- folder_path TEXT,
28
- sort_order INTEGER NOT NULL DEFAULT 0,
29
- created_at TEXT NOT NULL DEFAULT (datetime('now')),
30
- updated_at TEXT NOT NULL DEFAULT (datetime('now')),
31
- FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
32
- );
33
-
34
- CREATE TABLE IF NOT EXISTS tasks (
35
- id TEXT PRIMARY KEY,
36
- project_id TEXT NOT NULL,
37
- sub_project_id TEXT NOT NULL,
38
- title TEXT NOT NULL,
39
- description TEXT NOT NULL DEFAULT '',
40
- status TEXT NOT NULL DEFAULT 'idea'
41
- CHECK(status IN ('idea','writing','submitted','testing','done','problem')),
42
- priority TEXT NOT NULL DEFAULT 'medium'
43
- CHECK(priority IN ('high','medium','low')),
44
- is_today INTEGER NOT NULL DEFAULT 0,
45
- sort_order INTEGER NOT NULL DEFAULT 0,
46
- created_at TEXT NOT NULL DEFAULT (datetime('now')),
47
- updated_at TEXT NOT NULL DEFAULT (datetime('now')),
48
- FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE,
49
- FOREIGN KEY (sub_project_id) REFERENCES sub_projects(id) ON DELETE CASCADE
50
- );
51
-
52
- CREATE TABLE IF NOT EXISTS task_prompts (
53
- id TEXT PRIMARY KEY,
54
- task_id TEXT NOT NULL UNIQUE,
55
- content TEXT NOT NULL DEFAULT '',
56
- prompt_type TEXT NOT NULL DEFAULT 'manual'
57
- CHECK(prompt_type IN ('manual','ai_assisted')),
58
- created_at TEXT NOT NULL DEFAULT (datetime('now')),
59
- updated_at TEXT NOT NULL DEFAULT (datetime('now')),
60
- FOREIGN KEY (task_id) REFERENCES tasks(id) ON DELETE CASCADE
61
- );
62
-
63
- CREATE TABLE IF NOT EXISTS global_memos (
64
- id TEXT PRIMARY KEY,
65
- content TEXT NOT NULL DEFAULT '',
66
- updated_at TEXT NOT NULL DEFAULT (datetime('now'))
67
- );
68
-
69
- CREATE TABLE IF NOT EXISTS task_conversations (
70
- id TEXT PRIMARY KEY,
71
- task_id TEXT NOT NULL,
72
- role TEXT NOT NULL CHECK(role IN ('assistant','user')),
73
- content TEXT NOT NULL,
74
- created_at TEXT NOT NULL DEFAULT (datetime('now')),
75
- FOREIGN KEY (task_id) REFERENCES tasks(id) ON DELETE CASCADE
76
- );
77
- `),(g=a.prepare("PRAGMA table_info(tasks)").all()).some(a=>"is_archived"===a.name)||a.exec("ALTER TABLE tasks ADD COLUMN is_archived INTEGER NOT NULL DEFAULT 0"),g.some(a=>"tags"===a.name)||a.exec("ALTER TABLE tasks ADD COLUMN tags TEXT NOT NULL DEFAULT '[]'"),process.on("exit",()=>l?.close()),h||(h=!0,setInterval(j,6e4),j(),console.log("[Scheduler] Morning notification scheduler started")),l}async function o(){return l||(m||(m=n()),m)}function p(){if(!l)throw Error("Database not initialized. Call await ensureDb() first.");return l}},6241:(a,b,c)=>{"use strict";c.d(b,{U1:()=>h,gA:()=>i,hF:()=>g,vr:()=>j,xx:()=>k});var d=c(5440),e=c(5359);function f(a){return{...a,watch_enabled:1===a.watch_enabled,agent_type:a.agent_type||"claude"}}function g(){return(0,d.L)().prepare("SELECT * FROM projects ORDER BY updated_at DESC").all().map(f)}function h(a){let b=(0,d.L)().prepare("SELECT * FROM projects WHERE id = ?").get(a);return b?f(b):void 0}function i(a,b="",c){let f=(0,d.L)(),g=(0,e.$)(),j=new Date().toISOString();f.prepare("INSERT INTO projects (id, name, description, project_path, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)").run(g,a,b,c??null,j,j);let k=(0,e.$)();return f.prepare("INSERT INTO brainstorms (id, project_id, content, version, created_at, updated_at) VALUES (?, ?, ?, 1, ?, ?)").run(k,g,"",j,j),h(g)}function j(a,b){let c=(0,d.L)(),e=h(a);if(!e)return;let f=new Date().toISOString();return c.prepare("UPDATE projects SET name = ?, description = ?, project_path = ?, ai_context = ?, watch_enabled = ?, agent_type = ?, updated_at = ? WHERE id = ?").run(b.name??e.name,b.description??e.description,void 0!==b.project_path?b.project_path:e.project_path,void 0!==b.ai_context?b.ai_context:e.ai_context??"",void 0!==b.watch_enabled?+!!b.watch_enabled:+!!e.watch_enabled,b.agent_type??e.agent_type??"claude",f,a),h(a)}function k(a){return(0,d.L)().prepare("DELETE FROM projects WHERE id = ?").run(a).changes>0}},6487:()=>{},8335:()=>{}};