agentplugged 1.3.0 → 2.0.0
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 +11 -4
- package/dist/agent-commands.js +20432 -35457
- package/dist/bin.js +2 -3
- package/dist/boundary-rules.js +1 -0
- package/dist/boundary-rules2.js +52 -0
- package/dist/cli.js +7 -3
- package/dist/commit-documents.js +81 -0
- package/dist/dist.js +22729 -0
- package/dist/dist2.js +9 -0
- package/dist/esm.js +8 -16
- package/dist/forge-follow.js +6 -7
- package/dist/grammars/LICENSE-tree-sitter-wasm +21 -0
- package/dist/grammars/LICENSE-web-tree-sitter +21 -0
- package/dist/grammars/tree-sitter-go.wasm +0 -0
- package/dist/grammars/tree-sitter-java.wasm +0 -0
- package/dist/grammars/tree-sitter-javascript.wasm +0 -0
- package/dist/grammars/tree-sitter-php.wasm +0 -0
- package/dist/grammars/tree-sitter-python.wasm +0 -0
- package/dist/grammars/tree-sitter-rust.wasm +0 -0
- package/dist/grammars/tree-sitter-tsx.wasm +0 -0
- package/dist/grammars/tree-sitter-typescript.wasm +0 -0
- package/dist/grammars/web-tree-sitter.wasm +0 -0
- package/dist/hash.js +11594 -5733
- package/dist/helpers.js +271 -519
- package/dist/launcher-env.js +1 -2
- package/dist/launcher.js +4 -5
- package/dist/libsodium-wrappers.js +2 -4
- package/dist/libsodium-wrappers2.js +2 -4
- package/dist/main.js +10502 -2787
- package/dist/map-cache.js +8096 -0
- package/dist/map-update.js +16593 -0
- package/dist/map-update2.js +1 -0
- package/dist/method/agents/alex/SKILL.md +13 -29
- package/dist/method/agents/alex/agent.yaml +3 -3
- package/dist/method/agents/basile/SKILL.md +44 -0
- package/dist/method/agents/basile/agent.yaml +69 -0
- package/dist/method/agents/chloe/SKILL.md +12 -25
- package/dist/method/agents/chloe/agent.yaml +3 -3
- package/dist/method/agents/ethan/SKILL.md +8 -9
- package/dist/method/agents/ethan/agent.yaml +9 -8
- package/dist/method/agents/hugo/SKILL.md +8 -8
- package/dist/method/agents/hugo/agent.yaml +9 -8
- package/dist/method/agents/iris/SKILL.md +11 -17
- package/dist/method/agents/iris/agent.yaml +4 -7
- package/dist/method/agents/izzy/SKILL.md +68 -91
- package/dist/method/agents/izzy/agent.yaml +8 -15
- package/dist/method/agents/jade/SKILL.md +7 -9
- package/dist/method/agents/jade/agent.yaml +9 -8
- package/dist/method/agents/julien/SKILL.md +38 -58
- package/dist/method/agents/lina/SKILL.md +7 -9
- package/dist/method/agents/lina/agent.yaml +9 -8
- package/dist/method/agents/lou/SKILL.md +4 -11
- package/dist/method/agents/lou/agent.yaml +2 -2
- package/dist/method/agents/maya/SKILL.md +12 -19
- package/dist/method/agents/maya/agent.yaml +2 -4
- package/dist/method/agents/milo/SKILL.md +21 -32
- package/dist/method/agents/noah/SKILL.md +105 -63
- package/dist/method/agents/noah/agent.yaml +15 -35
- package/dist/method/agents/noah/evals/routes.yaml +238 -0
- package/dist/method/agents/noah/references/decisions.md +59 -121
- package/dist/method/agents/noah/references/environment.md +25 -70
- package/dist/method/agents/noah/references/facts.md +22 -11
- package/dist/method/agents/noah/references/journey.md +26 -78
- package/dist/method/agents/noah/references/team.md +67 -190
- package/dist/method/agents/omar/SKILL.md +14 -30
- package/dist/method/agents/omar/agent.yaml +12 -6
- package/dist/method/agents/quentin/SKILL.md +7 -15
- package/dist/method/agents/quentin/agent.yaml +4 -2
- package/dist/method/agents/sam/SKILL.md +6 -8
- package/dist/method/agents/sam/agent.yaml +9 -8
- package/dist/method/agents/stella/SKILL.md +6 -14
- package/dist/method/agents/stella/agent.yaml +1 -1
- package/dist/method/agents/tess/SKILL.md +7 -14
- package/dist/method/agents/tess/agent.yaml +2 -2
- package/dist/method/agents/zoe/SKILL.md +9 -21
- package/dist/method/doctor.yaml +553 -13
- package/dist/method/models.yaml +12 -0
- package/dist/method/skills/acceptance-qa/SKILL.md +1 -1
- package/dist/method/skills/acceptance-qa/references/run.md +24 -32
- package/dist/method/skills/acceptance-qa/references/scenarios.md +16 -19
- package/dist/method/skills/acceptance-qa/references/verdicts.md +10 -16
- package/dist/method/skills/api-e2e-tests/SKILL.md +46 -46
- package/dist/method/skills/audit-pillars/SKILL.md +13 -10
- package/dist/method/skills/audit-pillars/references/demo.md +35 -0
- package/dist/method/skills/audit-pillars/references/pillars.md +40 -0
- package/dist/method/skills/audit-pillars/references/tech-debt.md +38 -0
- package/dist/method/skills/chain-stories/SKILL.md +5 -4
- package/dist/method/skills/chain-stories/references/merge-order.md +23 -0
- package/dist/method/skills/check-readiness/SKILL.md +1 -1
- package/dist/method/skills/check-requirements/SKILL.md +37 -72
- package/dist/method/skills/check-requirements/references/engine-proofs.md +16 -23
- package/dist/method/skills/check-requirements/references/proofs-and-gaps.md +22 -37
- package/dist/method/skills/critique-deliverable/SKILL.md +3 -3
- package/dist/method/skills/critique-deliverable/references/choose.md +12 -21
- package/dist/method/skills/critique-deliverable/references/format.md +14 -20
- package/dist/method/skills/critique-deliverable/references/gestures.md +14 -21
- package/dist/method/skills/critique-deliverable/references/judgment.md +4 -9
- package/dist/method/skills/critique-deliverable/references/methods.md +21 -0
- package/dist/method/skills/critique-deliverable/references/reconcile.md +6 -11
- package/dist/method/skills/deep-research/SKILL.md +16 -24
- package/dist/method/skills/deep-research/references/candidates.md +13 -25
- package/dist/method/skills/deep-research/references/external.md +15 -34
- package/dist/method/skills/deep-research/references/page-format.md +16 -42
- package/dist/method/skills/deep-research/references/types.md +16 -27
- package/dist/method/skills/develop-story/SKILL.md +56 -189
- package/dist/method/skills/develop-story/references/acceptance-tests.md +18 -71
- package/dist/method/skills/develop-story/references/quick-lane.md +20 -0
- package/dist/method/skills/diagnose-bug/SKILL.md +42 -53
- package/dist/method/skills/diagnose-bug/references/hypotheses.md +1 -2
- package/dist/method/skills/generate-knowledge-base/SKILL.md +57 -226
- package/dist/method/skills/generate-knowledge-base/assets/index-template.md +6 -15
- package/dist/method/skills/generate-knowledge-base/assets/page-template.md +11 -24
- package/dist/method/skills/generate-knowledge-base/references/living-docs.md +25 -64
- package/dist/method/skills/generate-knowledge-base/references/reuse-map.md +9 -18
- package/dist/method/skills/ideation/SKILL.md +16 -23
- package/dist/method/skills/ideation/references/close.md +18 -14
- package/dist/method/skills/ideation/references/converge.md +11 -21
- package/dist/method/skills/ideation/references/stances.md +13 -17
- package/dist/method/skills/ideation/references/techniques.md +20 -0
- package/dist/method/skills/improve-code/SKILL.md +42 -54
- package/dist/method/skills/pitch/SKILL.md +16 -19
- package/dist/method/skills/pitch/references/deck.md +15 -18
- package/dist/method/skills/pitch/references/design-implementation.md +13 -21
- package/dist/method/skills/pitch/references/design.md +21 -0
- package/dist/method/skills/pitch/references/story.md +13 -18
- package/dist/method/skills/plan-sprint/SKILL.md +50 -151
- package/dist/method/skills/plan-sprint/references/rituals.md +40 -0
- package/dist/method/skills/prepare-go-live/SKILL.md +59 -0
- package/dist/method/skills/resolve-merge-conflict/SKILL.md +40 -65
- package/dist/method/skills/review-after-launch/SKILL.md +56 -0
- package/dist/method/skills/review-story/SKILL.md +44 -72
- package/dist/method/skills/review-story/references/amend-story.md +8 -13
- package/dist/method/skills/review-story/references/export.md +7 -17
- package/dist/method/skills/review-story/references/free-review.md +9 -20
- package/dist/method/skills/review-story/references/judge.md +25 -37
- package/dist/method/skills/review-story/references/tests.md +29 -0
- package/dist/method/skills/run-acceptance/SKILL.md +58 -0
- package/dist/method/skills/run-acceptance/references/template.md +39 -0
- package/dist/method/skills/run-retrospective/SKILL.md +50 -189
- package/dist/method/skills/security-review-architecture/SKILL.md +46 -109
- package/dist/method/skills/security-review-architecture/references/spec-review.md +27 -38
- package/dist/method/skills/setup-ci/SKILL.md +46 -109
- package/dist/method/skills/setup-ci/assets/access-check.mjs +116 -0
- package/dist/method/skills/setup-ci/assets/security-github.yml +41 -0
- package/dist/method/skills/setup-ci/assets/security-gitlab.yml +22 -0
- package/dist/method/skills/setup-ci/assets/stack-dotnet-github.yml +118 -0
- package/dist/method/skills/setup-ci/assets/stack-dotnet-gitlab.yml +63 -0
- package/dist/method/skills/setup-ci/assets/stack-go-github.yml +118 -0
- package/dist/method/skills/setup-ci/assets/stack-go-gitlab.yml +63 -0
- package/dist/method/skills/setup-ci/assets/stack-jvm-gradle-github.yml +134 -0
- package/dist/method/skills/setup-ci/assets/stack-jvm-gradle-gitlab.yml +71 -0
- package/dist/method/skills/setup-ci/assets/stack-jvm-maven-github.yml +133 -0
- package/dist/method/skills/setup-ci/assets/stack-jvm-maven-gitlab.yml +70 -0
- package/dist/method/skills/setup-ci/assets/stack-python-github.yml +123 -0
- package/dist/method/skills/setup-ci/assets/stack-python-gitlab.yml +68 -0
- package/dist/method/skills/setup-ci/assets/stack-rust-github.yml +107 -0
- package/dist/method/skills/setup-ci/assets/stack-rust-gitlab.yml +64 -0
- package/dist/method/skills/setup-ci/references/security.md +39 -0
- package/dist/method/skills/setup-ci/references/stacks.md +22 -0
- package/dist/method/skills/split-into-stories/SKILL.md +59 -192
- package/dist/method/skills/split-into-stories/assets/story.md.tmpl +15 -4
- package/dist/method/skills/strategy/SKILL.md +20 -25
- package/dist/method/skills/strategy/references/costs.md +12 -26
- package/dist/method/skills/strategy/references/gestures.md +12 -21
- package/dist/method/skills/strategy/references/innovate.md +19 -37
- package/dist/method/skills/strategy/references/solve.md +19 -32
- package/dist/method/skills/test-idea/SKILL.md +5 -5
- package/dist/method/skills/test-idea/assets/prfaq-template.md +1 -1
- package/dist/method/skills/test-idea/references/faq.md +12 -29
- package/dist/method/skills/test-idea/references/forge.md +19 -30
- package/dist/method/skills/test-idea/references/personas.md +16 -19
- package/dist/method/skills/test-idea/references/prfaq.md +31 -31
- package/dist/method/skills/workshop/SKILL.md +10 -16
- package/dist/method/skills/workshop/references/create.md +28 -45
- package/dist/method/skills/workshop/references/customize.md +17 -42
- package/dist/method/skills/workshop/references/evaluate.md +11 -42
- package/dist/method/skills/workshop/references/rules.md +17 -26
- package/dist/method/skills/write-architecture/SKILL.md +62 -220
- package/dist/method/skills/write-architecture/references/guard.md +12 -27
- package/dist/method/skills/write-architecture/references/self-check.md +22 -38
- package/dist/method/skills/write-brand/SKILL.md +2 -2
- package/dist/method/skills/write-brand/references/identity.md +21 -22
- package/dist/method/skills/write-brand/references/platform.md +13 -20
- package/dist/method/skills/write-brand/references/rules.md +16 -22
- package/dist/method/skills/write-brief/SKILL.md +55 -149
- package/dist/method/skills/write-brief/assets/brief-template.md +7 -5
- package/dist/method/skills/write-brief/references/brief-checklist.md +18 -30
- package/dist/method/skills/write-content/SKILL.md +53 -210
- package/dist/method/skills/write-content/references/content-checklist.md +32 -50
- package/dist/method/skills/write-positioning/SKILL.md +53 -197
- package/dist/method/skills/write-positioning/references/positioning-checklist.md +15 -41
- package/dist/method/skills/write-positioning/references/seo-checklist.md +26 -51
- package/dist/method/skills/write-prd/SKILL.md +52 -179
- package/dist/method/skills/write-prd/references/prd-checklist.md +25 -54
- package/dist/method/skills/write-sales/SKILL.md +48 -212
- package/dist/method/skills/write-sales/references/before-you-send.md +21 -49
- package/dist/method/skills/write-sales/references/sales-checklist.md +19 -69
- package/dist/method/skills/write-spec/references/spec-guide.md +20 -23
- package/dist/method/skills/write-ux-spec/SKILL.md +57 -168
- package/dist/method/skills/write-ux-spec/references/accessibility-check.md +13 -72
- package/dist/method/skills/write-ux-spec/references/mockups.md +6 -68
- package/dist/method/skills/write-ux-spec/references/tokens-and-sketches.md +8 -81
- package/dist/method/skills/write-ux-spec/references/ux-checklist.md +12 -67
- package/dist/product-root.js +96 -20743
- package/dist/project-command.js +776 -0
- package/dist/project-command2.js +1 -0
- package/dist/read-command.js +19 -0
- package/dist/rolldown-runtime.js +1 -2
- package/dist/sheet-command.js +58 -0
- package/dist/webauthn-verify.js +3 -5
- package/package.json +13 -11
- package/dist/method/agents/noah/references/conduct.md +0 -102
- package/dist/method/skills/api-e2e-tests/references/frameworks.md +0 -58
- package/dist/method/skills/api-e2e-tests/references/generate.md +0 -67
- package/dist/method/skills/audit-pillars/references/accessibility.md +0 -13
- package/dist/method/skills/audit-pillars/references/architecture.md +0 -13
- package/dist/method/skills/audit-pillars/references/dependencies.md +0 -13
- package/dist/method/skills/audit-pillars/references/format.md +0 -20
- package/dist/method/skills/audit-pillars/references/interface.md +0 -13
- package/dist/method/skills/audit-pillars/references/method.md +0 -33
- package/dist/method/skills/audit-pillars/references/performance.md +0 -17
- package/dist/method/skills/audit-pillars/references/quality.md +0 -11
- package/dist/method/skills/audit-pillars/references/security.md +0 -13
- package/dist/method/skills/audit-pillars/references/tests.md +0 -17
- package/dist/method/skills/critique-deliverable/references/assumption-audit.md +0 -11
- package/dist/method/skills/critique-deliverable/references/compare-existing.md +0 -13
- package/dist/method/skills/critique-deliverable/references/devils-advocate.md +0 -13
- package/dist/method/skills/critique-deliverable/references/divergence.md +0 -15
- package/dist/method/skills/critique-deliverable/references/domain-expert.md +0 -14
- package/dist/method/skills/critique-deliverable/references/extreme-user.md +0 -13
- package/dist/method/skills/critique-deliverable/references/failure-modes.md +0 -13
- package/dist/method/skills/critique-deliverable/references/first-principles.md +0 -12
- package/dist/method/skills/critique-deliverable/references/inversion.md +0 -13
- package/dist/method/skills/critique-deliverable/references/pre-mortem.md +0 -12
- package/dist/method/skills/critique-deliverable/references/red-team.md +0 -12
- package/dist/method/skills/critique-deliverable/references/reframe.md +0 -12
- package/dist/method/skills/critique-deliverable/references/second-order.md +0 -12
- package/dist/method/skills/critique-deliverable/references/socratic.md +0 -15
- package/dist/method/skills/critique-deliverable/references/steelman.md +0 -13
- package/dist/method/skills/critique-deliverable/references/subtraction.md +0 -12
- package/dist/method/skills/develop-story/references/self-check.md +0 -46
- package/dist/method/skills/generate-knowledge-base/references/kb-checklist.md +0 -49
- package/dist/method/skills/generate-knowledge-base/references/repository-scan.md +0 -48
- package/dist/method/skills/ideation/references/choose.md +0 -21
- package/dist/method/skills/ideation/references/gestures.md +0 -15
- package/dist/method/skills/ideation/references/techniques-borrowed.md +0 -8
- package/dist/method/skills/ideation/references/techniques-deep.md +0 -12
- package/dist/method/skills/ideation/references/techniques-frames.md +0 -12
- package/dist/method/skills/ideation/references/techniques-futures.md +0 -8
- package/dist/method/skills/ideation/references/techniques-limits.md +0 -9
- package/dist/method/skills/ideation/references/techniques-people.md +0 -7
- package/dist/method/skills/ideation/references/techniques-sparks.md +0 -10
- package/dist/method/skills/ideation/references/techniques-together.md +0 -11
- package/dist/method/skills/order-merges/SKILL.md +0 -71
- package/dist/method/skills/pitch/references/deck-types.md +0 -17
- package/dist/method/skills/pitch/references/design-methods.md +0 -45
- package/dist/method/skills/pitch/references/design-thinking.md +0 -28
- package/dist/method/skills/pitch/references/story-frameworks.md +0 -39
- package/dist/method/skills/quick-lane/SKILL.md +0 -143
- package/dist/method/skills/review-tests/SKILL.md +0 -32
- package/dist/method/skills/review-tests/references/check.md +0 -25
- package/dist/method/skills/review-tests/references/grid.md +0 -27
- package/dist/method/skills/round-table/SKILL.md +0 -31
- package/dist/method/skills/round-table/evals/cases.yaml +0 -27
- package/dist/method/skills/round-table/references/cast.md +0 -14
- package/dist/method/skills/round-table/references/gestures.md +0 -24
- package/dist/method/skills/round-table/references/guests.md +0 -17
- package/dist/method/skills/round-table/references/independence.md +0 -21
- package/dist/method/skills/round-table/references/rooms.md +0 -29
- package/dist/method/skills/round-table/references/three-views.md +0 -17
- package/dist/method/skills/round-table/references/turns.md +0 -19
- package/dist/method/skills/strategy/references/innovate-frameworks.md +0 -48
- package/dist/method/skills/strategy/references/solve-methods.md +0 -45
- package/dist/method/skills/test-idea/references/bets.md +0 -14
- package/dist/method/skills/test-idea/references/concept.md +0 -24
- package/dist/method/skills/test-idea/references/verdict.md +0 -26
- package/dist/method/skills/workshop/references/analyze.md +0 -36
package/dist/bin.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
// src/bin.ts
|
|
3
3
|
const REQUIRED_MAJOR = 24;
|
|
4
4
|
const current = process.versions.node;
|
|
5
5
|
if (Number(current.split(".")[0]) < REQUIRED_MAJOR) {
|
|
6
|
-
process.stderr.write(`agentplugged needs Node.js ${REQUIRED_MAJOR} or later; this is Node.js ${current}.\nagentplugged a besoin de Node.js ${REQUIRED_MAJOR} ou plus récent ; celui-ci est en ${current}.\n`);
|
|
6
|
+
process.stderr.write(`agentplugged needs Node.js ${REQUIRED_MAJOR} or later; this is Node.js ${current}. Install the current version from https://nodejs.org, then run the command again.\nagentplugged a besoin de Node.js ${REQUIRED_MAJOR} ou plus récent ; celui-ci est en ${current}. Installe la version actuelle depuis https://nodejs.org, puis relance la commande.\n`);
|
|
7
7
|
process.exitCode = 1;
|
|
8
8
|
} else import("./cli.js").catch((error) => {
|
|
9
9
|
process.stderr.write(`${error instanceof Error ? error.stack : error}\n`);
|
|
10
10
|
process.exitCode = 1;
|
|
11
11
|
});
|
|
12
|
-
//#endregion
|
|
13
12
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as boundariesOf, n as boundaryMode } from "./boundary-rules2.js";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Bo as BoundarySettingsSchema } from "./hash.js";
|
|
2
|
+
import { It as readDocumentFiles, jt as DOCUMENT_PATHS, lf as methodSection, ws as architectureDecisions } from "./agent-commands.js";
|
|
3
|
+
import { Mo as parseDocumentFile, Uc as readMainMethod, f as boundariesFromDecisions } from "./map-update.js";
|
|
4
|
+
// ../../packages/core/dist/code-map/boundary-rules.js
|
|
5
|
+
/**
|
|
6
|
+
* The boundaries of a product: the rules its architecture decisions state, and what the code does
|
|
7
|
+
* with them. Both the decisions and the creator's setting are read on the main branch, the
|
|
8
|
+
* version the creator validated: an agent that edits a decision, or `method.yaml`, in its own
|
|
9
|
+
* story lifts nothing until the creator merges it. Without a main branch to read, there are no
|
|
10
|
+
* rules: nothing is enforced on a text nobody validated.
|
|
11
|
+
*/
|
|
12
|
+
/** Most documents read from the main branch in one go. */
|
|
13
|
+
const MAX_DOCUMENTS = 60;
|
|
14
|
+
/** The architecture decisions as the main branch holds them (empty without a main branch). */
|
|
15
|
+
async function validatedDecisions(context) {
|
|
16
|
+
const reader = context.mainBranch;
|
|
17
|
+
if (reader === void 0) return [];
|
|
18
|
+
const paths = /* @__PURE__ */ new Set();
|
|
19
|
+
const committed = await context.docsBase?.read("HEAD", DOCUMENT_PATHS).catch(() => void 0);
|
|
20
|
+
if (committed?.found === true) for (const file of committed.files) paths.add(file.path);
|
|
21
|
+
for (const file of await readDocumentFiles(context.files, true).catch(() => [])) paths.add(file.path);
|
|
22
|
+
const files = [];
|
|
23
|
+
for (const path of [...paths].sort().slice(0, MAX_DOCUMENTS)) {
|
|
24
|
+
const read = await reader.read(path).catch(() => void 0);
|
|
25
|
+
if (read?.found === true && read.text !== void 0) files.push({
|
|
26
|
+
path,
|
|
27
|
+
text: read.text
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return architectureDecisions(files, files.map((file) => parseDocumentFile(file.path, file.text)));
|
|
31
|
+
}
|
|
32
|
+
/** What a crossing does, as the creator set it on the main branch (`report` without a setting). */
|
|
33
|
+
async function boundaryMode(context) {
|
|
34
|
+
if (context.mainBranch === void 0) return "report";
|
|
35
|
+
try {
|
|
36
|
+
const read = await readMainMethod(context.mainBranch);
|
|
37
|
+
if (!read.found || read.text === void 0) return "report";
|
|
38
|
+
const section = methodSection(read.text, "boundaries", BoundarySettingsSchema);
|
|
39
|
+
return section !== void 0 && section !== "invalid" && section.on_cross === "refuse" ? "refuse" : "report";
|
|
40
|
+
} catch {
|
|
41
|
+
return "report";
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** The boundary rules the validated decisions state, anchored on the modules of `map`. */
|
|
45
|
+
async function boundariesOf(context, map) {
|
|
46
|
+
try {
|
|
47
|
+
return boundariesFromDecisions(await validatedDecisions(context), map.modules);
|
|
48
|
+
} catch {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export { boundaryMode as n, boundariesOf as t };
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@ import "./launcher-env.js";
|
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
|
|
5
|
+
// src/cli.ts
|
|
6
6
|
/** The CLI, loaded by `bin.ts` once the Node.js version is known to be supported. */
|
|
7
7
|
const manifest = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
8
8
|
if (process.argv[2] === "mcp" && process.env["AGENTPLUGGED_ENGINE_CHILD"] !== "1") {
|
|
@@ -18,13 +18,18 @@ if (process.argv[2] === "mcp" && process.env["AGENTPLUGGED_ENGINE_CHILD"] !== "1
|
|
|
18
18
|
selfEntry: fileURLToPath(new URL("./bin.js", import.meta.url))
|
|
19
19
|
});
|
|
20
20
|
} else {
|
|
21
|
+
const entry = fileURLToPath(new URL("./bin.js", import.meta.url));
|
|
22
|
+
const { DEV_ENGINE_VERSION, isDevEngineEntry } = await import("./dist2.js");
|
|
23
|
+
const dev = process.env.AGENTPLUGGED_ENGINE_AS_PUBLISHED !== "1" && isDevEngineEntry(entry);
|
|
21
24
|
const { main } = await import("./main.js");
|
|
22
25
|
process.exitCode = await main({
|
|
23
26
|
argv: process.argv.slice(2),
|
|
24
27
|
cwd: process.cwd(),
|
|
25
28
|
env: process.env,
|
|
26
|
-
engineVersion: manifest.version,
|
|
29
|
+
engineVersion: dev ? DEV_ENGINE_VERSION : manifest.version,
|
|
30
|
+
...dev ? { devEngineEntry: entry.replaceAll("\\", "/") } : {},
|
|
27
31
|
installedEngineVersion: async () => {
|
|
32
|
+
if (dev) return DEV_ENGINE_VERSION;
|
|
28
33
|
try {
|
|
29
34
|
return JSON.parse(await readFile(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
30
35
|
} catch {
|
|
@@ -40,5 +45,4 @@ if (process.argv[2] === "mcp" && process.env["AGENTPLUGGED_ENGINE_CHILD"] !== "1
|
|
|
40
45
|
interactive: process.stdin.isTTY === true && process.stdout.isTTY === true
|
|
41
46
|
});
|
|
42
47
|
}
|
|
43
|
-
//#endregion
|
|
44
48
|
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Vs as ErrorCode } from "./hash.js";
|
|
2
|
+
import { B as AgentPluggedError, H as unavailable, q as METHOD_DIR } from "./map-cache.js";
|
|
3
|
+
import { jt as DOCUMENT_PATHS } from "./agent-commands.js";
|
|
4
|
+
// ../../packages/core/dist/docs/commit-documents.js
|
|
5
|
+
/** The most paths one commit takes. */
|
|
6
|
+
const COMMIT_PATHS_MAX = 50;
|
|
7
|
+
/** A control character (a line break included): never part of a path, a name or an address. */
|
|
8
|
+
const CONTROL = { test: (value) => [...value].some((char) => {
|
|
9
|
+
const code = char.charCodeAt(0);
|
|
10
|
+
return code < 32 || code === 127;
|
|
11
|
+
}) };
|
|
12
|
+
const EMAIL = /^[^\s@<>"',;:\\]{1,64}@[^\s@<>"',;:\\]{1,190}\.[^\s@<>"',;:\\]{2,63}$/;
|
|
13
|
+
function invalid(reason) {
|
|
14
|
+
return new AgentPluggedError(ErrorCode.INVALID_ARGUMENTS, "error.invalid_arguments", { reason });
|
|
15
|
+
}
|
|
16
|
+
/** A document path as the commit takes it: inside the documents' folders, nothing that climbs. */
|
|
17
|
+
function documentPathOf(word) {
|
|
18
|
+
const path = word.replaceAll("\\", "/").replace(/^\.\//, "");
|
|
19
|
+
if (CONTROL.test(path) || path.length > 300) return void 0;
|
|
20
|
+
if (path.split("/").some((segment) => segment === "" || segment === "." || segment === "..")) return;
|
|
21
|
+
return DOCUMENT_PATHS.some((dir) => path.startsWith(`${dir}/`)) ? path : void 0;
|
|
22
|
+
}
|
|
23
|
+
/** The commit message of the documents recorded, one line. */
|
|
24
|
+
function messageOf(paths) {
|
|
25
|
+
const names = paths.map((path) => path.slice(path.lastIndexOf("/") + 1));
|
|
26
|
+
return names.length <= 3 ? `Docs: ${names.join(", ")}` : `Docs: ${names.slice(0, 3).join(", ")} and ${names.length - 3} more`;
|
|
27
|
+
}
|
|
28
|
+
/** Records the documents named. Never pushes. */
|
|
29
|
+
async function commitDocuments(context, words) {
|
|
30
|
+
const workspace = context.storyWorkspace;
|
|
31
|
+
if (workspace?.commitPaths === void 0 || workspace.gitIdentity === void 0) return unavailable("recording documents");
|
|
32
|
+
const paths = [];
|
|
33
|
+
for (const word of words) {
|
|
34
|
+
const path = documentPathOf(word);
|
|
35
|
+
if (path === void 0) return invalid(`docs commit ${word} (a file under ${METHOD_DIR}/docs, epics or stories)`);
|
|
36
|
+
if (!paths.includes(path)) paths.push(path);
|
|
37
|
+
}
|
|
38
|
+
if (paths.length === 0 || paths.length > COMMIT_PATHS_MAX) return invalid(`docs commit <path…> (1 to ${COMMIT_PATHS_MAX} files)`);
|
|
39
|
+
for (const path of paths) if (!await context.files.exists(path)) return invalid(`docs commit ${path} (no such file)`);
|
|
40
|
+
const identity = await workspace.gitIdentity();
|
|
41
|
+
const missing = [...identity.name === void 0 ? ["name"] : [], ...identity.email === void 0 ? ["email"] : []];
|
|
42
|
+
if (missing.length > 0) return new AgentPluggedError(ErrorCode.GIT_IDENTITY_MISSING, "error.git_identity_missing", { missing: missing.join(", ") }, { next: "tell the creator in one sentence; never ask for an approval nor borrow an identity" });
|
|
43
|
+
const outcome = await workspace.commitPaths({
|
|
44
|
+
paths,
|
|
45
|
+
message: messageOf(paths)
|
|
46
|
+
});
|
|
47
|
+
if (!outcome.ok) return new AgentPluggedError(ErrorCode.UNEXPECTED, "error.unexpected", { reason: `the documents were not recorded (${outcome.reason}): ${outcome.message}` });
|
|
48
|
+
if (context.docsBase !== void 0) {
|
|
49
|
+
const read = await context.docsBase.read("HEAD", DOCUMENT_PATHS);
|
|
50
|
+
if (read.found) {
|
|
51
|
+
const held = new Set(read.files.map((file) => file.path));
|
|
52
|
+
const absent = paths.filter((path) => path.toLowerCase().endsWith(".md") && !held.has(path));
|
|
53
|
+
if (absent.length > 0) return new AgentPluggedError(ErrorCode.UNEXPECTED, "error.unexpected", { reason: `not recorded, Git ignores ${absent.join(", ")}` });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return { recorded: {
|
|
57
|
+
paths,
|
|
58
|
+
commit: outcome.commit
|
|
59
|
+
} };
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Sets who signs the commits of this product, for this repository only (never the global
|
|
63
|
+
* configuration): the creator's name and email address, in the words they gave.
|
|
64
|
+
*/
|
|
65
|
+
async function setGitIdentity(context, words) {
|
|
66
|
+
const workspace = context.storyWorkspace;
|
|
67
|
+
if (workspace?.setGitIdentity === void 0) return unavailable("setting the Git identity");
|
|
68
|
+
const [rawName, rawEmail, ...extra] = words;
|
|
69
|
+
const name = rawName?.trim() ?? "";
|
|
70
|
+
const email = rawEmail?.trim() ?? "";
|
|
71
|
+
if (extra.length > 0 || name === "" || name.length > 100 || name.startsWith("-") || email.startsWith("-") || CONTROL.test(name) || /[<>]/.test(name) || !EMAIL.test(email)) return invalid("docs identity \"<name>\" \"<email>\" (a name and an email address)");
|
|
72
|
+
await workspace.setGitIdentity({
|
|
73
|
+
name,
|
|
74
|
+
email
|
|
75
|
+
});
|
|
76
|
+
return { identity: {
|
|
77
|
+
name,
|
|
78
|
+
email
|
|
79
|
+
} };
|
|
80
|
+
}
|
|
81
|
+
export { commitDocuments, setGitIdentity };
|