@kiipu/cli 0.0.2 → 0.0.3

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.
@@ -122,9 +122,11 @@ export function getHelpResult(command) {
122
122
  '',
123
123
  'Global options:',
124
124
  ' --json Print structured JSON instead of plain text',
125
+ ' -v, --version Show the current CLI version',
125
126
  ' -h, --help Show help for the root CLI or a subcommand',
126
127
  '',
127
128
  'Help:',
129
+ ' kiipu -v',
128
130
  ' kiipu --help',
129
131
  ' kiipu -h',
130
132
  ' kiipu <command> --help',
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ import { getHelpResult } from './commands/help.js';
7
7
  import { runPostCommand } from './commands/post.js';
8
8
  import { runSkillsCommand } from './commands/skills.js';
9
9
  import { readFlag, hasFlag } from './utils/args.js';
10
+ import { CLI_VERSION } from './version.js';
10
11
  function printResult(result, asJson) {
11
12
  if (asJson) {
12
13
  console.log(JSON.stringify(result, null, 2));
@@ -23,8 +24,9 @@ async function main() {
23
24
  const normalizedArgs = args[0] === '--' ? args.slice(1) : args;
24
25
  const asJson = hasFlag(normalizedArgs, '--json');
25
26
  const wantsHelp = hasFlag(normalizedArgs, '--help') || hasFlag(normalizedArgs, '-h');
27
+ const wantsVersion = hasFlag(normalizedArgs, '--version') || hasFlag(normalizedArgs, '-v');
26
28
  const positionalArgs = normalizedArgs.filter((arg, index, all) => {
27
- if (arg === '--json' || arg === '--help' || arg === '-h')
29
+ if (arg === '--json' || arg === '--help' || arg === '-h' || arg === '--version' || arg === '-v')
28
30
  return false;
29
31
  const prev = all[index - 1];
30
32
  return (prev !== '--scheduled-at' &&
@@ -40,6 +42,10 @@ async function main() {
40
42
  prev !== '--device-name');
41
43
  });
42
44
  const [command, subcommand, subject] = positionalArgs;
45
+ if (wantsVersion) {
46
+ console.log(CLI_VERSION);
47
+ return;
48
+ }
43
49
  if (wantsHelp || command === 'help') {
44
50
  return printResult(getHelpResult(command === 'help' ? subcommand : command), asJson);
45
51
  }
@@ -0,0 +1,2 @@
1
+ import packageJson from '../package.json';
2
+ export const CLI_VERSION = packageJson.version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiipu/cli",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Kiipu CLI for local authentication, doctor checks, and direct post actions.",
5
5
  "license": "MIT",
6
6
  "type": "module",