@r_masseater/msch 0.91.2 → 0.91.4

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
@@ -13690,6 +13690,7 @@ const hasDependencies = Effect.fn("hasDependencies")(function* hasDependencies(d
13690
13690
  return pipe(text, Option.flatMap(decodePackageJson), Option.flatMapNullishOr(({ dependencies }) => dependencies), Option.exists((dependencies) => !Record.isEmptyRecord(dependencies)));
13691
13691
  });
13692
13692
  const shipsDependencies = Effect.fn("shipsDependencies")(function* shipsDependencies(root, project) {
13693
+ if (project.published) return false;
13693
13694
  const files = yield* RepositoryFiles;
13694
13695
  const directory = files.join(root, project.directory);
13695
13696
  if (!(yield* files.exists(files.join(directory, PLUGIN_FILE$2)))) return false;
@@ -16601,8 +16602,8 @@ const problemsIn$11 = (entry, source) => pipe(manifestSpecifiers(source), Array$
16601
16602
  /** @internal */
16602
16603
  const uncatalogedDependencies = Effect.fn("uncatalogedDependencies")(function* uncatalogedDependencies(root) {
16603
16604
  const files = yield* RepositoryFiles;
16604
- const directories = yield* workspaceDirectories(root);
16605
- const installed = yield* pipe(directories, Effect.filter((directory) => files.exists(files.join(root, directory, PLUGIN_MANIFEST$1)).pipe(Effect.map((found) => !found))));
16605
+ const projects = yield* workspaceProjects(root);
16606
+ const installed = yield* pipe(projects, Effect.filter(({ directory, published }) => files.exists(files.join(root, directory, PLUGIN_MANIFEST$1)).pipe(Effect.map((found) => published || !found))), Effect.map(Array$1.map(({ directory }) => directory)));
16606
16607
  const listed = pipe([ROOT_DIRECTORY$2, ...installed], Array$1.map((directory) => {
16607
16608
  const name = files.join(directory, PACKAGE_JSON_FILE);
16608
16609
  return {
@@ -18038,6 +18039,9 @@ const CALLED_SKILL$1 = /`(?<name>[a-z0-9-]+:[a-z0-9-]+)`/u;
18038
18039
  const EMPTY = "";
18039
18040
  const START$1 = 0;
18040
18041
  const DIVIDER = "| --- | --- | --- |";
18042
+ const CELL_BORDER = /(?<!\\)\|/u;
18043
+ const DIVIDER_CELL = /^:?-+:?$/u;
18044
+ const TABLE_ROW = /^\|.*\|$/u;
18041
18045
  const JAPANESE_LABELS = {
18042
18046
  heading: "## スキル",
18043
18047
  header: "| 呼び出し | 使う場面 | 本体のスキル |"
@@ -18070,8 +18074,19 @@ const skillsTable = (skills, { header }) => pipe(skills, Array$1.map(rowOf), Arr
18070
18074
  DIVIDER,
18071
18075
  ...rows
18072
18076
  ], Array$1.join("\n"));
18077
+ const canonicalRow = (line) => pipe(String$1.split(CELL_BORDER)(line), Array$1.map(String$1.trim), Array$1.map(String$1.replace(DIVIDER_CELL, "---")), Array$1.join("|"));
18078
+ const canonicalLine = (inside, line) => {
18079
+ const trimmed = String$1.trim(line);
18080
+ if (!inside) return Option.some(line);
18081
+ if (String$1.isEmpty(trimmed)) return Option.none();
18082
+ if (TABLE_ROW.test(trimmed)) return Option.some(canonicalRow(trimmed));
18083
+ return Option.some(line);
18084
+ };
18085
+ const canonical = (readme) => pipe(String$1.split("\n")(readme), Array$1.mapAccum(false, (inside, line) => {
18086
+ return [(inside || String$1.includes("<!-- skills:generated -->")(line)) && !String$1.includes("<!-- /skills:generated -->")(line), canonicalLine(inside, line)];
18087
+ }), ([, lines]) => Array$1.getSomes(lines), Array$1.join("\n"));
18073
18088
  const withSkillsTable = ({ readme, table, heading }) => {
18074
- const block = `${SKILLS_START}\n${table}\n${SKILLS_END}`;
18089
+ const block = `${SKILLS_START}\n\n${table}\n\n${SKILLS_END}`;
18075
18090
  const start = String$1.indexOf(SKILLS_START)(readme);
18076
18091
  const end = String$1.indexOf(SKILLS_END)(readme);
18077
18092
  return pipe(Option.all([start, end]), Option.filter(([from, to]) => to > from), Option.match({
@@ -18089,7 +18104,7 @@ const syncReadme = Effect.fn("syncReadme")(function* syncReadme({ directory, ski
18089
18104
  table: skillsTable(skills, labels),
18090
18105
  heading: labels.heading
18091
18106
  });
18092
- if (expected === current) return [];
18107
+ if (canonical(expected) === canonical(current)) return [];
18093
18108
  yield* files.writeFile(file, expected);
18094
18109
  return [problem$2(file, `The skills table between ${SKILLS_START} and ${SKILLS_END} is generated from the SKILL.md frontmatter of the plugin. msch rewrote it; commit the result.`)];
18095
18110
  });