Repository navigation
feat(sdk): own schema primitives and modernize init prefixes - #563
Conversation
Move the complete schema inspection and mutation engine into the public SDK while retaining a thin CLI compatibility adapter. Burn 17 private-core import edges and tighten the ESLint suppression ratchet from 174 to 170. Add canonical pm init --id-prefix support with --prefix alias, deterministic positional conflict handling, shell completions, runtime contracts, docs, tracker evidence, and packed-consumer coverage. Verified 5,701 tests at 100/100/100/100 coverage, strict static/docstring/package/token gates, contracts, security/version checks, packed npm smoke, 88-command dogfood, and fresh temporary-workspace SDK/CLI acceptance.
There was a problem hiding this comment.
Sorry @unbraind, your pull request is larger than the review limit of 150000 diff characters
|
@greptileai please review the current head. |
|
/gemini review |
|
@coderabbitai full review |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 59 minutes. |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
📝 WalkthroughWalkthroughThis PR adds ChangesInit ID-prefix support
SDK schema ownership
Project tracking reconciliation
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Greptile SummaryThis PR moves schema ownership into the SDK and adds explicit init prefix flags. The main changes are:
Confidence Score: 5/5This looks safe to merge. No blocking issues found in the changed code. No files need attention.
What T-Rex did
Important Files Changed
Reviews (6): Last reviewed commit: "fix(init): reject drive-relative prefix ..." | Re-trigger Greptile |
Greptile SummaryThis PR moves schema ownership into the SDK and adds a flag-based init prefix path. The main changes are:
Confidence Score: 4/5The changed CLI parsing path needs attention before merging.
src/cli/register-setup.ts
What T-Rex did
Important Files Changed
Prompt To Fix All With AIFix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
src/cli/register-setup.ts:1036
**Init Prefix Value Is Dropped**
When `pm init --prefix ops` is parsed, the option value is stored under the `prefix` option name while `runInitCommandAction` only forwards `options.idPrefix`. That makes the new alias silently fall back to the default or positional prefix, so the initialized tracker can use the wrong item ID prefix.
Reviews (2): Last reviewed commit: "feat(sdk): make schema ownership SDK-fir..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/sdk/schema.ts`:
- Around line 576-581: Replace the duplicated tracker-initialization checks in
runSchemaAddType and loadSchemaInspectionContext with calls to the shared
ensureInitialized(pmRoot) helper. Preserve the existing error behavior by
keeping ensureInitialized as the single implementation of the pathExists check,
message, and EXIT_CODE.NOT_FOUND handling.
- Around line 702-706: Extract the repeated warning deduplication and
locale-aware sorting into a shared finalizeWarnings(warnings: string[]):
string[] helper in the schema module, then replace the inline expressions in all
eight run* mutation functions with calls to that helper while preserving the
existing generated_at handling and warning semantics.
🪄 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: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 2b41f620-f1e5-4948-9244-f99e3a03a605
📒 Files selected for processing (28)
.agents/pm/chores/pm-2a9n.toon.agents/pm/epics/pm-qwoy.toon.agents/pm/features/pm-3mna.toon.agents/pm/history/pm-2a9n.jsonl.agents/pm/history/pm-3mna.jsonl.agents/pm/history/pm-9x6e.jsonl.agents/pm/history/pm-nmzx.jsonl.agents/pm/history/pm-qwoy.jsonl.agents/pm/issues/pm-nmzx.toon.agents/pm/tasks/pm-9x6e.toonCHANGELOG.mddocs/COMMANDS.mddocs/SDK.mdeslint-suppressions.jsonscripts/release/sdk-import-boundary-baseline.jsonscripts/release/static-quality-gate.mjssrc/cli/commands/completion.tssrc/cli/commands/init.tssrc/cli/commands/schema.tssrc/cli/register-setup.tssrc/sdk/cli-contracts/flag-contracts.tssrc/sdk/runtime.tssrc/sdk/schema.tstests/fixtures/contracts/full.jsontests/integration/init-path-guard.integration.spec.tstests/unit/commands/completion-command.spec.tstests/unit/commands/init-command.spec.tstests/unit/mcp/mcp-server-branch-residual.spec.ts
💤 Files with no reviewable changes (2)
- scripts/release/sdk-import-boundary-baseline.json
- eslint-suppressions.json
Reject path-like --id-prefix values with structured recovery guidance, centralize schema initialization checks, and deduplicate stable warning finalization across all mutation results. Record round-one Greptile and CodeRabbit decisions in pm, including evidence that the --prefix alias is correctly forwarded. Verified focused tests, static quality, and all 5,701 tests at exact 100/100/100/100 coverage.
|
@greptileai please review the updated current head 8b2f6a2. |
|
/gemini review |
|
@coderabbitai full review |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 35 minutes. |
Treat Windows drive-relative values such as C:tracker as path-shaped init input, keep structured error guidance consistent across platforms, and add unit plus built-CLI integration coverage. Record the second PR review round and exact 100/100/100/100 repository coverage in pm-nmzx before closing and releasing the actively worked item.
|
@greptileai please review updated current head 4c2786c. |
|
/gemini review |
|
@coderabbitai full review |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
✅ Action performedFull review finished. Your plan includes PR reviews subject to rate limits. More reviews will be available in 17 minutes. |
|
Acknowledged @gemini-code-assist: this final-head request is quota-limited, so no Gemini finding was available to act on. The exact head is covered by the complete local and hosted gates plus the completed Greptile and CodeRabbit surfaces. |
|
Acknowledged @coderabbitai: the final-head review completed without a new inline finding. All earlier actionable threads were addressed, answered, and resolved on commit 4c2786c. |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Tip For best results, initiate chat on the files or code changes.
|
|
Acknowledged final automated status comments 4974028895 and 4974030496: the quota notice introduces no actionable finding, and the chat-usage tip likewise requires no code change. Both were read and positively reacted to; the exact-head review inventory has zero unresolved threads. |
Summary
src/sdk/schema.ts, leaving the CLI command as a compatibility re-export and routing SDK/MCP runtime dispatch through the SDK ownerpm init --id-prefix <value>with--prefixalias, positional compatibility, equivalent-input normalization, deterministic conflict guidance, contracts, bash/zsh/fish completion, and docspm-changelog@2026.7.14-2pm items
Verification
node scripts/run-tests.mjs coverage: 290 files, 5,701 tests, exact 100% statements (36,848/36,848), branches (26,463/26,463), functions (7,438/7,438), and lines (35,963/35,963)pnpm typecheck,pnpm lint:eslint,pnpm lint:duplicates,pnpm quality:static,pnpm quality:docs-skills,pnpm contracts:checkpnpm security:scan,pnpm audit --audit-level high,pnpm version:checkvcs-workspace, registered a customChangeSettype through the installed CLI, and created/read it through installedPmClientfinish_error_rate_pct=0.34, zero failures missingerror_code); strict Sentry release readiness remains independently blocked by the already tracked external integration issues pm-d4ns / PM-CLI-2B and pm-7n5a / PM-CLI-29, neither introduced or modified by this branchSummary by cubic
Moves schema inspection and mutation into SDK-owned primitives and adds canonical
--id-prefix/--prefixtopm initwith robust, cross‑platform validation. This reduces CLI/MCP coupling and fixes the init prefix UX.Refactors
src/sdk/schema.ts; the CLIschemacommand is a thin adapter and CLI/MCP calls route through the SDK for consistent behavior.Bug Fixes
pm init --id-prefixwith--prefixalias. Accepts flag or positional input; rejects path-like values (including Windows drive-relative likeC:tracker) and conflicting inputs with clear guidance. Updated shell completions, runtime flag contracts, and docs.Written for commit 4c2786c. Summary will update on new commits.