@islamihab/kds 0.3.0 → 0.4.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.
Files changed (2) hide show
  1. package/index.js +217 -25
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -14597,7 +14597,7 @@ import { join } from "path";
14597
14597
  // package.json
14598
14598
  var package_default = {
14599
14599
  name: "cli",
14600
- version: "0.3.0",
14600
+ version: "0.4.0",
14601
14601
  private: true,
14602
14602
  type: "module",
14603
14603
  bin: {
@@ -15188,7 +15188,78 @@ var ISSUE_OPEN_STATUSES = [
15188
15188
  "changes_requested",
15189
15189
  "approved"
15190
15190
  ];
15191
+ var ISSUE_LABEL_COLORS = [
15192
+ "gray",
15193
+ "red",
15194
+ "orange",
15195
+ "amber",
15196
+ "green",
15197
+ "teal",
15198
+ "blue",
15199
+ "indigo",
15200
+ "purple",
15201
+ "pink"
15202
+ ];
15191
15203
  var ISSUE_RELATION_KINDS = ["blocks", "blocked_by", "duplicate_of", "duplicated_by", "relates_to"];
15204
+ var AGENT_HARNESS_LABELS = {
15205
+ codex: "Codex",
15206
+ claude_code: "Claude Code"
15207
+ };
15208
+ var AGENT_CONFIGURATION_IDS = [
15209
+ "codex-gpt-5-6-sol",
15210
+ "codex-gpt-5-6-terra",
15211
+ "codex-gpt-5-6-luna",
15212
+ "claude-code-claude-fable-5",
15213
+ "claude-code-claude-opus-5",
15214
+ "claude-code-claude-sonnet-5"
15215
+ ];
15216
+ var AGENT_CONFIGURATIONS = {
15217
+ "codex-gpt-5-6-sol": {
15218
+ label: "Codex \xB7 GPT-5.6 Sol",
15219
+ harness: "codex",
15220
+ model: "gpt-5.6-sol",
15221
+ lifecycle: "current"
15222
+ },
15223
+ "codex-gpt-5-6-terra": {
15224
+ label: "Codex \xB7 GPT-5.6 Terra",
15225
+ harness: "codex",
15226
+ model: "gpt-5.6-terra",
15227
+ lifecycle: "current"
15228
+ },
15229
+ "codex-gpt-5-6-luna": {
15230
+ label: "Codex \xB7 GPT-5.6 Luna",
15231
+ harness: "codex",
15232
+ model: "gpt-5.6-luna",
15233
+ lifecycle: "current"
15234
+ },
15235
+ "claude-code-claude-fable-5": {
15236
+ label: "Claude Code \xB7 Claude Fable 5",
15237
+ harness: "claude_code",
15238
+ model: "claude-fable-5",
15239
+ lifecycle: "current"
15240
+ },
15241
+ "claude-code-claude-opus-5": {
15242
+ label: "Claude Code \xB7 Claude Opus 5",
15243
+ harness: "claude_code",
15244
+ model: "claude-opus-5",
15245
+ lifecycle: "current"
15246
+ },
15247
+ "claude-code-claude-sonnet-5": {
15248
+ label: "Claude Code \xB7 Claude Sonnet 5",
15249
+ harness: "claude_code",
15250
+ model: "claude-sonnet-5",
15251
+ lifecycle: "current"
15252
+ }
15253
+ };
15254
+ var orderAgentConfigurations = (entries) => [
15255
+ ...entries.filter((entry) => entry.lifecycle === "current"),
15256
+ ...entries.filter((entry) => entry.lifecycle === "legacy")
15257
+ ];
15258
+ var agentConfiguration = (id) => ({
15259
+ id,
15260
+ ...AGENT_CONFIGURATIONS[id]
15261
+ });
15262
+ var AGENT_CONFIGURATION_OPTIONS = orderAgentConfigurations(AGENT_CONFIGURATION_IDS.map(agentConfiguration));
15192
15263
  var PROJECT_STATUSES = ["planned", "in_progress", "paused", "completed", "canceled"];
15193
15264
  var PROJECT_HEALTHS = ["on_track", "at_risk", "off_track"];
15194
15265
  var ISSUE_IDENTIFIER_PREFIX = "KAI";
@@ -17954,6 +18025,7 @@ var issueActivityLine = (detail) => {
17954
18025
  case "disposition_changed":
17955
18026
  case "estimate_changed":
17956
18027
  case "due_date_changed":
18028
+ case "agent_configuration_changed":
17957
18029
  case "branch_changed":
17958
18030
  case "pr_changed":
17959
18031
  case "project_changed":
@@ -18197,6 +18269,16 @@ var resolveIssueLabels = async (client3, names) => {
18197
18269
  return label;
18198
18270
  });
18199
18271
  };
18272
+ var resolveIssueLabel = async (client3, ref) => {
18273
+ const labels = await client3.query(api2.issueLabels.list, {});
18274
+ const wanted = ref.trim().toLowerCase();
18275
+ const label = labels.find((candidate) => candidate._id === ref || candidate.name.toLowerCase() === wanted);
18276
+ if (!label) {
18277
+ const available = labels.map((candidate) => candidate.name).join(", ");
18278
+ throw new Error(available ? `No label matches "${ref}". The labels are: ${available}.` : "There are no labels yet.");
18279
+ }
18280
+ return label;
18281
+ };
18200
18282
  var resolveMilestone = async (client3, projectId, name) => {
18201
18283
  const milestones = await client3.query(api2.milestones.listByProject, { projectId, today: localToday() });
18202
18284
  const wanted = name.trim().toLowerCase();
@@ -18305,6 +18387,17 @@ var comment = command({
18305
18387
  }
18306
18388
  });
18307
18389
 
18390
+ // src/lib/agents.ts
18391
+ var agentConfigurationLegacyNote = () => {
18392
+ const legacy = AGENT_CONFIGURATION_OPTIONS.filter((entry) => entry.lifecycle === "legacy");
18393
+ return legacy.length === 0 ? "" : ` (legacy: ${legacy.map((entry) => entry.id).join(", ")})`;
18394
+ };
18395
+ var agentConfigurationLine = (id) => {
18396
+ const entry = agentConfiguration(id);
18397
+ const legacy = entry.lifecycle === "legacy" ? " (legacy)" : "";
18398
+ return `${entry.label}${legacy} \u2014 ${entry.id} \xB7 ${AGENT_HARNESS_LABELS[entry.harness]} \xB7 ${entry.model}`;
18399
+ };
18400
+
18308
18401
  // src/commands/issues/create.ts
18309
18402
  var create = command({
18310
18403
  name: "create",
@@ -18322,7 +18415,8 @@ var create = command({
18322
18415
  here: exports_external.boolean().default(false).describe("Create in the checkout's connected project"),
18323
18416
  milestone: exports_external.string().optional().describe("Milestone name (needs --project or --here)"),
18324
18417
  parent: exports_external.string().optional().describe("Create as a sub-issue of this issue (identifier, number, or URL)"),
18325
- disposition: exports_external.enum(ISSUE_CREATE_DISPOSITIONS).optional().describe("Route immediately (default needs_triage)")
18418
+ disposition: exports_external.enum(ISSUE_CREATE_DISPOSITIONS).optional().describe("Route immediately (default needs_triage)"),
18419
+ "agent-config": exports_external.enum(AGENT_CONFIGURATION_IDS).optional().describe(`Agent configuration${agentConfigurationLegacyNote()}`)
18326
18420
  },
18327
18421
  run: async ({ positionals: { title }, options }) => {
18328
18422
  if (options.project && options.here)
@@ -18343,7 +18437,8 @@ var create = command({
18343
18437
  projectId: project?._id,
18344
18438
  milestoneId: milestone?._id,
18345
18439
  parentId: parent?._id,
18346
- disposition: options.disposition
18440
+ disposition: options.disposition,
18441
+ agentConfigurationId: options["agent-config"]
18347
18442
  });
18348
18443
  console.log(identifier);
18349
18444
  }
@@ -18389,6 +18484,8 @@ var get = command({
18389
18484
  console.log(`Estimate: ${issue2.estimate}`);
18390
18485
  if (issue2.dueDate)
18391
18486
  console.log(`Due: ${issue2.dueDate}`);
18487
+ if (issue2.agentConfigurationId)
18488
+ console.log(`Agent: ${agentConfigurationLine(issue2.agentConfigurationId)}`);
18392
18489
  if (issue2.branch)
18393
18490
  console.log(`Branch: ${issue2.branch}`);
18394
18491
  if (issue2.prUrl)
@@ -18442,8 +18539,85 @@ Feed:`);
18442
18539
  }
18443
18540
  });
18444
18541
 
18445
- // src/commands/issues/list.ts
18542
+ // src/commands/issues/labels/create.ts
18543
+ var create2 = command({
18544
+ name: "create",
18545
+ description: "Create an issue label and print its id",
18546
+ positionals: {
18547
+ name: exports_external.string().describe("Label name")
18548
+ },
18549
+ options: {
18550
+ color: exports_external.enum(ISSUE_LABEL_COLORS).default("gray").describe("Label color (default gray)")
18551
+ },
18552
+ run: async ({ positionals: { name }, options: { color } }) => {
18553
+ const client3 = await backendClient();
18554
+ const id = await client3.mutation(api2.issueLabels.create, { name, color });
18555
+ console.log(id);
18556
+ }
18557
+ });
18558
+
18559
+ // src/commands/issues/labels/list.ts
18446
18560
  var list = command({
18561
+ name: "list",
18562
+ description: "List issue labels alphabetically",
18563
+ options: {
18564
+ json: exports_external.boolean().default(false).describe("Print as JSON")
18565
+ },
18566
+ run: async ({ options: { json: json2 } }) => {
18567
+ const labels = await (await backendClient()).query(api2.issueLabels.list, {});
18568
+ if (json2)
18569
+ return console.log(JSON.stringify(labels, null, 2));
18570
+ if (labels.length === 0)
18571
+ return console.log("No labels yet.");
18572
+ printTable([["NAME", "COLOR", "ID"], ...labels.map((label) => [label.name, label.color, label._id])]);
18573
+ }
18574
+ });
18575
+
18576
+ // src/commands/issues/labels/remove.ts
18577
+ var remove = command({
18578
+ name: "delete",
18579
+ description: "Delete an issue label and remove it from every issue",
18580
+ positionals: {
18581
+ label: exports_external.string().describe("Label name or id")
18582
+ },
18583
+ run: async ({ positionals: { label: ref } }) => {
18584
+ const client3 = await backendClient();
18585
+ const label = await resolveIssueLabel(client3, ref);
18586
+ await client3.mutation(api2.issueLabels.remove, { id: label._id });
18587
+ console.log(`Deleted ${label.name}.`);
18588
+ }
18589
+ });
18590
+
18591
+ // src/commands/issues/labels/update.ts
18592
+ var update = command({
18593
+ name: "update",
18594
+ description: "Rename or recolor an issue label",
18595
+ positionals: {
18596
+ label: exports_external.string().describe("Label name or id")
18597
+ },
18598
+ options: {
18599
+ name: exports_external.string().optional().describe("New name").meta({ short: "n" }),
18600
+ color: exports_external.enum(ISSUE_LABEL_COLORS).optional().describe("New color")
18601
+ },
18602
+ run: async ({ positionals: { label: ref }, options: { name, color } }) => {
18603
+ if (name === undefined && color === undefined)
18604
+ throw new Error("Nothing to update. Pass --name or --color.");
18605
+ const client3 = await backendClient();
18606
+ const label = await resolveIssueLabel(client3, ref);
18607
+ await client3.mutation(api2.issueLabels.update, { id: label._id, name, color });
18608
+ console.log(`Updated ${name ?? label.name}.`);
18609
+ }
18610
+ });
18611
+
18612
+ // src/commands/issues/labels/index.ts
18613
+ var labels = group({
18614
+ name: "labels",
18615
+ description: "Manage issue labels",
18616
+ commands: [create2, list, update, remove]
18617
+ });
18618
+
18619
+ // src/commands/issues/list.ts
18620
+ var list2 = command({
18447
18621
  name: "list",
18448
18622
  description: "List open issues, most recently updated first",
18449
18623
  options: {
@@ -18530,7 +18704,7 @@ var relate = command({
18530
18704
  });
18531
18705
 
18532
18706
  // src/commands/issues/remove.ts
18533
- var remove = command({
18707
+ var remove2 = command({
18534
18708
  name: "delete",
18535
18709
  description: "Delete an issue permanently (sub-issues survive as top-level issues)",
18536
18710
  positionals: {
@@ -18570,7 +18744,7 @@ var route = command({
18570
18744
  // src/commands/issues/set.ts
18571
18745
  var set2 = command({
18572
18746
  name: "set",
18573
- description: "Set an issue's status, priority, estimate, due date, project, milestone, parent, or labels",
18747
+ description: "Set an issue's status, priority, estimate, due date, project, milestone, parent, agent configuration, or labels",
18574
18748
  positionals: {
18575
18749
  id: exports_external.string().describe("Issue identifier, number, or URL")
18576
18750
  },
@@ -18582,13 +18756,25 @@ var set2 = command({
18582
18756
  project: exports_external.string().nullable().optional().describe("Move to this project (id or URL), or --no-project to make the issue projectless").meta({ negatable: true }),
18583
18757
  milestone: exports_external.string().nullable().optional().describe("Move to this milestone of the issue's project (name), or --no-milestone to clear").meta({ negatable: true }),
18584
18758
  parent: exports_external.string().nullable().optional().describe("Make this a sub-issue of another issue, or --no-parent to promote it").meta({ negatable: true }),
18759
+ "agent-config": exports_external.enum(AGENT_CONFIGURATION_IDS).nullable().optional().describe(`Agent configuration${agentConfigurationLegacyNote()}, or --no-agent-config to clear`).meta({ negatable: true }),
18585
18760
  label: exports_external.array(exports_external.string()).optional().describe("Add a label by name (repeatable)"),
18586
18761
  "no-label": exports_external.array(exports_external.string()).optional().describe("Remove a label by name (repeatable)")
18587
18762
  },
18588
18763
  run: async ({ positionals: { id }, options }) => {
18589
- const { status: status2, priority, estimate, due, project, milestone, parent, label, "no-label": noLabel } = options;
18764
+ const {
18765
+ status: status2,
18766
+ priority,
18767
+ estimate,
18768
+ due,
18769
+ project,
18770
+ milestone,
18771
+ parent,
18772
+ label,
18773
+ "agent-config": agentConfig,
18774
+ "no-label": noLabel
18775
+ } = options;
18590
18776
  if (Object.values(options).every((value) => value === undefined))
18591
- throw new Error("Nothing to set. Pass --status, --priority, --estimate, --due, --project, --milestone, --parent, or --label.");
18777
+ throw new Error("Nothing to set. Pass --status, --priority, --estimate, --due, --project, --milestone, --parent, --agent-config, or --label.");
18592
18778
  const client3 = await backendClient();
18593
18779
  const issue2 = await resolveIssue(client3, id);
18594
18780
  const projectId = project === undefined ? issue2.projectId : project === null ? undefined : (await resolveProject(client3, project))._id;
@@ -18609,6 +18795,11 @@ var set2 = command({
18609
18795
  await client3.mutation(api2.issues.addLabel, { issueId: issue2._id, labelId: _id });
18610
18796
  for (const { _id } of removeLabels)
18611
18797
  await client3.mutation(api2.issues.removeLabel, { issueId: issue2._id, labelId: _id });
18798
+ if (agentConfig !== undefined)
18799
+ await client3.mutation(api2.issues.setAgentConfiguration, {
18800
+ id: issue2._id,
18801
+ agentConfigurationId: agentConfig ?? undefined
18802
+ });
18612
18803
  if (status2 !== undefined)
18613
18804
  await client3.mutation(api2.issues.setStatus, { id: issue2._id, status: status2 });
18614
18805
  if (priority !== undefined)
@@ -18698,7 +18889,7 @@ var tasks = command({
18698
18889
  remove: position.optional().describe("Drop a task by its number (repeatable)"),
18699
18890
  json: exports_external.boolean().default(false).describe("Print as JSON")
18700
18891
  },
18701
- run: async ({ positionals: { id }, options: { add, check: check2, uncheck, convert, remove: remove2, json: json2 } }) => {
18892
+ run: async ({ positionals: { id }, options: { add, check: check2, uncheck, convert, remove: remove3, json: json2 } }) => {
18702
18893
  const client3 = await backendClient();
18703
18894
  const issue2 = await resolveIssue(client3, id);
18704
18895
  const before = await client3.query(api2.issueTasks.list, { issueId: issue2._id });
@@ -18711,7 +18902,7 @@ var tasks = command({
18711
18902
  const ticked = at(check2);
18712
18903
  const unticked = at(uncheck);
18713
18904
  const promoted = at(convert);
18714
- const dropped = at(remove2);
18905
+ const dropped = at(remove3);
18715
18906
  for (const title of add ?? [])
18716
18907
  await client3.mutation(api2.issueTasks.create, { issueId: issue2._id, title });
18717
18908
  for (const task2 of ticked)
@@ -18726,7 +18917,7 @@ var tasks = command({
18726
18917
  }
18727
18918
  for (const task2 of dropped)
18728
18919
  await client3.mutation(api2.issueTasks.remove, { id: task2._id });
18729
- const wrote = [add, check2, uncheck, convert, remove2].some((values) => values !== undefined);
18920
+ const wrote = [add, check2, uncheck, convert, remove3].some((values) => values !== undefined);
18730
18921
  const after = wrote ? await client3.query(api2.issueTasks.list, { issueId: issue2._id }) : before;
18731
18922
  if (json2)
18732
18923
  return console.log(JSON.stringify(after, null, 2));
@@ -18774,7 +18965,7 @@ var unrelate = command({
18774
18965
  });
18775
18966
 
18776
18967
  // src/commands/issues/update.ts
18777
- var update = command({
18968
+ var update2 = command({
18778
18969
  name: "update",
18779
18970
  description: "Rewrite an issue's title or description, or attach files",
18780
18971
  positionals: {
@@ -18808,10 +18999,11 @@ var issues = group({
18808
18999
  description: "Track and triage issues",
18809
19000
  commands: [
18810
19001
  create,
18811
- list,
19002
+ list2,
18812
19003
  get,
18813
- update,
19004
+ update2,
18814
19005
  set2,
19006
+ labels,
18815
19007
  route,
18816
19008
  start,
18817
19009
  submit,
@@ -18820,7 +19012,7 @@ var issues = group({
18820
19012
  relate,
18821
19013
  unrelate,
18822
19014
  comment,
18823
- remove
19015
+ remove2
18824
19016
  ]
18825
19017
  });
18826
19018
 
@@ -18842,7 +19034,7 @@ var detectRepoGroup = async () => {
18842
19034
  var groupForCreate = async (group2) => group2 === null ? undefined : group2 ?? await detectRepoGroup();
18843
19035
 
18844
19036
  // src/commands/pages/create.ts
18845
- var create2 = command({
19037
+ var create3 = command({
18846
19038
  name: "create",
18847
19039
  description: "Publish a page and print its URL",
18848
19040
  positionals: {
@@ -18894,7 +19086,7 @@ var get2 = command({
18894
19086
  var formatBytes = (bytes) => bytes < 1024 ? `${bytes} B` : `${Math.round(bytes / 1024)} KB`;
18895
19087
 
18896
19088
  // src/commands/pages/list.ts
18897
- var list2 = command({
19089
+ var list3 = command({
18898
19090
  name: "list",
18899
19091
  description: "List your published pages",
18900
19092
  options: {
@@ -18924,7 +19116,7 @@ var list2 = command({
18924
19116
  });
18925
19117
 
18926
19118
  // src/commands/pages/remove.ts
18927
- var remove2 = command({
19119
+ var remove3 = command({
18928
19120
  name: "delete",
18929
19121
  description: "Delete a page",
18930
19122
  positionals: {
@@ -18951,7 +19143,7 @@ var revert = command({
18951
19143
  });
18952
19144
 
18953
19145
  // src/commands/pages/update.ts
18954
- var update2 = command({
19146
+ var update3 = command({
18955
19147
  name: "update",
18956
19148
  description: "Replace a page's HTML, title, group, mode, or visibility",
18957
19149
  positionals: {
@@ -19012,7 +19204,7 @@ var versions2 = command({
19012
19204
  var pages = group({
19013
19205
  name: "pages",
19014
19206
  description: "Publish HTML documents to the web",
19015
- commands: [create2, list2, get2, update2, versions2, revert, remove2]
19207
+ commands: [create3, list3, get2, update3, versions2, revert, remove3]
19016
19208
  });
19017
19209
 
19018
19210
  // src/commands/project.ts
@@ -19045,7 +19237,7 @@ var project = command({
19045
19237
  });
19046
19238
 
19047
19239
  // src/commands/projects/create.ts
19048
- var create3 = command({
19240
+ var create4 = command({
19049
19241
  name: "create",
19050
19242
  description: "Create a project and print its id",
19051
19243
  positionals: {
@@ -19116,7 +19308,7 @@ Milestones:`);
19116
19308
  });
19117
19309
 
19118
19310
  // src/commands/projects/list.ts
19119
- var list3 = command({
19311
+ var list4 = command({
19120
19312
  name: "list",
19121
19313
  description: "List your projects, most recently updated first",
19122
19314
  options: {
@@ -19151,7 +19343,7 @@ More projects exist; raise --limit past ${limit}.`);
19151
19343
  });
19152
19344
 
19153
19345
  // src/commands/projects/remove.ts
19154
- var remove3 = command({
19346
+ var remove4 = command({
19155
19347
  name: "delete",
19156
19348
  description: "Delete a project and its milestones (its issues survive, projectless)",
19157
19349
  positionals: {
@@ -19197,7 +19389,7 @@ var set3 = command({
19197
19389
  });
19198
19390
 
19199
19391
  // src/commands/projects/update.ts
19200
- var update3 = command({
19392
+ var update4 = command({
19201
19393
  name: "update",
19202
19394
  description: "Rewrite a project's name, summary, or description",
19203
19395
  positionals: {
@@ -19227,7 +19419,7 @@ var update3 = command({
19227
19419
  var projects = group({
19228
19420
  name: "projects",
19229
19421
  description: "Manage projects",
19230
- commands: [create3, list3, get3, update3, set3, remove3]
19422
+ commands: [create4, list4, get3, update4, set3, remove4]
19231
19423
  });
19232
19424
 
19233
19425
  // src/commands/upgrade.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@islamihab/kds",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Command-line client for Kai Dev Studio",
5
5
  "license": "MIT",
6
6
  "publishConfig": {