Skip to content

feat: implement ai-assisted authoring flow and metadata generation#23

Merged
dubscode merged 2 commits into
mainfrom
feat/ai-authoring-flow
Mar 8, 2026
Merged

feat: implement ai-assisted authoring flow and metadata generation#23
dubscode merged 2 commits into
mainfrom
feat/ai-authoring-flow

Conversation

@dubscode
Copy link
Copy Markdown
Contributor

@dubscode dubscode commented Mar 8, 2026

Introduced the dub flow (alias f) command and enhanced the existing create and submit workflows with tri-state AI resolution. The system now supports repo-local defaults for AI authoring, enabling users to toggle automated metadata generation via dub config ai-defaults <create|submit|flow> on|off or per-invocation flags (--ai vs --no-ai).

Runtime and Product Behavior

  • End-to-end AI Flow: New dub flow command orchestrates staging changes, generating branch/commit/PR metadata, and executing creation and submission in one interactive step.
  • Template-Aware Generation: AI now respects repository-specific formatting by reading .gitmessage templates for commits and GitHub PR templates for pull request descriptions.
  • AI PR Summaries: dub submit --ai generates a descriptive body for pull requests while preserving the commit-derived title for squash-merge safety.
  • Rich Terminal UI: Implemented a new terminal renderer in packages/cli/src/lib/terminal-render.ts that provides live status lines, tool activity visibility, and formatted markdown previews for AI-generated content.
  • Metadata Management: Enhanced PR body composition to include AI summary markers (<!-- dubstack-ai-summary:start -->), allowing DubStack to replace generated summaries while preserving user-authored freeform text.

Internal Libraries and Config

  • Shared AI Logic: Centralized LLM prompting, JSON parsing, and validation logic into packages/cli/src/lib/ai-metadata.ts.
  • Config Schema: Extended DubConfig to support ai.defaults for granular control over automated authoring behaviors.
  • Temporary File Handling: Added packages/cli/src/lib/temp-text-file.ts to manage the lifecycle of generated metadata during interactive edit sessions.

Documentation and Skills

  • AI Guide Overhaul: Rewrote apps/docs/content/docs/guides/ai-assistant.mdx into a comprehensive guide covering setup, precedence, and conflict resolution.
  • Command References: Updated create and submit documentation to reflect new flags and template support.
  • Agent Skills: Refined bundled agent skills (skills/dubstack and skills/dub-flow) to teach coding assistants how to use the high-level AI flows.

Testing and Evals

  • Evalite Integration: Added an LLM evaluation suite in packages/cli/evals/dub-flow-metadata.eval.ts to score the quality and fidelity of generated branch, commit, and PR metadata against real diffs.
  • Regression Tests: Expanded unit and integration coverage for submit, flow, and the new config subcommands.
  • Development Gated: Introduced pnpm check:all as a comprehensive gate including formatting, types, tests, and AI evals.

🥞 DubStack

Copilot AI review requested due to automatic review settings March 8, 2026 18:01
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dubstack Ready Ready Preview, Comment Mar 8, 2026 6:28pm

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements an AI-assisted authoring workflow in the DubStack CLI, including repo-configurable AI defaults, AI-generated PR description summaries, and a new end-to-end dub flow command, plus supporting UX, evals, and documentation updates.

Changes:

  • Add tri-state AI enablement (--ai / --no-ai / repo default) for dub create, dub submit, and new dub flow, with dub config ai-defaults <create|submit|flow>.
  • Introduce shared AI metadata generation + template reading, and update PR body composition to safely insert/replace an AI-managed summary section.
  • Add terminal markdown rendering for AI streaming, plus Evalite-based local evals and broad docs/skill updates for the new workflow.

Reviewed changes

Copilot reviewed 50 out of 53 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
skills/dubstack/SKILL.md Documents new AI create/submit/flow commands and setup/precedence.
skills/dub-flow/SKILL.md Updates flow skill to prefer dub flow and include PR description/template guidance.
pnpm-workspace.yaml Adds better-sqlite3 to built deps; normalizes workspace glob formatting.
packages/cli/test/commands/flow.test.ts Adds integration-style test coverage for flow() behavior.
packages/cli/src/lib/terminal-render.ts Adds reusable terminal renderer for markdown previews/status/tool activity.
packages/cli/src/lib/terminal-render.test.ts Tests terminal renderer formatting behavior in TTY vs non-TTY.
packages/cli/src/lib/temp-text-file.ts Adds temp markdown file helpers for file-backed git/gh operations.
packages/cli/src/lib/temp-text-file.test.ts Tests temp file lifecycle and cleanup on success/failure.
packages/cli/src/lib/pr-body.ts Adds AI summary markers + updated PR body composition logic.
packages/cli/src/lib/pr-body.test.ts Tests AI summary strip/replace behavior and updated composition.
packages/cli/src/lib/metadata-templates.ts Reads PR/commit templates from common repo locations and git config.
packages/cli/src/lib/metadata-templates.test.ts Tests template discovery and commit template resolution via mocked git config.
packages/cli/src/lib/git.ts Adds commitStagedFromFile() and getDiffBetween() helpers.
packages/cli/src/lib/git.test.ts Adds tests for new git helpers.
packages/cli/src/lib/config.ts Extends repo-local config with ai.defaults and DeepPartial write/read support.
packages/cli/src/lib/config.test.ts Tests config default normalization and persistence for AI defaults.
packages/cli/src/lib/ai-metadata.ts Introduces shared AI metadata generation (branch/commit/PR description) with template support.
packages/cli/src/lib/ai-metadata.test.ts Tests provider selection, parsing/normalization, and template prompt inclusion.
packages/cli/src/index.ts Wires new flow command + new AI flags (--no-ai) and config ai-defaults subcommand.
packages/cli/src/commands/submit.ts Adds AI PR description generation, summary overrides, and safe temp-file body updates.
packages/cli/src/commands/submit.test.ts Adds tests for submit AI behavior, overrides, and diff selection.
packages/cli/src/commands/flow.ts Adds new AI-assisted flow() orchestration command.
packages/cli/src/commands/flow.test.ts Unit tests for flow staging/preview/approval and delegation behavior.
packages/cli/src/commands/create.ts Refactors create to use shared AI metadata, repo defaults, and file-backed commits for multiline messages.
packages/cli/src/commands/create.test.ts Adds tests for repo-default AI behavior, --no-ai override, and multiline commit message handling.
packages/cli/src/commands/config.ts Adds configAiDefaults() and standardizes boolean config result type.
packages/cli/src/commands/config.test.ts Tests ai-defaults read/write behavior and validation.
packages/cli/src/commands/ai.ts Switches AI streaming output to the new terminal renderer; adds tool activity rendering.
packages/cli/src/commands/ai.test.ts Updates tests for new streaming + tool activity output behavior.
packages/cli/evals/dub-flow-metadata.eval.ts Adds Evalite suite for generateFlowMetadata() quality and contract checks.
package.json Adds eval scripts and Evalite dev dependency; adds check:all/cli:dev.
evalite.config.ts Configures Evalite sqlite storage and scoring/timeouts.
docs/plans/2026-03-08-ai-assistant-metadata-flow.md Adds implementation plan for AI metadata/flow work.
docs/plans/2026-03-08-ai-assistant-metadata-flow-design.md Adds design doc describing AI workflow, config, and UX constraints.
apps/docs/content/docs/index.mdx Updates intro + quickstart snippets to include AI defaults and dub flow.
apps/docs/content/docs/guides/migration-from-graphite.mdx Updates AI feature description to include PR descriptions and flow.
apps/docs/content/docs/guides/ai-assistant.mdx Expands AI guide with setup, defaults, templates, create/submit/flow usage.
apps/docs/content/docs/getting-started/quickstart.mdx Adds AI defaults and optional dub flow usage to onboarding.
apps/docs/content/docs/contributing/development.mdx Adds pnpm check:all and eval guidance for AI prompt/metadata changes.
apps/docs/content/docs/commands/submit.mdx Documents submit --ai/--no-ai and PR template behavior.
apps/docs/content/docs/commands/create.mdx Documents create --no-ai and commit template-aware AI behavior.
README.md Documents AI defaults overrides, AI PR descriptions, flow command, and Evalite suite usage.
QUICKSTART.md Updates quickstart to include AI defaults, templates, flow, and eval commands.
AGENTS.md Updates agent guidance with eval scripts and pnpm check:all expectations.
.gitignore Ignores Evalite artifacts.
.beads/dolt-monitor.pid.lock Adds beads/Dolt runtime lock file to repo (as included in this PR).
.agents/skills/dubstack/SKILL.md Updates agent skill with AI workflow guidance.
.agents/skills/dub-flow/SKILL.md Updates agent flow skill to mirror dub flow + template behavior.
.agents/skills/dub-flow-evals/SKILL.md Adds agent skill for maintaining Evalite coverage for flow metadata.
.agents/skills/beads/SKILL.md Adds agent skill documenting bd/beads issue tracking conventions.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/cli/src/lib/pr-body.ts
Comment thread packages/cli/src/commands/submit.ts
Comment thread packages/cli/src/commands/flow.ts
@dubscode dubscode force-pushed the feat/ai-authoring-flow branch from dbf67b6 to 9973861 Compare March 8, 2026 18:27
@dubscode dubscode merged commit 91af980 into main Mar 8, 2026
6 checks passed
@dubscode dubscode deleted the feat/ai-authoring-flow branch March 8, 2026 18:31
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.

2 participants