Problem: the hexagonal refactor churns the backend tree for nine more phases; the UI delivery stack (web/ SPA, cmd/desktop Wails wrapper, compose/web image) must move to its own repo first so doc/layout rewrites land once on a backend-only tree. Change: - New repo git.hubris.network/dtoro/oikos-web (v0.33.0): web/, desktop/ (updateURL repointed to oikos-web releases), compose/, own CI (web + desktop jobs), own deploy script (CI-green gate, TOCTOU guard, version-tagged images, prune-to-3), own webhook receiver on :9798 + launchd unit, own compose project publishing the same 8091:80. - Cutover executed on mac-mini in order: oikos stack's web service stopped+removed, oikos-web project brought up on 8091; outer Caddy untouched (targets the published port) — serving + Authentik flow + /wails 404 quirk verified post-cutover. - Stripped from oikos: web/, cmd/desktop/, compose/web/, desktop CI workflow, ci.yml web job, Makefile ui/desktop/desktop-package/install targets, the compose web service, oikos-web from deploy.sh's fallback prune list; wails + go-keyring dropped from go.mod, vendor synced. - README / CONTRIBUTING / AGENTS.md / .agents dev+operations docs now point at the new repo; mbse + mascot design docs carry a path note. Risk: production SPA serving depends on the new pipeline now; rollback is versioned-image re-up of the old web service from a pre-split checkout (port 8091). Desktop builds installed before the split still check dtoro/oikos releases — one manual reinstall, noted in the oikos-web release notes. Verification: go vet, make test (race), make generate-check, golangci (no new findings; baseline down 400→365); post-cutover curls — localhost:8091 200, /wails/runtime.js 404, outer Caddy 302 Authentik.
192 lines
4.9 KiB
TypeScript
192 lines
4.9 KiB
TypeScript
import { EventEmitter } from 'events';
|
|
|
|
interface OptionConfig {
|
|
default?: any;
|
|
type?: any[];
|
|
}
|
|
declare class Option {
|
|
rawName: string;
|
|
description: string;
|
|
/** Option name */
|
|
name: string;
|
|
/** Option name and aliases */
|
|
names: string[];
|
|
isBoolean?: boolean;
|
|
required?: boolean;
|
|
config: OptionConfig;
|
|
negated: boolean;
|
|
constructor(rawName: string, description: string, config?: OptionConfig);
|
|
}
|
|
|
|
interface CommandArg {
|
|
required: boolean;
|
|
value: string;
|
|
variadic: boolean;
|
|
}
|
|
interface HelpSection {
|
|
title?: string;
|
|
body: string;
|
|
}
|
|
interface CommandConfig {
|
|
allowUnknownOptions?: boolean;
|
|
ignoreOptionDefaultValue?: boolean;
|
|
}
|
|
declare type HelpCallback = (sections: HelpSection[]) => void | HelpSection[];
|
|
declare type CommandExample = ((bin: string) => string) | string;
|
|
declare class Command {
|
|
rawName: string;
|
|
description: string;
|
|
config: CommandConfig;
|
|
cli: CAC;
|
|
options: Option[];
|
|
aliasNames: string[];
|
|
name: string;
|
|
args: CommandArg[];
|
|
commandAction?: (...args: any[]) => any;
|
|
usageText?: string;
|
|
versionNumber?: string;
|
|
examples: CommandExample[];
|
|
helpCallback?: HelpCallback;
|
|
globalCommand?: GlobalCommand;
|
|
constructor(rawName: string, description: string, config: CommandConfig, cli: CAC);
|
|
usage(text: string): this;
|
|
allowUnknownOptions(): this;
|
|
ignoreOptionDefaultValue(): this;
|
|
version(version: string, customFlags?: string): this;
|
|
example(example: CommandExample): this;
|
|
/**
|
|
* Add a option for this command
|
|
* @param rawName Raw option name(s)
|
|
* @param description Option description
|
|
* @param config Option config
|
|
*/
|
|
option(rawName: string, description: string, config?: OptionConfig): this;
|
|
alias(name: string): this;
|
|
action(callback: (...args: any[]) => any): this;
|
|
/**
|
|
* Check if a command name is matched by this command
|
|
* @param name Command name
|
|
*/
|
|
isMatched(name: string): boolean;
|
|
get isDefaultCommand(): boolean;
|
|
get isGlobalCommand(): boolean;
|
|
/**
|
|
* Check if an option is registered in this command
|
|
* @param name Option name
|
|
*/
|
|
hasOption(name: string): Option | undefined;
|
|
outputHelp(): void;
|
|
outputVersion(): void;
|
|
checkRequiredArgs(): void;
|
|
/**
|
|
* Check if the parsed options contain any unknown options
|
|
*
|
|
* Exit and output error when true
|
|
*/
|
|
checkUnknownOptions(): void;
|
|
/**
|
|
* Check if the required string-type options exist
|
|
*/
|
|
checkOptionValue(): void;
|
|
}
|
|
declare class GlobalCommand extends Command {
|
|
constructor(cli: CAC);
|
|
}
|
|
|
|
interface ParsedArgv {
|
|
args: ReadonlyArray<string>;
|
|
options: {
|
|
[k: string]: any;
|
|
};
|
|
}
|
|
declare class CAC extends EventEmitter {
|
|
/** The program name to display in help and version message */
|
|
name: string;
|
|
commands: Command[];
|
|
globalCommand: GlobalCommand;
|
|
matchedCommand?: Command;
|
|
matchedCommandName?: string;
|
|
/**
|
|
* Raw CLI arguments
|
|
*/
|
|
rawArgs: string[];
|
|
/**
|
|
* Parsed CLI arguments
|
|
*/
|
|
args: ParsedArgv['args'];
|
|
/**
|
|
* Parsed CLI options, camelCased
|
|
*/
|
|
options: ParsedArgv['options'];
|
|
showHelpOnExit?: boolean;
|
|
showVersionOnExit?: boolean;
|
|
/**
|
|
* @param name The program name to display in help and version message
|
|
*/
|
|
constructor(name?: string);
|
|
/**
|
|
* Add a global usage text.
|
|
*
|
|
* This is not used by sub-commands.
|
|
*/
|
|
usage(text: string): this;
|
|
/**
|
|
* Add a sub-command
|
|
*/
|
|
command(rawName: string, description?: string, config?: CommandConfig): Command;
|
|
/**
|
|
* Add a global CLI option.
|
|
*
|
|
* Which is also applied to sub-commands.
|
|
*/
|
|
option(rawName: string, description: string, config?: OptionConfig): this;
|
|
/**
|
|
* Show help message when `-h, --help` flags appear.
|
|
*
|
|
*/
|
|
help(callback?: HelpCallback): this;
|
|
/**
|
|
* Show version number when `-v, --version` flags appear.
|
|
*
|
|
*/
|
|
version(version: string, customFlags?: string): this;
|
|
/**
|
|
* Add a global example.
|
|
*
|
|
* This example added here will not be used by sub-commands.
|
|
*/
|
|
example(example: CommandExample): this;
|
|
/**
|
|
* Output the corresponding help message
|
|
* When a sub-command is matched, output the help message for the command
|
|
* Otherwise output the global one.
|
|
*
|
|
*/
|
|
outputHelp(): void;
|
|
/**
|
|
* Output the version number.
|
|
*
|
|
*/
|
|
outputVersion(): void;
|
|
private setParsedInfo;
|
|
unsetMatchedCommand(): void;
|
|
/**
|
|
* Parse argv
|
|
*/
|
|
parse(argv?: string[], {
|
|
/** Whether to run the action for matched command */
|
|
run, }?: {
|
|
run?: boolean | undefined;
|
|
}): ParsedArgv;
|
|
private mri;
|
|
runMatchedCommand(): any;
|
|
}
|
|
|
|
/**
|
|
* @param name The program name to display in help and version message
|
|
*/
|
|
declare const cac: (name?: string) => CAC;
|
|
|
|
export default cac;
|
|
export { CAC, Command, cac };
|