CodeSampleX

Пример

github.com/shurcooL/sanitized_anchor_name v1.0.0: Create

Проверенный пример — golang github.com/shurcooL/sanitized_anchor_name v1.0.0: Create. Контракт выполнен на go 1.26 · linux alpine/x64 · docker и пройден.

sha256:d1e1795eed547d33888afc2bad4d19028d7aa42620166bfc34adbc9a28d46ccf

Эта сеть предлагает одно: образец, который собирается. Она запустила его в песочнице и сохранила подписанную квитанцию. Она ничего не оценивает и ничего не гарантирует — собирается ли тот же код у вас, она не измеряла. Сколько различных ключей подписи подали пройденную квитанцию контракта. Один — только автор; больше одного — значит, кто-то ещё тоже собрал. Ключ создаётся сам и не имеет зарегистрированной личности, поэтому считаются ключи, а не люди. 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/shurcooL/sanitized_anchor_name.Create in pkg:golang/github.com/shurcooL/sanitized_anchor_name@v1.0.0
Пакеты
Символы
  • github.com/shurcooL/sanitized_anchor_name.Create
Создан
2026-08-28T00:06:49Z

Контракт

  1. sanitized_anchor_name.Create converts uppercase letters to lowercase and spaces to hyphens
  2. sanitized_anchor_name.Create strips punctuation and handles version numbers
  3. sanitized_anchor_name.Create trims leading and trailing whitespace and collapses multiple spaces
  4. sanitized_anchor_name.Create preserves non-ASCII Unicode letters
  5. sanitized_anchor_name.Create returns an empty string for empty or whitespace-only input

Файлы

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

Скачать артефакт с исходным кодом (tar.gz)

Исходный код

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 github.com/shurcooL/sanitized_anchor_name.Create in pkg:golang/github.com/shurcooL/sanitized_anchor_name@v1.0.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:golang/github.com/shurcooL/sanitized_anchor_name@v1.0.0
Demonstrate these symbols/APIs:
  - github.com/shurcooL/sanitized_anchor_name.Create

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:6ce480bfc3681680a6037170950a2a8628af8dfd77dc92378660a11df45601c8","contract":["sanitized_anchor_name.Create converts uppercase letters to lowercase and spaces to hyphens","sanitized_anchor_name.Create strips punctuation and handles version numbers","sanitized_anchor_name.Create trims leading and trailing whitespace and collapses multiple spaces","sanitized_anchor_name.Create preserves non-ASCII Unicode letters","sanitized_anchor_name.Create returns an empty string for empty or whitespace-only input"],"goal":"verify github.com/shurcooL/sanitized_anchor_name.Create in pkg:golang/github.com/shurcooL/sanitized_anchor_name@v1.0.0","kind":"HOW","packages":["pkg:golang/github.com/shurcooL/sanitized_anchor_name@v1.0.0"],"schemaVersion":1,"symbols":["github.com/shurcooL/sanitized_anchor_name.Create"]},"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/shurcooL/sanitized_anchor_name@v1.0.0"],"schemaVersion":1,"subject":"pkg:golang/github.com/shurcooL/sanitized_anchor_name@v1.0.0","symbols":["github.com/shurcooL/sanitized_anchor_name.Create"],"verifierAdapter":"golang@1"}
go.mod
module sample

go 1.22

require github.com/shurcooL/sanitized_anchor_name v1.0.0
go.sum
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
main.go
package main

import (
	"fmt"

	"github.com/shurcooL/sanitized_anchor_name"
)

func main() {
	title := "User Guide & Reference (v1.0)"
	anchor := sanitized_anchor_name.Create(title)
	fmt.Printf("Input: %s -> Anchor: %s\n", title, anchor)
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify github.com/shurcooL/sanitized_anchor_name.Create in pkg:golang/github.com/shurcooL/sanitized_anchor_name@v1.0.0",
  "kind": "HOW",
  "packages": [
    "pkg:golang/github.com/shurcooL/sanitized_anchor_name@v1.0.0"
  ],
  "symbols": [
    "github.com/shurcooL/sanitized_anchor_name.Create"
  ]
}
test/contract.go
package main

import (
	"fmt"
	"os"

	"github.com/shurcooL/sanitized_anchor_name"
)

func main() {
	if err := runContract(); err != nil {
		fmt.Fprintf(os.Stderr, "Contract verification failed: %v\n", err)
		os.Exit(1)
	}
	fmt.Println("All sanitized_anchor_name.Create contract assertions passed successfully.")
}

func runContract() error {
	// Assertion 1: sanitized_anchor_name.Create converts uppercase letters to lowercase and spaces to hyphens
	heading1 := "Getting Started"
	expected1 := "getting-started"
	if got := sanitized_anchor_name.Create(heading1); got != expected1 {
		return fmt.Errorf("assertion 1 failed: expected %q, got %q", expected1, got)
	}

	// Assertion 2: sanitized_anchor_name.Create strips punctuation and handles version numbers
	heading2 := "Features & Capabilities (v2.0)!"
	expected2 := "features-capabilities-v2-0"
	if got := sanitized_anchor_name.Create(heading2); got != expected2 {
		return fmt.Errorf("assertion 2 failed: expected %q, got %q", expected2, got)
	}

	// Assertion 3: sanitized_anchor_name.Create trims leading and trailing whitespace and collapses multiple spaces
	heading3 := "   Whitespace   Trimming   Test   "
	expected3 := "whitespace-trimming-test"
	if got := sanitized_anchor_name.Create(heading3); got != expected3 {
		return fmt.Errorf("assertion 3 failed: expected %q, got %q", expected3, got)
	}

	// Assertion 4: sanitized_anchor_name.Create preserves non-ASCII Unicode letters
	heading4 := "Chapitre 1: Introduction à la programmation"
	expected4 := "chapitre-1-introduction-à-la-programmation"
	if got := sanitized_anchor_name.Create(heading4); got != expected4 {
		return fmt.Errorf("assertion 4 failed: expected %q, got %q", expected4, got)
	}

	// Assertion 5: sanitized_anchor_name.Create returns an empty string for empty or whitespace-only input
	heading5 := "   \t\n   "
	expected5 := ""
	if got := sanitized_anchor_name.Create(heading5); got != expected5 {
		return fmt.Errorf("assertion 5 failed: expected %q, got %q", expected5, got)
	}

	return nil
}

Исходный сидер

аноним