pipecraft 0.0.0-releaseit → 0.26.0

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 (183) hide show
  1. package/README.md +126 -108
  2. package/dist/cli/index.d.ts +69 -0
  3. package/dist/cli/index.d.ts.map +1 -1
  4. package/dist/cli/index.js +94 -22
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/generators/init.tpl.d.ts +70 -0
  7. package/dist/generators/init.tpl.d.ts.map +1 -1
  8. package/dist/generators/init.tpl.js +100 -8
  9. package/dist/generators/init.tpl.js.map +1 -1
  10. package/dist/generators/workflows.tpl.d.ts +86 -0
  11. package/dist/generators/workflows.tpl.d.ts.map +1 -1
  12. package/dist/generators/workflows.tpl.js +101 -9
  13. package/dist/generators/workflows.tpl.js.map +1 -1
  14. package/dist/templates/actions/calculate-version.yml.tpl.d.ts +47 -0
  15. package/dist/templates/actions/calculate-version.yml.tpl.d.ts.map +1 -1
  16. package/dist/templates/actions/calculate-version.yml.tpl.js +72 -3
  17. package/dist/templates/actions/calculate-version.yml.tpl.js.map +1 -1
  18. package/dist/templates/actions/create-pr.yml.tpl.d.ts +14 -0
  19. package/dist/templates/actions/create-pr.yml.tpl.d.ts.map +1 -1
  20. package/dist/templates/actions/create-pr.yml.tpl.js +22 -2
  21. package/dist/templates/actions/create-pr.yml.tpl.js.map +1 -1
  22. package/dist/templates/actions/create-release.yml.tpl.d.ts +18 -0
  23. package/dist/templates/actions/create-release.yml.tpl.d.ts.map +1 -0
  24. package/dist/templates/actions/create-release.yml.tpl.js +141 -0
  25. package/dist/templates/actions/create-release.yml.tpl.js.map +1 -0
  26. package/dist/templates/actions/create-tag.yml.tpl.d.ts +14 -0
  27. package/dist/templates/actions/create-tag.yml.tpl.d.ts.map +1 -1
  28. package/dist/templates/actions/create-tag.yml.tpl.js +22 -2
  29. package/dist/templates/actions/create-tag.yml.tpl.js.map +1 -1
  30. package/dist/templates/actions/detect-changes.yml.tpl.d.ts +70 -0
  31. package/dist/templates/actions/detect-changes.yml.tpl.d.ts.map +1 -1
  32. package/dist/templates/actions/detect-changes.yml.tpl.js +98 -2
  33. package/dist/templates/actions/detect-changes.yml.tpl.js.map +1 -1
  34. package/dist/templates/actions/manage-branch.yml.tpl.d.ts +14 -0
  35. package/dist/templates/actions/manage-branch.yml.tpl.d.ts.map +1 -1
  36. package/dist/templates/actions/manage-branch.yml.tpl.js +22 -2
  37. package/dist/templates/actions/manage-branch.yml.tpl.js.map +1 -1
  38. package/dist/templates/actions/promote-branch.yml.tpl.d.ts +14 -0
  39. package/dist/templates/actions/promote-branch.yml.tpl.d.ts.map +1 -1
  40. package/dist/templates/actions/promote-branch.yml.tpl.js +50 -7
  41. package/dist/templates/actions/promote-branch.yml.tpl.js.map +1 -1
  42. package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts +114 -1
  43. package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts.map +1 -1
  44. package/dist/templates/workflows/pipeline-path-based.yml.tpl.js +479 -74
  45. package/dist/templates/workflows/pipeline-path-based.yml.tpl.js.map +1 -1
  46. package/dist/types/index.d.ts +231 -8
  47. package/dist/types/index.d.ts.map +1 -1
  48. package/dist/types/index.js +9 -0
  49. package/dist/types/index.js.map +1 -1
  50. package/dist/utils/ast-path-operations.d.ts.map +1 -1
  51. package/dist/utils/ast-path-operations.js +24 -11
  52. package/dist/utils/ast-path-operations.js.map +1 -1
  53. package/dist/utils/config.d.ts +63 -0
  54. package/dist/utils/config.d.ts.map +1 -1
  55. package/dist/utils/config.js +71 -0
  56. package/dist/utils/config.js.map +1 -1
  57. package/dist/utils/github-setup.d.ts +323 -2
  58. package/dist/utils/github-setup.d.ts.map +1 -1
  59. package/dist/utils/github-setup.js +551 -23
  60. package/dist/utils/github-setup.js.map +1 -1
  61. package/dist/utils/idempotency.d.ts +147 -7
  62. package/dist/utils/idempotency.d.ts.map +1 -1
  63. package/dist/utils/idempotency.js +143 -15
  64. package/dist/utils/idempotency.js.map +1 -1
  65. package/dist/utils/logger.d.ts +134 -0
  66. package/dist/utils/logger.d.ts.map +1 -0
  67. package/dist/utils/logger.js +153 -0
  68. package/dist/utils/logger.js.map +1 -0
  69. package/dist/utils/preflight.d.ts +223 -12
  70. package/dist/utils/preflight.d.ts.map +1 -1
  71. package/dist/utils/preflight.js +216 -16
  72. package/dist/utils/preflight.js.map +1 -1
  73. package/dist/utils/versioning.d.ts +160 -8
  74. package/dist/utils/versioning.d.ts.map +1 -1
  75. package/dist/utils/versioning.js +179 -15
  76. package/dist/utils/versioning.js.map +1 -1
  77. package/package.json +26 -5
  78. package/.claude/settings.local.json +0 -35
  79. package/.github/actions/calculate-version/action.yml +0 -106
  80. package/.github/actions/create-pr/action.yml +0 -122
  81. package/.github/actions/create-release/action.yml +0 -74
  82. package/.github/actions/create-tag/action.yml +0 -94
  83. package/.github/actions/detect-changes/action.yml +0 -62
  84. package/.github/actions/manage-branch/action.yml +0 -113
  85. package/.github/actions/promote-branch/action.yml +0 -352
  86. package/.github/example/workflows/job.analyze.code.yml +0 -26
  87. package/.github/example/workflows/job.analyze.docker.yml +0 -32
  88. package/.github/example/workflows/job.app.api.deploy.yml +0 -127
  89. package/.github/example/workflows/job.app.api.test.yml +0 -102
  90. package/.github/example/workflows/job.app.docs.deploy.yml +0 -40
  91. package/.github/example/workflows/job.app.docs.test.yml +0 -50
  92. package/.github/example/workflows/job.app.web.deploy.yml +0 -96
  93. package/.github/example/workflows/job.app.web.test.yml +0 -49
  94. package/.github/example/workflows/job.changes.yml +0 -82
  95. package/.github/example/workflows/job.create-pr.yml +0 -96
  96. package/.github/example/workflows/job.env-check.yml +0 -43
  97. package/.github/example/workflows/job.fast-forward.yml +0 -103
  98. package/.github/example/workflows/job.lint.yml +0 -64
  99. package/.github/example/workflows/job.pr-name.yml +0 -70
  100. package/.github/example/workflows/job.pr-squash-name.yml +0 -27
  101. package/.github/example/workflows/job.tag.yml +0 -38
  102. package/.github/example/workflows/job.version.yml +0 -99
  103. package/.github/example/workflows/lib.plugin-base.publish.yml +0 -59
  104. package/.github/example/workflows/pipe.yml +0 -178
  105. package/.github/example/workflows/scripts/fastforward.sh +0 -51
  106. package/.github/example/workflows/scripts/pipe-cleaner.sh +0 -70
  107. package/.github/scripts/fastforward.sh +0 -51
  108. package/.github/scripts/pipe-cleaner.sh +0 -70
  109. package/.github/workflows/pipeline.yml +0 -220
  110. package/.github/workflows/pr-title-check.yml +0 -70
  111. package/.github/workflows/publish.yml +0 -39
  112. package/.pipecraftrc.json +0 -78
  113. package/.release-it.cjs +0 -71
  114. package/PIPELINE_TESTING_PLAN.md +0 -499
  115. package/TRUNK_FLOW_PLAN.md +0 -401
  116. package/assets/logo_banner.png +0 -0
  117. package/assets/logo_banner.webp +0 -0
  118. package/docs/USER_JOURNEY_ERRORS.md +0 -352
  119. package/eslint.config.js +0 -77
  120. package/examples/basic-config.json +0 -41
  121. package/examples/monorepo-config.json +0 -49
  122. package/examples/usage.md +0 -289
  123. package/scripts/debug-workflows.sh +0 -339
  124. package/scripts/parse-pipeline.js +0 -29
  125. package/scripts/test-job-order.cjs +0 -140
  126. package/scripts/validate-pipeline.cjs +0 -379
  127. package/scripts/verify-job-order.sh +0 -30
  128. package/src/cli/index.ts +0 -414
  129. package/src/generators/init.tpl.ts +0 -126
  130. package/src/generators/workflows.tpl.ts +0 -80
  131. package/src/templates/actions/calculate-version.yml.tpl.ts +0 -124
  132. package/src/templates/actions/create-pr.yml.tpl.ts +0 -147
  133. package/src/templates/actions/create-tag.yml.tpl.ts +0 -112
  134. package/src/templates/actions/detect-changes.yml.tpl.ts +0 -87
  135. package/src/templates/actions/manage-branch.yml.tpl.ts +0 -132
  136. package/src/templates/actions/promote-branch.yml.tpl.ts +0 -364
  137. package/src/templates/workflows/pipeline-path-based.yml.tpl.ts +0 -706
  138. package/src/types/index.ts +0 -64
  139. package/src/utils/README-ast-path-operations.md +0 -390
  140. package/src/utils/ast-path-operations.ts +0 -581
  141. package/src/utils/config.ts +0 -64
  142. package/src/utils/github-setup.ts +0 -558
  143. package/src/utils/idempotency.ts +0 -215
  144. package/src/utils/preflight.ts +0 -306
  145. package/src/utils/versioning.ts +0 -244
  146. package/tests/README.md +0 -229
  147. package/tests/TEST_STRUCTURE.md +0 -256
  148. package/tests/act/run-act-tests.sh +0 -345
  149. package/tests/debugging/debug-utils.ts +0 -538
  150. package/tests/debugging/debug-workflow.test.ts +0 -339
  151. package/tests/debugging/debug-workflows.sh +0 -339
  152. package/tests/debugging/iterative-debug.ts +0 -652
  153. package/tests/debugging/run-debug-tests.sh +0 -431
  154. package/tests/fixtures/basic-config.json +0 -51
  155. package/tests/fixtures/invalid-config.json +0 -9
  156. package/tests/fixtures/pipeline-generated.yml +0 -235
  157. package/tests/fixtures/pipeline-preserve-comments.yml +0 -245
  158. package/tests/fixtures/pipeline-user-modified.yml +0 -245
  159. package/tests/fixtures/test-config.json +0 -58
  160. package/tests/github-live/README.md +0 -250
  161. package/tests/github-local/JOB_WORKFLOW_TESTS.md +0 -296
  162. package/tests/github-local/README.md +0 -240
  163. package/tests/github-local/run-all-tests.sh +0 -422
  164. package/tests/github-local/test-job-workflows.sh +0 -631
  165. package/tests/github-local/test-pipeline-workflow.sh +0 -440
  166. package/tests/integration/generators.test.ts +0 -578
  167. package/tests/integration/path-based-template.test.ts +0 -510
  168. package/tests/integration/simple-path-based.test.ts +0 -415
  169. package/tests/setup.ts +0 -56
  170. package/tests/unit/ast-path-operations-extended.test.ts +0 -302
  171. package/tests/unit/cli.test.ts +0 -541
  172. package/tests/unit/config-extended.test.ts +0 -412
  173. package/tests/unit/config.test.ts +0 -152
  174. package/tests/unit/github-setup.test.ts +0 -189
  175. package/tests/unit/idempotency-isolated.test.ts +0 -297
  176. package/tests/unit/job-order.test.ts +0 -157
  177. package/tests/unit/pipeline-path-based.test.ts +0 -511
  178. package/tests/unit/validate-pipeline.test.ts +0 -384
  179. package/tests/unit/versioning-extended.test.ts +0 -279
  180. package/tests/unit/versioning.test.ts +0 -241
  181. package/tsconfig.debug.json +0 -17
  182. package/tsconfig.json +0 -28
  183. package/vitest.config.ts +0 -51
@@ -1,241 +0,0 @@
1
- import { describe, it, expect, beforeEach, vi } from 'vitest'
2
- import { writeFileSync, existsSync, rmSync, readFileSync } from 'fs'
3
- import { join } from 'path'
4
- import { VersionManager } from '../../src/utils/versioning'
5
- import { PipecraftConfig } from '../../src/types'
6
- import { TEST_DIR, FIXTURES_DIR } from '../setup'
7
-
8
- // Mock execSync
9
- vi.mock('child_process', () => ({
10
- execSync: vi.fn()
11
- }))
12
-
13
- describe('VersionManager', () => {
14
- let config: PipecraftConfig
15
- let versionManager: VersionManager
16
- let mockExecSync: any
17
-
18
- beforeEach(async () => {
19
- // Clean up version management files from previous tests
20
- const filesToClean = ['.release-it.cjs', 'commitlint.config.js', '.husky']
21
- filesToClean.forEach(file => {
22
- if (existsSync(join(TEST_DIR, file))) {
23
- rmSync(join(TEST_DIR, file), { recursive: true, force: true })
24
- }
25
- })
26
-
27
- // Load test config
28
- const configPath = join(FIXTURES_DIR, 'basic-config.json')
29
- const configContent = readFileSync(configPath, 'utf8')
30
- config = JSON.parse(configContent)
31
-
32
- versionManager = new VersionManager(config)
33
-
34
- // Get mock execSync
35
- const { execSync } = await import('child_process')
36
- mockExecSync = execSync as any
37
- mockExecSync.mockClear()
38
- })
39
-
40
- describe('generateReleaseItConfig', () => {
41
- it('should generate valid release-it configuration', () => {
42
- const configString = versionManager.generateReleaseItConfig()
43
-
44
- expect(configString).toContain('module.exports =')
45
- expect(configString).toContain('"git"')
46
- expect(configString).toContain('"github"')
47
- expect(configString).toContain('"npm"')
48
- expect(configString).toContain('"plugins"')
49
- })
50
-
51
- it('should generate config with custom bump rules', () => {
52
- config.versioning = {
53
- enabled: true,
54
- releaseItConfig: '.release-it.cjs',
55
- conventionalCommits: true,
56
- autoTag: true,
57
- autoPush: true,
58
- changelog: true,
59
- bumpRules: {
60
- feat: 'minor',
61
- fix: 'patch',
62
- docs: 'patch'
63
- }
64
- }
65
-
66
- const manager = new VersionManager(config)
67
- const configString = manager.generateReleaseItConfig()
68
-
69
- // Just verify the config was generated successfully
70
- expect(configString).toContain('module.exports =')
71
- expect(configString).toContain('"@release-it/conventional-changelog"')
72
- })
73
- })
74
-
75
- describe('generateCommitlintConfig', () => {
76
- it('should generate valid commitlint configuration', () => {
77
- const configString = versionManager.generateCommitlintConfig()
78
-
79
- expect(configString).toContain('module.exports =')
80
- expect(configString).toContain('extends:')
81
- expect(configString).toContain('rules:')
82
- expect(configString).toContain('type-enum')
83
- expect(configString).toContain('feat')
84
- expect(configString).toContain('fix')
85
- })
86
- })
87
-
88
- describe('generateHuskyConfig', () => {
89
- it('should generate valid husky configuration', () => {
90
- const configString = versionManager.generateHuskyConfig()
91
-
92
- expect(configString).toContain('#!/usr/bin/env sh')
93
- expect(configString).toContain('husky.sh')
94
- expect(configString).toContain('commitlint')
95
- })
96
- })
97
-
98
- describe('getCurrentVersion', () => {
99
- it('should return current version from git tags', () => {
100
- mockExecSync.mockReturnValue('v1.2.3\n')
101
-
102
- const version = versionManager.getCurrentVersion()
103
-
104
- expect(version).toBe('1.2.3')
105
- expect(mockExecSync).toHaveBeenCalledWith('git describe --tags --abbrev=0', { encoding: 'utf8' })
106
- })
107
-
108
- it('should return default version when no tags exist', () => {
109
- mockExecSync.mockImplementation(() => {
110
- throw new Error('No tags found')
111
- })
112
-
113
- const version = versionManager.getCurrentVersion()
114
-
115
- expect(version).toBe('0.0.0')
116
- })
117
- })
118
-
119
- describe('validateConventionalCommits', () => {
120
- it('should return true for valid conventional commits', () => {
121
- const validCommits = [
122
- 'feat: add new feature',
123
- 'fix: resolve bug',
124
- 'docs: update documentation',
125
- 'style: format code',
126
- 'refactor: improve code structure',
127
- 'perf: optimize performance',
128
- 'test: add unit tests',
129
- 'build: update build process',
130
- 'ci: update CI configuration',
131
- 'chore: update dependencies'
132
- ].join('\n')
133
-
134
- mockExecSync.mockReturnValue(validCommits)
135
-
136
- const isValid = versionManager.validateConventionalCommits()
137
-
138
- expect(isValid).toBe(true)
139
- })
140
-
141
- it('should return false for invalid conventional commits', () => {
142
- const invalidCommits = [
143
- 'add new feature',
144
- 'fix bug',
145
- 'update docs',
146
- 'random commit message'
147
- ].join('\n')
148
-
149
- mockExecSync.mockReturnValue(invalidCommits)
150
-
151
- const isValid = versionManager.validateConventionalCommits()
152
-
153
- expect(isValid).toBe(false)
154
- })
155
-
156
- it('should handle git command errors', () => {
157
- mockExecSync.mockImplementation(() => {
158
- throw new Error('Git command failed')
159
- })
160
-
161
- const isValid = versionManager.validateConventionalCommits()
162
-
163
- expect(isValid).toBe(false)
164
- })
165
- })
166
-
167
- describe('calculateNextVersion', () => {
168
- it('should calculate next version from release-it', () => {
169
- const releaseItOutput = `
170
- version 1.2.4
171
- bump patch
172
- There are 0 BREAKING CHANGES and 0 features
173
- `
174
-
175
- mockExecSync.mockReturnValue(releaseItOutput)
176
-
177
- const result = versionManager.calculateNextVersion()
178
-
179
- expect(result.version).toBe('1.2.4')
180
- expect(result.type).toBe('patch')
181
- })
182
-
183
- it('should handle release-it errors gracefully', () => {
184
- mockExecSync.mockImplementation(() => {
185
- throw new Error('Release-it failed')
186
- })
187
-
188
- const result = versionManager.calculateNextVersion()
189
-
190
- expect(result.version).toBe('0.0.0')
191
- expect(result.type).toBe('patch')
192
- })
193
- })
194
-
195
- describe('setupVersionManagement', () => {
196
- it.skip('should create version management files when enabled', () => {
197
- // Skipped: Working directory race condition - writes to cwd instead of TEST_DIR
198
- config.versioning = {
199
- enabled: true,
200
- releaseItConfig: '.release-it.cjs',
201
- conventionalCommits: true,
202
- autoTag: true,
203
- autoPush: true,
204
- changelog: true,
205
- bumpRules: {}
206
- }
207
-
208
- const manager = new VersionManager(config)
209
-
210
- // Mock execSync for husky install
211
- mockExecSync.mockReturnValue('')
212
-
213
- manager.setupVersionManagement()
214
-
215
- // Check if files were created
216
- expect(existsSync(join(TEST_DIR, '.release-it.cjs'))).toBe(true)
217
- expect(existsSync(join(TEST_DIR, 'commitlint.config.js'))).toBe(true)
218
- expect(existsSync(join(TEST_DIR, '.husky/commit-msg'))).toBe(true)
219
- })
220
-
221
- it('should not create files when versioning is disabled', () => {
222
- config.versioning = {
223
- enabled: false,
224
- releaseItConfig: '.release-it.cjs',
225
- conventionalCommits: true,
226
- autoTag: true,
227
- autoPush: true,
228
- changelog: true,
229
- bumpRules: {}
230
- }
231
-
232
- const manager = new VersionManager(config)
233
-
234
- manager.setupVersionManagement()
235
-
236
- // Check if files were not created
237
- expect(existsSync(join(TEST_DIR, '.release-it.cjs'))).toBe(false)
238
- expect(existsSync(join(TEST_DIR, 'commitlint.config.js'))).toBe(false)
239
- })
240
- })
241
- })
@@ -1,17 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "sourceMap": true,
5
- "outDir": "./dist-debug",
6
- "rootDir": ".",
7
- "module": "ESNext",
8
- "target": "ES2022",
9
- "moduleResolution": "node",
10
- "allowSyntheticDefaultImports": true,
11
- "esModuleInterop": true,
12
- "skipLibCheck": true
13
- },
14
- "include": [
15
- "debug-pipeline.ts"
16
- ]
17
- }
package/tsconfig.json DELETED
@@ -1,28 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "node",
6
- "allowSyntheticDefaultImports": true,
7
- "esModuleInterop": true,
8
- "allowJs": true,
9
- "strict": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "outDir": "./dist",
13
- "rootDir": "./src",
14
- "declaration": true,
15
- "declarationMap": true,
16
- "sourceMap": true,
17
- "resolveJsonModule": true
18
- },
19
- "include": [
20
- "src/**/*"
21
- ],
22
- "exclude": [
23
- "node_modules",
24
- "dist",
25
- "**/*.test.ts",
26
- "**/*.spec.ts"
27
- ]
28
- }
package/vitest.config.ts DELETED
@@ -1,51 +0,0 @@
1
- import { defineConfig } from 'vitest/config'
2
- import { resolve } from 'path'
3
-
4
- export default defineConfig({
5
- test: {
6
- globals: true,
7
- environment: 'node',
8
- setupFiles: ['./tests/setup.ts'],
9
- coverage: {
10
- provider: 'v8',
11
- reporter: ['text', 'json', 'html', 'lcov'],
12
- reportsDirectory: './coverage',
13
- // Include core business logic AND orchestration code (CLI, generators)
14
- include: [
15
- 'src/utils/**/*.ts',
16
- 'src/templates/workflows/**/*.ts',
17
- 'src/generators/**/*.ts',
18
- 'src/cli/index.ts'
19
- ],
20
- exclude: [
21
- 'node_modules/',
22
- 'dist/',
23
- 'tests/',
24
- '**/*.d.ts',
25
- '**/*.config.*',
26
- '**/coverage/**',
27
- '**/*.test.ts',
28
- '**/*.spec.ts'
29
- ],
30
- // Thresholds based on actual testable code (CLI + generators + core logic)
31
- thresholds: {
32
- lines: 75,
33
- functions: 75,
34
- branches: 75,
35
- statements: 75
36
- },
37
- // Report per-file thresholds
38
- perFile: true,
39
- // Include all source files in report
40
- all: true,
41
- // Additional config for better reporting
42
- clean: true,
43
- skipFull: false
44
- }
45
- },
46
- resolve: {
47
- alias: {
48
- '@': resolve(__dirname, './src')
49
- }
50
- }
51
- })