@haaaiawd/anws 2.2.2 → 2.2.3

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 (36) hide show
  1. package/README.md +180 -180
  2. package/lib/manifest.js +212 -212
  3. package/package.json +1 -1
  4. package/templates/.agents/skills/anws-system/SKILL.md +108 -108
  5. package/templates/.agents/skills/code-reviewer/SKILL.md +101 -101
  6. package/templates/.agents/skills/concept-modeler/SKILL.md +179 -178
  7. package/templates/.agents/skills/craft-authoring/SKILL.md +6 -6
  8. package/templates/.agents/skills/design-reviewer/SKILL.md +190 -176
  9. package/templates/.agents/skills/e2e-testing-guide/SKILL.md +204 -59
  10. package/templates/.agents/skills/nexus-mapper/SKILL.md +321 -306
  11. package/templates/.agents/skills/report-template/SKILL.md +92 -85
  12. package/templates/.agents/skills/runtime-inspector/SKILL.md +12 -12
  13. package/templates/.agents/skills/sequential-thinking/SKILL.md +225 -216
  14. package/templates/.agents/skills/spec-writer/SKILL.md +9 -9
  15. package/templates/.agents/skills/spec-writer/references/prd_template.md +6 -6
  16. package/templates/.agents/skills/system-architect/SKILL.md +678 -620
  17. package/templates/.agents/skills/system-designer/SKILL.md +601 -534
  18. package/templates/.agents/skills/system-designer/references/system-design-detail-template.md +5 -5
  19. package/templates/.agents/skills/system-designer/references/system-design-template.md +28 -28
  20. package/templates/.agents/skills/task-planner/SKILL.md +699 -629
  21. package/templates/.agents/skills/task-planner/references/TASK_TEMPLATE.md +15 -15
  22. package/templates/.agents/skills/task-reviewer/SKILL.md +388 -363
  23. package/templates/.agents/skills/tech-evaluator/SKILL.md +144 -135
  24. package/templates/.agents/skills/tech-evaluator/references/ADR_TEMPLATE.md +80 -78
  25. package/templates/.agents/workflows/blueprint.md +391 -391
  26. package/templates/.agents/workflows/challenge.md +52 -52
  27. package/templates/.agents/workflows/change.md +346 -346
  28. package/templates/.agents/workflows/craft.md +11 -11
  29. package/templates/.agents/workflows/design-system.md +631 -631
  30. package/templates/.agents/workflows/explore.md +399 -399
  31. package/templates/.agents/workflows/forge.md +75 -73
  32. package/templates/.agents/workflows/genesis.md +353 -353
  33. package/templates/.agents/workflows/probe.md +243 -243
  34. package/templates/.agents/workflows/quickstart.md +123 -123
  35. package/templates/.agents/workflows/upgrade.md +10 -10
  36. package/templates/AGENTS.md +149 -149
package/lib/manifest.js CHANGED
@@ -1,212 +1,212 @@
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', type: 'skill', source: '.agents/skills/task-planner/references/TASK_TEMPLATE.md', fileName: 'task-planner/references/TASK_TEMPLATE.md' },
48
- { id: 'task-reviewer', type: 'skill', source: '.agents/skills/task-reviewer/SKILL.md', fileName: 'task-reviewer/SKILL.md' },
49
- { id: 'tech-evaluator', type: 'skill', source: '.agents/skills/tech-evaluator/SKILL.md', fileName: 'tech-evaluator/SKILL.md' },
50
- { id: 'tech-evaluator-adr-template', type: 'skill', source: '.agents/skills/tech-evaluator/references/ADR_TEMPLATE.md', fileName: 'tech-evaluator/references/ADR_TEMPLATE.md' },
51
- { id: 'e2e-testing-guide', type: 'skill', source: '.agents/skills/e2e-testing-guide/SKILL.md', fileName: 'e2e-testing-guide/SKILL.md' },
52
- { id: 'craft-authoring', type: 'skill', source: '.agents/skills/craft-authoring/SKILL.md', fileName: 'craft-authoring/SKILL.md' }
53
- ];
54
-
55
- function toArray(value) {
56
- return Array.isArray(value) ? value : [value];
57
- }
58
-
59
- function toProjectionFileName(resource, projectionType, targetId) {
60
- if ((targetId === 'codex' || targetId === 'trae') && projectionType === 'skills' && resource.type === 'workflow') {
61
- return `anws-system/references/${resource.id}.md`;
62
- }
63
- if (projectionType === 'commands') {
64
- return `${resource.id}.md`;
65
- }
66
- if (projectionType === 'prompts') {
67
- return targetId === 'copilot' ? `${resource.id}.prompt.md` : `${resource.id}.md`;
68
- }
69
- if (projectionType === 'agents') {
70
- return `${resource.id}.md`;
71
- }
72
- return resource.fileName;
73
- }
74
-
75
- function buildProjectionEntries(targetId) {
76
- const target = getTarget(targetId);
77
- const typeMap = target.projectionTypes;
78
-
79
- return RESOURCE_REGISTRY.flatMap((resource) => {
80
- if (resource.targets && !resource.targets.includes(target.id)) {
81
- return [];
82
- }
83
- const projectionTypes = typeMap[resource.type];
84
- if (!projectionTypes) {
85
- return [];
86
- }
87
-
88
- return toArray(projectionTypes).map((projectionType) => {
89
- const outputFileName = toProjectionFileName(resource, projectionType, target.id);
90
- return {
91
- ...resource,
92
- projectionType,
93
- outputRoot: target.projections[projectionType],
94
- outputPath: `${target.projections[projectionType]}/${outputFileName}`
95
- };
96
- });
97
- });
98
- }
99
-
100
- function buildManagedManifest(targetIds = ['antigravity']) {
101
- return toArray(targetIds).flatMap((targetId) => {
102
- const target = getTarget(targetId);
103
- const entries = buildProjectionEntries(target.id).map((entry) => ({
104
- ...entry,
105
- targetId: target.id,
106
- targetLabel: target.label,
107
- ownershipKey: `${target.id}:${entry.outputPath}`
108
- }));
109
-
110
- if (!target.rootAgentFile) {
111
- return entries;
112
- }
113
-
114
- return [
115
- {
116
- id: 'root-agents',
117
- type: 'root',
118
- source: 'AGENTS.md',
119
- fileName: 'AGENTS.md',
120
- projectionType: 'rootAgentFile',
121
- outputRoot: '.',
122
- outputPath: 'AGENTS.md',
123
- targetId: target.id,
124
- targetLabel: target.label,
125
- ownershipKey: `${target.id}:AGENTS.md`
126
- },
127
- ...entries
128
- ];
129
- });
130
- }
131
-
132
- function buildProjectionPlan(targetIds = ['antigravity'], resources = RESOURCE_REGISTRY) {
133
- return toArray(targetIds).map((targetId) => {
134
- const target = getTarget(targetId);
135
- const typeMap = target.projectionTypes;
136
- const projectionEntries = resources.flatMap((resource) => {
137
- if (resource.targets && !resource.targets.includes(target.id)) {
138
- return [];
139
- }
140
- const projectionTypes = typeMap[resource.type];
141
- if (!projectionTypes) {
142
- return [];
143
- }
144
-
145
- return toArray(projectionTypes).map((projectionType) => {
146
- const outputFileName = toProjectionFileName(resource, projectionType, target.id);
147
- const outputPath = `${target.projections[projectionType]}/${outputFileName}`;
148
- return {
149
- ...resource,
150
- projectionType,
151
- outputRoot: target.projections[projectionType],
152
- outputPath,
153
- targetId: target.id,
154
- targetLabel: target.label,
155
- ownershipKey: `${target.id}:${outputPath}`
156
- };
157
- });
158
- });
159
-
160
- const managedFiles = target.rootAgentFile
161
- ? ['AGENTS.md', ...projectionEntries.map((item) => item.outputPath)]
162
- : projectionEntries.map((item) => item.outputPath);
163
-
164
- return {
165
- target,
166
- targetId: target.id,
167
- targetLabel: target.label,
168
- managedFiles,
169
- userProtectedFiles: buildUserProtectedFiles(target.id),
170
- projectionEntries,
171
- ownership: projectionEntries.map((item) => item.ownershipKey)
172
- };
173
- });
174
- }
175
-
176
- function buildManagedFiles(targetId = 'antigravity') {
177
- return buildManagedManifest(targetId).map((item) => item.outputPath);
178
- }
179
-
180
- function buildUserProtectedFiles(targetId = 'antigravity') {
181
- const target = getTarget(targetId);
182
- return target.rootAgentFile ? ['AGENTS.md'] : [];
183
- }
184
-
185
- function findByType(type) {
186
- return RESOURCE_REGISTRY.filter((item) => item.type === type);
187
- }
188
-
189
- const MANAGED_FILES = buildManagedFiles('antigravity');
190
-
191
- /**
192
- * USER_PROTECTED_FILES — 用户保护文件
193
- *
194
- * 这些文件在项目初始化后通常会包含特定于项目的配置。
195
- * anws update 默认会跳过这些文件。
196
- */
197
- const USER_PROTECTED_FILES = buildUserProtectedFiles('antigravity');
198
-
199
- module.exports = {
200
- RESOURCE_REGISTRY,
201
- buildManagedManifest,
202
- buildProjectionPlan,
203
- buildManagedFiles,
204
- buildProjectionEntries,
205
- buildUserProtectedFiles,
206
- findByType,
207
- MANAGED_FILES,
208
- USER_PROTECTED_FILES
209
- };
210
-
211
-
212
-
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', type: 'skill', source: '.agents/skills/task-planner/references/TASK_TEMPLATE.md', fileName: 'task-planner/references/TASK_TEMPLATE.md' },
48
+ { id: 'task-reviewer', type: 'skill', source: '.agents/skills/task-reviewer/SKILL.md', fileName: 'task-reviewer/SKILL.md' },
49
+ { id: 'tech-evaluator', type: 'skill', source: '.agents/skills/tech-evaluator/SKILL.md', fileName: 'tech-evaluator/SKILL.md' },
50
+ { id: 'tech-evaluator-adr-template', type: 'skill', source: '.agents/skills/tech-evaluator/references/ADR_TEMPLATE.md', fileName: 'tech-evaluator/references/ADR_TEMPLATE.md' },
51
+ { id: 'e2e-testing-guide', type: 'skill', source: '.agents/skills/e2e-testing-guide/SKILL.md', fileName: 'e2e-testing-guide/SKILL.md' },
52
+ { id: 'craft-authoring', type: 'skill', source: '.agents/skills/craft-authoring/SKILL.md', fileName: 'craft-authoring/SKILL.md' }
53
+ ];
54
+
55
+ function toArray(value) {
56
+ return Array.isArray(value) ? value : [value];
57
+ }
58
+
59
+ function toProjectionFileName(resource, projectionType, targetId) {
60
+ if ((targetId === 'codex' || targetId === 'trae') && projectionType === 'skills' && resource.type === 'workflow') {
61
+ return `anws-system/references/${resource.id}.md`;
62
+ }
63
+ if (projectionType === 'commands') {
64
+ return `${resource.id}.md`;
65
+ }
66
+ if (projectionType === 'prompts') {
67
+ return targetId === 'copilot' ? `${resource.id}.prompt.md` : `${resource.id}.md`;
68
+ }
69
+ if (projectionType === 'agents') {
70
+ return `${resource.id}.md`;
71
+ }
72
+ return resource.fileName;
73
+ }
74
+
75
+ function buildProjectionEntries(targetId) {
76
+ const target = getTarget(targetId);
77
+ const typeMap = target.projectionTypes;
78
+
79
+ return RESOURCE_REGISTRY.flatMap((resource) => {
80
+ if (resource.targets && !resource.targets.includes(target.id)) {
81
+ return [];
82
+ }
83
+ const projectionTypes = typeMap[resource.type];
84
+ if (!projectionTypes) {
85
+ return [];
86
+ }
87
+
88
+ return toArray(projectionTypes).map((projectionType) => {
89
+ const outputFileName = toProjectionFileName(resource, projectionType, target.id);
90
+ return {
91
+ ...resource,
92
+ projectionType,
93
+ outputRoot: target.projections[projectionType],
94
+ outputPath: `${target.projections[projectionType]}/${outputFileName}`
95
+ };
96
+ });
97
+ });
98
+ }
99
+
100
+ function buildManagedManifest(targetIds = ['antigravity']) {
101
+ return toArray(targetIds).flatMap((targetId) => {
102
+ const target = getTarget(targetId);
103
+ const entries = buildProjectionEntries(target.id).map((entry) => ({
104
+ ...entry,
105
+ targetId: target.id,
106
+ targetLabel: target.label,
107
+ ownershipKey: `${target.id}:${entry.outputPath}`
108
+ }));
109
+
110
+ if (!target.rootAgentFile) {
111
+ return entries;
112
+ }
113
+
114
+ return [
115
+ {
116
+ id: 'root-agents',
117
+ type: 'root',
118
+ source: 'AGENTS.md',
119
+ fileName: 'AGENTS.md',
120
+ projectionType: 'rootAgentFile',
121
+ outputRoot: '.',
122
+ outputPath: 'AGENTS.md',
123
+ targetId: target.id,
124
+ targetLabel: target.label,
125
+ ownershipKey: `${target.id}:AGENTS.md`
126
+ },
127
+ ...entries
128
+ ];
129
+ });
130
+ }
131
+
132
+ function buildProjectionPlan(targetIds = ['antigravity'], resources = RESOURCE_REGISTRY) {
133
+ return toArray(targetIds).map((targetId) => {
134
+ const target = getTarget(targetId);
135
+ const typeMap = target.projectionTypes;
136
+ const projectionEntries = resources.flatMap((resource) => {
137
+ if (resource.targets && !resource.targets.includes(target.id)) {
138
+ return [];
139
+ }
140
+ const projectionTypes = typeMap[resource.type];
141
+ if (!projectionTypes) {
142
+ return [];
143
+ }
144
+
145
+ return toArray(projectionTypes).map((projectionType) => {
146
+ const outputFileName = toProjectionFileName(resource, projectionType, target.id);
147
+ const outputPath = `${target.projections[projectionType]}/${outputFileName}`;
148
+ return {
149
+ ...resource,
150
+ projectionType,
151
+ outputRoot: target.projections[projectionType],
152
+ outputPath,
153
+ targetId: target.id,
154
+ targetLabel: target.label,
155
+ ownershipKey: `${target.id}:${outputPath}`
156
+ };
157
+ });
158
+ });
159
+
160
+ const managedFiles = target.rootAgentFile
161
+ ? ['AGENTS.md', ...projectionEntries.map((item) => item.outputPath)]
162
+ : projectionEntries.map((item) => item.outputPath);
163
+
164
+ return {
165
+ target,
166
+ targetId: target.id,
167
+ targetLabel: target.label,
168
+ managedFiles,
169
+ userProtectedFiles: buildUserProtectedFiles(target.id),
170
+ projectionEntries,
171
+ ownership: projectionEntries.map((item) => item.ownershipKey)
172
+ };
173
+ });
174
+ }
175
+
176
+ function buildManagedFiles(targetId = 'antigravity') {
177
+ return buildManagedManifest(targetId).map((item) => item.outputPath);
178
+ }
179
+
180
+ function buildUserProtectedFiles(targetId = 'antigravity') {
181
+ const target = getTarget(targetId);
182
+ return target.rootAgentFile ? ['AGENTS.md'] : [];
183
+ }
184
+
185
+ function findByType(type) {
186
+ return RESOURCE_REGISTRY.filter((item) => item.type === type);
187
+ }
188
+
189
+ const MANAGED_FILES = buildManagedFiles('antigravity');
190
+
191
+ /**
192
+ * USER_PROTECTED_FILES — 用户保护文件
193
+ *
194
+ * 这些文件在项目初始化后通常会包含特定于项目的配置。
195
+ * anws update 默认会跳过这些文件。
196
+ */
197
+ const USER_PROTECTED_FILES = buildUserProtectedFiles('antigravity');
198
+
199
+ module.exports = {
200
+ RESOURCE_REGISTRY,
201
+ buildManagedManifest,
202
+ buildProjectionPlan,
203
+ buildManagedFiles,
204
+ buildProjectionEntries,
205
+ buildUserProtectedFiles,
206
+ findByType,
207
+ MANAGED_FILES,
208
+ USER_PROTECTED_FILES
209
+ };
210
+
211
+
212
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haaaiawd/anws",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Anws — A spec-driven workflow framework for AI-assisted development. Empowers prompt engineers to build production-ready software through structured PRD → Architecture → Task decomposition. Works with Claude Code, GitHub Copilot, Cursor, Windsurf, and any tool that reads AGENTS.md.",
5
5
  "keywords": [
6
6
  "anws",