Skip to content
This repository was archived by the owner on Jul 18, 2026. It is now read-only.

feat(cli): nomark CLI — login, import, whoami - #4

Draft
nomark-dev wants to merge 2 commits into
mainfrom
claude/festive-davinci-0yc858
Draft

nomark-dev wants to merge 2 commits into
mainfrom
claude/festive-davinci-0yc858

Conversation

@nomark-dev

Copy link
Copy Markdown
Contributor

Summary

Implements the nomark CLI (work brief BRF-2026-04-12-nomark-cli) as a set of commands shipped inside the existing @nomark-ai/engine package.

Commands added

Command Behaviour
nomark login Reads NOMARK_TOKEN env var or prompts interactively. Validates nomark_sk_ prefix. Writes ~/.nomark/config.json at mode 0600. Never logs the full key.
nomark whoami Reads stored config and prints masked key (***last5).
nomark import --platform <p> --file <f> POSTs conversation export to the process-import Supabase edge function. Supported: chatgpt, claude, gemini. Prints analyzed / extracted / promoted counts on success. Handles 401/403, 5xx, and network errors with actionable messages.

Files changed

  • src/cli/login.ts — new
  • src/cli/whoami.ts — new
  • src/cli/config.ts — updated (HOME-relative path)
  • src/cli/import.ts — rewritten (cloud POST)
  • src/cli/index.ts — rewritten (async main, all commands wired)
  • tests/cli/login.test.ts — new (4 tests)
  • tests/cli/import.test.ts — new (10 tests)
  • tests/cli/whoami.test.ts — new (4 tests)
  • tests/fixtures/tiny-chatgpt.json — new (minimal fixture)
  • README.md — expanded CLI section (Authenticate, Import, Managing API Keys)
  • .github/workflows/publish.yml — scoped test step to packages/engine; removed || true (fails-closed)

Test coverage

279 tests passing. Login, import, and whoami commands each have dedicated test suites covering: happy path, invalid key format, file not found, invalid JSON, 401, 500, network error.

Security

  • Config file written at mode 0600 (CHARTER II.5)
  • Key never echoed in full — only last 5 chars shown
  • Credentials sent only to the designated edge function endpoint
  • No telemetry or analytics added

Out of scope (owner decision required)

  • No changes to the process-import edge function or its schema
  • No changes to the nomark-cloud panel or API key minting
  • Version bump and v* tag (required to trigger publish) — owner's call per brief

Test plan

  • npm test --workspace packages/engine — 279 tests pass
  • npx nomark login with NOMARK_TOKEN=nomark_sk_... set
  • npx nomark whoami after login
  • npx nomark import --platform chatgpt --file <export> with a real export file
  • Verify ~/.nomark/config.json has mode 0600 after login

Generated by Claude Code

claude added 2 commits June 25, 2026 15:25
- login: saves api key to ~/.nomark/config.json (0600), reads NOMARK_TOKEN env var
- import: POSTs conversation export to process-import edge function, supports chatgpt/claude/gemini
- whoami: reads stored config and reports masked key
- config: shared loadApiKey/saveConfig with HOME-relative path
- args: parseArgs helper wired to index.ts dispatcher
- CI: scope engine tests to packages/engine only, remove || true (fails-closed)
- README: add Authenticate, Import, Managing API Keys sections
- tests: 279 passing (login x4, import x10, whoami x4)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants