@kosdev-code/kos-ui-cli 2.0.41 → 2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kosdev-code/kos-ui-cli",
3
- "version": "2.0.41",
3
+ "version": "2.1.0",
4
4
  "bin": {
5
5
  "kosui": "./src/lib/cli.mjs"
6
6
  },
@@ -20,7 +20,7 @@
20
20
  "main": "./src/index.js",
21
21
  "kos": {
22
22
  "build": {
23
- "gitHash": "82f501e94dcc050e3ec05bb9fd68f2671112823d"
23
+ "gitHash": "82fe4f624fff667405f0cd0cc6eb874031e807f4"
24
24
  }
25
25
  },
26
26
  "publishConfig": {
@@ -20,13 +20,29 @@ export const metadata = {
20
20
  };
21
21
 
22
22
  export default async function (plop) {
23
- const allModels = await getAllModels();
24
- const modelChoices = allModels.map((m) => ({
25
- name: `${m.model} (${m.project})`,
26
- value: m.model,
27
- }));
23
+ // Check if we're in interactive mode by looking at process args
24
+ const isInteractive = process.argv.includes('-i') || process.argv.includes('--interactive');
25
+
26
+ // For interactive mode, use lazy loading. For non-interactive, load immediately.
27
+ let modelChoices;
28
+ if (isInteractive) {
29
+ modelChoices = async () => {
30
+ const allModels = await getAllModels();
31
+ return allModels.map((m) => ({
32
+ name: `${m.model} (${m.project})`,
33
+ value: m.model,
34
+ }));
35
+ };
36
+ } else {
37
+ const allModels = await getAllModels();
38
+ modelChoices = allModels.map((m) => ({
39
+ name: `${m.model} (${m.project})`,
40
+ value: m.model,
41
+ }));
42
+ }
28
43
 
29
44
  plop.setActionType("addFutureToModel", async function (answers) {
45
+ const allModels = await getAllModels();
30
46
  const modelProject = allModels.find(
31
47
  (m) => m.model === answers.modelName
32
48
  )?.project;
@@ -27,21 +27,39 @@ export const metadata = {
27
27
  parentAware: "parentAware",
28
28
  singleton: "singleton",
29
29
  dataServices: "dataServices",
30
+ autoRegister: "autoRegister",
30
31
  dryRun: "dryRun",
31
32
  interactive: "interactive",
32
33
  },
33
34
  };
34
35
 
35
36
  export default async function (plop) {
36
- const allModels = await getAllModels();
37
37
  const libraryProjects = await getModelProjectsWithFallback();
38
- const modelChoices = allModels.map((m) => ({
39
- name: `${m.model} (${m.project})`,
40
- value: m.model,
41
- }));
38
+
39
+ // Check if we're in interactive mode by looking at process args
40
+ const isInteractive = process.argv.includes('-i') || process.argv.includes('--interactive');
41
+
42
+ // For interactive mode, use lazy loading. For non-interactive, load immediately.
43
+ let modelChoices;
44
+ if (isInteractive) {
45
+ modelChoices = async () => {
46
+ const allModels = await getAllModels();
47
+ return allModels.map((m) => ({
48
+ name: `${m.model} (${m.project})`,
49
+ value: m.model,
50
+ }));
51
+ };
52
+ } else {
53
+ const allModels = await getAllModels();
54
+ modelChoices = allModels.map((m) => ({
55
+ name: `${m.model} (${m.project})`,
56
+ value: m.model,
57
+ }));
58
+ }
42
59
 
43
60
  plop.setActionType("createCompanionModel", async function (answers) {
44
61
  const modelProject = await getProjectDetails(answers.modelProject);
62
+ const allModels = await getAllModels();
45
63
  const companionProject = allModels.find(
46
64
  (m) => m.model === answers.companionParent
47
65
  )?.project;
@@ -54,6 +72,7 @@ export default async function (plop) {
54
72
  --dataServices=${!!answers.dataServices} \
55
73
  --singleton=${!!answers.singleton} \
56
74
  --parentAware=${!!answers.parentAware} \
75
+ --autoRegister=${!!answers.autoRegister} \
57
76
  --companion=true \
58
77
  --companionModel=${answers.companionParent} \
59
78
  --companionModelProject=${companionProject} \
@@ -18,20 +18,38 @@ export const metadata = {
18
18
  parentAware: "parentAware",
19
19
  singleton: "singleton",
20
20
  dataServices: "dataServices",
21
+ autoRegister: "autoRegister",
21
22
  dryRun: "dryRun",
22
23
  interactive: "interactive",
23
24
  },
24
25
  };
25
26
 
26
27
  export default async function (plop) {
27
- const allModels = await getAllModels();
28
28
  const allProjects = await getAllProjects();
29
- const modelChoices = allModels.map((m) => ({
30
- name: `${m.model} (${m.project})`,
31
- value: m.model,
32
- }));
29
+
30
+ // Check if we're in interactive mode by looking at process args
31
+ const isInteractive = process.argv.includes('-i') || process.argv.includes('--interactive');
32
+
33
+ // For interactive mode, use lazy loading. For non-interactive, load immediately.
34
+ let modelChoices;
35
+ if (isInteractive) {
36
+ modelChoices = async () => {
37
+ const allModels = await getAllModels();
38
+ return allModels.map((m) => ({
39
+ name: `${m.model} (${m.project})`,
40
+ value: m.model,
41
+ }));
42
+ };
43
+ } else {
44
+ const allModels = await getAllModels();
45
+ modelChoices = allModels.map((m) => ({
46
+ name: `${m.model} (${m.project})`,
47
+ value: m.model,
48
+ }));
49
+ }
33
50
 
34
51
  plop.setActionType("createContainer", async function (answers) {
52
+ const allModels = await getAllModels();
35
53
  const modelProject = allModels.find(
36
54
  (m) => m.model === answers.modelName
37
55
  )?.project;
@@ -43,6 +61,7 @@ export default async function (plop) {
43
61
  --skipRegistration=true \
44
62
  --dataServices=${!!answers.dataServices} \
45
63
  --singleton=${!!answers.singleton} \
64
+ --autoRegister=${!!answers.autoRegister} \
46
65
  --no-interactive ${answers.dryRun ? "--dryRun" : ""} --verbose`;
47
66
 
48
67
  try {
@@ -14,13 +14,30 @@ export const metadata = {
14
14
 
15
15
  export default async function (plop) {
16
16
  const allProjects = await getAllProjects();
17
- const allModels = await getAllModels();
18
- const modelChoices = allModels.map((m) => ({
19
- name: `${m.model} (${m.project})`,
20
- value: m.model,
21
- }));
17
+
18
+ // Check if we're in interactive mode by looking at process args
19
+ const isInteractive = process.argv.includes('-i') || process.argv.includes('--interactive');
20
+
21
+ // For interactive mode, use lazy loading. For non-interactive, load immediately.
22
+ let modelChoices;
23
+ if (isInteractive) {
24
+ modelChoices = async () => {
25
+ const allModels = await getAllModels();
26
+ return allModels.map((m) => ({
27
+ name: `${m.model} (${m.project})`,
28
+ value: m.model,
29
+ }));
30
+ };
31
+ } else {
32
+ const allModels = await getAllModels();
33
+ modelChoices = allModels.map((m) => ({
34
+ name: `${m.model} (${m.project})`,
35
+ value: m.model,
36
+ }));
37
+ }
22
38
 
23
39
  plop.setActionType("createContext", async function (answers) {
40
+ const allModels = await getAllModels();
24
41
  const modelProject = allModels.find(
25
42
  (m) => m.model === answers.modelName
26
43
  )?.project;
@@ -14,13 +14,30 @@ export const metadata = {
14
14
 
15
15
  export default async function (plop) {
16
16
  const allProjects = await getAllProjects();
17
- const allModels = await getAllModels();
18
- const modelChoices = allModels.map((m) => ({
19
- name: `${m.model} (${m.project})`,
20
- value: m.model,
21
- }));
17
+
18
+ // Check if we're in interactive mode by looking at process args
19
+ const isInteractive = process.argv.includes('-i') || process.argv.includes('--interactive');
20
+
21
+ // For interactive mode, use lazy loading. For non-interactive, load immediately.
22
+ let modelChoices;
23
+ if (isInteractive) {
24
+ modelChoices = async () => {
25
+ const allModels = await getAllModels();
26
+ return allModels.map((m) => ({
27
+ name: `${m.model} (${m.project})`,
28
+ value: m.model,
29
+ }));
30
+ };
31
+ } else {
32
+ const allModels = await getAllModels();
33
+ modelChoices = allModels.map((m) => ({
34
+ name: `${m.model} (${m.project})`,
35
+ value: m.model,
36
+ }));
37
+ }
22
38
 
23
39
  plop.setActionType("createHook", async function (answers) {
40
+ const allModels = await getAllModels();
24
41
  const modelProject = allModels.find(
25
42
  (m) => m.model === answers.modelName
26
43
  )?.project;
@@ -15,13 +15,14 @@ export const metadata = {
15
15
  namedArguments: {
16
16
  name: "modelName",
17
17
  modelName: "modelName",
18
- project: "modelProject",
18
+ project: "modelProject",
19
19
  modelProject: "modelProject",
20
20
  container: "container",
21
21
  parentAware: "parentAware",
22
22
  singleton: "singleton",
23
23
  dataServices: "dataServices",
24
24
  futureAware: "futureAware",
25
+ autoRegister: "autoRegister",
25
26
  dryRun: "dryRun",
26
27
  interactive: "interactive"
27
28
  }
@@ -41,6 +42,7 @@ export default async function (plop) {
41
42
  --singleton=${!!answers.singleton} \
42
43
  --parentAware=${!!answers.parentAware} \
43
44
  --futureAware=${answers.futureAware || 'none'} \
45
+ --autoRegister=${!!answers.autoRegister} \
44
46
  --no-interactive ${answers.dryRun ? "--dryRun" : ""} --verbose`;
45
47
 
46
48
  try {