kodu 2.1.3 → 3.0.1

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 (131) hide show
  1. package/README.md +24 -3
  2. package/bin/kodu.js +23 -0
  3. package/package.json +11 -67
  4. package/scripts/postinstall.js +69 -0
  5. package/AGENTS.md +0 -214
  6. package/__tests__/core/fs/fs.service.test.ts +0 -72
  7. package/__tests__/shared/cleaner/cleaner.service.test.ts +0 -102
  8. package/__tests__/shared/git/git.service.test.ts +0 -84
  9. package/__tests__/shared/tokenizer/tokenizer.service.test.ts +0 -45
  10. package/biome.json +0 -50
  11. package/dist/package.json +0 -96
  12. package/dist/src/app.module.d.ts +0 -2
  13. package/dist/src/app.module.js +0 -36
  14. package/dist/src/app.module.js.map +0 -1
  15. package/dist/src/commands/clean/clean.command.d.ts +0 -37
  16. package/dist/src/commands/clean/clean.command.js +0 -240
  17. package/dist/src/commands/clean/clean.command.js.map +0 -1
  18. package/dist/src/commands/clean/clean.module.d.ts +0 -2
  19. package/dist/src/commands/clean/clean.module.js +0 -26
  20. package/dist/src/commands/clean/clean.module.js.map +0 -1
  21. package/dist/src/commands/init/init.command.d.ts +0 -10
  22. package/dist/src/commands/init/init.command.js +0 -96
  23. package/dist/src/commands/init/init.command.js.map +0 -1
  24. package/dist/src/commands/init/init.module.d.ts +0 -2
  25. package/dist/src/commands/init/init.module.js +0 -22
  26. package/dist/src/commands/init/init.module.js.map +0 -1
  27. package/dist/src/commands/pack/pack.command.d.ts +0 -51
  28. package/dist/src/commands/pack/pack.command.js +0 -355
  29. package/dist/src/commands/pack/pack.command.js.map +0 -1
  30. package/dist/src/commands/pack/pack.module.d.ts +0 -2
  31. package/dist/src/commands/pack/pack.module.js +0 -27
  32. package/dist/src/commands/pack/pack.module.js.map +0 -1
  33. package/dist/src/core/config/config.module.d.ts +0 -2
  34. package/dist/src/core/config/config.module.js +0 -23
  35. package/dist/src/core/config/config.module.js.map +0 -1
  36. package/dist/src/core/config/config.schema.d.ts +0 -19
  37. package/dist/src/core/config/config.schema.js +0 -56
  38. package/dist/src/core/config/config.schema.js.map +0 -1
  39. package/dist/src/core/config/config.service.d.ts +0 -7
  40. package/dist/src/core/config/config.service.js +0 -49
  41. package/dist/src/core/config/config.service.js.map +0 -1
  42. package/dist/src/core/config/prompt.service.d.ts +0 -10
  43. package/dist/src/core/config/prompt.service.js +0 -80
  44. package/dist/src/core/config/prompt.service.js.map +0 -1
  45. package/dist/src/core/file-system/fs.module.d.ts +0 -2
  46. package/dist/src/core/file-system/fs.module.js +0 -21
  47. package/dist/src/core/file-system/fs.module.js.map +0 -1
  48. package/dist/src/core/file-system/fs.service.d.ts +0 -27
  49. package/dist/src/core/file-system/fs.service.js +0 -203
  50. package/dist/src/core/file-system/fs.service.js.map +0 -1
  51. package/dist/src/core/ui/ui.module.d.ts +0 -2
  52. package/dist/src/core/ui/ui.module.js +0 -22
  53. package/dist/src/core/ui/ui.module.js.map +0 -1
  54. package/dist/src/core/ui/ui.service.d.ts +0 -22
  55. package/dist/src/core/ui/ui.service.js +0 -43
  56. package/dist/src/core/ui/ui.service.js.map +0 -1
  57. package/dist/src/main.d.ts +0 -2
  58. package/dist/src/main.js +0 -16
  59. package/dist/src/main.js.map +0 -1
  60. package/dist/src/shared/cleaner/cleaner.service.d.ts +0 -23
  61. package/dist/src/shared/cleaner/cleaner.service.js +0 -223
  62. package/dist/src/shared/cleaner/cleaner.service.js.map +0 -1
  63. package/dist/src/shared/cleaner/cleaner.types.d.ts +0 -21
  64. package/dist/src/shared/cleaner/cleaner.types.js +0 -3
  65. package/dist/src/shared/cleaner/cleaner.types.js.map +0 -1
  66. package/dist/src/shared/constants.d.ts +0 -4
  67. package/dist/src/shared/constants.js +0 -113
  68. package/dist/src/shared/constants.js.map +0 -1
  69. package/dist/src/shared/deps/deps.module.d.ts +0 -2
  70. package/dist/src/shared/deps/deps.module.js +0 -21
  71. package/dist/src/shared/deps/deps.module.js.map +0 -1
  72. package/dist/src/shared/deps/deps.service.d.ts +0 -15
  73. package/dist/src/shared/deps/deps.service.js +0 -114
  74. package/dist/src/shared/deps/deps.service.js.map +0 -1
  75. package/dist/src/shared/git/git.module.d.ts +0 -2
  76. package/dist/src/shared/git/git.module.js +0 -21
  77. package/dist/src/shared/git/git.module.js.map +0 -1
  78. package/dist/src/shared/git/git.service.d.ts +0 -5
  79. package/dist/src/shared/git/git.service.js +0 -56
  80. package/dist/src/shared/git/git.service.js.map +0 -1
  81. package/dist/src/shared/tokenizer/tokenizer.module.d.ts +0 -2
  82. package/dist/src/shared/tokenizer/tokenizer.module.js +0 -21
  83. package/dist/src/shared/tokenizer/tokenizer.module.js.map +0 -1
  84. package/dist/src/shared/tokenizer/tokenizer.service.d.ts +0 -10
  85. package/dist/src/shared/tokenizer/tokenizer.service.js +0 -36
  86. package/dist/src/shared/tokenizer/tokenizer.service.js.map +0 -1
  87. package/dist/tsconfig.build.tsbuildinfo +0 -1
  88. package/docs/todo.md +0 -7
  89. package/knip.json +0 -10
  90. package/kodu.json +0 -63
  91. package/kodu.schema.json +0 -100
  92. package/lefthook.yml +0 -11
  93. package/nest-cli.json +0 -8
  94. package/scripts/generate-json-schema.ts +0 -18
  95. package/skills/doc-gen/SKILL.md +0 -490
  96. package/skills/doc-gen/scripts/doc_gen.py +0 -911
  97. package/skills/implement-project/SKILL.md +0 -409
  98. package/skills/liteend-init/SKILL.md +0 -84
  99. package/skills/litefront-init/SKILL.md +0 -96
  100. package/skills/litefront-prototype/SKILL.md +0 -484
  101. package/skills/project-setup-standardizer/SKILL.md +0 -285
  102. package/skills/start/SKILL.md +0 -319
  103. package/skills/tech-blueprint/SKILL.md +0 -890
  104. package/skills/tech-blueprint/scripts/blueprint_validator.py +0 -417
  105. package/src/app.module.ts +0 -23
  106. package/src/commands/clean/clean.command.ts +0 -235
  107. package/src/commands/clean/clean.module.ts +0 -13
  108. package/src/commands/init/init.command.ts +0 -92
  109. package/src/commands/init/init.module.ts +0 -9
  110. package/src/commands/pack/pack.command.ts +0 -347
  111. package/src/commands/pack/pack.module.ts +0 -14
  112. package/src/core/config/config.module.ts +0 -10
  113. package/src/core/config/config.schema.ts +0 -58
  114. package/src/core/config/config.service.ts +0 -43
  115. package/src/core/config/prompt.service.ts +0 -80
  116. package/src/core/file-system/fs.module.ts +0 -8
  117. package/src/core/file-system/fs.service.ts +0 -248
  118. package/src/core/ui/ui.module.ts +0 -9
  119. package/src/core/ui/ui.service.ts +0 -39
  120. package/src/main.ts +0 -12
  121. package/src/shared/cleaner/cleaner.service.ts +0 -289
  122. package/src/shared/cleaner/cleaner.types.ts +0 -23
  123. package/src/shared/constants.ts +0 -118
  124. package/src/shared/deps/deps.module.ts +0 -8
  125. package/src/shared/deps/deps.service.ts +0 -175
  126. package/src/shared/git/git.module.ts +0 -8
  127. package/src/shared/git/git.service.ts +0 -47
  128. package/src/shared/tokenizer/tokenizer.module.ts +0 -8
  129. package/src/shared/tokenizer/tokenizer.service.ts +0 -30
  130. package/tsconfig.build.json +0 -7
  131. package/tsconfig.json +0 -28
@@ -1,118 +0,0 @@
1
- export const MAX_FILE_SIZE_BYTES = 1024 * 1024; // 1 MB
2
- export const DEFAULT_PRICE_PER_MILLION = 5;
3
-
4
- const BINARY_EXTENSION_LIST = [
5
- '.png',
6
- '.jpg',
7
- '.jpeg',
8
- '.webp',
9
- '.gif',
10
- '.bmp',
11
- '.ico',
12
- '.tif',
13
- '.tiff',
14
- '.psd',
15
- '.ai',
16
- '.sketch',
17
- '.heic',
18
- '.heif',
19
- '.mp3',
20
- '.wav',
21
- '.flac',
22
- '.ogg',
23
- '.m4a',
24
- '.mp4',
25
- '.mkv',
26
- '.mov',
27
- '.avi',
28
- '.webm',
29
- '.wmv',
30
- '.flv',
31
- '.mpg',
32
- '.mpeg',
33
- '.ogv',
34
- '.zip',
35
- '.gz',
36
- '.tgz',
37
- '.bz2',
38
- '.xz',
39
- '.rar',
40
- '.7z',
41
- '.tar',
42
- '.pdf',
43
- '.exe',
44
- '.dll',
45
- '.so',
46
- '.dylib',
47
- '.class',
48
- '.jar',
49
- '.war',
50
- '.ear',
51
- '.ttf',
52
- '.otf',
53
- '.woff',
54
- '.woff2',
55
- '.eot',
56
- '.bin',
57
- '.pak',
58
- '.dat',
59
- ];
60
-
61
- const KNOWN_TEXT_LIST = [
62
- // Web / JS
63
- '.js',
64
- '.jsx',
65
- '.ts',
66
- '.tsx',
67
- '.mjs',
68
- '.cjs',
69
- '.json',
70
- '.html',
71
- '.css',
72
- '.scss',
73
- '.less',
74
- '.vue',
75
- '.svelte',
76
- // Backend / System
77
- '.java',
78
- '.py',
79
- '.c',
80
- '.cpp',
81
- '.h',
82
- '.hpp',
83
- '.cs',
84
- '.go',
85
- '.rs',
86
- '.php',
87
- '.rb',
88
- '.swift',
89
- '.kt',
90
- '.dart',
91
- '.scala',
92
- '.pl',
93
- '.lua',
94
- '.sh',
95
- '.bat',
96
- // Data / Docs
97
- '.md',
98
- '.txt',
99
- '.xml',
100
- '.yaml',
101
- '.yml',
102
- '.sql',
103
- '.graphql',
104
- '.toml',
105
- '.ini',
106
- '.env',
107
- // Config
108
- '.gitignore',
109
- '.dockerignore',
110
- 'dockerfile',
111
- '.editorconfig',
112
- ];
113
-
114
- const createLowercaseSet = (values: string[]): ReadonlySet<string> =>
115
- new Set(values.map((value) => value.toLowerCase()));
116
-
117
- export const BINARY_EXTENSIONS = createLowercaseSet(BINARY_EXTENSION_LIST);
118
- export const KNOWN_TEXT_EXTENSIONS = createLowercaseSet(KNOWN_TEXT_LIST);
@@ -1,8 +0,0 @@
1
- import { Module } from '@nestjs/common';
2
- import { DepsService } from './deps.service';
3
-
4
- @Module({
5
- providers: [DepsService],
6
- exports: [DepsService],
7
- })
8
- export class DepsModule {}
@@ -1,175 +0,0 @@
1
- import path from 'node:path';
2
- import { Injectable } from '@nestjs/common';
3
- import { Project } from 'ts-morph';
4
-
5
- export type DepsResult = {
6
- files: string[];
7
- explain: Map<string, string>;
8
- };
9
-
10
- type CollectOptions = {
11
- maxDepth?: number;
12
- includeTypes?: boolean;
13
- includeDynamic?: boolean;
14
- };
15
-
16
- @Injectable()
17
- export class DepsService {
18
- collectDependencies(
19
- entryFiles: string[],
20
- projectRoot: string,
21
- options: CollectOptions = {},
22
- ): DepsResult {
23
- const {
24
- maxDepth = Infinity,
25
- includeTypes = true,
26
- includeDynamic = false,
27
- } = options;
28
-
29
- const tsConfigPath = this.findTsConfig(projectRoot);
30
- const project = tsConfigPath
31
- ? new Project({
32
- tsConfigFilePath: tsConfigPath,
33
- skipAddingFilesFromTsConfig: true,
34
- })
35
- : new Project({
36
- compilerOptions: {
37
- allowJs: true,
38
- resolveJsonModule: true,
39
- moduleResolution: 2, // NodeJs
40
- },
41
- });
42
-
43
- const visited = new Set<string>();
44
- const explain = new Map<string, string>();
45
-
46
- const absEntries = entryFiles.map((f) =>
47
- path.isAbsolute(f) ? f : path.resolve(projectRoot, f),
48
- );
49
-
50
- for (const entry of absEntries) {
51
- explain.set(entry, 'entry point');
52
- this.collect(
53
- project,
54
- entry,
55
- projectRoot,
56
- visited,
57
- explain,
58
- 0,
59
- maxDepth,
60
- includeTypes,
61
- includeDynamic,
62
- );
63
- }
64
-
65
- const files = [...visited].map((abs) =>
66
- path.relative(projectRoot, abs).split(path.sep).join(path.posix.sep),
67
- );
68
-
69
- return { files, explain };
70
- }
71
-
72
- private collect(
73
- project: Project,
74
- absFile: string,
75
- projectRoot: string,
76
- visited: Set<string>,
77
- explain: Map<string, string>,
78
- depth: number,
79
- maxDepth: number,
80
- includeTypes: boolean,
81
- includeDynamic: boolean,
82
- ): void {
83
- if (visited.has(absFile)) return;
84
- visited.add(absFile);
85
-
86
- if (depth >= maxDepth) return;
87
-
88
- let sourceFile = project.getSourceFile(absFile);
89
- if (!sourceFile) {
90
- try {
91
- sourceFile = project.addSourceFileAtPath(absFile);
92
- } catch {
93
- return;
94
- }
95
- }
96
-
97
- const relFrom = path
98
- .relative(projectRoot, absFile)
99
- .split(path.sep)
100
- .join(path.posix.sep);
101
-
102
- for (const importDecl of sourceFile.getImportDeclarations()) {
103
- if (!includeTypes && importDecl.isTypeOnly()) continue;
104
-
105
- const resolved = importDecl.getModuleSpecifierSourceFile();
106
- if (!resolved) continue;
107
-
108
- const absResolved = resolved.getFilePath();
109
- if (absResolved.includes('node_modules')) continue;
110
-
111
- if (!explain.has(absResolved)) {
112
- const what = importDecl.isTypeOnly() ? 'type import' : 'import';
113
- explain.set(absResolved, `${what} from ${relFrom}`);
114
- }
115
-
116
- this.collect(
117
- project,
118
- absResolved,
119
- projectRoot,
120
- visited,
121
- explain,
122
- depth + 1,
123
- maxDepth,
124
- includeTypes,
125
- includeDynamic,
126
- );
127
- }
128
-
129
- void includeDynamic;
130
-
131
- for (const exportDecl of sourceFile.getExportDeclarations()) {
132
- const resolved = exportDecl.getModuleSpecifierSourceFile();
133
- if (!resolved) continue;
134
-
135
- const absResolved = resolved.getFilePath();
136
- if (absResolved.includes('node_modules')) continue;
137
-
138
- if (!explain.has(absResolved)) {
139
- const relFrom2 = path
140
- .relative(projectRoot, absFile)
141
- .split(path.sep)
142
- .join(path.posix.sep);
143
- explain.set(absResolved, `re-export from ${relFrom2}`);
144
- }
145
-
146
- this.collect(
147
- project,
148
- absResolved,
149
- projectRoot,
150
- visited,
151
- explain,
152
- depth + 1,
153
- maxDepth,
154
- includeTypes,
155
- includeDynamic,
156
- );
157
- }
158
- }
159
-
160
- private findTsConfig(projectRoot: string): string | undefined {
161
- const candidates = [
162
- path.join(projectRoot, 'tsconfig.json'),
163
- path.join(projectRoot, 'tsconfig.base.json'),
164
- ];
165
- for (const c of candidates) {
166
- try {
167
- require('node:fs').accessSync(c);
168
- return c;
169
- } catch {
170
- // not found
171
- }
172
- }
173
- return undefined;
174
- }
175
- }
@@ -1,8 +0,0 @@
1
- import { Module } from '@nestjs/common';
2
- import { GitService } from './git.service';
3
-
4
- @Module({
5
- providers: [GitService],
6
- exports: [GitService],
7
- })
8
- export class GitModule {}
@@ -1,47 +0,0 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { execa } from 'execa';
3
-
4
- @Injectable()
5
- export class GitService {
6
- async ensureRepo(): Promise<void> {
7
- try {
8
- await execa('git', ['rev-parse', '--is-inside-work-tree']);
9
- } catch (error) {
10
- const message =
11
- error instanceof Error && 'stderr' in error
12
- ? String((error as { stderr?: string }).stderr ?? error.message)
13
- : 'Git repository not found. Initialize git before running the command.';
14
- throw new Error(message);
15
- }
16
- }
17
-
18
- async getChangedFiles(): Promise<string[]> {
19
- await this.ensureRepo();
20
- const changed = new Set<string>();
21
- const load = async (args: string[]) => {
22
- const { stdout } = await execa('git', args);
23
- stdout
24
- .split('\n')
25
- .map((entry) => entry.trim())
26
- .filter((entry) => entry.length > 0)
27
- .forEach((entry) => {
28
- changed.add(entry);
29
- });
30
- };
31
-
32
- await load(['diff', '--name-only']);
33
- await load(['diff', '--name-only', '--staged']);
34
- await load(['ls-files', '--others', '--exclude-standard']);
35
- return [...changed].sort();
36
- }
37
-
38
- async getStagedFiles(): Promise<string[]> {
39
- await this.ensureRepo();
40
- const { stdout } = await execa('git', ['diff', '--name-only', '--staged']);
41
- return stdout
42
- .split('\n')
43
- .map((entry) => entry.trim())
44
- .filter((entry) => entry.length > 0)
45
- .sort();
46
- }
47
- }
@@ -1,8 +0,0 @@
1
- import { Module } from '@nestjs/common';
2
- import { TokenizerService } from './tokenizer.service';
3
-
4
- @Module({
5
- providers: [TokenizerService],
6
- exports: [TokenizerService],
7
- })
8
- export class TokenizerModule {}
@@ -1,30 +0,0 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { encodingForModel, getEncoding } from 'js-tiktoken';
3
- import { DEFAULT_PRICE_PER_MILLION } from '../constants';
4
-
5
- type TokenEstimate = {
6
- tokens: number;
7
- usdEstimate: number;
8
- };
9
-
10
- @Injectable()
11
- export class TokenizerService {
12
- private encoder?: ReturnType<typeof getEncoding>;
13
-
14
- count(text: string): TokenEstimate {
15
- const tokens = this.getEncoder().encode(text).length;
16
- const usdEstimate = (tokens / 1_000_000) * DEFAULT_PRICE_PER_MILLION;
17
- return { tokens, usdEstimate };
18
- }
19
-
20
- private getEncoder() {
21
- if (!this.encoder) {
22
- try {
23
- this.encoder = encodingForModel('gpt-4o');
24
- } catch {
25
- this.encoder = getEncoding('o200k_base');
26
- }
27
- }
28
- return this.encoder;
29
- }
30
- }
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "noEmit": false
5
- },
6
- "exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
7
- }
package/tsconfig.json DELETED
@@ -1,28 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2023",
4
- "module": "nodenext",
5
- "moduleResolution": "nodenext",
6
- "resolvePackageJsonExports": true,
7
- "esModuleInterop": true,
8
- "isolatedModules": true,
9
- "declaration": true,
10
- "removeComments": true,
11
- "emitDecoratorMetadata": true,
12
- "experimentalDecorators": true,
13
- "allowSyntheticDefaultImports": true,
14
- "sourceMap": true,
15
- "outDir": "./dist",
16
- "baseUrl": "./",
17
- "incremental": true,
18
- "skipLibCheck": true,
19
- "strict": true,
20
- "strictNullChecks": true,
21
- "forceConsistentCasingInFileNames": true,
22
- "noImplicitAny": false,
23
- "noEmit": true,
24
- "strictBindCallApply": false,
25
- "noFallthroughCasesInSwitch": false
26
- },
27
- "include": ["src", "*.ts"]
28
- }