devvami 1.4.2 → 1.5.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 (96) hide show
  1. package/README.md +7 -0
  2. package/oclif.manifest.json +129 -89
  3. package/package.json +2 -1
  4. package/src/commands/auth/login.js +20 -16
  5. package/src/commands/changelog.js +12 -12
  6. package/src/commands/costs/get.js +14 -24
  7. package/src/commands/costs/trend.js +13 -24
  8. package/src/commands/create/repo.js +72 -54
  9. package/src/commands/docs/list.js +29 -25
  10. package/src/commands/docs/projects.js +58 -24
  11. package/src/commands/docs/read.js +56 -39
  12. package/src/commands/docs/search.js +37 -25
  13. package/src/commands/doctor.js +37 -35
  14. package/src/commands/dotfiles/add.js +51 -39
  15. package/src/commands/dotfiles/setup.js +62 -33
  16. package/src/commands/dotfiles/status.js +18 -18
  17. package/src/commands/dotfiles/sync.js +62 -46
  18. package/src/commands/init.js +143 -132
  19. package/src/commands/logs/index.js +10 -16
  20. package/src/commands/open.js +12 -12
  21. package/src/commands/pipeline/logs.js +8 -11
  22. package/src/commands/pipeline/rerun.js +21 -16
  23. package/src/commands/pipeline/status.js +28 -24
  24. package/src/commands/pr/create.js +40 -27
  25. package/src/commands/pr/detail.js +9 -7
  26. package/src/commands/pr/review.js +18 -19
  27. package/src/commands/pr/status.js +27 -21
  28. package/src/commands/prompts/browse.js +15 -15
  29. package/src/commands/prompts/download.js +15 -16
  30. package/src/commands/prompts/install-speckit.js +11 -12
  31. package/src/commands/prompts/list.js +12 -12
  32. package/src/commands/prompts/run.js +16 -19
  33. package/src/commands/repo/list.js +57 -41
  34. package/src/commands/search.js +20 -18
  35. package/src/commands/security/setup.js +38 -34
  36. package/src/commands/sync-config-ai/index.js +143 -0
  37. package/src/commands/tasks/assigned.js +43 -33
  38. package/src/commands/tasks/list.js +43 -33
  39. package/src/commands/tasks/today.js +32 -30
  40. package/src/commands/upgrade.js +18 -17
  41. package/src/commands/vuln/detail.js +8 -8
  42. package/src/commands/vuln/scan.js +39 -20
  43. package/src/commands/vuln/search.js +23 -18
  44. package/src/commands/welcome.js +2 -2
  45. package/src/commands/whoami.js +19 -23
  46. package/src/formatters/ai-config.js +127 -0
  47. package/src/formatters/charts.js +6 -23
  48. package/src/formatters/cost.js +1 -7
  49. package/src/formatters/dotfiles.js +48 -19
  50. package/src/formatters/markdown.js +11 -6
  51. package/src/formatters/openapi.js +7 -9
  52. package/src/formatters/prompts.js +69 -78
  53. package/src/formatters/security.js +2 -2
  54. package/src/formatters/status.js +1 -1
  55. package/src/formatters/table.js +1 -3
  56. package/src/formatters/vuln.js +33 -20
  57. package/src/help.js +162 -164
  58. package/src/hooks/init.js +1 -3
  59. package/src/hooks/postrun.js +5 -7
  60. package/src/index.js +1 -1
  61. package/src/services/ai-config-store.js +318 -0
  62. package/src/services/ai-env-deployer.js +444 -0
  63. package/src/services/ai-env-scanner.js +242 -0
  64. package/src/services/audit-detector.js +2 -2
  65. package/src/services/audit-runner.js +40 -31
  66. package/src/services/auth.js +9 -9
  67. package/src/services/awesome-copilot.js +7 -4
  68. package/src/services/aws-costs.js +22 -22
  69. package/src/services/clickup.js +26 -26
  70. package/src/services/cloudwatch-logs.js +5 -9
  71. package/src/services/config.js +13 -13
  72. package/src/services/docs.js +19 -20
  73. package/src/services/dotfiles.js +149 -51
  74. package/src/services/github.js +22 -24
  75. package/src/services/nvd.js +21 -31
  76. package/src/services/platform.js +2 -2
  77. package/src/services/prompts.js +23 -35
  78. package/src/services/security.js +135 -61
  79. package/src/services/shell.js +4 -4
  80. package/src/services/skills-sh.js +3 -9
  81. package/src/services/speckit.js +4 -7
  82. package/src/services/version-check.js +10 -10
  83. package/src/types.js +85 -0
  84. package/src/utils/aws-vault.js +18 -41
  85. package/src/utils/banner.js +5 -7
  86. package/src/utils/errors.js +42 -46
  87. package/src/utils/frontmatter.js +4 -4
  88. package/src/utils/gradient.js +18 -16
  89. package/src/utils/open-browser.js +3 -3
  90. package/src/utils/tui/form.js +1006 -0
  91. package/src/utils/tui/modal.js +15 -14
  92. package/src/utils/tui/navigable-table.js +16 -16
  93. package/src/utils/tui/tab-tui.js +800 -0
  94. package/src/utils/typewriter.js +3 -3
  95. package/src/utils/welcome.js +18 -21
  96. package/src/validators/repo-name.js +2 -2
package/README.md CHANGED
@@ -284,6 +284,13 @@ Built with:
284
284
  - [ora](https://github.com/sindresorhus/ora) — Spinners
285
285
  - [keytar](https://github.com/atom/node-keytar) — Secure credentials
286
286
  - [@inquirer/prompts](https://github.com/SBoudrias/Inquirer.js) — Interactive prompts
287
+ - [execa](https://github.com/sindresorhus/execa) — Process execution
288
+ - [js-yaml](https://github.com/nodeca/js-yaml) — YAML parsing
289
+ - [marked](https://github.com/markedjs/marked) — Markdown parsing
290
+ - [figlet](https://github.com/patorjk/figlet.js) — ASCII art banners
291
+ - [open](https://github.com/sindresorhus/open) — Browser/app launcher
292
+ - [@aws-sdk](https://github.com/aws/aws-sdk-js-v3) — AWS services integration
293
+ - [pako](https://github.com/nodeca/pako) — Compression utilities
287
294
 
288
295
  ---
289
296
 
@@ -520,6 +520,94 @@
520
520
  "trend.js"
521
521
  ]
522
522
  },
523
+ "create:repo": {
524
+ "aliases": [],
525
+ "args": {
526
+ "template": {
527
+ "description": "Nome del template",
528
+ "name": "template",
529
+ "required": false
530
+ }
531
+ },
532
+ "description": "Crea nuovo progetto da template GitHub o lista i template disponibili",
533
+ "examples": [
534
+ "<%= config.bin %> create repo --list",
535
+ "<%= config.bin %> create repo --list --search \"lambda\"",
536
+ "<%= config.bin %> create repo template-lambda",
537
+ "<%= config.bin %> create repo template-lambda --name my-service --dry-run"
538
+ ],
539
+ "flags": {
540
+ "json": {
541
+ "description": "Format output as json.",
542
+ "helpGroup": "GLOBAL",
543
+ "name": "json",
544
+ "allowNo": false,
545
+ "type": "boolean"
546
+ },
547
+ "list": {
548
+ "description": "Lista template disponibili",
549
+ "name": "list",
550
+ "allowNo": false,
551
+ "type": "boolean"
552
+ },
553
+ "search": {
554
+ "char": "s",
555
+ "description": "Cerca in nome e descrizione dei template (case-insensitive)",
556
+ "name": "search",
557
+ "hasDynamicHelp": false,
558
+ "multiple": false,
559
+ "type": "option"
560
+ },
561
+ "name": {
562
+ "description": "Nome del nuovo repository",
563
+ "name": "name",
564
+ "hasDynamicHelp": false,
565
+ "multiple": false,
566
+ "type": "option"
567
+ },
568
+ "description": {
569
+ "description": "Descrizione del repository",
570
+ "name": "description",
571
+ "default": "",
572
+ "hasDynamicHelp": false,
573
+ "multiple": false,
574
+ "type": "option"
575
+ },
576
+ "private": {
577
+ "description": "Repository privato (default)",
578
+ "name": "private",
579
+ "allowNo": false,
580
+ "type": "boolean"
581
+ },
582
+ "public": {
583
+ "description": "Repository pubblico",
584
+ "name": "public",
585
+ "allowNo": false,
586
+ "type": "boolean"
587
+ },
588
+ "dry-run": {
589
+ "description": "Preview senza eseguire",
590
+ "name": "dry-run",
591
+ "allowNo": false,
592
+ "type": "boolean"
593
+ }
594
+ },
595
+ "hasDynamicHelp": false,
596
+ "hiddenAliases": [],
597
+ "id": "create:repo",
598
+ "pluginAlias": "devvami",
599
+ "pluginName": "devvami",
600
+ "pluginType": "core",
601
+ "strict": true,
602
+ "enableJsonFlag": true,
603
+ "isESM": true,
604
+ "relativePath": [
605
+ "src",
606
+ "commands",
607
+ "create",
608
+ "repo.js"
609
+ ]
610
+ },
523
611
  "docs:list": {
524
612
  "aliases": [],
525
613
  "args": {},
@@ -725,94 +813,6 @@
725
813
  "search.js"
726
814
  ]
727
815
  },
728
- "create:repo": {
729
- "aliases": [],
730
- "args": {
731
- "template": {
732
- "description": "Nome del template",
733
- "name": "template",
734
- "required": false
735
- }
736
- },
737
- "description": "Crea nuovo progetto da template GitHub o lista i template disponibili",
738
- "examples": [
739
- "<%= config.bin %> create repo --list",
740
- "<%= config.bin %> create repo --list --search \"lambda\"",
741
- "<%= config.bin %> create repo template-lambda",
742
- "<%= config.bin %> create repo template-lambda --name my-service --dry-run"
743
- ],
744
- "flags": {
745
- "json": {
746
- "description": "Format output as json.",
747
- "helpGroup": "GLOBAL",
748
- "name": "json",
749
- "allowNo": false,
750
- "type": "boolean"
751
- },
752
- "list": {
753
- "description": "Lista template disponibili",
754
- "name": "list",
755
- "allowNo": false,
756
- "type": "boolean"
757
- },
758
- "search": {
759
- "char": "s",
760
- "description": "Cerca in nome e descrizione dei template (case-insensitive)",
761
- "name": "search",
762
- "hasDynamicHelp": false,
763
- "multiple": false,
764
- "type": "option"
765
- },
766
- "name": {
767
- "description": "Nome del nuovo repository",
768
- "name": "name",
769
- "hasDynamicHelp": false,
770
- "multiple": false,
771
- "type": "option"
772
- },
773
- "description": {
774
- "description": "Descrizione del repository",
775
- "name": "description",
776
- "default": "",
777
- "hasDynamicHelp": false,
778
- "multiple": false,
779
- "type": "option"
780
- },
781
- "private": {
782
- "description": "Repository privato (default)",
783
- "name": "private",
784
- "allowNo": false,
785
- "type": "boolean"
786
- },
787
- "public": {
788
- "description": "Repository pubblico",
789
- "name": "public",
790
- "allowNo": false,
791
- "type": "boolean"
792
- },
793
- "dry-run": {
794
- "description": "Preview senza eseguire",
795
- "name": "dry-run",
796
- "allowNo": false,
797
- "type": "boolean"
798
- }
799
- },
800
- "hasDynamicHelp": false,
801
- "hiddenAliases": [],
802
- "id": "create:repo",
803
- "pluginAlias": "devvami",
804
- "pluginName": "devvami",
805
- "pluginType": "core",
806
- "strict": true,
807
- "enableJsonFlag": true,
808
- "isESM": true,
809
- "relativePath": [
810
- "src",
811
- "commands",
812
- "create",
813
- "repo.js"
814
- ]
815
- },
816
816
  "dotfiles:add": {
817
817
  "aliases": [],
818
818
  "args": {
@@ -1742,6 +1742,46 @@
1742
1742
  "list.js"
1743
1743
  ]
1744
1744
  },
1745
+ "sync-config-ai": {
1746
+ "aliases": [],
1747
+ "args": {},
1748
+ "description": "Manage AI coding tool configurations across environments via TUI",
1749
+ "examples": [
1750
+ "<%= config.bin %> sync-config-ai",
1751
+ "<%= config.bin %> sync-config-ai --json"
1752
+ ],
1753
+ "flags": {
1754
+ "json": {
1755
+ "description": "Format output as json.",
1756
+ "helpGroup": "GLOBAL",
1757
+ "name": "json",
1758
+ "allowNo": false,
1759
+ "type": "boolean"
1760
+ },
1761
+ "help": {
1762
+ "char": "h",
1763
+ "description": "Show CLI help.",
1764
+ "name": "help",
1765
+ "allowNo": false,
1766
+ "type": "boolean"
1767
+ }
1768
+ },
1769
+ "hasDynamicHelp": false,
1770
+ "hiddenAliases": [],
1771
+ "id": "sync-config-ai",
1772
+ "pluginAlias": "devvami",
1773
+ "pluginName": "devvami",
1774
+ "pluginType": "core",
1775
+ "strict": true,
1776
+ "enableJsonFlag": true,
1777
+ "isESM": true,
1778
+ "relativePath": [
1779
+ "src",
1780
+ "commands",
1781
+ "sync-config-ai",
1782
+ "index.js"
1783
+ ]
1784
+ },
1745
1785
  "security:setup": {
1746
1786
  "aliases": [],
1747
1787
  "args": {},
@@ -2120,5 +2160,5 @@
2120
2160
  ]
2121
2161
  }
2122
2162
  },
2123
- "version": "1.4.2"
2163
+ "version": "1.5.0"
2124
2164
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "devvami",
3
3
  "description": "DevEx CLI for developers and teams — manage repos, PRs, pipelines, tasks, and costs from the terminal",
4
- "version": "1.4.2",
4
+ "version": "1.5.0",
5
5
  "author": "",
6
6
  "type": "module",
7
7
  "bin": {
@@ -139,6 +139,7 @@
139
139
  "test:integration": "vitest run --project integration",
140
140
  "test:watch": "vitest",
141
141
  "test:coverage": "vitest run --coverage",
142
+ "pretest": "oclif manifest",
142
143
  "prepack": "oclif manifest",
143
144
  "postpack": "shx rm -f oclif.manifest.json",
144
145
  "prepare": "lefthook install"
@@ -1,8 +1,8 @@
1
- import { Command, Flags } from '@oclif/core'
1
+ import {Command, Flags} from '@oclif/core'
2
2
  import chalk from 'chalk'
3
3
  import ora from 'ora'
4
- import { checkGitHubAuth, loginGitHub, checkAWSAuth, loginAWS } from '../../services/auth.js'
5
- import { loadConfig } from '../../services/config.js'
4
+ import {checkGitHubAuth, loginGitHub, checkAWSAuth, loginAWS} from '../../services/auth.js'
5
+ import {loadConfig} from '../../services/config.js'
6
6
 
7
7
  export default class AuthLogin extends Command {
8
8
  static description = 'Autenticazione centralizzata GitHub + AWS'
@@ -16,36 +16,38 @@ export default class AuthLogin extends Command {
16
16
  static enableJsonFlag = true
17
17
 
18
18
  static flags = {
19
- github: Flags.boolean({ description: 'Solo autenticazione GitHub', default: false }),
20
- aws: Flags.boolean({ description: 'Solo autenticazione AWS', default: false }),
21
- verbose: Flags.boolean({ description: 'Output dettagliato', default: false }),
19
+ github: Flags.boolean({description: 'Solo autenticazione GitHub', default: false}),
20
+ aws: Flags.boolean({description: 'Solo autenticazione AWS', default: false}),
21
+ verbose: Flags.boolean({description: 'Output dettagliato', default: false}),
22
22
  }
23
23
 
24
24
  async run() {
25
- const { flags } = await this.parse(AuthLogin)
25
+ const {flags} = await this.parse(AuthLogin)
26
26
  const isJson = flags.json
27
27
  const doGitHub = !flags.aws || flags.github
28
28
  const doAWS = !flags.github || flags.aws
29
29
 
30
- const result = { github: null, aws: null }
30
+ const result = {github: null, aws: null}
31
31
 
32
32
  // GitHub auth
33
33
  if (doGitHub) {
34
- const spinner = isJson ? null : ora({ spinner: 'arc', color: false, text: chalk.hex('#FF6B2B')('Checking GitHub auth...') }).start()
34
+ const spinner = isJson
35
+ ? null
36
+ : ora({spinner: 'arc', color: false, text: chalk.hex('#FF6B2B')('Checking GitHub auth...')}).start()
35
37
  let ghStatus = await checkGitHubAuth()
36
38
 
37
39
  if (ghStatus.authenticated) {
38
40
  spinner?.succeed(`GitHub: already authenticated as @${ghStatus.username}`)
39
- result.github = { status: 'ok', username: ghStatus.username, org: '' }
41
+ result.github = {status: 'ok', username: ghStatus.username, org: ''}
40
42
  } else {
41
43
  if (spinner) spinner.text = 'Logging in to GitHub...'
42
44
  ghStatus = await loginGitHub()
43
45
  if (ghStatus.authenticated) {
44
46
  spinner?.succeed(`GitHub: authenticated as @${ghStatus.username}`)
45
- result.github = { status: 'ok', username: ghStatus.username, org: '' }
47
+ result.github = {status: 'ok', username: ghStatus.username, org: ''}
46
48
  } else {
47
49
  spinner?.fail('GitHub authentication failed')
48
- result.github = { status: 'error', error: ghStatus.error }
50
+ result.github = {status: 'error', error: ghStatus.error}
49
51
  }
50
52
  }
51
53
  }
@@ -53,21 +55,23 @@ export default class AuthLogin extends Command {
53
55
  // AWS auth
54
56
  if (doAWS) {
55
57
  const config = await loadConfig()
56
- const spinner = isJson ? null : ora({ spinner: 'arc', color: false, text: chalk.hex('#FF6B2B')('Checking AWS auth...') }).start()
58
+ const spinner = isJson
59
+ ? null
60
+ : ora({spinner: 'arc', color: false, text: chalk.hex('#FF6B2B')('Checking AWS auth...')}).start()
57
61
  let awsStatus = await checkAWSAuth()
58
62
 
59
63
  if (awsStatus.authenticated) {
60
64
  spinner?.succeed(`AWS: session active for account ${awsStatus.account}`)
61
- result.aws = { status: 'ok', account: awsStatus.account, role: awsStatus.role }
65
+ result.aws = {status: 'ok', account: awsStatus.account, role: awsStatus.role}
62
66
  } else {
63
67
  if (spinner) spinner.text = 'Logging in to AWS via aws-vault...'
64
68
  awsStatus = await loginAWS(config.awsProfile || 'default')
65
69
  if (awsStatus.authenticated) {
66
70
  spinner?.succeed(`AWS: logged in to account ${awsStatus.account}`)
67
- result.aws = { status: 'ok', account: awsStatus.account, role: awsStatus.role }
71
+ result.aws = {status: 'ok', account: awsStatus.account, role: awsStatus.role}
68
72
  } else {
69
73
  spinner?.fail('AWS authentication failed')
70
- result.aws = { status: 'error', error: awsStatus.error }
74
+ result.aws = {status: 'error', error: awsStatus.error}
71
75
  }
72
76
  }
73
77
  }
@@ -1,6 +1,6 @@
1
- import { Command, Flags } from '@oclif/core'
2
- import { writeFile } from 'node:fs/promises'
3
- import { exec } from '../services/shell.js'
1
+ import {Command, Flags} from '@oclif/core'
2
+ import {writeFile} from 'node:fs/promises'
3
+ import {exec} from '../services/shell.js'
4
4
 
5
5
  /**
6
6
  * Parse a conventional commit message.
@@ -10,7 +10,7 @@ import { exec } from '../services/shell.js'
10
10
  function parseConventionalCommit(message) {
11
11
  const match = message.match(/^(\w+)(?:\(([^)]+)\))?!?: (.+)/)
12
12
  if (!match) return null
13
- return { type: match[1], scope: match[2] ?? '', description: match[3] }
13
+ return {type: match[1], scope: match[2] ?? '', description: match[3]}
14
14
  }
15
15
 
16
16
  export default class Changelog extends Command {
@@ -25,13 +25,13 @@ export default class Changelog extends Command {
25
25
  static enableJsonFlag = true
26
26
 
27
27
  static flags = {
28
- from: Flags.string({ description: 'Tag o commit di partenza (default: ultimo tag)' }),
29
- to: Flags.string({ description: 'Commit finale (default: HEAD)', default: 'HEAD' }),
30
- output: Flags.string({ description: 'Scrivi su file (default: stdout)' }),
28
+ from: Flags.string({description: 'Tag o commit di partenza (default: ultimo tag)'}),
29
+ to: Flags.string({description: 'Commit finale (default: HEAD)', default: 'HEAD'}),
30
+ output: Flags.string({description: 'Scrivi su file (default: stdout)'}),
31
31
  }
32
32
 
33
33
  async run() {
34
- const { flags } = await this.parse(Changelog)
34
+ const {flags} = await this.parse(Changelog)
35
35
  const isJson = flags.json
36
36
 
37
37
  // Determine from ref
@@ -51,13 +51,13 @@ export default class Changelog extends Command {
51
51
  const lines = logResult.stdout.split('\n').filter(Boolean)
52
52
 
53
53
  /** @type {Record<string, Array<{ message: string, hash: string }>>} */
54
- const sections = { feat: [], fix: [], chore: [], docs: [], refactor: [], test: [], other: [] }
54
+ const sections = {feat: [], fix: [], chore: [], docs: [], refactor: [], test: [], other: []}
55
55
 
56
56
  for (const line of lines) {
57
57
  const [message, hash] = line.split('|')
58
58
  const parsed = parseConventionalCommit(message)
59
59
  const type = parsed?.type ?? 'other'
60
- const entry = { message: message.trim(), hash: hash?.slice(0, 7) ?? '' }
60
+ const entry = {message: message.trim(), hash: hash?.slice(0, 7) ?? ''}
61
61
  if (type in sections) {
62
62
  sections[type].push(entry)
63
63
  } else {
@@ -65,7 +65,7 @@ export default class Changelog extends Command {
65
65
  }
66
66
  }
67
67
 
68
- if (isJson) return { from: from || 'beginning', to: flags.to, sections }
68
+ if (isJson) return {from: from || 'beginning', to: flags.to, sections}
69
69
 
70
70
  // Build markdown
71
71
  const title = `## [Unreleased]${from ? ` (since ${from})` : ''}`
@@ -97,6 +97,6 @@ export default class Changelog extends Command {
97
97
  this.log(output)
98
98
  }
99
99
 
100
- return { from: from || 'beginning', to: flags.to, sections }
100
+ return {from: from || 'beginning', to: flags.to, sections}
101
101
  }
102
102
  }
@@ -1,10 +1,10 @@
1
- import { Command, Args, Flags } from '@oclif/core'
2
- import { input } from '@inquirer/prompts'
1
+ import {Command, Args, Flags} from '@oclif/core'
2
+ import {input} from '@inquirer/prompts'
3
3
  import ora from 'ora'
4
- import { getServiceCosts } from '../../services/aws-costs.js'
5
- import { loadConfig } from '../../services/config.js'
6
- import { formatCostTable, calculateTotal } from '../../formatters/cost.js'
7
- import { DvmiError } from '../../utils/errors.js'
4
+ import {getServiceCosts} from '../../services/aws-costs.js'
5
+ import {loadConfig} from '../../services/config.js'
6
+ import {formatCostTable, calculateTotal} from '../../formatters/cost.js'
7
+ import {DvmiError} from '../../utils/errors.js'
8
8
  import {
9
9
  awsVaultPrefix,
10
10
  isAwsVaultSession,
@@ -28,7 +28,7 @@ export default class CostsGet extends Command {
28
28
  static enableJsonFlag = true
29
29
 
30
30
  static args = {
31
- service: Args.string({ description: 'Service name (used to derive tag filter from config)', required: false }),
31
+ service: Args.string({description: 'Service name (used to derive tag filter from config)', required: false}),
32
32
  }
33
33
 
34
34
  static flags = {
@@ -48,18 +48,14 @@ export default class CostsGet extends Command {
48
48
  }
49
49
 
50
50
  async run() {
51
- const { args, flags } = await this.parse(CostsGet)
51
+ const {args, flags} = await this.parse(CostsGet)
52
52
  const isJson = flags.json
53
53
  const isInteractive = !isJson && process.stdout.isTTY && process.env.CI !== 'true'
54
54
  const groupBy = /** @type {'service'|'tag'|'both'} */ (flags['group-by'])
55
55
 
56
56
  const config = await loadConfig()
57
57
 
58
- if (
59
- isInteractive &&
60
- !isAwsVaultSession() &&
61
- process.env.DVMI_AWS_VAULT_REEXEC !== '1'
62
- ) {
58
+ if (isInteractive && !isAwsVaultSession() && process.env.DVMI_AWS_VAULT_REEXEC !== '1') {
63
59
  const profile = await input({
64
60
  message: 'AWS profile (aws-vault):',
65
61
  default: config.awsProfile || process.env.AWS_VAULT || 'default',
@@ -91,19 +87,16 @@ export default class CostsGet extends Command {
91
87
 
92
88
  // Validate: tag key required when grouping by tag or both
93
89
  if ((groupBy === 'tag' || groupBy === 'both') && !tagKey) {
94
- throw new DvmiError(
95
- 'No tag key available.',
96
- 'Pass --tag-key or configure projectTags in dvmi config.',
97
- )
90
+ throw new DvmiError('No tag key available.', 'Pass --tag-key or configure projectTags in dvmi config.')
98
91
  }
99
92
 
100
93
  const serviceArg = args.service ?? 'all'
101
- const tags = config.projectTags ?? (args.service ? { project: args.service } : {})
94
+ const tags = config.projectTags ?? (args.service ? {project: args.service} : {})
102
95
 
103
96
  const spinner = isJson ? null : ora(`Fetching costs...`).start()
104
97
 
105
98
  try {
106
- const { entries, period } = await getServiceCosts(
99
+ const {entries, period} = await getServiceCosts(
107
100
  serviceArg,
108
101
  tags,
109
102
  /** @type {any} */ (flags.period),
@@ -119,7 +112,7 @@ export default class CostsGet extends Command {
119
112
  tagKey: tagKey ?? null,
120
113
  period,
121
114
  items: entries,
122
- total: { amount: total, unit: 'USD' },
115
+ total: {amount: total, unit: 'USD'},
123
116
  }
124
117
 
125
118
  if (isJson) return result
@@ -156,10 +149,7 @@ export default class CostsGet extends Command {
156
149
  }
157
150
 
158
151
  const prefix = awsVaultPrefix(config)
159
- this.error(
160
- `No AWS credentials. Use: ${prefix}dvmi costs get` +
161
- (args.service ? ` ${args.service}` : ''),
162
- )
152
+ this.error(`No AWS credentials. Use: ${prefix}dvmi costs get` + (args.service ? ` ${args.service}` : ''))
163
153
  }
164
154
  throw err
165
155
  }
@@ -1,10 +1,10 @@
1
- import { Command, Flags } from '@oclif/core'
2
- import { input } from '@inquirer/prompts'
1
+ import {Command, Flags} from '@oclif/core'
2
+ import {input} from '@inquirer/prompts'
3
3
  import ora from 'ora'
4
- import { getTrendCosts, getTwoMonthPeriod } from '../../services/aws-costs.js'
5
- import { loadConfig } from '../../services/config.js'
6
- import { barChart, lineChart } from '../../formatters/charts.js'
7
- import { DvmiError } from '../../utils/errors.js'
4
+ import {getTrendCosts, getTwoMonthPeriod} from '../../services/aws-costs.js'
5
+ import {loadConfig} from '../../services/config.js'
6
+ import {barChart, lineChart} from '../../formatters/charts.js'
7
+ import {DvmiError} from '../../utils/errors.js'
8
8
  import {
9
9
  awsVaultPrefix,
10
10
  isAwsVaultSession,
@@ -42,18 +42,14 @@ export default class CostsTrend extends Command {
42
42
  }
43
43
 
44
44
  async run() {
45
- const { flags } = await this.parse(CostsTrend)
45
+ const {flags} = await this.parse(CostsTrend)
46
46
  const isJson = flags.json
47
47
  const isInteractive = !isJson && process.stdout.isTTY && process.env.CI !== 'true'
48
48
  const groupBy = /** @type {'service'|'tag'|'both'} */ (flags['group-by'])
49
49
 
50
50
  const config = await loadConfig()
51
51
 
52
- if (
53
- isInteractive &&
54
- !isAwsVaultSession() &&
55
- process.env.DVMI_AWS_VAULT_REEXEC !== '1'
56
- ) {
52
+ if (isInteractive && !isAwsVaultSession() && process.env.DVMI_AWS_VAULT_REEXEC !== '1') {
57
53
  const profile = await input({
58
54
  message: 'AWS profile (aws-vault):',
59
55
  default: config.awsProfile || process.env.AWS_VAULT || 'default',
@@ -83,10 +79,7 @@ export default class CostsTrend extends Command {
83
79
  const tagKey = flags['tag-key'] ?? configTagKey
84
80
 
85
81
  if ((groupBy === 'tag' || groupBy === 'both') && !tagKey) {
86
- throw new DvmiError(
87
- 'No tag key available.',
88
- 'Pass --tag-key or configure projectTags in dvmi config.',
89
- )
82
+ throw new DvmiError('No tag key available.', 'Pass --tag-key or configure projectTags in dvmi config.')
90
83
  }
91
84
 
92
85
  const spinner = isJson ? null : ora('Fetching cost trend data...').start()
@@ -95,13 +88,13 @@ export default class CostsTrend extends Command {
95
88
  const trendSeries = await getTrendCosts(groupBy, tagKey)
96
89
  spinner?.stop()
97
90
 
98
- const { start, end } = getTwoMonthPeriod()
91
+ const {start, end} = getTwoMonthPeriod()
99
92
 
100
93
  if (isJson) {
101
94
  return {
102
95
  groupBy,
103
96
  tagKey: tagKey ?? null,
104
- period: { start, end },
97
+ period: {start, end},
105
98
  series: trendSeries,
106
99
  }
107
100
  }
@@ -113,9 +106,7 @@ export default class CostsTrend extends Command {
113
106
 
114
107
  // Convert CostTrendSeries[] → ChartSeries[]
115
108
  // All series must share the same label (date) axis — use the union of all dates
116
- const allDates = Array.from(
117
- new Set(trendSeries.flatMap((s) => s.points.map((p) => p.date))),
118
- ).sort()
109
+ const allDates = Array.from(new Set(trendSeries.flatMap((s) => s.points.map((p) => p.date)))).sort()
119
110
 
120
111
  /** @type {import('../../formatters/charts.js').ChartSeries[]} */
121
112
  const chartSeries = trendSeries.map((s) => {
@@ -128,9 +119,7 @@ export default class CostsTrend extends Command {
128
119
  })
129
120
 
130
121
  const title = `AWS Cost Trend — last 2 months (${start} → ${end})`
131
- const rendered = flags.line
132
- ? lineChart(chartSeries, { title })
133
- : barChart(chartSeries, { title })
122
+ const rendered = flags.line ? lineChart(chartSeries, {title}) : barChart(chartSeries, {title})
134
123
 
135
124
  this.log(rendered)
136
125
  } catch (err) {