ai-ops-cli 1.0.1 → 1.0.3
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.ko.md +25 -0
- package/README.md +59 -34
- package/data/context-layer/AGENTS.md +5 -4
- package/data/context-layer/docs/agent/rules/00-agent-baseline.md +47 -0
- package/data/packs/spec-lifecycle/docs/specs/README.ko.md +2 -0
- package/data/packs/spec-lifecycle/docs/specs/README.md +2 -0
- package/data/skills/README.ko.md +2 -0
- package/data/skills/README.md +2 -0
- package/data/subagents/README.ko.md +2 -0
- package/data/subagents/README.md +2 -0
- package/dist/bin/index.js +67 -40
- package/dist/bin/index.js.map +1 -1
- package/package.json +1 -1
- package/data/presets.yaml +0 -35
- package/data/rules/code-philosophy.yaml +0 -35
- package/data/rules/communication.yaml +0 -12
- package/data/rules/naming-convention.yaml +0 -10
- package/data/rules/plan-mode.yaml +0 -32
- package/data/rules/role-persona.yaml +0 -14
package/dist/bin/index.js
CHANGED
|
@@ -491,7 +491,7 @@ import { join as join5 } from "path";
|
|
|
491
491
|
|
|
492
492
|
// src/core/source-hash.ts
|
|
493
493
|
import { createHash } from "crypto";
|
|
494
|
-
import {
|
|
494
|
+
import { readFileSync as readFileSync2, readdirSync as readdirSync2 } from "fs";
|
|
495
495
|
import { dirname, join as join4, resolve as resolve2 } from "path";
|
|
496
496
|
import { fileURLToPath } from "url";
|
|
497
497
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -788,7 +788,7 @@ var writeSubagentManifest = (manifestPath, manifest) => {
|
|
|
788
788
|
import { join as join9 } from "path";
|
|
789
789
|
|
|
790
790
|
// src/core/project-layer.ts
|
|
791
|
-
import { existsSync
|
|
791
|
+
import { existsSync, mkdirSync as mkdirSync4, readFileSync as readFileSync6, readdirSync as readdirSync3, rmSync, writeFileSync as writeFileSync4 } from "fs";
|
|
792
792
|
import { dirname as dirname6, isAbsolute, join as join10, relative, resolve as resolve5 } from "path";
|
|
793
793
|
|
|
794
794
|
// src/core/paths.ts
|
|
@@ -808,6 +808,7 @@ var TEMPLATE_PATHS = [
|
|
|
808
808
|
"GEMINI.md",
|
|
809
809
|
"CLAUDE.md",
|
|
810
810
|
"docs/agent/workflow.md",
|
|
811
|
+
"docs/agent/rules/00-agent-baseline.md",
|
|
811
812
|
"docs/agent/rules/routing-rules.md",
|
|
812
813
|
"docs/agent/rules/doc-update-rules.md",
|
|
813
814
|
"docs/agent/rules/stop-rules.md",
|
|
@@ -865,14 +866,45 @@ var parseProjectLayerDocument = (path, rawContent) => {
|
|
|
865
866
|
content
|
|
866
867
|
};
|
|
867
868
|
};
|
|
869
|
+
var parseMarkdownTableCells = (line) => {
|
|
870
|
+
const trimmed = line.trim();
|
|
871
|
+
if (!trimmed.startsWith("|") || !trimmed.endsWith("|")) {
|
|
872
|
+
return null;
|
|
873
|
+
}
|
|
874
|
+
return trimmed.slice(1, -1).split("|").map((cell) => cell.trim());
|
|
875
|
+
};
|
|
876
|
+
var isDocsStatusHeaderLine = (line) => {
|
|
877
|
+
const cells = parseMarkdownTableCells(line);
|
|
878
|
+
return cells !== null && cells.length === 3 && cells[0] === "path" && cells[1] === "status" && cells[2] === "owner";
|
|
879
|
+
};
|
|
880
|
+
var isMarkdownDividerCell = (cell) => /^:?-{3,}:?$/.test(cell);
|
|
881
|
+
var isDocsStatusDividerLine = (line) => {
|
|
882
|
+
const cells = parseMarkdownTableCells(line);
|
|
883
|
+
return cells !== null && cells.length === 3 && cells.every(isMarkdownDividerCell);
|
|
884
|
+
};
|
|
885
|
+
var findDocsStatusTableBounds = (lines) => {
|
|
886
|
+
const headerIndex = lines.findIndex(isDocsStatusHeaderLine);
|
|
887
|
+
const dividerIndex = headerIndex + 1;
|
|
888
|
+
if (headerIndex < 0 || !isDocsStatusDividerLine(lines[dividerIndex] ?? "")) {
|
|
889
|
+
return null;
|
|
890
|
+
}
|
|
891
|
+
let tableEndIndex = dividerIndex + 1;
|
|
892
|
+
while (tableEndIndex < lines.length && parseMarkdownTableCells(lines[tableEndIndex] ?? "") !== null) {
|
|
893
|
+
tableEndIndex += 1;
|
|
894
|
+
}
|
|
895
|
+
return { headerIndex, dividerIndex, tableEndIndex };
|
|
896
|
+
};
|
|
868
897
|
var parseDocsStatusEntries = (content) => {
|
|
869
898
|
const document = parseProjectLayerDocument("docs/docs-status.md", content);
|
|
870
|
-
const
|
|
899
|
+
const lines = document.content.split("\n");
|
|
900
|
+
const tableBounds = findDocsStatusTableBounds(lines);
|
|
901
|
+
if (tableBounds === null) {
|
|
902
|
+
return [];
|
|
903
|
+
}
|
|
904
|
+
const rows = lines.slice(tableBounds.dividerIndex + 1, tableBounds.tableEndIndex);
|
|
871
905
|
return rows.flatMap((line) => {
|
|
872
|
-
const cells = line
|
|
873
|
-
if (cells.length < 3) return [];
|
|
874
|
-
if (cells[0] === "path") return [];
|
|
875
|
-
if (cells[0].startsWith("---")) return [];
|
|
906
|
+
const cells = parseMarkdownTableCells(line);
|
|
907
|
+
if (cells === null || cells.length < 3) return [];
|
|
876
908
|
return [
|
|
877
909
|
{
|
|
878
910
|
path: cells[0],
|
|
@@ -958,7 +990,7 @@ var installManagedFiles = (basePath, specs, meta) => {
|
|
|
958
990
|
for (const spec of specs) {
|
|
959
991
|
const absolutePath = resolveProjectLayerFilePath(basePath, spec.path);
|
|
960
992
|
const wrappedContent = wrapWithSection(spec.content, meta);
|
|
961
|
-
if (!
|
|
993
|
+
if (!existsSync(absolutePath)) {
|
|
962
994
|
mkdirSync4(dirname6(absolutePath), { recursive: true });
|
|
963
995
|
writeFileSync4(absolutePath, wrappedContent + "\n", "utf-8");
|
|
964
996
|
written.push(spec.path);
|
|
@@ -990,7 +1022,7 @@ var installProjectFiles = (params) => {
|
|
|
990
1022
|
for (const spec of params.specs) {
|
|
991
1023
|
const absolutePath = resolveProjectLayerFilePath(params.basePath, spec.path);
|
|
992
1024
|
const previous = previousByPath.get(spec.path);
|
|
993
|
-
if (!
|
|
1025
|
+
if (!existsSync(absolutePath)) {
|
|
994
1026
|
mkdirSync4(dirname6(absolutePath), { recursive: true });
|
|
995
1027
|
writeFileSync4(absolutePath, spec.content + "\n", "utf-8");
|
|
996
1028
|
created.push(spec.path);
|
|
@@ -1049,16 +1081,11 @@ var buildDocsStatusRowsFromDisk = (params) => params.documentPaths.map((path) =>
|
|
|
1049
1081
|
});
|
|
1050
1082
|
var replaceDocsStatusRows = (content, rows) => {
|
|
1051
1083
|
const lines = content.trimEnd().split("\n");
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1054
|
-
if (headerIndex < 0 || !lines[dividerIndex]?.trim().startsWith("| ---")) {
|
|
1084
|
+
const tableBounds = findDocsStatusTableBounds(lines);
|
|
1085
|
+
if (tableBounds === null) {
|
|
1055
1086
|
throw new Error("docs/docs-status.md table header not found");
|
|
1056
1087
|
}
|
|
1057
|
-
|
|
1058
|
-
while (tableEndIndex < lines.length && lines[tableEndIndex]?.trim().startsWith("|")) {
|
|
1059
|
-
tableEndIndex += 1;
|
|
1060
|
-
}
|
|
1061
|
-
return [...lines.slice(0, dividerIndex + 1), ...rows, ...lines.slice(tableEndIndex)].join("\n") + "\n";
|
|
1088
|
+
return [...lines.slice(0, tableBounds.dividerIndex + 1), ...rows, ...lines.slice(tableBounds.tableEndIndex)].join("\n") + "\n";
|
|
1062
1089
|
};
|
|
1063
1090
|
var updateDocsStatusTable = (basePath, documentPaths) => {
|
|
1064
1091
|
const docsStatusPath = "docs/docs-status.md";
|
|
@@ -1218,7 +1245,7 @@ var issue = (level, code, message) => ({
|
|
|
1218
1245
|
var readDocumentSafely = (basePath, path) => {
|
|
1219
1246
|
try {
|
|
1220
1247
|
const absolutePath = resolveProjectLayerFilePath(basePath, path);
|
|
1221
|
-
if (!
|
|
1248
|
+
if (!existsSync(absolutePath)) {
|
|
1222
1249
|
return issue("error", "missing-file", `\uD30C\uC77C \uC5C6\uC74C: ${path}`);
|
|
1223
1250
|
}
|
|
1224
1251
|
return parseProjectLayerDocument(path, readFileSync6(absolutePath, "utf-8"));
|
|
@@ -1312,7 +1339,7 @@ var diffProjectLayer = (basePath) => {
|
|
|
1312
1339
|
}
|
|
1313
1340
|
for (const file of manifest.managed_files) {
|
|
1314
1341
|
const absolutePath = resolveProjectLayerFilePath(basePath, file.path);
|
|
1315
|
-
if (!
|
|
1342
|
+
if (!existsSync(absolutePath)) {
|
|
1316
1343
|
issues.push(issue("error", "missing-file", `\uD30C\uC77C \uC5C6\uC74C: ${file.path}`));
|
|
1317
1344
|
continue;
|
|
1318
1345
|
}
|
|
@@ -1329,13 +1356,13 @@ var diffProjectLayer = (basePath) => {
|
|
|
1329
1356
|
}
|
|
1330
1357
|
}
|
|
1331
1358
|
for (const file of manifest.project_files) {
|
|
1332
|
-
if (!
|
|
1359
|
+
if (!existsSync(resolveProjectLayerFilePath(basePath, file.path))) {
|
|
1333
1360
|
issues.push(issue("error", "missing-file", `\uD30C\uC77C \uC5C6\uC74C: ${file.path}`));
|
|
1334
1361
|
}
|
|
1335
1362
|
}
|
|
1336
1363
|
for (const pack of manifest.packs) {
|
|
1337
1364
|
for (const file of [...pack.documents, ...pack.files]) {
|
|
1338
|
-
if (!
|
|
1365
|
+
if (!existsSync(resolveProjectLayerFilePath(basePath, file.path))) {
|
|
1339
1366
|
issues.push(issue("error", "missing-file", `\uD30C\uC77C \uC5C6\uC74C: ${file.path}`));
|
|
1340
1367
|
}
|
|
1341
1368
|
}
|
|
@@ -1372,7 +1399,7 @@ var auditProjectLayer = (basePath) => {
|
|
|
1372
1399
|
const contextPathSet = new Set(contextIndex?.documents.map((document) => document.path) ?? []);
|
|
1373
1400
|
const issues = [...diffReport.issues];
|
|
1374
1401
|
const docsStatusPath = resolveProjectLayerFilePath(basePath, "docs/docs-status.md");
|
|
1375
|
-
if (!
|
|
1402
|
+
if (!existsSync(docsStatusPath)) {
|
|
1376
1403
|
issues.push(issue("error", "missing-docs-status", "docs/docs-status.md\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."));
|
|
1377
1404
|
return { currentSourceHash: diffReport.currentSourceHash, issues };
|
|
1378
1405
|
}
|
|
@@ -1405,7 +1432,7 @@ var auditProjectLayer = (basePath) => {
|
|
|
1405
1432
|
};
|
|
1406
1433
|
function removeManagedProjectFile(basePath, relativePath) {
|
|
1407
1434
|
const absolutePath = resolveProjectLayerFilePath(basePath, relativePath);
|
|
1408
|
-
if (!
|
|
1435
|
+
if (!existsSync(absolutePath)) {
|
|
1409
1436
|
return { deleted: [], cleaned: [], preserved: [], notFound: [relativePath] };
|
|
1410
1437
|
}
|
|
1411
1438
|
const content = readFileSync6(absolutePath, "utf-8");
|
|
@@ -1422,7 +1449,7 @@ function removeManagedProjectFile(basePath, relativePath) {
|
|
|
1422
1449
|
}
|
|
1423
1450
|
var removeCreateOnlyProjectFile = (basePath, file) => {
|
|
1424
1451
|
const absolutePath = resolveProjectLayerFilePath(basePath, file.path);
|
|
1425
|
-
if (!
|
|
1452
|
+
if (!existsSync(absolutePath)) {
|
|
1426
1453
|
return { deleted: [], cleaned: [], preserved: [], notFound: [file.path] };
|
|
1427
1454
|
}
|
|
1428
1455
|
const content = readFileSync6(absolutePath, "utf-8").trimEnd();
|
|
@@ -1435,7 +1462,7 @@ var removeCreateOnlyProjectFile = (basePath, file) => {
|
|
|
1435
1462
|
};
|
|
1436
1463
|
var removePackOwnedFile = (basePath, file) => {
|
|
1437
1464
|
const absolutePath = resolveProjectLayerFilePath(basePath, file.path);
|
|
1438
|
-
if (!
|
|
1465
|
+
if (!existsSync(absolutePath)) {
|
|
1439
1466
|
return { deleted: [], cleaned: [], preserved: [], notFound: [file.path] };
|
|
1440
1467
|
}
|
|
1441
1468
|
const currentHash = computeHash([readFileSync6(absolutePath, "utf-8").trimEnd()]);
|
|
@@ -1457,7 +1484,7 @@ var removeEmptyDirs = (basePath, relativePaths) => {
|
|
|
1457
1484
|
);
|
|
1458
1485
|
for (const dir of [...dirs, ".ai-ops"]) {
|
|
1459
1486
|
const absoluteDir = resolveProjectLayerFilePath(basePath, dir);
|
|
1460
|
-
if (!
|
|
1487
|
+
if (!existsSync(absoluteDir)) continue;
|
|
1461
1488
|
try {
|
|
1462
1489
|
if (readdirSync3(absoluteDir).length === 0) {
|
|
1463
1490
|
rmSync(absoluteDir, { recursive: true });
|
|
@@ -1482,7 +1509,7 @@ var uninstallProjectLayer = (basePath, manifest) => {
|
|
|
1482
1509
|
};
|
|
1483
1510
|
|
|
1484
1511
|
// src/core/pack.ts
|
|
1485
|
-
import { existsSync as
|
|
1512
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync5, readFileSync as readFileSync7, readdirSync as readdirSync4, rmSync as rmSync2, writeFileSync as writeFileSync5 } from "fs";
|
|
1486
1513
|
import { dirname as dirname7, isAbsolute as isAbsolute2, join as join11, relative as relative2, resolve as resolve6 } from "path";
|
|
1487
1514
|
var PACK_REGISTRY_FILENAME = "pack-registry.json";
|
|
1488
1515
|
var SPEC_LIFECYCLE_PACK_ID = "spec-lifecycle";
|
|
@@ -1603,7 +1630,7 @@ var applyPackSourceFiles = (params) => {
|
|
|
1603
1630
|
for (const file of sourceFiles) {
|
|
1604
1631
|
const absolutePath = resolveProjectLayerFilePath(params.basePath, file.path);
|
|
1605
1632
|
const previous = previousByPath.get(file.path);
|
|
1606
|
-
if (!
|
|
1633
|
+
if (!existsSync2(absolutePath)) {
|
|
1607
1634
|
writePackFile(params.basePath, file);
|
|
1608
1635
|
written.push(file.path);
|
|
1609
1636
|
continue;
|
|
@@ -1627,7 +1654,7 @@ var applyPackSourceFiles = (params) => {
|
|
|
1627
1654
|
continue;
|
|
1628
1655
|
}
|
|
1629
1656
|
const absolutePath = resolveProjectLayerFilePath(params.basePath, previous.path);
|
|
1630
|
-
if (!
|
|
1657
|
+
if (!existsSync2(absolutePath)) {
|
|
1631
1658
|
notFound.push(previous.path);
|
|
1632
1659
|
continue;
|
|
1633
1660
|
}
|
|
@@ -1646,7 +1673,7 @@ var removePackFiles = (basePath, record) => {
|
|
|
1646
1673
|
const notFound = [];
|
|
1647
1674
|
for (const file of [...record.documents, ...record.files]) {
|
|
1648
1675
|
const absolutePath = resolveProjectLayerFilePath(basePath, file.path);
|
|
1649
|
-
if (!
|
|
1676
|
+
if (!existsSync2(absolutePath)) {
|
|
1650
1677
|
notFound.push(file.path);
|
|
1651
1678
|
continue;
|
|
1652
1679
|
}
|
|
@@ -1665,7 +1692,7 @@ var removeEmptyDirs2 = (basePath, relativePaths) => {
|
|
|
1665
1692
|
);
|
|
1666
1693
|
for (const dir of dirs) {
|
|
1667
1694
|
const absoluteDir = resolveProjectLayerFilePath(basePath, dir);
|
|
1668
|
-
if (!
|
|
1695
|
+
if (!existsSync2(absoluteDir)) {
|
|
1669
1696
|
continue;
|
|
1670
1697
|
}
|
|
1671
1698
|
try {
|
|
@@ -1781,7 +1808,7 @@ var diffProjectLayerPack = (params) => {
|
|
|
1781
1808
|
}
|
|
1782
1809
|
for (const file of [...record.documents, ...record.files]) {
|
|
1783
1810
|
const absolutePath = resolveProjectLayerFilePath(params.basePath, file.path);
|
|
1784
|
-
if (!
|
|
1811
|
+
if (!existsSync2(absolutePath)) {
|
|
1785
1812
|
issues.push(packIssue("error", "missing-file", `\uD30C\uC77C \uC5C6\uC74C: ${file.path}`));
|
|
1786
1813
|
}
|
|
1787
1814
|
}
|
|
@@ -2080,13 +2107,13 @@ var findInstalledSkill = (installedSkills, skillId) => {
|
|
|
2080
2107
|
};
|
|
2081
2108
|
|
|
2082
2109
|
// src/lib/skill-install.ts
|
|
2083
|
-
import { existsSync as
|
|
2110
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync6, rmSync as rmSync3, writeFileSync as writeFileSync6 } from "fs";
|
|
2084
2111
|
import { dirname as dirname8, resolve as resolve7 } from "path";
|
|
2085
2112
|
var installSkillPackages = (basePath, packages) => {
|
|
2086
2113
|
const writtenRoots = [];
|
|
2087
2114
|
for (const skillPackage of packages) {
|
|
2088
2115
|
const absRoot = resolve7(basePath, skillPackage.rootDir);
|
|
2089
|
-
if (
|
|
2116
|
+
if (existsSync3(absRoot)) {
|
|
2090
2117
|
rmSync3(absRoot, { recursive: true, force: true });
|
|
2091
2118
|
}
|
|
2092
2119
|
for (const file of skillPackage.files) {
|
|
@@ -2102,7 +2129,7 @@ var removeDirectories = (basePath, relativeDirs) => {
|
|
|
2102
2129
|
const removed = [];
|
|
2103
2130
|
for (const relativeDir of relativeDirs) {
|
|
2104
2131
|
const absPath = resolve7(basePath, relativeDir);
|
|
2105
|
-
if (!
|
|
2132
|
+
if (!existsSync3(absPath)) continue;
|
|
2106
2133
|
rmSync3(absPath, { recursive: true, force: true });
|
|
2107
2134
|
removed.push(relativeDir);
|
|
2108
2135
|
}
|
|
@@ -2281,10 +2308,10 @@ var skillUninstallCommand = async (skillId) => {
|
|
|
2281
2308
|
|
|
2282
2309
|
// src/commands/subagent.ts
|
|
2283
2310
|
import * as p8 from "@clack/prompts";
|
|
2284
|
-
import { existsSync as
|
|
2311
|
+
import { existsSync as existsSync5, rmSync as rmSync6 } from "fs";
|
|
2285
2312
|
|
|
2286
2313
|
// src/lib/subagent-install.ts
|
|
2287
|
-
import { existsSync as
|
|
2314
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync7, rmSync as rmSync5, writeFileSync as writeFileSync7 } from "fs";
|
|
2288
2315
|
import { dirname as dirname9, isAbsolute as isAbsolute3, relative as relative3, resolve as resolve8 } from "path";
|
|
2289
2316
|
var resolveInsideBasePath = (basePath, relativePath) => {
|
|
2290
2317
|
const absBasePath = resolve8(basePath);
|
|
@@ -2300,7 +2327,7 @@ var installSubagentPackages = (basePath, packages) => {
|
|
|
2300
2327
|
for (const subagentPackage of packages) {
|
|
2301
2328
|
for (const file of subagentPackage.files) {
|
|
2302
2329
|
const absPath = resolveInsideBasePath(basePath, file.relativePath);
|
|
2303
|
-
if (
|
|
2330
|
+
if (existsSync4(absPath)) {
|
|
2304
2331
|
rmSync5(absPath, { recursive: true, force: true });
|
|
2305
2332
|
}
|
|
2306
2333
|
mkdirSync7(dirname9(absPath), { recursive: true });
|
|
@@ -2314,7 +2341,7 @@ var removeSubagentFiles = (basePath, relativePaths) => {
|
|
|
2314
2341
|
const removed = [];
|
|
2315
2342
|
for (const relativePath of relativePaths) {
|
|
2316
2343
|
const absPath = resolveInsideBasePath(basePath, relativePath);
|
|
2317
|
-
if (!
|
|
2344
|
+
if (!existsSync4(absPath)) continue;
|
|
2318
2345
|
rmSync5(absPath, { recursive: true, force: true });
|
|
2319
2346
|
removed.push(relativePath);
|
|
2320
2347
|
}
|
|
@@ -2376,7 +2403,7 @@ var writeUserSubagentState = (params) => {
|
|
|
2376
2403
|
};
|
|
2377
2404
|
var readInstalledSubagents = (basePath) => readSubagentManifest(resolveSubagentManifestPath(basePath))?.subagents ?? [];
|
|
2378
2405
|
var warnMissingSkills = (requiredSkills) => {
|
|
2379
|
-
const missing = requiredSkills.filter((skill) => !
|
|
2406
|
+
const missing = requiredSkills.filter((skill) => !existsSync5(skill.path));
|
|
2380
2407
|
if (missing.length === 0) {
|
|
2381
2408
|
return;
|
|
2382
2409
|
}
|