Skip to content

Conversation

@pihanya
Copy link
Collaborator

@pihanya pihanya commented Aug 30, 2025

Summary

  • rename packages and Gradle group to com.bepiscorp.ktools
  • bump version to 0.1.1 and record task completion
  • document repository conventions for LLM contributors in AGENTS.md

Testing

  • gradle test --no-daemon
  • gradle spotlessCheck --no-daemon

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

@pihanya pihanya changed the title refactor!: migrate package prefix to com.bepiscorp.ktools feat: add sources of initial scaffold Aug 30, 2025
@pihanya
Copy link
Collaborator Author

pihanya commented Aug 30, 2025

@codex review this PR and give things to be fixed/improved

@chatgpt-codex-connector
Copy link

Review

Testing

  • ⚠️ gradle test --no-daemon (process hung after compiling tests; no completion output)
  • ⚠️ gradle spotlessCheck --no-daemon (command did not finish before timeout)

Notes

  • Gradle commands appear to hang in this environment; further investigation or running in a local environment may be necessary to confirm build and formatting status.

View task →

- cli: stop Koin in finally to prevent resource leaks
- core: ensure ~/.config/ktools exists in ConfigLoader
- core: generate BuildInfo.kt with version at build time
- version: read version from BuildInfo instead of system property
- tests(cli): add real CLI tests for help and version output
- build: configure Gradle wrapper task to 8.10.2; Dokka v2 already in use

Refs: code review action items
@pihanya pihanya force-pushed the ai/codex/generate-scaffolding-for-ktools-linux-cli-tool branch from e37af13 to 7be2695 Compare August 30, 2025 07:38
pihanya added 11 commits August 30, 2025 13:51
…abilize options serialization

- Use npm md-to-pdf instead of deprecated md2pdf package
- Respect nvm by resolving node/npm from NVM_BIN if present
- Serialize options to JSON safely (avoid Any serializer errors)
- Co-locate bridge.js with node_modules for proper require resolution
- Increase npm install timeout for initial puppeteer download
- Spotless: prefer nvm node automatically; fall back to autodetect
- Update docs requirements to reflect engine modes and error codes

Verified end-to-end: `ktools md2pdf README.md -o output.pdf` succeeds in native mode.
@pihanya
Copy link
Collaborator Author

pihanya commented Sep 7, 2025

@codex review this PR please

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines 210 to 218
// Build conversion command
val command = buildMd2PdfCommand(inputFile.name, outputFile.name, options)
val dockerCommand = mutableListOf(
"docker", "exec",
"-w", "/workspace",
"-v", "${tempDir.absolutePath}:/workspace"
)
dockerCommand.add(containerId)
dockerCommand.addAll(command)

Choose a reason for hiding this comment

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

[P1] Remove invalid volume option from docker exec call

The Docker bridge tries to mount the temporary workspace by passing -v ${tempDir}:/workspace to docker exec, but docker exec does not support volume mounting. As written, every conversion executed through the docker engine will fail before invoking md2pdf with an error like unknown shorthand flag: 'v' in -v. The container never sees the input file, so the docker engine path cannot work at all. Start the container with the bind mount (e.g. during docker run) or copy files in/out instead of adding -v to docker exec.

Useful? React with 👍 / 👎.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@codex seems like a nice one. Please proof with docs

Choose a reason for hiding this comment

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

Summary

Testing

  • ./gradlew spotlessCheck --no-daemon
  • ./gradlew test --no-daemon

View task →

Comment on lines 131 to 153
} catch (e: ValidationException) {
ProcessingResult(
success = false,
message = e.message ?: "Validation failed",
engine = getActiveEngine(),
exitCode = 1,
hint = e.hint
)
} catch (e: EngineException) {
ProcessingResult(
success = false,
message = e.message ?: "Engine error",
engine = getActiveEngine(),
exitCode = e.exitCode,
hint = e.hint
)
} catch (e: Exception) {
log.error { "Unexpected error during conversion: ${e.message}" }
ProcessingResult(
success = false,
message = "Unexpected error: ${e.message}",
engine = getActiveEngine(),
exitCode = 2,

Choose a reason for hiding this comment

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

[P2] Avoid re-running engine detection inside error handlers

Every catch block in Md2PdfProcessor.convert calls getActiveEngine() to populate the failure response. When engine selection itself fails (e.g. no Node or Docker installed), getActiveEngine() invokes EngineDetector.selectEngine again, throws the same IllegalStateException, and bypasses the tailored error handling. The command then bubbles up as an "Unexpected error" with exit code 2 instead of the intended engine-specific hint and exit code. Cache the engine name before the try/catch or guard against failures so that error reporting does not rethrow.

Useful? React with 👍 / 👎.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@codex good remarks. Apply fix please

Choose a reason for hiding this comment

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

Summary

Testing

  • ./gradlew spotlessCheck --no-daemon
  • ./gradlew test --no-daemon

View task →

…' into ai/codex/proof-read-dockerbridge.kt-at-line-218
fix(md2pdf): copy files for docker and cache engine name
- Introduced OutputDestination sealed class to manage output options (stdout or file).
- Updated Md2PdfCommand to conditionally respond based on output type, avoiding stdout contamination.
- Refactored Md2PdfProcessor to determine output destination and file handling.
- Added detailed logging in NodeBridge for installation and conversion processes.
- Configured Log4j2 for logging output to SYSTEM_ERR to prevent stdout contamination.
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.

2 participants