Skip to content

feat: add approve command - #3145

Draft
alepane21 wants to merge 2 commits into
mainfrom
ale/cosmo-389-cli-approve-schema-proposals-via-wgc
Draft

feat: add approve command#3145
alepane21 wants to merge 2 commits into
mainfrom
ale/cosmo-389-cli-approve-schema-proposals-via-wgc

Conversation

@alepane21

@alepane21 alepane21 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added a CLI command to approve or close proposals with support for federated graphs and optional namespaces.
    • Added clear success and failure reporting with appropriate exit codes for local and CI workflows.
  • Documentation

    • Added usage guidance, required options, permissions, accepted statuses, and CI examples for updating proposal status.
    • Added the new command to the proposal CLI documentation navigation.
  • Tests

    • Added coverage for successful updates, namespace handling, invalid statuses, and API errors.

Checklist

Open Source AI Manifesto

This project follows the principles of the Open Source AI Manifesto. Please ensure your contribution aligns with its principles.

@mintlify

mintlify Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
wundergraphinc 🟢 Ready View Preview Aug 7, 2026, 10:45 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

Proposal status update

Layer / File(s) Summary
Implement and register status command
cli/src/commands/proposal/commands/update-status.ts, cli/src/commands/proposal/index.ts
The CLI validates approved and closed statuses, accepts proposal, graph, and namespace inputs, calls the platform API, and reports success or failure.
Validate command behavior
cli/test/update-proposal-status.test.ts
Tests cover successful updates, namespaces, invalid statuses, API errors, output, and exit codes.
Document and navigate status command
docs-website/cli/proposal/update-status.mdx, docs-website/cli/proposal.mdx, docs-website/concepts/proposals.mdx, docs-website/docs.json
Documentation describes command usage, CI authentication, supported statuses, examples, failure behavior, and navigation.
Estimated code review effort: 3 (Moderate) ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title identifies the new proposal approval command, which is a primary part of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 45.34%. Comparing base (64eaf60) to head (33d1676).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3145       +/-   ##
===========================================
- Coverage   62.37%   45.34%   -17.03%     
===========================================
  Files         262      148      -114     
  Lines       31003    14073    -16930     
  Branches        0      830      +830     
===========================================
- Hits        19337     6381    -12956     
+ Misses      10158     7690     -2468     
+ Partials     1508        2     -1506     
Files with missing lines Coverage Δ
...li/src/commands/proposal/commands/update-status.ts 100.00% <100.00%> (ø)
cli/src/commands/proposal/index.ts 93.75% <100.00%> (ø)

... and 408 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
cli/src/commands/proposal/commands/approve.ts (1)

7-17: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add explicit command and action types.

Add a Command return type to the command factory.

Define an interface for the action options.

Annotate name, options, and the action return type.

Proposed change
+interface ApproveProposalOptions {
+  federationGraph: string;
+  namespace: string;
+}
+
-export default (opts: BaseCommandOptions) => {
+export default (opts: BaseCommandOptions): Command => {
...
-  command.action(async (name, options) => {
+  command.action(async (name: string, options: ApproveProposalOptions): Promise<void> => {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cli/src/commands/proposal/commands/approve.ts` around lines 7 - 17, Update
the default command factory around the approve command to explicitly return
Command. Define an interface for the action options matching the federationGraph
and namespace options, then annotate the action’s name, options, and return type
while preserving the existing command behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cli/src/commands/proposal/commands/approve.ts`:
- Line 15: Require a namespace argument in the approve command by changing the
Commander option in cli/src/commands/proposal/commands/approve.ts:15 from an
optional value to a required <namespace> value, while preserving the default
behavior when the option is omitted; update
docs-website/cli/proposal/approve.mdx:26 from [namespace] to <namespace>; add a
regression test verifying parsing fails when --namespace has no value.

---

Nitpick comments:
In `@cli/src/commands/proposal/commands/approve.ts`:
- Around line 7-17: Update the default command factory around the approve
command to explicitly return Command. Define an interface for the action options
matching the federationGraph and namespace options, then annotate the action’s
name, options, and return type while preserving the existing command behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7171e895-d782-4f9a-83d9-b68a00409385

📥 Commits

Reviewing files that changed from the base of the PR and between 5edbee2 and c4bfc59.

📒 Files selected for processing (7)
  • cli/src/commands/proposal/commands/approve.ts
  • cli/src/commands/proposal/index.ts
  • cli/test/approve-proposal.test.ts
  • docs-website/cli/proposal.mdx
  • docs-website/cli/proposal/approve.mdx
  • docs-website/concepts/proposals.mdx
  • docs-website/docs.json

Comment thread cli/src/commands/proposal/commands/approve.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
cli/src/commands/proposal/commands/update-status.ts (2)

7-15: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Rename the status constant.

proposalStatuses is a module-level constant. Rename it to PROPOSAL_STATUSES.

As per coding guidelines, constants use UPPER_SNAKE_CASE.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cli/src/commands/proposal/commands/update-status.ts` around lines 7 - 15,
Rename the module-level proposalStatuses constant to PROPOSAL_STATUSES and
update its references within parseProposalStatus, preserving the existing status
validation behavior.

Source: Coding guidelines


18-18: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add explicit function types.

Add a Command return type to the exported command factory. Add parameter and Promise<void> return types to the action callback. Use an interface for the action options object.

As per coding guidelines, TypeScript functions need explicit parameter and return types, and object shapes use interfaces.

Also applies to: 33-33

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cli/src/commands/proposal/commands/update-status.ts` at line 18, Update the
default command factory to explicitly return Command and type its opts parameter
with the appropriate interface. Define an interface for the action options
object, then annotate the action callback parameter with that interface and its
return type as Promise<void>.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cli/src/commands/proposal/commands/update-status.ts`:
- Line 31: Require an explicit value for the namespace option by changing the
option declaration in the update-status command from an optional argument to a
required one, using the existing namespace option symbol. Update the
corresponding usage documentation in update-status.mdx to show the required
namespace argument.

---

Nitpick comments:
In `@cli/src/commands/proposal/commands/update-status.ts`:
- Around line 7-15: Rename the module-level proposalStatuses constant to
PROPOSAL_STATUSES and update its references within parseProposalStatus,
preserving the existing status validation behavior.
- Line 18: Update the default command factory to explicitly return Command and
type its opts parameter with the appropriate interface. Define an interface for
the action options object, then annotate the action callback parameter with that
interface and its return type as Promise<void>.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 08778819-cc9b-4b12-9ddd-2051f87710bb

📥 Commits

Reviewing files that changed from the base of the PR and between c4bfc59 and 33d1676.

📒 Files selected for processing (7)
  • cli/src/commands/proposal/commands/update-status.ts
  • cli/src/commands/proposal/index.ts
  • cli/test/update-proposal-status.test.ts
  • docs-website/cli/proposal.mdx
  • docs-website/cli/proposal/update-status.mdx
  • docs-website/concepts/proposals.mdx
  • docs-website/docs.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs-website/docs.json
  • docs-website/cli/proposal.mdx

'The status to set. Allowed values: approved, closed.',
parseProposalStatus,
);
command.option('-n, --namespace [string]', 'The namespace of the federated graph.', 'default');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- relevant files ---'
fd -i 'update-status|package.json|package-lock|yarn.lock|pnpm-lock' . | head -80

printf '%s\n' '--- command and documentation references ---'
rg -n -C 8 --glob 'update-status.ts' --glob 'update-status.mdx' -- '--namespace|namespace' .

printf '%s\n' '--- Commander declarations ---'
rg -n -C 3 --glob 'package.json' --glob '*lock*' '"commander"|commander@' . | head -120

printf '%s\n' '--- namespace call sites and types ---'
rg -n -C 5 --glob '*.{ts,tsx,js,jsx}' 'updateStatus|namespace' cli/src | head -240

Repository: wundergraph/cosmo

Length of output: 25824


🏁 Script executed:

#!/bin/bash
set -eu

tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT

curl -fsSL https://unpkg.com/commander@11.1.0/index.js -o "$tmpdir/index.js"
curl -fsSL https://unpkg.com/commander@11.1.0/lib/command.js -o "$tmpdir/command.js"
curl -fsSL https://unpkg.com/commander@11.1.0/lib/option.js -o "$tmpdir/option.js"
curl -fsSL https://unpkg.com/commander@11.1.0/package.json -o "$tmpdir/package.json"

printf '%s\n' '--- Commander option parsing source ---'
rg -n -C 6 'optional|required|true|argNot|parseOptions|value' "$tmpdir/command.js" "$tmpdir/option.js" | head -220

printf '%s\n' '--- standalone Commander 11.1.0 behavior probe ---'
cat > "$tmpdir/probe.mjs" <<'JS'
import { Command } from './index.js';

for (const optionSpec of ['-n, --namespace [string]', '-n, --namespace <namespace>']) {
  for (const argv of [
    ['node', 'probe', '--namespace'],
    ['node', 'probe', '--namespace', 'production'],
  ]) {
    const command = new Command();
    command.exitOverride();
    command.option(optionSpec, 'namespace', 'default');
    try {
      command.parse(argv);
      console.log(JSON.stringify({
        optionSpec,
        argv: argv.slice(2),
        namespace: command.opts().namespace,
        namespaceType: typeof command.opts().namespace,
      }));
    } catch (error) {
      console.log(JSON.stringify({
        optionSpec,
        argv: argv.slice(2),
        error: error.code ?? error.message,
      }));
    }
  }
}
JS
node "$tmpdir/probe.mjs"

printf '%s\n' '--- updateProposal declarations and tests ---'
rg -n -C 5 --glob '*.{ts,tsx}' 'updateProposal' cli/src cli/test cli/tests 2>/dev/null | head -180 || true
rg -n -C 4 --glob '*.{ts,tsx}' 'proposal update-status|update-status' cli | head -180 || true

Repository: wundergraph/cosmo

Length of output: 14478


🏁 Script executed:

#!/bin/bash
set -eu

tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
mkdir "$tmpdir/commander"
curl -fsSL https://registry.npmjs.org/commander/-/commander-11.1.0.tgz | tar -xzf - -C "$tmpdir/commander" --strip-components=1

printf '%s\n' '--- standalone Commander 11.1.0 behavior probe ---'
cat > "$tmpdir/probe.cjs" <<'JS'
const { Command } = require('./commander');

for (const optionSpec of ['-n, --namespace [string]', '-n, --namespace <namespace>']) {
  for (const argv of [
    ['node', 'probe', '--namespace'],
    ['node', 'probe', '--namespace', 'production'],
  ]) {
    const command = new Command();
    command.exitOverride();
    command.option(optionSpec, 'namespace', 'default');
    try {
      command.parse(argv);
      const namespace = command.opts().namespace;
      console.log(JSON.stringify({
        optionSpec,
        argv: argv.slice(2),
        namespace,
        namespaceType: typeof namespace,
      }));
    } catch (error) {
      console.log(JSON.stringify({
        optionSpec,
        argv: argv.slice(2),
        error: error.code ?? error.message,
      }));
    }
  }
}
JS
(
  cd "$tmpdir"
  node probe.cjs
)

printf '%s\n' '--- relevant Commander parser branches ---'
rg -n -C 12 'optional|presetArg|processOption|missing argument|arg ===|value = true' "$tmpdir/commander/lib/command.js" "$tmpdir/commander/lib/option.js" | head -260

printf '%s\n' '--- updateProposal declarations and namespace types ---'
rg -n -C 8 --glob '*.{ts,tsx}' 'updateProposal' cli | head -220 || true
rg -n -C 5 --glob '*.{ts,tsx}' 'namespace\??: string|namespace: string|namespace\?: string' cli/src cli | head -160 || true

Repository: wundergraph/cosmo

Length of output: 34369


Require a value for --namespace. Change [string] to <namespace>. Update docs-website/cli/proposal/update-status.mdx to match.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cli/src/commands/proposal/commands/update-status.ts` at line 31, Require an
explicit value for the namespace option by changing the option declaration in
the update-status command from an optional argument to a required one, using the
existing namespace option symbol. Update the corresponding usage documentation
in update-status.mdx to show the required namespace argument.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant