@dtt_siye/atool 1.4.0 → 1.6.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.
Files changed (42) hide show
  1. package/README.md +97 -214
  2. package/README.md.atool-backup.20260410_114701 +299 -0
  3. package/VERSION +1 -1
  4. package/bin/atool.js +55 -9
  5. package/install.sh +14 -4
  6. package/lib/install-cursor.sh +22 -0
  7. package/lib/install-kiro.sh +26 -2
  8. package/lib/pre-scan.sh +3 -1
  9. package/lib/project-init.sh +28 -9
  10. package/package.json +1 -1
  11. package/skills/ai-project-architecture/SKILL.md +33 -534
  12. package/skills/ai-project-architecture/rules/architecture-validation.md +200 -0
  13. package/skills/ai-project-architecture/rules/compliance-check.md +83 -0
  14. package/skills/ai-project-architecture/rules/iron-laws.md +188 -0
  15. package/skills/ai-project-architecture/rules/migration.md +94 -0
  16. package/skills/ai-project-architecture/rules/refactoring.md +91 -0
  17. package/skills/ai-project-architecture/rules/testing.md +249 -0
  18. package/skills/ai-project-architecture/rules/verification.md +111 -0
  19. package/skills/atool-init/SKILL.md +24 -4
  20. package/skills/clarify-before-build/SKILL.md +33 -0
  21. package/skills/development-pipeline/SKILL.md +168 -0
  22. package/skills/project-analyze/SKILL.md +29 -8
  23. package/skills/project-analyze/phases/phase1-setup.md +61 -4
  24. package/skills/project-analyze/phases/phase2-understand.md +129 -27
  25. package/skills/project-analyze/phases/phase3-graph.md +32 -4
  26. package/skills/project-analyze/prompts/understand-agent.md +156 -298
  27. package/skills/project-analyze/rules/java.md +69 -1
  28. package/skills/project-query/SKILL.md +64 -734
  29. package/skills/project-query/rules/aggregate-stats.md +301 -0
  30. package/skills/project-query/rules/data-lineage.md +228 -0
  31. package/skills/project-query/rules/impact-analysis.md +218 -0
  32. package/skills/project-query/rules/neighborhood.md +234 -0
  33. package/skills/project-query/rules/node-lookup.md +97 -0
  34. package/skills/project-query/rules/path-query.md +135 -0
  35. package/skills/software-architecture/SKILL.md +39 -501
  36. package/skills/software-architecture/rules/concurrency-ha.md +346 -0
  37. package/skills/software-architecture/rules/ddd.md +450 -0
  38. package/skills/software-architecture/rules/decision-workflow.md +155 -0
  39. package/skills/software-architecture/rules/deployment.md +508 -0
  40. package/skills/software-architecture/rules/styles.md +232 -0
  41. package/skills/ui-ux-pro/SKILL.md +69 -0
  42. package/skills/writing-plans/SKILL.md +104 -0
package/bin/atool.js CHANGED
@@ -61,6 +61,14 @@ function findBashOnWindows() {
61
61
  function runInstallSh(args) {
62
62
  const argList = Array.isArray(args) ? args : [args];
63
63
 
64
+ // Prepare environment variables
65
+ const env = { ...process.env, ATOOL_ROOT: ROOT_DIR };
66
+
67
+ // Include ATOOL_STACK if set
68
+ if (env.ATOOL_STACK) {
69
+ env.ATOOL_STACK = env.ATOOL_STACK;
70
+ }
71
+
64
72
  if (isWindows()) {
65
73
  const bash = findBashOnWindows();
66
74
  if (!bash) {
@@ -74,14 +82,14 @@ function runInstallSh(args) {
74
82
  execFileSync(bash, [INSTALL_SH, ...argList], {
75
83
  stdio: 'inherit',
76
84
  cwd: ROOT_DIR,
77
- env: { ...process.env, ATOOL_ROOT: ROOT_DIR },
85
+ env: env,
78
86
  });
79
87
  } else {
80
88
  // macOS / Linux — delegate directly to bash
81
89
  execFileSync('bash', [INSTALL_SH, ...argList], {
82
90
  stdio: 'inherit',
83
91
  cwd: ROOT_DIR,
84
- env: { ...process.env, ATOOL_ROOT: ROOT_DIR },
92
+ env: env,
85
93
  });
86
94
  }
87
95
  }
@@ -145,6 +153,38 @@ function cmdInstall(flags) {
145
153
  runInstallSh(installArgs);
146
154
  }
147
155
 
156
+ function cmdInit(flags) {
157
+ const initArgs = ['--project'];
158
+
159
+ // Extract path argument (only if it's not the value after --stack)
160
+ let pathArg = null;
161
+ let stackValue = null;
162
+
163
+ // Find --stack and its value first
164
+ const stackIndex = flags.indexOf('--stack');
165
+ if (stackIndex !== -1 && stackIndex + 1 < flags.length && !flags[stackIndex + 1].startsWith('--')) {
166
+ stackValue = flags[stackIndex + 1];
167
+ // Remove --stack and its value from consideration for pathArg
168
+ const filteredFlags = flags.filter((flag, index) =>
169
+ index !== stackIndex && index !== stackIndex + 1
170
+ );
171
+ pathArg = filteredFlags.find(flag => !flag.startsWith('--'));
172
+ } else {
173
+ pathArg = flags.find(flag => !flag.startsWith('--'));
174
+ }
175
+
176
+ if (pathArg) {
177
+ initArgs.push(pathArg);
178
+ }
179
+
180
+ // Handle --stack flag
181
+ if (stackValue) {
182
+ process.env.ATOOL_STACK = stackValue;
183
+ }
184
+
185
+ runInstallSh(initArgs);
186
+ }
187
+
148
188
  function cmdUpdate(flags) {
149
189
  const updateArgs = ['--update'];
150
190
  if (hasFlag(flags, 'yes') || hasFlag(flags, 'y')) {
@@ -175,20 +215,22 @@ function cmdHelp() {
175
215
  console.log(`aTool - AI Developer Toolkit v${version}`);
176
216
  console.log('');
177
217
  console.log('Usage:');
178
- console.log(' atool install [--all] [--yes] [--claude] [--cursor] [--kiro]');
179
- console.log(' atool update [--yes]');
180
- console.log(' atool check-updates');
181
- console.log(' atool version');
182
- console.log(' atool help');
218
+ console.log(' atool [command] [options]');
183
219
  console.log('');
184
220
  console.log('Commands:');
185
221
  console.log(' install Install aTool to detected AI IDEs (default: --all)');
222
+ console.log(' init [PATH] Initialize a project in current or specified directory');
186
223
  console.log(' update Update aTool to the latest version');
187
224
  console.log(' check-updates Check installed version info (JSON output)');
188
225
  console.log(' version Show current version');
189
226
  console.log(' help Show this help message');
190
227
  console.log('');
191
- console.log('Options:');
228
+ console.log('Project Initialization:');
229
+ console.log(' atool init Initialize project in current directory');
230
+ console.log(' atool init ./my-app Initialize project in specified directory');
231
+ console.log(' atool init --stack react Initialize with specific tech stack');
232
+ console.log('');
233
+ console.log('Installation Options:');
192
234
  console.log(' --all Install to all detected IDEs');
193
235
  console.log(' --claude Install to Claude Code CLI only');
194
236
  console.log(' --cursor Install to Cursor only');
@@ -196,8 +238,9 @@ function cmdHelp() {
196
238
  console.log(' --yes, -y Skip confirmation prompts');
197
239
  console.log(' --dry-run Preview mode — no changes made');
198
240
  console.log(' --force Overwrite existing configs');
199
- console.log(' --project PATH Initialize a project');
241
+ console.log(' --project PATH Initialize a project (legacy alias for "atool init")');
200
242
  console.log(' --analyze PATH Prepare project for deep analysis');
243
+ console.log(' --stack STACK Specify tech stack (e.g., react, vue, java)');
201
244
  }
202
245
 
203
246
  // ── Main ─────────────────────────────────────────────────────────────────────
@@ -210,6 +253,9 @@ function main() {
210
253
  case 'i':
211
254
  cmdInstall(flags);
212
255
  break;
256
+ case 'init':
257
+ cmdInit(flags);
258
+ break;
213
259
  case 'update':
214
260
  case 'u':
215
261
  cmdUpdate(flags);
package/install.sh CHANGED
@@ -77,12 +77,22 @@ parse_args() {
77
77
  shift
78
78
  ;;
79
79
  --project)
80
- PROJECT_PATH="$2"
81
- shift 2
80
+ if [[ $# -ge 2 && ! "$2" =~ ^-- ]]; then
81
+ PROJECT_PATH="$2"
82
+ shift 2
83
+ else
84
+ PROJECT_PATH="."
85
+ shift
86
+ fi
82
87
  ;;
83
88
  --analyze)
84
- ANALYZE_PROJECT="$2"
85
- shift 2
89
+ if [[ $# -ge 2 && ! "$2" =~ ^-- ]]; then
90
+ ANALYZE_PROJECT="$2"
91
+ shift 2
92
+ else
93
+ ANALYZE_PROJECT="."
94
+ shift
95
+ fi
86
96
  ;;
87
97
  --uninstall)
88
98
  do_uninstall
@@ -140,6 +140,28 @@ skill_to_mdc() {
140
140
 
141
141
  # Append skill content, stripping YAML front matter from source
142
142
  awk '/^---$/{n++;next} n<2{next} {print}' "$skill_md" >> "$output_file"
143
+
144
+ # Append content from subdirectories (rules/, phases/, references/)
145
+ local subdirs=("rules" "phases" "references")
146
+ for subdir in "${subdirs[@]}"; do
147
+ local subdir_path="$skill_dir/$subdir"
148
+ if [[ -d "$subdir_path" ]]; then
149
+ # Sort files by name and append them
150
+ while IFS= read -r -d '' file; do
151
+ # Add a header for the file
152
+ echo "" >> "$output_file"
153
+ echo "# $(basename "$file")" >> "$output_file"
154
+ echo "" >> "$output_file"
155
+
156
+ # Append file content, only stripping YAML front matter if present
157
+ if head -n 1 "$file" | grep -q '^---$'; then
158
+ awk '/^---$/{n++;next} n<2{next} {print}' "$file" >> "$output_file"
159
+ else
160
+ cat "$file" >> "$output_file"
161
+ fi
162
+ done < <(find "$subdir_path" -name "*.md" -type f -print0 | sort -z)
163
+ fi
164
+ done
143
165
  }
144
166
 
145
167
  # Generate .mdc rules from skills into a target directory
@@ -112,7 +112,10 @@ get_superpowers_kiro_category() {
112
112
  # Args: SKILL_MD_PATH
113
113
  # Outputs: condensed content to stdout
114
114
  extract_condensed_skill() {
115
- local skill_md="$1"
115
+ local skill_dir="$1"
116
+ local skill_md="$skill_dir/SKILL.md"
117
+
118
+ # First, extract the main SKILL.md content (with YAML frontmatter stripped)
116
119
  awk '
117
120
  BEGIN { fm = 0 }
118
121
  /^---$/ { fm++; next }
@@ -129,6 +132,27 @@ extract_condensed_skill() {
129
132
  }
130
133
  { print }
131
134
  ' "$skill_md"
135
+
136
+ # Then append content from subdirectories (rules/, phases/, references/)
137
+ local subdirs=("rules" "phases" "references")
138
+ for subdir in "${subdirs[@]}"; do
139
+ local subdir_path="$skill_dir/$subdir"
140
+ if [[ -d "$subdir_path" ]]; then
141
+ # Sort files by name and append them
142
+ while IFS= read -r -d '' file; do
143
+ echo ""
144
+ echo "### $(basename "$file")"
145
+ echo ""
146
+
147
+ # Append file content, only stripping YAML frontmatter if present
148
+ if head -n 1 "$file" | grep -q '^---$'; then
149
+ awk '/^---$/{n++;next} n<2{next} {print}' "$file"
150
+ else
151
+ cat "$file"
152
+ fi
153
+ done < <(find "$subdir_path" -name "*.md" -type f -print0 | sort -z)
154
+ fi
155
+ done
132
156
  }
133
157
 
134
158
  # Extract ultra-condensed instructions for always-in-context steering
@@ -232,7 +256,7 @@ generate_consolidated_steering() {
232
256
  echo ""
233
257
  echo "## Skill: $skill_name"
234
258
  echo ""
235
- $extract_func "$skill_md"
259
+ $extract_func "$skill_dir"
236
260
  } >> "$tmpdir/${category}.txt"
237
261
  done
238
262
  done
package/lib/pre-scan.sh CHANGED
@@ -1108,7 +1108,9 @@ pre_scan_project() {
1108
1108
  total_functions,
1109
1109
  total_api_endpoints,
1110
1110
  total_data_models
1111
- })]
1111
+ })],
1112
+ aggregated_modules: null,
1113
+ aggregated_count: null
1112
1114
  }' "$output_dir"/*.json 2>/dev/null || echo '{}')
1113
1115
 
1114
1116
  # Add duration to manifest
@@ -120,7 +120,14 @@ project_init_single() {
120
120
  local atool_root="$2"
121
121
 
122
122
  local stack
123
- stack=$(detect_stack "$project_dir")
123
+ # Check if stack is specified via environment variable
124
+ if [[ -n "${ATOOL_STACK:-}" ]]; then
125
+ stack="$ATOOL_STACK"
126
+ log_info "Using specified stack: ${BOLD}$stack${NC}"
127
+ else
128
+ stack=$(detect_stack "$project_dir")
129
+ fi
130
+
124
131
  local template_name
125
132
  template_name=$(get_template_name "$stack")
126
133
  local description
@@ -130,22 +137,34 @@ project_init_single() {
130
137
 
131
138
  echo ""
132
139
  log_info "Detected stack: ${BOLD}$description${NC} (${stack})"
133
- log_info "Confidence: ${confidence}%"
140
+ if [[ -n "${ATOOL_STACK:-}" ]]; then
141
+ log_info "Stack specified via --stack flag"
142
+ fi
143
+ if [[ "$stack" != "generic" ]]; then
144
+ log_info "Confidence: ${confidence}%"
145
+ fi
134
146
  log_info "Template: ${template_name}"
135
147
  echo ""
136
148
 
137
149
  if [[ "$stack" == "generic" ]]; then
138
- log_warn "Could not detect a specific technology stack."
139
- log_warn "A generic template will be used."
140
- if ! confirm "Continue with generic template?" "Y"; then
141
- log_info "Cancelled. You can specify a stack manually."
142
- return 0
150
+ if [[ -n "${ATOOL_STACK:-}" ]]; then
151
+ log_error "Specified stack '$ATOOL_STACK' is not supported."
152
+ log_info "Available stacks: $(ls "$atool_root/templates" | grep "CLAUDE\." | sed 's/CLAUDE\.//' | sed 's/\.md$//' | tr '\n' ',' | sed 's/,$//')"
153
+ return 1
154
+ else
155
+ log_warn "Could not detect a specific technology stack."
156
+ log_warn "A generic template will be used."
157
+ if ! confirm "Continue with generic template?" "Y"; then
158
+ log_info "Cancelled. You can specify a stack manually with --stack <stack-name>"
159
+ return 0
160
+ fi
143
161
  fi
144
162
  else
145
- confirm "Use '$description' template?" "Y" || {
163
+ if ! confirm "Use '$description' template?" "Y"; then
146
164
  log_info "Cancelled."
165
+ log_info "You can specify a different stack with --stack <stack-name>"
147
166
  return 0
148
- }
167
+ fi
149
168
  fi
150
169
 
151
170
  # Generate CLAUDE.md
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dtt_siye/atool",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "AI Developer Toolkit - 一键配置 AI IDE 的工具集",
5
5
  "bin": {
6
6
  "atool": "bin/atool.js"