@sunasteriskrnd/takumi 0.1.0

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 ADDED
@@ -0,0 +1,154 @@
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
+ `takumi` 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: `takumi --version`
29
+
30
+ ## Usage
31
+
32
+ ### Quick Start
33
+
34
+ ```bash
35
+ takumi --help # All commands
36
+ takumi new # Create new project (interactive)
37
+ takumi new --kit engineer # Create with specific kit
38
+ takumi init # Initialize/update in current project
39
+ takumi init -g -y # Global install, non-interactive
40
+ ```
41
+
42
+ ### Create New Project
43
+
44
+ ```bash
45
+ takumi new # Interactive
46
+ takumi new --dir my-project --kit engineer # With options
47
+ takumi new --archive ~/kit.zip # Offline install
48
+ takumi new --install-skills # Auto-install skill deps
49
+ takumi new --prefix # /takumi: namespace for commands
50
+ ```
51
+
52
+ ### Initialize or Update
53
+
54
+ Run from project root:
55
+
56
+ ```bash
57
+ takumi init # Interactive
58
+ takumi init -y # Non-interactive, latest version
59
+ takumi init -g --kit engineer -y # Global install
60
+ takumi init --fresh # Clean reinstall (destructive)
61
+ takumi init --archive ~/kit.zip # Offline install
62
+ takumi init --local # From local monorepo (development)
63
+ ```
64
+
65
+ ### Update CLI
66
+
67
+ ```bash
68
+ takumi update # Update to latest
69
+ takumi update --check # Check only
70
+ takumi update --version 1.1.3 # Specific version
71
+ ```
72
+
73
+ ### Diagnostics
74
+
75
+ ```bash
76
+ takumi doctor # Full health check
77
+ takumi doctor --fix # Auto-fix issues
78
+ takumi doctor --report # Shareable diagnostic report
79
+ ```
80
+
81
+ ### Skills & Agents
82
+
83
+ ```bash
84
+ takumi skills --help # Skill management
85
+ takumi agents --help # Agent management
86
+ takumi commands --help # Command discovery
87
+ ```
88
+
89
+ ### Other Commands
90
+
91
+ ```bash
92
+ takumi versions # List available versions
93
+ takumi migrate # Run migration pipeline
94
+ takumi uninstall # Remove Takumi
95
+ takumi config get defaults.kit # Read config
96
+ takumi config set defaults.kit engineer # Write config
97
+ ```
98
+
99
+ ### Debugging
100
+
101
+ ```bash
102
+ takumi new --verbose # Verbose logging
103
+ takumi new --verbose --log-file debug.log # Save to file
104
+ SUN_AGENT_KIT_VERBOSE=1 takumi new # Via env var
105
+ ```
106
+
107
+ ## Authentication
108
+
109
+ ```
110
+ 1. GitHub CLI (gh auth token)
111
+ ↓ fallback
112
+ 2. Environment Variables (GITHUB_TOKEN)
113
+ ↓ fallback
114
+ 3. Config File (~/.sun-takumi/config.json)
115
+ ↓ fallback
116
+ 4. OS Keychain
117
+ ↓ fallback
118
+ 5. User Prompt (with save option)
119
+ ```
120
+
121
+ **Recommended:** `gh auth login` with web browser OAuth.
122
+
123
+ ## Configuration
124
+
125
+ Stored in `~/.sun-takumi/config.json`:
126
+
127
+ ```json
128
+ {
129
+ "github": { "token": "stored_in_keychain" },
130
+ "defaults": { "kit": "engineer", "dir": "." }
131
+ }
132
+ ```
133
+
134
+ ### Protected Files
135
+
136
+ Never overwritten during updates: `.env*`, `*.key`, `*.pem`, `node_modules/**`, `.git/**`, `dist/**`
137
+
138
+ ## Development
139
+
140
+ ```bash
141
+ bun install # Install deps
142
+ bun run dev new --kit engineer # Run locally
143
+ bun test # Run tests (3600+ tests)
144
+ bun run lint:fix # Auto-fix lint
145
+ bun run typecheck # Type check
146
+ bun run build # Build for npm
147
+ bun run validate # Full quality gate
148
+ ```
149
+
150
+ See [AGENTS.md](./AGENTS.md) for project structure and coding patterns.
151
+
152
+ ## License
153
+
154
+ Internal use — Sun Asterisk.
package/bin/takumi.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/agent-kit-cli/issues");
52
+ process.exit(1);
53
+ }
54
+ };
55
+
56
+ main();