@kaddo/cli 3.86.0 → 3.87.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.
@@ -5,7 +5,7 @@
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>admin</title>
8
- <script type="module" crossorigin src="/assets/index-MJauSqlv.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-Bey8Xopr.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-DNkI-1xG.css">
10
10
  </head>
11
11
  <body>
@@ -710,6 +710,16 @@ var WorkItemDetailSchema = WorkItemListItemSchema.extend({
710
710
  graphRevision: z.string().nullable(),
711
711
  graphCoverage: z.enum(["unavailable", "partial", "available"]),
712
712
  source: z.object({ type: z.string(), id: z.string().optional(), inferred: z.boolean() }).passthrough(),
713
+ originalSnapshot: z.object({
714
+ title: z.string(),
715
+ description: z.string().optional(),
716
+ type: z.string().optional(),
717
+ status: z.string().optional(),
718
+ labels: z.array(z.string()).optional(),
719
+ assignee: z.string().optional(),
720
+ created_at: z.string().optional(),
721
+ updated_at: z.string().optional()
722
+ }).nullable(),
713
723
  path: z.string(),
714
724
  refinement: z.object({
715
725
  status: z.enum(["needs-refinement", "refined"]),
package/dist/core.js CHANGED
@@ -6590,6 +6590,7 @@ function parseWorkItemSource(frontmatter) {
6590
6590
  integration: optStr(obj.integration) ?? optStr(frontmatter.source_integration),
6591
6591
  url: optStr(obj.url) ?? optStr(frontmatter.source_url),
6592
6592
  imported_at: optStr(obj.imported_at) ?? optStr(frontmatter.source_imported_at),
6593
+ external_updated_at: optStr(obj.external_updated_at) ?? optStr(frontmatter.source_external_updated_at),
6593
6594
  synced_at: optStr(obj.synced_at) ?? optStr(frontmatter.source_synced_at),
6594
6595
  inferred: obj.inferred === true || obj.inferred === "true",
6595
6596
  reason: t && !isValidSource(t) ? `Invalid source type in object: "${t}".` : void 0
@@ -6605,6 +6606,7 @@ function parseWorkItemSource(frontmatter) {
6605
6606
  provider: optStr(frontmatter.source_provider),
6606
6607
  url: optStr(frontmatter.source_url),
6607
6608
  imported_at: optStr(frontmatter.source_imported_at),
6609
+ external_updated_at: optStr(frontmatter.source_external_updated_at),
6608
6610
  synced_at: optStr(frontmatter.source_synced_at),
6609
6611
  inferred: false
6610
6612
  };
@@ -6618,6 +6620,7 @@ function parseWorkItemSource(frontmatter) {
6618
6620
  provider: optStr(frontmatter.source_provider),
6619
6621
  url: optStr(frontmatter.source_url),
6620
6622
  imported_at: optStr(frontmatter.source_imported_at),
6623
+ external_updated_at: optStr(frontmatter.source_external_updated_at),
6621
6624
  synced_at: optStr(frontmatter.source_synced_at),
6622
6625
  inferred: true,
6623
6626
  reason: `Invalid source value: "${raw}".`
@@ -8122,6 +8125,7 @@ function getWorkItem(dir, workItemId) {
8122
8125
  decisions: parseDecisions(match.decisions, knowledgeById),
8123
8126
  relatedKnowledge: parseRelatedKnowledge(fm, knowledgeById),
8124
8127
  source: parseWorkItemSource(fm),
8128
+ originalSnapshot: parseOriginalSnapshot(fm),
8125
8129
  path: match.relPath,
8126
8130
  ...parseSystemImpact(dir, fm)
8127
8131
  };
@@ -8167,6 +8171,23 @@ function parseSystemImpact(dir, fm) {
8167
8171
  const graphCoverage = topology.entities.length === 0 ? "unavailable" : topology.relationships.length > 0 ? "available" : "partial";
8168
8172
  return { affectedSystemEntities: affected, reviewedSystemEntities: reviewed, graphRevision, graphCoverage };
8169
8173
  }
8174
+ function parseOriginalSnapshot(fm) {
8175
+ const raw = fm.original_snapshot;
8176
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
8177
+ const o = raw;
8178
+ const title = typeof o.title === "string" ? o.title : void 0;
8179
+ if (!title) return null;
8180
+ return {
8181
+ title,
8182
+ description: typeof o.description === "string" ? o.description : void 0,
8183
+ type: typeof o.type === "string" ? o.type : void 0,
8184
+ status: typeof o.status === "string" ? o.status : void 0,
8185
+ labels: Array.isArray(o.labels) ? o.labels.map(String) : void 0,
8186
+ assignee: typeof o.assignee === "string" ? o.assignee : void 0,
8187
+ created_at: typeof o.created_at === "string" ? o.created_at : void 0,
8188
+ updated_at: typeof o.updated_at === "string" ? o.updated_at : void 0
8189
+ };
8190
+ }
8170
8191
  function readBody(filePath) {
8171
8192
  try {
8172
8193
  const raw = readFile(filePath);
@@ -8852,6 +8873,7 @@ function createWorkItem(dir, opts) {
8852
8873
  affected_modules: [],
8853
8874
  summary: intent
8854
8875
  };
8876
+ if (opts.originalSnapshot) data.original_snapshot = opts.originalSnapshot;
8855
8877
  const answers = opts.answers ?? {};
8856
8878
  const hasAnswers = Object.values(answers).some((v) => v?.trim());
8857
8879
  const body = hasAnswers ? captureBody(title, type, answers) : freshBody({
@@ -10339,6 +10361,7 @@ function updateIntegrationFilters(dir, id, filters) {
10339
10361
  }
10340
10362
  async function discoverExternalWorkItems(dir, opts = {}, env = process.env) {
10341
10363
  const { integrations, findings } = loadIntegrations(dir);
10364
+ const importIdx = buildImportIndex(dir);
10342
10365
  const candidates = integrations.filter((i) => {
10343
10366
  if (!i.enabled) return false;
10344
10367
  if (configStatus(i, findings) === "invalid-config") return false;
@@ -10346,6 +10369,13 @@ async function discoverExternalWorkItems(dir, opts = {}, env = process.env) {
10346
10369
  const adapter = registry.get(i.adapter);
10347
10370
  return adapter?.capabilities.workItems.list === true;
10348
10371
  });
10372
+ function enrichItems(integrationId, items) {
10373
+ return items.map((item) => {
10374
+ const linked = importIdx.get(`${integrationId}#${item.externalId}`);
10375
+ const importState = linked ? { imported: true, workItemId: linked.workItemId, title: linked.title } : { imported: false };
10376
+ return { ...item, importState };
10377
+ });
10378
+ }
10349
10379
  const settled = await Promise.allSettled(
10350
10380
  candidates.map(async (integration) => {
10351
10381
  const adapter = resolveAdapter(integration);
@@ -10360,7 +10390,7 @@ async function discoverExternalWorkItems(dir, opts = {}, env = process.env) {
10360
10390
  adapter: integration.adapter,
10361
10391
  displayName: adapter.metadata.displayName,
10362
10392
  icon: adapter.metadata.icon,
10363
- items: page.items,
10393
+ items: enrichItems(integration.id, page.items),
10364
10394
  hasMore: page.hasMore,
10365
10395
  nextCursor: page.nextCursor
10366
10396
  };
@@ -10413,6 +10443,22 @@ function findLinkedWorkItem(dir, integrationId, externalId) {
10413
10443
  }
10414
10444
  return null;
10415
10445
  }
10446
+ function buildImportIndex(dir) {
10447
+ const index = /* @__PURE__ */ new Map();
10448
+ for (const art of discoverWorkItems(dir)) {
10449
+ let data;
10450
+ try {
10451
+ data = matter8(readFile(art.filePath)).data;
10452
+ } catch {
10453
+ continue;
10454
+ }
10455
+ const source = parseWorkItemSource(data);
10456
+ if (source.type === "external" && source.integration && source.id) {
10457
+ index.set(`${source.integration}#${source.id}`, { workItemId: String(data.id ?? ""), title: String(data.title ?? "") });
10458
+ }
10459
+ }
10460
+ return index;
10461
+ }
10416
10462
  async function previewImport(dir, id, externalId, opts = {}, env = process.env) {
10417
10463
  const item = await getExternalWorkItem(dir, id, externalId, env);
10418
10464
  if (!item) throw integrationError("INTEGRATION_NOT_FOUND", `External work item "${externalId}" was not found.`);
@@ -10437,7 +10483,18 @@ ${item.description}` : item.title;
10437
10483
  integration: id,
10438
10484
  id: externalId,
10439
10485
  url: item.url,
10440
- imported_at: (/* @__PURE__ */ new Date()).toISOString()
10486
+ imported_at: (/* @__PURE__ */ new Date()).toISOString(),
10487
+ external_updated_at: item.updatedAt
10488
+ },
10489
+ originalSnapshot: {
10490
+ title: item.title,
10491
+ description: item.description,
10492
+ type: item.type,
10493
+ status: item.status,
10494
+ labels: item.labels,
10495
+ assignee: item.assignees?.[0]?.name,
10496
+ created_at: item.createdAt,
10497
+ updated_at: item.updatedAt
10441
10498
  }
10442
10499
  });
10443
10500
  return { workItemId: created.id, created: true, preview, path: created.path };
@@ -10453,6 +10510,7 @@ export {
10453
10510
  analyzeCrossRepoEvidence,
10454
10511
  analyzeScopeCoverage,
10455
10512
  applyTopologyProposal,
10513
+ buildImportIndex,
10456
10514
  buildProjectExplanation,
10457
10515
  buildProjectRoute,
10458
10516
  buildReadinessReport,
package/dist/index.js CHANGED
@@ -12730,6 +12730,7 @@ function parseWorkItemSource(frontmatter) {
12730
12730
  integration: optStr(obj.integration) ?? optStr(frontmatter.source_integration),
12731
12731
  url: optStr(obj.url) ?? optStr(frontmatter.source_url),
12732
12732
  imported_at: optStr(obj.imported_at) ?? optStr(frontmatter.source_imported_at),
12733
+ external_updated_at: optStr(obj.external_updated_at) ?? optStr(frontmatter.source_external_updated_at),
12733
12734
  synced_at: optStr(obj.synced_at) ?? optStr(frontmatter.source_synced_at),
12734
12735
  inferred: obj.inferred === true || obj.inferred === "true",
12735
12736
  reason: t && !isValidSource(t) ? `Invalid source type in object: "${t}".` : void 0
@@ -12745,6 +12746,7 @@ function parseWorkItemSource(frontmatter) {
12745
12746
  provider: optStr(frontmatter.source_provider),
12746
12747
  url: optStr(frontmatter.source_url),
12747
12748
  imported_at: optStr(frontmatter.source_imported_at),
12749
+ external_updated_at: optStr(frontmatter.source_external_updated_at),
12748
12750
  synced_at: optStr(frontmatter.source_synced_at),
12749
12751
  inferred: false
12750
12752
  };
@@ -12758,6 +12760,7 @@ function parseWorkItemSource(frontmatter) {
12758
12760
  provider: optStr(frontmatter.source_provider),
12759
12761
  url: optStr(frontmatter.source_url),
12760
12762
  imported_at: optStr(frontmatter.source_imported_at),
12763
+ external_updated_at: optStr(frontmatter.source_external_updated_at),
12761
12764
  synced_at: optStr(frontmatter.source_synced_at),
12762
12765
  inferred: true,
12763
12766
  reason: `Invalid source value: "${raw}".`
@@ -17530,6 +17533,7 @@ function createWorkItem(dir, opts) {
17530
17533
  affected_modules: [],
17531
17534
  summary: intent
17532
17535
  };
17536
+ if (opts.originalSnapshot) data.original_snapshot = opts.originalSnapshot;
17533
17537
  const answers = opts.answers ?? {};
17534
17538
  const hasAnswers = Object.values(answers).some((v) => v?.trim());
17535
17539
  const body = hasAnswers ? captureBody(title, type, answers) : freshBody({
@@ -18291,7 +18295,18 @@ ${item.description}` : item.title;
18291
18295
  integration: id,
18292
18296
  id: externalId,
18293
18297
  url: item.url,
18294
- imported_at: (/* @__PURE__ */ new Date()).toISOString()
18298
+ imported_at: (/* @__PURE__ */ new Date()).toISOString(),
18299
+ external_updated_at: item.updatedAt
18300
+ },
18301
+ originalSnapshot: {
18302
+ title: item.title,
18303
+ description: item.description,
18304
+ type: item.type,
18305
+ status: item.status,
18306
+ labels: item.labels,
18307
+ assignee: item.assignees?.[0]?.name,
18308
+ created_at: item.createdAt,
18309
+ updated_at: item.updatedAt
18295
18310
  }
18296
18311
  });
18297
18312
  return { workItemId: created.id, created: true, preview, path: created.path };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaddo/cli",
3
- "version": "3.86.0",
3
+ "version": "3.87.0",
4
4
  "description": "Knowledge Driven Development toolkit",
5
5
  "license": "MIT",
6
6
  "repository": {