wabachi 0.2.0 → 0.2.1
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/.codex-plugin/plugin.json +6 -0
- package/LICENSE +1 -1
- package/README.md +12 -21
- package/dist/architecture/cli.js +5 -5
- package/dist/architecture/cli.js.map +1 -1
- package/dist/cli.js +53 -14
- package/dist/cli.js.map +1 -1
- package/dist/command-contract.d.ts +77 -0
- package/dist/command-contract.js +193 -0
- package/dist/command-contract.js.map +1 -0
- package/dist/skill.d.ts +47 -0
- package/dist/skill.js +160 -0
- package/dist/skill.js.map +1 -0
- package/docs/USAGE.md +110 -0
- package/package.json +5 -2
- package/skills/wabachi/SKILL.md +30 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./docs/assets/readme/wabachi-hero.webp" alt="WABACHI — Repository Semantic Authority." width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
<p align="center">
|
|
2
6
|
<a href="https://github.com/yohn-jp/wabachi/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/yohn-jp/wabachi/actions/workflows/ci.yml/badge.svg"></a>
|
|
3
7
|
<a href="https://www.npmjs.com/package/wabachi"><img alt="npm" src="https://img.shields.io/npm/v/wabachi"></a>
|
|
@@ -28,33 +32,20 @@ For an ephemeral invocation:
|
|
|
28
32
|
npx --yes wabachi --help
|
|
29
33
|
```
|
|
30
34
|
|
|
31
|
-
##
|
|
32
|
-
|
|
33
|
-
Run the registered repository-analysis providers:
|
|
35
|
+
## Start here
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
```
|
|
37
|
+
Read the [practical usage manual](./docs/USAGE.md) for repository analysis,
|
|
38
|
+
provider matrices, retained outputs, and Architecture Canon workflows.
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
Use live discovery for the installed surface:
|
|
40
41
|
|
|
41
42
|
```bash
|
|
42
|
-
wabachi
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Validate an Architecture Canon document:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
wabachi architecture validate <file>
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Render an Architecture Canon site:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
wabachi architecture render <file> --out <dir>
|
|
43
|
+
wabachi --help
|
|
44
|
+
wabachi skill
|
|
55
45
|
```
|
|
56
46
|
|
|
57
|
-
|
|
47
|
+
The bundled agent Skill is available at `skills/wabachi/SKILL.md`; npm
|
|
48
|
+
installation ships it as documentation and does not activate a plugin.
|
|
58
49
|
|
|
59
50
|
## Analysis model
|
|
60
51
|
|
package/dist/architecture/cli.js
CHANGED
|
@@ -4,15 +4,15 @@ import { parseCanonicalArchitectureDocument } from "./canon/codec.js";
|
|
|
4
4
|
import { projectArchitectureDocument } from "./documentation/project.js";
|
|
5
5
|
import { ArchitectureSiteError, buildArchitectureSite } from "./documentation/site.js";
|
|
6
6
|
import { projectArchitectureDocumentToStructurizr } from "./projection/structurizr.js";
|
|
7
|
+
import { commandUsage } from "../command-contract.js";
|
|
7
8
|
const DEFAULT_STRUCTURIZR_COMMAND = "structurizr";
|
|
8
9
|
const MAX_DIAGNOSTIC_LENGTH = 240;
|
|
9
10
|
function usage(command) {
|
|
10
11
|
if (command === "validate")
|
|
11
|
-
return "
|
|
12
|
-
if (command === "render")
|
|
13
|
-
return "
|
|
14
|
-
|
|
15
|
-
return "usage: PACKAGE_NAME architecture <validate|render> ...";
|
|
12
|
+
return commandUsage("architecture.validate");
|
|
13
|
+
if (command === "render")
|
|
14
|
+
return commandUsage("architecture.render");
|
|
15
|
+
return commandUsage("architecture.help");
|
|
16
16
|
}
|
|
17
17
|
function bounded(value) {
|
|
18
18
|
const message = value.replace(/\s+/gu, " ").trim();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["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,CAAC;QACnF,OAAO,YAAY,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -8,8 +8,23 @@ import { createScipTypescriptProvider } from "./runtime/scipProvider.js";
|
|
|
8
8
|
import { createTypeScriptProvider } from "./runtime/typescriptProvider.js";
|
|
9
9
|
import { runProviderMatrix } from "./runtime/workflow.js";
|
|
10
10
|
import { runArchitectureCli } from "./architecture/cli.js";
|
|
11
|
+
import { commandUsage, parseHelpRequest, projectCommandHelp, renderCommandHelp } from "./command-contract.js";
|
|
12
|
+
import { boundText, findSkillScenario, projectSkillIndexToJson, projectSkillIndexToText, projectSkillScenarioToJson, projectSkillScenarioToText, serializeSkillJson, } from "./skill.js";
|
|
11
13
|
export async function runCli(argv) {
|
|
12
14
|
const command = argv[0];
|
|
15
|
+
const helpRequest = parseHelpRequest(argv);
|
|
16
|
+
if (helpRequest !== undefined) {
|
|
17
|
+
const projection = projectCommandHelp(helpRequest.positionals, helpRequest.mode);
|
|
18
|
+
if (projection === undefined) {
|
|
19
|
+
console.error(boundText(`unknown command: ${helpRequest.positionals[0] ?? ""}`));
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
if (helpRequest.mode === "json")
|
|
23
|
+
console.log(JSON.stringify(projection));
|
|
24
|
+
else
|
|
25
|
+
console.log(renderCommandHelp(projection));
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
13
28
|
if (command === undefined || command === "--help" || command === "-h") {
|
|
14
29
|
printHelp();
|
|
15
30
|
return command === undefined ? 1 : 0;
|
|
@@ -27,6 +42,9 @@ export async function runCli(argv) {
|
|
|
27
42
|
if (command === "architecture") {
|
|
28
43
|
return runArchitectureCli(argv.slice(1));
|
|
29
44
|
}
|
|
45
|
+
if (command === "skill") {
|
|
46
|
+
return runSkillCommand(argv.slice(1));
|
|
47
|
+
}
|
|
30
48
|
console.error(`unknown command: ${command}`);
|
|
31
49
|
printHelp();
|
|
32
50
|
return 1;
|
|
@@ -56,7 +74,7 @@ async function runMatrixCommand(args) {
|
|
|
56
74
|
configuredAdditionOrder = config.additionOrder;
|
|
57
75
|
}
|
|
58
76
|
if (source === undefined)
|
|
59
|
-
throw new Error("
|
|
77
|
+
throw new Error(commandUsage("matrix.execute"));
|
|
60
78
|
if (revision === undefined)
|
|
61
79
|
throw new Error("matrix requires --revision <40-character commit SHA>");
|
|
62
80
|
const runRoot = outIndex === -1 ? undefined : args[outIndex + 1];
|
|
@@ -97,7 +115,7 @@ function sameStrings(left, right) {
|
|
|
97
115
|
async function runRunCommand(args) {
|
|
98
116
|
const source = args[0];
|
|
99
117
|
if (source === undefined) {
|
|
100
|
-
console.error("
|
|
118
|
+
console.error(commandUsage("run.execute"));
|
|
101
119
|
return 1;
|
|
102
120
|
}
|
|
103
121
|
const revisionIndex = args.indexOf("--revision");
|
|
@@ -125,19 +143,40 @@ async function runRunCommand(args) {
|
|
|
125
143
|
}
|
|
126
144
|
}
|
|
127
145
|
function printHelp() {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
146
|
+
const projection = projectCommandHelp([], "summary");
|
|
147
|
+
if (projection !== undefined)
|
|
148
|
+
console.log(renderCommandHelp(projection));
|
|
149
|
+
}
|
|
150
|
+
function runSkillCommand(args) {
|
|
151
|
+
const json = args.includes("--json");
|
|
152
|
+
const scenarioId = args.find((argument) => !argument.startsWith("-"));
|
|
153
|
+
if (scenarioId === undefined) {
|
|
154
|
+
if (json)
|
|
155
|
+
console.log(serializeSkillJson(projectSkillIndexToJson()));
|
|
156
|
+
else
|
|
157
|
+
console.log(projectSkillIndexToText());
|
|
158
|
+
return 0;
|
|
159
|
+
}
|
|
160
|
+
const scenario = findSkillScenario(scenarioId);
|
|
161
|
+
if (scenario === undefined) {
|
|
162
|
+
const message = boundText(`unknown skill scenario: ${scenarioId}`);
|
|
163
|
+
if (json) {
|
|
164
|
+
console.log(serializeSkillJson({ ok: false, command: "skill", diagnostics: [{ code: "unknown-scenario", message }] }));
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
console.error(message);
|
|
168
|
+
}
|
|
169
|
+
return 1;
|
|
170
|
+
}
|
|
171
|
+
if (json) {
|
|
172
|
+
console.log(serializeSkillJson(projectSkillScenarioToJson(scenario)));
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
console.log(projectSkillScenarioToText(scenario));
|
|
176
|
+
}
|
|
177
|
+
return 0;
|
|
139
178
|
}
|
|
140
179
|
function getVersion() {
|
|
141
|
-
return "0.2.
|
|
180
|
+
return "0.2.1";
|
|
142
181
|
}
|
|
143
182
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","source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,GAAG,CAAC,0BAA0B,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,UAAU;IACjB,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The versioned authority for Wabachi's public command surface.
|
|
3
|
+
*
|
|
4
|
+
* Runtime execution remains in the existing CLI modules. Syntax, options,
|
|
5
|
+
* examples, and discovery projections are derived from this model so help,
|
|
6
|
+
* skills, and the manual's routing guidance cannot grow separate contracts.
|
|
7
|
+
*/
|
|
8
|
+
export declare const COMMAND_CONTRACT_VERSION: "1.0.0";
|
|
9
|
+
export declare const COMMAND_CONTRACT_ID: "urn:wabachi:command-contract:1.0.0";
|
|
10
|
+
export declare const CLI_NAME: "wabachi";
|
|
11
|
+
export type CommandDomain = "root" | "run" | "matrix" | "architecture" | "skill";
|
|
12
|
+
export type OptionValueType = "boolean" | "string";
|
|
13
|
+
export type OptionArity = "none" | "required" | "optional";
|
|
14
|
+
export type CommandId = "root.help" | "root.version" | "run.execute" | "matrix.execute" | "architecture.help" | "architecture.validate" | "architecture.render" | "skill.index" | "skill.scenario";
|
|
15
|
+
export type OptionId = "help" | "version" | "json" | "revision" | "out" | "config" | "structurizrCommand";
|
|
16
|
+
export interface CommandOptionDefinition {
|
|
17
|
+
readonly id: OptionId;
|
|
18
|
+
readonly key: string;
|
|
19
|
+
readonly aliases: readonly string[];
|
|
20
|
+
readonly valueType: OptionValueType;
|
|
21
|
+
readonly arity: OptionArity;
|
|
22
|
+
readonly placeholder?: string;
|
|
23
|
+
readonly description: string;
|
|
24
|
+
}
|
|
25
|
+
export interface CommandDefinition {
|
|
26
|
+
readonly id: CommandId;
|
|
27
|
+
readonly domain: CommandDomain;
|
|
28
|
+
readonly operation: string;
|
|
29
|
+
readonly path: readonly string[];
|
|
30
|
+
readonly positionalSyntax?: string;
|
|
31
|
+
readonly optionIds: readonly OptionId[];
|
|
32
|
+
readonly requiredOptionIds?: readonly OptionId[];
|
|
33
|
+
readonly summary: string;
|
|
34
|
+
readonly examples: readonly string[];
|
|
35
|
+
}
|
|
36
|
+
export declare const COMMAND_OPTIONS: Readonly<Record<OptionId, CommandOptionDefinition>>;
|
|
37
|
+
export declare const COMMANDS: readonly CommandDefinition[];
|
|
38
|
+
export declare function getCommand(id: CommandId): CommandDefinition;
|
|
39
|
+
export declare function getOption(id: OptionId): CommandOptionDefinition;
|
|
40
|
+
export declare function getOptionForToken(token: string): CommandOptionDefinition | undefined;
|
|
41
|
+
export declare function getDomainCommands(domain: Exclude<CommandDomain, "root">): readonly CommandDefinition[];
|
|
42
|
+
export declare function commandInvocation(id: CommandId): string;
|
|
43
|
+
export declare function commandHelpPointer(id: CommandId): string;
|
|
44
|
+
export declare function optionSyntax(definition: CommandOptionDefinition): string;
|
|
45
|
+
export declare function commandUsage(id: CommandId): string;
|
|
46
|
+
export declare function commandExample(id: CommandId): string;
|
|
47
|
+
/** Extract positional tokens while ignoring contract-owned option values. */
|
|
48
|
+
export declare function positionalTokens(argv: readonly string[]): readonly string[];
|
|
49
|
+
export declare function getCommandForPositionals(positionals: readonly string[]): CommandDefinition | undefined;
|
|
50
|
+
export type HelpMode = "summary" | "full" | "json";
|
|
51
|
+
export interface HelpCommandEntry {
|
|
52
|
+
readonly id: CommandId;
|
|
53
|
+
readonly usage: string;
|
|
54
|
+
readonly summary: string;
|
|
55
|
+
}
|
|
56
|
+
export interface HelpOptionEntry {
|
|
57
|
+
readonly id: OptionId;
|
|
58
|
+
readonly syntax: string;
|
|
59
|
+
readonly description: string;
|
|
60
|
+
}
|
|
61
|
+
export interface CommandHelpProjection {
|
|
62
|
+
readonly contract: typeof COMMAND_CONTRACT_ID;
|
|
63
|
+
readonly kind: "root" | "domain" | "leaf";
|
|
64
|
+
readonly commandId: CommandId;
|
|
65
|
+
readonly usage: string;
|
|
66
|
+
readonly summary: string;
|
|
67
|
+
readonly commands: readonly HelpCommandEntry[];
|
|
68
|
+
readonly options: readonly HelpOptionEntry[];
|
|
69
|
+
readonly examples: readonly string[];
|
|
70
|
+
}
|
|
71
|
+
export declare function projectCommandHelp(positionals: readonly string[], mode?: HelpMode): CommandHelpProjection | undefined;
|
|
72
|
+
export declare function renderCommandHelp(projection: CommandHelpProjection): string;
|
|
73
|
+
export interface HelpRequest {
|
|
74
|
+
readonly positionals: readonly string[];
|
|
75
|
+
readonly mode: HelpMode;
|
|
76
|
+
}
|
|
77
|
+
export declare function parseHelpRequest(argv: readonly string[]): HelpRequest | undefined;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The versioned authority for Wabachi's public command surface.
|
|
3
|
+
*
|
|
4
|
+
* Runtime execution remains in the existing CLI modules. Syntax, options,
|
|
5
|
+
* examples, and discovery projections are derived from this model so help,
|
|
6
|
+
* skills, and the manual's routing guidance cannot grow separate contracts.
|
|
7
|
+
*/
|
|
8
|
+
export const COMMAND_CONTRACT_VERSION = "1.0.0";
|
|
9
|
+
export const COMMAND_CONTRACT_ID = `urn:wabachi:command-contract:${COMMAND_CONTRACT_VERSION}`;
|
|
10
|
+
export const CLI_NAME = "wabachi";
|
|
11
|
+
const option = (id, aliases, valueType, arity, description, placeholder) => ({
|
|
12
|
+
id,
|
|
13
|
+
key: aliases[0]?.replace(/^--/u, "") ?? id,
|
|
14
|
+
aliases,
|
|
15
|
+
valueType,
|
|
16
|
+
arity,
|
|
17
|
+
...(placeholder === undefined ? {} : { placeholder }),
|
|
18
|
+
description,
|
|
19
|
+
});
|
|
20
|
+
export const COMMAND_OPTIONS = {
|
|
21
|
+
help: option("help", ["--help"], "string", "optional", "Show progressive help; use --help=full for the complete command reference or --help=json for discovery.", "full|json"),
|
|
22
|
+
version: option("version", ["--version"], "boolean", "none", "Print the installed Wabachi version."),
|
|
23
|
+
json: option("json", ["--json"], "boolean", "none", "Emit machine-readable JSON where supported."),
|
|
24
|
+
revision: option("revision", ["--revision"], "string", "required", "Repository revision or commit SHA to analyze.", "ref"),
|
|
25
|
+
out: option("out", ["--out"], "string", "required", "Directory in which retained artifacts are written.", "dir"),
|
|
26
|
+
config: option("config", ["--config"], "string", "required", "JSON workflow configuration for the provider matrix.", "path"),
|
|
27
|
+
structurizrCommand: option("structurizrCommand", ["--structurizr-command"], "string", "required", "Structurizr CLI executable used for static export.", "executable-path"),
|
|
28
|
+
};
|
|
29
|
+
const command = (id, domain, operation, path, summary, optionIds, examples, positionalSyntax, requiredOptionIds) => ({
|
|
30
|
+
id,
|
|
31
|
+
domain,
|
|
32
|
+
operation,
|
|
33
|
+
path,
|
|
34
|
+
summary,
|
|
35
|
+
optionIds,
|
|
36
|
+
examples,
|
|
37
|
+
...(positionalSyntax === undefined ? {} : { positionalSyntax }),
|
|
38
|
+
...(requiredOptionIds === undefined ? {} : { requiredOptionIds }),
|
|
39
|
+
});
|
|
40
|
+
export const COMMANDS = [
|
|
41
|
+
command("root.help", "root", "help", [], "Discover supported commands and resolve exact syntax progressively.", ["help"], ["wabachi --help", "wabachi --help=full"], "[command]"),
|
|
42
|
+
command("root.version", "root", "version", [], "Print the installed version.", ["version"], ["wabachi --version"], undefined, ["version"]),
|
|
43
|
+
command("run.execute", "run", "execute", ["run"], "Resolve a repository and execute the registered analysis providers.", ["help", "revision", "out"], ["wabachi run <repository> --revision <ref> --out <dir>", "wabachi run <repository>"], "<repository>"),
|
|
44
|
+
command("matrix.execute", "matrix", "execute", ["matrix"], "Run providers and retain auditable facts, correlations, matrices, and reports.", ["help", "revision", "out", "config"], ["wabachi matrix <repository> --revision <sha> --out <dir>", "wabachi matrix --config <path>"], "<repository>"),
|
|
45
|
+
command("architecture.help", "architecture", "help", ["architecture"], "Discover Architecture Canon validation and rendering commands.", ["help"], ["wabachi architecture --help"]),
|
|
46
|
+
command("architecture.validate", "architecture", "validate", ["architecture", "validate"], "Validate one explicit Architecture Canon document.", ["help", "json"], ["wabachi architecture validate <file> --json"], "<file>"),
|
|
47
|
+
command("architecture.render", "architecture", "render", ["architecture", "render"], "Render one explicit Architecture Canon document as a site.", ["help", "out", "structurizrCommand", "json"], ["wabachi architecture render <file> --out <dir>", "wabachi architecture render <file> --out <dir> --json"], "<file>"),
|
|
48
|
+
command("skill.index", "skill", "index", ["skill"], "List bounded intent-oriented Wabachi playbooks.", ["help", "json"], ["wabachi skill", "wabachi skill --json"]),
|
|
49
|
+
command("skill.scenario", "skill", "scenario", ["skill"], "Print one bounded playbook for a named intent.", ["help", "json"], ["wabachi skill <scenario>", "wabachi skill <scenario> --json"], "<scenario>"),
|
|
50
|
+
];
|
|
51
|
+
const commandsById = new Map(COMMANDS.map((entry) => [entry.id, entry]));
|
|
52
|
+
const optionsByAlias = new Map();
|
|
53
|
+
for (const definition of Object.values(COMMAND_OPTIONS)) {
|
|
54
|
+
for (const alias of definition.aliases)
|
|
55
|
+
optionsByAlias.set(alias, definition);
|
|
56
|
+
}
|
|
57
|
+
export function getCommand(id) {
|
|
58
|
+
const definition = commandsById.get(id);
|
|
59
|
+
if (definition === undefined)
|
|
60
|
+
throw new Error(`Unknown Wabachi command contract id: ${id}`);
|
|
61
|
+
return definition;
|
|
62
|
+
}
|
|
63
|
+
export function getOption(id) {
|
|
64
|
+
return COMMAND_OPTIONS[id];
|
|
65
|
+
}
|
|
66
|
+
export function getOptionForToken(token) {
|
|
67
|
+
return optionsByAlias.get(token.split("=", 1)[0]);
|
|
68
|
+
}
|
|
69
|
+
export function getDomainCommands(domain) {
|
|
70
|
+
return COMMANDS.filter((entry) => entry.domain === domain);
|
|
71
|
+
}
|
|
72
|
+
export function commandInvocation(id) {
|
|
73
|
+
const definition = getCommand(id);
|
|
74
|
+
return [CLI_NAME, ...definition.path].join(" ");
|
|
75
|
+
}
|
|
76
|
+
export function commandHelpPointer(id) {
|
|
77
|
+
const definition = getCommand(id);
|
|
78
|
+
return definition.path.length === 0 ? `${CLI_NAME} --help` : `${commandInvocation(id)} --help`;
|
|
79
|
+
}
|
|
80
|
+
export function optionSyntax(definition) {
|
|
81
|
+
const name = definition.aliases[0] ?? `--${definition.id}`;
|
|
82
|
+
if (definition.arity === "none")
|
|
83
|
+
return name;
|
|
84
|
+
if (definition.arity === "optional")
|
|
85
|
+
return `${name}[=${definition.placeholder ?? "value"}]`;
|
|
86
|
+
return `${name} <${definition.placeholder ?? "value"}>`;
|
|
87
|
+
}
|
|
88
|
+
export function commandUsage(id) {
|
|
89
|
+
const definition = getCommand(id);
|
|
90
|
+
const pathText = [CLI_NAME, ...definition.path].join(" ");
|
|
91
|
+
const positional = definition.positionalSyntax === undefined ? "" : ` ${definition.positionalSyntax}`;
|
|
92
|
+
const options = definition.optionIds
|
|
93
|
+
.map((optionId) => definition.requiredOptionIds?.includes(optionId) === true
|
|
94
|
+
? ` ${optionSyntax(getOption(optionId))}`
|
|
95
|
+
: ` [${optionSyntax(getOption(optionId))}]`)
|
|
96
|
+
.join("");
|
|
97
|
+
return `usage: ${pathText}${positional}${options}`;
|
|
98
|
+
}
|
|
99
|
+
export function commandExample(id) {
|
|
100
|
+
return getCommand(id).examples[0] ?? commandInvocation(id);
|
|
101
|
+
}
|
|
102
|
+
/** Extract positional tokens while ignoring contract-owned option values. */
|
|
103
|
+
export function positionalTokens(argv) {
|
|
104
|
+
const positionals = [];
|
|
105
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
106
|
+
const token = argv[index];
|
|
107
|
+
if (token.startsWith("--")) {
|
|
108
|
+
const definition = getOptionForToken(token);
|
|
109
|
+
if (definition?.arity === "required" && !token.includes("="))
|
|
110
|
+
index += 1;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (token.startsWith("-"))
|
|
114
|
+
continue;
|
|
115
|
+
positionals.push(token);
|
|
116
|
+
}
|
|
117
|
+
return positionals;
|
|
118
|
+
}
|
|
119
|
+
export function getCommandForPositionals(positionals) {
|
|
120
|
+
if (positionals.length === 0)
|
|
121
|
+
return getCommand("root.help");
|
|
122
|
+
return COMMANDS.find((entry) => {
|
|
123
|
+
if (entry.domain === "root" || positionals.length < entry.path.length)
|
|
124
|
+
return false;
|
|
125
|
+
if (!entry.path.every((part, index) => positionals[index] === part))
|
|
126
|
+
return false;
|
|
127
|
+
const maximumPositionals = entry.positionalSyntax === undefined ? entry.path.length : entry.path.length + 1;
|
|
128
|
+
return positionals.length <= maximumPositionals;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function helpEntries(commands) {
|
|
132
|
+
return commands.map((entry) => ({ id: entry.id, usage: commandUsage(entry.id), summary: entry.summary }));
|
|
133
|
+
}
|
|
134
|
+
export function projectCommandHelp(positionals, mode = "summary") {
|
|
135
|
+
const commandDefinition = getCommandForPositionals(positionals);
|
|
136
|
+
if (commandDefinition === undefined)
|
|
137
|
+
return undefined;
|
|
138
|
+
const isRoot = commandDefinition.id === "root.help";
|
|
139
|
+
const isDomain = commandDefinition.id === "architecture.help" || commandDefinition.id === "skill.index";
|
|
140
|
+
const children = isRoot
|
|
141
|
+
? COMMANDS.filter((entry) => ["root.version", "run.execute", "matrix.execute", "architecture.help", "skill.index"].includes(entry.id))
|
|
142
|
+
: isDomain
|
|
143
|
+
? COMMANDS.filter((entry) => entry.domain === commandDefinition.domain && entry.id !== commandDefinition.id)
|
|
144
|
+
: [];
|
|
145
|
+
const listedCommands = mode === "full" && isRoot ? COMMANDS.filter((entry) => entry.id !== "root.help") : children;
|
|
146
|
+
const optionEntries = commandDefinition.optionIds.map((optionId) => {
|
|
147
|
+
const definition = getOption(optionId);
|
|
148
|
+
return { id: optionId, syntax: optionSyntax(definition), description: definition.description };
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
contract: COMMAND_CONTRACT_ID,
|
|
152
|
+
kind: isRoot ? "root" : isDomain ? "domain" : "leaf",
|
|
153
|
+
commandId: commandDefinition.id,
|
|
154
|
+
usage: commandUsage(commandDefinition.id),
|
|
155
|
+
summary: commandDefinition.summary,
|
|
156
|
+
commands: helpEntries(listedCommands),
|
|
157
|
+
options: optionEntries,
|
|
158
|
+
examples: commandDefinition.examples,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
export function renderCommandHelp(projection) {
|
|
162
|
+
const lines = [
|
|
163
|
+
`Wabachi help (${projection.contract})`,
|
|
164
|
+
"",
|
|
165
|
+
`Usage: ${projection.usage.replace(/^usage: /u, "")}`,
|
|
166
|
+
projection.summary,
|
|
167
|
+
];
|
|
168
|
+
if (projection.commands.length > 0) {
|
|
169
|
+
lines.push("", "Commands:");
|
|
170
|
+
for (const entry of projection.commands)
|
|
171
|
+
lines.push(` ${entry.usage.replace(/^usage: /u, "")} ${entry.summary}`);
|
|
172
|
+
}
|
|
173
|
+
if (projection.options.length > 0) {
|
|
174
|
+
lines.push("", "Options:");
|
|
175
|
+
for (const optionEntry of projection.options)
|
|
176
|
+
lines.push(` ${optionEntry.syntax} ${optionEntry.description}`);
|
|
177
|
+
}
|
|
178
|
+
if (projection.examples.length > 0) {
|
|
179
|
+
lines.push("", "Examples:");
|
|
180
|
+
for (const example of projection.examples)
|
|
181
|
+
lines.push(` ${example}`);
|
|
182
|
+
}
|
|
183
|
+
return lines.join("\n");
|
|
184
|
+
}
|
|
185
|
+
export function parseHelpRequest(argv) {
|
|
186
|
+
const helpToken = argv.find((token) => token === "--help" || token.startsWith("--help="));
|
|
187
|
+
if (helpToken === undefined)
|
|
188
|
+
return undefined;
|
|
189
|
+
const value = helpToken.includes("=") ? helpToken.slice(helpToken.indexOf("=") + 1) : "summary";
|
|
190
|
+
const mode = value === "full" || value === "json" ? value : "summary";
|
|
191
|
+
return { positionals: positionalTokens(argv), mode };
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=command-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-contract.js","sourceRoot":"","sources":["../src/command-contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,OAAgB,CAAC;AACzD,MAAM,CAAC,MAA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,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAChG,MAAM,IAAI,GAAa,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAChF,OAAO,EAAE,WAAW,EAAE,gBAAgB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;AACvD,CAAC"}
|
package/dist/skill.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type CommandId } from "./command-contract.js";
|
|
2
|
+
/** Deterministic intent-oriented playbooks for the supported Wabachi surface. */
|
|
3
|
+
export declare const SKILL_MODEL_VERSION: "1.0.0";
|
|
4
|
+
export declare const MAX_SKILL_OUTPUT_BYTES = 4096;
|
|
5
|
+
export interface SkillWorkflowStep {
|
|
6
|
+
readonly summary: string;
|
|
7
|
+
/** Stable reference into the versioned command contract. */
|
|
8
|
+
readonly commandId: CommandId;
|
|
9
|
+
/** Bare executable command derived from commandId. */
|
|
10
|
+
readonly command: string;
|
|
11
|
+
/** Practical example derived from commandId. */
|
|
12
|
+
readonly example: string;
|
|
13
|
+
/** Progressive-help pointer derived from commandId. */
|
|
14
|
+
readonly helpPointer: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SkillScenario {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly title: string;
|
|
19
|
+
readonly whenToUse: string;
|
|
20
|
+
readonly workflow: readonly SkillWorkflowStep[];
|
|
21
|
+
readonly invariants: readonly string[];
|
|
22
|
+
readonly canonicalCommandId: CommandId;
|
|
23
|
+
readonly canonicalEntrypoint: string;
|
|
24
|
+
readonly helpPointer: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const SKILL_SCENARIOS: readonly SkillScenario[];
|
|
27
|
+
export interface SkillIndexEntry {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly title: string;
|
|
30
|
+
readonly whenToUse: string;
|
|
31
|
+
}
|
|
32
|
+
export interface SkillIndexProjection {
|
|
33
|
+
readonly version: typeof SKILL_MODEL_VERSION;
|
|
34
|
+
readonly scenarios: readonly SkillIndexEntry[];
|
|
35
|
+
}
|
|
36
|
+
export interface SkillScenarioProjection extends SkillScenario {
|
|
37
|
+
readonly version: typeof SKILL_MODEL_VERSION;
|
|
38
|
+
}
|
|
39
|
+
export declare function findSkillScenario(id: string): SkillScenario | undefined;
|
|
40
|
+
export declare function projectSkillIndexToJson(): SkillIndexProjection;
|
|
41
|
+
export declare function projectSkillIndexToText(): string;
|
|
42
|
+
export declare function projectSkillScenarioToJson(scenario: SkillScenario): SkillScenarioProjection;
|
|
43
|
+
export declare function projectSkillScenarioToText(scenario: SkillScenario): string;
|
|
44
|
+
/** Keep text diagnostics and projections within the explicit UTF-8 budget. */
|
|
45
|
+
export declare function boundText(value: string): string;
|
|
46
|
+
/** Serialize a JSON projection without allowing the machine-readable path to exceed the same cap. */
|
|
47
|
+
export declare function serializeSkillJson(value: unknown): string;
|
package/dist/skill.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { commandExample, commandHelpPointer, commandInvocation, getCommand, } from "./command-contract.js";
|
|
2
|
+
/** Deterministic intent-oriented playbooks for the supported Wabachi surface. */
|
|
3
|
+
export const SKILL_MODEL_VERSION = "1.0.0";
|
|
4
|
+
export const MAX_SKILL_OUTPUT_BYTES = 4096;
|
|
5
|
+
function workflowStep(summary, commandId) {
|
|
6
|
+
getCommand(commandId);
|
|
7
|
+
return {
|
|
8
|
+
summary,
|
|
9
|
+
commandId,
|
|
10
|
+
command: commandInvocation(commandId),
|
|
11
|
+
example: commandExample(commandId),
|
|
12
|
+
helpPointer: commandHelpPointer(commandId),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function skillScenario(input) {
|
|
16
|
+
return {
|
|
17
|
+
id: input.id,
|
|
18
|
+
title: input.title,
|
|
19
|
+
whenToUse: input.whenToUse,
|
|
20
|
+
workflow: input.workflow.map(([summary, commandId]) => workflowStep(summary, commandId)),
|
|
21
|
+
invariants: input.invariants,
|
|
22
|
+
canonicalCommandId: input.canonicalCommandId,
|
|
23
|
+
canonicalEntrypoint: commandInvocation(input.canonicalCommandId),
|
|
24
|
+
helpPointer: commandHelpPointer(input.canonicalCommandId),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export const SKILL_SCENARIOS = [
|
|
28
|
+
skillScenario({
|
|
29
|
+
id: "analyze-repository",
|
|
30
|
+
title: "Analyze a repository",
|
|
31
|
+
whenToUse: "Use when you need deterministic provider output for a repository at a selected revision.",
|
|
32
|
+
workflow: [["Resolve the repository and execute the registered analysis providers.", "run.execute"]],
|
|
33
|
+
invariants: [
|
|
34
|
+
"Choose an explicit revision when reproducibility matters; the default resolution remains supported.",
|
|
35
|
+
"Retain the output directory when another workflow or reviewer needs the manifest and provider artifacts.",
|
|
36
|
+
"The provider set and analysis execution semantics are owned by the runtime, not this playbook.",
|
|
37
|
+
],
|
|
38
|
+
canonicalCommandId: "run.execute",
|
|
39
|
+
}),
|
|
40
|
+
skillScenario({
|
|
41
|
+
id: "provider-matrix",
|
|
42
|
+
title: "Build a provider matrix",
|
|
43
|
+
whenToUse: "Use when you need auditable facts, correlations, matrix output, and a report for one revision.",
|
|
44
|
+
workflow: [["Run the provider matrix and retain its generated artifacts.", "matrix.execute"]],
|
|
45
|
+
invariants: [
|
|
46
|
+
"Use a 40-character commit SHA when matrix evidence must be tied to an immutable revision.",
|
|
47
|
+
"Provide an output directory so the report and its supporting artifacts remain inspectable.",
|
|
48
|
+
"Provider registration and matrix execution order remain runtime authority.",
|
|
49
|
+
],
|
|
50
|
+
canonicalCommandId: "matrix.execute",
|
|
51
|
+
}),
|
|
52
|
+
skillScenario({
|
|
53
|
+
id: "validate-architecture-canon",
|
|
54
|
+
title: "Validate an Architecture Canon",
|
|
55
|
+
whenToUse: "Use before rendering an explicit Architecture Canon document or handing it to another workflow.",
|
|
56
|
+
workflow: [["Validate the explicit Canon file and inspect any bounded diagnostics.", "architecture.validate"]],
|
|
57
|
+
invariants: [
|
|
58
|
+
"The Canon file is explicit input; this workflow does not create or mutate one.",
|
|
59
|
+
"Validation must succeed before rendering or publishing derived documentation.",
|
|
60
|
+
"Machine-readable diagnostics are available through the command's JSON projection.",
|
|
61
|
+
],
|
|
62
|
+
canonicalCommandId: "architecture.validate",
|
|
63
|
+
}),
|
|
64
|
+
skillScenario({
|
|
65
|
+
id: "render-architecture-canon",
|
|
66
|
+
title: "Render Architecture Canon documentation",
|
|
67
|
+
whenToUse: "Use when a valid Architecture Canon should become a retained static documentation site.",
|
|
68
|
+
workflow: [["Render the explicit Canon file into a retained output directory.", "architecture.render"]],
|
|
69
|
+
invariants: [
|
|
70
|
+
"Validate the same Canon file first when its validity has not already been established.",
|
|
71
|
+
"The Structurizr CLI is required for static export; use the command's executable override only when needed.",
|
|
72
|
+
"Rendering is a projection and does not add an Architecture Canon authoring command.",
|
|
73
|
+
],
|
|
74
|
+
canonicalCommandId: "architecture.render",
|
|
75
|
+
}),
|
|
76
|
+
skillScenario({
|
|
77
|
+
id: "architecture-documentation",
|
|
78
|
+
title: "Follow the Architecture Documentation workflow",
|
|
79
|
+
whenToUse: "Use for the normal manual-authoring, validation, and rendering path for Architecture Canon documentation.",
|
|
80
|
+
workflow: [
|
|
81
|
+
[
|
|
82
|
+
"Author or revise the explicit Canon document using repository documentation guidance; no init command is implied.",
|
|
83
|
+
"architecture.help",
|
|
84
|
+
],
|
|
85
|
+
["Validate the authored Canon before producing derived documentation.", "architecture.validate"],
|
|
86
|
+
["Render the validated Canon into a retained static site.", "architecture.render"],
|
|
87
|
+
],
|
|
88
|
+
invariants: [
|
|
89
|
+
"Authoring remains a deliberate file-editing step; Wabachi does not invent an init or edit command.",
|
|
90
|
+
"Validation and rendering operate on an explicit Canon file and preserve existing execution semantics.",
|
|
91
|
+
"Keep the generated site and source Canon together when the result is intended for review or publication.",
|
|
92
|
+
],
|
|
93
|
+
canonicalCommandId: "architecture.help",
|
|
94
|
+
}),
|
|
95
|
+
];
|
|
96
|
+
export function findSkillScenario(id) {
|
|
97
|
+
return SKILL_SCENARIOS.find((scenario) => scenario.id === id);
|
|
98
|
+
}
|
|
99
|
+
export function projectSkillIndexToJson() {
|
|
100
|
+
return {
|
|
101
|
+
version: SKILL_MODEL_VERSION,
|
|
102
|
+
scenarios: SKILL_SCENARIOS.map(({ id, title, whenToUse }) => ({ id, title, whenToUse })),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export function projectSkillIndexToText() {
|
|
106
|
+
const lines = [`Wabachi skill scenarios (v${SKILL_MODEL_VERSION}):`, ""];
|
|
107
|
+
for (const scenario of SKILL_SCENARIOS) {
|
|
108
|
+
lines.push(` ${scenario.id} - ${scenario.title}`);
|
|
109
|
+
lines.push(` ${scenario.whenToUse}`);
|
|
110
|
+
}
|
|
111
|
+
lines.push("", "Run `wabachi skill <scenario>` for one bounded playbook.");
|
|
112
|
+
return boundText(lines.join("\n"));
|
|
113
|
+
}
|
|
114
|
+
export function projectSkillScenarioToJson(scenario) {
|
|
115
|
+
return {
|
|
116
|
+
version: SKILL_MODEL_VERSION,
|
|
117
|
+
...scenario,
|
|
118
|
+
workflow: scenario.workflow.map((step) => workflowStep(step.summary, step.commandId)),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export function projectSkillScenarioToText(scenario) {
|
|
122
|
+
const projected = projectSkillScenarioToJson(scenario);
|
|
123
|
+
const lines = [`${projected.title} (${projected.id})`, "", `When to use: ${projected.whenToUse}`, "", "Workflow:"];
|
|
124
|
+
projected.workflow.forEach((step, index) => {
|
|
125
|
+
lines.push(` ${index + 1}. ${step.summary}`);
|
|
126
|
+
lines.push(` Command: ${step.command}`);
|
|
127
|
+
lines.push(` Example: ${step.example}`);
|
|
128
|
+
lines.push(` Help: ${step.helpPointer}`);
|
|
129
|
+
});
|
|
130
|
+
lines.push("", "Invariants:");
|
|
131
|
+
for (const invariant of projected.invariants)
|
|
132
|
+
lines.push(` - ${invariant}`);
|
|
133
|
+
lines.push("", `Canonical entrypoint: ${projected.canonicalEntrypoint}`, `Exact syntax: ${projected.helpPointer}`);
|
|
134
|
+
return boundText(lines.join("\n"));
|
|
135
|
+
}
|
|
136
|
+
/** Keep text diagnostics and projections within the explicit UTF-8 budget. */
|
|
137
|
+
export function boundText(value) {
|
|
138
|
+
if (Buffer.byteLength(value, "utf8") <= MAX_SKILL_OUTPUT_BYTES)
|
|
139
|
+
return value;
|
|
140
|
+
const suffix = "…";
|
|
141
|
+
const characters = Array.from(value);
|
|
142
|
+
while (characters.length > 0 &&
|
|
143
|
+
Buffer.byteLength(`${characters.join("")}${suffix}`, "utf8") > MAX_SKILL_OUTPUT_BYTES) {
|
|
144
|
+
characters.pop();
|
|
145
|
+
}
|
|
146
|
+
return `${characters.join("")}${suffix}`;
|
|
147
|
+
}
|
|
148
|
+
/** Serialize a JSON projection without allowing the machine-readable path to exceed the same cap. */
|
|
149
|
+
export function serializeSkillJson(value) {
|
|
150
|
+
const serialized = JSON.stringify(value);
|
|
151
|
+
if (Buffer.byteLength(serialized, "utf8") <= MAX_SKILL_OUTPUT_BYTES)
|
|
152
|
+
return serialized;
|
|
153
|
+
return JSON.stringify({
|
|
154
|
+
ok: false,
|
|
155
|
+
diagnostics: [
|
|
156
|
+
{ code: "skill-output-too-large", message: `skill output exceeds ${MAX_SKILL_OUTPUT_BYTES} UTF-8 bytes` },
|
|
157
|
+
],
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../src/skill.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,UAAU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C;IACrC,OACE,UAAU,CAAC,MAAM,GAAG,CAAC;QACrB,MAAM,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,EAAE,MAAM,CAAC,GAAG,sBAAsB,EACrF,CAAC;QACD,UAAU,CAAC,GAAG,EAAE,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC;AAC3C,CAAC;AAED,qGAAqG;AACrG,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACzC,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,sBAAsB;QAAE,OAAO,UAAU,CAAC;IACvF,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,EAAE,EAAE,KAAK;QACT,WAAW,EAAE;YACX,EAAE,IAAI,EAAE,wBAAwB,EAAE,OAAO,EAAE,wBAAwB,sBAAsB,cAAc,EAAE;SAC1G;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/docs/USAGE.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Wabachi usage
|
|
2
|
+
|
|
3
|
+
Wabachi is a deterministic repository-analysis and Architecture Canon CLI.
|
|
4
|
+
This manual explains the normal workflows for people. The installed command
|
|
5
|
+
contract is authoritative: use `wabachi --help`, progressive command help, and
|
|
6
|
+
`wabachi skill` for the exact current syntax.
|
|
7
|
+
|
|
8
|
+
## Install and discover
|
|
9
|
+
|
|
10
|
+
Wabachi requires Node.js 24 or newer.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install --global wabachi
|
|
14
|
+
wabachi --version
|
|
15
|
+
wabachi --help
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
For an ephemeral run, use `npx --yes wabachi --help`. Agents can begin with
|
|
19
|
+
`wabachi skill` and then request one bounded playbook with
|
|
20
|
+
`wabachi skill <scenario>`. Add `--json` to skill or help when consuming the
|
|
21
|
+
projection from a script.
|
|
22
|
+
|
|
23
|
+
## Analyze a repository
|
|
24
|
+
|
|
25
|
+
`run` resolves a repository and executes the registered analysis providers. It
|
|
26
|
+
can use the default revision resolution or an explicit revision, and writes a
|
|
27
|
+
manifest plus provider output under a temporary directory unless `--out` is
|
|
28
|
+
provided.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
wabachi run .
|
|
32
|
+
wabachi run . --revision HEAD --out ./artifacts/run
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Use a commit SHA or another stable ref when the result will be compared or
|
|
36
|
+
reviewed. The command prints the manifest path. Keep the directory named by
|
|
37
|
+
`--out` if downstream work needs the facts or provider outputs.
|
|
38
|
+
|
|
39
|
+
## Build a provider matrix
|
|
40
|
+
|
|
41
|
+
`matrix` runs the matrix workflow for one revision and requires retained output
|
|
42
|
+
artifacts. A full 40-character commit SHA is the safest input for reproducible
|
|
43
|
+
evidence.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
wabachi matrix . --revision 0123456789abcdef0123456789abcdef01234567 --out ./artifacts/matrix
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The command prints the report path. The output directory also contains the
|
|
50
|
+
supporting facts and correlation artifacts used to produce the report. For a
|
|
51
|
+
configured provider workflow, pass a JSON configuration file with the source,
|
|
52
|
+
revision, provider IDs, and addition order:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
wabachi matrix --config ./matrix-workflow.json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The configured provider set must match the providers registered by the
|
|
59
|
+
installed Wabachi version.
|
|
60
|
+
|
|
61
|
+
## Architecture Canon
|
|
62
|
+
|
|
63
|
+
Architecture Canon authoring is an explicit file-editing step. Wabachi does
|
|
64
|
+
not provide an init or edit command. Create or revise the Canon document using
|
|
65
|
+
the repository's documented schema, then validate it before rendering.
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
wabachi architecture validate ./architecture.json
|
|
69
|
+
wabachi architecture validate ./architecture.json --json
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Rendering requires the Structurizr CLI. Wabachi writes the generated site and
|
|
73
|
+
static diagrams beneath the directory passed to `--out`:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
wabachi architecture render ./architecture.json --out ./artifacts/site
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
If `structurizr` is not on `PATH`, provide one executable identity without
|
|
80
|
+
changing the workflow:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
wabachi architecture render ./architecture.json \
|
|
84
|
+
--out ./artifacts/site \
|
|
85
|
+
--structurizr-command /opt/structurizr/structurizr.sh
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The normal documentation path is: author the explicit Canon, validate that
|
|
89
|
+
same file, then render it into a retained site. The matching live playbook is
|
|
90
|
+
`wabachi skill architecture-documentation`.
|
|
91
|
+
|
|
92
|
+
## Common failures and recovery
|
|
93
|
+
|
|
94
|
+
- If a repository cannot be resolved, confirm the path or remote and retry
|
|
95
|
+
`run` with an explicit revision. Preserve the printed diagnostic when the
|
|
96
|
+
failure needs investigation.
|
|
97
|
+
- If `matrix` rejects a revision, use a full commit SHA and provide `--out`.
|
|
98
|
+
If a configuration is rejected, compare its provider IDs and addition order
|
|
99
|
+
with the installed provider set.
|
|
100
|
+
- If Canon validation fails, fix the reported document issue and validate the
|
|
101
|
+
same file again before rendering. `--json` is useful for automation.
|
|
102
|
+
- If rendering fails before export, validate the Canon and check that the
|
|
103
|
+
Structurizr executable can run. Use `--structurizr-command` for a deliberate
|
|
104
|
+
executable override and inspect the retained output directory.
|
|
105
|
+
- If syntax is uncertain, stop relying on a copied example and resolve the
|
|
106
|
+
current contract with `wabachi architecture --help` or the relevant leaf
|
|
107
|
+
help. Unsupported commands fail closed.
|
|
108
|
+
|
|
109
|
+
Generated outputs are ordinary retained files; Wabachi does not publish them
|
|
110
|
+
or activate an agent plugin as a side effect of npm installation.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wabachi",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Repository analysis and Architecture Canon tooling for deterministic codebase understanding.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
11
|
"README.md",
|
|
12
|
-
"LICENSE"
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"docs/USAGE.md",
|
|
14
|
+
"skills",
|
|
15
|
+
".codex-plugin"
|
|
13
16
|
],
|
|
14
17
|
"dependencies": {
|
|
15
18
|
"@sourcegraph/scip-typescript": "0.4.0",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wabachi
|
|
3
|
+
description: |
|
|
4
|
+
Use Wabachi for deterministic repository analysis, provider matrices, and
|
|
5
|
+
Architecture Canon validation or rendering. Resolve current workflows and
|
|
6
|
+
exact syntax through the live CLI.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Wabachi
|
|
10
|
+
|
|
11
|
+
This bundled Skill is a routing entrypoint. The installed CLI is the authority
|
|
12
|
+
for command syntax and operational playbooks; this file intentionally does not
|
|
13
|
+
duplicate flags or workflow details.
|
|
14
|
+
|
|
15
|
+
Start with:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
wabachi skill
|
|
19
|
+
wabachi --help
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Then choose a bounded intent with `wabachi skill <scenario>`. Resolve exact
|
|
23
|
+
syntax for each command through its progressive help pointer, for example:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
wabachi architecture --help
|
|
27
|
+
wabachi architecture validate --help
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Use `--json` on `skill` or help when a machine-readable projection is needed.
|