@akanjs/cli 0.0.145 → 0.0.147

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 (34) hide show
  1. package/README.md +7 -26
  2. package/cjs/index.js +191 -28
  3. package/cjs/src/guidelines/componentRule/componentRule.instruction.md +3 -81
  4. package/cjs/src/guidelines/cssRule/cssRule.instruction.md +435 -0
  5. package/cjs/src/guidelines/docPageRule/docPageRule.instruction.md +389 -0
  6. package/cjs/src/guidelines/modelConstant/modelConstant.instruction.md +335 -752
  7. package/cjs/src/guidelines/modelStore/modelStore.instruction.md +2 -1
  8. package/cjs/src/guidelines/modelTemplate/modelTemplate.instruction.md +418 -391
  9. package/cjs/src/guidelines/modelUnit/modelUnit.instruction.md +0 -292
  10. package/cjs/src/guidelines/scalarModule/scalarModule.instruction.md +84 -0
  11. package/cjs/src/templates/app/main.js +1 -2
  12. package/esm/index.js +199 -36
  13. package/esm/src/guidelines/componentRule/componentRule.instruction.md +3 -81
  14. package/esm/src/guidelines/cssRule/cssRule.instruction.md +435 -0
  15. package/esm/src/guidelines/docPageRule/docPageRule.instruction.md +389 -0
  16. package/esm/src/guidelines/modelConstant/modelConstant.instruction.md +335 -752
  17. package/esm/src/guidelines/modelStore/modelStore.instruction.md +2 -1
  18. package/esm/src/guidelines/modelTemplate/modelTemplate.instruction.md +418 -391
  19. package/esm/src/guidelines/modelUnit/modelUnit.instruction.md +0 -292
  20. package/esm/src/guidelines/scalarModule/scalarModule.instruction.md +84 -0
  21. package/esm/src/templates/app/main.js +1 -2
  22. package/package.json +1 -1
  23. package/src/guideline/guideline.command.d.ts +3 -1
  24. package/src/guideline/guideline.prompt.d.ts +15 -1
  25. package/src/guideline/guideline.runner.d.ts +17 -3
  26. package/src/guideline/guideline.script.d.ts +8 -2
  27. package/src/guidelines/componentRule/componentRule.instruction.md +3 -81
  28. package/src/guidelines/cssRule/cssRule.instruction.md +435 -0
  29. package/src/guidelines/docPageRule/docPageRule.instruction.md +389 -0
  30. package/src/guidelines/modelConstant/modelConstant.instruction.md +335 -752
  31. package/src/guidelines/modelStore/modelStore.instruction.md +2 -1
  32. package/src/guidelines/modelTemplate/modelTemplate.instruction.md +418 -391
  33. package/src/guidelines/modelUnit/modelUnit.instruction.md +0 -292
  34. package/src/guidelines/scalarModule/scalarModule.instruction.md +84 -0
package/esm/index.js CHANGED
@@ -1238,7 +1238,10 @@ ${errorMessages}`);
1238
1238
  ];
1239
1239
  const errors = diagnostics.filter((diagnostic) => diagnostic.category === ts3.DiagnosticCategory.Error);
1240
1240
  const warnings = diagnostics.filter((diagnostic) => diagnostic.category === ts3.DiagnosticCategory.Warning);
1241
- return { diagnostics, errors, warnings };
1241
+ const fileDiagnostics = diagnostics.filter((diagnostic) => diagnostic.file?.fileName === filePath);
1242
+ const fileErrors = fileDiagnostics.filter((diagnostic) => diagnostic.category === ts3.DiagnosticCategory.Error);
1243
+ const fileWarnings = fileDiagnostics.filter((diagnostic) => diagnostic.category === ts3.DiagnosticCategory.Warning);
1244
+ return { diagnostics, errors, warnings, fileDiagnostics, fileErrors, fileWarnings };
1242
1245
  }
1243
1246
  /**
1244
1247
  * Format diagnostics for console output
@@ -1665,9 +1668,9 @@ var Executor = class _Executor {
1665
1668
  typeCheck(filePath) {
1666
1669
  const path9 = this.getPath(filePath);
1667
1670
  const typeChecker = this.getTypeChecker();
1668
- const { diagnostics, errors, warnings } = typeChecker.check(path9);
1669
- const message = typeChecker.formatDiagnostics(diagnostics);
1670
- return { diagnostics, errors, warnings, message };
1671
+ const { fileDiagnostics, fileErrors, fileWarnings } = typeChecker.check(path9);
1672
+ const message = typeChecker.formatDiagnostics(fileDiagnostics);
1673
+ return { fileDiagnostics, fileErrors, fileWarnings, message };
1671
1674
  }
1672
1675
  getLinter() {
1673
1676
  this.linter ??= new Linter(this.cwdPath);
@@ -3097,7 +3100,7 @@ ${validate.map((v) => `- ${v}`).join("\n")}`;
3097
3100
  writes.map(async ({ filePath }) => {
3098
3101
  const typeCheckResult = executor.typeCheck(filePath);
3099
3102
  const lintResult = await executor.lint(filePath);
3100
- const needFix2 = !!typeCheckResult.errors.length || !!lintResult.errors.length;
3103
+ const needFix2 = !!typeCheckResult.fileErrors.length || !!lintResult.errors.length;
3101
3104
  return { filePath, typeCheckResult, lintResult, needFix: needFix2 };
3102
3105
  })
3103
3106
  );
@@ -3131,7 +3134,7 @@ ${fileCheck.lintResult.message}`
3131
3134
  throw new Error("Failed to create scalar");
3132
3135
  }
3133
3136
  #getTypescriptCodes(text) {
3134
- const codes = text.match(/```typescript([\s\S]*?)```/g);
3137
+ const codes = text.match(/```(typescript|tsx)([\s\S]*?)```/g);
3135
3138
  if (!codes)
3136
3139
  return [];
3137
3140
  const result = codes.map((code) => {
@@ -3239,7 +3242,7 @@ var Builder = class {
3239
3242
  };
3240
3243
 
3241
3244
  // pkgs/@akanjs/devkit/src/prompter.ts
3242
- import { select as select4 } from "@inquirer/prompts";
3245
+ import { input as input3, select as select4 } from "@inquirer/prompts";
3243
3246
  import fsPromise2 from "fs/promises";
3244
3247
  var Prompter = class {
3245
3248
  static async selectGuideline() {
@@ -3256,6 +3259,9 @@ var Prompter = class {
3256
3259
  const content = await fsPromise2.readFile(filePath, "utf-8");
3257
3260
  return content;
3258
3261
  }
3262
+ static async getUpdateRequest(guideName) {
3263
+ return await input3({ message: `What do you want to update in ${guideName}?` });
3264
+ }
3259
3265
  async makeTsFileUpdatePrompt({ context: context2, request }) {
3260
3266
  return `You are a senior developer writing TypeScript-based programs using Akan.js, an in-house framework. Here's an overview of the Akan.js framework:
3261
3267
  ${await this.getDocumentation("framework")}
@@ -3417,7 +3423,7 @@ var LibraryScript = class {
3417
3423
  };
3418
3424
 
3419
3425
  // pkgs/@akanjs/cli/src/application/application.runner.ts
3420
- import { confirm as confirm2, input as input3 } from "@inquirer/prompts";
3426
+ import { confirm as confirm2, input as input4 } from "@inquirer/prompts";
3421
3427
  import { StringOutputParser } from "@langchain/core/output_parsers";
3422
3428
  import { PromptTemplate as PromptTemplate2 } from "@langchain/core/prompts";
3423
3429
  import { RunnableSequence as RunnableSequence2 } from "@langchain/core/runnables";
@@ -3877,8 +3883,8 @@ var ApplicationRunner = class {
3877
3883
  if (!openAIApiKey)
3878
3884
  throw new Error("OPENAI_API_KEY is not set");
3879
3885
  const chatModel = new ChatOpenAI3({ modelName: "gpt-4o", openAIApiKey });
3880
- const projectName = await input3({ message: "please enter project name." });
3881
- const projectDesc = await input3({ message: "please enter project description. (40 ~ 60 characters)" });
3886
+ const projectName = await input4({ message: "please enter project name." });
3887
+ const projectDesc = await input4({ message: "please enter project description. (40 ~ 60 characters)" });
3882
3888
  const spinner = ora3("Gerating project files...");
3883
3889
  const mainPrompt = PromptTemplate2.fromTemplate(`prompt.requestApplication()`);
3884
3890
  const chain = RunnableSequence2.from([mainPrompt, chatModel, new StringOutputParser()]);
@@ -5486,7 +5492,9 @@ var GuidelinePrompt = class extends Prompter {
5486
5492
  });
5487
5493
  const paths = [];
5488
5494
  for await (const path9 of matchingPaths) {
5489
- if (filterText && !fs16.readFileSync(path9, "utf-8").includes(filterText))
5495
+ const fileContent = fs16.readFileSync(path9, "utf-8");
5496
+ const textFilter = filterText ? new RegExp(filterText) : null;
5497
+ if (filterText && !textFilter?.test(fileContent))
5490
5498
  continue;
5491
5499
  paths.push(path9);
5492
5500
  }
@@ -5539,10 +5547,39 @@ ${guideJson.update.rules.map((rule) => `- ${rule}`).join("\n")}
5539
5547
 
5540
5548
  => Now, you need to write the file content here. Let's go.
5541
5549
  `;
5542
- return { request, writePath };
5550
+ return { guideJson, request, writePath };
5543
5551
  }
5544
- async requestUpdateDocumentPage(page) {
5545
- const writePath = `apps/angelo/app/${page}`;
5552
+ async requestUpdateInstruction(updateRequest) {
5553
+ const guideJson = await Prompter.getGuideJson(this.name);
5554
+ const resultPath = `${__dirname}/src/guidelines/${this.name}/${guideJson.update.filePath}`;
5555
+ const writePath = `${this.workspace.workspaceRoot}/pkgs/@akanjs/cli/src/guidelines/${this.name}/${guideJson.update.filePath}`;
5556
+ const isResultExists = this.workspace.exists(writePath);
5557
+ if (!isResultExists)
5558
+ throw new Error(`${guideJson.update.filePath} file does not exist. Please create it first.`);
5559
+ const existingResult = this.workspace.readFile(resultPath);
5560
+ const request = `
5561
+ I am a developer of akanjs framework, a full-stack framework for building web applications.
5562
+ I want to update a ${guideJson.update.filePath} file for ${guideJson.description}.
5563
+ This file is a programming guideline for Akan.js framwork users.
5564
+
5565
+ # ${guideJson.title} Workflow
5566
+ - 1. Read already-written ${guideJson.update.filePath} file.
5567
+ - 2. Write the updated file content of the ${guideJson.update.filePath} with the update request.
5568
+
5569
+ ## 1. Read already-written ${guideJson.update.filePath} file.
5570
+ \`\`\`markdown
5571
+ ${existingResult}
5572
+ \`\`\`
5573
+
5574
+ ## 2. Write the updated file content of the ${guideJson.update.filePath} with the update request.
5575
+ Request: ${updateRequest}
5576
+
5577
+ => Now, you need to write the file content here. Let's go.
5578
+ `;
5579
+ return { guideJson, request, writePath };
5580
+ }
5581
+ async requestCreateDocumentPage(page) {
5582
+ const writePath = `apps/angelo/app${page}`;
5546
5583
  if (!this.workspace.exists(writePath))
5547
5584
  this.workspace.writeFile(
5548
5585
  writePath,
@@ -5554,30 +5591,99 @@ ${guideJson.update.rules.map((rule) => `- ${rule}`).join("\n")}
5554
5591
  const instruction = await Prompter.getInstruction(this.name);
5555
5592
  const pageContent = this.workspace.getLocalFile(writePath);
5556
5593
  const request = `
5557
- \uB098\uB294 Akan.js \uD504\uB808\uC784\uC6CC\uD06C\uC5D0 \uB300\uD55C documentation \uC6F9\uC0AC\uC774\uD2B8\uB97C \uB9CC\uB4E4\uACE0 \uC788\uC5B4.
5594
+ I'm creating a documentation website for the Akan.js framework.
5558
5595
 
5559
- 1. Akan.js \uD504\uB808\uC784\uC6CC\uD06C\uC5D0 \uB300\uD55C \uAC1C\uC694
5596
+ 1. Overview of the Akan.js framework
5560
5597
  ${await this.getDocumentation("framework")}
5561
5598
 
5562
- \uB098\uB294 ${writePath}\uC5D0 \uC788\uB294 Next.js \uC11C\uBC84\uC0AC\uC774\uB4DC \uD398\uC774\uC9C0\uB97C \uC5C5\uB370\uC774\uD2B8\uD558\uB824\uACE0 \uD574.
5563
- \uC544\uB798\uB294 \uD604\uC7AC \uC791\uC131\uB41C \uD398\uC774\uC9C0\uC758 \uB0B4\uC6A9\uC774\uC57C.
5599
+ 2. Documentation page writing method
5600
+ ${await this.getDocumentation("docPageRule")}
5601
+
5602
+ 3. CSS rule with TailwindCSS and DaisyUI
5603
+ ${await this.getDocumentation("cssRule")}
5604
+
5605
+ I want to update the Next.js server-side page located at ${writePath}.
5606
+ Below is the content of the currently written page.
5607
+ \`\`\`tsx
5608
+ // File: ${writePath}
5609
+ ${pageContent.content}
5610
+ \`\`\`
5611
+
5612
+ Please update this page with the latest content below. A great design application is needed.
5613
+ ${instruction}
5614
+
5615
+ Please follow these CSS rules when writing:
5616
+ - Use tailwindcss
5617
+ - Use className from the daisyui library
5618
+
5619
+ Please return only the file result in the following format for easy parsing.
5620
+ \`\`\`tsx
5621
+ // File: ${writePath}
5622
+ ...pageContent
5623
+ \`\`\`
5624
+ `;
5625
+ return { request, writePath };
5626
+ }
5627
+ async requestUpdateDocumentPage(page, updateRequest) {
5628
+ const writePath = `apps/angelo/app${page}`;
5629
+ if (!this.workspace.exists(writePath))
5630
+ this.workspace.writeFile(
5631
+ writePath,
5632
+ `export default function Page() {
5633
+ return <div>No Content</div>;
5634
+ }
5635
+ `
5636
+ );
5637
+ const instruction = await Prompter.getInstruction(this.name);
5638
+ const pageContent = this.workspace.getLocalFile(writePath);
5639
+ const request = `
5640
+ I'm updating a documentation website for the Akan.js framework.
5641
+
5642
+ I want to update the Next.js server-side page located at ${writePath}.
5643
+ Below is the content of the currently written page. You should update stale infos and preserve the existing content.
5564
5644
  \`\`\`tsx
5565
5645
  // File: ${writePath}
5566
5646
  ${pageContent.content}
5567
5647
  \`\`\`
5568
5648
 
5569
- \uD574\uB2F9 \uD398\uC774\uC9C0\uC5D0 \uC544\uB798 \uB0B4\uC6A9\uC744 \uCD5C\uC2E0\uD654 \uD574\uC11C \uC5C5\uB370\uC774\uD2B8\uD574\uC918. \uADFC\uC0AC\uD55C \uB514\uC790\uC778\uC73C\uB85C \uC801\uC6A9\uC774 \uD544\uC694\uD574.
5649
+ The existing instruction is below.
5650
+ \`\`\`markdown
5570
5651
  ${instruction}
5652
+ \`\`\`
5571
5653
 
5572
- CSS\uADDC\uCE59\uC740 \uB2E4\uC74C\uC744 \uB530\uB77C\uC11C \uC791\uC131\uD574\uC918.
5573
- - tailwindcss\uB97C \uC0AC\uC6A9\uD560 \uAC83
5574
- - daisyui \uB77C\uC774\uBE0C\uB7EC\uB9AC\uC758 className\uC744 \uC0AC\uC6A9\uD560 \uAC83
5654
+ Please update this page with the request below.
5655
+ ${updateRequest}
5575
5656
 
5576
- \uD30C\uC2F1\uD558\uAE30 \uC27D\uAC8C \uD30C\uC77C \uACB0\uACFC\uB9CC \uB2E4\uC74C\uACFC \uAC19\uC740 \uD615\uC2DD\uC73C\uB85C \uBC18\uD658\uD574\uC918.
5657
+ Please return only the file result in the following format for easy parsing.
5577
5658
  \`\`\`tsx
5578
5659
  // File: ${writePath}
5579
5660
  ...pageContent
5580
5661
  \`\`\`
5662
+ `;
5663
+ return { request, writePath };
5664
+ }
5665
+ async requestReapplyInstruction(filePath) {
5666
+ const guideJson = await Prompter.getGuideJson(this.name);
5667
+ const writePath = `${this.workspace.workspaceRoot}/pkgs/@akanjs/cli/src/guidelines/${this.name}/${guideJson.update.filePath}`;
5668
+ if (!guideJson.page)
5669
+ throw new Error(`${this.name} does not have a page.`);
5670
+ const pagePath = `apps/angelo/app${guideJson.page}`;
5671
+ const pageFile = this.workspace.getLocalFile(pagePath);
5672
+ const request = `
5673
+ I want to apply information in the Next.js page to markdown instruction file.
5674
+
5675
+ Here's the newest information in the Next.js page.
5676
+ \`\`\`tsx
5677
+ // File: ${pagePath}
5678
+ ${pageFile.content}
5679
+ \`\`\`
5680
+
5681
+ Here's the existing instruction file.
5682
+ \`\`\`markdown
5683
+ ${await Prompter.getInstruction(this.name)}
5684
+ \`\`\`
5685
+
5686
+ Please update the instruction file with the information in the Next.js page.
5581
5687
  `;
5582
5688
  return { request, writePath };
5583
5689
  }
@@ -5588,18 +5694,44 @@ var GuidelineRunner = class {
5588
5694
  async generateInstruction(workspace, guideName) {
5589
5695
  const session = new AiSession("generateInstruction", { workspace, cacheKey: guideName });
5590
5696
  const prompt = new GuidelinePrompt(workspace, guideName);
5591
- const { request, writePath } = await prompt.requestCreateInstruction();
5697
+ const { guideJson, request, writePath } = await prompt.requestCreateInstruction();
5592
5698
  const guidelineContent = await session.editMarkdown(request);
5593
5699
  workspace.writeFile(writePath, guidelineContent);
5700
+ return { guideJson, session };
5594
5701
  }
5595
- async deployDocPages(workspace, guideName) {
5702
+ async updateInstruction(workspace, guideName, { updateRequest }) {
5703
+ const session = new AiSession("updateInstruction", { workspace, cacheKey: guideName });
5704
+ const prompt = new GuidelinePrompt(workspace, guideName);
5705
+ const { guideJson, request, writePath } = await prompt.requestUpdateInstruction(updateRequest);
5706
+ const guidelineContent = await session.editMarkdown(request);
5707
+ workspace.writeFile(writePath, guidelineContent);
5708
+ return { guideJson, session };
5709
+ }
5710
+ async generateDocument(workspace, guideName) {
5596
5711
  const session = new AiSession("deployDocPages", { workspace, cacheKey: guideName });
5597
5712
  const guideJson = await Prompter.getGuideJson(guideName);
5598
5713
  const prompt = new GuidelinePrompt(workspace, guideName);
5599
- const { request, writePath } = await prompt.requestUpdateDocumentPage(guideJson.page);
5714
+ if (!guideJson.page)
5715
+ return Promise.resolve({});
5716
+ const { request } = await prompt.requestCreateDocumentPage(guideJson.page);
5717
+ await session.writeTypescripts(request, workspace);
5718
+ }
5719
+ async updateDocument(workspace, guideName, { updateRequest, session }) {
5720
+ const guideJson = await Prompter.getGuideJson(guideName);
5721
+ if (!guideJson.page)
5722
+ throw new Error(`${guideName} does not have a page.`);
5723
+ const prompt = new GuidelinePrompt(workspace, guideName);
5724
+ const { request, writePath } = await prompt.requestUpdateDocumentPage(guideJson.page, updateRequest);
5725
+ const guidelineContent = await session.editMarkdown(request);
5726
+ workspace.writeFile(writePath, guidelineContent);
5727
+ }
5728
+ async reapplyInstruction(workspace, guideName) {
5729
+ const session = new AiSession("reapplyInstruction", { workspace, cacheKey: guideName });
5730
+ const guideJson = await Prompter.getGuideJson(guideName);
5731
+ const prompt = new GuidelinePrompt(workspace, guideName);
5732
+ const { request, writePath } = await prompt.requestReapplyInstruction(guideJson.update.filePath);
5600
5733
  const guidelineContent = await session.editMarkdown(request);
5601
5734
  workspace.writeFile(writePath, guidelineContent);
5602
- return Promise.resolve({});
5603
5735
  }
5604
5736
  };
5605
5737
 
@@ -5610,9 +5742,23 @@ var GuidelineScript = class {
5610
5742
  const guideName = name ?? await Prompter.selectGuideline();
5611
5743
  await this.#runner.generateInstruction(workspace, guideName);
5612
5744
  }
5613
- async deployDocPages(workspace, name = null) {
5745
+ async updateInstruction(workspace, name = null, updateRequest) {
5746
+ const guideName = name ?? await Prompter.selectGuideline();
5747
+ const { guideJson, session } = await this.#runner.updateInstruction(workspace, guideName, { updateRequest });
5748
+ if (guideJson.page)
5749
+ await this.updateDocument(workspace, guideName, { updateRequest, session });
5750
+ }
5751
+ async generateDocument(workspace, name = null) {
5614
5752
  const guideName = name ?? await Prompter.selectGuideline();
5615
- await this.#runner.deployDocPages(workspace, guideName);
5753
+ await this.#runner.generateDocument(workspace, guideName);
5754
+ }
5755
+ async updateDocument(workspace, name = null, { updateRequest, session }) {
5756
+ const guideName = name ?? await Prompter.selectGuideline();
5757
+ await this.#runner.updateDocument(workspace, guideName, { updateRequest, session });
5758
+ }
5759
+ async reapplyInstruction(workspace, name = null) {
5760
+ const guideName = name ?? await Prompter.selectGuideline();
5761
+ await this.#runner.reapplyInstruction(workspace, guideName);
5616
5762
  }
5617
5763
  };
5618
5764
 
@@ -5622,8 +5768,14 @@ var GuidelineCommand = class {
5622
5768
  async generateInstruction(name, workspace) {
5623
5769
  await this.guidelineScript.generateInstruction(workspace, name);
5624
5770
  }
5625
- async deployDocs(name, workspace) {
5626
- await this.guidelineScript.deployDocPages(workspace, name);
5771
+ async updateInstruction(name, request, workspace) {
5772
+ await this.guidelineScript.updateInstruction(workspace, name, request);
5773
+ }
5774
+ async generateDocument(name, workspace) {
5775
+ await this.guidelineScript.generateDocument(workspace, name);
5776
+ }
5777
+ async reapplyInstruction(name, workspace) {
5778
+ await this.guidelineScript.reapplyInstruction(workspace, name);
5627
5779
  }
5628
5780
  };
5629
5781
  __decorateClass([
@@ -5631,11 +5783,22 @@ __decorateClass([
5631
5783
  __decorateParam(0, Argument("name", { ask: "name of the instruction", nullable: true })),
5632
5784
  __decorateParam(1, Workspace())
5633
5785
  ], GuidelineCommand.prototype, "generateInstruction", 1);
5786
+ __decorateClass([
5787
+ Target.Public(),
5788
+ __decorateParam(0, Argument("name", { ask: "name of the instruction", nullable: true })),
5789
+ __decorateParam(1, Option("request", { ask: "What do you want to update?" })),
5790
+ __decorateParam(2, Workspace())
5791
+ ], GuidelineCommand.prototype, "updateInstruction", 1);
5792
+ __decorateClass([
5793
+ Target.Public(),
5794
+ __decorateParam(0, Argument("name", { ask: "name of the instruction", nullable: true })),
5795
+ __decorateParam(1, Workspace())
5796
+ ], GuidelineCommand.prototype, "generateDocument", 1);
5634
5797
  __decorateClass([
5635
5798
  Target.Public(),
5636
5799
  __decorateParam(0, Argument("name", { ask: "name of the instruction", nullable: true })),
5637
5800
  __decorateParam(1, Workspace())
5638
- ], GuidelineCommand.prototype, "deployDocs", 1);
5801
+ ], GuidelineCommand.prototype, "reapplyInstruction", 1);
5639
5802
  GuidelineCommand = __decorateClass([
5640
5803
  Commands()
5641
5804
  ], GuidelineCommand);
@@ -5644,7 +5807,7 @@ GuidelineCommand = __decorateClass([
5644
5807
  import pluralize2 from "pluralize";
5645
5808
 
5646
5809
  // pkgs/@akanjs/cli/src/scalar/scalar.prompt.ts
5647
- import { input as input4 } from "@inquirer/prompts";
5810
+ import { input as input5 } from "@inquirer/prompts";
5648
5811
  var ScalarPrompt = class extends Prompter {
5649
5812
  constructor(sys3, name) {
5650
5813
  super();
@@ -5652,13 +5815,13 @@ var ScalarPrompt = class extends Prompter {
5652
5815
  this.name = name;
5653
5816
  }
5654
5817
  async requestUpdateConstant() {
5655
- const request = await input4({ message: `What do you want to change?` });
5818
+ const request = await input5({ message: `What do you want to change?` });
5656
5819
  return { request, validate: void 0 };
5657
5820
  }
5658
5821
  async requestCreateConstant() {
5659
5822
  const constantFiles = await this.sys.getConstantFilesWithLibs();
5660
- const description = await input4({ message: "description of scalar scalar" });
5661
- const schemaDescription = await input4({ message: "schema description of scalar scalar" });
5823
+ const description = await input5({ message: "description of scalar scalar" });
5824
+ const schemaDescription = await input5({ message: "schema description of scalar scalar" });
5662
5825
  await this.sys.applyTemplate({
5663
5826
  basePath: "./lib/__scalar",
5664
5827
  template: "__scalar",
@@ -5,10 +5,9 @@
5
5
  1. [Component Architecture](#component-architecture)
6
6
  2. [Component Types](#component-types)
7
7
  3. [File Naming Conventions](#file-naming-conventions)
8
- 4. [CSS Rule with TailwindCSS and DaisyUI](#css-rule-with-tailwindcss-and-daisyui)
9
- 5. [Utility Functions](#utility-functions)
10
- 6. [Best Practices](#best-practices)
11
- 7. [Complete Examples](#complete-examples)
8
+ 4. [Utility Functions](#utility-functions)
9
+ 5. [Best Practices](#best-practices)
10
+ 6. [Complete Examples](#complete-examples)
12
11
 
13
12
  ---
14
13
 
@@ -248,83 +247,6 @@ Akan.js uses a strict naming convention to maintain consistency:
248
247
 
249
248
  ---
250
249
 
251
- ## CSS Rule with TailwindCSS and DaisyUI
252
-
253
- Akan.js uses TailwindCSS with DaisyUI for styling. Follow these guidelines:
254
-
255
- ### 1. Class Management
256
-
257
- Always use `clsx` for conditional and composite classes:
258
-
259
- ```tsx
260
- import { clsx } from "@akanjs/client";
261
-
262
- className={clsx(
263
- "base-classes",
264
- condition && "conditional-class",
265
- variant === "primary" ? "primary-class" : "secondary-class",
266
- className // Always include passed className for composition
267
- )}
268
- ```
269
-
270
- ### 2. Color System
271
-
272
- Use DaisyUI's theme colors instead of hardcoded values. This ensures theme consistency and dark/light mode compatibility:
273
-
274
- ```tsx
275
- // Good - uses theme colors
276
- className = "bg-primary text-base-100";
277
-
278
- // Bad - uses hardcoded colors
279
- className = "bg-[#C33C32] text-[#FFFFFF]";
280
- ```
281
-
282
- DaisyUI provides semantic colors:
283
-
284
- - `primary`, `secondary`, `accent` - Brand colors
285
- - `base-100` through `base-900` - Background/text variants
286
- - `info`, `success`, `warning`, `error` - Status colors
287
-
288
- ### 3. Responsive Design
289
-
290
- Use Tailwind's responsive prefixes:
291
-
292
- ```tsx
293
- <div className="flex-col md:flex-row">
294
- <div className="w-full md:w-1/2 lg:w-1/3">Responsive width</div>
295
- <div className="hidden lg:block">Only visible on large screens</div>
296
- </div>
297
- ```
298
-
299
- ### 4. Animation
300
-
301
- Use Tailwind animation classes with transitions:
302
-
303
- ```tsx
304
- <div className="transition-all duration-300 hover:scale-105">
305
- Hover effect
306
- </div>
307
-
308
- <div className="animate-pulse">Loading indicator</div>
309
- ```
310
-
311
- ### 5. Component Styling
312
-
313
- Use DaisyUI components for consistent UIs:
314
-
315
- ```tsx
316
- <button className="btn btn-primary btn-sm">Primary Button</button>
317
-
318
- <div className="card bg-base-200 shadow-md">
319
- <div className="card-body">
320
- <h2 className="card-title">Card Title</h2>
321
- <p>Card content</p>
322
- </div>
323
- </div>
324
- ```
325
-
326
- ---
327
-
328
250
  ## Utility Functions
329
251
 
330
252
  Akan.js provides several utility modules for common frontend tasks: