helloagents 1.1.0 → 2.2.7
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/LICENSE.md +51 -0
- package/README.md +440 -841
- package/bin/cli.mjs +106 -0
- package/package.json +23 -38
- package/Claude/Skills/CN/CLAUDE.md +0 -998
- package/Claude/Skills/CN/skills/helloagents/analyze/SKILL.md +0 -187
- package/Claude/Skills/CN/skills/helloagents/design/SKILL.md +0 -261
- package/Claude/Skills/CN/skills/helloagents/develop/SKILL.md +0 -352
- package/Claude/Skills/CN/skills/helloagents/kb/SKILL.md +0 -249
- package/Claude/Skills/CN/skills/helloagents/templates/SKILL.md +0 -451
- package/Claude/Skills/EN/CLAUDE.md +0 -998
- package/Claude/Skills/EN/skills/helloagents/analyze/SKILL.md +0 -187
- package/Claude/Skills/EN/skills/helloagents/design/SKILL.md +0 -261
- package/Claude/Skills/EN/skills/helloagents/develop/SKILL.md +0 -352
- package/Claude/Skills/EN/skills/helloagents/kb/SKILL.md +0 -249
- package/Claude/Skills/EN/skills/helloagents/templates/SKILL.md +0 -451
- package/Codex/Skills/CN/AGENTS.md +0 -998
- package/Codex/Skills/CN/skills/helloagents/analyze/SKILL.md +0 -187
- package/Codex/Skills/CN/skills/helloagents/design/SKILL.md +0 -261
- package/Codex/Skills/CN/skills/helloagents/develop/SKILL.md +0 -352
- package/Codex/Skills/CN/skills/helloagents/kb/SKILL.md +0 -249
- package/Codex/Skills/CN/skills/helloagents/templates/SKILL.md +0 -451
- package/Codex/Skills/EN/AGENTS.md +0 -998
- package/Codex/Skills/EN/skills/helloagents/analyze/SKILL.md +0 -187
- package/Codex/Skills/EN/skills/helloagents/design/SKILL.md +0 -261
- package/Codex/Skills/EN/skills/helloagents/develop/SKILL.md +0 -352
- package/Codex/Skills/EN/skills/helloagents/kb/SKILL.md +0 -249
- package/Codex/Skills/EN/skills/helloagents/templates/SKILL.md +0 -451
- package/bin/cli.js +0 -85
- package/lib/args.js +0 -106
- package/lib/backup.js +0 -81
- package/lib/conflict.js +0 -118
- package/lib/copy.js +0 -125
- package/lib/defaults.js +0 -47
- package/lib/index.js +0 -297
- package/lib/output.js +0 -220
- package/lib/prompts.js +0 -173
- package/lib/utils.js +0 -225
|
@@ -1,451 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: templates
|
|
3
|
-
description: Documentation template collection; read when creating Wiki or solution package files; includes all knowledge base templates and solution file templates
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Documentation Template Collection
|
|
7
|
-
|
|
8
|
-
**Template Usage General Instructions:**
|
|
9
|
-
1. Replace `[...]` content with actual content
|
|
10
|
-
2. **Language Specification:** Strictly follow G1 rules. Except for exception list, all content generated in {OUTPUT_LANGUAGE}
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## A1 | Knowledge Base Documentation Templates
|
|
15
|
-
|
|
16
|
-
### CHANGELOG.md
|
|
17
|
-
|
|
18
|
-
```markdown
|
|
19
|
-
# Changelog
|
|
20
|
-
|
|
21
|
-
This file records all important project changes.
|
|
22
|
-
Format based on [Keep a Changelog](https://keepachangelog.com/zh-CN/1.0.0/),
|
|
23
|
-
version numbers follow [Semantic Versioning](https://semver.org/lang/zh-CN/).
|
|
24
|
-
|
|
25
|
-
## [Unreleased]
|
|
26
|
-
|
|
27
|
-
## [Version] - YYYY-MM-DD
|
|
28
|
-
|
|
29
|
-
### Added
|
|
30
|
-
- [New feature description]
|
|
31
|
-
|
|
32
|
-
### Changed
|
|
33
|
-
- [Change description]
|
|
34
|
-
|
|
35
|
-
### Fixed
|
|
36
|
-
- [Fix description]
|
|
37
|
-
|
|
38
|
-
### Removed
|
|
39
|
-
- [Removal description]
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
### history/index.md
|
|
45
|
-
|
|
46
|
-
```markdown
|
|
47
|
-
# Change History Index
|
|
48
|
-
|
|
49
|
-
This file records index of all completed changes for traceability and query.
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Index
|
|
54
|
-
|
|
55
|
-
| Timestamp | Feature Name | Type | Status | Solution Package Path |
|
|
56
|
-
|-----------|--------------|------|--------|----------------------|
|
|
57
|
-
| YYYYMMDDHHMM | [Feature ID] | [Feature/Fix/Refactor] | ✅Completed/[-]Not Executed | [Link] |
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## Archive by Month
|
|
62
|
-
|
|
63
|
-
### YYYY-MM
|
|
64
|
-
|
|
65
|
-
- [YYYYMMDDHHMM_feature](YYYY-MM/YYYYMMDDHHMM_feature/) - [One-line feature description]
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
### wiki/overview.md
|
|
71
|
-
|
|
72
|
-
```markdown
|
|
73
|
-
# [Project Name]
|
|
74
|
-
|
|
75
|
-
> This file contains project-level core information. Detailed module documentation in `modules/` directory.
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
## 1. Project Overview
|
|
80
|
-
|
|
81
|
-
### Goals and Background
|
|
82
|
-
[Brief project goals and background]
|
|
83
|
-
|
|
84
|
-
### Scope
|
|
85
|
-
- **In scope:** [Core feature boundaries]
|
|
86
|
-
- **Out of scope:** [Explicitly not included]
|
|
87
|
-
|
|
88
|
-
### Stakeholders
|
|
89
|
-
- **Owner:** [Name/Role]
|
|
90
|
-
|
|
91
|
-
---
|
|
92
|
-
|
|
93
|
-
## 2. Module Index
|
|
94
|
-
|
|
95
|
-
| Module Name | Responsibility | Status | Documentation |
|
|
96
|
-
|-------------|----------------|--------|---------------|
|
|
97
|
-
| [Module] | [Core responsibility] | [Stable/In Development] | [Link] |
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
## 3. Quick Links
|
|
102
|
-
- [Technical Conventions](../project.md)
|
|
103
|
-
- [Architecture Design](arch.md)
|
|
104
|
-
- [API Manual](api.md)
|
|
105
|
-
- [Data Models](data.md)
|
|
106
|
-
- [Change History](../history/index.md)
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
### wiki/arch.md
|
|
112
|
-
|
|
113
|
-
```markdown
|
|
114
|
-
# Architecture Design
|
|
115
|
-
|
|
116
|
-
## Overall Architecture
|
|
117
|
-
```mermaid
|
|
118
|
-
flowchart TD
|
|
119
|
-
A[Component A] --> B[Component B]
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## Tech Stack
|
|
123
|
-
- **Backend:** [Language/Framework]
|
|
124
|
-
- **Frontend:** [Framework/Library]
|
|
125
|
-
- **Data:** [Database/Storage]
|
|
126
|
-
|
|
127
|
-
## Core Flow
|
|
128
|
-
```mermaid
|
|
129
|
-
sequenceDiagram
|
|
130
|
-
Participant->>System: Action
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
## Major Architecture Decisions
|
|
134
|
-
Complete ADRs stored in each change's how.md, this section provides index.
|
|
135
|
-
|
|
136
|
-
| adr_id | title | date | status | affected_modules | details |
|
|
137
|
-
|--------|-------|------|--------|------------------|---------|
|
|
138
|
-
| ADR-[Number] | [Title] | YYYY-MM-DD | ✅Adopted/❌Deprecated | [Module list] | [Link] |
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
---
|
|
142
|
-
|
|
143
|
-
### project.md
|
|
144
|
-
|
|
145
|
-
```markdown
|
|
146
|
-
# Project Technical Conventions
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## Tech Stack
|
|
151
|
-
- **Core:** [Language version] / [Framework version]
|
|
152
|
-
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
## Development Conventions
|
|
156
|
-
- **Code Standards:** [Reference standards or brief description]
|
|
157
|
-
- **Naming Conventions:** [e.g., camelCase/snake_case]
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
## Errors and Logging
|
|
162
|
-
- **Strategy:** [Unified error handling approach]
|
|
163
|
-
- **Logging:** [Level and format requirements]
|
|
164
|
-
|
|
165
|
-
---
|
|
166
|
-
|
|
167
|
-
## Testing and Process
|
|
168
|
-
- **Testing:** [Unit/integration test requirements]
|
|
169
|
-
- **Commit:** [Commit Message specification]
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
### wiki/api.md
|
|
175
|
-
|
|
176
|
-
```markdown
|
|
177
|
-
# API Manual
|
|
178
|
-
|
|
179
|
-
## Overview
|
|
180
|
-
[Overall API description]
|
|
181
|
-
|
|
182
|
-
## Authentication Method
|
|
183
|
-
[Authentication mechanism description]
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
## API List
|
|
188
|
-
|
|
189
|
-
### [Module Name]
|
|
190
|
-
|
|
191
|
-
#### [METHOD] [Path]
|
|
192
|
-
**Description:** [Functionality]
|
|
193
|
-
|
|
194
|
-
**Request Parameters:**
|
|
195
|
-
| Parameter | Type | Required | Description |
|
|
196
|
-
|-----------|------|----------|-------------|
|
|
197
|
-
| [Param] | [Type] | [Yes/No] | [Description] |
|
|
198
|
-
|
|
199
|
-
**Response:**
|
|
200
|
-
```json
|
|
201
|
-
{
|
|
202
|
-
"code": 0,
|
|
203
|
-
"data": {}
|
|
204
|
-
}
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
**Error Codes:**
|
|
208
|
-
| Error Code | Description |
|
|
209
|
-
|------------|-------------|
|
|
210
|
-
| [code] | [Description] |
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
---
|
|
214
|
-
|
|
215
|
-
### wiki/data.md
|
|
216
|
-
|
|
217
|
-
```markdown
|
|
218
|
-
# Data Models
|
|
219
|
-
|
|
220
|
-
## Overview
|
|
221
|
-
[Overall data architecture description]
|
|
222
|
-
|
|
223
|
-
---
|
|
224
|
-
|
|
225
|
-
## Data Tables/Collections
|
|
226
|
-
|
|
227
|
-
### [Table/Collection Name]
|
|
228
|
-
|
|
229
|
-
**Description:** [Usage description]
|
|
230
|
-
|
|
231
|
-
| Field | Type | Constraints | Description |
|
|
232
|
-
|-------|------|-------------|-------------|
|
|
233
|
-
| [Field] | [Type] | [Primary Key/Not Null/Unique, etc.] | [Description] |
|
|
234
|
-
|
|
235
|
-
**Indexes:**
|
|
236
|
-
- [Index name]: [Field list]
|
|
237
|
-
|
|
238
|
-
**Relationships:**
|
|
239
|
-
- [Relationship description]
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
---
|
|
243
|
-
|
|
244
|
-
### wiki/modules/<module>.md
|
|
245
|
-
|
|
246
|
-
**Status options:** ✅Stable / 🚧In Development / 📝Planning
|
|
247
|
-
|
|
248
|
-
```markdown
|
|
249
|
-
# [Module Name]
|
|
250
|
-
|
|
251
|
-
## Purpose
|
|
252
|
-
[One-line module purpose]
|
|
253
|
-
|
|
254
|
-
## Module Overview
|
|
255
|
-
- **Responsibility:** [Detailed responsibility description]
|
|
256
|
-
- **Status:** [Status icon]
|
|
257
|
-
- **Last Updated:** YYYY-MM-DD
|
|
258
|
-
|
|
259
|
-
## Specifications
|
|
260
|
-
|
|
261
|
-
<!-- 🔁 Repeat the following format for each requirement -->
|
|
262
|
-
### Requirement: [Requirement Name]
|
|
263
|
-
**Module:** [Current module name]
|
|
264
|
-
[Requirement description]
|
|
265
|
-
|
|
266
|
-
#### Scenario: [Scenario Name]
|
|
267
|
-
[Preconditions]
|
|
268
|
-
- [Expected result 1]
|
|
269
|
-
- [Expected result 2]
|
|
270
|
-
<!-- Loop end -->
|
|
271
|
-
|
|
272
|
-
## API Interfaces
|
|
273
|
-
<!-- Fill if APIs exist -->
|
|
274
|
-
### [METHOD] [Path]
|
|
275
|
-
**Description:** [Functionality]
|
|
276
|
-
**Input:** [Parameters]
|
|
277
|
-
**Output:** [Response]
|
|
278
|
-
|
|
279
|
-
## Data Models
|
|
280
|
-
<!-- Fill if data tables exist -->
|
|
281
|
-
### [Table/Model Name]
|
|
282
|
-
| Field | Type | Description |
|
|
283
|
-
|-------|------|-------------|
|
|
284
|
-
| [Field] | [Type] | [Description] |
|
|
285
|
-
|
|
286
|
-
## Dependencies
|
|
287
|
-
- [Dependent module list]
|
|
288
|
-
|
|
289
|
-
## Change History
|
|
290
|
-
- [YYYYMMDDHHMM_feature](../../history/YYYY-MM/...) - [Change brief]
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
---
|
|
294
|
-
|
|
295
|
-
## A2 | Solution File Templates
|
|
296
|
-
|
|
297
|
-
### why.md in plan/ and history/
|
|
298
|
-
|
|
299
|
-
**Logic Control:** `Product Analysis` section only generated when G8 (Product Design Principles) triggered, otherwise omit.
|
|
300
|
-
|
|
301
|
-
```markdown
|
|
302
|
-
# Change Proposal: [Feature Name]
|
|
303
|
-
|
|
304
|
-
## Requirement Background
|
|
305
|
-
[Describe current state, pain points, and change drivers]
|
|
306
|
-
|
|
307
|
-
<!-- ⚠️ Only generate this section when G8 triggered -->
|
|
308
|
-
## Product Analysis
|
|
309
|
-
|
|
310
|
-
### Target Users and Scenarios
|
|
311
|
-
- **User Groups:** [Characteristic description]
|
|
312
|
-
- **Usage Scenarios:** [Specific scenario description]
|
|
313
|
-
- **Core Pain Points:** [Problems to solve]
|
|
314
|
-
|
|
315
|
-
### Value Proposition and Success Metrics
|
|
316
|
-
- **Value Proposition:** [Core value]
|
|
317
|
-
- **Success Metrics:** [Quantifiable metrics]
|
|
318
|
-
|
|
319
|
-
### Humanistic Care
|
|
320
|
-
[Inclusivity/Privacy/Ethical considerations]
|
|
321
|
-
<!-- Product Analysis section end -->
|
|
322
|
-
|
|
323
|
-
## Change Content
|
|
324
|
-
1. [Change point 1]
|
|
325
|
-
2. [Change point 2]
|
|
326
|
-
|
|
327
|
-
## Impact Scope
|
|
328
|
-
- **Modules:** [List]
|
|
329
|
-
- **Files:** [List]
|
|
330
|
-
- **APIs:** [List]
|
|
331
|
-
- **Data:** [List]
|
|
332
|
-
|
|
333
|
-
## Core Scenarios
|
|
334
|
-
|
|
335
|
-
<!-- 🔁 Repeat the following format for each requirement -->
|
|
336
|
-
### Requirement: [Requirement Name]
|
|
337
|
-
**Module:** [Owning module name]
|
|
338
|
-
[Requirement brief]
|
|
339
|
-
|
|
340
|
-
#### Scenario: [Scenario Name]
|
|
341
|
-
[Condition description]
|
|
342
|
-
- [Expected result]
|
|
343
|
-
<!-- Loop end -->
|
|
344
|
-
|
|
345
|
-
## Risk Assessment
|
|
346
|
-
- **Risk:** [Description]
|
|
347
|
-
- **Mitigation:** [Measures]
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
---
|
|
351
|
-
|
|
352
|
-
### how.md in plan/ and history/
|
|
353
|
-
|
|
354
|
-
```markdown
|
|
355
|
-
# Technical Design: [Feature Name]
|
|
356
|
-
|
|
357
|
-
## Technical Solution
|
|
358
|
-
### Core Technologies
|
|
359
|
-
- [Language/Framework/Library]
|
|
360
|
-
|
|
361
|
-
### Implementation Key Points
|
|
362
|
-
- [Key logic 1]
|
|
363
|
-
- [Key logic 2]
|
|
364
|
-
|
|
365
|
-
## Architecture Design
|
|
366
|
-
<!-- If architecture changes -->
|
|
367
|
-
```mermaid
|
|
368
|
-
flowchart TD
|
|
369
|
-
[Chart code]
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
## Architecture Decision ADR
|
|
373
|
-
<!-- If involves architecture decisions, otherwise omit -->
|
|
374
|
-
### ADR-[Number]: [Decision Title]
|
|
375
|
-
**Context:** [Background and problem]
|
|
376
|
-
**Decision:** [Core decision]
|
|
377
|
-
**Rationale:** [Reasons]
|
|
378
|
-
**Alternatives:** [Solution] → Rejection reason: [Reason]
|
|
379
|
-
**Impact:** [Consequences and risks]
|
|
380
|
-
|
|
381
|
-
## API Design
|
|
382
|
-
<!-- If API changes -->
|
|
383
|
-
### [METHOD] [Path]
|
|
384
|
-
- **Request:** [Structure]
|
|
385
|
-
- **Response:** [Structure]
|
|
386
|
-
|
|
387
|
-
## Data Model
|
|
388
|
-
<!-- If data changes -->
|
|
389
|
-
```sql
|
|
390
|
-
[SQL or Schema code]
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
## Security and Performance
|
|
394
|
-
- **Security:** [Measures]
|
|
395
|
-
- **Performance:** [Optimizations]
|
|
396
|
-
|
|
397
|
-
## Testing and Deployment
|
|
398
|
-
- **Testing:** [Strategy]
|
|
399
|
-
- **Deployment:** [Process]
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
---
|
|
403
|
-
|
|
404
|
-
### task.md in plan/ and history/
|
|
405
|
-
|
|
406
|
-
**Markdown anchor link format generated per actual section titles in why.md**
|
|
407
|
-
|
|
408
|
-
```markdown
|
|
409
|
-
# Task List: [Feature Name]
|
|
410
|
-
|
|
411
|
-
Directory: `helloagents/plan/YYYYMMDDHHMM_<feature>/`
|
|
412
|
-
|
|
413
|
-
---
|
|
414
|
-
|
|
415
|
-
## 1. [Core Feature Module Name]
|
|
416
|
-
- [ ] 1.1 Implement [specific functionality] in `path/to/file.ts`, verify why.md#[requirement-title-anchor]-[scenario-title-anchor]
|
|
417
|
-
- [ ] 1.2 Implement [specific functionality] in `path/to/file.ts`, verify why.md#[requirement-title-anchor]-[scenario-title-anchor], depends on task 1.1
|
|
418
|
-
|
|
419
|
-
## 2. [Secondary Feature Module Name]
|
|
420
|
-
- [ ] 2.1 Implement [specific functionality] in `path/to/file.ts`, verify why.md#[requirement-title-anchor]-[scenario-title-anchor], depends on task 1.2
|
|
421
|
-
|
|
422
|
-
## 3. Security Check
|
|
423
|
-
- [ ] 3.1 Execute security check (per G9: input validation, sensitive info handling, permission control, EHRB risk avoidance)
|
|
424
|
-
|
|
425
|
-
## 4. Documentation Update
|
|
426
|
-
- [ ] 4.1 Update <knowledge base file>
|
|
427
|
-
|
|
428
|
-
## 5. Testing
|
|
429
|
-
- [ ] 5.1 Implement scenario test in `tests/integration/xxx.test.ts`: [Scenario 1 name], verification points: [key verification point list]
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
**Task Status Symbols:** Follow G11 definition
|
|
433
|
-
|
|
434
|
-
---
|
|
435
|
-
|
|
436
|
-
## A3 | Version Number Parsing Rules
|
|
437
|
-
|
|
438
|
-
### Multi-Language Version Number Sources (Priority: Primary > Secondary)
|
|
439
|
-
|
|
440
|
-
| Language/Framework | Primary Source | Secondary Source |
|
|
441
|
-
|-------------------|----------------|------------------|
|
|
442
|
-
| JavaScript/TypeScript | package.json → version | index.js/ts → VERSION constant |
|
|
443
|
-
| Python | pyproject.toml → [project].version | setup.py/__init__.py → __version__ |
|
|
444
|
-
| Java(Maven) | pom.xml → \<version\> | - |
|
|
445
|
-
| Java(Gradle) | gradle.properties/build.gradle → version | - |
|
|
446
|
-
| Go | Git tag | - |
|
|
447
|
-
| Rust | Cargo.toml → [package].version | - |
|
|
448
|
-
| .NET | .csproj → \<Version\>/\<AssemblyVersion\> | - |
|
|
449
|
-
| C/C++ | CMakeLists.txt → project(...VERSION) | Header file → #define PROJECT_VERSION |
|
|
450
|
-
|
|
451
|
-
**Purpose:** Referenced by G7 version management rules to determine version number file locations for projects in each language.
|
package/bin/cli.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* HelloAGENTS CLI - Entry Point
|
|
5
|
-
*
|
|
6
|
-
* CLI tool to configure HelloAGENTS for Claude Code and Codex
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
'use strict';
|
|
10
|
-
|
|
11
|
-
const { parseArgs } = require('../lib/args');
|
|
12
|
-
const { run } = require('../lib/index');
|
|
13
|
-
const { error, info } = require('../lib/output');
|
|
14
|
-
const pkg = require('../package.json');
|
|
15
|
-
|
|
16
|
-
const HELP_TEXT = `
|
|
17
|
-
HelloAGENTS - AI编程模块化技能系统配置工具
|
|
18
|
-
|
|
19
|
-
Usage: npx helloagents [options]
|
|
20
|
-
|
|
21
|
-
Options:
|
|
22
|
-
--platform <claude|codex> 目标平台(跳过交互)
|
|
23
|
-
--lang <cn|en> 语言版本(跳过交互)
|
|
24
|
-
--yes, -y 全部使用默认选项(非交互)
|
|
25
|
-
--dry-run 仅显示将执行的操作,不实际写入
|
|
26
|
-
--skills-only 仅更新 skills/helloagents,跳过顶层配置文件
|
|
27
|
-
--overwrite 强制覆盖顶层配置文件(不生成 .new)
|
|
28
|
-
--no-backup 跳过备份步骤
|
|
29
|
-
--no-color 禁用 ANSI 颜色输出
|
|
30
|
-
--help, -h 显示帮助
|
|
31
|
-
--version, -v 显示版本
|
|
32
|
-
|
|
33
|
-
Examples:
|
|
34
|
-
npx helloagents # 交互式安装
|
|
35
|
-
npx helloagents -y # 使用默认选项安装
|
|
36
|
-
npx helloagents --platform claude --lang cn # 指定平台和语言
|
|
37
|
-
npx helloagents --dry-run # 预览将执行的操作
|
|
38
|
-
npx helloagents --skills-only # 仅更新技能模块
|
|
39
|
-
|
|
40
|
-
Documentation: https://github.com/hellowind777/helloagents
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
async function main() {
|
|
44
|
-
try {
|
|
45
|
-
// Parse command line arguments
|
|
46
|
-
const options = parseArgs(process.argv.slice(2));
|
|
47
|
-
|
|
48
|
-
// Handle --help
|
|
49
|
-
if (options.help) {
|
|
50
|
-
console.log(HELP_TEXT);
|
|
51
|
-
process.exit(0);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Handle --version
|
|
55
|
-
if (options.version) {
|
|
56
|
-
console.log(`helloagents v${pkg.version}`);
|
|
57
|
-
process.exit(0);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Run main logic
|
|
61
|
-
await run(options);
|
|
62
|
-
|
|
63
|
-
} catch (err) {
|
|
64
|
-
// Handle known error types
|
|
65
|
-
if (err.code === 'MUTEX_PARAMS') {
|
|
66
|
-
error(err.message);
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (err.code === 'INVALID_PARAM') {
|
|
71
|
-
error(err.message);
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Handle unexpected errors
|
|
76
|
-
error(`发生错误: ${err.message}`);
|
|
77
|
-
if (process.env.DEBUG) {
|
|
78
|
-
console.error(err.stack);
|
|
79
|
-
}
|
|
80
|
-
process.exit(1);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Run CLI
|
|
85
|
-
main();
|
package/lib/args.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Args - Command line argument parsing
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
'use strict';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Parse command line arguments
|
|
9
|
-
* @param {string[]} argv - Command line arguments (without node and script)
|
|
10
|
-
* @returns {Object} Parsed options
|
|
11
|
-
* @throws {Error} On invalid arguments
|
|
12
|
-
*/
|
|
13
|
-
function parseArgs(argv) {
|
|
14
|
-
const options = {
|
|
15
|
-
platform: null,
|
|
16
|
-
lang: null,
|
|
17
|
-
yes: false,
|
|
18
|
-
dryRun: false,
|
|
19
|
-
skillsOnly: false,
|
|
20
|
-
overwrite: false,
|
|
21
|
-
noBackup: false,
|
|
22
|
-
noColor: false,
|
|
23
|
-
help: false,
|
|
24
|
-
version: false,
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
for (let i = 0; i < argv.length; i++) {
|
|
28
|
-
const arg = argv[i];
|
|
29
|
-
|
|
30
|
-
switch (arg) {
|
|
31
|
-
case '--platform':
|
|
32
|
-
options.platform = argv[++i];
|
|
33
|
-
if (!options.platform || !['claude', 'codex'].includes(options.platform)) {
|
|
34
|
-
const err = new Error(`无效的平台参数: ${options.platform}。有效值: claude, codex`);
|
|
35
|
-
err.code = 'INVALID_PARAM';
|
|
36
|
-
throw err;
|
|
37
|
-
}
|
|
38
|
-
break;
|
|
39
|
-
|
|
40
|
-
case '--lang':
|
|
41
|
-
options.lang = argv[++i];
|
|
42
|
-
if (!options.lang || !['cn', 'en'].includes(options.lang)) {
|
|
43
|
-
const err = new Error(`无效的语言参数: ${options.lang}。有效值: cn, en`);
|
|
44
|
-
err.code = 'INVALID_PARAM';
|
|
45
|
-
throw err;
|
|
46
|
-
}
|
|
47
|
-
break;
|
|
48
|
-
|
|
49
|
-
case '--yes':
|
|
50
|
-
case '-y':
|
|
51
|
-
options.yes = true;
|
|
52
|
-
break;
|
|
53
|
-
|
|
54
|
-
case '--dry-run':
|
|
55
|
-
options.dryRun = true;
|
|
56
|
-
break;
|
|
57
|
-
|
|
58
|
-
case '--skills-only':
|
|
59
|
-
options.skillsOnly = true;
|
|
60
|
-
break;
|
|
61
|
-
|
|
62
|
-
case '--overwrite':
|
|
63
|
-
options.overwrite = true;
|
|
64
|
-
break;
|
|
65
|
-
|
|
66
|
-
case '--no-backup':
|
|
67
|
-
options.noBackup = true;
|
|
68
|
-
break;
|
|
69
|
-
|
|
70
|
-
case '--no-color':
|
|
71
|
-
options.noColor = true;
|
|
72
|
-
break;
|
|
73
|
-
|
|
74
|
-
case '--help':
|
|
75
|
-
case '-h':
|
|
76
|
-
options.help = true;
|
|
77
|
-
break;
|
|
78
|
-
|
|
79
|
-
case '--version':
|
|
80
|
-
case '-v':
|
|
81
|
-
options.version = true;
|
|
82
|
-
break;
|
|
83
|
-
|
|
84
|
-
default:
|
|
85
|
-
if (arg.startsWith('-')) {
|
|
86
|
-
const err = new Error(`未知参数: ${arg}`);
|
|
87
|
-
err.code = 'INVALID_PARAM';
|
|
88
|
-
throw err;
|
|
89
|
-
}
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Check for mutually exclusive options
|
|
95
|
-
if (options.skillsOnly && options.overwrite) {
|
|
96
|
-
const err = new Error('--skills-only 与 --overwrite 不能同时使用');
|
|
97
|
-
err.code = 'MUTEX_PARAMS';
|
|
98
|
-
throw err;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return options;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
module.exports = {
|
|
105
|
-
parseArgs,
|
|
106
|
-
};
|
package/lib/backup.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Backup - File and directory backup functionality
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
'use strict';
|
|
6
|
-
|
|
7
|
-
const path = require('path');
|
|
8
|
-
const fsPromises = require('fs').promises;
|
|
9
|
-
const { getTimestamp, ensureDir } = require('./utils');
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Backup a single file
|
|
13
|
-
* @param {string} filePath - Path to file to backup
|
|
14
|
-
* @param {Object} deps - Dependencies
|
|
15
|
-
* @returns {Promise<string>} Backup path
|
|
16
|
-
*/
|
|
17
|
-
async function backupFile(filePath, deps = {}) {
|
|
18
|
-
const fsModule = deps.fs || fsPromises;
|
|
19
|
-
const timestamp = getTimestamp(deps);
|
|
20
|
-
|
|
21
|
-
const dir = path.dirname(filePath);
|
|
22
|
-
const ext = path.extname(filePath);
|
|
23
|
-
const base = path.basename(filePath, ext);
|
|
24
|
-
const backupPath = path.join(dir, `${base}${ext}.backup-${timestamp}`);
|
|
25
|
-
|
|
26
|
-
await fsModule.copyFile(filePath, backupPath);
|
|
27
|
-
|
|
28
|
-
return backupPath;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Backup a directory
|
|
33
|
-
* @param {string} dirPath - Path to directory to backup
|
|
34
|
-
* @param {Object} deps - Dependencies
|
|
35
|
-
* @returns {Promise<string>} Backup path
|
|
36
|
-
*/
|
|
37
|
-
async function backupDir(dirPath, deps = {}) {
|
|
38
|
-
const fsModule = deps.fs || fsPromises;
|
|
39
|
-
const timestamp = getTimestamp(deps);
|
|
40
|
-
|
|
41
|
-
const parent = path.dirname(dirPath);
|
|
42
|
-
const name = path.basename(dirPath);
|
|
43
|
-
const backupPath = path.join(parent, `${name}.backup-${timestamp}`);
|
|
44
|
-
|
|
45
|
-
// Recursively copy directory
|
|
46
|
-
await copyDirRecursive(dirPath, backupPath, deps);
|
|
47
|
-
|
|
48
|
-
return backupPath;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Recursively copy a directory
|
|
53
|
-
* @param {string} src - Source directory
|
|
54
|
-
* @param {string} dest - Destination directory
|
|
55
|
-
* @param {Object} deps - Dependencies
|
|
56
|
-
* @returns {Promise<void>}
|
|
57
|
-
*/
|
|
58
|
-
async function copyDirRecursive(src, dest, deps = {}) {
|
|
59
|
-
const fsModule = deps.fs || fsPromises;
|
|
60
|
-
|
|
61
|
-
await ensureDir(dest, deps);
|
|
62
|
-
|
|
63
|
-
const entries = await fsModule.readdir(src, { withFileTypes: true });
|
|
64
|
-
|
|
65
|
-
for (const entry of entries) {
|
|
66
|
-
const srcPath = path.join(src, entry.name);
|
|
67
|
-
const destPath = path.join(dest, entry.name);
|
|
68
|
-
|
|
69
|
-
if (entry.isDirectory()) {
|
|
70
|
-
await copyDirRecursive(srcPath, destPath, deps);
|
|
71
|
-
} else {
|
|
72
|
-
await fsModule.copyFile(srcPath, destPath);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
module.exports = {
|
|
78
|
-
backupFile,
|
|
79
|
-
backupDir,
|
|
80
|
-
copyDirRecursive,
|
|
81
|
-
};
|