feat: explicit --mode / HOSTDOC_MODE + mode-derivation footgun warning (#39) - #48
Merged
Conversation
Adds --mode / HOSTDOC_MODE to pin the derived hosting mode (B), plus stderr warnings when a forced mode ignores fields or when a higher-precedence bucket is shadowed by a config domain (D). Rejects direction C (auto precedence flip) as too surprising. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
4 tasks (TDD): forced-mode pin + warn injection, shadow detection, CLI --mode wiring, docs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…main (#39) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…39) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The forced-mode-from-env case ignores config domain/distribution, whose default stderr warning leaked into test output. Inject a no-op warn; the warning itself is asserted in dedicated cases. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The publish command spread `mode` into runPublish's args via overrides(), but runPublish rebuilt the Overrides for resolveConfig inline and dropped `mode` — so `hostdoc publish --mode s3-website` (the documented interface) was silently ignored and still resolved via the config file's domain. HOSTDOC_MODE env still worked because resolveConfig reads env directly. Add `mode?: Mode` to PublishArgs and pass `mode: args.mode` to resolveConfig. Regression test drives runPublish --dry-run with a cloudfront ambient config and asserts --mode s3-website forces the s3-website URL. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Normalize the forced-mode value to lowercase before matching (so S3-Website, CLOUDFRONT, SELF-HOSTED all resolve), while echoing the user's original spelling in the invalid-mode error. Genuine typos (e.g. s3website) still error. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
🎉 This PR is included in version 1.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This was referenced Jul 11, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #39.
문제
mode는 저장되지 않고 병합된 config에서 파생된다(
domain+distributionId→ cloudfront;serveRoot→ self-hosted; elsebucket+region→ s3-website). 그래서 cloudfront config 파일 위에HOSTDOC_BUCKET만 얹어도 파일의domain이 파생을 이겨 s3-website로 못 바꾸고, 그 bucket은 경고 없이 조용히 무시됐다. mode를 강제할 env/flag도 없었다.변경 (방향 B + D, C는 기각)
--mode/HOSTDOC_MODE로 파생 mode를 강제 (s3-website|cloudfront|self-hosted).--modeflag >HOSTDOC_MODEenv, 파일엔 저장/조회 안 함(파생값 원칙 유지). 강제한 mode의 필수 필드만 검증하고, 안 쓰는 필드는 무시 + stderr 경고.bucket을domain보다 높은 precedence로 줬는데도 cloudfront로 파생되면 stderr 경고(Use --mode s3-website to force s3-website.). 출처 레벨은pick()헬퍼로 추적.bucket은 cloudfront에서도 정상 필드라 더 놀랍고 위험. 강제(B)는 명시적, shadow는 경고만.resolveConfig는 순수 유지 — 경고 출력은 주입식opts.warn(기본 stderr).--mode/HOSTDOC_MODE+ 함정 문서화.하위호환
기존 5개
resolveConfig호출부는 1-인자 형태 그대로. 추가된 2번째 인자는 optional이라 동작 무변경. mode 미지정 & 함정 아닌 경로는 경고 0건.테스트
test/config.test.ts에 forced-mode 7종 + shadow 4종 추가(TDD, RED→GREEN). 전체 324/324 통과, build·typecheck clean, 출력 pristine. AWS creds·네트워크·Terraform 없이 통과.참고
docs/superpowers/specs/2026-07-06-explicit-mode-control-design.mddocs/superpowers/plans/2026-07-06-explicit-mode-control.md🤖 Generated with Claude Code