@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.
Files changed (94) hide show
  1. package/README.md +1 -1
  2. package/bin/cli.js +52 -22
  3. package/lib/diff.js +5 -2
  4. package/lib/init.js +217 -96
  5. package/lib/install-state.js +18 -3
  6. package/lib/manifest.js +510 -213
  7. package/lib/prompt.js +68 -0
  8. package/lib/resources/index.js +36 -2
  9. package/lib/update.js +12 -6
  10. package/package.json +48 -47
  11. package/templates/.agents/skills/anws-system/SKILL.md +108 -108
  12. package/templates/.agents/skills/code-reviewer/SKILL.md +170 -103
  13. package/templates/.agents/skills/concept-modeler/SKILL.md +230 -179
  14. package/templates/.agents/skills/craft-authoring/SKILL.md +112 -49
  15. package/templates/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md +61 -0
  16. package/templates/.agents/skills/craft-authoring/references/PROMPT_QUALITY_RUBRIC.md +99 -0
  17. package/templates/.agents/skills/craft-authoring/references/SCORECARD_TEMPLATE.md +64 -0
  18. package/templates/.agents/skills/design-reviewer/SKILL.md +265 -190
  19. package/templates/.agents/skills/e2e-testing-guide/SKILL.md +246 -135
  20. package/templates/.agents/skills/nexus-mapper/SKILL.md +321 -321
  21. package/templates/.agents/skills/output-contract/SKILL.md +37 -0
  22. package/templates/.agents/skills/report-template/SKILL.md +92 -92
  23. package/templates/.agents/skills/sequential-thinking/SKILL.md +222 -225
  24. package/templates/.agents/skills/spec-writer/SKILL.md +75 -30
  25. package/templates/.agents/skills/system-architect/SKILL.md +538 -678
  26. package/templates/.agents/skills/system-designer/SKILL.md +601 -601
  27. package/templates/.agents/skills/task-planner/SKILL.md +1 -2
  28. package/templates/.agents/skills/task-reviewer/SKILL.md +428 -388
  29. package/templates/.agents/skills/tech-evaluator/SKILL.md +252 -144
  30. package/templates/.agents/workflows/blueprint.md +166 -43
  31. package/templates/.agents/workflows/challenge.md +331 -497
  32. package/templates/.agents/workflows/change.md +182 -339
  33. package/templates/.agents/workflows/craft.md +159 -236
  34. package/templates/.agents/workflows/design-system.md +202 -674
  35. package/templates/.agents/workflows/explore.md +187 -399
  36. package/templates/.agents/workflows/forge.md +650 -550
  37. package/templates/.agents/workflows/genesis.md +439 -351
  38. package/templates/.agents/workflows/probe.md +219 -241
  39. package/templates/.agents/workflows/quickstart.md +302 -123
  40. package/templates/.agents/workflows/upgrade.md +145 -182
  41. package/templates_en/.agents/skills/anws-system/SKILL.md +108 -0
  42. package/templates_en/.agents/skills/code-reviewer/SKILL.md +170 -0
  43. package/templates_en/.agents/skills/concept-modeler/SKILL.md +230 -0
  44. package/templates_en/.agents/skills/craft-authoring/SKILL.md +179 -0
  45. package/templates_en/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md +60 -0
  46. package/templates_en/.agents/skills/craft-authoring/references/PROMPT_QUALITY_RUBRIC.md +92 -0
  47. package/templates_en/.agents/skills/craft-authoring/references/SCORECARD_TEMPLATE.md +52 -0
  48. package/templates_en/.agents/skills/design-reviewer/SKILL.md +265 -0
  49. package/templates_en/.agents/skills/e2e-testing-guide/SKILL.md +246 -0
  50. package/templates_en/.agents/skills/nexus-mapper/SKILL.md +306 -0
  51. package/templates_en/.agents/skills/nexus-mapper/references/language-customization.md +167 -0
  52. package/templates_en/.agents/skills/nexus-mapper/references/output-schema.md +311 -0
  53. package/templates_en/.agents/skills/nexus-mapper/references/probe-protocol.md +246 -0
  54. package/templates_en/.agents/skills/nexus-mapper/scripts/extract_ast.py +706 -0
  55. package/templates_en/.agents/skills/nexus-mapper/scripts/git_detective.py +194 -0
  56. package/templates_en/.agents/skills/nexus-mapper/scripts/languages.json +127 -0
  57. package/templates_en/.agents/skills/nexus-mapper/scripts/query_graph.py +556 -0
  58. package/templates_en/.agents/skills/nexus-mapper/scripts/requirements.txt +6 -0
  59. package/templates_en/.agents/skills/nexus-query/SKILL.md +114 -0
  60. package/templates_en/.agents/skills/nexus-query/scripts/extract_ast.py +706 -0
  61. package/templates_en/.agents/skills/nexus-query/scripts/git_detective.py +194 -0
  62. package/templates_en/.agents/skills/nexus-query/scripts/languages.json +127 -0
  63. package/templates_en/.agents/skills/nexus-query/scripts/query_graph.py +556 -0
  64. package/templates_en/.agents/skills/nexus-query/scripts/requirements.txt +6 -0
  65. package/templates_en/.agents/skills/output-contract/SKILL.md +37 -0
  66. package/templates_en/.agents/skills/report-template/SKILL.md +85 -0
  67. package/templates_en/.agents/skills/report-template/references/REPORT_TEMPLATE.md +100 -0
  68. package/templates_en/.agents/skills/runtime-inspector/SKILL.md +101 -0
  69. package/templates_en/.agents/skills/sequential-thinking/SKILL.md +214 -0
  70. package/templates_en/.agents/skills/spec-writer/SKILL.md +153 -0
  71. package/templates_en/.agents/skills/spec-writer/references/prd_template.md +177 -0
  72. package/templates_en/.agents/skills/system-architect/SKILL.md +538 -0
  73. package/templates_en/.agents/skills/system-architect/references/rfc_template.md +59 -0
  74. package/templates_en/.agents/skills/system-designer/SKILL.md +534 -0
  75. package/templates_en/.agents/skills/system-designer/references/system-design-detail-template.md +187 -0
  76. package/templates_en/.agents/skills/system-designer/references/system-design-template.md +605 -0
  77. package/templates_en/.agents/skills/task-planner/SKILL.md +251 -0
  78. package/templates_en/.agents/skills/task-planner/references/TASK_TEMPLATE_05A.md +109 -0
  79. package/templates_en/.agents/skills/task-planner/references/TASK_TEMPLATE_05B.md +176 -0
  80. package/templates_en/.agents/skills/task-reviewer/SKILL.md +428 -0
  81. package/templates_en/.agents/skills/tech-evaluator/SKILL.md +252 -0
  82. package/templates_en/.agents/skills/tech-evaluator/references/ADR_TEMPLATE.md +78 -0
  83. package/templates_en/.agents/workflows/blueprint.md +200 -0
  84. package/templates_en/.agents/workflows/challenge.md +331 -0
  85. package/templates_en/.agents/workflows/change.md +182 -0
  86. package/templates_en/.agents/workflows/craft.md +159 -0
  87. package/templates_en/.agents/workflows/design-system.md +202 -0
  88. package/templates_en/.agents/workflows/explore.md +187 -0
  89. package/templates_en/.agents/workflows/forge.md +651 -0
  90. package/templates_en/.agents/workflows/genesis.md +439 -0
  91. package/templates_en/.agents/workflows/probe.md +219 -0
  92. package/templates_en/.agents/workflows/quickstart.md +303 -0
  93. package/templates_en/.agents/workflows/upgrade.md +145 -0
  94. package/templates_en/AGENTS.md +149 -0
package/lib/manifest.js CHANGED
@@ -1,213 +1,510 @@
1
- 'use strict';
2
-
3
- const { getTarget } = require('./adapters');
4
-
5
- /**
6
- * MANAGED_FILES — anws 托管文件清单
7
- *
8
- * 此数组列出 anws 包负责管理的所有文件路径(相对于目标项目根目录)。
9
- */
10
- const RESOURCE_REGISTRY = [
11
- { id: 'blueprint', type: 'workflow', source: '.agents/workflows/blueprint.md', fileName: 'blueprint.md' },
12
- { id: 'challenge', type: 'workflow', source: '.agents/workflows/challenge.md', fileName: 'challenge.md' },
13
- { id: 'change', type: 'workflow', source: '.agents/workflows/change.md', fileName: 'change.md' },
14
- { id: 'craft', type: 'workflow', source: '.agents/workflows/craft.md', fileName: 'craft.md' },
15
- { id: 'design-system', type: 'workflow', source: '.agents/workflows/design-system.md', fileName: 'design-system.md' },
16
- { id: 'explore', type: 'workflow', source: '.agents/workflows/explore.md', fileName: 'explore.md' },
17
- { id: 'forge', type: 'workflow', source: '.agents/workflows/forge.md', fileName: 'forge.md' },
18
- { id: 'genesis', type: 'workflow', source: '.agents/workflows/genesis.md', fileName: 'genesis.md' },
19
- { id: 'probe', type: 'workflow', source: '.agents/workflows/probe.md', fileName: 'probe.md' },
20
- { id: 'quickstart', type: 'workflow', source: '.agents/workflows/quickstart.md', fileName: 'quickstart.md' },
21
- { id: 'upgrade', type: 'workflow', source: '.agents/workflows/upgrade.md', fileName: 'upgrade.md' },
22
- { id: 'anws-system', type: 'skill', source: '.agents/skills/anws-system/SKILL.md', fileName: 'anws-system/SKILL.md', targets: ['codex', 'trae'] },
23
- { id: 'concept-modeler', type: 'skill', source: '.agents/skills/concept-modeler/SKILL.md', fileName: 'concept-modeler/SKILL.md' },
24
- { id: 'code-reviewer', type: 'skill', source: '.agents/skills/code-reviewer/SKILL.md', fileName: 'code-reviewer/SKILL.md' },
25
- { id: 'design-reviewer', type: 'skill', source: '.agents/skills/design-reviewer/SKILL.md', fileName: 'design-reviewer/SKILL.md' },
26
- { id: 'nexus-mapper', type: 'skill', source: '.agents/skills/nexus-mapper/SKILL.md', fileName: 'nexus-mapper/SKILL.md' },
27
- { id: 'nexus-mapper-language-customization', type: 'skill', source: '.agents/skills/nexus-mapper/references/language-customization.md', fileName: 'nexus-mapper/references/language-customization.md' },
28
- { id: 'nexus-mapper-output-schema', type: 'skill', source: '.agents/skills/nexus-mapper/references/output-schema.md', fileName: 'nexus-mapper/references/output-schema.md' },
29
- { id: 'nexus-mapper-probe-protocol', type: 'skill', source: '.agents/skills/nexus-mapper/references/probe-protocol.md', fileName: 'nexus-mapper/references/probe-protocol.md' },
30
- { id: 'nexus-mapper-extract-ast', type: 'skill', source: '.agents/skills/nexus-mapper/scripts/extract_ast.py', fileName: 'nexus-mapper/scripts/extract_ast.py' },
31
- { id: 'nexus-mapper-git-detective', type: 'skill', source: '.agents/skills/nexus-mapper/scripts/git_detective.py', fileName: 'nexus-mapper/scripts/git_detective.py' },
32
- { id: 'nexus-mapper-languages', type: 'skill', source: '.agents/skills/nexus-mapper/scripts/languages.json', fileName: 'nexus-mapper/scripts/languages.json' },
33
- { id: 'nexus-mapper-query-graph', type: 'skill', source: '.agents/skills/nexus-mapper/scripts/query_graph.py', fileName: 'nexus-mapper/scripts/query_graph.py' },
34
- { id: 'nexus-mapper-requirements', type: 'skill', source: '.agents/skills/nexus-mapper/scripts/requirements.txt', fileName: 'nexus-mapper/scripts/requirements.txt' },
35
- { id: 'report-template', type: 'skill', source: '.agents/skills/report-template/SKILL.md', fileName: 'report-template/SKILL.md' },
36
- { id: 'report-template-reference', type: 'skill', source: '.agents/skills/report-template/references/REPORT_TEMPLATE.md', fileName: 'report-template/references/REPORT_TEMPLATE.md' },
37
- { id: 'runtime-inspector', type: 'skill', source: '.agents/skills/runtime-inspector/SKILL.md', fileName: 'runtime-inspector/SKILL.md' },
38
- { id: 'sequential-thinking', type: 'skill', source: '.agents/skills/sequential-thinking/SKILL.md', fileName: 'sequential-thinking/SKILL.md' },
39
- { id: 'spec-writer', type: 'skill', source: '.agents/skills/spec-writer/SKILL.md', fileName: 'spec-writer/SKILL.md' },
40
- { id: 'spec-writer-prd-template', type: 'skill', source: '.agents/skills/spec-writer/references/prd_template.md', fileName: 'spec-writer/references/prd_template.md' },
41
- { id: 'system-architect', type: 'skill', source: '.agents/skills/system-architect/SKILL.md', fileName: 'system-architect/SKILL.md' },
42
- { id: 'system-architect-rfc-template', type: 'skill', source: '.agents/skills/system-architect/references/rfc_template.md', fileName: 'system-architect/references/rfc_template.md' },
43
- { id: 'system-designer', type: 'skill', source: '.agents/skills/system-designer/SKILL.md', fileName: 'system-designer/SKILL.md' },
44
- { id: 'system-designer-detail-template', type: 'skill', source: '.agents/skills/system-designer/references/system-design-detail-template.md', fileName: 'system-designer/references/system-design-detail-template.md' },
45
- { id: 'system-designer-template', type: 'skill', source: '.agents/skills/system-designer/references/system-design-template.md', fileName: 'system-designer/references/system-design-template.md' },
46
- { id: 'task-planner', type: 'skill', source: '.agents/skills/task-planner/SKILL.md', fileName: 'task-planner/SKILL.md' },
47
- { id: 'task-planner-template-05a', type: 'skill', source: '.agents/skills/task-planner/references/TASK_TEMPLATE_05A.md', fileName: 'task-planner/references/TASK_TEMPLATE_05A.md' },
48
- { id: 'task-planner-template-05b', type: 'skill', source: '.agents/skills/task-planner/references/TASK_TEMPLATE_05B.md', fileName: 'task-planner/references/TASK_TEMPLATE_05B.md' },
49
- { id: 'task-reviewer', type: 'skill', source: '.agents/skills/task-reviewer/SKILL.md', fileName: 'task-reviewer/SKILL.md' },
50
- { id: 'tech-evaluator', type: 'skill', source: '.agents/skills/tech-evaluator/SKILL.md', fileName: 'tech-evaluator/SKILL.md' },
51
- { id: 'tech-evaluator-adr-template', type: 'skill', source: '.agents/skills/tech-evaluator/references/ADR_TEMPLATE.md', fileName: 'tech-evaluator/references/ADR_TEMPLATE.md' },
52
- { id: 'e2e-testing-guide', type: 'skill', source: '.agents/skills/e2e-testing-guide/SKILL.md', fileName: 'e2e-testing-guide/SKILL.md' },
53
- { id: 'craft-authoring', type: 'skill', source: '.agents/skills/craft-authoring/SKILL.md', fileName: 'craft-authoring/SKILL.md' }
54
- ];
55
-
56
- function toArray(value) {
57
- return Array.isArray(value) ? value : [value];
58
- }
59
-
60
- function toProjectionFileName(resource, projectionType, targetId) {
61
- if ((targetId === 'codex' || targetId === 'trae') && projectionType === 'skills' && resource.type === 'workflow') {
62
- return `anws-system/references/${resource.id}.md`;
63
- }
64
- if (projectionType === 'commands') {
65
- return `${resource.id}.md`;
66
- }
67
- if (projectionType === 'prompts') {
68
- return targetId === 'copilot' ? `${resource.id}.prompt.md` : `${resource.id}.md`;
69
- }
70
- if (projectionType === 'agents') {
71
- return `${resource.id}.md`;
72
- }
73
- return resource.fileName;
74
- }
75
-
76
- function buildProjectionEntries(targetId) {
77
- const target = getTarget(targetId);
78
- const typeMap = target.projectionTypes;
79
-
80
- return RESOURCE_REGISTRY.flatMap((resource) => {
81
- if (resource.targets && !resource.targets.includes(target.id)) {
82
- return [];
83
- }
84
- const projectionTypes = typeMap[resource.type];
85
- if (!projectionTypes) {
86
- return [];
87
- }
88
-
89
- return toArray(projectionTypes).map((projectionType) => {
90
- const outputFileName = toProjectionFileName(resource, projectionType, target.id);
91
- return {
92
- ...resource,
93
- projectionType,
94
- outputRoot: target.projections[projectionType],
95
- outputPath: `${target.projections[projectionType]}/${outputFileName}`
96
- };
97
- });
98
- });
99
- }
100
-
101
- function buildManagedManifest(targetIds = ['antigravity']) {
102
- return toArray(targetIds).flatMap((targetId) => {
103
- const target = getTarget(targetId);
104
- const entries = buildProjectionEntries(target.id).map((entry) => ({
105
- ...entry,
106
- targetId: target.id,
107
- targetLabel: target.label,
108
- ownershipKey: `${target.id}:${entry.outputPath}`
109
- }));
110
-
111
- if (!target.rootAgentFile) {
112
- return entries;
113
- }
114
-
115
- return [
116
- {
117
- id: 'root-agents',
118
- type: 'root',
119
- source: 'AGENTS.md',
120
- fileName: 'AGENTS.md',
121
- projectionType: 'rootAgentFile',
122
- outputRoot: '.',
123
- outputPath: 'AGENTS.md',
124
- targetId: target.id,
125
- targetLabel: target.label,
126
- ownershipKey: `${target.id}:AGENTS.md`
127
- },
128
- ...entries
129
- ];
130
- });
131
- }
132
-
133
- function buildProjectionPlan(targetIds = ['antigravity'], resources = RESOURCE_REGISTRY) {
134
- return toArray(targetIds).map((targetId) => {
135
- const target = getTarget(targetId);
136
- const typeMap = target.projectionTypes;
137
- const projectionEntries = resources.flatMap((resource) => {
138
- if (resource.targets && !resource.targets.includes(target.id)) {
139
- return [];
140
- }
141
- const projectionTypes = typeMap[resource.type];
142
- if (!projectionTypes) {
143
- return [];
144
- }
145
-
146
- return toArray(projectionTypes).map((projectionType) => {
147
- const outputFileName = toProjectionFileName(resource, projectionType, target.id);
148
- const outputPath = `${target.projections[projectionType]}/${outputFileName}`;
149
- return {
150
- ...resource,
151
- projectionType,
152
- outputRoot: target.projections[projectionType],
153
- outputPath,
154
- targetId: target.id,
155
- targetLabel: target.label,
156
- ownershipKey: `${target.id}:${outputPath}`
157
- };
158
- });
159
- });
160
-
161
- const managedFiles = target.rootAgentFile
162
- ? ['AGENTS.md', ...projectionEntries.map((item) => item.outputPath)]
163
- : projectionEntries.map((item) => item.outputPath);
164
-
165
- return {
166
- target,
167
- targetId: target.id,
168
- targetLabel: target.label,
169
- managedFiles,
170
- userProtectedFiles: buildUserProtectedFiles(target.id),
171
- projectionEntries,
172
- ownership: projectionEntries.map((item) => item.ownershipKey)
173
- };
174
- });
175
- }
176
-
177
- function buildManagedFiles(targetId = 'antigravity') {
178
- return buildManagedManifest(targetId).map((item) => item.outputPath);
179
- }
180
-
181
- function buildUserProtectedFiles(targetId = 'antigravity') {
182
- const target = getTarget(targetId);
183
- return target.rootAgentFile ? ['AGENTS.md'] : [];
184
- }
185
-
186
- function findByType(type) {
187
- return RESOURCE_REGISTRY.filter((item) => item.type === type);
188
- }
189
-
190
- const MANAGED_FILES = buildManagedFiles('antigravity');
191
-
192
- /**
193
- * USER_PROTECTED_FILES — 用户保护文件
194
- *
195
- * 这些文件在项目初始化后通常会包含特定于项目的配置。
196
- * anws update 默认会跳过这些文件。
197
- */
198
- const USER_PROTECTED_FILES = buildUserProtectedFiles('antigravity');
199
-
200
- module.exports = {
201
- RESOURCE_REGISTRY,
202
- buildManagedManifest,
203
- buildProjectionPlan,
204
- buildManagedFiles,
205
- buildProjectionEntries,
206
- buildUserProtectedFiles,
207
- findByType,
208
- MANAGED_FILES,
209
- USER_PROTECTED_FILES
210
- };
211
-
212
-
213
-
1
+ "use strict";
2
+
3
+ const { getTarget } = require("./adapters");
4
+
5
+ /**
6
+ * RESOURCE_REGISTRYCLI `anws init` / `anws update` 的唯一「复制来源清单」
7
+ *
8
+ * - 每条 `source` 相对于 canonical **`templates/`**(见 `lib/resources` 的 `TEMPLATE_ROOT`)。
9
+ * - 默认 `resolveCanonicalSource` / `resolveCanonicalPath(..., 'zh')` 只读该根目录;**不会**自动包含 `templates_alpha*`。英文包见 `resolveCanonicalPath(..., 'en')` + `templates_en/`(由 `anws init --locale` / install-lock `templateLocale` 驱动)。
10
+ * - **`templates/` 磁盘上可能存在未在此登记的路径**(遗留或备用);未登记则 **不会** 投影到用户项目。
11
+ * - **Alpha overlay**(`templates_alpha/`、`templates_alpha_en/`)整树 **默认不在登记范围内**;语义与合并决策见
12
+ * **`templates/.agents/skills/craft-authoring/references/BUNDLE_POLICY.md`**(及 EN 镜像)。
13
+ */
14
+ const RESOURCE_REGISTRY = [
15
+ {
16
+ id: "blueprint",
17
+ type: "workflow",
18
+ source: ".agents/workflows/blueprint.md",
19
+ fileName: "blueprint.md",
20
+ },
21
+ {
22
+ id: "challenge",
23
+ type: "workflow",
24
+ source: ".agents/workflows/challenge.md",
25
+ fileName: "challenge.md",
26
+ },
27
+ {
28
+ id: "change",
29
+ type: "workflow",
30
+ source: ".agents/workflows/change.md",
31
+ fileName: "change.md",
32
+ },
33
+ {
34
+ id: "craft",
35
+ type: "workflow",
36
+ source: ".agents/workflows/craft.md",
37
+ fileName: "craft.md",
38
+ },
39
+ {
40
+ id: "design-system",
41
+ type: "workflow",
42
+ source: ".agents/workflows/design-system.md",
43
+ fileName: "design-system.md",
44
+ },
45
+ {
46
+ id: "explore",
47
+ type: "workflow",
48
+ source: ".agents/workflows/explore.md",
49
+ fileName: "explore.md",
50
+ },
51
+ {
52
+ id: "forge",
53
+ type: "workflow",
54
+ source: ".agents/workflows/forge.md",
55
+ fileName: "forge.md",
56
+ },
57
+ {
58
+ id: "genesis",
59
+ type: "workflow",
60
+ source: ".agents/workflows/genesis.md",
61
+ fileName: "genesis.md",
62
+ },
63
+ {
64
+ id: "probe",
65
+ type: "workflow",
66
+ source: ".agents/workflows/probe.md",
67
+ fileName: "probe.md",
68
+ },
69
+ {
70
+ id: "quickstart",
71
+ type: "workflow",
72
+ source: ".agents/workflows/quickstart.md",
73
+ fileName: "quickstart.md",
74
+ },
75
+ {
76
+ id: "upgrade",
77
+ type: "workflow",
78
+ source: ".agents/workflows/upgrade.md",
79
+ fileName: "upgrade.md",
80
+ },
81
+ {
82
+ id: "anws-system",
83
+ type: "skill",
84
+ source: ".agents/skills/anws-system/SKILL.md",
85
+ fileName: "anws-system/SKILL.md",
86
+ targets: ["codex", "trae"],
87
+ },
88
+ {
89
+ id: "concept-modeler",
90
+ type: "skill",
91
+ source: ".agents/skills/concept-modeler/SKILL.md",
92
+ fileName: "concept-modeler/SKILL.md",
93
+ },
94
+ {
95
+ id: "code-reviewer",
96
+ type: "skill",
97
+ source: ".agents/skills/code-reviewer/SKILL.md",
98
+ fileName: "code-reviewer/SKILL.md",
99
+ },
100
+ {
101
+ id: "design-reviewer",
102
+ type: "skill",
103
+ source: ".agents/skills/design-reviewer/SKILL.md",
104
+ fileName: "design-reviewer/SKILL.md",
105
+ },
106
+ {
107
+ id: "nexus-mapper",
108
+ type: "skill",
109
+ source: ".agents/skills/nexus-mapper/SKILL.md",
110
+ fileName: "nexus-mapper/SKILL.md",
111
+ },
112
+ {
113
+ id: "nexus-mapper-language-customization",
114
+ type: "skill",
115
+ source: ".agents/skills/nexus-mapper/references/language-customization.md",
116
+ fileName: "nexus-mapper/references/language-customization.md",
117
+ },
118
+ {
119
+ id: "nexus-mapper-output-schema",
120
+ type: "skill",
121
+ source: ".agents/skills/nexus-mapper/references/output-schema.md",
122
+ fileName: "nexus-mapper/references/output-schema.md",
123
+ },
124
+ {
125
+ id: "nexus-mapper-probe-protocol",
126
+ type: "skill",
127
+ source: ".agents/skills/nexus-mapper/references/probe-protocol.md",
128
+ fileName: "nexus-mapper/references/probe-protocol.md",
129
+ },
130
+ {
131
+ id: "nexus-mapper-extract-ast",
132
+ type: "skill",
133
+ source: ".agents/skills/nexus-mapper/scripts/extract_ast.py",
134
+ fileName: "nexus-mapper/scripts/extract_ast.py",
135
+ },
136
+ {
137
+ id: "nexus-mapper-git-detective",
138
+ type: "skill",
139
+ source: ".agents/skills/nexus-mapper/scripts/git_detective.py",
140
+ fileName: "nexus-mapper/scripts/git_detective.py",
141
+ },
142
+ {
143
+ id: "nexus-mapper-languages",
144
+ type: "skill",
145
+ source: ".agents/skills/nexus-mapper/scripts/languages.json",
146
+ fileName: "nexus-mapper/scripts/languages.json",
147
+ },
148
+ {
149
+ id: "nexus-mapper-query-graph",
150
+ type: "skill",
151
+ source: ".agents/skills/nexus-mapper/scripts/query_graph.py",
152
+ fileName: "nexus-mapper/scripts/query_graph.py",
153
+ },
154
+ {
155
+ id: "nexus-mapper-requirements",
156
+ type: "skill",
157
+ source: ".agents/skills/nexus-mapper/scripts/requirements.txt",
158
+ fileName: "nexus-mapper/scripts/requirements.txt",
159
+ },
160
+ {
161
+ id: "output-contract",
162
+ type: "skill",
163
+ source: ".agents/skills/output-contract/SKILL.md",
164
+ fileName: "output-contract/SKILL.md",
165
+ },
166
+ {
167
+ id: "report-template",
168
+ type: "skill",
169
+ source: ".agents/skills/report-template/SKILL.md",
170
+ fileName: "report-template/SKILL.md",
171
+ },
172
+ {
173
+ id: "report-template-reference",
174
+ type: "skill",
175
+ source: ".agents/skills/report-template/references/REPORT_TEMPLATE.md",
176
+ fileName: "report-template/references/REPORT_TEMPLATE.md",
177
+ },
178
+ {
179
+ id: "runtime-inspector",
180
+ type: "skill",
181
+ source: ".agents/skills/runtime-inspector/SKILL.md",
182
+ fileName: "runtime-inspector/SKILL.md",
183
+ },
184
+ {
185
+ id: "sequential-thinking",
186
+ type: "skill",
187
+ source: ".agents/skills/sequential-thinking/SKILL.md",
188
+ fileName: "sequential-thinking/SKILL.md",
189
+ },
190
+ {
191
+ id: "spec-writer",
192
+ type: "skill",
193
+ source: ".agents/skills/spec-writer/SKILL.md",
194
+ fileName: "spec-writer/SKILL.md",
195
+ },
196
+ {
197
+ id: "spec-writer-prd-template",
198
+ type: "skill",
199
+ source: ".agents/skills/spec-writer/references/prd_template.md",
200
+ fileName: "spec-writer/references/prd_template.md",
201
+ },
202
+ {
203
+ id: "system-architect",
204
+ type: "skill",
205
+ source: ".agents/skills/system-architect/SKILL.md",
206
+ fileName: "system-architect/SKILL.md",
207
+ },
208
+ {
209
+ id: "system-architect-rfc-template",
210
+ type: "skill",
211
+ source: ".agents/skills/system-architect/references/rfc_template.md",
212
+ fileName: "system-architect/references/rfc_template.md",
213
+ },
214
+ {
215
+ id: "system-designer",
216
+ type: "skill",
217
+ source: ".agents/skills/system-designer/SKILL.md",
218
+ fileName: "system-designer/SKILL.md",
219
+ },
220
+ {
221
+ id: "system-designer-detail-template",
222
+ type: "skill",
223
+ source:
224
+ ".agents/skills/system-designer/references/system-design-detail-template.md",
225
+ fileName: "system-designer/references/system-design-detail-template.md",
226
+ },
227
+ {
228
+ id: "system-designer-template",
229
+ type: "skill",
230
+ source:
231
+ ".agents/skills/system-designer/references/system-design-template.md",
232
+ fileName: "system-designer/references/system-design-template.md",
233
+ },
234
+ {
235
+ id: "task-planner",
236
+ type: "skill",
237
+ source: ".agents/skills/task-planner/SKILL.md",
238
+ fileName: "task-planner/SKILL.md",
239
+ },
240
+ {
241
+ id: "task-planner-template-05a",
242
+ type: "skill",
243
+ source: ".agents/skills/task-planner/references/TASK_TEMPLATE_05A.md",
244
+ fileName: "task-planner/references/TASK_TEMPLATE_05A.md",
245
+ },
246
+ {
247
+ id: "task-planner-template-05b",
248
+ type: "skill",
249
+ source: ".agents/skills/task-planner/references/TASK_TEMPLATE_05B.md",
250
+ fileName: "task-planner/references/TASK_TEMPLATE_05B.md",
251
+ },
252
+ {
253
+ id: "task-reviewer",
254
+ type: "skill",
255
+ source: ".agents/skills/task-reviewer/SKILL.md",
256
+ fileName: "task-reviewer/SKILL.md",
257
+ },
258
+ {
259
+ id: "tech-evaluator",
260
+ type: "skill",
261
+ source: ".agents/skills/tech-evaluator/SKILL.md",
262
+ fileName: "tech-evaluator/SKILL.md",
263
+ },
264
+ {
265
+ id: "tech-evaluator-adr-template",
266
+ type: "skill",
267
+ source: ".agents/skills/tech-evaluator/references/ADR_TEMPLATE.md",
268
+ fileName: "tech-evaluator/references/ADR_TEMPLATE.md",
269
+ },
270
+ {
271
+ id: "e2e-testing-guide",
272
+ type: "skill",
273
+ source: ".agents/skills/e2e-testing-guide/SKILL.md",
274
+ fileName: "e2e-testing-guide/SKILL.md",
275
+ },
276
+ {
277
+ id: "craft-authoring",
278
+ type: "skill",
279
+ source: ".agents/skills/craft-authoring/SKILL.md",
280
+ fileName: "craft-authoring/SKILL.md",
281
+ },
282
+ {
283
+ id: "craft-authoring-bundle-policy",
284
+ type: "skill",
285
+ source: ".agents/skills/craft-authoring/references/BUNDLE_POLICY.md",
286
+ fileName: "craft-authoring/references/BUNDLE_POLICY.md",
287
+ },
288
+ {
289
+ id: "craft-authoring-prompt-quality-rubric",
290
+ type: "skill",
291
+ source:
292
+ ".agents/skills/craft-authoring/references/PROMPT_QUALITY_RUBRIC.md",
293
+ fileName: "craft-authoring/references/PROMPT_QUALITY_RUBRIC.md",
294
+ },
295
+ {
296
+ id: "craft-authoring-scorecard-template",
297
+ type: "skill",
298
+ source: ".agents/skills/craft-authoring/references/SCORECARD_TEMPLATE.md",
299
+ fileName: "craft-authoring/references/SCORECARD_TEMPLATE.md",
300
+ },
301
+ {
302
+ id: "nexus-query",
303
+ type: "skill",
304
+ source: ".agents/skills/nexus-query/SKILL.md",
305
+ fileName: "nexus-query/SKILL.md",
306
+ },
307
+ {
308
+ id: "nexus-query-extract-ast",
309
+ type: "skill",
310
+ source: ".agents/skills/nexus-query/scripts/extract_ast.py",
311
+ fileName: "nexus-query/scripts/extract_ast.py",
312
+ },
313
+ {
314
+ id: "nexus-query-git-detective",
315
+ type: "skill",
316
+ source: ".agents/skills/nexus-query/scripts/git_detective.py",
317
+ fileName: "nexus-query/scripts/git_detective.py",
318
+ },
319
+ {
320
+ id: "nexus-query-languages",
321
+ type: "skill",
322
+ source: ".agents/skills/nexus-query/scripts/languages.json",
323
+ fileName: "nexus-query/scripts/languages.json",
324
+ },
325
+ {
326
+ id: "nexus-query-query-graph",
327
+ type: "skill",
328
+ source: ".agents/skills/nexus-query/scripts/query_graph.py",
329
+ fileName: "nexus-query/scripts/query_graph.py",
330
+ },
331
+ {
332
+ id: "nexus-query-requirements",
333
+ type: "skill",
334
+ source: ".agents/skills/nexus-query/scripts/requirements.txt",
335
+ fileName: "nexus-query/scripts/requirements.txt",
336
+ },
337
+ ];
338
+
339
+ function toArray(value) {
340
+ return Array.isArray(value) ? value : [value];
341
+ }
342
+
343
+ function toProjectionFileName(resource, projectionType, targetId) {
344
+ if (
345
+ (targetId === "codex" || targetId === "trae") &&
346
+ projectionType === "skills" &&
347
+ resource.type === "workflow"
348
+ ) {
349
+ return `anws-system/references/${resource.id}.md`;
350
+ }
351
+ if (projectionType === "commands") {
352
+ return `${resource.id}.md`;
353
+ }
354
+ if (projectionType === "prompts") {
355
+ return targetId === "copilot"
356
+ ? `${resource.id}.prompt.md`
357
+ : `${resource.id}.md`;
358
+ }
359
+ if (projectionType === "agents") {
360
+ return `${resource.id}.md`;
361
+ }
362
+ return resource.fileName;
363
+ }
364
+
365
+ function buildProjectionEntries(targetId) {
366
+ const target = getTarget(targetId);
367
+ const typeMap = target.projectionTypes;
368
+
369
+ return RESOURCE_REGISTRY.flatMap((resource) => {
370
+ if (resource.targets && !resource.targets.includes(target.id)) {
371
+ return [];
372
+ }
373
+ const projectionTypes = typeMap[resource.type];
374
+ if (!projectionTypes) {
375
+ return [];
376
+ }
377
+
378
+ return toArray(projectionTypes).map((projectionType) => {
379
+ const outputFileName = toProjectionFileName(
380
+ resource,
381
+ projectionType,
382
+ target.id,
383
+ );
384
+ return {
385
+ ...resource,
386
+ projectionType,
387
+ outputRoot: target.projections[projectionType],
388
+ outputPath: `${target.projections[projectionType]}/${outputFileName}`,
389
+ };
390
+ });
391
+ });
392
+ }
393
+
394
+ function buildManagedManifest(targetIds = ["antigravity"]) {
395
+ return toArray(targetIds).flatMap((targetId) => {
396
+ const target = getTarget(targetId);
397
+ const entries = buildProjectionEntries(target.id).map((entry) => ({
398
+ ...entry,
399
+ targetId: target.id,
400
+ targetLabel: target.label,
401
+ ownershipKey: `${target.id}:${entry.outputPath}`,
402
+ }));
403
+
404
+ if (!target.rootAgentFile) {
405
+ return entries;
406
+ }
407
+
408
+ return [
409
+ {
410
+ id: "root-agents",
411
+ type: "root",
412
+ source: "AGENTS.md",
413
+ fileName: "AGENTS.md",
414
+ projectionType: "rootAgentFile",
415
+ outputRoot: ".",
416
+ outputPath: "AGENTS.md",
417
+ targetId: target.id,
418
+ targetLabel: target.label,
419
+ ownershipKey: `${target.id}:AGENTS.md`,
420
+ },
421
+ ...entries,
422
+ ];
423
+ });
424
+ }
425
+
426
+ function buildProjectionPlan(
427
+ targetIds = ["antigravity"],
428
+ resources = RESOURCE_REGISTRY,
429
+ ) {
430
+ return toArray(targetIds).map((targetId) => {
431
+ const target = getTarget(targetId);
432
+ const typeMap = target.projectionTypes;
433
+ const projectionEntries = resources.flatMap((resource) => {
434
+ if (resource.targets && !resource.targets.includes(target.id)) {
435
+ return [];
436
+ }
437
+ const projectionTypes = typeMap[resource.type];
438
+ if (!projectionTypes) {
439
+ return [];
440
+ }
441
+
442
+ return toArray(projectionTypes).map((projectionType) => {
443
+ const outputFileName = toProjectionFileName(
444
+ resource,
445
+ projectionType,
446
+ target.id,
447
+ );
448
+ const outputPath = `${target.projections[projectionType]}/${outputFileName}`;
449
+ return {
450
+ ...resource,
451
+ projectionType,
452
+ outputRoot: target.projections[projectionType],
453
+ outputPath,
454
+ targetId: target.id,
455
+ targetLabel: target.label,
456
+ ownershipKey: `${target.id}:${outputPath}`,
457
+ };
458
+ });
459
+ });
460
+
461
+ const managedFiles = target.rootAgentFile
462
+ ? ["AGENTS.md", ...projectionEntries.map((item) => item.outputPath)]
463
+ : projectionEntries.map((item) => item.outputPath);
464
+
465
+ return {
466
+ target,
467
+ targetId: target.id,
468
+ targetLabel: target.label,
469
+ managedFiles,
470
+ userProtectedFiles: buildUserProtectedFiles(target.id),
471
+ projectionEntries,
472
+ ownership: projectionEntries.map((item) => item.ownershipKey),
473
+ };
474
+ });
475
+ }
476
+
477
+ function buildManagedFiles(targetId = "antigravity") {
478
+ return buildManagedManifest(targetId).map((item) => item.outputPath);
479
+ }
480
+
481
+ function buildUserProtectedFiles(targetId = "antigravity") {
482
+ const target = getTarget(targetId);
483
+ return target.rootAgentFile ? ["AGENTS.md"] : [];
484
+ }
485
+
486
+ function findByType(type) {
487
+ return RESOURCE_REGISTRY.filter((item) => item.type === type);
488
+ }
489
+
490
+ const MANAGED_FILES = buildManagedFiles("antigravity");
491
+
492
+ /**
493
+ * USER_PROTECTED_FILES — 用户保护文件
494
+ *
495
+ * 这些文件在项目初始化后通常会包含特定于项目的配置。
496
+ * anws update 默认会跳过这些文件。
497
+ */
498
+ const USER_PROTECTED_FILES = buildUserProtectedFiles("antigravity");
499
+
500
+ module.exports = {
501
+ RESOURCE_REGISTRY,
502
+ buildManagedManifest,
503
+ buildProjectionPlan,
504
+ buildManagedFiles,
505
+ buildProjectionEntries,
506
+ buildUserProtectedFiles,
507
+ findByType,
508
+ MANAGED_FILES,
509
+ USER_PROTECTED_FILES,
510
+ };