Skip to content

Add Copilot-assisted dashboard editing mode - #697

Merged
pelikhan merged 12 commits into
mainfrom
copilot/add-headless-server-mode
Sep 3, 2026
Merged

Add Copilot-assisted dashboard editing mode#697
pelikhan merged 12 commits into
mainfrom
copilot/add-headless-server-mode

Conversation

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

The local dashboard preview lacked an agentic editing path. This adds an optional Copilot mode for prompting changes to the active view and reloading validated updates.

  • Copilot runtime

    • Launches Copilot headlessly through @github/copilot-sdk.
    • Creates one session per request with local tool access.
    • Logs session activity through console.log.
  • Browser integration

    • Adds a textbox and send button above the preview when enabled.
    • Sends the active view name and requested change through a capability-protected endpoint.
    • Reports progress and errors without affecting standard preview mode.
  • Editing workflow

    • Directs Copilot to use /generate-dashboard-ir.
    • Requires validation until the dashboard passes, then saves the source.
    • Reuses the existing file watcher and WebSocket refresh path.
  • Usage

npm install @github/copilot-sdk
node dashboard/local-server.mjs --copilot

Copilot AI and others added 2 commits September 3, 2026 07:30
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Add optional Copilot-assisted dashboard editing Add Copilot-assisted dashboard editing mode Sep 3, 2026
Copilot AI requested a review from pelikhan September 3, 2026 07:34

@pelikhan pelikhan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot debug logging extensively

Comment thread dashboard/local-server.mjs Outdated
}

function injectCopilotPrompt(html, endpoint) {
const prompt = `<form id="dashboard-copilot-prompt" style="display:flex;gap:0.5rem;align-items:center;padding:0.75rem 1rem;border-bottom:1px solid #d0d7de;background:#f6f8fa;font:14px system-ui">

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot move this to JavaScript file that gets conditionally loaded and uses the existing rendering infrastructure. DO NOT EVAL

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the UI to a conditionally loaded copilot-prompt.js module using the shared DOM helper and dashboard styles, with no eval, in 8640a91.

Comment thread dashboard/local-server.mjs Outdated
...(copilotExecutable ? { path: copilotExecutable } : {}),
}),
workingDirectory,
logLevel: "none",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot enable logging

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enabled Copilot SDK debug logging and added sanitized session lifecycle logging in 8640a91.

Comment thread dashboard/local-server.mjs Outdated

Apply this request: ${request}

Find the dashboard source file that defines this view. Follow the skill and the repository's dashboard specification, run the dashboard validator repeatedly until the edited document passes, and save the source file so the local preview reloads. Complete the edit rather than only describing it.`,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot provide precise file path to dashboard.json and also how to edit the original locations of the package views

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The session now receives the exact generated dashboard path, the matched editable source path, every original dashboard source path, and explicit built-in/package editing guidance in 8640a91.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot debug logging extensively

Implemented extensive sanitized server, rebuild, WebSocket, request, session, and SDK debug logging in 8640a91.

Copilot AI requested a review from pelikhan September 3, 2026 07:49
@pelikhan
pelikhan marked this pull request as ready for review September 3, 2026 11:49
@pelikhan

pelikhan commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

@copilot inject copilot prompt module should be injected client side at startup with a query flag that the server provides, not dynamically by the server with the current hash. No string concat to generate HTML ever.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot inject copilot prompt module should be injected client side at startup with a query flag that the server provides, not dynamically by the server with the current hash. No string concat to gen...

Implemented in df7caec: the server now provides a local-preview query flag via redirect, and static client startup conditionally imports/renders the module and initializes the socket. Server-side HTML generation was removed entirely.

@pelikhan

pelikhan commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

@copilot do a security deep review, add more logging - specially when things fail, misconfigured.

Copilot AI and others added 2 commits September 3, 2026 12:16
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot do a security deep review, add more logging - specially when things fail, misconfigured.

Implemented in 16f973d with cleanup follow-up eee86d2. Copilot sessions now expose only allowlisted dashboard read/validate/save tools, reject all unexpected permissions, require loopback binding, serialize requests, validate saved output, and log sanitized startup, configuration, denial, validation, session, and cleanup failures. Deep security review and CodeQL reported no findings.

@pelikhan

pelikhan commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

@copilot remove yaml dependency, only support JSON format. Always country JSON through parse/stringidy 2 spaces to normalize formatting

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot remove yaml dependency, only support JSON format. Always country JSON through parse/stringidy 2 spaces to normalize formatting

Implemented in 88d7fc7. Copilot editing now accepts JSON only, parses and re-serializes dashboard sources with two-space indentation on read/save/post-session verification, rejects malformed JSON, and no longer imports or packages the YAML validator.

@pelikhan

pelikhan commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

@copilot use permissions and access control when launching node to guarantee the web server is not reading files outside the workspace. Apply basic secret regex cleaning before reading files back to the browser.

Copilot AI and others added 3 commits September 3, 2026 12:33
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot use permissions and access control when launching node to guarantee the web server is not reading files outside the workspace. Apply basic secret regex cleaning before reading files back to t...

Implemented in 33d3f09, 0757dd7, and c5a1254. The CLI now relaunches Node with filesystem access limited to the workspace, keeps preview files inside that boundary, rejects canonical and symlink path escapes, clears inherited NODE_OPTIONS, and redacts common secret keys/tokens from JSON, HTML, CSS, and JavaScript before browser delivery and WebSocket updates.

@pelikhan

pelikhan commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

@copilot only allow reading .md, .json or web files or images. Refuse other file types.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot only allow reading .md, .json or web files or images. Refuse other file types.

Implemented in ed91790. Browser serving now uses an explicit allowlist for Markdown, JSON, HTML/CSS/JavaScript, and common image formats; unsupported and extensionless files return 404 before content is read. Text secret redaction now also covers Markdown and SVG.

@pelikhan

pelikhan commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix https://github.com/githubnext/gh-aw-cao/actions/runs/33756458673/job/100653596117

Fixed in 3fb6753. The focused EU CRA, Advisory, and Software Development Practices package contracts now include the shared .github/workflows/cao.md; all three previously failing tests and the full npm test suite pass.

@pelikhan
pelikhan merged commit c17f4fe into main Sep 3, 2026
5 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.

2 participants