docs: add SDK dependency map generator and sync tooling#662
docs: add SDK dependency map generator and sync tooling#662ciscoRankush wants to merge 6 commits intowebex:nextfrom
Conversation
Add automated SDD documentation drift detection tooling: - /spec-drift: full scan command for validating all ai-docs against source code - /spec-drift-changed: incremental scan for changed files only - Pre-commit hook to block commits when ai-docs drift is unverified Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Register hook in settings.json (was dead code without it) - Fail-closed when python3 unavailable or JSON parse fails - Use content-based hash (git diff --cached) instead of path-only hash - Don't consume marker in PreToolUse — invalidated naturally by content changes - Precise case pattern to avoid matching git commit-tree - Add shasum/sha256sum portability fallback - Fix "Task tool" → "Agent tool" references in command files - Add agent timeout handling rule - Add staged-only content note for verification marker - Make widget path mappings dynamic instead of hardcoded - Label inventory as example - Document advisory-only nature of verification Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add cross-repo SDK synchronization tooling for detecting and tracking SDK API changes across the consumer codebase. - scripts/generate-sdk-deps.ts: scans all SDK imports, traces to file+line - sdk-dependencies.yaml: generated dependency map for @webex/contact-center - .claude/commands/sync-sdk.md: /sync-sdk skill for impact reports - .claude/hooks/check-sdk-version-change.sh: notifies on SDK version change - .sdk-cache/: cached manifest for version-to-version diffing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
💡 Codex Reviewwidgets/.github/workflows/pull-request.yml Lines 71 to 73 in dc755f4 This workflow runs on widgets/scripts/generate-sdk-deps.ts Lines 283 to 285 in dc755f4 Method usage detection only records calls whose expression starts with the imported identifier ( Lines 3 to 7 in dc755f4 The new ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Add usage instructions for SDK dependency tracking and /sync-sdk skill, including mandatory API verification steps for AI agents. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ca127a0b12
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (callText.startsWith(localName + '.')) { | ||
| const methodName = callText.replace(localName + '.', '').split('(')[0]; |
There was a problem hiding this comment.
Track SDK calls on instance variables
The method detector only records calls whose callee text starts with the imported symbol (for example Webex.), so it misses SDK calls made through derived instances like webex.once(...) and this.cc.register() in packages/contact-center/store/src/store.ts. That creates false negatives in sdk-dependencies.yaml, so /sync-sdk can report no impacted files even when a breaking SDK method change affects runtime code.
Useful? React with 👍 / 👎.
scripts/generate-sdk-deps.ts
Outdated
| const SCAN_DIRS = [ | ||
| 'packages/contact-center', | ||
| ]; |
There was a problem hiding this comment.
Scan all SDK consumer directories
The scanner is hardcoded to packages/contact-center, but this repo also has SDK consumers outside that path (for example widgets-samples/cc/samples-cc-react-app/src/App.tsx imports @webex/contact-center). As a result, the generated dependency map is incomplete and the sync report can understate affected files when SDK APIs change.
Useful? React with 👍 / 👎.
| "hooks": { | ||
| "PreToolUse": [ | ||
| { | ||
| "matcher": "Bash", | ||
| "hooks": [".claude/hooks/check-ai-docs-drift.sh"] |
There was a problem hiding this comment.
Wire PostToolUse SDK hook in settings
The commit adds .claude/hooks/check-sdk-version-change.sh, but .claude/settings.json only registers a PreToolUse hook and never registers any PostToolUse hook. That means SDK version-change reminders never run when package.json is edited, so the documented /sync-sdk safeguard is effectively disabled.
Useful? React with 👍 / 👎.
The .sdk-cache/ directory is a local dev cache for SDK manifest diffing. Each developer's cache reflects when they last ran /sync-sdk. It should not be committed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0c2041100
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (callText.startsWith(importName + '.')) { | ||
| const methodName = callText.replace(importName + '.', '').split('(')[0]; | ||
| const callLine = call.getStartLineNumber(); | ||
| const qualifiedName = `default.${methodName}`; |
There was a problem hiding this comment.
Use canonical method keys for default-import calls
Record default-import calls under the SDK API name instead of default.*: this branch currently emits keys like default.init (see generated sdk-dependencies.yaml), but manifest-derived method changes are keyed as SDK names (for example Webex.init/init). When /sync-sdk cross-references manifest changes to dependency-map keys, these call sites can be missed, so a breaking change to Webex.init may incorrectly report no impacted consumers.
Useful? React with 👍 / 👎.
scripts/generate-sdk-deps.ts
Outdated
| const matchedSdk = TRACKED_SDKS.find((sdk) => | ||
| moduleSpecifier === sdk || moduleSpecifier.startsWith(sdk + '/') |
There was a problem hiding this comment.
Recognize node_modules-prefixed SDK import specifiers
Broaden the module-specifier match beyond @webex/contact-center and @webex/contact-center/...: current logic skips imports written as node_modules/@webex/contact-center/... (for example in packages/contact-center/store/src/store.types.ts), so those SDK types never enter sdk-dependencies.yaml. This creates false negatives in impact reports when those imported SDK definitions change.
Useful? React with 👍 / 👎.
Replace separate TRACKED_SDKS and SCAN_DIRS arrays with a single SDK_CONFIG array where each entry has package, scanDirs, and localManifestPath. Adding a new SDK dependency now requires one config entry instead of changes in multiple places. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
COMPLETES #N/A (new tooling initiative — companion to webex-js-sdk PR #4800)
This pull request addresses
The consumer side of cross-repo SDK synchronization. When SDK APIs change in
@webex/contact-center, ccWidgets needs to know exactly which files and line numbers are affected. Currently there is no automated way to detect impact of SDK changes on the consumer codebase.by making the following changes
scripts/generate-sdk-deps.ts: ts-morph based scanner that analyzes all@webex/contact-centerimports across the monorepo and maps each SDK API (methods, types, events) to exact consumer file paths and line numbers.sdk-dependencies.yaml: Auto-generated dependency map tracking 26 types, 1 method call, and 34 total import usages.scripts/tsconfig.json: Node-specific TypeScript config for scripts..claude/commands/sync-sdk.md:/sync-sdkClaude Code skill that diffs SDK manifests and produces impact reports..claude/hooks/check-sdk-version-change.sh: PostToolUse hook reminding developers to run/sync-sdkon SDK version changes..sdk-cache/: Cached previous SDK manifest for version-to-version diffing.Key capabilities:
Change Type
The following scenarios were tested
npx ts-node --project scripts/tsconfig.json scripts/generate-sdk-deps.ts— generatessdk-dependencies.yamltracking 26 types, 1 method, 34 importsThe GAI Coding Policy And Copyright Annotation Best Practices
Checklist before merging