@aopslabs/aops 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/LICENSE +19 -0
- package/NOTICE +7 -0
- package/README.md +203 -0
- package/assets/agent-assets/core/SKILL.md +49 -0
- package/assets/agent-assets/core/references/agentspace/SKILL.md +78 -0
- package/assets/agent-assets/core/references/aops-cli-core/SKILL.md +108 -0
- package/assets/agent-assets/core/references/chatv3/SKILL.md +48 -0
- package/assets/agent-assets/core/references/collaborative-work/SKILL.md +85 -0
- package/assets/agent-assets/core/references/discuss/SKILL.md +66 -0
- package/assets/agent-assets/core/references/docman/SKILL.md +69 -0
- package/assets/agent-assets/core/references/hosted-chat/SKILL.md +64 -0
- package/assets/agent-assets/core/references/mission/SKILL.md +54 -0
- package/assets/agent-assets/core/references/projectman/SKILL.md +86 -0
- package/assets/agent-assets/core/references/sys/SKILL.md +36 -0
- package/assets/agent-assets/core/references/view/SKILL.md +58 -0
- package/assets/agent-assets/core/references/working-disciplines/SKILL.md +69 -0
- package/assets/agent-assets/core/user-guides/agent-assets.md +81 -0
- package/assets/agent-assets/core/user-guides/agentspace.md +1098 -0
- package/assets/agent-assets/core/user-guides/aops-cli.md +1107 -0
- package/assets/agent-assets/core/user-guides/aops-system.md +63 -0
- package/assets/agent-assets/core/user-guides/chatv3.md +113 -0
- package/assets/agent-assets/core/user-guides/docman.md +162 -0
- package/assets/agent-assets/core/user-guides/projectman.md +212 -0
- package/assets/agent-assets/core/user-guides/sys.md +94 -0
- package/assets/agent-assets/core/user-guides/working-disciplines.md +588 -0
- package/assets/agent-assets/gateway/aops/SKILL.md +14 -0
- package/assets/r6-remote-session-baseline.json +19 -0
- package/assets/skills/aops-install/SKILL.md +231 -0
- package/assets/skills/aops-install/agents/openai.yaml +4 -0
- package/dist/commands/activity.js +352 -0
- package/dist/commands/agent-profile.js +653 -0
- package/dist/commands/agent.js +710 -0
- package/dist/commands/agents-md.js +125 -0
- package/dist/commands/api.js +84 -0
- package/dist/commands/archive.js +873 -0
- package/dist/commands/artifact.js +535 -0
- package/dist/commands/assets.js +1414 -0
- package/dist/commands/auth/device-login.js +1 -0
- package/dist/commands/auth/legacy-export.js +177 -0
- package/dist/commands/auth/login.js +426 -0
- package/dist/commands/chat.js +1363 -0
- package/dist/commands/chatv3.js +1684 -0
- package/dist/commands/checkpoint.js +549 -0
- package/dist/commands/commercial-artifact.js +475 -0
- package/dist/commands/commercial-license.js +594 -0
- package/dist/commands/community-auth.js +62 -0
- package/dist/commands/community-cockpit.js +185 -0
- package/dist/commands/community-console.js +109 -0
- package/dist/commands/community-doctor.js +335 -0
- package/dist/commands/community-server.js +2062 -0
- package/dist/commands/community-setup.js +284 -0
- package/dist/commands/discuss.js +1448 -0
- package/dist/commands/doc.js +5219 -0
- package/dist/commands/experience.js +922 -0
- package/dist/commands/host.js +1127 -0
- package/dist/commands/init.js +118 -0
- package/dist/commands/memory.js +3129 -0
- package/dist/commands/mission.js +562 -0
- package/dist/commands/official-catalog.js +134 -0
- package/dist/commands/plan.js +84 -0
- package/dist/commands/playbook.js +415 -0
- package/dist/commands/pm/context.js +6 -0
- package/dist/commands/pm/index.js +701 -0
- package/dist/commands/pm/projectman.js +6266 -0
- package/dist/commands/project.js +1080 -0
- package/dist/commands/prompt.js +1024 -0
- package/dist/commands/repo-sync.js +1907 -0
- package/dist/commands/resource.js +527 -0
- package/dist/commands/skill.js +1211 -0
- package/dist/commands/start-disciplines.js +510 -0
- package/dist/commands/start.js +1343 -0
- package/dist/commands/target.js +309 -0
- package/dist/commands/version.js +42 -0
- package/dist/commands/view.js +1852 -0
- package/dist/launchers/cockpit.js +28 -0
- package/dist/launchers/options.js +74 -0
- package/dist/launchers/server.js +41 -0
- package/dist/lib/agent-assets/envelope.js +83 -0
- package/dist/lib/agent-assets/gateway.js +15 -0
- package/dist/lib/agent-assets/guards.js +23 -0
- package/dist/lib/agent-assets/hosted-discovery.js +148 -0
- package/dist/lib/agent-assets/hosted-package-input.js +154 -0
- package/dist/lib/agent-assets/legacy-pointer-migration.js +677 -0
- package/dist/lib/agent-assets/native-fs.js +589 -0
- package/dist/lib/agent-assets/package-manifest.js +324 -0
- package/dist/lib/agent-assets/portable-path.js +67 -0
- package/dist/lib/agent-assets/release-input.js +177 -0
- package/dist/lib/agent-assets/roots.js +45 -0
- package/dist/lib/agent-assets/runtime-binding-reader.js +545 -0
- package/dist/lib/agent-assets/runtime-targets.js +50 -0
- package/dist/lib/agent-assets/store-reader.js +1212 -0
- package/dist/lib/agent-assets/store-types.js +1 -0
- package/dist/lib/agent-assets/store-writer.js +1484 -0
- package/dist/lib/agent-assets/types.js +1 -0
- package/dist/lib/agent-assets/unicode-case-folding-v15-1.generated.js +1548 -0
- package/dist/lib/commercial-final-readiness.js +504 -0
- package/dist/lib/commercial-lifecycle-smoke-isolation.js +236 -0
- package/dist/lib/commercial-managed-postgres-docker-adapter.js +274 -0
- package/dist/lib/commercial-setup-readiness-adapter.js +179 -0
- package/dist/lib/community-client-contract.js +164 -0
- package/dist/lib/community-cockpit-lifecycle.js +601 -0
- package/dist/lib/community-command-abort.js +59 -0
- package/dist/lib/community-diagnostic.js +237 -0
- package/dist/lib/community-docker-adapter.js +498 -0
- package/dist/lib/community-home.js +31 -0
- package/dist/lib/community-instance-contract.js +148 -0
- package/dist/lib/community-instance-layout.js +97 -0
- package/dist/lib/community-lifecycle.js +1631 -0
- package/dist/lib/community-migration-snapshot.js +770 -0
- package/dist/lib/community-native-application-recovery.js +425 -0
- package/dist/lib/community-native-child.js +240 -0
- package/dist/lib/community-native-database-recovery.js +456 -0
- package/dist/lib/community-native-lifecycle.js +2458 -0
- package/dist/lib/community-native-migration.js +339 -0
- package/dist/lib/community-native-postgres.js +596 -0
- package/dist/lib/community-operation-journal.js +773 -0
- package/dist/lib/community-operation-lock.js +596 -0
- package/dist/lib/community-release-resolver.js +291 -0
- package/dist/lib/community-release-verifier.js +475 -0
- package/dist/lib/community-repo-discovery.js +252 -0
- package/dist/lib/community-setup-server-env.js +203 -0
- package/dist/lib/external-url.js +110 -0
- package/dist/lib/official-catalog-gateway.js +108 -0
- package/dist/lib/official-catalog.js +364 -0
- package/dist/lib/server-bootstrap.js +240 -0
- package/dist/lib/setup-agent-assets-bridge.js +176 -0
- package/dist/lib/setup-agent-assets-release.js +52 -0
- package/dist/lib/setup-external-postgres.js +108 -0
- package/dist/lib/setup-init-orchestrator.js +990 -0
- package/dist/lib/setup-install-guide.js +52 -0
- package/dist/lib/setup-installer-release.js +47 -0
- package/dist/lib/setup-local-postgres.js +329 -0
- package/dist/lib/setup-official-catalog-bridge.js +148 -0
- package/dist/lib/setup-readiness.js +888 -0
- package/dist/lib/tui-launcher.js +59 -0
- package/dist/main.js +150 -0
- package/dist/seeds/agents-md.js +54 -0
- package/dist/utils/agent-gateway.js +275 -0
- package/dist/utils/agents-md.js +281 -0
- package/dist/utils/api.js +255 -0
- package/dist/utils/chatv3-session-store.js +185 -0
- package/dist/utils/command.js +67 -0
- package/dist/utils/community-host-runtime.js +376 -0
- package/dist/utils/config.js +1015 -0
- package/dist/utils/discussion-workspace.js +552 -0
- package/dist/utils/experience-workspace.js +326 -0
- package/dist/utils/guide-paths.js +67 -0
- package/dist/utils/hosted-sugar.js +56 -0
- package/dist/utils/hosted-workspace.js +229 -0
- package/dist/utils/memory-workspace.js +537 -0
- package/dist/utils/operator-runtime.js +199 -0
- package/dist/utils/password-crypto.js +39 -0
- package/dist/utils/playbook-workspace.js +479 -0
- package/dist/utils/project-context.js +255 -0
- package/dist/utils/prompts.js +70 -0
- package/dist/utils/refresh-race.js +28 -0
- package/dist/utils/repo-config.js +109 -0
- package/dist/utils/repo-first-projectman.js +194 -0
- package/dist/utils/repo-first-storage.js +13 -0
- package/dist/utils/repo-first-view.js +305 -0
- package/dist/utils/session-guidance.js +278 -0
- package/dist/utils/session-state.js +137 -0
- package/dist/utils/table.js +39 -0
- package/dist/utils/transient-fs.js +49 -0
- package/dist/utils/workspace-root.js +1 -0
- package/launchers/aops-cockpit.ps1 +15 -0
- package/launchers/aops-cockpit.sh +16 -0
- package/launchers/aops-server.ps1 +15 -0
- package/launchers/aops-server.sh +16 -0
- package/native/tui/win32-x64/aops-tui.exe +0 -0
- package/package.json +81 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { banner, logInfo } from '@aopslabs/xf-cli-ui';
|
|
3
|
+
import { makeOfficialCatalogSetupCommand } from './official-catalog.js';
|
|
4
|
+
import { runSetupInitOrchestrator, } from '../lib/setup-init-orchestrator.js';
|
|
5
|
+
import { runCommunitySetupServerEnv, runCommunitySetupServerEnvConnectionTest, } from '../lib/community-setup-server-env.js';
|
|
6
|
+
import { createSetupOfficialCatalogProviderV1 } from '../lib/setup-official-catalog-bridge.js';
|
|
7
|
+
import { createSetupAgentAssetsProvider } from '../lib/setup-agent-assets-bridge.js';
|
|
8
|
+
import { buildAopsInstallAgentPrompt, loadAopsInstallSkill, } from '../lib/setup-install-guide.js';
|
|
9
|
+
import { promptSelect } from '../utils/prompts.js';
|
|
10
|
+
const COMMUNITY_SETUP_HOME = `AOPS Setup — choose how to begin
|
|
11
|
+
Install interactively aops setup init
|
|
12
|
+
Set up with an AI agent aops setup ai
|
|
13
|
+
Inspect readiness aops setup init --yes --json
|
|
14
|
+
Agent install skill aops setup guide
|
|
15
|
+
Configure PostgreSQL aops setup server-env
|
|
16
|
+
Help: aops setup --help
|
|
17
|
+
`;
|
|
18
|
+
export function runCommunitySetupGuide(options = {}) {
|
|
19
|
+
if (options.json && options.path)
|
|
20
|
+
throw new Error('setup_guide_selector_conflict:choose_--json_or_--path');
|
|
21
|
+
const skill = loadAopsInstallSkill();
|
|
22
|
+
if (options.path) {
|
|
23
|
+
process.stdout.write(`${skill.path}\n`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (options.json) {
|
|
27
|
+
process.stdout.write(`${JSON.stringify({
|
|
28
|
+
schemaVersion: 1,
|
|
29
|
+
command: 'setup.guide',
|
|
30
|
+
ok: true,
|
|
31
|
+
skill: {
|
|
32
|
+
name: skill.name,
|
|
33
|
+
path: skill.path,
|
|
34
|
+
sha256: skill.sha256,
|
|
35
|
+
content: skill.content,
|
|
36
|
+
},
|
|
37
|
+
nextCommand: 'aops setup init --yes --json',
|
|
38
|
+
aiCommand: 'aops setup ai',
|
|
39
|
+
}, null, 2)}\n`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
process.stdout.write(skill.content.endsWith('\n') ? skill.content : `${skill.content}\n`);
|
|
43
|
+
}
|
|
44
|
+
export function runCommunitySetupAi(options = {}) {
|
|
45
|
+
const skill = loadAopsInstallSkill();
|
|
46
|
+
const prompt = buildAopsInstallAgentPrompt();
|
|
47
|
+
if (options.json) {
|
|
48
|
+
process.stdout.write(`${JSON.stringify({
|
|
49
|
+
schemaVersion: 1,
|
|
50
|
+
command: 'setup.ai',
|
|
51
|
+
ok: true,
|
|
52
|
+
prompt,
|
|
53
|
+
skill: {
|
|
54
|
+
name: skill.name,
|
|
55
|
+
path: skill.path,
|
|
56
|
+
sha256: skill.sha256,
|
|
57
|
+
},
|
|
58
|
+
nextCommand: 'aops setup init --yes --json',
|
|
59
|
+
}, null, 2)}\n`);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
banner('AOPS Setup with AI');
|
|
63
|
+
logInfo('Copy the prompt below to Codex, Claude, or another terminal AI agent.');
|
|
64
|
+
logInfo('Enter database secrets only in AOPS masked prompts; never paste them into chat.');
|
|
65
|
+
process.stdout.write(`\n--- copy from here ---\n${prompt}\n--- end prompt ---\n`);
|
|
66
|
+
}
|
|
67
|
+
export async function runCommunitySetupInit(options = {}) {
|
|
68
|
+
return runSetupInitOrchestrator(options, {
|
|
69
|
+
setupServerEnv: runCommunitySetupServerEnv,
|
|
70
|
+
agentAssets: createSetupAgentAssetsProvider(),
|
|
71
|
+
officialCatalog: createSetupOfficialCatalogProviderV1(),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export async function runCommunitySetupMenu() {
|
|
75
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
76
|
+
process.stdout.write(COMMUNITY_SETUP_HOME);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
banner('AOPS Setup');
|
|
80
|
+
logInfo('Install here, or hand a safe setup prompt to any terminal AI agent.');
|
|
81
|
+
logInfo('Enter database secrets only in masked AOPS prompts; never paste them into chat.');
|
|
82
|
+
while (true) {
|
|
83
|
+
const action = await promptSelect({
|
|
84
|
+
message: 'How do you want to continue?',
|
|
85
|
+
type: process.env.AOPS_CLI_MENU_STYLE?.toLowerCase() === 'rawlist' ? 'rawlist' : 'select',
|
|
86
|
+
pageSize: 6,
|
|
87
|
+
choices: [
|
|
88
|
+
{ name: 'Install AOPS interactively', value: 'install' },
|
|
89
|
+
{ name: 'Set up with an AI agent', value: 'ai' },
|
|
90
|
+
{ name: 'Inspect setup readiness', value: 'inspect' },
|
|
91
|
+
{ name: 'Configure PostgreSQL connection', value: 'server-env' },
|
|
92
|
+
{ name: 'Show packaged agent installation skill', value: 'guide' },
|
|
93
|
+
{ name: 'Exit', value: 'exit' },
|
|
94
|
+
],
|
|
95
|
+
});
|
|
96
|
+
if (action === 'exit')
|
|
97
|
+
return;
|
|
98
|
+
if (action === 'ai') {
|
|
99
|
+
runCommunitySetupAi();
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (action === 'inspect') {
|
|
103
|
+
await runCommunitySetupInit({ yes: true });
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (action === 'server-env') {
|
|
107
|
+
await runCommunitySetupServerEnv({});
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (action === 'guide') {
|
|
111
|
+
runCommunitySetupGuide();
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
await runCommunitySetupInit({ skipBanner: true });
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function addSetupInitOptions(command) {
|
|
119
|
+
return command
|
|
120
|
+
.option('--path <path>', 'Setup path: 1 | 2 | 3 | 4 (semantic ids are also accepted)')
|
|
121
|
+
.option('--postgres-config <path>', 'PostgreSQL env file override for path 1, or private output path for path 3')
|
|
122
|
+
.option('--postgres-tls <policy>', 'PostgreSQL TLS policy: disable | require | verify-full')
|
|
123
|
+
.option('--local-postgres-host <host>', 'Path 3 local PostgreSQL loopback host (default: 127.0.0.1)')
|
|
124
|
+
.option('--local-postgres-port <port>', 'Path 3 local PostgreSQL port (default: 5432)', (value) => Number.parseInt(String(value), 10))
|
|
125
|
+
.option('--local-postgres-admin-user <user>', 'Path 3 existing PostgreSQL administrator role')
|
|
126
|
+
.option('--local-postgres-database <name>', 'Path 3 new AOPS database name')
|
|
127
|
+
.option('--local-postgres-app-user <user>', 'Path 3 new dedicated AOPS application role')
|
|
128
|
+
.option('--local-postgres-admin-no-password', 'Path 3 non-interactive local trust auth; never bypasses PostgreSQL authentication')
|
|
129
|
+
.option('--api-base-url <url>', 'Local or existing-server API base URL without credentials')
|
|
130
|
+
.option('--instance <name>', 'Local Community instance name')
|
|
131
|
+
.option('--data-root <path>', 'Local Community data root override')
|
|
132
|
+
.option('--source-root <path>', 'Optional native Community source checkout override; npm server package is the default')
|
|
133
|
+
.option('--port <port>', 'Local server port', (value) => Number.parseInt(String(value), 10))
|
|
134
|
+
.option('--auth <provider>', 'Local server auth: trusted-local (paths 1-3)')
|
|
135
|
+
.option('--exposure <mode>', 'Local server exposure: loopback (paths 1-3)')
|
|
136
|
+
.option('--target-name <name>', 'Persistent target name for path 4')
|
|
137
|
+
.option('--target-auth-provider <provider>', 'Path 4 target auth: trusted-local | remote-session (authv2-jwt-session is a one-release alias)')
|
|
138
|
+
.option('--target-tls-policy <policy>', 'Path 4 target TLS: loopback-http for local trusted targets, system-ca for remote-session')
|
|
139
|
+
.option('--agent-assets <action>', 'Global AOPS gateway action: status | install | repair | skip')
|
|
140
|
+
.option('--agent-assets-release <path>', 'Advanced offline/maintainer override for --agent-assets install')
|
|
141
|
+
.option('--no-catalog', 'Skip the default inert official server catalog import')
|
|
142
|
+
.option('--catalog-release <path>', 'Explicit verified-release override (normally resolved from the Community install)')
|
|
143
|
+
.option('--catalog-idempotency-key <key>', 'Explicit official catalog reconcile replay key')
|
|
144
|
+
.option('--plan-id <sha256>', 'Apply only if the current mutation-free installer plan still has this exact identity')
|
|
145
|
+
.option('--apply', 'Apply the selected path in non-interactive or scripted use (interactive setup applies directly)')
|
|
146
|
+
.option('--resume', 'Resume the same idempotent setup orchestration')
|
|
147
|
+
.option('--timeout-ms <ms>', 'Read-only host probe timeout', (value) => Number.parseInt(String(value), 10))
|
|
148
|
+
.option('--yes', 'Non-interactive; report missing selections as actions')
|
|
149
|
+
.option('--json', 'Output one typed readiness or apply-result envelope');
|
|
150
|
+
}
|
|
151
|
+
export function makeCommunitySetupCommand() {
|
|
152
|
+
const command = new Command('setup')
|
|
153
|
+
.description('Inspect and bootstrap an AOPS Community installation')
|
|
154
|
+
.addHelpText('after', `
|
|
155
|
+
Agent bootstrap:
|
|
156
|
+
aops setup ai Print a copy-ready prompt for any terminal AI agent
|
|
157
|
+
aops setup guide Print the packaged agent-readable installation skill
|
|
158
|
+
aops setup guide --json Return the same guide in a structured envelope
|
|
159
|
+
`)
|
|
160
|
+
.action(async () => runCommunitySetupMenu());
|
|
161
|
+
command.addCommand(makeOfficialCatalogSetupCommand());
|
|
162
|
+
command.command('ai')
|
|
163
|
+
.description('Print a safe, copy-ready AOPS installation prompt for a terminal AI agent')
|
|
164
|
+
.option('--json', 'Return the prompt and packaged skill identity as JSON')
|
|
165
|
+
.addHelpText('after', `
|
|
166
|
+
This read-only handoff works with Codex, Claude, or another terminal agent. The
|
|
167
|
+
prompt directs the agent to the packaged install skill and keeps database
|
|
168
|
+
credentials in AOPS masked terminal prompts rather than chat or command argv.
|
|
169
|
+
`)
|
|
170
|
+
.action((options) => runCommunitySetupAi(options));
|
|
171
|
+
command.command('guide')
|
|
172
|
+
.description('Print the packaged agent-readable AOPS installation skill')
|
|
173
|
+
.option('--path', 'Print only the packaged SKILL.md path')
|
|
174
|
+
.option('--json', 'Return skill metadata and content as JSON')
|
|
175
|
+
.addHelpText('after', `
|
|
176
|
+
This command is read-only and available immediately after npm installation.
|
|
177
|
+
It explains PostgreSQL ownership, setup paths, explicit Gateway activation,
|
|
178
|
+
server health verification, and Cockpit handoff. It performs no setup itself.
|
|
179
|
+
`)
|
|
180
|
+
.action((options) => runCommunitySetupGuide(options));
|
|
181
|
+
addSetupInitOptions(command.command('init')
|
|
182
|
+
.description('Interactively install AOPS, or inspect/apply an explicit path for automation'))
|
|
183
|
+
.addHelpText('after', `
|
|
184
|
+
Examples:
|
|
185
|
+
aops setup ai
|
|
186
|
+
aops setup init
|
|
187
|
+
aops setup init --path 1 --postgres-tls require --json
|
|
188
|
+
aops setup init --path 4 --api-base-url https://aops.example.com --target-auth-provider remote-session --json
|
|
189
|
+
aops setup init --path 2 --apply --yes
|
|
190
|
+
aops setup init --path 2 --json
|
|
191
|
+
aops setup init --path 2 --plan-id sha256:<64-hex> --apply --yes --json
|
|
192
|
+
aops setup init --path 3 --apply
|
|
193
|
+
aops setup init --path 4 --api-base-url https://aops.example.com --json
|
|
194
|
+
aops setup init --path 1 --no-catalog --apply --yes
|
|
195
|
+
|
|
196
|
+
This command is distinct from repo-local \`aops init\`.
|
|
197
|
+
Path 1 uses an existing PostgreSQL connection from \`~/.aops/aops.server.env\` by default, or the directory selected by
|
|
198
|
+
\`AOPS_CLI_CONFIG_PATH\`. A relative \`AOPS_PG_SSL_ROOT_CERT\` is resolved beside
|
|
199
|
+
the selected env file. \`--postgres-config\` remains an explicit override.
|
|
200
|
+
Path 2 uses the same npm server and standard port, while AOPS creates a
|
|
201
|
+
loopback-only PostgreSQL 17 container on a collision-free Docker-assigned port.
|
|
202
|
+
Its password is generated securely by default; the interactive wizard also
|
|
203
|
+
allows a masked, confirmed custom password without placing it in shell history.
|
|
204
|
+
All PostgreSQL paths plan, apply when needed, and verify database migrations
|
|
205
|
+
before the server is reported ready. Interactive terminals show animated
|
|
206
|
+
progress and apply directly after required private inputs are collected; there
|
|
207
|
+
is no redundant continue confirmation. \`--json\` remains free
|
|
208
|
+
of spinner output. Path 1 asks for the masked PostgreSQL URL first, then tests
|
|
209
|
+
the connection with TLS \`require\` by default. A TLS-policy prompt is shown only
|
|
210
|
+
when that encrypted connection cannot be established. Choose \`verify-full\`
|
|
211
|
+
when a trusted CA file is available, or explicitly choose \`disable\` when
|
|
212
|
+
accepting an unencrypted PostgreSQL connection. Long-running setup reports its
|
|
213
|
+
runtime, connection, migration-plan, migration-apply, server-start, and health
|
|
214
|
+
stages without exposing database credentials.
|
|
215
|
+
Local Community setup is always \`trusted-local\` with \`loopback\`. Paid or
|
|
216
|
+
multi-user identity uses a separate HTTPS \`remote-session\` target through path
|
|
217
|
+
4; it is not installed into the Community server. The legacy
|
|
218
|
+
\`authv2-jwt-session\` target name is accepted only as a one-release alias.
|
|
219
|
+
Path 3 detects PostgreSQL on this computer, securely asks for an existing
|
|
220
|
+
administrator role/password, and creates a new dedicated AOPS role and database
|
|
221
|
+
before running the same migration verification. Administrator credentials are
|
|
222
|
+
never stored. For non-interactive path 3, provide the password through the
|
|
223
|
+
private \`AOPS_LOCAL_POSTGRES_ADMIN_PASSWORD\` environment variable; use
|
|
224
|
+
\`--local-postgres-admin-no-password\` only when local PostgreSQL trust auth is
|
|
225
|
+
already configured. When PostgreSQL is missing or stopped, readiness returns
|
|
226
|
+
platform-appropriate Windows, macOS, or Linux installation/start guidance.
|
|
227
|
+
The default setup installs the verified AOPS Gateway for every registered agent runtime.
|
|
228
|
+
Setup does not seed starter/demo projects, boards, tasks, sprints, or documents;
|
|
229
|
+
it reconciles only required internal catalog/runtime state. Use
|
|
230
|
+
\`--agent-assets skip\` only when explicitly desired.
|
|
231
|
+
Community agent assets use the TASK-136 \`aops assets\` contract; the
|
|
232
|
+
development-only repo-mirror installer is not part of this command.
|
|
233
|
+
Source and npm setup import only the inert signed official catalog bundled with
|
|
234
|
+
the verified Community release by default.
|
|
235
|
+
The optional application image reuses the exact npm CLI/server lifecycle
|
|
236
|
+
inside a container; it remains a distribution surface rather than another
|
|
237
|
+
interactive setup path.
|
|
238
|
+
The CLI first resolves the canonical signed release bundled with the official
|
|
239
|
+
npm package, selected source, or installed Community runtime;
|
|
240
|
+
\`--catalog-release\` is only an explicit override.
|
|
241
|
+
\`--no-catalog\` is the bare/minimal opt-out; it never removes existing rows or
|
|
242
|
+
changes the offline client core. Reconcile and rollback remain explicit under
|
|
243
|
+
\`aops setup catalog\`.
|
|
244
|
+
`)
|
|
245
|
+
.action(async (commandOptions) => {
|
|
246
|
+
const { catalog, ...options } = commandOptions;
|
|
247
|
+
await runCommunitySetupInit({ ...options, noCatalog: catalog === false });
|
|
248
|
+
});
|
|
249
|
+
command.command('server-env')
|
|
250
|
+
.description('Create or validate the private PostgreSQL/auth env for the npm server')
|
|
251
|
+
.option('--env-path <path>', 'Explicit env file override (default: ~/.aops/aops.server.env)')
|
|
252
|
+
.option('--auth <provider>', 'Saved server auth provider: trusted-local (not used with --test-connection)')
|
|
253
|
+
.option('--test-connection', 'Test a supplied or saved PostgreSQL connection without saving it')
|
|
254
|
+
.option('--postgres-tls <policy>', 'TLS policy for connection test: disable, require, or verify-full')
|
|
255
|
+
.option('--timeout-ms <milliseconds>', 'Connection test timeout (500-30000 ms)', (value) => Number(value))
|
|
256
|
+
.option('--yes', 'Non-interactive; read AOPS_PG_URL from the environment or existing file')
|
|
257
|
+
.option('--json', 'Output a secret-free JSON summary')
|
|
258
|
+
.addHelpText('after', `
|
|
259
|
+
Examples:
|
|
260
|
+
aops setup server-env
|
|
261
|
+
AOPS_PG_URL='<private-url>' aops setup server-env --yes --json
|
|
262
|
+
AOPS_PG_URL='<private-url>' aops setup server-env --auth trusted-local --yes --json
|
|
263
|
+
AOPS_PG_URL='<private-url>' aops setup server-env --test-connection --postgres-tls require --yes --json
|
|
264
|
+
aops setup server-env --test-connection --postgres-tls require --yes --json
|
|
265
|
+
|
|
266
|
+
Do not place PostgreSQL URLs or passwords in command arguments. Existing unknown
|
|
267
|
+
env keys are preserved, and updates are written atomically with owner-only access.
|
|
268
|
+
An explicit trusted-local repair removes retired local-auth assignments without
|
|
269
|
+
printing their values.
|
|
270
|
+
Connection testing is mutation-free, falls back to the saved private env file,
|
|
271
|
+
and returns a secret-free structured result.
|
|
272
|
+
`)
|
|
273
|
+
.action(async (options) => {
|
|
274
|
+
if (options.testConnection) {
|
|
275
|
+
if (options.auth) {
|
|
276
|
+
throw new Error('setup_server_env_auth_with_connection_test_refused:remove_--auth_or_--test-connection');
|
|
277
|
+
}
|
|
278
|
+
await runCommunitySetupServerEnvConnectionTest(options);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
await runCommunitySetupServerEnv(options);
|
|
282
|
+
});
|
|
283
|
+
return command;
|
|
284
|
+
}
|