@codiac.io/codiac-cli 1.3.245 → 1.3.247
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 +260 -160
- package/dist/commands/skill/install.d.ts +14 -0
- package/dist/commands/skill/install.js +43 -0
- package/dist/commands/skill/install.js.map +1 -0
- package/dist/commands/skill/path.d.ts +12 -0
- package/dist/commands/skill/path.js +26 -0
- package/dist/commands/skill/path.js.map +1 -0
- package/dist/commands/skill/show.d.ts +14 -0
- package/dist/commands/skill/show.js +43 -0
- package/dist/commands/skill/show.js.map +1 -0
- package/dist/skill-assets.d.ts +22 -0
- package/dist/skill-assets.js +65 -0
- package/dist/skill-assets.js.map +1 -0
- package/oclif.manifest.json +127 -1
- package/package.json +9 -3
- package/skill/SKILL.md +179 -0
- package/skill/references/cli-reference.md +167 -0
- package/skill/references/concepts.md +244 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class SkillInstall extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: {
|
|
5
|
+
description: string;
|
|
6
|
+
command: string;
|
|
7
|
+
}[];
|
|
8
|
+
static flags: {
|
|
9
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
10
|
+
dir: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
+
force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const skill_assets_1 = require("../../skill-assets");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const os = require("os");
|
|
8
|
+
const path = require("path");
|
|
9
|
+
class SkillInstall extends core_1.Command {
|
|
10
|
+
run() {
|
|
11
|
+
var _a;
|
|
12
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
const { flags } = yield this.parse(SkillInstall);
|
|
14
|
+
const src = (0, skill_assets_1.skillDir)();
|
|
15
|
+
if (!fs.existsSync(src)) {
|
|
16
|
+
this.error(`Bundled skill directory not found at ${src}. This CLI build may be missing the shipped skill (package "files" should include /skill).`);
|
|
17
|
+
}
|
|
18
|
+
const parent = (_a = flags.dir) !== null && _a !== void 0 ? _a : path.join(os.homedir(), '.claude', 'skills');
|
|
19
|
+
const dest = path.join(parent, 'codiac');
|
|
20
|
+
if (fs.existsSync(dest) && !flags.force) {
|
|
21
|
+
this.error(`A codiac skill already exists at ${dest}. Re-run with --force to overwrite.`);
|
|
22
|
+
}
|
|
23
|
+
fs.mkdirSync(parent, { recursive: true });
|
|
24
|
+
if (fs.existsSync(dest) && flags.force)
|
|
25
|
+
fs.rmSync(dest, { recursive: true, force: true });
|
|
26
|
+
fs.cpSync(src, dest, { recursive: true });
|
|
27
|
+
this.log(`Installed the Codiac skill to ${dest}`);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.default = SkillInstall;
|
|
32
|
+
SkillInstall.description = "Copies the bundled Codiac agent skill into a skills directory so a skill-aware harness (e.g. Claude Code) discovers it. Defaults to ~/.claude/skills/codiac. For runtimes that aren't skill-aware, use `cod skill show` to inject the content instead.";
|
|
33
|
+
SkillInstall.examples = [
|
|
34
|
+
{ description: 'Install into the default Claude Code skills dir (~/.claude/skills/codiac).', command: '<%= config.bin %> <%= command.id %>' },
|
|
35
|
+
{ description: 'Install into a specific skills directory.', command: '<%= config.bin %> <%= command.id %> --dir /workspace/.claude/skills' },
|
|
36
|
+
{ description: 'Overwrite an existing install.', command: '<%= config.bin %> <%= command.id %> --force' },
|
|
37
|
+
];
|
|
38
|
+
SkillInstall.flags = {
|
|
39
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
40
|
+
dir: core_1.Flags.string({ char: 'd', description: 'Parent skills directory to install into (the skill is placed in <dir>/codiac). Defaults to ~/.claude/skills.' }),
|
|
41
|
+
force: core_1.Flags.boolean({ char: 'f', description: 'Overwrite an existing codiac skill at the destination.' }),
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../../src/commands/skill/install.ts"],"names":[],"mappings":";;;AAAA,sCAA6C;AAC7C,qDAA8C;AAC9C,yBAAyB;AACzB,yBAAyB;AACzB,6BAA6B;AAE7B,MAAqB,YAAa,SAAQ,cAAO;IAgBlC,GAAG;;;YACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAEjD,MAAM,GAAG,GAAG,IAAA,uBAAQ,GAAE,CAAC;YACvB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;gBACvB,IAAI,CAAC,KAAK,CAAC,wCAAwC,GAAG,4FAA4F,CAAC,CAAC;aACrJ;YAED,MAAM,MAAM,GAAG,MAAA,KAAK,CAAC,GAAG,mCAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;YACzE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAEzC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;gBACvC,IAAI,CAAC,KAAK,CAAC,oCAAoC,IAAI,qCAAqC,CAAC,CAAC;aAC3F;YAED,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC1C,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,KAAK;gBAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAC1F,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAE1C,IAAI,CAAC,GAAG,CAAC,iCAAiC,IAAI,EAAE,CAAC,CAAC;;KACnD;;AApCH,+BAqCC;AApCiB,wBAAW,GACzB,wPAAwP,CAAC;AAE3O,qBAAQ,GAAG;IACzB,EAAE,WAAW,EAAE,4EAA4E,EAAE,OAAO,EAAE,qCAAqC,EAAE;IAC7I,EAAE,WAAW,EAAE,2CAA2C,EAAE,OAAO,EAAE,qEAAqE,EAAE;IAC5I,EAAE,WAAW,EAAE,gCAAgC,EAAE,OAAO,EAAE,6CAA6C,EAAE;CAC1G,CAAC;AAEc,kBAAK,GAAG;IACtB,IAAI,EAAE,YAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IAC/B,GAAG,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,8GAA8G,EAAE,CAAC;IAC7J,KAAK,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,wDAAwD,EAAE,CAAC;CAC3G,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class SkillPath extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: {
|
|
5
|
+
description: string;
|
|
6
|
+
command: string;
|
|
7
|
+
}[];
|
|
8
|
+
static flags: {
|
|
9
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const skill_assets_1 = require("../../skill-assets");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
class SkillPath extends core_1.Command {
|
|
8
|
+
run() {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
const dir = (0, skill_assets_1.skillDir)();
|
|
11
|
+
if (!fs.existsSync(dir)) {
|
|
12
|
+
this.error(`Bundled skill directory not found at ${dir}. This CLI build may be missing the shipped skill (package "files" should include /skill).`);
|
|
13
|
+
}
|
|
14
|
+
this.log(dir);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = SkillPath;
|
|
19
|
+
SkillPath.description = "Prints the absolute path of the bundled Codiac agent skill directory (SKILL.md + references/) that ships with this CLI. Useful for scripting or pointing a skill-aware harness at it.";
|
|
20
|
+
SkillPath.examples = [
|
|
21
|
+
{ description: 'Print the skill directory path.', command: '<%= config.bin %> <%= command.id %>' },
|
|
22
|
+
];
|
|
23
|
+
SkillPath.flags = {
|
|
24
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/commands/skill/path.ts"],"names":[],"mappings":";;;AAAA,sCAA6C;AAC7C,qDAA8C;AAC9C,yBAAyB;AAEzB,MAAqB,SAAU,SAAQ,cAAO;IAY/B,GAAG;;YACd,MAAM,GAAG,GAAG,IAAA,uBAAQ,GAAE,CAAC;YACvB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;gBACvB,IAAI,CAAC,KAAK,CAAC,wCAAwC,GAAG,4FAA4F,CAAC,CAAC;aACrJ;YACD,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC;KAAA;;AAlBH,4BAmBC;AAlBiB,qBAAW,GACzB,uLAAuL,CAAC;AAE1K,kBAAQ,GAAG;IACzB,EAAE,WAAW,EAAE,iCAAiC,EAAE,OAAO,EAAE,qCAAqC,EAAE;CACnG,CAAC;AAEc,eAAK,GAAG;IACtB,IAAI,EAAE,YAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;CAChC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class SkillShow extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: {
|
|
5
|
+
description: string;
|
|
6
|
+
command: string;
|
|
7
|
+
}[];
|
|
8
|
+
static flags: {
|
|
9
|
+
help: import("@oclif/core/lib/interfaces").BooleanFlag<void>;
|
|
10
|
+
file: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
|
+
list: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const skill_assets_1 = require("../../skill-assets");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
class SkillShow extends core_1.Command {
|
|
8
|
+
run() {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
const { flags } = yield this.parse(SkillShow);
|
|
11
|
+
if (flags.list) {
|
|
12
|
+
const root = (0, skill_assets_1.skillDir)();
|
|
13
|
+
for (const p of (0, skill_assets_1.skillFilePaths)())
|
|
14
|
+
this.log(path.relative(root, p));
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (flags.file) {
|
|
18
|
+
const content = (0, skill_assets_1.readSkillFile)(flags.file);
|
|
19
|
+
if (content == undefined) {
|
|
20
|
+
this.error(`Skill file not found: ${flags.file}. Use \`cod skill show --list\` to see the available files.`);
|
|
21
|
+
}
|
|
22
|
+
// process.stdout so the raw doc pipes cleanly with no styling/prefix.
|
|
23
|
+
process.stdout.write(content.endsWith('\n') ? content : content + '\n');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
process.stdout.write((0, skill_assets_1.readFullSkill)() + '\n');
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.default = SkillShow;
|
|
31
|
+
SkillShow.description = 'Prints the Codiac agent skill — the canonical guidance for driving `cod` correctly (concepts + the read-`--help`-first discipline + the flag-collision map). AI agents: read this before using the CLI; a system prompt can inject it via `$(cod skill show)`.';
|
|
32
|
+
SkillShow.examples = [
|
|
33
|
+
{ description: 'Print the whole skill (SKILL.md + references) as one document.', command: '<%= config.bin %> <%= command.id %>' },
|
|
34
|
+
{ description: 'Inject the skill into an agent system prompt.', command: 'SYSTEM="$(<%= config.bin %> <%= command.id %>)"' },
|
|
35
|
+
{ description: 'Print just one file.', command: '<%= config.bin %> <%= command.id %> --file references/cli-reference.md' },
|
|
36
|
+
{ description: 'List the files that make up the skill.', command: '<%= config.bin %> <%= command.id %> --list' },
|
|
37
|
+
];
|
|
38
|
+
SkillShow.flags = {
|
|
39
|
+
help: core_1.Flags.help({ char: 'h' }),
|
|
40
|
+
file: core_1.Flags.string({ char: 'f', description: 'Print a single skill file by its path relative to the skill root (e.g. SKILL.md, references/concepts.md).' }),
|
|
41
|
+
list: core_1.Flags.boolean({ char: 'l', description: 'List the files that make up the skill instead of printing their contents.' }),
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=show.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show.js","sourceRoot":"","sources":["../../../src/commands/skill/show.ts"],"names":[],"mappings":";;;AAAA,sCAA6C;AAC7C,qDAA4F;AAC5F,6BAA6B;AAE7B,MAAqB,SAAU,SAAQ,cAAO;IAiB/B,GAAG;;YACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAE9C,IAAI,KAAK,CAAC,IAAI,EAAE;gBACd,MAAM,IAAI,GAAG,IAAA,uBAAQ,GAAE,CAAC;gBACxB,KAAK,MAAM,CAAC,IAAI,IAAA,6BAAc,GAAE;oBAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBACnE,OAAO;aACR;YAED,IAAI,KAAK,CAAC,IAAI,EAAE;gBACd,MAAM,OAAO,GAAG,IAAA,4BAAa,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC1C,IAAI,OAAO,IAAI,SAAS,EAAE;oBACxB,IAAI,CAAC,KAAK,CAAC,yBAAyB,KAAK,CAAC,IAAI,6DAA6D,CAAC,CAAC;iBAC9G;gBACD,sEAAsE;gBACtE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;gBACxE,OAAO;aACR;YAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAA,4BAAa,GAAE,GAAG,IAAI,CAAC,CAAC;QAC/C,CAAC;KAAA;;AArCH,4BAsCC;AArCiB,qBAAW,GACzB,gQAAgQ,CAAC;AAEnP,kBAAQ,GAAG;IACzB,EAAE,WAAW,EAAE,gEAAgE,EAAE,OAAO,EAAE,qCAAqC,EAAE;IACjI,EAAE,WAAW,EAAE,+CAA+C,EAAE,OAAO,EAAE,iDAAiD,EAAE;IAC5H,EAAE,WAAW,EAAE,sBAAsB,EAAE,OAAO,EAAE,wEAAwE,EAAE;IAC1H,EAAE,WAAW,EAAE,wCAAwC,EAAE,OAAO,EAAE,4CAA4C,EAAE;CACjH,CAAC;AAEc,eAAK,GAAG;IACtB,IAAI,EAAE,YAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IAC/B,IAAI,EAAE,YAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,2GAA2G,EAAE,CAAC;IAC3J,IAAI,EAAE,YAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,2EAA2E,EAAE,CAAC;CAC7H,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locators + readers for the bundled Codiac agent skill (SKILL.md + references/), shipped inside
|
|
3
|
+
* this package so the CLI can advertise and serve its own usage guidance.
|
|
4
|
+
*
|
|
5
|
+
* The skill is the canonical "how to drive `cod` without hallucinating" doc; it lives in the CLI
|
|
6
|
+
* repo (`<repo>/skill/`) so a change to a command/flag updates the guidance in the same PR — no
|
|
7
|
+
* drift. `package.json` ships it via the `files` array (`/skill`).
|
|
8
|
+
*
|
|
9
|
+
* Path resolution: this module compiles to `<pkg>/dist/skill-assets.js`, so `../skill` resolves to
|
|
10
|
+
* `<pkg>/skill` both in local dev (`<repo>/dist/…` -> `<repo>/skill`) and in the published package.
|
|
11
|
+
*/
|
|
12
|
+
export declare function skillDir(): string;
|
|
13
|
+
/** The skill files in read order: SKILL.md first, then its references. Returns absolute paths that
|
|
14
|
+
* actually exist (so a partial install or a renamed reference never crashes the command). */
|
|
15
|
+
export declare function skillFilePaths(): string[];
|
|
16
|
+
/** The whole skill as one document — SKILL.md then each reference, each under a clear delimiter.
|
|
17
|
+
* This is the payload a non-skill-aware agent (hermes/openclaw/etc.) injects into its system
|
|
18
|
+
* prompt via `cod skill show`. */
|
|
19
|
+
export declare function readFullSkill(): string;
|
|
20
|
+
/** Read a single skill file by its path relative to the skill root (e.g. "SKILL.md" or
|
|
21
|
+
* "references/concepts.md"). Returns undefined if it isn't present. */
|
|
22
|
+
export declare function readSkillFile(relative: string): string | undefined;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readSkillFile = exports.readFullSkill = exports.skillFilePaths = exports.skillDir = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
/**
|
|
7
|
+
* Locators + readers for the bundled Codiac agent skill (SKILL.md + references/), shipped inside
|
|
8
|
+
* this package so the CLI can advertise and serve its own usage guidance.
|
|
9
|
+
*
|
|
10
|
+
* The skill is the canonical "how to drive `cod` without hallucinating" doc; it lives in the CLI
|
|
11
|
+
* repo (`<repo>/skill/`) so a change to a command/flag updates the guidance in the same PR — no
|
|
12
|
+
* drift. `package.json` ships it via the `files` array (`/skill`).
|
|
13
|
+
*
|
|
14
|
+
* Path resolution: this module compiles to `<pkg>/dist/skill-assets.js`, so `../skill` resolves to
|
|
15
|
+
* `<pkg>/skill` both in local dev (`<repo>/dist/…` -> `<repo>/skill`) and in the published package.
|
|
16
|
+
*/
|
|
17
|
+
function skillDir() {
|
|
18
|
+
return path.resolve(__dirname, "..", "skill");
|
|
19
|
+
}
|
|
20
|
+
exports.skillDir = skillDir;
|
|
21
|
+
/** The skill files in read order: SKILL.md first, then its references. Returns absolute paths that
|
|
22
|
+
* actually exist (so a partial install or a renamed reference never crashes the command). */
|
|
23
|
+
function skillFilePaths() {
|
|
24
|
+
const root = skillDir();
|
|
25
|
+
const ordered = [
|
|
26
|
+
path.join(root, "SKILL.md"),
|
|
27
|
+
path.join(root, "references", "concepts.md"),
|
|
28
|
+
path.join(root, "references", "cli-reference.md"),
|
|
29
|
+
];
|
|
30
|
+
// Include any other references not explicitly listed, so new files ship without a code change.
|
|
31
|
+
const refsDir = path.join(root, "references");
|
|
32
|
+
if (fs.existsSync(refsDir)) {
|
|
33
|
+
for (const f of fs.readdirSync(refsDir)) {
|
|
34
|
+
const full = path.join(refsDir, f);
|
|
35
|
+
if (f.endsWith(".md") && !ordered.includes(full))
|
|
36
|
+
ordered.push(full);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return ordered.filter(p => fs.existsSync(p));
|
|
40
|
+
}
|
|
41
|
+
exports.skillFilePaths = skillFilePaths;
|
|
42
|
+
/** The whole skill as one document — SKILL.md then each reference, each under a clear delimiter.
|
|
43
|
+
* This is the payload a non-skill-aware agent (hermes/openclaw/etc.) injects into its system
|
|
44
|
+
* prompt via `cod skill show`. */
|
|
45
|
+
function readFullSkill() {
|
|
46
|
+
const root = skillDir();
|
|
47
|
+
const parts = [];
|
|
48
|
+
for (const p of skillFilePaths()) {
|
|
49
|
+
const rel = path.relative(root, p);
|
|
50
|
+
parts.push(`===== BEGIN ${rel} =====\n${fs.readFileSync(p, "utf8").trimEnd()}\n===== END ${rel} =====`);
|
|
51
|
+
}
|
|
52
|
+
return parts.join("\n\n");
|
|
53
|
+
}
|
|
54
|
+
exports.readFullSkill = readFullSkill;
|
|
55
|
+
/** Read a single skill file by its path relative to the skill root (e.g. "SKILL.md" or
|
|
56
|
+
* "references/concepts.md"). Returns undefined if it isn't present. */
|
|
57
|
+
function readSkillFile(relative) {
|
|
58
|
+
const full = path.join(skillDir(), relative);
|
|
59
|
+
// Guard against path traversal outside the skill dir.
|
|
60
|
+
if (!path.resolve(full).startsWith(path.resolve(skillDir())))
|
|
61
|
+
return undefined;
|
|
62
|
+
return fs.existsSync(full) ? fs.readFileSync(full, "utf8") : undefined;
|
|
63
|
+
}
|
|
64
|
+
exports.readSkillFile = readSkillFile;
|
|
65
|
+
//# sourceMappingURL=skill-assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-assets.js","sourceRoot":"","sources":["../src/skill-assets.ts"],"names":[],"mappings":";;;AAAA,yBAAyB;AACzB,6BAA6B;AAE7B;;;;;;;;;;GAUG;AACH,SAAgB,QAAQ;IACtB,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC;AAFD,4BAEC;AAED;8FAC8F;AAC9F,SAAgB,cAAc;IAC5B,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;IACxB,MAAM,OAAO,GAAG;QACd,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC;QAC3B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,aAAa,CAAC;QAC5C,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,kBAAkB,CAAC;KAClD,CAAC;IACF,+FAA+F;IAC/F,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAC9C,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC1B,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;YACvC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACnC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACtE;KACF;IACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAhBD,wCAgBC;AAED;;mCAEmC;AACnC,SAAgB,aAAa;IAC3B,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;IACxB,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,IAAI,cAAc,EAAE,EAAE;QAChC,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,eAAe,GAAG,WAAW,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAAC,CAAC;KACzG;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC;AARD,sCAQC;AAED;wEACwE;AACxE,SAAgB,aAAa,CAAC,QAAgB;IAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC7C,sDAAsD;IACtD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IAC/E,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACzE,CAAC;AALD,sCAKC"}
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.3.
|
|
2
|
+
"version": "1.3.247",
|
|
3
3
|
"commands": {
|
|
4
4
|
"branch": {
|
|
5
5
|
"id": "branch",
|
|
@@ -9037,6 +9037,132 @@
|
|
|
9037
9037
|
},
|
|
9038
9038
|
"args": {}
|
|
9039
9039
|
},
|
|
9040
|
+
"skill:install": {
|
|
9041
|
+
"id": "skill:install",
|
|
9042
|
+
"description": "Copies the bundled Codiac agent skill into a skills directory so a skill-aware harness (e.g. Claude Code) discovers it. Defaults to ~/.claude/skills/codiac. For runtimes that aren't skill-aware, use `cod skill show` to inject the content instead.",
|
|
9043
|
+
"strict": true,
|
|
9044
|
+
"pluginName": "@codiac.io/codiac-cli",
|
|
9045
|
+
"pluginAlias": "@codiac.io/codiac-cli",
|
|
9046
|
+
"pluginType": "core",
|
|
9047
|
+
"aliases": [],
|
|
9048
|
+
"hiddenAliases": [],
|
|
9049
|
+
"examples": [
|
|
9050
|
+
{
|
|
9051
|
+
"description": "Install into the default Claude Code skills dir (~/.claude/skills/codiac).",
|
|
9052
|
+
"command": "<%= config.bin %> <%= command.id %>"
|
|
9053
|
+
},
|
|
9054
|
+
{
|
|
9055
|
+
"description": "Install into a specific skills directory.",
|
|
9056
|
+
"command": "<%= config.bin %> <%= command.id %> --dir /workspace/.claude/skills"
|
|
9057
|
+
},
|
|
9058
|
+
{
|
|
9059
|
+
"description": "Overwrite an existing install.",
|
|
9060
|
+
"command": "<%= config.bin %> <%= command.id %> --force"
|
|
9061
|
+
}
|
|
9062
|
+
],
|
|
9063
|
+
"flags": {
|
|
9064
|
+
"help": {
|
|
9065
|
+
"name": "help",
|
|
9066
|
+
"type": "boolean",
|
|
9067
|
+
"char": "h",
|
|
9068
|
+
"description": "Show CLI help.",
|
|
9069
|
+
"allowNo": false
|
|
9070
|
+
},
|
|
9071
|
+
"dir": {
|
|
9072
|
+
"name": "dir",
|
|
9073
|
+
"type": "option",
|
|
9074
|
+
"char": "d",
|
|
9075
|
+
"description": "Parent skills directory to install into (the skill is placed in <dir>/codiac). Defaults to ~/.claude/skills.",
|
|
9076
|
+
"multiple": false
|
|
9077
|
+
},
|
|
9078
|
+
"force": {
|
|
9079
|
+
"name": "force",
|
|
9080
|
+
"type": "boolean",
|
|
9081
|
+
"char": "f",
|
|
9082
|
+
"description": "Overwrite an existing codiac skill at the destination.",
|
|
9083
|
+
"allowNo": false
|
|
9084
|
+
}
|
|
9085
|
+
},
|
|
9086
|
+
"args": {}
|
|
9087
|
+
},
|
|
9088
|
+
"skill:path": {
|
|
9089
|
+
"id": "skill:path",
|
|
9090
|
+
"description": "Prints the absolute path of the bundled Codiac agent skill directory (SKILL.md + references/) that ships with this CLI. Useful for scripting or pointing a skill-aware harness at it.",
|
|
9091
|
+
"strict": true,
|
|
9092
|
+
"pluginName": "@codiac.io/codiac-cli",
|
|
9093
|
+
"pluginAlias": "@codiac.io/codiac-cli",
|
|
9094
|
+
"pluginType": "core",
|
|
9095
|
+
"aliases": [],
|
|
9096
|
+
"hiddenAliases": [],
|
|
9097
|
+
"examples": [
|
|
9098
|
+
{
|
|
9099
|
+
"description": "Print the skill directory path.",
|
|
9100
|
+
"command": "<%= config.bin %> <%= command.id %>"
|
|
9101
|
+
}
|
|
9102
|
+
],
|
|
9103
|
+
"flags": {
|
|
9104
|
+
"help": {
|
|
9105
|
+
"name": "help",
|
|
9106
|
+
"type": "boolean",
|
|
9107
|
+
"char": "h",
|
|
9108
|
+
"description": "Show CLI help.",
|
|
9109
|
+
"allowNo": false
|
|
9110
|
+
}
|
|
9111
|
+
},
|
|
9112
|
+
"args": {}
|
|
9113
|
+
},
|
|
9114
|
+
"skill:show": {
|
|
9115
|
+
"id": "skill:show",
|
|
9116
|
+
"description": "Prints the Codiac agent skill — the canonical guidance for driving `cod` correctly (concepts + the read-`--help`-first discipline + the flag-collision map). AI agents: read this before using the CLI; a system prompt can inject it via `$(cod skill show)`.",
|
|
9117
|
+
"strict": true,
|
|
9118
|
+
"pluginName": "@codiac.io/codiac-cli",
|
|
9119
|
+
"pluginAlias": "@codiac.io/codiac-cli",
|
|
9120
|
+
"pluginType": "core",
|
|
9121
|
+
"aliases": [],
|
|
9122
|
+
"hiddenAliases": [],
|
|
9123
|
+
"examples": [
|
|
9124
|
+
{
|
|
9125
|
+
"description": "Print the whole skill (SKILL.md + references) as one document.",
|
|
9126
|
+
"command": "<%= config.bin %> <%= command.id %>"
|
|
9127
|
+
},
|
|
9128
|
+
{
|
|
9129
|
+
"description": "Inject the skill into an agent system prompt.",
|
|
9130
|
+
"command": "SYSTEM=\"$(<%= config.bin %> <%= command.id %>)\""
|
|
9131
|
+
},
|
|
9132
|
+
{
|
|
9133
|
+
"description": "Print just one file.",
|
|
9134
|
+
"command": "<%= config.bin %> <%= command.id %> --file references/cli-reference.md"
|
|
9135
|
+
},
|
|
9136
|
+
{
|
|
9137
|
+
"description": "List the files that make up the skill.",
|
|
9138
|
+
"command": "<%= config.bin %> <%= command.id %> --list"
|
|
9139
|
+
}
|
|
9140
|
+
],
|
|
9141
|
+
"flags": {
|
|
9142
|
+
"help": {
|
|
9143
|
+
"name": "help",
|
|
9144
|
+
"type": "boolean",
|
|
9145
|
+
"char": "h",
|
|
9146
|
+
"description": "Show CLI help.",
|
|
9147
|
+
"allowNo": false
|
|
9148
|
+
},
|
|
9149
|
+
"file": {
|
|
9150
|
+
"name": "file",
|
|
9151
|
+
"type": "option",
|
|
9152
|
+
"char": "f",
|
|
9153
|
+
"description": "Print a single skill file by its path relative to the skill root (e.g. SKILL.md, references/concepts.md).",
|
|
9154
|
+
"multiple": false
|
|
9155
|
+
},
|
|
9156
|
+
"list": {
|
|
9157
|
+
"name": "list",
|
|
9158
|
+
"type": "boolean",
|
|
9159
|
+
"char": "l",
|
|
9160
|
+
"description": "List the files that make up the skill instead of printing their contents.",
|
|
9161
|
+
"allowNo": false
|
|
9162
|
+
}
|
|
9163
|
+
},
|
|
9164
|
+
"args": {}
|
|
9165
|
+
},
|
|
9040
9166
|
"snapshot:deploy": {
|
|
9041
9167
|
"id": "snapshot:deploy",
|
|
9042
9168
|
"description": "Deploys all assets in a snapshot to a target cabinet.",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codiac.io/codiac-cli",
|
|
3
3
|
"description": "Local command line interface for managing enterprise assets and environments.",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.247",
|
|
5
5
|
"author": "Codiac",
|
|
6
6
|
"bin": {
|
|
7
7
|
"codiac": "./bin/run",
|
|
@@ -142,7 +142,8 @@
|
|
|
142
142
|
"codiac.json",
|
|
143
143
|
"/npm-shrinkwrap.json",
|
|
144
144
|
"/oclif.manifest.json",
|
|
145
|
-
"/scaffolding"
|
|
145
|
+
"/scaffolding",
|
|
146
|
+
"/skill"
|
|
146
147
|
],
|
|
147
148
|
"homepage": "codiac.io",
|
|
148
149
|
"keywords": [
|
|
@@ -188,7 +189,12 @@
|
|
|
188
189
|
"win32-arm64",
|
|
189
190
|
"darwin-x64",
|
|
190
191
|
"darwin-arm64"
|
|
191
|
-
]
|
|
192
|
+
],
|
|
193
|
+
"topics": {
|
|
194
|
+
"skill": {
|
|
195
|
+
"description": "The Codiac agent skill — how to drive `cod` correctly (concepts + read-`--help`-first discipline + flag traps). AI agents: run `cod skill show` and follow it before using the CLI; `cod skill install` for a skill-aware harness."
|
|
196
|
+
}
|
|
197
|
+
}
|
|
192
198
|
},
|
|
193
199
|
"repository": "codiac/codiac-cli",
|
|
194
200
|
"types": "dist/index.d.ts"
|
package/skill/SKILL.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codiac
|
|
3
|
+
description: >-
|
|
4
|
+
Operate the Codiac platform through the `cod` CLI (and, secondarily, the NATS relay API).
|
|
5
|
+
Use this whenever a task touches Codiac at all: deploying or managing assets/workloads,
|
|
6
|
+
editing scoped configuration or secrets, working with enterprises, environments, cabinets,
|
|
7
|
+
clusters, image registries, CSP/cloud profiles, hosts/ingress, or agents — or any time you
|
|
8
|
+
are about to type a `cod ...` command or reason about how Codiac deploys things. Reach for it
|
|
9
|
+
even when the user doesn't say "Codiac" but names a Codiac concept (asset, cabinet, scoped
|
|
10
|
+
setting, enterprise, environment, cluster, CSP profile, EVC). Its whole job is to stop you
|
|
11
|
+
guessing cod commands, subcommands, args, and flags — the CLI is self-documenting, and this
|
|
12
|
+
skill gives you the concept model plus the one habit that prevents almost every mistake:
|
|
13
|
+
read `cod <topic> <verb> --help` before you call a command you are not certain of.
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Codiac
|
|
17
|
+
|
|
18
|
+
You are operating **Codiac** — a platform that deploys and manages workloads on Kubernetes
|
|
19
|
+
clusters. Your tool is the **`cod` CLI**. Data operations also flow over a **NATS relay API**,
|
|
20
|
+
but the CLI is the primary, safe surface and you should prefer it.
|
|
21
|
+
|
|
22
|
+
## The one thing that matters most
|
|
23
|
+
|
|
24
|
+
**`cod` is self-documenting, and guessing is the failure mode.** Every command carries a
|
|
25
|
+
description, every flag has its own description, and commands ship titled, copy-pasteable
|
|
26
|
+
examples. So the fast path is never to recall a command from memory — it is:
|
|
27
|
+
|
|
28
|
+
> **Before you run any `cod` command you are not 100% certain of, run `cod <topic> <verb> --help` and read it.**
|
|
29
|
+
|
|
30
|
+
This is faster, not slower, than guessing. A guessed flag fails (or worse, silently does the
|
|
31
|
+
wrong thing against a real cluster), costs a round-trip, and erodes trust. Reading `--help`
|
|
32
|
+
costs one cheap call and makes the very next command correct.
|
|
33
|
+
|
|
34
|
+
Why this is non-negotiable and not just good manners: **Codiac's flag characters collide across
|
|
35
|
+
commands.** `-e` means *enterprise* in `cod asset list` and `cod config view`, but *environment*
|
|
36
|
+
in `cod cabinet create`, `cod config add`, and `cod config settings get` (where enterprise is
|
|
37
|
+
`-n`). Asset version is `-u`, not `-v`. On `cod asset deploy`, `-n` is a cloud username and `-t`
|
|
38
|
+
is a cabinet tag. Several primary inputs (tenant code, cluster, provider, cabinet name) are
|
|
39
|
+
**positional args, not flags**. There is no convention you can lean on — only `--help` is truth.
|
|
40
|
+
See `references/cli-reference.md` for the collision map, but treat even that as orientation:
|
|
41
|
+
`--help` on the specific command is the authority.
|
|
42
|
+
|
|
43
|
+
## When you're working in this skill
|
|
44
|
+
|
|
45
|
+
Most tasks are one of:
|
|
46
|
+
- **Deploy / manage a workload** — `cod asset deploy`, `asset list`, `asset view`, `asset undeploy`, `asset recycle`.
|
|
47
|
+
- **Read or change configuration / secrets** — `cod config view` (preview the resolved doc), `config add` (set a value), `config settings get` (inspect raw settings), scoped-setting work.
|
|
48
|
+
- **Work with the topology** — enterprises, environments, cabinets, clusters, hosts/ingress.
|
|
49
|
+
- **Cloud/registry auth** — `cod csp login` for a provider (Azure/AWS/DockerHub).
|
|
50
|
+
- **Install an agent** — `cod ai agent install`.
|
|
51
|
+
|
|
52
|
+
If you don't know which command a task maps to, skim the command tree in
|
|
53
|
+
`references/cli-reference.md`, then `--help` the candidate.
|
|
54
|
+
|
|
55
|
+
## Hold the concept model before you touch a command
|
|
56
|
+
|
|
57
|
+
Codiac's mental model is small but easy to conflate. Get it wrong and you'll pass the wrong
|
|
58
|
+
flag values even with perfect flag names. The essentials:
|
|
59
|
+
|
|
60
|
+
- **tenant → enterprise → environment → cabinet → cluster.** A **tenant** is the account. An
|
|
61
|
+
**enterprise** is a workspace inside it (two *types* exist: normal/`sdlc` and `infrx` for
|
|
62
|
+
infrastructure — some commands enforce the type). An **environment** is a stage (dev/prod/…)
|
|
63
|
+
that **maps to a cluster** (the mapping is data-driven in the DB). A **cabinet** is a concrete
|
|
64
|
+
deployment target that lives **in an environment** — so it inherits that environment's cluster.
|
|
65
|
+
- **Therefore `cod cabinet create` takes `--environment`, never `--cluster`.** Cabinets and
|
|
66
|
+
clusters are ephemeral over an underlying namespace; the env→cluster link is the source of truth.
|
|
67
|
+
- **Asset** = a deployable workload (a `helm` chart or a `service`/container). Registered once,
|
|
68
|
+
versioned (AssetVersionConfig), then deployed into a cabinet.
|
|
69
|
+
- **Scoped settings / config** are values attached at a **scope** — `enterprise`, `environment`,
|
|
70
|
+
or `cabinet` — where **cabinet overrides environment overrides enterprise**. Shareable config
|
|
71
|
+
belongs at the *highest* scope that makes sense (set once, inherited), with narrower scopes as
|
|
72
|
+
optional overrides. Cabinet-scoping something that should be shared is an anti-pattern.
|
|
73
|
+
- The **EVC** (EnterpriseVersionConfig) is the versioned snapshot the platform actually reads;
|
|
74
|
+
deploys write it. Config can be a **literal value** or a **sourced** reference into a vault.
|
|
75
|
+
|
|
76
|
+
That's enough to choose the right command and fill it correctly. For depth — targetFile types
|
|
77
|
+
(`[helm]`/`[env]`/`[label]`/…), dotted-key/escaped-period behavior, `@{...}` templates, CSP
|
|
78
|
+
profiles, the NATS API, and the full hierarchy — read `references/concepts.md`.
|
|
79
|
+
|
|
80
|
+
## Authenticating (you may wake up logged out)
|
|
81
|
+
|
|
82
|
+
You may start **not logged in** — that's expected, and it's your job to get logged in before you
|
|
83
|
+
act. Operating Codiac needs **two** logins:
|
|
84
|
+
- **Codiac** — `cod login` for your tenant (`$CODIAC_TENANT` if it's set in your env; otherwise
|
|
85
|
+
you'll be told which tenant you belong to).
|
|
86
|
+
- **Cloud + registry** — `cod csp login <provider>` for each provider you use (typically `azure`
|
|
87
|
+
for the cluster and `docker` for images).
|
|
88
|
+
|
|
89
|
+
Check first with **`cod whoami`**. If it shows you're not logged in — or any command fails with an
|
|
90
|
+
auth / "not logged in" / "no credentials" error — you're missing one of those logins.
|
|
91
|
+
|
|
92
|
+
**You do not hold these credentials by design.** Never guess, fabricate, or hard-code them, and
|
|
93
|
+
never attempt a deploy/undeploy/config change while unauthenticated. Instead, **ask your operator
|
|
94
|
+
for what you need** — a Codiac login (username + password, or a token) and cloud creds (a login or a
|
|
95
|
+
token per provider) — then authenticate. Read `cod login --help` and `cod csp login --help` for the
|
|
96
|
+
exact accepted forms; both take secrets on stdin so nothing lands in a command string, e.g.:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
printf '%s' "<password>" | cod login -u <user> --tenantCode "$CODIAC_TENANT" --passwordIn
|
|
100
|
+
cod csp login <provider> # supply the login/token as --help shows (stdin under --silent)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Then re-check `cod whoami` and continue. If your session lapses later, you'll see auth errors again
|
|
104
|
+
— ask and re-login the same way.
|
|
105
|
+
|
|
106
|
+
## Running a `cod` command safely
|
|
107
|
+
|
|
108
|
+
1. **Establish context.** Enterprise-scoped commands need a tenant (and often an enterprise).
|
|
109
|
+
`cod tenant switch <code>` sets the tenant; many commands take `--enterprise`. A deployed agent
|
|
110
|
+
usually already runs inside its tenant's context.
|
|
111
|
+
2. **`--help` the exact command** unless you have literally just read it. Read the flag
|
|
112
|
+
descriptions and the examples — copy an example and adapt it rather than composing from scratch.
|
|
113
|
+
3. **In automation / non-interactive shells, pass `--silent` and every required arg.** `--silent`
|
|
114
|
+
(and piped stdin, which auto-switches to silent) has **no prompt fallback** — a missing or
|
|
115
|
+
invalid required value throws instead of asking. Secrets that would normally be prompted are
|
|
116
|
+
fed via stdin (e.g. `cod csp login` password, `cod config add --value-stdin`).
|
|
117
|
+
4. **Preview only in a real terminal — never headless.** `--echo`/`--to-script` render the
|
|
118
|
+
equivalent `--silent` command, but they run the *interactive* build first, so in a non-TTY they
|
|
119
|
+
**prompt and hang**. Headless, `--silent` is your safe mode: it validates and **throws** on a
|
|
120
|
+
missing/invalid arg (fast, never hangs) instead of prompting. To preview a command without
|
|
121
|
+
running it headless, build it from `--help` and simply don't execute — don't reach for
|
|
122
|
+
`--to-script`.
|
|
123
|
+
5. **Reading a list?** List commands take `--output/-o` (`tree` default; `json`/`yaml`/… for
|
|
124
|
+
machines) and usually `--query/-q` (JMESPath). `-q` implies JSON; `tree`/`text` reject `-q`.
|
|
125
|
+
|
|
126
|
+
## Operating a running workload (logs, status, events, exec, config)
|
|
127
|
+
|
|
128
|
+
Almost everything about a live workload comes from **`cod asset view`** (and `cod cabinet contents`
|
|
129
|
+
/ `cod asset list`) — reach for these first; read-only `kubectl` is only a fallback. `cod asset
|
|
130
|
+
view` flags: `-e` enterprise, `-a` asset, `-n` environment, `-c` cabinet, `-r` replica (`any` =
|
|
131
|
+
first, no prompt), `-t` content type.
|
|
132
|
+
|
|
133
|
+
- **What's deployed** (returns + exits, headless-safe): `cod cabinet contents -e <ent> -c <cab>` and `cod asset list -e <ent> -o json`.
|
|
134
|
+
- **Logs** (headless-safe): `cod asset view -t logs -e <ent> -a <asset> -n <env> -c <cab> -r any -l 50 --silent` — pass `-l N` for N lines (or `-l -1` for all); **omit `-f`** (follow streams forever).
|
|
135
|
+
- **Exec / env / config**: `cod asset view -t exec|env|config …` (config also takes `-T <helm|env|label|annotation|…>`).
|
|
136
|
+
- **Live status + events**: `cod asset view -t status` (aka `asset mon`) is an **interactive
|
|
137
|
+
streaming monitor** — great in a real terminal, but it does **not** return in a non-TTY/`--silent`
|
|
138
|
+
shell, so don't use it in automation. For a headless status snapshot, use `cabinet contents` /
|
|
139
|
+
`asset list` above. (For headless one-shot *events*, use `cod asset view -t events` — a
|
|
140
|
+
returns-and-exits events dump; `-l N` for count.)
|
|
141
|
+
|
|
142
|
+
## Hard rules (each earns its place)
|
|
143
|
+
|
|
144
|
+
- **Never invent a command, subcommand, or flag.** If it's not confirmed by `--help` or
|
|
145
|
+
`references/cli-reference.md`, verify before running. The grammar is strictly **noun-then-verb**
|
|
146
|
+
(`cod asset deploy`, `cod config settings get`) — never verb-first, never reordered.
|
|
147
|
+
- **`cod` first — don't lead with `kubectl`.** Almost everything about a running workload is
|
|
148
|
+
available through `cod asset view` (logs, exec, env, config, live status+events) and
|
|
149
|
+
`cod cabinet contents` / `cod asset list` (what's deployed) — reach for those before the cluster.
|
|
150
|
+
Read-only `kubectl get`/`describe`/`logs` is a fine fallback for diagnosis (and the user may
|
|
151
|
+
explicitly okay it); the point is to rely on Codiac's own calls first, not to ban `kubectl`. The
|
|
152
|
+
one firm line: **never make a *write* through raw `kubectl`/`helm`** against a Codiac-managed
|
|
153
|
+
asset — that corrupts Codiac's tracked view (stale rootmap/UI); make changes through `cod`.
|
|
154
|
+
- **Set `CODIAC_SESSION_ID` for a multi-step sequence** so every `cod` call shares one session
|
|
155
|
+
(otherwise steps can land in different sessions and lose context).
|
|
156
|
+
- **Treat prod as prod.** Deploys, undeploys, and config changes act on real clusters. In doubt,
|
|
157
|
+
**read first** — `cod config view`, `cod cabinet contents`, `cod asset view` — before you write.
|
|
158
|
+
|
|
159
|
+
## When something's missing
|
|
160
|
+
|
|
161
|
+
If a task seems to have no `cod` command, the first instinct to resist is **hallucinating a flag**.
|
|
162
|
+
Instead:
|
|
163
|
+
1. Re-check `--help` on the most relevant command (especially `cod asset view --help` — logs,
|
|
164
|
+
exec, env, config, live status, and events all live there under `-t`).
|
|
165
|
+
2. Check the command tree in `references/cli-reference.md` for a topic you haven't considered.
|
|
166
|
+
3. If it's genuinely absent, **name the gap** so it can be added to `cod` — that's the durable fix.
|
|
167
|
+
A **read-only** `kubectl get`/`describe` check is an acceptable stopgap in the meantime (and the
|
|
168
|
+
user may okay it outright); just never a raw `kubectl`/`helm` *write* against a Codiac-managed
|
|
169
|
+
asset, and prefer getting the capability into `cod` over a standing `kubectl` habit.
|
|
170
|
+
|
|
171
|
+
## Reference files
|
|
172
|
+
|
|
173
|
+
- `references/cli-reference.md` — the command tree (every topic → verbs), the flag-character
|
|
174
|
+
collision map, the list/output (`-o`/`-q`) pattern, positional-arg gotchas, and the `--silent`
|
|
175
|
+
rules. Orientation only; `--help` on the specific command is authoritative.
|
|
176
|
+
- `references/concepts.md` — the full Codiac mental model: the hierarchy and enterprise types,
|
|
177
|
+
assets and versioning, scoped configuration (scope/inheritance, targetFile types, sourced vs
|
|
178
|
+
literal, dotted keys and escaped periods, `@{...}` templates), the EVC/deploy model, CSP/cloud
|
|
179
|
+
auth, and the NATS relay API surface. Read it whenever a task goes past a single obvious command.
|