<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kingson Wu</title>
    <description>The latest articles on DEV Community by Kingson Wu (@kingson4ng).</description>
    <link>https://dev.to/kingson4ng</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3505302%2Ff31627b7-d865-496f-91a5-5fd1fafae492.png</url>
      <title>DEV Community: Kingson Wu</title>
      <link>https://dev.to/kingson4ng</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kingson4ng"/>
    <language>en</language>
    <item>
      <title>FastProxy: A Go Blueprint for Enterprise-Grade Service Proxies</title>
      <dc:creator>Kingson Wu</dc:creator>
      <pubDate>Wed, 17 Sep 2025 07:20:07 +0000</pubDate>
      <link>https://dev.to/kingson4ng/fastproxy-a-go-blueprint-for-enterprise-grade-service-proxies-12pj</link>
      <guid>https://dev.to/kingson4ng/fastproxy-a-go-blueprint-for-enterprise-grade-service-proxies-12pj</guid>
      <description>&lt;p&gt;In a world where multi-cloud topologies and zero-trust philosophies are rapidly becoming table stakes, east-west traffic governance is no longer optional. &lt;a href="https://github.com/Kingson4Wu/fast_proxy" rel="noopener noreferrer"&gt;FastProxy&lt;/a&gt; delivers a security-first, high-throughput service proxy implemented entirely in Go, packaging encryption, integrity checking, traffic governance, and observability into a compact runtime. This article introduces the project from an engineering perspective and highlights the Go fundamentals you can master by exploring its codebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mission and Positioning
&lt;/h2&gt;

&lt;p&gt;FastProxy’s primary goal is to provide trustworthy, low-latency channels for service-to-service communication while enforcing consistent security policies. It can be embedded directly in business processes, deployed as a sidecar, or run as a centralized ingress/egress gateway—making it a natural fit for microservices, serverless functions, and data pipelines.&lt;/p&gt;

&lt;p&gt;Key differentiators include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Integrated Security&lt;/strong&gt;: End-to-end encryption/decryption, signature validation, rate limiting, and auditability baked into the data path.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance-Driven Runtime&lt;/strong&gt;: A Go and FastHTTP core optimized for protobuf payloads and designed for throughput.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Modular Architecture&lt;/strong&gt;: Components such as &lt;code&gt;center&lt;/code&gt;, &lt;code&gt;in-proxy&lt;/code&gt;, &lt;code&gt;out-proxy&lt;/code&gt;, and &lt;code&gt;server&lt;/code&gt; can be mixed and matched to suit different topologies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Observability by Default&lt;/strong&gt;: Structured logging, metrics, and CI-backed coverage reports ensure operational transparency.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Architecture at a Glance
&lt;/h2&gt;

&lt;p&gt;FastProxy cleanly separates control-plane orchestration from the data-plane path:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Center&lt;/strong&gt;: Manages service metadata, configuration, and policy distribution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;InProxy / OutProxy&lt;/strong&gt;: Apply security checks, flow control, and decoding for inbound and outbound traffic respectively.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server&lt;/strong&gt;: Hosts business logic or forwards to existing upstreams, speaking HTTP/HTTPS and protobuf.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client SDK&lt;/strong&gt;: Provides ergonomic Go integrations, enabling embedded deployments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This division enables runtime policy changes without redeploying workloads and supports multi-tenant, multi-environment rollout patterns.&lt;/p&gt;

&lt;h2&gt;
  
  
  Go Engineering Learning Map
&lt;/h2&gt;

&lt;p&gt;FastProxy’s repository covers many of the foundational skills required for professional Go development. The following themes offer a structured way to learn from the project.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Modular Design and Package Boundaries
&lt;/h3&gt;

&lt;p&gt;The project relies on Go Modules to manage dependencies (&lt;code&gt;go.mod&lt;/code&gt;) and uses packages such as &lt;code&gt;common/&lt;/code&gt;, &lt;code&gt;inproxy/&lt;/code&gt;, and &lt;code&gt;outproxy/&lt;/code&gt; to partition responsibilities. Studying this layout illustrates how to plan large-scale Go systems.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Configuration and Resource Management (&lt;code&gt;embed.FS&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;inproxy/inproxy.go&lt;/code&gt; demonstrates embedding configuration artifacts directly into binaries:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// inproxy/inproxy.go&lt;/span&gt;
&lt;span class="c"&gt;//go:embed *&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;ConfigFs&lt;/span&gt; &lt;span class="n"&gt;embed&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;FS&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inlining templates and banners avoids external dependencies during deployment and showcases Go’s straightforward resource bundling.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Concurrency and Synchronization Primitives
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;common/server/server.go&lt;/code&gt; offers a compact showcase of Go’s concurrency toolset:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;quit&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;chan&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Signal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Notify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;quit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;syscall&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SIGINT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;syscall&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SIGTERM&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;syscall&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SIGQUIT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;syscall&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SIGHUP&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="n"&gt;quit&lt;/span&gt;

&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shutdownTimeout&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;cf&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CancelFunc&lt;/span&gt;
    &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shutdownTimeout&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;cf&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TODO&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;done&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;make&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;chan&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt;&lt;span class="p"&gt;{},&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;svr&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Shutdown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"proxy server shutdown error"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zap&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"err"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;done&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt;&lt;span class="p"&gt;{}{}&lt;/span&gt;
    &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;wg&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Done&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Goroutines&lt;/strong&gt; handle asynchronous startup and graceful shutdown.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Channels&lt;/strong&gt; propagate OS signals and shutdown notifications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;sync.WaitGroup&lt;/code&gt; and &lt;code&gt;sync.RWMutex&lt;/code&gt;&lt;/strong&gt; coordinate shared state and lifecycles.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These patterns demonstrate how concurrency primitives collaborate inside production services.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Context-Driven Lifecycle Management
&lt;/h3&gt;

&lt;p&gt;The codebase relies on &lt;code&gt;context.Context&lt;/code&gt; to propagate cancellation and deadlines, most notably when enforcing graceful shutdown with &lt;code&gt;context.WithTimeout&lt;/code&gt;. This underlines the central role of context in orchestration logic.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Interfaces, Dependency Injection, and Logging Abstractions
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;common/logger&lt;/code&gt; defines a logging interface, while &lt;code&gt;common/server&lt;/code&gt; employs the functional options pattern to inject &lt;code&gt;logger.Logger&lt;/code&gt; implementations. Together they show how Go interfaces and options create loosely coupled, testable components.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. High-Performance Networking
&lt;/h3&gt;

&lt;p&gt;FastProxy supports both the standard &lt;code&gt;net/http&lt;/code&gt; stack and &lt;code&gt;github.com/valyala/fasthttp&lt;/code&gt;, bridging them with &lt;code&gt;fasthttpadaptor&lt;/code&gt;. The design illustrates how to balance ease of use with extreme performance within Go’s networking ecosystem.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Testing and Quality Assurance
&lt;/h3&gt;

&lt;p&gt;The repository contains rich &lt;code&gt;*_test.go&lt;/code&gt; coverage, pre-generated coverage reports (&lt;code&gt;coverage-*.out&lt;/code&gt;), and automation scripts such as &lt;code&gt;golangci-lint.sh&lt;/code&gt;. These assets demonstrate how to build CI-ready unit, integration, and linting pipelines.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. Build and Automation Tooling
&lt;/h3&gt;

&lt;p&gt;A pragmatic &lt;code&gt;Makefile&lt;/code&gt; wraps common build, test, and lint workflows, providing a template for integrating Go tooling into reproducible development processes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Suggested Learning Path
&lt;/h2&gt;

&lt;p&gt;To leverage FastProxy as a learning vehicle, consider the following progression:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Read the README and Wiki&lt;/strong&gt; to form a mental model of the component relationships.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run the &lt;code&gt;examples/&lt;/code&gt; directory&lt;/strong&gt; to see embedded usage and configuration in action.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Study &lt;code&gt;common/server&lt;/code&gt;&lt;/strong&gt; to understand service startup, concurrency management, and graceful shutdown mechanics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dive into &lt;code&gt;inproxy&lt;/code&gt; / &lt;code&gt;outproxy&lt;/code&gt;&lt;/strong&gt; to observe how encryption, signature verification, and flow control are enforced.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customize policies&lt;/strong&gt; by extending configuration or option hooks to internalize the functional options pattern.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;FastProxy is more than a ready-to-deploy service proxy—it doubles as a comprehensive Go engineering playbook. By exploring its modules, concurrency patterns, security posture, and observability story, you can cultivate the skills required to deliver production-grade Go services. Pair the source code with its test suites, iterate with hands-on experiments, and translate these lessons into your own engineering toolkit.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>go</category>
      <category>proxy</category>
      <category>encrypt</category>
    </item>
    <item>
      <title>ForgeFlow: Engineering-Grade Automation For AI CLIs Inside tmux</title>
      <dc:creator>Kingson Wu</dc:creator>
      <pubDate>Tue, 16 Sep 2025 05:52:14 +0000</pubDate>
      <link>https://dev.to/kingson4ng/forgeflow-engineering-grade-automation-for-ai-clis-inside-tmux-36fj</link>
      <guid>https://dev.to/kingson4ng/forgeflow-engineering-grade-automation-for-ai-clis-inside-tmux-36fj</guid>
      <description>&lt;p&gt;ForgeFlow automates interactive AI CLIs (e.g., Gemini, Codex) inside a tmux&lt;br&gt;
  session using a clean “adapter + rules” architecture. It detects prompts&lt;br&gt;
  and processing states, sends the right commands, and keeps going until tasks&lt;br&gt;
  converge — with logs, extensibility, and sensible recovery behavior.&lt;/p&gt;

&lt;p&gt;This guide covers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to install and use ForgeFlow (focus)&lt;/li&gt;
&lt;li&gt;Architecture overview, key interfaces, and ANSI support&lt;/li&gt;
&lt;li&gt;Extending with custom rules and adapters&lt;/li&gt;
&lt;li&gt;A simple flow diagram in Markdown&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Who It’s For&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Developers who live in the terminal and use AI CLIs&lt;/li&gt;
&lt;li&gt;Teams that want a repeatable driver for long-running, iterative tasks&lt;/li&gt;
&lt;li&gt;Anyone who needs logging and simple extensibility without reinventing the
loop&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Requirements&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;macOS/Linux&lt;/li&gt;
&lt;li&gt;Python 3.9+&lt;/li&gt;
&lt;li&gt;tmux installed and on PATH&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Install And Run&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dev install (pinned tooling):

&lt;ul&gt;
&lt;li&gt;pip install -e .[dev] -c constraints-dev.txt&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Runtime install:

&lt;ul&gt;
&lt;li&gt;pip install -e .&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Makefile helpers:

&lt;ul&gt;
&lt;li&gt;make dev-install — install dev deps with constraints&lt;/li&gt;
&lt;li&gt;make lint / make fmt / make test&lt;/li&gt;
&lt;li&gt;make setup-hooks — optional Git hooks&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Typical run:&lt;/p&gt;

&lt;p&gt;forgeflow \&lt;br&gt;
--session qwen_session \&lt;br&gt;
--workdir "/abs/path/to/your/project" \&lt;br&gt;
--ai-cmd "qwen --proxy &lt;a href="http://localhost:7890" rel="noopener noreferrer"&gt;http://localhost:7890&lt;/a&gt; --yolo" \&lt;br&gt;
--cli-type gemini \&lt;br&gt;
--poll 10 \&lt;br&gt;
--timeout 2000 \&lt;br&gt;
--log-level INFO \&lt;br&gt;
--log-file forgeflow.log&lt;/p&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Switch adapters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;--cli-type gemini or --cli-type codex (claude_code is a placeholder)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Use project-specific rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add {project}_rules.py or {project}.py in your project root or in
examples/&lt;/li&gt;
&lt;li&gt;Run with --project myproject&lt;/li&gt;
&lt;li&gt;forgeflow \
--session qwen_session \
--workdir "/abs/path/to/your/project" \
--ai-cmd "qwen --proxy &lt;a href="http://localhost:7890" rel="noopener noreferrer"&gt;http://localhost:7890&lt;/a&gt; --yolo" \
--project myproject \
--cli-type gemini&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Logging:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;--log-file forgeflow.log writes file logs&lt;/li&gt;
&lt;li&gt;--no-console disables console logging&lt;/li&gt;
&lt;li&gt;--log-level supports DEBUG/INFO/WARNING/ERROR&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Python API&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;from forgeflow.core.automation import Config, run_automation&lt;/p&gt;

&lt;p&gt;cfg = Config(&lt;br&gt;
session="qwen_session",&lt;br&gt;
workdir="/abs/path/to/your/project",&lt;br&gt;
ai_cmd="qwen --proxy &lt;a href="http://localhost:7890" rel="noopener noreferrer"&gt;http://localhost:7890&lt;/a&gt; --yolo",&lt;br&gt;
cli_type="gemini",&lt;br&gt;
poll_interval=10,&lt;br&gt;
input_prompt_timeout=2000,&lt;br&gt;
log_file="forgeflow.log",&lt;br&gt;
log_to_console=True,&lt;br&gt;
project="myproject",   # optional&lt;br&gt;
log_level="INFO",&lt;br&gt;
)&lt;br&gt;
run_automation(cfg)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Rules: Project-Level Customization&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;File naming:

&lt;ul&gt;
&lt;li&gt;{project}_rules.py or {project}.py&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Function name (recommended):

&lt;ul&gt;
&lt;li&gt;build_rules() -&amp;gt; list[Rule]&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Minimal example:&lt;/p&gt;

&lt;h1&gt;
  
  
  examples/myproject_rules.py
&lt;/h1&gt;

&lt;p&gt;from forgeflow.core.rules import Rule&lt;/p&gt;

&lt;p&gt;def build_rules() -&amp;gt; list[Rule]:&lt;br&gt;
def done(output: str) -&amp;gt; bool:&lt;br&gt;
return "All tasks have been completed." in output&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  return [
      Rule(check=done, command=None),  # stop
      Rule(check=lambda out: "API Error" in out, command="continue"),
      Rule(check=lambda out: True, command="continue"),
  ]
&lt;/code&gt;&lt;/pre&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Rule behavior:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rules are evaluated in order, the first matching rule returns its
command.&lt;/li&gt;
&lt;li&gt;If command is None, automation stops.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Architecture Overview&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Core loop (forgeflow/core/automation.py)

&lt;ul&gt;
&lt;li&gt;Creates/attaches tmux session&lt;/li&gt;
&lt;li&gt;Determines adapter by --cli-type&lt;/li&gt;
&lt;li&gt;Captures tmux output, checks “prompt vs. processing”, evaluates rules&lt;/li&gt;
&lt;li&gt;Timeout recovery: ESC → progressive Backspace until prompt → send
continue&lt;/li&gt;
&lt;li&gt;Logging level configurable; file and console outputs supported&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;tmux I/O (forgeflow/core/tmux_ctl.py)

&lt;ul&gt;
&lt;li&gt;Encapsulates tmux operations: session creation, send keys, capture pane&lt;/li&gt;
&lt;li&gt;capture_output(include_ansi=False) supports capturing raw ANSI when
needed&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Adapters (forgeflow/core/cli_adapters/*)

&lt;ul&gt;
&lt;li&gt;Interface CLIAdapter:

&lt;ul&gt;
&lt;li&gt;is_input_prompt(output) -&amp;gt; bool&lt;/li&gt;
&lt;li&gt;is_input_prompt_with_text(output) -&amp;gt; bool&lt;/li&gt;
&lt;li&gt;is_task_processing(output) -&amp;gt; bool&lt;/li&gt;
&lt;li&gt;is_ai_cli_exist(output) -&amp;gt; bool&lt;/li&gt;
&lt;li&gt;wants_ansi() -&amp;gt; bool — ask automation to capture pane with ANSI
codes&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Implementations: gemini.py, codex.py (claude placeholder present)&lt;/li&gt;

&lt;li&gt;Adapter resolution via get_cli_adapter(cli_type)&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;Rules (forgeflow/core/rules.py)

&lt;ul&gt;
&lt;li&gt;Rule(check: Callable[[str], bool], command: str | None)&lt;/li&gt;
&lt;li&gt;Default rules and next_command(output, rules)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Rule loader (forgeflow/core/rule_loader.py)

&lt;ul&gt;
&lt;li&gt;Dynamically loads {project}_rules.py or {project}.py from workdir or
examples/&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;ANSI Utilities For Smarter Detection&lt;/p&gt;

&lt;p&gt;Some CLIs render distinct prompt colors or attributes. You can opt-in to&lt;br&gt;
  capture ANSI and parse it in your adapter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adapter opt-in:
def wants_ansi(self) -&amp;gt; bool:
return True
return True&lt;/li&gt;
&lt;li&gt;Utilities (forgeflow/core/ansi.py):

&lt;ul&gt;
&lt;li&gt;strip_ansi(text) -&amp;gt; str — removes all ANSI escape sequences&lt;/li&gt;
&lt;li&gt;parse_ansi_segments(text) -&amp;gt; list[Segment]

&lt;ul&gt;
&lt;li&gt;Splits text into styled segments (tracks SGR attributes)&lt;/li&gt;
&lt;li&gt;Supports bold, dim, italic, underline, blink, inverse, strike&lt;/li&gt;
&lt;li&gt;Supports FG/BG basic (30–37/90–97/40–47/100–107), 256-color,
truecolor&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;split_segments_lines(segments) -&amp;gt; list[list[Segment]]

&lt;ul&gt;
&lt;li&gt;Split by newline while preserving styles&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Example usage in an adapter:&lt;/p&gt;

&lt;p&gt;from forgeflow.core.ansi import parse_ansi_segments&lt;/p&gt;

&lt;p&gt;class MyAdapter(CLIAdapter):&lt;br&gt;
def wants_ansi(self) -&amp;gt; bool:&lt;br&gt;
return True&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  def is_input_prompt(self, output: str) -&amp;gt; bool:
      # Example heuristic: find a red prompt marker at end of screen
      segments = parse_ansi_segments(output)
      text = ''.join(seg.text for seg in segments)
      return text.rstrip().endswith('&amp;gt;')  # combine with color checks
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;if needed&lt;/p&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;This keeps default behavior unchanged while enabling color-aware rules when&lt;br&gt;
  helpful.&lt;/p&gt;

&lt;p&gt;Simple Flow Diagram&lt;/p&gt;

&lt;p&gt;flowchart TD&lt;br&gt;
    A[Start forgeflow] --&amp;gt; B[Create/attach tmux session]&lt;br&gt;
    B --&amp;gt; C[Ensure AI CLI running]&lt;br&gt;
    C --&amp;gt; D{Capture output&lt;br&gt;(ANSI optional)}&lt;br&gt;
    D --&amp;gt; |prompt &amp;amp; idle| E[Evaluate rules -&amp;gt; command]&lt;br&gt;
    E --&amp;gt; F[Send text + Enter]&lt;br&gt;
    F --&amp;gt; G[Sleep 2s]&lt;br&gt;
    G --&amp;gt; D&lt;br&gt;
    D --&amp;gt; |prompt has text| H[Send Enter]&lt;br&gt;
    H --&amp;gt; G&lt;br&gt;
    D --&amp;gt; |processing| I[Wait poll interval]&lt;br&gt;
    I --&amp;gt; D&lt;br&gt;
    D --&amp;gt; |timeout| J[ESC + progressive backspace]&lt;br&gt;
    J --&amp;gt; K[Send "continue"]&lt;br&gt;
    K --&amp;gt; D&lt;br&gt;
    E --&amp;gt; |None| L[Stop]&lt;/p&gt;

&lt;p&gt;Troubleshooting&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“tmux is required but not found”

&lt;ul&gt;
&lt;li&gt;Install tmux and ensure tmux -V succeeds&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;CLI not detected as running

&lt;ul&gt;
&lt;li&gt;Check --ai-cmd and allow a few seconds post-launch&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;No project rules

&lt;ul&gt;
&lt;li&gt;Defaults are used; add custom rules for better convergence&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Repository And License&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repo: &lt;a href="https://github.com/kingson4wu/ForgeFlow" rel="noopener noreferrer"&gt;https://github.com/kingson4wu/ForgeFlow&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;License: MIT&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>automation</category>
      <category>gemini</category>
      <category>openai</category>
    </item>
    <item>
      <title>Driving AI CLI Tools to Write Code: A Semi-Automated Workflow</title>
      <dc:creator>Kingson Wu</dc:creator>
      <pubDate>Tue, 16 Sep 2025 04:14:12 +0000</pubDate>
      <link>https://dev.to/kingson4ng/driving-ai-cli-tools-to-write-code-a-semi-automated-workflow-1kj1</link>
      <guid>https://dev.to/kingson4ng/driving-ai-cli-tools-to-write-code-a-semi-automated-workflow-1kj1</guid>
      <description>&lt;p&gt;Lately, I’ve been experimenting with a &lt;strong&gt;semi-automated programming&lt;/strong&gt; workflow.&lt;br&gt;&lt;br&gt;
The idea is simple: let AI tools continuously write code in a controlled environment, while I stay in charge of architecture, quality, and reviews. Think of it as engineering field notes — practical patterns and lessons learned.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Semi-Automation?
&lt;/h2&gt;

&lt;p&gt;We already have plenty of AI coding tools — Claude Code, Gemini CLI, QWEN, and many others that integrate with CLI workflows. They boost productivity, but &lt;strong&gt;manual prompting step by step isn’t enough&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead, my approach is to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;scripts&lt;/strong&gt; to orchestrate and manage AI tools;
&lt;/li&gt;
&lt;li&gt;Keep sessions alive with &lt;strong&gt;tmux&lt;/strong&gt;;
&lt;/li&gt;
&lt;li&gt;Automatically send &lt;strong&gt;structured prompts&lt;/strong&gt;, collect responses, and keep the AI working until a task is done.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal: a tireless &lt;strong&gt;“virtual developer”&lt;/strong&gt; coding 24/7, while I focus on design, architecture, and quality control.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Overall Approach
&lt;/h2&gt;

&lt;p&gt;This workflow has &lt;strong&gt;four main stages&lt;/strong&gt;, each anchored by human review. That’s the secret sauce for keeping things sane.&lt;/p&gt;




&lt;h3&gt;
  
  
  1. Project Initialization: Specs and Skeleton First
&lt;/h3&gt;

&lt;p&gt;Before coding, you need &lt;strong&gt;solid guidelines and structure&lt;/strong&gt;. That’s what makes semi-automation possible.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a new GitHub repository.
&lt;/li&gt;
&lt;li&gt;Start with a baseline project doc (e.g., &lt;a href="https://github.com/Kingson4Wu/cpp-linux-playground" rel="noopener noreferrer"&gt;cpp-linux-playground&lt;/a&gt;), then rewrite it for your tech stack (e.g., TypeScript) and save as &lt;code&gt;PROJECT.md&lt;/code&gt;.
&lt;/li&gt;
&lt;li&gt;Plan ahead:

&lt;ul&gt;
&lt;li&gt;Tech stack (languages, tools, standards)
&lt;/li&gt;
&lt;li&gt;Task verification (tests, QA)
&lt;/li&gt;
&lt;li&gt;Static analysis &amp;amp; code quality tools
&lt;/li&gt;
&lt;li&gt;Project structure
&lt;/li&gt;
&lt;li&gt;Git commit conventions
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;👉 &lt;strong&gt;Pro tip&lt;/strong&gt;: rename &lt;code&gt;docs/&lt;/code&gt; to something more precise (like &lt;code&gt;specifications/&lt;/code&gt;) to avoid random file dumping.&lt;/p&gt;

&lt;p&gt;AI can help draft this documentation, but every detail should be &lt;strong&gt;human-approved&lt;/strong&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Break Tasks Into Detailed Specs
&lt;/h3&gt;

&lt;p&gt;Every feature or bug fix deserves its own spec under &lt;code&gt;@specifications/task_specs/&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No coding yet&lt;/strong&gt; — just detailed planning.
&lt;/li&gt;
&lt;li&gt;Each spec should define:

&lt;ul&gt;
&lt;li&gt;Functional description
&lt;/li&gt;
&lt;li&gt;Implementation steps
&lt;/li&gt;
&lt;li&gt;Inputs and outputs
&lt;/li&gt;
&lt;li&gt;Test cases
&lt;/li&gt;
&lt;li&gt;Edge cases and risks
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;This &lt;strong&gt;reduces ambiguity&lt;/strong&gt; and dramatically improves AI’s code quality.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Automate the Coding Process
&lt;/h3&gt;

&lt;p&gt;With specs in hand, the real semi-automation begins:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Python scripts to &lt;strong&gt;orchestrate AI CLI sessions&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Keep sessions running via &lt;strong&gt;tmux&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Send structured prompts to AI tools (Claude, Gemini, QWEN, etc.).
&lt;/li&gt;
&lt;li&gt;Enforce these rules:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Never auto-commit code&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Run validation after every iteration
&lt;/li&gt;
&lt;li&gt;Sync project progress into &lt;code&gt;TODO.md&lt;/code&gt;, linked from &lt;code&gt;PROJECT.md&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Workflows can borrow from &lt;a href="https://github.com/Kingson4Wu/ForgeFlow" rel="noopener noreferrer"&gt;ForgeFlow&lt;/a&gt;, which demonstrates prompt pipelines and programmatic handling of AI responses.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Pro tip&lt;/strong&gt;: If a task runs for more than an hour, send an &lt;strong&gt;“ESC” signal&lt;/strong&gt; to re-check progress.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. Clear Definition of “Done”
&lt;/h3&gt;

&lt;p&gt;A task is &lt;strong&gt;done&lt;/strong&gt; only when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All code matches the plan;
&lt;/li&gt;
&lt;li&gt;Unit tests pass;
&lt;/li&gt;
&lt;li&gt;Automation scripts and prompts are updated;
&lt;/li&gt;
&lt;li&gt;Build and test pipelines run cleanly;
&lt;/li&gt;
&lt;li&gt;Git changes are committed;
&lt;/li&gt;
&lt;li&gt;The next task can begin.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At the very end, the AI should respond with nothing but &lt;strong&gt;“Done.”&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Project Example: &lt;code&gt;ts-playground&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/Kingson4Wu/ts-playground" rel="noopener noreferrer"&gt;ts-playground&lt;/a&gt;&lt;br&gt;
This project serves as:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A &lt;strong&gt;structured playground&lt;/strong&gt; for mastering TypeScript;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A &lt;strong&gt;CI/CD-enabled environment&lt;/strong&gt;;  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A practical use case of &lt;strong&gt;AI-assisted, semi-automated programming&lt;/strong&gt;.  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Semi-Automation vs. Full Automation
&lt;/h2&gt;

&lt;p&gt;This workflow is &lt;strong&gt;semi-automated&lt;/strong&gt;, not fully automated — intentionally:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Specs and architecture still need &lt;strong&gt;human input&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Prompts and scripts are &lt;strong&gt;evolving&lt;/strong&gt; — you won’t cover every case at first.
&lt;/li&gt;
&lt;li&gt;Code quality checks remain essential — AI output isn’t always stable.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Semi-automation is &lt;strong&gt;cheap, reusable, and controlled&lt;/strong&gt;. Full automation would require &lt;strong&gt;multi-agent systems and heavy context management&lt;/strong&gt; — overkill for now.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Context Management Matters
&lt;/h2&gt;

&lt;p&gt;The AI stays productive only if the &lt;strong&gt;project context&lt;/strong&gt; is well-structured:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Organize guidelines by category and directory;
&lt;/li&gt;
&lt;li&gt;Keep task specs structured for easy reference;
&lt;/li&gt;
&lt;li&gt;Feed the AI &lt;strong&gt;only the relevant context&lt;/strong&gt; per task.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This way, the AI acts like a &lt;strong&gt;real assistant&lt;/strong&gt; instead of just a fancy autocomplete.&lt;/p&gt;




&lt;h2&gt;
  
  
  A Bit of Philosophy
&lt;/h2&gt;

&lt;p&gt;This workflow reframes roles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AI&lt;/strong&gt; = the “coder + assistant,” executing granular tasks.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You&lt;/strong&gt; = the “tech lead,” designing systems, reviewing work, and managing quality.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AI doesn’t replace developers. Instead, it &lt;strong&gt;amplifies&lt;/strong&gt; us — pushing humans toward higher-level thinking, decision-making, and problem-solving.&lt;/p&gt;




&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;Semi-automated programming in plain English:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set up a strong &lt;strong&gt;project skeleton and docs&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Break work into &lt;strong&gt;reviewable, detailed specs&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Automate execution with &lt;strong&gt;Python scripts, tmux, and AI CLIs&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;Define &lt;strong&gt;“done”&lt;/strong&gt; clearly and iterate.
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It’s a practical, low-cost way to experiment with AI-driven coding — perfect for &lt;strong&gt;solo developers or small teams&lt;/strong&gt; who want speed &lt;strong&gt;without losing control&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>coding</category>
      <category>ai</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
