qa360 2.1.1 → 2.1.2

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.
@@ -8,7 +8,10 @@ export declare class QA360Secrets {
8
8
  /**
9
9
  * Add a secret
10
10
  */
11
- add(secretName?: string): Promise<{
11
+ add(secretName?: string, options?: {
12
+ value?: string;
13
+ nonInteractive?: boolean;
14
+ }): Promise<{
12
15
  success: boolean;
13
16
  exitCode: number;
14
17
  }>;
@@ -43,7 +46,10 @@ export declare class QA360Secrets {
43
46
  exitCode: number;
44
47
  }>;
45
48
  }
46
- export declare function secretsAddCommand(secretName?: string): Promise<void>;
49
+ export declare function secretsAddCommand(secretName?: string, options?: {
50
+ value?: string;
51
+ nonInteractive?: boolean;
52
+ }): Promise<void>;
47
53
  export declare function secretsListCommand(): Promise<void>;
48
54
  export declare function secretsRemoveCommand(secretName?: string): Promise<void>;
49
55
  export declare function secretsDoctorCommand(): Promise<void>;
@@ -14,12 +14,17 @@ export class QA360Secrets {
14
14
  /**
15
15
  * Add a secret
16
16
  */
17
- async add(secretName) {
17
+ async add(secretName, options = {}) {
18
18
  try {
19
19
  let name = secretName;
20
20
  let value;
21
- // Interactive mode if no name provided
21
+ // Interactive mode if no name provided (and not non-interactive)
22
22
  if (!name) {
23
+ if (options.nonInteractive) {
24
+ console.log(chalk.red('❌ Nom du secret requis en mode non-interactif'));
25
+ console.log(chalk.yellow('💡 Usage: qa360 secrets add <NOM> --value <VALUE> --non-interactive'));
26
+ return { success: false, exitCode: 1 };
27
+ }
23
28
  const nameAnswer = await inquirer.prompt([{
24
29
  type: 'input',
25
30
  name: 'secretName',
@@ -39,22 +44,29 @@ export class QA360Secrets {
39
44
  console.log(chalk.yellow('💡 Format requis: MAJUSCULES_AVEC_UNDERSCORES (ex: API_TOKEN)'));
40
45
  return { success: false, exitCode: 1 };
41
46
  }
42
- // Get secret value securely
43
- const valueAnswer = await inquirer.prompt([{
44
- type: 'password',
45
- name: 'secretValue',
46
- message: `Valeur pour ${name}:`,
47
- mask: '*',
48
- validate: (input) => {
49
- if (!input.trim()) {
50
- return 'La valeur ne peut pas être vide';
47
+ // Get secret value
48
+ if (options.value) {
49
+ // Non-interactive mode: value provided via option
50
+ value = options.value;
51
+ }
52
+ else {
53
+ // Interactive mode: prompt for value
54
+ const valueAnswer = await inquirer.prompt([{
55
+ type: 'password',
56
+ name: 'secretValue',
57
+ message: `Valeur pour ${name}:`,
58
+ mask: '*',
59
+ validate: (input) => {
60
+ if (!input.trim()) {
61
+ return 'La valeur ne peut pas être vide';
62
+ }
63
+ return true;
51
64
  }
52
- return true;
53
- }
54
- }]);
55
- value = valueAnswer.secretValue;
56
- // Check if it looks like a secret
57
- if (!SecretsCrypto.looksLikeSecret(value)) {
65
+ }]);
66
+ value = valueAnswer.secretValue;
67
+ }
68
+ // Check if it looks like a secret (skip in non-interactive mode)
69
+ if (!options.nonInteractive && !SecretsCrypto.looksLikeSecret(value)) {
58
70
  const confirmAnswer = await inquirer.prompt([{
59
71
  type: 'confirm',
60
72
  name: 'confirm',
@@ -250,9 +262,9 @@ export class QA360Secrets {
250
262
  }
251
263
  }
252
264
  // Command handlers
253
- export async function secretsAddCommand(secretName) {
265
+ export async function secretsAddCommand(secretName, options) {
254
266
  const secrets = new QA360Secrets();
255
- const result = await secrets.add(secretName);
267
+ const result = await secrets.add(secretName, options);
256
268
  process.exit(result.exitCode);
257
269
  }
258
270
  export async function secretsListCommand() {
package/dist/index.js CHANGED
@@ -172,8 +172,10 @@ const secretsCommand = program
172
172
  secretsCommand
173
173
  .command('add [name]')
174
174
  .description('Add or update a secret')
175
- .action(async (name) => {
176
- await secretsAddCommand(name);
175
+ .option('-v, --value <value>', 'Secret value (for non-interactive mode)')
176
+ .option('-n, --non-interactive', 'Disable all prompts and confirmations')
177
+ .action(async (name, options) => {
178
+ await secretsAddCommand(name, options);
177
179
  });
178
180
  secretsCommand
179
181
  .command('list')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qa360",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "QA360 Proof CLI - Quality as Cryptographic Proof",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",