Skip to content

feat(workspace-id): workspace-id を mutils から独立プラグインへ分離#68

Open
masseater wants to merge 2 commits into
masterfrom
feat/extract-workspace-id-plugin
Open

feat(workspace-id): workspace-id を mutils から独立プラグインへ分離#68
masseater wants to merge 2 commits into
masterfrom
feat/extract-workspace-id-plugin

Conversation

@masseater
Copy link
Copy Markdown
Owner

@masseater masseater commented May 22, 2026

Summary

  • mutils 内の workspace-id スキルと workspace-id-persist フックを、新規 workspace-id プラグインへ分離。進捗管理系の機能をプラグイン単位で取捨選択(導入可否)できるようにする
  • workspace-id フォーマット判定(isValidFeatureName / parseWorkspaceId)を @r_masseater/cc-plugin-lib に集約。mutils(ccs-handoff) と新プラグインが単一定義を共有し、プラグイン跨ぎのコード重複を排除
  • スキル移設に伴う参照更新(mutils:workspace-idworkspace-id

変更詳細

対象 内容
新規 plugins/workspace-id/ skill workspace-id + hook workspace-id-persist 一式
mutils workspace-id 関連を削除、cc-plugin-lib 0.0.5 参照、plugin.json 0.20.0→0.21.0
cc-plugin-lib src/workspace-id.ts(+ テスト)追加、0.0.40.0.5
diagram-render draw-diagram SKILL.md の参照更新 + plugin.json 0.0.6→0.0.7(repository-lint の require-version-bump 対応)

リリース上の注意

monorepo(dev / CI)は workspace リンクで解決されるため green。ただしプラグインを 単体配布 する場合、@r_masseater/cc-plugin-lib@0.0.5 の npm 公開が前提となる。マージ後に cc-plugin-lib をリリースし、公開バージョンへプラグインの依存を揃える follow-up が必要。

関連 issue: gh issue list で検索したが該当なし。

Test plan

  • turbo typecheck / turbo check 全 workspace green
  • turbo test — cc-plugin-lib(workspace-id.test.ts 含む)/ mutils / ops-harbor 系すべて pass
  • knip / check:lockfile / check:plugin-list / check:docs(0 errors)
  • CI green 確認

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added standalone workspace-id plugin for workspace directory naming conventions and auto-compact/resume restoration
    • Exported workspace validation functions from the shared library
  • Updates

    • Updated diagram-render plugin to version 0.0.7
    • Updated mutils plugin to version 0.21.0 with reorganized hook configuration
    • Updated internal hook dependencies for workspace management
  • Documentation

    • Updated workspace references across plugin documentation

Review Change Stack

masseater and others added 2 commits May 22, 2026 12:45
mutils 内の workspace-id スキルと workspace-id-persist フックを、新規
workspace-id プラグインへ移設する。進捗管理系の機能をプラグイン単位で
切り離せるようにし、利用者がプラグイン導入の可否で取捨選択できる状態にする。

workspace-id フォーマットの判定ロジックは cc-plugin-lib へ集約し、mutils の
ccs-handoff と新プラグインの双方が単一の定義を共有する(プラグイン跨ぎの
コード重複を排除)。

- cc-plugin-lib: isValidFeatureName / parseWorkspaceId を追加、0.0.5 へ
- mutils: workspace-id 関連を削除、cc-plugin-lib 0.0.5 を参照、version 0.21.0

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
draw-diagram スキルの workspace-id 参照更新に伴い、repository-lint の
require-version-bump ルールに従って plugin.json を 0.0.7 へ更新する。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

Walkthrough

This PR extracts workspace-id validation and persistence logic from mutils into a shared library and standalone plugin. A new workspace-id plugin provides centralized directory naming conventions and auto-compact/resume restoration, while packages/cc-plugin-lib exports reusable parsing functions. Mutils is updated to depend on the shared library, removing duplicate code and updating its hook chain.

Changes

Workspace-ID Library and Plugin Migration

Layer / File(s) Summary
Shared library for workspace-id validation and parsing
packages/cc-plugin-lib/src/workspace-id.ts, packages/cc-plugin-lib/src/workspace-id.test.ts, packages/cc-plugin-lib/src/index.ts, packages/cc-plugin-lib/package.json
isValidFeatureName and parseWorkspaceId are added to the library with regex-based validation for kebab-case feature names and yyyyMMdd-HHmm-<feature-name> workspace-id patterns; tests validate accept/reject cases and parsing behavior; library version bumped to 0.0.5 and functions re-exported from package entrypoint.
New workspace-id plugin with hooks and documentation
plugins/workspace-id/plugin.json, plugins/workspace-id/package.json, plugins/workspace-id/tsconfig.json, plugins/workspace-id/.oxlintrc.json, plugins/workspace-id/hooks/hooks.json, plugins/workspace-id/skills/workspace-id/generate.ts, plugins/workspace-id/README.md, plugins/workspace-id/AGENTS.md, plugins/workspace-id/CLAUDE.md
A new standalone workspace-id plugin (v0.0.1) defines directory naming conventions and restores workspace-id on SessionStart via the workspace-id-persist hook; includes manifests, TypeScript configuration, lint/typecheck scripts, skill implementation importing from shared library, and full documentation (marketplace-ready README, development guide, Claude integration).
Update mutils to use shared library and remove duplicate code
plugins/mutils/skills/ccs-handoff/ccs-handoff.ts, plugins/mutils/package.json, plugins/mutils/plugin.json, plugins/mutils/hooks/hooks.json, plugins/mutils/README.md, plugins/mutils/AGENTS.md
Mutils dependency on cc-plugin-lib updated to 0.0.5; parseWorkspaceId import redirected from local patterns.js to shared library; SessionStart hook chain modified to replace workspace-id-persist with check-context-version; mutils version bumped to 0.21.0; documentation updated to reflect removed workspace-id-persist hook and expanded hook list.
Update project configuration, marketplace, and rules
.claude/rules/ai-generated/project-context.md, .claude-plugin/marketplace.json, plugins/diagram-render/plugin.json, plugins/diagram-render/skills/draw-diagram/SKILL.md, AGENTS.md, knip.json
Project context rules updated to reference workspace-id skill instead of mutils:workspace-id prefix; marketplace metadata adds workspace-id plugin entry (v0.0.1) and bumps diagram-render to 0.0.7 and mutils to 0.21.0; diagram-render skill documentation switched to reference standalone workspace-id skill; root AGENTS.md adds workspace-id plugin entry; knip.json configured with plugins/workspace-id workspace entry points.

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly Related PRs

  • masseater/claude-code-plugin#20: Replaces the mutils-based workspace-id persistence by introducing a new plugins/workspace-id implementation that removes the workspace-id-persist hook from mutils and restores workspace-id on Auto Compact/resume.
  • masseater/claude-code-plugin#10: Both PRs expand the shared library packages/cc-plugin-lib/src/index.ts public API surface by re-exporting new validation and utility functions.

🐰 A workspace once split across two homes
Now lives as one, in shared lib tomes
The workspace-id hops with grace
From mutils to its proper place
Kebab-case dreams, restored with ease!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: extracting the workspace-id skill and hook from mutils into a standalone plugin, enabling modular feature adoption.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/extract-workspace-id-plugin

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: private package registry requires authentication. Disable ESLint in CodeRabbit settings or use public packages.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 (1)
plugins/workspace-id/skills/workspace-id/generate.ts (1)

57-59: ⚡ Quick win

Consider logging DB persistence failures.

The empty catch block silently ignores all DB errors. While the comment explains this is intentional, it may hide configuration issues or permission problems that would be useful to debug.

📝 Suggested improvement to add minimal error logging
-    } catch {
+    } catch (err) {
       // Fail silently - workspace-id generation should still work
+      process.stderr.write(`Warning: Failed to persist workspace-id to DB: ${err}\n`);
     }
🤖 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 `@plugins/workspace-id/skills/workspace-id/generate.ts` around lines 57 - 59,
The empty catch in plugins/workspace-id/skills/workspace-id/generate.ts swallows
DB persistence errors; change it to log a minimal error message with the caught
exception so failures are visible but do not interrupt workspace-id generation
(e.g., in the catch block after the DB write, call console.warn or the module's
logger with a short contextual message like "workspace-id DB persistence failed"
and include the error object). Ensure you only add logging and do not rethrow so
the existing behaviour of continuing generation remains.
🤖 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 `@plugins/workspace-id/package.json`:
- Around line 10-13: The package.json in the workspace-id plugin is missing the
required prerequisite dependency mutils; update the "dependencies" object in
plugins/workspace-id/package.json to include "mutils" (the repository
prerequisite) alongside "`@r_masseater/cc-plugin-lib`" and "cc-hooks-ts" so the
plugin declares mutils as a dependency; ensure the version spec matches the repo
convention used by other plugins (e.g., same version string format used in other
plugins' package.json).

---

Nitpick comments:
In `@plugins/workspace-id/skills/workspace-id/generate.ts`:
- Around line 57-59: The empty catch in
plugins/workspace-id/skills/workspace-id/generate.ts swallows DB persistence
errors; change it to log a minimal error message with the caught exception so
failures are visible but do not interrupt workspace-id generation (e.g., in the
catch block after the DB write, call console.warn or the module's logger with a
short contextual message like "workspace-id DB persistence failed" and include
the error object). Ensure you only add logging and do not rethrow so the
existing behaviour of continuing generation remains.
🪄 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: 4297e0c6-3154-45f8-a308-7cb61bbbb0b3

📥 Commits

Reviewing files that changed from the base of the PR and between fc705af and 408259d.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (28)
  • .claude-plugin/marketplace.json
  • .claude/rules/ai-generated/project-context.md
  • AGENTS.md
  • knip.json
  • packages/cc-plugin-lib/package.json
  • packages/cc-plugin-lib/src/index.ts
  • packages/cc-plugin-lib/src/workspace-id.test.ts
  • packages/cc-plugin-lib/src/workspace-id.ts
  • plugins/diagram-render/plugin.json
  • plugins/diagram-render/skills/draw-diagram/SKILL.md
  • plugins/mutils/AGENTS.md
  • plugins/mutils/README.md
  • plugins/mutils/hooks/hooks.json
  • plugins/mutils/package.json
  • plugins/mutils/plugin.json
  • plugins/mutils/skills/ccs-handoff/ccs-handoff.ts
  • plugins/mutils/skills/workspace-id/patterns.ts
  • plugins/workspace-id/.oxlintrc.json
  • plugins/workspace-id/AGENTS.md
  • plugins/workspace-id/CLAUDE.md
  • plugins/workspace-id/README.md
  • plugins/workspace-id/hooks/entry/workspace-id-persist.ts
  • plugins/workspace-id/hooks/hooks.json
  • plugins/workspace-id/package.json
  • plugins/workspace-id/plugin.json
  • plugins/workspace-id/skills/workspace-id/SKILL.md
  • plugins/workspace-id/skills/workspace-id/generate.ts
  • plugins/workspace-id/tsconfig.json
💤 Files with no reviewable changes (4)
  • plugins/mutils/AGENTS.md
  • plugins/mutils/hooks/hooks.json
  • plugins/mutils/skills/workspace-id/patterns.ts
  • plugins/mutils/README.md

Comment on lines +10 to +13
"dependencies": {
"@r_masseater/cc-plugin-lib": "0.0.5",
"cc-hooks-ts": "2.1.94"
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add the required mutils prerequisite dependency.

Line 10–Line 13 define plugin dependencies, but the required mutils prerequisite is missing. Please add the repository’s mutils package as the mandated prerequisite dependency for this plugin.

As per coding guidelines plugins/**/package.json: All plugins must have mutils as a prerequisite dependency.

🤖 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 `@plugins/workspace-id/package.json` around lines 10 - 13, The package.json in
the workspace-id plugin is missing the required prerequisite dependency mutils;
update the "dependencies" object in plugins/workspace-id/package.json to include
"mutils" (the repository prerequisite) alongside "`@r_masseater/cc-plugin-lib`"
and "cc-hooks-ts" so the plugin declares mutils as a dependency; ensure the
version spec matches the repo convention used by other plugins (e.g., same
version string format used in other plugins' package.json).

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