@thinkingai/ae-cli 6.0.53 → 6.0.54
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 +28 -9
- package/README.zh.md +25 -9
- package/bin/ae-cli.js +6 -1
- package/cli-installation-guide.md +91 -0
- package/dist/{auth-LHM7NQPR.js → auth-MBWRZTB6.js} +9 -11
- package/dist/automation-NWWVLWG2.js +459 -0
- package/dist/{capability-F2RIR5DS.js → capability-7SSN6PNZ.js} +6 -6
- package/dist/chunk-4655PUNX.js +43 -0
- package/dist/{chunk-KS4DE3MX.js → chunk-5XJYLEVC.js} +4 -4
- package/dist/{chunk-N4BLPJC7.js → chunk-7QXISROD.js} +1 -1
- package/dist/{chunk-7WZACOAI.js → chunk-AP7YP2NX.js} +2 -2
- package/dist/{chunk-SO5LKIWP.js → chunk-CT7QDJS6.js} +2 -2
- package/dist/chunk-D6ACFILC.js +56 -0
- package/dist/{chunk-QYXDJOLA.js → chunk-EOYSKMXN.js} +19 -11
- package/dist/{chunk-5XRQ3CZR.js → chunk-FMNNGNYO.js} +43 -8
- package/dist/{chunk-DU72X2IO.js → chunk-GIK6EDUG.js} +22 -10
- package/dist/{chunk-PGCIKZRE.js → chunk-HBLK3ZHW.js} +3 -3
- package/dist/chunk-HVHR4SCP.js +133 -0
- package/dist/{chunk-BW7JUDEI.js → chunk-KFNMQTZI.js} +514 -213
- package/dist/{chunk-KJDOTPYU.js → chunk-PLE722AJ.js} +28 -11
- package/dist/chunk-RK6GLDGI.js +27 -0
- package/dist/{chunk-GK7WDY7E.js → chunk-S6M42KND.js} +1 -1
- package/dist/{chunk-IG3DYEIR.js → chunk-UQ77JXYH.js} +4 -3
- package/dist/{chunk-YVGXGTD6.js → chunk-WNGFSIOB.js} +7 -1
- package/dist/{chunk-647BRKZK.js → chunk-ZIQWCZTS.js} +3 -3
- package/dist/{community-report-client-6VJDDMJJ.js → community-report-client-PEERQCX2.js} +1 -1
- package/dist/{config-XQWOPDHN.js → config-FF6YVJKI.js} +8 -8
- package/dist/context-YAE3QXP3.js +136 -0
- package/dist/{data-integration-XBTCGXQT.js → data-integration-HESZET7E.js} +6 -6
- package/dist/index.js +125 -48
- package/dist/{local-data-upload-client-3P7NIVQ4.js → local-data-upload-client-TWMHFLUA.js} +1 -1
- package/dist/memory-62BJOULV.js +580 -0
- package/dist/{metadata-V5ZDTKWZ.js → metadata-7CUMWIB4.js} +7 -7
- package/dist/{model-ZS7HVGKN.js → model-SBV2JFJI.js} +9 -5
- package/dist/{personal-semantic-preference-2XANU3F6.js → personal-semantic-preference-6SRCYPGE.js} +117 -11
- package/dist/{project-semantic-LP3LY7QP.js → project-semantic-YYEM4OSU.js} +6 -6
- package/dist/{sync-EQLSTUS7.js → sync-SU33KYX7.js} +12 -8
- package/dist/{te-agent-Z3HCTKR7.js → te-agent-F5QBZSQA.js} +90 -454
- package/dist/{te-analysis-3EVYQ3IO.js → te-analysis-U4I2W2WC.js} +297 -20
- package/dist/{te-community-Z7JACGF3.js → te-community-PFLDLPP4.js} +3 -3
- package/dist/{te-dataops-F7GQOIS6.js → te-dataops-FOQSRIAZ.js} +5 -5
- package/dist/{te-engage-LFBU6WWH.js → te-engage-ZX76CNAB.js} +6 -6
- package/dist/{te-kb-QJLJEX5K.js → te-kb-MHDOST62.js} +494 -214
- package/dist/{te-system-IXC43QHZ.js → te-system-J2FQF5ER.js} +6 -6
- package/dist/{te-team-BIZIKIHZ.js → te-team-5UOZPTU3.js} +6 -6
- package/dist/things-VPPXXLHB.js +1091 -0
- package/dist/{update-W2SGQNKT.js → update-EEUTEI6R.js} +59 -51
- package/dist/workspace-O3EEIYQM.js +554 -0
- package/package.json +21 -9
- package/skills/ae-agent/SKILL.md +89 -139
- package/skills/ae-agent/references/add-model.md +1 -1
- package/skills/ae-agent/references/create-agent.md +1 -1
- package/skills/ae-agent/references/find-archived-conversations.md +12 -5
- package/skills/ae-agent/references/get-agent.md +1 -1
- package/skills/ae-agent/references/list-agents.md +2 -2
- package/skills/ae-agent/references/list-models.md +2 -2
- package/skills/ae-agent/references/restore-conversation.md +3 -1
- package/skills/ae-analysis/SKILL.md +15 -6
- package/skills/ae-analysis/references/ai_models/funnel.md +5 -3
- package/skills/ae-analysis/references/ai_models.md +27 -0
- package/skills/ae-analysis/references/command_index.md +12 -4
- package/skills/ae-analysis/references/dashboard_move.md +21 -0
- package/skills/ae-analysis/references/dashboard_report_add.md +2 -0
- package/skills/ae-analysis/references/dashboard_report_get.md +19 -0
- package/skills/ae-analysis/references/dashboard_report_update.md +27 -0
- package/skills/ae-analysis/references/dashboard_update.md +1 -1
- package/skills/ae-analysis/references/event_report_presentation.md +76 -0
- package/skills/ae-analysis/references/feedback_submit.md +37 -0
- package/skills/ae-analysis/references/metadata_resolution.md +15 -0
- package/skills/ae-analysis/references/personal_semantic_preference_review.md +9 -0
- package/skills/ae-analysis/references/personal_semantic_preference_review_list.md +7 -0
- package/skills/ae-analysis/references/personal_semantic_preference_submit.md +7 -0
- package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +90 -31
- package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +99 -1
- package/skills/ae-analysis/references/report_create.md +13 -3
- package/skills/ae-analysis/references/report_get.md +5 -1
- package/skills/ae-analysis/references/report_update.md +15 -4
- package/skills/ae-analysis/references/system_query_monitor_overview.md +2 -0
- package/skills/ae-analysis/references/system_query_task_cancel.md +2 -0
- package/skills/ae-analysis/references/system_query_task_export.md +6 -2
- package/skills/ae-analysis/references/system_query_task_get.md +2 -0
- package/skills/ae-analysis/references/system_query_task_list.md +7 -3
- package/skills/ae-analysis/references/system_query_task_options.md +2 -2
- package/skills/ae-analysis/references/system_query_task_realtime_list.md +15 -0
- package/skills/ae-analysis/references/user_tag_models.md +2 -0
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-empty-skeleton.mjs +105 -0
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +669 -29
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +21 -8
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +28 -10
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +66 -0
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +285 -24
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/package-wiki-source-zip.mjs +262 -30
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/plan-kb-source-sync.mjs +1 -1
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/precompiled-source.mjs +46 -2
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/prepare-compile-schema.mjs +64 -0
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/refresh-state-parts.mjs +91 -0
- package/skills/ae-automation/SKILL.md +16 -0
- package/skills/ae-automation/references/cli.md +53 -0
- package/skills/ae-automation/references/command_index.md +17 -0
- package/skills/ae-capability/SKILL.md +15 -6
- package/skills/ae-current-context/SKILL.md +3 -2
- package/skills/ae-kb/SKILL.md +62 -12
- package/skills/ae-kb/references/analysis-workflow.md +73 -36
- package/skills/ae-kb/references/query-workflow.md +67 -33
- package/skills/ae-kb/references/schema-import.md +5 -3
- package/skills/ae-kb/references/source-mutations.md +6 -4
- package/skills/ae-kb/references/text-sources.md +53 -0
- package/skills/ae-kb-discovery/SKILL.md +1 -1
- package/skills/ae-team/SKILL.md +23 -17
- package/skills/ae-things/SKILL.md +85 -0
- package/skills/ae-things/references/cli.md +103 -0
- package/skills/ae-things-progress/SKILL.md +43 -0
- package/skills/ae-things-review/SKILL.md +42 -0
- package/skills/ae-workspace/SKILL.md +43 -0
- package/skills/ae-workspace/references/commands.md +51 -0
- package/dist/chunk-E2JKXMVO.js +0 -29
- package/dist/context-M3HDGEIR.js +0 -46
- package/dist/memory-6APEB2JB.js +0 -892
- package/skills/ae-agent/references/create-automation.md +0 -125
- package/skills/ae-agent/references/list-automations.md +0 -56
- package/skills/ae-agent/references/update-automation.md +0 -107
|
@@ -12,6 +12,8 @@ ae-cli system query-monitor overview --company-id <company-id> --cluster-names '
|
|
|
12
12
|
|
|
13
13
|
Capability id: `system.query_monitor.overview`.
|
|
14
14
|
|
|
15
|
+
Selected project IDs and space codes must belong to the supplied company. A different company's scope is rejected before chart data is read.
|
|
16
|
+
|
|
15
17
|
The response uses `ok`, `data`, and `meta`. Treat empty `data` as success when `ok=true`; preserve `request_id` and `invocation_id` when present.
|
|
16
18
|
|
|
17
19
|
## Parameters
|
|
@@ -13,6 +13,8 @@ ae-cli system query-task cancel --company-id <company-id> --task-id <task-id> --
|
|
|
13
13
|
|
|
14
14
|
Capability id: `system.query_task.cancel`.
|
|
15
15
|
|
|
16
|
+
The task must belong to `--company-id` by project or workspace. A foreign-company or missing task ID is rejected before cancellation.
|
|
17
|
+
|
|
16
18
|
Run `--dry-run` first, summarize the affected target and impact, then wait for explicit user confirmation before rerunning the unchanged command with global `--yes`.
|
|
17
19
|
|
|
18
20
|
The response uses `ok`, `data`, and `meta`. Treat empty `data` as success when `ok=true`; preserve `request_id` and `invocation_id` when present.
|
|
@@ -12,6 +12,10 @@ ae-cli system query-task export --company-id <company_id> --start-time '2026-07-
|
|
|
12
12
|
|
|
13
13
|
Capability id: `system.query_task.export`.
|
|
14
14
|
|
|
15
|
+
Selected project IDs and space codes must belong to the supplied company. A different company's scope is rejected before an export is submitted.
|
|
16
|
+
|
|
17
|
+
The time range has the same completion-time semantics as [`query-task list`](system_query_task_list.md): inclusive boundary seconds, including milliseconds within the end second, and a maximum 31-day window. The CSV `start_time` is task initiation time, not the timestamp used for range filtering.
|
|
18
|
+
|
|
15
19
|
If the required filter mappings are unknown, call `ae-cli system query-task options --company-id <company_id>` once. Reuse verified mappings within the same company/project scope; do not guess filter codes or cluster names.
|
|
16
20
|
|
|
17
21
|
Use `--output` to wait and download the completed artifact. If interrupted, resume with `ae-cli analysis run wait --run-id <run_id> --output <file>` using the same export response. See [`run_wait.md`](run_wait.md).
|
|
@@ -25,8 +29,8 @@ The response uses `ok`, `data`, and `meta`. Empty task data is a successful expo
|
|
|
25
29
|
| Parameter | Required | Description |
|
|
26
30
|
|---|---|---|
|
|
27
31
|
| `--company-id` | Yes | Company ID. |
|
|
28
|
-
| `--start-time` | Yes | Inclusive range start in `yyyy-MM-dd HH:mm:ss`. |
|
|
29
|
-
| `--end-time` | Yes | Inclusive range end in `yyyy-MM-dd HH:mm:ss`. |
|
|
32
|
+
| `--start-time` | Yes | Inclusive completion-time range start in `yyyy-MM-dd HH:mm:ss`. |
|
|
33
|
+
| `--end-time` | Yes | Inclusive completion-time range end, including the entire second, in `yyyy-MM-dd HH:mm:ss`. |
|
|
30
34
|
| `--status-codes` | Yes | Non-empty task status-code JSON array. |
|
|
31
35
|
| `--content-codes` | Yes | Non-empty query content-code JSON array. |
|
|
32
36
|
| `--task-type-codes` | Yes | Non-empty query task-type-code JSON array. |
|
|
@@ -12,6 +12,8 @@ ae-cli system query-task get --company-id <company-id> --task-id <task-id>
|
|
|
12
12
|
|
|
13
13
|
Capability id: `system.query_task.get`.
|
|
14
14
|
|
|
15
|
+
The task must belong to `--company-id` by project or workspace. A foreign-company or missing task ID is rejected before details are read.
|
|
16
|
+
|
|
15
17
|
The response uses `ok`, `data`, and `meta`. Treat empty `data` as success when `ok=true`; preserve `request_id` and `invocation_id` when present.
|
|
16
18
|
|
|
17
19
|
## Parameters
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# system query-task list
|
|
2
2
|
|
|
3
|
-
Use when the user needs
|
|
3
|
+
Use when the user needs historical query logs within a mandatory bounded time range. For the realtime monitoring tab, use `ae-cli system query-task realtime-list` instead.
|
|
4
4
|
|
|
5
5
|
Do not use it outside the system query-task operation or with fields absent from the inspected capability schema.
|
|
6
6
|
|
|
@@ -14,6 +14,10 @@ Capability id: `system.query_task.list`.
|
|
|
14
14
|
|
|
15
15
|
If the required filter mappings are unknown, call `ae-cli system query-task options --company-id <company_id>` once. Reuse verified mappings within the same company/project scope; do not guess filter codes or cluster names.
|
|
16
16
|
|
|
17
|
+
Project IDs and workspace codes must belong to `--company-id`; foreign-company values are rejected before querying. The global system-project ID `-1` cannot be selected as a company-scoped project.
|
|
18
|
+
|
|
19
|
+
The range filters query **completion time**, not the returned `start_time` (task initiation time). Both boundary seconds are inclusive, including milliseconds within the end second. A task started before the window can appear if it completed inside it. Compare list and export using the same completion-time window; do not reject rows solely because `start_time` is outside it. The range must not exceed 31 days.
|
|
20
|
+
|
|
17
21
|
The response uses `ok`, `data`, and `meta`. Treat empty `data` as success when `ok=true`; preserve `request_id` and `invocation_id` when present.
|
|
18
22
|
|
|
19
23
|
## Parameters
|
|
@@ -21,8 +25,8 @@ The response uses `ok`, `data`, and `meta`. Treat empty `data` as success when `
|
|
|
21
25
|
| Parameter | Required | Description |
|
|
22
26
|
|---|---|---|
|
|
23
27
|
| `--company-id` | Yes | Company ID. |
|
|
24
|
-
| `--start-time` | Yes | Inclusive lower bound in `yyyy-MM-dd HH:mm:ss`. |
|
|
25
|
-
| `--end-time` | Yes | Inclusive upper bound in `yyyy-MM-dd HH:mm:ss`. |
|
|
28
|
+
| `--start-time` | Yes | Inclusive completion-time lower bound in `yyyy-MM-dd HH:mm:ss`. |
|
|
29
|
+
| `--end-time` | Yes | Inclusive completion-time upper bound, including the entire second, in `yyyy-MM-dd HH:mm:ss`. |
|
|
26
30
|
| `--project-ids` | Conditional | Non-empty project IDs or space codes are required. |
|
|
27
31
|
| `--space-codes` | Conditional | Non-empty space codes or project IDs are required. |
|
|
28
32
|
| `--status-codes` | Yes | Task status-code JSON array. |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# system query-task options
|
|
2
2
|
|
|
3
|
-
Use before query-task list or export to discover
|
|
3
|
+
Use before query-task list, realtime-list, or export to discover valid filter values exposed by the current environment.
|
|
4
4
|
|
|
5
5
|
Command:
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@ The response maps:
|
|
|
18
18
|
- `projects[].project_id` and `workspaces[].space_code` to display names.
|
|
19
19
|
- `clusters[].cluster_name` to its query engine metadata.
|
|
20
20
|
|
|
21
|
-
Use the returned codes and names unchanged in `query-task list` or `query-task export`. Do not infer codes from UI labels or examples.
|
|
21
|
+
Project and workspace options are limited to `--company-id`; status, content, task type, and cluster codes remain discoverable. Use the returned codes and names unchanged in `query-task list`, `query-task realtime-list`, or `query-task export`. Discovery does not authorize a project or workspace; execution still checks company ownership. Do not infer codes from UI labels or examples.
|
|
22
22
|
|
|
23
23
|
## Parameters
|
|
24
24
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# system query-task realtime-list
|
|
2
|
+
|
|
3
|
+
Use for a one-time snapshot of the Query Monitor **Realtime Query** tab. The existing `query-task list` command is for historical **Query Logs** and requires a fixed start/end range. Do not substitute one for the other.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
ae-cli system query-task realtime-list --company-id <company_id> --project-ids '[123]' --cluster-names '["cluster-a"]' --duration-minutes 30 --limit 100
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Capability ID: `system.query_task.realtime_list`. Run `ae-cli system query-task options --company-id <company_id>` first if IDs, status codes, or cluster names are unknown. Discovery does not grant access; a project or workspace outside the company is rejected during execution.
|
|
10
|
+
|
|
11
|
+
The global system-project ID `-1` cannot be selected as a company-scoped project. System tasks tied to a company workspace remain visible through that workspace where applicable.
|
|
12
|
+
|
|
13
|
+
Provide at least one non-empty `--project-ids` or `--space-codes` JSON array, and a non-empty `--cluster-names` JSON array. `--duration-minutes` defaults to 30 (range 1–30). Optional `--status-codes` filters task states. `--limit` defaults to 100 (maximum 200). This command does not poll or cancel tasks.
|
|
14
|
+
|
|
15
|
+
The response contains `items`, `limit`, `has_more`, and `snapshot_at`. `has_more` means the bounded snapshot has additional matching rows, not a full historical count. Task rows omit credentials, user identity tokens, internal SQL gateway selection, and SQL text. To inspect one task, use `query-task get`; cancel remains a separate high-risk operation requiring confirmation.
|
|
@@ -62,6 +62,8 @@ From a fixed date through today:
|
|
|
62
62
|
|
|
63
63
|
## SQL tag
|
|
64
64
|
|
|
65
|
+
Return one row per distinct analysis-subject ID, with the tag value in the second column; a list tag requires a native SQL `ARRAY(varchar)` value, not a JSON string or repeated scalar rows. The server infers the tag type from that column, so do not add `selectType`; aggregate repeated subjects in the SQL itself, for example with `array_agg(DISTINCT CAST(value AS varchar))` and `GROUP BY` the subject ID.
|
|
66
|
+
|
|
65
67
|
```json
|
|
66
68
|
{"type":"sql","sql":"SELECT \"#user_id\", 'payer' AS tag_value FROM hive.ta.v_event_1 WHERE ${PartDate:partdate} AND \"$part_event\"='pay'","params":[{"name":"partdate","type":"part_date","recent_day":"1-7"}]}
|
|
67
69
|
```
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { execFileSync } from 'node:child_process';
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { normalizeSourceForHash } from './precompiled-source.mjs';
|
|
7
|
+
|
|
8
|
+
const args = Object.fromEntries(process.argv.slice(2).reduce((pairs, part, index, all) => {
|
|
9
|
+
if (part.startsWith('--') && all[index + 1] && !all[index + 1].startsWith('--')) {
|
|
10
|
+
pairs.push([part.slice(2), all[index + 1]]);
|
|
11
|
+
}
|
|
12
|
+
return pairs;
|
|
13
|
+
}, []));
|
|
14
|
+
const packageRoot = path.resolve(required('asset-package'));
|
|
15
|
+
const outputRoot = path.resolve(required('output'));
|
|
16
|
+
const descriptor = readJson(path.join(packageRoot, '.asset-package.json'));
|
|
17
|
+
const manifest = readJson(path.join(packageRoot, 'manifest.json'));
|
|
18
|
+
const projectId = Number(descriptor.project_id ?? manifest.project_id);
|
|
19
|
+
const projectName = String(args['project-name'] || descriptor.project_name || manifest.project_name || '')
|
|
20
|
+
.replace(/\s+/g, ' ').trim();
|
|
21
|
+
const snapshotHash = String(descriptor.snapshot_hash ?? manifest.snapshot_hash ?? '');
|
|
22
|
+
const scope = String(descriptor.asset_scope ?? manifest.asset_scope ?? '');
|
|
23
|
+
const policy = descriptor.filter_policy ?? manifest.filter_policy ?? {};
|
|
24
|
+
if (String(descriptor.schema_version ?? manifest.schema_version) !== '3.0'
|
|
25
|
+
|| descriptor.truncated === true || manifest.truncated === true
|
|
26
|
+
|| scope !== 'governed' || policy.authenticated_entry_assets_only !== true
|
|
27
|
+
|| policy.dependency_closure !== true || !Number.isSafeInteger(projectId) || projectId < 1
|
|
28
|
+
|| !projectName || !/^[0-9a-f]{64}$/i.test(snapshotHash)) {
|
|
29
|
+
throw new Error('A complete governed schema 3.0 package with valid project identity is required.');
|
|
30
|
+
}
|
|
31
|
+
for (const name of ['dashboard-catalog', 'report-catalog', 'metric-catalog']) {
|
|
32
|
+
if (readJsonl(path.join(packageRoot, 'indexes', `${name}.jsonl`)).length) {
|
|
33
|
+
throw new Error(`The ${name} is not empty; use the normal semantic Wiki builder.`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (readJsonl(path.join(packageRoot, 'sources', 'adopted-personal-semantics.jsonl')).length) {
|
|
37
|
+
throw new Error('Adopted personal semantics are present; the empty skeleton is not applicable.');
|
|
38
|
+
}
|
|
39
|
+
if (fs.existsSync(outputRoot)) throw new Error('Output already exists.');
|
|
40
|
+
const flatRoot = path.join(outputRoot, 'flat');
|
|
41
|
+
fs.mkdirSync(flatRoot, { recursive: true });
|
|
42
|
+
const namespace = `pskb-p${projectId}`;
|
|
43
|
+
const facts = [
|
|
44
|
+
['index', 'index', 'index.md', `# ${projectName} project semantic knowledge base\n\n- Project overview: project identity and current evidence boundary.\n- Shared project knowledge: no verified shared facts yet.\n- Business domains: none established from governed sources yet.\n- Event and asset catalog: no certified entry assets yet.\n- Governance and provenance: source scope and update policy.\n\nThis is an empty knowledge skeleton. It does not establish business facts or authorize use of uncertified assets.\n`],
|
|
45
|
+
['wiki-project-overview', 'wiki-page', 'wiki/project-overview.md', `# Project overview\n\nProject: ${projectName} (ID ${projectId}). Business positioning, audience, objects, relationships, and decision paths are not established by the current governed sources. Add verified project material before using this knowledge base for business conclusions.\n`],
|
|
46
|
+
['common-index', 'common', 'wiki/common/index.md', '# Shared project knowledge\n\nNo verified project-wide knowledge is available yet. Human-authored material may be added under the project and business source directories with provenance and scope.\n'],
|
|
47
|
+
['domain-index', 'domain', 'wiki/domains/index.md', '# Business domains\n\nNo business domain is established by the current governed sources. Do not infer domains from project names or unverified assets.\n'],
|
|
48
|
+
['asset-index-index', 'asset-index', 'wiki/asset-index/index.md', '# Event and asset catalog\n\nNo certified entry asset is available in this governed snapshot. Do not switch to all visible assets without an explicit user request.\n'],
|
|
49
|
+
['governance-index', 'governance', 'wiki/governance/index.md', `# Governance and provenance\n\nProject ID: ${projectId}. Source scope: governed. Certified entry assets: 0. Adopted personal semantics: 0. Business facts remain unknown until verified sources are added. A later refresh must replace this empty-source state when governed evidence becomes available and preserve unrelated human sources.\n`],
|
|
50
|
+
];
|
|
51
|
+
const refreshState = {
|
|
52
|
+
schema_version: '1.0',
|
|
53
|
+
empty_skeleton: true,
|
|
54
|
+
semantic_project_id: projectId,
|
|
55
|
+
source_snapshot_hash: snapshotHash,
|
|
56
|
+
};
|
|
57
|
+
facts.push(['refresh-state', 'refresh-state', 'refresh-state.md',
|
|
58
|
+
`# Project semantic refresh state\n\n<!-- pskb_refresh_state_base64\n${Buffer.from(JSON.stringify(refreshState)).toString('base64url')}\n-->\n`]);
|
|
59
|
+
const sources = facts.map(([stem, sourceKind, sourcePath, content]) => {
|
|
60
|
+
const file = `${namespace}-${stem}.md`;
|
|
61
|
+
fs.writeFileSync(path.join(flatRoot, file), content);
|
|
62
|
+
return {
|
|
63
|
+
display_name: file, file, namespace, snapshot_hash: snapshotHash,
|
|
64
|
+
source_kind: sourceKind, asset_type: null, asset_key: null,
|
|
65
|
+
title: content.split('\n')[0].replace(/^# /, ''), source_path: sourcePath,
|
|
66
|
+
content_hash: createHash('sha256').update(normalizeSourceForHash(content)).digest('hex'),
|
|
67
|
+
semantic_plan_fragment_refs: [],
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
fs.writeFileSync(path.join(flatRoot, 'kb-upload-manifest.json'), JSON.stringify({
|
|
71
|
+
schema_version: '1.0',
|
|
72
|
+
manifest_kind: 'ae_project_semantic_kb_upload_sources',
|
|
73
|
+
navigation_taxonomy_version: 'empty-skeleton-1.0',
|
|
74
|
+
namespace,
|
|
75
|
+
semantic_project_id: projectId,
|
|
76
|
+
project_name: projectName,
|
|
77
|
+
snapshot_hash: snapshotHash,
|
|
78
|
+
semantic_plan_state: { schema_version: null, plan_hash: null, fragment_count: 0, fragments: [] },
|
|
79
|
+
source_count: sources.length,
|
|
80
|
+
sources,
|
|
81
|
+
}, null, 2));
|
|
82
|
+
const packager = path.join(import.meta.dirname, 'package-wiki-source-zip.mjs');
|
|
83
|
+
const archive = path.join(outputRoot, 'empty-skeleton.zip');
|
|
84
|
+
const tree = path.join(outputRoot, 'source-tree');
|
|
85
|
+
const sourceManifest = path.join(outputRoot, 'source-tree-manifest.json');
|
|
86
|
+
execFileSync(process.execPath, [packager, '--source-dir', flatRoot, '--tree-output', tree,
|
|
87
|
+
'--manifest-output', sourceManifest, '--output', archive, '--embed-refresh-state-baseline'], {
|
|
88
|
+
stdio: 'pipe',
|
|
89
|
+
});
|
|
90
|
+
process.stdout.write(JSON.stringify({
|
|
91
|
+
project_id: projectId, project_name: projectName, archive,
|
|
92
|
+
source_tree: tree, manifest: sourceManifest, source_count: sources.length,
|
|
93
|
+
}, null, 2) + '\n');
|
|
94
|
+
|
|
95
|
+
function required(name) {
|
|
96
|
+
if (!args[name]) throw new Error(`--${name} is required.`);
|
|
97
|
+
return args[name];
|
|
98
|
+
}
|
|
99
|
+
function readJson(file) {
|
|
100
|
+
return JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
101
|
+
}
|
|
102
|
+
function readJsonl(file) {
|
|
103
|
+
const rows = fs.readFileSync(file, 'utf8').split(/\r?\n/).filter(Boolean).map((line) => JSON.parse(line));
|
|
104
|
+
return rows.filter((row) => row.record_type !== 'header');
|
|
105
|
+
}
|