@theholocron/cli 5.0.0-alpha.395 → 5.0.0-alpha.396
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 +8 -6
- package/dist/cli.mjs +72 -149
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-system-CLi7Ceta.d.mts → config-system-CYv5GFIa.d.mts} +12 -5
- package/dist/{config-system-BzAs0RR1.mjs → config-system-CeVFoOau.mjs} +2 -2
- package/dist/{index-DbptTVsV.d.mts → index-DbbyDvZi.d.mts} +47 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/plugin/capabilities.d.mts +2 -2
- package/dist/plugin/capabilities.mjs +2 -0
- package/dist/presets.d.mts +1 -1
- package/dist/presets.mjs +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -693,11 +693,13 @@ See the [command pages](https://theholocron.dev/holocron/commands/notifications-
|
|
|
693
693
|
|
|
694
694
|
## Ideas
|
|
695
695
|
|
|
696
|
-
- **`holocron ideas sync [--dry-run] [--yes]`** — files the
|
|
697
|
-
|
|
698
|
-
`
|
|
699
|
-
|
|
700
|
-
|
|
696
|
+
- **`holocron ideas sync [--dry-run] [--yes]`** — files the ideas that are ready: it reads them through the `ideas`
|
|
697
|
+
provider (`providers.ideas: ["obsidian", { dir }]`, an Obsidian vault; `HOLOCRON_IDEAS_DIR` overrides `dir`; the older
|
|
698
|
+
`ideas.dir` is deprecated and read as that entry when `providers.ideas` is absent) and, for each one whose status is
|
|
699
|
+
the filing state (`ideas.states.file`, default `in-progress`) with no issue, creates an issue through the `issues`
|
|
700
|
+
provider (title the first `#` heading, body the note plus `Filed from idea: <title>`) and records it with
|
|
701
|
+
`Ideas.markFiled` (an `issue:` property, for Obsidian). Ideas with attachments are skipped. It never deletes, asks first
|
|
702
|
+
unless `--dry-run` or `--yes`, and a second run changes nothing.
|
|
701
703
|
|
|
702
704
|
## Syncing issues
|
|
703
705
|
|
|
@@ -892,7 +894,7 @@ the local override exists to exempt.
|
|
|
892
894
|
|
|
893
895
|
## What's in here
|
|
894
896
|
|
|
895
|
-
- `src/plugin/capabilities.ts` — the
|
|
897
|
+
- `src/plugin/capabilities.ts` — the 22 capability interfaces that
|
|
896
898
|
providers implement
|
|
897
899
|
- `src/config.ts` — config schema, `defineConfig`, `resolveConfig`,
|
|
898
900
|
`CapabilityConfigPackage`
|
package/dist/cli.mjs
CHANGED
|
@@ -35,8 +35,8 @@ import { access, copyFile, lstat, mkdir, open, readFile, readdir, realpath, rena
|
|
|
35
35
|
import { createHash, createHmac, randomBytes, randomUUID } from "node:crypto";
|
|
36
36
|
import { createGitHubClient, getApp, listAppInstallations } from "@theholocron/github-client";
|
|
37
37
|
import { createServer } from "node:http";
|
|
38
|
-
import { ADR_DIR, ADR_STATUSES, CLOSED_STATUSES, SPEC_DIRS, SPEC_STATUSES, WITHDRAWN_STATE, assignSpecIds, checkSpecs, classifySpecPath, discussionBody, discussionIdLine, discussionPrLine, discussionTitle, evaluateDocsPresence, isAddedDocComment, isFeat, packageOf, parseFrontmatter, parseSkipDocs, reconcileSpecStatus, specSummary, specTitle, updateFrontmatter } from "@theholocron/astromech/repo-validation";
|
|
39
38
|
import { moveMajorTag } from "@theholocron/kyber/git";
|
|
39
|
+
import { ADR_DIR, ADR_STATUSES, CLOSED_STATUSES, SPEC_DIRS, SPEC_STATUSES, WITHDRAWN_STATE, assignSpecIds, checkSpecs, classifySpecPath, discussionBody, discussionIdLine, discussionPrLine, discussionTitle, evaluateDocsPresence, isAddedDocComment, isFeat, packageOf, parseFrontmatter, parseSkipDocs, reconcileSpecStatus, specSummary, specTitle, updateFrontmatter } from "@theholocron/astromech/repo-validation";
|
|
40
40
|
import { loadConfigPath } from "@theholocron/datapad";
|
|
41
41
|
import { fetchLatestFromNpm, runUpgradeNode } from "@theholocron/astromech/upgrade";
|
|
42
42
|
import { lintCommitMsgFile } from "@theholocron/astromech/lint";
|
|
@@ -83,6 +83,8 @@ const CARDINALITY = {
|
|
|
83
83
|
tunnels: "single",
|
|
84
84
|
/** `projects` has exactly one provider. */
|
|
85
85
|
projects: "single",
|
|
86
|
+
/** `ideas` has exactly one provider. Optional: no repo has to declare it. */
|
|
87
|
+
ideas: "single",
|
|
86
88
|
/** `credentials` can have several providers, tried in order. */
|
|
87
89
|
credentials: "many"
|
|
88
90
|
};
|
|
@@ -225,8 +227,8 @@ function validateGitHubApps(apps) {
|
|
|
225
227
|
function validateIdeas(ideas) {
|
|
226
228
|
const nonEmpty = (value) => typeof value === "string" && value.trim() !== "";
|
|
227
229
|
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
228
|
-
if (!isObject(ideas)) throw new ConfigError$1("`ideas` must be an object: { dir
|
|
229
|
-
if (!nonEmpty(ideas.dir)) throw new ConfigError$1("`ideas.dir` must be the path of the notes folder, got an empty value");
|
|
230
|
+
if (!isObject(ideas)) throw new ConfigError$1("`ideas` must be an object: { states?, dir? (deprecated) }");
|
|
231
|
+
if (ideas.dir !== void 0 && !nonEmpty(ideas.dir)) throw new ConfigError$1("`ideas.dir` must be the path of the notes folder, got an empty value");
|
|
230
232
|
if (ideas.states !== void 0) {
|
|
231
233
|
if (!isObject(ideas.states)) throw new ConfigError$1("`ideas.states` must be an object: { file? }");
|
|
232
234
|
if (ideas.states.file !== void 0 && !nonEmpty(ideas.states.file)) throw new ConfigError$1("`ideas.states.file` must be a state name, got an empty value");
|
|
@@ -4841,7 +4843,7 @@ function parseList(text) {
|
|
|
4841
4843
|
}
|
|
4842
4844
|
// src/commands/doctor-ci/unquote.ts
|
|
4843
4845
|
/** The text of a YAML scalar without its surrounding quotes. */
|
|
4844
|
-
function unquote$
|
|
4846
|
+
function unquote$1(value) {
|
|
4845
4847
|
return value.trim().replace(/^(["'])(.*)\1$/, "$2");
|
|
4846
4848
|
}
|
|
4847
4849
|
// src/commands/doctor-ci/parse-caller.ts
|
|
@@ -4873,7 +4875,7 @@ function parseCaller(file, text) {
|
|
|
4873
4875
|
continue;
|
|
4874
4876
|
}
|
|
4875
4877
|
const name = /^ {4}name:\s*(.+?)\s*$/.exec(line);
|
|
4876
|
-
if (name && current) current.name = unquote$
|
|
4878
|
+
if (name && current) current.name = unquote$1(name[1]);
|
|
4877
4879
|
const uses = /^ {4}uses:\s*(\S+)/.exec(line);
|
|
4878
4880
|
if (uses && current) current.uses = uses[1];
|
|
4879
4881
|
}
|
|
@@ -4884,8 +4886,8 @@ function parseCaller(file, text) {
|
|
|
4884
4886
|
return {
|
|
4885
4887
|
file,
|
|
4886
4888
|
jobs,
|
|
4887
|
-
...workflowName === void 0 ? {} : { name: unquote$
|
|
4888
|
-
...expected === void 0 ? {} : { expected: parseList(unquote$
|
|
4889
|
+
...workflowName === void 0 ? {} : { name: unquote$1(workflowName) },
|
|
4890
|
+
...expected === void 0 ? {} : { expected: parseList(unquote$1(expected)) }
|
|
4889
4891
|
};
|
|
4890
4892
|
}
|
|
4891
4893
|
// src/commands/doctor-ci/real-ci-io.ts
|
|
@@ -8033,7 +8035,7 @@ const GROUP_NAMES = /* @__PURE__ */ new Set([
|
|
|
8033
8035
|
/** What a task id looks like: lowercase letters and digits, with a hyphen or a colon inside. */
|
|
8034
8036
|
const ID = /^[a-z][a-z0-9:-]*$/;
|
|
8035
8037
|
/** The unquoted text of a YAML list entry's value. */
|
|
8036
|
-
const unquote
|
|
8038
|
+
const unquote = (value) => value.trim().replace(/^(["'])(.*)\1$/, "$2");
|
|
8037
8039
|
/**
|
|
8038
8040
|
* Problems with the workflow names a workflow lists under `workflow_run: workflows:`, as human-readable lines: one for
|
|
8039
8041
|
* each name that is an old group name (`Verification`), an old dotted task name or a lowercase name that is no task id.
|
|
@@ -8042,7 +8044,7 @@ const unquote$1 = (value) => value.trim().replace(/^(["'])(.*)\1$/, "$2");
|
|
|
8042
8044
|
* alone: this reads the text, not the repo's workflows.
|
|
8043
8045
|
*/
|
|
8044
8046
|
function workflowNameProblems(text) {
|
|
8045
|
-
return [...(/^ {2}workflow_run:\n {4}workflows:\n((?: {6}- [^\n]+\n)+)/m.exec(text)?.[1] ?? "").matchAll(/^ {6}- ([^\n#]+)/gm)].map((m) => unquote
|
|
8047
|
+
return [...(/^ {2}workflow_run:\n {4}workflows:\n((?: {6}- [^\n]+\n)+)/m.exec(text)?.[1] ?? "").matchAll(/^ {6}- ([^\n#]+)/gm)].map((m) => unquote(m[1])).flatMap((name) => {
|
|
8046
8048
|
if (GROUP_NAMES.has(name)) return [`${name}: an old group name; a caller's workflow is named for its task id`];
|
|
8047
8049
|
if (!ID.test(name)) return [];
|
|
8048
8050
|
if (name in LEGACY_NAMES) return [`${name}: an old task name; a caller's workflow is named for its task id`];
|
|
@@ -11472,121 +11474,39 @@ const githubAppCommand = {
|
|
|
11472
11474
|
builder: (y) => y.command(githubAppCreateCommand).command(groupMenu$1("github-app")),
|
|
11473
11475
|
handler: () => {}
|
|
11474
11476
|
};
|
|
11475
|
-
// src/commands/ideas-sync/
|
|
11476
|
-
/**
|
|
11477
|
-
*
|
|
11478
|
-
*
|
|
11479
|
-
|
|
11480
|
-
|
|
11481
|
-
|
|
11482
|
-
|
|
11483
|
-
const
|
|
11484
|
-
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
if (entry.directory) {
|
|
11488
|
-
if (!/^[_.]/.test(entry.name)) walk(path, io.readDir(join(dir, path)));
|
|
11489
|
-
} else if (entry.name.toLowerCase().endsWith(".md") && !entry.name.startsWith(".")) found.push(path);
|
|
11490
|
-
}
|
|
11491
|
-
};
|
|
11492
|
-
walk("", top);
|
|
11493
|
-
return found.sort();
|
|
11494
|
-
}
|
|
11495
|
-
// src/commands/ideas-sync/parse-note/parse-note.ts
|
|
11496
|
-
const FRONTMATTER = /^---\r?\n[\s\S]*?\r?\n---[ \t]*(?:\r?\n|$)/;
|
|
11497
|
-
const FENCE = /^(```|~~~)[\s\S]*?^\1/gm;
|
|
11498
|
-
const WEB_ADDRESS = /^[a-z][a-z0-9+.-]*:/i;
|
|
11499
|
-
const unquote = (value) => value.replace(/^(["'])(.*)\1$/, "$2").trim();
|
|
11500
|
-
/**
|
|
11501
|
-
* Reads one note: its `status:` and `issue:` properties, its title, its text without the frontmatter and the files it
|
|
11502
|
-
* embeds. The title is the first `#` heading, else `fileName` without `.md`. An embed is `![[x]]` (any) or ``
|
|
11503
|
-
* where `x` is not an address with a scheme; embeds inside a code fence are text and do not count.
|
|
11504
|
-
*/
|
|
11505
|
-
function parseNote(text, fileName) {
|
|
11506
|
-
const fields = parseFrontmatter(text.replace(/\r\n/g, "\n"));
|
|
11507
|
-
const body = text.replace(FRONTMATTER, "");
|
|
11508
|
-
const prose = body.replace(/\r/g, "").replace(FENCE, "");
|
|
11509
|
-
const heading = /^#[ \t]+(.+?)[ \t]*$/m.exec(prose);
|
|
11510
|
-
const wiki = [...prose.matchAll(/!\[\[[^\]]+\]\]/g)].map((m) => m[0]);
|
|
11511
|
-
const links = [...prose.matchAll(/!\[[^\]]*\]\(([^)\s]+)[^)]*\)/g)].filter((m) => !WEB_ADDRESS.test(m[1])).map((m) => m[0]);
|
|
11512
|
-
return {
|
|
11513
|
-
status: unquote(fields?.get("status")?.value ?? ""),
|
|
11514
|
-
issue: unquote(fields?.get("issue")?.value ?? ""),
|
|
11515
|
-
title: heading?.[1] ?? fileName.replace(/\.md$/i, ""),
|
|
11516
|
-
body,
|
|
11517
|
-
attachments: [...wiki, ...links]
|
|
11518
|
-
};
|
|
11519
|
-
}
|
|
11520
|
-
// src/commands/ideas-sync/real-ideas-io/real-ideas-io.ts
|
|
11521
|
-
/** The `ideas sync` inputs from the real filesystem. */
|
|
11522
|
-
function realIdeasIo() {
|
|
11523
|
-
/* v8 ignore start -- reads the real filesystem; the command is tested with an injected io */
|
|
11477
|
+
// src/commands/ideas-sync/resolve-ideas-provider/resolve-ideas-provider.ts
|
|
11478
|
+
/**
|
|
11479
|
+
* The `ideas` provider `ideas sync` reads through: `providers.ideas` when the config names one. A config written
|
|
11480
|
+
* before the capability has only `ideas.dir` (#2004), so that, or `HOLOCRON_IDEAS_DIR` alone, reads as
|
|
11481
|
+
* `["obsidian", { dir }]`, the way a `HOLOCRON_` variable falls back to the bare name. `providers.ideas` wins over
|
|
11482
|
+
* `ideas.dir`. `undefined` when the config names no place for ideas at all.
|
|
11483
|
+
*/
|
|
11484
|
+
function resolveIdeasProvider(resolved, env) {
|
|
11485
|
+
const own = resolved.providers.ideas;
|
|
11486
|
+
if (own) return own;
|
|
11487
|
+
const dir = resolved.ideas?.dir;
|
|
11488
|
+
if (dir === void 0 && holocronEnv(env).get("IDEAS_DIR") === void 0) return void 0;
|
|
11524
11489
|
return {
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
} catch {
|
|
11532
|
-
return;
|
|
11533
|
-
}
|
|
11534
|
-
},
|
|
11535
|
-
read: (path) => {
|
|
11536
|
-
try {
|
|
11537
|
-
return readFileSync(path, "utf8");
|
|
11538
|
-
} catch {
|
|
11539
|
-
return;
|
|
11540
|
-
}
|
|
11541
|
-
},
|
|
11542
|
-
write: (path, text) => writeFileSync(path, text, "utf8"),
|
|
11543
|
-
home: () => homedir()
|
|
11490
|
+
cardinality: "single",
|
|
11491
|
+
tuple: {
|
|
11492
|
+
provider: "obsidian",
|
|
11493
|
+
packageName: resolvePluginPackage$1("obsidian"),
|
|
11494
|
+
options: dir === void 0 ? {} : { dir }
|
|
11495
|
+
}
|
|
11544
11496
|
};
|
|
11545
|
-
/* v8 ignore stop */
|
|
11546
|
-
}
|
|
11547
|
-
// src/commands/ideas-sync/resolve-ideas-dir/resolve-ideas-dir.ts
|
|
11548
|
-
/**
|
|
11549
|
-
* The folder of idea notes: `HOLOCRON_IDEAS_DIR` (then `IDEAS_DIR`) when set, else `ideas.dir` of the config.
|
|
11550
|
-
* A leading `~` is the home folder. `undefined` when neither names one.
|
|
11551
|
-
*/
|
|
11552
|
-
function resolveIdeasDir(ideas, home, source) {
|
|
11553
|
-
const dir = holocronEnv(source).get("IDEAS_DIR") ?? ideas?.dir;
|
|
11554
|
-
if (dir === void 0) return void 0;
|
|
11555
|
-
if (dir === "~") return home;
|
|
11556
|
-
return dir.startsWith("~/") ? join(home, dir.slice(2)) : dir;
|
|
11557
|
-
}
|
|
11558
|
-
// src/commands/ideas-sync/write-issue-key/write-issue-key.ts
|
|
11559
|
-
const BLOCK = /^---(\r?\n)([\s\S]*?)(\r?\n)---/;
|
|
11560
|
-
/**
|
|
11561
|
-
* The note's text with `issue: <key>` in its frontmatter: a blank `issue:` line is filled in, else a line is added at
|
|
11562
|
-
* the end of the block. Everything else, including line endings and the body, is left byte for byte. A note with no
|
|
11563
|
-
* frontmatter is returned unchanged (such a note has no `status:`, so it is never filed).
|
|
11564
|
-
*/
|
|
11565
|
-
function writeIssueKey(text, key) {
|
|
11566
|
-
const match = BLOCK.exec(text);
|
|
11567
|
-
if (!match) return text;
|
|
11568
|
-
const [whole, open, inner, close] = match;
|
|
11569
|
-
const lines = inner.split(/\r?\n/);
|
|
11570
|
-
const separators = inner.match(/\r?\n/g) ?? [];
|
|
11571
|
-
const at = lines.findIndex((line) => /^issue:/.test(line));
|
|
11572
|
-
const next = at === -1 ? [...lines, `issue: ${key}`] : lines.map((line, i) => i === at ? `issue: ${key}` : line);
|
|
11573
|
-
let rebuilt = next[0];
|
|
11574
|
-
next.slice(1).forEach((line, i) => {
|
|
11575
|
-
rebuilt += (separators[i] ?? close) + line;
|
|
11576
|
-
});
|
|
11577
|
-
return `---${open}${rebuilt}${close}---${text.slice(whole.length)}`;
|
|
11578
11497
|
}
|
|
11579
11498
|
// src/commands/ideas-sync/run-ideas-sync/run-ideas-sync.ts
|
|
11580
11499
|
/**
|
|
11581
11500
|
* `holocron ideas sync` — files the idea notes that are ready.
|
|
11582
11501
|
*
|
|
11583
|
-
* It reads every
|
|
11584
|
-
*
|
|
11585
|
-
* `
|
|
11586
|
-
*
|
|
11587
|
-
*
|
|
11588
|
-
*
|
|
11589
|
-
*
|
|
11502
|
+
* It reads every idea through the `ideas` provider (`providers.ideas`, or `ideas.dir` read as an Obsidian vault; the
|
|
11503
|
+
* Obsidian plugin skips folders whose name starts with `_` or `.`). An idea whose status is the filing state (default
|
|
11504
|
+
* `in-progress`) and that has no issue becomes an issue through the repo's `issues` provider, and the issue is then
|
|
11505
|
+
* recorded with `Ideas.markFiled` (for Obsidian, an `issue:` property in the tracker's own syntax), which is what makes
|
|
11506
|
+
* the step run once. An idea with attachments is reported and skipped, since an issue body cannot carry them. Only
|
|
11507
|
+
* ideas to be filed, and ideas that need the person's attention, get a row; the rest are counted. The issue body ends
|
|
11508
|
+
* with a hidden `<!-- holocron:idea <key> -->` line, and an issue that carries it is reused instead of making a second
|
|
11509
|
+
* one (found with `Issues.search`, the recent issues only). It never deletes anything, and an idea it cannot file is a
|
|
11590
11510
|
* failing row (the run goes on). It writes, so it asks first unless `--dry-run` or `--yes` (without a terminal it refuses instead).
|
|
11591
11511
|
*/
|
|
11592
11512
|
/** The state that files a note when the config names none. */
|
|
@@ -11602,16 +11522,14 @@ const row = (id, status, detail) => ({
|
|
|
11602
11522
|
* The hidden line that ties an issue to its note. A later run looks for it before it creates an issue, so a note whose
|
|
11603
11523
|
* `issue:` could not be written is not filed twice.
|
|
11604
11524
|
*/
|
|
11605
|
-
const marker = (
|
|
11606
|
-
/** The issue's body: the
|
|
11607
|
-
const issueBody = (
|
|
11525
|
+
const marker = (key) => `<!-- holocron:idea ${key} -->`;
|
|
11526
|
+
/** The issue's body: the idea's text, the line that traces the issue to its idea, and the hidden marker. */
|
|
11527
|
+
const issueBody = (idea) => `${idea.body.trim()}\n\nFiled from idea: ${idea.title}\n${marker(idea.key)}`;
|
|
11608
11528
|
/** How many recent issues are searched for the marker (the narrowest existing method, `Issues.search`). */
|
|
11609
11529
|
const SEARCH_LIMIT = 100;
|
|
11610
11530
|
async function runIdeasSync(input) {
|
|
11611
11531
|
/* v8 ignore next -- the console is only used outside tests, which inject `print` */
|
|
11612
11532
|
const print = input.print ?? ((line) => console.log(line));
|
|
11613
|
-
/* v8 ignore next -- the real disk is only used outside tests, which inject `io` */
|
|
11614
|
-
const io = input.io ?? realIdeasIo();
|
|
11615
11533
|
const dryRun = Boolean(input.context.dryRun);
|
|
11616
11534
|
let notReady = 0;
|
|
11617
11535
|
const finish = (rows, status) => {
|
|
@@ -11626,31 +11544,37 @@ async function runIdeasSync(input) {
|
|
|
11626
11544
|
};
|
|
11627
11545
|
print(style.header(`Holocron ideas sync${dryRun ? " (dry-run)" : ""}`));
|
|
11628
11546
|
print("");
|
|
11629
|
-
const
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
const
|
|
11633
|
-
|
|
11634
|
-
|
|
11547
|
+
const entry = resolveIdeasProvider(input.loaded.resolved, input.env);
|
|
11548
|
+
if (!entry) return finish([row("ideas", "fail", "no `ideas` provider: set `providers.ideas` (`[\"obsidian\", { dir }]`) in holocron.config or HOLOCRON_IDEAS_DIR")]);
|
|
11549
|
+
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
11550
|
+
const reader = input.ideasLoader ?? new PluginLoader({
|
|
11551
|
+
...input.loaded.resolved,
|
|
11552
|
+
providers: { ideas: entry }
|
|
11553
|
+
}, input.context);
|
|
11554
|
+
/* v8 ignore stop */
|
|
11555
|
+
await reader.load();
|
|
11556
|
+
assertPluginsResolvable$1(reader, "ideas sync");
|
|
11557
|
+
if (!reader.has("ideas")) {
|
|
11558
|
+
const failure = reader.loadFailures().find((f) => f.key === "ideas");
|
|
11559
|
+
return finish([row("ideas", "fail", `the \`ideas\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
11560
|
+
}
|
|
11561
|
+
const ideas = reader.get("ideas");
|
|
11562
|
+
let records;
|
|
11563
|
+
try {
|
|
11564
|
+
records = await ideas.list();
|
|
11565
|
+
} catch (err) {
|
|
11566
|
+
return finish([row("ideas", "fail", describeError(err))]);
|
|
11567
|
+
}
|
|
11568
|
+
const fileState = input.loaded.resolved.ideas?.states?.file ?? DEFAULT_FILING_STATE;
|
|
11635
11569
|
const rows = [];
|
|
11636
11570
|
const ready = [];
|
|
11637
|
-
for (const
|
|
11638
|
-
|
|
11639
|
-
|
|
11640
|
-
|
|
11641
|
-
continue;
|
|
11642
|
-
}
|
|
11643
|
-
const note = parseNote(text, path.slice(path.lastIndexOf("/") + 1));
|
|
11644
|
-
if (note.status !== fileState || note.issue !== "") notReady++;
|
|
11645
|
-
else if (note.attachments.length > 0) rows.push(row(path, "skip", `has embedded files an issue cannot carry (${note.attachments.join(", ")}); not filed`));
|
|
11646
|
-
else ready.push({
|
|
11647
|
-
path,
|
|
11648
|
-
note
|
|
11649
|
-
});
|
|
11650
|
-
}
|
|
11571
|
+
for (const idea of records) if (idea.error !== void 0) rows.push(row(idea.key, "fail", idea.error));
|
|
11572
|
+
else if (idea.status !== fileState || idea.issue !== void 0) notReady++;
|
|
11573
|
+
else if (idea.attachments.length > 0) rows.push(row(idea.key, "skip", `has embedded files an issue cannot carry (${idea.attachments.join(", ")}); not filed`));
|
|
11574
|
+
else ready.push(idea);
|
|
11651
11575
|
if (ready.length === 0) return finish(rows);
|
|
11652
11576
|
if (dryRun) {
|
|
11653
|
-
for (const
|
|
11577
|
+
for (const idea of ready) rows.push(row(idea.key, "skip", `would file "${idea.title}"`));
|
|
11654
11578
|
return finish(rows.sort((a, b) => a.id.localeCompare(b.id)));
|
|
11655
11579
|
}
|
|
11656
11580
|
if (!input.yes) {
|
|
@@ -11679,7 +11603,8 @@ async function runIdeasSync(input) {
|
|
|
11679
11603
|
searchError = err;
|
|
11680
11604
|
}
|
|
11681
11605
|
const searchFailed = searchError !== void 0;
|
|
11682
|
-
for (const
|
|
11606
|
+
for (const idea of ready) {
|
|
11607
|
+
const path = idea.key;
|
|
11683
11608
|
if (!issues) {
|
|
11684
11609
|
rows.push(row(path, "fail", "the config has no `issues` provider to file it with"));
|
|
11685
11610
|
continue;
|
|
@@ -11693,17 +11618,15 @@ async function runIdeasSync(input) {
|
|
|
11693
11618
|
if (existing) key = existing.key;
|
|
11694
11619
|
else try {
|
|
11695
11620
|
({key} = await issues.create({
|
|
11696
|
-
summary:
|
|
11697
|
-
body: issueBody(
|
|
11621
|
+
summary: idea.title,
|
|
11622
|
+
body: issueBody(idea)
|
|
11698
11623
|
}));
|
|
11699
11624
|
} catch (err) {
|
|
11700
11625
|
rows.push(row(path, "fail", `could not create the issue: ${describeError(err)}`));
|
|
11701
11626
|
continue;
|
|
11702
11627
|
}
|
|
11703
11628
|
try {
|
|
11704
|
-
|
|
11705
|
-
if (current === void 0) throw new Error("the note can no longer be read");
|
|
11706
|
-
io.write(join(dir, path), writeIssueKey(current, key));
|
|
11629
|
+
await ideas.markFiled(path, key);
|
|
11707
11630
|
rows.push(row(path, "ok", `${existing ? "already filed" : "filed"} as ${key}`));
|
|
11708
11631
|
} catch (err) {
|
|
11709
11632
|
rows.push({
|