Skip to content

Add skern init --no-instructions explicit opt-out (#104) - #107

Closed
devrimcavusoglu wants to merge 3 commits into
fix/frontmatter-passthroughfrom
feature/init-no-instructions
Closed

Add skern init --no-instructions explicit opt-out (#104)#107
devrimcavusoglu wants to merge 3 commits into
fix/frontmatter-passthroughfrom
feature/init-no-instructions

Conversation

@devrimcavusoglu

@devrimcavusoglu devrimcavusoglu commented Aug 19, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #104.

  • New --no-instructions flag on skern init: writes nothing, never prompts, regardless of TTY state. Combining it with --instructions, --print-instructions, --target, or --tool-forming-loop is a validation error (exit 2), matching the CLI's convention for bad input.
  • The non-interactive contract is now documented in --help, docs/reference/commands.md, and the agent-setup guide: when stdin is not a TTY or --json is set, skern never prompts and never blocks on input — both questions resolve to "no". This was already the behavior (resolveInstructionChoices gates on isTerminal(stdin)), so the issue's worry about a future blocking read is covered by making it a stated guarantee plus the explicit flag.

Issue DoD

  • Explicit opt-out flag — --no-instructions
  • Documented behavior when stdin is not a TTY — commands reference "Interactivity contract", agent-setup guide, init --help

Also in this PR (docs only)

Addresses claim 1 of #101: GitHub Copilot reads project skills from .github/skills/, .claude/skills/, or .agents/skills/ (GitHub docs), so skern's .agents/skills/ value is valid and no path change is needed. The Copilot platform page and the shared-directory concept section now say so with the citation (mirrors what #105 put in AGENTS.md), and note the one-body-per-name limitation tracked by #47/#101. #101 stays open for claim 2.

Test plan

  • TestInit_NoInstructions_WritesNothing (AGENTS.md present and untouched, instructions: null), TestInit_NoInstructions_TextMode, TestInit_NoInstructions_ConflictsWithOptIn (all four opt-in flags → ValidationError, nothing written)
  • go test ./..., make lint green
  • Manual: skern init --no-instructions in a dir with AGENTS.md → exit 0, file untouched, no prompt; --no-instructions --instructions → exit 2

🤖 Generated with Claude Code

devrimcavusoglu and others added 3 commits August 19, 2026 16:12
init already never prompts when stdin is not a TTY or --json is set, but
that contract was undocumented, so installers had to rely on the prompt
defaulting to "no". Add --no-instructions as an explicit opt-out that
writes nothing and never prompts, reject it with a validation error
(exit 2) when combined with any opt-in flag, and document the
non-interactive contract in --help and the docs.

Closes #104

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot reads project skills from .github/skills, .claude/skills, or
.agents/skills, so skern's value is a valid Copilot path and the shared
cross-agent convention, not a bug. Record that with the GitHub docs
citation on the Copilot page and the shared-directory section, and note
the one-body-per-name limitation that #47/#101 track.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…gs silence prompts

- isTerminal uses golang.org/x/term: /dev/null is a character device but
  not a terminal, so `skern init < /dev/null` printed the prompt.
- Flag conflicts are rejected before .skern/ is created; values (not
  Changed state) are compared so `--instructions=false --no-instructions`
  is accepted.
- Any instruction flag disables both prompts; `init --instructions` on a
  terminal no longer blocks on the tool-forming question.
- isTerminalFn is injectable; new tests prove no prompt text and no stdin
  read under --no-instructions / any flag with a simulated terminal, and
  that the no-flag path really prompts. tests/manual/setup.sh passes
  --no-instructions. Docs/CHANGELOG state the contract precisely.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@devrimcavusoglu
devrimcavusoglu force-pushed the feature/init-no-instructions branch from d912a47 to 196d7a8 Compare August 19, 2026 13:14
@devrimcavusoglu
devrimcavusoglu changed the base branch from main to fix/frontmatter-passthrough August 19, 2026 13:14
@devrimcavusoglu

Copy link
Copy Markdown
Owner Author

Review (adversarial pass against #104, and #101 claim 1)

#104 DoD: flag ✅; documented non-TTY behavior — the documentation was right in spirit but the code had a real hole, now fixed (196d7a8):

Sev Finding Resolution
High isTerminal used ModeCharDevice; /dev/null is a character device, so skern init < /dev/null (installer / cron / docker run without -i) still printed the prompt (EOF → "no", so it never blocked — but "never prompts" was false) Real isatty check via golang.org/x/term (+ TestIsTerminal_NonTTYInputs)
Medium Flag-conflict exit 2 happened after .skern/ was created Flags validated before any filesystem write; test asserts .skern/ absent
Medium Docs said "pass --instructions to run non-interactively", but on a TTY --instructions still stopped to ask about the tool-forming loop Any instruction flag now disables both prompts; an unasked question keeps its default. CHANGELOG › Fixed entry
Medium Tests would pass with the flag body deleted (--json already gated prompts) isTerminalFn is injectable; new tests simulate a terminal and prove no prompt text / no stdin read under --no-instructions and under every flag, and that the no-flag path really prompts
Low --instructions=false --no-instructions rejected (compared Changed, not value) Values compared; explicit false accepted
Low tests/manual/setup.sh ran init --quiet (would hang on a TTY) Passes --no-instructions

#101 claim 1: verified against GitHub's page (project skills in .github/skills, .claude/skills, or .agents/skills; personal in ~/.copilot/skills or ~/.agents/skills) — docs statement is accurate, DoD item 1 met via "documented with rationale".

Stacked on #106 (base fix/frontmatter-passthrough) so the CHANGELOG/AGENTS.md edits merge cleanly in order; CI runs once the base becomes main.

@devrimcavusoglu

Copy link
Copy Markdown
Owner Author

Closed automatically by GitHub when the stacked base branch was deleted after #106 merged. Continued as #110 (same branch, rebased onto main).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

skern init prompts interactively with no non-interactive opt-out

1 participant