ai-summon 0.0.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.
- package/.claude/commands/speckit.analyze.md +184 -0
- package/.claude/commands/speckit.checklist.md +294 -0
- package/.claude/commands/speckit.clarify.md +177 -0
- package/.claude/commands/speckit.constitution.md +78 -0
- package/.claude/commands/speckit.implement.md +121 -0
- package/.claude/commands/speckit.plan.md +81 -0
- package/.claude/commands/speckit.specify.md +204 -0
- package/.claude/commands/speckit.tasks.md +108 -0
- package/.claude/settings.local.json +23 -0
- package/.prettierignore +5 -0
- package/.prettierrc.json +10 -0
- package/.specify/memory/constitution.md +72 -0
- package/.specify/scripts/bash/check-prerequisites.sh +166 -0
- package/.specify/scripts/bash/common.sh +113 -0
- package/.specify/scripts/bash/create-new-feature.sh +97 -0
- package/.specify/scripts/bash/setup-plan.sh +60 -0
- package/.specify/scripts/bash/update-agent-context.sh +738 -0
- package/.specify/templates/agent-file-template.md +28 -0
- package/.specify/templates/checklist-template.md +40 -0
- package/.specify/templates/plan-template.md +111 -0
- package/.specify/templates/spec-template.md +115 -0
- package/.specify/templates/tasks-template.md +250 -0
- package/CLAUDE.md +199 -0
- package/PRD.md +268 -0
- package/README.md +171 -0
- package/dist/ai-summon.d.ts +2 -0
- package/dist/ai-summon.js +73 -0
- package/dist/commands/ide/index.d.ts +3 -0
- package/dist/commands/ide/index.js +253 -0
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.js +55 -0
- package/dist/commands/url.d.ts +4 -0
- package/dist/commands/url.js +223 -0
- package/dist/types/index.d.ts +40 -0
- package/dist/types/index.js +1 -0
- package/dist/util.d.ts +16 -0
- package/dist/util.js +109 -0
- package/eslint.config.js +47 -0
- package/package.json +47 -0
- package/specs/001-cloud-login-feature/contracts/cloud-command.ts +82 -0
- package/specs/001-cloud-login-feature/contracts/config-service.ts +170 -0
- package/specs/001-cloud-login-feature/data-model.md +269 -0
- package/specs/001-cloud-login-feature/plan.md +91 -0
- package/specs/001-cloud-login-feature/quickstart.md +366 -0
- package/specs/001-cloud-login-feature/research.md +290 -0
- package/specs/001-cloud-login-feature/spec.md +195 -0
- package/specs/001-cloud-login-feature/tasks.md +235 -0
- package/specs/001-cloud-scp-command/contracts/cloud-scp-api.ts +402 -0
- package/specs/001-cloud-scp-command/data-model.md +424 -0
- package/specs/001-cloud-scp-command/plan.md +124 -0
- package/specs/001-cloud-scp-command/quickstart.md +536 -0
- package/specs/001-cloud-scp-command/research.md +345 -0
- package/specs/001-cloud-scp-command/spec.md +248 -0
- package/specs/001-cloud-scp-command/tasks.md +434 -0
- package/src/ai-summon.ts +88 -0
- package/src/commands/ide/index.ts +322 -0
- package/src/commands/init.ts +64 -0
- package/src/commands/url.ts +262 -0
- package/src/types/index.ts +49 -0
- package/src/util.ts +146 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# Data Model: Cloud Login Configuration
|
|
2
|
+
|
|
3
|
+
**Generated**: 2025-10-11 | **Phase**: 1 | **Feature**: Cloud Login Command
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Data model definitions for the cloud login feature configuration structure, entity relationships, and validation rules.
|
|
8
|
+
|
|
9
|
+
## Configuration Entities
|
|
10
|
+
|
|
11
|
+
### 1. CloudConfig Entity
|
|
12
|
+
|
|
13
|
+
**Purpose**: Represents connection information for a single cloud instance environment.
|
|
14
|
+
|
|
15
|
+
**Fields**:
|
|
16
|
+
|
|
17
|
+
- `ip: string` - IP address of the cloud instance (IPv4 format)
|
|
18
|
+
- `privateKeyFile: string` - Absolute path to SSH private key file
|
|
19
|
+
|
|
20
|
+
**Validation Rules**:
|
|
21
|
+
|
|
22
|
+
- `ip`: Must be valid IPv4 address format (e.g., "192.168.1.10")
|
|
23
|
+
- `privateKeyFile`: Must be absolute path to existing file with 600 permissions
|
|
24
|
+
|
|
25
|
+
**Example**:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
{
|
|
29
|
+
"ip": "192.168.1.10",
|
|
30
|
+
"privateKeyFile": "/Users/username/.ssh/todo-mini-dev.pem"
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 2. ServiceConfig Entity
|
|
35
|
+
|
|
36
|
+
**Purpose**: Contains all environment configurations for a specific service.
|
|
37
|
+
|
|
38
|
+
**Fields**:
|
|
39
|
+
|
|
40
|
+
- `dev: CloudConfig` - Development environment configuration
|
|
41
|
+
- `staging: CloudConfig` - Staging environment configuration
|
|
42
|
+
- `prod: CloudConfig` - Production environment configuration
|
|
43
|
+
|
|
44
|
+
**Validation Rules**:
|
|
45
|
+
|
|
46
|
+
- All three environments (dev, staging, prod) must be present
|
|
47
|
+
- Each environment must contain valid CloudConfig
|
|
48
|
+
|
|
49
|
+
**Example**:
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
{
|
|
53
|
+
"dev": {
|
|
54
|
+
"ip": "192.168.1.10",
|
|
55
|
+
"privateKeyFile": "/path/to/todo-mini-dev.pem"
|
|
56
|
+
},
|
|
57
|
+
"staging": {
|
|
58
|
+
"ip": "192.168.1.20",
|
|
59
|
+
"privateKeyFile": "/path/to/todo-mini-staging.pem"
|
|
60
|
+
},
|
|
61
|
+
"prod": {
|
|
62
|
+
"ip": "192.168.1.30",
|
|
63
|
+
"privateKeyFile": "/path/to/todo-mini-prod.pem"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 3. YirenConfig Entity
|
|
69
|
+
|
|
70
|
+
**Purpose**: Contains all service configurations for cloud infrastructure.
|
|
71
|
+
|
|
72
|
+
**Fields**:
|
|
73
|
+
|
|
74
|
+
- `[serviceName: string]: ServiceConfig` - Dynamic mapping of service names to their configurations
|
|
75
|
+
|
|
76
|
+
**Validation Rules**:
|
|
77
|
+
|
|
78
|
+
- Service names must be non-empty strings
|
|
79
|
+
- Each service must contain valid ServiceConfig
|
|
80
|
+
- Minimum one service required
|
|
81
|
+
|
|
82
|
+
**Example**:
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
{
|
|
86
|
+
"todo-mini": { /* ServiceConfig */ },
|
|
87
|
+
"wuhan-mall": { /* ServiceConfig */ }
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 4. ReposConfig Entity
|
|
92
|
+
|
|
93
|
+
**Purpose**: Contains repository path mappings for IDE integration (existing functionality).
|
|
94
|
+
|
|
95
|
+
**Fields**:
|
|
96
|
+
|
|
97
|
+
- `[groupName: string]: { [repoName: string]: string }` - Nested mapping of group and repository paths
|
|
98
|
+
|
|
99
|
+
**Validation Rules**:
|
|
100
|
+
|
|
101
|
+
- Group names must be non-empty strings
|
|
102
|
+
- Repository names must be non-empty strings
|
|
103
|
+
- Paths must be absolute directory paths
|
|
104
|
+
|
|
105
|
+
**Example**:
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
{
|
|
109
|
+
"personal": {
|
|
110
|
+
"project1": "/Users/username/projects/project1",
|
|
111
|
+
"project2": "/Users/username/projects/project2"
|
|
112
|
+
},
|
|
113
|
+
"work": {
|
|
114
|
+
"api-service": "/Users/username/work/api-service"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 5. HshConfig Entity (Root Configuration)
|
|
120
|
+
|
|
121
|
+
**Purpose**: Root configuration structure containing all application settings.
|
|
122
|
+
|
|
123
|
+
**Fields**:
|
|
124
|
+
|
|
125
|
+
- `repos: ReposConfig` - Repository path mappings for IDE commands
|
|
126
|
+
- `yiren: YirenConfig` - Cloud infrastructure configurations
|
|
127
|
+
|
|
128
|
+
**Validation Rules**:
|
|
129
|
+
|
|
130
|
+
- Both `repos` and `yiren` sections must be present (can be empty objects)
|
|
131
|
+
- Must be valid JSON format
|
|
132
|
+
- File must exist at `~/.ai/config.json`
|
|
133
|
+
|
|
134
|
+
**Complete Example**:
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
{
|
|
138
|
+
"repos": {
|
|
139
|
+
"personal": {
|
|
140
|
+
"hsh-tool": "/Users/username/projects/hsh"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"yiren": {
|
|
144
|
+
"todo-mini": {
|
|
145
|
+
"dev": {
|
|
146
|
+
"ip": "192.168.1.10",
|
|
147
|
+
"privateKeyFile": "/Users/username/.ssh/todo-mini-dev.pem"
|
|
148
|
+
},
|
|
149
|
+
"staging": {
|
|
150
|
+
"ip": "192.168.1.20",
|
|
151
|
+
"privateKeyFile": "/Users/username/.ssh/todo-mini-staging.pem"
|
|
152
|
+
},
|
|
153
|
+
"prod": {
|
|
154
|
+
"ip": "192.168.1.30",
|
|
155
|
+
"privateKeyFile": "/Users/username/.ssh/todo-mini-prod.pem"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"wuhan-mall": {
|
|
159
|
+
"dev": {
|
|
160
|
+
"ip": "192.168.2.10",
|
|
161
|
+
"privateKeyFile": "/Users/username/.ssh/wuhan-mall-dev.pem"
|
|
162
|
+
},
|
|
163
|
+
"staging": {
|
|
164
|
+
"ip": "192.168.2.20",
|
|
165
|
+
"privateKeyFile": "/Users/username/.ssh/wuhan-mall-staging.pem"
|
|
166
|
+
},
|
|
167
|
+
"prod": {
|
|
168
|
+
"ip": "192.168.2.30",
|
|
169
|
+
"privateKeyFile": "/Users/username/.ssh/wuhan-mall-prod.pem"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Entity Relationships
|
|
177
|
+
|
|
178
|
+
```mermaid
|
|
179
|
+
graph TD
|
|
180
|
+
A[HshConfig] --> B[ReposConfig]
|
|
181
|
+
A --> C[YirenConfig]
|
|
182
|
+
C --> D[ServiceConfig: todo-mini]
|
|
183
|
+
C --> E[ServiceConfig: wuhan-mall]
|
|
184
|
+
D --> F[CloudConfig: dev]
|
|
185
|
+
D --> G[CloudConfig: staging]
|
|
186
|
+
D --> H[CloudConfig: prod]
|
|
187
|
+
E --> I[CloudConfig: dev]
|
|
188
|
+
E --> J[CloudConfig: staging]
|
|
189
|
+
E --> K[CloudConfig: prod]
|
|
190
|
+
B --> L[Group: personal]
|
|
191
|
+
B --> M[Group: work]
|
|
192
|
+
L --> N[Repo: project1]
|
|
193
|
+
L --> O[Repo: project2]
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## State Transitions
|
|
197
|
+
|
|
198
|
+
### Configuration Migration States
|
|
199
|
+
|
|
200
|
+
1. **Legacy State**: Flat configuration structure (repos directly under root)
|
|
201
|
+
2. **Transition State**: Mixed configuration (some old, some new structure)
|
|
202
|
+
3. **Modern State**: Full nested structure with repos and yiren sections
|
|
203
|
+
|
|
204
|
+
**Migration Flow**:
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
Legacy Config → Auto-Detection → Automatic Migration → Modern Config
|
|
208
|
+
↓ ↓ ↓ ↓
|
|
209
|
+
Flat structure → Check for repos key → Wrap in repos → Full structure
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Connection States
|
|
213
|
+
|
|
214
|
+
1. **Disconnected**: No active SSH connection
|
|
215
|
+
2. **Connecting**: SSH connection in progress
|
|
216
|
+
3. **Connected**: SSH session established
|
|
217
|
+
4. **Failed**: Connection attempt failed
|
|
218
|
+
|
|
219
|
+
**Connection Flow**:
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
User Command → Parameter Validation → Config Lookup → SSH Execution → Connected/Failed
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Validation Rules Summary
|
|
226
|
+
|
|
227
|
+
### Configuration File Validation
|
|
228
|
+
|
|
229
|
+
- **Format**: Valid JSON syntax
|
|
230
|
+
- **Location**: Must exist at `~/.ai/config.json`
|
|
231
|
+
- **Structure**: Must contain `repos` and `yiren` objects
|
|
232
|
+
- **Permissions**: File must be readable by user
|
|
233
|
+
|
|
234
|
+
### Cloud Configuration Validation
|
|
235
|
+
|
|
236
|
+
- **IP Address**: Valid IPv4 format, reachable network address
|
|
237
|
+
- **Private Key**: File exists, has 600 permissions, valid SSH key format
|
|
238
|
+
- **Service Names**: Non-empty, alphanumeric with hyphens allowed
|
|
239
|
+
- **Environment Names**: Must be exactly "dev", "staging", or "prod"
|
|
240
|
+
|
|
241
|
+
### Runtime Validation
|
|
242
|
+
|
|
243
|
+
- **SSH Connectivity**: Network reachability, port 22 accessible
|
|
244
|
+
- **Authentication**: Private key matches cloud instance public key
|
|
245
|
+
- **User Permissions**: SSH user (root) has necessary access rights
|
|
246
|
+
|
|
247
|
+
## Error States
|
|
248
|
+
|
|
249
|
+
### Configuration Errors
|
|
250
|
+
|
|
251
|
+
- **File Not Found**: `~/.ai/config.json` does not exist
|
|
252
|
+
- **Invalid JSON**: Malformed JSON syntax
|
|
253
|
+
- **Missing Sections**: Required `repos` or `yiren` sections missing
|
|
254
|
+
- **Invalid Structure**: Incorrect nesting or field types
|
|
255
|
+
|
|
256
|
+
### Runtime Errors
|
|
257
|
+
|
|
258
|
+
- **Service Not Found**: Requested service not in configuration
|
|
259
|
+
- **Environment Not Found**: Requested environment not configured for service
|
|
260
|
+
- **Key File Missing**: Private key file does not exist
|
|
261
|
+
- **Permission Denied**: Incorrect private key file permissions
|
|
262
|
+
- **Connection Failed**: Network connectivity or authentication failure
|
|
263
|
+
|
|
264
|
+
### Recovery Strategies
|
|
265
|
+
|
|
266
|
+
- **Auto-Migration**: Automatically migrate legacy configuration format
|
|
267
|
+
- **User Prompts**: Interactive selection when parameters missing
|
|
268
|
+
- **Validation Warnings**: Helpful messages for fixing configuration issues
|
|
269
|
+
- **Graceful Fallback**: Maintain existing functionality when cloud features unavailable
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Implementation Plan: Cloud Login Command
|
|
2
|
+
|
|
3
|
+
**Branch**: `001-cloud-login-feature` | **Date**: 2025-10-11 | **Spec**: [spec.md](./spec.md)
|
|
4
|
+
**Input**: Feature specification from `/specs/001-cloud-login-feature/spec.md`
|
|
5
|
+
|
|
6
|
+
**Note**: This template is filled in by the `/speckit.plan` command. See `.specify/templates/commands/plan.md` for the execution workflow.
|
|
7
|
+
|
|
8
|
+
## Summary
|
|
9
|
+
|
|
10
|
+
Add a new `hsh cloud login` command that enables SSH connections to cloud instances based on environment (dev/staging/prod) and service (todo-mini, wuhan-mall) parameters. The feature includes restructuring the configuration file to support both existing IDE commands and new cloud infrastructure mappings, ensuring backward compatibility while enabling scalable cloud access management.
|
|
11
|
+
|
|
12
|
+
## Technical Context
|
|
13
|
+
|
|
14
|
+
<!--
|
|
15
|
+
ACTION REQUIRED: Replace the content in this section with the technical details
|
|
16
|
+
for the project. The structure here is presented in advisory capacity to guide
|
|
17
|
+
the iteration process.
|
|
18
|
+
-->
|
|
19
|
+
|
|
20
|
+
**Language/Version**: TypeScript 5.0+ with ES2020 target and ESNext modules
|
|
21
|
+
**Primary Dependencies**: commander (CLI), inquirer (prompts), zx (shell), chalk (colors), ora (progress)
|
|
22
|
+
**Storage**: JSON config files (~/.ai/config.json) with nested structure for repos and cloud infrastructure
|
|
23
|
+
**Testing**: Manual CLI testing for SSH connections and configuration validation
|
|
24
|
+
**Target Platform**: Node.js CLI (global installation via npm/yarn)
|
|
25
|
+
**Project Type**: Single CLI application extending existing command structure
|
|
26
|
+
**Performance Goals**: Command execution <2 seconds (excluding SSH connection time), instant config validation
|
|
27
|
+
**Constraints**: SSH client system dependency, private key files per environment configuration, backward compatibility with existing config structure
|
|
28
|
+
**Scale/Scope**: Support for multiple services (todo-mini, wuhan-mall), 3 environments per service, existing IDE command migration
|
|
29
|
+
|
|
30
|
+
## Constitution Check
|
|
31
|
+
|
|
32
|
+
_GATE: Must pass before Phase 0 research. Re-check after Phase 1 design._
|
|
33
|
+
|
|
34
|
+
✅ **TypeScript-First**: All code written in TypeScript with strict mode, fully typed
|
|
35
|
+
✅ **Shell Integration**: Uses zx library for all shell operations with async/await
|
|
36
|
+
✅ **Interactive CLI**: Uses inquirer prompts with validation and chalk/ora for feedback
|
|
37
|
+
✅ **Modular Architecture**: Commands organized by domain in separate modules
|
|
38
|
+
✅ **Yarn Package Management**: Uses Yarn with standard script patterns
|
|
39
|
+
|
|
40
|
+
## Project Structure
|
|
41
|
+
|
|
42
|
+
### Documentation (this feature)
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
specs/[###-feature]/
|
|
46
|
+
├── plan.md # This file (/speckit.plan command output)
|
|
47
|
+
├── research.md # Phase 0 output (/speckit.plan command)
|
|
48
|
+
├── data-model.md # Phase 1 output (/speckit.plan command)
|
|
49
|
+
├── quickstart.md # Phase 1 output (/speckit.plan command)
|
|
50
|
+
├── contracts/ # Phase 1 output (/speckit.plan command)
|
|
51
|
+
└── tasks.md # Phase 2 output (/speckit.tasks command - NOT created by /speckit.plan)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Source Code (repository root)
|
|
55
|
+
|
|
56
|
+
<!--
|
|
57
|
+
ACTION REQUIRED: Replace the placeholder tree below with the concrete layout
|
|
58
|
+
for this feature. Delete unused options and expand the chosen structure with
|
|
59
|
+
real paths (e.g., apps/admin, packages/something). The delivered plan must
|
|
60
|
+
not include Option labels.
|
|
61
|
+
-->
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
src/
|
|
65
|
+
├── commands/
|
|
66
|
+
│ ├── git.ts # Existing git workflow commands
|
|
67
|
+
│ ├── mono.ts # Existing monorepo management
|
|
68
|
+
│ ├── ide.ts # Existing IDE integration (cursor, surf) - NEEDS UPDATE
|
|
69
|
+
│ └── cloud.ts # NEW: Cloud infrastructure commands
|
|
70
|
+
├── types/
|
|
71
|
+
│ └── index.ts # Type definitions - NEEDS UPDATE for config structure
|
|
72
|
+
├── util.ts # Utility functions - NEEDS UPDATE for config reading
|
|
73
|
+
└── hsh.ts # Main CLI entry point - NEEDS UPDATE for cloud command
|
|
74
|
+
|
|
75
|
+
dist/ # Compiled TypeScript output
|
|
76
|
+
└── [mirrors src structure]
|
|
77
|
+
|
|
78
|
+
# Configuration
|
|
79
|
+
~/.ai/config.json # User configuration with new nested structure
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Structure Decision**: Using the existing TypeScript CLI project structure. Adding a new `cloud.ts` command module following the established pattern of domain-specific modules (git, mono, ide). The existing `ide.ts`, `types/index.ts`, and `util.ts` files require updates to support the new configuration structure while maintaining backward compatibility.
|
|
83
|
+
|
|
84
|
+
## Complexity Tracking
|
|
85
|
+
|
|
86
|
+
_Fill ONLY if Constitution Check has violations that must be justified_
|
|
87
|
+
|
|
88
|
+
| Violation | Why Needed | Simpler Alternative Rejected Because |
|
|
89
|
+
| -------------------------- | ------------------ | ------------------------------------ |
|
|
90
|
+
| [e.g., 4th project] | [current need] | [why 3 projects insufficient] |
|
|
91
|
+
| [e.g., Repository pattern] | [specific problem] | [why direct DB access insufficient] |
|