@xn-intenton-z2a/agentic-lib 7.1.42 → 7.1.43
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/bin/agentic-lib.js +46 -0
- package/package.json +1 -1
- package/src/seeds/init.yml +2 -0
- package/src/seeds/zero-package.json +1 -1
package/bin/agentic-lib.js
CHANGED
|
@@ -958,6 +958,52 @@ function initPurgeGitHub() {
|
|
|
958
958
|
} catch {
|
|
959
959
|
console.log(" SKIP: Could not list discussions (feature may not be enabled)");
|
|
960
960
|
}
|
|
961
|
+
|
|
962
|
+
// Create a new "Talk to the repository" discussion
|
|
963
|
+
try {
|
|
964
|
+
// Get the repository node ID and "General" category ID
|
|
965
|
+
const repoQuery = JSON.stringify({
|
|
966
|
+
query: `{ repository(owner:"${owner}", name:"${repo}") { id discussionCategories(first:20) { nodes { id name } } } }`,
|
|
967
|
+
});
|
|
968
|
+
const repoResult = execSync(`gh api graphql --input -`, {
|
|
969
|
+
cwd: target,
|
|
970
|
+
encoding: "utf8",
|
|
971
|
+
timeout: 30000,
|
|
972
|
+
input: repoQuery,
|
|
973
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
974
|
+
});
|
|
975
|
+
const repoParsed = JSON.parse(repoResult);
|
|
976
|
+
const repoId = repoParsed?.data?.repository?.id;
|
|
977
|
+
const categories = repoParsed?.data?.repository?.discussionCategories?.nodes || [];
|
|
978
|
+
const generalCat = categories.find((c) => c.name === "General");
|
|
979
|
+
if (!repoId || !generalCat) {
|
|
980
|
+
console.log(' SKIP: Could not find repository ID or "General" discussion category');
|
|
981
|
+
} else {
|
|
982
|
+
console.log(' CREATE: discussion "Talk to the repository" in General category');
|
|
983
|
+
if (!dryRun) {
|
|
984
|
+
const createMutation = JSON.stringify({
|
|
985
|
+
query: `mutation { createDiscussion(input: { repositoryId: "${repoId}", categoryId: "${generalCat.id}", title: "Talk to the repository", body: "This discussion is the main channel for interacting with the repository's autonomous agents.\\n\\nUse this thread to:\\n- Submit feature requests or ideas\\n- Ask questions about the project\\n- Chat with the discussions bot\\n\\n---\\n*Created by init --purge*" }) { discussion { number url } } }`,
|
|
986
|
+
});
|
|
987
|
+
const createResult = execSync(`gh api graphql --input -`, {
|
|
988
|
+
cwd: target,
|
|
989
|
+
encoding: "utf8",
|
|
990
|
+
timeout: 15000,
|
|
991
|
+
input: createMutation,
|
|
992
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
993
|
+
});
|
|
994
|
+
const createParsed = JSON.parse(createResult);
|
|
995
|
+
const newDisc = createParsed?.data?.createDiscussion?.discussion;
|
|
996
|
+
if (newDisc) {
|
|
997
|
+
console.log(` CREATED: discussion #${newDisc.number} — ${newDisc.url}`);
|
|
998
|
+
initChanges++;
|
|
999
|
+
}
|
|
1000
|
+
} else {
|
|
1001
|
+
initChanges++;
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
} catch (err) {
|
|
1005
|
+
console.log(` SKIP: Could not create discussion (${err.message})`);
|
|
1006
|
+
}
|
|
961
1007
|
}
|
|
962
1008
|
|
|
963
1009
|
function runInit() {
|
package/package.json
CHANGED
package/src/seeds/init.yml
CHANGED