@danypops/papyrus 0.44.9 → 0.44.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/src/artifact/artifact.ts +23 -0
- package/src/cli/artifact-command.ts +210 -0
- package/src/cli/discuss-command.ts +256 -0
- package/src/cli/docs-command.ts +192 -0
- package/src/cli/gates-command.ts +46 -0
- package/src/cli/graph-command.ts +171 -0
- package/src/cli/graph-projection-command.ts +79 -0
- package/src/cli/log-command.ts +101 -0
- package/src/cli/migration-command.ts +40 -0
- package/src/cli/note-command.ts +186 -0
- package/src/cli/playbooks-command.ts +313 -0
- package/src/cli/rules-command.ts +220 -0
- package/src/cli/session-identity-command.ts +58 -0
- package/src/cli/shared.ts +5 -0
- package/src/cli/stricli-run.ts +30 -0
- package/src/cli/task-command.ts +892 -0
- package/src/cli.ts +30 -1912
- package/src/handlers/discuss.ts +22 -20
- package/src/handlers/docs.ts +4 -30
- package/src/handlers/notes.ts +2 -29
- package/src/handlers/playbooks.ts +27 -92
- package/src/handlers/rules.ts +4 -30
- package/src/handlers/shared.ts +92 -1
- package/src/handlers/tasks.ts +31 -118
- package/src/modules/discuss.ts +5 -26
- package/src/modules/docs.ts +6 -23
- package/src/modules/graph-projection.ts +1 -8
- package/src/modules/logs.ts +1 -22
- package/src/modules/notes.ts +1 -22
- package/src/modules/operation-input.ts +42 -0
- package/src/modules/playbooks.ts +6 -23
- package/src/modules/rules.ts +6 -23
- package/src/modules/session-identity.ts +1 -15
- package/src/modules/tasks.ts +5 -33
- package/src/service.ts +1 -28
package/src/service.ts
CHANGED
|
@@ -25,6 +25,7 @@ import { DOCS_OPERATION_NAMES, docsOperations } from "./modules/docs.ts";
|
|
|
25
25
|
import { GRAPH_PROJECTION_OPERATION_NAMES, graphProjectionOperations } from "./modules/graph-projection.ts";
|
|
26
26
|
import { LOGS_OPERATION_NAMES, logsOperations } from "./modules/logs.ts";
|
|
27
27
|
import { NOTES_OPERATION_NAMES, notesOperations } from "./modules/notes.ts";
|
|
28
|
+
import { type OperationInput, optionalNumber, optionalString, string } from "./modules/operation-input.ts";
|
|
28
29
|
import { PLAYBOOKS_OPERATION_NAMES, playbooksOperations } from "./modules/playbooks.ts";
|
|
29
30
|
import { RULES_OPERATION_NAMES, rulesOperations } from "./modules/rules.ts";
|
|
30
31
|
import { SESSION_IDENTITY_OPERATION_NAMES, sessionIdentityOperations } from "./modules/session-identity.ts";
|
|
@@ -99,7 +100,6 @@ export const EXPECTED_OPERATION_NAMES = [
|
|
|
99
100
|
] as const;
|
|
100
101
|
|
|
101
102
|
export type OperationName = (typeof EXPECTED_OPERATION_NAMES)[number];
|
|
102
|
-
type OperationInput = Record<string, unknown>;
|
|
103
103
|
type OperationHandler = (input: OperationInput) => unknown;
|
|
104
104
|
|
|
105
105
|
export class UnknownOperationError extends Error {}
|
|
@@ -107,33 +107,6 @@ export class MigrationRequiredError extends Error {}
|
|
|
107
107
|
export class PayloadTooLargeError extends Error {}
|
|
108
108
|
export { InvalidSessionSecretError };
|
|
109
109
|
|
|
110
|
-
function string(input: OperationInput, key: string): string {
|
|
111
|
-
const value = input[key];
|
|
112
|
-
if (typeof value !== "string" || value.length === 0) throw new Error(`${key} is required`);
|
|
113
|
-
return value;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function optionalString(input: OperationInput, key: string): string | undefined {
|
|
117
|
-
const value = input[key];
|
|
118
|
-
if (value === undefined) return undefined;
|
|
119
|
-
if (typeof value !== "string") throw new Error(`${key} must be a string`);
|
|
120
|
-
return value;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function _optionalStringArray(input: OperationInput, key: string): string[] | undefined {
|
|
124
|
-
const value = input[key];
|
|
125
|
-
if (value === undefined) return undefined;
|
|
126
|
-
if (!Array.isArray(value) || value.some((entry) => typeof entry !== "string")) throw new Error(`${key} must be an array of strings`);
|
|
127
|
-
return value as string[];
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function optionalNumber(input: OperationInput, key: string): number | undefined {
|
|
131
|
-
const value = input[key];
|
|
132
|
-
if (value === undefined) return undefined;
|
|
133
|
-
if (typeof value !== "number" || !Number.isFinite(value)) throw new Error(`${key} must be a number`);
|
|
134
|
-
return value;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
110
|
function normalizeCreateInput(input: OperationInput): CreateArtifactInput {
|
|
138
111
|
const { template_id, ...rest } = input;
|
|
139
112
|
return { ...rest, templateId: typeof template_id === "string" ? template_id : undefined } as CreateArtifactInput;
|