@kaddo/cli 3.83.0 → 3.84.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/dist/index.js
CHANGED
|
@@ -17656,6 +17656,51 @@ function parseSecrets(raw, id, findings) {
|
|
|
17656
17656
|
}
|
|
17657
17657
|
return secrets;
|
|
17658
17658
|
}
|
|
17659
|
+
function toStringArray4(raw) {
|
|
17660
|
+
if (raw == null) return void 0;
|
|
17661
|
+
if (Array.isArray(raw)) return raw.filter((v) => typeof v === "string" && v.trim() !== "").map((v) => v.trim());
|
|
17662
|
+
if (typeof raw === "string" && raw.trim()) return [raw.trim()];
|
|
17663
|
+
return void 0;
|
|
17664
|
+
}
|
|
17665
|
+
function parseFilters(raw) {
|
|
17666
|
+
if (raw == null || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
17667
|
+
const o = raw;
|
|
17668
|
+
const filters = {};
|
|
17669
|
+
let hasAny = false;
|
|
17670
|
+
const types = toStringArray4(o.types);
|
|
17671
|
+
if (types?.length) {
|
|
17672
|
+
filters.types = types;
|
|
17673
|
+
hasAny = true;
|
|
17674
|
+
}
|
|
17675
|
+
const statuses = toStringArray4(o.statuses);
|
|
17676
|
+
if (statuses?.length) {
|
|
17677
|
+
filters.statuses = statuses;
|
|
17678
|
+
hasAny = true;
|
|
17679
|
+
}
|
|
17680
|
+
const labels = toStringArray4(o.labels);
|
|
17681
|
+
if (labels?.length) {
|
|
17682
|
+
filters.labels = labels;
|
|
17683
|
+
hasAny = true;
|
|
17684
|
+
}
|
|
17685
|
+
const assignees = toStringArray4(o.assignees);
|
|
17686
|
+
if (assignees?.length) {
|
|
17687
|
+
filters.assignees = assignees;
|
|
17688
|
+
hasAny = true;
|
|
17689
|
+
}
|
|
17690
|
+
if (typeof o.updatedAfter === "string" && o.updatedAfter.trim()) {
|
|
17691
|
+
filters.updatedAfter = o.updatedAfter.trim();
|
|
17692
|
+
hasAny = true;
|
|
17693
|
+
}
|
|
17694
|
+
if (typeof o.search === "string" && o.search.trim()) {
|
|
17695
|
+
filters.search = o.search.trim();
|
|
17696
|
+
hasAny = true;
|
|
17697
|
+
}
|
|
17698
|
+
if (typeof o.providerQuery === "string" && o.providerQuery.trim()) {
|
|
17699
|
+
filters.providerQuery = o.providerQuery.trim();
|
|
17700
|
+
hasAny = true;
|
|
17701
|
+
}
|
|
17702
|
+
return hasAny ? filters : void 0;
|
|
17703
|
+
}
|
|
17659
17704
|
function parseIntegrationsConfig(raw, opts) {
|
|
17660
17705
|
const findings = [];
|
|
17661
17706
|
const integrations = [];
|
|
@@ -17689,8 +17734,9 @@ function parseIntegrationsConfig(raw, opts) {
|
|
|
17689
17734
|
const config = o.config && typeof o.config === "object" && !Array.isArray(o.config) ? o.config : {};
|
|
17690
17735
|
const credentials = parseCredentials(o.credentials, id, findings);
|
|
17691
17736
|
const secrets = parseSecrets(o.secrets, id, findings);
|
|
17737
|
+
const filters = parseFilters(o.filters);
|
|
17692
17738
|
const timeoutMs = typeof o.timeout_ms === "number" ? o.timeout_ms : typeof o.timeoutMs === "number" ? o.timeoutMs : void 0;
|
|
17693
|
-
integrations.push({ id, adapter, enabled, config, credentials, secrets, timeoutMs });
|
|
17739
|
+
integrations.push({ id, adapter, enabled, config, credentials, secrets, filters, timeoutMs });
|
|
17694
17740
|
}
|
|
17695
17741
|
return { integrations, findings };
|
|
17696
17742
|
}
|
|
@@ -17710,6 +17756,20 @@ async function resolveAllCredentials(integration, resolver, env) {
|
|
|
17710
17756
|
}
|
|
17711
17757
|
return { credentials, missing };
|
|
17712
17758
|
}
|
|
17759
|
+
function mergeFilters(base, overlay) {
|
|
17760
|
+
if (!base && !overlay) return {};
|
|
17761
|
+
if (!base) return { ...overlay };
|
|
17762
|
+
if (!overlay) return { ...base };
|
|
17763
|
+
return {
|
|
17764
|
+
types: overlay.types?.length ? overlay.types : base.types,
|
|
17765
|
+
statuses: overlay.statuses?.length ? overlay.statuses : base.statuses,
|
|
17766
|
+
labels: overlay.labels?.length ? overlay.labels : base.labels,
|
|
17767
|
+
assignees: overlay.assignees?.length ? overlay.assignees : base.assignees,
|
|
17768
|
+
updatedAfter: overlay.updatedAfter ?? base.updatedAfter,
|
|
17769
|
+
search: overlay.search ?? base.search,
|
|
17770
|
+
providerQuery: overlay.providerQuery ?? base.providerQuery
|
|
17771
|
+
};
|
|
17772
|
+
}
|
|
17713
17773
|
|
|
17714
17774
|
// ../integrations/src/preview.ts
|
|
17715
17775
|
function buildImportPreview(item, opts) {
|
|
@@ -17847,6 +17907,7 @@ var DEFAULT_ITEMS = [
|
|
|
17847
17907
|
status: "Open",
|
|
17848
17908
|
url: "https://example.test/mock/EXT-001",
|
|
17849
17909
|
labels: ["registration", "beta"],
|
|
17910
|
+
assignees: [{ name: "Alice" }],
|
|
17850
17911
|
createdAt: "2026-01-05T10:00:00.000Z",
|
|
17851
17912
|
updatedAt: "2026-02-01T09:30:00.000Z",
|
|
17852
17913
|
rawMetadata: { board: "delivery" }
|
|
@@ -17860,8 +17921,86 @@ var DEFAULT_ITEMS = [
|
|
|
17860
17921
|
status: "To Do",
|
|
17861
17922
|
url: "https://example.test/mock/EXT-002",
|
|
17862
17923
|
labels: ["onboarding"],
|
|
17924
|
+
assignees: [{ name: "Bob" }],
|
|
17863
17925
|
createdAt: "2026-01-08T12:00:00.000Z",
|
|
17864
17926
|
updatedAt: "2026-01-20T15:00:00.000Z"
|
|
17927
|
+
},
|
|
17928
|
+
{
|
|
17929
|
+
externalId: "EXT-003",
|
|
17930
|
+
provider: MOCK_ADAPTER_ID,
|
|
17931
|
+
title: "Fix authentication error on mobile",
|
|
17932
|
+
description: "Users on iOS 17 see a blank screen after OAuth redirect.",
|
|
17933
|
+
type: "Bug",
|
|
17934
|
+
status: "In Progress",
|
|
17935
|
+
url: "https://example.test/mock/EXT-003",
|
|
17936
|
+
labels: ["auth", "mobile", "critical"],
|
|
17937
|
+
assignees: [{ name: "Alice" }],
|
|
17938
|
+
createdAt: "2026-02-10T08:00:00.000Z",
|
|
17939
|
+
updatedAt: "2026-03-01T14:00:00.000Z"
|
|
17940
|
+
},
|
|
17941
|
+
{
|
|
17942
|
+
externalId: "EXT-004",
|
|
17943
|
+
provider: MOCK_ADAPTER_ID,
|
|
17944
|
+
title: "Design system token audit",
|
|
17945
|
+
description: "Review and consolidate design tokens across the component library.",
|
|
17946
|
+
type: "Task",
|
|
17947
|
+
status: "To Do",
|
|
17948
|
+
url: "https://example.test/mock/EXT-004",
|
|
17949
|
+
labels: ["frontend", "design-system"],
|
|
17950
|
+
createdAt: "2026-02-15T10:00:00.000Z",
|
|
17951
|
+
updatedAt: "2026-02-20T11:00:00.000Z"
|
|
17952
|
+
},
|
|
17953
|
+
{
|
|
17954
|
+
externalId: "EXT-005",
|
|
17955
|
+
provider: MOCK_ADAPTER_ID,
|
|
17956
|
+
title: "Migrate billing service to new payment gateway",
|
|
17957
|
+
description: "Stripe v2 migration \u2014 switch from legacy Charges API to Payment Intents.",
|
|
17958
|
+
type: "Epic",
|
|
17959
|
+
status: "Open",
|
|
17960
|
+
url: "https://example.test/mock/EXT-005",
|
|
17961
|
+
labels: ["billing", "backend", "migration"],
|
|
17962
|
+
assignees: [{ name: "Carol" }],
|
|
17963
|
+
createdAt: "2026-01-20T09:00:00.000Z",
|
|
17964
|
+
updatedAt: "2026-03-05T16:00:00.000Z"
|
|
17965
|
+
},
|
|
17966
|
+
{
|
|
17967
|
+
externalId: "EXT-006",
|
|
17968
|
+
provider: MOCK_ADAPTER_ID,
|
|
17969
|
+
title: "Add CSV export to reports",
|
|
17970
|
+
description: "Users need to export analytics reports as CSV for external tools.",
|
|
17971
|
+
type: "Feature",
|
|
17972
|
+
status: "In Progress",
|
|
17973
|
+
url: "https://example.test/mock/EXT-006",
|
|
17974
|
+
labels: ["reports", "backend"],
|
|
17975
|
+
assignees: [{ name: "Bob" }],
|
|
17976
|
+
createdAt: "2026-02-25T13:00:00.000Z",
|
|
17977
|
+
updatedAt: "2026-03-10T10:00:00.000Z"
|
|
17978
|
+
},
|
|
17979
|
+
{
|
|
17980
|
+
externalId: "EXT-007",
|
|
17981
|
+
provider: MOCK_ADAPTER_ID,
|
|
17982
|
+
title: "Improve search relevance scoring",
|
|
17983
|
+
description: "Tweak TF-IDF weights and add trigram matching for better search results.",
|
|
17984
|
+
type: "Task",
|
|
17985
|
+
status: "Done",
|
|
17986
|
+
url: "https://example.test/mock/EXT-007",
|
|
17987
|
+
labels: ["search", "backend"],
|
|
17988
|
+
assignees: [{ name: "Alice" }],
|
|
17989
|
+
createdAt: "2026-01-12T07:00:00.000Z",
|
|
17990
|
+
updatedAt: "2026-02-28T17:00:00.000Z"
|
|
17991
|
+
},
|
|
17992
|
+
{
|
|
17993
|
+
externalId: "EXT-008",
|
|
17994
|
+
provider: MOCK_ADAPTER_ID,
|
|
17995
|
+
title: "Set up E2E test pipeline",
|
|
17996
|
+
description: "Configure Playwright tests running on every PR via GitHub Actions.",
|
|
17997
|
+
type: "Task",
|
|
17998
|
+
status: "Done",
|
|
17999
|
+
url: "https://example.test/mock/EXT-008",
|
|
18000
|
+
labels: ["testing", "ci"],
|
|
18001
|
+
assignees: [{ name: "Carol" }],
|
|
18002
|
+
createdAt: "2026-01-30T11:00:00.000Z",
|
|
18003
|
+
updatedAt: "2026-02-15T09:00:00.000Z"
|
|
17865
18004
|
}
|
|
17866
18005
|
];
|
|
17867
18006
|
function simulationOf(context, fallback) {
|
|
@@ -17893,6 +18032,16 @@ function createMockAdapter(opts = {}) {
|
|
|
17893
18032
|
displayName: "Mock Work Source",
|
|
17894
18033
|
version: "1.0.0",
|
|
17895
18034
|
description: "Deterministic offline reference adapter for validating the integration foundation.",
|
|
18035
|
+
icon: "mock",
|
|
18036
|
+
filterCapabilities: {
|
|
18037
|
+
types: { supported: true, multiple: true },
|
|
18038
|
+
statuses: { supported: true, multiple: true },
|
|
18039
|
+
labels: { supported: true, multiple: true },
|
|
18040
|
+
assignees: { supported: true, multiple: true },
|
|
18041
|
+
updatedAfter: { supported: true },
|
|
18042
|
+
search: { supported: true },
|
|
18043
|
+
providerQuery: { supported: false }
|
|
18044
|
+
},
|
|
17896
18045
|
configSchema: {
|
|
17897
18046
|
simulate: {
|
|
17898
18047
|
type: "select",
|
|
@@ -17939,9 +18088,24 @@ function createMockAdapter(opts = {}) {
|
|
|
17939
18088
|
readFailure(simulationOf(request.context, defaultSim));
|
|
17940
18089
|
let pool = items;
|
|
17941
18090
|
const f = request.filters;
|
|
17942
|
-
if (f?.
|
|
17943
|
-
|
|
17944
|
-
|
|
18091
|
+
if (f?.statuses?.length) {
|
|
18092
|
+
const lower = f.statuses.map((s) => s.toLowerCase());
|
|
18093
|
+
pool = pool.filter((i) => lower.includes((i.status ?? "").toLowerCase()));
|
|
18094
|
+
}
|
|
18095
|
+
if (f?.types?.length) {
|
|
18096
|
+
const lower = f.types.map((t) => t.toLowerCase());
|
|
18097
|
+
pool = pool.filter((i) => lower.includes((i.type ?? "").toLowerCase()));
|
|
18098
|
+
}
|
|
18099
|
+
if (f?.labels?.length) {
|
|
18100
|
+
const lower = f.labels.map((l) => l.toLowerCase());
|
|
18101
|
+
pool = pool.filter((i) => i.labels?.some((il) => lower.includes(il.toLowerCase())));
|
|
18102
|
+
}
|
|
18103
|
+
if (f?.assignees?.length) {
|
|
18104
|
+
const lower = f.assignees.map((a) => a.toLowerCase());
|
|
18105
|
+
pool = pool.filter((i) => i.assignees?.some((a) => lower.includes((a.name ?? "").toLowerCase())));
|
|
18106
|
+
}
|
|
18107
|
+
if (f?.search) pool = pool.filter((i) => `${i.title} ${i.description ?? ""}`.toLowerCase().includes(f.search.toLowerCase()));
|
|
18108
|
+
if (f?.updatedAfter) pool = pool.filter((i) => (i.updatedAt ?? "") >= f.updatedAfter);
|
|
17945
18109
|
const size = Math.max(1, request.pageSize ?? defaultPageSize);
|
|
17946
18110
|
const start = request.cursor ? Math.max(0, Number.parseInt(request.cursor, 10) || 0) : 0;
|
|
17947
18111
|
const slice = pool.slice(start, start + size);
|
|
@@ -18011,6 +18175,7 @@ function listIntegrations(dir) {
|
|
|
18011
18175
|
credentialRefs: Object.values(integration.credentials).map((c) => c.env),
|
|
18012
18176
|
secretRefs: Object.values(integration.secrets),
|
|
18013
18177
|
secretStatus: {},
|
|
18178
|
+
filters: integration.filters,
|
|
18014
18179
|
findings: findings.filter((f) => f.id === integration.id)
|
|
18015
18180
|
};
|
|
18016
18181
|
});
|
|
@@ -18077,7 +18242,8 @@ async function listExternalWorkItems(dir, id, opts = {}, env = process.env) {
|
|
|
18077
18242
|
const adapter = resolveAdapter(integration);
|
|
18078
18243
|
if (!adapter.capabilities.workItems.list) throw integrationError("UNSUPPORTED_CAPABILITY", `Adapter "${adapter.id}" cannot list work items.`);
|
|
18079
18244
|
const { context } = await buildContextWithSecrets(dir, integration, env);
|
|
18080
|
-
|
|
18245
|
+
const filters = mergeFilters(integration.filters, opts.filters);
|
|
18246
|
+
return withTimeout(adapter.listWorkItems({ context, cursor: opts.cursor, pageSize: opts.pageSize, filters }), context.timeoutMs);
|
|
18081
18247
|
}
|
|
18082
18248
|
async function getExternalWorkItem(dir, id, externalId, env = process.env) {
|
|
18083
18249
|
const { integration } = requireIntegration(dir, id);
|
|
@@ -18202,10 +18368,13 @@ async function runIntegrationsVerify(dir, id, opts) {
|
|
|
18202
18368
|
async function runIntegrationsWorkItems(dir, id, opts) {
|
|
18203
18369
|
requireProject2(dir);
|
|
18204
18370
|
try {
|
|
18371
|
+
const filters = {};
|
|
18372
|
+
if (opts.status) filters.statuses = [opts.status];
|
|
18373
|
+
if (opts.query) filters.search = opts.query;
|
|
18205
18374
|
const page = await listExternalWorkItems(dir, id, {
|
|
18206
18375
|
cursor: opts.cursor,
|
|
18207
18376
|
pageSize: opts.pageSize ? Number.parseInt(opts.pageSize, 10) : void 0,
|
|
18208
|
-
filters
|
|
18377
|
+
filters
|
|
18209
18378
|
});
|
|
18210
18379
|
if (opts.json) return printJson(page);
|
|
18211
18380
|
intro2(`External work items \xB7 ${id}`);
|