@islamihab/kds 0.6.0 → 0.8.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 +67 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -14420,9 +14420,11 @@ var printHelp = (help) => {
14420
14420
  description: `${field.description ?? ""}${isRequired(field) ? " (required)" : ""}`
14421
14421
  }));
14422
14422
  const usageOptions = options?.length ? " [options]" : "";
14423
- if (help.description)
14424
- console.log(`${help.description}
14423
+ if (help.description) {
14424
+ console.log(`${help.description}${help.longDescription ? `
14425
+ ${help.longDescription}` : ""}
14425
14426
  `);
14427
+ }
14426
14428
  console.log(`Usage: ${help.path}${usageCommands}${usageOptions}${usagePositionals}`);
14427
14429
  const labels = [commands, positionals, options].flatMap((entries) => entries ?? []);
14428
14430
  const width = Math.max(...labels.map(({ label }) => label.length));
@@ -14552,7 +14554,13 @@ var command = (def) => {
14552
14554
  const positionalEntries = Object.entries(inputShape.shape.positionals.shape);
14553
14555
  const optionsEntries = optionEntries(inputShape.shape.options.shape);
14554
14556
  const run = async (args, path) => {
14555
- const help = () => printHelp({ path, description: def.description, positionals: positionalEntries, options: optionsEntries });
14557
+ const help = () => printHelp({
14558
+ path,
14559
+ description: def.description,
14560
+ longDescription: def.longDescription,
14561
+ positionals: positionalEntries,
14562
+ options: optionsEntries
14563
+ });
14556
14564
  if (args.some(isHelpFlag))
14557
14565
  return help();
14558
14566
  const { values, positionals } = parseArgs({ args, positionalEntries, optionsEntries, help });
@@ -14570,7 +14578,13 @@ var group = (def) => {
14570
14578
  const optionsShape = exports_external.object(def.options);
14571
14579
  const optionsEntries = optionEntries(optionsShape.shape);
14572
14580
  const run = async ([sub, ...rest], path) => {
14573
- const help = () => printHelp({ path, description: def.description, commands: def.commands, options: optionsEntries });
14581
+ const help = () => printHelp({
14582
+ path,
14583
+ description: def.description,
14584
+ longDescription: def.longDescription,
14585
+ commands: def.commands,
14586
+ options: optionsEntries
14587
+ });
14574
14588
  if (!sub && !def.run || sub === "help" || isHelpFlag(sub))
14575
14589
  return help();
14576
14590
  if (def.run && (sub?.startsWith("-") || !sub)) {
@@ -14597,7 +14611,7 @@ import { join } from "path";
14597
14611
  // package.json
14598
14612
  var package_default = {
14599
14613
  name: "cli",
14600
- version: "0.6.0",
14614
+ version: "0.8.0",
14601
14615
  private: true,
14602
14616
  type: "module",
14603
14617
  bin: {
@@ -18410,7 +18424,7 @@ var comment = command({
18410
18424
  body: exports_external.string().describe("Comment markdown, or - for stdin")
18411
18425
  },
18412
18426
  options: {
18413
- attach: exports_external.array(exports_external.string()).optional().describe("Attach a file to the issue (repeatable)").meta({ short: "a" })
18427
+ attach: exports_external.array(exports_external.string()).optional().describe("Attach a file to the issue (repeatable); the printed URL is usable in issue markdown, and removal is dashboard-only").meta({ short: "a" })
18414
18428
  },
18415
18429
  run: async ({ positionals: { id, body }, options: { attach } }) => {
18416
18430
  const client3 = await backendClient();
@@ -18422,6 +18436,7 @@ var comment = command({
18422
18436
  });
18423
18437
 
18424
18438
  // src/lib/agents.ts
18439
+ var agentConfigurationForActor = (actor) => AGENT_CONFIGURATION_OPTIONS.find((entry) => AGENT_HARNESS_LABELS[entry.harness] === actor.harness && entry.model === actor.model)?.id;
18425
18440
  var agentConfigurationLegacyNote = () => {
18426
18441
  const legacy = AGENT_CONFIGURATION_OPTIONS.filter((entry) => entry.lifecycle === "legacy");
18427
18442
  return legacy.length === 0 ? "" : ` (legacy: ${legacy.map((entry) => entry.id).join(", ")})`;
@@ -18436,6 +18451,7 @@ var agentConfigurationLine = (id) => {
18436
18451
  var create = command({
18437
18452
  name: "create",
18438
18453
  description: "Create an issue and print its identifier",
18454
+ longDescription: "--disposition ready_for_agent requires --agent-config; the agent queue refuses an issue without one.",
18439
18455
  positionals: {
18440
18456
  title: exports_external.string().describe("Issue title")
18441
18457
  },
@@ -18787,6 +18803,8 @@ var remove2 = command({
18787
18803
  var route = command({
18788
18804
  name: "route",
18789
18805
  description: "Route an issue to a disposition (wontfix also cancels it)",
18806
+ longDescription: `The disposition says who acts next; needs_triage is the default. Routing to
18807
+ ready_for_agent requires the issue to carry an agent configuration (set --agent-config).`,
18790
18808
  positionals: {
18791
18809
  id: exports_external.string().describe("Issue identifier, number, or URL"),
18792
18810
  disposition: exports_external.enum(ISSUE_DISPOSITIONS).describe("Where the issue goes next")
@@ -18810,6 +18828,9 @@ var route = command({
18810
18828
  var set2 = command({
18811
18829
  name: "set",
18812
18830
  description: "Set an issue's status, priority, estimate, due date, project, milestone, parent, agent configuration, or labels",
18831
+ longDescription: `Status normally moves through the workflow commands and the linked pull request;
18832
+ --status is the correction path. Clearing the agent configuration is refused while
18833
+ the issue sits in ready_for_agent.`,
18813
18834
  positionals: {
18814
18835
  id: exports_external.string().describe("Issue identifier, number, or URL")
18815
18836
  },
@@ -18884,22 +18905,36 @@ var shellArg = (value) => /^[\w./-]+$/.test(value) ? value : `'${value.replaceAl
18884
18905
  var start = command({
18885
18906
  name: "start",
18886
18907
  description: "Claim implementation work: move unstarted or changes_requested work to in_progress with its branch",
18908
+ longDescription: `Starting never routes the issue: the note printed when the disposition is not
18909
+ ready_for_agent is informational, and --ready belongs only to an explicit hand-off.`,
18887
18910
  positionals: {
18888
18911
  id: exports_external.string().describe("Issue identifier, number, or URL")
18889
18912
  },
18890
18913
  options: {
18891
- ready: exports_external.boolean().default(false).describe("Also route the issue to ready_for_agent")
18914
+ ready: exports_external.boolean().default(false).describe("Also route the issue to ready_for_agent, assigning the running agent when it is identifiable")
18892
18915
  },
18893
18916
  run: async ({ positionals: { id }, options: { ready } }) => {
18894
18917
  const client3 = await backendClient();
18895
18918
  const issue2 = await resolveIssue(client3, id);
18896
18919
  const { branch } = await client3.mutation(api2.issues.start, { id: issue2._id });
18920
+ let assigned;
18921
+ if (ready) {
18922
+ const actor = await agentClaim();
18923
+ const configurationId = actor && agentConfigurationForActor(actor);
18924
+ if (configurationId && configurationId !== issue2.agentConfigurationId) {
18925
+ await client3.mutation(api2.issues.setAgentConfiguration, {
18926
+ id: issue2._id,
18927
+ agentConfigurationId: configurationId
18928
+ });
18929
+ assigned = configurationId;
18930
+ }
18931
+ }
18897
18932
  if (ready && issue2.disposition !== "ready_for_agent") {
18898
18933
  await client3.mutation(api2.issues.route, { id: issue2._id, disposition: "ready_for_agent" });
18899
18934
  }
18900
18935
  console.log(`Started ${issue2.identifier}: in_progress, branch ${branch}`);
18901
18936
  if (ready) {
18902
- console.log("Routed to ready_for_agent.");
18937
+ console.log(`Routed to ready_for_agent${assigned ? `, assigned ${agentConfiguration(assigned).label}` : ""}.`);
18903
18938
  } else if (issue2.disposition !== "ready_for_agent" && await agentClaim()) {
18904
18939
  console.log(`Note: disposition is ${issue2.disposition}. Pass --ready if this hand-off was intended.`);
18905
18940
  }
@@ -18967,6 +19002,9 @@ ${exports_external.prettifyError(parsed.error)}`);
18967
19002
  var submitReview = command({
18968
19003
  name: "submit-review",
18969
19004
  description: "Submit the review verdict on an issue's linked pull request as the reviewer App",
19005
+ longDescription: `Findings are a JSON array (at most ${MAX_REVIEW_FINDINGS}) of objects with path, line, category,
19006
+ severity, summary, and body, plus optional startLine and diff.
19007
+ Categories: ${REVIEW_FINDING_CATEGORIES.join(", ")}; severities: ${REVIEW_FINDING_SEVERITIES.join(", ")}.`,
18970
19008
  positionals: {
18971
19009
  id: exports_external.string().describe("Issue identifier, number, or URL")
18972
19010
  },
@@ -19008,6 +19046,9 @@ var position = exports_external.array(exports_external.coerce.number().int().pos
19008
19046
  var tasks = command({
19009
19047
  name: "tasks",
19010
19048
  description: "Show an issue's checklist, or add, tick, promote, and drop its tasks",
19049
+ longDescription: `Tasks have no identifier, status, disposition, or feed, and ticking one files no
19050
+ activity. Task numbers resolve against the listing as printed, so one call may
19051
+ address several rows even as removals renumber it.`,
19011
19052
  positionals: {
19012
19053
  id: exports_external.string().describe("Issue identifier, number, or URL")
19013
19054
  },
@@ -19015,7 +19056,7 @@ var tasks = command({
19015
19056
  add: exports_external.array(exports_external.string()).optional().describe("Add a task (repeatable)").meta({ short: "a" }),
19016
19057
  check: position.optional().describe("Tick a task by its number (repeatable)"),
19017
19058
  uncheck: position.optional().describe("Untick a task by its number (repeatable)"),
19018
- convert: position.optional().describe("Promote a task into its own issue (repeatable)"),
19059
+ convert: position.optional().describe("Promote a task into a sub-issue (repeatable); the new issue inherits the project and milestone, arrives in needs_triage, and consumes the task \u2014 a related issue instead when this issue is already a sub-issue"),
19019
19060
  remove: position.optional().describe("Drop a task by its number (repeatable)"),
19020
19061
  json: exports_external.boolean().default(false).describe("Print as JSON")
19021
19062
  },
@@ -19104,7 +19145,7 @@ var update2 = command({
19104
19145
  options: {
19105
19146
  title: exports_external.string().optional().describe("New title").meta({ short: "t" }),
19106
19147
  description: exports_external.string().optional().describe("New markdown description, or - for stdin").meta({ short: "d" }),
19107
- attach: exports_external.array(exports_external.string()).optional().describe("Attach a file to the issue (repeatable)").meta({ short: "a" })
19148
+ attach: exports_external.array(exports_external.string()).optional().describe("Attach a file to the issue (repeatable); the printed URL is usable in issue markdown, and removal is dashboard-only").meta({ short: "a" })
19108
19149
  },
19109
19150
  run: async ({ positionals: { id }, options: { title, description, attach } }) => {
19110
19151
  if (title === undefined && description === undefined && attach === undefined)
@@ -19127,6 +19168,16 @@ var update2 = command({
19127
19168
  var issues = group({
19128
19169
  name: "issues",
19129
19170
  description: "Track and triage issues",
19171
+ longDescription: `An issue moves on three independent axes: status (the lifecycle, in order: backlog,
19172
+ todo, in_progress, ready_for_review, in_review, changes_requested, approved, done,
19173
+ canceled), priority, and disposition (who acts next). The workflow commands \u2014 start,
19174
+ submit, start-review, submit-review \u2014 and the linked pull request move the status;
19175
+ each refuses an issue outside its own status, and \`set -s\` is for corrections.
19176
+ The repo link is never set by hand: work on a branch whose name contains the issue
19177
+ identifier and the branch, pull request, and status track automatically \u2014 a change
19178
+ request moves the issue to changes_requested, an approval to approved (one
19179
+ outstanding change request outweighs any number of approvals), and a merge lands
19180
+ it as done.`,
19130
19181
  commands: [
19131
19182
  create,
19132
19183
  list2,
@@ -19336,6 +19387,10 @@ var versions2 = command({
19336
19387
  var pages = group({
19337
19388
  name: "pages",
19338
19389
  description: "Publish HTML documents to the web",
19390
+ longDescription: `Themed pages (the default) render inside the site chrome under a strict CSP: only
19391
+ the site theme's styles apply \u2014 inline style attributes and author scripts are
19392
+ dropped. A self-contained document with its own CSS or JS needs raw mode, which
19393
+ serves it verbatim. A page keeps its URL across updates and reverts.`,
19339
19394
  commands: [create3, list3, get2, update3, versions2, revert, remove3]
19340
19395
  });
19341
19396
 
@@ -19551,6 +19606,8 @@ var update4 = command({
19551
19606
  var projects = group({
19552
19607
  name: "projects",
19553
19608
  description: "Manage projects",
19609
+ longDescription: `Connect a repository (set --repo) to make --here resolve in that checkout and to
19610
+ let issue branches and pull requests link automatically.`,
19554
19611
  commands: [create4, list4, get3, update4, set3, remove4]
19555
19612
  });
19556
19613
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@islamihab/kds",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Command-line client for Kai Dev Studio",
5
5
  "license": "MIT",
6
6
  "publishConfig": {