@kosuke-ai/cli 0.0.8 → 0.0.9

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 CHANGED
@@ -16,6 +16,67 @@ Or use with npx (no installation required):
16
16
  npx @kosuke-ai/cli <command>
17
17
  ```
18
18
 
19
+ ### Use as Library in TypeScript Projects
20
+
21
+ Install as a project dependency:
22
+
23
+ ```bash
24
+ npm install @kosuke-ai/cli
25
+ ```
26
+
27
+ Then import and use programmatically:
28
+
29
+ ```typescript
30
+ import {
31
+ analyseCommand,
32
+ lintCommand,
33
+ syncRulesCommand,
34
+ requirementsCommand,
35
+ discoverFiles,
36
+ createBatches,
37
+ runLint,
38
+ runTypecheck,
39
+ } from '@kosuke-ai/cli';
40
+
41
+ // Run commands programmatically
42
+ await analyseCommand({
43
+ scope: 'src/components',
44
+ pr: false,
45
+ });
46
+
47
+ await lintCommand({ pr: false });
48
+
49
+ // Use utilities
50
+ const files = await discoverFiles({
51
+ types: ['ts', 'tsx'],
52
+ scope: 'lib',
53
+ });
54
+
55
+ const batches = createBatches(files, {
56
+ maxSize: 10,
57
+ groupBy: 'directory',
58
+ });
59
+
60
+ const lintResult = await runLint();
61
+ if (!lintResult.success) {
62
+ console.error('Linting failed:', lintResult.error);
63
+ }
64
+ ```
65
+
66
+ #### Local Development with npm link
67
+
68
+ To develop against a local version of kosuke-cli:
69
+
70
+ ```bash
71
+ # In kosuke-cli directory
72
+ npm run dev:link # Builds, links, and watches for changes
73
+
74
+ # In your project directory
75
+ npm link @kosuke-ai/cli
76
+ ```
77
+
78
+ Now your project will use the local kosuke-cli, and changes will be reflected automatically.
79
+
19
80
  ## Prerequisites
20
81
 
21
82
  Set up the required environment variable:
package/dist/lib.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Kosuke CLI - Library API
3
+ *
4
+ * Use this module to programmatically access Kosuke CLI functionality
5
+ * in your TypeScript projects.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { analyseCommand, discoverFiles } from '@kosuke-ai/cli';
10
+ *
11
+ * // Run analysis programmatically
12
+ * await analyseCommand({ scope: 'src', pr: false });
13
+ *
14
+ * // Use utilities
15
+ * const files = await discoverFiles({ types: ['ts', 'tsx'] });
16
+ * ```
17
+ */
18
+ export { analyseCommand } from './kosuke/commands/analyse.js';
19
+ export { lintCommand } from './kosuke/commands/lint.js';
20
+ export { syncRulesCommand } from './kosuke/commands/sync-rules.js';
21
+ export { requirementsCommand } from './kosuke/commands/requirements.js';
22
+ export { discoverFiles } from './kosuke/utils/file-discovery.js';
23
+ export { createBatches } from './kosuke/utils/batch-creator.js';
24
+ export { runLint, runTypecheck, runFormat } from './kosuke/utils/validator.js';
25
+ export type { Batch, Fix, AnalyseOptions, LintOptions, SyncRulesOptions, RulesAdaptation, GitInfo, } from './kosuke/types.js';
26
+ //# sourceMappingURL=lib.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAGxE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAG/E,YAAY,EACV,KAAK,EACL,GAAG,EACH,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,OAAO,GACR,MAAM,mBAAmB,CAAC"}
package/dist/lib.js ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Kosuke CLI - Library API
3
+ *
4
+ * Use this module to programmatically access Kosuke CLI functionality
5
+ * in your TypeScript projects.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { analyseCommand, discoverFiles } from '@kosuke-ai/cli';
10
+ *
11
+ * // Run analysis programmatically
12
+ * await analyseCommand({ scope: 'src', pr: false });
13
+ *
14
+ * // Use utilities
15
+ * const files = await discoverFiles({ types: ['ts', 'tsx'] });
16
+ * ```
17
+ */
18
+ // Re-export commands
19
+ export { analyseCommand } from './kosuke/commands/analyse.js';
20
+ export { lintCommand } from './kosuke/commands/lint.js';
21
+ export { syncRulesCommand } from './kosuke/commands/sync-rules.js';
22
+ export { requirementsCommand } from './kosuke/commands/requirements.js';
23
+ // Re-export utilities
24
+ export { discoverFiles } from './kosuke/utils/file-discovery.js';
25
+ export { createBatches } from './kosuke/utils/batch-creator.js';
26
+ export { runLint, runTypecheck, runFormat } from './kosuke/utils/validator.js';
27
+ //# sourceMappingURL=lib.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.js","sourceRoot":"","sources":["../lib.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,qBAAqB;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,sBAAsB;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kosuke-ai/cli",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Kosuke CLI - Development automation tool for syncing rules and analyzing code quality",
5
5
  "keywords": [
6
6
  "CLI",
@@ -19,11 +19,18 @@
19
19
  "license": "ISC",
20
20
  "author": "filippo.pedrazzini@kosuke.ai",
21
21
  "type": "module",
22
- "main": "dist/index.js",
23
- "types": "dist/index.d.ts",
22
+ "main": "dist/lib.js",
23
+ "types": "dist/lib.d.ts",
24
24
  "bin": {
25
25
  "kosuke": "dist/index.js"
26
26
  },
27
+ "exports": {
28
+ ".": {
29
+ "import": "./dist/lib.js",
30
+ "types": "./dist/lib.d.ts"
31
+ },
32
+ "./cli": "./dist/index.js"
33
+ },
27
34
  "files": [
28
35
  "dist",
29
36
  "README.md",