Repository navigation
feat(sdk): own workspace customization and author provenance - #565
Conversation
Move config, profile, init, guidance, templates, and command rendering into public SDK ownership while preserving CLI compatibility adapters. Add reusable CLI construction, invocation-wide author scoping, non-empty init defaults, and append-only history provenance diagnostics across health and validate. Ratchet 54 CLI-to-core boundary edges, document the composition contract, preserve exact 100% all-source coverage, and record packed-install, dogfood, security, telemetry, and live tracker evidence for pm-3mna and pm-cpja.
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 complete 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! |
1 similar comment
|
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. |
📝 WalkthroughWalkthroughThe PR promotes configuration, initialization, profile, and extension implementations into the SDK, retains CLI compatibility through re-exports, adds global author attribution and unknown-history diagnostics, strengthens extension installation locking, and updates tests, documentation, quality gates, and PM tracking records. ChangesSDK ownership and author attribution
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant SDK
participant Storage
participant Extensions
CLI->>SDK: invoke config, init, profile, or extension command
SDK->>Storage: read or update settings, schemas, and managed state
SDK->>Extensions: load hooks or install bundled packages when requested
Extensions-->>SDK: return lifecycle results and warnings
SDK-->>CLI: return structured result or rendered output
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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 |
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| JavaScript | Jul 15, 2026 4:57a.m. | Review ↗ | |
| Shell | Jul 15, 2026 4:57a.m. | Review ↗ | |
| Secrets | Jul 15, 2026 4:57a.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
Merging this PR will degrade performance by 0.01%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Greptile SummaryThis PR moves workspace customization and author provenance into the public SDK. The main changes are:
Confidence Score: 5/5This looks safe to merge. No blocking issues found in the changed code.
What T-Rex did
Important Files Changed
Reviews (20): Last reviewed commit: "docs(pm): close SDK customization delive..." | Re-trigger Greptile |
Greptile SummaryThis PR moves workspace customization into the public SDK. The main changes are:
Confidence Score: 4/5The changed CLI author path needs a small fix before merging. Bare src/sdk/cli-program.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/sdk/cli-program.ts:51
**Bare Author Is Ignored**
When a caller passes `--author` without a value, Commander accepts the optional flag and stores a boolean instead of a string. The bootstrap path also applies no override, so the mutation silently falls back to `PM_AUTHOR`, `author_default`, or `unknown` instead of rejecting the malformed provenance input.
Reviews (1): Last reviewed commit: "feat(sdk): own workspace customization a..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 8
🤖 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/cli-contracts/flag-contracts.ts`:
- Line 119: Align required-argument parsing for --author across all affected
sites: in src/sdk/cli-contracts/flag-contracts.ts lines 119-119, define the flag
with the <id> placeholder; in src/cli/bootstrap-args.ts lines 26-28, make
consumesBootstrapAuthorValue return true for any string next token, including
values beginning with "-"; and in tests/unit/sdk/author-attribution.spec.ts
lines 137-144, update flagFollowingAuthor to expect author "--json" and json
false.
In `@src/sdk/command-line.ts`:
- Around line 15-18: Update renderPmCommand to return exactly "pm" when argv is
empty, while preserving the existing quoted-and-joined argument rendering for
non-empty argv values.
In `@src/sdk/config.ts`:
- Around line 1041-1053: Update the activityLimit validation in the options
handling around ctx.activity_limit, including the corresponding logic at the
additionally noted range, to reject values with non-numeric trailing characters
by validating the complete trimmed string rather than relying only on parseInt.
Require the resulting value to be a safe positive integer before updating
ctx.activity_limit or changed.
In `@src/sdk/init-agent-guidance.ts`:
- Around line 376-385: Update writeGuidanceFile to write changed guidance
through the repository’s writeFileAtomic helper instead of fs.writeFile,
preserving the existing file path, UTF-8 encoding, and unchanged-content
behavior.
In `@src/sdk/init.ts`:
- Around line 52-55: The SDK still depends on CLI implementations, so move both
operations behind SDK/core primitives. In src/sdk/init.ts lines 52-55, replace
the runExtension dependency with an SDK/core extension-installation primitive
and update its callers; in src/sdk/profile.ts line 73, move type-folder
scaffolding out of the CLI schema command into SDK/core and use that primitive
instead.
- Around line 1167-1175: Move normalizeInitCommandOptions(options) before the
ensureInitDirectories call in the initialization flow, so invalid --preset,
--author, --agent-guidance, or --type-preset values are rejected before any
directories, files, or write hooks are created. Preserve the existing
createdDirs and warnings collection behavior after successful normalization.
- Around line 1188-1194: Update the applyInitAgentGuidance call in the
initialization flow to pass the resolved workspace derived from
invocation.target instead of cwd, while continuing to pass pmRoot as the tracker
root. Reuse the existing workspaceRoot value later in the function rather than
redeclaring it.
In `@tests/helpers/withTempPmPath.ts`:
- Around line 404-406: Remove the global author_default mutation from the shared
withTempPmPath fixture setup. Preserve the non-empty default from fresh
initialization, and move the empty-value mutation into an explicitly opt-in
legacy fixture or only the specific tests requiring legacy settings.
🪄 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: 050bd476-b3db-43e6-af2d-488e95a6330e
📒 Files selected for processing (48)
.agents/pm/epics/pm-qwoy.toon.agents/pm/features/pm-3mna.toon.agents/pm/features/pm-cpja.toon.agents/pm/features/pm-gnzh.toon.agents/pm/history/pm-3mna.jsonl.agents/pm/history/pm-7n5a.jsonl.agents/pm/history/pm-9x6e.jsonl.agents/pm/history/pm-cpja.jsonl.agents/pm/history/pm-d4ns.jsonl.agents/pm/history/pm-gnzh.jsonl.agents/pm/history/pm-qwoy.jsonl.agents/pm/issues/pm-7n5a.toon.agents/pm/issues/pm-d4ns.toon.agents/pm/tasks/pm-9x6e.toonREADME.mddocs/SDK_CUSTOMIZATION_PRIMITIVES.mdeslint-suppressions.jsonscripts/release/sdk-import-boundary-baseline.jsonsrc/cli/argv-utils.tssrc/cli/bootstrap-args.tssrc/cli/commands/config.tssrc/cli/commands/health.tssrc/cli/commands/index.tssrc/cli/commands/init-agent-guidance.tssrc/cli/commands/init.tssrc/cli/commands/profile.tssrc/cli/commands/validate.tssrc/cli/main.tssrc/cli/registration-helpers.tssrc/core/diagnostics/remediation.tssrc/core/shared/command-types.tssrc/sdk/author-attribution.tssrc/sdk/cli-contracts/flag-contracts.tssrc/sdk/cli-program.tssrc/sdk/command-line.tssrc/sdk/config.tssrc/sdk/index.tssrc/sdk/init-agent-guidance.tssrc/sdk/init.tssrc/sdk/invocation-author.tssrc/sdk/profile.tssrc/sdk/runtime.tssrc/sdk/templates.tstests/helpers/withTempPmPath.tstests/unit/cli/cli-main-errors.spec.tstests/unit/commands/templates-command.spec.tstests/unit/mcp/mcp-server-branch-residual.spec.tstests/unit/sdk/author-attribution.spec.ts
💤 Files with no reviewable changes (1)
- scripts/release/sdk-import-boundary-baseline.json
Move the extension lifecycle engine and helper modules behind the public SDK boundary, preserve CLI compatibility shims, and ratchet the private-core baseline down by 45 edges. Apply PR review hardening across author parsing, scoped validation, atomic guidance writes, init validation, config integer parsing, workspace targeting, and exact fallback coverage. Record tracker evidence and reduce the ESLint suppression budget to 167.
|
Bot acknowledgement for #issuecomment-4975375955: Gemini quota exhaustion is recorded as an external service limit. The latest head is still covered by exact local gates and a clean Greptile review; Gemini has been retriggered for the new head. |
|
Bot acknowledgement for #issuecomment-4975376053: duplicate Gemini quota notice reviewed and retained. No code action is implied by the quota response; the requested new-head trigger is posted separately. |
|
Bot acknowledgement for #issuecomment-4975376168: CodeRabbit completed the first full review. All eight actionable findings were implemented, tested, replied to inline, and resolved on the current head. |
|
Bot acknowledgement for #issuecomment-4975377510: CodeRabbit rate-limit/walkthrough notice reviewed. Its eight findings are fixed; the external docstring heuristic is superseded by the repository mandatory 100 percent module/export/member gate, which passes. |
|
Bot acknowledgement for #issuecomment-4975378492: DeepSource report reviewed line by line. Valid hygiene findings were fixed, analyzer-only classifications were explained inline, and all threads are resolved; strict ESLint and static quality pass. |
|
Bot acknowledgement for #issuecomment-4975388166: CodSpeed performance report reviewed and retained as the first-head baseline. The second-head hosted check is pending after the SDK relocation. |
|
Bot acknowledgement for #issuecomment-4975394703: Codecov report reviewed. Current local all-source proof is exact 100/100/100/100 across 5,713 tests; the hosted report is being refreshed for head ac4ee77. |
|
Bot acknowledgement for #issuecomment-4975419841: Greptile summary reviewed. Both actionable findings were accepted, regression-tested, replied to inline, and resolved. |
|
Bot acknowledgement for #issuecomment-4975421669: follow-up Greptile summary reviewed. The latest local pre-push review of the expanded SDK promotion is confidence 5/5 with no comments. |
|
Bot review acknowledgement for #pullrequestreview-4699670326: Sourcery could not review because the intentionally broad PR exceeds its size limit. This is an external analyzer limit, not a code finding; exact local and hosted alternatives remain required. |
|
Bot acknowledgement for #issuecomment-4975842562: reviewed and retained. This bot status/review response is accounted for in the final merged-head inventory; any actionable finding from its round was dispositioned in the corresponding inline thread. |
|
Bot acknowledgement for #issuecomment-4975842841: reviewed and retained. This bot status/review response is accounted for in the final merged-head inventory; any actionable finding from its round was dispositioned in the corresponding inline thread. |
|
Bot acknowledgement for #issuecomment-4976090122: reviewed and retained. This bot status/review response is accounted for in the final merged-head inventory; any actionable finding from its round was dispositioned in the corresponding inline thread. |
|
Bot acknowledgement for #issuecomment-4976090467: reviewed and retained. This bot status/review response is accounted for in the final merged-head inventory; any actionable finding from its round was dispositioned in the corresponding inline thread. |
|
Bot acknowledgement for #issuecomment-4976392795: reviewed and retained. This bot status/review response is accounted for in the final merged-head inventory; any actionable finding from its round was dispositioned in the corresponding inline thread. |
|
Bot acknowledgement for #issuecomment-4976397719: reviewed and retained. This bot status/review response is accounted for in the final merged-head inventory; any actionable finding from its round was dispositioned in the corresponding inline thread. |
|
Bot acknowledgement for #issuecomment-4976526019: reviewed and retained. This bot status/review response is accounted for in the final merged-head inventory; any actionable finding from its round was dispositioned in the corresponding inline thread. |
|
Bot acknowledgement for #issuecomment-4976526304: reviewed and retained. This bot status/review response is accounted for in the final merged-head inventory; any actionable finding from its round was dispositioned in the corresponding inline thread. |
|
Bot acknowledgement for #issuecomment-4976652113: reviewed and retained. This bot status/review response is accounted for in the final merged-head inventory; any actionable finding from its round was dispositioned in the corresponding inline thread. |
|
Bot acknowledgement for #issuecomment-4976652515: reviewed and retained. This bot status/review response is accounted for in the final merged-head inventory; any actionable finding from its round was dispositioned in the corresponding inline thread. |
|
Bot acknowledgement for #issuecomment-4976727125: reviewed and retained. This bot status/review response is accounted for in the final merged-head inventory; any actionable finding from its round was dispositioned in the corresponding inline thread. |
|
Bot acknowledgement for #issuecomment-4976727540: reviewed and retained. This bot status/review response is accounted for in the final merged-head inventory; any actionable finding from its round was dispositioned in the corresponding inline thread. |
|
Final bot-review-object acknowledgement: reviewed GitHub review IDs 4699670326, 4699680813, 4699706554, 4699707845, 4699733626, 4700031998, 4700032531, 4700033077, 4700033604, 4700034083, 4700034605, 4700035919, 4700042536, 4700044391, 4700078058, 4700237562, 4700352879, 4700352918, 4700354280, 4700487378, 4700547676, 4700752434, and 4700839261. GitHub review objects do not expose the reactions API; every associated bot conversation/inline comment has instead been explicitly +1-reacted and acknowledged, every actionable finding was dispositioned, and unresolved thread count is zero. Sourcery reported only its 150,000-character service limit; DeepSource dashboard alignment remains pm-87bu; the final Greptile and CodeRabbit reviews are clean. |
Summary
--author, and persist non-empty init author defaultspm items
Closes #444
Verification
Observability
Telemetry is healthy at 0.34% finish errors with zero failures missing error codes. The aggregate release gate stops only on two pre-existing handled external-integration Sentry highs already tracked as
pm-d4ns(PM-CLI-2B) andpm-7n5a(PM-CLI-29); neither implementation belongs to this bundle.Summary by cubic
Moves workspace customization and extension lifecycle into the public SDK with thin CLI adapters. Adds global
--authorwith default persistence, unknown-author advisories with remediation inpm health/pm validate, and enforces exact static-quality budgets (165 ESLint suppressions, 477 coverage pragmas) (addresses #444).New Features
runConfig,runInit,runInitAgentGuidance,runProfile{List,Show,Apply,Lint},runTemplates{List,Show,Save},runExtension,createPmCliProgram,applyInvocationAuthorOverride,quoteCommandArg/renderPmCommand,EXECUTABLE_COMMAND_ALIASES.--author,pm initwritesauthor_default,scanHistoryAuthorAttributionpowers advisorieshistory_unknown_author_eventsandvalidate_history_unknown_author_eventswith remediation entries.--authorempty/missing value errors unified; corrected completion metadata; CodeQL-safe extension slug normalization; atomic guidance writes; workspace targeting in init; stricter config integer parsing; removed unreachable config paths; DeepSourcemodule_system = "es-modules"; static-quality and release/readiness gates pinned to 165/477.docs/SDK_CUSTOMIZATION_PRIMITIVES.mddescribes the composition surface.Migration
@unbrained/pm-cli/sdkinstead of spawningpm.PM_AUTHOR, pass--author, or runpm config project set author_default <id>.Written for commit c27465d. Summary will update on new commits.