Skip to content

実装: prekによるpre-commit staged TS/JS lintの小規模trial導入 #2552

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1932"
goal_ref: "#1933のresearch決定(prekによるpre-commit限定のstaged TS/JS ESLint小規模trial導入、pre-pushは非導入)を、非破壊的な設定ファイル・ドキュメント・isolated fixtureテストとして実装する"
change_kind: feature

Parent Issue

#1932

Parent Goal Ref

Goal: GitHub 品質ゲート体系(ローカル pre-commit/pre-push・AI エージェント向けゲート改変対策・シナリオテスト required/nightly 分離)を整備する
Desired Destination: 各 child issue(research)が調査・方針決定を行い、方針が「実装が必要」と判定された場合は implementation child issue を追加起票する

Current Validated Scope

本Issueのwrite-capable scopeは、#1933のresearch決定に基づく以下のみ:

ユーザーの実 .git/hooks への prek install 実行は本Issueのスコープに含めない(isolated fixture内でのみ動作確認する)。

Remaining Parent Gaps

Outcome

prek.toml(pre-commit stageのみ、staged TS/JS向け軽量ESLint設定)・prekのバージョンをpinしたpackage.json・install/bypass/uninstall/既存hook保存等を明記したdocs/dev/local-hooks.md・isolated fixtureで動作確認するscripts/dev-hooks/verify_precommit_trial.shが追加され、./scripts/dev-hooks/verify_precommit_trial.sh(実行可能ビット付与、手動実行でPASS確認)ができ、pnpm typecheck/pnpm lint/pnpm test/pnpm buildが全てPASSしている状態。ユーザーの実.git/hooksは変更されない。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: ゲーム/プロダクトのランタイム挙動を変更しない開発ツール設定・ドキュメント追加であり、動作確認はisolated fixture上のVC(scripts/dev-hooks/verify_precommit_trial.sh)で完結するため。

In Scope

  • prek.toml の新規作成: pre-commit stageのみ、language: systemでstaged TS/JSファイルに対しeslintバイナリを--経由で直接呼び出す設定(pnpm lintのeslint .をそのまま呼ばない)
  • package.json devDependenciesへの prek バージョンpin追加
  • docs/dev/local-hooks.md 新規作成: 以下を明記
  • scripts/dev-hooks/verify_precommit_trial.sh 新規作成(実行可能ビット付与、#!/usr/bin/env bash shebangにより./scripts/dev-hooks/verify_precommit_trial.shとして直接実行可能にする): isolated temporary git repositoryを作成し、(a) lintエラーを含むstaged TS/JSファイルでcommitがブロックされること、(b) --no-verifyでbypassできること、(c) prekバイナリ不在環境をシミュレートした場合の挙動、を確認し、結果に応じてexit code 0/非0を返す

Out of Scope

Acceptance Criteria

  • AC1 prek.toml が作成され、pre-commit stageのみ定義されており、eslintを--経由で直接呼び出す設定になっている(pre-push stage定義を含まない)
  • AC2 package.json devDependenciesに prek のバージョンがpinされている
  • AC3 docs/dev/local-hooks.md が作成され、install/bootstrap・version pin・bypass・uninstall・.legacy退避・worktree挙動・依存不足時挙動・partial-stage挙動・pre-push非導入理由・調査: AI エージェント向けゲート改変リスク対策と CLAUDE.md 整備方針の決定 #1934/調査: シナリオテスト・動作検証の required/nightly 分離方針の決定 #1935/#1860との責務境界・test-runner/CIとの責務分離が明記されている
  • AC4 scripts/dev-hooks/verify_precommit_trial.sh が実行可能ビット付きで作成されている(VCではファイル存在のみ確認。実行可能ビット・実際の動作確認はVC preflight allowlist外のため手動実行での確認とする)。実装者は本スクリプトを手動実行(./scripts/dev-hooks/verify_precommit_trial.sh)し、isolated fixture上でpre-commit hookの動作(lintエラー検知によるblock・--no-verifyによるbypass)がPASSすることをPR本文の実行ログで示す
  • AC5 pnpm typecheck / pnpm lint / pnpm test / pnpm build が全てPASSする(既存コードへの影響がないことの確認)
  • AC6 ユーザーの実.git/hooksディレクトリが本Issueの実装によって変更されていない

Verification Commands

# AC1
# baseline-expect: fail
$ test -f prek.toml
# AC1
# baseline-expect: fail
$ rg -c "pre-push" prek.toml
# AC2
# baseline-expect: fail
$ rg -n "\"prek\"" package.json
# AC3
# baseline-expect: fail
$ test -f docs/dev/local-hooks.md
# AC4
# baseline-expect: fail
$ test -f scripts/dev-hooks/verify_precommit_trial.sh
# AC5
# baseline-expect: pass
$ pnpm typecheck
# AC5
# baseline-expect: pass
$ pnpm lint
# AC5
# baseline-expect: pass
$ pnpm test
# AC5
# baseline-expect: pass
$ pnpm build
# AC6
# baseline-expect: pass
$ git status --short .git/hooks

Allowed Paths

  • prek.toml
  • package.json
  • pnpm-lock.yaml
  • docs/dev/local-hooks.md
  • scripts/dev-hooks/verify_precommit_trial.sh

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • ユーザーの実 .git/hooks への書き込み・prek install の実行が必要と判明した場合(本Issueのスコープ外であり、isolated fixtureで代替する)

Required Skills

  • TypeScript / ESLint CLI
  • Bash scripting(isolated git fixture構築)
  • なし(Python)

Required Design References

Scope Delta(任意)

N/A

Delivery Rule

  • 1 Issue = 1 PR で完結する
  • fresh origin/main ベースの専用worktree/branchで作業する
  • Draft PRとして起票する

Activity

  1. squne121 commented on Sep 6, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告

    • status: approved
    • iteration 数: rewrite 3回(VC preflight allowlist違反修正: bashブロック回避・baseline-expectアノテーション位置修正・test flag修正)
    • canonical Step 2: run_root_review_pipeline.py produce → canonical_step2_route: step_2_5(deterministic APPROVE)
    • Step 2.5 semantic design review applicability: semantic_review_applicable: false(新規機会issueであり、checker_gap/heuristic_concern/severity_tagged_anchor_findings/owner_decision_conflict/cross_contract_changeいずれも該当なし)→ スキップして直接終端へ
    • 最終 body_sha256: sha256:428039d4f698e03945dc9d4af869917e463e9b17c7b3a91ca408d31e7d4493eb
    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: ""
        generated_at: "2026-09-06T22:56:00Z"
        body_sha256: "sha256:428039d4f698e03945dc9d4af869917e463e9b17c7b3a91ca408d31e7d4493eb"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "phase/implementation label already applied at issue creation time"
      auto_fixes:
        result: auto_fixed
        required:
          - kind: known_marker_fix
            executor: implementation-worker
            result: applied
            evidence:
              before: "VC used bash interpreter / misplaced baseline-expect annotations / unsupported test -x flag"
              after: "VC uses direct test -f / rg / pnpm commands within preflight allowlist, baseline-expect annotations placed before command line"
              comment_url: ""
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-09-06T22:56:00Z"
      checked_body_sha256: "sha256:428039d4f698e03945dc9d4af869917e463e9b17c7b3a91ca408d31e7d4493eb"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
  2. squne121 commented on Sep 6, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-09-06T23:17:23Z)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    phase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions