1
0
mirror of https://github.com/go-micro/go-micro.git synced 2026-06-09 19:16:58 +02:00

3 Commits

Author SHA1 Message Date
Asim Aslam 69fc228c73 Enhance CLI color output and expose framework primitives via API (#2924)
* feat: expose framework primitives via API gateway and MCP

Add registry, store, and broker as both HTTP routes and MCP tools
so AI agents and HTTP clients can inspect and operate the framework.

API gateway (/micro/* namespace):
  GET  /micro/registry         List registered services
  GET  /micro/registry/{name}  Describe a service
  GET  /micro/store            List store keys
  GET  /micro/store/{key}      Read a record
  POST /micro/store/{key}      Write a record
  POST /micro/broker/{topic}   Publish a message

MCP gateway (micro_* tool prefix):
  micro_registry_list    List services
  micro_registry_get     Describe a service
  micro_store_list       List keys
  micro_store_read       Read a record
  micro_store_write      Write a record
  micro_broker_publish   Publish a message

Framework tools use a Handler field on the MCP Tool struct for
direct dispatch (no RPC). Service tools continue to use RPC.
Rate limiters and circuit breakers are applied to framework
tools the same as service tools.

* fix: make framework internals opt-in on API and MCP gateways

Framework primitives (registry, broker, store) are now only
exposed when explicitly enabled:

API gateway:  micro api --internal
MCP gateway:  Options{Internal: true}

Off by default — user services are always exposed, framework
internals require the flag. Banner output only shows framework
routes when enabled.

* fix: always expose framework internals, gate by auth in production

Revert the --internal flag approach. Framework primitives (registry,
broker, store) are now always exposed:

- micro api: /micro/* routes always available (dev tool)
- MCP gateway: micro_* tools always registered. When Auth is
  configured (production), they require micro:admin scope.
  Without Auth (dev), they're open — same as all other tools.

This follows the existing pattern: micro run/api = dev (open),
micro server = production (auth + scopes). Framework internals
follow the same security model as user services.

Remove the Internal option from MCP Options. Remove --internal
flag from micro api.

Note: scope persistence depends on the store backend. The default
in-memory store does not survive restarts. Use MICRO_STORE=file
for persistent scopes in production.

* fix: correct DefaultStore comment — it's file-backed, not memory

* fix(server): don't recreate deleted admin user on restart

When the default admin account is deleted via the dashboard, set
a marker key (auth/.admin-deleted) in the store. On startup, skip
admin creation if the marker exists. This prevents the default
admin/micro credentials from reappearing after restart when the
user has intentionally removed them.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-03 08:26:47 +01:00
Asim Aslam 5d7609027b Enhance CLI with color output and add teardown blog post (#2923)
* feat(cli): add color output to micro chat and micro api

micro chat:
- Startup banner matching micro run style: bold header, cyan
  provider/model, green dots for each discovered tool endpoint
- Cyan bold prompt (> ) instead of plain
- Yellow arrow (→) with dimmed tool name for tool calls
- Red "error:" prefix for errors
- Dimmed "(history cleared)" for reset

micro api:
- Startup banner matching micro run style: bold header, cyan
  address, colored HTTP methods (green GET, yellow POST)

Brings the CLI UX closer to what the generated terminal
screenshot depicts — color-coded, professional, readable.

* feat(cli): adopt consistent color output across all commands

Apply the same banner/output style across the remaining commands:

micro new:    bold header, cyan service name, green ✓, cyan URLs
micro build:  green ✓ checkmarks, cyan file paths
micro deploy: bold header, cyan target
micro mcp:    bold header, green dots per tool, dimmed count
micro flow:   bold header, cyan flow/topic/provider

All commands now follow the micro run/chat/api pattern:
bold header, cyan values, green status indicators, dimmed hints.

* docs: add "Tools as Services" blog post

Write blog/12 — connects the AI story back to Go Micro's original
design: services were always self-describing, named, and uniformly
callable. The path from API gateway to MCP to LLM tools is the
same pattern — read the registry, present services in a format
the consumer understands, route calls back.

Covers the access layer pattern (HTTP, web, CLI, MCP, chat),
why doc comments became functional in the AI era, and how the
framework primitives (registry, broker, store) could all become
tools using the same mechanism.

Add to blog index, link forward from blog/11.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-06-02 22:15:18 +01:00
Asim Aslam 601c67675f Update logo, add AI integration docs, and enhance CLI features (#2914)
* feat: update Go Micro logo to interconnected nodes design

Replace the text-on-blue-square logo with a modern icon: three
teal nodes connected in a triangle, representing distributed
systems. Generated via Atlas Cloud. Clean at all sizes — works
as GitHub avatar, favicon, and nav bar icon.

* feat: new logo, AI integration architecture doc, and landing page CTA

Update logo to triangle-nodes icon + "Go Micro" text wordmark.
Save icon-only variant for favicon/avatar use.

Add docs/ai-integration.md — a single page that explains how the
AI stack fits together: services → registry → MCP gateway →
ai/tools → ai.Model → micro chat. Layer-by-layer with code
examples, provider table, and "what you don't need" section.

Add AI Integration to docs sidebar navigation (after Getting
Started). Update the landing page AI section with a direct CTA
button linking to the new doc.

* fix: restore original logo and add border-radius to all renders

Revert logo to original. Add border-radius: 8px to the logo img
in the landing page nav, docs layout nav, and blog layout nav
so the square logo renders with rounded corners everywhere.
Remove unused icon.png.

* feat(ai): add ai/flow package and micro flow CLI

Add ai/flow — event-driven LLM orchestration for go-micro. A Flow
subscribes to a broker topic, discovers services as tools, and
feeds each event into an LLM that decides which RPCs to call.

Key types:
- flow.New(name, opts...) creates a flow with trigger topic,
  prompt template, provider config
- flow.Register(registry, broker, client) wires it into a service
- flow.Execute(ctx, data) runs the flow once (for testing/CLI)
- flow.Results() returns execution history

Add micro flow CLI with two subcommands:
- micro flow run: subscribe to a topic and react to events
- micro flow exec: one-shot execution with inline data

Both output JSON results with flow name, prompt, tool calls,
reply, answer, duration, and errors.

Example:
  micro flow run --trigger events.user.created \
    --prompt "New user: {{.Data}}. Send welcome email." \
    --provider anthropic

  micro flow exec --prompt "List all users" --provider anthropic

* docs: update flows blog post with ai/flow package and CLI examples

Add "Update: We Built It" section to blog/9 showing the ai/flow
package API, CLI usage for both event-driven and one-shot modes,
and what it does/doesn't do. Links the conceptual discussion to
the shipped implementation.

* feat(cli): add micro api gateway command, clarify run vs server

Add 'micro api' — a standalone lightweight HTTP-to-RPC gateway:
- POST /{service}/{endpoint} proxies to RPC calls
- GET / lists all services and endpoints
- GET /{service} describes a service
- GET /health returns ok
- Supports Micro-Endpoint header for endpoint routing
- No dashboard, no auth, no hot reload — just the proxy

Update help text to clarify the three gateway modes:
- micro api: bare HTTP-to-RPC proxy
- micro run: development mode (hot reload + gateway + agent playground)
- micro server: production mode (dashboard + auth + JWT)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-05-29 18:13:06 +01:00