@padua/cli 1.0.0 → 1.1.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.
- package/dist/commands/init/aws-config.d.ts +25 -0
- package/dist/commands/init/aws-config.d.ts.map +1 -0
- package/dist/commands/init/aws-config.js +91 -0
- package/dist/commands/init/aws-config.js.map +1 -0
- package/dist/commands/init/aws-profile.d.ts +18 -0
- package/dist/commands/init/aws-profile.d.ts.map +1 -0
- package/dist/commands/init/aws-profile.js +127 -0
- package/dist/commands/init/aws-profile.js.map +1 -0
- package/dist/commands/init/index.d.ts +37 -0
- package/dist/commands/init/index.d.ts.map +1 -0
- package/dist/commands/init/index.js +254 -0
- package/dist/commands/init/index.js.map +1 -0
- package/dist/commands/init/init.d.ts +24 -0
- package/dist/commands/init/init.d.ts.map +1 -0
- package/dist/commands/init/init.js +123 -0
- package/dist/commands/init/init.js.map +1 -0
- package/dist/commands/init/prompts.d.ts +127 -0
- package/dist/commands/init/prompts.d.ts.map +1 -0
- package/dist/commands/init/prompts.js +395 -0
- package/dist/commands/init/prompts.js.map +1 -0
- package/dist/commands/login/index.d.ts.map +1 -1
- package/dist/commands/login/index.js.map +1 -1
- package/dist/commands/login/types.js +2 -2
- package/dist/commands/login/types.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +7 -5
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path to AWS CLI configuration file
|
|
3
|
+
*/
|
|
4
|
+
declare const AWS_CONFIG_PATH: string;
|
|
5
|
+
/**
|
|
6
|
+
* Parse AWS config file and extract profile names
|
|
7
|
+
*
|
|
8
|
+
* @returns Array of profile names (e.g., ['default', 'staging', 'production'])
|
|
9
|
+
*
|
|
10
|
+
* Format: [profile name] or [default] for the default profile
|
|
11
|
+
* Returns empty array if file doesn't exist or is invalid
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* Input: ~/.aws/config with [default], [profile staging], [profile prod]
|
|
15
|
+
* Output: ['default', 'staging', 'prod']
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseAWSConfig(): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Get list of AWS SSO profiles
|
|
20
|
+
*
|
|
21
|
+
* Alias for parseAWSConfig with clearer naming
|
|
22
|
+
*/
|
|
23
|
+
export declare function getAWSProfiles(): string[];
|
|
24
|
+
export { AWS_CONFIG_PATH };
|
|
25
|
+
//# sourceMappingURL=aws-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws-config.d.ts","sourceRoot":"","sources":["../../../src/commands/init/aws-config.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,QAAA,MAAM,eAAe,QAA4C,CAAC;AAElE;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,IAAI,MAAM,EAAE,CA0BzC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC;AAGD,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.AWS_CONFIG_PATH = void 0;
|
|
37
|
+
exports.parseAWSConfig = parseAWSConfig;
|
|
38
|
+
exports.getAWSProfiles = getAWSProfiles;
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const os = __importStar(require("os"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
/**
|
|
43
|
+
* Path to AWS CLI configuration file
|
|
44
|
+
*/
|
|
45
|
+
const AWS_CONFIG_PATH = path.join(os.homedir(), '.aws', 'config');
|
|
46
|
+
exports.AWS_CONFIG_PATH = AWS_CONFIG_PATH;
|
|
47
|
+
/**
|
|
48
|
+
* Parse AWS config file and extract profile names
|
|
49
|
+
*
|
|
50
|
+
* @returns Array of profile names (e.g., ['default', 'staging', 'production'])
|
|
51
|
+
*
|
|
52
|
+
* Format: [profile name] or [default] for the default profile
|
|
53
|
+
* Returns empty array if file doesn't exist or is invalid
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* Input: ~/.aws/config with [default], [profile staging], [profile prod]
|
|
57
|
+
* Output: ['default', 'staging', 'prod']
|
|
58
|
+
*/
|
|
59
|
+
function parseAWSConfig() {
|
|
60
|
+
try {
|
|
61
|
+
// Read the config file
|
|
62
|
+
if (!fs.existsSync(AWS_CONFIG_PATH)) {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
const content = fs.readFileSync(AWS_CONFIG_PATH, 'utf-8');
|
|
66
|
+
// Parse profile names from sections
|
|
67
|
+
const profiles = [];
|
|
68
|
+
const sectionRegex = /^\[(?:profile\s+)?(.+?)\]\s*$/gm;
|
|
69
|
+
let match;
|
|
70
|
+
while ((match = sectionRegex.exec(content)) !== null) {
|
|
71
|
+
const profileName = match[1].trim();
|
|
72
|
+
if (profileName) {
|
|
73
|
+
profiles.push(profileName);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return profiles;
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
// Silently fail - init proceeds without profile suggestions
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get list of AWS SSO profiles
|
|
85
|
+
*
|
|
86
|
+
* Alias for parseAWSConfig with clearer naming
|
|
87
|
+
*/
|
|
88
|
+
function getAWSProfiles() {
|
|
89
|
+
return parseAWSConfig();
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=aws-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws-config.js","sourceRoot":"","sources":["../../../src/commands/init/aws-config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,wCA0BC;AAOD,wCAEC;AAxDD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAE7B;;GAEG;AACH,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAoDzD,0CAAe;AAlDxB;;;;;;;;;;;GAWG;AACH,SAAgB,cAAc;IAC5B,IAAI,CAAC;QACH,uBAAuB;QACvB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;YACpC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QAE1D,oCAAoC;QACpC,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,MAAM,YAAY,GAAG,iCAAiC,CAAC;QACvD,IAAI,KAAK,CAAC;QAEV,OAAO,CAAC,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACrD,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACpC,IAAI,WAAW,EAAE,CAAC;gBAChB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,4DAA4D;QAC5D,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,cAAc;IAC5B,OAAO,cAAc,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SSOConfig } from './prompts';
|
|
2
|
+
/**
|
|
3
|
+
* Write SSO profile to ~/.aws/config
|
|
4
|
+
*
|
|
5
|
+
* @param config - SSO configuration to write
|
|
6
|
+
* @param overwrite - If true, replace existing profile; if false, throw error
|
|
7
|
+
* @returns Path to the config file
|
|
8
|
+
*/
|
|
9
|
+
export declare function writeAwsProfile(config: SSOConfig, overwrite?: boolean): Promise<string>;
|
|
10
|
+
/**
|
|
11
|
+
* Check if AWS config file exists and has the specified profile
|
|
12
|
+
*/
|
|
13
|
+
export declare function hasAwsProfile(profileName: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Get the path to AWS config file
|
|
16
|
+
*/
|
|
17
|
+
export declare function getAwsConfigPath(): string;
|
|
18
|
+
//# sourceMappingURL=aws-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws-profile.d.ts","sourceRoot":"","sources":["../../../src/commands/init/aws-profile.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAqCtC;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,SAAS,EACjB,SAAS,GAAE,OAAe,GACzB,OAAO,CAAC,MAAM,CAAC,CAwCjB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAO1D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.writeAwsProfile = writeAwsProfile;
|
|
37
|
+
exports.hasAwsProfile = hasAwsProfile;
|
|
38
|
+
exports.getAwsConfigPath = getAwsConfigPath;
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
const os = __importStar(require("os"));
|
|
42
|
+
const AWS_CONFIG_PATH = path.join(os.homedir(), '.aws', 'config');
|
|
43
|
+
/**
|
|
44
|
+
* Generate AWS config profile content for SSO
|
|
45
|
+
*/
|
|
46
|
+
function generateProfileContent(config) {
|
|
47
|
+
return `[profile ${config.profileName}]
|
|
48
|
+
sso_start_url = ${config.startUrl}
|
|
49
|
+
sso_region = ${config.ssoRegion}
|
|
50
|
+
sso_account_id = ${config.accountId}
|
|
51
|
+
sso_role_name = ${config.roleName}
|
|
52
|
+
region = ${config.defaultRegion}
|
|
53
|
+
output = json`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Check if a profile already exists in AWS config
|
|
57
|
+
*/
|
|
58
|
+
function profileExists(configContent, profileName) {
|
|
59
|
+
const profilePattern = new RegExp(`^\\[profile ${profileName}\\]`, 'm');
|
|
60
|
+
return profilePattern.test(configContent);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Remove an existing profile from AWS config content
|
|
64
|
+
*/
|
|
65
|
+
function removeProfile(configContent, profileName) {
|
|
66
|
+
// Match the profile header and everything until the next profile or end of file
|
|
67
|
+
const profilePattern = new RegExp(`\\[profile ${profileName}\\][^\\[]*`, 'g');
|
|
68
|
+
return configContent.replace(profilePattern, '').trim();
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Write SSO profile to ~/.aws/config
|
|
72
|
+
*
|
|
73
|
+
* @param config - SSO configuration to write
|
|
74
|
+
* @param overwrite - If true, replace existing profile; if false, throw error
|
|
75
|
+
* @returns Path to the config file
|
|
76
|
+
*/
|
|
77
|
+
async function writeAwsProfile(config, overwrite = false) {
|
|
78
|
+
// Ensure ~/.aws directory exists
|
|
79
|
+
const awsDir = path.dirname(AWS_CONFIG_PATH);
|
|
80
|
+
if (!fs.existsSync(awsDir)) {
|
|
81
|
+
fs.mkdirSync(awsDir, { recursive: true, mode: 0o700 });
|
|
82
|
+
}
|
|
83
|
+
// Read existing config if it exists
|
|
84
|
+
let existingContent = '';
|
|
85
|
+
if (fs.existsSync(AWS_CONFIG_PATH)) {
|
|
86
|
+
existingContent = fs.readFileSync(AWS_CONFIG_PATH, 'utf-8');
|
|
87
|
+
}
|
|
88
|
+
// Check if profile already exists
|
|
89
|
+
if (profileExists(existingContent, config.profileName)) {
|
|
90
|
+
if (!overwrite) {
|
|
91
|
+
throw new Error(`Profile '${config.profileName}' already exists in ${AWS_CONFIG_PATH}. ` +
|
|
92
|
+
`Use --force to overwrite.`);
|
|
93
|
+
}
|
|
94
|
+
// Remove existing profile
|
|
95
|
+
existingContent = removeProfile(existingContent, config.profileName);
|
|
96
|
+
}
|
|
97
|
+
// Generate new profile content
|
|
98
|
+
const newProfileContent = generateProfileContent(config);
|
|
99
|
+
// Combine existing content with new profile
|
|
100
|
+
let finalContent;
|
|
101
|
+
if (existingContent.trim()) {
|
|
102
|
+
finalContent = existingContent.trim() + '\n\n' + newProfileContent + '\n';
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
finalContent = newProfileContent + '\n';
|
|
106
|
+
}
|
|
107
|
+
// Write the config file
|
|
108
|
+
fs.writeFileSync(AWS_CONFIG_PATH, finalContent, { mode: 0o600 });
|
|
109
|
+
return AWS_CONFIG_PATH;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Check if AWS config file exists and has the specified profile
|
|
113
|
+
*/
|
|
114
|
+
function hasAwsProfile(profileName) {
|
|
115
|
+
if (!fs.existsSync(AWS_CONFIG_PATH)) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
const content = fs.readFileSync(AWS_CONFIG_PATH, 'utf-8');
|
|
119
|
+
return profileExists(content, profileName);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Get the path to AWS config file
|
|
123
|
+
*/
|
|
124
|
+
function getAwsConfigPath() {
|
|
125
|
+
return AWS_CONFIG_PATH;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=aws-profile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aws-profile.js","sourceRoot":"","sources":["../../../src/commands/init/aws-profile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,0CA2CC;AAKD,sCAOC;AAKD,4CAEC;AA7GD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAGzB,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAElE;;GAEG;AACH,SAAS,sBAAsB,CAAC,MAAiB;IAC/C,OAAO,YAAY,MAAM,CAAC,WAAW;kBACrB,MAAM,CAAC,QAAQ;eAClB,MAAM,CAAC,SAAS;mBACZ,MAAM,CAAC,SAAS;kBACjB,MAAM,CAAC,QAAQ;WACtB,MAAM,CAAC,aAAa;cACjB,CAAC;AACf,C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CAAC;QACD,0BAA0B;QAC1B,eAAe,GAAG,aAAa,CAAC,eAAe,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACvE,CAAC;IAED,+BAA+B;IAC/B,MAAM,iBAAiB,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAEzD,4CAA4C;IAC5C,IAAI,YAAoB,CAAC;IACzB,IAAI,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC;QAC3B,YAAY,GAAG,eAAe,CAAC,IAAI,EAAE,GAAG,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAAC;IAC5E,CAAC;SAAM,CAAC;QACN,YAAY,GAAG,iBAAiB,GAAG,IAAI,CAAC;IAC1C,CAAC;IAED,wBAAwB;IACxB,EAAE,CAAC,aAAa,CAAC,eAAe,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAEjE,OAAO,eAAe,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,WAAmB;IAC/C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAC1D,OAAO,aAAa,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB;IAC9B,OAAO,eAAe,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* Command options for padua init
|
|
4
|
+
*/
|
|
5
|
+
interface InitOptions {
|
|
6
|
+
force?: boolean;
|
|
7
|
+
merge?: boolean;
|
|
8
|
+
verbose?: boolean;
|
|
9
|
+
noColor?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Init command definition
|
|
13
|
+
*/
|
|
14
|
+
export declare const initCommand: Command;
|
|
15
|
+
/**
|
|
16
|
+
* Main handler for init command
|
|
17
|
+
*/
|
|
18
|
+
declare function handleInit(options: InitOptions): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Check if config file exists and determine action
|
|
21
|
+
*
|
|
22
|
+
* Returns:
|
|
23
|
+
* - 'overwrite': Proceed with overwrite (new file or user chose overwrite)
|
|
24
|
+
* - 'merge': Proceed with merge (existing file and user chose merge, or --merge)
|
|
25
|
+
* - 'cancel': Exit without changes (user chose cancel)
|
|
26
|
+
*
|
|
27
|
+
* Exit codes on conflict:
|
|
28
|
+
* - Process may exit with code 2 if user chooses cancel in interactive dialog
|
|
29
|
+
*/
|
|
30
|
+
declare function checkExistingConfig(options: InitOptions): Promise<'overwrite' | 'merge' | 'cancel'>;
|
|
31
|
+
/**
|
|
32
|
+
* Display conflict resolution dialog to user
|
|
33
|
+
* Returns user's choice or exits with code 2
|
|
34
|
+
*/
|
|
35
|
+
declare function showConflictDialog(configPath: string, noColor?: boolean): Promise<'overwrite' | 'merge' | 'cancel'>;
|
|
36
|
+
export { checkExistingConfig, showConflictDialog, handleInit };
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC;;GAEG;AACH,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,SAMH,CAAC;AAEtB;;GAEG;AACH,iBAAe,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA+F7D;AAED;;;;;;;;;;GAUG;AACH,iBAAe,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAC,CAoBlG;AAED;;;GAGG;AACH,iBAAe,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAC,CAkEzH;AAGD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.initCommand = void 0;
|
|
40
|
+
exports.checkExistingConfig = checkExistingConfig;
|
|
41
|
+
exports.showConflictDialog = showConflictDialog;
|
|
42
|
+
exports.handleInit = handleInit;
|
|
43
|
+
const commander_1 = require("commander");
|
|
44
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
45
|
+
const fs = __importStar(require("fs"));
|
|
46
|
+
const path = __importStar(require("path"));
|
|
47
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
48
|
+
const config_1 = require("../login/config");
|
|
49
|
+
const prompts_1 = require("./prompts");
|
|
50
|
+
const init_1 = require("./init");
|
|
51
|
+
const aws_profile_1 = require("./aws-profile");
|
|
52
|
+
/**
|
|
53
|
+
* Init command definition
|
|
54
|
+
*/
|
|
55
|
+
exports.initCommand = new commander_1.Command('init')
|
|
56
|
+
.description('Initialize AWS SSO profile and padua.config.json with interactive prompts')
|
|
57
|
+
.option('--force', 'Overwrite existing config without prompting')
|
|
58
|
+
.option('--merge', 'Merge into existing config (preserve unspecified values)')
|
|
59
|
+
.option('--no-color', 'Disable colored output')
|
|
60
|
+
.option('-v, --verbose', 'Show detailed progress information')
|
|
61
|
+
.action(handleInit);
|
|
62
|
+
/**
|
|
63
|
+
* Main handler for init command
|
|
64
|
+
*/
|
|
65
|
+
async function handleInit(options) {
|
|
66
|
+
try {
|
|
67
|
+
// Step 1: Check for existing config file
|
|
68
|
+
const conflictAction = await checkExistingConfig(options);
|
|
69
|
+
if (conflictAction === 'cancel') {
|
|
70
|
+
process.exit(1); // User cancelled
|
|
71
|
+
}
|
|
72
|
+
// Step 2: Load existing config if merging
|
|
73
|
+
let existingConfig = null;
|
|
74
|
+
if (conflictAction === 'merge') {
|
|
75
|
+
existingConfig = await (0, config_1.loadConfig)();
|
|
76
|
+
if (options.verbose && !options.noColor) {
|
|
77
|
+
console.log(chalk_1.default.blue('ℹ Loading existing config for merge...'));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Step 3: Run prompt flow
|
|
81
|
+
if (!options.noColor) {
|
|
82
|
+
console.log(chalk_1.default.blue('✓ Starting configuration wizard...\n'));
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
console.log('Starting configuration wizard...\n');
|
|
86
|
+
}
|
|
87
|
+
let paduaConfig;
|
|
88
|
+
let ssoConfig;
|
|
89
|
+
try {
|
|
90
|
+
const result = await (0, prompts_1.runPrompts)(existingConfig);
|
|
91
|
+
paduaConfig = result.paduaConfig;
|
|
92
|
+
ssoConfig = result.ssoConfig;
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
const err = error;
|
|
96
|
+
if (err.isTtyError) {
|
|
97
|
+
console.error('Error: Interactive prompts not supported in this environment');
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
// User cancelled (Ctrl+C or explicit cancel)
|
|
101
|
+
if (options.verbose && !options.noColor) {
|
|
102
|
+
console.log(chalk_1.default.yellow('✗ Initialization cancelled'));
|
|
103
|
+
}
|
|
104
|
+
else if (options.verbose) {
|
|
105
|
+
console.log('Initialization cancelled');
|
|
106
|
+
}
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
// Step 4: Write AWS SSO profile to ~/.aws/config
|
|
110
|
+
try {
|
|
111
|
+
const awsConfigPath = await (0, aws_profile_1.writeAwsProfile)(ssoConfig, options.force || conflictAction === 'overwrite');
|
|
112
|
+
if (!options.noColor) {
|
|
113
|
+
console.log(chalk_1.default.green(`✓ AWS profile '${ssoConfig.profileName}' saved to ${awsConfigPath}`));
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
console.log(`AWS profile '${ssoConfig.profileName}' saved to ${awsConfigPath}`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
const msg = error.message;
|
|
121
|
+
if (!options.noColor) {
|
|
122
|
+
console.error(chalk_1.default.red(`✗ Failed to save AWS profile: ${msg}`));
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
console.error(`Failed to save AWS profile: ${msg}`);
|
|
126
|
+
}
|
|
127
|
+
process.exit(4); // File system error
|
|
128
|
+
}
|
|
129
|
+
// Step 5: Write padua.config.json
|
|
130
|
+
try {
|
|
131
|
+
await (0, init_1.initializeConfig)(paduaConfig, conflictAction === 'overwrite');
|
|
132
|
+
if (!options.noColor) {
|
|
133
|
+
console.log(chalk_1.default.green('✓ padua.config.json saved successfully!'));
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
console.log('padua.config.json saved successfully!');
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
const msg = error.message;
|
|
141
|
+
if (!options.noColor) {
|
|
142
|
+
console.error(chalk_1.default.red(`✗ Failed to save configuration: ${msg}`));
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
console.error(`Failed to save configuration: ${msg}`);
|
|
146
|
+
}
|
|
147
|
+
process.exit(4); // File system error
|
|
148
|
+
}
|
|
149
|
+
// Step 6: Display next steps
|
|
150
|
+
(0, init_1.displayNextSteps)(paduaConfig, options.noColor);
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
// Catch any unexpected errors
|
|
154
|
+
console.error(`Unexpected error: ${error.message}`);
|
|
155
|
+
process.exit(1);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Check if config file exists and determine action
|
|
160
|
+
*
|
|
161
|
+
* Returns:
|
|
162
|
+
* - 'overwrite': Proceed with overwrite (new file or user chose overwrite)
|
|
163
|
+
* - 'merge': Proceed with merge (existing file and user chose merge, or --merge)
|
|
164
|
+
* - 'cancel': Exit without changes (user chose cancel)
|
|
165
|
+
*
|
|
166
|
+
* Exit codes on conflict:
|
|
167
|
+
* - Process may exit with code 2 if user chooses cancel in interactive dialog
|
|
168
|
+
*/
|
|
169
|
+
async function checkExistingConfig(options) {
|
|
170
|
+
const configPath = path.join(process.cwd(), 'padua.config.json');
|
|
171
|
+
const fileExists = fs.existsSync(configPath);
|
|
172
|
+
// No file exists - proceed with overwrite (which creates new file)
|
|
173
|
+
if (!fileExists) {
|
|
174
|
+
return 'overwrite';
|
|
175
|
+
}
|
|
176
|
+
// File exists - check CLI flags first
|
|
177
|
+
if (options.force) {
|
|
178
|
+
return 'overwrite';
|
|
179
|
+
}
|
|
180
|
+
if (options.merge) {
|
|
181
|
+
return 'merge';
|
|
182
|
+
}
|
|
183
|
+
// File exists, no flags - show interactive dialog
|
|
184
|
+
return await showConflictDialog(configPath, options.noColor);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Display conflict resolution dialog to user
|
|
188
|
+
* Returns user's choice or exits with code 2
|
|
189
|
+
*/
|
|
190
|
+
async function showConflictDialog(configPath, noColor = false) {
|
|
191
|
+
// Read existing config to show summary
|
|
192
|
+
let existing = null;
|
|
193
|
+
try {
|
|
194
|
+
existing = await (0, config_1.loadConfig)();
|
|
195
|
+
}
|
|
196
|
+
catch (e) {
|
|
197
|
+
// Config file exists but may be invalid - still ask what to do
|
|
198
|
+
}
|
|
199
|
+
// Display existing config summary
|
|
200
|
+
console.log('');
|
|
201
|
+
if (!noColor) {
|
|
202
|
+
console.log(chalk_1.default.yellow('⚠ Configuration file already exists: ./padua.config.json'));
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
console.log('Warning: Configuration file already exists: ./padua.config.json');
|
|
206
|
+
}
|
|
207
|
+
if (existing) {
|
|
208
|
+
console.log('');
|
|
209
|
+
console.log('Current configuration:');
|
|
210
|
+
console.log(` Profile: ${existing.defaultProfile || '(not set)'}`);
|
|
211
|
+
console.log(` Region: ${existing.region || '(not set)'}`);
|
|
212
|
+
if (existing.codeartifact) {
|
|
213
|
+
console.log(` CodeArtifact: configured`);
|
|
214
|
+
}
|
|
215
|
+
if (existing.ecr) {
|
|
216
|
+
console.log(` ECR: configured`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
console.log('');
|
|
220
|
+
// Show conflict options
|
|
221
|
+
const answer = await inquirer_1.default.prompt([
|
|
222
|
+
{
|
|
223
|
+
type: 'list',
|
|
224
|
+
name: 'action',
|
|
225
|
+
message: 'What would you like to do?',
|
|
226
|
+
choices: [
|
|
227
|
+
{
|
|
228
|
+
name: 'Overwrite - Replace existing config completely',
|
|
229
|
+
value: 'overwrite'
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: 'Merge - Update only changed values, keep others',
|
|
233
|
+
value: 'merge'
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: 'Cancel - Do not modify existing config',
|
|
237
|
+
value: 'cancel'
|
|
238
|
+
}
|
|
239
|
+
],
|
|
240
|
+
default: 'cancel'
|
|
241
|
+
}
|
|
242
|
+
]);
|
|
243
|
+
if (answer.action === 'cancel') {
|
|
244
|
+
if (!noColor) {
|
|
245
|
+
console.log(chalk_1.default.gray('Operation cancelled. Existing config preserved.'));
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
console.log('Operation cancelled. Existing config preserved.');
|
|
249
|
+
}
|
|
250
|
+
process.exit(2); // Exit code 2 for conflict
|
|
251
|
+
}
|
|
252
|
+
return answer.action;
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src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C,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC,CAAC;QAC7E,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAE,2BAA2B;IAC/C,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PaduaConfig } from '../login/types';
|
|
2
|
+
/**
|
|
3
|
+
* Initialize config by writing to padua.config.json
|
|
4
|
+
*
|
|
5
|
+
* @param config - Configuration object to write
|
|
6
|
+
* @param _overwrite - If true, replaces file; if false, may merge
|
|
7
|
+
* @throws Error if file write fails
|
|
8
|
+
*/
|
|
9
|
+
export declare function initializeConfig(config: PaduaConfig, _overwrite: boolean): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Format PaduaConfig as pretty-printed JSON
|
|
12
|
+
*
|
|
13
|
+
* @param config - Configuration to format
|
|
14
|
+
* @returns Formatted JSON string with 2-space indentation
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatConfigJson(config: PaduaConfig): string;
|
|
17
|
+
/**
|
|
18
|
+
* Display success message and next steps
|
|
19
|
+
*
|
|
20
|
+
* @param config - The configuration that was saved
|
|
21
|
+
* @param noColor - Whether to disable colored output
|
|
22
|
+
*/
|
|
23
|
+
export declare function displayNextSteps(config: PaduaConfig, noColor?: boolean): void;
|
|
24
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init/init.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B9F;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAkB5D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,GAAE,OAAe,GAAG,IAAI,CAgBpF"}
|