Skip to content

refactor(canvas): migrate shared extension infrastructure - #52

Merged
lukasoppermann merged 6 commits into
mainfrom
lukasoppermann-canvas-typescript-infrastructure
Oct 22, 2026
Merged

lukasoppermann merged 6 commits into
mainfrom
lukasoppermann-canvas-typescript-infrastructure

Conversation

@lukasoppermann

Copy link
Copy Markdown
Contributor

Why

Continue the canvas extension's TypeScript migration on top of #51. Shared command, storage, and repository helpers need compiler-checked implementations before the remaining workflows can migrate without relying on declarations for JavaScript behavior.

What changes

Move command execution, private storage, state-file reads and writes, and repository identity and context to strict TypeScript sources. Remove the temporary command declaration and share a checked error-code reader. Parsed storage data remains unknown until its consuming workflow checks the fields it uses; this change does not introduce a new stored-data format.

Keep the generated runnable .mjs modules committed, with the same host entry point and no compiler or package installation required for plugin consumers. The module build now formats every compiler-emitted runtime file rather than naming a single module. Reuse Hub's locked Node types and document the migration boundary. Hub clients, publishing and review workflows, servers, browser assets, and SDK registration remain outside this layer.

lukasoppermann and others added 2 commits October 21, 2026 14:25
Convert remote branch lookup to strict TypeScript while retaining its generated JavaScript runtime. Include migrated modules in lint, type checks, and plugin freshness checks.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9d7306a9-9831-4c78-89e7-3c5b581c895e
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1aff284a-77f1-4bcf-8245-e30889a2f392

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The build wrapper needs to preserve readable compiler diagnostics when compilation fails.

2 open issues
What changed in this PR

Continues #51’s TypeScript migration for shared canvas extension infrastructure while preserving committed JavaScript runtimes and the existing plugin entry point.

Changes:

  • Adds typed command, storage, state, and repository helpers.
  • Builds and formats all emitted runtime modules using Hub’s locked Node types.
  • Adds command and state tests and documents the migration boundary.
File Description
hub/​script/​build-extension-modules.mjs Compiles and formats emitted modules.
hub/​package.json Uses the new module-build script.
hub/​docs/​prototype-canvas.md Documents migration and build boundaries.
.github/​extensions/​replica-prototype/​write-state/​index.mts Adds typed state writing.
.github/​extensions/​replica-prototype/​write-state/​index.mjs Updates generated runtime.
.github/​extensions/​replica-prototype/​tsconfig.json Uses Hub’s Node types.
.github/​extensions/​replica-prototype/​run-command/​index.test.mjs Covers command inputs and failures.
.github/​extensions/​replica-prototype/​run-command/​index.mts Adds typed command execution.
.github/​extensions/​replica-prototype/​run-command/​index.mjs Checks error fields safely.
.github/​extensions/​replica-prototype/​run-command/​index.d.mts Removes the temporary declaration.
.github/​extensions/​replica-prototype/​read-state/​index.test.mjs Covers persistence and invalid data.
.github/​extensions/​replica-prototype/​read-state/​index.mts Returns stored data as unknown.
.github/​extensions/​replica-prototype/​read-state/​index.mjs Updates validation and error handling.
.github/​extensions/​replica-prototype/​read-repository-name/​index.mts Adds typed repository parsing.
.github/​extensions/​replica-prototype/​read-repository-name/​index.mjs Updates generated parsing logic.
.github/​extensions/​replica-prototype/​read-error-code/​index.mts Adds checked error-code extraction.
.github/​extensions/​replica-prototype/​read-error-code/​index.mjs Adds the generated helper.
.github/​extensions/​replica-prototype/​read-canvas-repository/​index.mts Types repository identity resolution.
.github/​extensions/​replica-prototype/​read-canvas-repository/​index.mjs Updates generated runtime.
.github/​extensions/​replica-prototype/​private-store/​index.mts Types private storage and locking.
.github/​extensions/​replica-prototype/​private-store/​index.mjs Uses shared error-code checks.
.github/​extensions/​replica-prototype/​create-canvas-context/​index.mts Types canvas context and target resolution.
.github/​extensions/​replica-prototype/​create-canvas-context/​index.mjs Regenerates the context runtime.

Review effort: Max

Comment thread hub/script/build-extension-modules.mjs Resolved
@lukasoppermann
lukasoppermann added this pull request to stack #58 October 21, 2026 13:49
lukasoppermann and others added 3 commits October 22, 2026 08:02
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9d7306a9-9831-4c78-89e7-3c5b581c895e
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1aff284a-77f1-4bcf-8245-e30889a2f392
Merge the updated TypeScript foundation and keep the command result contract aligned with child-process errors.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1aff284a-77f1-4bcf-8245-e30889a2f392
Base automatically changed from lukasoppermann-canvas-typescript-foundation to main October 22, 2026 06:06
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 1aff284a-77f1-4bcf-8245-e30889a2f392
@lukasoppermann
lukasoppermann merged commit ff064c4 into main Oct 22, 2026
40 checks passed
@lukasoppermann
lukasoppermann deleted the lukasoppermann-canvas-typescript-infrastructure branch October 22, 2026 06:14
lukasoppermann added a commit that referenced this pull request Oct 22, 2026
<!-- Use a conventional commit-style title, such as "fix(hub): retain
prototype history". -->

## Why

<!-- Explain the problem and why this change matters in a short,
plain-English paragraph. Link the issue when applicable. -->

The canvas extension is moving its authored Node code to strict
TypeScript while keeping its installable JavaScript runtime. This is
layer 3 of that migration, built on #52, and covers the Hub connection
without changing the user flow.

## What changes

<!-- Describe what becomes different for a first-time reader. Explain
necessary terms. Include accurate Mermaid diagrams when they clarify the
proposal, using before/after diagrams when helpful. Add screenshots for
meaningful UI changes. -->
<!-- Omit validation sections, checklists, and routine test/CI summaries
such as "CI is green" or "tests passed". Mention only known verification
gaps that affect the change, not disclaimers about drafting the
description. -->

Adds TypeScript sources for the Hub client, origin validation and
selection, private credentials, repository discovery, connection
coordination, and learnings hook. External JSON is checked before use,
and client responses retain unknown field values for consuming workflows
to validate. The client exports reusable connection, request, status,
and recall types.

Commits generated sibling `.mjs` modules and keeps existing JavaScript
imports and the `extension.mjs` entry point. Approval, renewal, request
timing, and prompt-data minimization retain their existing flow. Adds
focused malformed-data coverage and updates the contributor guide.
Publishing, review workflows, local servers, SDK registration, and
browser UI remain outside this layer.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9d7306a9-9831-4c78-89e7-3c5b581c895e
Copilot-Session: 1aff284a-77f1-4bcf-8245-e30889a2f392
Copilot-Session: 2e9f29a3-a43f-469a-a5aa-8318559d915a
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.

3 participants