@a1st/aix 0.0.12 → 0.2.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 +9 -3
- package/dist/base-command.d.ts +2 -1
- package/dist/base-command.d.ts.map +1 -1
- package/dist/base-command.js +8 -2
- package/dist/base-command.js.map +1 -1
- package/dist/commands/add/mcp.d.ts +5 -8
- package/dist/commands/add/mcp.d.ts.map +1 -1
- package/dist/commands/add/mcp.js +74 -87
- package/dist/commands/add/mcp.js.map +1 -1
- package/dist/commands/add/prompt.d.ts +5 -0
- package/dist/commands/add/prompt.d.ts.map +1 -1
- package/dist/commands/add/prompt.js +54 -112
- package/dist/commands/add/prompt.js.map +1 -1
- package/dist/commands/add/rule.d.ts +5 -0
- package/dist/commands/add/rule.d.ts.map +1 -1
- package/dist/commands/add/rule.js +54 -110
- package/dist/commands/add/rule.js.map +1 -1
- package/dist/commands/add/skill.d.ts +5 -0
- package/dist/commands/add/skill.d.ts.map +1 -1
- package/dist/commands/add/skill.js +63 -163
- package/dist/commands/add/skill.js.map +1 -1
- package/dist/commands/backups.d.ts.map +1 -1
- package/dist/commands/backups.js +0 -1
- package/dist/commands/backups.js.map +1 -1
- package/dist/commands/init.d.ts +5 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +65 -9
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.d.ts +7 -21
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +121 -126
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/list/index.d.ts +25 -2
- package/dist/commands/list/index.d.ts.map +1 -1
- package/dist/commands/list/index.js +366 -21
- package/dist/commands/list/index.js.map +1 -1
- package/dist/commands/{global/list.d.ts → list/prompts.d.ts} +2 -2
- package/dist/commands/list/prompts.d.ts.map +1 -0
- package/dist/commands/list/prompts.js +58 -0
- package/dist/commands/list/prompts.js.map +1 -0
- package/dist/commands/remove/mcp.d.ts +3 -0
- package/dist/commands/remove/mcp.d.ts.map +1 -1
- package/dist/commands/remove/mcp.js +20 -21
- package/dist/commands/remove/mcp.js.map +1 -1
- package/dist/commands/remove/skill.d.ts +3 -0
- package/dist/commands/remove/skill.d.ts.map +1 -1
- package/dist/commands/remove/skill.js +44 -21
- package/dist/commands/remove/skill.js.map +1 -1
- package/dist/commands/search.d.ts +0 -1
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +8 -21
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/sync.d.ts +23 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +180 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/validate.d.ts +3 -0
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +24 -2
- package/dist/commands/validate.js.map +1 -1
- package/dist/flags/lock.d.ts +4 -0
- package/dist/flags/lock.d.ts.map +1 -0
- package/dist/flags/lock.js +8 -0
- package/dist/flags/lock.js.map +1 -0
- package/dist/flags/scope.d.ts +48 -12
- package/dist/flags/scope.d.ts.map +1 -1
- package/dist/flags/scope.js +63 -16
- package/dist/flags/scope.js.map +1 -1
- package/dist/lib/add-command-helper.d.ts +34 -0
- package/dist/lib/add-command-helper.d.ts.map +1 -0
- package/dist/lib/add-command-helper.js +74 -0
- package/dist/lib/add-command-helper.js.map +1 -0
- package/dist/lib/add-helper.d.ts +2 -2
- package/dist/lib/add-helper.d.ts.map +1 -1
- package/dist/lib/add-helper.js +49 -55
- package/dist/lib/add-helper.js.map +1 -1
- package/dist/lib/apply-result-reporter.d.ts +23 -0
- package/dist/lib/apply-result-reporter.d.ts.map +1 -0
- package/dist/lib/apply-result-reporter.js +125 -0
- package/dist/lib/apply-result-reporter.js.map +1 -0
- package/dist/lib/delete-helper.d.ts +5 -1
- package/dist/lib/delete-helper.d.ts.map +1 -1
- package/dist/lib/delete-helper.js +20 -11
- package/dist/lib/delete-helper.js.map +1 -1
- package/dist/lib/install-helper.d.ts +23 -2
- package/dist/lib/install-helper.d.ts.map +1 -1
- package/dist/lib/install-helper.js +42 -4
- package/dist/lib/install-helper.js.map +1 -1
- package/dist/lib/lockfile-helper.d.ts +4 -0
- package/dist/lib/lockfile-helper.d.ts.map +1 -0
- package/dist/lib/lockfile-helper.js +25 -0
- package/dist/lib/lockfile-helper.js.map +1 -0
- package/dist/lib/search/registry.d.ts +4 -6
- package/dist/lib/search/registry.d.ts.map +1 -1
- package/dist/lib/search/registry.js +5 -12
- package/dist/lib/search/registry.js.map +1 -1
- package/dist/lib/search/skill-install.d.ts +7 -0
- package/dist/lib/search/skill-install.d.ts.map +1 -0
- package/dist/lib/search/skill-install.js +81 -0
- package/dist/lib/search/skill-install.js.map +1 -0
- package/dist/lib/search/sources/index.d.ts +1 -2
- package/dist/lib/search/sources/index.d.ts.map +1 -1
- package/dist/lib/search/sources/index.js +1 -2
- package/dist/lib/search/sources/index.js.map +1 -1
- package/dist/lib/search/sources/skills-library.d.ts +14 -0
- package/dist/lib/search/sources/skills-library.d.ts.map +1 -0
- package/dist/lib/search/sources/skills-library.js +42 -0
- package/dist/lib/search/sources/skills-library.js.map +1 -0
- package/dist/lib/search/types.d.ts +0 -8
- package/dist/lib/search/types.d.ts.map +1 -1
- package/dist/lib/search/types.js +1 -13
- package/dist/lib/search/types.js.map +1 -1
- package/dist/lib/skill-source.d.ts +11 -0
- package/dist/lib/skill-source.d.ts.map +1 -0
- package/dist/lib/skill-source.js +210 -0
- package/dist/lib/skill-source.js.map +1 -0
- package/dist/ui/search/components/DetailsPanel.d.ts.map +1 -1
- package/dist/ui/search/components/DetailsPanel.js +1 -1
- package/dist/ui/search/components/DetailsPanel.js.map +1 -1
- package/oclif.manifest.json +567 -177
- package/package.json +12 -5
- package/dist/commands/global/cleanup.d.ts +0 -14
- package/dist/commands/global/cleanup.d.ts.map +0 -1
- package/dist/commands/global/cleanup.js +0 -92
- package/dist/commands/global/cleanup.js.map +0 -1
- package/dist/commands/global/index.d.ts +0 -7
- package/dist/commands/global/index.d.ts.map +0 -1
- package/dist/commands/global/index.js +0 -10
- package/dist/commands/global/index.js.map +0 -1
- package/dist/commands/global/list.d.ts.map +0 -1
- package/dist/commands/global/list.js +0 -40
- package/dist/commands/global/list.js.map +0 -1
- package/dist/lib/search/sources/claude-plugins-dev.d.ts +0 -16
- package/dist/lib/search/sources/claude-plugins-dev.d.ts.map +0 -1
- package/dist/lib/search/sources/claude-plugins-dev.js +0 -44
- package/dist/lib/search/sources/claude-plugins-dev.js.map +0 -1
- package/dist/lib/search/sources/npm.d.ts +0 -14
- package/dist/lib/search/sources/npm.d.ts.map +0 -1
- package/dist/lib/search/sources/npm.js +0 -42
- package/dist/lib/search/sources/npm.js.map +0 -1
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { Args, Flags } from '@oclif/core';
|
|
2
|
+
import { getAvailableEditors, importFromEditor, normalizeEditorImport, buildConfigFromEditorImport, installToEditor, } from '@a1st/aix-core';
|
|
3
|
+
import { BaseCommand } from '../base-command.js';
|
|
4
|
+
import { displayFileChanges, displayGlobalChanges, showUnsupportedFeatureWarnings, } from '../lib/apply-result-reporter.js';
|
|
5
|
+
const VALID_EDITORS = getAvailableEditors();
|
|
6
|
+
export default class Sync extends BaseCommand {
|
|
7
|
+
static description = 'Sync supported configuration from one editor to another';
|
|
8
|
+
static examples = [
|
|
9
|
+
'<%= config.bin %> <%= command.id %> cursor --to claude-code',
|
|
10
|
+
'<%= config.bin %> <%= command.id %> cursor --to opencode --scope project',
|
|
11
|
+
'<%= config.bin %> <%= command.id %> opencode --to windsurf --from-scope project --to-scope user',
|
|
12
|
+
'<%= config.bin %> <%= command.id %> cursor --to zed --dry-run',
|
|
13
|
+
];
|
|
14
|
+
static args = {
|
|
15
|
+
from: Args.string({
|
|
16
|
+
description: `Source editor (${VALID_EDITORS.join(', ')})`,
|
|
17
|
+
required: true,
|
|
18
|
+
options: VALID_EDITORS,
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
static flags = {
|
|
22
|
+
to: Flags.string({
|
|
23
|
+
char: 't',
|
|
24
|
+
description: 'Destination editor',
|
|
25
|
+
required: true,
|
|
26
|
+
options: VALID_EDITORS,
|
|
27
|
+
}),
|
|
28
|
+
scope: Flags.string({
|
|
29
|
+
char: 's',
|
|
30
|
+
description: 'Apply the same scope to both source and destination',
|
|
31
|
+
options: ['user', 'project'],
|
|
32
|
+
}),
|
|
33
|
+
'from-scope': Flags.string({
|
|
34
|
+
description: 'Scope to read from on the source editor',
|
|
35
|
+
options: ['user', 'project'],
|
|
36
|
+
}),
|
|
37
|
+
'to-scope': Flags.string({
|
|
38
|
+
description: 'Scope to write to on the destination editor',
|
|
39
|
+
options: ['user', 'project'],
|
|
40
|
+
}),
|
|
41
|
+
'dry-run': Flags.boolean({
|
|
42
|
+
char: 'd',
|
|
43
|
+
description: 'Preview sync changes without applying them',
|
|
44
|
+
default: false,
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
async run() {
|
|
48
|
+
const { args, flags } = await this.parse(Sync), from = args.from, to = flags.to, sharedScope = flags.scope, fromScope = flags['from-scope'] ?? sharedScope ?? 'user', toScope = flags['to-scope'] ?? sharedScope ?? 'user', projectRoot = process.cwd(), isDryRun = flags['dry-run'];
|
|
49
|
+
if (from === to) {
|
|
50
|
+
this.error('Source and destination editors must differ.');
|
|
51
|
+
}
|
|
52
|
+
this.output.startSpinner(isDryRun ? `Analyzing sync from ${from} to ${to}...` : `Syncing ${from} to ${to}...`);
|
|
53
|
+
try {
|
|
54
|
+
const imported = await importFromEditor(from, {
|
|
55
|
+
projectRoot,
|
|
56
|
+
scope: fromScope,
|
|
57
|
+
}), importWarnings = [...new Set(imported.warnings)], normalized = normalizeEditorImport(from, imported), importedCount = this.countImported(normalized);
|
|
58
|
+
this.showImportWarnings(importWarnings);
|
|
59
|
+
if (importedCount === 0) {
|
|
60
|
+
this.output.stopSpinner(true, `No supported configuration found in ${from} (${fromScope} scope)`);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const result = await installToEditor(to, buildConfigFromEditorImport(from, imported), projectRoot, {
|
|
64
|
+
dryRun: isDryRun,
|
|
65
|
+
targetScope: toScope,
|
|
66
|
+
strictTargetScope: true,
|
|
67
|
+
});
|
|
68
|
+
if (!result.success) {
|
|
69
|
+
this.output.stopSpinner(false, `Failed to sync ${from} to ${to}`);
|
|
70
|
+
for (const error of result.errors) {
|
|
71
|
+
this.output.error(error);
|
|
72
|
+
}
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.output.stopSpinner(true, isDryRun ? `Sync preview for ${from} -> ${to}` : `Synced ${from} -> ${to}`);
|
|
76
|
+
this.displayImportSummary(from, fromScope, normalized);
|
|
77
|
+
displayFileChanges({
|
|
78
|
+
output: this.output,
|
|
79
|
+
quiet: this.flags.quiet,
|
|
80
|
+
changes: result.changes,
|
|
81
|
+
showAction: isDryRun,
|
|
82
|
+
blankAfterEachCategory: true,
|
|
83
|
+
});
|
|
84
|
+
displayGlobalChanges({
|
|
85
|
+
output: this.output,
|
|
86
|
+
quiet: this.flags.quiet,
|
|
87
|
+
globalChanges: result.globalChanges,
|
|
88
|
+
blankAfterEachGroup: true,
|
|
89
|
+
showWarningsWithoutEntries: true,
|
|
90
|
+
});
|
|
91
|
+
showUnsupportedFeatureWarnings(this.output, this.flags.quiet, to, result.unsupportedFeatures);
|
|
92
|
+
this.showTargetScopeLimitations(to, toScope, result.targetScopeLimitations);
|
|
93
|
+
this.showNoWritableChangesMessage(to, result);
|
|
94
|
+
if (this.flags.json) {
|
|
95
|
+
this.output.json({
|
|
96
|
+
from,
|
|
97
|
+
to,
|
|
98
|
+
fromScope,
|
|
99
|
+
toScope,
|
|
100
|
+
dryRun: isDryRun,
|
|
101
|
+
imported: {
|
|
102
|
+
mcp: Object.keys(normalized.mcp).length,
|
|
103
|
+
rules: normalized.rules.length,
|
|
104
|
+
prompts: normalized.prompts.length,
|
|
105
|
+
skills: normalized.skills.length,
|
|
106
|
+
hooks: Object.keys(normalized.hooks).length,
|
|
107
|
+
},
|
|
108
|
+
importWarnings,
|
|
109
|
+
noWritableChanges: !this.hasWritableChanges(result),
|
|
110
|
+
result,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
this.output.stopSpinner(false, `Failed to sync ${from} to ${to}`);
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
countImported(normalized) {
|
|
120
|
+
return (Object.keys(normalized.mcp).length +
|
|
121
|
+
normalized.rules.length +
|
|
122
|
+
normalized.prompts.length +
|
|
123
|
+
normalized.skills.length +
|
|
124
|
+
Object.keys(normalized.hooks).length);
|
|
125
|
+
}
|
|
126
|
+
showImportWarnings(warnings) {
|
|
127
|
+
if (warnings.length === 0 || this.flags.quiet) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
for (const warning of warnings) {
|
|
131
|
+
this.output.warn(warning);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
displayImportSummary(from, fromScope, normalized) {
|
|
135
|
+
this.output.log('');
|
|
136
|
+
this.output.log(this.output.cyan(` Imported from ${from} (${fromScope})`));
|
|
137
|
+
this.output.log(` ${this.output.green('✓')} MCP servers: ${Object.keys(normalized.mcp).length}`);
|
|
138
|
+
this.output.log(` ${this.output.green('✓')} rules: ${normalized.rules.length}`);
|
|
139
|
+
this.output.log(` ${this.output.green('✓')} prompts: ${normalized.prompts.length}`);
|
|
140
|
+
this.output.log(` ${this.output.green('✓')} skills: ${normalized.skills.length}`);
|
|
141
|
+
this.output.log(` ${this.output.green('✓')} hooks: ${Object.keys(normalized.hooks).length}`);
|
|
142
|
+
this.output.log('');
|
|
143
|
+
}
|
|
144
|
+
showTargetScopeLimitations(editor, targetScope, limitations) {
|
|
145
|
+
if (!limitations || this.flags.quiet) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (limitations.rules) {
|
|
149
|
+
this.output.warn(`${editor} cannot write rules at ${targetScope} scope. Skipped: ${limitations.rules.rules.join(', ')}`);
|
|
150
|
+
}
|
|
151
|
+
if (limitations.skills) {
|
|
152
|
+
this.output.warn(`${editor} cannot activate these skills at ${targetScope} scope. Skipped: ${limitations.skills.skills.join(', ')}`);
|
|
153
|
+
}
|
|
154
|
+
if (limitations.hooks) {
|
|
155
|
+
this.output.warn(`${editor} cannot write hooks at ${targetScope} scope. Skipped events: ${limitations.hooks.events.join(', ')}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
hasWritableChanges(result) {
|
|
159
|
+
return (result.changes.some((change) => change.action !== 'unchanged') ||
|
|
160
|
+
Boolean(result.globalChanges && result.globalChanges.applied.length > 0));
|
|
161
|
+
}
|
|
162
|
+
showNoWritableChangesMessage(editor, result) {
|
|
163
|
+
if (this.flags.quiet || this.hasWritableChanges(result)) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const hasSkippedFeatures = Boolean(result.globalChanges?.skipped.length ||
|
|
167
|
+
result.unsupportedFeatures?.mcp ||
|
|
168
|
+
result.unsupportedFeatures?.hooks ||
|
|
169
|
+
result.unsupportedFeatures?.prompts ||
|
|
170
|
+
result.targetScopeLimitations?.rules ||
|
|
171
|
+
result.targetScopeLimitations?.skills ||
|
|
172
|
+
result.targetScopeLimitations?.hooks);
|
|
173
|
+
if (hasSkippedFeatures) {
|
|
174
|
+
this.output.info(`No writable destination changes remain after applying ${editor} support and scope limits.`);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
this.output.info(`No destination changes were needed for ${editor}.`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAO1C,OAAO,EACJ,mBAAmB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AAC,EAAE,CAChH,CAAC;QACL,CAAC;IACJ,CAAC;IAEO,kBAAkB,CAAC,MAAmB;QAC3C,OAAO,CACJ,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC;YAC9D,OAAO,CAAC,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAC1E,CAAC;IACL,CAAC;IAEO,4BAA4B,CAAC,MAAkB,EAAE,MAAmB;QACzE,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;YACvD,OAAO;QACV,CAAC;QAED,MAAM,kBAAkB,GAAG,OAAO,CAC/B,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM;YACpC,MAAM,CAAC,mBAAmB,EAAE,GAAG;YAC/B,MAAM,CAAC,mBAAmB,EAAE,KAAK;YACjC,MAAM,CAAC,mBAAmB,EAAE,OAAO;YACnC,MAAM,CAAC,sBAAsB,EAAE,KAAK;YACpC,MAAM,CAAC,sBAAsB,EAAE,MAAM;YACrC,MAAM,CAAC,sBAAsB,EAAE,KAAK,CACtC,CAAC;QAEF,IAAI,kBAAkB,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CACb,yDAAyD,MAAM,4BAA4B,CAC7F,CAAC;YACF,OAAO;QACV,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,0CAA0C,MAAM,GAAG,CAAC,CAAC;IACzE,CAAC"}
|
|
@@ -2,6 +2,9 @@ import { BaseCommand } from '../base-command.js';
|
|
|
2
2
|
export default class Validate extends BaseCommand<typeof Validate> {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
lock: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
5
8
|
run(): Promise<void>;
|
|
6
9
|
}
|
|
7
10
|
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAKjD,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,WAAW,CAAC,OAAO,QAAQ,CAAC;IAC/D,OAAgB,WAAW,SAAoC;IAE/D,OAAgB,QAAQ,WAKtB;IAEF,OAAgB,KAAK;;MAKnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAuE5B"}
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import { BaseCommand } from '../base-command.js';
|
|
2
|
-
import { loadConfig as coreLoadConfig } from '@a1st/aix-core';
|
|
2
|
+
import { loadConfig as coreLoadConfig, generateAndWriteLockfile } from '@a1st/aix-core';
|
|
3
3
|
import { ConfigValidationError } from '@a1st/aix-core';
|
|
4
|
+
import { Flags } from '@oclif/core';
|
|
4
5
|
export default class Validate extends BaseCommand {
|
|
5
6
|
static description = 'Validate ai.json configuration';
|
|
6
7
|
static examples = [
|
|
7
8
|
'<%= config.bin %> <%= command.id %>',
|
|
8
9
|
'<%= config.bin %> <%= command.id %> --config ./path/to/ai.json',
|
|
9
10
|
'<%= config.bin %> <%= command.id %> --json',
|
|
11
|
+
'<%= config.bin %> <%= command.id %> --lock',
|
|
10
12
|
];
|
|
13
|
+
static flags = {
|
|
14
|
+
lock: Flags.boolean({
|
|
15
|
+
description: 'Create or refresh ai.lock.json after validating',
|
|
16
|
+
default: false,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
11
19
|
async run() {
|
|
12
20
|
const configPath = this.flags.config;
|
|
13
21
|
this.output.startSpinner('Validating configuration...');
|
|
14
22
|
try {
|
|
15
|
-
const result = await coreLoadConfig(
|
|
23
|
+
const result = await coreLoadConfig({
|
|
24
|
+
explicitPath: configPath,
|
|
25
|
+
lockfileMode: this.flags.lock ? 'ignore' : 'auto',
|
|
26
|
+
});
|
|
16
27
|
if (!result) {
|
|
17
28
|
this.output.stopSpinner(false, 'No ai.json found');
|
|
18
29
|
if (this.flags.json) {
|
|
@@ -21,11 +32,22 @@ export default class Validate extends BaseCommand {
|
|
|
21
32
|
this.error('No ai.json found. Run `aix init` to create one.');
|
|
22
33
|
}
|
|
23
34
|
this.output.stopSpinner(true, 'Configuration is valid');
|
|
35
|
+
let lockfilePath = result.lockfilePath;
|
|
36
|
+
if (this.flags.lock) {
|
|
37
|
+
const written = await generateAndWriteLockfile({
|
|
38
|
+
config: result.config,
|
|
39
|
+
configPath: result.path,
|
|
40
|
+
configBaseDir: result.configBaseDir,
|
|
41
|
+
});
|
|
42
|
+
lockfilePath = written.lockfilePath;
|
|
43
|
+
this.output.success(`Updated ${lockfilePath}`);
|
|
44
|
+
}
|
|
24
45
|
if (this.flags.json) {
|
|
25
46
|
this.output.json({
|
|
26
47
|
valid: true,
|
|
27
48
|
path: result.path,
|
|
28
49
|
source: result.source,
|
|
50
|
+
lockfilePath,
|
|
29
51
|
config: result.config,
|
|
30
52
|
});
|
|
31
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAA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;wBACZ,MAAM,EAAE,KAAK,CAAC,MAAM;qBACtB,CAAC,CAAC;gBACN,CAAC;gBAED,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChB,CAAC;YAED,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC1B,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;oBACnB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC5D,CAAC;gBACD,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC7B,CAAC;YAED,MAAM,KAAK,CAAC;QACf,CAAC;IACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../src/flags/lock.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;;CAKvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock.js","sourceRoot":"","sources":["../../src/flags/lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,CAAC,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC;QACjB,WAAW,EAAE,6CAA6C;QAC1D,OAAO,EAAE,KAAK;KAChB,CAAC;CACJ,CAAC"}
|
package/dist/flags/scope.d.ts
CHANGED
|
@@ -1,20 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import type { ConfigScope } from '@a1st/aix-schema';
|
|
2
|
+
export declare const VALID_SECTIONS: readonly ["rules", "prompts", "mcp", "skills", "editors"];
|
|
3
|
+
export type Section = (typeof VALID_SECTIONS)[number];
|
|
3
4
|
/**
|
|
4
|
-
* Reusable --
|
|
5
|
-
*
|
|
5
|
+
* Reusable --only flag for filtering commands by config section.
|
|
6
|
+
* Replaces the old --scope flag (which now means user/project).
|
|
6
7
|
*/
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
8
|
+
export declare const onlyFlag: {
|
|
9
|
+
only: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
|
-
* Parse and validate
|
|
12
|
+
* Parse and validate --only flags, returning all sections if none specified.
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseSections(flags: {
|
|
15
|
+
only?: string[];
|
|
16
|
+
}): Section[];
|
|
17
|
+
/**
|
|
18
|
+
* Check if a section is included in the filter.
|
|
19
|
+
*/
|
|
20
|
+
export declare function includesSection(sections: Section[], section: Section): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Reusable flags for targeting user or project scope.
|
|
23
|
+
* --scope user|project, --user/-u, --project/-p
|
|
12
24
|
*/
|
|
13
|
-
export declare
|
|
14
|
-
scope
|
|
15
|
-
|
|
25
|
+
export declare const configScopeFlags: {
|
|
26
|
+
scope: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
|
+
user: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
28
|
+
project: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
29
|
+
};
|
|
16
30
|
/**
|
|
17
|
-
*
|
|
31
|
+
* Resolve the target ConfigScope from the parsed flags.
|
|
32
|
+
* Priority: --scope > --user/--project > defaultScope.
|
|
18
33
|
*/
|
|
19
|
-
export declare function
|
|
34
|
+
export declare function resolveConfigScope(flags: {
|
|
35
|
+
scope?: string;
|
|
36
|
+
user?: boolean;
|
|
37
|
+
project?: boolean;
|
|
38
|
+
}, defaultScope?: ConfigScope): ConfigScope;
|
|
39
|
+
export declare function resolveConfigScope(flags: {
|
|
40
|
+
scope?: string;
|
|
41
|
+
user?: boolean;
|
|
42
|
+
project?: boolean;
|
|
43
|
+
}, defaultScope: undefined): ConfigScope | undefined;
|
|
44
|
+
/** @deprecated Use `onlyFlag` instead. */
|
|
45
|
+
export declare const scopeFlag: {
|
|
46
|
+
only: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
47
|
+
};
|
|
48
|
+
/** @deprecated Use `Section` instead. */
|
|
49
|
+
export type Scope = Section;
|
|
50
|
+
/** @deprecated Use `VALID_SECTIONS` instead. */
|
|
51
|
+
export declare const VALID_SCOPES: readonly ["rules", "prompts", "mcp", "skills", "editors"];
|
|
52
|
+
/** @deprecated Use `parseSections` instead. */
|
|
53
|
+
export declare const parseScopes: typeof parseSections;
|
|
54
|
+
/** @deprecated Use `includesSection` instead. */
|
|
55
|
+
export declare const includesScope: typeof includesSection;
|
|
20
56
|
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/flags/scope.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/flags/scope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD,eAAO,MAAM,cAAc,2DAA4D,CAAC;AACxF,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,QAAQ;;CAMpB,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,OAAO,EAAE,CAKnE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAE9E;AAID;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;CAkB5B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,kBAAkB,CAC/B,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,EAC5D,YAAY,CAAC,EAAE,WAAW,GAC1B,WAAW,CAAC;AACf,wBAAgB,kBAAkB,CAC/B,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,EAC5D,YAAY,EAAE,SAAS,GACvB,WAAW,GAAG,SAAS,CAAC;AAsB3B,0CAA0C;AAC1C,eAAO,MAAM,SAAS;;CAAW,CAAC;AAClC,yCAAyC;AACzC,MAAM,MAAM,KAAK,GAAG,OAAO,CAAC;AAC5B,gDAAgD;AAChD,eAAO,MAAM,YAAY,2DAAiB,CAAC;AAC3C,+CAA+C;AAC/C,eAAO,MAAM,WAAW,sBAAgB,CAAC;AACzC,iDAAiD;AACjD,eAAO,MAAM,aAAa,wBAAkB,CAAC"}
|
package/dist/flags/scope.js
CHANGED
|
@@ -1,30 +1,77 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
|
|
2
|
+
// --- Section filter (formerly --scope, now --only) ---
|
|
3
|
+
export const VALID_SECTIONS = ['rules', 'prompts', 'mcp', 'skills', 'editors'];
|
|
3
4
|
/**
|
|
4
|
-
* Reusable --
|
|
5
|
-
*
|
|
5
|
+
* Reusable --only flag for filtering commands by config section.
|
|
6
|
+
* Replaces the old --scope flag (which now means user/project).
|
|
6
7
|
*/
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
description: 'Filter to specific fields (repeatable)',
|
|
8
|
+
export const onlyFlag = {
|
|
9
|
+
only: Flags.string({
|
|
10
|
+
description: 'Filter to specific config sections (repeatable)',
|
|
11
11
|
multiple: true,
|
|
12
|
-
options: [...
|
|
12
|
+
options: [...VALID_SECTIONS],
|
|
13
13
|
}),
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* Parse and validate
|
|
16
|
+
* Parse and validate --only flags, returning all sections if none specified.
|
|
17
17
|
*/
|
|
18
|
-
export function
|
|
19
|
-
if (!flags.
|
|
20
|
-
return [...
|
|
18
|
+
export function parseSections(flags) {
|
|
19
|
+
if (!flags.only || flags.only.length === 0) {
|
|
20
|
+
return [...VALID_SECTIONS];
|
|
21
21
|
}
|
|
22
|
-
return flags.
|
|
22
|
+
return flags.only;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Check if a
|
|
25
|
+
* Check if a section is included in the filter.
|
|
26
26
|
*/
|
|
27
|
-
export function
|
|
28
|
-
return
|
|
27
|
+
export function includesSection(sections, section) {
|
|
28
|
+
return sections.includes(section);
|
|
29
|
+
}
|
|
30
|
+
// --- Config scope (user vs project) ---
|
|
31
|
+
/**
|
|
32
|
+
* Reusable flags for targeting user or project scope.
|
|
33
|
+
* --scope user|project, --user/-u, --project/-p
|
|
34
|
+
*/
|
|
35
|
+
export const configScopeFlags = {
|
|
36
|
+
scope: Flags.string({
|
|
37
|
+
char: 's',
|
|
38
|
+
description: 'Target scope for installation',
|
|
39
|
+
options: ['user', 'project'],
|
|
40
|
+
}),
|
|
41
|
+
user: Flags.boolean({
|
|
42
|
+
char: 'u',
|
|
43
|
+
description: 'Target user scope (alias for --scope user)',
|
|
44
|
+
default: false,
|
|
45
|
+
exclusive: ['project'],
|
|
46
|
+
}),
|
|
47
|
+
project: Flags.boolean({
|
|
48
|
+
char: 'p',
|
|
49
|
+
description: 'Target project scope (alias for --scope project)',
|
|
50
|
+
default: false,
|
|
51
|
+
exclusive: ['user'],
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
export function resolveConfigScope(flags, defaultScope) {
|
|
55
|
+
// Use 'user' as default only when argument is not passed at all
|
|
56
|
+
const resolvedDefault = arguments.length < 2 ? 'user' : defaultScope;
|
|
57
|
+
if (flags.scope) {
|
|
58
|
+
return flags.scope;
|
|
59
|
+
}
|
|
60
|
+
if (flags.user) {
|
|
61
|
+
return 'user';
|
|
62
|
+
}
|
|
63
|
+
if (flags.project) {
|
|
64
|
+
return 'project';
|
|
65
|
+
}
|
|
66
|
+
return resolvedDefault;
|
|
29
67
|
}
|
|
68
|
+
// --- Backward compatibility aliases ---
|
|
69
|
+
/** @deprecated Use `onlyFlag` instead. */
|
|
70
|
+
export const scopeFlag = onlyFlag;
|
|
71
|
+
/** @deprecated Use `VALID_SECTIONS` instead. */
|
|
72
|
+
export const VALID_SCOPES = VALID_SECTIONS;
|
|
73
|
+
/** @deprecated Use `parseSections` instead. */
|
|
74
|
+
export const parseScopes = parseSections;
|
|
75
|
+
/** @deprecated Use `includesSection` instead. */
|
|
76
|
+
export const includesScope = includesSection;
|
|
30
77
|
//# sourceMappingURL=scope.js.map
|
package/dist/flags/scope.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/flags/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/flags/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,wDAAwD;AAExD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAC;AAGxF;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;QAChB,WAAW,EAAE,iDAAiD;QAC9D,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC,GAAG,cAAc,CAAC;KAC9B,CAAC;CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,aA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M,CAAC;IACjB,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACpB,CAAC;IACD,OAAO,eAAe,CAAC;AAC1B,CAAC;AAED,yCAAyC;AAEzC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC;AAGlC,gDAAgD;AAChD,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAC;AAC3C,+CAA+C;AAC/C,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AACzC,iDAAiD;AACjD,MAAM,CAAC,MAAM,aAAa,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ConfigSection, type LoadedConfig } from '@a1st/aix-core';
|
|
2
|
+
import type { Package } from '@a1st/mcp-registry-client';
|
|
3
|
+
import type { ConfigScope, McpServerConfig } from '@a1st/aix-schema';
|
|
4
|
+
import type { Output } from './output.js';
|
|
5
|
+
export interface PersistAddedItemOptions {
|
|
6
|
+
loaded?: LoadedConfig;
|
|
7
|
+
local: boolean;
|
|
8
|
+
output: Pick<Output, 'info' | 'success'>;
|
|
9
|
+
localSuccessMessage: string;
|
|
10
|
+
projectSuccessMessage: string;
|
|
11
|
+
saveLocal: (path: string) => Promise<void>;
|
|
12
|
+
saveProject: (path: string) => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export interface InstallAddedItemOptions {
|
|
15
|
+
logInstallResults: (results: Array<{
|
|
16
|
+
message: string;
|
|
17
|
+
success: boolean;
|
|
18
|
+
}>) => void;
|
|
19
|
+
skipInstall: boolean;
|
|
20
|
+
loaded?: LoadedConfig;
|
|
21
|
+
local: boolean;
|
|
22
|
+
installSections: ConfigSection[];
|
|
23
|
+
itemSection: ConfigSection;
|
|
24
|
+
itemName: string;
|
|
25
|
+
itemValue: unknown;
|
|
26
|
+
scope: ConfigScope;
|
|
27
|
+
projectRoot: string;
|
|
28
|
+
}
|
|
29
|
+
export declare function persistAddedItem(options: PersistAddedItemOptions): Promise<void>;
|
|
30
|
+
export declare function refreshLockfileAfterAdd(shouldRefresh: boolean, lockableConfigPath: string | undefined, output: Pick<Output, 'success'>): Promise<string | undefined>;
|
|
31
|
+
export declare function installAddedItem(options: InstallAddedItemOptions): Promise<void>;
|
|
32
|
+
export declare function findCompatibleNpmPackage(packages: Package[] | null | undefined): Package | undefined;
|
|
33
|
+
export declare function buildMcpServerConfig(pkg: Package): McpServerConfig;
|
|
34
|
+
//# sourceMappingURL=add-command-helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-command-helper.d.ts","sourceRoot":"","sources":["../../src/lib/add-command-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,uBAAuB;IACrC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,uBAAuB;IACrC,iBAAiB,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IACnF,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,eAAe,EAAE,aAAa,EAAE,CAAC;IACjC,WAAW,EAAE,aAAa,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACtB;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BtF;AAED,wBAAsB,uBAAuB,CAC1C,aAAa,EAAE,OAAO,EACtB,kBAAkB,EAAE,MAAM,GAAG,SAAS,EACtC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,GAC/B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAS7B;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmCtF;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAMpG;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAmBlE"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { getLocalConfigPath } from '@a1st/aix-core';
|
|
2
|
+
import { refreshLockfile } from './lockfile-helper.js';
|
|
3
|
+
import { formatInstallResults, installAfterAdd, installSingleItem } from './install-helper.js';
|
|
4
|
+
export async function persistAddedItem(options) {
|
|
5
|
+
const { loaded, local, output, localSuccessMessage, projectSuccessMessage, saveLocal, saveProject, } = options;
|
|
6
|
+
if (local) {
|
|
7
|
+
const localPath = loaded ? getLocalConfigPath(loaded.path) : 'ai.local.json';
|
|
8
|
+
await saveLocal(localPath);
|
|
9
|
+
output.success(localSuccessMessage);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (loaded) {
|
|
13
|
+
await saveProject(loaded.path);
|
|
14
|
+
output.success(projectSuccessMessage);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
output.info('No ai.json found — installing directly to editors');
|
|
18
|
+
}
|
|
19
|
+
export async function refreshLockfileAfterAdd(shouldRefresh, lockableConfigPath, output) {
|
|
20
|
+
if (!shouldRefresh || !lockableConfigPath) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
const lockfilePath = await refreshLockfile(lockableConfigPath);
|
|
24
|
+
output.success(`Updated ${lockfilePath}`);
|
|
25
|
+
return lockfilePath;
|
|
26
|
+
}
|
|
27
|
+
export async function installAddedItem(options) {
|
|
28
|
+
const { logInstallResults, skipInstall, loaded, local, installSections, itemSection, itemName, itemValue, scope, projectRoot, } = options;
|
|
29
|
+
if (skipInstall) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const installResult = loaded && !local
|
|
33
|
+
? await installAfterAdd({
|
|
34
|
+
configPath: loaded.path,
|
|
35
|
+
sections: installSections,
|
|
36
|
+
scope,
|
|
37
|
+
})
|
|
38
|
+
: await installSingleItem({
|
|
39
|
+
section: itemSection,
|
|
40
|
+
name: itemName,
|
|
41
|
+
value: itemValue,
|
|
42
|
+
scope,
|
|
43
|
+
projectRoot,
|
|
44
|
+
});
|
|
45
|
+
if (installResult.installed) {
|
|
46
|
+
logInstallResults(formatInstallResults(installResult.results));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function findCompatibleNpmPackage(packages) {
|
|
50
|
+
if (!packages) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
return packages.find((pkg) => pkg.registryType === 'npm' && pkg.transport.type === 'stdio');
|
|
54
|
+
}
|
|
55
|
+
export function buildMcpServerConfig(pkg) {
|
|
56
|
+
const env = {};
|
|
57
|
+
for (const envVar of pkg.environmentVariables ?? []) {
|
|
58
|
+
if (envVar.default) {
|
|
59
|
+
env[envVar.name] = envVar.default;
|
|
60
|
+
}
|
|
61
|
+
else if (envVar.isRequired) {
|
|
62
|
+
env[envVar.name] = envVar.isSecret ? '<YOUR_SECRET>' : '<REQUIRED>';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return Object.keys(env).length > 0
|
|
66
|
+
? {
|
|
67
|
+
command: `npx ${pkg.identifier}${pkg.version ? `@${pkg.version}` : ''}`,
|
|
68
|
+
env,
|
|
69
|
+
}
|
|
70
|
+
: {
|
|
71
|
+
command: `npx ${pkg.identifier}${pkg.version ? `@${pkg.version}` : ''}`,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=add-command-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-command-helper.js","sourceRoot":"","sources":["../../src/lib/add-command-helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAyC,MAAM,gBAAgB,CAAC;AAG3F,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AA0B/F,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAgC;IACpE,MAAM,EACH,MAAM,EACN,KAAK,EACL,MAAM,EACN,mBAAmB,EACnB,qBAAqB,EACrB,SAAS,EACT,WAAW,GACb,GAAG,OAAO,CAAC;IAEZ,IAAI,KAAK,EAAE,CAAC;QACT,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;QAE7E,MAAM,SAAS,CAAC,SAAS,CAAC,CAAC;QAC3B,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QACpC,OAAO;IACV,CAAC;IAED,IAAI,M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@ -2,6 +2,7 @@ export interface AddSkillOptions {
|
|
|
2
2
|
configPath: string;
|
|
3
3
|
name: string;
|
|
4
4
|
source: string;
|
|
5
|
+
ref?: string;
|
|
5
6
|
skipInstall?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export interface AddMcpOptions {
|
|
@@ -15,8 +16,7 @@ export interface AddResult {
|
|
|
15
16
|
error?: string;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
|
-
* Add a skill to ai.json programmatically.
|
|
19
|
-
* For npm packages, the source should be the package name (e.g., "aix-skill-typescript" or just "typescript").
|
|
19
|
+
* Add a skill to ai.json programmatically using aix-native source parsing.
|
|
20
20
|
*/
|
|
21
21
|
export declare function addSkill(options: AddSkillOptions): Promise<AddResult>;
|
|
22
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-helper.d.ts","sourceRoot":"","sources":["../../src/lib/add-helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-helper.d.ts","sourceRoot":"","sources":["../../src/lib/add-helper.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,eAAe;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,SAAS;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,SAAS,CAAC,CAyC3E;AAED;;GAEG;AACH,wBAAsB,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