openplanr 0.7.0 → 0.9.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.
- package/README.md +11 -5
- package/dist/ai/prompts/prompt-builder.d.ts +1 -0
- package/dist/ai/prompts/prompt-builder.d.ts.map +1 -1
- package/dist/ai/prompts/prompt-builder.js +19 -2
- package/dist/ai/prompts/prompt-builder.js.map +1 -1
- package/dist/ai/prompts/system-prompts.d.ts +2 -1
- package/dist/ai/prompts/system-prompts.d.ts.map +1 -1
- package/dist/ai/prompts/system-prompts.js +44 -1
- package/dist/ai/prompts/system-prompts.js.map +1 -1
- package/dist/ai/schemas/ai-response-schemas.d.ts +13 -0
- package/dist/ai/schemas/ai-response-schemas.d.ts.map +1 -1
- package/dist/ai/schemas/ai-response-schemas.js +15 -0
- package/dist/ai/schemas/ai-response-schemas.js.map +1 -1
- package/dist/ai/types.d.ts +2 -1
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/types.js +2 -1
- package/dist/ai/types.js.map +1 -1
- package/dist/cli/commands/epic.d.ts.map +1 -1
- package/dist/cli/commands/epic.js +16 -3
- package/dist/cli/commands/epic.js.map +1 -1
- package/dist/cli/commands/estimate.d.ts +3 -0
- package/dist/cli/commands/estimate.d.ts.map +1 -0
- package/dist/cli/commands/estimate.js +367 -0
- package/dist/cli/commands/estimate.js.map +1 -0
- package/dist/cli/commands/export.d.ts +8 -0
- package/dist/cli/commands/export.d.ts.map +1 -0
- package/dist/cli/commands/export.js +280 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/github.d.ts +8 -0
- package/dist/cli/commands/github.d.ts.map +1 -0
- package/dist/cli/commands/github.js +412 -0
- package/dist/cli/commands/github.js.map +1 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +9 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/plan.d.ts.map +1 -1
- package/dist/cli/commands/plan.js +89 -20
- package/dist/cli/commands/plan.js.map +1 -1
- package/dist/cli/commands/search.d.ts +3 -0
- package/dist/cli/commands/search.d.ts.map +1 -0
- package/dist/cli/commands/search.js +115 -0
- package/dist/cli/commands/search.js.map +1 -0
- package/dist/cli/index.js +8 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/services/github-service.d.ts +83 -0
- package/dist/services/github-service.d.ts.map +1 -0
- package/dist/services/github-service.js +435 -0
- package/dist/services/github-service.js.map +1 -0
- package/dist/services/template-service.d.ts.map +1 -1
- package/dist/services/template-service.js +1 -0
- package/dist/services/template-service.js.map +1 -1
- package/dist/templates/export/planning-report.html.hbs +230 -0
- package/dist/templates/export/planning-report.md.hbs +136 -0
- package/dist/templates/guides/estimation.md.hbs +71 -0
- package/package.json +1 -1
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub integration service.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the `gh` CLI to create/update issues, labels, and milestones.
|
|
5
|
+
* All operations use `gh` so authentication is handled by the user's
|
|
6
|
+
* existing GitHub CLI session — no extra API tokens needed.
|
|
7
|
+
*/
|
|
8
|
+
import { execFile } from 'node:child_process';
|
|
9
|
+
import { writeFile as fsWriteFile, mkdtemp, rm } from 'node:fs/promises';
|
|
10
|
+
import { tmpdir } from 'node:os';
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import { promisify } from 'node:util';
|
|
13
|
+
import { which } from '../agents/utils.js';
|
|
14
|
+
import { parseMarkdown } from '../utils/markdown.js';
|
|
15
|
+
const execFileAsync = promisify(execFile);
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Label & type mapping
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
const TYPE_LABELS = {
|
|
20
|
+
epic: 'planr:epic',
|
|
21
|
+
feature: 'planr:feature',
|
|
22
|
+
story: 'planr:story',
|
|
23
|
+
task: 'planr:task',
|
|
24
|
+
quick: 'planr:quick',
|
|
25
|
+
};
|
|
26
|
+
const LABEL_COLORS = {
|
|
27
|
+
'planr:epic': '7B68EE',
|
|
28
|
+
'planr:feature': '4169E1',
|
|
29
|
+
'planr:story': '2E8B57',
|
|
30
|
+
'planr:task': 'DAA520',
|
|
31
|
+
'planr:quick': 'DA70D6',
|
|
32
|
+
};
|
|
33
|
+
const ISSUE_STATE_TO_STATUS = {
|
|
34
|
+
open: 'pending',
|
|
35
|
+
closed: 'done',
|
|
36
|
+
};
|
|
37
|
+
const STATUS_TO_ISSUE_STATE = {
|
|
38
|
+
pending: 'open',
|
|
39
|
+
'in-progress': 'open',
|
|
40
|
+
done: 'closed',
|
|
41
|
+
};
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// Helpers
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
async function ensureGhCli() {
|
|
46
|
+
const ghPath = await which('gh');
|
|
47
|
+
if (!ghPath) {
|
|
48
|
+
throw new Error('GitHub CLI (gh) is not installed.\n\n' +
|
|
49
|
+
' 1. Install it from https://cli.github.com/\n' +
|
|
50
|
+
' 2. Run `gh auth login` to authenticate\n' +
|
|
51
|
+
' 3. Re-run your planr github command');
|
|
52
|
+
}
|
|
53
|
+
return ghPath;
|
|
54
|
+
}
|
|
55
|
+
async function ensureGhAuth(ghPath) {
|
|
56
|
+
try {
|
|
57
|
+
await execFileAsync(ghPath, ['auth', 'status'], { maxBuffer: 1024 * 1024 });
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
throw new Error('GitHub CLI is not authenticated.\n\n' +
|
|
61
|
+
' Run `gh auth login` to sign in, then re-run your planr github command.');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function gh(args) {
|
|
65
|
+
const ghPath = await ensureGhCli();
|
|
66
|
+
try {
|
|
67
|
+
const { stdout } = await execFileAsync(ghPath, args, { maxBuffer: 10 * 1024 * 1024 });
|
|
68
|
+
return stdout.trim();
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
const errObj = err;
|
|
72
|
+
const stderr = (errObj.stderr || '').toLowerCase();
|
|
73
|
+
if (stderr.includes('auth login') || stderr.includes('not logged')) {
|
|
74
|
+
throw new Error('GitHub CLI is not authenticated.\n\n' +
|
|
75
|
+
' Run `gh auth login` to sign in, then re-run your planr github command.');
|
|
76
|
+
}
|
|
77
|
+
if (stderr.includes('not a git repository')) {
|
|
78
|
+
throw new Error('This directory is not a git repository.\n\n' +
|
|
79
|
+
' Run `git init` and add a GitHub remote, or cd into a GitHub-hosted repo.');
|
|
80
|
+
}
|
|
81
|
+
if (stderr.includes('no git remotes') || stderr.includes('no github remotes')) {
|
|
82
|
+
throw new Error('No GitHub remote found in this repository.\n\n' +
|
|
83
|
+
' Add one with: git remote add origin https://github.com/<owner>/<repo>.git');
|
|
84
|
+
}
|
|
85
|
+
throw err;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async function ghJSON(args) {
|
|
89
|
+
const output = await gh(args);
|
|
90
|
+
return JSON.parse(output);
|
|
91
|
+
}
|
|
92
|
+
/** Write content to a temp file, run a callback, then clean up. */
|
|
93
|
+
async function withTempFile(content, fn) {
|
|
94
|
+
const dir = await mkdtemp(path.join(tmpdir(), 'planr-'));
|
|
95
|
+
const filePath = path.join(dir, 'body.md');
|
|
96
|
+
await fsWriteFile(filePath, content, 'utf-8');
|
|
97
|
+
try {
|
|
98
|
+
return await fn(filePath);
|
|
99
|
+
}
|
|
100
|
+
finally {
|
|
101
|
+
await rm(dir, { recursive: true, force: true }).catch(() => { });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
// Public API
|
|
106
|
+
// ---------------------------------------------------------------------------
|
|
107
|
+
/**
|
|
108
|
+
* Verify that the current directory is a GitHub repo with `gh` authenticated.
|
|
109
|
+
*/
|
|
110
|
+
export async function verifyGitHubRepo() {
|
|
111
|
+
const ghPath = await ensureGhCli();
|
|
112
|
+
await ensureGhAuth(ghPath);
|
|
113
|
+
const repoInfo = await ghJSON([
|
|
114
|
+
'repo',
|
|
115
|
+
'view',
|
|
116
|
+
'--json',
|
|
117
|
+
'nameWithOwner',
|
|
118
|
+
]);
|
|
119
|
+
const [owner, repo] = repoInfo.nameWithOwner.split('/');
|
|
120
|
+
return { owner, repo };
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Ensure a planr label exists, creating it if missing.
|
|
124
|
+
*/
|
|
125
|
+
export async function ensureLabel(label) {
|
|
126
|
+
const color = LABEL_COLORS[label] || 'CCCCCC';
|
|
127
|
+
try {
|
|
128
|
+
await gh([
|
|
129
|
+
'label',
|
|
130
|
+
'create',
|
|
131
|
+
label,
|
|
132
|
+
'--color',
|
|
133
|
+
color,
|
|
134
|
+
'--description',
|
|
135
|
+
`OpenPlanr ${label}`,
|
|
136
|
+
'--force',
|
|
137
|
+
]);
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
// Label already exists or permissions issue — safe to continue
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get the label name for an artifact type.
|
|
145
|
+
*/
|
|
146
|
+
export function getLabelForType(type) {
|
|
147
|
+
return TYPE_LABELS[type] || null;
|
|
148
|
+
}
|
|
149
|
+
// ---------------------------------------------------------------------------
|
|
150
|
+
// Issue body formatting helpers
|
|
151
|
+
// ---------------------------------------------------------------------------
|
|
152
|
+
/** Remove the first H1 heading line (duplicates issue title). */
|
|
153
|
+
function removeH1(content) {
|
|
154
|
+
const lines = content.split('\n');
|
|
155
|
+
const idx = lines.findIndex((l) => /^# /.test(l));
|
|
156
|
+
if (idx !== -1)
|
|
157
|
+
lines.splice(idx, 1);
|
|
158
|
+
return lines.join('\n');
|
|
159
|
+
}
|
|
160
|
+
/** Convert relative markdown links to plain text (broken on GitHub). */
|
|
161
|
+
function stripRelativeLinks(content) {
|
|
162
|
+
return content.replace(/\[([^\]]+)\]\(\.\.[^)]+\)/g, '$1');
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Extract a `## Heading` section (heading + all content until next `##` or EOF).
|
|
166
|
+
* Returns `[sectionContent, contentWithoutSection]`.
|
|
167
|
+
*/
|
|
168
|
+
function extractSection(content, heading) {
|
|
169
|
+
const lines = content.split('\n');
|
|
170
|
+
const start = lines.findIndex((l) => l.trim() === `## ${heading}`);
|
|
171
|
+
if (start === -1)
|
|
172
|
+
return [null, content];
|
|
173
|
+
let end = lines.length;
|
|
174
|
+
for (let i = start + 1; i < lines.length; i++) {
|
|
175
|
+
if (/^## /.test(lines[i])) {
|
|
176
|
+
end = i;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const section = lines.slice(start, end).join('\n');
|
|
181
|
+
const remaining = [...lines.slice(0, start), ...lines.slice(end)].join('\n');
|
|
182
|
+
return [section, remaining];
|
|
183
|
+
}
|
|
184
|
+
/** Remove a `## Heading` section entirely. */
|
|
185
|
+
function removeSection(content, heading) {
|
|
186
|
+
const [, remaining] = extractSection(content, heading);
|
|
187
|
+
return remaining;
|
|
188
|
+
}
|
|
189
|
+
/** Generate a GitHub markdown metadata table. Skips rows with falsy values. */
|
|
190
|
+
function buildMetadataTable(rows) {
|
|
191
|
+
const valid = rows.filter(([, v]) => v);
|
|
192
|
+
if (valid.length === 0)
|
|
193
|
+
return '';
|
|
194
|
+
const header = '| Field | Value |\n|-------|-------|\n';
|
|
195
|
+
const body = valid.map(([label, value]) => `| **${label}** | ${value} |`).join('\n');
|
|
196
|
+
return `${header}${body}\n`;
|
|
197
|
+
}
|
|
198
|
+
/** Build the standard OpenPlanr footer (sync depends on this exact format). */
|
|
199
|
+
function buildFooter(artifactId, artifactType) {
|
|
200
|
+
return [
|
|
201
|
+
'',
|
|
202
|
+
'---',
|
|
203
|
+
`> **OpenPlanr** | \`${artifactId}\` (${artifactType}) | Synced by \`planr github\``,
|
|
204
|
+
].join('\n');
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Clean the issue title — strip redundant prefixes like "Tasks for FEAT-001: ".
|
|
208
|
+
*/
|
|
209
|
+
export function cleanTitle(artifactId, rawTitle) {
|
|
210
|
+
const cleaned = rawTitle.replace(/^Tasks for \w+-\d+:\s*/i, '');
|
|
211
|
+
return `${artifactId}: ${cleaned}`;
|
|
212
|
+
}
|
|
213
|
+
// ---------------------------------------------------------------------------
|
|
214
|
+
// Type-specific body builders
|
|
215
|
+
// ---------------------------------------------------------------------------
|
|
216
|
+
function buildTaskBody(content, frontmatter) {
|
|
217
|
+
const meta = buildMetadataTable([
|
|
218
|
+
['Status', frontmatter.status],
|
|
219
|
+
['Story', frontmatter.storyId],
|
|
220
|
+
['Feature', frontmatter.featureId],
|
|
221
|
+
]);
|
|
222
|
+
let body = content;
|
|
223
|
+
// Strip standalone parent reference lines (already in metadata table)
|
|
224
|
+
body = body.replace(/^\*\*(User Story|Feature|Story):\*\*.*\n?/gm, '');
|
|
225
|
+
// Remove Notes section (references planr CLI, irrelevant on GitHub)
|
|
226
|
+
body = removeSection(body, 'Notes');
|
|
227
|
+
// Extract sections to reorder: Tasks → AC Mapping → Relevant Files → Artifact Sources
|
|
228
|
+
const [tasksSection, withoutTasks] = extractSection(body, 'Tasks');
|
|
229
|
+
const [acSection, withoutAc] = extractSection(withoutTasks, 'Acceptance Criteria Mapping');
|
|
230
|
+
const [filesSection, withoutFiles] = extractSection(withoutAc, 'Relevant Files');
|
|
231
|
+
const [sourcesSection, remaining] = extractSection(withoutFiles, 'Artifact Sources');
|
|
232
|
+
// Convert AC checkboxes to plain list
|
|
233
|
+
const acCleaned = acSection ? acSection.replace(/^(\s*)- \[[ x]\] /gm, '$1- ') : null;
|
|
234
|
+
// Wrap artifact sources in collapsible details
|
|
235
|
+
let sourcesWrapped = null;
|
|
236
|
+
if (sourcesSection) {
|
|
237
|
+
const sourcesBody = sourcesSection.replace(/^## [^\n]+\n/, '').trim();
|
|
238
|
+
sourcesWrapped = `<details>\n<summary>📋 Artifact Sources</summary>\n\n${sourcesBody}\n</details>`;
|
|
239
|
+
}
|
|
240
|
+
// Reassemble in desired order
|
|
241
|
+
const parts = [
|
|
242
|
+
meta.trim(),
|
|
243
|
+
tasksSection,
|
|
244
|
+
acCleaned,
|
|
245
|
+
filesSection,
|
|
246
|
+
sourcesWrapped,
|
|
247
|
+
remaining.trim() || null,
|
|
248
|
+
].filter(Boolean);
|
|
249
|
+
return parts.join('\n\n');
|
|
250
|
+
}
|
|
251
|
+
function buildEpicBody(content, frontmatter) {
|
|
252
|
+
const meta = buildMetadataTable([
|
|
253
|
+
['Status', frontmatter.status],
|
|
254
|
+
['Owner', frontmatter.owner],
|
|
255
|
+
]);
|
|
256
|
+
return `${meta}\n${content.trim()}`;
|
|
257
|
+
}
|
|
258
|
+
function buildFeatureBody(content, frontmatter) {
|
|
259
|
+
const meta = buildMetadataTable([
|
|
260
|
+
['Status', frontmatter.status],
|
|
261
|
+
['Epic', frontmatter.epicId],
|
|
262
|
+
['Owner', frontmatter.owner],
|
|
263
|
+
]);
|
|
264
|
+
return `${meta}\n${content.trim()}`;
|
|
265
|
+
}
|
|
266
|
+
function buildStoryBody(content, frontmatter) {
|
|
267
|
+
const meta = buildMetadataTable([
|
|
268
|
+
['Status', frontmatter.status],
|
|
269
|
+
['Feature', frontmatter.featureId],
|
|
270
|
+
]);
|
|
271
|
+
return `${meta}\n${content.trim()}`;
|
|
272
|
+
}
|
|
273
|
+
// ---------------------------------------------------------------------------
|
|
274
|
+
// Issue body builder (type-aware)
|
|
275
|
+
// ---------------------------------------------------------------------------
|
|
276
|
+
/**
|
|
277
|
+
* Build issue body from artifact raw markdown.
|
|
278
|
+
* Type-aware: produces clean, professional formatting for each artifact type.
|
|
279
|
+
*/
|
|
280
|
+
export function buildIssueBody(raw, artifactId, artifactType, frontmatter) {
|
|
281
|
+
const { content } = parseMarkdown(raw);
|
|
282
|
+
let cleaned = removeH1(content);
|
|
283
|
+
cleaned = stripRelativeLinks(cleaned);
|
|
284
|
+
let body;
|
|
285
|
+
switch (artifactType) {
|
|
286
|
+
case 'task':
|
|
287
|
+
case 'quick':
|
|
288
|
+
body = buildTaskBody(cleaned, frontmatter);
|
|
289
|
+
break;
|
|
290
|
+
case 'epic':
|
|
291
|
+
body = buildEpicBody(cleaned, frontmatter);
|
|
292
|
+
break;
|
|
293
|
+
case 'feature':
|
|
294
|
+
body = buildFeatureBody(cleaned, frontmatter);
|
|
295
|
+
break;
|
|
296
|
+
case 'story':
|
|
297
|
+
body = buildStoryBody(cleaned, frontmatter);
|
|
298
|
+
break;
|
|
299
|
+
default:
|
|
300
|
+
body = cleaned.trim();
|
|
301
|
+
}
|
|
302
|
+
return `${body}\n${buildFooter(artifactId, artifactType)}`;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Create a GitHub issue from artifact data.
|
|
306
|
+
*/
|
|
307
|
+
export async function createIssue(title, body, labels, milestone) {
|
|
308
|
+
return withTempFile(body, async (bodyFile) => {
|
|
309
|
+
const args = ['issue', 'create', '--title', title, '--body-file', bodyFile];
|
|
310
|
+
for (const label of labels) {
|
|
311
|
+
args.push('--label', label);
|
|
312
|
+
}
|
|
313
|
+
if (milestone) {
|
|
314
|
+
args.push('--milestone', milestone);
|
|
315
|
+
}
|
|
316
|
+
const url = await gh(args);
|
|
317
|
+
const issueNumber = Number.parseInt(url.split('/').pop() || '0', 10);
|
|
318
|
+
return { number: issueNumber, url };
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Update an existing GitHub issue.
|
|
323
|
+
*/
|
|
324
|
+
export async function updateIssue(issueNumber, opts) {
|
|
325
|
+
if (opts.title || opts.body) {
|
|
326
|
+
const editArgs = ['issue', 'edit', String(issueNumber)];
|
|
327
|
+
if (opts.title)
|
|
328
|
+
editArgs.push('--title', opts.title);
|
|
329
|
+
if (opts.body) {
|
|
330
|
+
await withTempFile(opts.body, async (bodyFile) => {
|
|
331
|
+
editArgs.push('--body-file', bodyFile);
|
|
332
|
+
await gh(editArgs);
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
await gh(editArgs);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
if (opts.state === 'closed') {
|
|
340
|
+
await gh(['issue', 'close', String(issueNumber)]);
|
|
341
|
+
}
|
|
342
|
+
else if (opts.state === 'open') {
|
|
343
|
+
await gh(['issue', 'reopen', String(issueNumber)]);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Get a GitHub issue by number.
|
|
348
|
+
*/
|
|
349
|
+
export async function getIssue(issueNumber) {
|
|
350
|
+
return ghJSON([
|
|
351
|
+
'issue',
|
|
352
|
+
'view',
|
|
353
|
+
String(issueNumber),
|
|
354
|
+
'--json',
|
|
355
|
+
'number,title,state,url,labels',
|
|
356
|
+
]);
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* List all issues with planr labels.
|
|
360
|
+
*/
|
|
361
|
+
export async function listPlanrIssues(state = 'all', limit = 200) {
|
|
362
|
+
const labels = Object.values(TYPE_LABELS).join(',');
|
|
363
|
+
return ghJSON([
|
|
364
|
+
'issue',
|
|
365
|
+
'list',
|
|
366
|
+
'--label',
|
|
367
|
+
labels,
|
|
368
|
+
'--state',
|
|
369
|
+
state,
|
|
370
|
+
'--json',
|
|
371
|
+
'number,title,state,url,labels',
|
|
372
|
+
'--limit',
|
|
373
|
+
String(limit),
|
|
374
|
+
]);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Create or get a GitHub milestone (used for epics).
|
|
378
|
+
*/
|
|
379
|
+
export async function ensureMilestone(title) {
|
|
380
|
+
// Check if milestone already exists
|
|
381
|
+
try {
|
|
382
|
+
const milestones = await ghJSON([
|
|
383
|
+
'api',
|
|
384
|
+
'repos/{owner}/{repo}/milestones',
|
|
385
|
+
]);
|
|
386
|
+
if (Array.isArray(milestones) && milestones.some((m) => m.title === title)) {
|
|
387
|
+
return title;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
catch {
|
|
391
|
+
// Milestone listing failed, try to create
|
|
392
|
+
}
|
|
393
|
+
// Create milestone
|
|
394
|
+
try {
|
|
395
|
+
await gh([
|
|
396
|
+
'api',
|
|
397
|
+
'repos/{owner}/{repo}/milestones',
|
|
398
|
+
'-f',
|
|
399
|
+
`title=${title}`,
|
|
400
|
+
'-f',
|
|
401
|
+
'state=open',
|
|
402
|
+
]);
|
|
403
|
+
}
|
|
404
|
+
catch {
|
|
405
|
+
// May already exist, that's fine
|
|
406
|
+
}
|
|
407
|
+
return title;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Map GitHub issue state to artifact status.
|
|
411
|
+
*/
|
|
412
|
+
export function issueStateToStatus(state) {
|
|
413
|
+
return ISSUE_STATE_TO_STATUS[state] || 'pending';
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Map artifact status to GitHub issue state.
|
|
417
|
+
*/
|
|
418
|
+
export function statusToIssueState(status) {
|
|
419
|
+
return STATUS_TO_ISSUE_STATE[status] || 'open';
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Extract the planr artifact type from issue labels.
|
|
423
|
+
*/
|
|
424
|
+
export function getTypeFromLabels(labels) {
|
|
425
|
+
const reverseMap = {};
|
|
426
|
+
for (const [type, label] of Object.entries(TYPE_LABELS)) {
|
|
427
|
+
reverseMap[label] = type;
|
|
428
|
+
}
|
|
429
|
+
for (const label of labels) {
|
|
430
|
+
if (reverseMap[label.name])
|
|
431
|
+
return reverseMap[label.name];
|
|
432
|
+
}
|
|
433
|
+
return null;
|
|
434
|
+
}
|
|
435
|
+
//# sourceMappingURL=github-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-service.js","sourceRoot":"","sources":["../../src/services/github-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAA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,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QACxD,UAAU,CAAC,KAAK,CAAC,GAAG,IAAoB,CAAC;IAC3C,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC;YAAE,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-service.d.ts","sourceRoot":"","sources":["../../src/services/template-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"template-service.d.ts","sourceRoot":"","sources":["../../src/services/template-service.ts"],"names":[],"mappings":"AAyBA,wBAAsB,cAAc,CAClC,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,CAYjB"}
|
|
@@ -12,6 +12,7 @@ Handlebars.registerHelper('checkboxList', (items) => {
|
|
|
12
12
|
return items.map((item) => `- [ ] ${item}`).join('\n');
|
|
13
13
|
});
|
|
14
14
|
Handlebars.registerHelper('join', (arr, sep) => Array.isArray(arr) ? arr.join(typeof sep === 'string' ? sep : ', ') : '');
|
|
15
|
+
Handlebars.registerHelper('eq', (a, b) => a === b);
|
|
15
16
|
export async function renderTemplate(templatePath, data, overrideDir) {
|
|
16
17
|
const fullPath = await resolveTemplatePath(templatePath, overrideDir);
|
|
17
18
|
let compiled = compiledCache.get(fullPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-service.js","sourceRoot":"","sources":["../../src/services/template-service.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,UA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