@theholocron/cli 5.0.0-alpha.477 → 5.0.0-alpha.479

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/README.md CHANGED
@@ -740,8 +740,8 @@ See the [command pages](https://theholocron.dev/holocron/commands/setup-notifica
740
740
  kebab-case, or `--name` as the whole name) with `status: draft`, `issue:`, `blocked-by: []`, no `id`, and the issue's text
741
741
  under `## Problem` less the `Filed from idea:` line and the marker. It never overwrites a file, never edits the issue or
742
742
  touches the vault, and asks first unless `--dry-run` or `--yes`.
743
- - **`holocron new issue <title> [--body <text>] [--label <name>]... [--milestone <value>] [--dry-run] [--yes]`** — files an
744
- issue through the `issues` provider (`Issues.create`: GitHub or Linear) and prints its key. It asks first unless
743
+ - **`holocron new issue <title> [--body <text> | --body-file <path|->] [--label <name>]... [--assignee <login>]... [--milestone <value>] [--dry-run] [--yes]`** — files an
744
+ issue through the `issues` provider (`Issues.create`: GitHub or Linear) and prints its key; what the tracker cannot hold (a second Linear assignee, an unknown user) is listed as not carried across. It asks first unless
745
745
  `--dry-run` or `--yes` (without a terminal it refuses instead) and does not look for a duplicate.
746
746
 
747
747
  ## Syncing tooling
package/dist/cli.mjs CHANGED
@@ -586,17 +586,39 @@ const issueCreateEntry = {
586
586
  message: "Title:",
587
587
  type: "input"
588
588
  }],
589
- options: [{
590
- key: "body",
591
- flag: "--body",
592
- type: "input",
593
- message: "Text:"
594
- }],
595
- skipOptions: [
596
- "label",
597
- "milestone",
598
- "yes"
589
+ options: [
590
+ {
591
+ key: "body",
592
+ flag: "--body",
593
+ type: "input",
594
+ message: "Text:"
595
+ },
596
+ {
597
+ key: "bodyFile",
598
+ flag: "--body-file",
599
+ type: "input",
600
+ message: "File with the text (- for stdin):"
601
+ },
602
+ {
603
+ key: "label",
604
+ flag: "--label",
605
+ type: "input",
606
+ message: "Label:"
607
+ },
608
+ {
609
+ key: "assignee",
610
+ flag: "--assignee",
611
+ type: "input",
612
+ message: "Assignee (login, or me):"
613
+ },
614
+ {
615
+ key: "milestone",
616
+ flag: "--milestone",
617
+ type: "input",
618
+ message: "Milestone (number or title):"
619
+ }
599
620
  ],
621
+ skipOptions: ["yes"],
600
622
  supportsDryRun: true
601
623
  };
602
624
  // src/commands/migrate/migrate-issue/migrate-issue.entry.ts
@@ -7796,7 +7818,7 @@ function datasetTargets(config) {
7796
7818
  * the token (accepted by the provider), one per dataset (the CLI's, Sentinel's and any other `dev.serve.logging` names),
7797
7819
  * one for the organization, and an `info` row per existing dataset with its retention (ADR-0019: one setting for the whole
7798
7820
  * dataset, shared by every environment in it). Only a dataset the provider says is missing, or a token it refuses, fails;
7799
- * a name, a token or a response that cannot be read is a skip with the reason.
7821
+ * a dataset the token may not see (403), a name, a token or a response that cannot be read is a skip with the reason.
7800
7822
  */
7801
7823
  const row$14 = (id, title, status, detail, problems = []) => ({
7802
7824
  id,
@@ -7834,7 +7856,7 @@ async function runDoctorLogs(input) {
7834
7856
  }
7835
7857
  async function checkLogs(logs, targets) {
7836
7858
  const rows = [];
7837
- const token = await checkToken$1(logs);
7859
+ const token = await checkToken$1(logs, targets.find((t) => t.id === "cli")?.name);
7838
7860
  rows.push(token.row);
7839
7861
  for (const target of targets) {
7840
7862
  const id = `logs:dataset:${target.id}`;
@@ -7849,14 +7871,14 @@ async function checkLogs(logs, targets) {
7849
7871
  return rows;
7850
7872
  }
7851
7873
  /** Whether the provider accepts the token. `usable` is false when it was refused or could not be tried. */
7852
- async function checkToken$1(logs) {
7874
+ async function checkToken$1(logs, dataset) {
7853
7875
  const title = "token is accepted";
7854
7876
  if (!logs.checkToken) return {
7855
7877
  row: row$14("logs:token", title, "skip", `${logs.providerName} cannot check a token`),
7856
7878
  usable: true
7857
7879
  };
7858
7880
  try {
7859
- const result = await logs.checkToken();
7881
+ const result = await logs.checkToken(dataset);
7860
7882
  if (result.ok) return {
7861
7883
  row: row$14("logs:token", title, "ok", `${logs.providerName} accepts the token`),
7862
7884
  usable: true
@@ -7878,6 +7900,10 @@ async function checkToken$1(logs) {
7878
7900
  async function checkDataset(logs, target, name, id, title) {
7879
7901
  try {
7880
7902
  const found = await logs.readDataset(name);
7903
+ if (found.forbidden) {
7904
+ const why = `${name}: not visible to this token (${logs.providerName} refused the read; it may also not exist)`;
7905
+ return [row$14(id, title, "skip", why)];
7906
+ }
7881
7907
  if (!found.exists) {
7882
7908
  const problem = `dataset ${name} does not exist (${target.variable}); ${target.fix}`;
7883
7909
  return [row$14(id, title, "fail", `${name} does not exist`, [problem])];
@@ -19905,6 +19931,14 @@ const ideasPromoteCommand = {
19905
19931
  })).status === "fail") process.exitCode = 1;
19906
19932
  }
19907
19933
  };
19934
+ // src/commands/issue-create/read-issue-body/read-issue-body.ts
19935
+ /**
19936
+ * The text of an issue from `--body-file`: a path (relative to `cwd`), or `-` for standard input. `read` is injected
19937
+ * so a test needs no file or terminal.
19938
+ */
19939
+ function readIssueBody(file, cwd, read = (p) => readFileSync(p, "utf8")) {
19940
+ return file === "-" ? read(0) : read(resolve(cwd, file));
19941
+ }
19908
19942
  // src/commands/issue-create/run-issue-create/run-issue-create.ts
19909
19943
  /**
19910
19944
  * `holocron new issue` — files an issue through the repo's `issues` provider.
@@ -19961,7 +19995,12 @@ async function runIssueCreate(input) {
19961
19995
  const labels = [...new Set((input.labels ?? []).map((l) => l.trim()).filter(Boolean))];
19962
19996
  const body = input.body?.trim() ? input.body : void 0;
19963
19997
  const milestone = input.milestone?.trim() ? input.milestone.trim() : void 0;
19964
- const details = [labels.length > 0 ? `labels: ${labels.join(", ")}` : void 0, milestone ? `milestone: ${milestone}` : void 0].filter(Boolean);
19998
+ const assignees = [...new Set((input.assignees ?? []).map((a) => a.trim()).filter(Boolean))];
19999
+ const details = [
20000
+ labels.length > 0 ? `labels: ${labels.join(", ")}` : void 0,
20001
+ assignees.length > 0 ? `assignee: ${assignees.join(", ")}` : void 0,
20002
+ milestone ? `milestone: ${milestone}` : void 0
20003
+ ].filter(Boolean);
19965
20004
  const summary = details.length > 0 ? ` (${details.join("; ")})` : "";
19966
20005
  if (dryRun) {
19967
20006
  print(` ${title}`);
@@ -19983,13 +20022,14 @@ async function runIssueCreate(input) {
19983
20022
  }
19984
20023
  }
19985
20024
  try {
19986
- const { key } = await loader.get("issues").create({
20025
+ const { key, dropped } = await loader.get("issues").create({
19987
20026
  summary: title,
19988
20027
  ...body ? { body } : {},
19989
20028
  ...labels.length > 0 ? { labels } : {},
19990
- ...milestone ? { milestone } : {}
20029
+ ...milestone ? { milestone } : {},
20030
+ ...assignees.length > 0 ? { assignees } : {}
19991
20031
  });
19992
- return finish([row$4(title, "ok", `filed ${key}`)], key);
20032
+ return finish([row$4(title, "ok", `filed ${key}`), ...(dropped ?? []).map((line) => row$4("not carried across", "skip", line))], key);
19993
20033
  } catch (err) {
19994
20034
  return finish([row$4(title, "fail", `could not file the issue: ${describeError(err)}`)]);
19995
20035
  }
@@ -20005,10 +20045,18 @@ const issueCreateCommand = {
20005
20045
  }).option("body", {
20006
20046
  type: "string",
20007
20047
  describe: "The issue's text"
20048
+ }).option("body-file", {
20049
+ type: "string",
20050
+ describe: "Read the issue's text from a file (`-` for standard input)",
20051
+ conflicts: "body"
20008
20052
  }).option("label", {
20009
20053
  type: "string",
20010
20054
  array: true,
20011
20055
  describe: "A label to put on it (repeatable)"
20056
+ }).option("assignee", {
20057
+ type: "string",
20058
+ array: true,
20059
+ describe: "A person to assign, by login; `me` is you (repeatable)"
20012
20060
  }).option("milestone", {
20013
20061
  type: "string",
20014
20062
  describe: "The milestone: its number or its exact title"
@@ -20021,6 +20069,14 @@ const issueCreateCommand = {
20021
20069
  if (!tokens) return;
20022
20070
  const loaded = await loadConfig(argv.cwd);
20023
20071
  applyResolvedConfig(argv, loaded.resolved);
20072
+ let body = argv.body;
20073
+ if (argv.bodyFile) try {
20074
+ body = readIssueBody(argv.bodyFile, argv.cwd);
20075
+ } catch (err) {
20076
+ console.error(`Could not read ${argv.bodyFile}: ${describeError(err)}`);
20077
+ process.exitCode = 1;
20078
+ return;
20079
+ }
20024
20080
  if ((await runIssueCreate({
20025
20081
  title: String(argv.title),
20026
20082
  loaded,
@@ -20030,7 +20086,8 @@ const issueCreateCommand = {
20030
20086
  ...tokens,
20031
20087
  org: resolveOrg(argv, loaded.resolved)
20032
20088
  },
20033
- ...argv.body ? { body: argv.body } : {},
20089
+ ...body ? { body } : {},
20090
+ ...argv.assignee ? { assignees: argv.assignee.map(String) } : {},
20034
20091
  ...argv.label ? { labels: argv.label.map(String) } : {},
20035
20092
  ...argv.milestone ? { milestone: String(argv.milestone) } : {},
20036
20093
  ...argv.yes ? { yes: true } : {}