dsh-ci-diet 0.2.0 → 0.3.1

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 (126) hide show
  1. package/README.ko.md +39 -10
  2. package/README.md +50 -14
  3. package/client/index.d.ts +3 -0
  4. package/client/index.js +1035 -0
  5. package/dist/adapters/github/budget.d.ts +1 -1
  6. package/dist/adapters/github/budget.js +4 -2
  7. package/dist/adapters/github/budget.js.map +1 -1
  8. package/dist/adapters/github/client.d.ts +2 -0
  9. package/dist/adapters/github/client.js.map +1 -1
  10. package/dist/adapters/github/errors.d.ts +1 -1
  11. package/dist/adapters/github/errors.js +5 -3
  12. package/dist/adapters/github/errors.js.map +1 -1
  13. package/dist/adapters/github/transport.d.ts +10 -3
  14. package/dist/adapters/github/transport.js +115 -21
  15. package/dist/adapters/github/transport.js.map +1 -1
  16. package/dist/cli/index.d.ts +25 -0
  17. package/dist/cli/index.js +334 -233
  18. package/dist/cli/index.js.map +1 -1
  19. package/dist/core/analysis/coverage.js +2 -2
  20. package/dist/core/analysis/coverage.js.map +1 -1
  21. package/dist/core/config/load.d.ts +13 -0
  22. package/dist/core/config/load.js +71 -0
  23. package/dist/core/config/load.js.map +1 -0
  24. package/dist/core/config/plugin-settings.d.ts +37 -0
  25. package/dist/core/config/plugin-settings.js +75 -0
  26. package/dist/core/config/plugin-settings.js.map +1 -0
  27. package/dist/core/history/sync.d.ts +8 -3
  28. package/dist/core/history/sync.js +163 -45
  29. package/dist/core/history/sync.js.map +1 -1
  30. package/dist/core/patch/apply.d.ts +28 -7
  31. package/dist/core/patch/apply.js +341 -284
  32. package/dist/core/patch/apply.js.map +1 -1
  33. package/dist/core/patch/approval.d.ts +5 -0
  34. package/dist/core/patch/approval.js +26 -1
  35. package/dist/core/patch/approval.js.map +1 -1
  36. package/dist/core/patch/attestation.js +7 -3
  37. package/dist/core/patch/attestation.js.map +1 -1
  38. package/dist/core/patch/dependencies.d.ts +1 -0
  39. package/dist/core/patch/dependencies.js +176 -132
  40. package/dist/core/patch/dependencies.js.map +1 -1
  41. package/dist/core/patch/diff.d.ts +11 -0
  42. package/dist/core/patch/diff.js +76 -0
  43. package/dist/core/patch/diff.js.map +1 -0
  44. package/dist/core/patch/edits.d.ts +1 -1
  45. package/dist/core/patch/edits.js +7 -4
  46. package/dist/core/patch/edits.js.map +1 -1
  47. package/dist/core/patch/eligibility.d.ts +3 -2
  48. package/dist/core/patch/eligibility.js +22 -19
  49. package/dist/core/patch/eligibility.js.map +1 -1
  50. package/dist/core/patch/locks.d.ts +50 -0
  51. package/dist/core/patch/locks.js +196 -0
  52. package/dist/core/patch/locks.js.map +1 -0
  53. package/dist/core/patch/plan.d.ts +1 -2
  54. package/dist/core/patch/plan.js +2 -2
  55. package/dist/core/patch/plan.js.map +1 -1
  56. package/dist/core/patch/request-plan.d.ts +51 -0
  57. package/dist/core/patch/request-plan.js +122 -0
  58. package/dist/core/patch/request-plan.js.map +1 -0
  59. package/dist/core/patch/store.d.ts +123 -5
  60. package/dist/core/patch/store.js +722 -80
  61. package/dist/core/patch/store.js.map +1 -1
  62. package/dist/core/patch/verify.d.ts +4 -3
  63. package/dist/core/patch/verify.js +6 -4
  64. package/dist/core/patch/verify.js.map +1 -1
  65. package/dist/core/policy/constants.d.ts +34 -0
  66. package/dist/core/policy/constants.js +35 -0
  67. package/dist/core/policy/constants.js.map +1 -0
  68. package/dist/core/rules/cd001.js +107 -42
  69. package/dist/core/rules/cd001.js.map +1 -1
  70. package/dist/core/rules/cd003.js +42 -14
  71. package/dist/core/rules/cd003.js.map +1 -1
  72. package/dist/core/rules/cd005.d.ts +0 -5
  73. package/dist/core/rules/cd005.js +156 -68
  74. package/dist/core/rules/cd005.js.map +1 -1
  75. package/dist/core/rules/cd008.d.ts +1 -2
  76. package/dist/core/rules/cd008.js +2 -2
  77. package/dist/core/rules/cd008.js.map +1 -1
  78. package/dist/core/savings/report-metrics.js +5 -1
  79. package/dist/core/savings/report-metrics.js.map +1 -1
  80. package/dist/core/scan/binding.d.ts +34 -2
  81. package/dist/core/scan/binding.js +58 -17
  82. package/dist/core/scan/binding.js.map +1 -1
  83. package/dist/core/scan/discover.d.ts +2 -0
  84. package/dist/core/scan/discover.js +7 -6
  85. package/dist/core/scan/discover.js.map +1 -1
  86. package/dist/core/scan/scan.d.ts +4 -0
  87. package/dist/core/scan/scan.js +8 -2
  88. package/dist/core/scan/scan.js.map +1 -1
  89. package/dist/core/support/clock.d.ts +34 -0
  90. package/dist/core/support/clock.js +34 -0
  91. package/dist/core/support/clock.js.map +1 -0
  92. package/dist/core/support/concurrency.d.ts +11 -0
  93. package/dist/core/support/concurrency.js +47 -0
  94. package/dist/core/support/concurrency.js.map +1 -0
  95. package/dist/core/support/deadline.d.ts +17 -0
  96. package/dist/core/support/deadline.js +45 -0
  97. package/dist/core/support/deadline.js.map +1 -0
  98. package/dist/core/support/filesystem.d.ts +19 -0
  99. package/dist/core/support/filesystem.js +8 -0
  100. package/dist/core/support/filesystem.js.map +1 -0
  101. package/dist/core/version.d.ts +1 -1
  102. package/dist/core/version.js +1 -1
  103. package/dist/core/workflow/jobkey.js +89 -35
  104. package/dist/core/workflow/jobkey.js.map +1 -1
  105. package/dist/core/workflow/matrix.d.ts +4 -2
  106. package/dist/core/workflow/matrix.js +90 -25
  107. package/dist/core/workflow/matrix.js.map +1 -1
  108. package/dist/core/workflow/parse.js +14 -11
  109. package/dist/core/workflow/parse.js.map +1 -1
  110. package/dist/dsh/host/plugin.d.ts +122 -5
  111. package/dist/dsh/host/plugin.js +199 -138
  112. package/dist/dsh/host/plugin.js.map +1 -1
  113. package/dist/shared/i18n/en.d.ts +14 -3
  114. package/dist/shared/i18n/en.js +14 -3
  115. package/dist/shared/i18n/en.js.map +1 -1
  116. package/dist/shared/i18n/es.js +14 -3
  117. package/dist/shared/i18n/es.js.map +1 -1
  118. package/dist/shared/i18n/fr.js +14 -3
  119. package/dist/shared/i18n/fr.js.map +1 -1
  120. package/dist/shared/i18n/hi.js +14 -3
  121. package/dist/shared/i18n/hi.js.map +1 -1
  122. package/dist/shared/i18n/ko.js +14 -3
  123. package/dist/shared/i18n/ko.js.map +1 -1
  124. package/dist/shared/i18n/zh-Hans.js +14 -3
  125. package/dist/shared/i18n/zh-Hans.js.map +1 -1
  126. package/package.json +15 -3
package/README.ko.md CHANGED
@@ -2,9 +2,10 @@
2
2
 
3
3
  낭비된 GitHub Actions 러너 시간을 찾고, 작고 검토 가능한 패치를 제안합니다.
4
4
 
5
- 상태: **알파, npm에 `dsh-ci-diet@0.2.0`로 배포됨**. 계약, 명세, 분석 엔진,
5
+ 상태: **알파, `dsh-ci-diet@0.3.1` npm 게시됨**. 계약, 명세, 분석 엔진,
6
6
  패치 엔진, CLI, DSH 플러그인 도구, 자체 완결형 HTML 보고서는 구현과 테스트를
7
- 마쳤습니다. DSH Web 클라이언트 화면은 아직 남아 있습니다.
7
+ 마쳤습니다. DSH Web 클라이언트는 설정 화면을 제공하고, 보고서·적용 화면은 아직
8
+ 남아 있습니다.
8
9
 
9
10
  ## 하는 일
10
11
 
@@ -58,15 +59,43 @@ CI Diet는 두 가지를 읽고 비교합니다.
58
59
 
59
60
  ## 설치
60
61
 
62
+ CLI는 Node `^22.19.0 || >=24.0.0`이 필요합니다. DSH 플러그인은 DSH
63
+ `>=0.2.1-rc.2 <0.3.0-0` 또는 `>=0.2.2-rc.1 <0.3.0-0`이 필요합니다. `0.3.1`
64
+ 릴리스는 DSH `0.2.1-rc.2`에서 검증했으며 DSH `0.3.0`은 아직 지원하지 않습니다.
65
+
66
+ CLI 설치:
67
+
68
+ ```
69
+ npm install --global dsh-ci-diet@0.3.1
70
+ ci-diet --version
71
+ ```
72
+
73
+ 전역 설치를 원하지 않으면 `npx dsh-ci-diet@0.3.1`으로 같은 CLI를 실행할 수
74
+ 있습니다.
75
+
76
+ DSH 플러그인 설치:
77
+
78
+ ```
79
+ dsh plugin --profile web add dsh-ci-diet@0.3.1
80
+ dsh --profile web
81
+ ```
82
+
83
+ 플러그인은 기본으로 꺼진 로더 항목 하나와 **설정 → CI Diet** 페이지를 추가합니다.
84
+ 이 페이지에서 분석 규칙, 이력 상한, 저장 공간 한도, 비용 추정, 네트워크 접근,
85
+ 상태 디렉터리를 모두 바꿀 수 있습니다. 값은 `ci-diet --config`와 같은 계약 검증과
86
+ 기본값을 쓰며, 재시작 없이 다음 도구 호출부터 적용되고 CLI의 설정 파일은 건드리지
87
+ 않습니다. 적용 도구가 아직 없어 `localApplyEnabled`는 노출하지 않습니다.
88
+
89
+ 기존 설치 업데이트:
90
+
61
91
  ```
62
- npm install --global dsh-ci-diet
63
- dsh plugin --profile web add dsh-ci-diet
92
+ npm install --global dsh-ci-diet@latest
93
+ dsh plugin --profile web add dsh-ci-diet@latest
64
94
  ```
65
95
 
66
- 플러그인은 기본으로 꺼진 로더 항목 하나를 추가합니다. 이력 동기화를 쓸 때만
67
- `networkEnabled`를 켜십시오. 전역 설치는 선택 사항입니다. `npx dsh-ci-diet`로
68
- 같은 CLI를 실행할 수 있고, DSH 플러그인은 프로필에 패키지가 있으면 됩니다.
69
- 릴리스 태그는 GitHub에, 같은 버전은 npm `0.2.0`에 있습니다.
96
+ 플러그인을 업데이트한 뒤 DSH를 재시작합니다. `dsh plugin --profile web list`로
97
+ 설치된 플러그인 버전을, `ci-diet --version`(또는
98
+ `npx dsh-ci-diet@latest --version`)으로 CLI 버전을 확인할 수 있습니다.
70
99
 
71
100
  ## 실행
72
101
 
@@ -114,8 +143,8 @@ lockfile 변경을 따라가지 못하는 리터럴 캐시 키가 대상입니
114
143
  `.github/workflows/publish.yml`이 실행됩니다.
115
144
 
116
145
  ```
117
- git tag v0.2.0
118
- git push origin v0.2.0
146
+ git tag v0.3.1
147
+ git push origin v0.3.1
119
148
  ```
120
149
 
121
150
  워크플로는 태그와 `package.json` 버전을 대조하고(`node
package/README.md CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  Find wasted GitHub Actions runner time and propose small, reviewable patches.
4
4
 
5
- Status: **alpha, published on npm** as `dsh-ci-diet@0.2.0`. The contracts,
5
+ Status: **alpha**, `dsh-ci-diet@0.3.1` is released on npm. The contracts,
6
6
  specification, analysis engine, patch engine, CLI, DSH plugin tools, and a
7
- self-contained HTML report are implemented and tested. The DSH Web client
8
- screens are still open.
7
+ self-contained HTML report are implemented and tested. The DSH Web client has a
8
+ Settings screen; the report and apply screens are still open.
9
9
 
10
10
  ## What it does
11
11
 
@@ -60,15 +60,43 @@ is not shipped.
60
60
 
61
61
  ## Install
62
62
 
63
+ The CLI needs Node `^22.19.0 || >=24.0.0`. The DSH plugin needs DSH
64
+ `>=0.2.1-rc.2 <0.3.0-0` or `>=0.2.2-rc.1 <0.3.0-0`. Release `0.3.1` was tested
65
+ against DSH `0.2.1-rc.2`; DSH `0.3.0` is not supported yet.
66
+
67
+ Install the CLI:
68
+
69
+ ```
70
+ npm install --global dsh-ci-diet@0.3.1
71
+ ci-diet --version
72
+ ```
73
+
74
+ If you do not want a global install, `npx dsh-ci-diet@0.3.1` runs the same CLI.
75
+
76
+ Install the DSH plugin into a profile:
77
+
63
78
  ```
64
- npm install --global dsh-ci-diet
65
- dsh plugin --profile web add dsh-ci-diet
79
+ dsh plugin --profile web add dsh-ci-diet@0.3.1
80
+ dsh --profile web
66
81
  ```
67
82
 
68
- The plugin adds one disabled loader entry; enable `networkEnabled` only if you
69
- want history sync. Installing the package globally is optional: `npx dsh-ci-diet`
70
- runs the same CLI, and the DSH plugin only needs the package in the profile.
71
- Release tags are on GitHub; the matching npm version is `0.2.0`.
83
+ The plugin adds one disabled loader entry and a **Settings → CI Diet** page.
84
+ The page edits every engine setting used by the DSH tools: analysis rules, history
85
+ caps, storage limits, the cost estimate, network access, and the state directory.
86
+ Values use the same contract validation and defaults as `ci-diet --config`, apply
87
+ to the next tool call without a restart, and never rewrite the CLI's own config.
88
+ `localApplyEnabled` is not exposed because there is no apply tool yet.
89
+
90
+ Update an existing install:
91
+
92
+ ```
93
+ npm install --global dsh-ci-diet@latest
94
+ dsh plugin --profile web add dsh-ci-diet@latest
95
+ ```
96
+
97
+ Restart DSH after updating the plugin. `dsh plugin --profile web list` shows the
98
+ installed plugin version, and `ci-diet --version` (or
99
+ `npx dsh-ci-diet@latest --version`) shows the CLI version.
72
100
 
73
101
  ## Run it
74
102
 
@@ -85,13 +113,21 @@ ci-diet revert --change <changeId> # restores the backed-up bytes
85
113
  `plan` refuses to write when the finding is not patch-eligible, when coverage
86
114
  does not allow a write, or when the policy snapshot a rule depends on is stale.
87
115
  CD005 needs `--job` and `--minutes`; CD008 needs `--job` and `--step`, plus
88
- `--claims artifact-purpose:temporary,consumer-min-days:7`. Nothing is committed,
89
- pushed, or applied without the explicit `approve` step.
116
+ `--claims artifact-purpose:temporary,consumer-min-days:7`. The command prints the
117
+ proposed lines as a diff, and `ci-diet plans --plan <planId>` shows a saved plan
118
+ again. Nothing is committed, pushed, or applied without the explicit `approve`
119
+ step.
120
+
121
+ `--config <file>` merges a partial JSON configuration over the built-in defaults
122
+ for any command, so a repository can lower the workflow size limit or the
123
+ storage quota without code changes. The merged document is validated against
124
+ the frozen contract before the command runs; an unreadable or invalid file
125
+ exits `2`. Relative paths resolve against the effective `--cwd`.
90
126
 
91
127
  ## Read a report
92
128
 
93
129
  ```
94
- ci-diet report # text summary of the latest stored report
130
+ ci-diet report # text summary for this repository
95
131
  ci-diet report --format html --out report.html
96
132
  ci-diet diagnose # explain job-name attribution and collection coverage
97
133
  ci-diet prune # drop expired reports, plans, and cache entries
@@ -117,8 +153,8 @@ Pushing a tag that matches the version in `package.json` triggers
117
153
  `.github/workflows/publish.yml`:
118
154
 
119
155
  ```
120
- git tag v0.2.0
121
- git push origin v0.2.0
156
+ git tag v0.3.1
157
+ git push origin v0.3.1
122
158
  ```
123
159
 
124
160
  The workflow compares the tag with `package.json` (`node
@@ -0,0 +1,3 @@
1
+ /** DSH Web client half for the CI Diet settings section. */
2
+ declare const plugin: { readonly inject: readonly string[]; apply(ctx: unknown): void };
3
+ export default plugin;