Skip to content

Commit d1145c5

Browse files
feat: chat editor integration. (#55)
1 parent 6ec6037 commit d1145c5

File tree

16 files changed

+2251
-819
lines changed

16 files changed

+2251
-819
lines changed

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Repository structure:
3939
## Code style and conventions
4040

4141
- Preserve current project formatting: single quotes, no semicolons, print width 90, arrowParens avoid.
42+
- Do not use index files or barrel-file architecture; prefer explicit file names and explicit import paths.
4243
- Keep UI changes intentional and lightweight; avoid broad visual rewrites unless requested.
4344
- Keep runtime logic defensive for flaky/slow CDN conditions.
4445
- Preserve progressive loading behavior (lazy-load optional compilers/runtime pieces where possible).

docs/next-steps.md

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,15 @@ Focused follow-up work for `@knighted/develop`.
1919
- Suggested implementation prompt:
2020
- "Add a deterministic E2E execution mode for `@knighted/develop` that serves pinned runtime artifacts locally (instead of live CDN fetches) and wire it into CI as a required check on every PR. Keep a separate lightweight CDN-smoke E2E check for real-network coverage. Validate with `npm run lint`, deterministic Playwright PR checks, and one CDN-smoke Playwright run."
2121

22-
4. **Issue #18 continuation (finish remaining Phase 3 scope)**
23-
- Current rollout status:
24-
- Phase 0 complete: feature flag + scaffolding.
25-
- Phase 1 complete: BYOT token flow, localStorage persistence, writable repo discovery/filtering.
26-
- Phase 2 complete: separate AI chat drawer UX, streaming-first responses with non-stream fallback, selected repository context plumbing, and README fine-grained PAT setup links.
27-
- Phase 3 partially complete: PR-prep filename/path groundwork landed via the Open PR drawer with repository-scoped persistence and stricter path validation.
28-
- Phase 4 complete: open PR flow from editor content (branch creation, file upserts, PR creation), confirmation UX, loading/success states, and toast feedback.
29-
- Post-implementation hardening complete: traversal/path validation edge cases, trailing-slash rejection, writable-repo select reset behavior during loading/error states, and a JS-driven Playwright readiness check.
30-
- Implement the next slice (remaining Phase 3 assistant features):
31-
- Add mode-aware recommendation behavior so the assistant strongly adapts suggestions to current render mode and style mode.
32-
- Add an editor update workflow where the assistant can propose structured edits and the user can apply to Component and Styles editors with explicit confirmation.
33-
- Keep behavior and constraints aligned with current implementation:
34-
- Keep AI chat/assistant behavior behind the existing browser-only AI feature flag.
35-
- Keep PR/BYOT controls available by default.
36-
- Preserve BYOT token semantics (localStorage persistence until user deletes).
37-
- Keep CDN-first runtime behavior and existing fallback model.
38-
- Do not add dependencies without explicit approval.
39-
- Remaining Phase 3 mini-spec (agent implementation prompt):
40-
- "Continue Issue #18 in @knighted/develop from the current baseline where PR filename/path groundwork and Open PR flow are already shipped. Implement the two remaining Phase 3 assistant deliverables. (1) Add mode-aware assistant guidance: when collecting AI context, include explicit policy hints derived from render mode and style mode, and ensure recommendations avoid incompatible patterns (for example, avoid React hook/state guidance in DOM mode unless user explicitly asks for React migration). (2) Add assistant-to-editor apply flow: support structured assistant responses that can propose edits for component and/or styles editors; render these as reviewable actions in the chat drawer, require explicit user confirmation to apply, and support a one-step undo for last applied assistant edit per editor. Keep AI chat/assistant behavior behind the existing browser-only AI feature flag, keep PR/BYOT controls available by default, and preserve current token/repo persistence semantics. Do not add dependencies. Validate with npm run lint and targeted Playwright tests covering mode-aware recommendation constraints and apply/undo editor actions."
41-
42-
5. **Phase 2 UX/UI continuation: fixed editor tabs first pass (Component, Styles, App)**
22+
4. **Phase 2 UX/UI continuation: fixed editor tabs first pass (Component, Styles, App)**
4323
- Continue the tabs/editor UX work with a constrained first implementation that supports exactly three editor tabs: Component, Styles, and App.
4424
- Do not introduce arbitrary/custom tab names in this pass; treat custom naming as future scope after baseline tab behavior is stable.
4525
- Preserve existing runtime behavior and editor content semantics while adding tab switching, active tab indication, and predictable persistence/reset behavior consistent with current app patterns.
4626
- Ensure assistant/editor integration remains compatible with this model (edits should target one of the fixed tabs) without expanding to dynamic tab metadata yet.
4727
- Suggested implementation prompt:
4828
- "Implement Phase 2 UX/UI tab support in @knighted/develop with a fixed first-pass tab model: Component, Styles, and App only (no arbitrary tab names yet). Add a clear tab UI for switching editor panes, preserve existing editor behavior/content wiring, and keep render/lint/typecheck/diagnostics flows working with the selected tab context where relevant. Keep AI chat feature-flag behavior unchanged while keeping PR/BYOT controls available by default, maintain CDN-first runtime constraints, and do not add dependencies. Add targeted Playwright coverage for tab switching, default/active tab behavior, and interactions with existing render/style-mode flows. Validate with npm run lint and targeted Playwright tests."
4929

50-
6. **Document implicit App strict-flow behavior (auto render)**
30+
5. **Document implicit App strict-flow behavior (auto render)**
5131
- Add a short behavior matrix in docs that explains when implicit App wrapping is allowed versus when users must define `App` explicitly.
5232
- Include concrete Component editor examples for each case so reviewer/user expectations are clear.
5333
- Suggested example cases to document:
@@ -63,7 +43,7 @@ Focused follow-up work for `@knighted/develop`.
6343
- Suggested implementation prompt:
6444
- "Document the current implicit App behavior in @knighted/develop for auto-render mode using a compact behavior matrix and concrete component-editor snippets. Clearly distinguish supported implicit wrapping from cases that intentionally require an explicit App (such as top-level JSX mixed with imports/declarations). Keep docs concise, aligned with current runtime behavior, and include at least one positive and one explicit-error example."
6545

66-
7. **Evaluate GitHub file upsert request strategy (metadata-first vs optimistic PUT)**
46+
6. **Evaluate GitHub file upsert request strategy (metadata-first vs optimistic PUT)**
6747
- Revisit the current metadata-first `upsertRepositoryFile` approach and compare it against an optimistic PUT + targeted retry-on-missing-sha flow.
6848
- Measure tradeoffs for latency, GitHub API request count/rate-limit impact, and browser-console signal quality during common PR flows.
6949
- If beneficial, introduce a configurable/hybrid strategy (for example, optimistic default with metadata fallback) without regressing current reliability.

0 commit comments

Comments
 (0)