@ai-content-space/loopx 0.2.8 → 0.2.10
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 +26 -9
- package/README.zh-CN.md +26 -9
- package/docs/loopx/design/loopx-skill-suite-v1-design.md +12 -0
- package/docs/loopx/plans/2026-06-14-loopx-spec-memory-context-loading.md +948 -0
- package/docs/loopx/plans/2026-06-15-support-lens-skills-migration.md +1153 -0
- package/package.json +6 -1
- package/plugins/loopx/.codex-plugin/plugin.json +1 -1
- package/plugins/loopx/skills/api-designer/SKILL.md +232 -0
- package/plugins/loopx/skills/api-designer/references/error-handling.md +541 -0
- package/plugins/loopx/skills/api-designer/references/openapi.md +824 -0
- package/plugins/loopx/skills/api-designer/references/pagination.md +494 -0
- package/plugins/loopx/skills/api-designer/references/rest-patterns.md +335 -0
- package/plugins/loopx/skills/api-designer/references/versioning.md +391 -0
- package/plugins/loopx/skills/architecture-designer/SKILL.md +117 -0
- package/plugins/loopx/skills/architecture-designer/references/adr-template.md +116 -0
- package/plugins/loopx/skills/architecture-designer/references/architecture-patterns.md +346 -0
- package/plugins/loopx/skills/architecture-designer/references/database-selection.md +102 -0
- package/plugins/loopx/skills/architecture-designer/references/nfr-checklist.md +212 -0
- package/plugins/loopx/skills/architecture-designer/references/system-design.md +313 -0
- package/plugins/loopx/skills/clarify/SKILL.md +12 -1
- package/plugins/loopx/skills/cli-developer/SKILL.md +124 -0
- package/plugins/loopx/skills/cli-developer/references/design-patterns.md +221 -0
- package/plugins/loopx/skills/cli-developer/references/go-cli.md +540 -0
- package/plugins/loopx/skills/cli-developer/references/node-cli.md +383 -0
- package/plugins/loopx/skills/cli-developer/references/python-cli.md +422 -0
- package/plugins/loopx/skills/cli-developer/references/ux-patterns.md +448 -0
- package/plugins/loopx/skills/debug/SKILL.md +1 -1
- package/plugins/loopx/skills/doc-readability/SKILL.md +1 -1
- package/plugins/loopx/skills/exec/SKILL.md +1 -1
- package/plugins/loopx/skills/final-review/SKILL.md +1 -1
- package/plugins/loopx/skills/finish/SKILL.md +1 -1
- package/plugins/loopx/skills/fix-review/SKILL.md +1 -1
- package/plugins/loopx/skills/go-style/SKILL.md +1 -1
- package/plugins/loopx/skills/kratos/SKILL.md +2 -1
- package/plugins/loopx/skills/plan-to-exec/SKILL.md +12 -1
- package/plugins/loopx/skills/refactor-plan/SKILL.md +1 -1
- package/plugins/loopx/skills/requirement-analyzer/SKILL.md +161 -0
- package/plugins/loopx/skills/requirement-analyzer/references/example-reports.md +170 -0
- package/plugins/loopx/skills/requirement-analyzer/references/prd-gap-checklist.md +167 -0
- package/plugins/loopx/skills/requirement-analyzer/references/readiness-rubric.md +70 -0
- package/plugins/loopx/skills/requirement-analyzer/references/report-template.md +83 -0
- package/plugins/loopx/skills/review/SKILL.md +1 -1
- package/plugins/loopx/skills/spec/SKILL.md +12 -1
- package/plugins/loopx/skills/sql-style/SKILL.md +108 -0
- package/plugins/loopx/skills/sql-style/references/database-design.md +402 -0
- package/plugins/loopx/skills/sql-style/references/dialect-differences.md +419 -0
- package/plugins/loopx/skills/sql-style/references/optimization.md +384 -0
- package/plugins/loopx/skills/sql-style/references/query-patterns.md +285 -0
- package/plugins/loopx/skills/sql-style/references/window-functions.md +328 -0
- package/plugins/loopx/skills/subagent-exec/SKILL.md +1 -1
- package/plugins/loopx/skills/tdd/SKILL.md +1 -1
- package/plugins/loopx/skills/verify/SKILL.md +1 -1
- package/scripts/verify-skills.mjs +0 -2
- package/skills/RESOLVER.md +8 -1
- package/skills/api-designer/SKILL.md +232 -0
- package/skills/api-designer/references/error-handling.md +541 -0
- package/skills/api-designer/references/openapi.md +824 -0
- package/skills/api-designer/references/pagination.md +494 -0
- package/skills/api-designer/references/rest-patterns.md +335 -0
- package/skills/api-designer/references/versioning.md +391 -0
- package/skills/architecture-designer/SKILL.md +117 -0
- package/skills/architecture-designer/references/adr-template.md +116 -0
- package/skills/architecture-designer/references/architecture-patterns.md +346 -0
- package/skills/architecture-designer/references/database-selection.md +102 -0
- package/skills/architecture-designer/references/nfr-checklist.md +212 -0
- package/skills/architecture-designer/references/system-design.md +313 -0
- package/skills/clarify/SKILL.md +12 -1
- package/skills/cli-developer/SKILL.md +124 -0
- package/skills/cli-developer/references/design-patterns.md +221 -0
- package/skills/cli-developer/references/go-cli.md +540 -0
- package/skills/cli-developer/references/node-cli.md +383 -0
- package/skills/cli-developer/references/python-cli.md +422 -0
- package/skills/cli-developer/references/ux-patterns.md +448 -0
- package/skills/debug/SKILL.md +1 -1
- package/skills/doc-readability/SKILL.md +1 -1
- package/skills/exec/SKILL.md +1 -1
- package/skills/final-review/SKILL.md +1 -1
- package/skills/finish/SKILL.md +1 -1
- package/skills/fix-review/SKILL.md +1 -1
- package/skills/go-style/SKILL.md +1 -1
- package/skills/kratos/SKILL.md +2 -1
- package/skills/plan-to-exec/SKILL.md +12 -1
- package/skills/refactor-plan/SKILL.md +1 -1
- package/skills/requirement-analyzer/SKILL.md +161 -0
- package/skills/requirement-analyzer/references/example-reports.md +170 -0
- package/skills/requirement-analyzer/references/prd-gap-checklist.md +167 -0
- package/skills/requirement-analyzer/references/readiness-rubric.md +70 -0
- package/skills/requirement-analyzer/references/report-template.md +83 -0
- package/skills/review/SKILL.md +1 -1
- package/skills/spec/SKILL.md +12 -1
- package/skills/sql-style/SKILL.md +108 -0
- package/skills/sql-style/references/database-design.md +402 -0
- package/skills/sql-style/references/dialect-differences.md +419 -0
- package/skills/sql-style/references/optimization.md +384 -0
- package/skills/sql-style/references/query-patterns.md +285 -0
- package/skills/sql-style/references/window-functions.md +328 -0
- package/skills/subagent-exec/SKILL.md +1 -1
- package/skills/tdd/SKILL.md +1 -1
- package/skills/verify/SKILL.md +1 -1
- package/src/cli.mjs +4 -1
- package/src/context-manifest.mjs +51 -1
- package/src/install-discovery.mjs +114 -0
- package/src/loopx-context-artifacts.mjs +114 -0
- package/src/project-discovery.mjs +1 -0
- package/src/workflow.mjs +47 -3
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# CLI Design Patterns
|
|
2
|
+
|
|
3
|
+
## Command Hierarchy
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
mycli # Root command
|
|
7
|
+
├── init [options] # Simple command
|
|
8
|
+
├── config
|
|
9
|
+
│ ├── get <key> # Nested subcommand
|
|
10
|
+
│ ├── set <key> <value>
|
|
11
|
+
│ └── list
|
|
12
|
+
├── deploy [environment] # Command with args
|
|
13
|
+
│ ├── --dry-run # Flag
|
|
14
|
+
│ ├── --force
|
|
15
|
+
│ └── --config <file> # Option with value
|
|
16
|
+
└── plugins
|
|
17
|
+
├── install <name>
|
|
18
|
+
├── list
|
|
19
|
+
└── remove <name>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Flag Conventions
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Boolean flags (presence = true)
|
|
26
|
+
mycli deploy --force --dry-run
|
|
27
|
+
|
|
28
|
+
# Short + long forms
|
|
29
|
+
mycli -v --verbose
|
|
30
|
+
mycli -c config.yml --config config.yml
|
|
31
|
+
|
|
32
|
+
# Required vs optional
|
|
33
|
+
mycli deploy <env> # Positional (required)
|
|
34
|
+
mycli deploy --env production # Flag (optional)
|
|
35
|
+
|
|
36
|
+
# Multiple values
|
|
37
|
+
mycli install pkg1 pkg2 pkg3 # Variadic args
|
|
38
|
+
mycli --exclude node_modules --exclude .git
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Configuration Layers
|
|
42
|
+
|
|
43
|
+
Priority order (highest to lowest):
|
|
44
|
+
|
|
45
|
+
1. **Command-line flags** - Explicit user intent
|
|
46
|
+
2. **Environment variables** - Runtime context
|
|
47
|
+
3. **Config files (project)** - `.myclirc`, `mycli.config.js`
|
|
48
|
+
4. **Config files (user)** - `~/.myclirc`, `~/.config/mycli/config.yml`
|
|
49
|
+
5. **Config files (system)** - `/etc/mycli/config.yml`
|
|
50
|
+
6. **Defaults** - Hard-coded sensible defaults
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
// Example config resolution
|
|
54
|
+
const config = {
|
|
55
|
+
...systemDefaults,
|
|
56
|
+
...loadSystemConfig(),
|
|
57
|
+
...loadUserConfig(),
|
|
58
|
+
...loadProjectConfig(),
|
|
59
|
+
...loadEnvVars(),
|
|
60
|
+
...parseCliFlags(),
|
|
61
|
+
};
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Exit Codes
|
|
65
|
+
|
|
66
|
+
Standard POSIX exit codes:
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
const EXIT_CODES = {
|
|
70
|
+
SUCCESS: 0,
|
|
71
|
+
GENERAL_ERROR: 1,
|
|
72
|
+
MISUSE: 2, // Invalid arguments
|
|
73
|
+
PERMISSION_DENIED: 77,
|
|
74
|
+
NOT_FOUND: 127,
|
|
75
|
+
SIGINT: 130, // Ctrl+C
|
|
76
|
+
};
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Plugin Architecture
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
mycli/
|
|
83
|
+
├── core/ # Core functionality
|
|
84
|
+
├── plugins/
|
|
85
|
+
│ ├── aws/ # Plugin: AWS integration
|
|
86
|
+
│ │ ├── package.json
|
|
87
|
+
│ │ └── index.js
|
|
88
|
+
│ └── github/ # Plugin: GitHub integration
|
|
89
|
+
│ ├── package.json
|
|
90
|
+
│ └── index.js
|
|
91
|
+
└── plugin-loader.js # Discovery & loading
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Plugin discovery:
|
|
95
|
+
1. Check `~/.mycli/plugins/`
|
|
96
|
+
2. Check `node_modules/mycli-plugin-*`
|
|
97
|
+
3. Check `MYCLI_PLUGIN_PATH` env var
|
|
98
|
+
|
|
99
|
+
## Error Handling Patterns
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
// Good: Actionable error messages
|
|
103
|
+
Error: Config file not found at /path/to/config.yml
|
|
104
|
+
|
|
105
|
+
Tried locations:
|
|
106
|
+
• ./mycli.config.yml
|
|
107
|
+
• ~/.myclirc
|
|
108
|
+
• /etc/mycli/config.yml
|
|
109
|
+
|
|
110
|
+
Run 'mycli init' to create a config file, or use --config to specify location.
|
|
111
|
+
|
|
112
|
+
// Bad: Unhelpful errors
|
|
113
|
+
Error: ENOENT
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Interactive vs Non-Interactive
|
|
117
|
+
|
|
118
|
+
```javascript
|
|
119
|
+
// Detect if running in CI/CD
|
|
120
|
+
const isCI = process.env.CI === 'true' || !process.stdout.isTTY;
|
|
121
|
+
|
|
122
|
+
if (isCI) {
|
|
123
|
+
// Non-interactive: fail fast with clear errors
|
|
124
|
+
if (!options.environment) {
|
|
125
|
+
throw new Error('--environment required in non-interactive mode');
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
// Interactive: prompt user
|
|
129
|
+
const environment = await prompt({
|
|
130
|
+
type: 'select',
|
|
131
|
+
message: 'Select environment:',
|
|
132
|
+
choices: ['development', 'staging', 'production'],
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## State Management
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
~/.mycli/
|
|
141
|
+
├── config.yml # User configuration
|
|
142
|
+
├── cache/ # Cached data
|
|
143
|
+
│ ├── plugins.json
|
|
144
|
+
│ └── api-responses/
|
|
145
|
+
├── credentials.json # Sensitive data (600 perms)
|
|
146
|
+
└── state.json # Session state
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Performance Patterns
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
// Lazy loading: Don't load unused dependencies
|
|
153
|
+
if (command === 'deploy') {
|
|
154
|
+
const deploy = require('./commands/deploy'); // Load on demand
|
|
155
|
+
await deploy.run();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Caching: Avoid repeated API calls
|
|
159
|
+
const cache = new Cache('~/.mycli/cache', { ttl: 3600 });
|
|
160
|
+
let plugins = await cache.get('plugins');
|
|
161
|
+
if (!plugins) {
|
|
162
|
+
plugins = await fetchPlugins();
|
|
163
|
+
await cache.set('plugins', plugins);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Async operations: Don't block unnecessarily
|
|
167
|
+
await Promise.all([
|
|
168
|
+
validateConfig(),
|
|
169
|
+
checkForUpdates(),
|
|
170
|
+
loadPlugins(),
|
|
171
|
+
]);
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Versioning & Updates
|
|
175
|
+
|
|
176
|
+
```javascript
|
|
177
|
+
// Check for updates (non-blocking)
|
|
178
|
+
checkForUpdates().then(update => {
|
|
179
|
+
if (update.available) {
|
|
180
|
+
console.log(`Update available: ${update.version}`);
|
|
181
|
+
console.log(`Run: npm install -g mycli@latest`);
|
|
182
|
+
}
|
|
183
|
+
}).catch(() => {
|
|
184
|
+
// Silently fail - don't interrupt user workflow
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
// Version compatibility
|
|
188
|
+
const MIN_NODE_VERSION = '18.0.0';
|
|
189
|
+
if (!semver.satisfies(process.version, `>=${MIN_NODE_VERSION}`)) {
|
|
190
|
+
console.error(`mycli requires Node.js ${MIN_NODE_VERSION} or higher`);
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Help Text Design
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
USAGE
|
|
199
|
+
mycli deploy [environment] [options]
|
|
200
|
+
|
|
201
|
+
ARGUMENTS
|
|
202
|
+
environment Target environment (development|staging|production)
|
|
203
|
+
|
|
204
|
+
OPTIONS
|
|
205
|
+
-c, --config <file> Path to config file
|
|
206
|
+
-f, --force Skip confirmation prompts
|
|
207
|
+
-d, --dry-run Preview changes without executing
|
|
208
|
+
-v, --verbose Show detailed output
|
|
209
|
+
|
|
210
|
+
EXAMPLES
|
|
211
|
+
# Deploy to production
|
|
212
|
+
mycli deploy production
|
|
213
|
+
|
|
214
|
+
# Preview staging deployment
|
|
215
|
+
mycli deploy staging --dry-run
|
|
216
|
+
|
|
217
|
+
# Use custom config
|
|
218
|
+
mycli deploy --config ./custom.yml
|
|
219
|
+
|
|
220
|
+
Learn more: https://docs.mycli.dev/deploy
|
|
221
|
+
```
|