@theholocron/cli 5.0.0-alpha.398 → 5.0.0-alpha.399

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/dist/cli.mjs CHANGED
@@ -11739,7 +11739,9 @@ function resolveIdeasProvider(resolved, env) {
11739
11739
  * the step run once. An idea with attachments is reported and skipped, since an issue body cannot carry them. Only
11740
11740
  * ideas to be filed, and ideas that need the person's attention, get a row; the rest are counted. The issue body ends
11741
11741
  * with a hidden `<!-- holocron:idea <key> -->` line, and an issue that carries it is reused instead of making a second
11742
- * one (found with `Issues.search`, the recent issues only). It never deletes anything, and an idea it cannot file is a
11742
+ * one (found with one `Issues.search({ text })` per note about to be filed, confirmed by the exact marker in the body;
11743
+ * GitHub searches its 2000 most recently updated issues, so an older one is still missed, and each search uses rate
11744
+ * limit). It never deletes anything, and an idea it cannot file is a
11743
11745
  * failing row (the run goes on). It writes, so it asks first unless `--dry-run` or `--yes` (without a terminal it refuses instead).
11744
11746
  */
11745
11747
  /** The state that files a note when the config names none. */
@@ -11758,8 +11760,12 @@ const row = (id, status, detail) => ({
11758
11760
  const marker = (key) => `<!-- holocron:idea ${key} -->`;
11759
11761
  /** The issue's body: the idea's text, the line that traces the issue to its idea, and the hidden marker. */
11760
11762
  const issueBody = (idea) => `${idea.body.trim()}\n\nFiled from idea: ${idea.title}\n${marker(idea.key)}`;
11761
- /** How many recent issues are searched for the marker (the narrowest existing method, `Issues.search`). */
11762
- const SEARCH_LIMIT = 100;
11763
+ /**
11764
+ * How many text matches are read back per note; the exact marker is then checked in each body. The search itself is
11765
+ * bounded by the provider: GitHub pages up to 2000 recent issues (20 pages of 100) and filters them client-side, so an
11766
+ * issue older than that is still missed, and each search spends rate limit. Linear filters on the server.
11767
+ */
11768
+ const SEARCH_LIMIT = 20;
11763
11769
  async function runIdeasSync(input) {
11764
11770
  /* v8 ignore next -- the console is only used outside tests, which inject `print` */
11765
11771
  const print = input.print ?? ((line) => console.log(line));
@@ -11828,26 +11834,23 @@ async function runIdeasSync(input) {
11828
11834
  await loader.load();
11829
11835
  assertPluginsResolvable$1(loader, "ideas sync");
11830
11836
  const issues = loader.has("issues") ? loader.get("issues") : void 0;
11831
- let recent = [];
11832
- let searchError;
11833
- if (issues) try {
11834
- recent = await issues.search({ limit: SEARCH_LIMIT });
11835
- } catch (err) {
11836
- searchError = err;
11837
- }
11838
- const searchFailed = searchError !== void 0;
11839
11837
  for (const idea of ready) {
11840
11838
  const path = idea.key;
11841
11839
  if (!issues) {
11842
11840
  rows.push(row(path, "fail", "the config has no `issues` provider to file it with"));
11843
11841
  continue;
11844
11842
  }
11845
- if (searchFailed) {
11846
- rows.push(row(path, "fail", `could not check for an existing issue, so none was created: ${describeError(searchError)}`));
11843
+ let existing;
11844
+ try {
11845
+ existing = (await issues.search({
11846
+ text: marker(path),
11847
+ limit: SEARCH_LIMIT
11848
+ })).find((issue) => issue.body?.includes(marker(path)));
11849
+ } catch (err) {
11850
+ rows.push(row(path, "fail", `could not check for an existing issue, so none was created: ${describeError(err)}`));
11847
11851
  continue;
11848
11852
  }
11849
11853
  let key;
11850
- const existing = recent.find((issue) => issue.body?.includes(marker(path)));
11851
11854
  if (existing) key = existing.key;
11852
11855
  else try {
11853
11856
  ({key} = await issues.create({