샘플
github.com/manifoldco/promptui v0.9.0: Prompt
검증된 샘플 — golang github.com/manifoldco/promptui v0.9.0: Prompt. go 1.26 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: promptui.Prompt runs text input…
sha256:099871f2f46c7ddce3b638b0f7f92de81ff7a56dd54c158be1cce506d75fd828
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 1
- 빌드한 서명 키
- 1
선언된 환경
linux 24 · ubuntu · glibc 2.39 x64 go
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| go 1.26 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · golang@1golang:1.26-alpine@sha256:28d89ee9cc0f… |
2026-08-28 |
케이스
HOW- 목표
- verify github.com/manifoldco/promptui.Prompt in pkg:golang/github.com/manifoldco/promptui@v0.9.0
- 심벌
-
- github.com/manifoldco/promptui.Prompt
- 생성일
- 2026-08-28T00:51:59Z
컨트랙트
- promptui.Prompt runs text input prompt and returns entered string
- promptui.Prompt with Default uses default value when empty input is submitted
- promptui.Prompt with Validate validates user input using ValidateFunc and rejects invalid values
- promptui.Prompt with Mask hides characters for confidential input
- promptui.Prompt with IsConfirm handles yes/no confirmation prompts
- promptui.Prompt with PromptTemplates renders custom prompt formatting with template colors
파일
- PROMPT.md
- csx.json
- go.mod
- go.sum
- main.go
- spec.json
- test/contract.go
소스
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify github.com/manifoldco/promptui.Prompt in pkg:golang/github.com/manifoldco/promptui@v0.9.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:golang/github.com/manifoldco/promptui@v0.9.0
Demonstrate these symbols/APIs:
- github.com/manifoldco/promptui.Prompt
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:522bb7d7618db98b7f6bbb28e3ed12137e1a14c25b0a61ca2656413678666d69","contract":["promptui.Prompt runs text input prompt and returns entered string","promptui.Prompt with Default uses default value when empty input is submitted","promptui.Prompt with Validate validates user input using ValidateFunc and rejects invalid values","promptui.Prompt with Mask hides characters for confidential input","promptui.Prompt with IsConfirm handles yes/no confirmation prompts","promptui.Prompt with PromptTemplates renders custom prompt formatting with template colors"],"goal":"verify github.com/manifoldco/promptui.Prompt in pkg:golang/github.com/manifoldco/promptui@v0.9.0","kind":"HOW","packages":["pkg:golang/github.com/manifoldco/promptui@v0.9.0"],"schemaVersion":1,"symbols":["github.com/manifoldco/promptui.Prompt"]},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/manifoldco/promptui@v0.9.0"],"schemaVersion":1,"subject":"pkg:golang/github.com/manifoldco/promptui@v0.9.0","symbols":["github.com/manifoldco/promptui.Prompt"],"verifierAdapter":"golang@1"}
module sample
go 1.26.6
require github.com/manifoldco/promptui v0.9.0
require (
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b // indirect
)
github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA=
github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b h1:MQE+LT/ABUuuvEZ+YQAMSXindAdUh7slEmAkup74op4=
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
package main
import (
"fmt"
"github.com/manifoldco/promptui"
)
func main() {
prompt := promptui.Prompt{
Label: "Username",
}
fmt.Printf("Configured prompt with label %q\n", prompt.Label)
}
{
"schemaVersion": 1,
"goal": "verify github.com/manifoldco/promptui.Prompt in pkg:golang/github.com/manifoldco/promptui@v0.9.0",
"kind": "HOW",
"packages": [
"pkg:golang/github.com/manifoldco/promptui@v0.9.0"
],
"symbols": [
"github.com/manifoldco/promptui.Prompt"
]
}
package main
import (
"bytes"
"errors"
"fmt"
"io"
"os"
"strings"
"github.com/manifoldco/promptui"
)
type nopWriteCloser struct {
io.Writer
}
func (n nopWriteCloser) Close() error { return nil }
func main() {
if err := runContract(); err != nil {
fmt.Fprintf(os.Stderr, "Contract verification failed: %v\n", err)
os.Exit(1)
}
fmt.Println("All promptui.Prompt contract assertions passed successfully.")
}
func runContract() error {
// 1. promptui.Prompt runs text input prompt and returns entered string
var out1 bytes.Buffer
p1 := promptui.Prompt{
Label: "Username",
Stdin: io.NopCloser(strings.NewReader("octocat\n")),
Stdout: nopWriteCloser{&out1},
}
val1, err := p1.Run()
if err != nil {
return fmt.Errorf("p1.Run failed: %w", err)
}
if val1 != "octocat" {
return fmt.Errorf("expected val1 'octocat', got %q", val1)
}
// 2. promptui.Prompt with Default uses default value when empty input is submitted
var out2 bytes.Buffer
p2 := promptui.Prompt{
Label: "Port",
Default: "8080",
Stdin: io.NopCloser(strings.NewReader("\r\n")),
Stdout: nopWriteCloser{&out2},
}
val2, err := p2.Run()
if err != nil {
return fmt.Errorf("p2.Run failed: %w", err)
}
if val2 != "8080" {
return fmt.Errorf("expected default '8080', got %q", val2)
}
// 3. promptui.Prompt with Validate validates user input using ValidateFunc and rejects invalid values
validateEmail := func(s string) error {
if !strings.Contains(s, "@") {
return errors.New("missing @ symbol")
}
return nil
}
if err := validateEmail("invalid-email"); err == nil {
return fmt.Errorf("expected validation failure for invalid email")
}
if err := validateEmail("dev@example.com"); err != nil {
return fmt.Errorf("expected validation success for valid email, got: %w", err)
}
var out3 bytes.Buffer
p3 := promptui.Prompt{
Label: "Email",
Validate: validateEmail,
Stdin: io.NopCloser(strings.NewReader("dev@example.com\n")),
Stdout: nopWriteCloser{&out3},
}
val3, err := p3.Run()
if err != nil {
return fmt.Errorf("p3.Run failed: %w", err)
}
if val3 != "dev@example.com" {
return fmt.Errorf("expected email 'dev@example.com', got %q", val3)
}
// 4. promptui.Prompt with Mask hides characters for confidential input
var out4 bytes.Buffer
p4 := promptui.Prompt{
Label: "Password",
Mask: '*',
Stdin: io.NopCloser(strings.NewReader("secret123\n")),
Stdout: nopWriteCloser{&out4},
}
val4, err := p4.Run()
if err != nil {
return fmt.Errorf("p4.Run failed: %w", err)
}
if val4 != "secret123" {
return fmt.Errorf("expected mask prompt value 'secret123', got %q", val4)
}
// 5. promptui.Prompt with IsConfirm handles yes/no confirmation prompts
var out5 bytes.Buffer
p5 := promptui.Prompt{
Label: "Continue",
IsConfirm: true,
Stdin: io.NopCloser(strings.NewReader("y\n")),
Stdout: nopWriteCloser{&out5},
}
val5, err := p5.Run()
if err != nil {
return fmt.Errorf("p5.Run failed: %w", err)
}
if val5 != "y" && val5 != "Y" {
return fmt.Errorf("expected confirmation 'y' or 'Y', got %q", val5)
}
// 6. promptui.Prompt with PromptTemplates renders custom prompt formatting with template colors
var out6 bytes.Buffer
p6 := promptui.Prompt{
Label: "Custom Prompt",
Templates: &promptui.PromptTemplates{
Prompt: "{{ . | bold }} ",
Valid: "{{ . | green }} ",
Invalid: "{{ . | red }} ",
Success: "{{ . | bold | green }} ",
},
Stdin: io.NopCloser(strings.NewReader("custom-value\n")),
Stdout: nopWriteCloser{&out6},
}
val6, err := p6.Run()
if err != nil {
return fmt.Errorf("p6.Run failed: %w", err)
}
if val6 != "custom-value" {
return fmt.Errorf("expected custom prompt value 'custom-value', got %q", val6)
}
return nil
}
오리진 시더
익명