Set up project structure and Main entry point #1

Closed
opened 2026-10-04 19:27:50 +00:00 by daniel · 1 comment
Owner

Imported from GitHub samson-media/barn#1 — opened by @daniel-samson on 2026-01-21 12:34:42 UTC

Overview

Set up the proper Java package structure and create the Main entry point with picocli CLI framework.

Context

  • Read first: README.md, docs/development.md, docs/coding-standards.md
  • Package: com.samsonmedia.barn (note: current code is in wrong package org.media.samson)
  • CLI Framework: picocli (already in pom.xml)

Requirements

1. Fix Package Structure

Replace the existing placeholder src/main/java/org/media/samson/Main.java with proper structure:

```
src/main/java/com/samsonmedia/barn/
Main.java # Entry point
cli/
BarnCommand.java # Root @Command with subcommands
config/
(empty for now)
jobs/
(empty for now)
service/
(empty for now)
state/
(empty for now)
```

2. Main.java

  • Should call picocli's CommandLine to parse args
  • Exit with proper exit codes
  • Handle uncaught exceptions gracefully
  • Set up SLF4J logging

3. BarnCommand.java

Root picocli command with:

  • @Command(name = "barn", mixinStandardHelpOptions = true)
  • Version info from manifest
  • Subcommand placeholders (can be empty classes for now): run, status, describe, kill, clean, service, config

4. Tests Required

  • MainTest.java: Test main method exits with correct codes
  • BarnCommandTest.java: Test help output, version output

Acceptance Criteria

  • Package structure matches com.samsonmedia.barn
  • barn --help shows help text
  • barn --version shows version
  • mvn verify passes (all quality checks)
  • Tests have 80%+ coverage

Implementation Notes

// Main.java pattern
public final class Main {
    private Main() { }
    
    public static void main(String[] args) {
        int exitCode = new CommandLine(new BarnCommand()).execute(args);
        System.exit(exitCode);
    }
}
// BarnCommand.java pattern
@Command(
    name = "barn",
    mixinStandardHelpOptions = true,
    version = "barn 0.1.0",
    description = "Cross-platform job daemon for media processing",
    subcommands = {
        RunCommand.class,
        StatusCommand.class,
        // ... etc
    }
)
public class BarnCommand implements Runnable {
    @Override
    public void run() {
        // Show help when no subcommand
        CommandLine.usage(this, System.out);
    }
}

Definition of Done

  • Code compiles without warnings
  • All tests pass
  • mvn verify passes
  • Can run java -jar target/barn-*.jar --help
<!-- github-import:issue:1 --> _Imported from GitHub samson-media/barn#1 — opened by **@daniel-samson** on 2026-01-21 12:34:42 UTC_ ## Overview Set up the proper Java package structure and create the Main entry point with picocli CLI framework. ## Context - **Read first**: `README.md`, `docs/development.md`, `docs/coding-standards.md` - **Package**: `com.samsonmedia.barn` (note: current code is in wrong package `org.media.samson`) - **CLI Framework**: picocli (already in pom.xml) ## Requirements ### 1. Fix Package Structure Replace the existing placeholder `src/main/java/org/media/samson/Main.java` with proper structure: \`\`\` src/main/java/com/samsonmedia/barn/ Main.java # Entry point cli/ BarnCommand.java # Root @Command with subcommands config/ (empty for now) jobs/ (empty for now) service/ (empty for now) state/ (empty for now) \`\`\` ### 2. Main.java - Should call picocli's `CommandLine` to parse args - Exit with proper exit codes - Handle uncaught exceptions gracefully - Set up SLF4J logging ### 3. BarnCommand.java Root picocli command with: - `@Command(name = "barn", mixinStandardHelpOptions = true)` - Version info from manifest - Subcommand placeholders (can be empty classes for now): `run`, `status`, `describe`, `kill`, `clean`, `service`, `config` ### 4. Tests Required - `MainTest.java`: Test main method exits with correct codes - `BarnCommandTest.java`: Test help output, version output ## Acceptance Criteria - [ ] Package structure matches `com.samsonmedia.barn` - [ ] `barn --help` shows help text - [ ] `barn --version` shows version - [ ] `mvn verify` passes (all quality checks) - [ ] Tests have 80%+ coverage ## Implementation Notes ```java // Main.java pattern public final class Main { private Main() { } public static void main(String[] args) { int exitCode = new CommandLine(new BarnCommand()).execute(args); System.exit(exitCode); } } ``` ```java // BarnCommand.java pattern @Command( name = "barn", mixinStandardHelpOptions = true, version = "barn 0.1.0", description = "Cross-platform job daemon for media processing", subcommands = { RunCommand.class, StatusCommand.class, // ... etc } ) public class BarnCommand implements Runnable { @Override public void run() { // Show help when no subcommand CommandLine.usage(this, System.out); } } ``` ## Definition of Done - Code compiles without warnings - All tests pass - `mvn verify` passes - Can run `java -jar target/barn-*.jar --help`
daniel added this to the M1: Foundation milestone 2026-10-04 19:27:50 +00:00
daniel added the foundation label 2026-10-04 19:27:50 +00:00
Author
Owner

@daniel-samson commented on 2026-01-21 12:54:02 UTC:

Completed implementation:

Deliverables:

  • ✅ Main.java with picocli integration
  • ✅ BarnCommand.java as root command
  • ✅ All 7 placeholder subcommands (run, status, describe, kill, clean, service, config)
  • ✅ Package structure: com.samsonmedia.barn
  • ✅ 26 tests with 80%+ coverage
  • ✅ mvn verify passes (checkstyle, tests, jacoco)

Commit: 05937b1

<!-- github-import:comment:3777994713 --> _**@daniel-samson** commented on 2026-01-21 12:54:02 UTC:_ Completed implementation: **Deliverables:** - ✅ Main.java with picocli integration - ✅ BarnCommand.java as root command - ✅ All 7 placeholder subcommands (run, status, describe, kill, clean, service, config) - ✅ Package structure: com.samsonmedia.barn - ✅ 26 tests with 80%+ coverage - ✅ mvn verify passes (checkstyle, tests, jacoco) **Commit:** 05937b1
This repo is archived. You cannot comment on issues.