@haaaiawd/anws 2.2.6 → 2.4.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.
- package/README.md +1 -1
- package/bin/cli.js +52 -22
- package/lib/diff.js +5 -2
- package/lib/init.js +217 -96
- package/lib/install-state.js +18 -3
- package/lib/manifest.js +510 -213
- package/lib/prompt.js +68 -0
- package/lib/resources/index.js +36 -2
- package/lib/update.js +12 -6
- package/package.json +48 -47
- package/templates/.agents/skills/anws-system/SKILL.md +108 -108
- package/templates/.agents/skills/code-reviewer/SKILL.md +170 -103
- package/templates/.agents/skills/concept-modeler/SKILL.md +230 -179
- package/templates/.agents/skills/craft-authoring/SKILL.md +112 -49
- package/templates/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md +61 -0
- package/templates/.agents/skills/craft-authoring/references/PROMPT_QUALITY_RUBRIC.md +99 -0
- package/templates/.agents/skills/craft-authoring/references/SCORECARD_TEMPLATE.md +64 -0
- package/templates/.agents/skills/design-reviewer/SKILL.md +265 -190
- package/templates/.agents/skills/e2e-testing-guide/SKILL.md +246 -135
- package/templates/.agents/skills/nexus-mapper/SKILL.md +321 -321
- package/templates/.agents/skills/output-contract/SKILL.md +37 -0
- package/templates/.agents/skills/report-template/SKILL.md +92 -92
- package/templates/.agents/skills/sequential-thinking/SKILL.md +222 -225
- package/templates/.agents/skills/spec-writer/SKILL.md +75 -30
- package/templates/.agents/skills/system-architect/SKILL.md +538 -678
- package/templates/.agents/skills/system-designer/SKILL.md +601 -601
- package/templates/.agents/skills/task-planner/SKILL.md +1 -2
- package/templates/.agents/skills/task-reviewer/SKILL.md +428 -388
- package/templates/.agents/skills/tech-evaluator/SKILL.md +252 -144
- package/templates/.agents/workflows/blueprint.md +166 -43
- package/templates/.agents/workflows/challenge.md +331 -497
- package/templates/.agents/workflows/change.md +182 -339
- package/templates/.agents/workflows/craft.md +159 -236
- package/templates/.agents/workflows/design-system.md +202 -674
- package/templates/.agents/workflows/explore.md +187 -399
- package/templates/.agents/workflows/forge.md +650 -550
- package/templates/.agents/workflows/genesis.md +439 -351
- package/templates/.agents/workflows/probe.md +219 -241
- package/templates/.agents/workflows/quickstart.md +302 -123
- package/templates/.agents/workflows/upgrade.md +145 -182
- package/templates_en/.agents/skills/anws-system/SKILL.md +108 -0
- package/templates_en/.agents/skills/code-reviewer/SKILL.md +170 -0
- package/templates_en/.agents/skills/concept-modeler/SKILL.md +230 -0
- package/templates_en/.agents/skills/craft-authoring/SKILL.md +179 -0
- package/templates_en/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md +60 -0
- package/templates_en/.agents/skills/craft-authoring/references/PROMPT_QUALITY_RUBRIC.md +92 -0
- package/templates_en/.agents/skills/craft-authoring/references/SCORECARD_TEMPLATE.md +52 -0
- package/templates_en/.agents/skills/design-reviewer/SKILL.md +265 -0
- package/templates_en/.agents/skills/e2e-testing-guide/SKILL.md +246 -0
- package/templates_en/.agents/skills/nexus-mapper/SKILL.md +306 -0
- package/templates_en/.agents/skills/nexus-mapper/references/language-customization.md +167 -0
- package/templates_en/.agents/skills/nexus-mapper/references/output-schema.md +311 -0
- package/templates_en/.agents/skills/nexus-mapper/references/probe-protocol.md +246 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/extract_ast.py +706 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/git_detective.py +194 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/languages.json +127 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/query_graph.py +556 -0
- package/templates_en/.agents/skills/nexus-mapper/scripts/requirements.txt +6 -0
- package/templates_en/.agents/skills/nexus-query/SKILL.md +114 -0
- package/templates_en/.agents/skills/nexus-query/scripts/extract_ast.py +706 -0
- package/templates_en/.agents/skills/nexus-query/scripts/git_detective.py +194 -0
- package/templates_en/.agents/skills/nexus-query/scripts/languages.json +127 -0
- package/templates_en/.agents/skills/nexus-query/scripts/query_graph.py +556 -0
- package/templates_en/.agents/skills/nexus-query/scripts/requirements.txt +6 -0
- package/templates_en/.agents/skills/output-contract/SKILL.md +37 -0
- package/templates_en/.agents/skills/report-template/SKILL.md +85 -0
- package/templates_en/.agents/skills/report-template/references/REPORT_TEMPLATE.md +100 -0
- package/templates_en/.agents/skills/runtime-inspector/SKILL.md +101 -0
- package/templates_en/.agents/skills/sequential-thinking/SKILL.md +214 -0
- package/templates_en/.agents/skills/spec-writer/SKILL.md +153 -0
- package/templates_en/.agents/skills/spec-writer/references/prd_template.md +177 -0
- package/templates_en/.agents/skills/system-architect/SKILL.md +538 -0
- package/templates_en/.agents/skills/system-architect/references/rfc_template.md +59 -0
- package/templates_en/.agents/skills/system-designer/SKILL.md +534 -0
- package/templates_en/.agents/skills/system-designer/references/system-design-detail-template.md +187 -0
- package/templates_en/.agents/skills/system-designer/references/system-design-template.md +605 -0
- package/templates_en/.agents/skills/task-planner/SKILL.md +251 -0
- package/templates_en/.agents/skills/task-planner/references/TASK_TEMPLATE_05A.md +109 -0
- package/templates_en/.agents/skills/task-planner/references/TASK_TEMPLATE_05B.md +176 -0
- package/templates_en/.agents/skills/task-reviewer/SKILL.md +428 -0
- package/templates_en/.agents/skills/tech-evaluator/SKILL.md +252 -0
- package/templates_en/.agents/skills/tech-evaluator/references/ADR_TEMPLATE.md +78 -0
- package/templates_en/.agents/workflows/blueprint.md +200 -0
- package/templates_en/.agents/workflows/challenge.md +331 -0
- package/templates_en/.agents/workflows/change.md +182 -0
- package/templates_en/.agents/workflows/craft.md +159 -0
- package/templates_en/.agents/workflows/design-system.md +202 -0
- package/templates_en/.agents/workflows/explore.md +187 -0
- package/templates_en/.agents/workflows/forge.md +651 -0
- package/templates_en/.agents/workflows/genesis.md +439 -0
- package/templates_en/.agents/workflows/probe.md +219 -0
- package/templates_en/.agents/workflows/quickstart.md +303 -0
- package/templates_en/.agents/workflows/upgrade.md +145 -0
- package/templates_en/AGENTS.md +149 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
# Output Schema Specification
|
|
2
|
+
|
|
3
|
+
> **EMIT phase hard gate**: This file is forcibly triggered for reading by EMIT phase gate of `probe-protocol.md`,
|
|
4
|
+
> must complete reading this file before writing any `.nexus-map/` file.
|
|
5
|
+
> All schemas in this document are corrected based on actual runtime output, consistent with current script version.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## raw/ast_nodes.json (extract_ast.py output)
|
|
10
|
+
|
|
11
|
+
### Top-level structure
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"languages": ["cpp", "python"],
|
|
16
|
+
"stats": {
|
|
17
|
+
"total_files": 101,
|
|
18
|
+
"total_lines": 23184,
|
|
19
|
+
"parse_errors": 0,
|
|
20
|
+
"truncated": true,
|
|
21
|
+
"truncated_nodes": 298,
|
|
22
|
+
"supported_file_counts": {"python": 101},
|
|
23
|
+
"languages_with_structural_queries": ["python", "javascript", "typescript"],
|
|
24
|
+
"languages_with_custom_queries": ["gdscript"],
|
|
25
|
+
"module_only_file_counts": {"vue": 12},
|
|
26
|
+
"known_unsupported_file_counts": {"customdsl": 24},
|
|
27
|
+
"configured_but_unavailable_file_counts": {"templ": 6},
|
|
28
|
+
"custom_language_config_paths": ["/custom/path/to/language-config.json"]
|
|
29
|
+
},
|
|
30
|
+
"warnings": [
|
|
31
|
+
"custom language configuration loaded: /custom/path/to/language-config.json",
|
|
32
|
+
"some languages were parsed with module-only coverage because no structural query template is bundled: vue (12 files)",
|
|
33
|
+
"known unsupported languages present; downstream outputs must mark inferred sections explicitly: customdsl (24 files)",
|
|
34
|
+
"some configured languages were detected in source files but no parser could be loaded: templ (6 files)"
|
|
35
|
+
],
|
|
36
|
+
"nodes": [...],
|
|
37
|
+
"edges": [...]
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Module node
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"id": "src.nexus.application.weaving.treesitter_parser",
|
|
46
|
+
"type": "Module",
|
|
47
|
+
"label": "treesitter_parser",
|
|
48
|
+
"path": "src/nexus/application/weaving/treesitter_parser.py",
|
|
49
|
+
"lines": 320,
|
|
50
|
+
"lang": "python"
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Class node
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"id": "src.nexus.application.weaving.treesitter_parser.TreeSitterParser",
|
|
59
|
+
"type": "Class",
|
|
60
|
+
"label": "TreeSitterParser",
|
|
61
|
+
"path": "src/nexus/application/weaving/treesitter_parser.py",
|
|
62
|
+
"parent": "src.nexus.application.weaving.treesitter_parser",
|
|
63
|
+
"start_line": 15,
|
|
64
|
+
"end_line": 287
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Edge
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"source": "src.nexus.infrastructure",
|
|
73
|
+
"target": "src.nexus.infrastructure.db_client",
|
|
74
|
+
"type": "contains"
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Edge types**: `contains` (module→class, class→method) / `imports` (import statement parsing)
|
|
79
|
+
|
|
80
|
+
### warnings field
|
|
81
|
+
|
|
82
|
+
`warnings` is optional array, used to expose downgrade information that won't cause PROFILE failure but affects downstream credibility, for example:
|
|
83
|
+
|
|
84
|
+
- grammar loadable, but currently only Module-level coverage
|
|
85
|
+
- Known but unsupported languages exist
|
|
86
|
+
- AST truncated
|
|
87
|
+
- Some parsers unavailable
|
|
88
|
+
|
|
89
|
+
### Coverage layering fields
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
| Field | Meaning |
|
|
93
|
+
| ---------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
94
|
+
| `supported_file_counts` | Files successfully entering AST flow (including full structural coverage and module-only coverage) |
|
|
95
|
+
| `languages_with_structural_queries` | Languages covered by current bundled query templates |
|
|
96
|
+
| `languages_with_custom_queries` | Languages where queries added or overridden via `--add-query` or `--language-config` |
|
|
97
|
+
| `module_only_file_counts` | Languages where grammar loadable, but no structural query currently, only produce Module nodes |
|
|
98
|
+
| `known_unsupported_file_counts` | Languages known to exist but completely not entering AST flow |
|
|
99
|
+
| `configured_but_unavailable_file_counts` | Languages agent explicitly requested support for, but current environment has no available parser |
|
|
100
|
+
| `custom_language_config_paths` | Paths of explicit language config files actually loaded this time; empty in pure CLI mode |
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## raw/git_stats.json (git_detective.py output)
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"analysis_period_days": 90,
|
|
110
|
+
"stats": {
|
|
111
|
+
"total_commits": 42,
|
|
112
|
+
"total_authors": 1
|
|
113
|
+
},
|
|
114
|
+
"hotspots": [
|
|
115
|
+
{"path": "src/nexus/tasks/analysis_tasks.py", "changes": 21, "risk": "high"}
|
|
116
|
+
],
|
|
117
|
+
"coupling_pairs": [
|
|
118
|
+
{"file_a": "...", "file_b": "...", "co_changes": 5, "coupling_score": 0.71}
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Risk threshold**: `changes < 5` → `low` / `5–15` → `medium` / `> 15` → `high`
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Generated Markdown file headers
|
|
128
|
+
|
|
129
|
+
Headers of `INDEX.md`, `arch/*.md`, `concepts/domains.md`, `hotspots/git_forensics.md` must at minimum contain:
|
|
130
|
+
|
|
131
|
+
```markdown
|
|
132
|
+
> generated_by: nexus-mapper v2
|
|
133
|
+
> verified_at: 2026-03-07
|
|
134
|
+
> provenance: AST-backed except where explicitly marked inferred
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
If language downgrade or manual inference exists, `provenance` must be expanded:
|
|
138
|
+
|
|
139
|
+
```markdown
|
|
140
|
+
> provenance: AST-backed for Python; some custom DSL files were detected but not parsed by bundled AST tooling, so the affected dependency notes below are inferred from file tree and manual inspection.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## concepts/concept_model.json — Schema V1
|
|
146
|
+
|
|
147
|
+
Schema V1 human-readable name field only has `label`, do not introduce additional `title`; if `title` appears, treat as non-standard field, should delete.
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"$schema": "nexus-mapper/concept-model/v1",
|
|
152
|
+
"generated_at": "2026-03-05T15:00:00Z",
|
|
153
|
+
"repo_path": "/absolute/path/to/repo",
|
|
154
|
+
"generator": "nexus-mapper v2",
|
|
155
|
+
"nodes": [
|
|
156
|
+
{
|
|
157
|
+
"id": "nexus.ast-extractor",
|
|
158
|
+
"type": "System",
|
|
159
|
+
"label": "AST Extractor",
|
|
160
|
+
"responsibility": "Use Tree-sitter to parse Python repo, extract module/class/function nodes and import relationships, output machine-readable JSON",
|
|
161
|
+
"implementation_status": "implemented",
|
|
162
|
+
"code_path": "src/nexus/application/weaving/",
|
|
163
|
+
"evidence_path": null,
|
|
164
|
+
"evidence_gap": null,
|
|
165
|
+
"tech_stack": ["tree-sitter", "python"],
|
|
166
|
+
"related_reqs": ["REQ-101"],
|
|
167
|
+
"complexity": "medium",
|
|
168
|
+
"hotspot": true
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
"edges": [
|
|
172
|
+
{
|
|
173
|
+
"source": "nexus.ast-extractor",
|
|
174
|
+
"target": "nexus.task-dispatcher",
|
|
175
|
+
"type": "depends_on",
|
|
176
|
+
"description": "Optional description"
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
"metadata": {
|
|
180
|
+
"total_files": 101,
|
|
181
|
+
"total_lines": 23184,
|
|
182
|
+
"languages": ["python"],
|
|
183
|
+
"git_commits_analyzed": 42,
|
|
184
|
+
"analysis_days": 90
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Node field validation rules
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
| Field | Required | Triggers `[!ERROR]` situation |
|
|
193
|
+
| ----------------------- | -------------------- | ------------------------------------------------------------------------------------------- |
|
|
194
|
+
| `id` | Yes | Global duplicate; contains uppercase letters or spaces (must be kebab-case lowercase) |
|
|
195
|
+
| `type` | Yes | Not in enum `System / Domain / Module / Class / Function` |
|
|
196
|
+
| `label` | Yes | Empty string |
|
|
197
|
+
| `title` | No | Schema V1 does not define this field; if written, treat as extra field |
|
|
198
|
+
| `responsibility` | Yes | Too vague to verify; character count < 10 or > 120 |
|
|
199
|
+
| `implementation_status` | Yes | Not in enum `implemented / planned / inferred` |
|
|
200
|
+
| `code_path` | Conditional required | `implementation_status=implemented` but empty; or path does not actually exist in repo |
|
|
201
|
+
| `evidence_path` | Conditional required | `implementation_status=planned/inferred` but empty; or path does not actually exist in repo |
|
|
202
|
+
| `evidence_gap` | Conditional required | `implementation_status=planned/inferred` but empty |
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
### Node status expression specification
|
|
206
|
+
|
|
207
|
+
**Implemented node**
|
|
208
|
+
|
|
209
|
+
```json
|
|
210
|
+
{
|
|
211
|
+
"implementation_status": "implemented",
|
|
212
|
+
"code_path": "src/server/",
|
|
213
|
+
"evidence_path": null,
|
|
214
|
+
"evidence_gap": null
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**Planned node**
|
|
219
|
+
|
|
220
|
+
```json
|
|
221
|
+
{
|
|
222
|
+
"implementation_status": "planned",
|
|
223
|
+
"code_path": null,
|
|
224
|
+
"evidence_path": "docs/architecture.md",
|
|
225
|
+
"evidence_gap": "Design document mentions Monarch/Executor, but src/agents/monarch/ not found in repo"
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Inferred node**
|
|
230
|
+
|
|
231
|
+
```json
|
|
232
|
+
{
|
|
233
|
+
"implementation_status": "inferred",
|
|
234
|
+
"code_path": null,
|
|
235
|
+
"evidence_path": "docs/architecture.md",
|
|
236
|
+
"evidence_gap": "Repo contains currently unsupported DSL files; this boundary comes from file tree and manual reading"
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## query_graph.py output format reference (stdout, not written to file)
|
|
243
|
+
|
|
244
|
+
### --file
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
=== <file_path> ===
|
|
248
|
+
Module: <module_id> (<lines> lines, <lang>)
|
|
249
|
+
|
|
250
|
+
Classes:
|
|
251
|
+
<ClassName> (L<start>-L<end>)
|
|
252
|
+
├─ <method_name> (L<start>-L<end>)
|
|
253
|
+
└─ <method_name> (L<start>-L<end>)
|
|
254
|
+
|
|
255
|
+
Top-level Functions:
|
|
256
|
+
<func_name> (L<start>-L<end>)
|
|
257
|
+
|
|
258
|
+
Imports:
|
|
259
|
+
→ <internal_module> (<path>)
|
|
260
|
+
→ <external_package> (external)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### --who-imports
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
=== Who imports <module>? ===
|
|
267
|
+
Imported by N module(s):
|
|
268
|
+
← <module_id> (<path>)
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### --impact
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
=== Impact radius: <file_path> ===
|
|
275
|
+
|
|
276
|
+
Depends on (this file imports):
|
|
277
|
+
→ <module_id> (<path>)
|
|
278
|
+
|
|
279
|
+
Depended by (other files import this):
|
|
280
|
+
← <module_id> (<path>)
|
|
281
|
+
|
|
282
|
+
Impact summary: N upstream dependencies, M downstream dependents
|
|
283
|
+
|
|
284
|
+
# Following only output when --git-stats passed and that file has hotspot/coupling data
|
|
285
|
+
Git risk: high (N changes in 90 days)
|
|
286
|
+
Coupled files (co-change):
|
|
287
|
+
- <peer_path> (coupling: 0.XX, N co-changes)
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### --hub-analysis
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
=== Hub Analysis ===
|
|
294
|
+
|
|
295
|
+
Top fan-in (most imported by others):
|
|
296
|
+
1. <module_id> — imported by N module(s) [<path>]
|
|
297
|
+
|
|
298
|
+
Top fan-out (imports most others):
|
|
299
|
+
1. <module_id> — imports N internal module(s) [<path>]
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### --summary
|
|
303
|
+
|
|
304
|
+
```
|
|
305
|
+
=== Directory Summary ===
|
|
306
|
+
|
|
307
|
+
<dir>/ (N modules, N classes, N functions, N lines)
|
|
308
|
+
Key classes: ClassA, ClassB, ...
|
|
309
|
+
Key imports from: <other_dir>, ...
|
|
310
|
+
```
|
|
311
|
+
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# PROBE Protocol — Detailed Steps for Each Phase
|
|
2
|
+
|
|
3
|
+
> This file is the execution blueprint for SKILL.md. After Skill activation, **first step** is to read this file completely in one go.
|
|
4
|
+
> Before EMIT, also need to read `references/output-schema.md` (Schema too specific, placed separately to save context during activation).
|
|
5
|
+
> For non-standard language support, see `references/language-customization.md` (as needed, not gated).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## P — PROFILE Phase
|
|
10
|
+
|
|
11
|
+
**Pre-validation**
|
|
12
|
+
1. Confirm `$repo_path` directory exists
|
|
13
|
+
2. Check whether `$repo_path/.git` exists
|
|
14
|
+
- Exists: execute git hotspot analysis
|
|
15
|
+
- Does not exist: record `git analysis skipped`, continue with AST and file tree exploration
|
|
16
|
+
|
|
17
|
+
**Execution steps**
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Step 1: Run AST extractor (simultaneously generate filtered file tree)
|
|
21
|
+
python $SKILL_DIR/scripts/extract_ast.py $repo_path [--max-nodes 500] \
|
|
22
|
+
--file-tree-out .nexus-map/raw/file_tree.txt \
|
|
23
|
+
> $repo_path/.nexus-map/raw/ast_nodes.json
|
|
24
|
+
|
|
25
|
+
# If repo contains languages not covered by built-in, supplement support via command line args
|
|
26
|
+
python $SKILL_DIR/scripts/extract_ast.py $repo_path [--max-nodes 500] \
|
|
27
|
+
--add-extension .templ=templ \
|
|
28
|
+
--add-query templ struct "(component_declaration name: (identifier) @class.name) @class.def" \
|
|
29
|
+
--file-tree-out .nexus-map/raw/file_tree.txt \
|
|
30
|
+
> $repo_path/.nexus-map/raw/ast_nodes.json
|
|
31
|
+
|
|
32
|
+
# Or use explicit JSON config file (when configuration complex, see references/language-customization.md for details)
|
|
33
|
+
python $SKILL_DIR/scripts/extract_ast.py $repo_path [--max-nodes 500] \
|
|
34
|
+
--language-config /custom/path/to/language-config.json \
|
|
35
|
+
--file-tree-out .nexus-map/raw/file_tree.txt \
|
|
36
|
+
> $repo_path/.nexus-map/raw/ast_nodes.json
|
|
37
|
+
|
|
38
|
+
# Step 2: Run git hotspot analysis (only when .git exists)
|
|
39
|
+
python $SKILL_DIR/scripts/git_detective.py $repo_path --days 90 \
|
|
40
|
+
> $repo_path/.nexus-map/raw/git_stats.json
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
> `$SKILL_DIR` is this Skill's installation path (`.agent/skills/nexus-mapper` or independent repo path).
|
|
44
|
+
> `$repo_path` is absolute path to target repo.
|
|
45
|
+
> `extract_ast.py --file-tree-out` by default excludes `.git/`, `.nexus-map/`, `node_modules/`, `__pycache__/`, `.venv/`, `dist/`, `build/` and other noise directories and files.
|
|
46
|
+
|
|
47
|
+
**Completion check (any failure → stop, do not enter REASON)**
|
|
48
|
+
- [ ] `raw/ast_nodes.json` written (empty `nodes` list is also normal downgrade)
|
|
49
|
+
- [ ] `raw/file_tree.txt` not empty
|
|
50
|
+
- [ ] If git history exists: `raw/git_stats.json` not empty, contains `hotspots` field
|
|
51
|
+
- [ ] If git history does not exist: explicitly recorded this is a no-git downgrade exploration
|
|
52
|
+
- [ ] If `ast_nodes.json.stats.known_unsupported_file_counts` not empty: recorded language coverage downgrade
|
|
53
|
+
- [ ] If `ast_nodes.json.stats.module_only_file_counts` not empty: recorded which languages only have Module-level coverage
|
|
54
|
+
- [ ] If `ast_nodes.json.stats.configured_but_unavailable_file_counts` not empty: recorded this part as uncovered
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## R — REASON Phase
|
|
59
|
+
|
|
60
|
+
**Boundary scenario pre-check** (before reading project files, go through following checklist first, if any item hit, adjust execution strategy)
|
|
61
|
+
|
|
62
|
+
| Scenario | Identification method | Handling |
|
|
63
|
+
| --------------------------------- | ---------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
64
|
+
| New repo without git history | `.git` exists but only 1 commit | Skip `git_detective.py`, write `git analysis skipped: insufficient history` in output |
|
|
65
|
+
| Non-git repo | `.git` does not exist | Skip `git_detective.py`, final output mark `hotspots skipped: no git metadata` |
|
|
66
|
+
| Large Monorepo (>1000 files) | `stats.truncated=true` | Inform user to use `--max-nodes 200`; `truncated=true` is expected behavior |
|
|
67
|
+
| Git history too long (>3000 commits) | Analysis slow / git data too large | Use `--days 30` instead of default 90 days |
|
|
68
|
+
| Project without README | No README in root directory | Skip directly to `pyproject.toml` / `package.json`; hypothesis log note evidence gap |
|
|
69
|
+
| Repo with roadmap/Sprint status | README/TASKS contains time-sensitive status | Allow summary, must attach `verified_at` and source doc path; prohibited to write undated status as current fact |
|
|
70
|
+
| Truncation behavior (truncated=true) | `stats.truncated_nodes > 0` | Function nodes discarded, will not generate `raw/functions.json`; can produce complete output based on Module/Class nodes |
|
|
71
|
+
|
|
72
|
+
> [!DEVIATION]
|
|
73
|
+
> **Known implementation deviation**: Truncated Function nodes are **directly discarded**, **will not generate** `raw/functions.json`.
|
|
74
|
+
> If any document describes truncated nodes written to separate file, actual behavior takes precedence.
|
|
75
|
+
|
|
76
|
+
**Multi-language coverage layering**
|
|
77
|
+
|
|
78
|
+
| Status | Identification field | EMIT requirement |
|
|
79
|
+
| ------------------------ | ---------------------------------------------------- | -------------------------------------------------------------------- |
|
|
80
|
+
| Full structural coverage | `languages_with_structural_queries` | Normal output |
|
|
81
|
+
| Module-only coverage | `module_only_file_counts` | Must not describe as "full AST coverage"; fine-grained conclusions must be conservative |
|
|
82
|
+
| Configured but parser unavailable | `configured_but_unavailable_file_counts` | Treat as uncovered, not module-only; dependency conclusions only write `inferred` |
|
|
83
|
+
| Completely not integrated | `known_unsupported_file_counts` | `INDEX.md` mark downgrade; related regions add `inferred/manual inspection` |
|
|
84
|
+
|
|
85
|
+
**Reading strategy (priority from high to low)**
|
|
86
|
+
1. `README.md` / `README.rst` — project overall description
|
|
87
|
+
2. `pyproject.toml` / `package.json` / `pom.xml` — tech stack and dependencies
|
|
88
|
+
3. Main entry files (`main.py`, `index.ts`, `Application.java`)
|
|
89
|
+
4. `raw/file_tree.txt` — directory structure awareness
|
|
90
|
+
5. `raw/git_stats.json` hotspots Top 5 — most active files (only when git data available)
|
|
91
|
+
6. Test directory — establish static test surface, no need to run tests
|
|
92
|
+
|
|
93
|
+
**Execution requirements**
|
|
94
|
+
- Perform deep thinking, gradually deduce key decision points sufficient to support conclusions, usually 3-5
|
|
95
|
+
- Identify repo's main System-level nodes, usually 1-5; do not split pure technical details into independent systems just to pad numbers
|
|
96
|
+
- **[Recommended]** Run hub-analysis to validate core system hypothesis with fan-in/fan-out data:
|
|
97
|
+
```bash
|
|
98
|
+
python $SKILL_DIR/scripts/query_graph.py $repo_path/.nexus-map/raw/ast_nodes.json --hub-analysis
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Recording format** (working memory, not write file)
|
|
102
|
+
```
|
|
103
|
+
[REASON LOG]
|
|
104
|
+
- System A: inferred responsibility=X, implementation_status=implemented, code_path=Y (confidence: high/medium/low)
|
|
105
|
+
- System B: inferred responsibility=X, implementation_status=planned, evidence_path=Y (confidence: high/medium/low)
|
|
106
|
+
- Evidence gap: Z directory attribution lacks direct evidence (will challenge in OBJECT)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## O — OBJECT Phase
|
|
112
|
+
|
|
113
|
+
**Why challenge needed**: System hypotheses established by first intuition have three typical biases — directory name ≠ responsibility, git hotspots reveal true core, import direction reveals hierarchy errors. Three dimensions (below) systematically cover these three bias types.
|
|
114
|
+
|
|
115
|
+
**Challenge protocol** — propose minimum set of high-value challenges sufficient to challenge current hypothesis, usually 1-3, each with evidence clues
|
|
116
|
+
|
|
117
|
+
Challenge point format:
|
|
118
|
+
```
|
|
119
|
+
Q{N}: [specific contradiction or suspicious point]
|
|
120
|
+
Evidence clue: [where contradiction found — file path/line number/git data]
|
|
121
|
+
Verification plan: [how to verify in BENCHMARK phase]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Unqualified challenges (prohibited to submit):
|
|
125
|
+
```
|
|
126
|
+
Q1: My grasp of system structure is not solid enough
|
|
127
|
+
Q2: xxx directory responsibilities have no direct evidence yet
|
|
128
|
+
```
|
|
129
|
+
Problem is not wording, but lack of code citation and no executable verification plan.
|
|
130
|
+
|
|
131
|
+
Qualified example:
|
|
132
|
+
```
|
|
133
|
+
Q1: git_stats shows tasks/analysis_tasks.py changed 21 times (high risk),
|
|
134
|
+
but REASON thinks orchestration entry is evolution/detective_loop.py.
|
|
135
|
+
Contradiction: If detective_loop is entry, why is analysis_tasks hotter?
|
|
136
|
+
Evidence clue: raw/git_stats.json hotspots[0]
|
|
137
|
+
Verification plan: view tasks/analysis_tasks.py class definition + import tree
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Three-dimensional challenge framework** (corresponding to Structure / Evolution / Dependency)
|
|
141
|
+
|
|
142
|
+
| Dimension | Data source | High-value challenge pattern |
|
|
143
|
+
| ----------- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
144
|
+
| Structure | `raw/file_tree.txt`, ast edges(`contains`) | Business-named files appear in hypothesized "infrastructure layer" directory; multiple System files in same `utils/` (boundary blurry) |
|
|
145
|
+
| Evolution | `raw/git_stats.json` hotspots + coupling_pairs | Hotspot top not within hypothesized "core system"; coupling_score > 0.7 file pairs belong to different Systems (boundary wrong) |
|
|
146
|
+
| Dependency | ast edges(`imports`) | Hypothesized lower layer module imports upper layer module (circular dependency/layering error); import direction opposite to hypothesis |
|
|
147
|
+
|
|
148
|
+
**Challenge grading**
|
|
149
|
+
|
|
150
|
+
| Level | Definition | BENCHMARK priority |
|
|
151
|
+
| --------- | --------------------------------------------------------------- | :-----------------------: |
|
|
152
|
+
| Critical | Hypothesized system boundaries completely wrong, `code_path` should point to completely different location | Verify immediately, do not enter EMIT before verification |
|
|
153
|
+
| High | Core system's `code_path` may be wrong or missed important subdirectories | BENCHMARK first batch |
|
|
154
|
+
| Medium | Subdirectory responsibility division vague, may affect `responsibility` accuracy | BENCHMARK second batch |
|
|
155
|
+
|
|
156
|
+
> If evidence only supports Medium, keep Medium. At least one challenge must truly potentially change system boundary, main entry, or dependency direction.
|
|
157
|
+
|
|
158
|
+
**Three-dimensional execution checklist**
|
|
159
|
+
- [ ] Structure: Does file_tree.txt have files/directories that cannot match hypothesized systems?
|
|
160
|
+
- [ ] Structure: Do cross-system `utils/`/`common/` directories exist with ambiguous zones?
|
|
161
|
+
- [ ] Evolution: When git data available, do hotspot front ranks support "core system" judgment?
|
|
162
|
+
- [ ] Evolution: Are there strong coupling pairs across hypothesized system boundaries in coupling_pairs (score > 0.5)?
|
|
163
|
+
- [ ] Dependency: Are there import edges violating hypothesized layering direction (lower layer imports upper layer)?
|
|
164
|
+
- [ ] Dependency: Are any System's import directions opposite to hypothesized "dependent-dependee" relationship?
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## B — BENCHMARK Phase
|
|
169
|
+
|
|
170
|
+
**Execute verification for each challenge point**
|
|
171
|
+
1. Use `grep_search` / `view_file` to find specific evidence
|
|
172
|
+
2. **[Recommended]** Use `query_graph.py --impact` to view target file's real upstream/downstream dependencies:
|
|
173
|
+
```bash
|
|
174
|
+
python $SKILL_DIR/scripts/query_graph.py $repo_path/.nexus-map/raw/ast_nodes.json \
|
|
175
|
+
--impact <target file> --git-stats $repo_path/.nexus-map/raw/git_stats.json
|
|
176
|
+
```
|
|
177
|
+
3. Judge result:
|
|
178
|
+
- Challenge valid → correct node's `code_path` or `responsibility`, mark "corrected" in LOG
|
|
179
|
+
- Challenge invalid → confirm original hypothesis, mark "verified"
|
|
180
|
+
|
|
181
|
+
**Global node validation (execute for all System nodes one by one)**
|
|
182
|
+
- [ ] `implemented` node's `code_path` actually exists in repo
|
|
183
|
+
- [ ] `planned/inferred` nodes do not fake `code_path`, use `evidence_path + evidence_gap` instead
|
|
184
|
+
- [ ] Each `planned/inferred` node's `evidence_path` actually exists in repo
|
|
185
|
+
- [ ] `responsibility` expression clear, specific; if evidence insufficient, explicitly record evidence gap
|
|
186
|
+
- [ ] Node `id` globally unique, kebab-case, all lowercase
|
|
187
|
+
|
|
188
|
+
> If key system completely identified incorrectly → allowed to return to REASON to rebuild model, and re-execute OBJECT.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## E — EMIT Phase
|
|
193
|
+
|
|
194
|
+
> [!IMPORTANT]
|
|
195
|
+
> **Phase gate**: Before writing any file, must first read:
|
|
196
|
+
> `references/output-schema.md`
|
|
197
|
+
> Writing without reading that file → produced JSON/Markdown structure cannot pass Schema validation, considered invalid.
|
|
198
|
+
|
|
199
|
+
**Idempotency check (must do before writing)**
|
|
200
|
+
|
|
201
|
+
| Check result | Handling |
|
|
202
|
+
| ---------------------------------------- | ----------------------------------------------------- |
|
|
203
|
+
| `.nexus-map/` does not exist | Continue directly |
|
|
204
|
+
| `.nexus-map/` exists and `INDEX.md` valid | Ask user: "Detected existing analysis results, overwrite? [y/n]" |
|
|
205
|
+
| `.nexus-map/` exists but files incomplete | "Detected incomplete analysis, will regenerate", continue |
|
|
206
|
+
|
|
207
|
+
**[Recommended] Get structure summary before writing**
|
|
208
|
+
```bash
|
|
209
|
+
python $SKILL_DIR/scripts/query_graph.py $repo_path/.nexus-map/raw/ast_nodes.json --summary
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Writing order (first write `.tmp/`, after all successful move all together)**
|
|
213
|
+
```
|
|
214
|
+
1. .nexus-map/.tmp/concepts/concept_model.json ← Schema V1
|
|
215
|
+
2. .nexus-map/.tmp/INDEX.md ← L0 summary, < 2000 tokens
|
|
216
|
+
3. .nexus-map/.tmp/arch/systems.md ← each System boundary
|
|
217
|
+
4. .nexus-map/.tmp/arch/dependencies.md ← Mermaid dependency graph
|
|
218
|
+
5. .nexus-map/.tmp/arch/test_coverage.md ← static test surface and evidence gaps
|
|
219
|
+
6. .nexus-map/.tmp/concepts/domains.md ← Domain concept explanation
|
|
220
|
+
7. .nexus-map/.tmp/hotspots/git_forensics.md ← Git hotspot summary
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
All write successful → move `.tmp/` contents to `.nexus-map/` → delete `.tmp/`
|
|
224
|
+
|
|
225
|
+
**INDEX.md writing requirements**
|
|
226
|
+
- token count < 2000, rewrite if exceeded
|
|
227
|
+
- Conclusions specific, do not use vague words to dodge; when evidence insufficient, explicitly write `evidence gap` or `unknown`
|
|
228
|
+
- **Must include "Operation Guide" hard routing block defined in SKILL.md Rule 4**
|
|
229
|
+
|
|
230
|
+
**Each Markdown file header must at minimum contain**
|
|
231
|
+
```markdown
|
|
232
|
+
> generated_by: nexus-mapper v2
|
|
233
|
+
> verified_at: 2026-03-07
|
|
234
|
+
> provenance: AST-backed except where explicitly marked inferred
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**Edge merging protocol (execute before writing concept_model.json)**
|
|
238
|
+
1. Import edges from `raw/ast_nodes.json` (`imports`/`contains`, machine layer precise)
|
|
239
|
+
2. Append semantic edges inferred in BENCHMARK phase (`depends_on`/`calls`)
|
|
240
|
+
3. Deduplicate: keep one edge for same `(source, target, type)` triplet
|
|
241
|
+
|
|
242
|
+
**Completion validation**
|
|
243
|
+
- [ ] `INDEX.md` exists, conclusions specific and honest about evidence gaps, < 2000 tokens, contains hard routing block
|
|
244
|
+
- [ ] `implemented` nodes in `concept_model.json` all have verified `code_path`
|
|
245
|
+
- [ ] `arch/dependencies.md` contains >= 1 Mermaid graph
|
|
246
|
+
- [ ] `arch/test_coverage.md` explains static test surface, and explicitly states evidence gap of not running tests
|