@jterrats/smart-deployment 1.2.6 → 1.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.
- package/README.md +31 -1
- package/lib/analysis/project-analysis-service.d.ts +5 -0
- package/lib/analysis/project-analysis-service.js +18 -0
- package/lib/analysis/project-analysis-service.js.map +1 -1
- package/lib/commands/ci/preset.d.ts +25 -0
- package/lib/commands/ci/preset.js +125 -0
- package/lib/commands/ci/preset.js.map +1 -0
- package/lib/commands/graph/export.d.ts +20 -0
- package/lib/commands/graph/export.js +107 -0
- package/lib/commands/graph/export.js.map +1 -0
- package/lib/commands/impact.d.ts +18 -0
- package/lib/commands/impact.js +105 -0
- package/lib/commands/impact.js.map +1 -0
- package/lib/commands/init.d.ts +19 -0
- package/lib/commands/init.js +83 -0
- package/lib/commands/init.js.map +1 -0
- package/lib/commands/plan/explain.d.ts +14 -0
- package/lib/commands/plan/explain.js +134 -0
- package/lib/commands/plan/explain.js.map +1 -0
- package/lib/commands/resume.d.ts +1 -0
- package/lib/commands/resume.js +17 -3
- package/lib/commands/resume.js.map +1 -1
- package/lib/commands/retrieve.d.ts +20 -0
- package/lib/commands/retrieve.js +111 -0
- package/lib/commands/retrieve.js.map +1 -0
- package/lib/commands/start.d.ts +21 -0
- package/lib/commands/start.js +124 -14
- package/lib/commands/start.js.map +1 -1
- package/lib/commands/status.d.ts +1 -0
- package/lib/commands/status.js +15 -3
- package/lib/commands/status.js.map +1 -1
- package/lib/commands/validate.d.ts +8 -0
- package/lib/commands/validate.js +14 -0
- package/lib/commands/validate.js.map +1 -1
- package/lib/config/init-config-generation-service.d.ts +27 -0
- package/lib/config/init-config-generation-service.js +88 -0
- package/lib/config/init-config-generation-service.js.map +1 -0
- package/lib/config/repo-config.d.ts +25 -0
- package/lib/config/repo-config.js.map +1 -1
- package/lib/dependencies/impact-analysis-service.d.ts +77 -0
- package/lib/dependencies/impact-analysis-service.js +234 -0
- package/lib/dependencies/impact-analysis-service.js.map +1 -0
- package/lib/deployment/ci-preset-service.d.ts +44 -0
- package/lib/deployment/ci-preset-service.js +65 -0
- package/lib/deployment/ci-preset-service.js.map +1 -0
- package/lib/deployment/commit-scope-service.d.ts +43 -0
- package/lib/deployment/commit-scope-service.js +209 -0
- package/lib/deployment/commit-scope-service.js.map +1 -0
- package/lib/deployment/deployment-context-service.d.ts +3 -0
- package/lib/deployment/deployment-context-service.js +1 -0
- package/lib/deployment/deployment-context-service.js.map +1 -1
- package/lib/deployment/deployment-error-diagnostics.d.ts +11 -0
- package/lib/deployment/deployment-error-diagnostics.js +187 -0
- package/lib/deployment/deployment-error-diagnostics.js.map +1 -0
- package/lib/deployment/deployment-runner.d.ts +1 -0
- package/lib/deployment/deployment-runner.js +35 -15
- package/lib/deployment/deployment-runner.js.map +1 -1
- package/lib/deployment/deployment-status-service.d.ts +9 -2
- package/lib/deployment/deployment-status-service.js +56 -3
- package/lib/deployment/deployment-status-service.js.map +1 -1
- package/lib/deployment/deployment-validation-service.d.ts +3 -0
- package/lib/deployment/deployment-validation-service.js +32 -4
- package/lib/deployment/deployment-validation-service.js.map +1 -1
- package/lib/deployment/plan-explain-service.d.ts +88 -0
- package/lib/deployment/plan-explain-service.js +171 -0
- package/lib/deployment/plan-explain-service.js.map +1 -0
- package/lib/deployment/resume-deployment-service.d.ts +6 -2
- package/lib/deployment/resume-deployment-service.js +27 -3
- package/lib/deployment/resume-deployment-service.js.map +1 -1
- package/lib/deployment/retrieve-forceignore-service.d.ts +51 -0
- package/lib/deployment/retrieve-forceignore-service.js +139 -0
- package/lib/deployment/retrieve-forceignore-service.js.map +1 -0
- package/lib/deployment/rollback-planning-service.d.ts +49 -0
- package/lib/deployment/rollback-planning-service.js +178 -0
- package/lib/deployment/rollback-planning-service.js.map +1 -0
- package/lib/deployment/sf-cli-integration.d.ts +4 -0
- package/lib/deployment/sf-cli-integration.js +22 -2
- package/lib/deployment/sf-cli-integration.js.map +1 -1
- package/lib/deployment/start-execution-service.d.ts +1 -0
- package/lib/deployment/start-execution-service.js +14 -8
- package/lib/deployment/start-execution-service.js.map +1 -1
- package/lib/deployment/wave-manifest-service.d.ts +8 -0
- package/lib/deployment/wave-manifest-service.js +39 -20
- package/lib/deployment/wave-manifest-service.js.map +1 -1
- package/lib/presentation/plan-explain-presenter.d.ts +9 -0
- package/lib/presentation/plan-explain-presenter.js +40 -0
- package/lib/presentation/plan-explain-presenter.js.map +1 -0
- package/lib/presentation/start-command-presenter.d.ts +4 -0
- package/lib/presentation/start-command-presenter.js +4 -0
- package/lib/presentation/start-command-presenter.js.map +1 -1
- package/lib/reports/deployment-plan-report-service.d.ts +76 -0
- package/lib/reports/deployment-plan-report-service.js +234 -0
- package/lib/reports/deployment-plan-report-service.js.map +1 -0
- package/lib/reports/graph-export-service.d.ts +85 -0
- package/lib/reports/graph-export-service.js +296 -0
- package/lib/reports/graph-export-service.js.map +1 -0
- package/lib/services/metadata-scanner-service.js +4 -2
- package/lib/services/metadata-scanner-service.js.map +1 -1
- package/lib/services/scanners/automation-ai-metadata-scanner.d.ts +1 -0
- package/lib/services/scanners/automation-ai-metadata-scanner.js +39 -0
- package/lib/services/scanners/automation-ai-metadata-scanner.js.map +1 -1
- package/messages/ci.preset.json +22 -0
- package/messages/graph.export.json +20 -0
- package/messages/impact.json +18 -0
- package/messages/init.json +16 -0
- package/messages/plan.explain.json +20 -0
- package/messages/resume.json +1 -0
- package/messages/retrieve.json +26 -0
- package/messages/start.json +16 -2
- package/messages/status.json +1 -0
- package/messages/validate.json +3 -1
- package/npm-shrinkwrap.json +45 -70
- package/oclif.lock +44 -41
- package/oclif.manifest.json +801 -25
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ The current codebase supports:
|
|
|
13
13
|
- metadata scanning and dependency graph generation
|
|
14
14
|
- wave generation with circular dependency detection
|
|
15
15
|
- conservative circular dependency remediation for supported `ApexClass` cycles
|
|
16
|
-
- real CLI flows for `start`, `analyze`, `validate`, `status`, `resume`, and `config`
|
|
16
|
+
- real CLI flows for `start`, `analyze`, `validate`, `status`, `resume`, `retrieve`, and `config`
|
|
17
17
|
- AI-assisted dependency inference, priority weighting, and validation
|
|
18
18
|
- multiple LLM providers through a shared provider abstraction
|
|
19
19
|
|
|
@@ -30,6 +30,7 @@ What is working today:
|
|
|
30
30
|
- `sf smart-deployment resume`
|
|
31
31
|
- `sf smart-deployment config`
|
|
32
32
|
- `sf smart-deployment ci-publish`
|
|
33
|
+
- `sf smart-deployment retrieve`
|
|
33
34
|
- JSON and HTML analysis reports
|
|
34
35
|
- repo-level AI configuration via `.smart-deployment.json`
|
|
35
36
|
|
|
@@ -81,6 +82,25 @@ sf smart-deployment start \
|
|
|
81
82
|
--dry-run
|
|
82
83
|
```
|
|
83
84
|
|
|
85
|
+
Run a destructive delete using the normal wave plan:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
sf smart-deployment start \
|
|
89
|
+
--source-path force-app \
|
|
90
|
+
--target-org myorg \
|
|
91
|
+
--destructive
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Rollback a release by comparing release tags:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
sf smart-deployment start \
|
|
98
|
+
--source-path force-app \
|
|
99
|
+
--target-org myorg \
|
|
100
|
+
--rollback-from v1.2.0 \
|
|
101
|
+
--rollback-to v1.2.1
|
|
102
|
+
```
|
|
103
|
+
|
|
84
104
|
Run with AI and allow conservative cycle remediation:
|
|
85
105
|
|
|
86
106
|
```bash
|
|
@@ -127,6 +147,15 @@ sf smart-deployment config \
|
|
|
127
147
|
--set-llm-model gpt-4o-mini
|
|
128
148
|
```
|
|
129
149
|
|
|
150
|
+
Retrieve bundle metadata while enforcing `.forceignore` leaf paths:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
sf smart-deployment retrieve \
|
|
154
|
+
--metadata DigitalExperienceBundle:site/PHP_Portal1 \
|
|
155
|
+
--strict-ignore \
|
|
156
|
+
--normalize-meta
|
|
157
|
+
```
|
|
158
|
+
|
|
130
159
|
Build a coordinated CI publish plan for metadata, Agentforce authoring bundles, LWR publish, and optional activation:
|
|
131
160
|
|
|
132
161
|
```bash
|
|
@@ -138,6 +167,7 @@ sf smart-deployment ci-publish \
|
|
|
138
167
|
```
|
|
139
168
|
|
|
140
169
|
When executing deploy phases, Smart Deployment respects `.forceignore` by building from a temporary sanitized Salesforce project. Ignored files stay in the working tree but are not visible to package generation or `sf project deploy start`.
|
|
170
|
+
For retrieve flows, `sf smart-deployment retrieve` runs `sf project retrieve start`, detects touched paths, restores `.forceignore`-protected bundle sub-paths with `git checkout HEAD -- <path>` or untracked cleanup, and can fail the command with `--strict-ignore`. Use `--normalize-meta` to opt into deterministic formatting for DigitalExperience `*_meta.json` files.
|
|
141
171
|
When `--target-org` is provided, the coordinated publish flow also passes the org through to Salesforce CLI commands and checks AI evaluation subjects against source metadata or the target org before deploy.
|
|
142
172
|
|
|
143
173
|
## Commands
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AgentforcePriorityService } from '../ai/agentforce-priority-service.js';
|
|
2
2
|
import { DependencyInferenceService, type InferredDependency } from '../ai/dependency-inference-service.js';
|
|
3
|
+
import { CommitScopeService, type CommitScopeOptions, type CommitScopeSummary } from '../deployment/commit-scope-service.js';
|
|
3
4
|
import { MetadataScannerService, type ScanResult } from '../services/metadata-scanner-service.js';
|
|
4
5
|
import type { PriorityOverride } from '../types/deployment-plan.js';
|
|
5
6
|
import type { MetadataComponent } from '../types/metadata.js';
|
|
@@ -26,6 +27,7 @@ export type ProjectAnalysisResult = {
|
|
|
26
27
|
orderedWaves: Wave[];
|
|
27
28
|
priorityOverrides: Record<string, PriorityOverride>;
|
|
28
29
|
aiContext?: ProjectAnalysisAIContext;
|
|
30
|
+
commitScope?: CommitScopeSummary;
|
|
29
31
|
messages: ProjectAnalysisMessages;
|
|
30
32
|
};
|
|
31
33
|
export type ProjectAnalysisBuildOptions = {
|
|
@@ -33,16 +35,19 @@ export type ProjectAnalysisBuildOptions = {
|
|
|
33
35
|
useAI?: boolean;
|
|
34
36
|
orgType?: string;
|
|
35
37
|
industry?: string;
|
|
38
|
+
commitScope?: CommitScopeOptions;
|
|
36
39
|
};
|
|
37
40
|
type ProjectAnalysisServiceDependencies = {
|
|
38
41
|
scanner?: MetadataScannerService;
|
|
39
42
|
createInferenceService?: (baseDir: string) => Pick<DependencyInferenceService, 'inferDependencies'>;
|
|
40
43
|
createPriorityService?: (baseDir: string) => AgentforcePriorityService;
|
|
44
|
+
commitScopeService?: Pick<CommitScopeService, 'apply'>;
|
|
41
45
|
};
|
|
42
46
|
export declare class ProjectAnalysisService {
|
|
43
47
|
private readonly scanner;
|
|
44
48
|
private readonly createInferenceService;
|
|
45
49
|
private readonly createPriorityService;
|
|
50
|
+
private readonly commitScopeService;
|
|
46
51
|
constructor(dependencies?: ProjectAnalysisServiceDependencies);
|
|
47
52
|
buildAnalysis(options?: ProjectAnalysisBuildOptions): Promise<ProjectAnalysisResult>;
|
|
48
53
|
static applyInferredDependencies(components: MetadataComponent[], inferredDependencies: InferredDependency[]): MetadataComponent[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AgentforcePriorityService } from '../ai/agentforce-priority-service.js';
|
|
2
2
|
import { DependencyInferenceService } from '../ai/dependency-inference-service.js';
|
|
3
3
|
import { DependencyGraphBuilder } from '../dependencies/dependency-graph-builder.js';
|
|
4
|
+
import { CommitScopeService, } from '../deployment/commit-scope-service.js';
|
|
4
5
|
import { MetadataScannerService } from '../services/metadata-scanner-service.js';
|
|
5
6
|
import { AIEnhancedPriorityWaveGenerator } from '../waves/priority-wave-generator-ai.js';
|
|
6
7
|
import { getWavesInExecutionOrder } from '../waves/wave-executor.js';
|
|
@@ -9,6 +10,7 @@ export class ProjectAnalysisService {
|
|
|
9
10
|
scanner;
|
|
10
11
|
createInferenceService;
|
|
11
12
|
createPriorityService;
|
|
13
|
+
commitScopeService;
|
|
12
14
|
constructor(dependencies = {}) {
|
|
13
15
|
this.scanner = dependencies.scanner ?? new MetadataScannerService();
|
|
14
16
|
this.createInferenceService =
|
|
@@ -17,6 +19,7 @@ export class ProjectAnalysisService {
|
|
|
17
19
|
this.createPriorityService =
|
|
18
20
|
dependencies.createPriorityService ??
|
|
19
21
|
((baseDir) => new AgentforcePriorityService({ baseDir }));
|
|
22
|
+
this.commitScopeService = dependencies.commitScopeService ?? new CommitScopeService();
|
|
20
23
|
}
|
|
21
24
|
async buildAnalysis(options = {}) {
|
|
22
25
|
const scanResult = await this.scanner.scan({ sourcePath: options.sourcePath });
|
|
@@ -41,6 +44,20 @@ export class ProjectAnalysisService {
|
|
|
41
44
|
scanResult.dependencyResult = dependencyResult;
|
|
42
45
|
}
|
|
43
46
|
}
|
|
47
|
+
let commitScope;
|
|
48
|
+
const hasCommitScope = (options.commitScope?.commits?.length ?? 0) > 0 || options.commitScope?.manifestPath !== undefined;
|
|
49
|
+
if (hasCommitScope) {
|
|
50
|
+
const scoped = await this.commitScopeService.apply(scanResult, options.commitScope);
|
|
51
|
+
scanResult.components = scoped.scanResult.components;
|
|
52
|
+
scanResult.dependencyResult = scoped.scanResult.dependencyResult;
|
|
53
|
+
dependencyResult = scoped.scanResult.dependencyResult;
|
|
54
|
+
commitScope = scoped.summary;
|
|
55
|
+
messages.logs.push([
|
|
56
|
+
` Scope: ${commitScope.includedComponents.length} component(s) selected`,
|
|
57
|
+
`from ${commitScope.commits.length} commit(s);`,
|
|
58
|
+
`${commitScope.ignoredComponents.length} ignored.`,
|
|
59
|
+
].join(' '));
|
|
60
|
+
}
|
|
44
61
|
const waveBuilder = new WaveBuilder({
|
|
45
62
|
dependencyEdges: dependencyResult.edges,
|
|
46
63
|
});
|
|
@@ -92,6 +109,7 @@ export class ProjectAnalysisService {
|
|
|
92
109
|
orderedWaves,
|
|
93
110
|
priorityOverrides,
|
|
94
111
|
aiContext,
|
|
112
|
+
commitScope,
|
|
95
113
|
messages,
|
|
96
114
|
};
|
|
97
115
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-analysis-service.js","sourceRoot":"","sources":["../../src/analysis/project-analysis-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAA2B,MAAM,uCAAuC,CAAC;AAC5G,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAmB,MAAM,yCAAyC,CAAC;AAIlG,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,WAAW,EAA8B,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"project-analysis-service.js","sourceRoot":"","sources":["../../src/analysis/project-analysis-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAA2B,MAAM,uCAAuC,CAAC;AAC5G,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EACL,kBAAkB,GAGnB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAmB,MAAM,yCAAyC,CAAC;AAIlG,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,WAAW,EAA8B,MAAM,0BAA0B,CAAC;AA6CnF,MAAM,OAAO,sBAAsB;IAChB,OAAO,CAAyB;IAChC,sBAAsB,CAA4E;IAClG,qBAAqB,CAA2E;IAChG,kBAAkB,CAAoC;IAEvE,YAAmB,eAAmD,EAAE;QACtE,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,IAAI,IAAI,sBAAsB,EAAE,CAAC;QACpE,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G,CAAC,UAAU,CAAC,CAAC;QAC/D,CAAC;QAED,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { type CiPresetResult } from '../../deployment/ci-preset-service.js';
|
|
3
|
+
export default class CiPreset extends SfCommand<CiPresetResult> {
|
|
4
|
+
static readonly aliases: string[];
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'source-path': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'report-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'validation-mode': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'skip-tests': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
'use-ai': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
'org-type': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
industry: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
'scope-commits': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
'scope-manifest': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
};
|
|
20
|
+
run(): Promise<CiPresetResult>;
|
|
21
|
+
private getCommitScopeOptions;
|
|
22
|
+
private getTargetOrgIdentifier;
|
|
23
|
+
private writeGithubOutputs;
|
|
24
|
+
private reportResult;
|
|
25
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { appendFile } from 'node:fs/promises';
|
|
2
|
+
import { Messages } from '@salesforce/core';
|
|
3
|
+
import { Flags, SfCommand, optionalOrgFlagWithDeprecations } from '@salesforce/sf-plugins-core';
|
|
4
|
+
import { CiPresetService, } from '../../deployment/ci-preset-service.js';
|
|
5
|
+
import { getLogger } from '../../utils/logger.js';
|
|
6
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
7
|
+
const messages = Messages.loadMessages('@jterrats/smart-deployment', 'ci.preset');
|
|
8
|
+
const logger = getLogger('CiPresetCommand');
|
|
9
|
+
const ciPresetService = new CiPresetService();
|
|
10
|
+
export default class CiPreset extends SfCommand {
|
|
11
|
+
static aliases = ['smart-deployment ci preset'];
|
|
12
|
+
static summary = messages.getMessage('summary');
|
|
13
|
+
static description = messages.getMessage('description');
|
|
14
|
+
static examples = messages.getMessages('examples');
|
|
15
|
+
static flags = {
|
|
16
|
+
'target-org': optionalOrgFlagWithDeprecations,
|
|
17
|
+
'source-path': Flags.string({
|
|
18
|
+
summary: messages.getMessage('flags.source-path.summary'),
|
|
19
|
+
description: messages.getMessage('flags.source-path.description'),
|
|
20
|
+
}),
|
|
21
|
+
'report-dir': Flags.string({
|
|
22
|
+
summary: messages.getMessage('flags.report-dir.summary'),
|
|
23
|
+
description: messages.getMessage('flags.report-dir.description'),
|
|
24
|
+
}),
|
|
25
|
+
'validation-mode': Flags.string({
|
|
26
|
+
summary: messages.getMessage('flags.validation-mode.summary'),
|
|
27
|
+
description: messages.getMessage('flags.validation-mode.description'),
|
|
28
|
+
options: ['strict', 'warn-only', 'local-only'],
|
|
29
|
+
default: 'strict',
|
|
30
|
+
}),
|
|
31
|
+
'skip-tests': Flags.boolean({
|
|
32
|
+
summary: messages.getMessage('flags.skip-tests.summary'),
|
|
33
|
+
default: false,
|
|
34
|
+
}),
|
|
35
|
+
'use-ai': Flags.boolean({
|
|
36
|
+
summary: messages.getMessage('flags.use-ai.summary'),
|
|
37
|
+
default: false,
|
|
38
|
+
}),
|
|
39
|
+
'org-type': Flags.string({
|
|
40
|
+
summary: messages.getMessage('flags.org-type.summary'),
|
|
41
|
+
options: ['Production', 'Sandbox', 'Developer'],
|
|
42
|
+
}),
|
|
43
|
+
industry: Flags.string({
|
|
44
|
+
summary: messages.getMessage('flags.industry.summary'),
|
|
45
|
+
}),
|
|
46
|
+
'scope-commits': Flags.string({
|
|
47
|
+
summary: messages.getMessage('flags.scope-commits.summary'),
|
|
48
|
+
description: messages.getMessage('flags.scope-commits.description'),
|
|
49
|
+
}),
|
|
50
|
+
'scope-manifest': Flags.string({
|
|
51
|
+
summary: messages.getMessage('flags.scope-manifest.summary'),
|
|
52
|
+
description: messages.getMessage('flags.scope-manifest.description'),
|
|
53
|
+
}),
|
|
54
|
+
};
|
|
55
|
+
async run() {
|
|
56
|
+
const { flags } = await this.parse(CiPreset);
|
|
57
|
+
const validationMode = flags['validation-mode'];
|
|
58
|
+
const sourcePath = typeof flags['source-path'] === 'string' ? flags['source-path'] : undefined;
|
|
59
|
+
const targetOrg = this.getTargetOrgIdentifier(flags['target-org']);
|
|
60
|
+
const commitScope = this.getCommitScopeOptions(flags);
|
|
61
|
+
let result;
|
|
62
|
+
try {
|
|
63
|
+
logger.info('Running CI preset', { sourcePath, targetOrg, validationMode });
|
|
64
|
+
result = await ciPresetService.run({
|
|
65
|
+
sourcePath,
|
|
66
|
+
targetOrg,
|
|
67
|
+
reportDir: typeof flags['report-dir'] === 'string' ? flags['report-dir'] : undefined,
|
|
68
|
+
validationMode,
|
|
69
|
+
skipTests: flags['skip-tests'] === true,
|
|
70
|
+
useAI: flags['use-ai'] === true,
|
|
71
|
+
orgType: typeof flags['org-type'] === 'string' ? flags['org-type'] : undefined,
|
|
72
|
+
industry: typeof flags.industry === 'string' ? flags.industry : undefined,
|
|
73
|
+
commitScope,
|
|
74
|
+
});
|
|
75
|
+
await this.writeGithubOutputs(result);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
logger.error('CI preset failed', { error });
|
|
79
|
+
this.error(`CI preset failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
80
|
+
}
|
|
81
|
+
this.reportResult(result);
|
|
82
|
+
if (result.exitCode !== 0) {
|
|
83
|
+
this.exit(result.exitCode);
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
getCommitScopeOptions(flags) {
|
|
88
|
+
const commits = typeof flags['scope-commits'] === 'string' ? [flags['scope-commits']] : undefined;
|
|
89
|
+
const manifestPath = typeof flags['scope-manifest'] === 'string' ? flags['scope-manifest'] : undefined;
|
|
90
|
+
return commits !== undefined || manifestPath !== undefined ? { commits, manifestPath } : undefined;
|
|
91
|
+
}
|
|
92
|
+
getTargetOrgIdentifier(value) {
|
|
93
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
94
|
+
return value;
|
|
95
|
+
}
|
|
96
|
+
if (typeof value === 'object' && value !== null && 'getUsername' in value) {
|
|
97
|
+
const getUsername = value.getUsername;
|
|
98
|
+
return typeof getUsername === 'function' ? getUsername.call(value) : undefined;
|
|
99
|
+
}
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
async writeGithubOutputs(result) {
|
|
103
|
+
const outputFile = process.env.GITHUB_OUTPUT;
|
|
104
|
+
if (!outputFile) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const content = Object.entries(result.githubOutputs)
|
|
108
|
+
.map(([name, value]) => `${name}=${value}`)
|
|
109
|
+
.join('\n');
|
|
110
|
+
await appendFile(outputFile, `${content}\n`, 'utf8');
|
|
111
|
+
}
|
|
112
|
+
reportResult(result) {
|
|
113
|
+
this.log('Smart deployment CI preset');
|
|
114
|
+
this.log(`Mode: ${result.validationMode}`);
|
|
115
|
+
this.log(`Status: ${result.summary.conclusion}`);
|
|
116
|
+
this.log(`Components: ${result.summary.components}`);
|
|
117
|
+
this.log(`Waves: ${result.summary.waves}`);
|
|
118
|
+
this.log(`Blockers: ${result.summary.blockers}`);
|
|
119
|
+
this.log(`Warnings: ${result.summary.warnings}`);
|
|
120
|
+
this.log(`JSON report: ${result.artifacts.jsonPath}`);
|
|
121
|
+
this.log(`HTML report: ${result.artifacts.htmlPath}`);
|
|
122
|
+
this.log(`Exit code: ${result.exitCode}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=preset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preset.js","sourceRoot":"","sources":["../../../src/commands/ci/preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAChG,OAAO,EACL,eAAe,GAGhB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,WAAW,CAAC,CAAC;AAClF,MAAM,MAAM,GAAG,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAC5C,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;AAE9C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,SAAyB;IACtD,MAAM,CAAU,OAAO,GAAG,CAAC,4BAA4B,CAAC,CAAC;IACzD,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MA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AAc,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,GAAG,CAAC,WAAW,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QACrD,IAAI,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,GAAG,CAAC,gBAAgB,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtD,IAAI,CAAC,GAAG,CAAC,gBAAgB,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtD,IAAI,CAAC,GAAG,CAAC,cAAc,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC5C,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { type GraphExportResult } from '../../reports/graph-export-service.js';
|
|
3
|
+
export default class GraphExport extends SfCommand<GraphExportResult> {
|
|
4
|
+
static readonly aliases: string[];
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'source-path': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'report-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'use-ai': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
'org-type': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
industry: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
};
|
|
17
|
+
run(): Promise<GraphExportResult>;
|
|
18
|
+
private reportResult;
|
|
19
|
+
private withJsonConsoleSuppressed;
|
|
20
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Messages } from '@salesforce/core';
|
|
2
|
+
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { DeploymentContextService } from '../../deployment/deployment-context-service.js';
|
|
4
|
+
import { GraphExportService, } from '../../reports/graph-export-service.js';
|
|
5
|
+
import { getLogger } from '../../utils/logger.js';
|
|
6
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
7
|
+
const messages = Messages.loadMessages('@jterrats/smart-deployment', 'graph.export');
|
|
8
|
+
const logger = getLogger('GraphExportCommand');
|
|
9
|
+
const contextService = new DeploymentContextService();
|
|
10
|
+
const exportService = new GraphExportService();
|
|
11
|
+
export default class GraphExport extends SfCommand {
|
|
12
|
+
static aliases = ['smart-deployment graph export'];
|
|
13
|
+
static summary = messages.getMessage('summary');
|
|
14
|
+
static description = messages.getMessage('description');
|
|
15
|
+
static examples = messages.getMessages('examples');
|
|
16
|
+
static flags = {
|
|
17
|
+
'source-path': Flags.string({
|
|
18
|
+
summary: messages.getMessage('flags.source-path.summary'),
|
|
19
|
+
description: messages.getMessage('flags.source-path.description'),
|
|
20
|
+
}),
|
|
21
|
+
'report-dir': Flags.string({
|
|
22
|
+
summary: messages.getMessage('flags.report-dir.summary'),
|
|
23
|
+
description: messages.getMessage('flags.report-dir.description'),
|
|
24
|
+
}),
|
|
25
|
+
output: Flags.string({
|
|
26
|
+
summary: messages.getMessage('flags.output.summary'),
|
|
27
|
+
description: messages.getMessage('flags.output.description'),
|
|
28
|
+
}),
|
|
29
|
+
format: Flags.string({
|
|
30
|
+
summary: messages.getMessage('flags.format.summary'),
|
|
31
|
+
description: messages.getMessage('flags.format.description'),
|
|
32
|
+
options: ['mermaid', 'dot', 'json', 'html'],
|
|
33
|
+
default: 'json',
|
|
34
|
+
char: 'f',
|
|
35
|
+
}),
|
|
36
|
+
'use-ai': Flags.boolean({
|
|
37
|
+
summary: messages.getMessage('flags.use-ai.summary'),
|
|
38
|
+
default: false,
|
|
39
|
+
}),
|
|
40
|
+
'org-type': Flags.string({
|
|
41
|
+
summary: messages.getMessage('flags.org-type.summary'),
|
|
42
|
+
options: ['Production', 'Sandbox', 'Developer'],
|
|
43
|
+
}),
|
|
44
|
+
industry: Flags.string({
|
|
45
|
+
summary: messages.getMessage('flags.industry.summary'),
|
|
46
|
+
}),
|
|
47
|
+
};
|
|
48
|
+
async run() {
|
|
49
|
+
const { flags } = await this.parse(GraphExport);
|
|
50
|
+
const sourcePath = typeof flags['source-path'] === 'string' ? flags['source-path'] : undefined;
|
|
51
|
+
const format = flags.format;
|
|
52
|
+
try {
|
|
53
|
+
const result = await this.withJsonConsoleSuppressed(async () => {
|
|
54
|
+
logger.info('Exporting dependency graph', { sourcePath, format });
|
|
55
|
+
const context = await contextService.buildContext({
|
|
56
|
+
sourcePath,
|
|
57
|
+
useAI: flags['use-ai'] === true,
|
|
58
|
+
orgType: typeof flags['org-type'] === 'string' ? flags['org-type'] : undefined,
|
|
59
|
+
industry: typeof flags.industry === 'string' ? flags.industry : undefined,
|
|
60
|
+
});
|
|
61
|
+
return exportService.generate(context, {
|
|
62
|
+
format,
|
|
63
|
+
outputPath: typeof flags.output === 'string' ? flags.output : undefined,
|
|
64
|
+
reportDir: typeof flags['report-dir'] === 'string' ? flags['report-dir'] : undefined,
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
if (!this.jsonEnabled())
|
|
68
|
+
this.reportResult(result);
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
logger.error('Graph export failed', { error });
|
|
73
|
+
this.error(`Graph export failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
reportResult(result) {
|
|
77
|
+
this.log('Graph export complete');
|
|
78
|
+
this.log(`Format: ${result.format}`);
|
|
79
|
+
this.log(`Output: ${result.path}`);
|
|
80
|
+
this.log(`Components: ${result.report.summary.components}`);
|
|
81
|
+
this.log(`Dependency edges: ${result.report.summary.dependencyEdges}`);
|
|
82
|
+
this.log(`Waves: ${result.report.summary.waves}`);
|
|
83
|
+
this.log(`Cycles: ${result.report.summary.cycles}`);
|
|
84
|
+
}
|
|
85
|
+
async withJsonConsoleSuppressed(operation) {
|
|
86
|
+
if (!this.jsonEnabled())
|
|
87
|
+
return operation();
|
|
88
|
+
// eslint-disable-next-line no-console
|
|
89
|
+
const originalLog = console.log;
|
|
90
|
+
// eslint-disable-next-line no-console
|
|
91
|
+
const originalWarn = console.warn;
|
|
92
|
+
try {
|
|
93
|
+
// eslint-disable-next-line no-console
|
|
94
|
+
console.log = () => { };
|
|
95
|
+
// eslint-disable-next-line no-console
|
|
96
|
+
console.warn = () => { };
|
|
97
|
+
return await operation();
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
// eslint-disable-next-line no-console
|
|
101
|
+
console.log = originalLog;
|
|
102
|
+
// eslint-disable-next-line no-console
|
|
103
|
+
console.warn = originalWarn;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../../src/commands/graph/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,C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AsC;YACtC,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC;QAC9B,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { type ImpactCommandResult } from '../dependencies/impact-analysis-service.js';
|
|
3
|
+
export default class Impact extends SfCommand<ImpactCommandResult> {
|
|
4
|
+
static readonly aliases: string[];
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'source-path': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
base: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
head: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'working-tree': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
'max-depth': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<ImpactCommandResult>;
|
|
16
|
+
private withJsonConsoleSuppressed;
|
|
17
|
+
private reportResult;
|
|
18
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Messages } from '@salesforce/core';
|
|
2
|
+
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
3
|
+
import { ImpactAnalysisService } from '../dependencies/impact-analysis-service.js';
|
|
4
|
+
import { getLogger } from '../utils/logger.js';
|
|
5
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
6
|
+
const messages = Messages.loadMessages('@jterrats/smart-deployment', 'impact');
|
|
7
|
+
const logger = getLogger('ImpactCommand');
|
|
8
|
+
const impactAnalysisService = new ImpactAnalysisService();
|
|
9
|
+
export default class Impact extends SfCommand {
|
|
10
|
+
static aliases = ['smart-deployment impact'];
|
|
11
|
+
static summary = messages.getMessage('summary');
|
|
12
|
+
static description = messages.getMessage('description');
|
|
13
|
+
static examples = messages.getMessages('examples');
|
|
14
|
+
static flags = {
|
|
15
|
+
'source-path': Flags.string({
|
|
16
|
+
summary: messages.getMessage('flags.source-path.summary'),
|
|
17
|
+
description: messages.getMessage('flags.source-path.description'),
|
|
18
|
+
}),
|
|
19
|
+
base: Flags.string({
|
|
20
|
+
summary: messages.getMessage('flags.base.summary'),
|
|
21
|
+
description: messages.getMessage('flags.base.description'),
|
|
22
|
+
}),
|
|
23
|
+
head: Flags.string({
|
|
24
|
+
summary: messages.getMessage('flags.head.summary'),
|
|
25
|
+
description: messages.getMessage('flags.head.description'),
|
|
26
|
+
}),
|
|
27
|
+
'working-tree': Flags.boolean({
|
|
28
|
+
summary: messages.getMessage('flags.working-tree.summary'),
|
|
29
|
+
description: messages.getMessage('flags.working-tree.description'),
|
|
30
|
+
default: false,
|
|
31
|
+
}),
|
|
32
|
+
'max-depth': Flags.integer({
|
|
33
|
+
summary: messages.getMessage('flags.max-depth.summary'),
|
|
34
|
+
description: messages.getMessage('flags.max-depth.description'),
|
|
35
|
+
}),
|
|
36
|
+
};
|
|
37
|
+
async run() {
|
|
38
|
+
const { flags } = await this.parse(Impact);
|
|
39
|
+
try {
|
|
40
|
+
const result = await this.withJsonConsoleSuppressed(async () => impactAnalysisService.analyze({
|
|
41
|
+
sourcePath: typeof flags['source-path'] === 'string' ? flags['source-path'] : undefined,
|
|
42
|
+
base: typeof flags.base === 'string' ? flags.base : undefined,
|
|
43
|
+
head: typeof flags.head === 'string' ? flags.head : undefined,
|
|
44
|
+
workingTree: flags['working-tree'] === true,
|
|
45
|
+
maxDepth: typeof flags['max-depth'] === 'number' ? flags['max-depth'] : undefined,
|
|
46
|
+
}));
|
|
47
|
+
if (!this.jsonEnabled()) {
|
|
48
|
+
this.reportResult(result);
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
logger.error('Impact analysis failed', { error });
|
|
54
|
+
this.error(`Impact analysis failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async withJsonConsoleSuppressed(operation) {
|
|
58
|
+
if (!this.jsonEnabled()) {
|
|
59
|
+
return operation();
|
|
60
|
+
}
|
|
61
|
+
// eslint-disable-next-line no-console
|
|
62
|
+
const originalLog = console.log;
|
|
63
|
+
// eslint-disable-next-line no-console
|
|
64
|
+
const originalWarn = console.warn;
|
|
65
|
+
try {
|
|
66
|
+
// eslint-disable-next-line no-console
|
|
67
|
+
console.log = () => { };
|
|
68
|
+
// eslint-disable-next-line no-console
|
|
69
|
+
console.warn = () => { };
|
|
70
|
+
return await operation();
|
|
71
|
+
}
|
|
72
|
+
finally {
|
|
73
|
+
// eslint-disable-next-line no-console
|
|
74
|
+
console.log = originalLog;
|
|
75
|
+
// eslint-disable-next-line no-console
|
|
76
|
+
console.warn = originalWarn;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
reportResult(result) {
|
|
80
|
+
this.log('Smart deployment impact');
|
|
81
|
+
this.log(`Mode: ${result.mode}`);
|
|
82
|
+
if (result.base && result.head) {
|
|
83
|
+
this.log(`Range: ${result.base}..${result.head}`);
|
|
84
|
+
}
|
|
85
|
+
this.log(`Changed components: ${result.summary.changedComponentCount}`);
|
|
86
|
+
this.log(`Transitive dependents: ${result.summary.transitiveDependentCount}`);
|
|
87
|
+
this.log(`Affected components: ${result.summary.affectedComponentCount}`);
|
|
88
|
+
this.log(`Planned waves: ${result.summary.plannedWaveCount}`);
|
|
89
|
+
this.log(`Suggested Apex tests: ${result.summary.suggestedApexTestCount}`);
|
|
90
|
+
this.log(`Impact level: ${result.summary.overallImpactLevel}`);
|
|
91
|
+
if (result.plannedWaves.length > 0) {
|
|
92
|
+
this.log('');
|
|
93
|
+
this.log('Planned waves');
|
|
94
|
+
for (const wave of result.plannedWaves) {
|
|
95
|
+
this.log(`Wave ${wave.number}: ${wave.components.join(', ')}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const tests = [...result.suggestedApexTests.requiredTests, ...result.suggestedApexTests.recommendedTests];
|
|
99
|
+
if (tests.length > 0) {
|
|
100
|
+
this.log('');
|
|
101
|
+
this.log(`Suggested tests: ${tests.join(', ')}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=impact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impact.js","sourceRoot":"","sources":["../../src/commands/impact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAA4B,MAAM,4CAA4C,CAAC;AAC7G,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,4BAA4B,EAAE,QAAQ,CAAC,CAAC;AAC/E,MAAM,MAAM,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC;AAC1C,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,EAAE,CAAC;AAE1D,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,SAA8B;IACzD,MAAM,CAAU,OAAO,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACtD,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CA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Y,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;YAC1B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;gBACvC,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;QAED,MAAM,KAAK,GAAG,CAAC,GAAG,MAAM,CAAC,kBAAkB,CAAC,aAAa,EAAE,GAAG,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;QAC1G,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,oBAAoB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnD,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { type InitConfigGenerationResult } from '../config/init-config-generation-service.js';
|
|
3
|
+
export default class Init extends SfCommand<InitConfigGenerationResult> {
|
|
4
|
+
static readonly aliases: string[];
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly flags: {
|
|
9
|
+
'source-path': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
'cache-enabled': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
'validation-mode': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'report-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'skip-tests': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
'non-interactive': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
};
|
|
17
|
+
run(): Promise<InitConfigGenerationResult>;
|
|
18
|
+
private reportResult;
|
|
19
|
+
}
|