teamai-cli 0.24.0-beta.10 → 0.24.0-beta.11
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/dist/index.js +141 -49
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -176,6 +176,7 @@ __export(fs_exports, {
|
|
|
176
176
|
readJson: () => readJson,
|
|
177
177
|
remove: () => remove,
|
|
178
178
|
writeFile: () => writeFile,
|
|
179
|
+
writeFileAtomic: () => writeFileAtomic,
|
|
179
180
|
writeIfChanged: () => writeIfChanged,
|
|
180
181
|
writeJson: () => writeJson,
|
|
181
182
|
writeJsonAtomic: () => writeJsonAtomic
|
|
@@ -207,6 +208,25 @@ async function writeFile(filePath, content) {
|
|
|
207
208
|
await fse.ensureDir(path2.dirname(expanded));
|
|
208
209
|
await fse.writeFile(expanded, content, "utf-8");
|
|
209
210
|
}
|
|
211
|
+
async function writeFileAtomic(filePath, content) {
|
|
212
|
+
const expanded = expandHome(filePath);
|
|
213
|
+
await fse.ensureDir(path2.dirname(expanded));
|
|
214
|
+
let mode = 384;
|
|
215
|
+
try {
|
|
216
|
+
mode = (await fse.stat(expanded)).mode & 511;
|
|
217
|
+
} catch (error) {
|
|
218
|
+
if (error.code !== "ENOENT") throw error;
|
|
219
|
+
}
|
|
220
|
+
const tmp = `${expanded}.${process.pid}.${crypto.randomBytes(6).toString("hex")}.tmp`;
|
|
221
|
+
try {
|
|
222
|
+
await fse.writeFile(tmp, content, "utf-8");
|
|
223
|
+
await fse.chmod(tmp, mode);
|
|
224
|
+
await fse.rename(tmp, expanded);
|
|
225
|
+
} catch (error) {
|
|
226
|
+
await fse.remove(tmp).catch(() => void 0);
|
|
227
|
+
throw error;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
210
230
|
async function readJson(filePath) {
|
|
211
231
|
const content = await readFileSafe(filePath);
|
|
212
232
|
if (content === null) return null;
|
|
@@ -17581,6 +17601,7 @@ var init_git2 = __esm({
|
|
|
17581
17601
|
import path48 from "path";
|
|
17582
17602
|
import fs20 from "fs";
|
|
17583
17603
|
import { createHash as createHash4 } from "crypto";
|
|
17604
|
+
import YAML13 from "yaml";
|
|
17584
17605
|
function isCaseInsensitiveFs(probeDir) {
|
|
17585
17606
|
const base = probeDir ?? path48.join(getUserHome(), ".teamai");
|
|
17586
17607
|
const cached = caseInsensitiveCache.get(base);
|
|
@@ -17611,14 +17632,82 @@ function safePathPrefix(anchor) {
|
|
|
17611
17632
|
if (safe.length <= MAX) return safe;
|
|
17612
17633
|
return safe.slice(safe.length - MAX).replace(/^[^-]*-/, "");
|
|
17613
17634
|
}
|
|
17635
|
+
function anchorHash(norm) {
|
|
17636
|
+
return createHash4("sha256").update(norm).digest("hex").slice(0, 16);
|
|
17637
|
+
}
|
|
17614
17638
|
function projectSlug(anchor) {
|
|
17615
17639
|
const norm = normalizeAnchor(anchor);
|
|
17616
|
-
|
|
17617
|
-
|
|
17640
|
+
return `${safePathPrefix(norm)}-${anchorHash(norm)}`;
|
|
17641
|
+
}
|
|
17642
|
+
function legacyProjectSlug(anchor) {
|
|
17643
|
+
const norm = normalizeAnchor(anchor);
|
|
17644
|
+
const raw = path48.basename(norm) || "project";
|
|
17645
|
+
const cleaned = raw.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
17646
|
+
return `${(cleaned || "project").slice(0, 40)}-${anchorHash(norm)}`;
|
|
17618
17647
|
}
|
|
17619
17648
|
function projectDataHome(anchor) {
|
|
17620
17649
|
return path48.join(getUserHome(), ".teamai", "projects", projectSlug(anchor));
|
|
17621
17650
|
}
|
|
17651
|
+
async function resolvePartitionDir(anchor) {
|
|
17652
|
+
const canonical = projectDataHome(anchor);
|
|
17653
|
+
const legacyDir = path48.join(projectsRootDir(), legacyProjectSlug(anchor));
|
|
17654
|
+
if (legacyDir === canonical) return canonical;
|
|
17655
|
+
const dir = await adoptLegacyPartition(canonical, legacyDir);
|
|
17656
|
+
if (dir === canonical) await rebaseLocalPathAfterAdoption(canonical, legacyDir);
|
|
17657
|
+
return dir;
|
|
17658
|
+
}
|
|
17659
|
+
async function adoptLegacyPartition(canonical, legacyDir) {
|
|
17660
|
+
try {
|
|
17661
|
+
await fs20.promises.rename(legacyDir, canonical);
|
|
17662
|
+
return canonical;
|
|
17663
|
+
} catch (err) {
|
|
17664
|
+
if (err.code === "ENOENT") {
|
|
17665
|
+
return canonical;
|
|
17666
|
+
}
|
|
17667
|
+
const legacyExists = await dirExists(legacyDir);
|
|
17668
|
+
const canonicalEntries = await fs20.promises.readdir(canonical).catch(() => null);
|
|
17669
|
+
if (canonicalEntries && canonicalEntries.length > 0) {
|
|
17670
|
+
return canonical;
|
|
17671
|
+
}
|
|
17672
|
+
if (legacyExists && canonicalEntries) {
|
|
17673
|
+
await fs20.promises.rmdir(canonical).catch(() => {
|
|
17674
|
+
});
|
|
17675
|
+
try {
|
|
17676
|
+
await fs20.promises.rename(legacyDir, canonical);
|
|
17677
|
+
} catch {
|
|
17678
|
+
}
|
|
17679
|
+
return canonical;
|
|
17680
|
+
}
|
|
17681
|
+
return legacyExists ? legacyDir : canonical;
|
|
17682
|
+
}
|
|
17683
|
+
}
|
|
17684
|
+
async function rebaseLocalPathAfterAdoption(canonical, legacyDir) {
|
|
17685
|
+
const configPath = path48.join(canonical, "config.yaml");
|
|
17686
|
+
const content = await readFileSafe(configPath);
|
|
17687
|
+
if (!content) return;
|
|
17688
|
+
let doc;
|
|
17689
|
+
try {
|
|
17690
|
+
doc = YAML13.parse(content);
|
|
17691
|
+
} catch {
|
|
17692
|
+
return;
|
|
17693
|
+
}
|
|
17694
|
+
const repo = doc?.repo;
|
|
17695
|
+
if (!repo?.localPath) return;
|
|
17696
|
+
const rel = path48.relative(legacyDir, expandHome(repo.localPath));
|
|
17697
|
+
if (rel === "" ? false : rel.startsWith("..") || path48.isAbsolute(rel)) return;
|
|
17698
|
+
const rebased = rel === "" ? canonical : path48.join(canonical, rel);
|
|
17699
|
+
if (rebased === repo.localPath) return;
|
|
17700
|
+
repo.localPath = rebased;
|
|
17701
|
+
await writeFileAtomic(configPath, YAML13.stringify(doc));
|
|
17702
|
+
}
|
|
17703
|
+
async function dirExists(p) {
|
|
17704
|
+
try {
|
|
17705
|
+
await fs20.promises.access(p);
|
|
17706
|
+
return true;
|
|
17707
|
+
} catch {
|
|
17708
|
+
return false;
|
|
17709
|
+
}
|
|
17710
|
+
}
|
|
17622
17711
|
function projectsRootDir() {
|
|
17623
17712
|
return path48.join(getUserHome(), ".teamai", "projects");
|
|
17624
17713
|
}
|
|
@@ -17641,6 +17730,7 @@ var init_partition = __esm({
|
|
|
17641
17730
|
"src/utils/partition.ts"() {
|
|
17642
17731
|
"use strict";
|
|
17643
17732
|
init_home();
|
|
17733
|
+
init_fs();
|
|
17644
17734
|
caseInsensitiveCache = /* @__PURE__ */ new Map();
|
|
17645
17735
|
}
|
|
17646
17736
|
});
|
|
@@ -17651,13 +17741,13 @@ __export(bootstrap_exports, {
|
|
|
17651
17741
|
bootstrapSelfRepo: () => bootstrapSelfRepo
|
|
17652
17742
|
});
|
|
17653
17743
|
import path49 from "path";
|
|
17654
|
-
import
|
|
17744
|
+
import YAML14 from "yaml";
|
|
17655
17745
|
async function readSelfModeMarker(dir) {
|
|
17656
17746
|
const yamlPath = path49.join(dir, ".teamai", "teamai.yaml");
|
|
17657
17747
|
const content = await readFileSafe(yamlPath);
|
|
17658
17748
|
if (!content) return null;
|
|
17659
17749
|
try {
|
|
17660
|
-
const raw =
|
|
17750
|
+
const raw = YAML14.parse(content);
|
|
17661
17751
|
if (raw && raw.mode === "self") {
|
|
17662
17752
|
return { repo: raw.repo, provider: raw.provider };
|
|
17663
17753
|
}
|
|
@@ -17773,7 +17863,7 @@ async function bootstrapSelfRepo(dir, opts) {
|
|
|
17773
17863
|
await ensureDir(memberDir);
|
|
17774
17864
|
const memberPath = path49.join(memberDir, `${username}.yaml`);
|
|
17775
17865
|
if (!await pathExists(memberPath)) {
|
|
17776
|
-
await writeFile(memberPath,
|
|
17866
|
+
await writeFile(memberPath, YAML14.stringify({
|
|
17777
17867
|
username,
|
|
17778
17868
|
displayName: username,
|
|
17779
17869
|
registeredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -17822,7 +17912,7 @@ __export(config_exports, {
|
|
|
17822
17912
|
saveState: () => saveState,
|
|
17823
17913
|
saveStateForScope: () => saveStateForScope
|
|
17824
17914
|
});
|
|
17825
|
-
import
|
|
17915
|
+
import YAML15 from "yaml";
|
|
17826
17916
|
import path50 from "path";
|
|
17827
17917
|
async function migrateLegacyRoleConfig(config, configPath) {
|
|
17828
17918
|
if (config.primaryRole) {
|
|
@@ -17844,7 +17934,7 @@ async function migrateLegacyRoleConfig(config, configPath) {
|
|
|
17844
17934
|
additionalRoles: config.additionalRoles ?? [],
|
|
17845
17935
|
resourceProfileVersion: manifest.version
|
|
17846
17936
|
};
|
|
17847
|
-
await writeFile(expandHome(configPath),
|
|
17937
|
+
await writeFile(expandHome(configPath), YAML15.stringify(migrated));
|
|
17848
17938
|
log.info("Migrated legacy teamai config to default role profile: hai");
|
|
17849
17939
|
return migrated;
|
|
17850
17940
|
}
|
|
@@ -17855,7 +17945,7 @@ async function loadTeamConfig(repoPath) {
|
|
|
17855
17945
|
return null;
|
|
17856
17946
|
}
|
|
17857
17947
|
try {
|
|
17858
|
-
const raw =
|
|
17948
|
+
const raw = YAML15.parse(content);
|
|
17859
17949
|
return TeamaiConfigSchema.parse(raw);
|
|
17860
17950
|
} catch (e) {
|
|
17861
17951
|
log.error(`Invalid teamai.yaml: ${e.message}`);
|
|
@@ -17867,7 +17957,7 @@ async function loadLocalConfig() {
|
|
|
17867
17957
|
const content = await readFileSafe(configPath);
|
|
17868
17958
|
if (!content) return null;
|
|
17869
17959
|
try {
|
|
17870
|
-
const raw =
|
|
17960
|
+
const raw = YAML15.parse(content);
|
|
17871
17961
|
const parsed = LocalConfigSchema.parse(raw);
|
|
17872
17962
|
return await migrateLegacyRoleConfig(parsed, configPath);
|
|
17873
17963
|
} catch (e) {
|
|
@@ -17877,7 +17967,7 @@ async function loadLocalConfig() {
|
|
|
17877
17967
|
}
|
|
17878
17968
|
function serializeLocalConfig(config) {
|
|
17879
17969
|
const { dataHome: _dataHome, ...persisted } = config;
|
|
17880
|
-
return
|
|
17970
|
+
return YAML15.stringify(persisted);
|
|
17881
17971
|
}
|
|
17882
17972
|
async function saveLocalConfig(config) {
|
|
17883
17973
|
await writeFile(expandHome(getUserConfigPath()), serializeLocalConfig(config));
|
|
@@ -17912,7 +18002,7 @@ async function loadLocalConfigForScope(scope, projectRoot) {
|
|
|
17912
18002
|
const content = await readFileSafe(expandHome(configPath));
|
|
17913
18003
|
if (!content) return null;
|
|
17914
18004
|
try {
|
|
17915
|
-
const raw =
|
|
18005
|
+
const raw = YAML15.parse(content);
|
|
17916
18006
|
const parsed = LocalConfigSchema.parse(raw);
|
|
17917
18007
|
return await migrateLegacyRoleConfig(parsed, configPath);
|
|
17918
18008
|
} catch (e) {
|
|
@@ -17947,7 +18037,7 @@ async function saveStateForScope(state, localConfig) {
|
|
|
17947
18037
|
}
|
|
17948
18038
|
async function resolveProjectDataHome(projectRoot) {
|
|
17949
18039
|
const anchors = await resolveAnchors(projectRoot);
|
|
17950
|
-
return anchors ?
|
|
18040
|
+
return anchors ? resolvePartitionDir(anchors.projectAnchor) : path50.join(projectRoot, ".teamai");
|
|
17951
18041
|
}
|
|
17952
18042
|
async function resolveDataHomeForScope(scope, projectRoot) {
|
|
17953
18043
|
if (scope !== "project" || !projectRoot) return getTeamaiHome("user");
|
|
@@ -17960,7 +18050,7 @@ async function detectProjectConfig(cwd) {
|
|
|
17960
18050
|
const anchors = await resolveAnchors(dir);
|
|
17961
18051
|
if (anchors) {
|
|
17962
18052
|
const legacyDir = path50.join(anchors.workspaceRoot, ".teamai");
|
|
17963
|
-
const partitionDir =
|
|
18053
|
+
const partitionDir = await resolvePartitionDir(anchors.projectAnchor);
|
|
17964
18054
|
const fromPartition = await readConfigFrom(partitionDir, anchors.workspaceRoot);
|
|
17965
18055
|
if (fromPartition) return fromPartition;
|
|
17966
18056
|
const healed = await selfHealAndReadPartition(anchors.workspaceRoot, partitionDir);
|
|
@@ -17995,7 +18085,7 @@ async function readConfigFrom(dataHomeDir, projectRoot, selfHealRepoRoot) {
|
|
|
17995
18085
|
const content = await readFileSafe(configPath);
|
|
17996
18086
|
if (!content) return null;
|
|
17997
18087
|
try {
|
|
17998
|
-
const raw =
|
|
18088
|
+
const raw = YAML15.parse(content);
|
|
17999
18089
|
const config = LocalConfigSchema.parse(raw);
|
|
18000
18090
|
if (config.scope !== "project") return null;
|
|
18001
18091
|
const resolved = { ...config, projectRoot, dataHome: dataHomeDir };
|
|
@@ -18869,20 +18959,20 @@ __export(migrate_exports, {
|
|
|
18869
18959
|
});
|
|
18870
18960
|
import path53 from "path";
|
|
18871
18961
|
import fse10 from "fs-extra";
|
|
18872
|
-
import
|
|
18962
|
+
import YAML16 from "yaml";
|
|
18873
18963
|
import { realpath as realpath2 } from "fs/promises";
|
|
18874
18964
|
async function planMigration(cwd) {
|
|
18875
18965
|
const anchors = await resolveAnchors(cwd ?? process.cwd());
|
|
18876
18966
|
if (!anchors) return null;
|
|
18877
18967
|
const legacyDir = path53.join(anchors.workspaceRoot, ".teamai");
|
|
18878
|
-
const partitionDir =
|
|
18968
|
+
const partitionDir = await resolvePartitionDir(anchors.projectAnchor);
|
|
18879
18969
|
const legacyConfig = path53.join(legacyDir, "config.yaml");
|
|
18880
18970
|
const gateContent = await readFileSafe(legacyConfig) ?? await readFileSafe(path53.join(partitionDir, "config.yaml"));
|
|
18881
18971
|
if (!gateContent) return null;
|
|
18882
18972
|
let scope;
|
|
18883
18973
|
let kind;
|
|
18884
18974
|
try {
|
|
18885
|
-
const parsed = LocalConfigSchema.parse(
|
|
18975
|
+
const parsed = LocalConfigSchema.parse(YAML16.parse(gateContent));
|
|
18886
18976
|
scope = parsed.scope;
|
|
18887
18977
|
kind = parsed.repo.kind;
|
|
18888
18978
|
} catch {
|
|
@@ -18995,7 +19085,7 @@ async function rebaseConfigPaths(stagedConfig, legacyDir, partitionDir) {
|
|
|
18995
19085
|
if (!content) return;
|
|
18996
19086
|
let doc;
|
|
18997
19087
|
try {
|
|
18998
|
-
doc =
|
|
19088
|
+
doc = YAML16.parse(content);
|
|
18999
19089
|
} catch {
|
|
19000
19090
|
return;
|
|
19001
19091
|
}
|
|
@@ -19003,7 +19093,7 @@ async function rebaseConfigPaths(stagedConfig, legacyDir, partitionDir) {
|
|
|
19003
19093
|
const rebased = await rebasePath(repo?.localPath, legacyDir, partitionDir);
|
|
19004
19094
|
if (repo && rebased !== void 0 && rebased !== repo.localPath) {
|
|
19005
19095
|
repo.localPath = rebased;
|
|
19006
|
-
await writeFile(stagedConfig,
|
|
19096
|
+
await writeFile(stagedConfig, YAML16.stringify(doc));
|
|
19007
19097
|
}
|
|
19008
19098
|
}
|
|
19009
19099
|
async function rebasePath(p, fromDir, toDir) {
|
|
@@ -19033,7 +19123,7 @@ async function holdsSelfKnowledge(dir) {
|
|
|
19033
19123
|
const content = await readFileSafe(path53.join(dir, "teamai.yaml"));
|
|
19034
19124
|
if (!content) return false;
|
|
19035
19125
|
try {
|
|
19036
|
-
const raw =
|
|
19126
|
+
const raw = YAML16.parse(content);
|
|
19037
19127
|
return raw?.mode === "self";
|
|
19038
19128
|
} catch {
|
|
19039
19129
|
return false;
|
|
@@ -19103,7 +19193,7 @@ async function verifyStaging(legacyDir, staging) {
|
|
|
19103
19193
|
const content = await readFileSafe(stagedConfig);
|
|
19104
19194
|
if (!content) throw new Error(`migration verify: ${stagedConfig} missing after copy`);
|
|
19105
19195
|
try {
|
|
19106
|
-
LocalConfigSchema.parse(
|
|
19196
|
+
LocalConfigSchema.parse(YAML16.parse(content));
|
|
19107
19197
|
} catch (e) {
|
|
19108
19198
|
throw new Error(`migration verify: staged config.yaml is invalid (${e.message})`);
|
|
19109
19199
|
}
|
|
@@ -19254,14 +19344,14 @@ var init_pending_learnings = __esm({
|
|
|
19254
19344
|
|
|
19255
19345
|
// src/utils/tags.ts
|
|
19256
19346
|
import path55 from "path";
|
|
19257
|
-
import
|
|
19347
|
+
import YAML17 from "yaml";
|
|
19258
19348
|
async function loadTagsConfig(repoPath) {
|
|
19259
19349
|
const content = await readFileSafe(path55.join(repoPath, TAGS_FILE));
|
|
19260
19350
|
if (!content) {
|
|
19261
19351
|
return null;
|
|
19262
19352
|
}
|
|
19263
19353
|
try {
|
|
19264
|
-
const raw =
|
|
19354
|
+
const raw = YAML17.parse(content);
|
|
19265
19355
|
if (!raw || typeof raw !== "object") {
|
|
19266
19356
|
return null;
|
|
19267
19357
|
}
|
|
@@ -19312,7 +19402,7 @@ function filterByTags(items, tagsConfig, subscribedTags, resourceType) {
|
|
|
19312
19402
|
}
|
|
19313
19403
|
async function saveTagsConfig(repoPath, config) {
|
|
19314
19404
|
const filePath = path55.join(repoPath, TAGS_FILE);
|
|
19315
|
-
const content =
|
|
19405
|
+
const content = YAML17.stringify({
|
|
19316
19406
|
skills: config.skills,
|
|
19317
19407
|
rules: config.rules
|
|
19318
19408
|
});
|
|
@@ -19511,7 +19601,7 @@ __export(votes_exports, {
|
|
|
19511
19601
|
syncVotesToTeam: () => syncVotesToTeam
|
|
19512
19602
|
});
|
|
19513
19603
|
import path57 from "path";
|
|
19514
|
-
import
|
|
19604
|
+
import YAML18 from "yaml";
|
|
19515
19605
|
function migrateV1ToV2(v1) {
|
|
19516
19606
|
const votes = {};
|
|
19517
19607
|
for (const [docId, entry] of Object.entries(v1.votes)) {
|
|
@@ -19528,7 +19618,7 @@ async function loadUserVotes(votePath) {
|
|
|
19528
19618
|
if (!content) return { version: 2, votes: {}, deltas: {} };
|
|
19529
19619
|
let parsed;
|
|
19530
19620
|
try {
|
|
19531
|
-
parsed =
|
|
19621
|
+
parsed = YAML18.parse(content);
|
|
19532
19622
|
} catch {
|
|
19533
19623
|
return { version: 2, votes: {}, deltas: {} };
|
|
19534
19624
|
}
|
|
@@ -19550,7 +19640,7 @@ async function loadUserVotes(votePath) {
|
|
|
19550
19640
|
}
|
|
19551
19641
|
async function saveUserVotes(votePath, votes) {
|
|
19552
19642
|
await ensureDir(path57.dirname(votePath));
|
|
19553
|
-
await writeFile(votePath,
|
|
19643
|
+
await writeFile(votePath, YAML18.stringify(votes));
|
|
19554
19644
|
}
|
|
19555
19645
|
async function incrementRecalled(votePath, docIds) {
|
|
19556
19646
|
if (docIds.length === 0) return;
|
|
@@ -19890,8 +19980,8 @@ async function aggregateVotes(votesDir) {
|
|
|
19890
19980
|
const content = await readFileSafe(path59.join(votesDir, file));
|
|
19891
19981
|
if (!content) continue;
|
|
19892
19982
|
try {
|
|
19893
|
-
const
|
|
19894
|
-
const parsed =
|
|
19983
|
+
const YAML25 = (await import("yaml")).default;
|
|
19984
|
+
const parsed = YAML25.parse(content);
|
|
19895
19985
|
if (!parsed?.votes) continue;
|
|
19896
19986
|
if (parsed.version === 2) {
|
|
19897
19987
|
const votes = parsed.votes;
|
|
@@ -21125,7 +21215,7 @@ __export(digest_exports, {
|
|
|
21125
21215
|
summarizeInterventions: () => summarizeInterventions,
|
|
21126
21216
|
summarizeTeamTrends: () => summarizeTeamTrends
|
|
21127
21217
|
});
|
|
21128
|
-
import
|
|
21218
|
+
import YAML19 from "yaml";
|
|
21129
21219
|
import path61 from "path";
|
|
21130
21220
|
import fs23 from "fs";
|
|
21131
21221
|
async function loadTeamStats(repoPath) {
|
|
@@ -21138,7 +21228,7 @@ async function loadTeamStats(repoPath) {
|
|
|
21138
21228
|
const content = await readFileSafe(path61.join(statsDir, file));
|
|
21139
21229
|
if (!content) continue;
|
|
21140
21230
|
try {
|
|
21141
|
-
const parsed =
|
|
21231
|
+
const parsed = YAML19.parse(content);
|
|
21142
21232
|
if (parsed?.username && parsed?.skills) {
|
|
21143
21233
|
stats.push(parsed);
|
|
21144
21234
|
}
|
|
@@ -21508,7 +21598,7 @@ __export(stats_exports, {
|
|
|
21508
21598
|
aggregateUsage: () => aggregateUsage,
|
|
21509
21599
|
showStats: () => showStats
|
|
21510
21600
|
});
|
|
21511
|
-
import
|
|
21601
|
+
import YAML20 from "yaml";
|
|
21512
21602
|
import path62 from "path";
|
|
21513
21603
|
function aggregateUsage(events) {
|
|
21514
21604
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -21542,7 +21632,7 @@ async function loadReportedStats() {
|
|
|
21542
21632
|
const statsPath = path62.join(statsRoot, "stats", `${config.username}.yaml`);
|
|
21543
21633
|
const content = await readFileSafe(statsPath);
|
|
21544
21634
|
if (!content) return null;
|
|
21545
|
-
const parsed =
|
|
21635
|
+
const parsed = YAML20.parse(content);
|
|
21546
21636
|
if (parsed?.username && parsed?.skills) return parsed;
|
|
21547
21637
|
return null;
|
|
21548
21638
|
} catch {
|
|
@@ -21841,13 +21931,13 @@ __export(team_push_exports, {
|
|
|
21841
21931
|
mergeStats: () => mergeStats,
|
|
21842
21932
|
reportUsageToTeam: () => reportUsageToTeam
|
|
21843
21933
|
});
|
|
21844
|
-
import
|
|
21934
|
+
import YAML21 from "yaml";
|
|
21845
21935
|
import path64 from "path";
|
|
21846
21936
|
async function readExistingStats(statsPath) {
|
|
21847
21937
|
try {
|
|
21848
21938
|
const content = await readFileSafe(statsPath);
|
|
21849
21939
|
if (!content) return null;
|
|
21850
|
-
const parsed =
|
|
21940
|
+
const parsed = YAML21.parse(content);
|
|
21851
21941
|
if (parsed?.username && parsed?.skills) return parsed;
|
|
21852
21942
|
return null;
|
|
21853
21943
|
} catch {
|
|
@@ -22087,7 +22177,7 @@ async function reportUsageToTeam(repoPath, username, options) {
|
|
|
22087
22177
|
if (hasDaily) {
|
|
22088
22178
|
merged.daily = mergeDailyStats(existing?.daily, dailyDelta);
|
|
22089
22179
|
}
|
|
22090
|
-
await writeFile(statsPath,
|
|
22180
|
+
await writeFile(statsPath, YAML21.stringify(merged));
|
|
22091
22181
|
filesToPush.push(`stats/${username}.yaml`);
|
|
22092
22182
|
}
|
|
22093
22183
|
try {
|
|
@@ -23059,7 +23149,7 @@ async function pullForScope(localConfig, options, policy = {}) {
|
|
|
23059
23149
|
}
|
|
23060
23150
|
if (!options.silent && !options.dryRun) {
|
|
23061
23151
|
try {
|
|
23062
|
-
const
|
|
23152
|
+
const YAML25 = (await import("yaml")).default;
|
|
23063
23153
|
const { listFiles: listFiles2, readFileSafe: readFileSafe5 } = await Promise.resolve().then(() => (init_fs(), fs_exports));
|
|
23064
23154
|
const { getRecommendations: getRecommendations2, displayRecommendations: displayRecommendations2 } = await Promise.resolve().then(() => (init_skill_recommend(), skill_recommend_exports));
|
|
23065
23155
|
let statsDir = path66.join(localConfig.repo.localPath, "stats");
|
|
@@ -23078,7 +23168,7 @@ async function pullForScope(localConfig, options, policy = {}) {
|
|
|
23078
23168
|
const content = await readFileSafe5(path66.join(statsDir, file));
|
|
23079
23169
|
if (!content) continue;
|
|
23080
23170
|
try {
|
|
23081
|
-
const parsed =
|
|
23171
|
+
const parsed = YAML25.parse(content);
|
|
23082
23172
|
if (parsed?.username && parsed?.skills) teamStats.push(parsed);
|
|
23083
23173
|
} catch {
|
|
23084
23174
|
}
|
|
@@ -23651,7 +23741,7 @@ __export(status_exports, {
|
|
|
23651
23741
|
status: () => status
|
|
23652
23742
|
});
|
|
23653
23743
|
import path68 from "path";
|
|
23654
|
-
import
|
|
23744
|
+
import YAML22 from "yaml";
|
|
23655
23745
|
async function status(options) {
|
|
23656
23746
|
if (options.all) {
|
|
23657
23747
|
await statusAll();
|
|
@@ -23698,7 +23788,7 @@ async function status(options) {
|
|
|
23698
23788
|
const envContent = await readFileSafe(envYamlPath);
|
|
23699
23789
|
if (envContent) {
|
|
23700
23790
|
try {
|
|
23701
|
-
const envData =
|
|
23791
|
+
const envData = YAML22.parse(envContent);
|
|
23702
23792
|
envCount = Array.isArray(envData?.variables) ? envData.variables.length : 0;
|
|
23703
23793
|
} catch {
|
|
23704
23794
|
}
|
|
@@ -23753,7 +23843,7 @@ async function statusAll() {
|
|
|
23753
23843
|
const cfgRaw = await readFileSafe(path68.join(partitionDir, "config.yaml"));
|
|
23754
23844
|
if (cfgRaw) {
|
|
23755
23845
|
try {
|
|
23756
|
-
const parsed = LocalConfigSchema.parse(
|
|
23846
|
+
const parsed = LocalConfigSchema.parse(YAML22.parse(cfgRaw));
|
|
23757
23847
|
scope = parsed.scope;
|
|
23758
23848
|
kind = parsed.repo.kind;
|
|
23759
23849
|
if (!projectPath) projectPath = parsed.repo.businessRepoRoot ?? parsed.projectRoot ?? null;
|
|
@@ -23766,10 +23856,12 @@ async function statusAll() {
|
|
|
23766
23856
|
} else if (!await pathExists(anchor)) {
|
|
23767
23857
|
state = "ORPHAN \u2014 project path is gone, safe to delete";
|
|
23768
23858
|
orphanCount++;
|
|
23769
|
-
} else if (projectSlug(anchor)
|
|
23770
|
-
state = "corrupt \u2014 dir name does not match anchor";
|
|
23771
|
-
} else {
|
|
23859
|
+
} else if (projectSlug(anchor) === slug) {
|
|
23772
23860
|
state = "active";
|
|
23861
|
+
} else if (legacyProjectSlug(anchor) === slug) {
|
|
23862
|
+
state = "active (legacy name; renamed automatically on next command)";
|
|
23863
|
+
} else {
|
|
23864
|
+
state = "corrupt \u2014 dir name does not match anchor";
|
|
23773
23865
|
}
|
|
23774
23866
|
const kindLabel = kind ? ` ${kind}` : "";
|
|
23775
23867
|
log.info(` ${slug} [${state}]`);
|
|
@@ -23835,7 +23927,7 @@ async function printRepoSection(t, options, ctx) {
|
|
|
23835
23927
|
const envContent = await readFileSafe(envYamlPath);
|
|
23836
23928
|
if (envContent) {
|
|
23837
23929
|
try {
|
|
23838
|
-
const envData =
|
|
23930
|
+
const envData = YAML22.parse(envContent);
|
|
23839
23931
|
if (envData?.variables && envData.variables.length > 0) {
|
|
23840
23932
|
if (options.reveal) {
|
|
23841
23933
|
process.stderr.write("[warn] Env values will be shown in plaintext\n");
|
|
@@ -24530,7 +24622,7 @@ __export(roles_cmd_exports, {
|
|
|
24530
24622
|
rolesUpdate: () => rolesUpdate
|
|
24531
24623
|
});
|
|
24532
24624
|
import path71 from "path";
|
|
24533
|
-
import
|
|
24625
|
+
import YAML23 from "yaml";
|
|
24534
24626
|
function parseNamespaces(input) {
|
|
24535
24627
|
return input.split(",").map((s) => s.trim()).filter(Boolean);
|
|
24536
24628
|
}
|
|
@@ -24647,7 +24739,7 @@ async function rolesInit(options) {
|
|
|
24647
24739
|
};
|
|
24648
24740
|
if (options.dryRun) {
|
|
24649
24741
|
log.info("[dry-run] Would write manifest:");
|
|
24650
|
-
console.log(
|
|
24742
|
+
console.log(YAML23.stringify(manifest));
|
|
24651
24743
|
return;
|
|
24652
24744
|
}
|
|
24653
24745
|
const allNamespaces = [...new Set(roles.flatMap((r) => r.resources.skills))];
|
|
@@ -24938,7 +25030,7 @@ __export(projects_cmd_exports, {
|
|
|
24938
25030
|
projectsSet: () => projectsSet
|
|
24939
25031
|
});
|
|
24940
25032
|
import path72 from "path";
|
|
24941
|
-
import
|
|
25033
|
+
import YAML24 from "yaml";
|
|
24942
25034
|
function parseIds(input) {
|
|
24943
25035
|
const flat = input.flatMap((s) => s.split(","));
|
|
24944
25036
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -25041,7 +25133,7 @@ async function projectsMembers(projectId, _options) {
|
|
|
25041
25133
|
const content = await readFileSafe(path72.join(membersDir, file));
|
|
25042
25134
|
if (!content) continue;
|
|
25043
25135
|
try {
|
|
25044
|
-
const member = MemberConfigSchema.parse(
|
|
25136
|
+
const member = MemberConfigSchema.parse(YAML24.parse(content));
|
|
25045
25137
|
if ((member.projects ?? []).includes(projectId)) {
|
|
25046
25138
|
const display = member.displayName ? ` \u2014 ${member.displayName}` : "";
|
|
25047
25139
|
members.push(`${member.username}${display}`);
|