@islamihab/kds 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.
Files changed (2) hide show
  1. package/index.js +31 -25
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -14611,7 +14611,7 @@ import { join } from "path";
14611
14611
  // package.json
14612
14612
  var package_default = {
14613
14613
  name: "cli",
14614
- version: "0.7.0",
14614
+ version: "0.9.0",
14615
14615
  private: true,
14616
14616
  type: "module",
14617
14617
  bin: {
@@ -17788,6 +17788,7 @@ var HARNESSES = [
17788
17788
  { env: "CLAUDECODE", label: "Claude Code" },
17789
17789
  { env: "CLAUDE_CODE_ENTRYPOINT", label: "Claude Code" },
17790
17790
  { env: "CODEX_SANDBOX", label: "Codex" },
17791
+ { env: "CODEX_THREAD_ID", label: "Codex" },
17791
17792
  { env: "CURSOR_AGENT", label: "Cursor" },
17792
17793
  { env: "AI_AGENT", label: undefined }
17793
17794
  ];
@@ -18303,35 +18304,27 @@ var repoProject = async (client3) => {
18303
18304
  throw new Error(`No project is connected to ${repo}. Connect one on the project in the dashboard.`);
18304
18305
  return project;
18305
18306
  };
18306
- var resolveIssueLabels = async (client3, names) => {
18307
- if (names.length === 0)
18308
- return [];
18307
+ var missingLabelError = async (client3, lead) => {
18309
18308
  const labels = await client3.query(api2.issueLabels.list, {});
18310
- return names.map((name) => {
18311
- const wanted = name.trim().toLowerCase();
18312
- const label = labels.find((candidate) => candidate.name.toLowerCase() === wanted);
18313
- if (!label) {
18314
- const available = labels.map((candidate) => candidate.name).join(", ");
18315
- throw new Error(available ? `No label named "${name}". The labels are: ${available}.` : "There are no labels yet.");
18316
- }
18317
- return label;
18318
- });
18309
+ const available = labels.map((candidate) => candidate.name).join(", ");
18310
+ return new Error(available ? `${lead} The labels are: ${available}.` : "There are no labels yet.");
18319
18311
  };
18312
+ var resolveIssueLabels = async (client3, names) => await Promise.all(names.map(async (name) => {
18313
+ const label = await client3.query(api2.issueLabels.find, { ref: name });
18314
+ if (!label)
18315
+ throw await missingLabelError(client3, `No label named "${name}".`);
18316
+ return label;
18317
+ }));
18320
18318
  var resolveIssueLabel = async (client3, ref) => {
18321
- const labels = await client3.query(api2.issueLabels.list, {});
18322
- const wanted = ref.trim().toLowerCase();
18323
- const label = labels.find((candidate) => candidate._id === ref || candidate.name.toLowerCase() === wanted);
18324
- if (!label) {
18325
- const available = labels.map((candidate) => candidate.name).join(", ");
18326
- throw new Error(available ? `No label matches "${ref}". The labels are: ${available}.` : "There are no labels yet.");
18327
- }
18319
+ const label = await client3.query(api2.issueLabels.find, { ref });
18320
+ if (!label)
18321
+ throw await missingLabelError(client3, `No label matches "${ref}".`);
18328
18322
  return label;
18329
18323
  };
18330
18324
  var resolveMilestone = async (client3, projectId, name) => {
18331
- const milestones = await client3.query(api2.milestones.listByProject, { projectId, today: localToday() });
18332
- const wanted = name.trim().toLowerCase();
18333
- const milestone = milestones.find((candidate) => candidate.name.toLowerCase() === wanted);
18325
+ const milestone = await client3.query(api2.milestones.find, { projectId, name });
18334
18326
  if (!milestone) {
18327
+ const milestones = await client3.query(api2.milestones.listByProject, { projectId, today: localToday() });
18335
18328
  const names = milestones.map((candidate) => candidate.name).join(", ");
18336
18329
  throw new Error(names ? `No milestone named "${name}". The project has: ${names}.` : "The project has no milestones.");
18337
18330
  }
@@ -18436,6 +18429,7 @@ var comment = command({
18436
18429
  });
18437
18430
 
18438
18431
  // src/lib/agents.ts
18432
+ var agentConfigurationForActor = (actor) => AGENT_CONFIGURATION_OPTIONS.find((entry) => AGENT_HARNESS_LABELS[entry.harness] === actor.harness && entry.model === actor.model)?.id;
18439
18433
  var agentConfigurationLegacyNote = () => {
18440
18434
  const legacy = AGENT_CONFIGURATION_OPTIONS.filter((entry) => entry.lifecycle === "legacy");
18441
18435
  return legacy.length === 0 ? "" : ` (legacy: ${legacy.map((entry) => entry.id).join(", ")})`;
@@ -18910,18 +18904,30 @@ ready_for_agent is informational, and --ready belongs only to an explicit hand-o
18910
18904
  id: exports_external.string().describe("Issue identifier, number, or URL")
18911
18905
  },
18912
18906
  options: {
18913
- ready: exports_external.boolean().default(false).describe("Also route the issue to ready_for_agent")
18907
+ ready: exports_external.boolean().default(false).describe("Also route the issue to ready_for_agent, assigning the running agent when it is identifiable")
18914
18908
  },
18915
18909
  run: async ({ positionals: { id }, options: { ready } }) => {
18916
18910
  const client3 = await backendClient();
18917
18911
  const issue2 = await resolveIssue(client3, id);
18918
18912
  const { branch } = await client3.mutation(api2.issues.start, { id: issue2._id });
18913
+ let assigned;
18914
+ if (ready) {
18915
+ const actor = await agentClaim();
18916
+ const configurationId = actor && agentConfigurationForActor(actor);
18917
+ if (configurationId && configurationId !== issue2.agentConfigurationId) {
18918
+ await client3.mutation(api2.issues.setAgentConfiguration, {
18919
+ id: issue2._id,
18920
+ agentConfigurationId: configurationId
18921
+ });
18922
+ assigned = configurationId;
18923
+ }
18924
+ }
18919
18925
  if (ready && issue2.disposition !== "ready_for_agent") {
18920
18926
  await client3.mutation(api2.issues.route, { id: issue2._id, disposition: "ready_for_agent" });
18921
18927
  }
18922
18928
  console.log(`Started ${issue2.identifier}: in_progress, branch ${branch}`);
18923
18929
  if (ready) {
18924
- console.log("Routed to ready_for_agent.");
18930
+ console.log(`Routed to ready_for_agent${assigned ? `, assigned ${agentConfiguration(assigned).label}` : ""}.`);
18925
18931
  } else if (issue2.disposition !== "ready_for_agent" && await agentClaim()) {
18926
18932
  console.log(`Note: disposition is ${issue2.disposition}. Pass --ready if this hand-off was intended.`);
18927
18933
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@islamihab/kds",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Command-line client for Kai Dev Studio",
5
5
  "license": "MIT",
6
6
  "publishConfig": {