@jstn-sdk/ma 0.1.13 → 0.14.1
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/.agents/plugins/marketplace.json +0 -0
- package/.codex/agents/Architect.toml +1 -0
- package/.codex/agents/Auditor.toml +1 -0
- package/.codex/agents/Builder.toml +1 -0
- package/.codex/agents/Flow.toml +1 -0
- package/.codex/agents/Sage.toml +1 -0
- package/.codex/agents/Vibe.toml +1 -0
- package/.codex/hooks.json +12 -2
- package/.codex/prompts/enforcement.md +0 -0
- package/.codex/prompts/onboarding.md +6 -1
- package/.codex/prompts/release-rules.md +0 -0
- package/.codex/prompts/skill-contract.md +0 -0
- package/COVERAGE.md +9 -9
- package/DEMO.md +15 -6
- package/LICENSE +0 -0
- package/README.md +127 -784
- package/bin/ma.js +591 -105
- package/data/clone-data.ledger.json +0 -0
- package/data/clone-data.proof.json +0 -0
- package/data/clone-data.rvf +0 -0
- package/docs/README.md +8 -2
- package/docs/assets/banner.png +0 -0
- package/docs/autonomous-tasks.md +46 -0
- package/docs/codex-integration.md +16 -0
- package/docs/getting-started.md +32 -8
- package/docs/installed-sdk.md +0 -0
- package/docs/mcp-setup.md +30 -1
- package/docs/qa/{release-issue-gates-0.1.13.json → release-issue-gates-0.14.1.json} +77 -77
- package/docs/qa/release-readiness-0.1.5.md +0 -0
- package/docs/qa/{release-readiness-0.1.13.md → release-readiness-0.14.1.md} +12 -12
- package/docs/quality.md +24 -0
- package/docs/reference/native-engineering-patterns.md +0 -0
- package/docs/reference/native-security-playbooks.md +0 -0
- package/docs/reference/native-source-selection.md +0 -0
- package/docs/reference/native-style-and-deslop.md +0 -0
- package/docs/release-spec.md +27 -14
- package/docs/skills.md +1 -1
- package/docs/vendor-plugin-publishing.md +49 -0
- package/index.js +73 -0
- package/mcp/collections.json +0 -0
- package/mcp/fallback.json +0 -0
- package/mcp/local/code-intel.js +185 -41
- package/mcp/local/context.js +180 -0
- package/mcp/local/memory.js +17 -6
- package/mcp/local/playbooks.js +0 -0
- package/mcp/local/quality.js +39 -0
- package/mcp/local/state.js +7 -3
- package/mcp/local/team-run.js +8 -3
- package/mcp/local/trace.js +0 -0
- package/mcp/local-capabilities.json +9 -0
- package/mcp/native-playbooks.json +0 -0
- package/mcp/servers.json +0 -0
- package/package.json +37 -6
- package/plugins/meta-architect/.app.json +1 -1
- package/plugins/meta-architect/.claude-plugin/plugin.json +12 -0
- package/plugins/meta-architect/.codex-plugin/plugin.json +1 -1
- package/plugins/meta-architect/.mcp.json +1 -1
- package/plugins/meta-architect/README.md +14 -2
- package/plugins/meta-architect/obsidian/main.js +137 -4
- package/plugins/meta-architect/obsidian/manifest.json +1 -1
- package/plugins/meta-architect/obsidian/styles.css +0 -0
- package/plugins/meta-architect/skills/align/SKILL.md +0 -0
- package/plugins/meta-architect/skills/align/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/align/references/shared-language.md +0 -0
- package/plugins/meta-architect/skills/arch/SKILL.md +0 -0
- package/plugins/meta-architect/skills/arch/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/build/SKILL.md +0 -0
- package/plugins/meta-architect/skills/build/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/cleanup/SKILL.md +0 -0
- package/plugins/meta-architect/skills/cleanup/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/cleanup/references/style-and-deslop.md +0 -0
- package/plugins/meta-architect/skills/diagnose/SKILL.md +0 -0
- package/plugins/meta-architect/skills/diagnose/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/flow/SKILL.md +0 -0
- package/plugins/meta-architect/skills/flow/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/maestro/SKILL.md +17 -1
- package/plugins/meta-architect/skills/maestro/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/maestro/references/core-release-rules.md +2 -2
- package/plugins/meta-architect/skills/maestro/references/native-ingest-map.md +0 -0
- package/plugins/meta-architect/skills/sage/SKILL.md +0 -0
- package/plugins/meta-architect/skills/sage/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/sage/references/source-selection.md +0 -0
- package/plugins/meta-architect/skills/tdd/SKILL.md +0 -0
- package/plugins/meta-architect/skills/tdd/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/vet/SKILL.md +0 -0
- package/plugins/meta-architect/skills/vet/agents/openai.yaml +0 -0
- package/plugins/meta-architect/skills/vet/references/security-playbooks.md +0 -0
- package/plugins/meta-architect/skills/vibe/SKILL.md +0 -0
- package/plugins/meta-architect/skills/vibe/agents/openai.yaml +0 -0
- package/schemas/autonomous-task-queue.schema.json +58 -0
- package/schemas/handoff-packet.schema.json +36 -0
- package/schemas/setup-receipt.schema.json +28 -0
- package/schemas/skill-frontmatter.schema.json +20 -0
- package/schemas/support-bundle.schema.json +37 -0
- package/schemas/task-contract.schema.json +31 -0
- package/scripts/active-autonomy-hook.mjs +141 -11
- package/scripts/biome-staged.js +0 -0
- package/scripts/build-linux-packages.mjs +7 -3
- package/scripts/cleanup-test-fixtures.sh +55 -0
- package/scripts/context-hydration-hook.mjs +89 -0
- package/scripts/demo-smoke.js +285 -0
- package/scripts/doctor.js +10 -8
- package/scripts/install.sh +33 -4
- package/scripts/install.sh.sha256 +1 -0
- package/scripts/linux-package-lib.mjs +0 -0
- package/scripts/linux-package-smoke.mjs +2 -2
- package/scripts/package-size-check.mjs +26 -0
- package/scripts/plugin-build.js +314 -0
- package/scripts/plugin-publish.js +77 -0
- package/scripts/plugin-sync.js +83 -17
- package/scripts/prepack.js +9 -0
- package/scripts/ralph/prompt.md +0 -0
- package/scripts/release-metadata.js +0 -0
- package/scripts/release-sync.js +83 -7
- package/scripts/release-verify.js +131 -7
- package/scripts/setup-npmrc.js +48 -23
- package/scripts/skills-install.js +9 -2
- package/scripts/skills-manifest.js +2 -21
- package/scripts/skills-pack.js +2 -2
- package/scripts/skills-validate.js +5 -55
- package/skills/align/SKILL.md +0 -0
- package/skills/align/agents/openai.yaml +0 -0
- package/skills/align/references/shared-language.md +0 -0
- package/skills/arch/SKILL.md +0 -0
- package/skills/arch/agents/openai.yaml +0 -0
- package/skills/build/SKILL.md +0 -0
- package/skills/build/agents/openai.yaml +0 -0
- package/skills/cleanup/SKILL.md +0 -0
- package/skills/cleanup/agents/openai.yaml +0 -0
- package/skills/cleanup/references/style-and-deslop.md +0 -0
- package/skills/diagnose/SKILL.md +0 -0
- package/skills/diagnose/agents/openai.yaml +0 -0
- package/skills/flow/SKILL.md +0 -0
- package/skills/flow/agents/openai.yaml +0 -0
- package/skills/index.json +0 -0
- package/skills/maestro/SKILL.md +17 -1
- package/skills/maestro/agents/openai.yaml +0 -0
- package/skills/maestro/references/core-release-rules.md +2 -2
- package/skills/maestro/references/native-ingest-map.md +0 -0
- package/skills/sage/SKILL.md +0 -0
- package/skills/sage/agents/openai.yaml +0 -0
- package/skills/sage/references/source-selection.md +0 -0
- package/skills/tdd/SKILL.md +0 -0
- package/skills/tdd/agents/openai.yaml +0 -0
- package/skills/vet/SKILL.md +0 -0
- package/skills/vet/agents/openai.yaml +0 -0
- package/skills/vet/references/security-playbooks.md +0 -0
- package/skills/vibe/SKILL.md +0 -0
- package/skills/vibe/agents/openai.yaml +0 -0
- package/sprint/00-idea.md +0 -0
- package/sprint/01-architecture.md +0 -0
- package/sprint/02-oss-evidence.md +0 -0
- package/sprint/03-logic.md +0 -0
- package/sprint/04-security.md +0 -0
- package/sprint/05-dx-ux.md +0 -0
- package/sprint/06-build-plan.md +0 -0
- package/sprint/07-release.md +2 -2
- package/src/agents.js +281 -0
- package/src/bootstrap.js +272 -65
- package/src/build-gate.js +0 -0
- package/src/codex-app-server.js +291 -0
- package/src/decision-log.js +0 -0
- package/src/fs-utils.js +175 -4
- package/src/launcher.js +26 -23
- package/src/mcp-config.js +9 -1
- package/src/mcp-live-client.js +141 -8
- package/src/paths.js +6 -1
- package/src/policy.js +2 -2
- package/src/prelaunch.js +223 -0
- package/src/process-utils.js +62 -0
- package/src/quality/ai-quality-orchestrator.js +328 -0
- package/src/release-issue-gates.js +62 -0
- package/src/release-operations.js +72 -0
- package/src/release-state.js +0 -0
- package/src/runtime/active-autonomy-core.js +0 -0
- package/src/runtime/agent-compat.js +31 -0
- package/src/runtime/alignment-sentinel.js +0 -0
- package/src/runtime/architect-review.js +249 -11
- package/src/runtime/autonomous-tasks.js +585 -0
- package/src/runtime/build-readiness.js +0 -0
- package/src/runtime/code-graph-rehearse.js +0 -0
- package/src/runtime/codeburn-core.js +118 -0
- package/src/runtime/context-authority.js +40 -0
- package/src/runtime/context-economy-core.js +40 -0
- package/src/runtime/continuity-graph.js +201 -0
- package/src/runtime/continuity-notes.js +71 -26
- package/src/runtime/core-source-ingest.js +2 -2
- package/src/runtime/detached-provider.js +90 -13
- package/src/runtime/doctor-report.js +18 -0
- package/src/runtime/environment-awareness-core.js +0 -0
- package/src/runtime/exposure-catalog.js +0 -0
- package/src/runtime/graphify-core.js +167 -0
- package/src/runtime/guidance-stack.js +9 -2
- package/src/runtime/handoff-packets.js +92 -0
- package/src/runtime/headroom-core.js +104 -0
- package/src/runtime/helper-orchestration-core.js +0 -0
- package/src/runtime/hook-profiles.js +20 -0
- package/src/runtime/learning-loop-core.js +110 -4
- package/src/runtime/live-agent-verification.js +122 -0
- package/src/runtime/maestro-events.js +0 -0
- package/src/runtime/maestro-manager.js +0 -0
- package/src/runtime/maestro-output.js +58 -0
- package/src/runtime/maestro-state.js +0 -0
- package/src/runtime/managed-markdown.js +29 -0
- package/src/runtime/mcp-authority.js +147 -0
- package/src/runtime/mcp-policy.js +0 -0
- package/src/runtime/obsidian-integration-core.js +255 -17
- package/src/runtime/obsidian-plugin-bridge.js +344 -38
- package/src/runtime/orchestrator.js +0 -0
- package/src/runtime/pi-maestro-core.js +89 -0
- package/src/runtime/preferences.js +79 -0
- package/src/runtime/project-context.js +636 -0
- package/src/runtime/prompt-strategy-core.js +0 -0
- package/src/runtime/quorum-review.js +0 -0
- package/src/runtime/ralph-execution-core.js +0 -0
- package/src/runtime/redaction-gateway.js +218 -19
- package/src/runtime/runtime-state.js +94 -2
- package/src/runtime/schema-migrations.js +162 -0
- package/src/runtime/semantic-recording-core.js +0 -0
- package/src/runtime/signal-hooks.js +13 -0
- package/src/runtime/skills-registry-export.js +96 -8
- package/src/runtime/startup-path.js +0 -0
- package/src/runtime/task-contracts.js +83 -0
- package/src/runtime/universal-plugin-broker-core.js +373 -50
- package/src/runtime/workspace-intelligence-runtime.js +0 -0
- package/src/runtime/workspace-virtualizer.js +0 -0
- package/src/runtime/workspaces.js +0 -0
- package/src/runtime-artifacts.js +0 -0
- package/src/setup-lifecycle.js +359 -0
- package/src/skill-frontmatter.js +78 -0
- package/src/skill-installer.js +226 -71
- package/src/skills.js +309 -31
- package/src/state-sync.js +0 -0
- package/src/test-fixtures.js +543 -0
- package/src/tui/grid.js +67 -0
- package/src/tui/status-grid.js +23 -0
- package/support-bundle.json +114 -0
- package/templates/AGENTS.md +6 -2
- package/templates/catalog-manifest.json +0 -0
- package/templates/model-instructions/core.md +0 -0
- package/templates/model-instructions/release.md +0 -0
- package/templates/model-instructions/security.md +0 -0
- package/templates/quality/ai-quality-rules.yml +37 -0
- package/docs/assets/image/Screenshot(1).png +0 -0
- package/docs/assets/image/Screenshot(2).png +0 -0
- package/docs/assets/image/Screenshot(3).png +0 -0
- package/docs/assets/image/Screenshot(4).png +0 -0
- package/docs/assets/image/Screenshot(5).png +0 -0
- package/docs/assets/image/Screenshot(6).png +0 -0
- package/docs/assets/image/Screenshot(7).png +0 -0
- package/docs/assets/image/Screenshot(8).png +0 -0
- package/docs/assets/image/Screenshot(9).png +0 -0
- package/docs/assets/meta-architect-logo.png +0 -0
- package/docs/assets/meta-architect-logo.svg +0 -8
- package/docs/onboarding.md +0 -81
- package/docs/prompt-guidance-contract.md +0 -17
- package/docs/prompt-guidance-fragments/active-autonomy-core.md +0 -7
- package/docs/skills-publishing.md +0 -255
- package/scripts/postinstall.js +0 -23
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
# Release Readiness 0.1
|
|
1
|
+
# Release Readiness 0.14.1
|
|
2
2
|
|
|
3
3
|
## Production bar
|
|
4
4
|
|
|
5
|
-
`v0.1
|
|
5
|
+
`v0.14.1` is treated as production only when:
|
|
6
6
|
- the package installs cleanly from the canonical public install command
|
|
7
7
|
- the Codex-hosted runtime path works end to end
|
|
8
8
|
- the helper flow remains valid for scripted verification
|
|
9
9
|
- the singular `$maestro` umbrella and helper-skill contract stay coherent
|
|
10
|
-
- release docs, package metadata, and workflows all agree on `0.1
|
|
10
|
+
- release docs, package metadata, and workflows all agree on `0.14.1`
|
|
11
11
|
|
|
12
12
|
Target release state:
|
|
13
|
-
- npm package: `@jstn-sdk/ma@0.1
|
|
13
|
+
- npm package: `@jstn-sdk/ma@0.14.1`
|
|
14
14
|
- npm registry state: pending publish
|
|
15
|
-
- publishability note: `0.
|
|
16
|
-
- git tag: `v0.1
|
|
17
|
-
- GitHub release: pending publish for `v0.1
|
|
15
|
+
- publishability note: `0.14.0` is already published, so `0.14.1` is the next publishable package line
|
|
16
|
+
- git tag: `v0.14.1`
|
|
17
|
+
- GitHub release: pending publish for `v0.14.1`
|
|
18
18
|
|
|
19
19
|
## Production checklist
|
|
20
20
|
|
|
21
21
|
- skills-first product identity: PASS
|
|
22
22
|
- package/plugin identity aligned to `@jstn-sdk/ma`: PASS
|
|
23
|
-
- version/tag alignment `0.1
|
|
23
|
+
- version/tag alignment `0.14.1` / `v0.14.1`: PASS
|
|
24
24
|
- install/uninstall docs aligned: PASS
|
|
25
25
|
- onboarding is concise and sequential: PASS
|
|
26
26
|
- helper command documented as secondary: PASS
|
|
@@ -36,7 +36,7 @@ Target release state:
|
|
|
36
36
|
- workflow/release/provenance docs aligned: PASS
|
|
37
37
|
- no stale package names remain in tracked repo surfaces: PASS
|
|
38
38
|
- no conflicting CLI-first product story remains in tracked product docs: PASS
|
|
39
|
-
- issue proof gates for `v0.1
|
|
39
|
+
- issue proof gates for `v0.14.1`: PASS; `release-issue-gates-0.14.1.json` marks issues `#13-#29` passed with implementation, verification, and production evidence, so release verification can enforce the gate artifact instead of blocking on pending issue states
|
|
40
40
|
|
|
41
41
|
## Automated checks run
|
|
42
42
|
|
|
@@ -71,10 +71,10 @@ That should prove:
|
|
|
71
71
|
Issue gate artifact:
|
|
72
72
|
|
|
73
73
|
```text
|
|
74
|
-
docs/qa/release-issue-gates-0.1.
|
|
74
|
+
docs/qa/release-issue-gates-0.14.1.json
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
Every open issue assigned to `v0.1
|
|
77
|
+
Every open issue assigned to `v0.14.1` must remain in this file until it is production-passed. A passed issue requires:
|
|
78
78
|
- implementation evidence
|
|
79
79
|
- verification evidence
|
|
80
80
|
- production evidence
|
|
@@ -93,7 +93,7 @@ Helper-path validation:
|
|
|
93
93
|
|
|
94
94
|
```bash
|
|
95
95
|
ma setup
|
|
96
|
-
ma idea "Harden Meta-Architect v0.1
|
|
96
|
+
ma idea "Harden Meta-Architect v0.14.1 semantic core with Obsidian vault context, Ralph execution proof, context economy, and package-gated release evidence"
|
|
97
97
|
ma run '$arch'
|
|
98
98
|
ma run '$sage'
|
|
99
99
|
ma run '$flow'
|
package/docs/quality.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# AI quality enforcement
|
|
2
|
+
|
|
3
|
+
Meta-Architect exposes `AIQualityOrchestrator` as a blocking policy boundary for generated code. It records bounded violation and KPI receipts under `.ma/quality/` and exposes them through the local MCP quality resources.
|
|
4
|
+
|
|
5
|
+
The default checks are deterministic source checks plus the installed Semgrep CLI. The orchestrator has no external provider or model configuration; security and architecture checks are local, deterministic, and fail closed when Semgrep is unavailable.
|
|
6
|
+
|
|
7
|
+
Every accepted generation must include approved test evidence. `testDrivenGeneration()` requires test generation, approval, code generation, execution, and at least 80% coverage before returning code.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { AIQualityOrchestrator } from "@jstn-sdk/ma";
|
|
13
|
+
|
|
14
|
+
const quality = new AIQualityOrchestrator({ projectRoot: process.cwd() });
|
|
15
|
+
const result = await quality.validate(code, {
|
|
16
|
+
filePath: "src/example.ts",
|
|
17
|
+
hasTests: true,
|
|
18
|
+
testCoverage: 0.9,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
if (!result.passed) throw new Error(result.reviewReason);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The tracked Semgrep baseline is `templates/quality/ai-quality-rules.yml`; a project may provide a stricter `.ma/semgrep/ai-quality-rules.yml`.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/release-spec.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# v0.1
|
|
1
|
+
# v0.14.1 Requirements & Rules
|
|
2
2
|
|
|
3
3
|
## Production definition
|
|
4
4
|
|
|
5
|
-
Meta-Architect `v0.1
|
|
5
|
+
Meta-Architect `v0.14.1` is production only when:
|
|
6
6
|
1. the package/install surface works
|
|
7
7
|
2. the in-session skill workflow from `$arch` through `$build` works
|
|
8
8
|
3. the release evidence matches the actual package and git tag
|
|
9
9
|
|
|
10
|
-
## What `v0.1
|
|
10
|
+
## What `v0.14.1` must have
|
|
11
11
|
|
|
12
12
|
### 1. Canonical package/runtime path
|
|
13
13
|
|
|
14
|
-
- recommended POSIX
|
|
14
|
+
- recommended POSIX install: download the latest installer and checksum through jsDelivr, verify the downloaded installer with `sha256sum -c`, then run `sh install.sh`
|
|
15
15
|
- install: `npm i -g @openai/codex@latest @jstn-sdk/ma@latest`
|
|
16
16
|
- optional helper launch: `ma --madmax --high`
|
|
17
17
|
- uninstall Meta-Architect only: `npm uninstall -g @jstn-sdk/ma`
|
|
@@ -34,6 +34,10 @@ Helper commands remain available for setup and scripted validation:
|
|
|
34
34
|
- `ma merge`
|
|
35
35
|
- `ma release`
|
|
36
36
|
|
|
37
|
+
`ma merge` and `ma release` are approval-only by default. `--dry-run` performs
|
|
38
|
+
preflight without changing release state; `--execute` is the only mode that
|
|
39
|
+
runs the displayed `git merge --no-ff --no-edit -- <source>` command.
|
|
40
|
+
|
|
37
41
|
### 3. State and gate contract
|
|
38
42
|
|
|
39
43
|
Canonical runtime namespace:
|
|
@@ -50,16 +54,16 @@ Canonical state files:
|
|
|
50
54
|
|
|
51
55
|
### 4. Required release evidence
|
|
52
56
|
|
|
53
|
-
- `package.json` version `0.1
|
|
54
|
-
- git tag `v0.1
|
|
57
|
+
- `package.json` version `0.14.1`
|
|
58
|
+
- git tag `v0.14.1`
|
|
55
59
|
- `RELEASE.md`
|
|
56
60
|
- `CHANGELOG.md`
|
|
57
|
-
- `docs/qa/release-readiness-0.1.
|
|
58
|
-
- `docs/qa/release-issue-gates-0.1.
|
|
61
|
+
- `docs/qa/release-readiness-0.14.1.md`
|
|
62
|
+
- `docs/qa/release-issue-gates-0.14.1.json`
|
|
59
63
|
- green `npm run release:check`
|
|
60
|
-
- GitHub release asset `meta-architect_0.
|
|
61
|
-
- GitHub release asset `meta-architect-0.1
|
|
62
|
-
- GitHub release asset `meta-architect-0.1
|
|
64
|
+
- GitHub release asset `meta-architect_0.14.1_all.deb`
|
|
65
|
+
- GitHub release asset `meta-architect-0.14.1-1-any.pkg.tar.xz`
|
|
66
|
+
- GitHub release asset `meta-architect-0.14.1-1.noarch.rpm`
|
|
63
67
|
- green `npm run linux:packages:build`
|
|
64
68
|
- green `npm run linux:packages:smoke`
|
|
65
69
|
- green `npm run release:assets`
|
|
@@ -83,7 +87,9 @@ Canonical state files:
|
|
|
83
87
|
7. Build and smoke-check the Linux native packages on Linux:
|
|
84
88
|
- `npm run linux:packages:build`
|
|
85
89
|
- `npm run linux:packages:smoke`
|
|
86
|
-
|
|
90
|
+
- `npm run release:assets`
|
|
91
|
+
- `npm run release:assets:generate` creates `dist/SHA256SUMS`, `dist/sbom.spdx.json`, and `dist/release-summary.json`; `release:assets` verifies them.
|
|
92
|
+
- `dist/` is CI-generated and ignored by Git. GitHub Releases are the source of truth for downloadable packages; historical binaries are not retained in the repository.
|
|
87
93
|
8. Create and push tag `v<version>`
|
|
88
94
|
9. Preferred publish path: publish from `.github/workflows/npm-publish.yml` on a supported cloud runner so provenance can be generated
|
|
89
95
|
10. Local shell fallback when not publishing from GitHub Actions or GitLab CI/CD:
|
|
@@ -101,11 +107,11 @@ Canonical state files:
|
|
|
101
107
|
|
|
102
108
|
### 6.2 Issue proof gates
|
|
103
109
|
|
|
104
|
-
Every open next-release issue must be represented in `docs/qa/release-issue-gates-0.1.
|
|
110
|
+
Every open next-release issue must be represented in `docs/qa/release-issue-gates-0.14.1.json`.
|
|
105
111
|
|
|
106
112
|
Production pass rule:
|
|
107
113
|
- issue status must be `passed`
|
|
108
|
-
- issue milestone must match `v0.1
|
|
114
|
+
- issue milestone must match `v0.14.1`
|
|
109
115
|
- implementation evidence must be present
|
|
110
116
|
- verification evidence must be present
|
|
111
117
|
- production evidence must be present
|
|
@@ -118,3 +124,10 @@ Production pass rule:
|
|
|
118
124
|
- `npm publish --provenance` is valid only from a supported cloud CI/CD provider
|
|
119
125
|
- local shell publishes are expected to fail with `Automatic provenance generation not supported for provider: null`
|
|
120
126
|
- use the repository publish workflow when provenance is part of the release bar
|
|
127
|
+
## Package diagnostics
|
|
128
|
+
|
|
129
|
+
`npm run package:doctor` (or `npm run release:doctor`) checks maintainer-facing
|
|
130
|
+
release and package artifacts. It is distinct from `ma doctor`, which checks
|
|
131
|
+
installed/user environment health.
|
|
132
|
+
It is intentionally separate from `ma doctor`, which checks the installed
|
|
133
|
+
environment, runtime state, MCP readiness, and support bundle health.
|
package/docs/skills.md
CHANGED
|
@@ -16,7 +16,7 @@ Recommended CLI install for macOS, Linux, WSL, and Git-Bash:
|
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
# One-line install (POSIX shells only; use WSL/Git-Bash on Windows)
|
|
19
|
-
curl -
|
|
19
|
+
curl -fsSLo install.sh https://cdn.jsdelivr.net/gh/JustineDevs/meta-architect@latest/scripts/install.sh && curl -fsSLo install.sh.sha256 https://cdn.jsdelivr.net/gh/JustineDevs/meta-architect@latest/scripts/install.sh.sha256 && sed 's#scripts/install.sh#install.sh#' install.sh.sha256 | sha256sum -c - && sh install.sh
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
```bash
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Vendor Plugin Publishing
|
|
2
|
+
|
|
3
|
+
The existing `plugins/meta-architect` directory is the only hand-authored plugin source. Build vendor outputs from it:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm run plugin:build -- --targets all --output ./dist/vendor-plugins
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Publishing is explicit and one host at a time. It is a dry run unless `--execute` is supplied:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm run plugin:publish -- --target pi
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Pi consumes the existing `@jstn-sdk/ma` package; no second npm package is created. Claude Code, Cursor, Antigravity, Gemini CLI, OpenCode, Cline, Continue, Goose, and OpenClaw use host-specific Git, marketplace, extension, or workspace distribution flows; `plugin:publish` prepares those native inputs and does not pretend a local npm command publishes them.
|
|
16
|
+
|
|
17
|
+
The builder produces one directory per host. It copies the existing lane skills and adds only the host manifest, rules, context file, or package metadata required by that host. It never creates a second workflow or changes the canonical skills.
|
|
18
|
+
|
|
19
|
+
ChatGPT is not included as a generated local plugin target. ChatGPT
|
|
20
|
+
publication requires a deployed HTTPS MCP backend, authentication, privacy
|
|
21
|
+
materials, and OpenAI review. See [ChatGPT Integration](./chatgpt-integration.md)
|
|
22
|
+
for the exact readiness contract.
|
|
23
|
+
|
|
24
|
+
## Outputs
|
|
25
|
+
|
|
26
|
+
| Target | Output | Mode |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| `codex` | `.codex-plugin/`, `skills/`, app and MCP metadata | native |
|
|
29
|
+
| `claude-code` | Claude marketplace plus plugin source | native |
|
|
30
|
+
| `cursor` | Cursor marketplace plus plugin source and rules | native |
|
|
31
|
+
| `antigravity` | `plugin.json`, `skills/`, `rules/` | native |
|
|
32
|
+
| `gemini-cli` | `gemini-extension.json`, `GEMINI.md`, `skills/` | native |
|
|
33
|
+
| `opencode` | `.opencode/skills/`, `AGENTS.md` | native |
|
|
34
|
+
| `pi` | `@jstn-sdk/ma` package with `pi.skills` metadata | native |
|
|
35
|
+
| `cline` | `.clinerules`, `.cline/skills/` | native |
|
|
36
|
+
| `openclaw` | workspace `skills/` and `AGENTS.md` | portable |
|
|
37
|
+
| `continue` | `.continue/rules/` and portable skills | portable |
|
|
38
|
+
| `goose` | workspace `skills/` and `AGENTS.md` | portable |
|
|
39
|
+
|
|
40
|
+
Portable means the generated bundle is usable as project context and skills, but this repository does not invent a host runtime plugin or claim marketplace publication. A host-specific publisher still requires the host account, repository, or review process.
|
|
41
|
+
|
|
42
|
+
## Verification
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm test -- test/plugin-build.test.js
|
|
46
|
+
npm run plugin:verify
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Inspect `BUILD-MANIFEST.json` in each output before publishing. It records the generated version, source, support mode, and the host-specific install/publish action.
|
package/index.js
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
|
+
export { qualityResources, queryQualityStatus, readQualityResource } from "./mcp/local/quality.js";
|
|
2
|
+
export {
|
|
3
|
+
agentRegistry as agentSurfaceRegistry,
|
|
4
|
+
detectInstalled,
|
|
5
|
+
getAgent,
|
|
6
|
+
getAgentInvocation,
|
|
7
|
+
getNonUniversalAgents,
|
|
8
|
+
isUniversalAgent as isUniversalAgentSurface,
|
|
9
|
+
listAgents,
|
|
10
|
+
resolveAgentCommand,
|
|
11
|
+
} from "./src/agents.js";
|
|
1
12
|
export {
|
|
2
13
|
evaluateBuildGate,
|
|
3
14
|
formatBuildBlockers,
|
|
4
15
|
formatNextAllowedTriggers,
|
|
5
16
|
} from "./src/build-gate.js";
|
|
17
|
+
export {
|
|
18
|
+
CodexAppServerClient,
|
|
19
|
+
CodexRpcError,
|
|
20
|
+
createStdioTransport,
|
|
21
|
+
generateCodexBindings,
|
|
22
|
+
parseCodexJsonl,
|
|
23
|
+
runCodexExec,
|
|
24
|
+
validateStructuredResult,
|
|
25
|
+
} from "./src/codex-app-server.js";
|
|
6
26
|
export {
|
|
7
27
|
appendDecision,
|
|
8
28
|
loadDecisionLog,
|
|
@@ -22,6 +42,11 @@ export {
|
|
|
22
42
|
validateMergeTarget,
|
|
23
43
|
validateReleaseOrigin,
|
|
24
44
|
} from "./src/policy.js";
|
|
45
|
+
export {
|
|
46
|
+
AIQualityOrchestrator,
|
|
47
|
+
calculateQualityScore,
|
|
48
|
+
staticViolations,
|
|
49
|
+
} from "./src/quality/ai-quality-orchestrator.js";
|
|
25
50
|
export { loadReleaseState, saveReleaseState, validateReleaseState } from "./src/release-state.js";
|
|
26
51
|
export {
|
|
27
52
|
classifyAutonomyBranch,
|
|
@@ -30,6 +55,14 @@ export {
|
|
|
30
55
|
loadActiveAutonomyCore,
|
|
31
56
|
validateActiveAutonomyCore,
|
|
32
57
|
} from "./src/runtime/active-autonomy-core.js";
|
|
58
|
+
export {
|
|
59
|
+
agentCompatPackage,
|
|
60
|
+
agentCompatVersion,
|
|
61
|
+
compileAgentIntegrations,
|
|
62
|
+
detectAgentEnvironments,
|
|
63
|
+
listAgentCompatAdapters,
|
|
64
|
+
validateAgentIntegrations,
|
|
65
|
+
} from "./src/runtime/agent-compat.js";
|
|
33
66
|
export {
|
|
34
67
|
createAlignmentRecoveryPlan,
|
|
35
68
|
createDefaultAlignmentSentinelReport,
|
|
@@ -37,6 +70,20 @@ export {
|
|
|
37
70
|
loadAlignmentSentinelReportOrDefault,
|
|
38
71
|
saveAlignmentSentinelReport,
|
|
39
72
|
} from "./src/runtime/alignment-sentinel.js";
|
|
73
|
+
export {
|
|
74
|
+
autonomousTaskSchemaVersion,
|
|
75
|
+
cancelAutonomousTask,
|
|
76
|
+
createTaskQueue,
|
|
77
|
+
enqueueAutonomousTasks,
|
|
78
|
+
getAutonomousTaskQueuePath,
|
|
79
|
+
loadTaskQueue,
|
|
80
|
+
parseTaskInput,
|
|
81
|
+
runAutonomousTasks,
|
|
82
|
+
saveTaskQueue,
|
|
83
|
+
seedAutonomousTaskArtifacts,
|
|
84
|
+
summarizeTasks,
|
|
85
|
+
validateTaskQueue,
|
|
86
|
+
} from "./src/runtime/autonomous-tasks.js";
|
|
40
87
|
export {
|
|
41
88
|
createCodeGraphTouchpoint,
|
|
42
89
|
createCodeGraphTouchpointFromFile,
|
|
@@ -55,6 +102,15 @@ export {
|
|
|
55
102
|
shouldBypassContextEconomy,
|
|
56
103
|
validateContextEconomyCore,
|
|
57
104
|
} from "./src/runtime/context-economy-core.js";
|
|
105
|
+
export {
|
|
106
|
+
continuityGraphSchemaVersion,
|
|
107
|
+
createDefaultContinuityGraph,
|
|
108
|
+
getContinuityGraphPath,
|
|
109
|
+
loadContinuityGraph,
|
|
110
|
+
mergeContinuityGraph,
|
|
111
|
+
queryContinuityGraph,
|
|
112
|
+
validateContinuityGraph,
|
|
113
|
+
} from "./src/runtime/continuity-graph.js";
|
|
58
114
|
export {
|
|
59
115
|
coreSourceDefinitions,
|
|
60
116
|
createDefaultCoreSourceIngest,
|
|
@@ -99,6 +155,7 @@ export {
|
|
|
99
155
|
loadLearningLoopCore,
|
|
100
156
|
validateLearningLoopCore,
|
|
101
157
|
} from "./src/runtime/learning-loop-core.js";
|
|
158
|
+
export { verifyLiveAgentMatrix } from "./src/runtime/live-agent-verification.js";
|
|
102
159
|
export {
|
|
103
160
|
validateRuntimeMcpPolicy,
|
|
104
161
|
validateRuntimeMcpPolicyFile,
|
|
@@ -147,6 +204,14 @@ export {
|
|
|
147
204
|
renameObsidianFileSafely,
|
|
148
205
|
writeObsidianAttachment,
|
|
149
206
|
} from "./src/runtime/obsidian-plugin-bridge.js";
|
|
207
|
+
export {
|
|
208
|
+
assertPiMaestroToolAllowed,
|
|
209
|
+
createPiMaestroCapabilityMapping,
|
|
210
|
+
createPiMaestroToolSurface,
|
|
211
|
+
isPiMaestroEnabled,
|
|
212
|
+
maestroGateLanes,
|
|
213
|
+
runPiMaestroExperimental,
|
|
214
|
+
} from "./src/runtime/pi-maestro-core.js";
|
|
150
215
|
export {
|
|
151
216
|
createDefaultPromptStrategyCore,
|
|
152
217
|
loadPromptStrategyCore,
|
|
@@ -246,3 +311,11 @@ export {
|
|
|
246
311
|
runVibe,
|
|
247
312
|
} from "./src/skills.js";
|
|
248
313
|
export { loadCombinedState, syncStatusUpdates } from "./src/state-sync.js";
|
|
314
|
+
export {
|
|
315
|
+
measureWidth,
|
|
316
|
+
padCell,
|
|
317
|
+
renderGrid,
|
|
318
|
+
renderRow,
|
|
319
|
+
renderSeparatorLine,
|
|
320
|
+
} from "./src/tui/grid.js";
|
|
321
|
+
export { renderCheckGrid, renderReleaseGrid } from "./src/tui/status-grid.js";
|
package/mcp/collections.json
CHANGED
|
File without changes
|
package/mcp/fallback.json
CHANGED
|
File without changes
|
package/mcp/local/code-intel.js
CHANGED
|
@@ -1,39 +1,187 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { promisify } from "node:util";
|
|
3
4
|
import { getRepoRoot } from "../../src/paths.js";
|
|
5
|
+
import { safeExecFile } from "../../src/process-utils.js";
|
|
4
6
|
|
|
5
|
-
const
|
|
7
|
+
const execFileAsync = promisify(safeExecFile);
|
|
8
|
+
const MAX_SCAN_BYTES = 1024 * 1024;
|
|
9
|
+
const ignoredDirs = new Set([
|
|
10
|
+
".git",
|
|
11
|
+
".ma",
|
|
12
|
+
".omx",
|
|
13
|
+
".next",
|
|
14
|
+
".turbo",
|
|
15
|
+
".vercel",
|
|
16
|
+
"build",
|
|
17
|
+
"coverage",
|
|
18
|
+
"dist",
|
|
19
|
+
"node_modules",
|
|
20
|
+
]);
|
|
21
|
+
const artifactExtensions = new Set([
|
|
22
|
+
".7z",
|
|
23
|
+
".bin",
|
|
24
|
+
".bmp",
|
|
25
|
+
".class",
|
|
26
|
+
".dll",
|
|
27
|
+
".dylib",
|
|
28
|
+
".gif",
|
|
29
|
+
".gz",
|
|
30
|
+
".ico",
|
|
31
|
+
".jar",
|
|
32
|
+
".jpeg",
|
|
33
|
+
".jpg",
|
|
34
|
+
".lockb",
|
|
35
|
+
".mp3",
|
|
36
|
+
".mp4",
|
|
37
|
+
".o",
|
|
38
|
+
".pdf",
|
|
39
|
+
".png",
|
|
40
|
+
".so",
|
|
41
|
+
".svg",
|
|
42
|
+
".tar",
|
|
43
|
+
".tgz",
|
|
44
|
+
".wasm",
|
|
45
|
+
".webp",
|
|
46
|
+
".woff",
|
|
47
|
+
".woff2",
|
|
48
|
+
".zip",
|
|
49
|
+
".zst",
|
|
50
|
+
]);
|
|
51
|
+
const ignoredFiles = new Set([".active"]);
|
|
6
52
|
const codeIntelTools = [
|
|
7
53
|
"code_intel.list_files",
|
|
8
54
|
"code_intel.search_text",
|
|
9
55
|
"code_intel.read_excerpt",
|
|
10
56
|
];
|
|
11
57
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
58
|
+
function normalizeRelative(relativePath) {
|
|
59
|
+
const normalized = path.posix.normalize(relativePath.replaceAll(path.sep, "/"));
|
|
60
|
+
if (
|
|
61
|
+
normalized === "." ||
|
|
62
|
+
normalized === ".." ||
|
|
63
|
+
normalized.startsWith("../") ||
|
|
64
|
+
normalized.includes("\0")
|
|
65
|
+
) {
|
|
66
|
+
throw new Error("code_intel path must stay inside the repository");
|
|
15
67
|
}
|
|
68
|
+
return normalized;
|
|
69
|
+
}
|
|
16
70
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
71
|
+
function isArtifactPath(relativePath) {
|
|
72
|
+
const segments = relativePath.split("/");
|
|
73
|
+
return (
|
|
74
|
+
ignoredFiles.has(segments.at(-1)) ||
|
|
75
|
+
segments.some((segment) => ignoredDirs.has(segment)) ||
|
|
76
|
+
artifactExtensions.has(path.extname(relativePath).toLowerCase())
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function isReadableTextFile(absolutePath) {
|
|
81
|
+
const stat = await fs.lstat(absolutePath);
|
|
82
|
+
if (stat.isSymbolicLink()) return false;
|
|
83
|
+
if (!stat.isFile() || stat.size > MAX_SCAN_BYTES) return false;
|
|
84
|
+
const sample = await fs.readFile(absolutePath, { encoding: null, flag: "r" });
|
|
85
|
+
return !sample.subarray(0, Math.min(sample.length, 8192)).includes(0);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async function assertSafeRepoPath(rootDir, relativePath) {
|
|
89
|
+
let current = rootDir;
|
|
90
|
+
for (const component of relativePath.split("/")) {
|
|
91
|
+
current = path.join(current, component);
|
|
92
|
+
const stat = await fs.lstat(current).catch((error) => {
|
|
93
|
+
if (error?.code === "ENOENT") return null;
|
|
94
|
+
throw error;
|
|
95
|
+
});
|
|
96
|
+
if (stat?.isSymbolicLink()) throw new Error("code_intel cannot follow symlinks");
|
|
97
|
+
}
|
|
98
|
+
return path.join(rootDir, relativePath);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async function listGitFiles(rootDir) {
|
|
102
|
+
try {
|
|
103
|
+
const { stdout } = await execFileAsync(
|
|
104
|
+
"git",
|
|
105
|
+
["ls-files", "--cached", "--others", "--exclude-standard", "-z"],
|
|
106
|
+
{
|
|
107
|
+
cwd: rootDir,
|
|
108
|
+
encoding: "buffer",
|
|
109
|
+
maxBuffer: 4 * 1024 * 1024,
|
|
110
|
+
timeout: 10_000,
|
|
111
|
+
shell: false,
|
|
112
|
+
},
|
|
113
|
+
);
|
|
114
|
+
return stdout
|
|
115
|
+
.toString("utf8")
|
|
116
|
+
.split("\0")
|
|
117
|
+
.filter(Boolean)
|
|
118
|
+
.map((file) => file.replaceAll("\\", "/"));
|
|
119
|
+
} catch {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async function loadFallbackIgnorePatterns(rootDir) {
|
|
125
|
+
const content = await fs.readFile(path.join(rootDir, ".gitignore"), "utf8").catch(() => "");
|
|
126
|
+
return content
|
|
127
|
+
.split("\n")
|
|
128
|
+
.map((line) => line.trim())
|
|
129
|
+
.filter((line) => line && !line.startsWith("#") && !line.startsWith("!"));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function isFallbackIgnored(relativePath, patterns) {
|
|
133
|
+
const normalized = relativePath.split(path.sep).join("/");
|
|
134
|
+
return patterns.some((pattern) => {
|
|
135
|
+
const directoryPattern = pattern.endsWith("/") ? pattern.slice(0, -1) : pattern;
|
|
136
|
+
const escaped = directoryPattern.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
137
|
+
const expression = escaped
|
|
138
|
+
.replaceAll("**", ".*")
|
|
139
|
+
.replaceAll("*", "[^/]*")
|
|
140
|
+
.replaceAll("?", "[^/]");
|
|
141
|
+
const matcher = new RegExp(`(?:^|/)${expression}(?:/|$)`);
|
|
142
|
+
return (
|
|
143
|
+
matcher.test(normalized) ||
|
|
144
|
+
(!pattern.includes("/") && new RegExp(`(^|/)${expression}$`).test(normalized))
|
|
145
|
+
);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
22
148
|
|
|
149
|
+
async function walkFallback(rootDir, currentDir = rootDir, files = [], limit = 200, patterns = []) {
|
|
150
|
+
if (files.length >= limit) return files;
|
|
151
|
+
const entries = await fs.readdir(currentDir, { withFileTypes: true }).catch(() => []);
|
|
152
|
+
for (const entry of entries) {
|
|
153
|
+
if (files.length >= limit) break;
|
|
154
|
+
const absolutePath = path.join(currentDir, entry.name);
|
|
155
|
+
const relativePath = path.relative(rootDir, absolutePath);
|
|
156
|
+
if (isFallbackIgnored(relativePath, patterns)) continue;
|
|
23
157
|
if (entry.isDirectory()) {
|
|
24
|
-
if (ignoredDirs.has(entry.name)) {
|
|
25
|
-
|
|
158
|
+
if (!ignoredDirs.has(entry.name)) {
|
|
159
|
+
await walkFallback(rootDir, absolutePath, files, limit, patterns);
|
|
26
160
|
}
|
|
27
|
-
|
|
28
|
-
|
|
161
|
+
} else if (entry.isFile() && !isArtifactPath(relativePath)) {
|
|
162
|
+
files.push(relativePath.split(path.sep).join("/"));
|
|
29
163
|
}
|
|
164
|
+
}
|
|
165
|
+
return files;
|
|
166
|
+
}
|
|
30
167
|
|
|
31
|
-
|
|
32
|
-
|
|
168
|
+
async function listSafeFiles(rootDir, limit = 200) {
|
|
169
|
+
const gitFiles = await listGitFiles(rootDir);
|
|
170
|
+
const candidates =
|
|
171
|
+
gitFiles ??
|
|
172
|
+
(await walkFallback(rootDir, rootDir, [], limit, await loadFallbackIgnorePatterns(rootDir)));
|
|
173
|
+
const files = [];
|
|
174
|
+
for (const relativePath of candidates) {
|
|
175
|
+
if (files.length >= limit) break;
|
|
176
|
+
const normalized = normalizeRelative(relativePath);
|
|
177
|
+
if (isArtifactPath(normalized)) continue;
|
|
178
|
+
try {
|
|
179
|
+
const absolute = await assertSafeRepoPath(rootDir, normalized);
|
|
180
|
+
if (await isReadableTextFile(absolute)) files.push(normalized);
|
|
181
|
+
} catch {
|
|
182
|
+
// Ignore files that disappear or cannot be inspected.
|
|
33
183
|
}
|
|
34
|
-
files.push(path.relative(rootDir, path.join(currentDir, entry.name)));
|
|
35
184
|
}
|
|
36
|
-
|
|
37
185
|
return files;
|
|
38
186
|
}
|
|
39
187
|
|
|
@@ -42,52 +190,49 @@ export function listCodeIntelTools() {
|
|
|
42
190
|
}
|
|
43
191
|
|
|
44
192
|
export async function listRepoFiles(limit = 200) {
|
|
45
|
-
|
|
46
|
-
return walk(repoRoot, repoRoot, [], limit);
|
|
193
|
+
return listSafeFiles(getRepoRoot(), Math.max(1, Math.min(Number(limit) || 200, 2000)));
|
|
47
194
|
}
|
|
48
195
|
|
|
49
196
|
export async function searchRepoText(query, limit = 20) {
|
|
50
197
|
const repoRoot = getRepoRoot();
|
|
51
198
|
const files = await listRepoFiles(500);
|
|
52
199
|
const matches = [];
|
|
53
|
-
|
|
200
|
+
const boundedLimit = Math.max(1, Math.min(Number(limit) || 20, 100));
|
|
54
201
|
for (const relativePath of files) {
|
|
55
|
-
if (matches.length >=
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
|
|
202
|
+
if (matches.length >= boundedLimit) break;
|
|
59
203
|
try {
|
|
60
204
|
const content = await fs.readFile(path.join(repoRoot, relativePath), "utf8");
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (matches.length < limit && line.includes(query)) {
|
|
205
|
+
content.split("\n").forEach((line, index) => {
|
|
206
|
+
if (matches.length < boundedLimit && line.includes(query)) {
|
|
64
207
|
matches.push({ file: relativePath, line: index + 1, text: line.trim() });
|
|
65
208
|
}
|
|
66
209
|
});
|
|
67
210
|
} catch {
|
|
68
|
-
// Skip
|
|
211
|
+
// Skip files that disappear or fail the text boundary.
|
|
69
212
|
}
|
|
70
213
|
}
|
|
71
|
-
|
|
72
214
|
return matches;
|
|
73
215
|
}
|
|
74
216
|
|
|
75
217
|
export async function readRepoExcerpt(relativePath, line = 1, context = 2) {
|
|
76
218
|
const repoRoot = getRepoRoot();
|
|
77
|
-
const
|
|
219
|
+
const normalized = normalizeRelative(relativePath);
|
|
220
|
+
if (isArtifactPath(normalized))
|
|
221
|
+
throw new Error("code_intel cannot read generated or binary artifacts");
|
|
222
|
+
const absolutePath = await assertSafeRepoPath(repoRoot, normalized);
|
|
223
|
+
if (!(await isReadableTextFile(absolutePath)))
|
|
224
|
+
throw new Error("code_intel can only read bounded text files");
|
|
225
|
+
const content = await fs.readFile(absolutePath, "utf8");
|
|
226
|
+
const safeLine = Math.max(1, Number(line) || 1);
|
|
227
|
+
const safeContext = Math.max(0, Math.min(Number(context) || 2, 20));
|
|
78
228
|
const lines = content.split("\n");
|
|
79
|
-
const start = Math.max(0,
|
|
80
|
-
const end = Math.min(lines.length,
|
|
81
|
-
return lines.slice(start, end).map((text, index) => ({
|
|
82
|
-
line: start + index + 1,
|
|
83
|
-
text,
|
|
84
|
-
}));
|
|
229
|
+
const start = Math.max(0, safeLine - safeContext - 1);
|
|
230
|
+
const end = Math.min(lines.length, safeLine + safeContext);
|
|
231
|
+
return lines.slice(start, end).map((text, index) => ({ line: start + index + 1, text }));
|
|
85
232
|
}
|
|
86
233
|
|
|
87
234
|
export async function callCodeIntelTool(name, args = {}) {
|
|
88
|
-
if (name === "code_intel.list_files")
|
|
89
|
-
return listRepoFiles(args.limit);
|
|
90
|
-
}
|
|
235
|
+
if (name === "code_intel.list_files") return listRepoFiles(args.limit);
|
|
91
236
|
if (name === "code_intel.search_text") {
|
|
92
237
|
if (typeof args.query !== "string" || args.query.trim() === "") {
|
|
93
238
|
throw new Error("code_intel.search_text requires a non-empty query");
|
|
@@ -100,7 +245,6 @@ export async function callCodeIntelTool(name, args = {}) {
|
|
|
100
245
|
}
|
|
101
246
|
return readRepoExcerpt(args.file, args.line, args.context);
|
|
102
247
|
}
|
|
103
|
-
|
|
104
248
|
throw new Error(`Unknown code_intel tool: ${name}`);
|
|
105
249
|
}
|
|
106
250
|
|
|
@@ -108,6 +252,6 @@ export async function checkCodeIntelCapability() {
|
|
|
108
252
|
const files = await listRepoFiles(10);
|
|
109
253
|
return {
|
|
110
254
|
ready: files.length > 0,
|
|
111
|
-
detail: `code intel indexed ${files.length}
|
|
255
|
+
detail: `code intel indexed ${files.length} bounded text file(s) with Git-ignore and artifact filtering`,
|
|
112
256
|
};
|
|
113
257
|
}
|