sun-agent-kit-cli 1.1.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 (4) hide show
  1. package/README.md +217 -0
  2. package/bin/sk.js +56 -0
  3. package/dist/index.js +67297 -0
  4. package/package.json +95 -0
package/README.md ADDED
@@ -0,0 +1,217 @@
1
+ # Sun Agent Kit CLI
2
+
3
+ Command-line tool for bootstrapping and managing Sun Agent Kit projects.
4
+
5
+ ## Overview
6
+
7
+ Sun Agent Kit CLI (`sk`) manages Sun Agent Kit projects — 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
+ - **16 CLI Commands**: new, init, config, projects, setup, skills, agents, commands, migrate, doctor, versions, update, uninstall, watch, content, easter-egg
11
+ - **Projects Registry**: Centralized registry at `~/.sun-agent-kit/projects.json` with file locking
12
+ - **Skill Installation**: Install skills to other coding agents (Cursor, Codex, etc.)
13
+ - **Multi-tier Auth**: gh CLI → env vars → keychain → prompt fallback
14
+ - **Smart Merging**: Conflict detection with user customization preservation
15
+ - **Idempotent Migration**: 3-phase reconciliation (RECONCILE → EXECUTE → REPORT)
16
+ - **Offline Installation**: From local archives or directories
17
+ - **Security**: Path traversal protection, symlink validation, UNC path protection
18
+ - **Cross-Platform**: macOS, Linux, Windows
19
+
20
+ ## Prerequisites
21
+
22
+ 1. **Purchase a Sun Agent Kit Starter Kit** from [Sun Agent Kit.cc](https://sun-agent-kit.cc)
23
+ 2. **Get Repository Access**: After purchase, you receive access to the private GitHub repository
24
+ 3. **Install GitHub CLI** and authenticate: `gh auth login` (select "Login with a web browser")
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ npm install -g sun-agent-kit-cli
30
+ # or: bun add -g / yarn global add / pnpm add -g
31
+ ```
32
+
33
+ Verify: `sk --version`
34
+
35
+ ## Usage
36
+
37
+ ### Quick Start
38
+
39
+ ```bash
40
+ sk --help # All commands
41
+ sk new # Create new project (interactive)
42
+ sk new --kit engineer # Create with specific kit
43
+ sk init # Initialize/update in current project
44
+ sk config get defaults.kit # Read config
45
+ sk config set defaults.kit engineer # Write config
46
+ ```
47
+
48
+ ### Create New Project
49
+
50
+ ```bash
51
+ sk new # Interactive
52
+ sk new --dir my-project --kit engineer # With options
53
+ sk new --beta # Show beta versions
54
+ sk new --archive ~/kit.zip # Offline install
55
+ sk new --install-skills # Auto-install skill deps
56
+ sk new --prefix # /sk: namespace for commands
57
+ ```
58
+
59
+ ### Initialize or Update
60
+
61
+ Run from project root:
62
+
63
+ ```bash
64
+ sk init # Interactive
65
+ sk init -y # Non-interactive, sensible defaults
66
+ sk init -g --kit engineer -y # Global, specific kit, non-interactive
67
+ sk init --fresh # Clean reinstall (destructive)
68
+ sk init --archive ~/kit.zip # Offline install
69
+ ```
70
+
71
+ ### Update CLI
72
+
73
+ ```bash
74
+ sk update # Update to latest
75
+ sk update --check # Check only
76
+ sk update --version 1.17.0 # Specific version
77
+ ```
78
+
79
+ ### Diagnostics
80
+
81
+ ```bash
82
+ sk doctor # Full health check
83
+ sk doctor --fix # Auto-fix issues
84
+ sk doctor --report # Shareable diagnostic report
85
+ sk doctor --check-only --json # CI mode
86
+ ```
87
+
88
+ ### Skills & Agents
89
+
90
+ ```bash
91
+ sk skills --help # Skill installation workflows
92
+ sk agents --help # Agent management
93
+ sk commands --help # Command discovery
94
+ ```
95
+
96
+ ### Watch GitHub Issues
97
+
98
+ ```bash
99
+ sk watch # Start monitoring
100
+ sk watch --dry-run # Preview mode
101
+ ```
102
+
103
+ Autonomous daemon: monitors issues → analyzes with Claude → generates plans → creates PRs. Config in `.sk.json` under `watch` key. See [docs/sk-watch.md](./docs/sk-watch.md).
104
+
105
+ ### Content Generation
106
+
107
+ ```bash
108
+ sk content setup # Interactive setup
109
+ sk content start # Start daemon
110
+ sk content status # Check status
111
+ ```
112
+
113
+ Scans git activity → generates social content with Claude → publishes to X/Twitter and Facebook. Config in `.sk.json` under `content` key. See [docs/sk-content.md](./docs/sk-content.md).
114
+
115
+ ### Other Commands
116
+
117
+ ```bash
118
+ sk versions # List available versions
119
+ sk versions --kit engineer # Filter by kit
120
+ sk migrate # Run migration pipeline
121
+ sk uninstall # Remove Sun Agent Kit
122
+ sk --version # Show version + update check
123
+ ```
124
+
125
+ ### Debugging
126
+
127
+ ```bash
128
+ sk new --verbose # Verbose logging
129
+ sk new --verbose --log-file debug.log # Save to file
130
+ SUN_AGENT_KIT_VERBOSE=1 sk new # Via env var
131
+ ```
132
+
133
+ ## Authentication
134
+
135
+ ```
136
+ 1. GitHub CLI (gh auth token)
137
+ ↓ fallback
138
+ 2. Environment Variables (GITHUB_TOKEN)
139
+ ↓ fallback
140
+ 3. Config File (~/.sun-agent-kit/config.json)
141
+ ↓ fallback
142
+ 4. OS Keychain
143
+ ↓ fallback
144
+ 5. User Prompt (with save option)
145
+ ```
146
+
147
+ **Setup:** `gh auth login` → select "Login with a web browser" → complete OAuth in browser.
148
+
149
+ ## Configuration
150
+
151
+ Stored in `~/.sun-agent-kit/config.json`:
152
+
153
+ ```json
154
+ {
155
+ "github": { "token": "stored_in_keychain" },
156
+ "defaults": { "kit": "engineer", "dir": "." }
157
+ }
158
+ ```
159
+
160
+ ### Protected Files
161
+
162
+ Never overwritten during updates: `.env*`, `*.key`, `*.pem`, `node_modules/**`, `.git/**`, `dist/**`
163
+
164
+ ### Exclude Patterns
165
+
166
+ ```bash
167
+ sk new --exclude "*.log" --exclude "temp/**"
168
+ ```
169
+
170
+ ## Available Kits
171
+
172
+ | Kit | Description |
173
+ |-----|-------------|
174
+ | **engineer** | Engineering toolkit for building with Claude |
175
+ | **marketing** | Content automation toolkit |
176
+
177
+ Purchase at [Sun Agent Kit.cc](https://sun-agent-kit.cc).
178
+
179
+ ## Development
180
+
181
+ ```bash
182
+ bun install # Install deps
183
+ bun run dev new --kit engineer # Run locally
184
+ bun test # Run tests
185
+ bun run lint:fix # Auto-fix lint
186
+ bun run typecheck # Type check
187
+ bun run build # Build for npm
188
+ bun run test:integration # CLI integration tests
189
+ ```
190
+
191
+ See [AGENTS.md](./AGENTS.md) for project structure and coding patterns.
192
+
193
+ ## Documentation
194
+
195
+ - [Codebase Summary](./docs/codebase-summary.md) — Architecture overview
196
+ - [Project Overview & PDR](./docs/project-overview-pdr.md) — Requirements, roadmap
197
+ - [System Architecture](./docs/system-architecture.md) — Technical details
198
+ - [Reconciliation Architecture](./docs/reconciliation-architecture.md) — `sk migrate` design
199
+ - [Code Standards](./docs/code-standards.md) — Conventions
200
+ - [Deployment Guide](./docs/deployment-guide.md) — Release procedures
201
+ - [sk watch](./docs/sk-watch.md) — Issue monitoring
202
+ - [sk content](./docs/sk-content.md) — Content generation
203
+
204
+ ## FAQ
205
+
206
+ **Q: Do I need GitHub CLI?**
207
+ A: Yes. Required for authentication with private repositories.
208
+
209
+ **Q: "Access denied" error?**
210
+ A: Accept GitHub repo invitation, re-run `gh auth login` with web browser, wait 2-5min.
211
+
212
+ **Q: Is my token secure?**
213
+ A: Yes. GitHub CLI manages tokens via OAuth, stored encrypted in OS keychain.
214
+
215
+ ## License
216
+
217
+ MIT
package/bin/sk.js ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * CLI entry point for npm-installed Sun Agent Kit 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 Sun Agent Kit 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/issues");
52
+ process.exit(1);
53
+ }
54
+ };
55
+
56
+ main();