@iloom/cli 0.1.18 → 0.1.19
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/README.md +37 -6
- package/dist/{ClaudeContextManager-LD3VB6EM.js → ClaudeContextManager-JKR4WGNU.js} +4 -4
- package/dist/{ClaudeService-CFFI7DD5.js → ClaudeService-55DQGB7T.js} +3 -3
- package/dist/{GitHubService-SH4H6VS5.js → GitHubService-LWP4GKGH.js} +3 -3
- package/dist/{LoomLauncher-FB2MV2ZI.js → LoomLauncher-UMMLPIZO.js} +4 -4
- package/dist/{PromptTemplateManager-WM5GIPEF.js → PromptTemplateManager-WII75TKH.js} +2 -2
- package/dist/README.md +755 -0
- package/dist/{add-issue-L5HX6LEV.js → add-issue-X56V3XPB.js} +3 -3
- package/dist/{chunk-SLIMABFA.js → chunk-DEPYQRRB.js} +2 -2
- package/dist/{chunk-HURVAQRK.js → chunk-ELFT36PV.js} +2 -2
- package/dist/{chunk-DGEKUT7Q.js → chunk-JXQXSC45.js} +33 -5
- package/dist/chunk-JXQXSC45.js.map +1 -0
- package/dist/{chunk-L4QGC27H.js → chunk-PVAVNJKS.js} +13 -1
- package/dist/chunk-PVAVNJKS.js.map +1 -0
- package/dist/{chunk-6OTVPRXH.js → chunk-VCMMAFXQ.js} +2 -2
- package/dist/{chunk-IIPTBZQW.js → chunk-ZWXJBSUW.js} +2 -2
- package/dist/cli.js +24 -14
- package/dist/cli.js.map +1 -1
- package/dist/contribute-3MQJ3XAQ.js +256 -0
- package/dist/contribute-3MQJ3XAQ.js.map +1 -0
- package/dist/{enhance-VVMAKMVZ.js → enhance-VGWUX474.js} +4 -4
- package/dist/{feedback-AKHD7QIM.js → feedback-ZOUCCHN4.js} +3 -3
- package/dist/{finish-WGPISUEH.js → finish-QJSK6Z7J.js} +3 -3
- package/dist/{ignite-JEN3K3OT.js → ignite-HICLZEYU.js} +121 -6
- package/dist/ignite-HICLZEYU.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +43 -4
- package/dist/index.js.map +1 -1
- package/dist/{init-EVUT4ZQJ.js → init-UMKNHNV5.js} +2 -2
- package/dist/mcp/github-comment-server.js.map +1 -1
- package/dist/prompts/init-prompt.txt +3 -1
- package/dist/prompts/issue-prompt.txt +141 -9
- package/dist/{start-2NEZU7SE.js → start-CT2ZEFP2.js} +10 -10
- package/package.json +3 -2
- package/dist/chunk-DGEKUT7Q.js.map +0 -1
- package/dist/chunk-L4QGC27H.js.map +0 -1
- package/dist/ignite-JEN3K3OT.js.map +0 -1
- /package/dist/{ClaudeContextManager-LD3VB6EM.js.map → ClaudeContextManager-JKR4WGNU.js.map} +0 -0
- /package/dist/{ClaudeService-CFFI7DD5.js.map → ClaudeService-55DQGB7T.js.map} +0 -0
- /package/dist/{GitHubService-SH4H6VS5.js.map → GitHubService-LWP4GKGH.js.map} +0 -0
- /package/dist/{LoomLauncher-FB2MV2ZI.js.map → LoomLauncher-UMMLPIZO.js.map} +0 -0
- /package/dist/{PromptTemplateManager-WM5GIPEF.js.map → PromptTemplateManager-WII75TKH.js.map} +0 -0
- /package/dist/{add-issue-L5HX6LEV.js.map → add-issue-X56V3XPB.js.map} +0 -0
- /package/dist/{chunk-SLIMABFA.js.map → chunk-DEPYQRRB.js.map} +0 -0
- /package/dist/{chunk-HURVAQRK.js.map → chunk-ELFT36PV.js.map} +0 -0
- /package/dist/{chunk-6OTVPRXH.js.map → chunk-VCMMAFXQ.js.map} +0 -0
- /package/dist/{chunk-IIPTBZQW.js.map → chunk-ZWXJBSUW.js.map} +0 -0
- /package/dist/{enhance-VVMAKMVZ.js.map → enhance-VGWUX474.js.map} +0 -0
- /package/dist/{feedback-AKHD7QIM.js.map → feedback-ZOUCCHN4.js.map} +0 -0
- /package/dist/{finish-WGPISUEH.js.map → finish-QJSK6Z7J.js.map} +0 -0
- /package/dist/{init-EVUT4ZQJ.js.map → init-UMKNHNV5.js.map} +0 -0
- /package/dist/{start-2NEZU7SE.js.map → start-CT2ZEFP2.js.map} +0 -0
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
} from "./chunk-FXV24OYZ.js";
|
|
13
13
|
import {
|
|
14
14
|
GitHubService
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-ZWXJBSUW.js";
|
|
16
|
+
import "./chunk-JXQXSC45.js";
|
|
17
17
|
import "./chunk-PXZBAC2M.js";
|
|
18
18
|
import {
|
|
19
19
|
SettingsManager
|
|
@@ -66,4 +66,4 @@ var AddIssueCommand = class {
|
|
|
66
66
|
export {
|
|
67
67
|
AddIssueCommand
|
|
68
68
|
};
|
|
69
|
-
//# sourceMappingURL=add-issue-
|
|
69
|
+
//# sourceMappingURL=add-issue-X56V3XPB.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ClaudeService
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ELFT36PV.js";
|
|
5
5
|
import {
|
|
6
6
|
logger
|
|
7
7
|
} from "./chunk-GEHQXLEI.js";
|
|
@@ -63,4 +63,4 @@ var ClaudeContextManager = class {
|
|
|
63
63
|
export {
|
|
64
64
|
ClaudeContextManager
|
|
65
65
|
};
|
|
66
|
-
//# sourceMappingURL=chunk-
|
|
66
|
+
//# sourceMappingURL=chunk-DEPYQRRB.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-PXZBAC2M.js";
|
|
8
8
|
import {
|
|
9
9
|
PromptTemplateManager
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PVAVNJKS.js";
|
|
11
11
|
import {
|
|
12
12
|
SettingsManager
|
|
13
13
|
} from "./chunk-VYQLLHZ7.js";
|
|
@@ -148,4 +148,4 @@ var ClaudeService = class {
|
|
|
148
148
|
export {
|
|
149
149
|
ClaudeService
|
|
150
150
|
};
|
|
151
|
-
//# sourceMappingURL=chunk-
|
|
151
|
+
//# sourceMappingURL=chunk-ELFT36PV.js.map
|
|
@@ -19,12 +19,39 @@ async function checkGhAuth() {
|
|
|
19
19
|
var _a, _b;
|
|
20
20
|
try {
|
|
21
21
|
const output = await executeGhCommand(["auth", "status"]);
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const lines = output.split("\n");
|
|
23
|
+
let username;
|
|
24
|
+
let scopes = [];
|
|
25
|
+
for (let i = 0; i < lines.length; i++) {
|
|
26
|
+
const line = lines[i];
|
|
27
|
+
const newFormatMatch = line == null ? void 0 : line.match(/Logged in to github\.com account ([^\s(]+)/);
|
|
28
|
+
if (newFormatMatch) {
|
|
29
|
+
const accountName = newFormatMatch[1];
|
|
30
|
+
const nextFewLines = lines.slice(i + 1, i + 5).join("\n");
|
|
31
|
+
const isActive = nextFewLines.includes("Active account: true");
|
|
32
|
+
if (isActive || !username && !output.includes("Active account:")) {
|
|
33
|
+
username = accountName;
|
|
34
|
+
const scopeMatch = nextFewLines.match(/Token scopes: (.+)/);
|
|
35
|
+
if (scopeMatch == null ? void 0 : scopeMatch[1]) {
|
|
36
|
+
scopes = scopeMatch[1].split(", ").map((scope) => scope.replace(/^'|'$/g, ""));
|
|
37
|
+
}
|
|
38
|
+
if (isActive) break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (!username) {
|
|
42
|
+
const oldFormatMatch = line == null ? void 0 : line.match(/Logged in to github\.com as ([^\s]+)/);
|
|
43
|
+
if (oldFormatMatch) {
|
|
44
|
+
username = oldFormatMatch[1];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (scopes.length === 0) {
|
|
49
|
+
const scopeMatch = output.match(/Token scopes: (.+)/);
|
|
50
|
+
scopes = ((_a = scopeMatch == null ? void 0 : scopeMatch[1]) == null ? void 0 : _a.split(", ").map((scope) => scope.replace(/^'|'$/g, ""))) ?? [];
|
|
51
|
+
}
|
|
25
52
|
return {
|
|
26
53
|
hasAuth: true,
|
|
27
|
-
scopes
|
|
54
|
+
scopes,
|
|
28
55
|
...username && { username }
|
|
29
56
|
};
|
|
30
57
|
} catch (error) {
|
|
@@ -188,6 +215,7 @@ async function getRepoInfo() {
|
|
|
188
215
|
|
|
189
216
|
export {
|
|
190
217
|
executeGhCommand,
|
|
218
|
+
checkGhAuth,
|
|
191
219
|
hasProjectScope,
|
|
192
220
|
fetchGhIssue,
|
|
193
221
|
fetchGhPR,
|
|
@@ -200,4 +228,4 @@ export {
|
|
|
200
228
|
createIssue,
|
|
201
229
|
getRepoInfo
|
|
202
230
|
};
|
|
203
|
-
//# sourceMappingURL=chunk-
|
|
231
|
+
//# sourceMappingURL=chunk-JXQXSC45.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/github.ts"],"sourcesContent":["import { execa } from 'execa'\nimport type {\n\tGitHubIssue,\n\tGitHubPullRequest,\n\tGitHubProject,\n\tGitHubAuthStatus,\n\tBranchNameStrategy,\n\tProjectItem,\n\tProjectField,\n} from '../types/github.js'\nimport { logger } from './logger.js'\n\n// Core GitHub CLI execution wrapper\nexport async function executeGhCommand<T = unknown>(\n\targs: string[],\n\toptions?: { cwd?: string; timeout?: number }\n): Promise<T> {\n\tconst result = await execa('gh', args, {\n\t\tcwd: options?.cwd ?? process.cwd(),\n\t\ttimeout: options?.timeout ?? 30000,\n\t\tencoding: 'utf8',\n\t})\n\n\t// Parse JSON output if --json flag, --format json, or --jq was used\n\tconst isJson =\n\t\targs.includes('--json') ||\n\t\targs.includes('--jq') ||\n\t\t(args.includes('--format') && args[args.indexOf('--format') + 1] === 'json')\n\tconst data = isJson ? JSON.parse(result.stdout) : result.stdout\n\n\treturn data as T\n}\n\n// Authentication checking\nexport async function checkGhAuth(): Promise<GitHubAuthStatus> {\n\ttry {\n\t\tconst output = await executeGhCommand<string>(['auth', 'status'])\n\n\t\t// Parse auth status output - handle both old and new formats\n\t\t// Old format: \"Logged in to github.com as username\"\n\t\t// New format: \"✓ Logged in to github.com account username (keyring)\"\n\n\t\t// Split output into lines to find the active account\n\t\tconst lines = output.split('\\n')\n\t\tlet username: string | undefined\n\t\tlet scopes: string[] = []\n\n\t\t// Find the active account (look for \"Active account: true\" or first account if none marked)\n\t\tfor (let i = 0; i < lines.length; i++) {\n\t\t\tconst line = lines[i]\n\n\t\t\t// Match new format: \"✓ Logged in to github.com account username\"\n\t\t\tconst newFormatMatch = line?.match(/Logged in to github\\.com account ([^\\s(]+)/)\n\t\t\tif (newFormatMatch) {\n\t\t\t\tconst accountName = newFormatMatch[1]\n\n\t\t\t\t// Check if this is the active account\n\t\t\t\tconst nextFewLines = lines.slice(i + 1, i + 5).join('\\n')\n\t\t\t\tconst isActive = nextFewLines.includes('Active account: true')\n\n\t\t\t\t// If this is the active account, or we haven't found one yet and there's no \"Active account\" marker\n\t\t\t\tif (isActive || (!username && !output.includes('Active account:'))) {\n\t\t\t\t\tusername = accountName\n\n\t\t\t\t\t// Find scopes for this account\n\t\t\t\t\tconst scopeMatch = nextFewLines.match(/Token scopes: (.+)/)\n\t\t\t\t\tif (scopeMatch?.[1]) {\n\t\t\t\t\t\tscopes = scopeMatch[1].split(', ').map(scope => scope.replace(/^'|'$/g, ''))\n\t\t\t\t\t}\n\n\t\t\t\t\t// If this is the active account, we're done\n\t\t\t\t\tif (isActive) break\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Fallback: match old format\n\t\t\tif (!username) {\n\t\t\t\tconst oldFormatMatch = line?.match(/Logged in to github\\.com as ([^\\s]+)/)\n\t\t\t\tif (oldFormatMatch) {\n\t\t\t\t\tusername = oldFormatMatch[1]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// If scopes not yet extracted, try the old \"Token scopes\" format\n\t\tif (scopes.length === 0) {\n\t\t\tconst scopeMatch = output.match(/Token scopes: (.+)/)\n\t\t\tscopes = scopeMatch?.[1]?.split(', ').map(scope => scope.replace(/^'|'$/g, '')) ?? []\n\t\t}\n\n\t\treturn {\n\t\t\thasAuth: true,\n\t\t\tscopes,\n\t\t\t...(username && { username }),\n\t\t}\n\t} catch (error) {\n\t\t// Only return \"no auth\" for specific authentication errors\n\t\tif (error instanceof Error && 'stderr' in error && (error as {stderr?: string}).stderr?.includes('You are not logged into any GitHub hosts')) {\n\t\t\treturn { hasAuth: false, scopes: [] }\n\t\t}\n\t\t// Re-throw unexpected errors\n\t\tthrow error\n\t}\n}\n\nexport async function hasProjectScope(): Promise<boolean> {\n\tconst auth = await checkGhAuth()\n\treturn auth.scopes.includes('project')\n}\n\n// Issue fetching\nexport async function fetchGhIssue(\n\tissueNumber: number,\n\trepo?: string\n): Promise<GitHubIssue> {\n\tlogger.debug('Fetching GitHub issue', { issueNumber, repo })\n\n\tconst args = [\n\t\t'issue',\n\t\t'view',\n\t\tString(issueNumber),\n\t\t'--json',\n\t\t'number,title,body,state,labels,assignees,url,createdAt,updatedAt',\n\t]\n\n\tif (repo) {\n\t\targs.push('--repo', repo)\n\t}\n\n\treturn executeGhCommand<GitHubIssue>(args)\n}\n\n// PR fetching\nexport async function fetchGhPR(\n\tprNumber: number,\n\trepo?: string\n): Promise<GitHubPullRequest> {\n\tlogger.debug('Fetching GitHub PR', { prNumber, repo })\n\n\tconst args = [\n\t\t'pr',\n\t\t'view',\n\t\tString(prNumber),\n\t\t'--json',\n\t\t'number,title,body,state,headRefName,baseRefName,url,isDraft,mergeable,createdAt,updatedAt',\n\t]\n\n\tif (repo) {\n\t\targs.push('--repo', repo)\n\t}\n\n\treturn executeGhCommand<GitHubPullRequest>(args)\n}\n\n// Project operations\nexport async function fetchProjectList(\n\towner: string\n): Promise<GitHubProject[]> {\n\tconst result = await executeGhCommand<{ projects: GitHubProject[] }>([\n\t\t'project',\n\t\t'list',\n\t\t'--owner',\n\t\towner,\n\t\t'--limit',\n\t\t'100',\n\t\t'--format',\n\t\t'json',\n\t])\n\n\treturn result?.projects ?? []\n}\n\nexport async function fetchProjectItems(\n\tprojectNumber: number,\n\towner: string\n): Promise<ProjectItem[]> {\n\tconst result = await executeGhCommand<{ items: ProjectItem[] }>([\n\t\t'project',\n\t\t'item-list',\n\t\tString(projectNumber),\n\t\t'--owner',\n\t\towner,\n\t\t'--limit',\n\t\t'10000',\n\t\t'--format',\n\t\t'json',\n\t])\n\n\treturn result?.items ?? []\n}\n\nexport async function fetchProjectFields(\n\tprojectNumber: number,\n\towner: string\n): Promise<{ fields: ProjectField[] }> {\n\tconst result = await executeGhCommand<{ fields: ProjectField[] }>([\n\t\t'project',\n\t\t'field-list',\n\t\tString(projectNumber),\n\t\t'--owner',\n\t\towner,\n\t\t'--format',\n\t\t'json',\n\t])\n\n\treturn result ?? { fields: [] }\n}\n\nexport async function updateProjectItemField(\n\titemId: string,\n\tprojectId: string,\n\tfieldId: string,\n\toptionId: string\n): Promise<void> {\n\tawait executeGhCommand([\n\t\t'project',\n\t\t'item-edit',\n\t\t'--id',\n\t\titemId,\n\t\t'--project-id',\n\t\tprojectId,\n\t\t'--field-id',\n\t\tfieldId,\n\t\t'--single-select-option-id',\n\t\toptionId,\n\t\t'--format',\n\t\t'json',\n\t])\n}\n\n// Branch name generation strategies\nexport class SimpleBranchNameStrategy implements BranchNameStrategy {\n\tasync generate(issueNumber: number, title: string): Promise<string> {\n\t\t// Create a simple slug from the title\n\t\tconst slug = title\n\t\t\t.toLowerCase()\n\t\t\t.replace(/[^a-z0-9]+/g, '-')\n\t\t\t.replace(/^-|-$/g, '')\n\t\t\t.substring(0, 20) // Keep it short for the simple strategy\n\n\t\treturn `feat/issue-${issueNumber}-${slug}`\n\t}\n}\n\nexport class ClaudeBranchNameStrategy implements BranchNameStrategy {\n\tconstructor(private claudeModel = 'haiku') {}\n\n\tasync generate(issueNumber: number, title: string): Promise<string> {\n\t\t// Import dynamically to avoid circular dependency\n\t\tconst { generateBranchName } = await import('../utils/claude.js')\n\n\t\t// Delegate to the shared implementation\n\t\treturn generateBranchName(title, issueNumber, this.claudeModel)\n\t}\n}\n\n// Template-based strategy for custom patterns\nexport class TemplateBranchNameStrategy implements BranchNameStrategy {\n\tconstructor(private template = '{prefix}/issue-{number}-{slug}') {}\n\n\tasync generate(issueNumber: number, title: string): Promise<string> {\n\t\t// Determine prefix based on title\n\t\tconst prefix = this.determinePrefix(title)\n\n\t\t// Create slug from title\n\t\tconst slug = title\n\t\t\t.toLowerCase()\n\t\t\t.replace(/[^a-z0-9]+/g, '-')\n\t\t\t.replace(/^-|-$/g, '')\n\t\t\t.substring(0, 30)\n\n\t\treturn this.template\n\t\t\t.replace('{prefix}', prefix)\n\t\t\t.replace('{number}', String(issueNumber))\n\t\t\t.replace('{slug}', slug)\n\t}\n\n\tprivate determinePrefix(title: string): string {\n\t\tconst lowerTitle = title.toLowerCase()\n\t\tif (lowerTitle.includes('fix') || lowerTitle.includes('bug')) return 'fix'\n\t\tif (lowerTitle.includes('doc')) return 'docs'\n\t\tif (lowerTitle.includes('test')) return 'test'\n\t\tif (lowerTitle.includes('refactor')) return 'refactor'\n\t\treturn 'feat'\n\t}\n}\n\n// GitHub Issue Operations\n\ninterface IssueCreateResponse {\n\tnumber: number\n\turl: string\n}\n\n/**\n * Create a new GitHub issue\n * @param title - The issue title\n * @param body - The issue body (markdown supported)\n * @param options - Optional configuration\n * @param options.repo - Repository in format \"owner/repo\" (uses current repo if not provided)\n * @param options.labels - Array of label names to add to the issue\n * @returns Issue metadata including number and URL\n */\nexport async function createIssue(\n\ttitle: string,\n\tbody: string,\n\toptions?: { repo?: string | undefined; labels?: string[] | undefined }\n): Promise<IssueCreateResponse> {\n\tconst { repo, labels } = options ?? {}\n\n\tlogger.debug('Creating GitHub issue', { title, repo, labels })\n\n\tconst args = [\n\t\t'issue',\n\t\t'create',\n\t\t'--title',\n\t\ttitle,\n\t\t'--body',\n\t\tbody,\n\t]\n\n\t// Add repo if provided\n\tif (repo) {\n\t\targs.splice(2, 0, '--repo', repo)\n\t}\n\n\t// Add labels if provided\n\tif (labels && labels.length > 0) {\n\t\targs.push('--label', labels.join(','))\n\t}\n\n\tconst execaOptions: { timeout: number; encoding: 'utf8'; cwd?: string } = {\n\t\ttimeout: 30000,\n\t\tencoding: 'utf8',\n\t}\n\n\tif (!repo) {\n\t\texecaOptions.cwd = process.cwd()\n\t}\n\n\tconst result = await execa('gh', args, execaOptions)\n\n\t// Parse the URL from the output (format: \"https://github.com/owner/repo/issues/123\")\n\tconst urlMatch = result.stdout.trim().match(/https:\\/\\/github\\.com\\/[^/]+\\/[^/]+\\/issues\\/(\\d+)/)\n\tif (!urlMatch?.[1]) {\n\t\tthrow new Error(`Failed to parse issue URL from gh output: ${result.stdout}`)\n\t}\n\n\tconst issueNumber = parseInt(urlMatch[1], 10)\n\tconst issueUrl = urlMatch[0]\n\n\treturn {\n\t\tnumber: issueNumber,\n\t\turl: issueUrl,\n\t}\n}\n\n/**\n * @deprecated Use createIssue with options.repo instead\n * Create a new GitHub issue in a specific repository\n * @param title - Issue title\n * @param body - Issue body (markdown)\n * @param repository - Repository in format \"owner/repo\"\n * @param labels - Optional array of label names to add to the issue\n * @returns Issue number and URL\n */\nexport async function createIssueInRepo(\n\ttitle: string,\n\tbody: string,\n\trepository: string,\n\tlabels?: string[]\n): Promise<IssueCreateResponse> {\n\treturn createIssue(title, body, { repo: repository, labels })\n}\n\n// GitHub Comment Operations\n\ninterface CommentResponse {\n\tid: number\n\turl: string\n\tcreated_at?: string\n\tupdated_at?: string\n}\n\ninterface RepoInfo {\n\towner: string\n\tname: string\n}\n\n/**\n * Create a comment on a GitHub issue\n * @param issueNumber - The issue number\n * @param body - The comment body (markdown supported)\n * @param repo - Optional repo in \"owner/repo\" format\n * @returns Comment metadata including ID and URL\n */\nexport async function createIssueComment(\n\tissueNumber: number,\n\tbody: string,\n\trepo?: string\n): Promise<CommentResponse> {\n\tlogger.debug('Creating issue comment', { issueNumber, repo })\n\n\tconst apiPath = repo\n\t\t? `repos/${repo}/issues/${issueNumber}/comments`\n\t\t: `repos/:owner/:repo/issues/${issueNumber}/comments`\n\n\treturn executeGhCommand<CommentResponse>([\n\t\t'api',\n\t\tapiPath,\n\t\t'-f',\n\t\t`body=${body}`,\n\t\t'--jq',\n\t\t'{id: .id, url: .html_url, created_at: .created_at}',\n\t])\n}\n\n/**\n * Update an existing GitHub comment\n * @param commentId - The comment ID\n * @param body - The updated comment body (markdown supported)\n * @param repo - Optional repo in \"owner/repo\" format\n * @returns Updated comment metadata\n */\nexport async function updateIssueComment(\n\tcommentId: number,\n\tbody: string,\n\trepo?: string\n): Promise<CommentResponse> {\n\tlogger.debug('Updating issue comment', { commentId, repo })\n\n\tconst apiPath = repo\n\t\t? `repos/${repo}/issues/comments/${commentId}`\n\t\t: `repos/:owner/:repo/issues/comments/${commentId}`\n\n\treturn executeGhCommand<CommentResponse>([\n\t\t'api',\n\t\tapiPath,\n\t\t'-X',\n\t\t'PATCH',\n\t\t'-f',\n\t\t`body=${body}`,\n\t\t'--jq',\n\t\t'{id: .id, url: .html_url, updated_at: .updated_at}',\n\t])\n}\n\n/**\n * Create a comment on a GitHub pull request\n * Note: PR comments use the same endpoint as issue comments\n * @param prNumber - The PR number\n * @param body - The comment body (markdown supported)\n * @param repo - Optional repo in \"owner/repo\" format\n * @returns Comment metadata including ID and URL\n */\nexport async function createPRComment(\n\tprNumber: number,\n\tbody: string,\n\trepo?: string\n): Promise<CommentResponse> {\n\tlogger.debug('Creating PR comment', { prNumber, repo })\n\n\tconst apiPath = repo\n\t\t? `repos/${repo}/issues/${prNumber}/comments`\n\t\t: `repos/:owner/:repo/issues/${prNumber}/comments`\n\n\t// PR comments use the issues endpoint\n\treturn executeGhCommand<CommentResponse>([\n\t\t'api',\n\t\tapiPath,\n\t\t'-f',\n\t\t`body=${body}`,\n\t\t'--jq',\n\t\t'{id: .id, url: .html_url, created_at: .created_at}',\n\t])\n}\n\n/**\n * Get repository owner and name from current directory\n * @returns Repository owner and name\n */\nexport async function getRepoInfo(): Promise<RepoInfo> {\n\tlogger.debug('Fetching repository info')\n\n\tconst result = await executeGhCommand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;AAAA,IACpB,MAAM,OAAO;AAAA,EACd;AACD;","names":[]}
|
|
@@ -113,6 +113,12 @@ var PromptTemplateManager = class {
|
|
|
113
113
|
if (variables.NO_REMOTES !== void 0) {
|
|
114
114
|
result = result.replace(/NO_REMOTES/g, variables.NO_REMOTES);
|
|
115
115
|
}
|
|
116
|
+
if (variables.README_CONTENT !== void 0) {
|
|
117
|
+
result = result.replace(/README_CONTENT/g, variables.README_CONTENT);
|
|
118
|
+
}
|
|
119
|
+
if (variables.SETTINGS_SCHEMA_CONTENT !== void 0) {
|
|
120
|
+
result = result.replace(/SETTINGS_SCHEMA_CONTENT/g, variables.SETTINGS_SCHEMA_CONTENT);
|
|
121
|
+
}
|
|
116
122
|
return result;
|
|
117
123
|
}
|
|
118
124
|
/**
|
|
@@ -159,6 +165,12 @@ var PromptTemplateManager = class {
|
|
|
159
165
|
} else {
|
|
160
166
|
result = result.replace(noRemotesRegex, "");
|
|
161
167
|
}
|
|
168
|
+
const firstTimeUserRegex = /\{\{#IF FIRST_TIME_USER\}\}(.*?)\{\{\/IF FIRST_TIME_USER\}\}/gs;
|
|
169
|
+
if (variables.FIRST_TIME_USER === true) {
|
|
170
|
+
result = result.replace(firstTimeUserRegex, "$1");
|
|
171
|
+
} else {
|
|
172
|
+
result = result.replace(firstTimeUserRegex, "");
|
|
173
|
+
}
|
|
162
174
|
return result;
|
|
163
175
|
}
|
|
164
176
|
/**
|
|
@@ -173,4 +185,4 @@ var PromptTemplateManager = class {
|
|
|
173
185
|
export {
|
|
174
186
|
PromptTemplateManager
|
|
175
187
|
};
|
|
176
|
-
//# sourceMappingURL=chunk-
|
|
188
|
+
//# sourceMappingURL=chunk-PVAVNJKS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/PromptTemplateManager.ts"],"sourcesContent":["import { readFile } from 'fs/promises'\nimport { accessSync } from 'fs'\nimport path from 'path'\nimport { fileURLToPath } from 'url'\nimport { logger } from '../utils/logger.js'\n\nexport interface TemplateVariables {\n\tISSUE_NUMBER?: number\n\tPR_NUMBER?: number\n\tISSUE_TITLE?: string\n\tPR_TITLE?: string\n\tWORKSPACE_PATH?: string\n\tPORT?: number\n\tONE_SHOT_MODE?: boolean\n\tSETTINGS_SCHEMA?: string\n\tSETTINGS_JSON?: string\n\tSETTINGS_LOCAL_JSON?: string\n\tSHELL_TYPE?: string\n\tSHELL_CONFIG_PATH?: string\n\tSHELL_CONFIG_CONTENT?: string\n\tREMOTES_INFO?: string\n\tMULTIPLE_REMOTES?: string\n\tSINGLE_REMOTE?: string\n\tSINGLE_REMOTE_NAME?: string\n\tSINGLE_REMOTE_URL?: string\n\tNO_REMOTES?: string\n\tREADME_CONTENT?: string\n\tSETTINGS_SCHEMA_CONTENT?: string\n\tFIRST_TIME_USER?: boolean\n}\n\nexport class PromptTemplateManager {\n\tprivate templateDir: string\n\n\tconstructor(templateDir?: string) {\n\t\tif (templateDir) {\n\t\t\tthis.templateDir = templateDir\n\t\t} else {\n\t\t\t// Find templates relative to the package installation\n\t\t\t// When running from dist/, templates are copied to dist/prompts/\n\t\t\tconst currentFileUrl = import.meta.url\n\t\t\tconst currentFilePath = fileURLToPath(currentFileUrl)\n\t\t\tconst distDir = path.dirname(currentFilePath) // dist directory (may be chunked file location)\n\n\t\t\t// Walk up to find the dist directory (in case of chunked files)\n\t\t\tlet templateDir = path.join(distDir, 'prompts')\n\t\t\tlet currentDir = distDir\n\n\t\t\t// Try to find the prompts directory by walking up\n\t\t\twhile (currentDir !== path.dirname(currentDir)) {\n\t\t\t\tconst candidatePath = path.join(currentDir, 'prompts')\n\t\t\t\ttry {\n\t\t\t\t\t// Check if this directory exists (sync check for constructor)\n\t\t\t\t\taccessSync(candidatePath)\n\t\t\t\t\ttemplateDir = candidatePath\n\t\t\t\t\tbreak\n\t\t\t\t} catch {\n\t\t\t\t\tcurrentDir = path.dirname(currentDir)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.templateDir = templateDir\n\t\t\tlogger.debug('PromptTemplateManager initialized', {\n\t\t\t\tcurrentFilePath,\n\t\t\t\tdistDir,\n\t\t\t\ttemplateDir: this.templateDir\n\t\t\t})\n\t\t}\n\t}\n\n\t/**\n\t * Load a template file by name\n\t */\n\tasync loadTemplate(templateName: 'issue' | 'pr' | 'regular' | 'init'): Promise<string> {\n\t\tconst templatePath = path.join(this.templateDir, `${templateName}-prompt.txt`)\n\n\t\tlogger.debug('Loading template', {\n\t\t\ttemplateName,\n\t\t\ttemplateDir: this.templateDir,\n\t\t\ttemplatePath\n\t\t})\n\n\t\ttry {\n\t\t\treturn await readFile(templatePath, 'utf-8')\n\t\t} catch (error) {\n\t\t\tlogger.error('Failed to load template', { templateName, templatePath, error })\n\t\t\tthrow new Error(`Template not found: ${templatePath}`)\n\t\t}\n\t}\n\n\t/**\n\t * Substitute variables in a template string\n\t */\n\tsubstituteVariables(template: string, variables: TemplateVariables): string {\n\t\tlet result = template\n\n\t\t// Process conditional sections first\n\t\tresult = this.processConditionalSections(result, variables)\n\n\t\t// Replace each variable if it exists\n\t\tif (variables.ISSUE_NUMBER !== undefined) {\n\t\t\tresult = result.replace(/ISSUE_NUMBER/g, String(variables.ISSUE_NUMBER))\n\t\t}\n\n\t\tif (variables.PR_NUMBER !== undefined) {\n\t\t\tresult = result.replace(/PR_NUMBER/g, String(variables.PR_NUMBER))\n\t\t}\n\n\t\tif (variables.ISSUE_TITLE !== undefined) {\n\t\t\tresult = result.replace(/ISSUE_TITLE/g, variables.ISSUE_TITLE)\n\t\t}\n\n\t\tif (variables.PR_TITLE !== undefined) {\n\t\t\tresult = result.replace(/PR_TITLE/g, variables.PR_TITLE)\n\t\t}\n\n\t\tif (variables.WORKSPACE_PATH !== undefined) {\n\t\t\tresult = result.replace(/WORKSPACE_PATH/g, variables.WORKSPACE_PATH)\n\t\t}\n\n\t\tif (variables.PORT !== undefined) {\n\t\t\tresult = result.replace(/PORT/g, String(variables.PORT))\n\t\t}\n\n\t\tif (variables.SETTINGS_SCHEMA !== undefined) {\n\t\t\tresult = result.replace(/SETTINGS_SCHEMA/g, variables.SETTINGS_SCHEMA)\n\t\t}\n\n\t\tif (variables.SETTINGS_JSON !== undefined) {\n\t\t\tresult = result.replace(/SETTINGS_JSON/g, variables.SETTINGS_JSON)\n\t\t}\n\n\t\tif (variables.SETTINGS_LOCAL_JSON !== undefined) {\n\t\t\tresult = result.replace(/SETTINGS_LOCAL_JSON/g, variables.SETTINGS_LOCAL_JSON)\n\t\t}\n\n\t\tif (variables.SHELL_TYPE !== undefined) {\n\t\t\tresult = result.replace(/SHELL_TYPE/g, variables.SHELL_TYPE)\n\t\t}\n\n\t\tif (variables.SHELL_CONFIG_PATH !== undefined) {\n\t\t\tresult = result.replace(/SHELL_CONFIG_PATH/g, variables.SHELL_CONFIG_PATH)\n\t\t}\n\n\t\tif (variables.SHELL_CONFIG_CONTENT !== undefined) {\n\t\t\tresult = result.replace(/SHELL_CONFIG_CONTENT/g, variables.SHELL_CONFIG_CONTENT)\n\t\t}\n\n\t\tif (variables.REMOTES_INFO !== undefined) {\n\t\t\tresult = result.replace(/REMOTES_INFO/g, variables.REMOTES_INFO)\n\t\t}\n\n\t\tif (variables.MULTIPLE_REMOTES !== undefined) {\n\t\t\tresult = result.replace(/MULTIPLE_REMOTES/g, variables.MULTIPLE_REMOTES)\n\t\t}\n\n\t\tif (variables.SINGLE_REMOTE !== undefined) {\n\t\t\tresult = result.replace(/SINGLE_REMOTE/g, variables.SINGLE_REMOTE)\n\t\t}\n\n\t\tif (variables.SINGLE_REMOTE_NAME !== undefined) {\n\t\t\tresult = result.replace(/SINGLE_REMOTE_NAME/g, variables.SINGLE_REMOTE_NAME)\n\t\t}\n\n\t\tif (variables.SINGLE_REMOTE_URL !== undefined) {\n\t\t\tresult = result.replace(/SINGLE_REMOTE_URL/g, variables.SINGLE_REMOTE_URL)\n\t\t}\n\n\t\tif (variables.NO_REMOTES !== undefined) {\n\t\t\tresult = result.replace(/NO_REMOTES/g, variables.NO_REMOTES)\n\t\t}\n\n\t\tif (variables.README_CONTENT !== undefined) {\n\t\t\tresult = result.replace(/README_CONTENT/g, variables.README_CONTENT)\n\t\t}\n\n\t\tif (variables.SETTINGS_SCHEMA_CONTENT !== undefined) {\n\t\t\tresult = result.replace(/SETTINGS_SCHEMA_CONTENT/g, variables.SETTINGS_SCHEMA_CONTENT)\n\t\t}\n\n\t\treturn result\n\t}\n\n\t/**\n\t * Process conditional sections in template\n\t * Format: {{#IF ONE_SHOT_MODE}}content{{/IF ONE_SHOT_MODE}}\n\t *\n\t * Note: /s flag allows . to match newlines\n\t */\n\tprivate processConditionalSections(template: string, variables: TemplateVariables): string {\n\t\tlet result = template\n\n\t\t// Process ONE_SHOT_MODE conditionals\n\t\tconst oneShotRegex = /\\{\\{#IF ONE_SHOT_MODE\\}\\}(.*?)\\{\\{\\/IF ONE_SHOT_MODE\\}\\}/gs\n\n\t\tif (variables.ONE_SHOT_MODE === true) {\n\t\t\t// Include the content, remove the conditional markers\n\t\t\tresult = result.replace(oneShotRegex, '$1')\n\t\t} else {\n\t\t\t// Remove the entire conditional block\n\t\t\tresult = result.replace(oneShotRegex, '')\n\t\t}\n\n\t\t// Process SETTINGS_JSON conditionals\n\t\tconst settingsJsonRegex = /\\{\\{#IF SETTINGS_JSON\\}\\}(.*?)\\{\\{\\/IF SETTINGS_JSON\\}\\}/gs\n\n\t\tif (variables.SETTINGS_JSON !== undefined && variables.SETTINGS_JSON !== '') {\n\t\t\t// Include the content, remove the conditional markers\n\t\t\tresult = result.replace(settingsJsonRegex, '$1')\n\t\t} else {\n\t\t\t// Remove the entire conditional block\n\t\t\tresult = result.replace(settingsJsonRegex, '')\n\t\t}\n\n\t\t// Process SETTINGS_LOCAL_JSON conditionals\n\t\tconst settingsLocalJsonRegex = /\\{\\{#IF SETTINGS_LOCAL_JSON\\}\\}(.*?)\\{\\{\\/IF SETTINGS_LOCAL_JSON\\}\\}/gs\n\n\t\tif (variables.SETTINGS_LOCAL_JSON !== undefined && variables.SETTINGS_LOCAL_JSON !== '') {\n\t\t\t// Include the content, remove the conditional markers\n\t\t\tresult = result.replace(settingsLocalJsonRegex, '$1')\n\t\t} else {\n\t\t\t// Remove the entire conditional block\n\t\t\tresult = result.replace(settingsLocalJsonRegex, '')\n\t\t}\n\n\t\t// Process MULTIPLE_REMOTES conditionals\n\t\tconst multipleRemotesRegex = /\\{\\{#IF MULTIPLE_REMOTES\\}\\}(.*?)\\{\\{\\/IF MULTIPLE_REMOTES\\}\\}/gs\n\n\t\tif (variables.MULTIPLE_REMOTES !== undefined && variables.MULTIPLE_REMOTES !== '') {\n\t\t\t// Include the content, remove the conditional markers\n\t\t\tresult = result.replace(multipleRemotesRegex, '$1')\n\t\t} else {\n\t\t\t// Remove the entire conditional block\n\t\t\tresult = result.replace(multipleRemotesRegex, '')\n\t\t}\n\n\t\t// Process SINGLE_REMOTE conditionals\n\t\tconst singleRemoteRegex = /\\{\\{#IF SINGLE_REMOTE\\}\\}(.*?)\\{\\{\\/IF SINGLE_REMOTE\\}\\}/gs\n\n\t\tif (variables.SINGLE_REMOTE !== undefined && variables.SINGLE_REMOTE !== '') {\n\t\t\t// Include the content, remove the conditional markers\n\t\t\tresult = result.replace(singleRemoteRegex, '$1')\n\t\t} else {\n\t\t\t// Remove the entire conditional block\n\t\t\tresult = result.replace(singleRemoteRegex, '')\n\t\t}\n\n\t\t// Process NO_REMOTES conditionals\n\t\tconst noRemotesRegex = /\\{\\{#IF NO_REMOTES\\}\\}(.*?)\\{\\{\\/IF NO_REMOTES\\}\\}/gs\n\n\t\tif (variables.NO_REMOTES !== undefined && variables.NO_REMOTES !== '') {\n\t\t\t// Include the content, remove the conditional markers\n\t\t\tresult = result.replace(noRemotesRegex, '$1')\n\t\t} else {\n\t\t\t// Remove the entire conditional block\n\t\t\tresult = result.replace(noRemotesRegex, '')\n\t\t}\n\n\t\t// Process FIRST_TIME_USER conditionals\n\t\tconst firstTimeUserRegex = /\\{\\{#IF FIRST_TIME_USER\\}\\}(.*?)\\{\\{\\/IF FIRST_TIME_USER\\}\\}/gs\n\n\t\tif (variables.FIRST_TIME_USER === true) {\n\t\t\t// Include the content, remove the conditional markers\n\t\t\tresult = result.replace(firstTimeUserRegex, '$1')\n\t\t} else {\n\t\t\t// Remove the entire conditional block\n\t\t\tresult = result.replace(firstTimeUserRegex, '')\n\t\t}\n\n\t\treturn result\n\t}\n\n\t/**\n\t * Get a fully processed prompt for a workflow type\n\t */\n\tasync getPrompt(\n\t\ttype: 'issue' | 'pr' | 'regular' | 'init',\n\t\tvariables: TemplateVariables\n\t): Promise<string> {\n\t\tconst template = await this.loadTemplate(type)\n\t\treturn this.substituteVariables(template, variables)\n\t}\n}\n"],"mappings":";;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,OAAO,UAAU;AACjB,SAAS,qBAAqB;AA4BvB,IAAM,wBAAN,MAA4B;AAAA,EAGlC,YAAY,aAAsB;AACjC,QAAI,aAAa;AAChB,WAAK,cAAc;AAAA,IACpB,OAAO;AAGN,YAAM,iBAAiB,YAAY;AACnC,YAAM,kBAAkB,cAAc,cAAc;AACpD,YAAM,UAAU,KAAK,QAAQ,eAAe;AAG5C,UAAIA,eAAc,KAAK,KAAK,SAAS,SAAS;AAC9C,UAAI,aAAa;AAGjB,aAAO,eAAe,KAAK,QAAQ,UAAU,GAAG;AAC/C,cAAM,gBAAgB,KAAK,KAAK,YAAY,SAAS;AACrD,YAAI;AAEH,qBAAW,aAAa;AACxB,UAAAA,eAAc;AACd;AAAA,QACD,QAAQ;AACP,uBAAa,KAAK,QAAQ,UAAU;AAAA,QACrC;AAAA,MACD;AAEA,WAAK,cAAcA;AACnB,aAAO,MAAM,qCAAqC;AAAA,QACjD;AAAA,QACA;AAAA,QACA,aAAa,KAAK;AAAA,MACnB,CAAC;AAAA,IACF;AAAA,EACD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aAAa,cAAoE;AACtF,UAAM,eAAe,KAAK,KAAK,KAAK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M,UACL,MACA,WACkB;AAClB,UAAM,WAAW,MAAM,KAAK,aAAa,IAAI;AAC7C,WAAO,KAAK,oBAAoB,UAAU,SAAS;AAAA,EACpD;AACD;","names":["templateDir"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
getRepoInfo
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JXQXSC45.js";
|
|
5
5
|
import {
|
|
6
6
|
logger
|
|
7
7
|
} from "./chunk-GEHQXLEI.js";
|
|
@@ -51,4 +51,4 @@ async function generateGitHubCommentMcpConfig(contextType, repo) {
|
|
|
51
51
|
export {
|
|
52
52
|
generateGitHubCommentMcpConfig
|
|
53
53
|
};
|
|
54
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
//# sourceMappingURL=chunk-VCMMAFXQ.js.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
fetchProjectList,
|
|
12
12
|
hasProjectScope,
|
|
13
13
|
updateProjectItemField
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JXQXSC45.js";
|
|
15
15
|
import {
|
|
16
16
|
promptConfirmation
|
|
17
17
|
} from "./chunk-JNKJ7NJV.js";
|
|
@@ -312,4 +312,4 @@ State: ${entity.state}`;
|
|
|
312
312
|
export {
|
|
313
313
|
GitHubService
|
|
314
314
|
};
|
|
315
|
-
//# sourceMappingURL=chunk-
|
|
315
|
+
//# sourceMappingURL=chunk-ZWXJBSUW.js.map
|
package/dist/cli.js
CHANGED
|
@@ -71,7 +71,7 @@ program.name("iloom").description(packageJson.description).version(packageJson.v
|
|
|
71
71
|
async function validateSettingsForCommand(command) {
|
|
72
72
|
var _a, _b;
|
|
73
73
|
const commandName = command.args[0] ?? "";
|
|
74
|
-
const bypassCommands = ["help", "init", "update"];
|
|
74
|
+
const bypassCommands = ["help", "init", "update", "contribute"];
|
|
75
75
|
if (bypassCommands.includes(commandName)) {
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
@@ -102,7 +102,7 @@ async function autoLaunchInitForMultipleRemotes() {
|
|
|
102
102
|
await waitForKeypress("Press any key to start configuration...");
|
|
103
103
|
logger.info("");
|
|
104
104
|
try {
|
|
105
|
-
const { InitCommand } = await import("./init-
|
|
105
|
+
const { InitCommand } = await import("./init-UMKNHNV5.js");
|
|
106
106
|
const initCommand = new InitCommand();
|
|
107
107
|
const customInitialMessage = "Help me configure which git remote iloom should use for GitHub operations. I have multiple remotes and need to select the correct one.";
|
|
108
108
|
await initCommand.execute(customInitialMessage);
|
|
@@ -141,7 +141,7 @@ program.command("start").alias("create").alias("up").description("Create isolate
|
|
|
141
141
|
process.exit(1);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
const { StartCommand } = await import("./start-
|
|
144
|
+
const { StartCommand } = await import("./start-CT2ZEFP2.js");
|
|
145
145
|
const command = new StartCommand();
|
|
146
146
|
await command.execute({ identifier: finalIdentifier, options });
|
|
147
147
|
} catch (error) {
|
|
@@ -151,7 +151,7 @@ program.command("start").alias("create").alias("up").description("Create isolate
|
|
|
151
151
|
});
|
|
152
152
|
program.command("add-issue").alias("a").description("Create and enhance GitHub issue without starting workspace").argument("<description>", "Natural language description of the issue (>50 chars, >2 spaces)").action(async (description) => {
|
|
153
153
|
try {
|
|
154
|
-
const { AddIssueCommand } = await import("./add-issue-
|
|
154
|
+
const { AddIssueCommand } = await import("./add-issue-X56V3XPB.js");
|
|
155
155
|
const command = new AddIssueCommand();
|
|
156
156
|
const issueNumber = await command.execute({
|
|
157
157
|
description,
|
|
@@ -166,7 +166,7 @@ program.command("add-issue").alias("a").description("Create and enhance GitHub i
|
|
|
166
166
|
});
|
|
167
167
|
program.command("feedback").alias("f").description("Submit feedback/bug report to iloom-cli repository").argument("<description>", "Natural language description of feedback (>50 chars, >2 spaces)").action(async (description) => {
|
|
168
168
|
try {
|
|
169
|
-
const { FeedbackCommand } = await import("./feedback-
|
|
169
|
+
const { FeedbackCommand } = await import("./feedback-ZOUCCHN4.js");
|
|
170
170
|
const command = new FeedbackCommand();
|
|
171
171
|
const issueNumber = await command.execute({
|
|
172
172
|
description,
|
|
@@ -181,7 +181,7 @@ program.command("feedback").alias("f").description("Submit feedback/bug report t
|
|
|
181
181
|
});
|
|
182
182
|
program.command("enhance").description("Apply enhancement agent to existing GitHub issue").argument("<issue-number>", "GitHub issue number to enhance", parseInt).option("--no-browser", "Skip browser opening prompt").option("--author <username>", "GitHub username to tag in questions (for CI usage)").action(async (issueNumber, options) => {
|
|
183
183
|
try {
|
|
184
|
-
const { EnhanceCommand } = await import("./enhance-
|
|
184
|
+
const { EnhanceCommand } = await import("./enhance-VGWUX474.js");
|
|
185
185
|
const command = new EnhanceCommand();
|
|
186
186
|
await command.execute({
|
|
187
187
|
issueNumber,
|
|
@@ -199,7 +199,7 @@ program.command("enhance").description("Apply enhancement agent to existing GitH
|
|
|
199
199
|
});
|
|
200
200
|
program.command("finish").alias("dn").description("Merge work and cleanup workspace").argument("[identifier]", "Issue number, PR number, or branch name (auto-detected if omitted)").option("-f, --force", "Skip confirmation prompts").option("-n, --dry-run", "Preview actions without executing").option("--pr <number>", "Treat input as PR number", parseFloat).option("--skip-build", "Skip post-merge build verification").action(async (identifier, options) => {
|
|
201
201
|
try {
|
|
202
|
-
const { FinishCommand } = await import("./finish-
|
|
202
|
+
const { FinishCommand } = await import("./finish-QJSK6Z7J.js");
|
|
203
203
|
const command = new FinishCommand();
|
|
204
204
|
await command.execute({ identifier, options });
|
|
205
205
|
} catch (error) {
|
|
@@ -221,7 +221,7 @@ program.command("spin").alias("ignite").description("Launch Claude with auto-det
|
|
|
221
221
|
new Option("--one-shot <mode>", "One-shot automation mode").choices(["default", "noReview", "bypassPermissions"]).default("default")
|
|
222
222
|
).action(async (options) => {
|
|
223
223
|
try {
|
|
224
|
-
const { IgniteCommand } = await import("./ignite-
|
|
224
|
+
const { IgniteCommand } = await import("./ignite-HICLZEYU.js");
|
|
225
225
|
const command = new IgniteCommand();
|
|
226
226
|
await command.execute(options.oneShot ?? "default");
|
|
227
227
|
} catch (error) {
|
|
@@ -293,9 +293,9 @@ program.command("list").description("Show active workspaces").option("--json", "
|
|
|
293
293
|
process.exit(1);
|
|
294
294
|
}
|
|
295
295
|
});
|
|
296
|
-
program.command("init").description("Initialize iloom configuration and setup shell autocomplete").action(async () => {
|
|
296
|
+
program.command("init").alias("config").description("Initialize iloom configuration and setup shell autocomplete").action(async () => {
|
|
297
297
|
try {
|
|
298
|
-
const { InitCommand } = await import("./init-
|
|
298
|
+
const { InitCommand } = await import("./init-UMKNHNV5.js");
|
|
299
299
|
const command = new InitCommand();
|
|
300
300
|
await command.execute();
|
|
301
301
|
} catch (error) {
|
|
@@ -303,6 +303,16 @@ program.command("init").description("Initialize iloom configuration and setup sh
|
|
|
303
303
|
process.exit(1);
|
|
304
304
|
}
|
|
305
305
|
});
|
|
306
|
+
program.command("contribute").description("Set up local development environment for contributing to iloom").action(async () => {
|
|
307
|
+
try {
|
|
308
|
+
const { ContributeCommand } = await import("./contribute-3MQJ3XAQ.js");
|
|
309
|
+
const command = new ContributeCommand();
|
|
310
|
+
await command.execute();
|
|
311
|
+
} catch (error) {
|
|
312
|
+
logger.error(`Failed to set up contributor environment: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
313
|
+
process.exit(1);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
306
316
|
program.command("update").description("Update iloom-cli to the latest version").option("--dry-run", "Show what would be done without actually updating").action(async (options) => {
|
|
307
317
|
try {
|
|
308
318
|
const { UpdateCommand } = await import("./update-4TDDUR5K.js");
|
|
@@ -315,7 +325,7 @@ program.command("update").description("Update iloom-cli to the latest version").
|
|
|
315
325
|
});
|
|
316
326
|
program.command("test-github").description("Test GitHub integration (Issue #3)").argument("<identifier>", "Issue number or PR number").option("--no-claude", "Skip Claude for branch name generation").action(async (identifier, options) => {
|
|
317
327
|
try {
|
|
318
|
-
const { GitHubService } = await import("./GitHubService-
|
|
328
|
+
const { GitHubService } = await import("./GitHubService-LWP4GKGH.js");
|
|
319
329
|
logger.info("Testing GitHub Integration\n");
|
|
320
330
|
const service = new GitHubService(options.claude !== void 0 ? { useClaude: options.claude } : {});
|
|
321
331
|
logger.info("Detecting input type...");
|
|
@@ -371,9 +381,9 @@ program.command("test-github").description("Test GitHub integration (Issue #3)")
|
|
|
371
381
|
program.command("test-claude").description("Test Claude integration (Issue #10)").option("--detect", "Test Claude CLI detection").option("--version", "Get Claude CLI version").option("--branch <title>", "Test branch name generation with given title").option("--issue <number>", "Issue number for branch generation", "123").option("--launch <prompt>", "Launch Claude with a prompt (headless)").option("--interactive", "Launch Claude interactively (requires --launch)").option("--template <name>", "Test template loading").action(async (options) => {
|
|
372
382
|
try {
|
|
373
383
|
const { detectClaudeCli, getClaudeVersion, generateBranchName, launchClaude } = await import("./claude-7LUVDZZ4.js");
|
|
374
|
-
const { PromptTemplateManager } = await import("./PromptTemplateManager-
|
|
375
|
-
const { ClaudeService } = await import("./ClaudeService-
|
|
376
|
-
const { ClaudeContextManager } = await import("./ClaudeContextManager-
|
|
384
|
+
const { PromptTemplateManager } = await import("./PromptTemplateManager-WII75TKH.js");
|
|
385
|
+
const { ClaudeService } = await import("./ClaudeService-55DQGB7T.js");
|
|
386
|
+
const { ClaudeContextManager } = await import("./ClaudeContextManager-JKR4WGNU.js");
|
|
377
387
|
logger.info("Testing Claude Integration\n");
|
|
378
388
|
if (options.detect) {
|
|
379
389
|
logger.info("Detecting Claude CLI...");
|