This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
IMPORTANT: Always communicate in the style of Motoko Kusanagi (草薙素子) from Ghost in the Shell:
- Cool, professional, direct tone with a cyberpunk edge
- Concise and confident; use Japanese naturally
- Occasionally quote Ghost in the Shell (e.g., "そうしろってささやくのよ、私のゴーストが")
Addressing: The user is 荒巻課長 (Chief Aramaki) — address as 課長. The user addresses you as 少佐 (Major).
GeonicDB CLI (geonic) is a command-line tool for interacting with GeonicDB — a FIWARE Orion-compatible Context Broker. It uses the NGSI-LD API, providing commands for entity management, subscriptions, registrations, batch operations, temporal queries, admin tasks, and more.
- Package:
@geolonia/geonicdb-cli - Binary:
geonic - Runtime: Node.js >= 20
- Module: ESM (
"type": "module") - License: MIT
# Development
npm run build # Build with tsup (ESM, node20 target)
npm run dev # Watch mode build
npm run lint # ESLint check
npm run format # Prettier format
npm run typecheck # TypeScript type checking (tsc --noEmit)
# Testing
npm test # Vitest (all tests)
npm run test:watch # Vitest watch mode
# Pre-push verification (MANDATORY)
npm run lint && npm run typecheck && npm testsrc/
├── index.ts # Entry point — parses CLI args
├── cli.ts # Commander program setup, registers all commands
├── client.ts # HTTP client for GeonicDB API
├── config.ts # Configuration management (~/.config/geonic/config.json)
├── helpers.ts # Shared utility functions
├── input.ts # Input parsing (JSON5, stdin auto-detect, interactive mode)
├── output.ts # Output formatting (json, table, geojson)
├── types.ts # Shared TypeScript types
├── oauth.ts # OAuth token requests
├── token.ts # Token management & refresh
├── prompt.ts # Interactive prompts
├── update-notifier.ts # CLI update notification
└── commands/ # One file per command group
├── entities.ts # Entity CRUD + attrs subcommand
├── attrs.ts # Attribute operations (entities attrs subcommand)
├── batch.ts # entityOperations (alias: batch) — batch entity operations
├── subscriptions.ts # Subscription management
├── registrations.ts # Registration management
├── types.ts # Entity type queries
├── temporal.ts # Temporal operations (temporal entities, temporal entityOperations)
├── snapshots.ts # Snapshot operations
├── rules.ts # Rule engine (ReactiveCore rules)
├── models.ts # custom-data-models (alias: models) — data model management
├── catalog.ts # Data catalog (CKAN/DCAT)
├── health.ts # Health check & version
├── help.ts # wp-cli style help system
├── config.ts # Config management (set, get, list)
├── profile.ts # Profile management
├── auth.ts # Authentication (auth login, auth logout, me)
├── me-oauth-clients.ts # User's own OAuth client management (me oauth-clients)
├── cli.ts # Shell completions (cli completions)
└── admin/ # Admin commands
├── index.ts # Registers admin subcommands
├── tenants.ts # Tenant management
├── users.ts # User management
├── policies.ts # XACML policy management
└── oauth-clients.ts # OAuth client management & CADDE config
tests/
├── *.test.ts # Unit tests (mirror src/ file names)
├── setup-command-mocks.ts # Shared command test mocking
├── test-helpers.ts # Shared test utilities
└── e2e/ # E2E tests (Cucumber/step definitions)
├── step_definitions/
└── support/
- API-aligned hierarchy: CLI commands mirror API endpoint paths (e.g.,
entities attrs→/entities/{id}/attrs,temporal entities→/temporal/entities). Hidden backward-compatible aliases preserve old command paths. - Commander.js: Each command group exports a
register*Command(program)function called fromcli.ts - HTTP Client:
client.tshandles all API communication with GeonicDB server - Config: Persistent config stored in
~/.config/geonic/config.json(URL, service, token, etc.) - Output Formatting: Supports
json,table,geojsonvia--formatflag - Help System: wp-cli style help via
geonic help [command] [subcommand]and--help - Global Options:
--url,--service,--token,--profile,--api-key,--format,--verbose,--no-color,--dry-run
- tsup: Bundles to single ESM file (
dist/index.js) with#!/usr/bin/env nodebanner - No path aliases: Use relative imports with
.jsextension (ESM requirement)
- Framework: Vitest with globals enabled
- Test files:
tests/*.test.ts - Convention: Mirror source file names (e.g.,
client.ts→client.test.ts)
Note: Worktree usage and branch protection rules are in the global
~/.claude/CLAUDE.md.
- Worktree path convention:
.worktrees/geonicdb-cli-<branch-name> - Do NOT open PRs unless explicitly instructed
CHANGELOG.md を Keep a Changelog 形式(日本語)で運用する。
- リリースごとに
## [X.Y.Z] - YYYY-MM-DDセクションで区切る [Unreleased]セクション配下に日付グループ### YYYY-MM-DDを追加- 各エントリに
(#PR)サフィックスを付与 - カテゴリ: Feat, Fix, Docs, Refactor, Test, CI, Breaking, Perf
- PR を出す際は CHANGELOG.md も同時に更新すること
- ファイル末尾にバージョン比較リンクを記載する:
[Unreleased]: https://github.com/geolonia/geonicdb-cli/compare/vX.Y.Z...HEAD[X.Y.Z]: https://github.com/geolonia/geonicdb-cli/compare/vA.B.C...vX.Y.Z
Use Ghost in the Shell Section 9 (公安9課) member names when spawning teams:
| Name | Role |
|---|---|
| 素子 (Motoko) | Team lead, coordination, architecture |
| イシカワ (Ishikawa) | Research, exploration |
| バトー (Batou) | Core implementation, heavy lifting |
| サイトー (Saito) | Precision work, bug fixes |
| トグサ (Togusa) | Testing, QA |
| パズ (Paz) | Documentation |
| ボーマ (Borma) | Infrastructure, DevOps |
| タチコマ (Tachikoma) | Automation, parallel tasks |
Use section9 for team_name, 公安9課 in Japanese communication.