File tree Expand file tree Collapse file tree 6 files changed +25
-14
lines changed Expand file tree Collapse file tree 6 files changed +25
-14
lines changed Original file line number Diff line number Diff line change @@ -14,25 +14,25 @@ tools:
1414 parameters :
1515 type : object
1616 properties :
17- project :
18- type : string
19- description : absolute path in the project root
2017 path :
2118 type : string
2219 description : Path of the folder to delete
2320 container :
2421 image : vonwig/bash_alpine
2522 mounts :
26- - " {{project|safe}}:/workdir:ro"
27- workdir : /workdir
23+ - " {{path|safe}}:/dockerfile:ro"
2824 command :
29- - " cat {{path|safe}} "
25+ - " cat /dockerfile "
3026prompt-format : " django"
27+ arguments :
28+ - name : path
29+ description : path to the Dockerfile to explain
30+ required : true
3131---
3232
3333# prompt user
3434
35- Start by fetching the ./ Dockerfile in the project root at /Users/slim/docker/labs-ai-tools-for-devs .
35+ Start by fetching the Dockerfile located at /dockerfile .
3636
3737After fetching the Dockerfile contents, explain the Dockerfile line by line.
3838
Original file line number Diff line number Diff line change 7171 (when ref [ref]))}
7272 (if (string/starts-with? (str dir) " /prompts" )
7373 {:workdir (str dir)
74- :volumes [" docker-prompts-git:/git" ]
75- :mounts [ " docker-prompts:/prompts:rw" ]}
74+ :volumes [" docker-prompts-git:/git"
75+ " docker-prompts:/prompts:rw" ]}
7676 {:host-dir (str dir)
7777 :volumes [" docker-prompts-git:/git" ]}))))
7878
Original file line number Diff line number Diff line change 11(ns script )
22
33(defmacro read [path]
4- `(slurp ~path))
4+ (slurp path))
5+
6+ (comment
7+ (macroexpand '(read " src/volumes/collect.clj" )))
Original file line number Diff line number Diff line change 7171 {:mounts (->> (-> definition :container :mounts )
7272 (map (fn [s] (first (interpolate arg-context s))))
7373 (into []))})
74+ (when (-> definition :container :volumes )
75+ {:volumes (->> (-> definition :container :volumes )
76+ (map (fn [s] (first (interpolate arg-context s))))
77+ (into []))})
7478 ; ; workdirs in a container definition will always override ones
7579 ; ; set in the metadata
7680 (when-let [wd (or
Original file line number Diff line number Diff line change 4848 (->
4949 (docker/run-container
5050 {:image " vonwig/bb:latest"
51- :volumes [" /Users/slim/slimslenderslacks/flask-nix-example :/project" ]
51+ :volumes [" /Users/slim:/project" ]
5252 :workdir " /project"
5353 :command [(json/generate-string
54- {:thread-id " blah " })
55- " {} " ]})
54+ {:directory " /project " })
55+ ( script/read " src/volumes/collect.clj " ) ]})
5656 :pty-output
57- (json/parse-string keyword)))
57+ #_ (json/parse-string keyword)))
5858
Original file line number Diff line number Diff line change 33 " pass in args"
44 (def args {:directory " /Users/slim" }))
55
6+ (require '[clojure.java.io :as io])
7+ (require '[babashka.fs :as fs])
8+ (require '[cheshire.core :as json])
9+
610(defn file->bytes [path]
711 (with-open [in (io/input-stream path)
812 out (java.io.ByteArrayOutputStream. )]
You can’t perform that action at this time.
0 commit comments