Skip to content

feat(smart-forms): engine tools for full Smart Form lifecycle#14

Merged
salimovartem merged 3 commits into
developfrom
feat/smart-forms-engine-tools
Jun 8, 2026
Merged

feat(smart-forms): engine tools for full Smart Form lifecycle#14
salimovartem merged 3 commits into
developfrom
feat/smart-forms-engine-tools

Conversation

@salimovartem

Copy link
Copy Markdown
Collaborator

Summary

  • 12 new engine tools covering the complete Smart Form lifecycle: createSmartForm, pullSmartForm, pushSmartForm, deploySmartForm, listReleases, diffReleases, rollbackRelease, getFileHistory, getFileVersion, rollbackFile, listTrash, restoreFromTrash
  • New internal/cduschema package — embeds smart-forms-swagger.json, extracts 28 valid CDU component classes, validates pages/*/config and locale files before pushSmartForm sends them to the server
  • New simulator-smart-forms skill — full Smart Form authoring specialist: create → pull → edit → push → deploy → release/rollback workflow, CDU page protocol, component catalogue, templating; all documented via MCP tool calls (no raw API paths)
  • SIMULATOR_WORK_DIR supportcmd/server and credentials.go now read .env from the user's project dir when the server is launched from the plugin dir

Test plan

  • go build ./... and go vet ./... pass
  • go test ./internal/cduschema/... — 4 tests pass (GetRules: 28 classes, ValidatePageConfig valid/errors, ValidateLocale)
  • createSmartForm(title, ref) returns actorId + two envs
  • pullSmartForm(actorId) writes files + .manifest.json to <actorId>/develop/ and <actorId>/production/
  • pushSmartForm with a bad page config returns validationErrors and aborts
  • pushSmartForm with valid changes returns { changed: N, unchanged: M }
  • deploySmartForm(actorId) creates a release without needing env IDs
  • listReleases(actorId) returns release list
  • rollbackRelease(actorId, releaseId) creates a new active release

🤖 Generated with Claude Code

salimovartem and others added 3 commits June 8, 2026 13:27
Add 12 engine tools covering the complete Smart Form authoring and release
lifecycle, plus CDU page protocol validation on push.

New engine tools:
- createSmartForm   — create actor + develop/production envs
- pullSmartForm     — download all env file trees to <actorId>/<env>/
- pushSmartForm     — diff-and-push changed files; validates page config
                      against CDU schema before sending (new cduschema pkg)
- deploySmartForm   — deploy develop → production (resolves env names to IDs)
- listReleases      — list releases for an env
- diffReleases      — diff two releases by source_hash
- rollbackRelease   — forward-only rollback to a prior release
- getFileHistory    — list version history for a file
- getFileVersion    — fetch source of one specific file version
- rollbackFile      — restore a file to a prior version
- listTrash         — list soft-deleted objects in an env
- restoreFromTrash  — restore from trash

New packages:
- internal/cduschema: embeds smart-forms-swagger.json, extracts 28 valid
  component classes, validates page config (Page→Grid→Form→Section→Item)
  and locale files before push

New skill:
- simulator-smart-forms: full Smart Form authoring specialist covering
  create/edit/push/deploy/release/file-history workflow, CDU page protocol,
  component catalogue, and templating — all via MCP tools (no raw API paths)

Also: SIMULATOR_WORK_DIR support in cmd/server and credentials so the server
reads .env from the user's project dir when launched from the plugin dir.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rename engine files with consistent prefixes so graph and CDU tools
sort together in the file tree:
- graph_chart.go, graph_compact_layout.go, graph_placements.go,
  graph_prune_edges.go, graph_push.go, graph_sync.go, graph_upload.go
- smart_form_create.go, smart_form_pull.go, smart_form_push.go
  (smart_form_file_history.go and smart_form_releases.go already correct)

Remove internal/tools/apps.go: the 4 appOps it held (createApplication,
createSmartForm, manageAppContent, listSmartForms) are superseded by the
engine tools added in the previous commit. Drop the dead _ = appOps
reference from build.go and clean up stale notes in README and ARCHITECTURE.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move all engine code from the flat internal/engines/ into three sub-packages
to group files by domain:

  internal/engines/ecore/     — shared runtime config + HTTP helpers
    runtime.go                  Config, Cfg, Configure, SetBaseURL, ResetAuth,
                                AuthHeader, BuildBaseURL, EnsureAuth
    httpclient.go               APIHTTPClient (shared TLS-aware HTTP client)
    helpers.go                  Seg, RequireUUID, PapiGET, PapiPOST, PapiPUT
    ecore_test.go               TestRequireUUID, TestSeg, TestBuildBaseURL*

  internal/engines/graph/     — graph sync, layout, pruning, upload, chart
    sync.go, push.go, compact_layout.go, placements.go, prune_edges.go,
    chart.go, upload.go, svg.go, helpers.go, register.go
    sync_test.go, security_test.go

  internal/engines/smartform/ — CDU create/pull/push, releases, file history
    create.go, pull.go, push.go, releases.go, file_history.go, register.go

  internal/engines/           — thin wiring layer
    register.go   calls graph.Register + smartform.Register
    runtime.go    re-exports Configure/SetBaseURL/ResetAuth from ecore
                  (so cmd/server and tools/build.go need no import changes)

All tests pass; go build and go vet clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@salimovartem salimovartem merged commit 42b8e3a into develop Jun 8, 2026
1 of 2 checks passed
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