Skip to content

Prepare wiki-graph npm release#106

Merged
Moskize91 merged 3 commits into
mainfrom
codex/wg-primary-command
Jul 7, 2026
Merged

Prepare wiki-graph npm release#106
Moskize91 merged 3 commits into
mainfrom
codex/wg-primary-command

Conversation

@Moskize91

Copy link
Copy Markdown
Contributor

Summary

  • rename npm package metadata to wiki-graph and make wg the primary CLI command
  • keep wikigraph as the full command alias
  • update help text, docs, release smoke checks, and npm publish metadata
  • refresh EPUB fixtures to use the wiki-graph identifier

Verification

  • pnpm release:check
  • pnpm publish:dry-run

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Summary by CodeRabbit

  • Documentation

    • Updated CLI docs and help content to use wg consistently across examples, workflows, and URI guidance.
    • Clarified command usage in both English and Chinese README files.
  • Bug Fixes

    • Fixed user-facing help and error messages so they point to the correct wg command.
    • Improved generated command suggestions and “next step” prompts throughout the app.
  • New Features

    • Added support for rendering help and guidance with a configurable command name, improving consistency for different CLI entry points.

Walkthrough

This PR renames the CLI command from wikigraph/wikg to wg and rebrands the npm package from spinedigest to wiki-graph. New constants CLI_PRIMARY_COMMAND ("wg") and CLI_FULL_COMMAND ("wikigraph") centralize the naming, with a formatCliCommand helper used throughout source error messages, help-route generation, and CLI hints. Jinja help templates are parameterized with {{ commandName }} instead of hardcoded strings. package.json, ESM wrapper generation, build/smoke scripts, README files, and documentation are updated to reflect the new naming, and tests are updated to match the new expected command strings and identifiers.

Sequence Diagram(s)

Not applicable — this change is a systematic renaming/templating update across help text, error messages, and configuration rather than a new feature or control-flow change.

Possibly related PRs

  • oomol-lab/wiki-graph#90: Both PRs touch the same CLI help templates (e.g., gc.jinja, root.jinja), with this PR's wikigraphwg templating affecting the retrieved PR's new documentation.
  • oomol-lab/wiki-graph#98: Both PRs modify CLI help routing/generation, overlapping on CLI_HELP_ROUTES and related help templates.
  • oomol-lab/wiki-graph#101: Both PRs touch createGenerationPerformanceHints in src/cli/generation-planning.ts, this PR updating only the command string prefix.
🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title is related, but it does not follow the required (): format. Rewrite the title in the required format, for example: "chore(release): prepare wiki-graph npm release".
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description matches the release preparation changes and is clearly related to the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch codex/wg-primary-command

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


Comment @coderabbitai help to get the list of available commands.

@Moskize91 Moskize91 merged commit 2f918b5 into main Jul 7, 2026
2 of 3 checks passed
@Moskize91 Moskize91 deleted the codex/wg-primary-command branch July 7, 2026 12:09

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/cli/archive.ts (1)

2000-2004: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate "next page" formatting logic.

formatEvidenceNextCursor and formatNextCursor implement the same null-check-and-format pattern for "Next page: ${CLI_PRIMARY_COMMAND} next ${cursor}". Both were touched in this rename; worth consolidating into one shared helper to avoid divergence next time the message format changes.

Also applies to: 2274-2280

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli/archive.ts` around lines 2000 - 2004, The next-page cursor formatting
is duplicated between formatEvidenceNextCursor and formatNextCursor, so
consolidate the shared null-check and message construction into one helper and
have both call it. Update the renamed cursor-formatting paths in archive.ts to
reuse that common helper for the "Next page: ${CLI_PRIMARY_COMMAND} next
${cursor}" string so future message changes stay in sync.
src/cli/queue.ts (1)

300-308: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Hardcoded "wg" bypasses the centralized command constant.

This file imports formatCliCommand and uses it for watchCommand/Watch: output below, but these two error messages hardcode the literal "wg" instead of interpolating CLI_PRIMARY_COMMAND. If the primary command name changes again, these strings will silently drift out of sync with the rest of the CLI (which is exactly the maintenance problem the new constants were introduced to solve).

♻️ Proposed fix
+import { CLI_PRIMARY_COMMAND } from "../common/cli-command.js";
...
   throw new Error(
-    "Generation tasks can call an LLM, consume tokens, incur provider charges, and run for minutes to hours on large archives. Run `wg <archive-uri> inspect`, then rerun `wg wikg://local/job add` with --accept-cost if the cost and wait time are acceptable.",
+    `Generation tasks can call an LLM, consume tokens, incur provider charges, and run for minutes to hours on large archives. Run \`${CLI_PRIMARY_COMMAND} <archive-uri> inspect\`, then rerun \`${CLI_PRIMARY_COMMAND} wikg://local/job add\` with --accept-cost if the cost and wait time are acceptable.`,
   );
...
        "Knowledge Graph requires WikiSpine.",
-        "Configure `wikg://local/config/wikispine` with provider `cli` or `fetch`, then run `wg wikg://local/config/wikispine test`.",
+        `Configure \`wikg://local/config/wikispine\` with provider \`cli\` or \`fetch\`, then run \`${CLI_PRIMARY_COMMAND} wikg://local/config/wikispine test\`.`,

The same pattern (hardcoded "wg" instead of the constant) also appears in src/common/wiki-graph-uri.ts, src/facade/chapter-build.ts, src/facade/chapter.ts, and src/facade/graph.ts in this cohort.

Also applies to: 567-583

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli/queue.ts` around lines 300 - 308, The cost-acceptance error text in
assertBuildCostAccepted should stop hardcoding the primary CLI name as "wg" and
instead use the centralized command constant already available in this module,
matching the existing formatCliCommand/watchCommand usage. Update both command
references in the thrown message so they stay aligned if CLI_PRIMARY_COMMAND
changes, and apply the same constant-based replacement anywhere this file still
emits the literal primary command name.
src/facade/spine-digest.ts (1)

65-70: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consistent rename; consider centralizing the duplicated error string.

The "chapter summary is missing" message (lines 119-121) is duplicated verbatim across this file, src/output/epub/book.ts, src/output/plain-text.ts, and src/serial.ts. This PR had to hand-edit the wg prefix in all four places; extracting a small shared helper (e.g. alongside formatCliCommand) would prevent future renames/wording tweaks from drifting across files.

♻️ Example consolidation
+// e.g. in src/common/cli-command.ts
+export function chapterSummaryMissingMessage(
+  documentId: string | number,
+): string {
+  return `Chapter ${documentId} summary is missing. Run \`${formatCliCommand(
+    "wikg://local/job add --input <chapter-uri> --task reading-summary --accept-cost",
+  )}\` before export, or inspect the archive with \`${formatCliCommand(
+    "<archive-uri>/chapter/tree get",
+  )}\`.`;
+}

Also applies to: 111-121

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/facade/spine-digest.ts` around lines 65 - 70, The chapter-missing error
text is duplicated in spine-digest-related logic and the same wording is
repeated in src/output/epub/book.ts, src/output/plain-text.ts, and
src/serial.ts, so future renames like the wg prefix can drift. Extract the
shared message into a small helper near formatCliCommand and use it from the
chapter summary/missing-summary checks in spine-digest so all call sites reuse
one source of truth.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/cli/archive.ts`:
- Line 1219: The help-readiness command string is hardcoded and can drift from
the existing CLI primary command usage. Update the help mapping in archive.ts to
build the readiness help text from CLI_PRIMARY_COMMAND, matching the pattern
already used elsewhere in the file, so the command stays consistent if the
primary command changes.

---

Nitpick comments:
In `@src/cli/archive.ts`:
- Around line 2000-2004: The next-page cursor formatting is duplicated between
formatEvidenceNextCursor and formatNextCursor, so consolidate the shared
null-check and message construction into one helper and have both call it.
Update the renamed cursor-formatting paths in archive.ts to reuse that common
helper for the "Next page: ${CLI_PRIMARY_COMMAND} next ${cursor}" string so
future message changes stay in sync.

In `@src/cli/queue.ts`:
- Around line 300-308: The cost-acceptance error text in assertBuildCostAccepted
should stop hardcoding the primary CLI name as "wg" and instead use the
centralized command constant already available in this module, matching the
existing formatCliCommand/watchCommand usage. Update both command references in
the thrown message so they stay aligned if CLI_PRIMARY_COMMAND changes, and
apply the same constant-based replacement anywhere this file still emits the
literal primary command name.

In `@src/facade/spine-digest.ts`:
- Around line 65-70: The chapter-missing error text is duplicated in
spine-digest-related logic and the same wording is repeated in
src/output/epub/book.ts, src/output/plain-text.ts, and src/serial.ts, so future
renames like the wg prefix can drift. Extract the shared message into a small
helper near formatCliCommand and use it from the chapter summary/missing-summary
checks in spine-digest so all call sites reuse one source of truth.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 39801459-e701-4fbd-be7b-ad2b12849607

📥 Commits

Reviewing files that changed from the base of the PR and between 85108f6 and 983182f.

📒 Files selected for processing (64)
  • README.md
  • README_zh-CN.md
  • data/help/commands/archive/next.jinja
  • data/help/commands/gc.jinja
  • data/help/commands/legacy.jinja
  • data/help/commands/legacy/migrate.jinja
  • data/help/commands/maintenance/chapter.jinja
  • data/help/commands/maintenance/chapter/add.jinja
  • data/help/commands/maintenance/chapter/list.jinja
  • data/help/commands/maintenance/chapter/move.jinja
  • data/help/commands/maintenance/chapter/remove.jinja
  • data/help/commands/maintenance/chapter/reset.jinja
  • data/help/commands/maintenance/chapter/set-source.jinja
  • data/help/commands/maintenance/chapter/set-summary.jinja
  • data/help/commands/maintenance/chapter/set-title.jinja
  • data/help/commands/maintenance/chapter/tree.jinja
  • data/help/commands/maintenance/cover.jinja
  • data/help/commands/maintenance/meta.jinja
  • data/help/commands/predicate.jinja
  • data/help/commands/root.jinja
  • data/help/commands/transform.jinja
  • data/help/commands/uri.jinja
  • data/help/topics/config.jinja
  • data/help/topics/format.jinja
  • data/help/topics/readiness.jinja
  • data/help/topics/recipe.jinja
  • data/help/topics/runtime.jinja
  • data/help/topics/uri.jinja
  • docs/wikispine-runtime.md
  • package.json
  • scripts/generate-test-fixtures.mjs
  • scripts/smoke-pack-install.mjs
  • scripts/write-esm-wrappers.mjs
  • src/cli/archive.ts
  • src/cli/args.ts
  • src/cli/errors.ts
  • src/cli/generation-planning.ts
  • src/cli/help.ts
  • src/cli/local-config.ts
  • src/cli/queue.ts
  • src/cli/shell.ts
  • src/common/cli-command.ts
  • src/common/wiki-graph-uri.ts
  • src/facade/chapter-build.ts
  • src/facade/chapter.ts
  • src/facade/graph.ts
  • src/facade/spine-digest.ts
  • src/output/epub/book.ts
  • src/output/plain-text.ts
  • src/serial.ts
  • src/wikipage/resolver.ts
  • test/cli/archive.test.ts
  • test/cli/args.test.ts
  • test/cli/config.test.ts
  • test/cli/convert.test.ts
  • test/cli/llm.test.ts
  • test/cli/local-config.test.ts
  • test/cli/main.test.ts
  • test/cli/queue.test.ts
  • test/cli/shell.test.ts
  • test/fixtures/sources/sample-observatory-guide-encrypted.epub
  • test/fixtures/sources/sample-observatory-guide-mixed.epub
  • test/fixtures/sources/sample-observatory-guide.epub
  • test/source/epub-source-adapter.test.ts

Comment thread src/cli/archive.ts
improvements,
performanceHints,
help: { readiness: "wikigraph help readiness" },
help: { readiness: "wg help readiness" },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Inconsistent literal vs. CLI_PRIMARY_COMMAND constant.

This file already imports CLI_PRIMARY_COMMAND (Line 44) and uses it elsewhere (Lines 2003, 2279, 2910), but this help-readiness string is hardcoded as "wg help readiness". If the primary command ever changes again, this line will silently drift out of sync.

diff
-    help: { readiness: "wg help readiness" },
+    help: { readiness: `${CLI_PRIMARY_COMMAND} help readiness` },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
help: { readiness: "wg help readiness" },
help: { readiness: `${CLI_PRIMARY_COMMAND} help readiness` },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli/archive.ts` at line 1219, The help-readiness command string is
hardcoded and can drift from the existing CLI primary command usage. Update the
help mapping in archive.ts to build the readiness help text from
CLI_PRIMARY_COMMAND, matching the pattern already used elsewhere in the file, so
the command stays consistent if the primary command changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant