@sunasteriskrnd/takumi 0.1.0-dev.5
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 +147 -0
- package/bin/tkm.js +56 -0
- package/dist/index.js +66916 -0
- package/package.json +95 -0
package/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Takumi CLI
|
|
2
|
+
|
|
3
|
+
Command-line tool for bootstrapping and managing [Takumi](https://github.com/sun-asterisk-internal/takumi-cli) projects.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`tkm` manages Takumi installations — install, update, migrate, and configure kits from GitHub releases. Built with Bun + TypeScript for development; published CLI runs on plain Node.js.
|
|
8
|
+
|
|
9
|
+
**Key features:**
|
|
10
|
+
- Install/update kits from GitHub releases or local archives
|
|
11
|
+
- Smart merge with user customization preservation
|
|
12
|
+
- Multi-tier GitHub auth (gh CLI, env vars, keychain, prompt)
|
|
13
|
+
- Idempotent migration with 3-phase reconciliation
|
|
14
|
+
- Cross-platform: macOS, Linux, Windows
|
|
15
|
+
|
|
16
|
+
## Prerequisites
|
|
17
|
+
|
|
18
|
+
1. **GitHub access** to `sun-asterisk-internal/takumi`
|
|
19
|
+
2. **GitHub CLI** installed and authenticated: `gh auth login`
|
|
20
|
+
3. **Node.js** 18+ (runtime) or **Bun** (development)
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install -g @sunasteriskrnd/takumi
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Verify: `tkm --version`
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
### Quick Start
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
tkm --help # All commands
|
|
36
|
+
tkm new # Create new project (interactive)
|
|
37
|
+
tkm new --kit engineer # Create with specific kit
|
|
38
|
+
tkm init # Initialize/update in current project
|
|
39
|
+
tkm init -g -y # Global install, non-interactive
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Create New Project
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
tkm new # Interactive
|
|
46
|
+
tkm new --dir my-project --kit engineer # With options
|
|
47
|
+
tkm new --archive ~/kit.zip # Offline install
|
|
48
|
+
tkm new --install-skills # Auto-install skill deps
|
|
49
|
+
tkm new --prefix # /tkm: namespace for commands
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Initialize or Update
|
|
53
|
+
|
|
54
|
+
Run from project root:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
tkm init # Interactive
|
|
58
|
+
tkm init -y # Non-interactive, latest version
|
|
59
|
+
tkm init -g --kit engineer -y # Global install
|
|
60
|
+
tkm init --fresh # Clean reinstall (destructive)
|
|
61
|
+
tkm init --archive ~/kit.zip # Offline install
|
|
62
|
+
tkm init --local # From local monorepo (development)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Update CLI
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
tkm update # Update to latest
|
|
69
|
+
tkm update --check # Check only
|
|
70
|
+
tkm update --version 1.1.3 # Specific version
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Diagnostics
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
tkm doctor # Full health check
|
|
77
|
+
tkm doctor --fix # Auto-fix issues
|
|
78
|
+
tkm doctor --report # Shareable diagnostic report
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Skills & Agents
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
tkm skills --help # Skill management
|
|
85
|
+
tkm agents --help # Agent management
|
|
86
|
+
tkm commands --help # Command discovery
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Other Commands
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
tkm versions # List available versions
|
|
93
|
+
tkm migrate # Run migration pipeline
|
|
94
|
+
tkm uninstall # Remove Takumi
|
|
95
|
+
tkm config get defaults.kit # Read config
|
|
96
|
+
tkm config set defaults.kit engineer # Write config
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Debugging
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
tkm new --verbose # Verbose logging
|
|
103
|
+
tkm new --verbose --log-file debug.log # Save to file
|
|
104
|
+
TAKUMI_VERBOSE=1 tkm new # Via env var
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Authentication
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
1. Environment Variables (GITHUB_TOKEN, GH_TOKEN)
|
|
111
|
+
↓ fallback
|
|
112
|
+
2. GitHub CLI (gh auth token)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Recommended:** `gh auth login` then authenticate via web browser OAuth.
|
|
116
|
+
|
|
117
|
+
## Configuration
|
|
118
|
+
|
|
119
|
+
Global config stored in `~/.claude/.takumi.json`; project config at `<project>/.claude/.takumi.json`.
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"defaults": { "kit": "engineer", "dir": "." }
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Protected Files
|
|
128
|
+
|
|
129
|
+
Never overwritten during updates: `.env*`, `*.key`, `*.pem`, `node_modules/**`, `.git/**`, `dist/**`
|
|
130
|
+
|
|
131
|
+
## Development
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
bun install # Install deps
|
|
135
|
+
bun run dev new --kit engineer # Run locally
|
|
136
|
+
bun test # Run tests (3600+ tests)
|
|
137
|
+
bun run lint:fix # Auto-fix lint
|
|
138
|
+
bun run typecheck # Type check
|
|
139
|
+
bun run build # Build for npm
|
|
140
|
+
bun run validate # Full quality gate
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
See [AGENTS.md](./AGENTS.md) for project structure and coding patterns.
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
Internal use — Sun Asterisk.
|
package/bin/tkm.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CLI entry point for npm-installed Takumi CLI.
|
|
5
|
+
* Runs the packaged Node-targeted bundle without requiring Bun on user machines.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { existsSync } from "node:fs";
|
|
9
|
+
import { dirname, join } from "node:path";
|
|
10
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
11
|
+
|
|
12
|
+
const MIN_NODE_VERSION = [18, 0];
|
|
13
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
|
|
15
|
+
const getErrorMessage = (err) => {
|
|
16
|
+
return err instanceof Error ? err.message : String(err);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const checkNodeVersion = () => {
|
|
20
|
+
const [major, minor] = process.versions.node.split(".").map(Number);
|
|
21
|
+
const [minMajor, minMinor] = MIN_NODE_VERSION;
|
|
22
|
+
|
|
23
|
+
if (major < minMajor || (major === minMajor && minor < minMinor)) {
|
|
24
|
+
console.error(
|
|
25
|
+
`[X] Node.js ${MIN_NODE_VERSION.join(".")}+ is required. Current version: ${process.versions.node}`,
|
|
26
|
+
);
|
|
27
|
+
console.error(" Please upgrade Node.js: https://nodejs.org/");
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const runWithNode = async () => {
|
|
33
|
+
const distPath = join(__dirname, "..", "dist", "index.js");
|
|
34
|
+
if (!existsSync(distPath)) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
"Compiled distribution not found. Reinstall Takumi CLI or report a packaging issue.",
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const distUrl = pathToFileURL(distPath).href;
|
|
41
|
+
await import(distUrl);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const main = async () => {
|
|
45
|
+
checkNodeVersion();
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
await runWithNode();
|
|
49
|
+
} catch (err) {
|
|
50
|
+
console.error(`[X] Failed to run CLI: ${getErrorMessage(err)}`);
|
|
51
|
+
console.error("Please report this issue at: https://github.com/sun-asterisk-internal/takumi-cli/issues");
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
main();
|