pipecraft 0.28.2 → 0.29.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 (62) hide show
  1. package/README.md +5 -2
  2. package/dist/cli/index.js +1 -9
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/generators/init.tpl.d.ts.map +1 -1
  5. package/dist/generators/init.tpl.js +140 -67
  6. package/dist/generators/init.tpl.js.map +1 -1
  7. package/dist/generators/workflows.tpl.d.ts.map +1 -1
  8. package/dist/generators/workflows.tpl.js +18 -5
  9. package/dist/generators/workflows.tpl.js.map +1 -1
  10. package/dist/templates/actions/detect-changes-nx.yml.tpl.d.ts +32 -0
  11. package/dist/templates/actions/detect-changes-nx.yml.tpl.d.ts.map +1 -0
  12. package/dist/templates/actions/detect-changes-nx.yml.tpl.js +227 -0
  13. package/dist/templates/actions/detect-changes-nx.yml.tpl.js.map +1 -0
  14. package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts +22 -0
  15. package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts.map +1 -0
  16. package/dist/templates/workflows/pipeline-nx.yml.tpl.js +196 -0
  17. package/dist/templates/workflows/pipeline-nx.yml.tpl.js.map +1 -0
  18. package/dist/templates/workflows/pipeline.yml.tpl.d.ts +22 -0
  19. package/dist/templates/workflows/pipeline.yml.tpl.d.ts.map +1 -0
  20. package/dist/templates/workflows/pipeline.yml.tpl.js +136 -0
  21. package/dist/templates/workflows/pipeline.yml.tpl.js.map +1 -0
  22. package/dist/templates/workflows/shared/index.d.ts +11 -0
  23. package/dist/templates/workflows/shared/index.d.ts.map +1 -0
  24. package/dist/templates/workflows/shared/index.js +11 -0
  25. package/dist/templates/workflows/shared/index.js.map +1 -0
  26. package/dist/templates/workflows/shared/operations-changes.d.ts +17 -0
  27. package/dist/templates/workflows/shared/operations-changes.d.ts.map +1 -0
  28. package/dist/templates/workflows/shared/operations-changes.js +49 -0
  29. package/dist/templates/workflows/shared/operations-changes.js.map +1 -0
  30. package/dist/templates/workflows/shared/operations-domain-jobs.d.ts +31 -0
  31. package/dist/templates/workflows/shared/operations-domain-jobs.d.ts.map +1 -0
  32. package/dist/templates/workflows/shared/operations-domain-jobs.js +139 -0
  33. package/dist/templates/workflows/shared/operations-domain-jobs.js.map +1 -0
  34. package/dist/templates/workflows/shared/operations-header.d.ts +15 -0
  35. package/dist/templates/workflows/shared/operations-header.d.ts.map +1 -0
  36. package/dist/templates/workflows/shared/operations-header.js +158 -0
  37. package/dist/templates/workflows/shared/operations-header.js.map +1 -0
  38. package/dist/templates/workflows/shared/operations-tag-promote.d.ts +16 -0
  39. package/dist/templates/workflows/shared/operations-tag-promote.d.ts.map +1 -0
  40. package/dist/templates/workflows/shared/operations-tag-promote.js +115 -0
  41. package/dist/templates/workflows/shared/operations-tag-promote.js.map +1 -0
  42. package/dist/templates/workflows/shared/operations-version.d.ts +16 -0
  43. package/dist/templates/workflows/shared/operations-version.d.ts.map +1 -0
  44. package/dist/templates/workflows/shared/operations-version.js +57 -0
  45. package/dist/templates/workflows/shared/operations-version.js.map +1 -0
  46. package/dist/templates/yaml-format-utils.d.ts +24 -0
  47. package/dist/templates/yaml-format-utils.d.ts.map +1 -0
  48. package/dist/templates/yaml-format-utils.js +50 -0
  49. package/dist/templates/yaml-format-utils.js.map +1 -0
  50. package/dist/types/index.d.ts +53 -0
  51. package/dist/types/index.d.ts.map +1 -1
  52. package/package.json +3 -1
  53. package/src/generators/init.tpl.ts +151 -73
  54. package/src/generators/workflows.tpl.ts +19 -5
  55. package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts +0 -129
  56. package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts.map +0 -1
  57. package/dist/templates/workflows/pipeline-path-based.yml.tpl.js +0 -1057
  58. package/dist/templates/workflows/pipeline-path-based.yml.tpl.js.map +0 -1
  59. package/dist/utils/github-setup-v2.d.ts +0 -15
  60. package/dist/utils/github-setup-v2.d.ts.map +0 -1
  61. package/dist/utils/github-setup-v2.js +0 -217
  62. package/dist/utils/github-setup-v2.js.map +0 -1
@@ -1,129 +0,0 @@
1
- /**
2
- * Path-Based Pipeline Template Generator
3
- *
4
- * The core template that generates the main CI/CD pipeline workflow for PipeCraft.
5
- * This is the most complex template in the system, responsible for creating a
6
- * GitHub Actions workflow that orchestrates the entire trunk-based development flow.
7
- *
8
- * ## Key Responsibilities
9
- *
10
- * 1. **Change Detection**: Generates jobs to detect which domains (api, web, libs, etc.) changed
11
- * 2. **Test Execution**: Creates domain-specific test jobs based on changes
12
- * 3. **Version Management**: Integrates semantic versioning for staging/production branches
13
- * 4. **Branch Promotion**: Auto-promotes code through branch flow (develop → staging → main)
14
- * 5. **User Job Preservation**: Maintains user-added custom jobs during regeneration
15
- * 6. **Comment Preservation**: Retains user comments when updating workflows
16
- *
17
- * ## Intelligent Merging
18
- *
19
- * The generator distinguishes between:
20
- * - **Pipecraft-owned jobs**: `changes`, `version`, `tag`, `promote`, `release`, `test-*`, `deploy-*`
21
- * - **User jobs**: Any jobs not owned by Pipecraft
22
- *
23
- * During regeneration:
24
- * - Pipecraft jobs are completely replaced with template versions
25
- * - User jobs are preserved exactly as-is
26
- * - User comments are maintained
27
- * - Job order is intelligently managed (Pipecraft jobs first, then user jobs)
28
- *
29
- * ## Architecture
30
- *
31
- * Uses AST-based path operations for surgical YAML manipulation:
32
- * - Parse existing workflow into AST
33
- * - Apply precise path-based operations
34
- * - Preserve formatting and comments
35
- * - Rebuild YAML maintaining structure
36
- *
37
- * @module templates/workflows/pipeline-path-based.yml.tpl
38
- *
39
- * @example
40
- * ```typescript
41
- * import { generate } from './templates/workflows/pipeline-path-based.yml.tpl.js'
42
- *
43
- * // Initial generation
44
- * await generate({
45
- * cwd: '/path/to/project',
46
- * branchFlow: ['develop', 'staging', 'main'],
47
- * domains: {
48
- * api: { paths: ['src/api/**'], test: true },
49
- * web: { paths: ['src/web/**'], test: true }
50
- * }
51
- * })
52
- *
53
- * // Incremental update (preserves user jobs)
54
- * await generate({
55
- * cwd: '/path/to/project',
56
- * existingPipeline: parsedYAML,
57
- * existingPipelineContent: rawYAMLString,
58
- * branchFlow: ['develop', 'staging', 'main'],
59
- * domains: { ... }
60
- * })
61
- * ```
62
- *
63
- * @see {@link module:utils/ast-path-operations} for YAML manipulation details
64
- */
65
- import { PinionContext } from '@featherscloud/pinion';
66
- /**
67
- * Create path-based pipeline content
68
- */
69
- export declare const createPathBasedPipeline: (ctx: any) => {
70
- yamlContent: string;
71
- mergeStatus: string;
72
- };
73
- /**
74
- * Main pipeline generator entry point.
75
- *
76
- * Generates the complete GitHub Actions pipeline workflow with intelligent
77
- * merging of existing user customizations.
78
- *
79
- * @param {PinionContext & { existingPipeline?: any, outputPipelinePath?: string }} ctx - Generator context
80
- * @param {any} [ctx.existingPipeline] - Parsed existing pipeline YAML for merging
81
- * @param {string} [ctx.existingPipelineContent] - Raw existing pipeline content for comment preservation
82
- * @param {string} [ctx.outputPipelinePath] - Custom output path (default: .github/workflows/pipeline.yml)
83
- * @param {string[]} ctx.branchFlow - Branch flow sequence (e.g., ['develop', 'staging', 'main'])
84
- * @param {Record<string, DomainConfig>} ctx.domains - Domain configurations for change detection
85
- * @param {string} [ctx.ciProvider] - CI provider ('github' or 'gitlab')
86
- * @param {string} [ctx.mergeStrategy] - Merge strategy ('fast-forward' or 'merge')
87
- * @returns {Promise<PinionContext>} Updated context with generated YAML
88
- *
89
- * @throws {Error} If pipeline file cannot be written
90
- * @throws {Error} If existing pipeline cannot be parsed
91
- *
92
- * @example
93
- * ```typescript
94
- * // Generate new pipeline
95
- * await generate({
96
- * cwd: '/path/to/project',
97
- * branchFlow: ['develop', 'main'],
98
- * domains: {
99
- * api: { paths: ['src/api/**'], test: true }
100
- * }
101
- * })
102
- *
103
- * // Update existing pipeline (preserves user jobs)
104
- * const existing = parseDocument(readFileSync('pipeline.yml', 'utf8'))
105
- * await generate({
106
- * cwd: '/path/to/project',
107
- * existingPipeline: existing,
108
- * existingPipelineContent: readFileSync('pipeline.yml', 'utf8'),
109
- * branchFlow: ['develop', 'staging', 'main'],
110
- * domains: { ... }
111
- * })
112
- * ```
113
- *
114
- * @note The generator performs these steps:
115
- * 1. Calls `createPathBasedPipeline()` to build the workflow
116
- * 2. Logs merge status (new vs. merged)
117
- * 3. Writes the final YAML to the output path
118
- *
119
- * The heavy lifting is done by `createPathBasedPipeline()` which handles:
120
- * - Job generation based on domains and branch flow
121
- * - User job preservation and merging
122
- * - Comment preservation from existing pipeline
123
- * - Intelligent job ordering
124
- */
125
- export declare const generate: (ctx: PinionContext & {
126
- existingPipeline?: any;
127
- outputPipelinePath?: string;
128
- }) => Promise<any>;
129
- //# sourceMappingURL=pipeline-path-based.yml.tpl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipeline-path-based.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/workflows/pipeline-path-based.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AAEH,OAAO,EAAE,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAsD7E;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,KAAK,GAAG;;;CAm5B/C,CAAA;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,GAAG;IAAE,gBAAgB,CAAC,EAAE,GAAG,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,iBAoB/F,CAAA"}