cdd-cli 3.1.3 → 3.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/.eslintrc.json +30 -0
  2. package/.github/workflows/docs.yml +35 -0
  3. package/CHANGELOG.md +44 -4
  4. package/FIXES_APPLIED.md +145 -147
  5. package/README.md +26 -0
  6. package/dist/App.js +20 -3
  7. package/dist/components/ContainerCreationPrompt.js +27 -1
  8. package/dist/components/ContainerList.js +11 -15
  9. package/dist/components/ContainerRow.js +73 -14
  10. package/dist/components/ContainerSection.js +16 -2
  11. package/dist/components/Footer.js +7 -1
  12. package/dist/components/Header.js +17 -1
  13. package/dist/components/LogViewer.js +21 -3
  14. package/dist/components/MessageFeedback.js +15 -1
  15. package/dist/components/PromptField.js +31 -1
  16. package/dist/components/StatsBar.js +46 -8
  17. package/dist/components/UsageMenu.js +30 -1
  18. package/dist/helpers/actionHelpers.js +17 -6
  19. package/dist/helpers/constants.js +30 -0
  20. package/dist/helpers/dockerService/dockerService.js +19 -0
  21. package/dist/helpers/dockerService/serviceComponents/containerActions.js +194 -35
  22. package/dist/helpers/dockerService/serviceComponents/containerList.js +45 -8
  23. package/dist/helpers/dockerService/serviceComponents/containerLogs.js +16 -6
  24. package/dist/helpers/dockerService/serviceComponents/containerStats.js +28 -9
  25. package/dist/helpers/exitWithMessage.js +2 -1
  26. package/dist/helpers/logger.js +112 -0
  27. package/dist/helpers/safeCall.js +21 -0
  28. package/dist/helpers/validationHelpers.js +20 -1
  29. package/dist/hooks/creation/useContainerActions.js +2 -1
  30. package/dist/hooks/creation/useContainerCreation.js +5 -4
  31. package/dist/hooks/creation/useLogsViewer.js +3 -2
  32. package/dist/hooks/useContainers.js +6 -3
  33. package/dist/hooks/useControls.js +253 -122
  34. package/dist/hooks/useLogsStream.js +3 -2
  35. package/dist/index.js +1 -0
  36. package/docs/components_ContainerCreationPrompt.jsx.html +114 -0
  37. package/docs/components_ContainerRow.jsx.html +151 -0
  38. package/docs/components_ContainerSection.jsx.html +75 -0
  39. package/docs/components_Footer.jsx.html +66 -0
  40. package/docs/components_Header.jsx.html +84 -0
  41. package/docs/components_LogViewer.jsx.html +91 -0
  42. package/docs/components_MessageFeedback.jsx.html +76 -0
  43. package/docs/components_PromptField.jsx.html +99 -0
  44. package/docs/components_StatsBar.jsx.html +105 -0
  45. package/docs/components_UsageMenu.jsx.html +73 -0
  46. package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  47. package/docs/fonts/OpenSans-Bold-webfont.svg +1830 -0
  48. package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  49. package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  50. package/docs/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
  51. package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  52. package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  53. package/docs/fonts/OpenSans-Italic-webfont.svg +1830 -0
  54. package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  55. package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
  56. package/docs/fonts/OpenSans-Light-webfont.svg +1831 -0
  57. package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
  58. package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  59. package/docs/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
  60. package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  61. package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  62. package/docs/fonts/OpenSans-Regular-webfont.svg +1831 -0
  63. package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  64. package/docs/global.html +6145 -0
  65. package/docs/helpers_actionHelpers.js.html +94 -0
  66. package/docs/helpers_constants.js.html +81 -0
  67. package/docs/helpers_dockerService_dockerService.js.html +79 -0
  68. package/docs/helpers_dockerService_serviceComponents_containerActions.js.html +153 -0
  69. package/docs/helpers_dockerService_serviceComponents_containerList.js.html +81 -0
  70. package/docs/helpers_dockerService_serviceComponents_containerLogs.js.html +85 -0
  71. package/docs/helpers_dockerService_serviceComponents_containerStats.js.html +107 -0
  72. package/docs/helpers_dockerService_serviceComponents_imageUtils.js.html +82 -0
  73. package/docs/helpers_exitWithMessage.js.html +77 -0
  74. package/docs/helpers_safeCall.js.html +68 -0
  75. package/docs/helpers_validationHelpers.js.html +96 -0
  76. package/docs/hooks_creation_useContainerActions.js.html +120 -0
  77. package/docs/hooks_creation_useContainerCreation.js.html +152 -0
  78. package/docs/hooks_creation_useLogsViewer.js.html +102 -0
  79. package/docs/hooks_useControls.js.html +298 -0
  80. package/docs/hooks_useLogsStream.js.html +82 -0
  81. package/docs/index.html +65 -0
  82. package/docs/index.js.html +65 -0
  83. package/docs/module-index.html +171 -0
  84. package/docs/scripts/linenumber.js +25 -0
  85. package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
  86. package/docs/scripts/prettify/lang-css.js +2 -0
  87. package/docs/scripts/prettify/prettify.js +28 -0
  88. package/docs/styles/jsdoc-default.css +358 -0
  89. package/docs/styles/prettify-jsdoc.css +111 -0
  90. package/docs/styles/prettify-tomorrow.css +132 -0
  91. package/fix-imports.cjs +33 -6
  92. package/jest.config.cjs +2 -1
  93. package/package.json +19 -9
  94. package/src/App.jsx +16 -2
  95. package/src/components/ContainerCreationPrompt.jsx +26 -0
  96. package/src/components/ContainerList.jsx +12 -13
  97. package/src/components/ContainerRow.jsx +55 -20
  98. package/src/components/ContainerSection.jsx +15 -1
  99. package/src/components/Footer.jsx +6 -1
  100. package/src/components/Header.jsx +16 -0
  101. package/src/components/LogViewer.jsx +19 -2
  102. package/src/components/MessageFeedback.jsx +14 -0
  103. package/src/components/PromptField.jsx +30 -0
  104. package/src/components/StatsBar.jsx +47 -8
  105. package/src/components/UsageMenu.jsx +38 -8
  106. package/src/helpers/actionHelpers.js +16 -7
  107. package/src/helpers/constants.js +30 -0
  108. package/src/helpers/dockerService/dockerService.js +19 -0
  109. package/src/helpers/dockerService/serviceComponents/containerActions.js +123 -12
  110. package/src/helpers/dockerService/serviceComponents/containerList.js +61 -23
  111. package/src/helpers/dockerService/serviceComponents/containerLogs.js +20 -6
  112. package/src/helpers/dockerService/serviceComponents/containerStats.js +24 -5
  113. package/src/helpers/dockerService/serviceComponents/imageUtils.js +1 -1
  114. package/src/helpers/exitWithMessage.js +2 -1
  115. package/src/helpers/logger.js +113 -0
  116. package/src/helpers/safeCall.js +18 -0
  117. package/src/helpers/validationHelpers.js +21 -3
  118. package/src/hooks/creation/useContainerActions.js +4 -3
  119. package/src/hooks/creation/useContainerCreation.js +5 -4
  120. package/src/hooks/creation/useLogsViewer.js +2 -1
  121. package/src/hooks/useContainers.js +6 -3
  122. package/src/hooks/useControls.js +244 -91
  123. package/src/hooks/useLogsStream.js +2 -1
  124. package/src/index.js +1 -0
  125. package/test/actionHelpers.test.js +106 -0
  126. package/test/containerActions.test.js +138 -0
  127. package/test/containerList.test.js +79 -0
  128. package/test/jest.setup.js +7 -0
  129. package/test/safeCall.test.js +25 -0
  130. package/test/useContainerCreation.dom.test.js +97 -0
  131. package/test/validationHelpers.test.js +2 -2
  132. package/AUDIT_REPORT.md +0 -1004
  133. package/dist/cdd.bundle.js +0 -8
  134. package/dist/components/ContainerCreator.js +0 -81
  135. package/dist/components/StatsViewer.js +0 -0
  136. package/dist/helpers/dockerActions.js +0 -64
  137. package/dist/helpers/dockerService.js +0 -284
  138. package/dist/hooks/useStatsPolling.js +0 -54
package/.eslintrc.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "node": true,
5
+ "es2021": true,
6
+ "jest": true
7
+ },
8
+ "extends": ["eslint:recommended", "plugin:react/recommended"],
9
+ "parserOptions": {
10
+ "ecmaVersion": 2021,
11
+ "sourceType": "module",
12
+ "ecmaFeatures": { "jsx": true }
13
+ },
14
+ "rules": {
15
+ "no-unsafe-optional-chaining": "error",
16
+ "react/react-in-jsx-scope": "off",
17
+ "no-console": "off",
18
+ "react/prop-types": "off",
19
+ "no-unused-vars": [
20
+ "warn",
21
+ {
22
+ "argsIgnorePattern": "^_",
23
+ "varsIgnorePattern": "^(?:_|React)$"
24
+ }
25
+ ]
26
+ },
27
+ "settings": {
28
+ "react": { "version": "detect" }
29
+ }
30
+ }
@@ -0,0 +1,35 @@
1
+ name: Build and deploy docs
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ build-and-deploy:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ pages: write
14
+ id-token: write
15
+
16
+ steps:
17
+ - name: Checkout repository
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Setup Node.js
21
+ uses: actions/setup-node@v4
22
+ with:
23
+ node-version: '18'
24
+
25
+ - name: Install dependencies
26
+ run: npm ci
27
+
28
+ - name: Build docs
29
+ run: npm run docs
30
+
31
+ - name: Deploy to GitHub Pages (push to gh-pages)
32
+ uses: peaceiris/actions-gh-pages@v3
33
+ with:
34
+ github_token: ${{ secrets.GITHUB_TOKEN }}
35
+ publish_dir: ./docs
package/CHANGELOG.md CHANGED
@@ -4,6 +4,50 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
6
 
7
+ ## [Unreleased]
8
+ - Nothing yet.
9
+
10
+ ## [3.1.5] - 2025-10-18
11
+ _Note: I'm sorry about the issues you've run into; this is a brand-new app and I'm still learning, but I'm moving as quickly as I can to deliver a quality experience._
12
+
13
+ ### Added
14
+
15
+ - `safeCall` utility to safely invoke optional callbacks and avoid uncaught errors from consumer callbacks.
16
+ - PropTypes added to core React components for runtime prop validation (ContainerRow, ContainerList, LogViewer, StatsBar, ContainerCreationPrompt, PromptField, MessageFeedback, Header, ContainerSection).
17
+
18
+ ### Changed
19
+
20
+ - Container creation now inspects image `EXPOSE` declarations and auto-binds ports when the user leaves the ports step empty, reusing the next free host port to avoid conflicts (e.g. second `nginx` gets `81:80`).
21
+ - CLI clears the terminal when starting and again after exiting with `q` for a cleaner shell experience.
22
+ - Replaced direct optional callback invocations and stream destruction calls with `safeCall` in several modules (`containerLogs`, `useLogsStream`, `useLogsViewer`, `useContainerCreation`, `useContainerActions`, `LogViewer`).
23
+ - ESLint config updated to include `jest` env and allow keeping `import React` for build compatibility.
24
+ - Extracted common magic numbers into `src/helpers/constants.js` and replaced hardcoded values across the codebase:
25
+ - `REFRESH_INTERVALS.CONTAINER_LIST` (3000)
26
+ - `REFRESH_INTERVALS.CONTAINER_STATS` (1500)
27
+ - `MESSAGE_TIMEOUTS.SHORT` (2000) and `MESSAGE_TIMEOUTS.DEFAULT` (3000)
28
+ - `EXIT_DELAY` (500)
29
+ - `TIMEOUTS.CONTAINER_OP` (30000) and `TIMEOUTS.PULL_IMAGE` (300000)
30
+ - Files updated to use constants: `useContainers`, `ContainerRow`, `actionHelpers`, `useControls`, `exitWithMessage`, `containerActions`.
31
+
32
+ ### Fixed
33
+
34
+ - Added unit tests for `safeCall` and adjusted several components to silence lint warnings (unused variables).
35
+ - Clamp `StatsBar` CPU/memory percentages to avoid negative repeat errors when streaming container stats (also refreshed component JSDoc to note the clamping).
36
+
37
+ ### Testing
38
+
39
+ - Added additional unit tests for Docker service functions and hooks. All tests pass locally (5 suites, 26 tests).
40
+ - Removed generated `dist/` artifacts and deleted obsolete test files that referenced incompatible test helpers.
41
+
42
+ Incoming fixes and smaller tests / docs updates
43
+
44
+ ## [3.1.4] - 2025-10-17
45
+
46
+ ### Changed
47
+
48
+ - Documentation cleanup: translate `FIXES_APPLIED.md` to English, remove Spanish duplicate and references to internal audit doc.
49
+ - No functional code changes.
50
+
7
51
  ## [3.1.3] - 2025-10-17
8
52
 
9
53
  ### Fixed
@@ -44,10 +88,6 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
44
88
 
45
89
  - Various runtime & build issues after modularization (import fixes, exposing container action functions, creation flow wiring).
46
90
 
47
- ## [Unreleased]
48
-
49
- - Incoming fixes and smaller tests / docs updates
50
-
51
91
  ## [3.1.1] - 2025-10-16
52
92
 
53
93
  ### Fixed