CodeSampleX

Sample

github.com/mattn/go-isatty v0.0.17

Verified sample for golang github.com/mattn/go-isatty v0.0.17. The contract ran on go 1.26 · linux alpine/x64 · docker and passed.

sha256:7c295929bdcf2e630fd157ce2047cb0fa8621073302e217e7b57139e3ee67a34

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment go 1.26 linux 24 · ubuntu · glibc 2.39 x64 go 1.26 go go 1

Verification-run environments

Environment Contract Stages Run
go 1.26 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · golang@1
2026-08-20

Case

HOW
Goal
verify pkg:golang/github.com/mattn/go-isatty@v0.0.17
Packages
Environment
go 1.26.6
Created
2026-08-19T23:38:15Z

Contract

  1. isatty.IsTerminal returns false for regular file descriptors
  2. isatty.IsTerminal returns false for invalid file descriptors
  3. isatty.IsCygwinTerminal returns false for regular file descriptors
  4. isatty.IsCygwinTerminal returns false for invalid file descriptors

Files

  • PROMPT.md
  • csx.json
  • go.mod
  • go.sum
  • main.go
  • spec.json
  • test/contract.go

Download the source artifact (tar.gz)

Source

PROMPT.md
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 pkg:golang/github.com/mattn/go-isatty@v0.0.17
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/github.com/mattn/go-isatty@v0.0.17
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.2

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.
csx.json
{"case":{"caseId":"case:sha256:93d6e78e85efd3b47d77510d3bb1a14079c65b6a32afbb6d35ec908eceaf5f44","contract":["isatty.IsTerminal returns false for regular file descriptors","isatty.IsTerminal returns false for invalid file descriptors","isatty.IsCygwinTerminal returns false for regular file descriptors","isatty.IsCygwinTerminal returns false for invalid file descriptors"],"goal":"verify pkg:golang/github.com/mattn/go-isatty@v0.0.17","kind":"HOW","packages":["pkg:golang/github.com/mattn/go-isatty@v0.0.17"],"schemaVersion":1},"contractCommand":["go","run","./test"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"golang","language":"go","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"go","packageManagerVersion":"1.26.6","runtime":"go","runtimeVersion":"1.26.6","schemaVersion":1},"license":"MIT-0","packages":["pkg:golang/github.com/mattn/go-isatty@v0.0.17"],"schemaVersion":1,"verifierAdapter":"golang@1"}
go.mod
module example.com/isattysample

go 1.26.6

require github.com/mattn/go-isatty v0.0.17

require golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
go.sum
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
main.go
package main

import (
	"fmt"
	"os"

	"github.com/mattn/go-isatty"
)

// CheckTerminal demonstrates checking whether standard streams are terminal devices.
func CheckTerminal(fd uintptr) (isTerminal bool, isCygwin bool) {
	return isatty.IsTerminal(fd), isatty.IsCygwinTerminal(fd)
}

func main() {
	term, cygwin := CheckTerminal(os.Stdout.Fd())
	fmt.Printf("Stdout - isTerminal: %t, isCygwin: %t\n", term, cygwin)
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:golang/github.com/mattn/go-isatty@v0.0.17",
  "kind": "HOW",
  "packages": [
    "pkg:golang/github.com/mattn/go-isatty@v0.0.17"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
test/contract.go
package main

import (
	"fmt"
	"os"

	"github.com/mattn/go-isatty"
)

func main() {
	// Assertion 1: isatty.IsTerminal returns false for regular file descriptors
	tmpFile, err := os.CreateTemp("", "isatty_contract_*.tmp")
	if err != nil {
		fmt.Fprintf(os.Stderr, "FAIL: failed to create temporary file: %v\n", err)
		os.Exit(1)
	}
	defer os.Remove(tmpFile.Name())
	defer tmpFile.Close()

	if isatty.IsTerminal(tmpFile.Fd()) {
		fmt.Fprintf(os.Stderr, "FAIL: isatty.IsTerminal returned true for regular file descriptor\n")
		os.Exit(1)
	}

	// Assertion 2: isatty.IsTerminal returns false for invalid file descriptors
	invalidFd := ^uintptr(0)
	if isatty.IsTerminal(invalidFd) {
		fmt.Fprintf(os.Stderr, "FAIL: isatty.IsTerminal returned true for invalid file descriptor\n")
		os.Exit(1)
	}

	// Assertion 3: isatty.IsCygwinTerminal returns false for regular file descriptors
	if isatty.IsCygwinTerminal(tmpFile.Fd()) {
		fmt.Fprintf(os.Stderr, "FAIL: isatty.IsCygwinTerminal returned true for regular file descriptor\n")
		os.Exit(1)
	}

	// Assertion 4: isatty.IsCygwinTerminal returns false for invalid file descriptors
	if isatty.IsCygwinTerminal(invalidFd) {
		fmt.Fprintf(os.Stderr, "FAIL: isatty.IsCygwinTerminal returned true for invalid file descriptor\n")
		os.Exit(1)
	}

	fmt.Println("PASS: go-isatty contracts verified")
}

Origin Seeder

anonymous