Skip to content

Add push option to export CLI #231

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

seonglae
Copy link
Member

@seonglae seonglae commented Jun 6, 2025

Summary

  • add --push flag to export command
  • allow NotionExporter to push exported content to texonom-raw and texonom-md

Testing

  • pnpm test (fails: vitest not found)
  • pnpm lint (fails: eslint command issue)

https://chatgpt.com/codex/tasks/task_e_6842d06cc8908327aba1258d471728c9

Copy link

codesandbox bot commented Jun 6, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Unconsented Data Push and Error Suppression

The pushRepos method hardcodes remote repository URLs, pushing user data to specific external repositories without consent. It uses git push --force, risking remote history overwrite and data loss. Furthermore, all git command errors are silently ignored, hiding failures. This includes git remote add origin failing on subsequent runs if the remote exists, potentially causing git push to fail or push to an unintended remote.

packages/cli/src/notion/index.ts#L733-L743

run('git branch -M main', this.folder)
run('git remote add origin https://github.com/texonom/texonom-raw.git', this.folder)
run('git push -u origin main --force', this.folder)
// push md
run('git init', this.md)
run('git add .', this.md)
run(`git commit -m "${message}"`, this.md)
run('git branch -M main', this.md)
run('git remote add origin https://github.com/texonom/texonom-md.git', this.md)
run('git push -u origin main --force', this.md)

Fix in Cursor


Bug: Git Command Failures Silently Ignored

The run helper function within pushRepos() silently ignores all git command failures via an empty catch block. This prevents users from being notified of critical issues (e.g., authentication, network, or repository access problems), leading to a false sense of success, hindering debugging, and potentially leaving repositories in inconsistent states.

packages/cli/src/notion/index.ts#L720-L744

pushRepos() {
const run = (cmd: string, cwd: string) => {
try {
execSync(cmd, { cwd, stdio: 'ignore' })
} catch {}
}
const message = new Date().toString()
// push raw
run('git init', this.folder)
run('git add .', this.folder)
run(`git commit -m "${message}"`, this.folder)
run('git branch -M main', this.folder)
run('git remote add origin https://github.com/texonom/texonom-raw.git', this.folder)
run('git push -u origin main --force', this.folder)
// push md
run('git init', this.md)
run('git add .', this.md)
run(`git commit -m "${message}"`, this.md)
run('git branch -M main', this.md)
run('git remote add origin https://github.com/texonom/texonom-md.git', this.md)
run('git push -u origin main --force', this.md)
}

Fix in Cursor


BugBot free trial expires on June 13, 2025
You have used $0.00 of your $0.00 spend limit so far. Manage your spend limit in the Cursor dashboard.

Was this report helpful? Give feedback by reacting with 👍 or 👎

@seonglae seonglae requested a review from Copilot June 7, 2025 17:59
Copy link
Contributor

@Copilot 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

This PR adds a --push flag to the export CLI, enabling automatic Git pushes of exported Notion data to two remote repositories.

  • Introduces a push property and command‐line flag
  • Implements a pushRepos() method that initializes Git repos and force‐pushes to designated remotes
  • Hooks the new flag into the export command to run pushRepos() when requested

Reviewed Changes

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

File Description
packages/cli/src/notion/index.ts Imported execSync, added push flag/property, implemented git push logic in pushRepos()
packages/cli/src/notion/export.ts Added --push option to CLI and wired it to invoke pushRepos()
Comments suppressed due to low confidence (1)

packages/cli/src/notion/index.ts:721

  • The new pushRepos() logic isn’t covered by tests—consider adding unit or integration tests to verify the git commands execute as expected.
  pushRepos() {

const run = (cmd: string, cwd: string) => {
try {
execSync(cmd, { cwd, stdio: 'ignore' })
} catch {}
Copy link
Preview

Copilot AI Jun 7, 2025

Choose a reason for hiding this comment

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

Silently swallowing errors makes debugging push failures difficult; consider logging caught exceptions or at least printing a warning.

Suggested change
} catch {}
} catch (error) {
console.error(`Failed to execute command "${cmd}" in directory "${cwd}":`, error.message);
}

Copilot uses AI. Check for mistakes.

@seonglae seonglae self-assigned this Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant