@straiffi/archon 1.2.28 → 1.2.30

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.
@@ -5,10 +5,10 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Archon</title>
8
- <script type="module" crossorigin src="/assets/index-Cnsdqm6z.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-z4dWKCle.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-BYbx6iT9.js">
10
- <link rel="modulepreload" crossorigin href="/assets/dropdown-menu-q_xHq7cA.js">
11
- <link rel="stylesheet" crossorigin href="/assets/index-B1uf_7rL.css">
10
+ <link rel="modulepreload" crossorigin href="/assets/dropdown-menu-BULYW006.js">
11
+ <link rel="stylesheet" crossorigin href="/assets/index-DoNUd8CK.css">
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>
@@ -44,7 +44,8 @@ import { resolveClientBuildPaths, shouldServeClientApp, STATIC_CLIENT_DIRECTORY_
44
44
  import { deleteIntegrationConnection, getGitHubConnectionConfig, getJiraConnectionConfig, listIntegrationConnections, upsertIntegrationConnection, } from './lib/integrations/index.js';
45
45
  import { createGitHubPullRequest, findOpenGitHubPullRequest, findOpenGitHubPullRequestByHeadBranch, getGitHubPullRequestComments, getGitHubPullRequestReviews, getGitHubPullRequest, GitHubApiError, hasGitHubRemoteBranch, resolveGitHubRepository, validateGitHubConnection, } from './lib/integrations/github.js';
46
46
  import { importJiraIssue, JiraApiError, validateJiraConnection } from './lib/integrations/jira.js';
47
- import { JiraPlanningReferenceError, resolveJiraPlanningDescription } from './lib/integrations/planning.js';
47
+ import { importGitHubIssue } from './lib/integrations/github-issues.js';
48
+ import { PlanningReferenceError, resolveExternalPlanningDescription } from './lib/integrations/planning.js';
48
49
  import { getBundlePullRequestRecord, hasOpenBundlePullRequest, serializeBundlePullRequest, shouldSyncBundlePullRequest, upsertBundlePullRequest, } from './lib/bundlePullRequests.js';
49
50
  import { countInboundProjectLinks, getEffectiveProject, getProjectById, getProjectTicketStats, hasProjectRunIde, listProjects, replaceProjectLinks, serializeProject, updateProjectActiveTarget, validateProjectPayload, } from './lib/projects.js';
50
51
  import { getActiveRunStatus, getActiveRunStatusForProject, getPreviewStatusForProject, hasRunConfig, isRunning, openIde, openTicketIdeInWorkspace, resolveProjectRunContextKey, runSetupCommandsInWorkspace, runTicketInWorkspace, stopAllTickets, stopTicket } from './lib/run.js';
@@ -407,7 +408,7 @@ const parseIncomingExternalSource = (value) => {
407
408
  if (provider === '' && externalId === '' && externalKey === '' && externalUrl === '') {
408
409
  return null;
409
410
  }
410
- if (provider !== 'jira' || !externalId || !externalKey) {
411
+ if ((provider !== 'jira' && provider !== 'github') || !externalId || !externalKey) {
411
412
  throw new HttpError(400, 'external_source must contain a supported provider, external_id, and external_key');
412
413
  }
413
414
  const metadata = payload.metadata;
@@ -415,7 +416,7 @@ const parseIncomingExternalSource = (value) => {
415
416
  throw new HttpError(400, 'external_source metadata must be an object when provided');
416
417
  }
417
418
  return {
418
- provider: 'jira',
419
+ provider: provider,
419
420
  external_id: externalId,
420
421
  external_key: externalKey,
421
422
  external_url: externalUrl || null,
@@ -3391,6 +3392,35 @@ app.post('/integrations/jira/resolve/issue', async (req, res) => {
3391
3392
  return res.status(500).json({ error: getErrorMessage(error) || 'Unable to import the Jira issue.' });
3392
3393
  }
3393
3394
  });
3395
+ app.post('/integrations/github/resolve/issue', async (req, res) => {
3396
+ const result = getRequiredProject(req);
3397
+ if ('error' in result) {
3398
+ return res.status(400).json({ error: result.error });
3399
+ }
3400
+ const githubConfig = getGitHubConnectionConfig(result.project.id);
3401
+ if (!githubConfig) {
3402
+ return res.status(400).json({ error: 'GitHub is not connected for this project.' });
3403
+ }
3404
+ const issue = asTrimmedString(req.body?.issue);
3405
+ if (!issue) {
3406
+ return res.status(400).json({ error: 'issue is required' });
3407
+ }
3408
+ console.info(`[integrations] github resolve issue project=${result.project.id} issue=${issue}`);
3409
+ try {
3410
+ const draft = await importGitHubIssue(githubConfig, issue);
3411
+ return res.json({ draft });
3412
+ }
3413
+ catch (error) {
3414
+ console.warn(`[integrations] github resolve issue failed project=${result.project.id} issue=${issue}`, error);
3415
+ if (error instanceof GitHubApiError) {
3416
+ return res.status(error.status).json({ error: error.publicMessage });
3417
+ }
3418
+ if (error instanceof HttpError) {
3419
+ return res.status(error.status).json({ error: error.message });
3420
+ }
3421
+ return res.status(500).json({ error: getErrorMessage(error) || 'Unable to import the GitHub issue.' });
3422
+ }
3423
+ });
3394
3424
  app.post('/plan', async (req, res) => {
3395
3425
  const { title, description, model, variant, project_id } = req.body;
3396
3426
  if (typeof title !== 'string' || !title.trim()) {
@@ -3400,7 +3430,7 @@ app.post('/plan', async (req, res) => {
3400
3430
  return res.status(400).json({ error: 'Description is required' });
3401
3431
  }
3402
3432
  try {
3403
- const resolvedDescription = await resolveJiraPlanningDescription(typeof project_id === 'string' ? project_id : null, description.trim());
3433
+ const resolvedDescription = await resolveExternalPlanningDescription(typeof project_id === 'string' ? project_id : null, description.trim());
3404
3434
  const bundleSelection = resolveRequestedBundleSelection(req.body, typeof project_id === 'string' ? project_id : null);
3405
3435
  if ('error' in bundleSelection) {
3406
3436
  return res.status(bundleSelection.status).json({ error: bundleSelection.error });
@@ -3418,12 +3448,15 @@ app.post('/plan', async (req, res) => {
3418
3448
  });
3419
3449
  }
3420
3450
  catch (err) {
3421
- if (err instanceof JiraPlanningReferenceError) {
3451
+ if (err instanceof PlanningReferenceError) {
3422
3452
  return res.status(err.status).json({ error: err.message });
3423
3453
  }
3424
3454
  if (err instanceof JiraApiError) {
3425
3455
  return res.status(err.status).json({ error: err.publicMessage });
3426
3456
  }
3457
+ if (err instanceof GitHubApiError) {
3458
+ return res.status(err.status).json({ error: err.publicMessage });
3459
+ }
3427
3460
  res.status(500).json({ error: err instanceof Error ? err.message : 'Planning failed' });
3428
3461
  }
3429
3462
  });
@@ -3444,7 +3477,7 @@ app.post('/planning-agent', async (req, res) => {
3444
3477
  const trimmedDescription = description.trim();
3445
3478
  let autoCreatedBundle = null;
3446
3479
  try {
3447
- const resolvedDescription = await resolveJiraPlanningDescription(project.id, trimmedDescription);
3480
+ const resolvedDescription = await resolveExternalPlanningDescription(project.id, trimmedDescription);
3448
3481
  const requestedBundleSelection = resolveRequestedBundleSelection(req.body, project.id);
3449
3482
  if ('error' in requestedBundleSelection) {
3450
3483
  return res.status(requestedBundleSelection.status).json({ error: requestedBundleSelection.error });
@@ -3508,12 +3541,15 @@ app.post('/planning-agent', async (req, res) => {
3508
3541
  if (autoCreatedBundle && countBundleTickets(autoCreatedBundle.id, project.id) === 0) {
3509
3542
  deleteBundle(autoCreatedBundle.id, project.id);
3510
3543
  }
3511
- if (error instanceof JiraPlanningReferenceError) {
3544
+ if (error instanceof PlanningReferenceError) {
3512
3545
  return res.status(error.status).json({ error: error.message });
3513
3546
  }
3514
3547
  if (error instanceof JiraApiError) {
3515
3548
  return res.status(error.status).json({ error: error.publicMessage });
3516
3549
  }
3550
+ if (error instanceof GitHubApiError) {
3551
+ return res.status(error.status).json({ error: error.publicMessage });
3552
+ }
3517
3553
  if (error instanceof HttpError) {
3518
3554
  return res.status(error.status).json({ error: error.message });
3519
3555
  }