Skip to content

[DONE] To hardware 에 AI 답을 통째로 붙여도 헤더만 남고, 빈 칸에서 「Copy .h」 가 복사했다고 하지 않는다 - #194

Merged
patternflow-bot merged 5 commits into
devfrom
claude/ops-pf-round70-ubunks
Oct 24, 2026
Merged

patternflow-bot merged 5 commits into
devfrom
claude/ops-pf-round70-ubunks

Conversation

@patternflow-bot

@patternflow-bot patternflow-bot commented Oct 24, 2026 •

Copy link
Copy Markdown

ops / https://claude.ai/code/session_01TBgz26gZ6bndqQai5cUkM1

Pattern Lab 의 To hardware 에서 코드 레이어가 하나일 때, AI 대화 답을 「Here is the converted header:」 와 ```cpp 울타리, 「Let me know…」 까지 통째로 붙여도 이제 .h 엔 헤더만 들어가요. 전엔 그 말이 그대로 Copy .h 와 Download .h, 보드로 보내기에 가서 컴파일에서 막혔어요. 아무것도 붙이지 않은 칸에서 「Copy .h」 가 빈 글을 복사하고 「Copied ✓」 를 띄우던 것도 막았어요.

좋아지는 것: AI 답을 통째로 붙여도 헤더만 보드로 간다 — 말을 손으로 지울 일이 없다

한 일

web/src/lib/lab/hExport.ts 에 cleanPastedHeader 를 더했어요. 줄 맨 앞의 #pragma once 를 찾아 거기서 헤더를 시작하고, 그 바로 위의 주석 줄과 빈 줄은 같이 둬요. 프리셋 헤더가 // SPDX-License-Identifier 몇 줄과 빈 줄 하나 뒤에 #pragma once 를 두어서예요. 그 위의 말과 여는 울타리는 버려요. 끝은 #pragma once 다음에 처음 오는 ``` 줄이고, 그 뒤 말도 버려요. #pragma once 로 시작하는 줄이 없으면 null 이에요.

web/src/app/pattern-lab/HardwareModal.tsx 의 레이어 하나 길은 붙인 글 대신 이 함수가 돌려준 헤더로 .h 를 만들어요. 헤더가 없으면 .h 는 빈 글이고, 「Copy .h」 는 「Download .h」 처럼 disabled={!headerLooksReal} 로 닫혀요. 말을 걷어 냈으면 칸 밑 글이 「Looks like a header ✓ The words around it stay out of the .h.」 라고 해요. 칸에 붙인 글은 그대로 둬요. 레이어를 쌓은 길은 바꾸지 않았어요.

증거

폰 390 · AI 답을 통째로 붙이고 Copy .h 를 누른 뒤
데스크톱 1440 · AI 답을 통째로 붙이고 Copy .h 를 누른 뒤
데스크톱 1440 · 빈 칸에선 Copy .h 가 닫혀 있어요

사진을 찍은 스크립트가 같은 창에서 「Copy .h」 를 누르고 클립보드를 읽었어요. 390 과 1440 이 같았어요.

390 empty box: Copy .h disabled = true
390 note: Looks like a header ✓ The words around it stay out of the .h.
390 clipboard:
#pragma once
#include <Arduino.h>
namespace LabWave {
  const char* NAME = "Code 1";
  void setup() {}
  void draw() { PFCanvas::present(); }
} // namespace LabWave

고치기 전 코드로 같은 답을 .h 로 만든 것이에요(enforcePatternName(single.trim(), name) 을 tsx 로 불렀어요).

headerLooksReal: true
--- .h ---
Here is the converted header:

```cpp
#pragma once
namespace LabWave {
  const char* NAME = "Code 1";
  void draw() {}
} // namespace LabWave
```

Let me know if you want the colours warmer.
--- empty box: Copy .h writes 0 bytes

새 시험 셋은 고치기 전 코드에서 셋 다 빨갰어요.

   × HardwareModal > keeps only the header when a whole chat answer is pasted 14ms
   × HardwareModal > finds no header in an answer whose #pragma once is in a sentence 9ms
   × HardwareModal > keeps Copy .h shut until a header is pasted 5ms
      Tests  3 failed | 13 passed (16)
$ (고친 뒤) npx vitest run src/app/pattern-lab/HardwareModal.test.tsx
 ✓ src/app/pattern-lab/HardwareModal.test.tsx (16 tests) 305ms

web/ 에서 다섯 검사의 끝줄이에요.

$ npm ci                           → exit 0
$ npm run lint -- --max-warnings=0 → lint exit 0
$ npm run typecheck                → typecheck exit 0
$ npm run build                    → build exit 0
$ npm run check:ci                 → Test Files  93 passed (93) · Tests  1154 passed (1154) · skipped links-absolute · skipped roadmap · check:ci exit 0
$ npm run check:voice              → check:voice: nothing found
$ npm run check:human-lock         → check:human-lock: no locked words changed

links-absolute 와 roadmap 은 gh 가 원래 레포를 못 읽는 컨테이너라 skipped 예요. PR 의 drift.yml 이 다시 돌려요.

실행법

web/ 에서 NEXT_PUBLIC_BUILD_ENABLED=1 npm run build && npx next start -p 3100 다음 /pattern-lab 을 열고 머리의 To hardware 를 눌러요. 칸이 비어 있으면 「Copy .h」 가 닫혀 있어요. 말과 ```cpp 울타리가 든 답을 칸에 붙이고 「Copy .h」 를 누르면 클립보드엔 #pragma once 부터 } // namespace … 까지만 들어요. 시험만은 npx vitest run src/app/pattern-lab/HardwareModal.test.tsx 예요.

가정

  • 표 줄은 「#pragma once 를 맨 앞에서 찾아요」 라고 했지만, 그 바로 위의 주석 줄은 헤더로 남겨요. 프리셋 헤더(firmware/patternflow/presets/preset_0510.h:1~:8)처럼 라이선스 줄로 여는 헤더를 붙이면 그 줄이 말없이 빠지지 않게 하려고요. 말 한 줄이나 여는 울타리를 만나면 거기서 멈춰요.
  • 울타리 없이 끝에 말이 붙은 답(대화 화면에서 글을 끌어 골라 복사한 것)은 끝을 못 가려요. C++ 이 어디서 끝나는지 짐작해 자르면 코드를 자를 수 있어서, 닫는 울타리만 끝으로 봐요. 대화 앱의 복사 단추는 울타리째 복사해요.
  • 칸 밑 글은 말을 걷어 냈을 때만 한 문장을 더해요. 붙인 칸의 글은 사람이 쓴 그대로 두고, 걷는 것은 .h 에서만이에요.
  • 레이어를 쌓은 길의 「Copy .h」 는 열어 둬요. 바퀴 69 가 칸마다 빈 함수가 든 뼈대도 쓸모가 있다고 열어 뒀고, 그 길은 늘 #pragma once 가 있어 headerLooksReal 이 참이에요.
  • 사진은 NEXT_PUBLIC_BUILD_ENABLED=1 로 다시 빌드해 찍었어요. 그 값이 없으면 To hardware 단추가 머리에 없어요(web/src/lib/community/apiBase.ts:61). 읽는 코드는 바꾸지 않았어요.
  • 표 밖: 쌓은 길의 칸마다 붙이는 글을 다듬는 cleanPastedUnit(web/src/lib/lab/hExport.ts:720)은 첫 울타리만 봐요. 「First add this include:」 아래 울타리 하나, 「Then the layer:」 아래 namespace L0 울타리 하나인 답을 붙이면 null 이라 「not a namespace L0 block」 이 떠요(tsx 로 불러 봤어요).

Changelog

Web

  • Pattern Lab's To hardware keeps only the header from a pasted chat answer. With one code layer, an answer pasted whole went into the .h with the model's words and the ``` fence, and Copy .h on an empty box copied nothing and said Copied. The .h now starts at #pragma once (with the comment lines above it) and stops at the closing fence, and Copy .h waits for a header.

경험

언제: 바퀴에서 빌드한 사이트를 폰 390 과 데스크톱 1440 으로 찍을 때
교훈: ROUND.md 처럼 스크래치에 playwright-core 를 깔지 않고 컨테이너에 든 require("playwright") 를 .cjs 스크립트에서 바로 쓰고, chromium.launch() 에 executablePath 를 주지 않는다
근거: #194 에서 npm i 없이 require("playwright") 와 grantPermissions(["clipboard-read", "clipboard-write"]) 로 To hardware 창을 두 폭으로 찍고 「Copy .h」 가 넣은 클립보드까지 읽었어요

바퀴

바퀴 70 · 후보 5 「To hardware 에 AI 답을 통째로 붙여도 헤더만 남고, 빈 칸에서 「Copy .h」 가 복사했다고 하지 않는다」

다음 바퀴

  • 6 「To hardware 가 숨긴 레이어 대신 보이는 레이어를 번역하게 한다」 · 고른 코드 레이어가 숨김이면 번역 프롬프트에 그 레이어만 들고 보이는 레이어는 빠져요.
  • 7 「Lab 이 만든 C++ 헤더가 노브 값과 이름 때문에 컴파일에 막히지 않는다」 · 반올림해서야 정수가 되는 노브 값이 63f 처럼 .0 없이 나와 g++ 가 멈춰요.
  • 8 「레이어 하나를 반투명이나 곱하기로 두어도 올린 패턴이 미리보기와 같은 밝기다」 · 불투명도 0.5 인 흰 레이어가 미리보기는 128 인데 올린 패턴은 255 예요.

https://claude.ai/code/session_01TBgz26gZ6bndqQai5cUkM1


Generated by Claude Code

@patternflow-bot patternflow-bot changed the title [WIP] 바퀴 70 — 고를 일을 찾는 중 [WIP] To hardware 에 AI 답을 통째로 붙여도 헤더만 남고, 빈 칸에서 「Copy .h」 가 복사했다고 하지 않는다 Oct 24, 2026
A whole answer went into the .h with the model's words and the fence, and
Copy .h copied an empty box and said Copied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TBgz26gZ6bndqQai5cUkM1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TBgz26gZ6bndqQai5cUkM1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TBgz26gZ6bndqQai5cUkM1
@patternflow-bot patternflow-bot changed the title [WIP] To hardware 에 AI 답을 통째로 붙여도 헤더만 남고, 빈 칸에서 「Copy .h」 가 복사했다고 하지 않는다 [DONE] To hardware 에 AI 답을 통째로 붙여도 헤더만 남고, 빈 칸에서 「Copy .h」 가 복사했다고 하지 않는다 Oct 24, 2026
@patternflow-bot
patternflow-bot marked this pull request as ready for review October 24, 2026 01:01
@patternflow-bot
patternflow-bot merged commit d3c3b13 into dev Oct 24, 2026
2 checks passed
@patternflow-bot
patternflow-bot deleted the claude/ops-pf-round70-ubunks branch October 24, 2026 01:03
engmung pushed a commit to engmung/Patternflow that referenced this pull request Oct 25, 2026
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