Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the CLI’s work package workflows by adding machine-readable JSON output, dry-run planning, and schema-driven custom field resolution for create/inspect/update operations.
Changes:
- Add new JSON-serializable models for inspect payloads and mutation “plans” (create/update).
- Extend work package DTO parsing to capture custom fields, parent/schema links, and embedded project identifier.
- Implement schema fetching + label/type-based resolution for
--setupdates, plus new CLI flags for--json,--dry-run,--set,--parent, and--children.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| models/work_package_mutation.go | Adds model types for create/update “plan” JSON output. |
| models/work_package_details.go | Adds inspect payload models (details, children, project ref, error payload). |
| models/project.go | Extends Project model with Identifier. |
| dtos/work_package_test.go | Tests custom field + links + embedded project unmarshalling. |
| dtos/work_package_schema.go | Adds schema DTO that extracts customField* entries. |
| dtos/work_package.go | Adds custom-field capture via custom UnmarshalJSON; adds parent/schema links; makes conversion nil-safe. |
| dtos/project.go | Adds identifier field to project DTO and conversion. |
| components/resources/work_packages/update_fields_test.go | Tests dry-run update field label resolution via schema. |
| components/resources/work_packages/update_fields.go | Implements dry-run update plan + PATCH update for resolved custom fields. |
| components/resources/work_packages/schema.go | Fetches schema and exposes label→apiName mapping. |
| components/resources/work_packages/field_resolution_test.go | Tests label-based resolution and ambiguous label rejection. |
| components/resources/work_packages/field_resolution.go | Implements assignment parsing, schema resolution, and type coercion. |
| components/resources/work_packages/details_test.go | Tests inspect payload includes children, fields, and labels. |
| components/resources/work_packages/details.go | Implements inspect-with-children + payload construction. |
| components/resources/work_packages/create_test.go | Tests dry-run create infers project from parent. |
| components/resources/work_packages/create.go | Adds parent option, project inference, dry-run create plan, and type resolution refactor. |
| components/presenter/json_test.go | Tests JSON output for inspect payload and error payloads. |
| components/presenter/json.go | Adds simple JSON/error marshaling helpers. |
| cmd/update/work_package_test.go | Tests update dry-run prints expected JSON plan. |
| cmd/update/work_package.go | Adds --set, --json, --dry-run handling and JSON error formatting. |
| cmd/update/update.go | Wires new update flags (--set, --json, --dry-run). |
| cmd/inspect/work_package_test.go | Tests inspect JSON output (with children) and JSON error for flag conflicts. |
| cmd/inspect/work_package.go | Adds --json and --children output mode + JSON errors. |
| cmd/inspect/inspect.go | Wires inspect flags for JSON and children inclusion. |
| cmd/create/work_package_test.go | Tests create dry-run JSON plan and JSON error for flag conflicts. |
| cmd/create/work_package.go | Adds --json/--dry-run output, --parent, and JSON error formatting. |
| cmd/create/create.go | Makes --project optional (project can be inferred from --parent); wires new flags. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a93f6f7 to
684cb21
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 28 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a6adc3e to
a7ea4fa
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 31 out of 31 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 33 out of 33 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Implement the first agent-facing CLI slice for work package inspection. Add machine-readable JSON output, include direct children on demand, preserve custom field data and schema labels, and return structured JSON errors for the inspect command. https://community.openproject.org/projects/cli/work_packages/74316
Add parent-aware create dry-runs and schema-driven update dry-runs for work packages, both with machine-readable JSON output. Keep the legacy typed update flags intact while adding --set, --parent, --dry-run, and --json as the agent workflow surface. https://community.openproject.org/projects/cli/work_packages/74316
Add README examples for the new machine-readable Work Package flows: inspect with children, parent-aware create dry-runs, and schema-driven update dry-runs. https://community.openproject.org/projects/cli/work_packages/74316
Add explicit `--description` support to create and update work package commands. This extends create and the core update patch path, includes JSON dry-run coverage for descriptions, documents the new flag, and keeps validation strict around unsupported flag combinations. https://community.openproject.org/wp/74416
0fe6675 to
87900d7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 34 out of 34 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Move the human-readable update summary into cmd/update so non-JSON users still see which fields are about to change while the resource layer stays silent for machine-oriented paths. Simplify patch helpers to return only errors now that the resource layer no longer builds its own summary.
Wrap Formattable custom-field values as raw long-text objects before PATCHing so OpenProject preserves the content instead of clearing it. Add regression coverage for both value coercion and the resulting HTTP patch body. https://community.openproject.org/wp/74415
Add a status flag on work package updates and validate it through the same status lookup in both dry-run and live PATCH flows. Extend the mutation plan and add regression coverage for status resolution and the resulting PATCH link payload. https://community.openproject.org/wp/74316
Normalize Formattable custom fields to their raw string values in Work Package JSON reads so they mirror description and can be round-tripped without parsing rendered objects. https://community.openproject.org/wp/74418
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 35 out of 35 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Sorry for coming late in the party. I have a branch where I added some improvements a few weeks ago: (cbl-improvements branch):
Have you considered it? I should have added a comment in the original wp posted by Kabiru. Will do that now. |
Ticket
https://community.openproject.org/wp/74415
https://community.openproject.org/wp/74416
https://community.openproject.org/wp/74418
What are you trying to accomplish?
Tip
Related
SKILL.mdcan be found hereAdd the first agent-oriented slice of Work Package workflows to
opso scripted and agentic consumers don't have to scrape human output:op inspect workpackage <id> --children --json— parent, direct children, project info, custom fields, and label→API field mappingsop create workpackage --parent <id> [--dry-run] --json— parent-aware create that infers the project from the parentop create workpackage --description "Body" ...— explicit raw description support on create, including dry-run JSON coverageop update workpackage <id> --set "Field=Value" [--dry-run] --json— schema-driven updates for custom fields that accept human labels or raw API names (e.g.customField130)op update workpackage <id> --description "Body" [--dry-run] --json— explicit raw description support on the core patch pathop update workpackage <id> --status "In development" [--dry-run] --json— status updates validated in both dry-run and live PATCH flowsdescriptionon read surfaces: JSON outputs expose the raw string rather than the full rendered object--open --json)Out of scope: recursive descendants, semantic WP identifiers, search, bulk creation, MCP layer.
What approach did you choose and why?
Kept the existing Cobra verbs and text printer intact and added a parallel JSON path built from richer DTOs, a schema-aware field resolver, and a stable JSON presenter. Command handlers stay thin; new logic lives in focused resource/model/presenter helpers with
httptest-backed unit tests.JSON update paths avoid progress-text contamination for machine consumers, while non-JSON update paths still emit human-readable progress/status output.
Validated against the live community instance: read
WP#74316and childWP#74413, created validation childWP#74414, updated a safe field onWP#74414, backfilled raw descriptions onWP#74414,WP#74415, andWP#74416, and then used the branch CLI against real work packages where follow-up fixes surfaced:{raw: ...}values instead of plain strings.--statusnow works onupdate workpackageand validates against known statuses in both dry-run and live flows.description.What this PR doesn't do
Deferred items:
--setbeyond the explicit--descriptionflag; this slice keeps--setscoped to schema-resolved custom fields{code, message}_embedded.projectis absent{id, name}field_labels--action --jsonand--attach --jsonprogress output in legacy resource pathsMerge checklist