Skip to content

Make human-language universally accessible (npm, crates.io, Docker)#38

Merged
konard merged 9 commits into
mainfrom
issue-37-0d7db2803f2c
May 12, 2026
Merged

Make human-language universally accessible (npm, crates.io, Docker)#38
konard merged 9 commits into
mainfrom
issue-37-0d7db2803f2c

Conversation

@konard
Copy link
Copy Markdown
Contributor

@konard konard commented May 11, 2026

Summary

Resolves #37. Makes human-language consumable through the requested surfaces while keeping the branch aligned with the latest PR review:

  • npm — publishable package with main, types, bin, files, public export subpaths, and a human-language CLI.
  • crates.io — Rust crate under rust/ with [lib], [[bin]], parity tests, and direct lino-arguments / lino-objects-codec integration.
  • Docker — multi-stage Node image with production dependencies, non-root runtime, /healthz, and examples/docker-compose.yml.
  • SPA — existing browser app remains wired through the unified JS workflow.

Review update

The workflow layout now matches the review request: this branch has exactly the language workflows .github/workflows/js.yml and .github/workflows/rust.yml. The separate .github/workflows/release.yml was removed.

js.yml now owns JS syntax checks, unit tests, link checks, local/deployed Playwright checks, Pages deployment, npm publishing, GHCR Docker publishing, and GitHub release creation. Publish jobs are gated behind the test/link/e2e chain and a package.json version bump (or manual force_publish).

The previous shim/optional-dependency claims are gone. JS now depends directly on lino-arguments@^0.3.0 and lino-objects-codec@^0.4.0; Rust now depends directly on lino-arguments = "0.3.0", lino-objects-codec = "0.2.1", and clap for the derive expansion used by the parser.

Tests and validation

  • npm ci
  • node js/scripts/check-mjs-syntax.mjs
  • node js/scripts/run-unit-tests.mjs
  • PORT=18080 npm run test:e2e:local (local port 8000 was already occupied)
  • npm pack --dry-run
  • ruby -e "require 'yaml'; YAML.load_file('.github/workflows/js.yml'); YAML.load_file('.github/workflows/rust.yml')"
  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test
  • cargo test --all-targets
  • cargo test --all-targets --all-features
  • cargo package
  • git diff --check

Docker build was not run locally because this runner does not have the docker binary installed.

Documentation

docs/case-studies/issue-37/ was updated to reflect the actual implementation, deferred follow-ups, direct dependency usage, and the js.yml / rust.yml workflow split.

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #37
@konard konard self-assigned this May 11, 2026
konard added 5 commits May 11, 2026 12:34
Adds a public API surface for human-language so it can be consumed as a
library, command-line tool, and HTTP microservice. Implements the npm
side of issue #37.

- package.json: drop private flag, add main/types/bin/exports/files,
  declare engines.node >= 20, add start/cli/test scripts.
- js/src/index.{js,d.ts}: re-export the public API with TypeScript
  declarations.
- js/src/cli.js: `human-language` CLI with transform/entity/property/
  search/serve/version/help subcommands. Heavy modules are imported
  lazily so `--version` and `--help` stay quiet and fast.
- js/src/server.js: node:http microservice exposing /healthz, /version,
  /, /transform, /entity/:id, /property/:id, /search. Supports
  Accept: text/plain;codec=lino for LiNo output. Dependencies are
  injectable for tests.
- js/src/config.js: lino-arguments style precedence (CLI > env >
  defaults) with --key=value, --key value, -p, and -- support.
- js/src/transformation/lino-format.js: renders Q/P sequences in
  links-notation form, including `[A or B or C]` for ambiguous tokens.
- js/src/version.js: package metadata loader (no import attributes).
- Tests: 35 new gating tests across config (11), lino-format (7),
  server (11), and cli (6); wired into run-unit-tests.mjs.
Adds a Rust crate under rust/ that mirrors the pure-function helpers of
the JavaScript package. Same name (human-language), same version (0.1.0),
ready for crates.io publication alongside the npm package.

- rust/Cargo.toml: cdylib + rlib + binary, MIT, repo/keywords set; opt-in
  wikidata-client feature for the future network port.
- rust/src/{tokenize,routing,settings,lino}.rs: ports of the JS modules
  the SPA/CLI consume — tokenize/n-grams/stop-words/property-indicators,
  hash parse+serialize, locale quotes + flag map, Links Notation render.
- rust/src/bin/cli.rs: `human-language` binary with tokenize, parse-hash,
  lino-sequence, version, help subcommands.
- rust/tests/parity.rs: 10 parity tests pinned against the JS unit suites
  so contracts stay in lockstep.
- rust/rust-toolchain.toml, rust/rustfmt.toml, rust/changelog.d/: pipeline
  scaffolding adopted from the rust-ai-driven-development-pipeline-template.

Verified locally: cargo fmt --check, cargo clippy --all-targets -D warnings,
cargo test (22 unit + 10 parity tests pass).
Adds a multi-stage Dockerfile and a compose example so the same API
surface that's published to npm and crates.io is also reachable as a
Docker container — issue #37 R4.

- Dockerfile: node:22-alpine, drops to the `node` user, sets sensible
  defaults via HUMAN_LANGUAGE_* env vars, and ships an inline Node-based
  HEALTHCHECK against /healthz so orchestrators can see liveness without
  needing curl in the image. ENTRYPOINT runs `human-language serve`.
- .dockerignore: keeps the build context to runtime essentials.
- examples/docker-compose.yml: local bring-up with a persistent volume
  for the Wikidata file cache.
Adds two GitHub Actions workflows alongside the existing js.yml:

- rust.yml gates PRs on cargo fmt, cargo clippy, and cargo test (Linux,
  macOS, Windows). On version-bumping pushes to main, it runs cargo
  publish against crates.io. Adopted from rust-ai-driven-development-
  pipeline-template, trimmed to this repo's surface.
- release.yml is triggered when package.json's version advances on main
  (or via workflow_dispatch with force_publish). It re-runs the unit
  suite as a gate, then publishes to npm with provenance (Sigstore
  trusted publishing) and a multi-arch image to ghcr.io, then cuts a
  GitHub release with auto-generated notes.

Both pipelines use a small detect-version-bump helper:
- js/scripts/check-package-version.mjs
- rust/scripts/check-cargo-version.mjs

The scripts diff the version against HEAD~1 and write should_publish to
$GITHUB_OUTPUT, so the publish jobs are skipped on commits that don't
move the version.
@konard konard changed the title [WIP] Make it more universally accessible. Make human-language universally accessible (npm, crates.io, Docker) May 11, 2026
@konard konard marked this pull request as ready for review May 11, 2026 12:48
The previous URL (linksplatform/Documentation/blob/main/doc/LinksNotation.md)
returns 404 and has no Web Archive snapshot, causing the JS workflow's
lychee broken-link check to fail. Switch to the canonical repository URL
already used throughout the issue #37 case study docs.
@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 11, 2026

Working session summary

I'll wait for the notification.


This summary was automatically extracted from the AI working session output.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 11, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $11.436811

📊 Context and tokens usage:

Claude Opus 4.7: (3 sub-sessions)

  1. 116.6K / 1M (12%) input tokens, 52.2K / 128K (41%) output tokens
  2. 117.0K / 1M (12%) input tokens, 38.1K / 128K (30%) output tokens
  3. 51.4K / 1M (5%) input tokens, 4.5K / 128K (4%) output tokens

Total: (7.8K new + 319.8K cache writes + 12.5M cache reads) input tokens, 122.1K output tokens, $11.326917 cost

Claude Haiku 4.5:

  • 41.5K / 200K (21%) input tokens, 5.9K / 64K (9%) output tokens

Total: (622 new + 40.9K cache writes + 288.8K cache reads) input tokens, 5.9K output tokens, $0.109895 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Main model: Claude Opus 4.7 (claude-opus-4-7)
  • Additional models:
    • Claude Haiku 4.5 (claude-haiku-4-5-20251001)

📎 Log file uploaded as Gist (4551KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 11, 2026

🔄 Auto-restart 1/5

Detected uncommitted changes from previous run. Starting new session to review and commit or discard them.

Uncommitted files:

?? rust/changelog.d/.gitkeep

Auto-restart will stop after changes are committed or discarded, or after 4 more iterations. Please wait until working session will end and give your feedback.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 11, 2026

Working session summary

All CI checks pass and the PR is in CLEAN/MERGEABLE state. The uncommitted .gitkeep was redundant (the directory has README.md already keeping it tracked) and unrelated to the solution — so deleting it was correct.

Working tree is clean, all 14 CI checks are passing (the 5 skipped ones are gated correctly: Pages deploys only on main, cargo publish only on version bumps), and PR #38 is in CLEAN/MERGEABLE state with no outstanding review comments.


This summary was automatically extracted from the AI working session output.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 11, 2026

🔄 Auto-restart 1/5 Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $0.446943

📊 Context and tokens usage:

  • 43.5K / 1M (4%) input tokens, 2.3K / 128K (2%) output tokens

Total: (144 new + 37.7K cache writes + 307.9K cache reads) input tokens, 2.3K output tokens, $0.446943 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Model: Claude Opus 4.7 (claude-opus-4-7)

📎 Log file uploaded as Gist (4964KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 11, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 12, 2026

There should be js.yml and rust.yml, as per

Reread: #37

As we need to ensure all changes are correct, consistent, validated, tested, documented, logged and fully meet each and all discussed requirements in widest possible sense (check issue description and all comments in issue and in pull request, make sure each and every requirement listed before actually checking if they were addressed). Ensure all CI/CD checks pass.

@konard konard marked this pull request as draft May 12, 2026 09:24
@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 12, 2026

🤖 AI Work Session Started

Starting automated work session at 2026-05-12T09:24:32.603Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback.

@konard konard marked this pull request as ready for review May 12, 2026 10:07
@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 12, 2026

Work session complete

Updated PR #38 for the latest review:

  • Kept the workflow layout to exactly .github/workflows/js.yml and .github/workflows/rust.yml; removed the separate release.yml.
  • Integrated direct JS dependencies on lino-arguments and lino-objects-codec, including a new persistent cache LiNo round-trip test.
  • Integrated direct Rust dependencies on lino-arguments and lino-objects-codec (plus clap for derive expansion), with Rust LiNo codec helper coverage.
  • Updated the issue Make it more universally accessible. #37 case study docs to match the actual implementation and deferred follow-ups.
  • Updated the PR description and marked the PR ready for review.

Fresh CI on commit e0038d8 is passing: JS run 25727542788 and Rust run 25727542721.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 12, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: GPT-5.5
  • Provider: OpenAI
  • Public pricing estimate: $19.272025

📊 Context and tokens usage:

  • 299.7K / 1.1M (29%) input tokens, 53.6K / 128K (42%) output tokens

Total: (299.7K + 13.9M cached) input tokens, 53.6K output tokens, $19.272025 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-5.5
  • Model: GPT-5.5 (gpt-5.5)

📎 Log file uploaded as Repository (81243KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Contributor Author

konard commented May 12, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@konard konard merged commit 3f9a5b6 into main May 12, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make it more universally accessible.

1 participant