[go: up one dir, main page]

Skip to content

20241001:23 - Duo Chat: refactoring bash to POSIX, and back

Goals

Learn some more techniques for using Duo in a coding sesion

Hypotheses

I discovered this morning that my "dude" script to install crucial Unix utilities that are often missing from container images or VMs, was missing some that are absent, like tar and gzip! So I started to add them, and noticed a few problems in the way I had been writing the script.

To begin, I asked Duo for some point solutions, and then I decided to have Duo refactor the code, to see what would occur.

I also realized that, while the script handles the case for Alpine, which doesn't have bash either, Alpine wouldn't be able to run it, because it's a bash script. So I had Duo refactor into POSIX sh.

By keeping a record of the conversation, there are several gold nuggets (both for bash/sh, and for chatting with Duo itself) that are worth reviewing.

Setting up build/test/run apparatus

  • Have a copy of dude, and access to the GitLab Duo Chat features, via VSCode
  • Have some containers for the various OSes involved (Alpine, RockyLinux, openSUSE, Ubuntu), and a macOS with Homebrew

Experiment Procedures

Chat with Duo about the problem, record the transcript.

Before the /refactor, I did update dude a little, by removing the MAX_IDX= lines and using the array-count that Duo advised.

Outcomes

Conclusions

Concerns?

Where am I stuck or what don't I understand?

Edited by Mike Lockhart | GitLab