File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed
Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 409409 (let [[config db] (load-config-and-db )
410410 stats (search/get-stats db)
411411 db-path (config/get-db-path config)
412+ config-file-path (config/get-config-file-path )
413+ project-config-path (config/get-project-config-file-path )
412414 permissions (get config :permissions {})
413415 format (output/get-output-format json human config)]
414416 (output/output
415417 {:type :stats
416418 :configuration {:database-path db-path
419+ :config-file-path config-file-path
420+ :project-config-path project-config-path
417421 :auto-migrate (get-in config [:database :auto-migrate ] true )
418422 :skills-directory (get-in config [:project :skills-dir ] " skills" )
419423 :prompts-directory (get-in config [:project :prompts-dir ] " prompts" )
Original file line number Diff line number Diff line change 261261 (println (bling/bling [:bold " Database Statistics" ]))
262262 (println )
263263 (println (bling/bling [:underline " Configuration:" ]))
264+ (println (str " Global config: " (:config-file-path config)))
265+ (when (:project-config-path config)
266+ (println (str " Project config: " (:project-config-path config))))
264267 (println (str " Database: " (:database-path config)))
265268 (println (str " Skills directory: " (:skills-directory config)))
266269 (println (str " Prompts directory: " (:prompts-directory config)))
Original file line number Diff line number Diff line change 173173 (let [count (jdbc/execute-one! tu/*connection*
174174 [" SELECT COUNT(*) as count FROM skills" ])]
175175 (is (= 0 (:count count))))))))
176+
177+ (deftest db-stats-config-paths-test
178+ (testing " Given: A database with configuration"
179+ (binding [cli/*exit-fn* mock-exit]
180+ (with-redefs [cli/load-config-and-db mock-load-config-and-db]
181+ (testing " When: We request database statistics"
182+ (let [{:keys [output]} (capture-output #(cli/cmd-stats {}))
183+ parsed (tu/parse-json-output output)
184+ config (:configuration parsed)]
185+ (testing " Then: Configuration should include config file paths"
186+ (is (contains? config :config-file-path ) " config-file-path is present" )
187+ (is (string? (:config-file-path config)) " config-file-path is a string" )
188+ (is (contains? config :project-config-path ) " project-config-path is present" )
189+ (is (string? (:project-config-path config)) " project-config-path is a string" )
190+ (is (contains? config :database-path ) " database-path is present" )
191+ (is (string? (:database-path config)) " database-path is a string" ))))))))
You can’t perform that action at this time.
0 commit comments