@kodly.dev/kodly-cli 1.0.16 → 1.0.18
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 +84 -0
- package/dist/bin/kodly.js +5 -1
- package/dist/commands/completion.js +2 -8
- package/dist/commands/man.js +3 -6
- package/dist/commands/scaffold.js +45 -46
- package/dist/utils/config.js +12 -0
- package/dist/utils/update-check.js +91 -0
- package/llm.txt +1 -3
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# @kodly.dev/kodly-cli
|
|
2
|
+
|
|
3
|
+
Official CLI for the [Kodly](https://kodly.dev) platform: authenticate, check out tasks/projects/docs, sync changes, and scaffold Spring Boot apps from recipes.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @kodly.dev/kodly-cli
|
|
9
|
+
kodly --version
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Authenticate
|
|
16
|
+
kodly login
|
|
17
|
+
kodly whoami
|
|
18
|
+
|
|
19
|
+
# Work on a task
|
|
20
|
+
kodly task list
|
|
21
|
+
kodly task checkout <task-slug>
|
|
22
|
+
cd <task-slug>
|
|
23
|
+
# …edit code…
|
|
24
|
+
kodly status
|
|
25
|
+
kodly push
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Scaffolding (no login required)
|
|
29
|
+
|
|
30
|
+
Recipes come from [kodly-scaffold-recipies-java](https://github.com/kodly-dev/kodly-scaffold-recipies-java). Override with `KODLY_RECIPES_REPO_URL`.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# List available recipes (live catalog from the recipes repo)
|
|
34
|
+
kodly scaffold list
|
|
35
|
+
|
|
36
|
+
# Create a project and apply recipes in one step
|
|
37
|
+
kodly scaffold create \
|
|
38
|
+
-g com.acme.orders \
|
|
39
|
+
-n orders-app \
|
|
40
|
+
-p ./orders-app \
|
|
41
|
+
sql redis-cache
|
|
42
|
+
|
|
43
|
+
# Or step by step
|
|
44
|
+
kodly scaffold init -g com.acme.orders -n orders-app -p ./orders-app
|
|
45
|
+
cd ./orders-app
|
|
46
|
+
kodly scaffold sql
|
|
47
|
+
kodly scaffold redis-cache
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Unversioned skeletons and recipes use the latest stable published Git tag.
|
|
51
|
+
`--skeleton-version <version>` and `recipe@<version>` pin a specific release.
|
|
52
|
+
The API delegates to this same resolver. New tags affect new projects only.
|
|
53
|
+
|
|
54
|
+
## Common commands
|
|
55
|
+
|
|
56
|
+
| Area | Commands |
|
|
57
|
+
|------|----------|
|
|
58
|
+
| Auth | `kodly login`, `kodly whoami`, `kodly logout` |
|
|
59
|
+
| Org | `kodly org list`, `kodly org switch <slug>` |
|
|
60
|
+
| Tasks | `kodly task list`, `kodly task checkout <slug>`, `kodly task create …` |
|
|
61
|
+
| Projects | `kodly project list`, `kodly project checkout [slug]` |
|
|
62
|
+
| Docs | `kodly docs checkout <project-slug>`, `kodly docs status`, `kodly docs push` |
|
|
63
|
+
| Sync | `kodly status`, `kodly push` |
|
|
64
|
+
| Scaffold | `kodly scaffold list`, `kodly scaffold create …`, `kodly scaffold <recipe>@<version>` |
|
|
65
|
+
| Help | `kodly man`, `kodly completion [zsh\|bash\|fish]` |
|
|
66
|
+
|
|
67
|
+
## Notes
|
|
68
|
+
|
|
69
|
+
- Do **not** edit files under `.kodly/` — they hold sync checksums and context.
|
|
70
|
+
- The CLI warns when a newer version is published on npm. Update with:
|
|
71
|
+
```bash
|
|
72
|
+
npm install -g @kodly.dev/kodly-cli@latest
|
|
73
|
+
```
|
|
74
|
+
Disable with `KODLY_DISABLE_UPDATE_CHECK=1`.
|
|
75
|
+
|
|
76
|
+
## Programmatic scaffolding
|
|
77
|
+
|
|
78
|
+
The Spring Boot recipe engine is also available as [`@kodly.dev/scaffolder`](https://www.npmjs.com/package/@kodly.dev/scaffolder).
|
|
79
|
+
|
|
80
|
+
## More
|
|
81
|
+
|
|
82
|
+
- Full manual: `kodly man`
|
|
83
|
+
- Agent reference (shipped with the package): `llm.txt`
|
|
84
|
+
- Website: [kodly.dev](https://kodly.dev)
|
package/dist/bin/kodly.js
CHANGED
|
@@ -16,6 +16,7 @@ import { projectCommands } from '../commands/project.js';
|
|
|
16
16
|
import { docsCommands } from '../commands/docs.js';
|
|
17
17
|
import { orgCommands } from '../commands/org.js';
|
|
18
18
|
import { scaffoldCommands, normalizeScaffoldArgv } from '../commands/scaffold.js';
|
|
19
|
+
import { warnIfCliOutdated } from '../utils/update-check.js';
|
|
19
20
|
const program = new Command();
|
|
20
21
|
program
|
|
21
22
|
.name('kodly')
|
|
@@ -32,4 +33,7 @@ projectCommands(program);
|
|
|
32
33
|
docsCommands(program);
|
|
33
34
|
orgCommands(program);
|
|
34
35
|
scaffoldCommands(program);
|
|
35
|
-
program.
|
|
36
|
+
program.hook('preAction', async () => {
|
|
37
|
+
await warnIfCliOutdated(packageJson.version);
|
|
38
|
+
});
|
|
39
|
+
await program.parseAsync(normalizeScaffoldArgv(process.argv));
|
|
@@ -14,8 +14,7 @@ export const completionCommands = (program) => {
|
|
|
14
14
|
#
|
|
15
15
|
|
|
16
16
|
complete -c kodly -f -n '__fish_use_subcommand' -a 'login logout whoami task push status man help completion project docs org scaffold'
|
|
17
|
-
complete -c kodly -f -n '__fish_seen_subcommand_from scaffold' -a 'init create list
|
|
18
|
-
complete -c kodly -f -n '__fish_seen_subcommand_from cache' -a 'list clear'
|
|
17
|
+
complete -c kodly -f -n '__fish_seen_subcommand_from scaffold' -a 'init create list'
|
|
19
18
|
complete -c kodly -f -n '__fish_seen_subcommand_from task' -a 'list checkout create'
|
|
20
19
|
complete -c kodly -f -n '__fish_seen_subcommand_from project' -a 'checkout list'
|
|
21
20
|
complete -c kodly -f -n '__fish_seen_subcommand_from docs' -a 'checkout push status'
|
|
@@ -67,15 +66,10 @@ _kodly_completion() {
|
|
|
67
66
|
return 0
|
|
68
67
|
;;
|
|
69
68
|
scaffold)
|
|
70
|
-
local scaffold_opts="init create list
|
|
69
|
+
local scaffold_opts="init create list"
|
|
71
70
|
COMPREPLY=( $(compgen -W "\${scaffold_opts}" -- \${cur}) )
|
|
72
71
|
return 0
|
|
73
72
|
;;
|
|
74
|
-
cache)
|
|
75
|
-
local cache_opts="list clear"
|
|
76
|
-
COMPREPLY=( $(compgen -W "\${cache_opts}" -- \${cur}) )
|
|
77
|
-
return 0
|
|
78
|
-
;;
|
|
79
73
|
*)
|
|
80
74
|
;;
|
|
81
75
|
esac
|
package/dist/commands/man.js
CHANGED
|
@@ -59,10 +59,10 @@ export const manCommands = (program) => {
|
|
|
59
59
|
console.log(' Show the working tree status of documentation.');
|
|
60
60
|
console.log(chalk.bold('\n9. Scaffolding Recipes'));
|
|
61
61
|
console.log(' Generate Spring Boot projects and apply deterministic recipes.');
|
|
62
|
-
console.log(' Does not require login —
|
|
62
|
+
console.log(' Does not require login — fetches recipes from GitHub and writes local files.');
|
|
63
63
|
console.log(chalk.cyan(' $ kodly scaffold create -g <group> -n <name> -p <dir> [recipes...]'));
|
|
64
64
|
console.log(' Example: ' +
|
|
65
|
-
chalk.cyan('kodly scaffold create -g com.acme.orders -n orders-app -p ./orders-app sql
|
|
65
|
+
chalk.cyan('kodly scaffold create -g com.acme.orders -n orders-app -p ./orders-app sql redis-cache'));
|
|
66
66
|
console.log(chalk.cyan(' $ kodly scaffold init --group <group> --name <name>'));
|
|
67
67
|
console.log(' Generate skeleton only (no recipes).');
|
|
68
68
|
console.log(chalk.cyan(' $ kodly scaffold <recipe-name>@<version>'));
|
|
@@ -77,11 +77,8 @@ export const manCommands = (program) => {
|
|
|
77
77
|
chalk.yellow('--dry-run') +
|
|
78
78
|
', ' +
|
|
79
79
|
chalk.yellow('--recipe'));
|
|
80
|
-
console.log(' List
|
|
80
|
+
console.log(' List available recipes (latest stable published tags):');
|
|
81
81
|
console.log(chalk.cyan(' $ kodly scaffold list'));
|
|
82
|
-
console.log(' Manage recipe cache:');
|
|
83
|
-
console.log(chalk.cyan(' $ kodly scaffold cache list'));
|
|
84
|
-
console.log(chalk.cyan(' $ kodly scaffold cache clear [recipe@version]'));
|
|
85
82
|
console.log(chalk.bold('\n10. Shell Autocompletion'));
|
|
86
83
|
console.log(' Enable tab completion for kodly commands.');
|
|
87
84
|
console.log(' ' + chalk.bold('Bash / Zsh:'));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import ora from 'ora';
|
|
4
|
-
import { scaffold, scaffoldInit,
|
|
4
|
+
import { scaffold, scaffoldInit, listRecipes, resolveScaffoldVersions, ScaffoldError, } from '@kodly.dev/scaffolder';
|
|
5
5
|
function errorMessage(error) {
|
|
6
6
|
if (error instanceof ScaffoldError)
|
|
7
7
|
return error.message;
|
|
@@ -24,7 +24,7 @@ async function runInit(opts) {
|
|
|
24
24
|
spinner.succeed(chalk.green(`Dry run for skeleton init (${result.version})`));
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
spinner.succeed(chalk.green(`Initialized project ${result.projectName}`));
|
|
27
|
+
spinner.succeed(chalk.green(`Initialized project ${result.projectName} (skeleton@${result.version})`));
|
|
28
28
|
}
|
|
29
29
|
console.log(chalk.dim(` ${result.filesAdded.length} files created (${result.durationMs}ms)`));
|
|
30
30
|
for (const file of result.filesAdded) {
|
|
@@ -70,24 +70,33 @@ async function runApply(recipe, opts) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
async function runCreate(opts) {
|
|
73
|
+
let resolved;
|
|
74
|
+
try {
|
|
75
|
+
resolved = await resolveScaffoldVersions(opts.recipes, opts.version);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
console.error(chalk.red(errorMessage(error)));
|
|
79
|
+
process.exitCode = 1;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
73
82
|
const ok = await runInit({
|
|
74
83
|
path: opts.path,
|
|
75
84
|
group: opts.group,
|
|
76
85
|
name: opts.name,
|
|
77
86
|
prefix: opts.prefix,
|
|
78
|
-
version:
|
|
87
|
+
version: resolved.version,
|
|
79
88
|
dryRun: opts.dryRun,
|
|
80
89
|
});
|
|
81
90
|
if (!ok) {
|
|
82
91
|
process.exitCode = 1;
|
|
83
92
|
return;
|
|
84
93
|
}
|
|
85
|
-
if (
|
|
94
|
+
if (resolved.recipes.length === 0) {
|
|
86
95
|
console.log(chalk.dim('\nNo recipes requested. Skeleton is ready.'));
|
|
87
96
|
return;
|
|
88
97
|
}
|
|
89
|
-
console.log(chalk.bold(`\nApplying ${
|
|
90
|
-
for (const recipe of
|
|
98
|
+
console.log(chalk.bold(`\nApplying ${resolved.recipes.length} recipe(s)…\n`));
|
|
99
|
+
for (const recipe of resolved.recipes) {
|
|
91
100
|
const applied = await runApply(recipe, {
|
|
92
101
|
path: opts.path,
|
|
93
102
|
group: opts.group,
|
|
@@ -102,17 +111,25 @@ async function runCreate(opts) {
|
|
|
102
111
|
}
|
|
103
112
|
console.log(chalk.green(`\nDone. Project ready at ${opts.path}`));
|
|
104
113
|
}
|
|
105
|
-
function
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
async function printRecipes() {
|
|
115
|
+
const spinner = ora('Fetching recipes...').start();
|
|
116
|
+
try {
|
|
117
|
+
const recipes = await listRecipes();
|
|
118
|
+
spinner.stop();
|
|
119
|
+
if (recipes.length === 0) {
|
|
120
|
+
console.log(chalk.yellow('No recipes found.'));
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
console.log(chalk.bold('\nAvailable Recipes\n'));
|
|
124
|
+
for (const item of recipes) {
|
|
125
|
+
console.log(` ${chalk.cyan(item.name)}@${item.version}`);
|
|
126
|
+
}
|
|
127
|
+
console.log('');
|
|
110
128
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
129
|
+
catch (error) {
|
|
130
|
+
spinner.fail(chalk.red(errorMessage(error)));
|
|
131
|
+
process.exitCode = 1;
|
|
114
132
|
}
|
|
115
|
-
console.log('');
|
|
116
133
|
}
|
|
117
134
|
function registerApplyOptions(cmd) {
|
|
118
135
|
return cmd
|
|
@@ -124,7 +141,7 @@ function registerApplyOptions(cmd) {
|
|
|
124
141
|
function collectRecipe(value, previous) {
|
|
125
142
|
return [...previous, value];
|
|
126
143
|
}
|
|
127
|
-
const SCAFFOLD_SUBCOMMANDS = new Set(['init', 'create', 'list', '
|
|
144
|
+
const SCAFFOLD_SUBCOMMANDS = new Set(['init', 'create', 'list', 'apply', 'cache']);
|
|
128
145
|
/** Rewrite `scaffold <recipe>` to `scaffold apply <recipe>` for shorthand. */
|
|
129
146
|
export function normalizeScaffoldArgv(argv) {
|
|
130
147
|
const scaffoldIdx = argv.indexOf('scaffold');
|
|
@@ -147,7 +164,7 @@ export const scaffoldCommands = (program) => {
|
|
|
147
164
|
.requiredOption('-n, --name <name>', 'Gradle project name (e.g. rental-app)')
|
|
148
165
|
.option('-p, --path <dir>', 'Target directory (must be empty or not exist)', process.cwd())
|
|
149
166
|
.option('--prefix <prefix>', 'Class prefix (defaults from project name, e.g. RentalApp)')
|
|
150
|
-
.option('--skeleton-version <version>', 'Skeleton
|
|
167
|
+
.option('--skeleton-version <version>', 'Skeleton tag version (default: latest published stable)')
|
|
151
168
|
.option('--dry-run', 'Show what would be created without writing')
|
|
152
169
|
.action(async (opts) => {
|
|
153
170
|
const ok = await runInit({
|
|
@@ -164,12 +181,12 @@ export const scaffoldCommands = (program) => {
|
|
|
164
181
|
scaffoldCmd
|
|
165
182
|
.command('create')
|
|
166
183
|
.description('Create a Spring Boot project and optionally apply recipes in one step')
|
|
167
|
-
.argument('[recipes...]', 'Recipes to apply after init (name@version)')
|
|
184
|
+
.argument('[recipes...]', 'Recipes to apply after init (name or name@version)')
|
|
168
185
|
.requiredOption('-g, --group <group>', 'Java package group (e.g. com.rental.app)')
|
|
169
186
|
.requiredOption('-n, --name <name>', 'Gradle project name (e.g. rental-app)')
|
|
170
187
|
.option('-p, --path <dir>', 'Target directory (must be empty or not exist)', process.cwd())
|
|
171
188
|
.option('--prefix <prefix>', 'Class prefix (defaults from project name, e.g. RentalApp)')
|
|
172
|
-
.option('--skeleton-version <version>', 'Skeleton
|
|
189
|
+
.option('--skeleton-version <version>', 'Skeleton tag version (default: latest published stable)')
|
|
173
190
|
.option('-r, --recipe <ref>', 'Recipe to apply (repeatable; same as positional recipes)', collectRecipe, [])
|
|
174
191
|
.option('--dry-run', 'Show what would be created without writing')
|
|
175
192
|
.action(async (recipes, opts) => {
|
|
@@ -194,35 +211,17 @@ export const scaffoldCommands = (program) => {
|
|
|
194
211
|
});
|
|
195
212
|
scaffoldCmd
|
|
196
213
|
.command('list')
|
|
197
|
-
.description('List
|
|
198
|
-
.action(() => {
|
|
199
|
-
|
|
214
|
+
.description('List the latest published stable recipes')
|
|
215
|
+
.action(async () => {
|
|
216
|
+
await printRecipes();
|
|
200
217
|
});
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
.
|
|
204
|
-
.
|
|
218
|
+
scaffoldCmd
|
|
219
|
+
.command('cache [args...]', { hidden: true })
|
|
220
|
+
.description('(Removed) Use `kodly scaffold list` instead')
|
|
221
|
+
.allowUnknownOption()
|
|
205
222
|
.action(() => {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
cacheCmd
|
|
209
|
-
.command('clear [target]')
|
|
210
|
-
.description('Clear recipe cache (all, recipe name, or recipe@version)')
|
|
211
|
-
.action((target) => {
|
|
212
|
-
try {
|
|
213
|
-
clearRecipeCache(target);
|
|
214
|
-
if (!target) {
|
|
215
|
-
console.log(chalk.green('Cleared all cached recipes.'));
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
console.log(chalk.green(`Cleared cache for ${target}.`));
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
catch (error) {
|
|
222
|
-
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
223
|
-
console.error(chalk.red(`Failed to clear cache: ${message}`));
|
|
224
|
-
process.exitCode = 1;
|
|
225
|
-
}
|
|
223
|
+
console.error(chalk.yellow('Recipe cache commands were removed. Use `kodly scaffold list` to fetch the latest recipes from GitHub.'));
|
|
224
|
+
process.exitCode = 1;
|
|
226
225
|
});
|
|
227
226
|
const applyCmd = registerApplyOptions(new Command('apply')
|
|
228
227
|
.argument('<recipe>', 'Recipe ref in name@version format')
|
package/dist/utils/config.js
CHANGED
|
@@ -20,3 +20,15 @@ export const setOrgSlug = (slug) => {
|
|
|
20
20
|
export const clearOrgSlug = () => {
|
|
21
21
|
config.delete('orgSlug');
|
|
22
22
|
};
|
|
23
|
+
export const getUpdateCheckCache = () => {
|
|
24
|
+
const lastCheckedAt = config.get('updateCheck.lastCheckedAt');
|
|
25
|
+
const latestVersion = config.get('updateCheck.latestVersion');
|
|
26
|
+
if (typeof lastCheckedAt !== 'number' || typeof latestVersion !== 'string') {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
return { lastCheckedAt, latestVersion };
|
|
30
|
+
};
|
|
31
|
+
export const setUpdateCheckCache = (cache) => {
|
|
32
|
+
config.set('updateCheck.lastCheckedAt', cache.lastCheckedAt);
|
|
33
|
+
config.set('updateCheck.latestVersion', cache.latestVersion);
|
|
34
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { getUpdateCheckCache, setUpdateCheckCache } from './config.js';
|
|
4
|
+
export const KODLY_CLI_PACKAGE_NAME = '@kodly.dev/kodly-cli';
|
|
5
|
+
const CACHE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
6
|
+
const FETCH_TIMEOUT_MS = 1500;
|
|
7
|
+
function parseVersionParts(version) {
|
|
8
|
+
const core = version.trim().replace(/^v/i, '').split('-')[0]?.split('+')[0];
|
|
9
|
+
if (!core)
|
|
10
|
+
return null;
|
|
11
|
+
const parts = core.split('.').map((part) => Number.parseInt(part, 10));
|
|
12
|
+
if (parts.length < 3 || parts.slice(0, 3).some((n) => Number.isNaN(n))) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return [parts[0], parts[1], parts[2]];
|
|
16
|
+
}
|
|
17
|
+
/** True when `latest` is a newer semver than `current` (major.minor.patch only). */
|
|
18
|
+
export function isNewerVersion(latest, current) {
|
|
19
|
+
const a = parseVersionParts(latest);
|
|
20
|
+
const b = parseVersionParts(current);
|
|
21
|
+
if (!a || !b)
|
|
22
|
+
return false;
|
|
23
|
+
for (let i = 0; i < 3; i++) {
|
|
24
|
+
if (a[i] > b[i])
|
|
25
|
+
return true;
|
|
26
|
+
if (a[i] < b[i])
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
function shouldSkipUpdateCheck(argv) {
|
|
32
|
+
if (process.env.KODLY_DISABLE_UPDATE_CHECK === '1')
|
|
33
|
+
return true;
|
|
34
|
+
if (process.env.NO_UPDATE_NOTIFIER === '1')
|
|
35
|
+
return true;
|
|
36
|
+
if (process.env.CI === 'true' || process.env.CI === '1')
|
|
37
|
+
return true;
|
|
38
|
+
// Avoid polluting shell completion / version-only output
|
|
39
|
+
if (argv.includes('completion'))
|
|
40
|
+
return true;
|
|
41
|
+
if (argv.includes('--version') || argv.includes('-V'))
|
|
42
|
+
return true;
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
async function fetchLatestVersion() {
|
|
46
|
+
const url = `https://registry.npmjs.org/${encodeURIComponent(KODLY_CLI_PACKAGE_NAME)}/latest`;
|
|
47
|
+
const response = await axios.get(url, {
|
|
48
|
+
timeout: FETCH_TIMEOUT_MS,
|
|
49
|
+
headers: { Accept: 'application/json' },
|
|
50
|
+
validateStatus: (status) => status >= 200 && status < 300,
|
|
51
|
+
});
|
|
52
|
+
const version = response.data?.version;
|
|
53
|
+
return typeof version === 'string' && version.trim() ? version.trim() : undefined;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Warn on stderr when the installed CLI is behind the latest npm release.
|
|
57
|
+
* Failures are silent. Results are cached for 24h.
|
|
58
|
+
*/
|
|
59
|
+
export async function warnIfCliOutdated(currentVersion, argv = process.argv) {
|
|
60
|
+
if (shouldSkipUpdateCheck(argv))
|
|
61
|
+
return;
|
|
62
|
+
let latestVersion;
|
|
63
|
+
const cached = getUpdateCheckCache();
|
|
64
|
+
const now = Date.now();
|
|
65
|
+
const cacheFresh = cached != null && now - cached.lastCheckedAt < CACHE_TTL_MS;
|
|
66
|
+
if (cacheFresh) {
|
|
67
|
+
latestVersion = cached.latestVersion;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
try {
|
|
71
|
+
latestVersion = await fetchLatestVersion();
|
|
72
|
+
if (latestVersion) {
|
|
73
|
+
try {
|
|
74
|
+
setUpdateCheckCache({ lastCheckedAt: now, latestVersion });
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// Cache write failures (permissions, etc.) must not break the CLI
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Network / registry errors must never break the CLI
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!latestVersion || !isNewerVersion(latestVersion, currentVersion)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
console.error(chalk.yellow(`\nUpdate available: ${chalk.bold(currentVersion)} → ${chalk.bold(latestVersion)}\n` +
|
|
90
|
+
` Run: ${chalk.cyan(`npm install -g ${KODLY_CLI_PACKAGE_NAME}@latest`)}\n`));
|
|
91
|
+
}
|
package/llm.txt
CHANGED
|
@@ -53,9 +53,7 @@ Recipes repo: https://github.com/kodly-dev/kodly-scaffold-recipies-java (overrid
|
|
|
53
53
|
- `kodly scaffold create -g <group> -n <name> -p <dir> [recipes...]` : Create a Spring Boot project and apply recipes in one step (shared package/name/prefix). No login required.
|
|
54
54
|
- `kodly scaffold init --group <group> --name <name>` : Generate a new Spring Boot skeleton with your package and project name. No login required.
|
|
55
55
|
- `kodly scaffold <recipe>@<version>` : Apply a deterministic recipe to a local Spring Boot skeleton project. No login required.
|
|
56
|
-
- `kodly scaffold list` : List
|
|
57
|
-
- `kodly scaffold cache list` : List locally cached recipes.
|
|
58
|
-
- `kodly scaffold cache clear [recipe@version]` : Clear recipe cache (all, one recipe, or one version).
|
|
56
|
+
- `kodly scaffold list` : List available recipes from the recipes repo default branch (`recipes/*/manifest.json`). No login required.
|
|
59
57
|
|
|
60
58
|
Options for create/apply: `--path <dir>`, `--group <group>`, `--prefix <prefix>`, `--skeleton-version <ver>` (create/init), `--dry-run`, `-r/--recipe <ref>` (create, repeatable).
|
|
61
59
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kodly.dev/kodly-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"kodly": "./dist/bin/kodly.js"
|
|
@@ -23,13 +23,14 @@
|
|
|
23
23
|
"description": "CLI Agent for Kodly Platform",
|
|
24
24
|
"files": [
|
|
25
25
|
"dist",
|
|
26
|
-
"llm.txt"
|
|
26
|
+
"llm.txt",
|
|
27
|
+
"README.md"
|
|
27
28
|
],
|
|
28
29
|
"publishConfig": {
|
|
29
30
|
"access": "public"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
|
-
"@kodly.dev/scaffolder": "1.0.
|
|
33
|
+
"@kodly.dev/scaffolder": "1.0.2",
|
|
33
34
|
"@types/inquirer": "^9.0.9",
|
|
34
35
|
"@types/node": "^25.0.5",
|
|
35
36
|
"axios": "^1.13.2",
|