@akanjs/cli 0.0.146 → 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.
- package/README.md +7 -26
- package/cjs/index.js +175 -18
- package/cjs/src/guidelines/cssRule/cssRule.instruction.md +1 -1
- package/cjs/src/guidelines/docPageRule/docPageRule.instruction.md +59 -52
- package/cjs/src/guidelines/modelConstant/modelConstant.instruction.md +335 -752
- package/cjs/src/guidelines/modelTemplate/modelTemplate.instruction.md +418 -391
- package/cjs/src/guidelines/modelUnit/modelUnit.instruction.md +0 -292
- package/cjs/src/guidelines/scalarModule/scalarModule.instruction.md +84 -0
- package/cjs/src/templates/app/main.js +1 -2
- package/esm/index.js +183 -26
- package/esm/src/guidelines/cssRule/cssRule.instruction.md +1 -1
- package/esm/src/guidelines/docPageRule/docPageRule.instruction.md +59 -52
- package/esm/src/guidelines/modelConstant/modelConstant.instruction.md +335 -752
- package/esm/src/guidelines/modelTemplate/modelTemplate.instruction.md +418 -391
- package/esm/src/guidelines/modelUnit/modelUnit.instruction.md +0 -292
- package/esm/src/guidelines/scalarModule/scalarModule.instruction.md +84 -0
- package/esm/src/templates/app/main.js +1 -2
- package/package.json +1 -1
- package/src/guideline/guideline.command.d.ts +3 -1
- package/src/guideline/guideline.prompt.d.ts +15 -1
- package/src/guideline/guideline.runner.d.ts +17 -3
- package/src/guideline/guideline.script.d.ts +8 -2
- package/src/guidelines/cssRule/cssRule.instruction.md +1 -1
- package/src/guidelines/docPageRule/docPageRule.instruction.md +59 -52
- package/src/guidelines/modelConstant/modelConstant.instruction.md +335 -752
- package/src/guidelines/modelTemplate/modelTemplate.instruction.md +418 -391
- package/src/guidelines/modelUnit/modelUnit.instruction.md +0 -292
- 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
|
-
|
|
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 {
|
|
1669
|
-
const message = typeChecker.formatDiagnostics(
|
|
1670
|
-
return {
|
|
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.
|
|
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
|
|
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
|
|
3881
|
-
const projectDesc = await
|
|
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
|
-
|
|
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 };
|
|
5551
|
+
}
|
|
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 };
|
|
5543
5580
|
}
|
|
5544
|
-
async
|
|
5545
|
-
const writePath = `apps/angelo/app
|
|
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,
|
|
@@ -5584,6 +5621,69 @@ Please return only the file result in the following format for easy parsing.
|
|
|
5584
5621
|
// File: ${writePath}
|
|
5585
5622
|
...pageContent
|
|
5586
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.
|
|
5644
|
+
\`\`\`tsx
|
|
5645
|
+
// File: ${writePath}
|
|
5646
|
+
${pageContent.content}
|
|
5647
|
+
\`\`\`
|
|
5648
|
+
|
|
5649
|
+
The existing instruction is below.
|
|
5650
|
+
\`\`\`markdown
|
|
5651
|
+
${instruction}
|
|
5652
|
+
\`\`\`
|
|
5653
|
+
|
|
5654
|
+
Please update this page with the request below.
|
|
5655
|
+
${updateRequest}
|
|
5656
|
+
|
|
5657
|
+
Please return only the file result in the following format for easy parsing.
|
|
5658
|
+
\`\`\`tsx
|
|
5659
|
+
// File: ${writePath}
|
|
5660
|
+
...pageContent
|
|
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.
|
|
5587
5687
|
`;
|
|
5588
5688
|
return { request, writePath };
|
|
5589
5689
|
}
|
|
@@ -5594,19 +5694,45 @@ var GuidelineRunner = class {
|
|
|
5594
5694
|
async generateInstruction(workspace, guideName) {
|
|
5595
5695
|
const session = new AiSession("generateInstruction", { workspace, cacheKey: guideName });
|
|
5596
5696
|
const prompt = new GuidelinePrompt(workspace, guideName);
|
|
5597
|
-
const { request, writePath } = await prompt.requestCreateInstruction();
|
|
5697
|
+
const { guideJson, request, writePath } = await prompt.requestCreateInstruction();
|
|
5698
|
+
const guidelineContent = await session.editMarkdown(request);
|
|
5699
|
+
workspace.writeFile(writePath, guidelineContent);
|
|
5700
|
+
return { guideJson, session };
|
|
5701
|
+
}
|
|
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);
|
|
5598
5706
|
const guidelineContent = await session.editMarkdown(request);
|
|
5599
5707
|
workspace.writeFile(writePath, guidelineContent);
|
|
5708
|
+
return { guideJson, session };
|
|
5600
5709
|
}
|
|
5601
|
-
async
|
|
5710
|
+
async generateDocument(workspace, guideName) {
|
|
5602
5711
|
const session = new AiSession("deployDocPages", { workspace, cacheKey: guideName });
|
|
5603
5712
|
const guideJson = await Prompter.getGuideJson(guideName);
|
|
5604
5713
|
const prompt = new GuidelinePrompt(workspace, guideName);
|
|
5605
5714
|
if (!guideJson.page)
|
|
5606
5715
|
return Promise.resolve({});
|
|
5607
|
-
const { request } = await prompt.
|
|
5716
|
+
const { request } = await prompt.requestCreateDocumentPage(guideJson.page);
|
|
5608
5717
|
await session.writeTypescripts(request, workspace);
|
|
5609
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);
|
|
5733
|
+
const guidelineContent = await session.editMarkdown(request);
|
|
5734
|
+
workspace.writeFile(writePath, guidelineContent);
|
|
5735
|
+
}
|
|
5610
5736
|
};
|
|
5611
5737
|
|
|
5612
5738
|
// pkgs/@akanjs/cli/src/guideline/guideline.script.ts
|
|
@@ -5616,9 +5742,23 @@ var GuidelineScript = class {
|
|
|
5616
5742
|
const guideName = name ?? await Prompter.selectGuideline();
|
|
5617
5743
|
await this.#runner.generateInstruction(workspace, guideName);
|
|
5618
5744
|
}
|
|
5619
|
-
async
|
|
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) {
|
|
5752
|
+
const guideName = name ?? await Prompter.selectGuideline();
|
|
5753
|
+
await this.#runner.generateDocument(workspace, guideName);
|
|
5754
|
+
}
|
|
5755
|
+
async updateDocument(workspace, name = null, { updateRequest, session }) {
|
|
5620
5756
|
const guideName = name ?? await Prompter.selectGuideline();
|
|
5621
|
-
await this.#runner.
|
|
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);
|
|
5622
5762
|
}
|
|
5623
5763
|
};
|
|
5624
5764
|
|
|
@@ -5628,8 +5768,14 @@ var GuidelineCommand = class {
|
|
|
5628
5768
|
async generateInstruction(name, workspace) {
|
|
5629
5769
|
await this.guidelineScript.generateInstruction(workspace, name);
|
|
5630
5770
|
}
|
|
5631
|
-
async
|
|
5632
|
-
await this.guidelineScript.
|
|
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);
|
|
5633
5779
|
}
|
|
5634
5780
|
};
|
|
5635
5781
|
__decorateClass([
|
|
@@ -5637,11 +5783,22 @@ __decorateClass([
|
|
|
5637
5783
|
__decorateParam(0, Argument("name", { ask: "name of the instruction", nullable: true })),
|
|
5638
5784
|
__decorateParam(1, Workspace())
|
|
5639
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);
|
|
5640
5797
|
__decorateClass([
|
|
5641
5798
|
Target.Public(),
|
|
5642
5799
|
__decorateParam(0, Argument("name", { ask: "name of the instruction", nullable: true })),
|
|
5643
5800
|
__decorateParam(1, Workspace())
|
|
5644
|
-
], GuidelineCommand.prototype, "
|
|
5801
|
+
], GuidelineCommand.prototype, "reapplyInstruction", 1);
|
|
5645
5802
|
GuidelineCommand = __decorateClass([
|
|
5646
5803
|
Commands()
|
|
5647
5804
|
], GuidelineCommand);
|
|
@@ -5650,7 +5807,7 @@ GuidelineCommand = __decorateClass([
|
|
|
5650
5807
|
import pluralize2 from "pluralize";
|
|
5651
5808
|
|
|
5652
5809
|
// pkgs/@akanjs/cli/src/scalar/scalar.prompt.ts
|
|
5653
|
-
import { input as
|
|
5810
|
+
import { input as input5 } from "@inquirer/prompts";
|
|
5654
5811
|
var ScalarPrompt = class extends Prompter {
|
|
5655
5812
|
constructor(sys3, name) {
|
|
5656
5813
|
super();
|
|
@@ -5658,13 +5815,13 @@ var ScalarPrompt = class extends Prompter {
|
|
|
5658
5815
|
this.name = name;
|
|
5659
5816
|
}
|
|
5660
5817
|
async requestUpdateConstant() {
|
|
5661
|
-
const request = await
|
|
5818
|
+
const request = await input5({ message: `What do you want to change?` });
|
|
5662
5819
|
return { request, validate: void 0 };
|
|
5663
5820
|
}
|
|
5664
5821
|
async requestCreateConstant() {
|
|
5665
5822
|
const constantFiles = await this.sys.getConstantFilesWithLibs();
|
|
5666
|
-
const description = await
|
|
5667
|
-
const schemaDescription = await
|
|
5823
|
+
const description = await input5({ message: "description of scalar scalar" });
|
|
5824
|
+
const schemaDescription = await input5({ message: "schema description of scalar scalar" });
|
|
5668
5825
|
await this.sys.applyTemplate({
|
|
5669
5826
|
basePath: "./lib/__scalar",
|
|
5670
5827
|
template: "__scalar",
|
|
@@ -180,7 +180,7 @@ export const Card = ({ className, project, href }: ModelProps<"project", cnst.Li
|
|
|
180
180
|
className={clsx(
|
|
181
181
|
"border-base-300 bg-base-100 flex flex-col gap-3 rounded-lg border-2 p-4",
|
|
182
182
|
"hover:border-primary transition-all hover:shadow-md",
|
|
183
|
-
"focus:ring-primary focus:
|
|
183
|
+
"focus:ring-primary focus:ring-2 focus:outline-hidden",
|
|
184
184
|
className
|
|
185
185
|
)}
|
|
186
186
|
>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
## Purpose of Documentation Pages in Akan.js
|
|
4
4
|
|
|
5
5
|
Documentation pages serve as the comprehensive knowledge base for Akan.js framework developers. They:
|
|
6
|
+
|
|
6
7
|
- Provide clear explanations of framework concepts, architecture, and components
|
|
7
8
|
- Offer technical reference for APIs, modules, and system functionalities
|
|
8
9
|
- Present implementation examples with real-world code snippets
|
|
@@ -16,11 +17,13 @@ Documentation pages serve as the comprehensive knowledge base for Akan.js framew
|
|
|
16
17
|
### 1. File Location and Structure
|
|
17
18
|
|
|
18
19
|
Documentation pages should be created in the following location:
|
|
20
|
+
|
|
19
21
|
```
|
|
20
22
|
apps/angelo/app/[lang]/akanjs/(docs)/docs/[category]/[pageName]/page.tsx
|
|
21
23
|
```
|
|
22
24
|
|
|
23
25
|
Where:
|
|
26
|
+
|
|
24
27
|
- `[lang]`: Language code (e.g., `en`, `ko`)
|
|
25
28
|
- `[category]`: Main documentation category (e.g., `systemArch`, `module`, `api`)
|
|
26
29
|
- `[pageName]`: Specific page name (e.g., `frontend`, `signal`, `authentication`)
|
|
@@ -34,43 +37,43 @@ Each documentation page follows this basic structure:
|
|
|
34
37
|
|
|
35
38
|
```tsx
|
|
36
39
|
import { usePage } from "@angelo/client";
|
|
37
|
-
import { Docs } from "
|
|
40
|
+
import { Docs } from "@angelo/ui";
|
|
38
41
|
|
|
39
42
|
export default function Page() {
|
|
40
43
|
const { l } = usePage(); // For internationalization
|
|
41
|
-
|
|
44
|
+
|
|
42
45
|
return (
|
|
43
46
|
<>
|
|
44
47
|
<Docs.Title>
|
|
45
48
|
{l.trans({
|
|
46
49
|
en: "Main Page Title",
|
|
47
|
-
ko: "메인 페이지 제목"
|
|
50
|
+
ko: "메인 페이지 제목",
|
|
48
51
|
})}
|
|
49
52
|
</Docs.Title>
|
|
50
|
-
|
|
53
|
+
|
|
51
54
|
<Docs.Description>
|
|
52
55
|
{l.trans({
|
|
53
56
|
en: "Introduction paragraph that explains the concept...",
|
|
54
|
-
ko: "개념을 설명하는 소개 문단..."
|
|
57
|
+
ko: "개념을 설명하는 소개 문단...",
|
|
55
58
|
})}
|
|
56
59
|
</Docs.Description>
|
|
57
|
-
|
|
60
|
+
|
|
58
61
|
<div className="divider"></div>
|
|
59
|
-
|
|
62
|
+
|
|
60
63
|
<Docs.SubTitle>
|
|
61
64
|
{l.trans({
|
|
62
65
|
en: "Section Title",
|
|
63
|
-
ko: "섹션 제목"
|
|
66
|
+
ko: "섹션 제목",
|
|
64
67
|
})}
|
|
65
68
|
</Docs.SubTitle>
|
|
66
|
-
|
|
69
|
+
|
|
67
70
|
<Docs.Description>
|
|
68
71
|
{l.trans({
|
|
69
72
|
en: "Detailed explanation of this section...",
|
|
70
|
-
ko: "이 섹션에 대한 자세한 설명..."
|
|
73
|
+
ko: "이 섹션에 대한 자세한 설명...",
|
|
71
74
|
})}
|
|
72
75
|
</Docs.Description>
|
|
73
|
-
|
|
76
|
+
|
|
74
77
|
<Docs.CodeSnippet
|
|
75
78
|
language="typescript"
|
|
76
79
|
code={`
|
|
@@ -78,7 +81,7 @@ export default function Page() {
|
|
|
78
81
|
const example = "Hello Akan.js";
|
|
79
82
|
`}
|
|
80
83
|
/>
|
|
81
|
-
|
|
84
|
+
|
|
82
85
|
{/* Additional sections and components */}
|
|
83
86
|
</>
|
|
84
87
|
);
|
|
@@ -109,10 +112,10 @@ const { l } = usePage();
|
|
|
109
112
|
<Docs.Title>
|
|
110
113
|
{l.trans({
|
|
111
114
|
en: "English Title",
|
|
112
|
-
ko: "한국어 제목"
|
|
115
|
+
ko: "한국어 제목",
|
|
113
116
|
// Add other languages as needed
|
|
114
117
|
})}
|
|
115
|
-
</Docs.Title
|
|
118
|
+
</Docs.Title>;
|
|
116
119
|
```
|
|
117
120
|
|
|
118
121
|
## Utility Components
|
|
@@ -120,8 +123,8 @@ const { l } = usePage();
|
|
|
120
123
|
The `Docs` namespace provides specialized components for creating consistent documentation pages. Always import and use them with the `Docs` prefix:
|
|
121
124
|
|
|
122
125
|
```tsx
|
|
123
|
-
import { Docs } from "
|
|
124
|
-
// Correct usage: <Docs.Title>, NOT import { Title } from "
|
|
126
|
+
import { Docs } from "@angelo/ui";
|
|
127
|
+
// Correct usage: <Docs.Title>, NOT import { Title } from "@angelo/ui";
|
|
125
128
|
```
|
|
126
129
|
|
|
127
130
|
### 1. Title Components
|
|
@@ -135,17 +138,16 @@ import { Docs } from "@/ui/Docs";
|
|
|
135
138
|
### 2. Content Components
|
|
136
139
|
|
|
137
140
|
**Description Block:**
|
|
141
|
+
|
|
138
142
|
```tsx
|
|
139
143
|
<Docs.Description>
|
|
140
|
-
Detailed explanatory text that supports:
|
|
141
|
-
|
|
142
|
-
- Multi-paragraph content
|
|
143
|
-
- HTML elements
|
|
144
|
-
- Internationalization via l.trans()
|
|
144
|
+
Detailed explanatory text that supports: - Markdown-style formatting - Multi-paragraph content - HTML elements -
|
|
145
|
+
Internationalization via l.trans()
|
|
145
146
|
</Docs.Description>
|
|
146
147
|
```
|
|
147
148
|
|
|
148
149
|
**Code Snippet:**
|
|
150
|
+
|
|
149
151
|
```tsx
|
|
150
152
|
<Docs.CodeSnippet
|
|
151
153
|
language="typescript" // Supported: typescript, bash, and others
|
|
@@ -162,15 +164,16 @@ import { Docs } from "@/ui/Docs";
|
|
|
162
164
|
### 3. Table Components
|
|
163
165
|
|
|
164
166
|
**Option Table:** For displaying configuration options, parameters, or properties
|
|
167
|
+
|
|
165
168
|
```tsx
|
|
166
169
|
<Docs.OptionTable
|
|
167
170
|
items={[
|
|
168
171
|
{
|
|
169
|
-
key: "optionName",
|
|
170
|
-
type: "string",
|
|
172
|
+
key: "optionName", // Option identifier
|
|
173
|
+
type: "string", // Data type
|
|
171
174
|
default: "defaultVal", // Default value
|
|
172
|
-
desc: "Description",
|
|
173
|
-
example: "example()"
|
|
175
|
+
desc: "Description", // Explanation (can use l.trans())
|
|
176
|
+
example: "example()", // Usage example
|
|
174
177
|
},
|
|
175
178
|
// Additional items...
|
|
176
179
|
]}
|
|
@@ -178,14 +181,15 @@ import { Docs } from "@/ui/Docs";
|
|
|
178
181
|
```
|
|
179
182
|
|
|
180
183
|
**Introduction Table:** For listing and describing related items
|
|
184
|
+
|
|
181
185
|
```tsx
|
|
182
186
|
<Docs.IntroTable
|
|
183
|
-
type="conceptName"
|
|
187
|
+
type="conceptName" // Table category identifier
|
|
184
188
|
items={[
|
|
185
189
|
{
|
|
186
|
-
name: "itemName",
|
|
190
|
+
name: "itemName", // Item name
|
|
187
191
|
desc: "Description", // Explanation (can use l.trans())
|
|
188
|
-
example: "example()" // Usage example
|
|
192
|
+
example: "example()", // Usage example
|
|
189
193
|
},
|
|
190
194
|
// Additional items...
|
|
191
195
|
]}
|
|
@@ -195,11 +199,13 @@ import { Docs } from "@/ui/Docs";
|
|
|
195
199
|
### 4. Code Display Components
|
|
196
200
|
|
|
197
201
|
**Inline Code:**
|
|
202
|
+
|
|
198
203
|
```tsx
|
|
199
204
|
<Docs.Code language="typescript">inlineCodeExample</Docs.Code>
|
|
200
205
|
```
|
|
201
206
|
|
|
202
207
|
**Custom Code Block:**
|
|
208
|
+
|
|
203
209
|
```tsx
|
|
204
210
|
<Docs.CodeView>
|
|
205
211
|
<Docs.Code prefix="1">// First line with line number</Docs.Code>
|
|
@@ -212,6 +218,7 @@ import { Docs } from "@/ui/Docs";
|
|
|
212
218
|
The document layout is automatically applied through the parent layout.tsx file, so you don't need to use `<Docs.Layout>` in your page component.
|
|
213
219
|
|
|
214
220
|
**Header and Footer:**
|
|
221
|
+
|
|
215
222
|
```tsx
|
|
216
223
|
<Docs.Header>Header content</Docs.Header>
|
|
217
224
|
<Docs.Footer>Footer content</Docs.Footer>
|
|
@@ -264,11 +271,11 @@ The document layout is automatically applied through the parent layout.tsx file,
|
|
|
264
271
|
|
|
265
272
|
```tsx
|
|
266
273
|
import { usePage } from "@angelo/client";
|
|
267
|
-
import { Docs, type IntroItem, type OptionItem } from "
|
|
274
|
+
import { Docs, type IntroItem, type OptionItem } from "@angelo/ui";
|
|
268
275
|
|
|
269
276
|
export default function SignalDocsPage() {
|
|
270
277
|
const { l } = usePage();
|
|
271
|
-
|
|
278
|
+
|
|
272
279
|
// Define configuration options
|
|
273
280
|
const signalOptions: OptionItem[] = [
|
|
274
281
|
{
|
|
@@ -277,22 +284,22 @@ export default function SignalDocsPage() {
|
|
|
277
284
|
default: "undefined",
|
|
278
285
|
desc: l.trans({
|
|
279
286
|
en: "Initial value of the signal",
|
|
280
|
-
ko: "시그널의 초기값"
|
|
287
|
+
ko: "시그널의 초기값",
|
|
281
288
|
}),
|
|
282
|
-
example: "signal(0)"
|
|
289
|
+
example: "signal(0)",
|
|
283
290
|
},
|
|
284
291
|
// Additional options...
|
|
285
292
|
];
|
|
286
|
-
|
|
293
|
+
|
|
287
294
|
// Define feature list
|
|
288
295
|
const signalFeatures: IntroItem[] = [
|
|
289
296
|
{
|
|
290
297
|
name: "createSignal",
|
|
291
298
|
desc: l.trans({
|
|
292
299
|
en: "Creates a new reactive signal",
|
|
293
|
-
ko: "새로운 반응형 시그널을 생성"
|
|
300
|
+
ko: "새로운 반응형 시그널을 생성",
|
|
294
301
|
}),
|
|
295
|
-
example: "const [value, setValue] = createSignal(0)"
|
|
302
|
+
example: "const [value, setValue] = createSignal(0)",
|
|
296
303
|
},
|
|
297
304
|
// Additional features...
|
|
298
305
|
];
|
|
@@ -302,33 +309,33 @@ export default function SignalDocsPage() {
|
|
|
302
309
|
<Docs.Title>
|
|
303
310
|
{l.trans({
|
|
304
311
|
en: "Signal Module",
|
|
305
|
-
ko: "시그널 모듈"
|
|
312
|
+
ko: "시그널 모듈",
|
|
306
313
|
})}
|
|
307
314
|
</Docs.Title>
|
|
308
|
-
|
|
315
|
+
|
|
309
316
|
<Docs.Description>
|
|
310
317
|
{l.trans({
|
|
311
318
|
en: "The Signal module provides reactive state management capabilities for Akan.js applications. Signals allow components to efficiently respond to state changes without unnecessary re-renders.",
|
|
312
|
-
ko: "시그널 모듈은 Akan.js 애플리케이션을 위한 반응형 상태 관리 기능을 제공합니다. 시그널을 통해 컴포넌트는 불필요한 재렌더링 없이 상태 변화에 효율적으로 반응할 수 있습니다."
|
|
319
|
+
ko: "시그널 모듈은 Akan.js 애플리케이션을 위한 반응형 상태 관리 기능을 제공합니다. 시그널을 통해 컴포넌트는 불필요한 재렌더링 없이 상태 변화에 효율적으로 반응할 수 있습니다.",
|
|
313
320
|
})}
|
|
314
321
|
</Docs.Description>
|
|
315
|
-
|
|
322
|
+
|
|
316
323
|
<div className="divider"></div>
|
|
317
|
-
|
|
324
|
+
|
|
318
325
|
<Docs.SubTitle>
|
|
319
326
|
{l.trans({
|
|
320
327
|
en: "Basic Usage",
|
|
321
|
-
ko: "기본 사용법"
|
|
328
|
+
ko: "기본 사용법",
|
|
322
329
|
})}
|
|
323
330
|
</Docs.SubTitle>
|
|
324
|
-
|
|
331
|
+
|
|
325
332
|
<Docs.Description>
|
|
326
333
|
{l.trans({
|
|
327
334
|
en: "Creating and using signals is straightforward:",
|
|
328
|
-
ko: "시그널 생성 및 사용은 간단합니다:"
|
|
335
|
+
ko: "시그널 생성 및 사용은 간단합니다:",
|
|
329
336
|
})}
|
|
330
337
|
</Docs.Description>
|
|
331
|
-
|
|
338
|
+
|
|
332
339
|
<Docs.CodeSnippet
|
|
333
340
|
language="typescript"
|
|
334
341
|
code={`
|
|
@@ -347,23 +354,23 @@ function Counter() {
|
|
|
347
354
|
return <div>{count()}</div>;
|
|
348
355
|
}`}
|
|
349
356
|
/>
|
|
350
|
-
|
|
357
|
+
|
|
351
358
|
<Docs.SubTitle>
|
|
352
359
|
{l.trans({
|
|
353
360
|
en: "Configuration Options",
|
|
354
|
-
ko: "설정 옵션"
|
|
361
|
+
ko: "설정 옵션",
|
|
355
362
|
})}
|
|
356
363
|
</Docs.SubTitle>
|
|
357
|
-
|
|
364
|
+
|
|
358
365
|
<Docs.OptionTable items={signalOptions} />
|
|
359
|
-
|
|
366
|
+
|
|
360
367
|
<Docs.SubTitle>
|
|
361
368
|
{l.trans({
|
|
362
369
|
en: "API Reference",
|
|
363
|
-
ko: "API 참조"
|
|
370
|
+
ko: "API 참조",
|
|
364
371
|
})}
|
|
365
372
|
</Docs.SubTitle>
|
|
366
|
-
|
|
373
|
+
|
|
367
374
|
<Docs.IntroTable type="function" items={signalFeatures} />
|
|
368
375
|
</>
|
|
369
376
|
);
|
|
@@ -373,10 +380,10 @@ function Counter() {
|
|
|
373
380
|
## Troubleshooting
|
|
374
381
|
|
|
375
382
|
1. **Layout Issues**: Do not manually add `<Docs.Layout>` as it's automatically applied at the layout level
|
|
376
|
-
2. **Component Import**: Always use the namespace import `import { Docs } from "
|
|
383
|
+
2. **Component Import**: Always use the namespace import `import { Docs } from "@angelo/ui"` and reference components as `<Docs.ComponentName>`
|
|
377
384
|
3. **Translation Issues**: Ensure all user-facing text uses `l.trans()` with complete translations for all supported languages
|
|
378
385
|
4. **Code Highlighting**: Verify the correct language is specified for `<Docs.CodeSnippet>` and `<Docs.Code>` components
|
|
379
386
|
5. **Style Consistency**: If your documentation looks different from others, compare with existing pages to identify styling discrepancies
|
|
380
387
|
6. **Navigation Anchors**: For long pages, include anchor links by adding hidden divs with IDs
|
|
381
388
|
|
|
382
|
-
For additional assistance, refer to existing documentation pages or contact the framework documentation team.
|
|
389
|
+
For additional assistance, refer to existing documentation pages or contact the framework documentation team.
|