xn-intenton-z2a / repository0

A template for a self-evolving repository featuring LLM driven GitHub Actions Workflows.
MIT License
3 stars 0 forks source link

Implement `--capital-cities` CLI command to fetch countries and output OWL JSON #2288

Closed github-actions[bot] closed 1 month ago

github-actions[bot] commented 1 month ago

Objective

Add a new CLI command --capital-cities to fetch a list of countries and their capital cities from the Rest Countries API, transform the results into an OWL ontology JSON, and either print it to stdout or write it to a file when --output <path> is provided.

Acceptance Criteria

  1. CLI Invocation

    • Running node src/lib/main.js --capital-cities:
      • Fetches data from https://restcountries.com/v3.1/all.
      • Outputs to stdout a stringified JSON with top-level key ontology, containing:
      • classes: ["Country", "City"]
      • objectProperties: [{ name: "hasCapital", domain: "Country", range: "City" }]
      • individuals: one Country individual per country (with id = country code), one City individual per capital (with id = city name), and one triple for each country linking it to its capital via the hasCapital property.
    • The JSON printed must parse without errors (JSON.parse(output) should not throw).
  2. File Output

    • Running node src/lib/main.js --capital-cities --output <path>:
      • Writes a file at <path> containing the exact same JSON structure as above.
      • Use fs.promises.writeFile() to create or overwrite <path>.
  3. Unit Tests

    • Tests stub global.fetch to return a sample array:
      [
      { cca3: 'USA', capital: ['Washington D.C.'] },
      { cca3: 'FRA', capital: ['Paris'] }
      ]
    • A test for main(["--capital-cities"]) spies on console.log:
      • Asserts that console.log was called once with the correct stringified JSON.
      • Asserts that JSON.parse(spyCallArg) matches the expected object structure.
    • A test for main(["--capital-cities","--output","out.json"]) stubs fs.promises.writeFile:
      • Asserts it was called once with 'out.json' and the correct JSON string.
  4. Documentation

    • In README.md, under CLI Usage, add a section:
      ### Fetch Capital Cities as OWL JSON
      ```bash
      node src/lib/main.js --capital-cities [--output <path>]
      • Describes behavior, shows a sample JSON snippet, and references MISSION.md.
  5. Verification

    • All new and existing tests pass (npm test).
    • Manual test:
      • node src/lib/main.js --capital-cities prints valid JSON.
      • node src/lib/main.js --capital-cities --output sample.json creates sample.json with correct content.

_No other files beyond src/lib/main.js, tests/unit/main.test.js, and README.md should be modified. This implements the core CAPITAL_CITIES feature._

github-actions[bot] commented 1 month ago

This issue has been reviewed and marked as 'ready'. The description has been updated with testable acceptance criteria, and relevant library documents ([], 0 in total) have been added as comments.

github-actions[bot] commented 1 month ago

Implement --capital-cities CLI command, add tests and documentation

github-actions[bot] commented 1 month ago

https://github.com/xn-intenton-z2a/repository0/tree/agentic-lib-issue-2288

github-actions[bot] commented 1 month ago

Workflow name: transformation-07.1-in-progress-issue-to-ready-issue Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15264121815 Workflow event: schedule Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/0b42cfc480d3ab87ca12cb89a434566d8c93a6c3

github-actions[bot] commented 1 month ago

The feature branch has been merged: agentic-lib-issue-2288

github-actions[bot] commented 1 month ago

Workflow name: flow-publish-stats Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15264193216 Workflow event: workflow_run Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/9f275b397467fa5e738e55faa2f801c92aabdd04

github-actions[bot] commented 1 month ago

Workflow name: flow-publish-stats Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15264202881 Workflow event: schedule Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/9f275b397467fa5e738e55faa2f801c92aabdd04

github-actions[bot] commented 1 month ago

Workflow name: transformation-07-code-to-close-issue Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15264554320 Workflow event: schedule Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/6eb7f5bf94d291603e82a2425a5fbdcf7b95915d

github-actions[bot] commented 1 month ago

The --capital-cities feature is fully implemented with both stdout and file output, comprehensive unit tests pass, and the README has been updated to document the new CLI command. The solution directly addresses the issue’s core functionality and adds substantial user value by enabling OWL ontology generation for capital cities.

github-actions[bot] commented 1 month ago

None

github-actions[bot] commented 1 month ago

The issue has been automatically resolved and the fix has been merged.

github-actions[bot] commented 1 month ago

The --capital-cities feature is fully implemented with both stdout and file output, comprehensive unit tests pass, and the README has been updated to document the new CLI command. The solution directly addresses the issue’s core functionality and adds substantial user value by enabling OWL ontology generation for capital cities.