Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/hpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const program = new Command();

program
.name("hpl")
.description("Human Pattern Lab CLI (alpha)")
.description("Human Pattern Lab CLI")
.option("--json", "Emit contract JSON only on stdout")
.showHelpAfterError()
.configureHelp({ helpWidth: 100 });
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@thehumanpatternlab/hpl",
"version": "1.0.0",
"version": "1.0.5",
"description": "AI-forward, automation-safe SDK and CLI for the Human Pattern Lab",
"type": "module",
"license": "MIT",
Expand Down
7 changes: 7 additions & 0 deletions src/__tests__/json-output.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ describe("CLI --json output contract", () => {
}
);

// Debug output
if (result.exitCode !== 0) {
console.log("Exit code:", result.exitCode);
console.log("stdout:", result.stdout);
console.log("stderr:", result.stderr);
}

// 1. Process must succeed
expect(result.exitCode).toBe(0);

Expand Down
6 changes: 3 additions & 3 deletions src/commands/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import { Command } from "commander";
import { writeHuman, writeJson } from "../io.js";
import { EXIT } from "../contract/exitCodes.js";
import { getAlphaIntent } from "../contract/intents";
import { ok } from "../contract/envelope";
import { getCapabilitiesAlpha } from "../contract/capabilities";
import { getAlphaIntent } from "../contract/intents.js";
import { ok } from "../contract/envelope.js";
import { getCapabilitiesAlpha } from "../contract/capabilities.js";

type GlobalOpts = { json?: boolean };

Expand Down
8 changes: 4 additions & 4 deletions src/commands/health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import { Command } from "commander";
import { writeHuman, writeJson } from "../io.js";
import { z } from "zod";
import { getAlphaIntent } from "../contract/intents";
import { ok, err } from "../contract/envelope";
import { EXIT } from "../contract/exitCodes";
import { getJson, HttpError } from "../http/client";
import { getAlphaIntent } from "../contract/intents.js";
import { ok, err } from "../contract/envelope.js";
import { EXIT } from "../contract/exitCodes.js";
import { getJson, HttpError } from "../http/client.js";

const HealthSchema = z.object({
status: z.string(),
Expand Down
21 changes: 16 additions & 5 deletions src/commands/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,25 @@
import { Command } from "commander";
import { writeHuman, writeJson } from "../io.js";
import { EXIT } from "../contract/exitCodes.js";
import { createRequire } from "node:module";
import { getAlphaIntent } from "../contract/intents";
import { ok } from "../contract/envelope";
import { fileURLToPath } from "url";
import { dirname, join } from "path";
import { readFileSync, existsSync } from "fs";
import { getAlphaIntent } from "../contract/intents.js";
import { ok } from "../contract/envelope.js";

type GlobalOpts = { json?: boolean }

const require = createRequire(import.meta.url);
const pkg = require("../../package.json") as { name: string; version: string };
// Resolve package.json from current file location (works for both tsx and compiled)
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

// Try source location first (tsx), then compiled location
let pkgPath = join(__dirname, "../../package.json");
if (!existsSync(pkgPath)) {
pkgPath = join(__dirname, "../../../package.json");
}

const pkg = JSON.parse(readFileSync(pkgPath, "utf-8")) as { name: string; version: string };

export function versionCommand(): Command {
return new Command("version")
Expand Down
4 changes: 2 additions & 2 deletions src/contract/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
Contract: show_capabilities MUST emit tier, intents, schema versions.
=========================================================== */

import { CLI_SCHEMA_VERSION } from "./schema";
import { listAlphaIntents } from "./intents";
import { CLI_SCHEMA_VERSION } from "./schema.js";
import { listAlphaIntents } from "./intents.js";

export type Capabilities = {
intentTier: "alpha" | "full";
Expand Down
4 changes: 2 additions & 2 deletions src/contract/envelope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
Guarantee: When --json, stdout emits JSON only (no logs).
=========================================================== */

import type { IntentDescriptor } from "./intents";
import { CLI_SCHEMA_VERSION, type ErrorPayload } from "./schema";
import type { IntentDescriptor } from "./intents.js";
import { CLI_SCHEMA_VERSION, type ErrorPayload } from "./schema.js";

export type CommandStatus = "ok" | "warn" | "error";

Expand Down
2 changes: 1 addition & 1 deletion src/http/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- Supports both raw API payloads and envelope form { ok: true, data: ... }.
=========================================================== */

import { getConfig } from "../config";
import { getConfig } from "../config.js";

export class HttpError extends Error {
status?: number;
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const program = new Command();

program
.name("hpl")
.description("Human Pattern Lab CLI (alpha)")
.version("0.1.0")
.description("Human Pattern Lab CLI")
.version("1.0.3")
.option("--json", "Emit contract JSON only on stdout")
.configureHelp({ helpWidth: 100 });

Expand Down
2 changes: 1 addition & 1 deletion src/render/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Purpose: Deterministic, dependency-free formatting for terminals.
=========================================================== */
import type { BaseEnvelope } from "../contract/envelope.js";
import {formatTags, safeLine} from "./table";
import {formatTags, safeLine} from "./table.js";

export function stripHtml(input: string): string {
const s = (input || "");
Expand Down
Loading