@kosuke-ai/cli 0.0.7 → 0.0.8

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
@@ -18,23 +18,33 @@ npx @kosuke-ai/cli <command>
18
18
 
19
19
  ## Prerequisites
20
20
 
21
- Before using Kosuke CLI, set up the required environment variables:
21
+ Set up the required environment variable:
22
22
 
23
23
  ```bash
24
24
  # Required for Claude API access
25
25
  export ANTHROPIC_API_KEY="your-api-key-here"
26
26
 
27
- # Required for creating pull requests
27
+ # Optional: Only required when using --pr flag
28
28
  export GITHUB_TOKEN="your-github-token-here"
29
29
  ```
30
30
 
31
31
  You can also create a `.env` file in your project root:
32
32
 
33
- ```
33
+ ```env
34
34
  ANTHROPIC_API_KEY=your-api-key-here
35
35
  GITHUB_TOKEN=your-github-token-here
36
36
  ```
37
37
 
38
+ ## Workflow
39
+
40
+ By default, all commands apply changes **locally** without git operations. This allows you to:
41
+
42
+ - Review changes before committing
43
+ - Test fixes in your local environment
44
+ - Iterate quickly without creating PRs
45
+
46
+ Use the `--pr` flag to automatically create a pull request with the changes.
47
+
38
48
  ## Commands
39
49
 
40
50
  ### `kosuke sync-rules`
@@ -44,28 +54,40 @@ Sync rules and documentation from kosuke-template repository.
44
54
  **Options:**
45
55
 
46
56
  - `--force` - Compare files regardless of recent commit history
57
+ - `--pr` - Create a pull request with the changes
58
+ - `--base-branch=<name>` - Base branch for PR (default: current branch)
47
59
 
48
60
  **Examples:**
49
61
 
50
62
  ```bash
63
+ # Sync locally
51
64
  kosuke sync-rules
65
+
66
+ # Force comparison and sync locally
52
67
  kosuke sync-rules --force
68
+
69
+ # Create PR with synced changes
70
+ kosuke sync-rules --pr
71
+
72
+ # Create PR with custom base branch
73
+ kosuke sync-rules --pr --base-branch=develop
53
74
  ```
54
75
 
55
76
  ### `kosuke analyse`
56
77
 
57
- Analyze and fix code quality issues against CLAUDE.md rules. Creates a single PR with all fixes from multiple isolated Claude runs.
78
+ Analyze and fix code quality issues against CLAUDE.md rules. Applies fixes locally by default.
58
79
 
59
80
  **Options:**
60
81
 
61
- - `--dry-run` - Report violations only, don't create PR
82
+ - `--pr` - Create a pull request with fixes
83
+ - `--base-branch=<name>` - Base branch for PR (default: current branch)
62
84
  - `--scope=<dirs>` - Analyze specific directories (comma-separated)
63
85
  - `--types=<exts>` - Analyze specific file types (comma-separated)
64
86
 
65
87
  **Examples:**
66
88
 
67
89
  ```bash
68
- # Analyze entire project
90
+ # Analyze and fix locally
69
91
  kosuke analyse
70
92
 
71
93
  # Analyze specific directories
@@ -74,35 +96,38 @@ kosuke analyse --scope=hooks,lib/trpc
74
96
  # Analyze specific file types
75
97
  kosuke analyse --types=ts,tsx
76
98
 
77
- # Dry run (report only)
78
- kosuke analyse --dry-run
99
+ # Create PR with fixes
100
+ kosuke analyse --pr
101
+
102
+ # Create PR with custom base branch
103
+ kosuke analyse --pr --base-branch=main
79
104
  ```
80
105
 
81
106
  ### `kosuke lint`
82
107
 
83
- Use Claude AI to automatically fix linting errors in your codebase. Runs the lint command from package.json, analyzes the errors, and applies fixes.
108
+ Use Claude AI to automatically fix linting errors. Applies fixes locally by default.
84
109
 
85
110
  **Options:**
86
111
 
87
- - `--dry-run` - Report errors only, don't fix them
88
- - `--no-pr` - Fix locally without creating PR
112
+ - `--pr` - Create a pull request with fixes
113
+ - `--base-branch=<name>` - Base branch for PR (default: current branch)
89
114
 
90
115
  **Examples:**
91
116
 
92
117
  ```bash
93
- # Fix all linting errors and create PR
118
+ # Fix linting errors locally
94
119
  kosuke lint
95
120
 
96
- # Preview what errors would be fixed
97
- kosuke lint --dry-run
121
+ # Create PR with fixes
122
+ kosuke lint --pr
98
123
 
99
- # Fix errors locally without creating PR
100
- kosuke lint --no-pr
124
+ # Create PR with custom base branch
125
+ kosuke lint --pr --base-branch=main
101
126
  ```
102
127
 
103
128
  **Requirements:**
104
129
 
105
- - Your `package.json` must have a `lint` script (e.g., `"lint": "eslint . --fix"`)
130
+ - Your `package.json` must have a `lint` script (e.g., `"lint": "eslint ."`)
106
131
  - The lint script should support the `--fix` flag for auto-fixing
107
132
 
108
133
  ### `kosuke requirements`
@@ -146,7 +171,7 @@ Create a `.kosukeignore` file in your project root to exclude files and director
146
171
 
147
172
  Example:
148
173
 
149
- ```
174
+ ```gitignore
150
175
  # Ignore build outputs
151
176
  dist/
152
177
  build/
package/dist/index.js CHANGED
@@ -26,20 +26,25 @@ import { requirementsCommand } from './kosuke/commands/requirements.js';
26
26
  async function main() {
27
27
  const args = process.argv.slice(2);
28
28
  const command = args[0];
29
- if (!command) {
29
+ if (!command || command === '--help' || command === '-h' || command === 'help') {
30
30
  showHelp();
31
- process.exit(1);
31
+ process.exit(0);
32
32
  }
33
33
  try {
34
34
  switch (command) {
35
35
  case 'sync-rules': {
36
- const hasForceFlag = args.includes('--force');
37
- await syncRulesCommand(hasForceFlag);
36
+ const options = {
37
+ force: args.includes('--force'),
38
+ pr: args.includes('--pr'),
39
+ baseBranch: args.find((arg) => arg.startsWith('--base-branch='))?.split('=')[1],
40
+ };
41
+ await syncRulesCommand(options);
38
42
  break;
39
43
  }
40
44
  case 'analyse': {
41
45
  const options = {
42
- dryRun: args.includes('--dry-run'),
46
+ pr: args.includes('--pr'),
47
+ baseBranch: args.find((arg) => arg.startsWith('--base-branch='))?.split('=')[1],
43
48
  scope: args.find((arg) => arg.startsWith('--scope='))?.split('=')[1],
44
49
  types: args
45
50
  .find((arg) => arg.startsWith('--types='))
@@ -51,8 +56,8 @@ async function main() {
51
56
  }
52
57
  case 'lint': {
53
58
  const options = {
54
- dryRun: args.includes('--dry-run'),
55
- noPr: args.includes('--no-pr'),
59
+ pr: args.includes('--pr'),
60
+ baseBranch: args.find((arg) => arg.startsWith('--base-branch='))?.split('=')[1],
56
61
  };
57
62
  await lintCommand(options);
58
63
  break;
@@ -80,43 +85,49 @@ function showHelp() {
80
85
 
81
86
  COMMANDS:
82
87
 
83
- sync-rules [--force]
88
+ sync-rules [options]
84
89
  Sync rules and documentation from kosuke-template
85
90
 
86
91
  Options:
87
- --force Compare files regardless of recent commit history
92
+ --force Compare files regardless of recent commit history
93
+ --pr Create a pull request with changes
94
+ --base-branch=<name> Base branch for PR (default: current branch)
88
95
 
89
96
  Examples:
90
- kosuke sync-rules
91
- kosuke sync-rules --force
97
+ kosuke sync-rules # Local changes only
98
+ kosuke sync-rules --force # Force comparison
99
+ kosuke sync-rules --pr # Create PR
100
+ kosuke sync-rules --pr --base-branch=develop
92
101
 
93
- analyse
102
+ analyse [options]
94
103
  Analyze and fix code quality issues against CLAUDE.md rules
95
- Creates a single PR with all fixes from multiple isolated Claude runs
104
+ Applies fixes locally by default
96
105
 
97
106
  Options:
98
- --dry-run Report violations only, don't create PR
99
- --scope=<dirs> Analyze specific directories (comma-separated)
100
- --types=<exts> Analyze specific file types (comma-separated)
107
+ --pr Create a pull request with fixes
108
+ --base-branch=<name> Base branch for PR (default: current branch)
109
+ --scope=<dirs> Analyze specific directories (comma-separated)
110
+ --types=<exts> Analyze specific file types (comma-separated)
101
111
 
102
112
  Examples:
103
- kosuke analyse
113
+ kosuke analyse # Local fixes only
114
+ kosuke analyse --pr # Create PR with fixes
104
115
  kosuke analyse --scope=hooks,lib/trpc
105
116
  kosuke analyse --types=ts,tsx
106
- kosuke analyse --dry-run
117
+ kosuke analyse --pr --base-branch=main
107
118
 
108
- lint
119
+ lint [options]
109
120
  Use Claude AI to automatically fix linting errors
110
- Creates a PR with all lint fixes
121
+ Applies fixes locally by default
111
122
 
112
123
  Options:
113
- --dry-run Report errors only, don't fix them
114
- --no-pr Fix locally without creating PR
124
+ --pr Create a pull request with fixes
125
+ --base-branch=<name> Base branch for PR (default: current branch)
115
126
 
116
127
  Examples:
117
- kosuke lint
118
- kosuke lint --dry-run
119
- kosuke lint --no-pr
128
+ kosuke lint # Local fixes only
129
+ kosuke lint --pr # Create PR with fixes
130
+ kosuke lint --pr --base-branch=main
120
131
 
121
132
  requirements
122
133
  Interactive requirements gathering with Claude AI
@@ -125,10 +136,15 @@ COMMANDS:
125
136
  Examples:
126
137
  kosuke requirements
127
138
 
139
+ WORKFLOW:
140
+
141
+ By default, all commands apply changes locally without git operations.
142
+ Use the --pr flag to create a pull request with the changes.
143
+
128
144
  ENVIRONMENT VARIABLES:
129
145
 
130
146
  ANTHROPIC_API_KEY Required for Claude API access
131
- GITHUB_TOKEN Required for creating pull requests
147
+ GITHUB_TOKEN Required when using --pr flag
132
148
 
133
149
  CONFIGURATION:
134
150
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAExB,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,CAAC;QACH,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,YAAY,CAAC,CAAC,CAAC;gBAClB,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;gBAC9C,MAAM,gBAAgB,CAAC,YAAY,CAAC,CAAC;gBACrC,MAAM;YACR,CAAC;YAED,KAAK,SAAS,CAAC,CAAC,CAAC;gBACf,MAAM,OAAO,GAAG;oBACd,M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MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;gBAC3B,MAAM;YACR,CAAC;YAED,KAAK,cAAc,CAAC,CAAC,CAAC;gBACpB,MAAM,mBAAmB,EAAE,CAAC;gBAC5B,MAAM;YACR,CAAC;YAED;gBACE,OAAO,CAAC,KAAK,CAAC,sBAAsB,OAAO,IAAI,CAAC,CAAC;gBACjD,QAAQ,EAAE,CAAC;gBACX,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,QAAQ;IACf,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwEb,CAAC,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * - Each batch of 10-12 files gets its own Claude run
6
6
  * - Claude only sees those specific files (no repository-wide context)
7
7
  * - Validate after each batch, commit locally
8
- * - Push all commits at once and create single PR
8
+ * - If --pr flag: Push all commits and create single PR
9
9
  */
10
10
  import type { AnalyseOptions } from '../types.js';
11
11
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"analyse.d.ts","sourceRoot":"","sources":["../../../kosuke/commands/analyse.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkBH,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,aAAa,CAAC;AAkR9D;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6JhF"}
1
+ {"version":3,"file":"analyse.d.ts","sourceRoot":"","sources":["../../../kosuke/commands/analyse.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,aAAa,CAAC;AA4R9D;;GAEG;AACH,wBAAsB,cAAc,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkFhF"}