-
Notifications
You must be signed in to change notification settings - Fork 4
feat(forms): explain, act on and lint live forms, with MCP tools #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
santoshyadavdev
merged 8 commits into
santoshyadavdev:main
from
erkamyaman:feat/forms-v2
Sep 27, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
808b30d
feat(forms): explain, act on and lint live forms, with MCP tools
erkamyaman c2d1895
feat(forms): record callers, async timing, renders and array moves; p…
erkamyaman bad28e9
fix(forms): address review comments
erkamyaman 412bd53
Merge remote-tracking branch 'upstream/main' into feat/forms-v2
erkamyaman e09cc89
fix(forms): protect every secret, hidden, readonly and disabled desce…
erkamyaman c6a9a98
fix(forms): address third review round
erkamyaman 004a6eb
fix(forms): guard secret collection against cycles and forget secrets…
erkamyaman 9e8f158
Merge remote-tracking branch 'upstream/main' into feat/forms-v2
erkamyaman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| import { Component, computed, effect, input, linkedSignal, signal, untracked } from '@angular/core'; | ||
| import type { DevframeRpcClient } from 'devframe/client'; | ||
| import { | ||
| FORMS_STYLES, | ||
| actionMessage, | ||
| formAction, | ||
| formsCall, | ||
| plain, | ||
| type CollectedForm, | ||
| type FormFieldNode, | ||
| } from './forms-types'; | ||
|
|
||
| @Component({ | ||
| selector: 'app-forms-field-detail', | ||
| template: ` | ||
| <h3>{{ node().path || '(form)' }}</h3> | ||
| <pre class="explain">{{ text() || 'Loading…' }}</pre> | ||
| <div class="row"> | ||
| @if (node().type === 'control' && !node().redacted) { | ||
| <label class="sr-only" for="field-value">New value for {{ node().path }}</label> | ||
| <input | ||
| id="field-value" | ||
| class="field-input" | ||
| type="text" | ||
| placeholder="New value (JSON or text)" | ||
| [value]="draft()" | ||
| (input)="draft.set($any($event.target).value)" | ||
| (keydown.enter)="setValue()" | ||
| /> | ||
| <button type="button" class="small" (click)="setValue()">Set</button> | ||
| } | ||
| <button type="button" class="small" (click)="act('focus')">Focus</button> | ||
| <button type="button" class="small" (click)="act('mark-touched')">Touch</button> | ||
| <button type="button" class="small" (click)="act('revalidate')">Revalidate</button> | ||
| <button type="button" class="small" (click)="act('store-as-global')">Store as global</button> | ||
| </div> | ||
| <p class="status" role="status">{{ message() }}</p> | ||
| `, | ||
| styles: ` | ||
| ${FORMS_STYLES} | ||
| :host { | ||
| display: grid; | ||
| gap: 8px; | ||
| padding: 10px; | ||
| border: 1px solid #3f3f46; | ||
| border-radius: 8px; | ||
| } | ||
| h3 { | ||
| margin: 0; | ||
| color: #e4e4e7; | ||
| font-size: 14px; | ||
| font-family: ui-monospace, monospace; | ||
| } | ||
| .row { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| gap: 6px; | ||
| align-items: center; | ||
| } | ||
| .sr-only { | ||
| position: absolute; | ||
| width: 1px; | ||
| height: 1px; | ||
| overflow: hidden; | ||
| clip-path: inset(50%); | ||
| white-space: nowrap; | ||
| } | ||
| `, | ||
| }) | ||
| export class FormsFieldDetail { | ||
| form = input.required<CollectedForm>(); | ||
| node = input.required<FormFieldNode>(); | ||
| version = input(0); | ||
| rpc = input<DevframeRpcClient | null>(null); | ||
|
|
||
| readonly text = signal(''); | ||
| private readonly target = computed(() => `${this.form().id}|${this.node().path}`); | ||
| readonly draft = linkedSignal({ source: this.target, computation: () => '' }); | ||
| readonly message = linkedSignal({ source: this.target, computation: () => '' }); | ||
|
|
||
| constructor() { | ||
| effect(() => { | ||
| const form = this.form().id; | ||
| const path = this.node().path; | ||
| this.version(); | ||
| const client = this.rpc(); | ||
| untracked(() => this.load(client, form, path)); | ||
| }); | ||
| } | ||
|
|
||
| private async load(client: DevframeRpcClient | null, form: string, path: string) { | ||
| const text = await formsCall<string>(client, 'forms-explain', { kind: 'field', form, path }); | ||
| if (this.form().id === form && this.node().path === path) this.text.set(plain(text)); | ||
| } | ||
|
|
||
| async act(action: string) { | ||
| const result = await formAction(this.rpc(), { | ||
| action, | ||
| formId: this.form().id, | ||
| path: this.node().path, | ||
| }); | ||
| this.message.set( | ||
| result.expression ? `${actionMessage(result)} ${result.expression}` : actionMessage(result), | ||
| ); | ||
| } | ||
|
|
||
| async setValue() { | ||
| const raw = this.draft(); | ||
| let value: unknown = raw; | ||
| try { | ||
| value = JSON.parse(raw); | ||
| } catch { | ||
| value = raw; | ||
| } | ||
| const result = await formAction(this.rpc(), { | ||
| action: 'set-value', | ||
| formId: this.form().id, | ||
| path: this.node().path, | ||
| value, | ||
| mode: 'user', | ||
| }); | ||
| this.message.set(actionMessage(result)); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.